codebase-snapshot 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +622 -0
- package/README.md +3 -2
- package/SECURITY.md +2 -2
- package/dist/bin.js +505 -269
- package/dist/{chunk-VI3JLKPX.js → chunk-IZPCJYZU.js} +3 -3
- package/dist/{chunk-PDLN24ZZ.js → chunk-VMRKUSXL.js} +354 -157
- package/dist/cli.cjs +401 -168
- package/dist/cli.d.cts +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/cli.js +42 -4
- package/dist/{generate-worker-B79yGkQO.d.cts → generate-worker-C6Z1I0XS.d.cts} +3 -0
- package/dist/{generate-worker-B79yGkQO.d.ts → generate-worker-C6Z1I0XS.d.ts} +3 -0
- package/dist/index.cjs +313 -116
- package/dist/index.d.cts +27 -9
- package/dist/index.d.ts +27 -9
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +292 -92
- package/dist/mcp.d.cts +22 -2
- package/dist/mcp.d.ts +22 -2
- package/dist/mcp.js +2 -2
- package/dist/{types-Cr5H2Y3t.d.cts → types-Drw1J0e0.d.cts} +8 -0
- package/dist/{types-Cr5H2Y3t.d.ts → types-Drw1J0e0.d.ts} +8 -0
- package/docs/agent.md +2 -2
- package/docs/answer.md +3 -0
- package/docs/benchmarks.md +4 -2
- package/docs/cli.md +39 -10
- package/docs/configuration.md +1 -1
- package/docs/health.md +29 -18
- package/docs/mcp.md +12 -10
- package/docs/output.md +5 -3
- package/docs/security-review.md +2 -2
- package/docs/serve.md +20 -4
- package/docs/signing.md +3 -1
- package/docs/tools.md +13 -2
- package/package.json +1 -1
package/dist/cli.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-Drw1J0e0.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
|
@@ -125,7 +125,7 @@ interface AgentContract {
|
|
|
125
125
|
/** Builds the contract document. Cheap enough to call on every `describe`. */
|
|
126
126
|
declare function buildAgentContract(): AgentContract;
|
|
127
127
|
|
|
128
|
-
type Command = "generate" | "validate" | "health" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill" | "mcp" | "serve";
|
|
128
|
+
type Command = "generate" | "validate" | "health" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill" | "mcp" | "update" | "serve";
|
|
129
129
|
declare const CLI_OPTIONS: {
|
|
130
130
|
readonly cwd: {
|
|
131
131
|
readonly type: "string";
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-Drw1J0e0.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
|
@@ -125,7 +125,7 @@ interface AgentContract {
|
|
|
125
125
|
/** Builds the contract document. Cheap enough to call on every `describe`. */
|
|
126
126
|
declare function buildAgentContract(): AgentContract;
|
|
127
127
|
|
|
128
|
-
type Command = "generate" | "validate" | "health" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill" | "mcp" | "serve";
|
|
128
|
+
type Command = "generate" | "validate" | "health" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill" | "mcp" | "update" | "serve";
|
|
129
129
|
declare const CLI_OPTIONS: {
|
|
130
130
|
readonly cwd: {
|
|
131
131
|
readonly type: "string";
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { startHttpTransport } from './chunk-
|
|
2
|
-
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-
|
|
3
|
-
export { buildAgentContract } from './chunk-
|
|
1
|
+
import { startHttpTransport } from './chunk-IZPCJYZU.js';
|
|
2
|
+
import { shouldCheck, checkForUpdate, GENERATOR_VERSION, cacheFilePath, formatUpdateNotice, installKind, buildAgentContract, startWebServer, runStdioServer, parseRemoteSource, assertPublicHost, cloneRepository, makeCloneDirectory, loadConfigFileDetailed, resolveConfig, validateSnapshot, auditSnapshot, describeManifestShapeProblem, explainPath, compareManifests, loadManifest, renderDiffText, generateSnapshot, getGitInfo, signManifest, loadSigningKey, writeSignature, formatNumber, isDiscoveryMode, ARTIFACT_NAMES, COMMAND_OPTION_SCOPE, commandsForOption, getPreset, unknownPresetMessage, GENERATOR_NAME, runInit, installPreCommitHook, PromptCancelled, SKILL_NAME, renderSkill, resolveLatest, isNewer, updateCommand, findConfigFile, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS, firstRunMessage, stripJsonComments, parseByteSize, gitignorePath, appendGitignoreEntries, escapeControls, runWithStdoutCapture, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderContractText, renderExplainText } from './chunk-VMRKUSXL.js';
|
|
3
|
+
export { buildAgentContract } from './chunk-VMRKUSXL.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs2 from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|
|
@@ -109,6 +109,7 @@ var COMMAND_ALIASES = /* @__PURE__ */ new Map([
|
|
|
109
109
|
["describe", "describe"],
|
|
110
110
|
["skill", "skill"],
|
|
111
111
|
["mcp", "mcp"],
|
|
112
|
+
["update", "update"],
|
|
112
113
|
["serve", "serve"]
|
|
113
114
|
]);
|
|
114
115
|
var COMMAND_ARITY = {
|
|
@@ -123,6 +124,7 @@ var COMMAND_ARITY = {
|
|
|
123
124
|
describe: 0,
|
|
124
125
|
skill: 0,
|
|
125
126
|
mcp: 0,
|
|
127
|
+
update: 0,
|
|
126
128
|
serve: 0
|
|
127
129
|
};
|
|
128
130
|
var CLI_OPTIONS = {
|
|
@@ -218,6 +220,7 @@ Commands:
|
|
|
218
220
|
explain <path> Show how one path would be treated: layer, kind, part, skips
|
|
219
221
|
diff <a> <b> Compare two snapshots (directories or manifest.json files)
|
|
220
222
|
describe Print the machine-readable contract (--format json for agents)
|
|
223
|
+
update Ask the registry whether a newer release exists (exit 1 if one does)
|
|
221
224
|
skill Print the bundled agent skill; --install writes it into the repo
|
|
222
225
|
mcp Serve this repository to an MCP client (stdio, or --http for the web)
|
|
223
226
|
serve Open a browser UI: generate, preview, download a zip; MCP at /mcp
|
|
@@ -1060,6 +1063,37 @@ async function firstRun(invocation) {
|
|
|
1060
1063
|
);
|
|
1061
1064
|
return await runSetupCommand(invocation, { interactive: plan.interactive });
|
|
1062
1065
|
}
|
|
1066
|
+
async function runUpdateCommand(invocation) {
|
|
1067
|
+
const current = GENERATOR_VERSION;
|
|
1068
|
+
const latestUrl = process.env.CODEBASE_SNAPSHOT_REGISTRY_URL;
|
|
1069
|
+
const latest = await resolveLatest({
|
|
1070
|
+
current,
|
|
1071
|
+
cacheFile: cacheFilePath(),
|
|
1072
|
+
force: true,
|
|
1073
|
+
...latestUrl === void 0 || latestUrl === "" ? {} : { latestUrl }
|
|
1074
|
+
});
|
|
1075
|
+
if (latest === null) {
|
|
1076
|
+
emit(invocation.format, { current, latest: null, updateAvailable: false }, () => {
|
|
1077
|
+
info(
|
|
1078
|
+
"Could not reach the npm registry, so the installed version could not be compared. Nothing was changed; try again when the network is available."
|
|
1079
|
+
);
|
|
1080
|
+
});
|
|
1081
|
+
return 2;
|
|
1082
|
+
}
|
|
1083
|
+
const kind = installKind();
|
|
1084
|
+
const updateAvailable = isNewer(latest, current);
|
|
1085
|
+
const command = updateCommand(kind);
|
|
1086
|
+
emit(invocation.format, { current, latest, updateAvailable, command }, () => {
|
|
1087
|
+
if (updateAvailable) {
|
|
1088
|
+
info(formatUpdateNotice({ current, latest }, kind));
|
|
1089
|
+
} else {
|
|
1090
|
+
info(
|
|
1091
|
+
`You are on codebase-snapshot ${current}, and the registry publishes ${latest}. No update is available.`
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
return updateAvailable ? 1 : 0;
|
|
1096
|
+
}
|
|
1063
1097
|
function runSkillCommand(invocation) {
|
|
1064
1098
|
if (!invocation.install) {
|
|
1065
1099
|
if (invocation.format === "json") {
|
|
@@ -1201,6 +1235,9 @@ ${USAGE}
|
|
|
1201
1235
|
if (invocation.command === "skill") {
|
|
1202
1236
|
return runSkillCommand(invocation);
|
|
1203
1237
|
}
|
|
1238
|
+
if (invocation.command === "update") {
|
|
1239
|
+
return runUpdateCommand(invocation);
|
|
1240
|
+
}
|
|
1204
1241
|
if (invocation.command === "serve") {
|
|
1205
1242
|
const server = await startWebServer({
|
|
1206
1243
|
cwd: path2.resolve(invocation.cwd),
|
|
@@ -1618,8 +1655,9 @@ ${USAGE}
|
|
|
1618
1655
|
}
|
|
1619
1656
|
const started = performance.now();
|
|
1620
1657
|
info(`\u{1F4F8} ${invocation.dryRun ? "Planning snapshot (dry run)" : "Generating snapshot"} for: ${resolved.cwd}`);
|
|
1658
|
+
const headerGit = getGitInfo(resolved.cwd, resolved.branch);
|
|
1621
1659
|
info(
|
|
1622
|
-
` Branch: ${resolved.branch} | Part budget: ${(resolved.maxPartBytes / 1024).toFixed(0)} KB | Generator: ${GENERATOR_VERSION} (${generatorOrigin(resolved.cwd)})`
|
|
1660
|
+
` Branch: ${resolved.branch}${headerGit.branchFromGit ? "" : " (fallback)"} | Part budget: ${(resolved.maxPartBytes / 1024).toFixed(0)} KB | Generator: ${GENERATOR_VERSION} (${generatorOrigin(resolved.cwd)})`
|
|
1623
1661
|
);
|
|
1624
1662
|
try {
|
|
1625
1663
|
let deltaBase;
|
|
@@ -23,6 +23,9 @@ interface WorkspaceCliOptions {
|
|
|
23
23
|
stripComments?: true;
|
|
24
24
|
removeEmptyLines?: true;
|
|
25
25
|
pack?: "single" | "xml" | "json";
|
|
26
|
+
/** Per-run narrowing, as the CLI's `--only` and `--ignore`; the config's lists are the default. */
|
|
27
|
+
only?: string[];
|
|
28
|
+
ignore?: string[];
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/** What the caller needs from a finished run; the whole manifest can be megabytes. */
|
|
@@ -23,6 +23,9 @@ interface WorkspaceCliOptions {
|
|
|
23
23
|
stripComments?: true;
|
|
24
24
|
removeEmptyLines?: true;
|
|
25
25
|
pack?: "single" | "xml" | "json";
|
|
26
|
+
/** Per-run narrowing, as the CLI's `--only` and `--ignore`; the config's lists are the default. */
|
|
27
|
+
only?: string[];
|
|
28
|
+
ignore?: string[];
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
/** What the caller needs from a finished run; the whole manifest can be megabytes. */
|