@spec-engine/spec-engine 0.8.1 → 0.9.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/agent/AGENTS.md +678 -0
  3. package/dist/agent/mcp.json +11 -0
  4. package/dist/agent/pre-commit +3 -0
  5. package/dist/agent/skills/req-author/SKILL.md +102 -0
  6. package/dist/docs/agent-reference/index.html +1280 -33
  7. package/dist/docs/architecture/index.html +6 -6
  8. package/dist/docs/checks/index.html +19 -266
  9. package/dist/docs/commands/index.html +32 -164
  10. package/dist/docs/format/index.html +2 -9
  11. package/dist/docs/getting-started/index.html +3 -3
  12. package/dist/docs/guides/platform-setup/index.html +2 -2
  13. package/dist/docs/pagefind/fragment/en_10e3da6.pf_fragment +0 -0
  14. package/dist/docs/pagefind/fragment/en_37cae5e.pf_fragment +0 -0
  15. package/dist/docs/pagefind/fragment/en_7fc2fcd.pf_fragment +0 -0
  16. package/dist/docs/pagefind/fragment/en_96d3bc1.pf_fragment +0 -0
  17. package/dist/docs/pagefind/fragment/en_a26aa07.pf_fragment +0 -0
  18. package/dist/docs/pagefind/fragment/en_b7e68ef.pf_fragment +0 -0
  19. package/dist/docs/pagefind/fragment/en_d8a5bcd.pf_fragment +0 -0
  20. package/dist/docs/pagefind/fragment/en_de67937.pf_fragment +0 -0
  21. package/dist/docs/pagefind/fragment/en_fc3c55b.pf_fragment +0 -0
  22. package/dist/docs/pagefind/index/en_1664b45.pf_index +0 -0
  23. package/dist/docs/pagefind/index/en_a8b8bb6.pf_index +0 -0
  24. package/dist/docs/pagefind/pagefind-entry.json +1 -1
  25. package/dist/docs/pagefind/pagefind.en_bc3d4a7766.pf_meta +0 -0
  26. package/dist/docs/platform-mapping/index.html +2 -1
  27. package/dist/docs/tags/index.html +9 -92
  28. package/dist/impl.js +1948 -653
  29. package/package.json +1 -1
  30. package/dist/docs/pagefind/fragment/en_1f98c2d.pf_fragment +0 -0
  31. package/dist/docs/pagefind/fragment/en_24f76b6.pf_fragment +0 -0
  32. package/dist/docs/pagefind/fragment/en_2ee687a.pf_fragment +0 -0
  33. package/dist/docs/pagefind/fragment/en_4bd9de6.pf_fragment +0 -0
  34. package/dist/docs/pagefind/fragment/en_9cc1878.pf_fragment +0 -0
  35. package/dist/docs/pagefind/fragment/en_9cfc306.pf_fragment +0 -0
  36. package/dist/docs/pagefind/fragment/en_b81dc52.pf_fragment +0 -0
  37. package/dist/docs/pagefind/fragment/en_c3abf3d.pf_fragment +0 -0
  38. package/dist/docs/pagefind/fragment/en_c3e92c6.pf_fragment +0 -0
  39. package/dist/docs/pagefind/index/en_59c3abf.pf_index +0 -0
  40. package/dist/docs/pagefind/index/en_a630d23.pf_index +0 -0
  41. package/dist/docs/pagefind/pagefind.en_ced49c317e.pf_meta +0 -0
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "spec": {
4
+ "command": "spec",
5
+ "args": [
6
+ "mcp",
7
+ "."
8
+ ]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ spec guard .
3
+ exit $?
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: req-author
3
+ description: Turn a rough brief or ticket into Spec Engine requirements — draft them in the fixed EARS shape, tie every draft to the exact words it came from, present the batch for human approval, and only then mint via the real `spec` CLI.
4
+ ---
5
+
6
+ # req-author
7
+
8
+ > A requirement is one rule of the product's behavior, stated from the user's point of view.
9
+
10
+ The full requirement authoring standard is the "Requirement authoring
11
+ standard" section of the agent reference
12
+ (`packages/site/src/content/docs/agent-reference.md`); this skill applies it.
13
+
14
+ This skill drives the real `spec` CLI (`spec req`, `spec query`,
15
+ `spec domain list`) and never reimplements minting. It is the front half of
16
+ the lifecycle: brief in, approved requirements out; the route → tag → check
17
+ loop consumes what it produces.
18
+
19
+ **Two non-negotiable rules:**
20
+
21
+ 1. **Never write without approval.** Draft, self-check, present the batch —
22
+ then STOP. No `spec req` runs until the human explicitly approves.
23
+ 2. **Every draft quotes its source.** Each drafted requirement carries the
24
+ exact phrase from the brief it derives from, verbatim. A requirement you
25
+ cannot anchor to the author's words is labeled **inferred** so the human
26
+ can accept or reject the inference knowingly. This exists because
27
+ agent-drafted requirements have shipped that the product owner could not
28
+ trace back to anything they said.
29
+
30
+ ## Procedure
31
+
32
+ 1. **Read the brief.** A ticket is temporary work; the requirements outlive
33
+ it. One brief usually splits into several requirements — one per behavior,
34
+ never one per ticket.
35
+
36
+ 2. **Draft each requirement in the fixed shape.** Every statement uses one of
37
+ the five EARS shapes (the word "shall" separates who acts from the
38
+ observable result):
39
+
40
+ | Situation | Shape |
41
+ |---|---|
42
+ | Always true | The `<system>` shall `<result>` |
43
+ | Triggered by an event | When `<trigger>`, the `<system>` shall `<result>` |
44
+ | Only in a certain state | While `<state>`, the `<system>` shall `<result>` |
45
+ | Handling something going wrong | If `<failure>`, then the `<system>` shall `<result>` |
46
+ | Only when a feature is present | Where `<feature>`, the `<system>` shall `<result>` |
47
+
48
+ Example: "When an unknown requirement id is passed, spec resolve shall
49
+ print [] and exit 0." If a draft fits no row, you have not yet decided
50
+ what triggers the behavior or what observably happens — decide, or mark
51
+ the draft as a question for the human.
52
+
53
+ One promise per statement: a result chaining two behaviors with `and` is
54
+ two drafts. Prefer `When`, `If … then`, and the bare `shall` form; `While`
55
+ and `Where` only when a state or feature gates the behavior. Rationale
56
+ belongs in the why, never in the statement.
57
+
58
+ The statement rules are checked the same way: one sentence ending in a
59
+ period, at most 280 characters, and no repository file or folder, test
60
+ mechanics, CI or tooling layout, history, project jargon, or tool choice.
61
+ `spec req` refuses a draft that breaks one; `spec lint <KEY-NNN> .` lists
62
+ the findings for an existing requirement.
63
+
64
+ 3. **Write a why that names what breaks.** The `why` answers "what goes wrong
65
+ if this stops being true" — never a restatement of the statement in
66
+ different words.
67
+
68
+ 4. **Place and dedup.** `spec domain list --json` shows every domain's
69
+ charter; put each requirement in the domain whose promise it protects (not
70
+ where the code file sits). Then `spec query "<phrase>" . --json` — if a
71
+ close requirement already exists, propose amending or relating it instead
72
+ of a new id.
73
+
74
+ 5. **Present the batch and STOP.** For each candidate show: the domain, the
75
+ statement, the why, and the **source quote** (or the
76
+ `inferred` label). Write nothing until the human approves. This gate is
77
+ mandatory.
78
+
79
+ 6. **On approval, mint via the real CLI:**
80
+
81
+ ```
82
+ spec req <domain> --text "<statement>" --why "<what breaks>"
83
+ ```
84
+
85
+ (or the equivalent `spec mcp` tools). `spec req` validates through the one
86
+ shared schema — in a domain that declares the ears grammar it also checks
87
+ the statement shape at write time, and with `--json` it returns the parsed
88
+ clauses.
89
+
90
+ 7. **Record the ticket as provenance only.** The originating ticket id is
91
+ history, never a requirement id and never a code `@spec` tag.
92
+
93
+ 8. **Verify.** `spec index . && spec check . --ci` (exit 0) and
94
+ `spec guard .` (no loss) before the change ships.
95
+
96
+ ## Invocation note
97
+
98
+ The repo's `.mcp.json` registers the local `spec mcp` server (stdio,
99
+ loopback), so the tools and the `author_requirements` prompt are callable
100
+ natively from the harness. From a source checkout the server runs as
101
+ `bun packages/engine/src/cli.ts mcp .`; a compiled `spec` binary on PATH runs
102
+ as `spec mcp .`.