@torka/claude-workflows 0.3.0 → 0.3.1

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.
@@ -67,22 +67,42 @@ current_path: $(pwd)
67
67
 
68
68
  ### 2. Discover Sidecar Files
69
69
 
70
- Scan for existing epic execution state files:
70
+ Scan for existing epic execution state files.
71
71
 
72
+ **IMPORTANT:** When running in a worktree, the sidecar was created in the **main repo** before session restart. You must search the main repo's sidecar folder, not just the local worktree folder.
73
+
74
+ **If running in MAIN REPO (`is_worktree` = false):**
72
75
  ```bash
73
76
  ls -la {sidecarFolder}/epic-*-state.yaml 2>/dev/null
74
77
  ```
75
78
 
79
+ **If running in WORKTREE (`is_worktree` = true):**
80
+ ```bash
81
+ # Derive main repo path from git
82
+ MAIN_REPO_PATH=$(dirname "$(git rev-parse --git-common-dir)")
83
+ MAIN_SIDECAR_FOLDER="$MAIN_REPO_PATH/_bmad-output/epic-executions"
84
+
85
+ # Search main repo sidecar folder (canonical location where setup created it)
86
+ ls -la "$MAIN_SIDECAR_FOLDER"/epic-*-state.yaml 2>/dev/null
87
+ ```
88
+
89
+ **Store main repo sidecar path for later use:**
90
+ ```
91
+ main_sidecar_folder: "$MAIN_SIDECAR_FOLDER" # Only when is_worktree=true
92
+ ```
93
+
76
94
  **For each sidecar found, extract:**
77
95
  - Epic number (from filename pattern)
78
96
  - `current_phase` value
79
97
  - `worktree_config.worktree_path` (if present)
80
98
  - `stories_pending` count
99
+ - `sidecar_path` (full path to the sidecar file)
81
100
 
82
101
  **Build sidecar list:**
83
102
  ```
84
103
  sidecars_found:
85
104
  - file: "epic-2-state.yaml"
105
+ sidecar_path: "/main/repo/_bmad-output/epic-executions/epic-2-state.yaml"
86
106
  epic_number: 2
87
107
  phase: "executing"
88
108
  worktree_path: "/path/to/worktree" | null
@@ -106,10 +126,12 @@ Based on detection results, determine the appropriate path:
106
126
  ```
107
127
  Detected: Running in worktree for Epic {N}
108
128
  Found matching execution state with {X} stories pending.
129
+ Sidecar location: {sidecar_path}
109
130
 
110
131
  Routing to continuation...
111
132
  ```
112
133
 
134
+ → Pass `sidecar_path` context for subsequent steps to use
113
135
  → Load, read entire file, then execute `{continueFile}`
114
136
 
115
137
  ---
@@ -131,7 +153,7 @@ Setup was completed in previous session.
131
153
  Ready to begin story execution...
132
154
  ```
133
155
 
