@popoverai/dotrequirements 0.24.2 → 0.25.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 (35) hide show
  1. package/README.md +7 -9
  2. package/dist/codebase-to-spec/cache.d.ts +6 -0
  3. package/dist/codebase-to-spec/cache.js +1 -0
  4. package/dist/codebase-to-spec/dispatch.d.ts +115 -0
  5. package/dist/codebase-to-spec/dispatch.js +850 -0
  6. package/dist/codebase-to-spec/pack.d.ts +7 -0
  7. package/dist/codebase-to-spec/pack.js +29 -8
  8. package/dist/codebase-to-spec/prompts/editor.d.ts +1 -1
  9. package/dist/codebase-to-spec/prompts/editor.js +1 -1
  10. package/dist/codebase-to-spec/prompts/specifier.d.ts +1 -1
  11. package/dist/codebase-to-spec/prompts/specifier.js +3 -2
  12. package/dist/codebase-to-spec/schemas.d.ts +528 -0
  13. package/dist/codebase-to-spec/schemas.js +244 -0
  14. package/dist/codebase-to-spec/skill-install.d.ts +41 -14
  15. package/dist/codebase-to-spec/skill-install.js +75 -26
  16. package/dist/commands/codebase-to-spec/compose-orchestrator.d.ts +14 -0
  17. package/dist/commands/codebase-to-spec/compose-orchestrator.js +54 -0
  18. package/dist/commands/codebase-to-spec/dispatch-context.d.ts +9 -0
  19. package/dist/commands/codebase-to-spec/dispatch-context.js +19 -0
  20. package/dist/commands/codebase-to-spec/dispatch-editor.d.ts +15 -0
  21. package/dist/commands/codebase-to-spec/dispatch-editor.js +70 -0
  22. package/dist/commands/codebase-to-spec/dispatch-planner.d.ts +18 -0
  23. package/dist/commands/codebase-to-spec/dispatch-planner.js +89 -0
  24. package/dist/commands/codebase-to-spec/dispatch-spec.d.ts +13 -0
  25. package/dist/commands/codebase-to-spec/dispatch-spec.js +56 -0
  26. package/dist/commands/codebase-to-spec/index.js +58 -2
  27. package/dist/commands/codebase-to-spec/pack.d.ts +5 -0
  28. package/dist/commands/codebase-to-spec/pack.js +6 -3
  29. package/dist/commands/codebase-to-spec/present-orchestrator.d.ts +20 -0
  30. package/dist/commands/codebase-to-spec/present-orchestrator.js +81 -0
  31. package/dist/commands/codebase-to-spec/skill-install.js +5 -1
  32. package/dist/templates/agents/cts-worker.md +9 -0
  33. package/dist/templates/skills/codebase-to-spec/SKILL.md +44 -77
  34. package/dist/templates/workflows/specify-codebase.js +372 -0
  35. package/package.json +2 -2
package/README.md CHANGED
@@ -243,20 +243,18 @@ Optional settings: `vercelBypassSecret`, `browserbaseApiKey`, `browserbaseProjec
243
243
 
244
244
  ### `dotreq cts` *(Alpha)*
245
245
 
246
- Generate behavioral requirements from an existing codebase. Packs the codebase, plans a behavioral outline, fans out per-area specifier agents to draft per-area requirements, runs a dual review loop, and writes the result to `.requirements/`.
246
+ Generate behavioral requirements from an existing codebase — it plans a behavioral outline, drafts the requirements for each area, converges each through independent review, then reconciles the whole spec in a final cross-area pass, and writes the result to `.requirements/`.
247
+
248
+ It runs as a Claude Code skill backed by a dynamic workflow. Install it, then invoke it from Claude Code:
247
249
 
248
250
  ```bash
