create-claude-workspace 2.3.38 → 2.3.40

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.
@@ -195,8 +195,8 @@ Before doing anything, check for unexpected state from user intervention or prev
195
195
  - If pipeline failed → resume STEP 9b fix loop.
196
196
  - If no pipeline found → proceed to STEP 10 (pipeline may have been cancelled or platform is unreachable).
197
197
  - **Crash recovery for STEP 10**: If `currentStep` in `state.json` is `10`:
198
- - Check if the feature branch has commits ahead of main. If yes, proceed to STEP 10 (merge from main).
199
- - If already merged: clean up worktree and branch.
198
+ - Check if the feature branch has commits ahead of main. If yes, proceed to STEP 10 (push + cleanup).
199
+ - If already merged or MR/PR exists: clean up worktree.
200
200
  - **Crash recovery for hotfix**: If `currentStep` 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.
201
201
  - `currentWorktree` is set in `state.json` but directory doesn't exist → orphaned reference. Check if the branch was merged (in `git log main`). If merged: task is done, move to next. If not merged but branch exists: recreate worktree `git worktree add {path} {branch}` and resume. If branch is gone: move to next task.
202
202
  - **Orphaned worktrees**: `git worktree list` — if there are worktrees not referenced by `state.json`:
@@ -371,8 +371,8 @@ If `PLAN.md` exists in the project root, check whether it changed since the last
371
371
  ### 13. One task per invocation — FULL CYCLE required
372
372
  - Complete exactly ONE task per invocation, then end the session cleanly.
373
373
  - The external loop (`autonomous.mjs` or ralph-loop) handles iteration control — you do NOT need to manage capacity, iteration counters, or session bounds.
374
- - **CRITICAL: You MUST execute the FULL cycle: STEP 9 → STEP 9b → STEP 10 → EXIT.** Do NOT exit after STEP 9. Creating an MR/PR is NOT the end — you must watch the CI pipeline (9b), read MR/PR comments, fix issues, and merge (10). Only EXIT after STEP 10 is complete (merge done, worktree cleaned up).
375
- - After merge (STEP 10), EXIT. Do NOT ask whether to continue, do NOT wait for confirmation, do NOT start another task. Do NOT create any commits after merge.
374
+ - **CRITICAL: You MUST execute the FULL cycle: STEP 9 → STEP 9b → STEP 10 → EXIT.** Do NOT exit after STEP 9. Creating an MR/PR is NOT the end — you MUST watch the CI pipeline (9b), fix any failures, and only then clean up (10). Exiting without watching CI is a bug — the whole point is to ensure the MR/PR is green before handing off.
375
+ - After STEP 10, EXIT. Do NOT ask whether to continue, do NOT wait for confirmation, do NOT start another task. Do NOT create any commits after cleanup.
376
376
  - Complexity tracking (S=1, M=2, L=4) is handled by the scheduler in `state.json`.
377
377
 
378
378
  ### 14. User input during autonomous operation
@@ -690,7 +690,7 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
690
690
  - **→ PROCEED TO STEP 9b** (do NOT exit here — MR/PR creation is NOT the end of the cycle)
691
691
 
692
692
  **STEP 9b: CI PIPELINE WATCH & MR/PR REVIEW** (only if git integration active AND remote push succeeded)
