claude-code-workflow 6.3.42 → 6.3.44
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/.claude/agents/tdd-developer.md +530 -0
- package/.claude/commands/issue/discover-by-prompt.md +5 -1
- package/.claude/commands/issue/discover.md +472 -468
- package/.claude/commands/issue/execute.md +580 -581
- package/.claude/commands/issue/new.md +417 -413
- package/.claude/commands/issue/plan.md +11 -13
- package/.claude/commands/issue/queue.md +445 -441
- package/.claude/commands/task/breakdown.md +207 -203
- package/.claude/commands/task/replan.md +440 -436
- package/.claude/commands/workflow/action-plan-verify.md +485 -447
- package/.claude/commands/workflow/brainstorm/artifacts.md +457 -453
- package/.claude/commands/workflow/brainstorm/auto-parallel.md +5 -1
- package/.claude/commands/workflow/brainstorm/synthesis.md +402 -398
- package/.claude/commands/workflow/clean.md +67 -35
- package/.claude/commands/workflow/debug-with-file.md +670 -666
- package/.claude/commands/workflow/debug.md +331 -327
- package/.claude/commands/workflow/develop-with-file.md +5 -1
- package/.claude/commands/workflow/execute.md +546 -498
- package/.claude/commands/workflow/lite-execute.md +44 -26
- package/.claude/commands/workflow/lite-fix.md +780 -730
- package/.claude/commands/workflow/lite-lite-lite.md +5 -1
- package/.claude/commands/workflow/lite-plan.md +87 -39
- package/.claude/commands/workflow/multi-cli-plan.md +572 -568
- package/.claude/commands/workflow/plan-verify.md +527 -0
- package/.claude/commands/workflow/plan.md +555 -551
- package/.claude/commands/workflow/replan.md +572 -515
- package/.claude/commands/workflow/review-fix.md +608 -610
- package/.claude/commands/workflow/session/complete.md +37 -14
- package/.claude/commands/workflow/session/solidify.md +303 -299
- package/.claude/commands/workflow/tdd-plan.md +630 -597
- package/.claude/commands/workflow/tdd-verify.md +391 -206
- package/.claude/commands/workflow/tools/conflict-resolution.md +24 -12
- package/.claude/commands/workflow/tools/task-generate-agent.md +583 -563
- package/.claude/commands/workflow/tools/task-generate-tdd.md +749 -517
- package/.claude/commands/workflow/ui-design/animation-extract.md +1154 -1150
- package/.claude/commands/workflow/ui-design/layout-extract.md +792 -788
- package/.claude/commands/workflow/ui-design/style-extract.md +777 -773
- package/.claude/skills/ccw/command.json +4 -4
- package/.claude/skills/ccw-coordinator/README.md +45 -0
- package/.claude/skills/ccw-coordinator/SKILL.md +320 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-abort.md +9 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-command-build.md +40 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-command-execute.md +124 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-command-selection.md +48 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-complete.md +25 -0
- package/.claude/skills/ccw-coordinator/phases/actions/action-init.md +26 -0
- package/.claude/skills/ccw-coordinator/phases/orchestrator.md +59 -0
- package/.claude/skills/ccw-coordinator/phases/state-schema.md +66 -0
- package/.claude/skills/ccw-coordinator/skill-config.json +66 -0
- package/.claude/skills/ccw-coordinator/specs/command-library.md +169 -0
- package/.claude/skills/ccw-coordinator/specs/specs.md +362 -0
- package/.claude/skills/ccw-coordinator/tools/README.md +95 -0
- package/.claude/skills/ccw-coordinator/tools/chain-validate.cjs +320 -0
- package/.claude/skills/ccw-coordinator/tools/command-registry.cjs +255 -0
- package/.claude/skills/ccw-help/command.json +5 -5
- package/.claude/skills/ccw-help/scripts/analyze_commands.py +337 -337
- package/.claude/workflows/cli-templates/prompts/workflow-impl-plan-template.txt +1 -1
- package/.codex/skills/parallel-dev-cycle/README.md +19 -16
- package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +90 -5
- package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +89 -4
- package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -696
- package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -436
- package/.codex/skills/parallel-dev-cycle/skill.md +194 -0
- package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -423
- package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +31 -16
- package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +74 -73
- package/ccw/dist/commands/issue.d.ts +4 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +73 -6
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js +32 -28
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts +10 -0
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +45 -0
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +38 -11
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/src/commands/issue.ts +84 -6
- package/ccw/src/core/routes/cli-routes.ts +30 -25
- package/ccw/src/templates/dashboard-js/views/help.js +1 -1
- package/ccw/src/tools/claude-cli-tools.ts +50 -0
- package/ccw/src/tools/codex-lens.ts +40 -11
- package/package.json +1 -1
- package/.codex/skills/parallel-dev-cycle/SKILL.md +0 -513
|
@@ -12,19 +12,26 @@ The coordination protocol enables four parallel agents (RA, EP, CD, VAS) to comm
|
|
|
12
12
|
|
|
13
13
|
**Location**: `.workflow/.cycle/{cycleId}.json`
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**Access Pattern**:
|
|
16
|
+
- **Agents**: READ ONLY - check dependencies and status
|
|
17
|
+
- **Orchestrator**: READ-WRITE - updates state after each phase
|
|
16
18
|
|
|
17
19
|
```javascript
|
|
18
|
-
// Every agent: Read
|
|
20
|
+
// Every agent: Read state to check dependencies
|
|
19
21
|
const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
|
|
22
|
+
const canProceed = checkDependencies(state)
|
|
20
23
|
|
|
21
|
-
//
|
|
22
|
-
|
|
24
|
+
// Agent outputs PHASE_RESULT (reports to orchestrator, NOT writes directly)
|
|
25
|
+
console.log("PHASE_RESULT: ...")
|
|
26
|
+
|
|
27
|
+
// Only Orchestrator writes to state file after receiving PHASE_RESULT
|
|
28
|
+
// Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(updatedState, null, 2))
|
|
23
29
|
```
|
|
24
30
|
|
|
25
31
|
**Protocol**:
|
|
26
|
-
-
|
|
27
|
-
-
|
|
32
|
+
- Only orchestrator writes to state file (no concurrent writes, no lock needed)
|
|
33
|
+
- Agents read state to understand dependencies
|
|
34
|
+
- Timestamp all orchestrator updates with ISO8601 format
|
|
28
35
|
- Never delete existing data, only append
|
|
29
36
|
|
|
30
37
|
### 2. Progress Markdown Files (Async Log)
|
|
@@ -33,18 +40,18 @@ Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
|
|
|
33
40
|
|
|
34
41
|
Each agent writes progress to dedicated markdown files:
|
|
35
42
|
|
|
36
|
-
| Agent |
|
|
37
|
-
|
|
38
|
-
| RA | requirements.md
|
|
39
|
-
| EP | exploration.md, architecture.md, plan.json |
|
|
40
|
-
| CD | implementation.md,
|
|
41
|
-
| VAS | validation.md, test-results.json
|
|
43
|
+
| Agent | Main Documents (Rewrite) | Logs (Append-Only) |
|
|
44
|
+
|-------|--------------------------|-------------------|
|
|
45
|
+
| RA | requirements.md | changes.log |
|
|
46
|
+
| EP | exploration.md, architecture.md, plan.json | changes.log |
|
|
47
|
+
| CD | implementation.md, issues.md | changes.log, debug-log.ndjson |
|
|
48
|
+
| VAS | validation.md, summary.md, test-results.json | changes.log |
|
|
42
49
|
|
|
43
50
|
**Protocol**:
|
|
44
|
-
-
|
|
45
|
-
-
|
|
51
|
+
- **Main documents**: Complete rewrite per iteration, archived to `history/`
|
|
52
|
+
- **Log files**: Append-only (changes.log, debug-log.ndjson) - never delete
|
|
53
|
+
- **Version synchronization**: All main documents share same version (e.g., all v1.1.0 in iteration 2)
|
|
46
54
|
- Include timestamp on each update
|
|
47
|
-
- Maintain backward compatibility
|
|
48
55
|
|
|
49
56
|
### 3. Orchestrator send_input (Synchronous)
|
|
50
57
|
|
|
@@ -198,6 +205,8 @@ PHASE_DETAILS:
|
|
|
198
205
|
|
|
199
206
|
## Dependency Resolution
|
|
200
207
|
|
|
208
|
+
**Execution Model**: All four agents are spawned in parallel, but execution blocks based on dependencies. Orchestrator manages dependency resolution via shared state.
|
|
209
|
+
|
|
201
210
|
### Build Order (Default)
|
|
202
211
|
|
|
203
212
|
```
|
|
@@ -206,6 +215,12 @@ RA (Requirements) → EP (Planning) → CD (Development) → VAS (Validation)
|
|
|
206
215
|
Block EP Block CD Block VAS Block completion
|
|
207
216
|
```
|
|
208
217
|
|
|
218
|
+
**Explanation**:
|
|
219
|
+
- All agents spawned simultaneously
|
|
220
|
+
- Each agent checks dependencies in shared state before proceeding
|
|
221
|
+
- Blocked agents wait for dependency completion
|
|
222
|
+
- Orchestrator uses `send_input` to notify dependent agents when ready
|
|
223
|
+
|
|
209
224
|
### Parallel Opportunities
|
|
210
225
|
|
|
211
226
|
Some phases can run in parallel:
|
|
@@ -384,7 +399,7 @@ console.log(state.coordination.feedback_log)
|
|
|
384
399
|
tail .workflow/.cycle/cycle-xxx.progress/ra/changes.log
|
|
385
400
|
|
|
386
401
|
# Check CD changes
|
|
387
|
-
grep "TASK-001" .workflow/.cycle/cycle-xxx.progress/cd/
|
|
402
|
+
grep "TASK-001" .workflow/.cycle/cycle-xxx.progress/cd/changes.log
|
|
388
403
|
|
|
389
404
|
# Check coordination timeline
|
|
390
405
|
tail -50 .workflow/.cycle/cycle-xxx.progress/coordination/feedback.md
|
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
# Document Versioning Strategy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Document version management strategy: Complete Rewrite + Archive History
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Recommended Approach: Complete Rewrite + Archive History
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
For each iteration, **completely rewrite** the main document, and automatically archive the old version to the `history/` directory.
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### File Structure
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
.workflow/.cycle/cycle-v1-20260122-abc123.progress/
|
|
13
13
|
├── ra/
|
|
14
|
-
│ ├── requirements.md # v1.2.0 (
|
|
15
|
-
│ ├── edge-cases.md # v1.2.0 (
|
|
16
|
-
│ ├── changes.log # NDJSON
|
|
14
|
+
│ ├── requirements.md # v1.2.0 (current version, complete rewrite)
|
|
15
|
+
│ ├── edge-cases.md # v1.2.0 (current version, complete rewrite)
|
|
16
|
+
│ ├── changes.log # NDJSON complete change history (append-only)
|
|
17
17
|
│ └── history/
|
|
18
|
-
│ ├── requirements-v1.0.0.md (
|
|
19
|
-
│ ├── requirements-v1.1.0.md (
|
|
20
|
-
│ ├── edge-cases-v1.0.0.md (
|
|
21
|
-
│ └── edge-cases-v1.1.0.md (
|
|
18
|
+
│ ├── requirements-v1.0.0.md (archived)
|
|
19
|
+
│ ├── requirements-v1.1.0.md (archived)
|
|
20
|
+
│ ├── edge-cases-v1.0.0.md (archived)
|
|
21
|
+
│ └── edge-cases-v1.1.0.md (archived)
|
|
22
22
|
├── ep/
|
|
23
|
-
│ ├── exploration.md # v1.2.0 (
|
|
24
|
-
│ ├── architecture.md # v1.2.0 (
|
|
25
|
-
│ ├── plan.json # v1.2.0 (
|
|
23
|
+
│ ├── exploration.md # v1.2.0 (current)
|
|
24
|
+
│ ├── architecture.md # v1.2.0 (current)
|
|
25
|
+
│ ├── plan.json # v1.2.0 (current)
|
|
26
26
|
│ └── history/
|
|
27
27
|
│ ├── plan-v1.0.0.json
|
|
28
28
|
│ └── plan-v1.1.0.json
|
|
29
29
|
├── cd/
|
|
30
|
-
│ ├── implementation.md # v1.2.0 (
|
|
31
|
-
│ ├──
|
|
32
|
-
│ ├──
|
|
30
|
+
│ ├── implementation.md # v1.2.0 (current)
|
|
31
|
+
│ ├── changes.log # NDJSON complete history
|
|
32
|
+
│ ├── debug-log.ndjson # Debug hypothesis tracking
|
|
33
|
+
│ ├── issues.md # Current unresolved issues
|
|
33
34
|
│ └── history/
|
|
34
35
|
│ ├── implementation-v1.0.0.md
|
|
35
36
|
│ └── implementation-v1.1.0.md
|
|
36
37
|
└── vas/
|
|
37
|
-
├── validation.md # v1.2.0 (
|
|
38
|
-
├── test-results.json # v1.2.0 (
|
|
39
|
-
├── summary.md # v1.2.0 (
|
|
38
|
+
├── validation.md # v1.2.0 (current)
|
|
39
|
+
├── test-results.json # v1.2.0 (current)
|
|
40
|
+
├── summary.md # v1.2.0 (current)
|
|
40
41
|
└── history/
|
|
41
42
|
├── validation-v1.0.0.md
|
|
42
43
|
└── test-results-v1.0.0.json
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
##
|
|
46
|
+
## Optimized Document Template
|
|
46
47
|
|
|
47
|
-
### Requirements.md (
|
|
48
|
+
### Requirements.md (Complete Rewrite Version)
|
|
48
49
|
|
|
49
50
|
```markdown
|
|
50
51
|
# Requirements Specification - v1.2.0
|
|
@@ -162,7 +163,7 @@ Response time < 500ms for all OAuth flows.
|
|
|
162
163
|
**Detailed History**: See `history/` directory and `changes.log`
|
|
163
164
|
```
|
|
164
165
|
|
|
165
|
-
### Changes.log (NDJSON -
|
|
166
|
+
### Changes.log (NDJSON - Complete History)
|
|
166
167
|
|
|
167
168
|
```jsonl
|
|
168
169
|
{"timestamp":"2026-01-22T10:00:00+08:00","iteration":1,"version":"1.0.0","action":"create","type":"requirement","id":"FR-001","description":"Initial OAuth requirement"}
|
|
@@ -173,37 +174,37 @@ Response time < 500ms for all OAuth flows.
|
|
|
173
174
|
{"timestamp":"2026-01-23T10:05:00+08:00","iteration":3,"version":"1.2.0","action":"update","type":"requirement","id":"FR-002","description":"Added GitHub provider"}
|
|
174
175
|
```
|
|
175
176
|
|
|
176
|
-
##
|
|
177
|
+
## Implementation Flow
|
|
177
178
|
|
|
178
|
-
### Agent
|
|
179
|
+
### Agent Workflow (RA Example)
|
|
179
180
|
|
|
180
181
|
```javascript
|
|
181
|
-
// ==================== RA Agent
|
|
182
|
+
// ==================== RA Agent Iteration Flow ====================
|
|
182
183
|
|
|
183
|
-
//
|
|
184
|
+
// Read current state
|
|
184
185
|
const state = JSON.parse(Read(`.workflow/.cycle/${cycleId}.json`))
|
|
185
186
|
const currentVersion = state.requirements?.version || "0.0.0"
|
|
186
187
|
const iteration = state.current_iteration
|
|
187
188
|
|
|
188
|
-
//
|
|
189
|
+
// If iteration (old version exists)
|
|
189
190
|
if (currentVersion !== "0.0.0") {
|
|
190
|
-
// 1.
|
|
191
|
+
// 1. Archive old version
|
|
191
192
|
const oldFile = `.workflow/.cycle/${cycleId}.progress/ra/requirements.md`
|
|
192
193
|
const archiveFile = `.workflow/.cycle/${cycleId}.progress/ra/history/requirements-v${currentVersion}.md`
|
|
193
194
|
|
|
194
|
-
Copy(oldFile, archiveFile) //
|
|
195
|
+
Copy(oldFile, archiveFile) // Archive
|
|
195
196
|
|
|
196
|
-
// 2.
|
|
197
|
+
// 2. Read old version (optional, for context understanding)
|
|
197
198
|
const oldRequirements = Read(oldFile)
|
|
198
199
|
|
|
199
|
-
// 3.
|
|
200
|
+
// 3. Read change history
|
|
200
201
|
const changesLog = readNDJSON(`.workflow/.cycle/${cycleId}.progress/ra/changes.log`)
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
// 4.
|
|
204
|
+
// 4. Generate new version number
|
|
204
205
|
const newVersion = bumpVersion(currentVersion, 'minor') // 1.1.0 -> 1.2.0
|
|
205
206
|
|
|
206
|
-
// 5.
|
|
207
|
+
// 5. Generate new document (complete rewrite)
|
|
207
208
|
const newRequirements = generateRequirements({
|
|
208
209
|
version: newVersion,
|
|
209
210
|
previousVersion: currentVersion,
|
|
@@ -211,13 +212,13 @@ const newRequirements = generateRequirements({
|
|
|
211
212
|
currentChanges: "Added MFA and GitHub provider",
|
|
212
213
|
iteration: iteration,
|
|
213
214
|
taskDescription: state.description,
|
|
214
|
-
changesLog: changesLog //
|
|
215
|
+
changesLog: changesLog // For understanding history
|
|
215
216
|
})
|
|
216
217
|
|
|
217
|
-
// 6.
|
|
218
|
+
// 6. Write new document (overwrite old)
|
|
218
219
|
Write(`.workflow/.cycle/${cycleId}.progress/ra/requirements.md`, newRequirements)
|
|
219
220
|
|
|
220
|
-
// 7.
|
|
221
|
+
// 7. Append change to changes.log
|
|
221
222
|
appendNDJSON(`.workflow/.cycle/${cycleId}.progress/ra/changes.log`, {
|
|
222
223
|
timestamp: getUtc8ISOString(),
|
|
223
224
|
iteration: iteration,
|
|
@@ -228,7 +229,7 @@ appendNDJSON(`.workflow/.cycle/${cycleId}.progress/ra/changes.log`, {
|
|
|
228
229
|
description: "Added MFA requirement"
|
|
229
230
|
})
|
|
230
231
|
|
|
231
|
-
// 8.
|
|
232
|
+
// 8. Update state
|
|
232
233
|
state.requirements = {
|
|
233
234
|
version: newVersion,
|
|
234
235
|
output_file: `.workflow/.cycle/${cycleId}.progress/ra/requirements.md`,
|
|
@@ -242,25 +243,25 @@ state.requirements = {
|
|
|
242
243
|
Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
|
|
243
244
|
```
|
|
244
245
|
|
|
245
|
-
##
|
|
246
|
+
## Advantages Comparison
|
|
246
247
|
|
|
247
|
-
|
|
|
248
|
-
|
|
249
|
-
|
|
|
250
|
-
| **Agent
|
|
251
|
-
|
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
| **Token
|
|
248
|
+
| Aspect | Incremental Update | Complete Rewrite + Archive |
|
|
249
|
+
|--------|-------------------|---------------------------|
|
|
250
|
+
| **Document Conciseness** | ❌ Gets longer | ✅ Always concise |
|
|
251
|
+
| **Agent Parsing** | ❌ Must parse history | ✅ Only read current version |
|
|
252
|
+
| **Maintenance Complexity** | ❌ High (version marking) | ✅ Low (direct rewrite) |
|
|
253
|
+
| **File Size** | ❌ Bloats | ✅ Fixed |
|
|
254
|
+
| **History Tracking** | ✅ In main document | ✅ In history/ + changes.log |
|
|
255
|
+
| **Human Readability** | ❌ Must skip history | ✅ Direct current view |
|
|
256
|
+
| **Token Usage** | ❌ More (read complete history) | ✅ Less (only read current) |
|
|
256
257
|
|
|
257
|
-
##
|
|
258
|
+
## Archive Strategy
|
|
258
259
|
|
|
259
|
-
###
|
|
260
|
+
### Auto-Archive Trigger
|
|
260
261
|
|
|
261
262
|
```javascript
|
|
262
263
|
function shouldArchive(currentVersion, state) {
|
|
263
|
-
//
|
|
264
|
+
// Archive on each version update
|
|
264
265
|
return currentVersion !== state.requirements?.version
|
|
265
266
|
}
|
|
266
267
|
|
|
@@ -269,29 +270,29 @@ function archiveOldVersion(cycleId, agent, filename, currentVersion) {
|
|
|
269
270
|
const archiveDir = `.workflow/.cycle/${cycleId}.progress/${agent}/history`
|
|
270
271
|
const archiveFile = `${archiveDir}/${filename.replace('.', `-v${currentVersion}.`)}`
|
|
271
272
|
|
|
272
|
-
//
|
|
273
|
+
// Ensure archive directory exists
|
|
273
274
|
mkdir -p ${archiveDir}
|
|
274
275
|
|
|
275
|
-
//
|
|
276
|
+
// Copy (not move, keep current file until new version written)
|
|
276
277
|
Copy(currentFile, archiveFile)
|
|
277
278
|
|
|
278
279
|
console.log(`Archived ${filename} v${currentVersion} to history/`)
|
|
279
280
|
}
|
|
280
281
|
```
|
|
281
282
|
|
|
282
|
-
###
|
|
283
|
+
### Cleanup Strategy (Optional)
|
|
283
284
|
|
|
284
|
-
|
|
285
|
+
Keep most recent N versions, delete older archives:
|
|
285
286
|
|
|
286
287
|
```javascript
|
|
287
288
|
function cleanupArchives(cycleId, agent, keepVersions = 3) {
|
|
288
289
|
const historyDir = `.workflow/.cycle/${cycleId}.progress/${agent}/history`
|
|
289
290
|
const archives = listFiles(historyDir)
|
|
290
291
|
|
|
291
|
-
//
|
|
292
|
+
// Sort by version number
|
|
292
293
|
archives.sort((a, b) => compareVersions(extractVersion(a), extractVersion(b)))
|
|
293
294
|
|
|
294
|
-
//
|
|
295
|
+
// Delete oldest versions (keep most recent N)
|
|
295
296
|
if (archives.length > keepVersions) {
|
|
296
297
|
const toDelete = archives.slice(0, archives.length - keepVersions)
|
|
297
298
|
toDelete.forEach(file => Delete(`${historyDir}/${file}`))
|
|
@@ -299,32 +300,32 @@ function cleanupArchives(cycleId, agent, keepVersions = 3) {
|
|
|
299
300
|
}
|
|
300
301
|
```
|
|
301
302
|
|
|
302
|
-
## Changes.log
|
|
303
|
+
## Importance of Changes.log
|
|
303
304
|
|
|
304
|
-
|
|
305
|
+
Although main document is completely rewritten, **changes.log (NDJSON) permanently preserves complete history**:
|
|
305
306
|
|
|
306
307
|
```bash
|
|
307
|
-
#
|
|
308
|
+
# View all changes
|
|
308
309
|
cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq .
|
|
309
310
|
|
|
310
|
-
#
|
|
311
|
+
# View history of specific requirement
|
|
311
312
|
cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq 'select(.id=="FR-001")'
|
|
312
313
|
|
|
313
|
-
#
|
|
314
|
+
# View changes by iteration
|
|
314
315
|
cat .workflow/.cycle/cycle-xxx.progress/ra/changes.log | jq 'select(.iteration==2)'
|
|
315
316
|
```
|
|
316
317
|
|
|
317
|
-
|
|
318
|
-
-
|
|
319
|
-
- **Changes.log**:
|
|
320
|
-
- **History/**:
|
|
318
|
+
This way:
|
|
319
|
+
- **Main Document**: Clear and concise (current state)
|
|
320
|
+
- **Changes.log**: Complete traceability (all history)
|
|
321
|
+
- **History/**: Snapshot backups (view on demand)
|
|
321
322
|
|
|
322
|
-
##
|
|
323
|
+
## Recommended Implementation
|
|
323
324
|
|
|
324
|
-
1. ✅
|
|
325
|
-
2. ✅
|
|
326
|
-
3. ✅
|
|
327
|
-
4. ✅ Changes.log (NDJSON)
|
|
328
|
-
5. ✅
|
|
325
|
+
1. ✅ Adopt "Complete Rewrite" strategy
|
|
326
|
+
2. ✅ Main document only keeps "previous version summary"
|
|
327
|
+
3. ✅ Auto-archive to `history/` directory
|
|
328
|
+
4. ✅ Changes.log (NDJSON) preserves complete history
|
|
329
|
+
5. ✅ Optional: Keep most recent 3-5 historical versions
|
|
329
330
|
|
|
330
|
-
|
|
331
|
+
This approach keeps documents concise (agent-friendly) while preserving complete history (audit-friendly).
|
|
@@ -168,6 +168,10 @@ interface IssueOptions {
|
|
|
168
168
|
limit?: number;
|
|
169
169
|
labels?: string;
|
|
170
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Clear cached project root (for testing)
|
|
173
|
+
*/
|
|
174
|
+
export declare function clearProjectRootCache(): void;
|
|
171
175
|
export declare function readIssues(): Issue[];
|
|
172
176
|
export declare function writeIssues(issues: Issue[]): void;
|
|
173
177
|
export declare function readSolutions(issueId: string): Solution[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue.d.ts","sourceRoot":"","sources":["../../src/commands/issue.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2BH,UAAU,aAAa;IACrB,IAAI,EAAE,SAAS,GAAG,eAAe,GAAG,WAAW,CAAC;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3G,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAGhB,iBAAiB,CAAC,EAAE,MAAM,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CAAC,CAwHf"}
|
|
@@ -26,6 +26,25 @@ process.stdout.on('error', (err) => {
|
|
|
26
26
|
});
|
|
27
27
|
const ISSUES_DIR = '.workflow/issues';
|
|
28
28
|
// ============ Storage Layer (JSONL) ============
|
|
29
|
+
/**
|
|
30
|
+
* Cached project root to avoid repeated git command execution
|
|
31
|
+
*/
|
|
32
|
+
let cachedProjectRoot = null;
|
|
33
|
+
/**
|
|
34
|
+
* Clear cached project root (for testing)
|
|
35
|
+
*/
|
|
36
|
+
export function clearProjectRootCache() {
|
|
37
|
+
cachedProjectRoot = null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Debug logging helper (enabled via CCW_DEBUG=true)
|
|
41
|
+
*/
|
|
42
|
+
const DEBUG = process.env.CCW_DEBUG === 'true';
|
|
43
|
+
function debugLog(msg) {
|
|
44
|
+
if (DEBUG) {
|
|
45
|
+
console.log(`[ccw:worktree] ${msg}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
29
48
|
/**
|
|
30
49
|
* Normalize path for comparison (handles Windows case sensitivity)
|
|
31
50
|
*/
|
|
@@ -63,7 +82,29 @@ function resolveMainRepoFromGitFile(gitFilePath) {
|
|
|
63
82
|
* This ensures .workflow/issues/ is always accessed from the main repo.
|
|
64
83
|
*/
|
|
65
84
|
function getProjectRoot() {
|
|
66
|
-
//
|
|
85
|
+
// Return cached result if available
|
|
86
|
+
if (cachedProjectRoot) {
|
|
87
|
+
debugLog(`Using cached project root: ${cachedProjectRoot}`);
|
|
88
|
+
return cachedProjectRoot;
|
|
89
|
+
}
|
|
90
|
+
debugLog(`Detecting project root from cwd: ${process.cwd()}`);
|
|
91
|
+
// Priority 1: Check CCW_MAIN_REPO environment variable
|
|
92
|
+
const envMainRepo = process.env.CCW_MAIN_REPO;
|
|
93
|
+
if (envMainRepo) {
|
|
94
|
+
debugLog(`Found CCW_MAIN_REPO env: ${envMainRepo}`);
|
|
95
|
+
const hasWorkflow = existsSync(join(envMainRepo, '.workflow'));
|
|
96
|
+
const hasGit = existsSync(join(envMainRepo, '.git'));
|
|
97
|
+
if (hasWorkflow || hasGit) {
|
|
98
|
+
debugLog(`CCW_MAIN_REPO validated (workflow=${hasWorkflow}, git=${hasGit})`);
|
|
99
|
+
cachedProjectRoot = envMainRepo;
|
|
100
|
+
return envMainRepo;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
console.warn('[ccw] CCW_MAIN_REPO is set but path is invalid (no .workflow or .git)');
|
|
104
|
+
console.warn(`[ccw] Path: ${envMainRepo}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Priority 2: Try to detect if we're in a git worktree using git commands
|
|
67
108
|
try {
|
|
68
109
|
// Get the common git directory (points to main repo's .git)
|
|
69
110
|
const gitCommonDir = execSync('git rev-parse --git-common-dir', {
|
|
@@ -77,6 +118,8 @@ function getProjectRoot() {
|
|
|
77
118
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
78
119
|
timeout: EXEC_TIMEOUTS.GIT_QUICK,
|
|
79
120
|
}).trim();
|
|
121
|
+
debugLog(`Git common dir: ${gitCommonDir}`);
|
|
122
|
+
debugLog(`Git dir: ${gitDir}`);
|
|
80
123
|
// Normalize paths for comparison (Windows case insensitive)
|
|
81
124
|
const normalizedCommon = normalizePath(gitCommonDir);
|
|
82
125
|
const normalizedGit = normalizePath(gitDir);
|
|
@@ -86,8 +129,11 @@ function getProjectRoot() {
|
|
|
86
129
|
const absoluteCommonDir = resolve(process.cwd(), gitCommonDir);
|
|
87
130
|
// .git directory's parent is the repo root
|
|
88
131
|
const mainRepoRoot = resolve(absoluteCommonDir, '..');
|
|
132
|
+
debugLog(`Detected worktree, main repo: ${mainRepoRoot}`);
|
|
89
133
|
// Verify .workflow or .git exists in main repo
|
|
90
134
|
if (existsSync(join(mainRepoRoot, '.workflow')) || existsSync(join(mainRepoRoot, '.git'))) {
|
|
135
|
+
debugLog(`Main repo validated, returning: ${mainRepoRoot}`);
|
|
136
|
+
cachedProjectRoot = mainRepoRoot;
|
|
91
137
|
return mainRepoRoot;
|
|
92
138
|
}
|
|
93
139
|
}
|
|
@@ -96,9 +142,10 @@ function getProjectRoot() {
|
|
|
96
142
|
if (isExecTimeoutError(err)) {
|
|
97
143
|
console.warn(`[issue] git rev-parse timed out after ${EXEC_TIMEOUTS.GIT_QUICK}ms; falling back to filesystem detection`);
|
|
98
144
|
}
|
|
145
|
+
debugLog(`Git command failed, falling back to filesystem detection`);
|
|
99
146
|
// Git command failed - fall through to manual detection
|
|
100
147
|
}
|
|
101
|
-
// Standard detection with worktree file support: walk up to find .workflow or .git
|
|
148
|
+
// Priority 3: Standard detection with worktree file support: walk up to find .workflow or .git
|
|
102
149
|
let dir = process.cwd();
|
|
103
150
|
while (dir !== resolve(dir, '..')) {
|
|
104
151
|
const gitPath = join(dir, '.git');
|
|
@@ -109,22 +156,42 @@ function getProjectRoot() {
|
|
|
109
156
|
if (gitStat.isFile()) {
|
|
110
157
|
// .git is a file - this is a worktree, try to resolve main repo
|
|
111
158
|
const mainRepo = resolveMainRepoFromGitFile(gitPath);
|
|
112
|
-
|
|
113
|
-
|
|
159
|
+
debugLog(`Parsed .git file, main repo: ${mainRepo}`);
|
|
160
|
+
if (mainRepo) {
|
|
161
|
+
// Verify main repo has .git directory (always true for main repo)
|
|
162
|
+
// Don't require .workflow - it may not exist yet in a new repo
|
|
163
|
+
const hasGit = existsSync(join(mainRepo, '.git'));
|
|
164
|
+
const hasWorkflow = existsSync(join(mainRepo, '.workflow'));
|
|
165
|
+
if (hasGit || hasWorkflow) {
|
|
166
|
+
if (!hasWorkflow) {
|
|
167
|
+
console.warn('[ccw] Worktree detected but main repo has no .workflow directory');
|
|
168
|
+
console.warn(`[ccw] Main repo: ${mainRepo}`);
|
|
169
|
+
console.warn('[ccw] Issue commands may fail until .workflow is created');
|
|
170
|
+
console.warn('[ccw] Set CCW_MAIN_REPO environment variable to override detection');
|
|
171
|
+
}
|
|
172
|
+
debugLog(`Main repo validated via .git file (git=${hasGit}, workflow=${hasWorkflow})`);
|
|
173
|
+
cachedProjectRoot = mainRepo;
|
|
174
|
+
return mainRepo;
|
|
175
|
+
}
|
|
114
176
|
}
|
|
115
|
-
// If main repo doesn't have .workflow, fall back to current worktree
|
|
116
177
|
}
|
|
117
178
|
}
|
|
118
179
|
catch {
|
|
119
180
|
// stat failed, continue with normal logic
|
|
181
|
+
debugLog(`Failed to stat ${gitPath}, continuing`);
|
|
120
182
|
}
|
|
121
183
|
}
|
|
122
184
|
if (existsSync(join(dir, '.workflow')) || existsSync(gitPath)) {
|
|
185
|
+
debugLog(`Found project root at: ${dir}`);
|
|
186
|
+
cachedProjectRoot = dir;
|
|
123
187
|
return dir;
|
|
124
188
|
}
|
|
125
189
|
dir = resolve(dir, '..');
|
|
126
190
|
}
|
|
127
|
-
|
|
191
|
+
debugLog(`No project root found, using cwd: ${process.cwd()}`);
|
|
192
|
+
const fallback = process.cwd();
|
|
193
|
+
cachedProjectRoot = fallback;
|
|
194
|
+
return fallback;
|
|
128
195
|
}
|
|
129
196
|
function getIssuesDir() {
|
|
130
197
|
return join(getProjectRoot(), ISSUES_DIR);
|