codebase-snapshot 0.20.3 → 0.20.4

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/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-Drw1J0e0.cjs';
1
+ import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, C as CliOptions, R as ResolvedSnapshotConfig } from './types-Drw1J0e0.cjs';
2
2
 
3
3
  /**
4
4
  * The machine-readable description of this tool.
@@ -495,6 +495,18 @@ declare function cleanInstallEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
495
495
  * to the payload, and a JSON consumer must never have to parse a suggestion.
496
496
  */
497
497
  declare function main(argv?: string[]): Promise<number>;
498
+ /** The command itself. Every early return here is a finished invocation. */
499
+ /**
500
+ * The generate-scoped options a CLI invocation carries.
501
+ *
502
+ * runCommand built this object by hand and runWatchLoop built a second, shorter copy. Every flag
503
+ * added after the watch loop was written worked once and disappeared on the first file edit:
504
+ * --only, --strip-comments, --token-tree, --include-diffs, --include-logs, --pack and --sign.
505
+ * One builder makes the two paths agree by construction.
506
+ */
507
+ declare function generateCliOptions(invocation: ParsedInvocation): Partial<CliOptions> & {
508
+ discovery?: DiscoveryMode;
509
+ };
498
510
  /** Coalesce bursts of filesystem events into one run. */
499
511
  declare const WATCH_DEBOUNCE_MS = 250;
500
512
  /**
@@ -574,4 +586,4 @@ declare function watchPathsFor(config: ResolvedSnapshotConfig): WatchPaths;
574
586
  */
575
587
  declare function watchSupportProblem(platform?: string, version?: string): string | null;
576
588
 
577
- export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, buildAgentContract, cleanInstallEnv, decideWatchEvent, finishWatchRun, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
589
+ export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, buildAgentContract, cleanInstallEnv, decideWatchEvent, finishWatchRun, generateCliOptions, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
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-Drw1J0e0.js';
1
+ import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, C as CliOptions, R as ResolvedSnapshotConfig } from './types-Drw1J0e0.js';
2
2
 
3
3
  /**
4
4
  * The machine-readable description of this tool.
@@ -495,6 +495,18 @@ declare function cleanInstallEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
495
495
  * to the payload, and a JSON consumer must never have to parse a suggestion.
496
496
  */
497
497
  declare function main(argv?: string[]): Promise<number>;
498
+ /** The command itself. Every early return here is a finished invocation. */
499
+ /**
500
+ * The generate-scoped options a CLI invocation carries.
501
+ *
502
+ * runCommand built this object by hand and runWatchLoop built a second, shorter copy. Every flag
503
+ * added after the watch loop was written worked once and disappeared on the first file edit:
504
+ * --only, --strip-comments, --token-tree, --include-diffs, --include-logs, --pack and --sign.
505
+ * One builder makes the two paths agree by construction.
506
+ */
507
+ declare function generateCliOptions(invocation: ParsedInvocation): Partial<CliOptions> & {
508
+ discovery?: DiscoveryMode;
509
+ };
498
510
  /** Coalesce bursts of filesystem events into one run. */
499
511
  declare const WATCH_DEBOUNCE_MS = 250;
500
512
  /**
@@ -574,4 +586,4 @@ declare function watchPathsFor(config: ResolvedSnapshotConfig): WatchPaths;
574
586
  */
575
587
  declare function watchSupportProblem(platform?: string, version?: string): string | null;
576
588
 
577
- export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, buildAgentContract, cleanInstallEnv, decideWatchEvent, finishWatchRun, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
589
+ export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, buildAgentContract, cleanInstallEnv, decideWatchEvent, finishWatchRun, generateCliOptions, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
- import { startHttpTransport } from './chunk-TUL3I7O6.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-7JQRJBMP.js';
3
- export { buildAgentContract } from './chunk-7JQRJBMP.js';
1
+ import { startHttpTransport } from './chunk-QB5TNXMZ.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, loadSigningKey, SIGNATURE_FILE, 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-AQZNT3QL.js';
3
+ export { buildAgentContract } from './chunk-AQZNT3QL.js';
4
4
  import { spawnSync } from 'child_process';