693
- - **Skip conditions**: no remote, no push happened, local-only mode, team workflow (team doesn't merge — CI runs on MR/PR, reviewed by humans)
693
+ - **Skip conditions**: no remote, no push happened, local-only mode
694
694
  - **Wait for pipeline to start** (max 60s polling):
695
695
  ```bash
696
696
  # GitHub — wait for workflow run to appear, capture run ID
@@ -755,67 +755,56 @@ To determine if a task is frontend, backend, or fullstack, use this heuristic:
755
755
  - If architect confirms environment issue → proceed to STEP 10 with local merge fallback, log blocker
756
756
  - If still failing → proceed to STEP 10 with local merge fallback
757
757
  - **Note**: `--force-with-lease` is safe here because we own the branch and just pushed it. The MR/PR stays open and updates automatically.
758
- - **→ PROCEED TO STEP 10** (do NOT exit here — the MR/PR must be MERGED before exiting)
758
+ - **→ PROCEED TO STEP 10**
759
759
 
760
- **STEP 10: POST-MERGE & NEXT ITEM**
760
+ **STEP 10: POST-TASK CLEANUP & NEXT ITEM**
761
761
  - Everything was committed in STEP 9 inside the worktree.
762
- - **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.
763
- - **Solo workflow** (CLAUDE.md `Workflow: solo` or default):
762
+ - **ZERO commits in this step** — all tracking was already committed in STEP 9. This step only performs git operations (cleanup, push) and delegates issue status updates.
763
+
764
+ - **When running via scheduler** (`state.json` exists): The scheduler handles merge, worktree cleanup, and branch deletion. Orchestrator only ensures final push and exits.
765
+
766
+ - **When running directly** (`claude --agent orchestrator` or ralph-loop):
767
+
764
768
  - **If git integration active** (MR/PR was created in STEP 9):
765
769
  - Ensure latest commit is pushed from worktree:
766
770
  ```bash
767
771
  git -C {worktree-path} push origin HEAD
768
772
  ```
769
- - 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):
770
- ```bash
771
- # GitHub
772
- gh pr merge --merge --delete-branch
773
- # GitLab
774
- glab mr merge --remove-source-branch
775
- ```
776
- - Then sync local main:
777
- ```bash
778
- git pull --rebase origin HEAD
779
- ```
780
- - Clean up worktree and branch:
773
+ - **Do NOT merge the MR/PR.** Leave it open for CI to pass and (optionally) human review. The MR/PR will be merged externally (by the user, by CI auto-merge, or by the scheduler in a future run).
774
+ - Clean up worktree only (branch stays for MR/PR):
781
775
  ```bash
782
776
  git worktree remove .worktrees/feat/{slug}
783
- git branch -d feat/{slug} 2>/dev/null || true
784
777
  ```
785
- - Delegate to `devops-integrator`: "Update issue #N status to done. Do NOT perform any git operations or file edits — already handled."
786
- - **If no git integration** (no MR/PR):
787
- - If remote exists: `git pull --rebase origin HEAD` before merge
778
+ - Sync main: `git pull --rebase origin HEAD`
779
+ - If git integration active: delegate to `devops-integrator`: "Update issue #N status to in-review. Do NOT perform any git operations."
780
+ - **Track the open MR/PR branch** remember `feat/{slug}` for branch stacking (see below).
781
+
782
+ - **If no git integration** (no MR/PR, no remote):
788
783
  - Merge locally (from project root, which is on main):
789
784
  ```bash
790
785
  git merge feat/{slug} --no-ff
791
786
  ```
792
787
  - If merge fails due to conflicts: follow the "Merge Conflicts" section below, then retry
793
- - If remote exists: `git push origin HEAD` after merge. If push fails (branch protection, auth): log blocker, leave commit local.
794
- - If no remote: skip pull/push (local-only mode)
795
788
  - Clean up worktree and branch:
796
789
  ```bash
797
790
  git worktree remove .worktrees/feat/{slug}
798
791
  git branch -d feat/{slug}
799
792
  ```
800
- - If platform merge fails (auth, permissions, branch protection):
801
- - Fall back to local merge (same as no-git-integration path above)
802
- - Delegate to `devops-integrator`: "Update issue #N status to done. Do NOT perform any git operations or file edits already handled."
803
- - **Team workflow** (CLAUDE.md `Workflow: team`):
804
- - If remote exists: push from worktree: `git -C {worktree-path} push origin HEAD`
805
- - Clean up worktree (branch stays for MR/PR review):
793
+
794
+ - **Branch stacking for dependent tasks**:
795
+ - If the next task depends on changes from a previous unmerged MR/PR, create worktree from the previous branch (not from main):
806
796
  ```bash
807
- git worktree remove .worktrees/feat/{slug}
797
+ git worktree add .worktrees/feat/{next} -b feat/{next} feat/{previous}
808
798
  ```
809
- - If remote exists: sync main: `git pull --rebase origin HEAD`
810
- - If git integration active: delegate to `devops-integrator`: "Update issue #N status to in-review. Do NOT perform any git operations."
811
- - Next task: if the next task depends on the previous (unmerged) MR/PR, create worktree from previous branch:
799
+ - This is "branch stacking" the new branch builds on top of the unmerged one.
800
+ - When the previous MR/PR is eventually merged into main, rebase the stacked branch:
812
801
  ```bash
813
- git worktree add .worktrees/feat/{next} -b feat/{next} feat/{previous}
802
+ git -C .worktrees/feat/{next} rebase --onto main feat/{previous}
814
803
  ```
815
- Note the stacking. When the previous MR/PR is merged: `git -C .worktrees/feat/{next} rebase --onto main feat/{previous}`
804
+ - If the next task does NOT depend on the previous MR/PR, create worktree from main as usual.
816
805
  - **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."
817
806
  - **→ EXIT NOW.** One task per invocation — STEP 10 is complete, end session. The external loop will start the next invocation.
818
- - **CRITICAL: ZERO commits after merge.** Do NOT `git add`, do NOT `git commit`, do NOT create `chore:` commits after the merge.
807
+ - **CRITICAL: ZERO commits after STEP 10.** Do NOT `git add`, do NOT `git commit`, do NOT create `chore:` commits after cleanup.
819
808
  - **If no `[ ]` tasks remain in current phase AND zero `[~]` exist** (all completed) -> phase transition (handled at start of STEP 1)
820
809
  - **If no `[ ]` tasks remain in ALL phases AND zero `[~]` exist** (everything completed):
821
810
  - **Pre-completion check**: Run `git status --short` — if there are uncommitted/untracked source files (excluding `.env`, `node_modules/`, `.claude/autonomous-state.json`), do NOT enter completion sequence. These files represent unfinished work. Create a task to review and commit them, then continue STEP 1.
@@ -844,7 +833,7 @@ For critical production bugs (outside normal TODO.md flow):
844
833
  5. If reviewer finds CRITICAL or WARN issues: fix them and re-review (max 2 cycles for hotfixes). If still failing, commit anyway — hotfix urgency takes priority.
845
834
  6. Commit & push from worktree (STEP 9) — include in the SAME commit:
846
835
  - Do NOT update TODO.md checkboxes unless the fix corresponds to an existing task
847
- 7. Post-merge: follow STEP 10 logic (merge to main from project root, clean up worktree + branch). No additional commits.
836
+ 7. Post-task: follow STEP 10 logic (push, create MR/PR if git integration active, clean up worktree). No additional commits.
848
837
  8. **Patch release**: if git integration active, delegate to `devops-integrator`: "Hotfix merged. Create a patch release with changelog." If CLAUDE.md has `Distribution: npm`, follow the same publish verification logic as phase transition (watch CI pipeline, verify `npm view`, fall back to direct publish on failure).
849
838
 
850
839
  **Skipped steps:** STEP 4 (tests — unless the bug reveals missing test coverage), STEP 5 (visual verification).
@@ -863,13 +852,17 @@ If a merge conflict occurs:
863
852
  5. If rebase is too complex: `cd {worktree-path} && git merge origin/main` instead (creates merge commit but is safer)
864
853
  6. Log the conflict resolution
865
854
 
866
- **During `git merge feat/branch` on main** (STEP 10, from project root):
855
+ **During `git merge feat/branch` on main** (STEP 10, local merge only — no git integration):
867
856
  1. Resolve the conflict in the merge commit (do NOT rebase here — you are on main)
868
857
  2. `git add [resolved files]` (only resolved files — do NOT use `git add .`), then `git merge --continue`
869
858
  3. Verify the merged result: build, lint, test from project root
870
859
  4. Push: `git push origin HEAD`
871
860
  5. Then clean up: `git worktree remove .worktrees/feat/{slug} && git branch -d feat/{slug}`
872
861
 
862
+ **During rebase in worktree** (branch stacking or MR/PR conflict):
863
+ 1. Resolve conflicts in the worktree: `git -C {worktree-path} add [resolved files]`, then `git -C {worktree-path} rebase --continue`
864
+ 2. Force-push the rebased branch: `git -C {worktree-path} push --force-with-lease`
865
+
873
866
  ## Proactive Problem Resolution
874
867
 
875
868
  All agents have access to a `report_issue` tool provided by the scheduler. When an agent encounters a problem outside its current task scope, it calls this tool to create a tracked issue. The scheduler picks it up on the next iteration and routes it through the normal pipeline.
@@ -914,6 +907,15 @@ Examples:
914
907
  - CI unfixable: `status: completed, action: ci_needs_config, message: "CI pipeline failed — missing NODE_AUTH_TOKEN secret. Task merged locally (fallback).", task_completed: "#42 User auth", next_task: "#43 Dashboard"`
915
908
  - Blocked: `status: blocked, action: needs_user_decision, message: "Task #15 requires API design decision — REST vs GraphQL. Cannot proceed without guidance."`
916
909
 
910
+ ## Research First — Then Implement (STRICT)
911
+
912
+ Before solving any problem, agents MUST research whether a correct/proper solution exists:
913
+ 1. **Read documentation** — check official docs, existing code patterns, API references
914
+ 2. **Verify assumptions** — grep for existing implementations, check library APIs, read types
915
+ 3. **Only then implement** — using the verified correct approach
916
+
917
+ Never guess or implement a workaround when a proper solution might exist. If unsure, delegate research to the relevant specialist agent before proceeding.
918
+
917
919
  ## No Workarounds — Fix the Root Cause (STRICT)
918
920
 
919
921
  When a tool, library, or process fails (e.g., `nx release`, `nx build`, a @cibule/* package, a generator), **fix the underlying issue** instead of bypassing it with a workaround. For example:
@@ -972,7 +974,7 @@ After handling the user's message, resume the development cycle from where you l
972
974
  - NEVER implement without architect plan (STEP 2) or skip code review (STEP 6)
973
975
  - Each commit = 1 logical unit
974
976
  - Conventional commits: feat/fix/refactor/chore/docs
975
- - **ABSOLUTE BAN: NEVER create commits that only change tracking files.** TODO.md changes (local mode) are committed WITH implementation code in STEP 9. After merge (STEP 10), ZERO commits. Forbidden patterns: `chore: update progress tracking`, `chore: update TODO.md`. If TODO.md shows as modified after merge, something went wrong in STEP 9 — investigate and fix, do NOT create a band-aid commit.
977
+ - **ABSOLUTE BAN: NEVER create commits that only change tracking files.** TODO.md changes (local mode) are committed WITH implementation code in STEP 9. After STEP 10, ZERO commits. Forbidden patterns: `chore: update progress tracking`, `chore: update TODO.md`. If TODO.md shows as modified after cleanup, something went wrong in STEP 9 — investigate and fix, do NOT create a band-aid commit.
976
978
  - All files in ENGLISH
977
979
  - TODO.md is your task tracking system (local mode) — keep it PRECISE and CURRENT
978
980
  - **NEVER add `eslint-disable` comments** (inline, next-line, or block). Fix the actual code instead. If a lint rule cannot be satisfied, restructure the code — do not suppress the warning.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-claude-workspace",
3
- "version": "2.3.38",
3
+ "version": "2.3.40",
4
4
  "author": "",
5
5
  "repository": {
6
6
  "type": "git",