@specforge/canary-cli 0.2.16 → 0.2.18

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.
Files changed (51) hide show
  1. package/dist/cli/config/paths.d.ts +15 -0
  2. package/dist/cli/config/paths.d.ts.map +1 -1
  3. package/dist/cli/config/paths.js +5 -0
  4. package/dist/cli/config/paths.js.map +1 -1
  5. package/dist/cli/config/work-sessions-base-registry.d.ts +61 -0
  6. package/dist/cli/config/work-sessions-base-registry.d.ts.map +1 -0
  7. package/dist/cli/config/work-sessions-base-registry.js +50 -0
  8. package/dist/cli/config/work-sessions-base-registry.js.map +1 -0
  9. package/dist/cli/templates/agents/content/core/sfag-orchestrator.d.ts.map +1 -1
  10. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js +34 -6
  11. package/dist/cli/templates/agents/content/core/sfag-orchestrator.js.map +1 -1
  12. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.d.ts.map +1 -1
  13. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js +37 -6
  14. package/dist/cli/templates/agents/content/core/sfag-ticket-implementer.js.map +1 -1
  15. package/dist/tools/core/git-injection.d.ts +45 -26
  16. package/dist/tools/core/git-injection.d.ts.map +1 -1
  17. package/dist/tools/core/git-injection.js +35 -37
  18. package/dist/tools/core/git-injection.js.map +1 -1
  19. package/dist/tools/index.d.ts.map +1 -1
  20. package/dist/tools/index.js +50 -7
  21. package/dist/tools/index.js.map +1 -1
  22. package/node_modules/@specforge/api-types/package.json +1 -1
  23. package/node_modules/@specforge/report-types/package.json +1 -1
  24. package/node_modules/@specforge/session-types/CHANGELOG.md +4 -0
  25. package/node_modules/@specforge/session-types/dist/index.d.ts +1 -1
  26. package/node_modules/@specforge/session-types/dist/index.d.ts.map +1 -1
  27. package/node_modules/@specforge/session-types/dist/index.js +1 -1
  28. package/node_modules/@specforge/session-types/dist/index.js.map +1 -1
  29. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.d.ts.map +1 -1
  30. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.js +3 -1
  31. package/node_modules/@specforge/session-types/dist/runtime/implementation-config.js.map +1 -1
  32. package/node_modules/@specforge/session-types/dist/runtime/lifecycle-contract.d.ts +27 -1
  33. package/node_modules/@specforge/session-types/dist/runtime/lifecycle-contract.d.ts.map +1 -1
  34. package/node_modules/@specforge/session-types/dist/runtime/work-session-file-change.d.ts +7 -1
  35. package/node_modules/@specforge/session-types/dist/runtime/work-session-file-change.d.ts.map +1 -1
  36. package/node_modules/@specforge/session-types/dist/schema/index.d.ts +1 -1
  37. package/node_modules/@specforge/session-types/dist/schema/index.d.ts.map +1 -1
  38. package/node_modules/@specforge/session-types/dist/schema/index.js +1 -1
  39. package/node_modules/@specforge/session-types/dist/schema/index.js.map +1 -1
  40. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.d.ts +99 -0
  41. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.d.ts.map +1 -1
  42. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.js +36 -0
  43. package/node_modules/@specforge/session-types/dist/schema/work-session-file-change.js.map +1 -1
  44. package/node_modules/@specforge/session-types/dist/schema/work-session.d.ts +17 -0
  45. package/node_modules/@specforge/session-types/dist/schema/work-session.d.ts.map +1 -1
  46. package/node_modules/@specforge/session-types/dist/schema/work-session.js +15 -0
  47. package/node_modules/@specforge/session-types/dist/schema/work-session.js.map +1 -1
  48. package/node_modules/@specforge/session-types/package.json +1 -1
  49. package/package.json +6 -6
  50. package/src/cli/templates/agents/content/core/sfag-orchestrator.ts +34 -6
  51. package/src/cli/templates/agents/content/core/sfag-ticket-implementer.ts +37 -6
