@popoverai/dotrequirements 0.26.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/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.js +7 -2
- 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/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.js +8 -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/templates/skills/codebase-to-spec/SKILL.md +10 -4
- package/package.json +1 -1
- 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,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec present` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Writes the final spec to `.requirements/` and emits a pipeline summary.
|
|
5
|
-
*
|
|
6
|
-
* Requirements covered:
|
|
7
|
-
* - CTS-CLI-2: granular `present` subcommand
|
|
8
|
-
* - CTS-CLI-4: TTY-driven interactive/non-interactive selection
|
|
9
|
-
* - CTS-PRESENT-1..4
|
|
10
|
-
*/
|
|
11
|
-
import { existsSync, writeFileSync } from "node:fs";
|
|
12
|
-
import { cachePaths } from "../../codebase-to-spec/cache.js";
|
|
13
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
14
|
-
import { detectMode } from "../../codebase-to-spec/interactive.js";
|
|
15
|
-
import { runPresent, } from "../../codebase-to-spec/present.js";
|
|
16
|
-
import { StdoutProgress } from "../../codebase-to-spec/progress.js";
|
|
17
|
-
import { buildPipelineSummary, renderSummaryText, } from "../../codebase-to-spec/summary.js";
|
|
18
|
-
import { findProjectRoot } from "../../utils/project-settings.js";
|
|
19
|
-
import { readFinalOutline } from "./plan-loop.js";
|
|
20
|
-
function resolveOverwritePolicy(isInteractive, options) {
|
|
21
|
-
if (options.overwrite && options.skipExisting) {
|
|
22
|
-
return { error: "--overwrite and --skip-existing are mutually exclusive." };
|
|
23
|
-
}
|
|
24
|
-
if (options.overwrite)
|
|
25
|
-
return "overwrite";
|
|
26
|
-
if (options.skipExisting)
|
|
27
|
-
return "skip-existing";
|
|
28
|
-
if (isInteractive)
|
|
29
|
-
return "prompt";
|
|
30
|
-
return "fail-fast";
|
|
31
|
-
}
|
|
32
|
-
export async function presentCommand(rawOptions = {}) {
|
|
33
|
-
const progress = new StdoutProgress();
|
|
34
|
-
const projectRoot = rawOptions.projectRoot ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
35
|
-
const paths = cachePaths(projectRoot);
|
|
36
|
-
if (!existsSync(paths.outlineFinal)) {
|
|
37
|
-
process.stderr.write(`Missing outline at ${paths.outlineFinal}. Run \`dotrequirements cts plan-loop\` first.\n`);
|
|
38
|
-
process.exitCode = ExitCode.MissingInput;
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (!existsSync(paths.specFinal)) {
|
|
42
|
-
process.stderr.write(`Missing final spec at ${paths.specFinal}. Run \`dotrequirements cts edit-loop\` first.\n`);
|
|
43
|
-
process.exitCode = ExitCode.MissingInput;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const outline = readFinalOutline(projectRoot);
|
|
47
|
-
const { isInteractive } = detectMode(rawOptions.forceMode);
|
|
48
|
-
const policy = resolveOverwritePolicy(isInteractive, rawOptions);
|
|
49
|
-
if (typeof policy === "object") {
|
|
50
|
-
process.stderr.write(`${policy.error}\n`);
|
|
51
|
-
process.exitCode = ExitCode.InvalidFlags;
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const outputSubdir = rawOptions.ignoreRequirements ? "cts" : undefined;
|
|
55
|
-
const outputDirLabel = outputSubdir
|
|
56
|
-
? `.requirements/${outputSubdir}/`
|
|
57
|
-
: ".requirements/";
|
|
58
|
-
progress.emit({
|
|
59
|
-
stage: "present",
|
|
60
|
-
step: "start",
|
|
61
|
-
message: `Writing final spec to ${outputDirLabel} (mode: ${isInteractive ? "interactive" : "non-interactive"}, policy: ${policy})`,
|
|
62
|
-
});
|
|
63
|
-
const result = await runPresent({
|
|
64
|
-
outline,
|
|
65
|
-
finalSpecPath: paths.specFinal,
|
|
66
|
-
projectRoot,
|
|
67
|
-
overwritePolicy: policy,
|
|
68
|
-
outputSubdir,
|
|
69
|
-
});
|
|
70
|
-
// Per-file outcome announcements.
|
|
71
|
-
for (const action of result.actions) {
|
|
72
|
-
progress.emit({
|
|
73
|
-
stage: "present",
|
|
74
|
-
step: action.action,
|
|
75
|
-
message: `${action.action}: ${action.path}`,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
if (!result.allWritten) {
|
|
79
|
-
if (result.conflictPath) {
|
|
80
|
-
// fail-fast bailed before any write.
|
|
81
|
-
process.stderr.write(`Refusing to overwrite ${result.conflictPath}. Re-run with --overwrite or --skip-existing, or run in interactive mode.\n`);
|
|
82
|
-
process.exitCode = ExitCode.OverwriteRefused;
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
// Other partial failures (validation, merge conflict, etc.).
|
|
86
|
-
process.exitCode = ExitCode.StageFailed;
|
|
87
|
-
}
|
|
88
|
-
// Emit the pipeline summary.
|
|
89
|
-
const summary = buildPipelineSummary({
|
|
90
|
-
outline,
|
|
91
|
-
paths,
|
|
92
|
-
outputPaths: result.outputPaths,
|
|
93
|
-
});
|
|
94
|
-
writeFileSync(paths.pipelineSummary, `${JSON.stringify(summary, null, 2)}\n`, "utf-8");
|
|
95
|
-
process.stdout.write(`\n${renderSummaryText(summary)}\n`);
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=present.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec run` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Chains the pipeline stages. Currently: pack → plan-loop. Subsequent
|
|
5
|
-
* increments will chain specify → compose → edit → present.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered (incrementally):
|
|
8
|
-
* - CTS-CLI-1: User can run the pipeline end-to-end with a single command
|
|
9
|
-
*/
|
|
10
|
-
import { type PackOptions } from "./pack.js";
|
|
11
|
-
export interface RunOptions extends PackOptions {
|
|
12
|
-
maxTurns?: number;
|
|
13
|
-
model?: string;
|
|
14
|
-
concurrency?: number;
|
|
15
|
-
forceMode?: "interactive" | "non-interactive";
|
|
16
|
-
overwrite?: boolean;
|
|
17
|
-
skipExisting?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare function runCommand(options?: RunOptions): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec run` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Chains the pipeline stages. Currently: pack → plan-loop. Subsequent
|
|
5
|
-
* increments will chain specify → compose → edit → present.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered (incrementally):
|
|
8
|
-
* - CTS-CLI-1: User can run the pipeline end-to-end with a single command
|
|
9
|
-
*/
|
|
10
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
11
|
-
import { composeCommand } from "./compose.js";
|
|
12
|
-
import { editLoopCommand } from "./edit-loop.js";
|
|
13
|
-
import { fanOutCommand } from "./fan-out.js";
|
|
14
|
-
import { packCommand } from "./pack.js";
|
|
15
|
-
import { planLoopCommand } from "./plan-loop.js";
|
|
16
|
-
import { presentCommand } from "./present.js";
|
|
17
|
-
export async function runCommand(options = {}) {
|
|
18
|
-
// Stage 1 — Pack
|
|
19
|
-
await packCommand(options);
|
|
20
|
-
if (process.exitCode && process.exitCode !== 0) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
// Stage 2 — Plan + outline review loop
|
|
24
|
-
await planLoopCommand({
|
|
25
|
-
maxTurns: options.maxTurns,
|
|
26
|
-
model: options.model,
|
|
27
|
-
progress: options.progress,
|
|
28
|
-
projectRoot: options.projectRoot,
|
|
29
|
-
});
|
|
30
|
-
if (process.exitCode &&
|
|
31
|
-
process.exitCode !== 0 &&
|
|
32
|
-
process.exitCode !== ExitCode.MaxTurnsHit) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
// Reset exit code from MaxTurnsHit so downstream stages can still proceed
|
|
36
|
-
// (we use the latest outline anyway per CTS-PLAN-6).
|
|
37
|
-
if (process.exitCode === ExitCode.MaxTurnsHit) {
|
|
38
|
-
process.exitCode = 0;
|
|
39
|
-
}
|
|
40
|
-
// Stage 3 — Specifier fan-out
|
|
41
|
-
await fanOutCommand({
|
|
42
|
-
concurrency: options.concurrency,
|
|
43
|
-
model: options.model,
|
|
44
|
-
projectRoot: options.projectRoot,
|
|
45
|
-
});
|
|
46
|
-
if (process.exitCode &&
|
|
47
|
-
process.exitCode !== 0 &&
|
|
48
|
-
process.exitCode !== ExitCode.StageFailed) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
// StageFailed from fan-out means some specifiers failed; per CTS-SPEC-5 the
|
|
52
|
-
// pipeline continues. Other areas still produced partials.
|
|
53
|
-
if (process.exitCode === ExitCode.StageFailed) {
|
|
54
|
-
process.exitCode = 0;
|
|
55
|
-
}
|
|
56
|
-
// Stage 4 — Compose
|
|
57
|
-
await composeCommand({ projectRoot: options.projectRoot });
|
|
58
|
-
if (process.exitCode && process.exitCode !== 0) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
// Stage 5 — Spec review + edit loop
|
|
62
|
-
await editLoopCommand({
|
|
63
|
-
maxTurns: options.maxTurns,
|
|
64
|
-
model: options.model,
|
|
65
|
-
projectRoot: options.projectRoot,
|
|
66
|
-
});
|
|
67
|
-
if (process.exitCode &&
|
|
68
|
-
process.exitCode !== 0 &&
|
|
69
|
-
process.exitCode !== ExitCode.MaxTurnsHit) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (process.exitCode === ExitCode.MaxTurnsHit) {
|
|
73
|
-
process.exitCode = 0;
|
|
74
|
-
}
|
|
75
|
-
// Stage 6 — Present (write final spec to .requirements/ + emit summary)
|
|
76
|
-
await presentCommand({
|
|
77
|
-
forceMode: options.forceMode,
|
|
78
|
-
overwrite: options.overwrite,
|
|
79
|
-
skipExisting: options.skipExisting,
|
|
80
|
-
ignoreRequirements: options.ignoreRequirements,
|
|
81
|
-
projectRoot: options.projectRoot,
|
|
82
|
-
});
|
|
83
|
-
// Present sets a non-zero exit code on overwrite refusal or validation
|
|
84
|
-
// failure; let it propagate.
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=run.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec specify-area <name>` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs a single specifier for one named area from the cached outline. Useful
|
|
5
|
-
* for retrying a single failed area, or for scripting.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered:
|
|
8
|
-
* - CTS-CLI-2: granular `specify-area` subcommand
|
|
9
|
-
* - CTS-SPEC-1..4: per-area specifier behavior
|
|
10
|
-
*/
|
|
11
|
-
export interface SpecifyAreaOptions {
|
|
12
|
-
model?: string;
|
|
13
|
-
/** Path to the CLI binary (defaults to `dotrequirements`). */
|
|
14
|
-
cliBinary?: string;
|
|
15
|
-
projectRoot?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function specifyAreaCommand(areaName: string, options?: SpecifyAreaOptions): Promise<void>;
|
|
18
|
-
//# sourceMappingURL=specify-area.d.ts.map
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `dotrequirements codebase-to-spec specify-area <name>` subcommand.
|
|
3
|
-
*
|
|
4
|
-
* Runs a single specifier for one named area from the cached outline. Useful
|
|
5
|
-
* for retrying a single failed area, or for scripting.
|
|
6
|
-
*
|
|
7
|
-
* Requirements covered:
|
|
8
|
-
* - CTS-CLI-2: granular `specify-area` subcommand
|
|
9
|
-
* - CTS-SPEC-1..4: per-area specifier behavior
|
|
10
|
-
*/
|
|
11
|
-
import { existsSync } from "node:fs";
|
|
12
|
-
import { cachePaths } from "../../codebase-to-spec/cache.js";
|
|
13
|
-
import { ExitCode } from "../../codebase-to-spec/exit-codes.js";
|
|
14
|
-
import { sanitizeAreaName } from "../../codebase-to-spec/fan-out.js";
|
|
15
|
-
import { StdoutProgress } from "../../codebase-to-spec/progress.js";
|
|
16
|
-
import { extractSlice } from "../../codebase-to-spec/slice.js";
|
|
17
|
-
import { runSpecifier } from "../../codebase-to-spec/specifier.js";
|
|
18
|
-
import { findProjectRoot } from "../../utils/project-settings.js";
|
|
19
|
-
import { readFinalOutline } from "./plan-loop.js";
|
|
20
|
-
export async function specifyAreaCommand(areaName, options = {}) {
|
|
21
|
-
const progress = new StdoutProgress();
|
|
22
|
-
const projectRoot = options.projectRoot ?? findProjectRoot(process.cwd()) ?? process.cwd();
|
|
23
|
-
const paths = cachePaths(projectRoot);
|
|
24
|
-
const cliBinary = options.cliBinary ?? "dotrequirements";
|
|
25
|
-
if (!existsSync(paths.outlineFinal)) {
|
|
26
|
-
process.stderr.write(`Missing outline at ${paths.outlineFinal}. Run \`dotrequirements cts plan-loop\` first.\n`);
|
|
27
|
-
process.exitCode = ExitCode.MissingInput;
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
if (!existsSync(paths.source)) {
|
|
31
|
-
process.stderr.write(`Missing uncompressed pack at ${paths.source}. Run \`dotrequirements cts pack\` first.\n`);
|
|
32
|
-
process.exitCode = ExitCode.MissingInput;
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const outline = readFinalOutline(projectRoot);
|
|
36
|
-
const area = outline.areas.find((a) => a.name === areaName ||
|
|
37
|
-
a.prefix === areaName ||
|
|
38
|
-
sanitizeAreaName(a.name) === sanitizeAreaName(areaName));
|
|
39
|
-
if (!area) {
|
|
40
|
-
process.stderr.write(`No area named "${areaName}" in outline. Available areas:\n${outline.areas
|
|
41
|
-
.map((a) => ` - ${a.name} (prefix: ${a.prefix})`)
|
|
42
|
-
.join("\n")}\n`);
|
|
43
|
-
process.exitCode = ExitCode.MissingInput;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const sanitized = sanitizeAreaName(area.name);
|
|
47
|
-
const slicePath = `${paths.partialsDir}/slice-${sanitized}.txt`;
|
|
48
|
-
const partialPath = paths.partial(sanitized);
|
|
49
|
-
progress.emit({
|
|
50
|
-
stage: "specify",
|
|
51
|
-
step: area.prefix,
|
|
52
|
-
message: `Extracting slice for ${area.name}`,
|
|
53
|
-
});
|
|
54
|
-
extractSlice(paths.source, slicePath, area.files);
|
|
55
|
-
progress.emit({
|
|
56
|
-
stage: "specify",
|
|
57
|
-
step: area.prefix,
|
|
58
|
-
message: `Running specifier for ${area.name}`,
|
|
59
|
-
});
|
|
60
|
-
const result = await runSpecifier({
|
|
61
|
-
outline,
|
|
62
|
-
area,
|
|
63
|
-
slicePath,
|
|
64
|
-
fullPackPath: paths.source,
|
|
65
|
-
partialPath,
|
|
66
|
-
validateCommand: `${cliBinary} cts validate`,
|
|
67
|
-
styleCheckCommand: `${cliBinary} cts style-check`,
|
|
68
|
-
addDirs: [paths.root],
|
|
69
|
-
model: options.model,
|
|
70
|
-
});
|
|
71
|
-
if (!result.wrotePartial) {
|
|
72
|
-
process.stderr.write(`Specifier for ${area.name} produced no partial (exit ${result.exitCode}).\n${result.stderr}\n`);
|
|
73
|
-
process.exitCode = ExitCode.StageFailed;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
progress.emit({
|
|
77
|
-
stage: "specify",
|
|
78
|
-
step: area.prefix,
|
|
79
|
-
message: `Done. Partial saved to ${partialPath} (${result.partialBytes} bytes)`,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=specify-area.js.map
|