codebase-snapshot 0.12.1 → 0.12.3
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 +44 -0
- package/README.md +1 -1
- package/dist/bin.js +133 -39
- package/dist/{chunk-H4FSGTEW.js → chunk-DEFKIYRZ.js} +116 -38
- package/dist/{chunk-BXWV2OXE.js → chunk-GIWY4HXZ.js} +18 -2
- package/dist/cli.cjs +133 -39
- package/dist/cli.js +3 -3
- package/dist/index.cjs +116 -38
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +82 -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.3";
|
|
2224
2224
|
var SCHEMA_VERSION = "3.0.0";
|
|
2225
2225
|
var LEGACY_GENERATOR_NAMES = ["@ankurhalder/codebase-snapshot"];
|
|
2226
2226
|
function isOurGeneratorName(name) {
|
|
@@ -3329,7 +3329,23 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3329
3329
|
const preamble = [];
|
|
3330
3330
|
const sections = [];
|
|
3331
3331
|
let current = null;
|
|
3332
|
+
let fence = null;
|
|
3332
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
|
+
}
|
|
3333
3349
|
const heading = /^##\s+(.+?)\s*$/.exec(line);
|
|
3334
3350
|
if (heading) {
|
|
3335
3351
|
current = { heading: heading[1], body: [] };
|
|
@@ -3341,7 +3357,7 @@ function parseOwnerBrief(filePath, text2) {
|
|
|
3341
3357
|
}
|
|
3342
3358
|
const recognised = {};
|
|
3343
3359
|
const notes = [];
|
|
3344
|
-
const canonical = (heading) => heading.trim().toLowerCase().replace(/\s+/g, " ");
|
|
3360
|
+
const canonical = (heading) => heading.trim().replace(/[:.]+$/, "").trim().toLowerCase().replace(/\s+/g, " ");
|
|
3345
3361
|
const canonicalOwner = new Map(OWNER_SECTIONS.map((name) => [canonical(name), name]));
|
|
3346
3362
|
const canonicalReserved = new Set(RESERVED_SECTIONS.map(canonical));
|
|
3347
3363
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -3885,6 +3901,7 @@ function resolvePromptTask(value) {
|
|
|
3885
3901
|
'promptTask must be one of "audit", "review" or "explain" (received ' + describeValue2(value) + ")."
|
|
3886
3902
|
);
|
|
3887
3903
|
}
|
|
3904
|
+
var MAX_BRIEF_BYTES = 64 * 1024;
|
|
3888
3905
|
function readConfiguredBrief(cwd, value) {
|
|
3889
3906
|
if (value === void 0 || value === null) return void 0;
|
|
3890
3907
|
if (typeof value !== "string" || value.trim().length === 0) {
|
|
@@ -3902,6 +3919,12 @@ function readConfiguredBrief(cwd, value) {
|
|
|
3902
3919
|
'brief "' + value + '" could not be read as a file; a snapshot must not ship without the half of the brief the owner wrote.'
|
|
3903
3920
|
);
|
|
3904
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
|
+
}
|
|
3905
3928
|
const parsed = parseOwnerBrief(value, text2);
|
|
3906
3929
|
if (parsed.problems.length > 0) {
|
|
3907
3930
|
throw new Error(
|
|
@@ -6281,6 +6304,32 @@ function describeManifestShapeProblem(value) {
|
|
|
6281
6304
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
6282
6305
|
return 'missing "config" object';
|
|
6283
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
|
+
}
|
|
6284
6333
|
const budgets = candidate.budgets;
|
|
6285
6334
|
if (!budgets || typeof budgets !== "object" || Array.isArray(budgets)) {
|
|
6286
6335
|
return 'missing "budgets" object';
|
|
@@ -6838,6 +6887,20 @@ function validateSnapshot(configInput) {
|
|
|
6838
6887
|
`withDependents: manifest ${Boolean(recorded.withDependents)} vs current ${Boolean(config.withDependents)}`
|
|
6839
6888
|
);
|
|
6840
6889
|
}
|
|
6890
|
+
const recordedTask = recorded.promptTask;
|
|
6891
|
+
if (recordedTask !== void 0 && recordedTask !== config.promptTask) {
|
|
6892
|
+
drift.configMismatches.push(
|
|
6893
|
+
`promptTask: manifest ${String(recordedTask)} vs current ${config.promptTask}`
|
|
6894
|
+
);
|
|
6895
|
+
}
|
|
6896
|
+
const recordedBrief = recorded.brief;
|
|
6897
|
+
const recordedBriefDigest = recordedBrief !== void 0 && typeof recordedBrief.digest === "string" ? recordedBrief.digest : void 0;
|
|
6898
|
+
const currentBriefDigest = config.brief?.digest;
|
|
6899
|
+
if (recordedBriefDigest !== currentBriefDigest) {
|
|
6900
|
+
drift.configMismatches.push(
|
|
6901
|
+
recordedBriefDigest === void 0 ? "brief: none recorded vs current " + String(config.brief?.path) : currentBriefDigest === void 0 ? "brief: manifest " + String(recordedBrief?.path) + " vs current none" : "brief: " + String(recordedBrief?.path) + " changed since this snapshot was generated"
|
|
6902
|
+
);
|
|
6903
|
+
}
|
|
6841
6904
|
const effectiveDiscovery = config.discovery ?? "auto";
|
|
6842
6905
|
const recordedDiscovery = recorded.discovery;
|
|
6843
6906
|
if (recordedDiscovery !== void 0 && recordedDiscovery !== effectiveDiscovery) {
|
|
@@ -7218,7 +7281,7 @@ function describePayloadDiff(before, after, sourceFilesIdentical, secretRules) {
|
|
|
7218
7281
|
if (digestDiffers) {
|
|
7219
7282
|
codes.push("config-digest");
|
|
7220
7283
|
reasons.push(
|
|
7221
|
-
`configuration digest ${shortDigest(digestBefore)} \u2192 ${shortDigest(digestAfter)} (budgets, preview thresholds, redaction rules
|
|
7284
|
+
`configuration digest ${shortDigest(digestBefore)} \u2192 ${shortDigest(digestAfter)} (budgets, preview thresholds, redaction rules, artifact selection, the prompt task and the owner brief all count)`
|
|
7222
7285
|
);
|
|
7223
7286
|
} else if (digestBefore === null || digestAfter === null) {
|
|
7224
7287
|
const missing = digestBefore === null && digestAfter !== null ? "before" : digestAfter === null && digestBefore !== null ? "after" : "both";
|
|
@@ -9885,6 +9948,7 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9885
9948
|
const brief = context.brief;
|
|
9886
9949
|
const wrote = (name) => artifacts?.[name] !== false;
|
|
9887
9950
|
const code = (value) => inlineCode(escapeControls(value));
|
|
9951
|
+
const text2 = (value) => escapeControls(value);
|
|
9888
9952
|
const hasOwnerHistory = (brief?.history ?? "").trim().length > 0;
|
|
9889
9953
|
const lines = [
|
|
9890
9954
|
"# PROMPT.md",
|
|
@@ -9903,18 +9967,18 @@ function generatePrompt(manifest, artifacts, context = {}) {
|
|
|
9903
9967
|
"the snapshot is what exists.",
|
|
9904
9968
|
""
|
|
9905
9969
|
];
|
|
9906
|
-
if (brief?.preamble !== void 0) lines.push(brief.preamble, "");
|
|
9970
|
+
if (brief?.preamble !== void 0) lines.push(text2(brief.preamble), "");
|
|
9907
9971
|
lines.push(...jobSection(task, history.length > 0 || hasOwnerHistory), "");
|
|
9908
|
-
lines.push(...stakesSection(brief, code));
|
|
9972
|
+
lines.push(...stakesSection(brief, code, text2));
|
|
9909
9973
|
lines.push(...haveSection(wrote), "");
|
|
9910
|
-
lines.push(...whatThisIsSection(overview), "");
|
|
9911
|
-
lines.push(...systemSection(manifest, code, brief), "");
|
|
9912
|
-
lines.push(...historySection(history, brief, code), "");
|
|
9913
|
-
lines.push(...barSection(brief, code), "");
|
|
9974
|
+
lines.push(...whatThisIsSection(overview, text2), "");
|
|
9975
|
+
lines.push(...systemSection(manifest, code, brief, text2), "");
|
|
9976
|
+
lines.push(...historySection(history, brief, code, text2), "");
|
|
9977
|
+
lines.push(...barSection(brief, code, text2), "");
|
|
9914
9978
|
lines.push(...coverageSection(manifest, code, wrote("audit")), "");
|
|
9915
9979
|
lines.push(...answerSection(), "");
|
|
9916
|
-
lines.push(...calibrationSection(brief, code), "");
|
|
9917
|
-
lines.push(...ownerNotesSection(brief, code));
|
|
9980
|
+
lines.push(...calibrationSection(brief, code, text2), "");
|
|
9981
|
+
lines.push(...ownerNotesSection(brief, code, text2));
|
|
9918
9982
|
lines.push(...snapshotSection(manifest, code), "");
|
|
9919
9983
|
lines.push(...deliverySection(manifest, wrote("parts"), slots));
|
|
9920
9984
|
lines.push(
|
|
@@ -9993,10 +10057,10 @@ function haveSection(wrote) {
|
|
|
9993
10057
|
out.push(...bullets);
|
|
9994
10058
|
return out;
|
|
9995
10059
|
}
|
|
9996
|
-
function systemSection(manifest, code, brief) {
|
|
10060
|
+
function systemSection(manifest, code, brief, escape) {
|
|
9997
10061
|
const out = ["## The system", ""];
|
|
9998
10062
|
if (brief?.system !== void 0) {
|
|
9999
|
-
out.push(...ownerBlock(brief.system, brief.path, code), "", "What the index records:", "");
|
|
10063
|
+
out.push(...ownerBlock(brief.system, brief.path, code, escape), "", "What the index records:", "");
|
|
10000
10064
|
}
|
|
10001
10065
|
const layers = Object.entries(manifest.layers).sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]));
|
|
10002
10066
|
if (layers.length > 0) {
|
|
@@ -10029,9 +10093,17 @@ function systemSection(manifest, code, brief) {
|
|
|
10029
10093
|
);
|
|
10030
10094
|
} else {
|
|
10031
10095
|
const parts = [];
|
|
10032
|
-
if (routes > 0)
|
|
10033
|
-
|
|
10034
|
-
|
|
10096
|
+
if (routes > 0) {
|
|
10097
|
+
parts.push(
|
|
10098
|
+
formatNumber(routes) + (routes === 1 ? " route" : " routes") + ", e.g. " + routesShown.join(", ")
|
|
10099
|
+
);
|
|
10100
|
+
}
|
|
10101
|
+
if (handlers > 0) parts.push(formatNumber(handlers) + (handlers === 1 ? " handler" : " handlers"));
|
|
10102
|
+
if (components > 0) {
|
|
10103
|
+
parts.push(
|
|
10104
|
+
formatNumber(components) + (components === 1 ? " component" : " components") + ", e.g. " + componentsShown.join(", ")
|
|
10105
|
+
);
|
|
10106
|
+
}
|
|
10035
10107
|
out.push("- Surfaces the index found: " + parts.join("; ") + ".");
|
|
10036
10108
|
}
|
|
10037
10109
|
const largest = [...manifest.files].sort((a, b) => b.includedBytes - a.includedBytes).slice(0, MAX_LARGEST_FILES);
|
|
@@ -10048,16 +10120,16 @@ function systemSection(manifest, code, brief) {
|
|
|
10048
10120
|
const allBytes = manifest.files.reduce((total, file) => total + file.includedBytes, 0);
|
|
10049
10121
|
const share = allBytes === 0 ? 0 : Math.round(testBytes / allBytes * 100);
|
|
10050
10122
|
out.push(
|
|
10051
|
-
"- Tests: " + formatNumber(tests.length) + " file
|
|
10123
|
+
"- Tests: " + formatNumber(tests.length) + (tests.length === 1 ? " file, " : " files, ") + share + "% of the included bytes.",
|
|
10052
10124
|
" They are evidence of intent, not of behaviour: a fixture can encode a payload shape the",
|
|
10053
10125
|
" real system never sends."
|
|
10054
10126
|
);
|
|
10055
10127
|
}
|
|
10056
10128
|
return out;
|
|
10057
10129
|
}
|
|
10058
|
-
function historySection(history, brief, code) {
|
|
10130
|
+
function historySection(history, brief, code, escape) {
|
|
10059
10131
|
const out = ["## What came before", ""];
|
|
10060
|
-
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code), "");
|
|
10132
|
+
if (brief?.history !== void 0) out.push(...ownerBlock(brief.history, brief.path, code, escape), "");
|
|
10061
10133
|
if (history.length === 0) {
|
|
10062
10134
|
out.push(
|
|
10063
10135
|
"No history was readable: this is not a git checkout, or git could not be run. Nothing about",
|
|
@@ -10072,14 +10144,14 @@ function historySection(history, brief, code) {
|
|
|
10072
10144
|
""
|
|
10073
10145
|
);
|
|
10074
10146
|
for (const commit of history) {
|
|
10075
|
-
out.push("- " + commit.subject);
|
|
10076
|
-
if (commit.body.length > 0) out.push(" " + commit.body);
|
|
10147
|
+
out.push("- " + escape(commit.subject));
|
|
10148
|
+
if (commit.body.length > 0) out.push(" " + escape(commit.body));
|
|
10077
10149
|
}
|
|
10078
10150
|
return out;
|
|
10079
10151
|
}
|
|
10080
|
-
function barSection(brief, code) {
|
|
10152
|
+
function barSection(brief, code, text2) {
|
|
10081
10153
|
if (brief?.bar !== void 0) {
|
|
10082
|
-
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code), ""];
|
|
10154
|
+
return ["## The bar", "", ...ownerBlock(brief.bar, brief.path, code, text2), ""];
|
|
10083
10155
|
}
|
|
10084
10156
|
return [
|
|
10085
10157
|
"## The bar",
|
|
@@ -10105,8 +10177,11 @@ function coverageSection(manifest, code, auditWritten) {
|
|
|
10105
10177
|
reasons.set(record.reason, (reasons.get(record.reason) ?? 0) + 1);
|
|
10106
10178
|
}
|
|
10107
10179
|
const tally = [...reasons.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([reason, count]) => code(reason) + " " + formatNumber(count)).join(", ");
|
|
10180
|
+
const found = manifest.totals.candidateFiles;
|
|
10181
|
+
const included = manifest.totals.includedFiles;
|
|
10182
|
+
const skipped = manifest.counts.skippedCount;
|
|
10108
10183
|
out.push(
|
|
10109
|
-
"- " + formatNumber(
|
|
10184
|
+
"- " + formatNumber(found) + (found === 1 ? " path was" : " paths were") + " found; " + formatNumber(included) + (included === 1 ? " is" : " are") + " in the parts and " + formatNumber(skipped) + (skipped === 1 ? " was" : " were") + " skipped" + (tally.length > 0 ? " (" + tally + ")" : "") + ".",
|
|
10110
10185
|
" `manifest.skipped[]` names each one and why. An absent path is not a clean path."
|
|
10111
10186
|
);
|
|
10112
10187
|
out.push(...incompleteSection(manifest, code));
|
|
@@ -10138,9 +10213,9 @@ function answerSection() {
|
|
|
10138
10213
|
" the gap you filled by asking instead of guessing."
|
|
10139
10214
|
];
|
|
10140
10215
|
}
|
|
10141
|
-
function calibrationSection(brief, code) {
|
|
10216
|
+
function calibrationSection(brief, code, text2) {
|
|
10142
10217
|
if (brief?.calibration !== void 0) {
|
|
10143
|
-
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code), ""];
|
|
10218
|
+
return ["## Calibration", "", ...ownerBlock(brief.calibration, brief.path, code, text2), ""];
|
|
10144
10219
|
}
|
|
10145
10220
|
return [
|
|
10146
10221
|
"## Calibration",
|
|
@@ -10198,20 +10273,20 @@ function jobSection(task, hasHistory) {
|
|
|
10198
10273
|
}
|
|
10199
10274
|
return out;
|
|
10200
10275
|
}
|
|
10201
|
-
function stakesSection(brief, code) {
|
|
10276
|
+
function stakesSection(brief, code, text2) {
|
|
10202
10277
|
if (brief?.stakes === void 0) return [];
|
|
10203
|
-
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code), ""];
|
|
10278
|
+
return ["## Stakes", "", ...ownerBlock(brief.stakes, brief.path, code, text2), ""];
|
|
10204
10279
|
}
|
|
10205
|
-
function whatThisIsSection(overview) {
|
|
10280
|
+
function whatThisIsSection(overview, escape) {
|
|
10206
10281
|
const body = [];
|
|
10207
10282
|
if (overview.description !== void 0) {
|
|
10208
|
-
body.push("- Declared in `package.json`: " + overview.description);
|
|
10283
|
+
body.push("- Declared in `package.json`: " + escape(overview.description));
|
|
10209
10284
|
}
|
|
10210
10285
|
if (overview.summary !== void 0) {
|
|
10211
|
-
body.push("- From the `README.md` first paragraph: " + overview.summary);
|
|
10286
|
+
body.push("- From the `README.md` first paragraph: " + escape(overview.summary));
|
|
10212
10287
|
}
|
|
10213
10288
|
if (overview.releases.length > 0) {
|
|
10214
|
-
body.push("- Most recent releases: " + overview.releases.join("; ") + ".");
|
|
10289
|
+
body.push("- Most recent releases: " + overview.releases.map(escape).join("; ") + ".");
|
|
10215
10290
|
}
|
|
10216
10291
|
if (body.length === 0) return [];
|
|
10217
10292
|
return [
|
|
@@ -10223,16 +10298,16 @@ function whatThisIsSection(overview) {
|
|
|
10223
10298
|
""
|
|
10224
10299
|
];
|
|
10225
10300
|
}
|
|
10226
|
-
function ownerNotesSection(brief, code) {
|
|
10301
|
+
function ownerNotesSection(brief, code, text2) {
|
|
10227
10302
|
if (brief === void 0 || brief.notes.length === 0) return [];
|
|
10228
10303
|
const out = ["## Owner notes", ""];
|
|
10229
10304
|
for (const note of brief.notes) {
|
|
10230
|
-
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code), "");
|
|
10305
|
+
out.push("### " + note.heading, "", ...ownerBlock(note.body, brief.path, code, text2), "");
|
|
10231
10306
|
}
|
|
10232
10307
|
return out;
|
|
10233
10308
|
}
|
|
10234
|
-
function ownerBlock(
|
|
10235
|
-
return ["> Written by the project owner in " + code(path23) + ", not generated.", "",
|
|
10309
|
+
function ownerBlock(body, path23, code, escape) {
|
|
10310
|
+
return ["> Written by the project owner in " + code(path23) + ", not generated.", "", escape(body)];
|
|
10236
10311
|
}
|
|
10237
10312
|
function snapshotSection(manifest, code) {
|
|
10238
10313
|
const out = ["## This snapshot", ""];
|
|
@@ -11389,6 +11464,7 @@ function maskOwnerBrief(brief, secretRules) {
|
|
|
11389
11464
|
const mask = (value) => maskPathText(value, secretRules);
|
|
11390
11465
|
return {
|
|
11391
11466
|
...brief,
|
|
11467
|
+
path: mask(brief.path),
|
|
11392
11468
|
...brief.stakes === void 0 ? {} : { stakes: mask(brief.stakes) },
|
|
11393
11469
|
...brief.system === void 0 ? {} : { system: mask(brief.system) },
|
|
11394
11470
|
...brief.history === void 0 ? {} : { history: mask(brief.history) },
|
|
@@ -12552,7 +12628,7 @@ function generateSnapshot(configInput, options) {
|
|
|
12552
12628
|
const shown = previewSummaryPaths.slice(0, ENCODING_PATHS_SHOWN).map((entry) => maskPathText(entry, config.secretRules));
|
|
12553
12629
|
const hidden = previewSummaryPaths.length - ENCODING_PATHS_SHOWN;
|
|
12554
12630
|
warnings.push(
|
|
12555
|
-
`${previewSummaryPaths.length} file
|
|
12631
|
+
`${previewSummaryPaths.length} ${previewSummaryPaths.length === 1 ? "file is" : "files are"} emitted as head/tail previews and were not parsed for a structural summary: ${shown.join(", ")}${hidden > 0 ? ` and ${hidden} more` : ""}. A whole-file summary would describe lines the snapshot does not carry; \`explain <path>\` names the preview budget.`
|
|
12556
12632
|
);
|
|
12557
12633
|
}
|
|
12558
12634
|
if (oversizeSummaryPaths.length > 0) {
|
|
@@ -12662,7 +12738,9 @@ function generateSnapshot(configInput, options) {
|
|
|
12662
12738
|
// configuration drift.
|
|
12663
12739
|
maxParts: config.maxParts ?? null,
|
|
12664
12740
|
promptTask: config.promptTask,
|
|
12665
|
-
|
|
12741
|
+
// The path is user input like every other name in this block: a credential-shaped
|
|
12742
|
+
// directory in it would otherwise be echoed into the manifest and PROMPT.md unmasked.
|
|
12743
|
+
...config.brief === void 0 ? {} : { brief: { path: maskName(config.brief.path), digest: config.brief.digest } },
|
|
12666
12744
|
discovery: config.discovery ?? "auto",
|
|
12667
12745
|
// A changed-files scope decides which files are in the snapshot, so the manifest that
|
|
12668
12746
|
// describes the run has to name it.
|
|
@@ -14839,7 +14917,7 @@ function buildAgentContract() {
|
|
|
14839
14917
|
type: "string",
|
|
14840
14918
|
default: "unset",
|
|
14841
14919
|
appliesTo: optionAppliesTo("brief"),
|
|
14842
|
-
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."
|
|
14920
|
+
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."
|
|
14843
14921
|
},
|
|
14844
14922
|
{
|
|
14845
14923
|
flag: "--prompt-task",
|
|
@@ -15542,6 +15620,8 @@ function ensureSingleRead(uri, text2, advice) {
|
|
|
15542
15620
|
}
|
|
15543
15621
|
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.";
|
|
15544
15622
|
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.";
|
|
15623
|
+
var PROMPT_URI = "snapshot://prompt";
|
|
15624
|
+
var PROMPT_ADVICE = "PROMPT.md is written whole and never truncated; regenerate it with snapshot_generate, then read it from the snapshot directory.";
|
|
15545
15625
|
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.";
|
|
15546
15626
|
var PART_URI = /^snapshot:\/\/parts\/(\d+)$/;
|
|
15547
15627
|
var REPORT_URIS = /* @__PURE__ */ new Map([
|
|
@@ -15592,6 +15672,13 @@ function buildResourceProvider() {
|
|
|
15592
15672
|
title: "Agent skill",
|
|
15593
15673
|
description: "Usage guidance for an agent working with this tool.",
|
|
15594
15674
|
mimeType: "text/markdown"
|
|
15675
|
+
},
|
|
15676
|
+
{
|
|
15677
|
+
uri: PROMPT_URI,
|
|
15678
|
+
name: "prompt",
|
|
15679
|
+
title: "Snapshot brief",
|
|
15680
|
+
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.",
|
|
15681
|
+
mimeType: "text/markdown"
|
|
15595
15682
|
}
|
|
15596
15683
|
];
|
|
15597
15684
|
for (const [uri, report] of REPORT_URIS) {
|
|
@@ -15656,6 +15743,13 @@ function buildResourceProvider() {
|
|
|
15656
15743
|
}
|
|
15657
15744
|
const workspace = await workspaceFor(context);
|
|
15658
15745
|
if ("error" in workspace) return null;
|
|
15746
|
+
if (uri === PROMPT_URI) {
|
|
15747
|
+
const text2 = readFileIfPresent(
|
|
15748
|
+
path17__namespace.resolve(workspace.root, workspace.config.outDir, "PROMPT.md")
|
|
15749
|
+
);
|
|
15750
|
+
if (text2 === null) return null;
|
|
15751
|
+
return { uri, mimeType: "text/markdown", text: ensureSingleRead(uri, text2, PROMPT_ADVICE) };
|
|
15752
|
+
}
|
|
15659
15753
|
const report = REPORT_URIS.get(uri);
|
|
15660
15754
|
if (report) {
|
|
15661
15755
|
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-GIWY4HXZ.js';
|
|
2
|
+
export { buildAgentContract } from './chunk-GIWY4HXZ.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-DEFKIYRZ.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|