codebase-snapshot 0.12.0 → 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 +53 -2
- package/README.md +1 -1
- package/dist/bin.js +128 -43
- package/dist/{chunk-6HXDYIJS.js → chunk-74ZAF64D.js} +111 -42
- package/dist/{chunk-5FPYVWP3.js → chunk-BITMWXYS.js} +18 -2
- package/dist/cli.cjs +128 -43
- package/dist/cli.js +3 -3
- package/dist/index.cjs +111 -42
- 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/dist/cli.cjs
CHANGED
|
@@ -2220,7 +2220,7 @@ function applySpansKeepingQuotes(line, spans) {
|
|
|
2220
2220
|
|
|
2221
2221
|
// src/version.ts
|
|
2222
2222
|
var GENERATOR_NAME = "codebase-snapshot";
|
|
2223
|
-
var GENERATOR_VERSION = "0.12.
|
|
2223
|
+
var GENERATOR_VERSION = "0.12.2";
|
|
2224
2224
|
var SCHEMA_VERSION = "3.0.0";
|
|
2225
2225
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2226
2226
|
function isOurGeneratorName(name) {
|
|
@@ -2669,6 +2669,15 @@ function defaultIgnoreReason(relativePath, toolDirNames = DEFAULT_TOOL_DIR_NAMES
|
|
|
2669
2669
|
return null;
|
|
2670
2670
|
}
|
|
2671
2671
|
var COMMIT_BODY_LIMIT = 400;
|
|
2672
|
+
function truncateAtSentence(text2, limit) {
|
|
2673
|
+
if (text2.length <= limit) return text2;
|
|
2674
|
+
const window = text2.slice(0, limit);
|
|
2675
|
+
const sentence = Math.max(window.lastIndexOf(". "), window.lastIndexOf("; "));
|
|
2676
|
+
if (sentence > limit / 3) return window.slice(0, sentence + 1).trim();
|
|
2677
|
+
const space = window.lastIndexOf(" ");
|
|
2678
|
+
if (space > limit / 3) return window.slice(0, space).trim() + "\u2026";
|
|
2679
|
+
return window.trim() + "\u2026";
|
|
2680
|
+
}
|
|
2672
2681
|
function recentCommits(cwd, limit = 10) {
|
|
2673
2682
|
try {
|
|
2674
2683
|
const stdout = childProcess__namespace.execFileSync(
|
|
@@ -2687,10 +2696,10 @@ function recentCommits(cwd, limit = 10) {
|
|
|
2687
2696
|
const separator = record.indexOf("");
|
|
2688
2697
|
const subject = separator === -1 ? record : record.slice(0, separator);
|
|
2689
2698
|
const rawBody = separator === -1 ? "" : record.slice(separator + 1);
|
|
2690
|
-
const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ");
|
|
2699
|
+
const body = rawBody.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).join(" ").replace(/\s*\|\s*/g, " ").replace(/\s+/g, " ").trim();
|
|
2691
2700
|
return {
|
|
2692
2701
|
subject: subject.trim(),
|
|
2693
|
-
body: body
|
|
2702
|
+
body: truncateAtSentence(body, COMMIT_BODY_LIMIT)
|
|
2694
2703
|
};
|
|
2695
2704
|
}).filter((commit) => commit.subject.length > 0);
|
|
2696
2705
|
} catch {
|
|
@@ -3320,7 +3329,23 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3320
3329
|
const preamble = [];
|
|
3321
3330
|
const sections = [];
|
|
3322
3331
|
let current = null;
|
|
3332
|
+
let fence = null;
|
|
3323
3333
|
for (const line of source.split(/\r?\n/)) {
|
|
3334
|
+
const fenceLine = /^ {0,3}(`{3,}|~{3,})/.exec(line);
|
|
3335
|
+
if (fenceLine) {
|
|
3336
|
+
const marker2 = fenceLine[1];
|
|
3337
|
+
const char = marker2[0];
|
|
3338
|
+
if (fence === null) fence = { char, length: marker2.length };
|
|
3339
|
+
else if (char === fence.char && marker2.length >= fence.length) fence = null;
|
|
3340
|
+
if (current) current.body.push(line);
|
|
3341
|
+
else preamble.push(line);
|
|
3342
|
+
continue;
|
|
3343
|
+
}
|
|
3344
|
+
if (fence !== null) {
|
|
3345
|
+
if (current) current.body.push(line);
|
|
3346
|
+
else preamble.push(line);
|
|
3347
|
+
continue;
|
|
3348
|
+
}
|
|
3324
3349
|
const heading = /^##\s+(.+?)\s*$/.exec(line);
|
|
3325
3350
|
if (heading) {
|
|
3326
3351
|
current = { heading: heading[1], body: [] };
|
|
@@ -3332,7 +3357,7 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3332
3357
|
}
|
|
3333
3358
|
const recognised = {};
|
|
3334
3359
|
const notes = [];
|
|
3335
|
-
const canonical = (heading) => heading.trim().toLowerCase().replace(/\s+/g, " ");
|
|
3360
|
+
const canonical = (heading) => heading.trim().replace(/[:.]+$/, "").trim().toLowerCase().replace(/\s+/g, " ");
|
|
3336
3361
|
const canonicalOwner = new Map(OWNER_SECTIONS.map((name) => [canonical(name), name]));
|
|
3337
3362
|
const canonicalReserved = new Set(RESERVED_SECTIONS.map(canonical));
|
|
3338
3363
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3876,6 +3901,7 @@ function resolvePromptTask(value) {
|
|
|
3876
3901
|
'promptTask must be one of "audit", "review" or "explain" (received ' + describeValue2(value) + ")."
|
|
3877
3902
|
);
|
|
3878
3903
|
}
|
|
3904
|
+
var MAX_BRIEF_BYTES = 64 * 1024;
|
|
3879
3905
|
function readConfiguredBrief(cwd, value) {
|
|
3880
3906
|
if (value === void 0 || value === null) return void 0;
|
|
3881
3907
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -3893,6 +3919,12 @@ function readConfiguredBrief(cwd, value) {
|
|
|
3893
3919
|
'brief "' + value + '" could not be read as a file; a snapshot must not ship without the half of the brief the owner wrote.'
|
|
3894
3920
|
);
|
|
3895
3921
|
}
|
|
3922
|
+
const bytes = Buffer.byteLength(text2, "utf8");
|
|
3923
|
+
if (bytes > MAX_BRIEF_BYTES) {
|
|
3924
|
+
throw new Error(
|
|
3925
|
+
'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."
|
|
3926
|
+
);
|
|
3927
|
+
}
|
|
3896
3928
|
const parsed = parseOwnerBrief(value, text2);
|
|
3897
3929
|
if (parsed.problems.length > 0) {
|
|
3898
3930
|
throw new Error(
|
|
@@ -6272,6 +6304,32 @@ function describeManifestShapeProblem(value) {
|
|
|
6272
6304
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
6273
6305
|
return 'missing "config" object';
|
|
6274
6306
|
}
|
|
6307
|
+
const recordedConfig = config;
|
|
6308
|
+
const promptTask = recordedConfig.promptTask;
|
|
6309
|
+
if (promptTask !== void 0 && promptTask !== "audit" && promptTask !== "review" && promptTask !== "explain") {
|
|
6310
|
+
return '`config.promptTask` must be "audit", "review" or "explain"';
|
|
6311
|
+
}
|
|
6312
|
+
const recordedBrief = recordedConfig.brief;
|
|
6313
|
+
if (recordedBrief !== void 0) {
|
|
6314
|
+
if (!recordedBrief || typeof recordedBrief !== "object" || Array.isArray(recordedBrief)) {
|
|
6315
|
+
return "`config.brief` must be an object";
|
|
6316
|
+
}
|
|
6317
|
+
const briefRecord = recordedBrief;
|
|
6318
|
+
if (typeof briefRecord.path !== "string" || briefRecord.path.length === 0) {
|
|
6319
|
+
return "`config.brief.path` must be a non-empty string";
|
|
6320
|
+
}
|
|
6321
|
+
if (typeof briefRecord.digest !== "string" || !/^[0-9a-f]{64}$/.test(briefRecord.digest)) {
|
|
6322
|
+
return "`config.brief.digest` must be a sha256 hex digest";
|
|
6323
|
+
}
|
|
6324
|
+
}
|
|
6325
|
+
const recordedSlots = recordedConfig.attachmentSlots;
|
|
6326
|
+
if (recordedSlots !== void 0 && (typeof recordedSlots !== "number" || !Number.isSafeInteger(recordedSlots) || recordedSlots < 0)) {
|
|
6327
|
+
return "`config.attachmentSlots` must be a non-negative integer";
|
|
6328
|
+
}
|
|
6329
|
+
const recordedMaxParts = recordedConfig.maxParts;
|
|
6330
|
+
if (recordedMaxParts !== void 0 && recordedMaxParts !== null && (typeof recordedMaxParts !== "number" || !Number.isSafeInteger(recordedMaxParts) || recordedMaxParts < 1)) {
|
|
6331
|
+
return "`config.maxParts` must be a positive integer or null";
|
|
6332
|
+
}
|
|
6275
6333
|
const budgets = candidate.budgets;
|
|
6276
6334
|
if (!budgets || typeof budgets !== "object" || Array.isArray(budgets)) {
|
|
6277
6335
|
return 'missing "budgets" object';
|
|
@@ -9876,6 +9934,7 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9876
9934
|
const brief = context.brief;
|
|
9877
9935
|
const wrote = (name) => artifacts?.[name] !== false;
|
|
9878
9936
|
const code = (value) => inlineCode(escapeControls(value));
|
|
9937
|
+
const text2 = (value) => escapeControls(value);
|
|
9879
9938
|
const hasOwnerHistory = (brief?.history ?? "").trim().length > 0;
|
|
9880
9939
|
const lines = [
|
|
9881
9940
|
"# PROMPT.md",
|
|
@@ -9894,18 +9953,18 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9894
9953
|
"the snapshot is what exists.",
|
|
9895
9954
|
""
|
|
9896
9955
|
];
|
|
9897
|
-
if (brief?.preamble !== void 0) lines.push(brief.preamble, "");
|
|
9956
|
+
if (brief?.preamble !== void 0) lines.push(text2(brief.preamble), "");
|
|
9898
9957
|
lines.push(...jobSection(task, history.length > 0 || hasOwnerHistory), "");
|
|
9899
|
-
lines.push(...stakesSection(brief, code));
|
|
9958
|
+
lines.push(...stakesSection(brief, code, text2));
|
|
9900
9959
|
lines.push(...haveSection(wrote), "");
|
|
9901
|
-
lines.push(...whatThisIsSection(overview), "");
|
|
9902
|
-
lines.push(...systemSection(manifest, code, brief), "");
|
|
9903
|
-
lines.push(...historySection(history, brief, code), "");
|
|
9904
|
-
lines.push(...barSection(brief, code), "");
|
|
9960
|
+
lines.push(...whatThisIsSection(overview, text2), "");
|
|
9961
|
+
lines.push(...systemSection(manifest, code, brief, text2), "");
|
|
9962
|
+
lines.push(...historySection(history, brief, code, text2), "");
|
|
9963
|
+
lines.push(...barSection(brief, code, text2), "");
|
|
9905
9964
|
lines.push(...coverageSection(manifest, code, wrote("audit")), "");
|
|
9906
9965
|
lines.push(...answerSection(), "");
|
|
9907
|
-
lines.push(...calibrationSection(brief, code), "");
|
|
9908
|
-
lines.push(...ownerNotesSection(brief, code));
|
|
9966
|
+
lines.push(...calibrationSection(brief, code, text2), "");
|
|
9967
|
+
lines.push(...ownerNotesSection(brief, code, text2));
|
|
9909
9968
|
lines.push(...snapshotSection(manifest, code), "");
|
|
9910
9969
|
lines.push(...deliverySection(manifest, wrote("parts"), slots));
|
|
9911
9970
|
lines.push(
|
|
@@ -9984,10 +10043,10 @@ function haveSection(wrote) {
|
|
|
9984
10043
|
out.push(...bullets);
|
|
9985
10044
|
return out;
|
|
9986
10045
|
}
|
|
9987
|
-
function systemSection(manifest, code, brief) {
|
|
10046
|
+
function systemSection(manifest, code, brief, escape) {
|
|
9988
10047
|
const out = ["## The system", ""];
|
|
9989
10048
|
if (brief?.system !== void 0) {
|
|
9990
|
-
out.push(...ownerBlock(brief.system, brief.path, code), "", "What the index records:", "");
|
|
10049
|
+
out.push(...ownerBlock(brief.system, brief.path, code, escape), "", "What the index records:", "");
|
|
9991
10050
|
}
|
|
9992
10051
|
const layers = Object.entries(manifest.layers).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
9993
10052
|
if (layers.length > 0) {
|
|
@@ -10046,9 +10105,9 @@ function systemSection(manifest, code, brief) {
|
|
|
10046
10105
|
}
|
|
10047
10106
|
return out;
|
|
10048
10107
|
}
|
|
10049
|
-
function historySection(history, brief, code) {
|
|
10108
|
+
function historySection(history, brief, code, escape) {
|
|
10050
10109
|
const out = ["## What came before", ""];
|
|
10051
|
-
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code), "");
|
|
10110
|
+
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code, escape), "");
|
|
10052
10111
|
if (history.length === 0) {
|
|
10053
10112
|
out.push(
|
|
10054
10113
|
"No history was readable: this is not a git checkout, or git could not be run. Nothing about",
|
|
@@ -10057,20 +10116,20 @@ function historySection(history, brief, code) {
|
|
|
10057
10116
|
return out;
|
|
10058
10117
|
}
|
|
10059
10118
|
out.push(
|
|
10060
|
-
"The last " + formatNumber(history.length) + " commit
|
|
10061
|
-
"
|
|
10062
|
-
"
|
|
10119
|
+
"The last " + formatNumber(history.length) + " " + (history.length === 1 ? "commit" : "commits") + ", newest first. Subjects and bodies are claims",
|
|
10120
|
+
"by whoever wrote them, not evidence - the code beside them is the evidence. If one of these",
|
|
10121
|
+
"fixes looks incomplete, quote the lines and say which call site it missed.",
|
|
10063
10122
|
""
|
|
10064
10123
|
);
|
|
10065
10124
|
for (const commit of history) {
|
|
10066
|
-
out.push("- " + commit.subject);
|
|
10067
|
-
if (commit.body.length > 0) out.push(" " + commit.body);
|
|
10125
|
+
out.push("- " + escape(commit.subject));
|
|
10126
|
+
if (commit.body.length > 0) out.push(" " + escape(commit.body));
|
|
10068
10127
|
}
|
|
10069
10128
|
return out;
|
|
10070
10129
|
}
|
|
10071
|
-
function barSection(brief, code) {
|
|
10130
|
+
function barSection(brief, code, text2) {
|
|
10072
10131
|
if (brief?.bar !== void 0) {
|
|
10073
|
-
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code), ""];
|
|
10132
|
+
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code, text2), ""];
|
|
10074
10133
|
}
|
|
10075
10134
|
return [
|
|
10076
10135
|
"## The bar",
|
|
@@ -10129,9 +10188,9 @@ function answerSection() {
|
|
|
10129
10188
|
" the gap you filled by asking instead of guessing."
|
|
10130
10189
|
];
|
|
10131
10190
|
}
|
|
10132
|
-
function calibrationSection(brief, code) {
|
|
10191
|
+
function calibrationSection(brief, code, text2) {
|
|
10133
10192
|
if (brief?.calibration !== void 0) {
|
|
10134
|
-
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code), ""];
|
|
10193
|
+
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code, text2), ""];
|
|
10135
10194
|
}
|
|
10136
10195
|
return [
|
|
10137
10196
|
"## Calibration",
|
|
@@ -10189,20 +10248,20 @@ function jobSection(task, hasHistory) {
|
|
|
10189
10248
|
}
|
|
10190
10249
|
return out;
|
|
10191
10250
|
}
|
|
10192
|
-
function stakesSection(brief, code) {
|
|
10251
|
+
function stakesSection(brief, code, text2) {
|
|
10193
10252
|
if (brief?.stakes === void 0) return [];
|
|
10194
|
-
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code), ""];
|
|
10253
|
+
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code, text2), ""];
|
|
10195
10254
|
}
|
|
10196
|
-
function whatThisIsSection(overview) {
|
|
10255
|
+
function whatThisIsSection(overview, escape) {
|
|
10197
10256
|
const body = [];
|
|
10198
10257
|
if (overview.description !== void 0) {
|
|
10199
|
-
body.push("- Declared in `package.json`: " + overview.description);
|
|
10258
|
+
body.push("- Declared in `package.json`: " + escape(overview.description));
|
|
10200
10259
|
}
|
|
10201
10260
|
if (overview.summary !== void 0) {
|
|
10202
|
-
body.push("- From the `README.md` first paragraph: " + overview.summary);
|
|
10261
|
+
body.push("- From the `README.md` first paragraph: " + escape(overview.summary));
|
|
10203
10262
|
}
|
|
10204
10263
|
if (overview.releases.length > 0) {
|
|
10205
|
-
body.push("- Most recent releases: " + overview.releases.join("; ") + ".");
|
|
10264
|
+
body.push("- Most recent releases: " + overview.releases.map(escape).join("; ") + ".");
|
|
10206
10265
|
}
|
|
10207
10266
|
if (body.length === 0) return [];
|
|
10208
10267
|
return [
|
|
@@ -10214,16 +10273,16 @@ function whatThisIsSection(overview) {
|
|
|
10214
10273
|
""
|
|
10215
10274
|
];
|
|
10216
10275
|
}
|
|
10217
|
-
function ownerNotesSection(brief, code) {
|
|
10276
|
+
function ownerNotesSection(brief, code, text2) {
|
|
10218
10277
|
if (brief === void 0 || brief.notes.length === 0) return [];
|
|
10219
10278
|
const out = ["## Owner notes", ""];
|
|
10220
10279
|
for (const note of brief.notes) {
|
|
10221
|
-
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code), "");
|
|
10280
|
+
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code, text2), "");
|
|
10222
10281
|
}
|
|
10223
10282
|
return out;
|
|
10224
10283
|
}
|
|
10225
|
-
function ownerBlock(
|
|
10226
|
-
return ["> Written by the project owner in " + code(path23) + ", not generated.", "",
|
|
10284
|
+
function ownerBlock(body, path23, code, escape) {
|
|
10285
|
+
return ["> Written by the project owner in " + code(path23) + ", not generated.", "", escape(body)];
|
|
10227
10286
|
}
|
|
10228
10287
|
function snapshotSection(manifest, code) {
|
|
10229
10288
|
const out = ["## This snapshot", ""];
|
|
@@ -10323,7 +10382,8 @@ function deliverySection(manifest, partsWritten, slots) {
|
|
|
10323
10382
|
);
|
|
10324
10383
|
if (parts > 1) {
|
|
10325
10384
|
out.push(
|
|
10326
|
-
" Either raise `--max-part-bytes` to merge the parts, or set
|
|
10385
|
+
" Either raise `--max-part-bytes` to merge the parts, or set",
|
|
10386
|
+
" `--max-parts " + slots + "` and let the parts grow to the count instead."
|
|
10327
10387
|
);
|
|
10328
10388
|
}
|
|
10329
10389
|
} else {
|
|
@@ -10566,13 +10626,13 @@ function readDescription(cwd) {
|
|
|
10566
10626
|
function readSummary(cwd) {
|
|
10567
10627
|
const raw = readText(path17__namespace.join(cwd, "README.md"));
|
|
10568
10628
|
if (raw === null) return {};
|
|
10569
|
-
const
|
|
10629
|
+
const text2 = raw.replace(/<h[1-6][^>]*>[\s\S]*?<\/h[1-6]>/gi, "\n").replace(/<\/(p|div|section|header|footer|li)>/gi, "\n").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]*>/g, " ").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'");
|
|
10570
10630
|
const paragraph = [];
|
|
10571
|
-
for (const line of
|
|
10631
|
+
for (const line of text2.split(/\r?\n/)) {
|
|
10572
10632
|
const trimmed = line.trim();
|
|
10573
10633
|
if (paragraph.length === 0) {
|
|
10574
10634
|
if (trimmed.length === 0) continue;
|
|
10575
|
-
if (/^#/.test(trimmed) || /^!\[/.test(trimmed) ||
|
|
10635
|
+
if (/^#/.test(trimmed) || /^!\[/.test(trimmed) || /^[-*|]/.test(trimmed)) continue;
|
|
10576
10636
|
if (/^\[[^\]]+\]:/.test(trimmed)) continue;
|
|
10577
10637
|
} else if (trimmed.length === 0 || /^#/.test(trimmed)) {
|
|
10578
10638
|
break;
|
|
@@ -10581,12 +10641,18 @@ function readSummary(cwd) {
|
|
|
10581
10641
|
}
|
|
10582
10642
|
const summary = paragraph.join(" ").replace(/\s+/g, " ").trim();
|
|
10583
10643
|
if (summary.length === 0) return {};
|
|
10584
|
-
return { summary: summary
|
|
10644
|
+
return { summary: truncate(summary, SUMMARY_LIMIT) };
|
|
10645
|
+
}
|
|
10646
|
+
function truncate(text2, limit) {
|
|
10647
|
+
if (text2.length <= limit) return text2;
|
|
10648
|
+
const window = text2.slice(0, limit);
|
|
10649
|
+
const space = window.lastIndexOf(" ");
|
|
10650
|
+
return (space > limit / 2 ? window.slice(0, space) : window).trim() + "\u2026";
|
|
10585
10651
|
}
|
|
10586
10652
|
function readReleases(cwd) {
|
|
10587
10653
|
const raw = readText(path17__namespace.join(cwd, "CHANGELOG.md"));
|
|
10588
10654
|
if (raw === null) return [];
|
|
10589
|
-
const headings = raw.split(/\r?\n/).
|
|
10655
|
+
const headings = raw.split(/\r?\n/).map((line) => /^##\s+(.+?)\s*$/.exec(line)?.[1]?.trim()).filter((heading) => heading !== void 0 && /^v?\d+\.\d+/.test(heading));
|
|
10590
10656
|
return headings.slice(0, MAX_RELEASES);
|
|
10591
10657
|
}
|
|
10592
10658
|
var PACKAGE_LATEST_URL = "https://registry.npmjs.org/codebase-snapshot/latest";
|
|
@@ -11373,6 +11439,7 @@ function maskOwnerBrief(brief, secretRules) {
|
|
|
11373
11439
|
const mask = (value) => maskPathText(value, secretRules);
|
|
11374
11440
|
return {
|
|
11375
11441
|
...brief,
|
|
11442
|
+
path: mask(brief.path),
|
|
11376
11443
|
...brief.stakes === void 0 ? {} : { stakes: mask(brief.stakes) },
|
|
11377
11444
|
...brief.system === void 0 ? {} : { system: mask(brief.system) },
|
|
11378
11445
|
...brief.history === void 0 ? {} : { history: mask(brief.history) },
|
|
@@ -12646,7 +12713,9 @@ function generateSnapshot(configInput, options) {
|
|
|
12646
12713
|
// configuration drift.
|
|
12647
12714
|
maxParts: config.maxParts ?? null,
|
|
12648
12715
|
promptTask: config.promptTask,
|
|
12649
|
-
|
|
12716
|
+
// The path is user input like every other name in this block: a credential-shaped
|
|
12717
|
+
// directory in it would otherwise be echoed into the manifest and PROMPT.md unmasked.
|
|
12718
|
+
...config.brief === void 0 ? {} : { brief: { path: maskName(config.brief.path), digest: config.brief.digest } },
|
|
12650
12719
|
discovery: config.discovery ?? "auto",
|
|
12651
12720
|
// A changed-files scope decides which files are in the snapshot, so the manifest that
|
|
12652
12721
|
// describes the run has to name it.
|
|
@@ -14823,7 +14892,7 @@ function buildAgentContract() {
|
|
|
14823
14892
|
type: "string",
|
|
14824
14893
|
default: "unset",
|
|
14825
14894
|
appliesTo: optionAppliesTo("brief"),
|
|
14826
|
-
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."
|
|
14895
|
+
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."
|
|
14827
14896
|
},
|
|
14828
14897
|
{
|
|
14829
14898
|
flag: "--prompt-task",
|
|
@@ -15526,6 +15595,8 @@ function ensureSingleRead(uri, text2, advice) {
|
|
|
15526
15595
|
}
|
|
15527
15596
|
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.";
|
|
15528
15597
|
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.";
|
|
15598
|
+
var PROMPT_URI = "snapshot://prompt";
|
|
15599
|
+
var PROMPT_ADVICE = "PROMPT.md is written whole and never truncated; regenerate it with snapshot_generate, then read it from the snapshot directory.";
|
|
15529
15600
|
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.";
|
|
15530
15601
|
var PART_URI = /^snapshot:\/\/parts\/(\d+)$/;
|
|
15531
15602
|
var REPORT_URIS = /* @__PURE__ */ new Map([
|
|
@@ -15576,6 +15647,13 @@ function buildResourceProvider() {
|
|
|
15576
15647
|
title: "Agent skill",
|
|
15577
15648
|
description: "Usage guidance for an agent working with this tool.",
|
|
15578
15649
|
mimeType: "text/markdown"
|
|
15650
|
+
},
|
|
15651
|
+
{
|
|
15652
|
+
uri: PROMPT_URI,
|
|
15653
|
+
name: "prompt",
|
|
15654
|
+
title: "Snapshot brief",
|
|
15655
|
+
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.",
|
|
15656
|
+
mimeType: "text/markdown"
|
|
15579
15657
|
}
|
|
15580
15658
|
];
|
|
15581
15659
|
for (const [uri, report] of REPORT_URIS) {
|
|
@@ -15640,6 +15718,13 @@ function buildResourceProvider() {
|
|
|
15640
15718
|
}
|
|
15641
15719
|
const workspace = await workspaceFor(context);
|
|
15642
15720
|
if ("error" in workspace) return null;
|
|
15721
|
+
if (uri === PROMPT_URI) {
|
|
15722
|
+
const text2 = readFileIfPresent(
|
|
15723
|
+
path17__namespace.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
|
|
15724
|
+
);
|
|
15725
|
+
if (text2 === null) return null;
|
|
15726
|
+
return { uri, mimeType: "text/markdown", text: ensureSingleRead(uri, text2, PROMPT_ADVICE) };
|
|
15727
|
+
}
|
|
15643
15728
|
const report = REPORT_URIS.get(uri);
|
|
15644
15729
|
if (report) {
|
|
15645
15730
|
const text2 = readFileIfPresent(
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-
|
|
2
|
-
export { buildAgentContract } from './chunk-
|
|
3
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-
|
|
1
|
+
import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-BITMWXYS.js';
|
|
2
|
+
export { buildAgentContract } from './chunk-BITMWXYS.js';
|
|
3
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, loadConfigFileDetailed, resolveConfig, validateSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-74ZAF64D.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|