134
- → Update sidecar: `current_phase: "executing"`
156
+ → Update sidecar at `{sidecar_path}` (the matched sidecar's full path): `current_phase: "executing"`
135
157
  → Load, read entire file, then execute step-02-orchestrate.md
136
158
 
137
159
  ---
@@ -72,9 +72,9 @@ To resume epic execution from a previous session by loading the sidecar state, d
72
72
 
73
73
  **Note:** This step is routed from step-01-init which already detected:
74
74
  - Whether we're in a worktree or main repo
75
- - Which sidecar file to use (passed as context)
75
+ - Which sidecar file to use (passed as `sidecar_path` context)
76
76
 
77
- If sidecar was NOT specified by router (edge case):
77
+ If `sidecar_path` was NOT specified by router (edge case):
78
78
 
79
79
  ```bash
80
80
  # Detect worktree context
@@ -82,21 +82,28 @@ GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
82
82
  GIT_COMMON=$(git rev-parse --git-common-dir 2>/dev/null)
83
83
  CURRENT_PATH=$(pwd)
84
84
 
85
- # If in worktree, find matching sidecar
85
+ # Determine sidecar search location
86
86
  if [ "$GIT_DIR" != "$GIT_COMMON" ]; then
87
- # Search for sidecar with matching worktree_path
88
- # Parse each epic-*-state.yaml and match worktree_config.worktree_path
87
+ # In worktree - sidecar is in main repo
88
+ MAIN_REPO_PATH=$(dirname "$GIT_COMMON")
89
+ SIDECAR_FOLDER="$MAIN_REPO_PATH/_bmad-output/epic-executions"
90
+ else
91
+ # In main repo - use local folder
92
+ SIDECAR_FOLDER="{sidecarFolder}"
89
93
  fi
94
+
95
+ # Find sidecar with matching worktree_path (if in worktree)
96
+ # Parse each epic-*-state.yaml and match worktree_config.worktree_path == CURRENT_PATH
90
97
  ```
91
98
 
92
99
  **Worktree-specific notes:**
93
- - Sidecar files are ALWAYS in main repo's `{sidecarFolder}`
94
- - When in worktree, sidecar is accessed via the shared git history
95
- - `worktree_config.worktree_path` in sidecar identifies the worktree
100
+ - Sidecar files are ALWAYS created in the **main repo's** `_bmad-output/epic-executions/`
101
+ - When in a worktree, you must derive the main repo path to find the sidecar
102
+ - `worktree_config.worktree_path` in sidecar identifies which worktree it belongs to
96
103
 
97
104
  ### 1. Load Sidecar State
98
105
 
99
- Read the sidecar file at `{sidecarFolder}/epic-{N}-state.yaml`:
106
+ Read the sidecar file at the path determined above (use `sidecar_path` from router context, or derive it as shown in section 0):
100
107
 
101
108
  Extract:
102
109
  - `epic_execution_state.epic_file`: Path to epic being executed
@@ -79,11 +79,14 @@ To autonomously execute all pending stories in the epic by orchestrating special
79
79
 
80
80
  ## CONTEXT BOUNDARIES:
81
81
 
82
+ - **Sidecar path:** Use `sidecar_path` from router context (step-01-init). In worktree mode, the sidecar is in the main repo's `_bmad-output/epic-executions/`, NOT the worktree's folder.
82
83
  - Sidecar file tracks current story and phase
83
84
  - Each agent gets fresh context with specific instructions
84
85
  - Sprint-status.yaml is source of truth for story states
85
86
  - Handoff messages provide phase completion status
86
87
 
88
+ **CRITICAL for worktree mode:** All sidecar updates must use the absolute `sidecar_path` passed from step-01-init. Do NOT use `{sidecarFolder}` directly as it resolves to the wrong location in worktrees.
89
+
87
90
  ---
88
91
 
89
92
  ## STORY EXECUTION LOOP
@@ -74,6 +74,7 @@ To generate the Epic Completion Report, create a Pull Request, handle worktree c
74
74
 
75
75
  ## CONTEXT BOUNDARIES:
76
76
 
77
+ - **Sidecar path:** Use `sidecar_path` from router context (step-01-init). In worktree mode, the sidecar is in the main repo's `_bmad-output/epic-executions/`, NOT the worktree's folder.
77
78
  - Sidecar file contains complete execution history
78
79
  - All story outcomes recorded in execution_log
79
80
  - Sprint-status reflects final story states
@@ -86,7 +87,9 @@ To generate the Epic Completion Report, create a Pull Request, handle worktree c
86
87
 
87
88
  ### 1. Load Execution Data
88
89
 
89
- Read the sidecar file at `{sidecarFolder}/epic-{N}-state.yaml`:
90
+ Read the sidecar file using `sidecar_path` from router context (passed through step-01-init → step-01b/02):
91
+
92
+ **Note:** In worktree mode, this path points to the main repo's sidecar location, not the worktree's.
90
93
 
91
94
  Gather:
92
95
  - `epic_execution_state.epic_file`, `epic_execution_state.epic_name`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torka/claude-workflows",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Claude Code workflow helpers: epic automation, git cleanup, agents, and design workflows",
5
5
  "keywords": [
6
6
  "claude-code",