5
5
  import * as fs2 from 'fs';
6
6
  import * as path2 from 'path';
@@ -1210,6 +1210,42 @@ ${formatUpdateNotice(notice, installKind())}
1210
1210
  }
1211
1211
  return code;
1212
1212
  }
1213
+ function generateCliOptions(invocation) {
1214
+ return {
1215
+ mode: invocation.command,
1216
+ format: invocation.format,
1217
+ dryRun: invocation.dryRun,
1218
+ cwd: invocation.cwd,
1219
+ outDir: invocation.outDir,
1220
+ includeMonolith: invocation.includeMonolith,
1221
+ includeSensitiveFiles: invocation.includeSensitiveFiles,
1222
+ maxPartBytes: invocation.maxPartBytes,
1223
+ maxPartTokens: invocation.maxPartTokens,
1224
+ largeFileBytes: invocation.largeFileBytes,
1225
+ maxMonolithBytes: invocation.maxMonolithBytes,
1226
+ attachmentSlots: invocation.attachmentSlots,
1227
+ maxParts: invocation.maxParts,
1228
+ ...invocation.includeDiffs === true ? { includeDiffs: true } : {},
1229
+ ...invocation.includeLogs === void 0 ? {} : { includeLogs: invocation.includeLogs },
1230
+ ...invocation.tokenTree === true ? { tokenTree: true } : {},
1231
+ ...invocation.stripComments === true ? { stripComments: true } : {},
1232
+ ...invocation.removeEmptyLines === true ? { removeEmptyLines: true } : {},
1233
+ ...invocation.only === void 0 ? {} : { only: invocation.only },
1234
+ ...invocation.ignore === void 0 ? {} : { ignore: invocation.ignore },
1235
+ ...invocation.pack === void 0 ? {} : { pack: invocation.pack },
1236
+ ...invocation.sign === true ? { sign: true } : {},
1237
+ brief: invocation.brief,
1238
+ promptTask: invocation.promptTask,
1239
+ skipArtifacts: invocation.skipArtifacts,
1240
+ onlyArtifacts: invocation.onlyArtifacts,
1241
+ discovery: invocation.discovery,
1242
+ changedSince: invocation.changedSince,
1243
+ staged: invocation.staged,
1244
+ withDependents: invocation.withDependents,
1245
+ skeleton: invocation.skeleton,
1246
+ sarif: invocation.sarif
1247
+ };
1248
+ }
1213
1249
  async function runCommand(argv) {
1214
1250
  let invocation;
1215
1251
  try {
@@ -1363,42 +1399,7 @@ ${USAGE}
1363
1399
  try {
1364
1400
  resolved = resolveConfig(
1365
1401
  loaded.config,
1366
- {
1367
- mode: invocation.command,
1368
- format: invocation.format,
1369
- dryRun: invocation.dryRun,
1370
- cwd: invocation.cwd,
1371
- outDir: invocation.outDir,
1372
- includeMonolith: invocation.includeMonolith,
1373
- includeSensitiveFiles: invocation.includeSensitiveFiles,
1374
- maxPartBytes: invocation.maxPartBytes,
1375
- maxPartTokens: invocation.maxPartTokens,
1376
- largeFileBytes: invocation.largeFileBytes,
1377
- maxMonolithBytes: invocation.maxMonolithBytes,
1378
- attachmentSlots: invocation.attachmentSlots,
1379
- maxParts: invocation.maxParts,
1380
- ...invocation.includeDiffs === true ? { includeDiffs: true } : {},
1381
- ...invocation.includeLogs === void 0 ? {} : { includeLogs: invocation.includeLogs },
1382
- ...invocation.tokenTree === true ? { tokenTree: true } : {},
1383
- ...invocation.stripComments === true ? { stripComments: true } : {},
1384
- ...invocation.removeEmptyLines === true ? { removeEmptyLines: true } : {},
1385
- ...invocation.only === void 0 ? {} : { only: invocation.only },
1386
- ...invocation.ignore === void 0 ? {} : { ignore: invocation.ignore },
1387
- ...invocation.pack === void 0 ? {} : { pack: invocation.pack },
1388
- brief: invocation.brief,
1389
- promptTask: invocation.promptTask,
1390
- skipArtifacts: invocation.skipArtifacts,
1391
- // `--only-artifacts` is forwarded as itself, not only as the derived suppression list:
1392
- // suppression cannot switch an artifact *on*, so a config that had turned one of the
1393
- // requested artifacts off left the run with nothing to write.
1394
- onlyArtifacts: invocation.onlyArtifacts,
1395
- discovery: invocation.discovery,
1396
- changedSince: invocation.changedSince,
1397
- staged: invocation.staged,
1398
- withDependents: invocation.withDependents,
1399
- skeleton: invocation.skeleton,
1400
- sarif: invocation.sarif
1401
- },
1402
+ generateCliOptions(invocation),
1402
1403
  invocation.cwd
1403
1404
  );
1404
1405
  } catch (err) {
@@ -1434,7 +1435,11 @@ ${USAGE}
1434
1435
  rows.push({ name, score: 0, counts: { pass: 0, warn: 0, fail: 1 }, failed: [], error: "no snapshot at " + snapshotDir2 });
1435
1436
  continue;
1436
1437
  }
1437
- const report2 = auditSnapshot({ snapshotDir: snapshotDir2, repoDir });
1438
+ const report2 = auditSnapshot({
1439
+ snapshotDir: snapshotDir2,
1440
+ repoDir,
1441
+ ...invocation.deep === true ? { deep: true } : {}
1442
+ });
1438
1443
  rows.push({
1439
1444
  name,
1440
1445
  score: report2.score,
@@ -1576,6 +1581,12 @@ ${USAGE}
1576
1581
  if (invocation.watch) {
1577
1582
  const problem = watchSupportProblem();
1578
1583
  if (problem !== null) return fail(invocation.format, problem);
1584
+ if (invocation.delta !== void 0) {
1585
+ return fail(
1586
+ invocation.format,
1587
+ "--watch cannot track a fixed --delta base; run a one-shot generate --delta, or watch without it."
1588
+ );
1589
+ }
1579
1590
  }
1580
1591
  if (invocation.workspace !== void 0) {
1581
1592
  const members = invocation.workspace.split(",").map((member) => member.trim()).filter((member) => member.length > 0);
@@ -1701,16 +1712,18 @@ ${USAGE}
1701
1712
  question: invocation.slice,
1702
1713
  ...invocation.sliceTokens === void 0 ? {} : { maxTokens: invocation.sliceTokens }
1703
1714
  }
1704
- }
1715
+ },
1716
+ ...invocation.sign === true && !invocation.dryRun ? { sign: { key: loadSigningKey() } } : {}
1705
1717
  });
