specweave 3.1.0 → 3.1.2

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 (73) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/dist/src/adapters/adapter-loader.d.ts +6 -1
  3. package/dist/src/adapters/adapter-loader.d.ts.map +1 -1
  4. package/dist/src/adapters/adapter-loader.js +17 -1
  5. package/dist/src/adapters/adapter-loader.js.map +1 -1
  6. package/dist/src/cli/commands/init.d.ts.map +1 -1
  7. package/dist/src/cli/commands/init.js +2 -1
  8. package/dist/src/cli/commands/init.js.map +1 -1
  9. package/dist/src/cli/commands/pickup.js +1 -1
  10. package/dist/src/cli/commands/pickup.js.map +1 -1
  11. package/dist/src/cli/commands/review.d.ts +2 -1
  12. package/dist/src/cli/commands/review.d.ts.map +1 -1
  13. package/dist/src/cli/commands/review.js +30 -6
  14. package/dist/src/cli/commands/review.js.map +1 -1
  15. package/dist/src/cli/commands/task.d.ts.map +1 -1
  16. package/dist/src/cli/commands/task.js +30 -5
  17. package/dist/src/cli/commands/task.js.map +1 -1
  18. package/dist/src/cli/commands/verify.d.ts.map +1 -1
  19. package/dist/src/cli/commands/verify.js +4 -2
  20. package/dist/src/cli/commands/verify.js.map +1 -1
  21. package/dist/src/cli/helpers/init/claude-install-line.d.ts +6 -0
  22. package/dist/src/cli/helpers/init/claude-install-line.d.ts.map +1 -0
  23. package/dist/src/cli/helpers/init/claude-install-line.js +11 -0
  24. package/dist/src/cli/helpers/init/claude-install-line.js.map +1 -0
  25. package/dist/src/cli/helpers/init/directory-structure.js +1 -1
  26. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  27. package/dist/src/cli/helpers/init/next-steps.d.ts.map +1 -1
  28. package/dist/src/cli/helpers/init/next-steps.js +7 -6
  29. package/dist/src/cli/helpers/init/next-steps.js.map +1 -1
  30. package/dist/src/core/hooks/handlers/stop.d.ts +11 -3
  31. package/dist/src/core/hooks/handlers/stop.d.ts.map +1 -1
  32. package/dist/src/core/hooks/handlers/stop.js +55 -5
  33. package/dist/src/core/hooks/handlers/stop.js.map +1 -1
  34. package/dist/src/core/increment/close-pending.d.ts +54 -0
  35. package/dist/src/core/increment/close-pending.d.ts.map +1 -0
  36. package/dist/src/core/increment/close-pending.js +125 -0
  37. package/dist/src/core/increment/close-pending.js.map +1 -0
  38. package/dist/src/core/increment/completion-validator.d.ts.map +1 -1
  39. package/dist/src/core/increment/completion-validator.js +7 -0
  40. package/dist/src/core/increment/completion-validator.js.map +1 -1
  41. package/dist/src/core/increment/status-commands.d.ts.map +1 -1
  42. package/dist/src/core/increment/status-commands.js +9 -9
  43. package/dist/src/core/increment/status-commands.js.map +1 -1
  44. package/dist/src/core/review/brief.d.ts.map +1 -1
  45. package/dist/src/core/review/brief.js +2 -1
  46. package/dist/src/core/review/brief.js.map +1 -1
  47. package/dist/src/core/session/handoff-doc-format.d.ts +2 -0
  48. package/dist/src/core/session/handoff-doc-format.d.ts.map +1 -1
  49. package/dist/src/core/session/handoff-doc-format.js +7 -2
  50. package/dist/src/core/session/handoff-doc-format.js.map +1 -1
  51. package/dist/src/core/session/handoff-list.d.ts +2 -2
  52. package/dist/src/core/session/handoff-list.d.ts.map +1 -1
  53. package/dist/src/core/session/handoff-list.js +3 -3
  54. package/dist/src/core/session/handoff-list.js.map +1 -1
  55. package/dist/src/core/session/handoff-secret-scrub.d.ts.map +1 -1
  56. package/dist/src/core/session/handoff-secret-scrub.js +49 -9
  57. package/dist/src/core/session/handoff-secret-scrub.js.map +1 -1
  58. package/dist/src/core/session/pickup.d.ts.map +1 -1
  59. package/dist/src/core/session/pickup.js +14 -6
  60. package/dist/src/core/session/pickup.js.map +1 -1
  61. package/dist/src/core/session/session-checkpoint.d.ts.map +1 -1
  62. package/dist/src/core/session/session-checkpoint.js +5 -1
  63. package/dist/src/core/session/session-checkpoint.js.map +1 -1
  64. package/dist/src/core/session/work-handoff.d.ts.map +1 -1
  65. package/dist/src/core/session/work-handoff.js +4 -2
  66. package/dist/src/core/session/work-handoff.js.map +1 -1
  67. package/package.json +1 -1
  68. package/plugins/specweave/.claude-plugin/plugin.json +1 -1
  69. package/plugins/specweave/hooks/run.mjs +12 -1
  70. package/plugins/specweave/skills/do/SKILL.md +9 -2
  71. package/plugins/specweave/skills/handoff/SKILL.md +6 -3
  72. package/plugins/specweave/skills/increment/SKILL.md +4 -0
  73. package/src/templates/AGENTS.md.template +4 -4