249
- dotreq cts run --scope src # full pipeline end-to-end
250
- dotreq cts run --scope src --fresh # discard cache and start over
251
- dotreq cts run --scope src --ignore-requirements # run against a codebase that already has its own .requirements/
252
- dotreq cts skill-install # install the conversational skill wrapper
251
+ dotreq cts skill-install # install into this project's .claude/
252
+ dotreq cts skill-install --global # …or into ~/.claude/ for every project
253
253
  ```
254
254
 
255
- `cts` shells out to `claude -p` and uses whatever auth mode you've configured for Claude Code. Each pipeline stage is also runnable on its own (`dotreq cts pack`, `plan-loop`, `fan-out`, `compose`, `edit-loop`, `present`) for partial re-runs and debugging.
256
-
257
- > **Alpha:** output quality is prompt-sensitive and varies by codebase. See the [Codebase to Spec docs](https://docs.dotrequirements.io/tools/cli/codebase-to-spec) for prerequisites, options, exit codes, and known rough edges. Feedback to support@dotrequirements.io welcome.
255
+ Then, in Claude Code, run `/codebase-to-spec` (or just ask — e.g. "spec the auth module"). You confirm the scope; the workflow autonomously plans the areas, drafts and reviews each one, reconciles them in a cross-area pass, and writes the result to `.requirements/`. Requires a Claude Code version with dynamic-workflow support.
258
256
 
259
- > **Heads up:** as of June 15, 2026, `claude -p` bills against your Claude subscription's API credit instead of the subscription seat (per Anthropic's May 13, 2026 announcement). `cts` runs will draw from that credit.
257
+ > **Alpha:** output quality is prompt-sensitive and varies by codebase. See the [Codebase to Spec docs](https://docs.dotrequirements.io/tools/cli/codebase-to-spec) for prerequisites, scoping, and known rough edges. Feedback to support@dotrequirements.io welcome.
260
258
 
261
259
  ### `dotreq ai-setup`
262
260
 
@@ -38,6 +38,12 @@ export interface CachePaths {
38
38
  specFinal: string;
39
39
  /** Final pipeline summary JSON, surfaced by present and consumed by wrappers. */
40
40
  pipelineSummary: string;
41
+ /**
42
+ * Conversational orchestrator outline — single YAML file that evolves
43
+ * across the run (Phase 2b refactor). Carries content + review.thread
44
+ * lifecycle state inline. Distinct from the legacy outline-N.json files.
45
+ */
46
+ outline: string;
41
47
  }
42
48
  export declare function cachePaths(projectRoot: string): CachePaths;
43
49
  export declare function ensureCacheDir(projectRoot: string): CachePaths;
@@ -29,6 +29,7 @@ export function cachePaths(projectRoot) {
29
29
  specReviewTurn: (n) => join(root, `spec-review-${n}.json`),
30
30
  specFinal: join(root, "spec-final.md"),
31
31
  pipelineSummary: join(root, "pipeline-summary.json"),
32
+ outline: join(root, "outline.yaml"),
32
33
  };
33
34
  }
34
35
  export function ensureCacheDir(projectRoot) {
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Dispatch-context composition for the codebase-to-spec workflow.
3
+ *
4
+ * A cts-worker runs `dotrequirements cts dispatch-context <dispatch-id>` to
5
+ * fetch the full composed prompt for its role (self-composition — there is no
6
+ * PreToolUse hook). Each returned prompt is self-contained: persona body +
7
+ * paths + any prior-round context the worker needs.
8
+ *
9
+ * Recognized dispatch IDs:
10
+ * - `planner-initial` — initial planner; writes outline.yaml
11
+ * - `planner-revise-<turn>` — revising planner; reads the prior outline.yaml
12
+ * (with its review.thread), applies the latest thread entry's revisions, and
13
+ * writes a new outline.yaml. `<turn>` is the round being PRODUCED (2 = first
14
+ * revision).
15
+ * - `outline-reviewer` — independent reviewer of the area decomposition; appends
16
+ * its verdict to the document-level review.thread.
17
+ * - `specifier-<area>` — drafts one area's partial.
18
+ * - `reviewer-<area>` — independent per-area reviewer; appends its verdict to
19
+ * that area's review.thread.
20
+ * - `editor-<area>` — applies the per-area reviewer's revisions to the partial.
21
+ * - `cross-area-reviewer` — document-level reviewer of the composed spec
22
+ * (cross-area issues + coverage); returns its verdict for the reconcile loop.
23
+ * - `compose-editor` — applies cross-area revisions to the composed spec.
24
+ * - `phase1-test` — mechanical plumbing self-test.
25
+ *
26
+ * Requirements covered:
27
+ * - CTSO-CONV-2: the outline converges via an independent reviewer loop
28
+ * - CTSO-CONV-5: cross-area review reconciles the composed spec
29
+ */
30
+ export interface DispatchContext {
31
+ /**
32
+ * The full composed prompt the worker subagent should receive as its first
33
+ * turn. Includes the persona body + paths + any prior-round context needed
34
+ * to ground the worker's behavior.
35
+ */
36
+ prompt: string;
37
+ }
38
+ /** Phase 1 dispatch-id used to validate the mechanical plumbing end-to-end. */
39
+ export declare const PHASE1_TEST_DISPATCH_ID = "phase1-test";
40
+ /** Phase 1 token the test worker echoes back. */
41
+ export declare const PHASE1_TEST_TOKEN = "PHASE1-WORKER-OK token=CTS9X";
42
+ /** Phase 2 dispatch-id for the initial planner pass. */
43
+ export declare const PLANNER_INITIAL_DISPATCH_ID = "planner-initial";
44
+ /**
45
+ * Phase 2b dispatch-id prefix for planner revise dispatches. Suffix is the
46
+ * turn number being PRODUCED (e.g., `planner-revise-2` produces the
47
+ * second turn's outline, reading the prior outline + its latest review
48
+ * thread entry as inputs).
49
+ */
50
+ export declare const PLANNER_REVISE_DISPATCH_ID_PREFIX = "planner-revise-";
51
+ /**
52
+ * Phase 3 dispatch-id prefix for specifier dispatches. Suffix is the area's
53
+ * prefix from the approved outline (e.g., `specifier-PLAN` runs the
54
+ * specifier for the PLAN area).
55
+ */
56
+ export declare const SPECIFIER_DISPATCH_ID_PREFIX = "specifier-";
57
+ /**
58
+ * Phase 4 dispatch-id prefix for editor dispatches. Suffix is the area's
59
+ * prefix (e.g., `editor-PLAN` revises the PLAN area's partial based on
60
+ * the latest area.review.thread entry's revisions).
61
+ */
62
+ export declare const EDITOR_DISPATCH_ID_PREFIX = "editor-";
63
+ /**
64
+ * Dispatch-id prefix for per-area reviewer dispatches. Suffix is the area's
65
+ * prefix (e.g., `reviewer-PLAN` reviews the PLAN area's partial). The reviewer
66
+ * is a distinct worker from the specifier/editor that produced the partial
67
+ * (independent second pair of eyes — CTSO-CONV-3.1). It appends its verdict to
68
+ * that area's `review.thread` in outline.yaml (read by the editor dispatch) and
69
+ * also returns the verdict so the workflow's convergence loop can branch on it.
70
+ */
71
+ export declare const REVIEWER_DISPATCH_ID_PREFIX = "reviewer-";
72
+ /**
73
+ * Dispatch-id for the outline reviewer — the independent reviewer for the
74
+ * planner's area decomposition (project level, one per run). Distinct from the
75
+ * planner that produced the outline (CTSO-CONV-2.1). It appends its verdict to
76
+ * the project-level `outline.review.thread` and returns the verdict so the
77
+ * workflow's outline loop can branch on it. The outline loop is sequential, so
78
+ * unlike the per-area reviewers this writer never contends on the file.
79
+ */
80
+ export declare const OUTLINE_REVIEWER_DISPATCH_ID = "outline-reviewer";
81
+ /**
82
+ * Dispatch-id for the cross-area reviewer — the document-level reviewer that
83
+ * runs AFTER per-area work converges and the partials are composed into a single
84
+ * spec. It reviews the composed spec for cross-area issues (duplication,
85
+ * terminology/persona drift, awkward cross-cutting splits, depth imbalance) plus
86
+ * document-level coverage and framing. It appends its verdict to the outline's
87
+ * top-level `crossAreaReview.thread` (auditable, like the per-area reviewers)
88
+ * and also returns it so the workflow's reconcile loop can branch on it
89
+ * (CTSO-CONV-5). Reuses the legacy SPEC_REVIEWER_PROMPT persona. One per round,
90
+ * sequential — no file contention.
91
+ */
92
+ export declare const CROSS_AREA_REVIEWER_DISPATCH_ID = "cross-area-reviewer";
93
+ /**
94
+ * Dispatch-id for the compose-level editor — applies the cross-area reviewer's
95
+ * revisions to the whole composed spec (not one area). Reuses the legacy
96
+ * EDITOR_PROMPT persona at its native document scope, reading the revisions to
97
+ * apply from the outline's top-level `crossAreaReview.thread` — the same
98
+ * auditable channel the per-area editor uses for `area.review.thread`.
99
+ */
100
+ export declare const COMPOSE_EDITOR_DISPATCH_ID = "compose-editor";
101
+ export interface ComposeDispatchOptions {
102
+ /**
103
+ * Project root used to resolve cache paths. Defaults to `findProjectRoot()`
104
+ * starting from cwd. Tests pass a temp directory.
105
+ */
106
+ projectRoot?: string;
107
+ }
108
+ /**
109
+ * Compose the dispatch context for a given dispatch-id.
110
+ *
111
+ * @returns the composed dispatch context, or `null` if the id is unknown
112
+ * or required inputs (cache files) are missing.
113
+ */
114
+ export declare function composeDispatchContext(dispatchId: string, options?: ComposeDispatchOptions): DispatchContext | null;
115
+ //# sourceMappingURL=dispatch.d.ts.map