codebase-snapshot 0.12.1 → 0.12.2
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/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/bin.js +101 -32
- package/dist/{chunk-H4FSGTEW.js → chunk-74ZAF64D.js} +84 -31
- package/dist/{chunk-BXWV2OXE.js → chunk-BITMWXYS.js} +18 -2
- package/dist/cli.cjs +101 -32
- package/dist/cli.js +3 -3
- package/dist/index.cjs +84 -31
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +68 -3
- package/dist/mcp.js +2 -2
- package/docs/cli.md +3 -3
- package/docs/configuration.md +5 -0
- package/docs/mcp.md +5 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,33 @@ deprecated with an explanatory message instead. `latest` has pointed at 0.9.0 si
|
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
|
+
## 0.12.2
|
|
30
|
+
|
|
31
|
+
Six defects in the brief, five of them found by attacking it rather than reading it.
|
|
32
|
+
|
|
33
|
+
- **A fenced sample heading was parsed as a section.** A brief that documents the format —
|
|
34
|
+
```` ```markdown ```` then `## Coverage` — was refused for redefining a measured section it never
|
|
35
|
+
defined. Fences are tracked now: content inside one is content, whatever it looks like.
|
|
36
|
+
- **Control characters in reproduced text reached the artifact.** A `NUL` (or a bidi override) in the
|
|
37
|
+
owner brief, a commit body or the README paragraph was written into `PROMPT.md` verbatim. Every
|
|
38
|
+
reproduced string is escaped the same way the rest of the tool escapes them.
|
|
39
|
+
- **`## Stakes:` fell into Owner notes.** A trailing colon is a typo, not a different heading, so the
|
|
40
|
+
canonical form drops trailing punctuation and the stakes render in their section.
|
|
41
|
+
- **The brief had no size limit.** A 240 kB brief produced a 240 kB `PROMPT.md`, which is a second
|
|
42
|
+
codebase rather than instruction. It is capped at 64 KiB, and the error names the size.
|
|
43
|
+
- **`config.brief.path` was recorded unmasked.** Every other user-supplied name in the manifest is
|
|
44
|
+
masked; a credential-shaped directory in the brief path was echoed into `manifest.json` and the
|
|
45
|
+
provenance line of `PROMPT.md`. It goes through the same masking now.
|
|
46
|
+
- **The shape guard ignored the fields added in 0.11 and 0.12.** A manifest with `promptTask: 5`, a
|
|
47
|
+
string `brief`, a negative `attachmentSlots` or `maxParts: 0` was accepted: `report` echoed it and
|
|
48
|
+
`validate` read it as unset. Each is refused by name now.
|
|
49
|
+
|
|
50
|
+
New: `snapshot://prompt` over MCP, so a client can read the brief before it attaches parts instead of
|
|
51
|
+
running the CLI to see it.
|
|
52
|
+
|
|
53
|
+
Everything else is unchanged. `0.12.2` is the same line: no `0.13`, no `1.0.0`.
|
|
54
|
+
|
|
55
|
+
Verified: 1 178 tests, 1 170 pass, 0 fail, 8 host skips; lint 225 files; every gate clean at 0.12.2.
|
|
29
56
|
## 0.12.1
|
|
30
57
|
|
|
31
58
|
Three defects in the facts 0.12.0 printed about a project, found by reading the artifact as the
|
package/README.md
CHANGED
|
@@ -210,7 +210,7 @@ Everything an agent needs is available as data, and the tool can install its own
|
|
|
210
210
|
```bash
|
|
211
211
|
npx codebase-snapshot describe --format json # contract: workflow, options, exit codes
|
|
212
212
|
npx codebase-snapshot skill --install # into .claude/skills + .cursor/rules
|
|
213
|
-
npx -y codebase-snapshot@0.12.
|
|
213
|
+
npx -y codebase-snapshot@0.12.2 mcp # or serve it over MCP
|
|
214
214
|
```
|
|
215
215
|
|
|
216
216
|
An agent told only "use `npx codebase-snapshot`" can read the contract, follow its ordered
|
package/dist/bin.js
CHANGED
|
@@ -2191,7 +2191,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2191
2191
|
|
|
2192
2192
|
// src/version.ts
|
|
2193
2193
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2194
|
-
var GENERATOR_VERSION = "0.12.
|
|
2194
|
+
var GENERATOR_VERSION = "0.12.2";
|
|
2195
2195
|
var SCHEMA_VERSION = "3.0.0";
|
|
2196
2196
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2197
2197
|
function isOurGeneratorName(name) {
|
|
@@ -3315,7 +3315,23 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3315
3315
|
const preamble = [];
|
|
3316
3316
|
const sections = [];
|
|
3317
3317
|
let current = null;
|
|
3318
|
+
let fence = null;
|
|
3318
3319
|
for (const line of source.split(/\r?\n/)) {
|
|
3320
|
+
const fenceLine = /^ {0,3}(`{3,}|~{3,})/.exec(line);
|
|
3321
|
+
if (fenceLine) {
|
|
3322
|
+
const marker2 = fenceLine[1];
|
|
3323
|
+
const char = marker2[0];
|
|
3324
|
+
if (fence === null) fence = { char, length: marker2.length };
|
|
3325
|
+
else if (char === fence.char && marker2.length >= fence.length) fence = null;
|
|
3326
|
+
if (current) current.body.push(line);
|
|
3327
|
+
else preamble.push(line);
|
|
3328
|
+
continue;
|
|
3329
|
+
}
|
|
3330
|
+
if (fence !== null) {
|
|
3331
|
+
if (current) current.body.push(line);
|
|
3332
|
+
else preamble.push(line);
|
|
3333
|
+
continue;
|
|
3334
|
+
}
|
|
3319
3335
|
const heading = /^##\s+(.+?)\s*$/.exec(line);
|
|
3320
3336
|
if (heading) {
|
|
3321
3337
|
current = { heading: heading[1], body: [] };
|
|
@@ -3327,7 +3343,7 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3327
3343
|
}
|
|
3328
3344
|
const recognised = {};
|
|
3329
3345
|
const notes = [];
|
|
3330
|
-
const canonical = (heading) => heading.trim().toLowerCase().replace(/\s+/g, " ");
|
|
3346
|
+
const canonical = (heading) => heading.trim().replace(/[:.]+$/, "").trim().toLowerCase().replace(/\s+/g, " ");
|
|
3331
3347
|
const canonicalOwner = new Map(OWNER_SECTIONS.map((name) => [canonical(name), name]));
|
|
3332
3348
|
const canonicalReserved = new Set(RESERVED_SECTIONS.map(canonical));
|
|
3333
3349
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3871,6 +3887,7 @@ function resolvePromptTask(value) {
|
|
|
3871
3887
|
'promptTask must be one of "audit", "review" or "explain" (received ' + describeValue2(value) + ")."
|
|
3872
3888
|
);
|
|
3873
3889
|
}
|
|
3890
|
+
var MAX_BRIEF_BYTES = 64 * 1024;
|
|
3874
3891
|
function readConfiguredBrief(cwd, value) {
|
|
3875
3892
|
if (value === void 0 || value === null) return void 0;
|
|
3876
3893
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -3888,6 +3905,12 @@ function readConfiguredBrief(cwd, value) {
|
|
|
3888
3905
|
'brief "' + value + '" could not be read as a file; a snapshot must not ship without the half of the brief the owner wrote.'
|
|
3889
3906
|
);
|
|
3890
3907
|
}
|
|
3908
|
+
const bytes = Buffer.byteLength(text2, "utf8");
|
|
3909
|
+
if (bytes > MAX_BRIEF_BYTES) {
|
|
3910
|
+
throw new Error(
|
|
3911
|
+
'brief "' + value + '" is ' + bytes + " bytes; the limit is " + MAX_BRIEF_BYTES + ". Keep it to what a reader can act on, or move the detail into a document the snapshot carries."
|
|
3912
|
+
);
|
|
3913
|
+
}
|
|
3891
3914
|
const parsed = parseOwnerBrief(value, text2);
|
|
3892
3915
|
if (parsed.problems.length > 0) {
|
|
3893
3916
|
throw new Error(
|
|
@@ -6285,6 +6308,32 @@ function describeManifestShapeProblem(value) {
|
|
|
6285
6308
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
6286
6309
|
return 'missing "config" object';
|
|
6287
6310
|
}
|
|
6311
|
+
const recordedConfig = config;
|
|
6312
|
+
const promptTask = recordedConfig.promptTask;
|
|
6313
|
+
if (promptTask !== void 0 && promptTask !== "audit" && promptTask !== "review" && promptTask !== "explain") {
|
|
6314
|
+
return '`config.promptTask` must be "audit", "review" or "explain"';
|
|
6315
|
+
}
|
|
6316
|
+
const recordedBrief = recordedConfig.brief;
|
|
6317
|
+
if (recordedBrief !== void 0) {
|
|
6318
|
+
if (!recordedBrief || typeof recordedBrief !== "object" || Array.isArray(recordedBrief)) {
|
|
6319
|
+
return "`config.brief` must be an object";
|
|
6320
|
+
}
|
|
6321
|
+
const briefRecord = recordedBrief;
|
|
6322
|
+
if (typeof briefRecord.path !== "string" || briefRecord.path.length === 0) {
|
|
6323
|
+
return "`config.brief.path` must be a non-empty string";
|
|
6324
|
+
}
|
|
6325
|
+
if (typeof briefRecord.digest !== "string" || !/^[0-9a-f]{64}$/.test(briefRecord.digest)) {
|
|
6326
|
+
return "`config.brief.digest` must be a sha256 hex digest";
|
|
6327
|
+
}
|
|
6328
|
+
}
|
|
6329
|
+
const recordedSlots = recordedConfig.attachmentSlots;
|
|
6330
|
+
if (recordedSlots !== void 0 && (typeof recordedSlots !== "number" || !Number.isSafeInteger(recordedSlots) || recordedSlots < 0)) {
|
|
6331
|
+
return "`config.attachmentSlots` must be a non-negative integer";
|
|
6332
|
+
}
|
|
6333
|
+
const recordedMaxParts = recordedConfig.maxParts;
|
|
6334
|
+
if (recordedMaxParts !== void 0 && recordedMaxParts !== null && (typeof recordedMaxParts !== "number" || !Number.isSafeInteger(recordedMaxParts) || recordedMaxParts < 1)) {
|
|
6335
|
+
return "`config.maxParts` must be a positive integer or null";
|
|
6336
|
+
}
|
|
6288
6337
|
const budgets = candidate.budgets;
|
|
6289
6338
|
if (!budgets || typeof budgets !== "object" || Array.isArray(budgets)) {
|
|
6290
6339
|
return 'missing "budgets" object';
|
|
@@ -9937,6 +9986,7 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9937
9986
|
const brief = context.brief;
|
|
9938
9987
|
const wrote = (name) => artifacts?.[name] !== false;
|
|
9939
9988
|
const code = (value) => inlineCode(escapeControls(value));
|
|
9989
|
+
const text2 = (value) => escapeControls(value);
|
|
9940
9990
|
const hasOwnerHistory = (brief?.history ?? "").trim().length > 0;
|
|
9941
9991
|
const lines = [
|
|
9942
9992
|
"# PROMPT.md",
|
|
@@ -9955,18 +10005,18 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9955
10005
|
"the snapshot is what exists.",
|
|
9956
10006
|
""
|
|
9957
10007
|
];
|
|
9958
|
-
if (brief?.preamble !== void 0) lines.push(brief.preamble, "");
|
|
10008
|
+
if (brief?.preamble !== void 0) lines.push(text2(brief.preamble), "");
|
|
9959
10009
|
lines.push(...jobSection(task, history.length > 0 || hasOwnerHistory), "");
|
|
9960
|
-
lines.push(...stakesSection(brief, code));
|
|
10010
|
+
lines.push(...stakesSection(brief, code, text2));
|
|
9961
10011
|
lines.push(...haveSection(wrote), "");
|
|
9962
|
-
lines.push(...whatThisIsSection(overview), "");
|
|
9963
|
-
lines.push(...systemSection(manifest, code, brief), "");
|
|
9964
|
-
lines.push(...historySection(history, brief, code), "");
|
|
9965
|
-
lines.push(...barSection(brief, code), "");
|
|
10012
|
+
lines.push(...whatThisIsSection(overview, text2), "");
|
|
10013
|
+
lines.push(...systemSection(manifest, code, brief, text2), "");
|
|
10014
|
+
lines.push(...historySection(history, brief, code, text2), "");
|
|
10015
|
+
lines.push(...barSection(brief, code, text2), "");
|
|
9966
10016
|
lines.push(...coverageSection(manifest, code, wrote("audit")), "");
|
|
9967
10017
|
lines.push(...answerSection(), "");
|
|
9968
|
-
lines.push(...calibrationSection(brief, code), "");
|
|
9969
|
-
lines.push(...ownerNotesSection(brief, code));
|
|
10018
|
+
lines.push(...calibrationSection(brief, code, text2), "");
|
|
10019
|
+
lines.push(...ownerNotesSection(brief, code, text2));
|
|
9970
10020
|
lines.push(...snapshotSection(manifest, code), "");
|
|
9971
10021
|
lines.push(...deliverySection(manifest, wrote("parts"), slots));
|
|
9972
10022
|
lines.push(
|
|
@@ -10045,10 +10095,10 @@ function haveSection(wrote) {
|
|
|
10045
10095
|
out.push(...bullets);
|
|
10046
10096
|
return out;
|
|
10047
10097
|
}
|
|
10048
|
-
function systemSection(manifest, code, brief) {
|
|
10098
|
+
function systemSection(manifest, code, brief, escape) {
|
|
10049
10099
|
const out = ["## The system", ""];
|
|
10050
10100
|
if (brief?.system !== void 0) {
|
|
10051
|
-
out.push(...ownerBlock(brief.system, brief.path, code), "", "What the index records:", "");
|
|
10101
|
+
out.push(...ownerBlock(brief.system, brief.path, code, escape), "", "What the index records:", "");
|
|
10052
10102
|
}
|
|
10053
10103
|
const layers = Object.entries(manifest.layers).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
10054
10104
|
if (layers.length > 0) {
|
|
@@ -10107,9 +10157,9 @@ function systemSection(manifest, code, brief) {
|
|
|
10107
10157
|
}
|
|
10108
10158
|
return out;
|
|
10109
10159
|
}
|
|
10110
|
-
function historySection(history, brief, code) {
|
|
10160
|
+
function historySection(history, brief, code, escape) {
|
|
10111
10161
|
const out = ["## What came before", ""];
|
|
10112
|
-
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code), "");
|
|
10162
|
+
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code, escape), "");
|
|
10113
10163
|
if (history.length === 0) {
|
|
10114
10164
|
out.push(
|
|
10115
10165
|
"No history was readable: this is not a git checkout, or git could not be run. Nothing about",
|
|
@@ -10124,14 +10174,14 @@ function historySection(history, brief, code) {
|
|
|
10124
10174
|
""
|
|
10125
10175
|
);
|
|
10126
10176
|
for (const commit of history) {
|
|
10127
|
-
out.push("- " + commit.subject);
|
|
10128
|
-
if (commit.body.length > 0) out.push(" " + commit.body);
|
|
10177
|
+
out.push("- " + escape(commit.subject));
|
|
10178
|
+
if (commit.body.length > 0) out.push(" " + escape(commit.body));
|
|
10129
10179
|
}
|
|
10130
10180
|
return out;
|
|
10131
10181
|
}
|
|
10132
|
-
function barSection(brief, code) {
|
|
10182
|
+
function barSection(brief, code, text2) {
|
|
10133
10183
|
if (brief?.bar !== void 0) {
|
|
10134
|
-
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code), ""];
|
|
10184
|
+
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code, text2), ""];
|
|
10135
10185
|
}
|
|
10136
10186
|
return [
|
|
10137
10187
|
"## The bar",
|
|
@@ -10190,9 +10240,9 @@ function answerSection() {
|
|
|
10190
10240
|
" the gap you filled by asking instead of guessing."
|
|
10191
10241
|
];
|
|
10192
10242
|
}
|
|
10193
|
-
function calibrationSection(brief, code) {
|
|
10243
|
+
function calibrationSection(brief, code, text2) {
|
|
10194
10244
|
if (brief?.calibration !== void 0) {
|
|
10195
|
-
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code), ""];
|
|
10245
|
+
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code, text2), ""];
|
|
10196
10246
|
}
|
|
10197
10247
|
return [
|
|
10198
10248
|
"## Calibration",
|
|
@@ -10250,20 +10300,20 @@ function jobSection(task, hasHistory) {
|
|
|
10250
10300
|
}
|
|
10251
10301
|
return out;
|
|
10252
10302
|
}
|
|
10253
|
-
function stakesSection(brief, code) {
|
|
10303
|
+
function stakesSection(brief, code, text2) {
|
|
10254
10304
|
if (brief?.stakes === void 0) return [];
|
|
10255
|
-
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code), ""];
|
|
10305
|
+
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code, text2), ""];
|
|
10256
10306
|
}
|
|
10257
|
-
function whatThisIsSection(overview) {
|
|
10307
|
+
function whatThisIsSection(overview, escape) {
|
|
10258
10308
|
const body = [];
|
|
10259
10309
|
if (overview.description !== void 0) {
|
|
10260
|
-
body.push("- Declared in `package.json`: " + overview.description);
|
|
10310
|
+
body.push("- Declared in `package.json`: " + escape(overview.description));
|
|
10261
10311
|
}
|
|
10262
10312
|
if (overview.summary !== void 0) {
|
|
10263
|
-
body.push("- From the `README.md` first paragraph: " + overview.summary);
|
|
10313
|
+
body.push("- From the `README.md` first paragraph: " + escape(overview.summary));
|
|
10264
10314
|
}
|
|
10265
10315
|
if (overview.releases.length > 0) {
|
|
10266
|
-
body.push("- Most recent releases: " + overview.releases.join("; ") + ".");
|
|
10316
|
+
body.push("- Most recent releases: " + overview.releases.map(escape).join("; ") + ".");
|
|
10267
10317
|
}
|
|
10268
10318
|
if (body.length === 0) return [];
|
|
10269
10319
|
return [
|
|
@@ -10275,16 +10325,16 @@ function whatThisIsSection(overview) {
|
|
|
10275
10325
|
""
|
|
10276
10326
|
];
|
|
10277
10327
|
}
|
|
10278
|
-
function ownerNotesSection(brief, code) {
|
|
10328
|
+
function ownerNotesSection(brief, code, text2) {
|
|
10279
10329
|
if (brief === void 0 || brief.notes.length === 0) return [];
|
|
10280
10330
|
const out = ["## Owner notes", ""];
|
|
10281
10331
|
for (const note of brief.notes) {
|
|
10282
|
-
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code), "");
|
|
10332
|
+
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code, text2), "");
|
|
10283
10333
|
}
|
|
10284
10334
|
return out;
|
|
10285
10335
|
}
|
|
10286
|
-
function ownerBlock(
|
|
10287
|
-
return ["> Written by the project owner in " + code(path23) + ", not generated.", "",
|
|
10336
|
+
function ownerBlock(body, path23, code, escape) {
|
|
10337
|
+
return ["> Written by the project owner in " + code(path23) + ", not generated.", "", escape(body)];
|
|
10288
10338
|
}
|
|
10289
10339
|
function snapshotSection(manifest, code) {
|
|
10290
10340
|
const out = ["## This snapshot", ""];
|
|
@@ -11463,6 +11513,7 @@ function maskOwnerBrief(brief, secretRules) {
|
|
|
11463
11513
|
const mask = (value) => maskPathText(value, secretRules);
|
|
11464
11514
|
return {
|
|
11465
11515
|
...brief,
|
|
11516
|
+
path: mask(brief.path),
|
|
11466
11517
|
...brief.stakes === void 0 ? {} : { stakes: mask(brief.stakes) },
|
|
11467
11518
|
...brief.system === void 0 ? {} : { system: mask(brief.system) },
|
|
11468
11519
|
...brief.history === void 0 ? {} : { history: mask(brief.history) },
|
|
@@ -12736,7 +12787,9 @@ function generateSnapshot(configInput, options) {
|
|
|
12736
12787
|
// configuration drift.
|
|
12737
12788
|
maxParts: config.maxParts ?? null,
|
|
12738
12789
|
promptTask: config.promptTask,
|
|
12739
|
-
|
|
12790
|
+
// The path is user input like every other name in this block: a credential-shaped
|
|
12791
|
+
// directory in it would otherwise be echoed into the manifest and PROMPT.md unmasked.
|
|
12792
|
+
...config.brief === void 0 ? {} : { brief: { path: maskName(config.brief.path), digest: config.brief.digest } },
|
|
12740
12793
|
discovery: config.discovery ?? "auto",
|
|
12741
12794
|
// A changed-files scope decides which files are in the snapshot, so the manifest that
|
|
12742
12795
|
// describes the run has to name it.
|
|
@@ -14925,7 +14978,7 @@ function buildAgentContract() {
|
|
|
14925
14978
|
type: "string",
|
|
14926
14979
|
default: "unset",
|
|
14927
14980
|
appliesTo: optionAppliesTo("brief"),
|
|
14928
|
-
summary: "Path to the owner-written half of PROMPT.md: Stakes, The system, What came before, The bar and Calibration replace or extend the generated prose; any other heading is kept as Owner notes. The measured headings cannot be redefined. A missing file is an error and an edited file is config drift."
|
|
14981
|
+
summary: "Path to the owner-written half of PROMPT.md: Stakes, The system, What came before, The bar and Calibration replace or extend the generated prose; any other heading is kept as Owner notes. The measured headings cannot be redefined; fenced code is content, not headings. The file is capped at 64 KiB. A missing file is an error and an edited file is config drift."
|
|
14929
14982
|
},
|
|
14930
14983
|
{
|
|
14931
14984
|
flag: "--prompt-task",
|
|
@@ -15636,6 +15689,8 @@ function ensureSingleRead(uri, text2, advice) {
|
|
|
15636
15689
|
}
|
|
15637
15690
|
var MANIFEST_ADVICE = "Cutting a JSON document at the limit leaves invalid JSON, so this resource is never truncated. Use the snapshot_locate, snapshot_read and snapshot_status tools instead \u2014 they read the manifest directly \u2014 or read manifest.json from the snapshot directory.";
|
|
15638
15691
|
var PART_ADVICE = "A part cut at the limit is a fragment of a file, not the file. Use snapshot_locate to find the file inside this part that you need, then snapshot_read for a bounded window of it.";
|
|
15692
|
+
var PROMPT_URI = "snapshot://prompt";
|
|
15693
|
+
var PROMPT_ADVICE = "PROMPT.md is written whole and never truncated; regenerate it with snapshot_generate, then read it from the snapshot directory.";
|
|
15639
15694
|
var REPORT_ADVICE = "A report cut at the limit would look complete and would not be. Read it from the snapshot directory instead: the file on disk is complete.";
|
|
15640
15695
|
var PART_URI = /^snapshot:\/\/parts\/(\d+)$/;
|
|
15641
15696
|
var REPORT_URIS = /* @__PURE__ */ new Map([
|
|
@@ -15686,6 +15741,13 @@ function buildResourceProvider() {
|
|
|
15686
15741
|
title: "Agent skill",
|
|
15687
15742
|
description: "Usage guidance for an agent working with this tool.",
|
|
15688
15743
|
mimeType: "text/markdown"
|
|
15744
|
+
},
|
|
15745
|
+
{
|
|
15746
|
+
uri: PROMPT_URI,
|
|
15747
|
+
name: "prompt",
|
|
15748
|
+
title: "Snapshot brief",
|
|
15749
|
+
description: "The brief for this snapshot: the job, what the snapshot contains, what it omits, the history it was built from and the standard the answer is held to. Read this before the parts; it names which part holds which file.",
|
|
15750
|
+
mimeType: "text/markdown"
|
|
15689
15751
|
}
|
|
15690
15752
|
];
|
|
15691
15753
|
for (const [uri, report] of REPORT_URIS) {
|
|
@@ -15750,6 +15812,13 @@ function buildResourceProvider() {
|
|
|
15750
15812
|
}
|
|
15751
15813
|
const workspace = await workspaceFor(context);
|
|
15752
15814
|
if ("error" in workspace) return null;
|
|
15815
|
+
if (uri === PROMPT_URI) {
|
|
15816
|
+
const text2 = readFileIfPresent(
|
|
15817
|
+
path21.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
|
|
15818
|
+
);
|
|
15819
|
+
if (text2 === null) return null;
|
|
15820
|
+
return { uri, mimeType: "text/markdown", text: ensureSingleRead(uri, text2, PROMPT_ADVICE) };
|
|
15821
|
+
}
|
|
15753
15822
|
const report = REPORT_URIS.get(uri);
|
|
15754
15823
|
if (report) {
|
|
15755
15824
|
const text2 = readFileIfPresent(
|
|
@@ -1749,7 +1749,23 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
1749
1749
|
const preamble = [];
|
|
1750
1750
|
const sections = [];
|
|
1751
1751
|
let current = null;
|
|
1752
|
+
let fence = null;
|
|
1752
1753
|
for (const line of source.split(/\r?\n/)) {
|
|
1754
|
+
const fenceLine = /^ {0,3}(`{3,}|~{3,})/.exec(line);
|
|
1755
|
+
if (fenceLine) {
|
|
1756
|
+
const marker2 = fenceLine[1];
|
|
1757
|
+
const char = marker2[0];
|
|
1758
|
+
if (fence === null) fence = { char, length: marker2.length };
|
|
1759
|
+
else if (char === fence.char && marker2.length >= fence.length) fence = null;
|
|
1760
|
+
if (current) current.body.push(line);
|
|
1761
|
+
else preamble.push(line);
|
|
1762
|
+
continue;
|
|
1763
|
+
}
|
|
1764
|
+
if (fence !== null) {
|
|
1765
|
+
if (current) current.body.push(line);
|
|
1766
|
+
else preamble.push(line);
|
|
1767
|
+
continue;
|
|
1768
|
+
}
|
|
1753
1769
|
const heading = /^##\s+(.+?)\s*$/.exec(line);
|
|
1754
1770
|
if (heading) {
|
|
1755
1771
|
current = { heading: heading[1], body: [] };
|
|
@@ -1761,7 +1777,7 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
1761
1777
|
}
|
|
1762
1778
|
const recognised = {};
|
|
1763
1779
|
const notes = [];
|
|
1764
|
-
const canonical = (heading) => heading.trim().toLowerCase().replace(/\s+/g, " ");
|
|
1780
|
+
const canonical = (heading) => heading.trim().replace(/[:.]+$/, "").trim().toLowerCase().replace(/\s+/g, " ");
|
|
1765
1781
|
const canonicalOwner = new Map(OWNER_SECTIONS.map((name) => [canonical(name), name]));
|
|
1766
1782
|
const canonicalReserved = new Set(RESERVED_SECTIONS.map(canonical));
|
|
1767
1783
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3977,7 +3993,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
3977
3993
|
|
|
3978
3994
|
// src/version.ts
|
|
3979
3995
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
3980
|
-
var GENERATOR_VERSION = "0.12.
|
|
3996
|
+
var GENERATOR_VERSION = "0.12.2";
|
|
3981
3997
|
var SCHEMA_VERSION = "3.0.0";
|
|
3982
3998
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
3983
3999
|
function isOurGeneratorName(name) {
|
|
@@ -5406,6 +5422,7 @@ function resolvePromptTask(value) {
|
|
|
5406
5422
|
'promptTask must be one of "audit", "review" or "explain" (received ' + describeValue2(value) + ")."
|
|
5407
5423
|
);
|
|
5408
5424
|
}
|
|
5425
|
+
var MAX_BRIEF_BYTES = 64 * 1024;
|
|
5409
5426
|
function readConfiguredBrief(cwd, value) {
|
|
5410
5427
|
if (value === void 0 || value === null) return void 0;
|
|
5411
5428
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -5423,6 +5440,12 @@ function readConfiguredBrief(cwd, value) {
|
|
|
5423
5440
|
'brief "' + value + '" could not be read as a file; a snapshot must not ship without the half of the brief the owner wrote.'
|
|
5424
5441
|
);
|
|
5425
5442
|
}
|
|
5443
|
+
const bytes = Buffer.byteLength(text2, "utf8");
|
|
5444
|
+
if (bytes > MAX_BRIEF_BYTES) {
|
|
5445
|
+
throw new Error(
|
|
5446
|
+
'brief "' + value + '" is ' + bytes + " bytes; the limit is " + MAX_BRIEF_BYTES + ". Keep it to what a reader can act on, or move the detail into a document the snapshot carries."
|
|
5447
|
+
);
|
|
5448
|
+
}
|
|
5426
5449
|
const parsed = parseOwnerBrief(value, text2);
|
|
5427
5450
|
if (parsed.problems.length > 0) {
|
|
5428
5451
|
throw new Error(
|
|
@@ -6889,6 +6912,7 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
6889
6912
|
const brief = context.brief;
|
|
6890
6913
|
const wrote = (name) => artifacts?.[name] !== false;
|
|
6891
6914
|
const code = (value) => inlineCode(escapeControls(value));
|
|
6915
|
+
const text2 = (value) => escapeControls(value);
|
|
6892
6916
|
const hasOwnerHistory = (brief?.history ?? "").trim().length > 0;
|
|
6893
6917
|
const lines = [
|
|
6894
6918
|
"# PROMPT.md",
|
|
@@ -6907,18 +6931,18 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
6907
6931
|
"the snapshot is what exists.",
|
|
6908
6932
|
""
|
|
6909
6933
|
];
|
|
6910
|
-
if (brief?.preamble !== void 0) lines.push(brief.preamble, "");
|
|
6934
|
+
if (brief?.preamble !== void 0) lines.push(text2(brief.preamble), "");
|
|
6911
6935
|
lines.push(...jobSection(task, history.length > 0 || hasOwnerHistory), "");
|
|
6912
|
-
lines.push(...stakesSection(brief, code));
|
|
6936
|
+
lines.push(...stakesSection(brief, code, text2));
|
|
6913
6937
|
lines.push(...haveSection(wrote), "");
|
|
6914
|
-
lines.push(...whatThisIsSection(overview), "");
|
|
6915
|
-
lines.push(...systemSection(manifest, code, brief), "");
|
|
6916
|
-
lines.push(...historySection(history, brief, code), "");
|
|
6917
|
-
lines.push(...barSection(brief, code), "");
|
|
6938
|
+
lines.push(...whatThisIsSection(overview, text2), "");
|
|
6939
|
+
lines.push(...systemSection(manifest, code, brief, text2), "");
|
|
6940
|
+
lines.push(...historySection(history, brief, code, text2), "");
|
|
6941
|
+
lines.push(...barSection(brief, code, text2), "");
|
|
6918
6942
|
lines.push(...coverageSection(manifest, code, wrote("audit")), "");
|
|
6919
6943
|
lines.push(...answerSection(), "");
|
|
6920
|
-
lines.push(...calibrationSection(brief, code), "");
|
|
6921
|
-
lines.push(...ownerNotesSection(brief, code));
|
|
6944
|
+
lines.push(...calibrationSection(brief, code, text2), "");
|
|
6945
|
+
lines.push(...ownerNotesSection(brief, code, text2));
|
|
6922
6946
|
lines.push(...snapshotSection(manifest, code), "");
|
|
6923
6947
|
lines.push(...deliverySection(manifest, wrote("parts"), slots));
|
|
6924
6948
|
lines.push(
|
|
@@ -6997,10 +7021,10 @@ function haveSection(wrote) {
|
|
|
6997
7021
|
out.push(...bullets);
|
|
6998
7022
|
return out;
|
|
6999
7023
|
}
|
|
7000
|
-
function systemSection(manifest, code, brief) {
|
|
7024
|
+
function systemSection(manifest, code, brief, escape) {
|
|
7001
7025
|
const out = ["## The system", ""];
|
|
7002
7026
|
if (brief?.system !== void 0) {
|
|
7003
|
-
out.push(...ownerBlock(brief.system, brief.path, code), "", "What the index records:", "");
|
|
7027
|
+
out.push(...ownerBlock(brief.system, brief.path, code, escape), "", "What the index records:", "");
|
|
7004
7028
|
}
|
|
7005
7029
|
const layers = Object.entries(manifest.layers).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
7006
7030
|
if (layers.length > 0) {
|
|
@@ -7059,9 +7083,9 @@ function systemSection(manifest, code, brief) {
|
|
|
7059
7083
|
}
|
|
7060
7084
|
return out;
|
|
7061
7085
|
}
|
|
7062
|
-
function historySection(history, brief, code) {
|
|
7086
|
+
function historySection(history, brief, code, escape) {
|
|
7063
7087
|
const out = ["## What came before", ""];
|
|
7064
|
-
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code), "");
|
|
7088
|
+
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code, escape), "");
|
|
7065
7089
|
if (history.length === 0) {
|
|
7066
7090
|
out.push(
|
|
7067
7091
|
"No history was readable: this is not a git checkout, or git could not be run. Nothing about",
|
|
@@ -7076,14 +7100,14 @@ function historySection(history, brief, code) {
|
|
|
7076
7100
|
""
|
|
7077
7101
|
);
|
|
7078
7102
|
for (const commit of history) {
|
|
7079
|
-
out.push("- " + commit.subject);
|
|
7080
|
-
if (commit.body.length > 0) out.push(" " + commit.body);
|
|
7103
|
+
out.push("- " + escape(commit.subject));
|
|
7104
|
+
if (commit.body.length > 0) out.push(" " + escape(commit.body));
|
|
7081
7105
|
}
|
|
7082
7106
|
return out;
|
|
7083
7107
|
}
|
|
7084
|
-
function barSection(brief, code) {
|
|
7108
|
+
function barSection(brief, code, text2) {
|
|
7085
7109
|
if (brief?.bar !== void 0) {
|
|
7086
|
-
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code), ""];
|
|
7110
|
+
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code, text2), ""];
|
|
7087
7111
|
}
|
|
7088
7112
|
return [
|
|
7089
7113
|
"## The bar",
|
|
@@ -7142,9 +7166,9 @@ function answerSection() {
|
|
|
7142
7166
|
" the gap you filled by asking instead of guessing."
|
|
7143
7167
|
];
|
|
7144
7168
|
}
|
|
7145
|
-
function calibrationSection(brief, code) {
|
|
7169
|
+
function calibrationSection(brief, code, text2) {
|
|
7146
7170
|
if (brief?.calibration !== void 0) {
|
|
7147
|
-
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code), ""];
|
|
7171
|
+
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code, text2), ""];
|
|
7148
7172
|
}
|
|
7149
7173
|
return [
|
|
7150
7174
|
"## Calibration",
|
|
@@ -7202,20 +7226,20 @@ function jobSection(task, hasHistory) {
|
|
|
7202
7226
|
}
|
|
7203
7227
|
return out;
|
|
7204
7228
|
}
|
|
7205
|
-
function stakesSection(brief, code) {
|
|
7229
|
+
function stakesSection(brief, code, text2) {
|
|
7206
7230
|
if (brief?.stakes === void 0) return [];
|
|
7207
|
-
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code), ""];
|
|
7231
|
+
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code, text2), ""];
|
|
7208
7232
|
}
|
|
7209
|
-
function whatThisIsSection(overview) {
|
|
7233
|
+
function whatThisIsSection(overview, escape) {
|
|
7210
7234
|
const body = [];
|
|
7211
7235
|
if (overview.description !== void 0) {
|
|
7212
|
-
body.push("- Declared in `package.json`: " + overview.description);
|
|
7236
|
+
body.push("- Declared in `package.json`: " + escape(overview.description));
|
|
7213
7237
|
}
|
|
7214
7238
|
if (overview.summary !== void 0) {
|
|
7215
|
-
body.push("- From the `README.md` first paragraph: " + overview.summary);
|
|
7239
|
+
body.push("- From the `README.md` first paragraph: " + escape(overview.summary));
|
|
7216
7240
|
}
|
|
7217
7241
|
if (overview.releases.length > 0) {
|
|
7218
|
-
body.push("- Most recent releases: " + overview.releases.join("; ") + ".");
|
|
7242
|
+
body.push("- Most recent releases: " + overview.releases.map(escape).join("; ") + ".");
|
|
7219
7243
|
}
|
|
7220
7244
|
if (body.length === 0) return [];
|
|
7221
7245
|
return [
|
|
@@ -7227,16 +7251,16 @@ function whatThisIsSection(overview) {
|
|
|
7227
7251
|
""
|
|
7228
7252
|
];
|
|
7229
7253
|
}
|
|
7230
|
-
function ownerNotesSection(brief, code) {
|
|
7254
|
+
function ownerNotesSection(brief, code, text2) {
|
|
7231
7255
|
if (brief === void 0 || brief.notes.length === 0) return [];
|
|
7232
7256
|
const out = ["## Owner notes", ""];
|
|
7233
7257
|
for (const note of brief.notes) {
|
|
7234
|
-
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code), "");
|
|
7258
|
+
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code, text2), "");
|
|
7235
7259
|
}
|
|
7236
7260
|
return out;
|
|
7237
7261
|
}
|
|
7238
|
-
function ownerBlock(
|
|
7239
|
-
return ["> Written by the project owner in " + code(path18) + ", not generated.", "",
|
|
7262
|
+
function ownerBlock(body, path18, code, escape) {
|
|
7263
|
+
return ["> Written by the project owner in " + code(path18) + ", not generated.", "", escape(body)];
|
|
7240
7264
|
}
|
|
7241
7265
|
function snapshotSection(manifest, code) {
|
|
7242
7266
|
const out = ["## This snapshot", ""];
|
|
@@ -8103,6 +8127,32 @@ function describeManifestShapeProblem(value) {
|
|
|
8103
8127
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
8104
8128
|
return 'missing "config" object';
|
|
8105
8129
|
}
|
|
8130
|
+
const recordedConfig = config;
|
|
8131
|
+
const promptTask = recordedConfig.promptTask;
|
|
8132
|
+
if (promptTask !== void 0 && promptTask !== "audit" && promptTask !== "review" && promptTask !== "explain") {
|
|
8133
|
+
return '`config.promptTask` must be "audit", "review" or "explain"';
|
|
8134
|
+
}
|
|
8135
|
+
const recordedBrief = recordedConfig.brief;
|
|
8136
|
+
if (recordedBrief !== void 0) {
|
|
8137
|
+
if (!recordedBrief || typeof recordedBrief !== "object" || Array.isArray(recordedBrief)) {
|
|
8138
|
+
return "`config.brief` must be an object";
|
|
8139
|
+
}
|
|
8140
|
+
const briefRecord = recordedBrief;
|
|
8141
|
+
if (typeof briefRecord.path !== "string" || briefRecord.path.length === 0) {
|
|
8142
|
+
return "`config.brief.path` must be a non-empty string";
|
|
8143
|
+
}
|
|
8144
|
+
if (typeof briefRecord.digest !== "string" || !/^[0-9a-f]{64}$/.test(briefRecord.digest)) {
|
|
8145
|
+
return "`config.brief.digest` must be a sha256 hex digest";
|
|
8146
|
+
}
|
|
8147
|
+
}
|
|
8148
|
+
const recordedSlots = recordedConfig.attachmentSlots;
|
|
8149
|
+
if (recordedSlots !== void 0 && (typeof recordedSlots !== "number" || !Number.isSafeInteger(recordedSlots) || recordedSlots < 0)) {
|
|
8150
|
+
return "`config.attachmentSlots` must be a non-negative integer";
|
|
8151
|
+
}
|
|
8152
|
+
const recordedMaxParts = recordedConfig.maxParts;
|
|
8153
|
+
if (recordedMaxParts !== void 0 && recordedMaxParts !== null && (typeof recordedMaxParts !== "number" || !Number.isSafeInteger(recordedMaxParts) || recordedMaxParts < 1)) {
|
|
8154
|
+
return "`config.maxParts` must be a positive integer or null";
|
|
8155
|
+
}
|
|
8106
8156
|
const budgets = candidate.budgets;
|
|
8107
8157
|
if (!budgets || typeof budgets !== "object" || Array.isArray(budgets)) {
|
|
8108
8158
|
return 'missing "budgets" object';
|
|
@@ -11439,6 +11489,7 @@ function maskOwnerBrief(brief, secretRules) {
|
|
|
11439
11489
|
const mask = (value) => maskPathText(value, secretRules);
|
|
11440
11490
|
return {
|
|
11441
11491
|
...brief,
|
|
11492
|
+
path: mask(brief.path),
|
|
11442
11493
|
...brief.stakes === void 0 ? {} : { stakes: mask(brief.stakes) },
|
|
11443
11494
|
...brief.system === void 0 ? {} : { system: mask(brief.system) },
|
|
11444
11495
|
...brief.history === void 0 ? {} : { history: mask(brief.history) },
|
|
@@ -12712,7 +12763,9 @@ function generateSnapshot(configInput, options) {
|
|
|
12712
12763
|
// configuration drift.
|
|
12713
12764
|
maxParts: config.maxParts ?? null,
|
|
12714
12765
|
promptTask: config.promptTask,
|
|
12715
|
-
|
|
12766
|
+
// The path is user input like every other name in this block: a credential-shaped
|
|
12767
|
+
// directory in it would otherwise be echoed into the manifest and PROMPT.md unmasked.
|
|
12768
|
+
...config.brief === void 0 ? {} : { brief: { path: maskName(config.brief.path), digest: config.brief.digest } },
|
|
12716
12769
|
discovery: config.discovery ?? "auto",
|
|
12717
12770
|
// A changed-files scope decides which files are in the snapshot, so the manifest that
|
|
12718
12771
|
// describes the run has to name it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-
|
|
1
|
+
import { GENERATOR_VERSION, anchorForPath, displayPath, MIN_MAX_PART_BYTES, SCHEMA_VERSION, GENERATOR_NAME, ARTIFACT_NAMES, PRESETS, generateInWorker, validateSnapshot, buildImportResolver, resolveSpecifier, truncateToBytes, explainPath, renderExplainText, describeManifestShapeProblem, loadConfigFileDetailed, parseByteSize, resolveConfig } from './chunk-74ZAF64D.js';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
@@ -1919,7 +1919,7 @@ function buildAgentContract() {
|
|
|
1919
1919
|
type: "string",
|
|
1920
1920
|
default: "unset",
|
|
1921
1921
|
appliesTo: optionAppliesTo("brief"),
|
|
1922
|
-
summary: "Path to the owner-written half of PROMPT.md: Stakes, The system, What came before, The bar and Calibration replace or extend the generated prose; any other heading is kept as Owner notes. The measured headings cannot be redefined. A missing file is an error and an edited file is config drift."
|
|
1922
|
+
summary: "Path to the owner-written half of PROMPT.md: Stakes, The system, What came before, The bar and Calibration replace or extend the generated prose; any other heading is kept as Owner notes. The measured headings cannot be redefined; fenced code is content, not headings. The file is capped at 64 KiB. A missing file is an error and an edited file is config drift."
|
|
1923
1923
|
},
|
|
1924
1924
|
{
|
|
1925
1925
|
flag: "--prompt-task",
|
|
@@ -2439,6 +2439,8 @@ function ensureSingleRead(uri, text, advice) {
|
|
|
2439
2439
|
}
|
|
2440
2440
|
var MANIFEST_ADVICE = "Cutting a JSON document at the limit leaves invalid JSON, so this resource is never truncated. Use the snapshot_locate, snapshot_read and snapshot_status tools instead \u2014 they read the manifest directly \u2014 or read manifest.json from the snapshot directory.";
|
|
2441
2441
|
var PART_ADVICE = "A part cut at the limit is a fragment of a file, not the file. Use snapshot_locate to find the file inside this part that you need, then snapshot_read for a bounded window of it.";
|
|
2442
|
+
var PROMPT_URI = "snapshot://prompt";
|
|
2443
|
+
var PROMPT_ADVICE = "PROMPT.md is written whole and never truncated; regenerate it with snapshot_generate, then read it from the snapshot directory.";
|
|
2442
2444
|
var REPORT_ADVICE = "A report cut at the limit would look complete and would not be. Read it from the snapshot directory instead: the file on disk is complete.";
|
|
2443
2445
|
var PART_URI = /^snapshot:\/\/parts\/(\d+)$/;
|
|
2444
2446
|
var REPORT_URIS = /* @__PURE__ */ new Map([
|
|
@@ -2489,6 +2491,13 @@ function buildResourceProvider() {
|
|
|
2489
2491
|
title: "Agent skill",
|
|
2490
2492
|
description: "Usage guidance for an agent working with this tool.",
|
|
2491
2493
|
mimeType: "text/markdown"
|
|
2494
|
+
},
|
|
2495
|
+
{
|
|
2496
|
+
uri: PROMPT_URI,
|
|
2497
|
+
name: "prompt",
|
|
2498
|
+
title: "Snapshot brief",
|
|
2499
|
+
description: "The brief for this snapshot: the job, what the snapshot contains, what it omits, the history it was built from and the standard the answer is held to. Read this before the parts; it names which part holds which file.",
|
|
2500
|
+
mimeType: "text/markdown"
|
|
2492
2501
|
}
|
|
2493
2502
|
];
|
|
2494
2503
|
for (const [uri, report] of REPORT_URIS) {
|
|
@@ -2553,6 +2562,13 @@ function buildResourceProvider() {
|
|
|
2553
2562
|
}
|
|
2554
2563
|
const workspace = await workspaceFor(context);
|
|
2555
2564
|
if ("error" in workspace) return null;
|
|
2565
|
+
if (uri === PROMPT_URI) {
|
|
2566
|
+
const text = readFileIfPresent(
|
|
2567
|
+
path.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
|
|
2568
|
+
);
|
|
2569
|
+
if (text === null) return null;
|
|
2570
|
+
return { uri, mimeType: "text/markdown", text: ensureSingleRead(uri, text, PROMPT_ADVICE) };
|
|
2571
|
+
}
|
|
2556
2572
|
const report = REPORT_URIS.get(uri);
|
|
2557
2573
|
if (report) {
|
|
2558
2574
|
const text = readFileIfPresent(
|