Build all Next.js workspaces in a monorepo in parallel, fix build errors iteratively, then commit and push the whole monorepo. Discovers Next.js subprojects by finding next.config.* files, spawns a subagent per workspace to build and fix, then commits and pushes once all pass.
Validate Next.js workspaces in a monorepo by building them in parallel, fix build errors, then commit and push ALL changes across the entire repo (including non-Next.js code like Python, config, etc.).
Only Next.js subprojects are build-gated. Everything else is committed as-is.
Find all Next.js subprojects in the repo:
find . -name "next.config.*" -not -path "*/node_modules/*" -not -path "*/.next/*"
For each match, the workspace root is the directory containing the next.config file. If no Next.js workspaces are found, skip straight to the commit step.
Spawn one Agent subagent per workspace. Each subagent should:
cdnpm audit fix --force to ensure dependencies are cleannpm run buildnpm run build. Repeat until the build succeeds or only ignorable errors remain.Launch ALL workspace subagents in a single message (parallel). Each subagent prompt should include:
npm run build, fix errors, and loop until passingWait for all subagents to complete before proceeding.
If any workspace failed to build after 10 attempts, report the failures to the user and ask how to proceed. Do NOT commit if any workspace has real (non-ignorable) build failures.
Once all Next.js workspaces pass (or there are none), commit everything in the repo that has changed — Next.js code, Python code, config files, training scripts, whatever.
git status and git diff to understand all changes.git log --oneline -5 to match the repo's commit message style.git add (use specific file names, not git add -A).git commit -m "$(cat <<'EOF'
<descriptive message>
EOF
)"
git push
Tell the user:
User: /commit-monorepo
-> Discover workspaces, build all in parallel, fix errors, commit, push.
User: /commit-monorepo update dashboard and API
-> Discover workspaces, build all in parallel, fix errors, commit with message incorporating "update dashboard and API", push.