@@ -98,6 +98,21 @@ So, before every \`start_work_session\`:
98
98
  (If you are not inside a git worktree, SWS still runs — the precondition treats a
99
99
  non-git caller as clean.)
100
100
 
101
+ ### Pass your \`worktree\` when you run in parallel
102
+
103
+ The MCP-local git reads (clean status, commit hash) resolve in the MCP server's current
104
+ directory. When several workers run **concurrently under one orchestrator, they share one
105
+ MCP server** — so each worker MUST tell SWS/CWS which worktree it lives in, or every
106
+ worker's git evidence would come from the launcher's directory instead of its own.
107
+
108
+ - If the orchestrator gave you a worktree path, pass it as \`worktree\` on **every**
109
+ \`start_work_session\` and \`complete_work_session\` call (use the same value for both).
110
+ - Two active sessions in the **same** worktree are denied (\`concurrent_worktree\`) — that
111
+ denial means you are missing (or sharing) a worktree; create your own (\`git worktree
112
+ add\`) and retry with its path.
113
+ - Running a **single** session in the current directory? Omit \`worktree\` — the current
114
+ directory is used, exactly as before.
115
+
101
116
  ## Step 1: Pick a ticket (autonomous)
102
117
 
103
118
  Pick the next actionable ticket yourself — no need to ask anyone:
@@ -111,7 +126,8 @@ Keep going through ready tickets until none remain.
111
126
 
112
127
  Ensure the worktree is clean (see the git-clean precondition), then:
113
128
  \`\`\`
114
- start_work_session({ ticketId })
129
+ start_work_session({ ticketId }) // single session, current directory
130
+ start_work_session({ ticketId, worktree: "/abs/path/to/your/worktree" }) // parallel worker
115
131
  // ready → active; returns the full orientation + workSessionId (the sessionId).
116
132
  \`\`\`
117
133
  Read the orientation in full. It IS your brief:
@@ -124,7 +140,9 @@ Read the orientation in full. It IS your brief:
124
140
 
125
141
  If SWS comes back \`outcome: "denied"\`, read the guidance and act on it: \`git_dirty\` →
126
142
  commit and retry; \`unfinished_dependencies\` → a dependency is not \`done\`, pick a
127
- different ready ticket; an aborted implementation stop, this spec is off-limits.
143
+ different ready ticket; \`concurrent_worktree\`another active session is in your
144
+ worktree, create your own (\`git worktree add\`) and retry with its \`worktree\` path; an
145
+ aborted implementation → stop, this spec is off-limits.
128
146
 
129
147
  ## Step 3: Implement + record — the assay-driven order
130
148
 
@@ -193,15 +211,24 @@ action_work_session({ ticketId, action: {
193
211
  }})
194
212
  \`\`\`
195
213
  Any **extra or divergent** file (not in the planned set) needs a justification, or it
196
- costs coherence:
214
+ costs coherence. When you justify one, VERIFY what plan item it fulfils and set
215
+ \`fulfills\` (both \`kind\` and \`id\` are required): if the file **replaces a declared file**
216
+ of a step, link it with \`{kind:"step", id:<step id>, fileId:<the declared fileChangeId>}\`
217
+ — that link is what UNBLOCKS the finalize when the plan under-declared the file; if it
218
+ exists to satisfy an **acceptance criterion or a test**, use
219
+ \`{kind:"acceptance_criterion"|"test", id}\`:
197
220
  \`\`\`
198
221
  action_work_session({ ticketId, action: {
199
222
  action: "add_file_change_justification", workSessionId,
200
223
  expectedPath: "src/util/hash.ts", expectedAction: "create",
201
- justification: "Extracted the hashing helper the AC requires; shared by the service."
224
+ justification: "Produced this instead of the declared src/util/crypto.ts; same role.",
225
+ fulfills: { kind: "step", id: "<step id>", fileId: "<declared fileChangeId>" }
202
226
  }})
203
227
  \`\`\`
204
- Use \`amend_file_change_justification\` to replace one after a rejection.
228
+ A deviation that replaces a declared file WITHOUT a \`fulfills.step\` holds the finalize,
229
+ and coherence reads low because the plan under-declared it — that is expected and honest.
230
+ Use \`amend_file_change_justification\` to replace one after a rejection (re-declare the
231
+ corrected \`fulfills\` — the amend OVERRIDES the prior link).
205
232
 
206
233
  ### 3d. Acceptance criteria (AC)
207
234
 
@@ -241,7 +268,10 @@ complete_work_session({
241
268
  ticketId,
242
269
  summary: "Implemented user registration: service, endpoint, validation, tests",
243
270
  filesCreated: [...], filesModified: [...],
244
- validation: { tests: { passed: 8, failed: 0 } }
271
+ validation: { tests: { passed: 8, failed: 0 } },
272
+ // If you passed a worktree to start_work_session, pass the SAME one here so the
273
+ // commit hash is read from YOUR worktree (omit it for a single session).
274
+ // worktree: "/abs/path/to/your/worktree"
245
275
  })
246
276
  // active → done; finalizes the WorkSession; the cascade unblocks dependents.
247
277
  // When every spec ticket is done, the spec → done and the ImplementationSession finalizes.
@@ -330,6 +360,7 @@ ticket — never a reset.
330
360
  ## Quality Gate (self-check before complete_work_session)
331
361
 
332
362
  - [ ] Worktree was clean before start_work_session (no \`git_dirty\` denial)
363
+ - [ ] If running in parallel: passed your \`worktree\` path to start_work_session AND complete_work_session
333
364
  - [ ] All implementation steps marked done via mark_implementation_step_completion
334
365
  - [ ] Tests run and recorded via record_test_result; every skip/failure justified
335
366
  - [ ] Every touched/divergent file recorded via record_file_change; divergences justified