create-claude-workspace 1.1.107 → 1.1.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ Authenticate on your host first (`claude auth login`), or pass an API key.
|
|
|
67
67
|
| `technical-planner` | Translates PRODUCT.md into phased TODO.md (with quality validation) |
|
|
68
68
|
| `devops-integrator` | GitLab/GitHub: milestones, issues, branches, MRs/PRs, post-merge cleanup |
|
|
69
69
|
| `deployment-engineer` | CI/CD pipelines, deploys, rollbacks, smoke tests, DB migrations |
|
|
70
|
-
| `orchestrator` | Development cycle:
|
|
70
|
+
| `orchestrator` | Development cycle: 10-step workflow with error recovery |
|
|
71
71
|
| `ui-engineer` | Frontend: components, styling, state, a11y (any framework) |
|
|
72
72
|
| `backend-ts-architect` | Backend: API, DB, business logic, DI, services |
|
|
73
73
|
| `senior-code-reviewer` | Code review: security, performance, architecture, duplication |
|
|
@@ -11,6 +11,7 @@ import { runClaude, currentChild } from './lib/claude-runner.mjs';
|
|
|
11
11
|
import { sleep, formatDuration, acquireLock, releaseLock, readMemory, isProjectComplete, getCurrentTask, getCurrentPhase, checkClaudeInstalled, checkAuth, checkGitIdentity, checkFilesystemWritable, gitFetchAndPull, gitCheckState, notify, printSummary, promptUser, parseUsageLimitResetMs, } from './lib/utils.mjs';
|
|
12
12
|
import { isTokenExpiringSoon, refreshOAuthToken } from './lib/oauth-refresh.mjs';
|
|
13
13
|
import { pollForNewWork } from './lib/idle-poll.mjs';
|
|
14
|
+
import { config as dotenvConfig } from '@dotenvx/dotenvx';
|
|
14
15
|
// ─── Args ───
|
|
15
16
|
function parseArgs(argv) {
|
|
16
17
|
const opts = { ...DEFAULTS };
|
|
@@ -266,6 +267,9 @@ async function main() {
|
|
|
266
267
|
printHelp();
|
|
267
268
|
process.exit(0);
|
|
268
269
|
}
|
|
270
|
+
// Load .env from project root — tokens (GITLAB_TOKEN, GH_TOKEN, etc.) are needed
|
|
271
|
+
// by idle-poll (platform API checks) and orchestrator (CLI auth refresh)
|
|
272
|
+
dotenvConfig({ path: resolve(opts.projectDir, '.env'), override: false, quiet: true });
|
|
269
273
|
const logPath = resolve(opts.projectDir, opts.logFile);
|
|
270
274
|
const log = createLogger(logPath);
|
|
271
275
|
log.info('Autonomous development loop starting.');
|
|
@@ -39,7 +39,7 @@ The project root directory ALWAYS stays on `main`. Each task gets its own **git
|
|
|
39
39
|
git worktree add .worktrees/feat/{slug} -b feat/{slug}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
### Working in the worktree (STEP 2-
|
|
42
|
+
### Working in the worktree (STEP 2-8)
|
|
43
43
|
ALL file reads, edits, and commands target the worktree path:
|
|
44
44
|
- **Read/Edit/Write**: use absolute paths under the worktree (e.g., `{worktree-abs-path}/src/app/...`)
|
|
45
45
|
- **Bash**: always `cd` into the worktree first: `cd {worktree-path} && nx build ...`
|
|
@@ -47,10 +47,10 @@ ALL file reads, edits, and commands target the worktree path:
|
|
|
47
47
|
|
|
48
48
|
### Tracking files (MEMORY.md, TODO.md)
|
|
49
49
|
- **Step-by-step updates** (e.g., `Current Step: 3 — IMPLEMENT`): edit MEMORY.md in the **project root** (on main). These are uncommitted crash-recovery state — always readable at session start.
|
|
50
|
-
- **STEP
|
|
51
|
-
- **After merge** (STEP
|
|
50
|
+
- **STEP 9** (commit): copy final MEMORY.md + TODO.md into the worktree, commit everything together. Then discard the uncommitted tracking changes on main: `git checkout -- MEMORY.md TODO.md` (they come back via merge).
|
|
51
|
+
- **After merge** (STEP 10): main receives the committed MEMORY.md and TODO.md from the feature branch.
|
|
52
52
|
|
|
53
|
-
### Merging (STEP
|
|
53
|
+
### Merging (STEP 10)
|
|
54
54
|
From the project root (on main):
|
|
55
55
|
```bash
|
|
56
56
|
git merge feat/{slug} --no-ff # or platform merge via devops-integrator
|
|
@@ -68,7 +68,7 @@ Then commit tracking changes (TODO.md `[~]`, MEMORY.md blocker) directly on main
|
|
|
68
68
|
### Crash recovery
|
|
69
69
|
- Worktree exists at session start → check MEMORY.md `Current Step` and `Current Worktree` to resume
|
|
70
70
|
- Worktree has uncommitted changes → continue from the recorded step
|
|
71
|
-
- Worktree has commits ahead of main → proceed to STEP
|
|
71
|
+
- Worktree has commits ahead of main → proceed to STEP 10 (merge)
|
|
72
72
|
- Orphaned worktree (no `Current Worktree` in MEMORY.md) → `git worktree remove --force` + `git branch -D`
|
|
73
73
|
|
|
74
74
|
## Session Start — Health Check
|
|
@@ -141,18 +141,18 @@ If MEMORY.md indicates "Project complete" (Current Phase contains "PROJECT COMPL
|
|
|
141
141
|
Before doing anything, check for unexpected state from user intervention or previous session:
|
|
142
142
|
- **Worktree recovery**: Read MEMORY.md `Current Worktree`. If set, check if the worktree directory exists:
|
|
143
143
|
- Worktree exists + `Current Step` is set → resume using the rules below:
|
|
144
|
-
- **Crash recovery for STEPs 1-
|
|
145
|
-
- **Crash recovery for STEP
|
|
146
|
-
- Check `git -C {worktree} status` for uncommitted changes. If present, the STEP
|
|
147
|
-
- If worktree is clean, the commit succeeded. Proceed to STEP
|
|
148
|
-
- **Crash recovery for STEP
|
|
149
|
-
- The push already succeeded (
|
|
150
|
-
- If pipeline is running → resume polling from STEP
|
|
151
|
-
- If pipeline passed → proceed to STEP
|
|
152
|
-
- If pipeline failed → resume STEP
|
|
153
|
-
- If no pipeline found → proceed to STEP
|
|
154
|
-
- **Crash recovery for STEP
|
|
155
|
-
- Check if the feature branch has commits ahead of main. If yes, proceed to STEP
|
|
144
|
+
- **Crash recovery for STEPs 1-8** (planning/implementation/review phase): The architect's plan from the previous session is LOST (it was only in context). You MUST re-delegate to the architect agent (STEP 2) before continuing. The architect will see the existing implementation in the worktree and produce a plan covering only the remaining work. Then continue from STEP 3. **Do NOT attempt to assess, read, or continue implementation yourself without a fresh architect plan.**
|
|
145
|
+
- **Crash recovery for STEP 9**: If `Current Step` contains `9 —` (exactly `9 — COMMIT`, not `9b`):
|
|
146
|
+
- Check `git -C {worktree} status` for uncommitted changes. If present, the STEP 9 commit was incomplete — re-stage all task files + TODO.md + MEMORY.md in the worktree and commit.
|
|
147
|
+
- If worktree is clean, the commit succeeded. Proceed to STEP 9b (CI watch) if git integration active, otherwise STEP 10.
|
|
148
|
+
- **Crash recovery for STEP 9b**: If `Current Step` contains `9b`:
|
|
149
|
+
- The push already succeeded (9b runs after push). Check if a CI pipeline is running for the branch.
|
|
150
|
+
- If pipeline is running → resume polling from STEP 9b.
|
|
151
|
+
- If pipeline passed → proceed to STEP 10.
|
|
152
|
+
- If pipeline failed → resume STEP 9b fix loop (check CI fix counter in MEMORY.md Notes if logged).
|
|
153
|
+
- If no pipeline found → proceed to STEP 10 (pipeline may have been cancelled or platform is unreachable).
|
|
154
|
+
- **Crash recovery for STEP 10**: If `Current Step` contains `10`:
|
|
155
|
+
- Check if the feature branch has commits ahead of main. If yes, proceed to STEP 10 (merge from main).
|
|
156
156
|
- If already merged: clean up worktree and branch, clear `Current Worktree` from MEMORY.md.
|
|
157
157
|
- **Crash recovery for hotfix**: If `Current Step` starts with `hotfix`, resume in hotfix workflow mode (shortened cycle). Re-delegate to architect (same as STEPs 1-10 recovery above), then continue from the hotfix step.
|
|
158
158
|
- `Current Worktree` is set but directory doesn't exist → orphaned reference. Check if the branch was merged (in `git log main`). If merged: clear `Current Worktree` and `Current Task` from MEMORY.md. If not merged but branch exists: recreate worktree `git worktree add {path} {branch}` and resume. If branch is gone: clear tracking, move to next task.
|
|
@@ -259,7 +259,7 @@ Read the current TODO.md and MEMORY.md for context on the project's current phas
|
|
|
259
259
|
#### 8f. Migration task priority
|
|
260
260
|
- After step 8 completes, if migration tasks were created in TODO.md, they become the **next tasks to pick** in STEP 1 (before any regular development tasks in the current phase), subject to the crash-recovery exception in STEP 1 (if `Current Worktree` is set, the in-progress task is finished first)
|
|
261
261
|
- This ensures the project stays aligned with kit conventions before new features are built on outdated patterns
|
|
262
|
-
- Migration tasks follow the normal development cycle (STEP 1-
|
|
262
|
+
- Migration tasks follow the normal development cycle (STEP 1-10) — they get architect plans, tests, review, just like any other task
|
|
263
263
|
|
|
264
264
|
#### Skip conditions
|
|
265
265
|
- `.claude/.kit-version` does not exist → skip entire step 8
|
|
@@ -327,7 +327,7 @@ If `PLAN.md` exists in the project root, check whether it changed since the last
|
|
|
327
327
|
### 13. One task per invocation
|
|
328
328
|
- Complete exactly ONE task per invocation, then end the session cleanly.
|
|
329
329
|
- The external loop (`autonomous.mjs` or ralph-loop) handles iteration control — you do NOT need to manage capacity, iteration counters, or session bounds.
|
|
330
|
-
- After committing the task (STEP
|
|
330
|
+
- After committing the task (STEP 9) and post-merge (STEP 10), EXIT. Do NOT update MEMORY.md after merge — it was already committed in STEP 9 and arrived on main via merge. Do NOT ask whether to continue, do NOT wait for confirmation, do NOT start another task. Do NOT create any commits after merge.
|
|
331
331
|
- Track complexity in MEMORY.md `Complexity This Session` for informational purposes only (S=1, M=2, L=4).
|
|
332
332
|
|
|
333
333
|
## Task Type Detection
|
|
@@ -354,7 +354,7 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
354
354
|
- Cross-reference with TODO.md — find the first unchecked `- [ ]` task in the current phase
|
|
355
355
|
- **Kit-upgrade tasks first**: if any `- [ ]` tasks in the current phase have `Kit-Upgrade:` tag, pick those before any regular tasks (regardless of position in the phase). **Exception**: if `Current Worktree` is set in MEMORY.md (in-progress task from a previous session), finish that task first — kit-upgrade will be picked in the next clean invocation. Never remove an in-progress worktree to make room for a kit-upgrade task.
|
|
356
356
|
- Skip tasks marked as `- [~]` (skipped/blocked)
|
|
357
|
-
- **If no `[ ]` tasks remain in the current phase**: advance to the next phase. Update MEMORY.md `Current Phase` to the next phase heading from TODO.md. Then look for the first `- [ ]` task in that new phase. This IS a phase transition — the phase transition check below will trigger for the first task. If no `[ ]` tasks remain in ANY phase, go to the final completion sequence in STEP
|
|
357
|
+
- **If no `[ ]` tasks remain in the current phase**: advance to the next phase. Update MEMORY.md `Current Phase` to the next phase heading from TODO.md. Then look for the first `- [ ]` task in that new phase. This IS a phase transition — the phase transition check below will trigger for the first task. If no `[ ]` tasks remain in ANY phase, go to the final completion sequence in STEP 10.
|
|
358
358
|
- **Dependency check**: verify ALL tasks listed in "Depends on" are checked `[x]` in TODO.md. If any dependency is incomplete, skip this task and pick the next one without unmet dependencies.
|
|
359
359
|
- Priority: TODO.md phases in order (Phase 0 -> Phase 1 -> ...)
|
|
360
360
|
- If item has Complexity: L -> delegate decomposition to `technical-planner`:
|
|
@@ -472,6 +472,17 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
472
472
|
- Used across ALL domains -> `libs/shared/` (global shared)
|
|
473
473
|
- Used within ONE domain group -> `libs/[domain]/shared/`
|
|
474
474
|
- Used within ONE library -> keep it local
|
|
475
|
+
- **BUILD & LINT VERIFICATION (MANDATORY):**
|
|
476
|
+
- After implementation is complete, the specialist agent MUST run build and lint to verify the code compiles and passes linting:
|
|
477
|
+
```
|
|
478
|
+
cd {worktree-path} && nx build [PROJECT] && nx lint [PROJECT]
|
|
479
|
+
```
|
|
480
|
+
- If build or lint fails, the specialist agent fixes it before returning. This is part of the implementation, not a separate step.
|
|
481
|
+
- **SAFETY LIMIT: Max 3 fix attempts.** If still failing after 3:
|
|
482
|
+
1. Report the failure back to the orchestrator with full error details
|
|
483
|
+
2. Orchestrator delegates to the original architect agent: "Build/lint is failing after 3 fix attempts. Errors: [paste errors]. Suggest a fix or a different approach."
|
|
484
|
+
3. If architect provides fix → delegate one more implementation attempt
|
|
485
|
+
4. If still failing → remove the worktree and branch (`git worktree remove --force .worktrees/feat/{slug} && git branch -D feat/{slug}`), clear `Current Worktree` from MEMORY.md, mark task as `[~]` SKIPPED in TODO.md, log as BLOCKER in MEMORY.md with full error details, commit tracking on main (`git add TODO.md MEMORY.md && git commit -m "chore: skip [task title] — [brief reason]"`, push only if remote exists), move to next task
|
|
475
486
|
- **DATABASE MIGRATIONS (if applicable):** If the task involves new/changed database schema:
|
|
476
487
|
- Delegate to `deployment-engineer` agent: "Generate a dev-time migration for this schema change: [describe change]. Database type: [from CLAUDE.md]. Generate migration file (UP + DOWN) in the migrations/ directory. Do NOT deploy — just generate the file and run it against the local/dev database. Report result."
|
|
477
488
|
- Include migration file in the commit
|
|
@@ -498,48 +509,21 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
498
509
|
- **Integration tests**: Include in the prompt: "Write integration tests for: [list endpoints/services from TESTING section]. Test real request/response cycles (use test server or supertest), database operations against test DB, and public API contracts. Keep integration tests in `*.integration.spec.ts` files (co-located next to source, same as unit tests)."
|
|
499
510
|
- **Visual regression tests**: Include in the prompt: "Write visual regression tests (`*.vrt.spec.ts`) for these pages/views: [list from TESTING section]. Use the VRT template with 3-viewport matrix (mobile 375px, tablet 768px, desktop 1280px). Use `maxDiffPixelRatio: 0.01` and `fullPage: true` for page screenshots. Mask dynamic content (timestamps, user avatars) with `mask` option."
|
|
500
511
|
- **Baseline updates for intentional visual changes**: If the architect's plan describes intentional visual changes to existing pages (redesign, new theme, layout restructure), add to the test-engineer prompt: "Existing VRT baselines will need updating. After writing/updating VRT tests, run `nx e2e [APP]-e2e -- --update-snapshots` to regenerate baselines. Include the updated baseline images in the commit."
|
|
512
|
+
- **Coverage requirement**: Include in the prompt: "Run ALL tests with `--coverage`. Coverage MUST stay above 80% (statements, branches, functions, lines). If coverage drops below 80%, add missing tests before returning."
|
|
513
|
+
- **E2E tests**: Include in the prompt: "Start dev server, wait for readiness, run E2E tests, then kill the dev server port. Use `bunx kill-port 4200` for cleanup."
|
|
514
|
+
- **VRT first-run note**: Include in the prompt: "If VRT tests (`*.vrt.spec.ts`) are newly created, the first run will fail (no baselines). Re-run once: first run creates baselines, second run compares. Ensure `*-snapshots/` directories are staged."
|
|
515
|
+
- **Stylelint** (for tasks with SCSS changes): Include in the prompt: "Run `stylelint` on changed SCSS files with `--max-warnings=0`."
|
|
516
|
+
- **SAFETY LIMIT: Max 3 fix attempts** for test failures. If still failing after 3:
|
|
517
|
+
1. Orchestrator delegates to the original architect agent: "Tests are failing after 3 fix attempts. Errors: [paste errors]. Suggest a fix or a different approach."
|
|
518
|
+
2. If architect provides fix → delegate one more test-engineer attempt
|
|
519
|
+
3. If still failing → remove the worktree and branch (`git worktree remove --force .worktrees/feat/{slug} && git branch -D feat/{slug}`), clear `Current Worktree` from MEMORY.md, mark task as `[~]` SKIPPED in TODO.md, log as BLOCKER in MEMORY.md with full error details, commit tracking on main (`git add TODO.md MEMORY.md && git commit -m "chore: skip [task title] — [brief reason]"`, push only if remote exists), move to next task
|
|
501
520
|
- **Error recovery**: If test-engineer agent fails, write basic smoke tests yourself and note in MEMORY.md
|
|
521
|
+
- DO NOT proceed to review with failing tests
|
|
502
522
|
|
|
503
|
-
**STEP 5:
|
|
504
|
-
- Update MEMORY.md (on main): set `Current Step: 5 —
|
|
505
|
-
- **Run all commands in the worktree**: `cd {worktree-path} && ...`
|
|
506
|
-
- Determine which projects to verify:
|
|
507
|
-
- Use `nx affected --target=build --base=main --head=HEAD` to find affected projects
|
|
508
|
-
- If `nx affected` is not available or unreliable, explicitly run for each project containing changed files:
|
|
509
|
-
- Changed files in `apps/[FRONTEND_APP]/` or `libs/` used by frontend -> `nx build [FRONTEND_APP]`, `nx lint [FRONTEND_APP]`, `nx test [FRONTEND_APP] --coverage`
|
|
510
|
-
- Changed files in `apps/[BACKEND_APP]/` or backend libs -> `nx build [BACKEND_APP]`, `nx lint [BACKEND_APP]`, `nx test [BACKEND_APP] --coverage`
|
|
511
|
-
- Changed files in a specific lib -> `nx test [LIB_PROJECT_NAME] --coverage` (test the lib directly, not just the app)
|
|
512
|
-
- **Coverage check**: tests MUST run with `--coverage` flag. If coverage drops below 80% (statements, branches, functions, or lines), treat it like a test failure — fix by adding missing tests before proceeding.
|
|
513
|
-
- **Integration tests (backend/packages)**: If integration test files (`*.integration.spec.ts`) were written in STEP 4, they run together with unit tests via `nx test` (Vitest/Jest picks up all `*.spec.ts` files). No extra step needed — just verify they pass in the `nx test` output above. If integration tests need a running backend or test database, start it before running tests:
|
|
514
|
-
```bash
|
|
515
|
-
cd {worktree-path}
|
|
516
|
-
# Example: start test DB or backend, then run tests
|
|
517
|
-
nx test [BACKEND_APP] --coverage 2>&1 | tail -50
|
|
518
|
-
```
|
|
519
|
-
- **E2E tests (frontend)**: If E2E tests were written in STEP 4 (check for `*-e2e` project or `e2e/` directory in the worktree):
|
|
520
|
-
```bash
|
|
521
|
-
cd {worktree-path}
|
|
522
|
-
nx serve [FRONTEND_APP] &
|
|
523
|
-
for i in $(seq 1 60); do curl -s http://localhost:4200 > /dev/null 2>&1 && break; sleep 1; done
|
|
524
|
-
nx e2e [FRONTEND_APP]-e2e 2>&1 | tail -50
|
|
525
|
-
bunx kill-port 4200 2>/dev/null || npx kill-port 4200 2>/dev/null || true
|
|
526
|
-
```
|
|
527
|
-
- E2E and integration test failures are treated the same as unit test failures — fix before proceeding.
|
|
528
|
-
- **VRT first-run note**: If VRT tests (`*.vrt.spec.ts`) were newly created in STEP 4, the first E2E run will fail because no baseline screenshots exist yet. This is expected — not a real failure. Re-run E2E once: first run creates baselines, second run compares against them. If the second run passes, the baselines are correct. Ensure `*-snapshots/` directories are staged for commit in STEP 11.
|
|
529
|
-
- **Stylelint** (for tasks with SCSS changes): run `stylelint "libs/**/*.scss" "apps/**/*.scss" --max-warnings=0` via the PKG runner (e.g., `bunx stylelint ...` / `npx stylelint ...`) or `nx stylelint [PROJECT]` if configured as Nx target
|
|
530
|
-
- Pipe output through `| tail -30` for readability
|
|
531
|
-
- Only use `--skip-nx-cache` if you suspect stale cache
|
|
532
|
-
- If fails: fix errors, re-run
|
|
533
|
-
- **SAFETY LIMIT: Max 3 fix attempts.** If still failing after 3:
|
|
534
|
-
1. Delegate to the original architect agent: "Build/lint/test is failing after 3 fix attempts. Errors: [paste errors]. Suggest a fix or a different approach."
|
|
535
|
-
2. If architect provides fix -> apply it, 1 more attempt
|
|
536
|
-
3. If still failing -> remove the worktree and branch (`git worktree remove --force .worktrees/feat/{slug} && git branch -D feat/{slug}`), clear `Current Worktree` from MEMORY.md, mark task as `[~]` SKIPPED in TODO.md, log as BLOCKER in MEMORY.md with full error details, commit tracking on main (`git add TODO.md MEMORY.md && git commit -m "chore: skip [task title] — [brief reason]"`, push only if remote exists), move to next task
|
|
537
|
-
- DO NOT proceed to review with broken build or failing tests
|
|
538
|
-
|
|
539
|
-
**STEP 6: VISUAL VERIFICATION (UI tasks only)**
|
|
540
|
-
- Update MEMORY.md (on main): set `Current Step: 6 — VISUAL VERIFY`
|
|
523
|
+
**STEP 5: VISUAL VERIFICATION (UI tasks only)**
|
|
524
|
+
- Update MEMORY.md (on main): set `Current Step: 5 — VISUAL VERIFY`
|
|
541
525
|
- Skip this step for backend-only tasks
|
|
542
|
-
- **Note**: Automated VRT (pixel comparison via `toHaveScreenshot()`) runs in STEP
|
|
526
|
+
- **Note**: Automated VRT (pixel comparison via `toHaveScreenshot()`) runs in STEP 4 (test-engineer) and catches regressions against baselines. This manual verification step complements VRT by checking subjective quality: does the page look good? Does it match the design intent? Are proportions and spacing aesthetically correct? VRT catches what changed; this step judges whether the change looks right.
|
|
543
527
|
- For frontend tasks, use Playwright MCP to verify visual output:
|
|
544
528
|
1. Start dev server **from the worktree**. **Important**: each Bash tool call runs in a separate shell, so PID variables don't persist. Start the server in one Bash call and leave it running:
|
|
545
529
|
```bash
|
|
@@ -559,15 +543,15 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
559
543
|
- If **Figma MCP** is available: compare with Figma design for visual fidelity
|
|
560
544
|
- If **UX.md** exists: verify against design spec (colors, spacing, typography tokens)
|
|
561
545
|
4. Verify basic interactions work (click, navigation, form submission)
|
|
562
|
-
- If visual issues are found: fix
|
|
546
|
+
- If visual issues are found: delegate fix to specialist agent and re-run STEP 4 (tests) before proceeding
|
|
563
547
|
- If Playwright MCP is unavailable, skip this step (but note it in MEMORY.md)
|
|
564
548
|
- **After verification, kill the dev server** (cross-platform, works across shell sessions):
|
|
565
549
|
```bash
|
|
566
550
|
bunx kill-port 4200 2>/dev/null || npx kill-port 4200 2>/dev/null || true
|
|
567
551
|
```
|
|
568
552
|
|
|
569
|
-
**STEP
|
|
570
|
-
- Update MEMORY.md (on main): set `Current Step:
|
|
553
|
+
**STEP 6: CODE REVIEW — DELEGATE to reviewer agent (MANDATORY)**
|
|
554
|
+
- Update MEMORY.md (on main): set `Current Step: 6 — REVIEW`
|
|
571
555
|
- First, prepare the list of ALL changed/new files in the worktree: `git -C {worktree-path} diff --name-only main` / `git -C {worktree-path} status`
|
|
572
556
|
- Call the Agent tool with `senior-code-reviewer`
|
|
573
557
|
- In your prompt, include:
|
|
@@ -580,8 +564,8 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
580
564
|
- **Error recovery**: If reviewer agent fails, run basic checks yourself (build, lint, test pass + quick read of changed files for obvious issues), note in MEMORY.md that automated review was skipped
|
|
581
565
|
- DO NOT skip this step even if you think the code is perfect
|
|
582
566
|
|
|
583
|
-
**STEP
|
|
584
|
-
- Update MEMORY.md (on main): set `Current Step:
|
|
567
|
+
**STEP 7: REWORK — DELEGATE to the original implementer (based on reviewer's findings)**
|
|
568
|
+
- Update MEMORY.md (on main): set `Current Step: 7 — REWORK`
|
|
585
569
|
- **You are an orchestrator — you MUST NOT fix code yourself.** Delegate rework to the same agent that did the implementation:
|
|
586
570
|
- Frontend issues → Agent tool with `ui-engineer`, model `"opus"`
|
|
587
571
|
- Backend issues → Agent tool with `backend-ts-architect`, model `"opus"`
|
|
@@ -600,23 +584,18 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
600
584
|
- DO NOT edit files yourself — delegate via Agent tool
|
|
601
585
|
- DO NOT skip delegation "because the fixes are small" — even one-line fixes go through the specialist agent
|
|
602
586
|
|
|
603
|
-
**STEP
|
|
604
|
-
- Update MEMORY.md (on main): set `Current Step:
|
|
587
|
+
**STEP 8: RE-REVIEW — DELEGATE again (max 4 re-reviews here, 5 total with STEP 6)**
|
|
588
|
+
- Update MEMORY.md (on main): set `Current Step: 8 — RE-REVIEW`
|
|
605
589
|
- After rework, call Agent tool with `senior-code-reviewer` AGAIN on changed files
|
|
606
|
-
- If issues remain after re-review, return to STEP
|
|
607
|
-
- **SAFETY LIMIT: Max 5 review cycles total (STEP
|
|
590
|
+
- If issues remain after re-review, return to STEP 7 for rework. Continue this STEP 7→8 loop until clean or safety limit reached.
|
|
591
|
+
- **SAFETY LIMIT: Max 5 review cycles total (STEP 6 counts as cycle 1).** If still failing after 5:
|
|
608
592
|
1. Delegate to the original architect agent: "Review cycle exceeded 5 iterations. Here are the remaining issues: [list]. Suggest a fundamentally different approach."
|
|
609
593
|
2. If architect provides new approach -> restart from STEP 3 with new plan (counts as 1 additional attempt)
|
|
610
594
|
3. If architect says issues are cosmetic/acceptable -> proceed with current code
|
|
611
595
|
4. If still stuck -> **SKIP this task**: remove worktree and branch (`git worktree remove --force .worktrees/feat/{slug} && git branch -D feat/{slug}`), clear `Current Worktree` from MEMORY.md, mark as `- [~] ~~**Task**~~ — SKIPPED: review cycle exceeded, see MEMORY.md blocker` in TODO.md, log as BLOCKER in MEMORY.md with full details, commit tracking on main (`git add TODO.md MEMORY.md && git commit -m "chore: skip [task title] — [brief reason]"`, push only if remote exists), move to next task
|
|
612
596
|
|
|
613
|
-
**STEP
|
|
614
|
-
- Update MEMORY.md (on main): set `Current Step:
|
|
615
|
-
- Run the same affected project commands as STEP 5 in the worktree (build, lint, unit tests with coverage, E2E tests if applicable)
|
|
616
|
-
- If any fail after review rework: fix and re-verify (do NOT go back to review for build fixes)
|
|
617
|
-
|
|
618
|
-
**STEP 11: COMMIT & PUSH**
|
|
619
|
-
- Update MEMORY.md (on main): set `Current Step: 11 — COMMIT`
|
|
597
|
+
**STEP 9: COMMIT & PUSH**
|
|
598
|
+
- Update MEMORY.md (on main): set `Current Step: 9 — COMMIT`
|
|
620
599
|
- **First, update tracking files on main** (project root):
|
|
621
600
|
- **TODO.md**: Check off the completed task: `- [x] **Task** — description ([date])`
|
|
622
601
|
- For skipped tasks: `- [~] ~~**Task**~~ — SKIPPED: [brief reason]`
|
|
@@ -662,8 +641,8 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
662
641
|
3. If auth/network -> retry once, then log blocker
|
|
663
642
|
4. Commit is still local and safe — do NOT reset or amend without reason
|
|
664
643
|
|
|
665
|
-
**STEP
|
|
666
|
-
- Update MEMORY.md (on main): set `Current Step:
|
|
644
|
+
**STEP 9b: CI PIPELINE WATCH** (only if git integration active AND remote push succeeded)
|
|
645
|
+
- Update MEMORY.md (on main): set `Current Step: 9b — CI WATCH`
|
|
667
646
|
- **Skip conditions**: no remote, no push happened, local-only mode, team workflow (team doesn't merge — CI runs on MR/PR, reviewed by humans)
|
|
668
647
|
- **Wait for pipeline to start** (max 60s polling):
|
|
669
648
|
```bash
|
|
@@ -681,7 +660,7 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
681
660
|
sleep 5
|
|
682
661
|
done
|
|
683
662
|
```
|
|
684
|
-
- **If no pipeline found after 60s**: proceed to STEP
|
|
663
|
+
- **If no pipeline found after 60s**: proceed to STEP 10 (CI may not be configured for this repo). Log in MEMORY.md Notes: "No CI pipeline detected — skipped CI watch."
|
|
685
664
|
- **Poll until completion** (max 1 hour):
|
|
686
665
|
```bash
|
|
687
666
|
# GitHub — watch specific run (blocks until done, built-in polling)
|
|
@@ -697,8 +676,8 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
697
676
|
esac
|
|
698
677
|
done
|
|
699
678
|
```
|
|
700
|
-
- **If CI passes** → proceed to STEP
|
|
701
|
-
- **If CI was canceled** → the pipeline was intentionally stopped (by a human or auto-canceled by a newer push). Do NOT treat as failure. If a newer push triggered it (from a fix attempt), restart polling for the new pipeline. Otherwise proceed to STEP
|
|
679
|
+
- **If CI passes** → proceed to STEP 10
|
|
680
|
+
- **If CI was canceled** → the pipeline was intentionally stopped (by a human or auto-canceled by a newer push). Do NOT treat as failure. If a newer push triggered it (from a fix attempt), restart polling for the new pipeline. Otherwise proceed to STEP 10.
|
|
702
681
|
- **If CI fails** → diagnose and fix (max 3 attempts). Log CI fix attempt count in MEMORY.md Notes (e.g., `CI fix attempts: 1/3`):
|
|
703
682
|
1. **Fetch CI logs**:
|
|
704
683
|
```bash
|
|
@@ -713,24 +692,24 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
713
692
|
- **Fixable in code** (test failure, build error, lint issue, missing dependency): fix in worktree, amend commit (`git -C {worktree-path} add [files] && git -C {worktree-path} commit --amend --no-edit`), force-push (`git -C {worktree-path} push --force-with-lease`), restart from "Wait for pipeline"
|
|
714
693
|
- **Config/infra issue** (missing CI secret, wrong Node version, Docker build failure): if deployment-engineer can fix (CI config change), delegate to it. Otherwise log as blocker.
|
|
715
694
|
- **Flaky/intermittent** (test passed locally but fails randomly in CI): retry the pipeline once (`gh run rerun "$RUN_ID" --failed` / trigger retry via `glab ci retry`). If it passes on retry, proceed. If it fails again, treat as fixable.
|
|
716
|
-
- **Unfixable** (requires human action — missing secrets, permissions, external service down): log in MEMORY.md Blockers, proceed to STEP
|
|
695
|
+
- **Unfixable** (requires human action — missing secrets, permissions, external service down): log in MEMORY.md Blockers, proceed to STEP 10 with local merge fallback. Return `blocked` status with details.
|
|
717
696
|
4. **After each fix attempt**: increment CI fix counter in MEMORY.md Notes. If counter reaches 3:
|
|
718
697
|
- Delegate to original architect agent: "CI pipeline failed 3 times. Failures: [list]. Local build/test passes. Suggest fix or confirm this is an environment issue."
|
|
719
698
|
- If architect provides fix → apply it (final attempt)
|
|
720
|
-
- If architect confirms environment issue → proceed to STEP
|
|
721
|
-
- If still failing → proceed to STEP
|
|
699
|
+
- If architect confirms environment issue → proceed to STEP 10 with local merge fallback, log blocker
|
|
700
|
+
- If still failing → proceed to STEP 10 with local merge fallback, log full details in MEMORY.md Blockers
|
|
722
701
|
- **Note**: `--force-with-lease` is safe here because we own the branch and just pushed it. The MR/PR stays open and updates automatically.
|
|
723
702
|
|
|
724
|
-
**STEP
|
|
725
|
-
- Everything was committed in STEP
|
|
726
|
-
- **ZERO commits in this step** — all tracking was already committed in STEP
|
|
703
|
+
**STEP 10: POST-MERGE & NEXT ITEM**
|
|
704
|
+
- Everything was committed in STEP 9 inside the worktree. The project root (on main) has a clean working tree (tracking changes were discarded in STEP 9).
|
|
705
|
+
- **ZERO commits in this step** — all tracking was already committed in STEP 9. This step only performs git operations (merge, worktree cleanup, push) and delegates issue status updates.
|
|
727
706
|
- **Solo workflow** (CLAUDE.md `Workflow: solo` or default):
|
|
728
|
-
- **If git integration active** (MR/PR was created in STEP
|
|
707
|
+
- **If git integration active** (MR/PR was created in STEP 9):
|
|
729
708
|
- Ensure latest commit is pushed from worktree:
|
|
730
709
|
```bash
|
|
731
710
|
git -C {worktree-path} push origin HEAD
|
|
732
711
|
```
|
|
733
|
-
- Merge via platform to properly close the MR/PR (CI should have passed in STEP
|
|
712
|
+
- Merge via platform to properly close the MR/PR (CI should have passed in STEP 9b — if merge still fails due to checks, use local merge fallback below):
|
|
734
713
|
```bash
|
|
735
714
|
# GitHub
|
|
736
715
|
gh pr merge --merge --delete-branch
|
|
@@ -779,7 +758,7 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
|
|
|
779
758
|
Note the stacking in MEMORY.md. When the previous MR/PR is merged: `git -C .worktrees/feat/{next} rebase --onto main feat/{previous}`
|
|
780
759
|
- **If no `[ ]` tasks remain in current phase AND at least one `[~]` exists** (all remaining were skipped): do NOT auto-advance. Delegate to `product-owner`: "All tasks in Phase [N] are blocked/skipped. The autonomous loop cannot proceed. Options: (1) ADD replacement tasks that unblock progress, (2) REPRIORITIZE to skip this phase entirely and move to next, (3) declare a BLOCKER requiring human intervention." If product-owner returns only CONFIRM with no actionable changes, STOP the autonomous loop and log: "Phase [N] fully blocked — requires human intervention. Run orchestrator manually after resolving blockers."
|
|
781
760
|
- One task per invocation — after post-merge, end session. The external loop will start the next invocation.
|
|
782
|
-
- **CRITICAL: ZERO commits after merge.** MEMORY.md and TODO.md are already on main (they came from the merge). Do NOT `git add`, do NOT `git commit`, do NOT create `chore:` commits. If you see tracking files as "modified" after merge, that is IMPOSSIBLE if STEP
|
|
761
|
+
- **CRITICAL: ZERO commits after merge.** MEMORY.md and TODO.md are already on main (they came from the merge). Do NOT `git add`, do NOT `git commit`, do NOT create `chore:` commits. If you see tracking files as "modified" after merge, that is IMPOSSIBLE if STEP 9 was done correctly — investigate, do NOT blindly commit.
|
|
783
762
|
- **If no `[ ]` tasks remain in current phase AND zero `[~]` exist** (all completed) -> phase transition (handled at start of STEP 1)
|
|
784
763
|
- **If no `[ ]` tasks remain in ALL phases AND zero `[~]` exist** (everything completed) -> final completion sequence:
|
|
785
764
|
1. Delegate to `product-owner` agent:
|
|
@@ -815,32 +794,31 @@ For critical production bugs (outside normal TODO.md flow):
|
|
|
815
794
|
1. Create worktree: `git worktree add .worktrees/fix/{description} -b fix/{description}` — store in MEMORY.md `Current Worktree`
|
|
816
795
|
2. Delegate to architect agent for minimal fix plan (STEP 2 — cannot be skipped). Include `Working directory: {worktree-abs-path}` in prompt.
|
|
817
796
|
3. Implement fix (STEP 3)
|
|
818
|
-
4.
|
|
819
|
-
5.
|
|
820
|
-
6.
|
|
821
|
-
7. Commit & push from worktree (STEP 11) — include in the SAME commit:
|
|
797
|
+
4. Code review (STEP 6 — cannot be skipped). **Include in reviewer prompt**: "NOTE: This is a hotfix. Test writing was intentionally deferred — do not flag missing test coverage for this change."
|
|
798
|
+
5. If reviewer finds CRITICAL or WARN issues: set `Current Step: 7 — REWORK (hotfix)`, fix them and re-review (max 2 cycles for hotfixes). If still failing, commit anyway with a note in MEMORY.md — hotfix urgency takes priority.
|
|
799
|
+
6. Commit & push from worktree (STEP 9) — include in the SAME commit:
|
|
822
800
|
- Copy MEMORY.md into worktree. MEMORY.md: add note under "Notes": `Hotfix: [description] ([date])`, set `Current Task` to `(none)`, `Current Step` to `(none)`, `Current Worktree` to `(none)`
|
|
823
801
|
- Do NOT update TODO.md checkboxes unless the fix corresponds to an existing task
|
|
824
|
-
|
|
825
|
-
|
|
802
|
+
7. Post-merge: follow STEP 10 logic (merge to main from project root, clean up worktree + branch). No additional commits.
|
|
803
|
+
8. **Patch release**: if git integration active, delegate to `devops-integrator`: "Hotfix merged. Create a patch release with changelog."
|
|
826
804
|
|
|
827
|
-
**Skipped steps:** STEP 4 (tests — unless the bug reveals missing test coverage), STEP
|
|
805
|
+
**Skipped steps:** STEP 4 (tests — unless the bug reveals missing test coverage), STEP 5 (visual verification).
|
|
828
806
|
|
|
829
|
-
**Tracking:** During hotfix flow, update `Current Step` in MEMORY.md at each numbered step (e.g., `Current Step: hotfix — STEP
|
|
807
|
+
**Tracking:** During hotfix flow, update `Current Step` in MEMORY.md at each numbered step (e.g., `Current Step: hotfix — STEP 6`) for crash recovery.
|
|
830
808
|
|
|
831
809
|
## Merge Conflicts
|
|
832
810
|
|
|
833
811
|
If a merge conflict occurs:
|
|
834
812
|
|
|
835
|
-
**During feature branch development** (STEP 3-
|
|
813
|
+
**During feature branch development** (STEP 3-8, in worktree):
|
|
836
814
|
1. `cd {worktree-path} && git fetch origin main && git rebase origin/main`
|
|
837
815
|
2. Resolve conflicts manually — prefer keeping both changes when possible
|
|
838
|
-
3. Re-run STEP
|
|
839
|
-
4. If conflict changes are significant (not just trivial merge): re-run STEP
|
|
816
|
+
3. Re-run STEP 4 (tests) in the worktree after resolution
|
|
817
|
+
4. If conflict changes are significant (not just trivial merge): re-run STEP 6 (code review) on affected files
|
|
840
818
|
5. If rebase is too complex: `cd {worktree-path} && git merge origin/main` instead (creates merge commit but is safer)
|
|
841
819
|
6. Log the conflict resolution in MEMORY.md Notes
|
|
842
820
|
|
|
843
|
-
**During `git merge feat/branch` on main** (STEP
|
|
821
|
+
**During `git merge feat/branch` on main** (STEP 10, from project root):
|
|
844
822
|
1. Resolve the conflict in the merge commit (do NOT rebase here — you are on main)
|
|
845
823
|
2. `git add [resolved files]` (only resolved files — do NOT use `git add .`), then `git merge --continue`
|
|
846
824
|
3. Verify the merged result: build, lint, test from project root
|
|
@@ -933,10 +911,10 @@ After handling the user's message, resume the development cycle from where you l
|
|
|
933
911
|
- You are an ORCHESTRATOR — delegate to specialist agents, do not bypass them
|
|
934
912
|
- Work FULLY autonomously in UNATTENDED mode; in interactive mode, handle user messages per the User Interaction section above
|
|
935
913
|
- NEVER commit code that: (a) failed review, (b) failed build/lint, (c) breaks tests
|
|
936
|
-
- NEVER implement without architect plan (STEP 2) or skip code review (STEP
|
|
914
|
+
- NEVER implement without architect plan (STEP 2) or skip code review (STEP 6)
|
|
937
915
|
- Each commit = 1 logical unit
|
|
938
916
|
- Conventional commits: feat/fix/refactor/chore/docs
|
|
939
|
-
- **ABSOLUTE BAN: NEVER create commits that only change MEMORY.md or TODO.md.** Tracking files are committed WITH implementation code in STEP
|
|
917
|
+
- **ABSOLUTE BAN: NEVER create commits that only change MEMORY.md or TODO.md.** Tracking files are committed WITH implementation code in STEP 9. After merge (STEP 10), ZERO commits — tracking files arrive on main via the merge itself. Forbidden patterns: `chore: update progress tracking`, `chore: update MEMORY.md`, `chore: update MEMORY.md tracking after ...`, `chore: log hotfix`. If tracking files show as modified after merge, something went wrong in STEP 9 — investigate and fix, do NOT create a band-aid commit.
|
|
940
918
|
- All files in ENGLISH
|
|
941
919
|
- TODO.md + MEMORY.md are your tracking system — keep them PRECISE and CURRENT
|
|
942
920
|
- If deviating from plan, LOG the reason in MEMORY.md
|
|
@@ -410,7 +410,7 @@ Install these before starting autonomous development:
|
|
|
410
410
|
|
|
411
411
|
The full development cycle is managed by the **`orchestrator` agent**. It handles:
|
|
412
412
|
- Session health check (file validation, git sync, external issue intake)
|
|
413
|
-
-
|
|
413
|
+
- 10-step development cycle (pick -> plan -> implement -> test -> review -> commit)
|
|
414
414
|
- Hotfix workflow, merge conflict resolution
|
|
415
415
|
- Phase transitions with product re-evaluation
|
|
416
416
|
- Error recovery and graceful degradation
|
package/package.json
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-claude-workspace",
|
|
3
|
-
"version": "1.1.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.1.109",
|
|
4
|
+
"author": "",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://gitlab.com/LadaBr/claude-starter-kit.git"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"typescript": "^5.8.0",
|
|
11
|
+
"vitest": "^4.0.18"
|
|
12
|
+
},
|
|
6
13
|
"bin": {
|
|
7
14
|
"create-claude-workspace": "dist/index.js"
|
|
8
15
|
},
|
|
16
|
+
"description": "Scaffold a project with Claude Code agents for autonomous AI-driven development",
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18"
|
|
19
|
+
},
|
|
9
20
|
"files": [
|
|
10
21
|
"dist/index.js",
|
|
11
22
|
"dist/scripts",
|
|
12
23
|
"dist/template"
|
|
13
24
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"build": "tsc && node scripts/copy-templates.mjs",
|
|
16
|
-
"test": "vitest run",
|
|
17
|
-
"test:integration": "vitest run src/scripts/integration.spec.ts",
|
|
18
|
-
"test:all": "vitest run --config vitest.integration.config.ts",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
20
|
-
},
|
|
21
25
|
"keywords": [
|
|
22
26
|
"claude",
|
|
23
27
|
"claude-code",
|
|
@@ -27,17 +31,16 @@
|
|
|
27
31
|
"scaffold",
|
|
28
32
|
"create"
|
|
29
33
|
],
|
|
30
|
-
"author": "",
|
|
31
34
|
"license": "MIT",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
"vitest": "^4.0.18"
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc && node scripts/copy-templates.mjs",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:integration": "vitest run src/scripts/integration.spec.ts",
|
|
39
|
+
"test:all": "vitest run --config vitest.integration.config.ts",
|
|
40
|
+
"prepublishOnly": "npm run build"
|
|
39
41
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
+
"type": "module",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@dotenvx/dotenvx": "^1.57.2"
|
|
42
45
|
}
|
|
43
46
|
}
|