@@ -31,6 +31,17 @@ function hasActiveAutoSession(data) {
31
31
  }
32
32
  return false;
33
33
  }
34
+ // `specweave task done`/`skip` writes ~/.specweave/close-pending/<session>.json
35
+ // when an increment's last task turns terminal; Stop then reminds that session
36
+ // once to verify and close it. Only that session spawns the worker: every
37
+ // other stop stays on the fast path.
38
+ function hasClosePendingFor(data) {
39
+ const session = typeof data.session_id === 'string' ? data.session_id : '';
40
+ if (!/^[A-Za-z0-9._-]{1,128}$/.test(session) || session === '.' || session === '..') return false;
41
+ if (data.stop_hook_active === true) return false;
42
+ try { return existsSync(path.join(homedir(), '.specweave', 'close-pending', `${session}.json`)); }
43
+ catch { return false; }
44
+ }
34
45
  // PreToolUse fast path. Ordinary edits and ordinary shell commands must not
35
46
  // spawn a worker, resolve npm or import the CLI. Write|Edit only matter inside
36
47
  // `.specweave/increments/`; Bash only matters when the project opted into the
@@ -100,7 +111,7 @@ process.stdin.on('end',()=>{
100
111
  catch {return finish({},'invalid_input');}
101
112
  if(!['session-start','pre-tool-use','pre-compact','stop'].includes(event))return finish({});
102
113
  if(process.env.SPECWEAVE_DISABLE_HOOKS === '1')return finish({});
103
- if(event === 'stop' && !hasActiveAutoSession(data))return finish({});
114
+ if(event === 'stop' && !hasActiveAutoSession(data) && !hasClosePendingFor(data))return finish({});
104
115
  if(event === 'pre-tool-use' && skipPreToolUse(data))return finish({});
105
116
  const env={...process.env};
106
117
  child=spawn(process.execPath,[worker,event],{env,detached:process.platform !== 'win32',stdio:['pipe','pipe','pipe']});
@@ -72,8 +72,15 @@ merge and close; do not implement.
72
72
 
73
73
  ## Finish without asking
74
74
 
75
- When `task next` has nothing left, run sw-done: verify, review, complete.
76
- "All tasks are done, should I close?" is the anti-pattern.
75
+ When `task next` has nothing left, run sw-done: verify, review, complete, in the same
76
+ session. "All tasks are done, should I close?" is the anti-pattern.
77
+
78
+ Plan for it from the start: a progress checklist or status you keep for the user ends
79
+ with "Verify and close 0042", not with "merge" or "release". Work that shipped through
80
+ a PR still gets `specweave task done T-03 --evidence "<commit sha>"` first, or the ledger
81
+ never shows it finished. A session never ends with every task done and the increment
82
+ still open; if a close gate stops you (verify fails, a manual check only the user can
83
+ do), say which one in your report. A lane agent leaves the close to its lead.
77
84
 
78
85
  ## Stopping early
79
86
 
@@ -52,7 +52,8 @@ or a `Waits on: ...` line in the increment's `handoff.md`; a `wait` with the not
52
52
 
53
53
  On the other side, "pick up all" is `specweave pickup --all`: the newest index,
54
54
  actionable increments first, then the ones waiting on a person. Start each topic with
55
- its resume prompt, then `specweave pickup <id>`.
55
+ its resume prompt, then `specweave pickup <id>` and sw-do, which closes each one
56
+ whose tasks all end up done.
56
57
 
57
58
  ## Your hand-written handoff is kept
58
59
 
@@ -93,7 +94,8 @@ account", run `specweave pickup`. It fetches the last handoff, moves this branch
93
94
  forward to it and applies the handed-off edits (only on a clean tree), then prints the
94
95
  increment, the next task with its acceptance criteria and any notes. If it reports
95
96
  uncommitted changes or a diverged branch, do what it says; never discard the user's
96
- edits. Then continue with sw-do.
97
+ edits. Then continue with sw-do, which closes the increment through sw-done once its
98
+ last task is done.
97
99
 
98
100
  Several sessions can hand off in one project (each increment's handoff, and a session
99
101
  that hit the limit in a worktree or with several increments active). `specweave handoff
@@ -130,4 +132,5 @@ git push -u origin HEAD
130
132
  ```
131
133
 
132
134
  To pick up by hand: `git fetch origin`, check out that branch, read its `handoff.md`,
133
- and continue at the first task in spec.md with no `done` line in the ledger.
135
+ and continue at the first task in spec.md with no `done` line in the ledger. When none
136
+ is left, close it as sw-done says.
@@ -108,3 +108,7 @@ Files that change and in what order, decisions, rejected alternatives, risks.
108
108
 
109
109
  Show the ACs and tasks. Unless the user asked to review the plan first, carry on with
110
110
  sw-do (one agent, or parallel lanes for three or more disjoint groups of tasks).
111
+ Opening an increment makes closing it part of the same job: any plan or checklist you
112
+ show ends with "Verify and close 0042", and sw-do closes it through sw-done once the last
113
+ task is done. When the plan waits for the user's review, say the increment stays open
114
+ until they answer.
@@ -8,12 +8,12 @@ This project uses SpecWeave. Plan increments in `.specweave/increments/NNNN-slug
8
8
  ## The loop
9
9
 
10
10
  1. `specweave pickup`: applies the latest handoff and prints the open increment, next task and ACs, other claims, branch state, notes and project memory.
11
- 2. New work needing ACs or handoff: `specweave create-increment "title"`, then fill spec.md. First ask the user only their critical decisions, one at a time with a recommended answer, and record them under `## Decisions` (sw-increment). If an open increment owns the files, add ACs and tasks there. Small fixes need no increment.
11
+ 2. New work needing ACs or handoff: `specweave create-increment "title"`, then fill spec.md. First ask the user only their critical decisions, one at a time with a recommended answer, and record them under `## Decisions` (sw-increment). If an open increment owns the files, add ACs and tasks there. Small fixes need no increment. Close what you open: its plan ends with "Verify and close NNNN".
12
12
  3. `specweave task claim T-NN`, edit only that task's Files, commit as `NNNN: what changed`, then `specweave task done T-NN --run "<its Test>"`.
13
- 4. `specweave verify`, a review in a fresh session for anything that ships, then `specweave complete NNNN`.
14
- 5. Before stopping or switching tools/accounts: `specweave handoff --reason "<why>"`.
13
+ 4. When the last task is done or skipped, without asking: `specweave verify`, a fresh-context review (subagent or new session) for anything that ships, `specweave complete NNNN`. PR-shipped work needs `task done` first.
14
+ 5. Stopping with tasks left, or switching tools: `specweave handoff --reason "<why>"`.
15
15
 
16
- **Handoff.** When the user says "hand off", "out of tokens" or "switching accounts", or "[Usage limit reached" appears (outside SpecWithCode), run `specweave handoff --reason "<why>"`; tell them to say "pick up" in the other tool. "[Usage limit approaching" or usage heads-ups mean keep working; say so. When the user says "pick up", run `specweave pickup`; continue its task, passing any given id/title. Take the newest handoff if several; say which.
16
+ **Handoff.** When the user says "hand off", "out of tokens" or "switching accounts", or "[Usage limit reached" appears (outside SpecWithCode), run `specweave handoff --reason "<why>"`; tell them to say "pick up" in the other tool. "[Usage limit approaching" or usage heads-ups mean keep working; say so. When the user says "pick up", run `specweave pickup`; continue through step 4, passing any given id/title. Take the newest handoff if several; say which.
17
17
 
18
18
  Tasks in spec.md: `### T-01 Title`, then `- AC: AC-01 | Files: src/a.ts, tests/e2e/a.test.ts | Test: npm test -- e2e/a`. An AC is met when its tasks are done. Leave notes with `specweave note "<text>"`. Skills: `.agents/skills/sw-*` and `.claude/skills/sw-*`; other tools: `npx vskill install anton-abyzov/specweave/sw-do`.
19
19
  <!-- /SECTION -->