spec-manager 0.1.0 → 0.2.0
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/AGENTS.md +1 -1
- package/README.md +94 -28
- package/dist/cli/change.d.ts.map +1 -1
- package/dist/cli/change.js +93 -4
- package/dist/cli/change.js.map +1 -1
- package/dist/cli/completion.d.ts +3 -0
- package/dist/cli/completion.d.ts.map +1 -0
- package/dist/cli/completion.js +30 -0
- package/dist/cli/completion.js.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/project.d.ts.map +1 -1
- package/dist/cli/project.js +71 -7
- package/dist/cli/project.js.map +1 -1
- package/dist/cli/spec.d.ts.map +1 -1
- package/dist/cli/spec.js +42 -14
- package/dist/cli/spec.js.map +1 -1
- package/dist/cli/task.d.ts.map +1 -1
- package/dist/cli/task.js +150 -42
- package/dist/cli/task.js.map +1 -1
- package/dist/cli/usability.d.ts.map +1 -1
- package/dist/cli/usability.js +32 -8
- package/dist/cli/usability.js.map +1 -1
- package/dist/cli/view.d.ts +3 -0
- package/dist/cli/view.d.ts.map +1 -0
- package/dist/cli/view.js +122 -0
- package/dist/cli/view.js.map +1 -0
- package/dist/core/agents.d.ts +23 -1
- package/dist/core/agents.d.ts.map +1 -1
- package/dist/core/agents.js +82 -2
- package/dist/core/agents.js.map +1 -1
- package/dist/core/archive.d.ts.map +1 -1
- package/dist/core/archive.js +74 -2
- package/dist/core/archive.js.map +1 -1
- package/dist/core/audit.d.ts +1 -0
- package/dist/core/audit.d.ts.map +1 -1
- package/dist/core/audit.js +60 -40
- package/dist/core/audit.js.map +1 -1
- package/dist/core/completion.d.ts +12 -0
- package/dist/core/completion.d.ts.map +1 -0
- package/dist/core/completion.js +136 -0
- package/dist/core/completion.js.map +1 -0
- package/dist/core/delta.d.ts +30 -1
- package/dist/core/delta.d.ts.map +1 -1
- package/dist/core/delta.js +141 -4
- package/dist/core/delta.js.map +1 -1
- package/dist/core/harness.d.ts +69 -0
- package/dist/core/harness.d.ts.map +1 -0
- package/dist/core/harness.js +278 -0
- package/dist/core/harness.js.map +1 -0
- package/dist/core/integrity-exemptions.d.ts +29 -0
- package/dist/core/integrity-exemptions.d.ts.map +1 -0
- package/dist/core/integrity-exemptions.js +100 -0
- package/dist/core/integrity-exemptions.js.map +1 -0
- package/dist/core/integrity.d.ts +12 -0
- package/dist/core/integrity.d.ts.map +1 -0
- package/dist/core/integrity.js +163 -0
- package/dist/core/integrity.js.map +1 -0
- package/dist/core/invariants.d.ts +5 -0
- package/dist/core/invariants.d.ts.map +1 -0
- package/dist/core/invariants.js +19 -0
- package/dist/core/invariants.js.map +1 -0
- package/dist/core/lifecycle.d.ts +37 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +70 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/paths.d.ts +3 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/core/paths.js +19 -1
- package/dist/core/paths.js.map +1 -1
- package/dist/core/placeholder.d.ts +6 -0
- package/dist/core/placeholder.d.ts.map +1 -0
- package/dist/core/placeholder.js +12 -0
- package/dist/core/placeholder.js.map +1 -0
- package/dist/core/reconciliation.d.ts +25 -0
- package/dist/core/reconciliation.d.ts.map +1 -0
- package/dist/core/reconciliation.js +122 -0
- package/dist/core/reconciliation.js.map +1 -0
- package/dist/core/remediation.d.ts +41 -0
- package/dist/core/remediation.d.ts.map +1 -0
- package/dist/core/remediation.js +169 -0
- package/dist/core/remediation.js.map +1 -0
- package/dist/core/spec-io.d.ts +3 -5
- package/dist/core/spec-io.d.ts.map +1 -1
- package/dist/core/spec-io.js +26 -13
- package/dist/core/spec-io.js.map +1 -1
- package/dist/core/status.d.ts +6 -3
- package/dist/core/status.d.ts.map +1 -1
- package/dist/core/status.js +12 -4
- package/dist/core/status.js.map +1 -1
- package/dist/core/task.d.ts +26 -0
- package/dist/core/task.d.ts.map +1 -1
- package/dist/core/task.js +74 -46
- package/dist/core/task.js.map +1 -1
- package/dist/core/transaction.d.ts +10 -0
- package/dist/core/transaction.d.ts.map +1 -0
- package/dist/core/transaction.js +65 -0
- package/dist/core/transaction.js.map +1 -0
- package/dist/core/usability.d.ts +8 -2
- package/dist/core/usability.d.ts.map +1 -1
- package/dist/core/usability.js +203 -35
- package/dist/core/usability.js.map +1 -1
- package/dist/core/validate.d.ts +2 -0
- package/dist/core/validate.d.ts.map +1 -1
- package/dist/core/validate.js +29 -1
- package/dist/core/validate.js.map +1 -1
- package/dist/core/view.d.ts +35 -0
- package/dist/core/view.d.ts.map +1 -0
- package/dist/core/view.js +50 -0
- package/dist/core/view.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/change.d.ts +20 -20
- package/dist/schemas/spec.d.ts +12 -12
- package/package.json +2 -1
- package/rules/flow-control.md +3 -3
- package/skill/SKILL.md +14 -2
- package/skill/subskills/impl.md +2 -2
- package/templates/L3-impl.md +2 -2
- package/templates/agent-plan.json +2 -1
- package/templates/agents/AGENTS.md +8 -6
- package/templates/agents/CLAUDE.md +7 -3
- package/templates/agents/CODEBUDDY.md +9 -7
- package/templates/agents/CURSOR.md +28 -0
- package/templates/agents/WINDSURF.md +28 -0
- package/templates/agents/codebuddy-skill/SKILL.md +12 -1
package/AGENTS.md
CHANGED
|
@@ -9,7 +9,7 @@ This project uses `spec-manager` for local-first spec-driven development. Specs,
|
|
|
9
9
|
- Feature work MUST go through `spec-manager`; do not jump directly from a user request to implementation code.
|
|
10
10
|
- New or non-trivial work follows L1 PRD -> L2 Design -> L3 Impl -> Agent Task.
|
|
11
11
|
- Never write implementation code unless the relevant L3 spec is `frozen`.
|
|
12
|
-
- `draft -> confirmed
|
|
12
|
+
- L1/L2 approval advances `draft -> confirmed`; one explicit L3 approval advances `draft -> frozen`. After writing spec content, stop and wait for approval.
|
|
13
13
|
- Before creating a new spec, inspect existing specs and decisions with `spec-manager spec list` and `spec-manager decision list --topic <topic>`.
|
|
14
14
|
- Before code edits, read the relevant frozen L3 spec and create/start an Agent Task.
|
|
15
15
|
- Record execution with `spec-manager task step`; finish with `spec-manager task complete`.
|
package/README.md
CHANGED
|
@@ -15,12 +15,20 @@
|
|
|
15
15
|
- **Four-layer funnel** — Requirements → Design → Implementation → Continuity, with human review gates at each layer
|
|
16
16
|
- **L0/L1/L2/L3 spec hierarchy** — vision / PRD / design / implementation spec
|
|
17
17
|
- **24 rules** with `applies_to` filtering — no need to load all 24 every time
|
|
18
|
-
- **Status machine** `draft → confirmed → frozen → implemented`
|
|
18
|
+
- **Status machine** L1/L2 use `draft → confirmed`; L3 uses `draft → frozen → implemented`
|
|
19
19
|
- **Agent Task lifecycle** — `create → start → step → complete`, steps in spec frontmatter; R5 blocks complete if steps are skipped
|
|
20
|
+
- **Coding harness bridge** — export task context, report task progress, record verification evidence, and propose implementation-scope changes from CLI-friendly commands
|
|
21
|
+
- **Project integrity inspection** — scan for dangling references, conflicting active tasks, missing verifications/decisions, and stale parents; surfaced via `project doctor`
|
|
22
|
+
- **Lifecycle reconciliation** — dry-run/apply plans to retroactively mark historical L1/L2 specs as `implemented` and create missing decision records
|
|
23
|
+
- **Repository remediation** — versioned migrations that retroactively create decision records, integrity exemptions, and missing agent asset directories
|
|
24
|
+
- **File transactions** — atomic, rollback-capable multi-file writes with snapshot-and-restore semantics
|
|
25
|
+
- **Task invariants** — hard-safety checks: one active task per spec, only running tasks accept steps, successful verification required before completion
|
|
20
26
|
- **Decision cards** with `what/why/affectedCriteria` + topic query
|
|
21
27
|
- **Rule audit** with at-least-once local JSON accumulator
|
|
22
28
|
- **Delta specs** (OpenSpec-style `changes/<name>/` with ADDED/MODIFIED/REMOVED/RENAMED + archive merge)
|
|
23
|
-
- **Multi-agent setup** —
|
|
29
|
+
- **Multi-agent setup** — auto-detect or explicitly install instructions for Claude Code, Codex, OpenCode, CodeBuddy, Cursor, and Windsurf
|
|
30
|
+
- **Interactive workflow view** — browse topics, specs, tasks, and next-step suggestions from one terminal UI
|
|
31
|
+
- **Shell completion** — install dynamic zsh/bash/fish completion for commands and spec codes
|
|
24
32
|
- **RFC 2119** keywords (SHALL/MUST/SHOULD) validation in acceptance criteria
|
|
25
33
|
- **Incident tracking** — rule violations drive rule evolution
|
|
26
34
|
|
|
@@ -29,15 +37,11 @@
|
|
|
29
37
|
## Install
|
|
30
38
|
|
|
31
39
|
```bash
|
|
32
|
-
#
|
|
33
|
-
git clone https://github.com/loki-ai-ch/spec-manager.git
|
|
34
|
-
cd spec-manager
|
|
35
|
-
npm install
|
|
36
|
-
npm run build
|
|
37
|
-
npm install -g .
|
|
38
|
-
|
|
39
|
-
# Or run without installing
|
|
40
|
+
# Run directly (recommended)
|
|
40
41
|
npx spec-manager <command>
|
|
42
|
+
|
|
43
|
+
# Or install globally
|
|
44
|
+
npm install -g spec-manager
|
|
41
45
|
```
|
|
42
46
|
|
|
43
47
|
## AI Agent Setup
|
|
@@ -51,7 +55,8 @@ Not every tool has a native "skills" directory. spec-manager installs the closes
|
|
|
51
55
|
```bash
|
|
52
56
|
cd my-project
|
|
53
57
|
spec-manager project init --name my-project
|
|
54
|
-
spec-manager project agents
|
|
58
|
+
spec-manager project agents # auto-detect installed/configured agents
|
|
59
|
+
spec-manager project agents --provider all # or install every supported provider
|
|
55
60
|
```
|
|
56
61
|
|
|
57
62
|
This writes:
|
|
@@ -62,13 +67,16 @@ This writes:
|
|
|
62
67
|
| Codex | `AGENTS.md` workflow capsule, not a native skill | `AGENTS.md` |
|
|
63
68
|
| OpenCode | `AGENTS.md` workflow capsule, not a native skill | `AGENTS.md` |
|
|
64
69
|
| CodeBuddy | Native skill | `CODEBUDDY.md`, `.codebuddy/skills/spec-manager/` |
|
|
70
|
+
| Cursor | Project rules | `.cursor/rules/spec-manager.mdc` |
|
|
71
|
+
| Windsurf | Project rules | `.windsurf/rules/spec-manager.md` |
|
|
65
72
|
|
|
66
73
|
Use a narrower install when needed:
|
|
67
74
|
|
|
68
75
|
```bash
|
|
69
76
|
spec-manager project agents --provider list
|
|
77
|
+
spec-manager project agents --dry-run
|
|
70
78
|
spec-manager project agents --provider all --dry-run
|
|
71
|
-
spec-manager project agents --provider codex,
|
|
79
|
+
spec-manager project agents --provider codex,cursor,windsurf
|
|
72
80
|
spec-manager project agents --provider codebuddy --force
|
|
73
81
|
```
|
|
74
82
|
|
|
@@ -140,26 +148,35 @@ Or use an AI agent configured with spec-manager:
|
|
|
140
148
|
For day-to-day use, these helper commands reduce command memorization:
|
|
141
149
|
|
|
142
150
|
```bash
|
|
143
|
-
spec-manager project doctor # check setup, agent files, skill assets, placeholders, audit
|
|
151
|
+
spec-manager project doctor # check setup, agent files, skill assets, placeholders, audit, integrity
|
|
152
|
+
spec-manager project reconcile # dry-run: retroactively mark historical specs as implemented + create missing decisions
|
|
153
|
+
spec-manager project remediate # versioned migrations: decision records, integrity exemptions, missing agent assets
|
|
144
154
|
spec-manager flow status --topic auth # show L1/L2/L3/Task progress and the next command
|
|
155
|
+
spec-manager view --topic auth # interactively browse specs, tasks, and next steps
|
|
145
156
|
spec-manager guide "add user auth" # print the next useful step for a request
|
|
146
157
|
spec-manager new feature --topic auth "User authentication"
|
|
147
|
-
spec-manager approve auth-L1 # draft→confirmed
|
|
158
|
+
spec-manager approve auth-L1 # L1/L2 draft→confirmed; L3 draft/confirmed→frozen
|
|
148
159
|
spec-manager run auth-L3.1.1 --plan ./plan.json
|
|
149
160
|
spec-manager template L1 --title "User authentication" > l1.md
|
|
161
|
+
spec-manager completion install zsh # also supports bash and fish
|
|
162
|
+
spec-manager completion uninstall # removes all installed completion scripts
|
|
150
163
|
```
|
|
151
164
|
|
|
152
165
|
Long-form commands remain available; the shortcuts only wrap the same rules and state machine.
|
|
153
166
|
|
|
154
167
|
| Command | Use it when | What it gives you |
|
|
155
168
|
|---|---|---|
|
|
156
|
-
| `project doctor` | You are unsure whether the project is ready | Setup checks plus concrete fix commands |
|
|
169
|
+
| `project doctor` | You are unsure whether the project is ready | Setup checks plus integrity scan and concrete fix commands |
|
|
170
|
+
| `project reconcile` | Historical specs need retroactive status fixes | Dry-run/apply plan to mark L1/L2 as implemented + create missing decisions |
|
|
171
|
+
| `project remediate` | Project needs versioned migrations | Creates decision records, integrity exemptions, and missing agent assets |
|
|
157
172
|
| `flow status` | You need to know where a topic is blocked | L1/L2/L3/Task state and the next command |
|
|
173
|
+
| `view` | You want to explore workflow state interactively | Topic/spec/task browser with next-step suggestions |
|
|
158
174
|
| `guide` | You have a request but do not know which command starts it | The next useful step without changing files |
|
|
159
175
|
| `new feature` | You want the fastest safe way to start an L1 | Creates the L1 shell and prints the next update command |
|
|
160
|
-
| `approve` | The user has explicitly approved a spec | Advances `draft→confirmed` or
|
|
176
|
+
| `approve` | The user has explicitly approved a spec | Advances L1/L2 `draft→confirmed` or L3 `draft/confirmed→frozen` |
|
|
161
177
|
| `run` | A frozen L3 is ready to execute | Creates and starts the task from a plan file |
|
|
162
178
|
| `template` | You need a draft file for L1/L2/L3 or `agent-plan` | Prints or writes the bundled template |
|
|
179
|
+
| `completion install/uninstall` | You want shell command and spec-code completion | Installs or removes zsh/bash/fish completion scripts |
|
|
163
180
|
|
|
164
181
|
Examples:
|
|
165
182
|
|
|
@@ -170,6 +187,8 @@ spec-manager template L2 --title "Invoice module" --output l2.md
|
|
|
170
187
|
spec-manager guide "add billing export"
|
|
171
188
|
```
|
|
172
189
|
|
|
190
|
+
After `completion install`, start a new shell session or reload that shell's completion configuration using the printed hint.
|
|
191
|
+
|
|
173
192
|
## Usage scenarios
|
|
174
193
|
|
|
175
194
|
### 1. Quick fix (typo / one-line change)
|
|
@@ -202,8 +221,7 @@ spec-manager spec confirm <l2-code>
|
|
|
202
221
|
|
|
203
222
|
spec-manager spec new L3 --topic billing --title "PDF generation" --parent <l2-code>
|
|
204
223
|
spec-manager spec update <l3-code> --content ./l3.md --ai-summary "..." --change-summary "init"
|
|
205
|
-
spec-manager spec confirm <l3-code>
|
|
206
|
-
spec-manager spec freeze <l3-code> # frozen → can create task
|
|
224
|
+
spec-manager spec confirm <l3-code> # one approval: draft → frozen
|
|
207
225
|
|
|
208
226
|
spec-manager task create <l3-code> --plan ./plan.json --auto-confirm
|
|
209
227
|
spec-manager task start T-001
|
|
@@ -335,9 +353,12 @@ cat > /tmp/jwt-plan.json <<'EOF'
|
|
|
335
353
|
}
|
|
336
354
|
EOF
|
|
337
355
|
|
|
338
|
-
# validate
|
|
356
|
+
# validate a plan file before committing it to the L3
|
|
339
357
|
spec-manager spec validate-plan /tmp/jwt-plan.json
|
|
340
358
|
|
|
359
|
+
# after the L3 contains planJson, validate directly from the spec
|
|
360
|
+
spec-manager spec validate-plan --from-spec auth-L3.1.1-jwt
|
|
361
|
+
|
|
341
362
|
# write L3 body referencing the plan
|
|
342
363
|
cat > /tmp/jwt-l3.md <<'EOF'
|
|
343
364
|
# JWT signing module — L3
|
|
@@ -355,7 +376,7 @@ spec-manager spec update auth-L3.1.1-jwt \
|
|
|
355
376
|
--change-summary "Initial L3"
|
|
356
377
|
```
|
|
357
378
|
|
|
358
|
-
L3 needs
|
|
379
|
+
L3 needs one explicit user approval: `spec confirm auth-L3.1.1-jwt` advances it directly from `draft` to `frozen`. Historical L3 specs already in `confirmed` can still use `spec freeze`. `frozen` remains the prerequisite for creating an Agent Task.
|
|
359
380
|
|
|
360
381
|
### 6. Create and run the Agent Task
|
|
361
382
|
|
|
@@ -364,18 +385,38 @@ spec-manager task create auth-L3.1.1-jwt --plan /tmp/jwt-plan.json --auto-confir
|
|
|
364
385
|
# → outputs: taskId T-001, file specs/auth/tasks/auth-L3.1.1-jwt-T-001.json
|
|
365
386
|
|
|
366
387
|
spec-manager task start T-001 --spec auth-L3.1.1-jwt
|
|
388
|
+
|
|
389
|
+
# optional: export a compact context packet for a coding harness / agent
|
|
390
|
+
spec-manager task context auth-L3.1.1-jwt --format text
|
|
391
|
+
spec-manager task context auth-L3.1.1-jwt --format json
|
|
392
|
+
|
|
367
393
|
# step 1
|
|
368
394
|
spec-manager task step T-001 --spec auth-L3.1.1-jwt --no 1 --type mcp_tool --name "Context gathering" \
|
|
369
395
|
--status succeeded --output-json '{"summary":"read L2 + L1","read":["auth-L2.1"]}' --latency 1200
|
|
370
396
|
# ... repeat for each step
|
|
371
397
|
|
|
398
|
+
# shorthand for harnesses: write a structured progress report into the next/picked task step
|
|
399
|
+
spec-manager task report T-001 --spec auth-L3.1.1-jwt \
|
|
400
|
+
--summary "Implemented JWT signing" \
|
|
401
|
+
--files "src/auth/jwt.ts,src/auth/__tests__/jwt.test.ts" \
|
|
402
|
+
--tests "npm test -- --run src/auth/__tests__/jwt.test.ts"
|
|
403
|
+
|
|
404
|
+
# record verification evidence before completion
|
|
405
|
+
spec-manager task verify T-001 --spec auth-L3.1.1-jwt \
|
|
406
|
+
--command "npm test -- --run src/auth/__tests__/jwt.test.ts" \
|
|
407
|
+
--exit-code 0 \
|
|
408
|
+
--summary "JWT tests passed" \
|
|
409
|
+
--covers-ac AC-1,AC-2
|
|
410
|
+
|
|
372
411
|
spec-manager task complete T-001 --spec auth-L3.1.1-jwt
|
|
373
412
|
# → L3 status: frozen → implemented
|
|
374
413
|
# → if all L3 children of L2 are implemented: L2 cascades to implemented
|
|
375
414
|
# → if all L2 children of L1 are implemented: L1 cascades to implemented
|
|
376
415
|
```
|
|
377
416
|
|
|
378
|
-
`task step` is the per-step report (with required `outputJson` per R15); `task complete` triggers the cascade — it never goes the other way (R2).
|
|
417
|
+
`task context` is designed for coding harnesses and agents that need a bounded work packet before editing. `task step` is the per-step report (with required `outputJson` per R15); `task report` is a compact harness-friendly wrapper around the same step recording model. `task verify` stores command, exit code, summary, artifacts, and covered ACs on the task. `task complete` triggers the cascade — it never goes the other way (R2).
|
|
418
|
+
|
|
419
|
+
Task history is immutable after `completed` or `failed`. A task can complete only after every planned step succeeds and at least one recorded verification has `exitCode=0`. The deprecated `task batch` command cannot synthesize successful execution records.
|
|
379
420
|
|
|
380
421
|
### 7. Record a decision card (R18: L1 implemented)
|
|
381
422
|
|
|
@@ -451,21 +492,46 @@ spec-manager change archive add-2fa
|
|
|
451
492
|
|
|
452
493
|
This gives you a full audit trail: who proposed what, when, and what the spec looked like before the change.
|
|
453
494
|
|
|
495
|
+
When an implementation discovers that the frozen L3 no longer matches reality, keep that deviation explicit and task-linked:
|
|
496
|
+
|
|
497
|
+
```bash
|
|
498
|
+
spec-manager change propose \
|
|
499
|
+
--task T-001 \
|
|
500
|
+
--spec auth-L3.1.1-jwt \
|
|
501
|
+
--reason "The library exposes async key loading, but the L3 specified sync loading" \
|
|
502
|
+
--impact "Update AC-2 and the verification command before merging"
|
|
503
|
+
|
|
504
|
+
spec-manager change list
|
|
505
|
+
spec-manager change show auth-l3-1-1-jwt-t-001-proposal
|
|
506
|
+
|
|
507
|
+
# after amending the L3, recording a decision, or splitting follow-up work
|
|
508
|
+
spec-manager change resolve auth-l3-1-1-jwt-t-001-proposal
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
Task-linked proposals live in `changes/<name>/proposal.md` with `status: unresolved|resolved`. `audit show` warns on unresolved task-linked proposals so implementation drift cannot disappear silently.
|
|
512
|
+
|
|
454
513
|
## Common commands
|
|
455
514
|
|
|
456
515
|
| Command | What it does |
|
|
457
516
|
|---|---|
|
|
458
517
|
| `spec-manager project init --name X` | Initialize `.spec-manager/` |
|
|
459
518
|
| `spec-manager project status` | Project overview (specs by level, recent activity) |
|
|
519
|
+
| `spec-manager project agents [--provider P] [--dry-run]` | Auto-detect or install agent workflow files |
|
|
520
|
+
| `spec-manager project doctor` | Setup + integrity checks with concrete fix commands |
|
|
521
|
+
| `spec-manager project reconcile [--dry-run]` | Retroactively mark historical L1/L2 as implemented + create missing decisions |
|
|
522
|
+
| `spec-manager project remediate [--dry-run]` | Versioned migrations: decisions, exemptions, missing agent assets |
|
|
523
|
+
| `spec-manager view [--topic X]` | Interactive topic/spec/task browser |
|
|
524
|
+
| `spec-manager completion install zsh\|bash\|fish` | Install shell and spec-code completion |
|
|
460
525
|
| `spec-manager spec list [--level L1] [--topic X] [--status draft]` | List specs (filterable) |
|
|
461
526
|
| `spec-manager spec show <code> [--include-content]` | View spec; default is narrow (metadata only, R19) |
|
|
462
527
|
| `spec-manager spec update <code> --content F --ai-summary S --change-summary R` | Write spec body |
|
|
463
528
|
| `spec-manager spec confirm \| freeze \| implement <code>` | Advance status (human-triggered) |
|
|
464
529
|
| `spec-manager spec validate <code>` | Re-run warning-only validation |
|
|
530
|
+
| `spec-manager spec validate-plan [file] [--from-spec <code>]` | Validate planJson from a file or L3 spec |
|
|
465
531
|
| `spec-manager spec add-relation <code> --target T --type based_on\|supersedes\|implements\|references` | Cross-spec reference |
|
|
466
|
-
| `spec-manager task create \| start \| step \| complete \| fail \| list \| show` | Agent Task lifecycle |
|
|
532
|
+
| `spec-manager task create \| start \| step \| report \| verify \| complete \| fail \| list \| show \| context` | Agent Task lifecycle and coding harness bridge |
|
|
467
533
|
| `spec-manager decision create \| list \| show \| update \| set-partial \| supersede \| delete` | Decision cards (R18) |
|
|
468
|
-
| `spec-manager change new \| archive \| list \| show` | Delta spec workflow |
|
|
534
|
+
| `spec-manager change new \| propose \| resolve \| archive \| list \| show` | Delta spec workflow and task-linked implementation change proposals |
|
|
469
535
|
| `spec-manager incident new \| list` | Rule violation tracking |
|
|
470
536
|
| `spec-manager audit hit \| report \| show` | Local rule audit |
|
|
471
537
|
|
|
@@ -482,15 +548,15 @@ my-project/
|
|
|
482
548
|
│ ├── audit.json
|
|
483
549
|
│ └── incidents/
|
|
484
550
|
├── specs/<topic>/
|
|
485
|
-
│ ├── <L1-code
|
|
486
|
-
│ ├── <L2-code
|
|
487
|
-
│ ├── <L3-code>[-desc]
|
|
551
|
+
│ ├── <L1-code>.md
|
|
552
|
+
│ ├── <L2-code>.md
|
|
553
|
+
│ ├── <L3-code>[-desc].md
|
|
488
554
|
│ ├── decisions/ # R18: L1 implemented → decision cards
|
|
489
555
|
│ │ └── DC-001.md
|
|
490
556
|
│ └── tasks/ # R3: L3 frozen → agent tasks
|
|
491
557
|
│ └── <specCode>-T-001.json
|
|
492
558
|
├── changes/<name>/
|
|
493
|
-
│ ├── proposal.md
|
|
559
|
+
│ ├── proposal.md # regular delta proposal or task-linked implementation proposal
|
|
494
560
|
│ ├── deltas/<code>.md
|
|
495
561
|
│ └── specs/<topic>/<code>/<code>.md # ADDED placeholder
|
|
496
562
|
└── archive/<name>/ # merged changes
|
|
@@ -520,7 +586,7 @@ spec-manager/
|
|
|
520
586
|
## Design choices
|
|
521
587
|
|
|
522
588
|
- **Markdown + YAML frontmatter** over JSON or DB: git-friendly, human-readable, diff-able
|
|
523
|
-
- **Atomic file writes** (temp + rename) prevent half-written specs
|
|
589
|
+
- **Atomic file writes** (temp + rename) prevent half-written specs; **file transactions** extend this to multi-spec operations with rollback
|
|
524
590
|
- **Narrow view by default** (`spec show` returns metadata only, R19) — saves context
|
|
525
591
|
- **Warning-only validation** — never throws on content quality issues (per R22, R13); R22 blocks confirm/freeze if content is still placeholder
|
|
526
592
|
- **Local rule audit** — JSON file with at-least-once pending queue (no network to fail)
|
package/dist/cli/change.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/cli/change.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/cli/change.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyK7D"}
|
package/dist/cli/change.js
CHANGED
|
@@ -6,12 +6,48 @@
|
|
|
6
6
|
* archive <name>
|
|
7
7
|
*/
|
|
8
8
|
import { getPaths } from '../core/paths.js';
|
|
9
|
-
import { createChange,
|
|
9
|
+
import { createChange, createTaskLinkedChangeProposal, getChangeDir, listChanges, listTaskLinkedChangeProposals, parseDeltaSpec, readTaskLinkedChangeProposal, resolveTaskLinkedChangeProposal, } from '../core/delta.js';
|
|
10
10
|
import { archiveChange } from '../core/archive.js';
|
|
11
11
|
export function registerChangeCommands(program) {
|
|
12
12
|
const change = program
|
|
13
13
|
.command('change')
|
|
14
14
|
.description('Delta change 提案(OpenSpec 风格:proposal + ADDED/MODIFIED/REMOVED/RENAMED)');
|
|
15
|
+
change
|
|
16
|
+
.command('propose')
|
|
17
|
+
.description('创建与 task/L3 关联的 change proposal')
|
|
18
|
+
.requiredOption('--task <taskCode>', '关联 task code')
|
|
19
|
+
.requiredOption('--spec <specCode>', '关联 L3 spec code')
|
|
20
|
+
.requiredOption('--reason <reason>', '偏差原因')
|
|
21
|
+
.requiredOption('--impact <impact>', '影响范围')
|
|
22
|
+
.option('--json', '以 JSON 格式输出', false)
|
|
23
|
+
.action((opts) => {
|
|
24
|
+
const paths = getPaths();
|
|
25
|
+
try {
|
|
26
|
+
const result = createTaskLinkedChangeProposal({
|
|
27
|
+
paths,
|
|
28
|
+
taskCode: opts.task,
|
|
29
|
+
specCode: opts.spec,
|
|
30
|
+
reason: opts.reason,
|
|
31
|
+
impact: opts.impact,
|
|
32
|
+
});
|
|
33
|
+
if (opts.json) {
|
|
34
|
+
console.log(JSON.stringify(result, null, 2));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
console.log(`✓ Change proposal created: ${result.name}`);
|
|
38
|
+
console.log(` status: ${result.status}`);
|
|
39
|
+
console.log(` task: ${result.taskCode}`);
|
|
40
|
+
console.log(` spec: ${result.specCode}`);
|
|
41
|
+
console.log(` proposal: ${result.proposalFile}`);
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log('Next:');
|
|
44
|
+
console.log(` spec-manager change show ${result.name}`);
|
|
45
|
+
console.log(` spec-manager change resolve ${result.name}`);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
handleChangeError(err);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
15
51
|
change
|
|
16
52
|
.command('new <name>')
|
|
17
53
|
.description('创建 change 提案目录(changes/<name>/)')
|
|
@@ -37,15 +73,23 @@ export function registerChangeCommands(program) {
|
|
|
37
73
|
const paths = getPaths();
|
|
38
74
|
const all = listChanges(paths);
|
|
39
75
|
if (opts.json) {
|
|
40
|
-
|
|
76
|
+
const taskLinked = listTaskLinkedChangeProposals(paths);
|
|
77
|
+
console.log(JSON.stringify(all.map(c => taskLinked.find(p => p.name === c.name) ?? c), null, 2));
|
|
41
78
|
return;
|
|
42
79
|
}
|
|
43
80
|
if (all.length === 0) {
|
|
44
81
|
console.log('(no active changes)');
|
|
45
82
|
return;
|
|
46
83
|
}
|
|
84
|
+
const taskLinkedByName = new Map(listTaskLinkedChangeProposals(paths).map(p => [p.name, p]));
|
|
47
85
|
for (const c of all) {
|
|
48
|
-
|
|
86
|
+
const taskLinked = taskLinkedByName.get(c.name);
|
|
87
|
+
if (taskLinked) {
|
|
88
|
+
console.log(` ${c.name} ${taskLinked.status} task=${taskLinked.taskCode} spec=${taskLinked.specCode}`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(` ${c.name} (created ${c.created || '?'})`);
|
|
92
|
+
}
|
|
49
93
|
}
|
|
50
94
|
});
|
|
51
95
|
change
|
|
@@ -60,13 +104,27 @@ export function registerChangeCommands(program) {
|
|
|
60
104
|
process.exit(1);
|
|
61
105
|
}
|
|
62
106
|
if (opts.json) {
|
|
107
|
+
const taskLinked = readTaskLinkedChangeProposal(paths, name);
|
|
108
|
+
if (taskLinked) {
|
|
109
|
+
console.log(JSON.stringify({ name, changes: [], proposal: taskLinked }, null, 2));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
63
112
|
const delta = parseDeltaSpec(paths, name);
|
|
64
|
-
console.log(JSON.stringify(delta, null, 2));
|
|
113
|
+
console.log(JSON.stringify({ ...delta, proposal: taskLinked }, null, 2));
|
|
65
114
|
return;
|
|
66
115
|
}
|
|
116
|
+
const taskLinked = readTaskLinkedChangeProposal(paths, name);
|
|
67
117
|
console.log(`Change: ${name}`);
|
|
68
118
|
console.log(` root: ${dir.root}`);
|
|
69
119
|
console.log(` proposal: ${dir.proposal}`);
|
|
120
|
+
if (taskLinked) {
|
|
121
|
+
console.log(` type: task-linked`);
|
|
122
|
+
console.log(` status: ${taskLinked.status}`);
|
|
123
|
+
console.log(` task: ${taskLinked.taskCode}`);
|
|
124
|
+
console.log(` spec: ${taskLinked.specCode}`);
|
|
125
|
+
console.log(` reason: ${taskLinked.reason}`);
|
|
126
|
+
console.log(` impact: ${taskLinked.impact}`);
|
|
127
|
+
}
|
|
70
128
|
console.log(` delta files: ${dir.deltaFiles.length}`);
|
|
71
129
|
for (const f of dir.deltaFiles)
|
|
72
130
|
console.log(` - ${f}`);
|
|
@@ -74,6 +132,25 @@ export function registerChangeCommands(program) {
|
|
|
74
132
|
for (const f of dir.specFiles)
|
|
75
133
|
console.log(` - ${f}`);
|
|
76
134
|
});
|
|
135
|
+
change
|
|
136
|
+
.command('resolve <name>')
|
|
137
|
+
.description('将 task-linked change proposal 标记为 resolved')
|
|
138
|
+
.option('--json', '以 JSON 格式输出', false)
|
|
139
|
+
.action((name, opts) => {
|
|
140
|
+
const paths = getPaths();
|
|
141
|
+
try {
|
|
142
|
+
const result = resolveTaskLinkedChangeProposal(paths, name);
|
|
143
|
+
if (opts.json) {
|
|
144
|
+
console.log(JSON.stringify(result, null, 2));
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
console.log(`✓ Change proposal resolved: ${result.name}`);
|
|
148
|
+
console.log(` status: ${result.status}`);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
handleChangeError(err);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
77
154
|
change
|
|
78
155
|
.command('archive <name>')
|
|
79
156
|
.description('应用 delta 到主 specs/,把 changes/<name>/ 移到 archive/')
|
|
@@ -100,4 +177,16 @@ export function registerChangeCommands(program) {
|
|
|
100
177
|
}
|
|
101
178
|
});
|
|
102
179
|
}
|
|
180
|
+
function handleChangeError(err) {
|
|
181
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
182
|
+
if (message.startsWith('INVALID_CHANGE:') ||
|
|
183
|
+
message.startsWith('SPEC_NOT_FOUND:') ||
|
|
184
|
+
message.startsWith('SPEC_NOT_L3:') ||
|
|
185
|
+
message.startsWith('TASK_NOT_FOUND:') ||
|
|
186
|
+
message.startsWith('CHANGE_NOT_FOUND:')) {
|
|
187
|
+
console.error(`✗ ${message}`);
|
|
188
|
+
process.exit(2);
|
|
189
|
+
}
|
|
190
|
+
throw err;
|
|
191
|
+
}
|
|
103
192
|
//# sourceMappingURL=change.js.map
|
package/dist/cli/change.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/cli/change.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/cli/change.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,YAAY,EACZ,WAAW,EACX,6BAA6B,EAC7B,cAAc,EACd,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wEAAwE,CAAC,CAAC;IAEzF,MAAM;SACH,OAAO,CAAC,SAAS,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AAmB,CAAC,EACvC,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/cli/completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASpC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA4BjE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { COMPLETION_SHELLS, installCompletion, uninstallCompletions, } from '../core/completion.js';
|
|
2
|
+
import { fail, printPathGroup } from './common.js';
|
|
3
|
+
export function registerCompletionCommands(program) {
|
|
4
|
+
const command = program.command('completion').description('安装或卸载 zsh/bash/fish shell completion');
|
|
5
|
+
command
|
|
6
|
+
.command('install <shell>')
|
|
7
|
+
.description('安装 shell completion')
|
|
8
|
+
.action((shellRaw) => {
|
|
9
|
+
if (!COMPLETION_SHELLS.includes(shellRaw)) {
|
|
10
|
+
fail(`✗ UNSUPPORTED_SHELL: ${shellRaw}(支持: ${COMPLETION_SHELLS.join(', ')})`, 2);
|
|
11
|
+
}
|
|
12
|
+
const shell = shellRaw;
|
|
13
|
+
const target = installCompletion(shell);
|
|
14
|
+
console.log(`✓ ${shell} completion installed`);
|
|
15
|
+
console.log(` path: ${target}`);
|
|
16
|
+
console.log(` reload: start a new ${shell} session or reload its completion configuration`);
|
|
17
|
+
});
|
|
18
|
+
command
|
|
19
|
+
.command('uninstall')
|
|
20
|
+
.description('卸载所有已安装的 shell completion')
|
|
21
|
+
.action(() => {
|
|
22
|
+
const result = uninstallCompletions();
|
|
23
|
+
if (result.removed.length === 0) {
|
|
24
|
+
fail('✗ COMPLETION_NOT_INSTALLED: 未找到已安装的 spec-manager completion', 2);
|
|
25
|
+
}
|
|
26
|
+
console.log('✓ shell completion removed');
|
|
27
|
+
printPathGroup('removed', result.removed);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/cli/completion.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,UAAU,0BAA0B,CAAC,OAAgB;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,sCAAsC,CAAC,CAAC;IAElG,OAAO;SACJ,OAAO,CAAC,iBAAiB,CAAC;SAC1B,WAAW,CAAC,qBAAqB,CAAC;SAClC,MAAM,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC3B,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,QAA2B,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,wBAAwB,QAAQ,QAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,KAAK,GAAG,QAA2B,CAAC;QAC1C,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,uBAAuB,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,CAAC,WAAW,MAAM,EAAE,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,yBAAyB,KAAK,iDAAiD,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,GAAG,EAAE;QACX,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;QACtC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,IAAI,CAAC,6DAA6D,EAAE,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;QAC1C,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -9,6 +9,8 @@ import { registerChangeCommands } from './change.js';
|
|
|
9
9
|
import { registerIncidentCommands } from './incident.js';
|
|
10
10
|
import { registerDictCommands } from './dict.js';
|
|
11
11
|
import { registerUsabilityCommands } from './usability.js';
|
|
12
|
+
import { registerViewCommands } from './view.js';
|
|
13
|
+
import { registerCompletionCommands } from './completion.js';
|
|
12
14
|
const program = new Command();
|
|
13
15
|
program
|
|
14
16
|
.name('spec-manager')
|
|
@@ -23,6 +25,8 @@ registerChangeCommands(program);
|
|
|
23
25
|
registerIncidentCommands(program);
|
|
24
26
|
registerDictCommands(program);
|
|
25
27
|
registerUsabilityCommands(program);
|
|
28
|
+
registerViewCommands(program);
|
|
29
|
+
registerCompletionCommands(program);
|
|
26
30
|
program.parseAsync(process.argv).catch((e) => {
|
|
27
31
|
console.error('✗ ' + (e?.message ?? e));
|
|
28
32
|
process.exit(1);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW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,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAClC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAClC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,yBAAyB,CAAC,OAAO,CAAC,CAAC;AACnC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,0BAA0B,CAAC,OAAO,CAAC,CAAC;AAEpC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IAC3C,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/cli/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/cli/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyKtD"}
|