@delfini/cli 0.1.0-rc.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.
- package/README.md +110 -0
- package/bin/delfini.mjs +23 -0
- package/dist/__engine-probe__.cjs +4495 -0
- package/dist/__engine-probe__.js +10 -0
- package/dist/chunk-MUW24ZC4.js +6933 -0
- package/dist/chunk-UGNHP6L5.js +1277 -0
- package/dist/cli.cjs +8104 -0
- package/dist/cli.d.cts +19 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +7 -0
- package/dist/index.cjs +8199 -0
- package/dist/index.d.cts +201 -0
- package/dist/index.d.ts +201 -0
- package/dist/index.js +56 -0
- package/dist/prompt.md +360 -0
- package/package.json +43 -0
- package/templates/SKILL.md +222 -0
- package/templates/claude-md-append-block.txt +27 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export { main } from './cli.cjs';
|
|
2
|
+
|
|
3
|
+
declare const DOC_SCOPE_RELATIVE_PATH = ".claude/skills/delfini/doc-scope.json";
|
|
4
|
+
declare const DOC_SCOPE_VERSION: 1;
|
|
5
|
+
interface DocScope {
|
|
6
|
+
version: 1;
|
|
7
|
+
doc_scope: string[];
|
|
8
|
+
}
|
|
9
|
+
interface DocScopeWriteOptions {
|
|
10
|
+
repoRoot?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DocScopeExpansionResult {
|
|
13
|
+
/** Absolute paths to files matched by the scope entries. Sorted, deduped. */
|
|
14
|
+
files: string[];
|
|
15
|
+
/** Original entries from `paths` that resolved to nothing on disk. */
|
|
16
|
+
missingPaths: string[];
|
|
17
|
+
}
|
|
18
|
+
declare class DocScopeVersionMismatchError extends Error {
|
|
19
|
+
readonly code: "DOC_SCOPE_VERSION_MISMATCH";
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
declare class DocScopeCorruptError extends Error {
|
|
23
|
+
readonly code: "DOC_SCOPE_CORRUPT";
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
declare class DocScopeValidationError extends Error {
|
|
27
|
+
readonly code: "DOC_SCOPE_VALIDATION";
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
declare function readDocScope(repoRoot?: string): Promise<DocScope | null>;
|
|
31
|
+
declare function writeDocScope(paths: string[], options?: DocScopeWriteOptions): Promise<void>;
|
|
32
|
+
declare function docScopeExists(repoRoot?: string): Promise<boolean>;
|
|
33
|
+
declare function deleteDocScope(repoRoot?: string): Promise<void>;
|
|
34
|
+
declare function expandDocScope(paths: string[], repoRoot?: string): Promise<DocScopeExpansionResult>;
|
|
35
|
+
|
|
36
|
+
declare class RepoRootNotFoundError extends Error {
|
|
37
|
+
readonly code: "REPO_ROOT_NOT_FOUND";
|
|
38
|
+
constructor(cause?: unknown);
|
|
39
|
+
}
|
|
40
|
+
declare function getRepoRoot(cwd?: string): Promise<string>;
|
|
41
|
+
|
|
42
|
+
declare function ensureTraceDir(repoRoot: string): string;
|
|
43
|
+
declare function appendToGitignore(repoRoot: string): {
|
|
44
|
+
changed: boolean;
|
|
45
|
+
};
|
|
46
|
+
declare function writeTraceFile(repoRoot: string, filename: string, content: string): string;
|
|
47
|
+
declare function writeRetryAttemptFile(repoRoot: string, attemptNumber: 1 | 2, content: string): string;
|
|
48
|
+
|
|
49
|
+
interface InstallLogger {
|
|
50
|
+
log?: (...args: unknown[]) => void;
|
|
51
|
+
}
|
|
52
|
+
interface RunInstallOptions {
|
|
53
|
+
/** Coding agent target. V1 accepts only 'CLAUDE' (design-spec NG2). */
|
|
54
|
+
tool?: string;
|
|
55
|
+
/** Logger for INFO messages. Defaults to `console`. */
|
|
56
|
+
logger?: InstallLogger;
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the auto-invoke opt-in. When provided, `runInstall` uses it
|
|
59
|
+
* directly (true → append the CLAUDE.md block; false → strip an existing
|
|
60
|
+
* block) and never prompts — this is the `--auto-invoke` / `--no-auto-invoke`
|
|
61
|
+
* CLI-flag path and the test seam. When omitted, `runInstall` prompts
|
|
62
|
+
* interactively on a TTY, or skips the CLAUDE.md mutation entirely on a
|
|
63
|
+
* non-TTY stdin (never blocks, never forces opt-in without consent).
|
|
64
|
+
*/
|
|
65
|
+
confirmAutoInvoke?: () => Promise<boolean>;
|
|
66
|
+
}
|
|
67
|
+
declare class InstallToolNotSupportedError extends Error {
|
|
68
|
+
readonly code: "INSTALL_TOOL_NOT_SUPPORTED";
|
|
69
|
+
constructor(tool: string);
|
|
70
|
+
}
|
|
71
|
+
declare function runInstall(targetPath: string, options?: RunInstallOptions): Promise<void>;
|
|
72
|
+
|
|
73
|
+
/** The diff sources selectable via `--diff-source` (FR141a). */
|
|
74
|
+
type DiffSource = 'local' | 'committed' | 'both';
|
|
75
|
+
declare const PROMPT_TOKEN_BUDGET = 150000;
|
|
76
|
+
interface RunLocalPrepareOptions {
|
|
77
|
+
/**
|
|
78
|
+
* The `--scope <paths>` value. Accepts a comma-separated string OR a string[].
|
|
79
|
+
* When provided, overrides the persisted `.claude/skills/delfini/doc-scope.json`
|
|
80
|
+
* WITHOUT modifying that file (FR144 per-run override invariant).
|
|
81
|
+
*/
|
|
82
|
+
scope?: string | string[];
|
|
83
|
+
/**
|
|
84
|
+
* The `--base <ref>` value. When provided, used as the diff base directly.
|
|
85
|
+
* When omitted, defaults to `git merge-base HEAD origin/main`.
|
|
86
|
+
*/
|
|
87
|
+
base?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Override the repo root used for all operations. Test seam — production
|
|
90
|
+
* callers omit this and let `getRepoRoot()` resolve via
|
|
91
|
+
* `git rev-parse --show-toplevel`.
|
|
92
|
+
*/
|
|
93
|
+
repoRoot?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Override the prompt-token budget. Test seam — production callers omit
|
|
96
|
+
* this and the module-level `PROMPT_TOKEN_BUDGET` constant applies.
|
|
97
|
+
*/
|
|
98
|
+
promptTokenBudget?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Stream sink for the warning + guidance output. Test seam — production
|
|
101
|
+
* callers omit this and `process.stderr` is used.
|
|
102
|
+
*/
|
|
103
|
+
stderr?: NodeJS.WritableStream;
|
|
104
|
+
/**
|
|
105
|
+
* Stream sink for the `prompt_too_large` JSON payload. Test seam.
|
|
106
|
+
*/
|
|
107
|
+
stdout?: NodeJS.WritableStream;
|
|
108
|
+
/**
|
|
109
|
+
* Opt-in doc-relevance gate. When set to a positive integer, docs whose
|
|
110
|
+
* relevance score (file-path overlap + identifier overlap + heading
|
|
111
|
+
* overlap + doc-path-in-diff) is below this threshold are dropped from
|
|
112
|
+
* the prompt before rendering. Default behaviour (undefined or 0) is
|
|
113
|
+
* observably no-op.
|
|
114
|
+
*
|
|
115
|
+
* Exposed via the `--relevance-threshold <N>` flag on `local-prepare`.
|
|
116
|
+
* Recommended starting value: 5 — covers Tier 1 (doc itself in diff) and
|
|
117
|
+
* single Tier 2 (one file path overlap).
|
|
118
|
+
*/
|
|
119
|
+
relevanceThreshold?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Opt-in deterministic diff pre-filter (Story P3.7.2 / FR151). When `true`,
|
|
122
|
+
* drops lockfile / generated / vendored / fixture paths plus pure
|
|
123
|
+
* whitespace-only and import-only hunks BEFORE prompt assembly. Default
|
|
124
|
+
* (`false` / undefined) is observably no-op — `analysis-input.json` is
|
|
125
|
+
* byte-identical and `buildPrompt` output is unchanged (NFR49(b) parity).
|
|
126
|
+
*
|
|
127
|
+
* When the gate runs the assembled `analysis-input.json` gains an additive
|
|
128
|
+
* `_filterResult: { droppedPaths, droppedHunks }` top-level sibling so the
|
|
129
|
+
* host agent and the maintainer can see what was dropped. Subagent
|
|
130
|
+
* consumers read only `diff`/`docs`/`prMetadata` and ignore `_filterResult`.
|
|
131
|
+
*
|
|
132
|
+
* Exposed via the `--enable-diff-prefilter` boolean flag on `local-prepare`.
|
|
133
|
+
*/
|
|
134
|
+
enableDiffPreFilter?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Which diff to analyse (FR141a). Default `local`:
|
|
137
|
+
* - `local` — working tree vs `HEAD` (`git diff HEAD`) + untracked files
|
|
138
|
+
* - `committed` — `HEAD` vs `--base` (the feature branch's committed delta)
|
|
139
|
+
* - `both` — working tree vs `--base` (what an opened PR contains) + untracked
|
|
140
|
+
*
|
|
141
|
+
* On the default branch `both`/`committed` collapse to `local` by
|
|
142
|
+
* construction (base ≈ HEAD → empty committed range) — no special-casing.
|
|
143
|
+
* Exposed via the `--diff-source <local|committed|both>` flag.
|
|
144
|
+
*/
|
|
145
|
+
diffSource?: DiffSource;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns an exit code (0 = success, 2 = no doc-scope, 4 = prompt-too-large).
|
|
149
|
+
* Does NOT call `process.exit` — the cli.ts router (Story P3.2.4) is the
|
|
150
|
+
* single owner of `process.exit`.
|
|
151
|
+
*/
|
|
152
|
+
declare function runLocalPrepare(options?: RunLocalPrepareOptions): Promise<number>;
|
|
153
|
+
|
|
154
|
+
interface RunDiffStatusOptions {
|
|
155
|
+
/**
|
|
156
|
+
* The `--base <ref>` value. When omitted, defaults to
|
|
157
|
+
* `git merge-base HEAD origin/main` (with a fallback to `HEAD` on a
|
|
158
|
+
* remote-less sandbox — see `resolveBaseRef`).
|
|
159
|
+
*/
|
|
160
|
+
base?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Override the repo root. Test seam — production callers omit this and let
|
|
163
|
+
* `getRepoRoot()` resolve via `git rev-parse --show-toplevel`.
|
|
164
|
+
*/
|
|
165
|
+
repoRoot?: string;
|
|
166
|
+
/** Stream sink for the JSON output. Test seam — defaults to process.stdout. */
|
|
167
|
+
stdout?: NodeJS.WritableStream;
|
|
168
|
+
/** Stream sink for errors + base-ref fallback warnings. Test seam. */
|
|
169
|
+
stderr?: NodeJS.WritableStream;
|
|
170
|
+
}
|
|
171
|
+
interface DiffStatus {
|
|
172
|
+
branch: string;
|
|
173
|
+
isDefaultBranch: boolean;
|
|
174
|
+
hasLocalChanges: boolean;
|
|
175
|
+
hasCommittedChanges: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns an exit code: `0` on success, non-zero on git failure (outside a
|
|
179
|
+
* git repo, or any other git error). On the error path it writes a message to
|
|
180
|
+
* stderr and emits NO JSON on stdout — consumers parse stdout only on exit 0.
|
|
181
|
+
*/
|
|
182
|
+
declare function runDiffStatus(options?: RunDiffStatusOptions): Promise<number>;
|
|
183
|
+
|
|
184
|
+
interface RunLocalFinalizeOptions {
|
|
185
|
+
/** Positional argument — path to findings.json. Relative paths resolve against repoRoot. */
|
|
186
|
+
findingsPath: string;
|
|
187
|
+
/** Override the repo root. Test seam — production callers omit and let `getRepoRoot()` resolve via `git rev-parse --show-toplevel`. */
|
|
188
|
+
repoRoot?: string;
|
|
189
|
+
/** Stream sink for the rendered report. Test seam — production uses process.stdout. */
|
|
190
|
+
stdout?: NodeJS.WritableStream;
|
|
191
|
+
/** Stream sink for the schema_validation JSON payload. Test seam — production uses process.stderr. */
|
|
192
|
+
stderr?: NodeJS.WritableStream;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns an exit code (0 / 1 / 3 per AC3). Does NOT call `process.exit` —
|
|
196
|
+
* the cli.ts router is the single owner of `process.exit` (matches the
|
|
197
|
+
* pattern from `runLocalPrepare`).
|
|
198
|
+
*/
|
|
199
|
+
declare function runLocalFinalize(options: RunLocalFinalizeOptions): Promise<number>;
|
|
200
|
+
|
|
201
|
+
export { DOC_SCOPE_RELATIVE_PATH, DOC_SCOPE_VERSION, type DiffSource, type DiffStatus, type DocScope, DocScopeCorruptError, type DocScopeExpansionResult, DocScopeValidationError, DocScopeVersionMismatchError, type DocScopeWriteOptions, type InstallLogger, InstallToolNotSupportedError, PROMPT_TOKEN_BUDGET, RepoRootNotFoundError, type RunDiffStatusOptions, type RunInstallOptions, type RunLocalFinalizeOptions, type RunLocalPrepareOptions, appendToGitignore, deleteDocScope, docScopeExists, ensureTraceDir, expandDocScope, getRepoRoot, readDocScope, runDiffStatus, runInstall, runLocalFinalize, runLocalPrepare, writeDocScope, writeRetryAttemptFile, writeTraceFile };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export { main } from './cli.js';
|
|
2
|
+
|
|
3
|
+
declare const DOC_SCOPE_RELATIVE_PATH = ".claude/skills/delfini/doc-scope.json";
|
|
4
|
+
declare const DOC_SCOPE_VERSION: 1;
|
|
5
|
+
interface DocScope {
|
|
6
|
+
version: 1;
|
|
7
|
+
doc_scope: string[];
|
|
8
|
+
}
|
|
9
|
+
interface DocScopeWriteOptions {
|
|
10
|
+
repoRoot?: string;
|
|
11
|
+
}
|
|
12
|
+
interface DocScopeExpansionResult {
|
|
13
|
+
/** Absolute paths to files matched by the scope entries. Sorted, deduped. */
|
|
14
|
+
files: string[];
|
|
15
|
+
/** Original entries from `paths` that resolved to nothing on disk. */
|
|
16
|
+
missingPaths: string[];
|
|
17
|
+
}
|
|
18
|
+
declare class DocScopeVersionMismatchError extends Error {
|
|
19
|
+
readonly code: "DOC_SCOPE_VERSION_MISMATCH";
|
|
20
|
+
constructor(message?: string);
|
|
21
|
+
}
|
|
22
|
+
declare class DocScopeCorruptError extends Error {
|
|
23
|
+
readonly code: "DOC_SCOPE_CORRUPT";
|
|
24
|
+
constructor(message: string);
|
|
25
|
+
}
|
|
26
|
+
declare class DocScopeValidationError extends Error {
|
|
27
|
+
readonly code: "DOC_SCOPE_VALIDATION";
|
|
28
|
+
constructor(message: string);
|
|
29
|
+
}
|
|
30
|
+
declare function readDocScope(repoRoot?: string): Promise<DocScope | null>;
|
|
31
|
+
declare function writeDocScope(paths: string[], options?: DocScopeWriteOptions): Promise<void>;
|
|
32
|
+
declare function docScopeExists(repoRoot?: string): Promise<boolean>;
|
|
33
|
+
declare function deleteDocScope(repoRoot?: string): Promise<void>;
|
|
34
|
+
declare function expandDocScope(paths: string[], repoRoot?: string): Promise<DocScopeExpansionResult>;
|
|
35
|
+
|
|
36
|
+
declare class RepoRootNotFoundError extends Error {
|
|
37
|
+
readonly code: "REPO_ROOT_NOT_FOUND";
|
|
38
|
+
constructor(cause?: unknown);
|
|
39
|
+
}
|
|
40
|
+
declare function getRepoRoot(cwd?: string): Promise<string>;
|
|
41
|
+
|
|
42
|
+
declare function ensureTraceDir(repoRoot: string): string;
|
|
43
|
+
declare function appendToGitignore(repoRoot: string): {
|
|
44
|
+
changed: boolean;
|
|
45
|
+
};
|
|
46
|
+
declare function writeTraceFile(repoRoot: string, filename: string, content: string): string;
|
|
47
|
+
declare function writeRetryAttemptFile(repoRoot: string, attemptNumber: 1 | 2, content: string): string;
|
|
48
|
+
|
|
49
|
+
interface InstallLogger {
|
|
50
|
+
log?: (...args: unknown[]) => void;
|
|
51
|
+
}
|
|
52
|
+
interface RunInstallOptions {
|
|
53
|
+
/** Coding agent target. V1 accepts only 'CLAUDE' (design-spec NG2). */
|
|
54
|
+
tool?: string;
|
|
55
|
+
/** Logger for INFO messages. Defaults to `console`. */
|
|
56
|
+
logger?: InstallLogger;
|
|
57
|
+
/**
|
|
58
|
+
* Resolves the auto-invoke opt-in. When provided, `runInstall` uses it
|
|
59
|
+
* directly (true → append the CLAUDE.md block; false → strip an existing
|
|
60
|
+
* block) and never prompts — this is the `--auto-invoke` / `--no-auto-invoke`
|
|
61
|
+
* CLI-flag path and the test seam. When omitted, `runInstall` prompts
|
|
62
|
+
* interactively on a TTY, or skips the CLAUDE.md mutation entirely on a
|
|
63
|
+
* non-TTY stdin (never blocks, never forces opt-in without consent).
|
|
64
|
+
*/
|
|
65
|
+
confirmAutoInvoke?: () => Promise<boolean>;
|
|
66
|
+
}
|
|
67
|
+
declare class InstallToolNotSupportedError extends Error {
|
|
68
|
+
readonly code: "INSTALL_TOOL_NOT_SUPPORTED";
|
|
69
|
+
constructor(tool: string);
|
|
70
|
+
}
|
|
71
|
+
declare function runInstall(targetPath: string, options?: RunInstallOptions): Promise<void>;
|
|
72
|
+
|
|
73
|
+
/** The diff sources selectable via `--diff-source` (FR141a). */
|
|
74
|
+
type DiffSource = 'local' | 'committed' | 'both';
|
|
75
|
+
declare const PROMPT_TOKEN_BUDGET = 150000;
|
|
76
|
+
interface RunLocalPrepareOptions {
|
|
77
|
+
/**
|
|
78
|
+
* The `--scope <paths>` value. Accepts a comma-separated string OR a string[].
|
|
79
|
+
* When provided, overrides the persisted `.claude/skills/delfini/doc-scope.json`
|
|
80
|
+
* WITHOUT modifying that file (FR144 per-run override invariant).
|
|
81
|
+
*/
|
|
82
|
+
scope?: string | string[];
|
|
83
|
+
/**
|
|
84
|
+
* The `--base <ref>` value. When provided, used as the diff base directly.
|
|
85
|
+
* When omitted, defaults to `git merge-base HEAD origin/main`.
|
|
86
|
+
*/
|
|
87
|
+
base?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Override the repo root used for all operations. Test seam — production
|
|
90
|
+
* callers omit this and let `getRepoRoot()` resolve via
|
|
91
|
+
* `git rev-parse --show-toplevel`.
|
|
92
|
+
*/
|
|
93
|
+
repoRoot?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Override the prompt-token budget. Test seam — production callers omit
|
|
96
|
+
* this and the module-level `PROMPT_TOKEN_BUDGET` constant applies.
|
|
97
|
+
*/
|
|
98
|
+
promptTokenBudget?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Stream sink for the warning + guidance output. Test seam — production
|
|
101
|
+
* callers omit this and `process.stderr` is used.
|
|
102
|
+
*/
|
|
103
|
+
stderr?: NodeJS.WritableStream;
|
|
104
|
+
/**
|
|
105
|
+
* Stream sink for the `prompt_too_large` JSON payload. Test seam.
|
|
106
|
+
*/
|
|
107
|
+
stdout?: NodeJS.WritableStream;
|
|
108
|
+
/**
|
|
109
|
+
* Opt-in doc-relevance gate. When set to a positive integer, docs whose
|
|
110
|
+
* relevance score (file-path overlap + identifier overlap + heading
|
|
111
|
+
* overlap + doc-path-in-diff) is below this threshold are dropped from
|
|
112
|
+
* the prompt before rendering. Default behaviour (undefined or 0) is
|
|
113
|
+
* observably no-op.
|
|
114
|
+
*
|
|
115
|
+
* Exposed via the `--relevance-threshold <N>` flag on `local-prepare`.
|
|
116
|
+
* Recommended starting value: 5 — covers Tier 1 (doc itself in diff) and
|
|
117
|
+
* single Tier 2 (one file path overlap).
|
|
118
|
+
*/
|
|
119
|
+
relevanceThreshold?: number;
|
|
120
|
+
/**
|
|
121
|
+
* Opt-in deterministic diff pre-filter (Story P3.7.2 / FR151). When `true`,
|
|
122
|
+
* drops lockfile / generated / vendored / fixture paths plus pure
|
|
123
|
+
* whitespace-only and import-only hunks BEFORE prompt assembly. Default
|
|
124
|
+
* (`false` / undefined) is observably no-op — `analysis-input.json` is
|
|
125
|
+
* byte-identical and `buildPrompt` output is unchanged (NFR49(b) parity).
|
|
126
|
+
*
|
|
127
|
+
* When the gate runs the assembled `analysis-input.json` gains an additive
|
|
128
|
+
* `_filterResult: { droppedPaths, droppedHunks }` top-level sibling so the
|
|
129
|
+
* host agent and the maintainer can see what was dropped. Subagent
|
|
130
|
+
* consumers read only `diff`/`docs`/`prMetadata` and ignore `_filterResult`.
|
|
131
|
+
*
|
|
132
|
+
* Exposed via the `--enable-diff-prefilter` boolean flag on `local-prepare`.
|
|
133
|
+
*/
|
|
134
|
+
enableDiffPreFilter?: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Which diff to analyse (FR141a). Default `local`:
|
|
137
|
+
* - `local` — working tree vs `HEAD` (`git diff HEAD`) + untracked files
|
|
138
|
+
* - `committed` — `HEAD` vs `--base` (the feature branch's committed delta)
|
|
139
|
+
* - `both` — working tree vs `--base` (what an opened PR contains) + untracked
|
|
140
|
+
*
|
|
141
|
+
* On the default branch `both`/`committed` collapse to `local` by
|
|
142
|
+
* construction (base ≈ HEAD → empty committed range) — no special-casing.
|
|
143
|
+
* Exposed via the `--diff-source <local|committed|both>` flag.
|
|
144
|
+
*/
|
|
145
|
+
diffSource?: DiffSource;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Returns an exit code (0 = success, 2 = no doc-scope, 4 = prompt-too-large).
|
|
149
|
+
* Does NOT call `process.exit` — the cli.ts router (Story P3.2.4) is the
|
|
150
|
+
* single owner of `process.exit`.
|
|
151
|
+
*/
|
|
152
|
+
declare function runLocalPrepare(options?: RunLocalPrepareOptions): Promise<number>;
|
|
153
|
+
|
|
154
|
+
interface RunDiffStatusOptions {
|
|
155
|
+
/**
|
|
156
|
+
* The `--base <ref>` value. When omitted, defaults to
|
|
157
|
+
* `git merge-base HEAD origin/main` (with a fallback to `HEAD` on a
|
|
158
|
+
* remote-less sandbox — see `resolveBaseRef`).
|
|
159
|
+
*/
|
|
160
|
+
base?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Override the repo root. Test seam — production callers omit this and let
|
|
163
|
+
* `getRepoRoot()` resolve via `git rev-parse --show-toplevel`.
|
|
164
|
+
*/
|
|
165
|
+
repoRoot?: string;
|
|
166
|
+
/** Stream sink for the JSON output. Test seam — defaults to process.stdout. */
|
|
167
|
+
stdout?: NodeJS.WritableStream;
|
|
168
|
+
/** Stream sink for errors + base-ref fallback warnings. Test seam. */
|
|
169
|
+
stderr?: NodeJS.WritableStream;
|
|
170
|
+
}
|
|
171
|
+
interface DiffStatus {
|
|
172
|
+
branch: string;
|
|
173
|
+
isDefaultBranch: boolean;
|
|
174
|
+
hasLocalChanges: boolean;
|
|
175
|
+
hasCommittedChanges: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Returns an exit code: `0` on success, non-zero on git failure (outside a
|
|
179
|
+
* git repo, or any other git error). On the error path it writes a message to
|
|
180
|
+
* stderr and emits NO JSON on stdout — consumers parse stdout only on exit 0.
|
|
181
|
+
*/
|
|
182
|
+
declare function runDiffStatus(options?: RunDiffStatusOptions): Promise<number>;
|
|
183
|
+
|
|
184
|
+
interface RunLocalFinalizeOptions {
|
|
185
|
+
/** Positional argument — path to findings.json. Relative paths resolve against repoRoot. */
|
|
186
|
+
findingsPath: string;
|
|
187
|
+
/** Override the repo root. Test seam — production callers omit and let `getRepoRoot()` resolve via `git rev-parse --show-toplevel`. */
|
|
188
|
+
repoRoot?: string;
|
|
189
|
+
/** Stream sink for the rendered report. Test seam — production uses process.stdout. */
|
|
190
|
+
stdout?: NodeJS.WritableStream;
|
|
191
|
+
/** Stream sink for the schema_validation JSON payload. Test seam — production uses process.stderr. */
|
|
192
|
+
stderr?: NodeJS.WritableStream;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Returns an exit code (0 / 1 / 3 per AC3). Does NOT call `process.exit` —
|
|
196
|
+
* the cli.ts router is the single owner of `process.exit` (matches the
|
|
197
|
+
* pattern from `runLocalPrepare`).
|
|
198
|
+
*/
|
|
199
|
+
declare function runLocalFinalize(options: RunLocalFinalizeOptions): Promise<number>;
|
|
200
|
+
|
|
201
|
+
export { DOC_SCOPE_RELATIVE_PATH, DOC_SCOPE_VERSION, type DiffSource, type DiffStatus, type DocScope, DocScopeCorruptError, type DocScopeExpansionResult, DocScopeValidationError, DocScopeVersionMismatchError, type DocScopeWriteOptions, type InstallLogger, InstallToolNotSupportedError, PROMPT_TOKEN_BUDGET, RepoRootNotFoundError, type RunDiffStatusOptions, type RunInstallOptions, type RunLocalFinalizeOptions, type RunLocalPrepareOptions, appendToGitignore, deleteDocScope, docScopeExists, ensureTraceDir, expandDocScope, getRepoRoot, readDocScope, runDiffStatus, runInstall, runLocalFinalize, runLocalPrepare, writeDocScope, writeRetryAttemptFile, writeTraceFile };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DOC_SCOPE_RELATIVE_PATH,
|
|
3
|
+
DOC_SCOPE_VERSION,
|
|
4
|
+
DocScopeCorruptError,
|
|
5
|
+
DocScopeValidationError,
|
|
6
|
+
DocScopeVersionMismatchError,
|
|
7
|
+
InstallToolNotSupportedError,
|
|
8
|
+
PROMPT_TOKEN_BUDGET,
|
|
9
|
+
RepoRootNotFoundError,
|
|
10
|
+
appendToGitignore,
|
|
11
|
+
deleteDocScope,
|
|
12
|
+
docScopeExists,
|
|
13
|
+
ensureTraceDir,
|
|
14
|
+
expandDocScope,
|
|
15
|
+
getRepoRoot,
|
|
16
|
+
main,
|
|
17
|
+
readDocScope,
|
|
18
|
+
runDiffStatus,
|
|
19
|
+
runInstall,
|
|
20
|
+
runLocalFinalize,
|
|
21
|
+
runLocalPrepare,
|
|
22
|
+
writeDocScope,
|
|
23
|
+
writeRetryAttemptFile,
|
|
24
|
+
writeTraceFile
|
|
25
|
+
} from "./chunk-UGNHP6L5.js";
|
|
26
|
+
import {
|
|
27
|
+
init_esm_shims
|
|
28
|
+
} from "./chunk-MUW24ZC4.js";
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
init_esm_shims();
|
|
32
|
+
export {
|
|
33
|
+
DOC_SCOPE_RELATIVE_PATH,
|
|
34
|
+
DOC_SCOPE_VERSION,
|
|
35
|
+
DocScopeCorruptError,
|
|
36
|
+
DocScopeValidationError,
|
|
37
|
+
DocScopeVersionMismatchError,
|
|
38
|
+
InstallToolNotSupportedError,
|
|
39
|
+
PROMPT_TOKEN_BUDGET,
|
|
40
|
+
RepoRootNotFoundError,
|
|
41
|
+
appendToGitignore,
|
|
42
|
+
deleteDocScope,
|
|
43
|
+
docScopeExists,
|
|
44
|
+
ensureTraceDir,
|
|
45
|
+
expandDocScope,
|
|
46
|
+
getRepoRoot,
|
|
47
|
+
main,
|
|
48
|
+
readDocScope,
|
|
49
|
+
runDiffStatus,
|
|
50
|
+
runInstall,
|
|
51
|
+
runLocalFinalize,
|
|
52
|
+
runLocalPrepare,
|
|
53
|
+
writeDocScope,
|
|
54
|
+
writeRetryAttemptFile,
|
|
55
|
+
writeTraceFile
|
|
56
|
+
};
|