@popoverai/dotrequirements 0.23.0 → 0.24.1

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 (235) hide show
  1. package/README.md +169 -22
  2. package/dist/cli.js +121 -60
  3. package/dist/codebase-to-spec/budget.d.ts +53 -0
  4. package/dist/codebase-to-spec/budget.js +80 -0
  5. package/dist/codebase-to-spec/cache.d.ts +49 -0
  6. package/dist/codebase-to-spec/cache.js +54 -0
  7. package/dist/codebase-to-spec/claude.d.ts +69 -0
  8. package/dist/codebase-to-spec/claude.js +126 -0
  9. package/dist/codebase-to-spec/compose.d.ts +49 -0
  10. package/dist/codebase-to-spec/compose.js +124 -0
  11. package/dist/codebase-to-spec/edit-loop.d.ts +54 -0
  12. package/dist/codebase-to-spec/edit-loop.js +195 -0
  13. package/dist/codebase-to-spec/editor.d.ts +54 -0
  14. package/dist/codebase-to-spec/editor.js +74 -0
  15. package/dist/codebase-to-spec/exit-codes.d.ts +40 -0
  16. package/dist/codebase-to-spec/exit-codes.js +58 -0
  17. package/dist/codebase-to-spec/fan-out.d.ts +63 -0
  18. package/dist/codebase-to-spec/fan-out.js +215 -0
  19. package/dist/codebase-to-spec/interactive.d.ts +30 -0
  20. package/dist/codebase-to-spec/interactive.js +48 -0
  21. package/dist/codebase-to-spec/outline-review-loop.d.ts +51 -0
  22. package/dist/codebase-to-spec/outline-review-loop.js +187 -0
  23. package/dist/codebase-to-spec/pack.d.ts +51 -0
  24. package/dist/codebase-to-spec/pack.js +127 -0
  25. package/dist/codebase-to-spec/planner.d.ts +41 -0
  26. package/dist/codebase-to-spec/planner.js +76 -0
  27. package/dist/codebase-to-spec/present.d.ts +94 -0
  28. package/dist/codebase-to-spec/present.js +288 -0
  29. package/dist/codebase-to-spec/progress.d.ts +33 -0
  30. package/dist/codebase-to-spec/progress.js +28 -0
  31. package/dist/codebase-to-spec/prompts/editor.d.ts +13 -0
  32. package/dist/codebase-to-spec/prompts/editor.js +57 -0
  33. package/dist/codebase-to-spec/prompts/outline-reviewer.d.ts +12 -0
  34. package/dist/codebase-to-spec/prompts/outline-reviewer.js +87 -0
  35. package/dist/codebase-to-spec/prompts/planner-initial.d.ts +11 -0
  36. package/dist/codebase-to-spec/prompts/planner-initial.js +125 -0
  37. package/dist/codebase-to-spec/prompts/planner-revise.d.ts +14 -0
  38. package/dist/codebase-to-spec/prompts/planner-revise.js +60 -0
  39. package/dist/codebase-to-spec/prompts/spec-reviewer.d.ts +16 -0
  40. package/dist/codebase-to-spec/prompts/spec-reviewer.js +96 -0
  41. package/dist/codebase-to-spec/prompts/specifier.d.ts +12 -0
  42. package/dist/codebase-to-spec/prompts/specifier.js +100 -0
  43. package/dist/codebase-to-spec/prompts/style-check.d.ts +12 -0
  44. package/dist/codebase-to-spec/prompts/style-check.js +78 -0
  45. package/dist/codebase-to-spec/schemas.d.ts +257 -0
  46. package/dist/codebase-to-spec/schemas.js +183 -0
  47. package/dist/codebase-to-spec/skill-install.d.ts +57 -0
  48. package/dist/codebase-to-spec/skill-install.js +79 -0
  49. package/dist/codebase-to-spec/slice.d.ts +49 -0
  50. package/dist/codebase-to-spec/slice.js +111 -0
  51. package/dist/codebase-to-spec/specifier.d.ts +60 -0
  52. package/dist/codebase-to-spec/specifier.js +79 -0
  53. package/dist/codebase-to-spec/style-check.d.ts +29 -0
  54. package/dist/codebase-to-spec/style-check.js +33 -0
  55. package/dist/codebase-to-spec/summary.d.ts +51 -0
  56. package/dist/codebase-to-spec/summary.js +183 -0
  57. package/dist/codebase-to-spec/validate.d.ts +46 -0
  58. package/dist/codebase-to-spec/validate.js +130 -0
  59. package/dist/commands/acceptance-test.d.ts +6 -0
  60. package/dist/commands/{browsertest.js → acceptance-test.js} +36 -29
  61. package/dist/commands/ai-setup.d.ts +5 -0
  62. package/dist/commands/ai-setup.js +441 -0
  63. package/dist/commands/codebase-to-spec/compose.d.ts +14 -0
  64. package/dist/commands/codebase-to-spec/compose.js +57 -0
  65. package/dist/commands/codebase-to-spec/edit-loop.d.ts +16 -0
  66. package/dist/commands/codebase-to-spec/edit-loop.js +83 -0
  67. package/dist/commands/codebase-to-spec/fan-out.d.ts +19 -0
  68. package/dist/commands/codebase-to-spec/fan-out.js +77 -0
  69. package/dist/commands/codebase-to-spec/index.d.ts +9 -0
  70. package/dist/commands/codebase-to-spec/index.js +135 -0
  71. package/dist/commands/codebase-to-spec/pack.d.ts +22 -0
  72. package/dist/commands/codebase-to-spec/pack.js +76 -0
  73. package/dist/commands/codebase-to-spec/plan-loop.d.ts +26 -0
  74. package/dist/commands/codebase-to-spec/plan-loop.js +105 -0
  75. package/dist/commands/codebase-to-spec/present.d.ts +21 -0
  76. package/dist/commands/codebase-to-spec/present.js +92 -0
  77. package/dist/commands/codebase-to-spec/run.d.ts +20 -0
  78. package/dist/commands/codebase-to-spec/run.js +85 -0
  79. package/dist/commands/codebase-to-spec/skill-install.d.ts +20 -0
  80. package/dist/commands/codebase-to-spec/skill-install.js +51 -0
  81. package/dist/commands/codebase-to-spec/specify-area.d.ts +18 -0
  82. package/dist/commands/codebase-to-spec/specify-area.js +82 -0
  83. package/dist/commands/codebase-to-spec/style-check.d.ts +15 -0
  84. package/dist/commands/codebase-to-spec/style-check.js +42 -0
  85. package/dist/commands/codebase-to-spec/validate.d.ts +18 -0
  86. package/dist/commands/codebase-to-spec/validate.js +38 -0
  87. package/dist/commands/create-requirement-document.d.ts +2 -0
  88. package/dist/commands/create-requirement-document.js +41 -0
  89. package/dist/commands/finalize.js +7 -7
  90. package/dist/commands/get.d.ts +2 -0
  91. package/dist/commands/get.js +55 -0
  92. package/dist/commands/init.js +132 -117
  93. package/dist/commands/link.js +27 -27
  94. package/dist/commands/list.d.ts +6 -0
  95. package/dist/commands/list.js +43 -0
  96. package/dist/commands/mcp.js +1 -1
  97. package/dist/commands/prepare.js +4 -4
  98. package/dist/commands/pull.js +116 -121
  99. package/dist/commands/push.js +106 -112
  100. package/dist/commands/report.d.ts +6 -2
  101. package/dist/commands/report.js +177 -122
  102. package/dist/commands/requirements-for.d.ts +2 -0
  103. package/dist/commands/requirements-for.js +29 -0
  104. package/dist/commands/review-test.d.ts +2 -0
  105. package/dist/commands/review-test.js +75 -0
  106. package/dist/commands/search.d.ts +6 -0
  107. package/dist/commands/search.js +39 -0
  108. package/dist/commands/style-check.d.ts +7 -0
  109. package/dist/commands/style-check.js +75 -0
  110. package/dist/commands/tests-for.d.ts +2 -0
  111. package/dist/commands/tests-for.js +80 -0
  112. package/dist/commands/validate.d.ts +6 -0
  113. package/dist/commands/validate.js +72 -0
  114. package/dist/config.js +1 -1
  115. package/dist/convex.d.ts +34 -22
  116. package/dist/convex.js +38 -22
  117. package/dist/harness/cache.d.ts +1 -5
  118. package/dist/harness/cache.js +49 -59
  119. package/dist/harness/convexReporting.d.ts +1 -1
  120. package/dist/harness/convexReporting.js +9 -7
  121. package/dist/harness/coverageCache.js +3 -3
  122. package/dist/harness/finalize.js +59 -46
  123. package/dist/harness/index.d.ts +6 -7
  124. package/dist/harness/index.js +9 -10
  125. package/dist/harness/prepare.js +6 -5
  126. package/dist/harness/requirementsLoader.d.ts +2 -2
  127. package/dist/harness/requirementsLoader.js +13 -35
  128. package/dist/harness/tracking.js +18 -18
  129. package/dist/harness/types.d.ts +1 -1
  130. package/dist/mcp/convexClient.d.ts +0 -39
  131. package/dist/mcp/convexClient.js +2 -107
  132. package/dist/mcp/handlers/authoring.d.ts +1 -1
  133. package/dist/mcp/handlers/authoring.js +30 -234
  134. package/dist/mcp/handlers/debug.d.ts +2 -3
  135. package/dist/mcp/handlers/debug.js +10 -10
  136. package/dist/mcp/handlers/get.d.ts +1 -1
  137. package/dist/mcp/handlers/get.js +11 -10
  138. package/dist/mcp/handlers/index.d.ts +20 -20
  139. package/dist/mcp/handlers/index.js +10 -10
  140. package/dist/mcp/handlers/list.d.ts +4 -33
  141. package/dist/mcp/handlers/list.js +16 -38
  142. package/dist/mcp/handlers/push.d.ts +1 -1
  143. package/dist/mcp/handlers/push.js +28 -18
  144. package/dist/mcp/handlers/report.d.ts +16 -0
  145. package/dist/mcp/handlers/report.js +134 -0
  146. package/dist/mcp/handlers/review.d.ts +1 -1
  147. package/dist/mcp/handlers/review.js +40 -59
  148. package/dist/mcp/handlers/search.d.ts +1 -1
  149. package/dist/mcp/handlers/search.js +7 -9
  150. package/dist/mcp/handlers/test-mapping.d.ts +1 -1
  151. package/dist/mcp/handlers/test-mapping.js +14 -14
  152. package/dist/mcp/handlers/types.d.ts +3 -3
  153. package/dist/mcp/handlers/types.js +2 -2
  154. package/dist/mcp/index.d.ts +1 -1
  155. package/dist/mcp/index.js +147 -167
  156. package/dist/push/core.d.ts +2 -2
  157. package/dist/push/core.js +20 -20
  158. package/dist/push/index.d.ts +1 -1
  159. package/dist/push/index.js +2 -2
  160. package/dist/requirements/cloud-ai.d.ts +57 -0
  161. package/dist/requirements/cloud-ai.js +104 -0
  162. package/dist/requirements/cloud-coverage.d.ts +41 -0
  163. package/dist/requirements/cloud-coverage.js +60 -0
  164. package/dist/requirements/coverage.d.ts +45 -0
  165. package/dist/requirements/coverage.js +114 -0
  166. package/dist/{mcp → requirements}/grep.d.ts +10 -1
  167. package/dist/{mcp → requirements}/grep.js +89 -44
  168. package/dist/{mcp/requirements.d.ts → requirements/index.d.ts} +19 -3
  169. package/dist/{mcp/requirements.js → requirements/index.js} +54 -35
  170. package/dist/requirements/style-guide.d.ts +67 -0
  171. package/dist/requirements/style-guide.js +299 -0
  172. package/dist/{mcp → requirements}/testCodeExtractor.js +24 -26
  173. package/dist/schema/browser.d.ts +8 -8
  174. package/dist/schema/browser.js +13 -15
  175. package/dist/schema/builder.d.ts +1 -1
  176. package/dist/schema/builder.js +13 -44
  177. package/dist/schema/conversions.d.ts +2 -2
  178. package/dist/schema/conversions.js +11 -11
  179. package/dist/schema/index.d.ts +9 -9
  180. package/dist/schema/index.js +15 -15
  181. package/dist/schema/parser-core.d.ts +1 -1
  182. package/dist/schema/parser-core.js +23 -22
  183. package/dist/schema/parser.d.ts +3 -3
  184. package/dist/schema/parser.js +27 -31
  185. package/dist/schema/resolver.d.ts +1 -1
  186. package/dist/schema/resolver.js +9 -9
  187. package/dist/schema/scenario.d.ts +1 -1
  188. package/dist/schema/scenario.js +1 -1
  189. package/dist/schema/schemas.d.ts +3 -3
  190. package/dist/schema/schemas.js +41 -28
  191. package/dist/schema/test-schema.js +27 -27
  192. package/dist/templates/context-file-section.md +3 -2
  193. package/dist/templates/example-requirements.js +1 -1
  194. package/dist/templates/example-requirements.ts +3 -1
  195. package/dist/templates/requirements-readme.js +1 -1
  196. package/dist/templates/requirements-readme.ts +1 -1
  197. package/dist/templates/skills/codebase-to-spec/SKILL.md +118 -0
  198. package/dist/utils/brand.js +3 -3
  199. package/dist/utils/browser-launch.js +4 -4
  200. package/dist/utils/context-file.d.ts +1 -1
  201. package/dist/utils/context-file.js +26 -26
  202. package/dist/utils/env.js +7 -7
  203. package/dist/utils/gitignore.js +7 -7
  204. package/dist/utils/oauth-callback-server.d.ts +1 -1
  205. package/dist/utils/oauth-callback-server.js +27 -25
  206. package/dist/utils/oauth-flow.js +32 -29
  207. package/dist/utils/project-discovery.d.ts +3 -3
  208. package/dist/utils/project-discovery.js +18 -17
  209. package/dist/utils/project-name.js +8 -8
  210. package/dist/utils/project-selector.d.ts +1 -1
  211. package/dist/utils/project-selector.js +24 -21
  212. package/dist/utils/project-settings.d.ts +1 -1
  213. package/dist/utils/project-settings.js +24 -22
  214. package/dist/utils/templates.js +6 -6
  215. package/package.json +3 -2
  216. package/dist/commands/browsertest.d.ts +0 -6
  217. package/dist/commands/login.d.ts +0 -12
  218. package/dist/commands/login.js +0 -117
  219. package/dist/commands/logout.d.ts +0 -5
  220. package/dist/commands/logout.js +0 -17
  221. package/dist/commands/mcp-setup.d.ts +0 -5
  222. package/dist/commands/mcp-setup.js +0 -431
  223. package/dist/commands/test.d.ts +0 -6
  224. package/dist/commands/test.js +0 -78
  225. package/dist/mcp/handlers/coverage.d.ts +0 -44
  226. package/dist/mcp/handlers/coverage.js +0 -105
  227. package/dist/mcp/types.d.ts +0 -27
  228. package/dist/mcp/types.js +0 -2
  229. package/dist/utils/local-project.d.ts +0 -31
  230. package/dist/utils/local-project.js +0 -33
  231. package/dist/utils/token-refresh.d.ts +0 -24
  232. package/dist/utils/token-refresh.js +0 -69
  233. package/dist/utils/token-storage.d.ts +0 -31
  234. package/dist/utils/token-storage.js +0 -57
  235. /package/dist/{mcp → requirements}/testCodeExtractor.d.ts +0 -0
