@popoverai/dotrequirements 0.25.0 → 0.26.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.
- package/dist/cli.js +8 -1
- package/dist/codebase-to-spec/area-name.d.ts +13 -0
- package/dist/codebase-to-spec/area-name.js +18 -0
- package/dist/codebase-to-spec/cache.d.ts +31 -0
- package/dist/codebase-to-spec/cache.js +29 -1
- package/dist/codebase-to-spec/compose.d.ts +7 -4
- package/dist/codebase-to-spec/compose.js +10 -21
- package/dist/codebase-to-spec/dispatch.js +1 -1
- package/dist/codebase-to-spec/present.d.ts +9 -0
- package/dist/codebase-to-spec/present.js +30 -4
- package/dist/codebase-to-spec/prompts/planner-initial.d.ts +3 -2
- package/dist/codebase-to-spec/prompts/planner-initial.js +3 -2
- package/dist/codebase-to-spec/renumber.d.ts +52 -0
- package/dist/codebase-to-spec/renumber.js +105 -0
- package/dist/codebase-to-spec/schemas.d.ts +35 -240
- package/dist/codebase-to-spec/schemas.js +5 -173
- package/dist/codebase-to-spec/skill-install.d.ts +16 -6
- package/dist/codebase-to-spec/skill-install.js +109 -47
- package/dist/codebase-to-spec/version-check.d.ts +31 -0
- package/dist/codebase-to-spec/version-check.js +56 -0
- package/dist/commands/ai-setup.d.ts +12 -1
- package/dist/commands/ai-setup.js +65 -33
- package/dist/commands/codebase-to-spec/dispatch-editor.js +1 -1
- package/dist/commands/codebase-to-spec/dispatch-spec.js +1 -1
- package/dist/commands/codebase-to-spec/index.js +7 -103
- package/dist/commands/codebase-to-spec/pack.d.ts +4 -0
- package/dist/commands/codebase-to-spec/pack.js +25 -1
- package/dist/commands/codebase-to-spec/present-orchestrator.d.ts +3 -1
- package/dist/commands/codebase-to-spec/present-orchestrator.js +11 -4
- package/dist/commands/init.js +6 -1
- package/dist/commands/link-resolution.d.ts +79 -0
- package/dist/commands/link-resolution.js +141 -0
- package/dist/commands/link.d.ts +14 -4
- package/dist/commands/link.js +369 -16
- package/dist/commands/pull.js +19 -2
- package/dist/commands/push.js +36 -2
- package/dist/convex.d.ts +5 -3
- package/dist/convex.js +5 -3
- package/dist/harness/cache.d.ts +0 -14
- package/dist/harness/cache.js +1 -41
- package/dist/harness/finalize.js +2 -2
- package/dist/harness/prepare.js +1 -3
- package/dist/harness/requirementsLoader.d.ts +3 -3
- package/dist/harness/requirementsLoader.js +13 -8
- package/dist/mcp/handlers/authoring.d.ts +5 -5
- package/dist/mcp/handlers/authoring.js +9 -9
- package/dist/mcp/handlers/push.d.ts +2 -2
- package/dist/mcp/handlers/push.js +36 -3
- package/dist/mcp/handlers/review.d.ts +4 -4
- package/dist/mcp/handlers/review.js +4 -4
- package/dist/mcp/handlers/search.d.ts +1 -1
- package/dist/mcp/handlers/search.js +1 -1
- package/dist/mcp/index.js +29 -0
- package/dist/push/core.d.ts +18 -0
- package/dist/push/core.js +70 -3
- package/dist/push/index.d.ts +1 -1
- package/dist/push/index.js +1 -1
- package/dist/schema/parser-core.js +5 -1
- package/dist/schema/parser.js +5 -1
- package/dist/schema/run-marker.d.ts +38 -0
- package/dist/schema/run-marker.js +138 -0
- package/dist/schema/schemas.d.ts +12 -0
- package/dist/schema/schemas.js +1 -0
- package/dist/templates/agents/cts-worker.md +1 -1
- package/dist/templates/skills/codebase-to-spec/SKILL.md +39 -11
- package/dist/templates/workflows/specify-codebase.js +4 -2
- package/dist/utils/own-package.d.ts +10 -0
- package/dist/utils/own-package.js +13 -0
- package/dist/utils/project-selector.d.ts +5 -0
- package/dist/utils/project-selector.js +4 -0
- package/package.json +2 -2
- package/dist/codebase-to-spec/edit-loop.d.ts +0 -54
- package/dist/codebase-to-spec/edit-loop.js +0 -195
- package/dist/codebase-to-spec/editor.d.ts +0 -54
- package/dist/codebase-to-spec/editor.js +0 -74
- package/dist/codebase-to-spec/fan-out.d.ts +0 -63
- package/dist/codebase-to-spec/fan-out.js +0 -215
- package/dist/codebase-to-spec/outline-review-loop.d.ts +0 -51
- package/dist/codebase-to-spec/outline-review-loop.js +0 -187
- package/dist/codebase-to-spec/planner.d.ts +0 -41
- package/dist/codebase-to-spec/planner.js +0 -76
- package/dist/codebase-to-spec/prompts/outline-reviewer.d.ts +0 -12
- package/dist/codebase-to-spec/prompts/outline-reviewer.js +0 -89
- package/dist/codebase-to-spec/slice.d.ts +0 -49
- package/dist/codebase-to-spec/slice.js +0 -111
- package/dist/codebase-to-spec/specifier.d.ts +0 -60
- package/dist/codebase-to-spec/specifier.js +0 -85
- package/dist/codebase-to-spec/summary.d.ts +0 -51
- package/dist/codebase-to-spec/summary.js +0 -183
- package/dist/commands/codebase-to-spec/compose.d.ts +0 -14
- package/dist/commands/codebase-to-spec/compose.js +0 -57
- package/dist/commands/codebase-to-spec/edit-loop.d.ts +0 -16
- package/dist/commands/codebase-to-spec/edit-loop.js +0 -83
- package/dist/commands/codebase-to-spec/fan-out.d.ts +0 -19
- package/dist/commands/codebase-to-spec/fan-out.js +0 -77
- package/dist/commands/codebase-to-spec/plan-loop.d.ts +0 -26
- package/dist/commands/codebase-to-spec/plan-loop.js +0 -105
- package/dist/commands/codebase-to-spec/present.d.ts +0 -26
- package/dist/commands/codebase-to-spec/present.js +0 -97
- package/dist/commands/codebase-to-spec/run.d.ts +0 -20
- package/dist/commands/codebase-to-spec/run.js +0 -86
- package/dist/commands/codebase-to-spec/specify-area.d.ts +0 -18
- package/dist/commands/codebase-to-spec/specify-area.js +0 -82
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Specifier worker: run a single specifier for one area.
|
|
3
|
-
*
|
|
4
|
-
* The specifier is given its slice + the outline + a target partial path, and
|
|
5
|
-
* it orchestrates its own work via tools (Read, Write, Edit, Grep, Glob, Bash).
|
|
6
|
-
* Self-style-check happens via `Bash dotrequirements cts style-check <path>`.
|
|
7
|
-
*
|
|
8
|
-
* Requirements covered:
|
|
9
|
-
* - CTS-SPEC-1: per-area worker invocation
|
|
10
|
-
* - CTS-SPEC-2: write partial to known path via Write tool
|
|
11
|
-
* - CTS-SPEC-3: self-style-check via Bash
|
|
12
|
-
* - CTS-SPEC-4: access to the full pack for cross-area context
|
|
13
|
-
* - CTS-SPEC-5: failure detection and retry orchestrated by fan-out (this file
|
|
14
|
-
* produces a single attempt; fan-out wraps it with retry policy)
|
|
15
|
-
*/
|
|
16
|
-
import { existsSync, statSync } from "node:fs";
|
|
17
|
-
import { runClaude } from "./claude.js";
|
|
18
|
-
import { SPECIFIER_PROMPT } from "./prompts/specifier.js";
|
|
19
|
-
function buildUserMessage(ctx) {
|
|
20
|
-
return [
|
|
21
|
-
`You are specifying ONE area of the system.`,
|
|
22
|
-
``,
|
|
23
|
-
`Area name: ${ctx.area.name}`,
|
|
24
|
-
`Area description: ${ctx.area.description}`,
|
|
25
|
-
`Document defaultPrefix: ${ctx.outline.defaultPrefix}`,
|
|
26
|
-
`Area prefix: ${ctx.area.prefix}`,
|
|
27
|
-
``,
|
|
28
|
-
`## Customers this area serves`,
|
|
29
|
-
`(Pick one of these as the named persona for your requirements. Do not invent a different customer. If none of these is a real user of the software — e.g., all entries describe a contributor to this codebase — follow the AREA-LACKS-CUSTOMER escape in your system prompt instead of writing requirements.)`,
|
|
30
|
-
`\`\`\`json`,
|
|
31
|
-
JSON.stringify(ctx.area.customers, null, 2),
|
|
32
|
-
`\`\`\``,
|
|
33
|
-
`Use full requirement IDs of the form: ${ctx.outline.defaultPrefix}-${ctx.area.prefix}-1, ${ctx.outline.defaultPrefix}-${ctx.area.prefix}-2, etc. (sequential, 1-indexed, no zero-padding).`,
|
|
34
|
-
``,
|
|
35
|
-
`## Paths`,
|
|
36
|
-
`- Slice (your area's files): ${ctx.slicePath}`,
|
|
37
|
-
`- Full uncompressed pack (for discovering behaviors in tests/recipes/docs): ${ctx.fullPackPath}`,
|
|
38
|
-
`- Where to write your partial: ${ctx.partialPath}`,
|
|
39
|
-
`- Validate command (run FIRST after writing your draft — deterministic syntax check):`,
|
|
40
|
-
` Bash: ${ctx.validateCommand} ${ctx.partialPath}`,
|
|
41
|
-
`- Style-check command (run SECOND, only after validate passes — AI clarity feedback):`,
|
|
42
|
-
` Bash: ${ctx.styleCheckCommand} ${ctx.partialPath}`,
|
|
43
|
-
``,
|
|
44
|
-
`## Full system outline (so you know what is in scope vs. not)`,
|
|
45
|
-
`\`\`\`json`,
|
|
46
|
-
JSON.stringify(ctx.outline, null, 2),
|
|
47
|
-
`\`\`\``,
|
|
48
|
-
``,
|
|
49
|
-
`Follow the three-phase workflow in your system prompt: draft (Phase A) → validate (Phase B) → style-check (Phase C) → confirm.`,
|
|
50
|
-
].join("\n");
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Run a single specifier. Returns details about whether it succeeded.
|
|
54
|
-
*/
|
|
55
|
-
export async function runSpecifier(ctx) {
|
|
56
|
-
const runner = ctx.runner ?? runClaude;
|
|
57
|
-
const result = await runner({
|
|
58
|
-
systemPrompt: SPECIFIER_PROMPT,
|
|
59
|
-
userMessage: buildUserMessage(ctx),
|
|
60
|
-
model: ctx.model,
|
|
61
|
-
tools: ["Read", "Write", "Edit", "Grep", "Glob", "Bash"],
|
|
62
|
-
addDirs: ctx.addDirs,
|
|
63
|
-
});
|
|
64
|
-
// Inspect the partial file to determine whether the specifier wrote
|
|
65
|
-
// something usable.
|
|
66
|
-
let wrotePartial = false;
|
|
67
|
-
let partialBytes = 0;
|
|
68
|
-
if (existsSync(ctx.partialPath)) {
|
|
69
|
-
try {
|
|
70
|
-
partialBytes = statSync(ctx.partialPath).size;
|
|
71
|
-
wrotePartial = partialBytes > 0;
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// ignore; treat as not written
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
wrotePartial,
|
|
79
|
-
partialBytes,
|
|
80
|
-
exitCode: result.exitCode,
|
|
81
|
-
stdout: result.stdout,
|
|
82
|
-
stderr: result.stderr,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
//# sourceMappingURL=specifier.js.map
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pipeline summary generation.
|
|
3
|
-
*
|
|
4
|
-
* Reads cached artifacts to assemble a structured summary of what the
|
|
5
|
-
* pipeline produced. Surfaced both as JSON (parseable by wrappers like the
|
|
6
|
-
* skill) and as a short human-readable block.
|
|
7
|
-
*
|
|
8
|
-
* Requirements covered:
|
|
9
|
-
* - CTS-PRESENT-4: Final pipeline summary is surfaced
|
|
10
|
-
* - CTS-OBSERVE-2 (partial): structured failure information available
|
|
11
|
-
*/
|
|
12
|
-
import type { CachePaths } from "./cache.js";
|
|
13
|
-
import { type Outline } from "./schemas.js";
|
|
14
|
-
export interface PipelineSummary {
|
|
15
|
-
totalAreas: number;
|
|
16
|
-
totalRequirements: number;
|
|
17
|
-
outline: {
|
|
18
|
-
turnsUsed: number;
|
|
19
|
-
finalVerdict: string | null;
|
|
20
|
-
residualNotes: string[];
|
|
21
|
-
};
|
|
22
|
-
specifiers: {
|
|
23
|
-
completed: number;
|
|
24
|
-
missing: number;
|
|
25
|
-
/** Area names that have no usable partial. */
|
|
26
|
-
missingAreas: string[];
|
|
27
|
-
};
|
|
28
|
-
specReview: {
|
|
29
|
-
turnsUsed: number;
|
|
30
|
-
finalVerdict: string | null;
|
|
31
|
-
residualNotes: string[];
|
|
32
|
-
};
|
|
33
|
-
outputs: {
|
|
34
|
-
/** Paths under .requirements/ that were written. */
|
|
35
|
-
paths: string[];
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
export interface BuildSummaryInput {
|
|
39
|
-
outline: Outline;
|
|
40
|
-
paths: CachePaths;
|
|
41
|
-
/** Paths the present stage wrote (under .requirements/). */
|
|
42
|
-
outputPaths: string[];
|
|
43
|
-
}
|
|
44
|
-
export declare function buildPipelineSummary(input: BuildSummaryInput): PipelineSummary;
|
|
45
|
-
/**
|
|
46
|
-
* Render a short human-readable block for the summary. Designed to fit on a
|
|
47
|
-
* small number of lines (CTS-PRESENT-4.2). Wrappers that want richer
|
|
48
|
-
* presentation can read the JSON form instead.
|
|
49
|
-
*/
|
|
50
|
-
export declare function renderSummaryText(summary: PipelineSummary): string;
|
|
51
|
-
//# sourceMappingURL=summary.d.ts.map
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pipeline summary generation.
|
|
3
|
-
*
|
|
4
|
-
* Reads cached artifacts to assemble a structured summary of what the
|
|
5
|
-
* pipeline produced. Surfaced both as JSON (parseable by wrappers like the
|
|
6
|
-
* skill) and as a short human-readable block.
|
|
7
|
-
*
|
|
8
|
-
* Requirements covered:
|
|
9
|
-
* - CTS-PRESENT-4: Final pipeline summary is surfaced
|
|
10
|
-
* - CTS-OBSERVE-2 (partial): structured failure information available
|
|
11
|
-
*/
|
|
12
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
13
|
-
import { sanitizeAreaName } from "./fan-out.js";
|
|
14
|
-
import { parseOutlineReview, parseSpecReview, } from "./schemas.js";
|
|
15
|
-
/**
|
|
16
|
-
* Count top-level requirements in a file by counting fenced
|
|
17
|
-
* \`\`\`dotrequirements blocks. Each block represents one root requirement
|
|
18
|
-
* (CTS-OBSERVE-2 counts each requirement ID once, excluding child criteria).
|
|
19
|
-
*/
|
|
20
|
-
function countRequirementsInFile(path) {
|
|
21
|
-
if (!existsSync(path))
|
|
22
|
-
return 0;
|
|
23
|
-
const content = readFileSync(path, "utf-8");
|
|
24
|
-
const matches = content.match(/```dotrequirements\b/g);
|
|
25
|
-
return matches ? matches.length : 0;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Look at outline-review-N.json files in the cache and return how many turns
|
|
29
|
-
* ran and what the final verdict was. Returns {turnsUsed: 0, finalVerdict: null}
|
|
30
|
-
* if no review artifacts exist.
|
|
31
|
-
*/
|
|
32
|
-
function summarizeOutlineReview(paths) {
|
|
33
|
-
let n = 0;
|
|
34
|
-
let lastReviewPath = null;
|
|
35
|
-
while (true) {
|
|
36
|
-
const path = paths.outlineReviewTurn(n + 1);
|
|
37
|
-
if (!existsSync(path))
|
|
38
|
-
break;
|
|
39
|
-
n++;
|
|
40
|
-
lastReviewPath = path;
|
|
41
|
-
}
|
|
42
|
-
if (!lastReviewPath)
|
|
43
|
-
return { turnsUsed: 0, finalVerdict: null, residualNotes: [] };
|
|
44
|
-
try {
|
|
45
|
-
const review = parseOutlineReview(readFileSync(lastReviewPath, "utf-8"));
|
|
46
|
-
const notes = [];
|
|
47
|
-
// Surface unresolved findings as residual notes if verdict isn't 'approved'.
|
|
48
|
-
if (review.verdict !== "approved") {
|
|
49
|
-
for (const cat of [
|
|
50
|
-
["coverage_gap", review.coverage_gaps],
|
|
51
|
-
["framing_error", review.framing_errors],
|
|
52
|
-
["granularity", review.granularity_issues],
|
|
53
|
-
["file_assignment", review.file_assignment_issues],
|
|
54
|
-
]) {
|
|
55
|
-
for (const note of cat[1]) {
|
|
56
|
-
notes.push(`outline.${cat[0]}: ${note}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return { turnsUsed: n, finalVerdict: review.verdict, residualNotes: notes };
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
return { turnsUsed: n, finalVerdict: null, residualNotes: [] };
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function summarizeSpecReview(paths) {
|
|
67
|
-
let n = 0;
|
|
68
|
-
let lastReviewPath = null;
|
|
69
|
-
while (true) {
|
|
70
|
-
const path = paths.specReviewTurn(n + 1);
|
|
71
|
-
if (!existsSync(path))
|
|
72
|
-
break;
|
|
73
|
-
n++;
|
|
74
|
-
lastReviewPath = path;
|
|
75
|
-
}
|
|
76
|
-
if (!lastReviewPath)
|
|
77
|
-
return { turnsUsed: 0, finalVerdict: null, residualNotes: [] };
|
|
78
|
-
try {
|
|
79
|
-
const review = parseSpecReview(readFileSync(lastReviewPath, "utf-8"));
|
|
80
|
-
const notes = [];
|
|
81
|
-
if (review.verdict !== "approved") {
|
|
82
|
-
for (const cat of [
|
|
83
|
-
["coverage_gap", review.coverage_gaps],
|
|
84
|
-
["framing_error", review.framing_errors],
|
|
85
|
-
["cross_area", review.cross_area_issues],
|
|
86
|
-
["internal_mechanics", review.internal_mechanics_drift],
|
|
87
|
-
]) {
|
|
88
|
-
for (const note of cat[1]) {
|
|
89
|
-
notes.push(`spec.${cat[0]}: ${note}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return { turnsUsed: n, finalVerdict: review.verdict, residualNotes: notes };
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return { turnsUsed: n, finalVerdict: null, residualNotes: [] };
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function summarizeSpecifiers(outline, paths) {
|
|
100
|
-
let completed = 0;
|
|
101
|
-
const missingAreas = [];
|
|
102
|
-
for (const area of outline.areas) {
|
|
103
|
-
const partialPath = paths.partial(sanitizeAreaName(area.name));
|
|
104
|
-
if (!existsSync(partialPath)) {
|
|
105
|
-
missingAreas.push(area.name);
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
const content = readFileSync(partialPath, "utf-8").trim();
|
|
109
|
-
if (!content ||
|
|
110
|
-
content.startsWith("_(missing partial") ||
|
|
111
|
-
content.startsWith("_(no files")) {
|
|
112
|
-
missingAreas.push(area.name);
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
completed++;
|
|
116
|
-
}
|
|
117
|
-
return { completed, missing: missingAreas.length, missingAreas };
|
|
118
|
-
}
|
|
119
|
-
export function buildPipelineSummary(input) {
|
|
120
|
-
const { outline, paths, outputPaths } = input;
|
|
121
|
-
const outlineReview = summarizeOutlineReview(paths);
|
|
122
|
-
const specReview = summarizeSpecReview(paths);
|
|
123
|
-
const specifiers = summarizeSpecifiers(outline, paths);
|
|
124
|
-
// Count top-level requirements across all written .requirements/ files.
|
|
125
|
-
let totalRequirements = 0;
|
|
126
|
-
for (const path of outputPaths) {
|
|
127
|
-
totalRequirements += countRequirementsInFile(path);
|
|
128
|
-
}
|
|
129
|
-
// Fall back to counting the final cached spec if nothing was written (e.g.
|
|
130
|
-
// dry-run / interrupted) — that way the summary still reflects what the
|
|
131
|
-
// pipeline produced.
|
|
132
|
-
if (totalRequirements === 0 && existsSync(paths.specFinal)) {
|
|
133
|
-
totalRequirements = countRequirementsInFile(paths.specFinal);
|
|
134
|
-
}
|
|
135
|
-
return {
|
|
136
|
-
totalAreas: outline.areas.length,
|
|
137
|
-
totalRequirements,
|
|
138
|
-
outline: outlineReview,
|
|
139
|
-
specifiers,
|
|
140
|
-
specReview,
|
|
141
|
-
outputs: { paths: outputPaths },
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Render a short human-readable block for the summary. Designed to fit on a
|
|
146
|
-
* small number of lines (CTS-PRESENT-4.2). Wrappers that want richer
|
|
147
|
-
* presentation can read the JSON form instead.
|
|
148
|
-
*/
|
|
149
|
-
export function renderSummaryText(summary) {
|
|
150
|
-
const lines = [];
|
|
151
|
-
lines.push(`Pipeline summary:`);
|
|
152
|
-
lines.push(` Areas: ${summary.totalAreas}`);
|
|
153
|
-
lines.push(` Top-level reqs: ${summary.totalRequirements}`);
|
|
154
|
-
lines.push(` Outline review: ${summary.outline.turnsUsed} turn(s), verdict: ${summary.outline.finalVerdict ?? "n/a"}`);
|
|
155
|
-
lines.push(` Specifiers: ${summary.specifiers.completed} completed, ${summary.specifiers.missing} missing`);
|
|
156
|
-
lines.push(` Spec review: ${summary.specReview.turnsUsed} turn(s), verdict: ${summary.specReview.finalVerdict ?? "n/a"}`);
|
|
157
|
-
lines.push(` Output files:`);
|
|
158
|
-
for (const path of summary.outputs.paths) {
|
|
159
|
-
lines.push(` - ${path}`);
|
|
160
|
-
}
|
|
161
|
-
if (summary.outline.residualNotes.length ||
|
|
162
|
-
summary.specReview.residualNotes.length) {
|
|
163
|
-
lines.push(``);
|
|
164
|
-
lines.push(` Residual notes (worth reviewing manually):`);
|
|
165
|
-
for (const note of [
|
|
166
|
-
...summary.outline.residualNotes,
|
|
167
|
-
...summary.specReview.residualNotes,
|
|
168
|
-
]) {
|
|
169
|
-
lines.push(` - ${note}`);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
if (summary.specifiers.missingAreas.length) {
|
|
173
|
-
lines.push(``);
|
|
174
|
-
lines.push(` Missing specifier output for:`);
|
|
175
|
-
for (const area of summary.specifiers.missingAreas) {
|
|
176
|
-
lines.push(` - ${area}`);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return lines.join("\n");
|
|
180
|
-
}
|
|
181
|
-
/** Suppress unused-var warning. */
|
|
182
|
-
void statSync;
|
|
183
|
-
//# sourceMappingURL=summary.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec compose` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Assembles per-area partials into a single composed Markdown document.
|
|
5
|
-
*
|
|
6
|
-
* Requirements covered:
|
|
7
|
-
* - CTS-CLI-2: granular `compose` subcommand
|
|
8
|
-
* - CTS-COMPOSE-1, CTS-COMPOSE-2
|
|
9
|
-
*/
|
|
10
|
-
export interface ComposeCmdOptions {
|
|
11
|
-
projectRoot?: string;
|
|
12
|
-
}
|
|
13
|
-
export declare function composeCommand(options?: ComposeCmdOptions): Promise<void>;
|
|
14
|
-
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec compose` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Assembles per-area partials into a single composed Markdown document.
|
|
5
|
-
*
|
|
6
|
-
* Requirements covered:
|
|
7
|
-
* - CTS-CLI-2: granular `compose` subcommand
|
|
8
|
-
* - CTS-COMPOSE-1, CTS-COMPOSE-2
|
|
9
|
-
*/
|
|
10
|
-
import { existsSync } from "node:fs";
|
|
11
|
-
import { cachePaths } from "../../codebase-to-spec/cache.js";
|
|
12
|
-
import { runCompose } from "../../codebase-to-spec/compose.js";
|
|
13
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
14
|
-
import { StdoutProgress } from "../../codebase-to-spec/progress.js";
|
|
15
|
-
import { findProjectRoot } from "../../utils/project-settings.js";
|
|
16
|
-
import { readFinalOutline } from "./plan-loop.js";
|
|
17
|
-
export async function composeCommand(options = {}) {
|
|
18
|
-
const progress = new StdoutProgress();
|
|
19
|
-
const projectRoot = options.projectRoot ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
20
|
-
const paths = cachePaths(projectRoot);
|
|
21
|
-
if (!existsSync(paths.outlineFinal)) {
|
|
22
|
-
process.stderr.write(`Missing outline at ${paths.outlineFinal}. Run \`dotrequirements cts plan-loop\` first.\n`);
|
|
23
|
-
process.exitCode = ExitCode.MissingInput;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const outline = readFinalOutline(projectRoot);
|
|
27
|
-
progress.emit({
|
|
28
|
-
stage: "compose",
|
|
29
|
-
step: "start",
|
|
30
|
-
message: `Composing spec from ${outline.areas.length} area partials`,
|
|
31
|
-
});
|
|
32
|
-
const result = runCompose({
|
|
33
|
-
outline,
|
|
34
|
-
partialPathFor: (sanitized) => paths.partial(sanitized),
|
|
35
|
-
composedPath: paths.composedSpec,
|
|
36
|
-
});
|
|
37
|
-
progress.emit({
|
|
38
|
-
stage: "compose",
|
|
39
|
-
step: "done",
|
|
40
|
-
message: `Composed spec → ${result.composedPath} (${result.partialsIncluded} partials included, ${result.partialsMissing} missing)`,
|
|
41
|
-
data: {
|
|
42
|
-
partialsIncluded: result.partialsIncluded,
|
|
43
|
-
partialsMissing: result.partialsMissing,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
if (result.validationError) {
|
|
47
|
-
process.stderr.write(`Composed spec failed validation:\n${result.validationError}\n`);
|
|
48
|
-
process.exitCode = ExitCode.StageFailed;
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
progress.emit({
|
|
52
|
-
stage: "compose",
|
|
53
|
-
step: "validation-ok",
|
|
54
|
-
message: "Composed spec passed schema validation",
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=compose.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec edit-loop` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs the spec review + editor loop over the composed spec.
|
|
5
|
-
*
|
|
6
|
-
* Requirements covered:
|
|
7
|
-
* - CTS-CLI-2: granular `edit-loop` subcommand
|
|
8
|
-
* - CTS-EDIT-1..6: end-to-end loop behavior
|
|
9
|
-
*/
|
|
10
|
-
export interface EditLoopCmdOptions {
|
|
11
|
-
maxTurns?: number;
|
|
12
|
-
model?: string;
|
|
13
|
-
projectRoot?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function editLoopCommand(rawOptions?: EditLoopCmdOptions): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=edit-loop.d.ts.map
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec edit-loop` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs the spec review + editor loop over the composed spec.
|
|
5
|
-
*
|
|
6
|
-
* Requirements covered:
|
|
7
|
-
* - CTS-CLI-2: granular `edit-loop` subcommand
|
|
8
|
-
* - CTS-EDIT-1..6: end-to-end loop behavior
|
|
9
|
-
*/
|
|
10
|
-
import { copyFileSync, existsSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { cachePaths } from "../../codebase-to-spec/cache.js";
|
|
12
|
-
import { DEFAULT_EDIT_LOOP_MAX_TURNS, runEditLoop, } from "../../codebase-to-spec/edit-loop.js";
|
|
13
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
14
|
-
import { StdoutProgress } from "../../codebase-to-spec/progress.js";
|
|
15
|
-
import { findProjectRoot } from "../../utils/project-settings.js";
|
|
16
|
-
export async function editLoopCommand(rawOptions = {}) {
|
|
17
|
-
const progress = new StdoutProgress();
|
|
18
|
-
const projectRoot = rawOptions.projectRoot ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
19
|
-
const paths = cachePaths(projectRoot);
|
|
20
|
-
const maxTurns = rawOptions.maxTurns ?? DEFAULT_EDIT_LOOP_MAX_TURNS;
|
|
21
|
-
if (!existsSync(paths.composedSpec)) {
|
|
22
|
-
process.stderr.write(`Missing composed spec at ${paths.composedSpec}. Run \`dotrequirements cts compose\` first.\n`);
|
|
23
|
-
process.exitCode = ExitCode.MissingInput;
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (!existsSync(paths.source)) {
|
|
27
|
-
process.stderr.write(`Missing uncompressed pack at ${paths.source}. Run \`dotrequirements cts pack\` first.\n`);
|
|
28
|
-
process.exitCode = ExitCode.MissingInput;
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
progress.emit({
|
|
32
|
-
stage: "spec-review",
|
|
33
|
-
step: "start",
|
|
34
|
-
message: `Starting spec review + edit loop (max-turns=${maxTurns})`,
|
|
35
|
-
});
|
|
36
|
-
let result;
|
|
37
|
-
try {
|
|
38
|
-
result = await runEditLoop({
|
|
39
|
-
composedSpecPath: paths.composedSpec,
|
|
40
|
-
specVersionFor: (turn) => paths.specVersion(turn),
|
|
41
|
-
fullPackPath: paths.source,
|
|
42
|
-
addDirs: [paths.root],
|
|
43
|
-
maxTurns,
|
|
44
|
-
model: rawOptions.model,
|
|
45
|
-
progress,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
process.stderr.write(`\nEdit loop failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
50
|
-
process.exitCode = ExitCode.StageFailed;
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Persist per-turn reviewer output (JSON).
|
|
54
|
-
result.reviewsByTurn.forEach((review, idx) => {
|
|
55
|
-
writeFileSync(paths.specReviewTurn(idx + 1), `${JSON.stringify(review, null, 2)}\n`, "utf-8");
|
|
56
|
-
});
|
|
57
|
-
if (result.hitMaxTurns) {
|
|
58
|
-
progress.emit({
|
|
59
|
-
stage: "spec-review",
|
|
60
|
-
step: "max-turns-hit",
|
|
61
|
-
message: `Loop hit max-turns (${maxTurns}) without converging. Using latest spec anyway.`,
|
|
62
|
-
data: { turnsUsed: result.turnsUsed, finalVerdict: result.finalVerdict },
|
|
63
|
-
});
|
|
64
|
-
process.exitCode = ExitCode.MaxTurnsHit;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
progress.emit({
|
|
68
|
-
stage: "spec-review",
|
|
69
|
-
step: "done",
|
|
70
|
-
message: `Edit loop converged at turn ${result.turnsUsed} with verdict: ${result.finalVerdict}`,
|
|
71
|
-
data: { turnsUsed: result.turnsUsed, finalVerdict: result.finalVerdict },
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
// Copy the final post-edit spec to a stable path so downstream stages
|
|
75
|
-
// (present) and external tooling have a predictable location.
|
|
76
|
-
copyFileSync(result.finalSpecPath, paths.specFinal);
|
|
77
|
-
progress.emit({
|
|
78
|
-
stage: "spec-review",
|
|
79
|
-
step: "final-spec",
|
|
80
|
-
message: `Final spec → ${paths.specFinal}`,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=edit-loop.js.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec fan-out` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs the specifier for every area in the cached outline, in parallel up to
|
|
5
|
-
* a bounded concurrency limit, with retry-once on failure.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered:
|
|
8
|
-
* - CTS-CLI-2: granular `fan-out` subcommand
|
|
9
|
-
* - CTS-SPEC-1.2: bounded concurrent execution
|
|
10
|
-
* - CTS-SPEC-5: failure detection + retry + non-blocking continuation
|
|
11
|
-
*/
|
|
12
|
-
export interface FanOutCmdOptions {
|
|
13
|
-
concurrency?: number;
|
|
14
|
-
model?: string;
|
|
15
|
-
cliBinary?: string;
|
|
16
|
-
projectRoot?: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function fanOutCommand(options?: FanOutCmdOptions): Promise<void>;
|
|
19
|
-
//# sourceMappingURL=fan-out.d.ts.map
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec fan-out` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs the specifier for every area in the cached outline, in parallel up to
|
|
5
|
-
* a bounded concurrency limit, with retry-once on failure.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered:
|
|
8
|
-
* - CTS-CLI-2: granular `fan-out` subcommand
|
|
9
|
-
* - CTS-SPEC-1.2: bounded concurrent execution
|
|
10
|
-
* - CTS-SPEC-5: failure detection + retry + non-blocking continuation
|
|
11
|
-
*/
|
|
12
|
-
import { existsSync } from "node:fs";
|
|
13
|
-
import { cachePaths } from "../../codebase-to-spec/cache.js";
|
|
14
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
15
|
-
import { DEFAULT_FAN_OUT_CONCURRENCY, runFanOut, } from "../../codebase-to-spec/fan-out.js";
|
|
16
|
-
import { StdoutProgress } from "../../codebase-to-spec/progress.js";
|
|
17
|
-
import { findProjectRoot } from "../../utils/project-settings.js";
|
|
18
|
-
import { readFinalOutline } from "./plan-loop.js";
|
|
19
|
-
export async function fanOutCommand(options = {}) {
|
|
20
|
-
const progress = new StdoutProgress();
|
|
21
|
-
const projectRoot = options.projectRoot ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
22
|
-
const paths = cachePaths(projectRoot);
|
|
23
|
-
const cliBinary = options.cliBinary ?? "dotrequirements";
|
|
24
|
-
if (!existsSync(paths.outlineFinal)) {
|
|
25
|
-
process.stderr.write(`Missing outline at ${paths.outlineFinal}. Run \`dotrequirements cts plan-loop\` first.\n`);
|
|
26
|
-
process.exitCode = ExitCode.MissingInput;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (!existsSync(paths.source)) {
|
|
30
|
-
process.stderr.write(`Missing uncompressed pack at ${paths.source}. Run \`dotrequirements cts pack\` first.\n`);
|
|
31
|
-
process.exitCode = ExitCode.MissingInput;
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const outline = readFinalOutline(projectRoot);
|
|
35
|
-
const concurrency = options.concurrency ?? DEFAULT_FAN_OUT_CONCURRENCY;
|
|
36
|
-
progress.emit({
|
|
37
|
-
stage: "specify",
|
|
38
|
-
step: "start",
|
|
39
|
-
message: `Fan-out: ${outline.areas.length} areas (concurrency=${concurrency})`,
|
|
40
|
-
});
|
|
41
|
-
const result = await runFanOut({
|
|
42
|
-
outline,
|
|
43
|
-
fullPackPath: paths.source,
|
|
44
|
-
partialPathFor: (sanitized) => paths.partial(sanitized),
|
|
45
|
-
slicePathFor: (sanitized) => `${paths.partialsDir}/slice-${sanitized}.txt`,
|
|
46
|
-
validateCommand: `${cliBinary} cts validate`,
|
|
47
|
-
styleCheckCommand: `${cliBinary} cts style-check`,
|
|
48
|
-
addDirs: [paths.root],
|
|
49
|
-
concurrency,
|
|
50
|
-
model: options.model,
|
|
51
|
-
progress,
|
|
52
|
-
});
|
|
53
|
-
// Summary
|
|
54
|
-
const failed = result.outcomes.filter((o) => o.status === "failed");
|
|
55
|
-
const completed = result.outcomes.filter((o) => o.status === "completed");
|
|
56
|
-
const skipped = result.outcomes.filter((o) => o.status === "skipped-resume");
|
|
57
|
-
progress.emit({
|
|
58
|
-
stage: "specify",
|
|
59
|
-
step: "summary",
|
|
60
|
-
message: `Completed: ${completed.length} / Skipped (resume): ${skipped.length} / Failed: ${failed.length}`,
|
|
61
|
-
data: {
|
|
62
|
-
completed: completed.length,
|
|
63
|
-
skipped: skipped.length,
|
|
64
|
-
failed: failed.length,
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
if (failed.length > 0) {
|
|
68
|
-
for (const o of failed) {
|
|
69
|
-
process.stderr.write(` failed: ${o.area.name} (${o.area.prefix}) — ${o.failureCause ?? "unknown"}\n`);
|
|
70
|
-
}
|
|
71
|
-
// Per CTS-SPEC-5, a failed specifier does not block the rest of the
|
|
72
|
-
// pipeline; we still let the caller decide. Surface non-zero so wrappers
|
|
73
|
-
// can react if they care.
|
|
74
|
-
process.exitCode = ExitCode.StageFailed;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
//# sourceMappingURL=fan-out.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec plan-loop` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Reads the compressed pack from the cache and runs the outline review loop
|
|
5
|
-
* (planner → reviewer → revise → ... → approved). Writes per-turn artifacts
|
|
6
|
-
* and the final outline.
|
|
7
|
-
*
|
|
8
|
-
* Requirements covered:
|
|
9
|
-
* - CTS-CLI-2: `dotrequirements cts plan-loop` runs only the outline review loop and exits
|
|
10
|
-
* - CTS-PLAN-1..6: end-to-end loop behavior
|
|
11
|
-
* - CTS-RESUME-1.1: skip loop if outline-final.json exists
|
|
12
|
-
* - CTS-OBSERVE-1, CTS-OBSERVE-2: progress + failure observability
|
|
13
|
-
*/
|
|
14
|
-
import type { Outline } from "../../codebase-to-spec/schemas.js";
|
|
15
|
-
export interface PlanLoopOptions {
|
|
16
|
-
maxTurns?: number;
|
|
17
|
-
model?: string;
|
|
18
|
-
progress?: import("../../codebase-to-spec/progress.js").ProgressEmitter;
|
|
19
|
-
projectRoot?: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function planLoopCommand(rawOptions?: PlanLoopOptions): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Helper used by `cts run` and tests to consume the outline that plan-loop wrote.
|
|
24
|
-
*/
|
|
25
|
-
export declare function readFinalOutline(projectRoot: string): Outline;
|
|
26
|
-
//# sourceMappingURL=plan-loop.d.ts.map
|