1706
1718
  if (invocation.sign === true && !invocation.dryRun) {
1707
- const manifestPath = path2.resolve(resolved.cwd, resolved.outDir, "manifest.json");
1719
+ const signaturePath = path2.resolve(resolved.cwd, resolved.outDir, SIGNATURE_FILE);
1708
1720
  try {
1709
- const record = signManifest(manifestPath, { key: loadSigningKey() });
1710
- writeSignature(path2.dirname(manifestPath), record);
1711
- info(" Signature: ed25519, " + record.keyOrigin + " key, " + record.fingerprint.slice(0, 12));
1721
+ const record = JSON.parse(fs2.readFileSync(signaturePath, "utf8"));
1722
+ info(
1723
+ " Signature: ed25519, " + (record.keyOrigin ?? "unknown") + " key, " + (record.fingerprint ?? manifest.fingerprint).slice(0, 12)
1724
+ );
1712
1725
  } catch (error) {
1713
- return fail(invocation.format, "Signing failed: " + error.message);
1726
+ return fail(invocation.format, "The snapshot was written but its signature could not be read: " + error.message);
1714
1727
  }
1715
1728
  }
1716
1729
  const elapsed = ((performance.now() - started) / 1e3).toFixed(2);
@@ -1938,34 +1951,20 @@ async function runWatchLoop(invocation, resolved, options) {
1938
1951
  for (const warning of loaded.warnings) warn(`\u26A0 Config: ${warning}`);
1939
1952
  const next = resolveConfig(
1940
1953
  loaded.config,
1941
- {
1942
- mode: invocation.command,
1943
- format: invocation.format,
1944
- dryRun: invocation.dryRun,
1945
- cwd: invocation.cwd,
1946
- outDir: invocation.outDir,
1947
- includeMonolith: invocation.includeMonolith,
1948
- includeSensitiveFiles: invocation.includeSensitiveFiles,
1949
- maxPartBytes: invocation.maxPartBytes,
1950
- maxPartTokens: invocation.maxPartTokens,
1951
- largeFileBytes: invocation.largeFileBytes,
1952
- maxMonolithBytes: invocation.maxMonolithBytes,
1953
- attachmentSlots: invocation.attachmentSlots,
1954
- maxParts: invocation.maxParts,
1955
- brief: invocation.brief,
1956
- promptTask: invocation.promptTask,
1957
- skipArtifacts: invocation.skipArtifacts,
1958
- onlyArtifacts: invocation.onlyArtifacts,
1959
- discovery: invocation.discovery,
1960
- changedSince: invocation.changedSince,
1961
- staged: invocation.staged,
1962
- withDependents: invocation.withDependents,
1963
- skeleton: invocation.skeleton,
1964
- sarif: invocation.sarif
1965
- },
1954
+ generateCliOptions(invocation),
1966
1955
  invocation.cwd
1967
1956
  );
1968
- const manifest = generateSnapshot(next, { dryRun: invocation.dryRun });
1957
+ const manifest = generateSnapshot(next, {
1958
+ dryRun: invocation.dryRun,
1959
+ ...invocation.budgetTokens === void 0 ? {} : { budgetTokens: invocation.budgetTokens },
1960
+ ...invocation.slice === void 0 ? {} : {
1961
+ slice: {
1962
+ question: invocation.slice,
1963
+ ...invocation.sliceTokens === void 0 ? {} : { maxTokens: invocation.sliceTokens }
1964
+ }
1965
+ },
1966
+ ...invocation.sign === true && !invocation.dryRun ? { sign: { key: loadSigningKey() } } : {}
1967
+ });
1969
1968
  paths = watchPathsFor(next);
1970
1969
  const elapsed = ((performance.now() - started) / 1e3).toFixed(2);
1971
1970
  info(
@@ -2040,4 +2039,4 @@ if (invokedDirectly) {
2040
2039
  );
2041
2040
  }
2042
2041
 
2043
- export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, beginWatchRun, cleanInstallEnv, decideWatchEvent, finishWatchRun, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
2042
+ export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, beginWatchRun, cleanInstallEnv, decideWatchEvent, finishWatchRun, generateCliOptions, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePositiveInteger, watchPathsFor, watchSupportProblem };
@@ -96,6 +96,10 @@ declare function generateInWorker(cwd: string, cliOptions: WorkspaceCliOptions,
96
96
  };
97
97
  budgetTokens?: number;
98
98
  };
99
+ /** Identity the parent can name when the worker is terminated mid-run. */
100
+ runId?: string;
101
+ /** Directories whose locks/staging this run may own; used only for abandoned-worker cleanup. */
102
+ lockRoots?: readonly string[];
99
103
  }): Promise<WorkerResults>;
100
104
 
101
105
  export { type GenerateSummary as G, type WorkerResults as W, generateInWorker as g, workerEntry as w };
@@ -96,6 +96,10 @@ declare function generateInWorker(cwd: string, cliOptions: WorkspaceCliOptions,
96
96
  };
97
97
  budgetTokens?: number;
98
98
  };
99
+ /** Identity the parent can name when the worker is terminated mid-run. */
100
+ runId?: string;
101
+ /** Directories whose locks/staging this run may own; used only for abandoned-worker cleanup. */
102
+ lockRoots?: readonly string[];
99
103
  }): Promise<WorkerResults>;
100
104
 
101
105
  export { type GenerateSummary as G, type WorkerResults as W, generateInWorker as g, workerEntry as w };