@@ -0,0 +1,100 @@
1
+ /**
2
+ * System prompt for the specifier worker.
3
+ *
4
+ * Each specifier handles one behavioral area. It writes its partial to a
5
+ * known path, runs the local style-check on its own draft, applies feedback,
6
+ * and confirms completion.
7
+ *
8
+ * Requirements covered:
9
+ * - CTS-SPEC-1, CTS-SPEC-2, CTS-SPEC-3, CTS-SPEC-4
10
+ */
11
+ export const SPECIFIER_PROMPT = `You are reading a slice of a software codebase — the files relevant to ONE behavioral area of the system. Your job is to produce the behavioral specification for that area, in **dotrequirements format**, validate the schema of your draft, then style-check it, applying feedback from each.
12
+
13
+ A separate planner agent has already broken the system into areas; you are responsible for ONE area only. The user message will tell you which area, give you the full outline (so you know what's in scope vs. not), point you at the slice, and tell you where to write your output.
14
+
15
+ ## What to capture
16
+
17
+ A behavioral specification describes what the system does from the outside — what someone using it can observe, not how the implementation works. Scoped to your assigned area, capture:
18
+
19
+ - **User-facing behaviors** — what the customer can do, what happens when they do it, what they see in response
20
+ - **Integration behaviors** — how this area interacts with external services, what it sends/receives, how it handles failures
21
+ - **Domain rules** — validation, business logic, state transitions, decision logic specific to this area
22
+ - **Error and edge cases** — what happens when things go wrong, what the system tolerates, what it rejects
23
+ - **Documented warnings, hazards, and limitations** — things the README or docstrings warn customers about
24
+
25
+ ## Customer and persona
26
+
27
+ Before drafting, identify who your area's customer is — the kind of person whose needs shape what counts as behavior here. Go one level deeper than generic categories: not "developer" — "a Python data engineer building ETL pipelines"; not "end-user" — "a shopper" or "a guest checking out without an account."
28
+
29
+ The outline's summary may already name customers the system serves — read it as supporting evidence. If a named customer fits your area, use it. If your area serves a customer the summary didn't name, or the summary is vague, commit to your own best hypothesis based on the slice.
30
+
31
+ Then name a concrete persona to use in your requirements — for example, "Casey, a React developer integrating an eCommerce SDK" or "Jamie, a shopper checking out as a guest." The persona threads through parent and child requirements.
32
+
33
+ ## Style principles
34
+
35
+ Apply these throughout your work:
36
+
37
+ 1. **Concrete examples, not vague language.** "When a registered user provides valid credentials, they are authenticated" — not "users can log in" or "works properly."
38
+ 2. **Natural, concise prose.** Declarative ("is authenticated"), not "should be" or wandering narrative.
39
+ 3. **Arrange/Act/Assert framing in mind.** Each requirement reads as preconditions / trigger / outcome.
40
+ 4. **Framework neutral.** Default to unlabeled criteria. Use labels (e.g., Given/When/Then) only when they genuinely sharpen meaning — don't impose them as a format.
41
+ 5. **Named personas.** Establish a persona in the parent requirement; reuse them in children. E.g., parent: "Casey, a React developer, can configure pLimit." Child: "When Casey calls pLimit(5), they receive..."
42
+ 6. **User-centric language.** Describe the customer's experience, not internal mechanics. "They are brought to the dashboard," not "they are redirected to /redirect/dashboard."
43
+ 7. **Single action per requirement.** No chaining multiple actions with "and then." Break into separate requirements.
44
+ 8. **Independently testable.** Each requirement should make sense on its own. If two requirements share preconditions, either nest them or restate context.
45
+ 9. **Behavior, not design.** "Provides valid credentials" — not "enters credentials into two single-line input fields and presses a green button."
46
+ 10. **Outcomes, not implementation.** Describe what the customer observes, not the internal mechanics that produce the observation. Implementation primitives (library function names, syscall flags, internal scheduling vocabulary, buffer sizes) don't belong in requirements.
47
+ 11. **Decompose large requirements.** If it can't be validated with a single test, break it down.
48
+
49
+ ## Read the documentation in your slice
50
+
51
+ If your slice contains README files, doc comments, JSDoc, or docstrings: read them carefully. They often contain warnings, edge cases, and limitations that don't appear in code but are part of the documented contract.
52
+
53
+ ## Workflow (REQUIRED)
54
+
55
+ ### Phase A: Draft
56
+
57
+ 1. Read your slice. Read documentation in the slice. If needed, Read/Grep the full pack to discover behaviors documented in tests or recipes.
58
+ 2. Use the **Write** tool to write your draft to the partial path provided in the user message. Output in this format:
59
+ - A one-paragraph area description introducing the persona and what they do with this area's surface. This paragraph is what readers see at the top of the area in the final spec — it is your framing, informed by the deep reading you just did. The planner's outline-time area description is not surfaced in the final spec.
60
+ - Blank line.
61
+ - Series of fenced \`dotrequirements\` blocks.
62
+
63
+ Do NOT include YAML frontmatter, H1 title, summary paragraph, or area H2. The composer adds those.
64
+
65
+ ### Phase B: Validate (schema/syntax — REQUIRED FIRST)
66
+
67
+ 1. Run the local validate tool by invoking the Bash command provided in the user message (it will be of the form \`dotrequirements cts validate <YOUR_PARTIAL_PATH>\`). It is deterministic and cheap — it checks that every requirement block parses, every criterion has a \`→\` arrow, position paths match indentation, and IDs are unique.
68
+ 2. If validate prints \`Schema validation: PASS\`, proceed to Phase C.
69
+ 3. If validate prints \`Schema validation: FAIL\`, use the **Edit** tool to fix the issue in your partial, then re-run validate. Repeat until it passes. Do not move on with a failing validation — schema errors will cause the downstream pipeline to reject your spec.
70
+
71
+ ### Phase C: Style-check and revise (clarity — REQUIRED SECOND)
72
+
73
+ 1. Only after validate passes, run the local style-check tool by invoking the Bash command provided in the user message (it will be of the form \`dotrequirements cts style-check <YOUR_PARTIAL_PATH>\`).
74
+ 2. Read the feedback carefully.
75
+ 3. For every MUST FIX and SHOULD FIX finding, edit your partial in place using the **Edit** tool to apply the suggested change.
76
+ 4. Act on COULD IMPROVE findings unless doing so would make the spec worse.
77
+ 5. If your edits added new requirements, restructured criteria, renamed IDs, or merged/split requirement blocks, re-run validate (it's cheap) and then style-check ONE more time.
78
+ 6. Style-check runs at most twice per invocation. Feedback from any subsequent run is noted in your final stdout but not acted upon.
79
+ 7. When done revising, output a short confirmation: "Done. Partial saved to <path>." That's it.
80
+
81
+ ## Format rules
82
+
83
+ \`\`\`dotrequirements
84
+ PREFIX-AREA-1: Short imperative title
85
+ 0. → A precondition or context
86
+ 1. → An action or trigger
87
+ 2. → An observable outcome
88
+ 2.0. → Additional outcome detail
89
+ \`\`\`
90
+
91
+ - **IDs**: \`<defaultPrefix>-<areaPrefix>-<NUM>\` — both prefixes are supplied in the user message. Number sequentially from 1; no zero-padding (\`PLIM-AONE-1\`, not \`PLIM-AONE-001\`).
92
+ - **Criteria**: \`<position>. <content>\` for unlabeled (the default), or \`<position>. <Label> → <content>\` when a label sharpens meaning.
93
+ - **Indentation**: 2 spaces per nesting level. Position paths must match indentation.
94
+
95
+ ## Output discipline
96
+
97
+ - The PARTIAL FILE is your primary deliverable, written/edited via Write and Edit tools.
98
+ - Your stdout response is brief — just confirmation when done.
99
+ - No chain-of-thought narration in the partial file or your stdout.`;
100
+ //# sourceMappingURL=specifier.js.map
@@ -0,0 +1,12 @@
1
+ /**
2
+ * System prompt for the local style-check tool.
3
+ *
4
+ * Reads a partial-spec file and produces severity-categorized feedback.
5
+ * Stateless — same "fresh set of eyes" pattern as the existing cloud
6
+ * `mcp__dotrequirements__style_check`.
7
+ *
8
+ * Requirements covered:
9
+ * - CTS-SPEC-3: Specifier worker runs a local style-check on its own draft
10
+ */
11
+ export declare const STYLE_CHECK_PROMPT = "You are a stateless style reviewer for a single dotrequirements partial spec \u2014 one or more `dotrequirements` fenced blocks plus an optional one-line description above them. Your job is to give the author actionable feedback on per-requirement writing quality.\n\nThis check is a \"fresh set of eyes\" \u2014 you have no memory of prior feedback rounds. You are looking only at this file as it currently stands.\n\n## How to categorize feedback\n\n### MUST FIX\n\n- **The requirement does not describe an observable outcome.** \"The system manages memory efficiently\" gives a tester nothing to verify. The requirement needs to be rephrased around what the customer can observe.\n\n### SHOULD FIX\n\n- **Vague language** where concrete behavior is needed.\n- **Missing preconditions** that anchor the test \u2014 a When/Then with no Given-equivalent context.\n- **Internal-mechanics drift** \u2014 describing how the implementation works (library function names, syscall flags, internal scheduling vocabulary, buffer sizes) instead of what the customer observes.\n- **Documentation prose dressed as a requirement** \u2014 \"the documentation directs users to...\" style commentary that isn't testable behavior.\n- **Persona inconsistency** \u2014 the spec doesn't name a persona, or child requirements drop the persona established by their parent.\n- **Chained actions** \u2014 a single requirement covering multiple discrete actions that should be separate requirements.\n- **Hidden sibling dependencies** \u2014 a requirement that only makes sense if read alongside its siblings.\n- **Imposed format labels** \u2014 Given/When/Then or other framework labels applied uniformly without sharpening meaning. The dotrequirements default is unlabeled criteria; labels are used only when they help.\n\n### COULD IMPROVE\n\n- Over-long titles that read like full sentences.\n- Inconsistent terminology with the rest of the area.\n- Redundant sub-criteria that re-state the parent.\n- UI or design specifics where behavior alone would suffice.\n\n## How to write findings\n\nFor each finding:\n- Cite the specific requirement ID (e.g., `AUTH-LOGIN-1`).\n- Quote the offending text.\n- Explain why it's an issue.\n- Suggest a rephrasing, or recommend dropping the requirement.\n\nKeep findings specific and concrete. Vague critiques like \"could be more comprehensive\" are not useful \u2014 name the requirement and quote the issue.\n\n## When to be brief\n\nIf the partial is genuinely good, say so. Don't manufacture findings to fill space. A clean style check is the right outcome more often than not.\n\n## Output format\n\nMarkdown with these headings:\n\n```\n## MUST FIX\n\n- ...\n\n## SHOULD FIX\n\n- ...\n\n## COULD IMPROVE\n\n- ...\n```\n\nOmit any heading with no findings. End with a one-line summary like `OVERALL: <terse assessment>`.\n\n## Output discipline\n\n- Output ONLY the categorized feedback, beginning with the first heading.\n- No preamble, no chain-of-thought, no explanation of your process.\n- Be honest. Accurate signal helps the author iterate.";
12
+ //# sourceMappingURL=style-check.d.ts.map
@@ -0,0 +1,78 @@
1
+ /**
2
+ * System prompt for the local style-check tool.
3
+ *
4
+ * Reads a partial-spec file and produces severity-categorized feedback.
5
+ * Stateless — same "fresh set of eyes" pattern as the existing cloud
6
+ * `mcp__dotrequirements__style_check`.
7
+ *
8
+ * Requirements covered:
9
+ * - CTS-SPEC-3: Specifier worker runs a local style-check on its own draft
10
+ */
11
+ export const STYLE_CHECK_PROMPT = `You are a stateless style reviewer for a single dotrequirements partial spec — one or more \`dotrequirements\` fenced blocks plus an optional one-line description above them. Your job is to give the author actionable feedback on per-requirement writing quality.
12
+
13
+ This check is a "fresh set of eyes" — you have no memory of prior feedback rounds. You are looking only at this file as it currently stands.
14
+
15
+ ## How to categorize feedback
16
+
17
+ ### MUST FIX
18
+
19
+ - **The requirement does not describe an observable outcome.** "The system manages memory efficiently" gives a tester nothing to verify. The requirement needs to be rephrased around what the customer can observe.
20
+
21
+ ### SHOULD FIX
22
+
23
+ - **Vague language** where concrete behavior is needed.
24
+ - **Missing preconditions** that anchor the test — a When/Then with no Given-equivalent context.
25
+ - **Internal-mechanics drift** — describing how the implementation works (library function names, syscall flags, internal scheduling vocabulary, buffer sizes) instead of what the customer observes.
26
+ - **Documentation prose dressed as a requirement** — "the documentation directs users to..." style commentary that isn't testable behavior.
27
+ - **Persona inconsistency** — the spec doesn't name a persona, or child requirements drop the persona established by their parent.
28
+ - **Chained actions** — a single requirement covering multiple discrete actions that should be separate requirements.
29
+ - **Hidden sibling dependencies** — a requirement that only makes sense if read alongside its siblings.
30
+ - **Imposed format labels** — Given/When/Then or other framework labels applied uniformly without sharpening meaning. The dotrequirements default is unlabeled criteria; labels are used only when they help.
31
+
32
+ ### COULD IMPROVE
33
+
34
+ - Over-long titles that read like full sentences.
35
+ - Inconsistent terminology with the rest of the area.
36
+ - Redundant sub-criteria that re-state the parent.
37
+ - UI or design specifics where behavior alone would suffice.
38
+
39
+ ## How to write findings
40
+
41
+ For each finding:
42
+ - Cite the specific requirement ID (e.g., \`AUTH-LOGIN-1\`).
43
+ - Quote the offending text.
44
+ - Explain why it's an issue.
45
+ - Suggest a rephrasing, or recommend dropping the requirement.
46
+
47
+ Keep findings specific and concrete. Vague critiques like "could be more comprehensive" are not useful — name the requirement and quote the issue.
48
+
49
+ ## When to be brief
50
+
51
+ If the partial is genuinely good, say so. Don't manufacture findings to fill space. A clean style check is the right outcome more often than not.
52
+
53
+ ## Output format
54
+
55
+ Markdown with these headings:
56
+
57
+ \`\`\`
58
+ ## MUST FIX
59
+
60
+ - ...
61
+
62
+ ## SHOULD FIX
63
+
64
+ - ...
65
+
66
+ ## COULD IMPROVE
67
+
68
+ - ...
69
+ \`\`\`
70
+
71
+ Omit any heading with no findings. End with a one-line summary like \`OVERALL: <terse assessment>\`.
72
+
73
+ ## Output discipline
74
+
75
+ - Output ONLY the categorized feedback, beginning with the first heading.
76
+ - No preamble, no chain-of-thought, no explanation of your process.
77
+ - Be honest. Accurate signal helps the author iterate.`;
78
+ //# sourceMappingURL=style-check.js.map
@@ -0,0 +1,257 @@
1
+ /**
2
+ * JSON schemas for outline + reviewer output.
3
+ *
4
+ * The CLI passes these to `claude -p --json-schema` to constrain agent output,
5
+ * then validates the parsed result before driving the loop.
6
+ *
7
+ * Requirements covered:
8
+ * - CTS-PLAN-1: outline structure
9
+ * - CTS-PLAN-2: outline reviewer output structure (categorized findings + verdict)
10
+ */
11
+ import { z } from "zod";
12
+ export declare const AreaSchema: z.ZodObject<{
13
+ name: z.ZodString;
14
+ description: z.ZodString;
15
+ prefix: z.ZodString;
16
+ files: z.ZodArray<z.ZodString, "many">;
17
+ }, "strip", z.ZodTypeAny, {
18
+ prefix: string;
19
+ files: string[];
20
+ name: string;
21
+ description: string;
22
+ }, {
23
+ prefix: string;
24
+ files: string[];
25
+ name: string;
26
+ description: string;
27
+ }>;
28
+ export type Area = z.infer<typeof AreaSchema>;
29
+ export declare const OutlineSchema: z.ZodObject<{
30
+ title: z.ZodString;
31
+ defaultPrefix: z.ZodString;
32
+ summary: z.ZodString;
33
+ areas: z.ZodArray<z.ZodObject<{
34
+ name: z.ZodString;
35
+ description: z.ZodString;
36
+ prefix: z.ZodString;
37
+ files: z.ZodArray<z.ZodString, "many">;
38
+ }, "strip", z.ZodTypeAny, {
39
+ prefix: string;
40
+ files: string[];
41
+ name: string;
42
+ description: string;
43
+ }, {
44
+ prefix: string;
45
+ files: string[];
46
+ name: string;
47
+ description: string;
48
+ }>, "many">;
49
+ }, "strip", z.ZodTypeAny, {
50
+ title: string;
51
+ defaultPrefix: string;
52
+ summary: string;
53
+ areas: {
54
+ prefix: string;
55
+ files: string[];
56
+ name: string;
57
+ description: string;
58
+ }[];
59
+ }, {
60
+ title: string;
61
+ defaultPrefix: string;
62
+ summary: string;
63
+ areas: {
64
+ prefix: string;
65
+ files: string[];
66
+ name: string;
67
+ description: string;
68
+ }[];
69
+ }>;
70
+ export type Outline = z.infer<typeof OutlineSchema>;
71
+ /**
72
+ * JSON Schema for the outline, passed to `claude -p --json-schema`.
73
+ * Mirrors OutlineSchema in JSON Schema form (which `claude -p` accepts).
74
+ */
75
+ export declare const OUTLINE_JSON_SCHEMA: {
76
+ readonly type: "object";
77
+ readonly properties: {
78
+ readonly title: {
79
+ readonly type: "string";
80
+ };
81
+ readonly defaultPrefix: {
82
+ readonly type: "string";
83
+ };
84
+ readonly summary: {
85
+ readonly type: "string";
86
+ };
87
+ readonly areas: {
88
+ readonly type: "array";
89
+ readonly items: {
90
+ readonly type: "object";
91
+ readonly properties: {
92
+ readonly name: {
93
+ readonly type: "string";
94
+ };
95
+ readonly description: {
96
+ readonly type: "string";
97
+ };
98
+ readonly prefix: {
99
+ readonly type: "string";
100
+ };
101
+ readonly files: {
102
+ readonly type: "array";
103
+ readonly items: {
104
+ readonly type: "string";
105
+ };
106
+ };
107
+ };
108
+ readonly required: readonly ["name", "description", "prefix", "files"];
109
+ readonly additionalProperties: false;
110
+ };
111
+ };
112
+ };
113
+ readonly required: readonly ["title", "defaultPrefix", "summary", "areas"];
114
+ readonly additionalProperties: false;
115
+ };
116
+ export declare const VerdictValues: readonly ["approved", "approved-with-revisions", "requires-another-review"];
117
+ export type Verdict = (typeof VerdictValues)[number];
118
+ export declare const OutlineReviewSchema: z.ZodObject<{
119
+ coverage_gaps: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
120
+ framing_errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
121
+ granularity_issues: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
122
+ file_assignment_issues: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
123
+ revisions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
124
+ verdict: z.ZodEnum<["approved", "approved-with-revisions", "requires-another-review"]>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ coverage_gaps: string[];
127
+ framing_errors: string[];
128
+ granularity_issues: string[];
129
+ file_assignment_issues: string[];
130
+ revisions: string[];
131
+ verdict: "approved" | "approved-with-revisions" | "requires-another-review";
132
+ }, {
133
+ verdict: "approved" | "approved-with-revisions" | "requires-another-review";
134
+ coverage_gaps?: string[] | undefined;
135
+ framing_errors?: string[] | undefined;
136
+ granularity_issues?: string[] | undefined;
137
+ file_assignment_issues?: string[] | undefined;
138
+ revisions?: string[] | undefined;
139
+ }>;
140
+ export type OutlineReview = z.infer<typeof OutlineReviewSchema>;
141
+ export declare const OUTLINE_REVIEW_JSON_SCHEMA: {
142
+ readonly type: "object";
143
+ readonly properties: {
144
+ readonly coverage_gaps: {
145
+ readonly type: "array";
146
+ readonly items: {
147
+ readonly type: "string";
148
+ };
149
+ };
150
+ readonly framing_errors: {
151
+ readonly type: "array";
152
+ readonly items: {
153
+ readonly type: "string";
154
+ };
155
+ };
156
+ readonly granularity_issues: {
157
+ readonly type: "array";
158
+ readonly items: {
159
+ readonly type: "string";
160
+ };
161
+ };
162
+ readonly file_assignment_issues: {
163
+ readonly type: "array";
164
+ readonly items: {
165
+ readonly type: "string";
166
+ };
167
+ };
168
+ readonly revisions: {
169
+ readonly type: "array";
170
+ readonly items: {
171
+ readonly type: "string";
172
+ };
173
+ };
174
+ readonly verdict: {
175
+ readonly type: "string";
176
+ readonly enum: readonly string[];
177
+ };
178
+ };
179
+ readonly required: readonly ["coverage_gaps", "framing_errors", "granularity_issues", "file_assignment_issues", "revisions", "verdict"];
180
+ readonly additionalProperties: false;
181
+ };
182
+ /**
183
+ * Try to parse a string as JSON and validate against the outline schema.
184
+ * Throws with a descriptive message on failure (caller catches and either
185
+ * retries or fails the loop).
186
+ */
187
+ export declare function parseOutline(text: string): Outline;
188
+ /**
189
+ * Parse a reviewer's JSON output and validate against the outline-review schema.
190
+ */
191
+ export declare function parseOutlineReview(text: string): OutlineReview;
192
+ export declare const SpecReviewSchema: z.ZodObject<{
193
+ coverage_gaps: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
194
+ framing_errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
195
+ cross_area_issues: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
196
+ internal_mechanics_drift: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
197
+ revisions: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
198
+ verdict: z.ZodEnum<["approved", "approved-with-revisions", "requires-another-review"]>;
199
+ }, "strip", z.ZodTypeAny, {
200
+ coverage_gaps: string[];
201
+ framing_errors: string[];
202
+ revisions: string[];
203
+ verdict: "approved" | "approved-with-revisions" | "requires-another-review";
204
+ cross_area_issues: string[];
205
+ internal_mechanics_drift: string[];
206
+ }, {
207
+ verdict: "approved" | "approved-with-revisions" | "requires-another-review";
208
+ coverage_gaps?: string[] | undefined;
209
+ framing_errors?: string[] | undefined;
210
+ revisions?: string[] | undefined;
211
+ cross_area_issues?: string[] | undefined;
212
+ internal_mechanics_drift?: string[] | undefined;
213
+ }>;
214
+ export type SpecReview = z.infer<typeof SpecReviewSchema>;
215
+ export declare const SPEC_REVIEW_JSON_SCHEMA: {
216
+ readonly type: "object";
217
+ readonly properties: {
218
+ readonly coverage_gaps: {
219
+ readonly type: "array";
220
+ readonly items: {
221
+ readonly type: "string";
222
+ };
223
+ };
224
+ readonly framing_errors: {
225
+ readonly type: "array";
226
+ readonly items: {
227
+ readonly type: "string";
228
+ };
229
+ };
230
+ readonly cross_area_issues: {
231
+ readonly type: "array";
232
+ readonly items: {
233
+ readonly type: "string";
234
+ };
235
+ };
236
+ readonly internal_mechanics_drift: {
237
+ readonly type: "array";
238
+ readonly items: {
239
+ readonly type: "string";
240
+ };
241
+ };
242
+ readonly revisions: {
243
+ readonly type: "array";
244
+ readonly items: {
245
+ readonly type: "string";
246
+ };
247
+ };
248
+ readonly verdict: {
249
+ readonly type: "string";
250
+ readonly enum: readonly string[];
251
+ };
252
+ };
253
+ readonly required: readonly ["coverage_gaps", "framing_errors", "cross_area_issues", "internal_mechanics_drift", "revisions", "verdict"];
254
+ readonly additionalProperties: false;
255
+ };
256
+ export declare function parseSpecReview(text: string): SpecReview;
257
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1,183 @@
1
+ /**
2
+ * JSON schemas for outline + reviewer output.
3
+ *
4
+ * The CLI passes these to `claude -p --json-schema` to constrain agent output,
5
+ * then validates the parsed result before driving the loop.
6
+ *
7
+ * Requirements covered:
8
+ * - CTS-PLAN-1: outline structure
9
+ * - CTS-PLAN-2: outline reviewer output structure (categorized findings + verdict)
10
+ */
11
+ import { z } from "zod";
12
+ // ---------- Outline ----------
13
+ export const AreaSchema = z.object({
14
+ name: z.string().min(1),
15
+ description: z.string().min(1),
16
+ prefix: z
17
+ .string()
18
+ .regex(/^[A-Z][A-Z0-9_]*$/, "prefix must be uppercase alphanumeric/underscore"),
19
+ files: z.array(z.string()).min(0),
20
+ });
21
+ export const OutlineSchema = z.object({
22
+ title: z.string().min(1),
23
+ defaultPrefix: z
24
+ .string()
25
+ .regex(/^[A-Z][A-Z0-9_]*$/, "defaultPrefix must be uppercase alphanumeric/underscore"),
26
+ summary: z.string().min(1),
27
+ areas: z.array(AreaSchema).min(1),
28
+ });
29
+ /**
30
+ * JSON Schema for the outline, passed to `claude -p --json-schema`.
31
+ * Mirrors OutlineSchema in JSON Schema form (which `claude -p` accepts).
32
+ */
33
+ export const OUTLINE_JSON_SCHEMA = {
34
+ type: "object",
35
+ properties: {
36
+ title: { type: "string" },
37
+ defaultPrefix: { type: "string" },
38
+ summary: { type: "string" },
39
+ areas: {
40
+ type: "array",
41
+ items: {
42
+ type: "object",
43
+ properties: {
44
+ name: { type: "string" },
45
+ description: { type: "string" },
46
+ prefix: { type: "string" },
47
+ files: { type: "array", items: { type: "string" } },
48
+ },
49
+ required: ["name", "description", "prefix", "files"],
50
+ additionalProperties: false,
51
+ },
52
+ },
53
+ },
54
+ required: ["title", "defaultPrefix", "summary", "areas"],
55
+ additionalProperties: false,
56
+ };
57
+ // ---------- Outline review verdict ----------
58
+ export const VerdictValues = [
59
+ "approved",
60
+ "approved-with-revisions",
61
+ "requires-another-review",
62
+ ];
63
+ export const OutlineReviewSchema = z.object({
64
+ coverage_gaps: z.array(z.string()).default([]),
65
+ framing_errors: z.array(z.string()).default([]),
66
+ granularity_issues: z.array(z.string()).default([]),
67
+ file_assignment_issues: z.array(z.string()).default([]),
68
+ revisions: z.array(z.string()).default([]),
69
+ verdict: z.enum(VerdictValues),
70
+ });
71
+ export const OUTLINE_REVIEW_JSON_SCHEMA = {
72
+ type: "object",
73
+ properties: {
74
+ coverage_gaps: { type: "array", items: { type: "string" } },
75
+ framing_errors: { type: "array", items: { type: "string" } },
76
+ granularity_issues: { type: "array", items: { type: "string" } },
77
+ file_assignment_issues: { type: "array", items: { type: "string" } },
78
+ revisions: { type: "array", items: { type: "string" } },
79
+ verdict: {
80
+ type: "string",
81
+ enum: VerdictValues,
82
+ },
83
+ },
84
+ required: [
85
+ "coverage_gaps",
86
+ "framing_errors",
87
+ "granularity_issues",
88
+ "file_assignment_issues",
89
+ "revisions",
90
+ "verdict",
91
+ ],
92
+ additionalProperties: false,
93
+ };
94
+ /**
95
+ * Try to parse a string as JSON and validate against the outline schema.
96
+ * Throws with a descriptive message on failure (caller catches and either
97
+ * retries or fails the loop).
98
+ */
99
+ export function parseOutline(text) {
100
+ const trimmed = text.trim();
101
+ // Try direct parse first; fall back to extracting first {...} block.
102
+ let raw;
103
+ try {
104
+ raw = JSON.parse(trimmed);
105
+ }
106
+ catch {
107
+ const match = trimmed.match(/(\{[\s\S]*\})/);
108
+ if (!match) {
109
+ throw new Error("Outline output is not valid JSON and contains no JSON object");
110
+ }
111
+ raw = JSON.parse(match[1]);
112
+ }
113
+ return OutlineSchema.parse(raw);
114
+ }
115
+ /**
116
+ * Parse a reviewer's JSON output and validate against the outline-review schema.
117
+ */
118
+ export function parseOutlineReview(text) {
119
+ const trimmed = text.trim();
120
+ let raw;
121
+ try {
122
+ raw = JSON.parse(trimmed);
123
+ }
124
+ catch {
125
+ const match = trimmed.match(/(\{[\s\S]*\})/);
126
+ if (!match) {
127
+ throw new Error("Reviewer output is not valid JSON and contains no JSON object");
128
+ }
129
+ raw = JSON.parse(match[1]);
130
+ }
131
+ return OutlineReviewSchema.parse(raw);
132
+ }
133
+ // ---------- Spec review verdict ----------
134
+ //
135
+ // Same three-verdict structure as the outline reviewer, with categories
136
+ // tailored to document-level cohesion concerns.
137
+ export const SpecReviewSchema = z.object({
138
+ coverage_gaps: z.array(z.string()).default([]),
139
+ framing_errors: z.array(z.string()).default([]),
140
+ cross_area_issues: z.array(z.string()).default([]),
141
+ internal_mechanics_drift: z.array(z.string()).default([]),
142
+ revisions: z.array(z.string()).default([]),
143
+ verdict: z.enum(VerdictValues),
144
+ });
145
+ export const SPEC_REVIEW_JSON_SCHEMA = {
146
+ type: "object",
147
+ properties: {
148
+ coverage_gaps: { type: "array", items: { type: "string" } },
149
+ framing_errors: { type: "array", items: { type: "string" } },
150
+ cross_area_issues: { type: "array", items: { type: "string" } },
151
+ internal_mechanics_drift: { type: "array", items: { type: "string" } },
152
+ revisions: { type: "array", items: { type: "string" } },
153
+ verdict: {
154
+ type: "string",
155
+ enum: VerdictValues,
156
+ },
157
+ },
158
+ required: [
159
+ "coverage_gaps",
160
+ "framing_errors",
161
+ "cross_area_issues",
162
+ "internal_mechanics_drift",
163
+ "revisions",
164
+ "verdict",
165
+ ],
166
+ additionalProperties: false,
167
+ };
168
+ export function parseSpecReview(text) {
169
+ const trimmed = text.trim();
170
+ let raw;
171
+ try {
172
+ raw = JSON.parse(trimmed);
173
+ }
174
+ catch {
175
+ const match = trimmed.match(/(\{[\s\S]*\})/);
176
+ if (!match) {
177
+ throw new Error("Spec reviewer output is not valid JSON and contains no JSON object");
178
+ }
179
+ raw = JSON.parse(match[1]);
180
+ }
181
+ return SpecReviewSchema.parse(raw);
182
+ }
183
+ //# sourceMappingURL=schemas.js.map