Build and Run Makefile
Create a Makefile with dev and build targets that match the project's real commands. The Makefile must use the repo's package manager and scripts.
Determine the package manager
- •Read
package.jsonand check thepackageManagerfield. Use it if present. - •If missing, infer from lockfiles (prefer the most specific signal):
- •
bun.lockborbun.lock - •
pnpm-lock.yaml - •
yarn.lock - •
package-lock.json
- •
- •If multiple signals exist or none are found, ask the user before proceeding.
Determine dev and build commands
- •Read
package.jsonscripts in the project root that owns the app (monorepos usually define root scripts that proxy to packages). - •Use
devfor development andbuildfor builds when available. - •If a script is missing, search for a clear alternative (
start,serve,preview, or framework docs) and confirm with the user when ambiguous. - •Form the command using the package manager:
- •Bun:
bun run <script> - •Pnpm:
pnpm <script> - •Yarn:
yarn <script> - •Npm:
npm run <script>
- •Bun:
Create or update Makefile
- •Create or update
Makefilein the repo root. - •Add
.PHONY: dev build. - •
devruns the resolved dev command. - •
buildruns the resolved build command. - •Do not leave placeholders; write the final commands.
- •Preserve any existing targets not related to
devorbuild.
Stop and ask when needed
If the package manager or commands cannot be determined confidently, stop and ask the user for clarification before editing files.