codebase-snapshot 0.20.4 → 0.20.5

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, C as CliOptions, 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-DnYsA6_Y.cjs';
2
2
 
3
3
  /**
4
4
  * The machine-readable description of this tool.
@@ -460,6 +460,8 @@ declare function parsePositiveInteger(raw: string | undefined, optionName: strin
460
460
  * as well as raw byte counts.
461
461
  */
462
462
  declare function parseByteOption(raw: string | undefined, optionName: string, minimum: number, unit?: string): number | undefined;
463
+ /** Parses a TCP port, where 0 is the documented "pick an ephemeral port" value. */
464
+ declare function parsePort(raw: string | undefined): number | undefined;
463
465
  /**
464
466
  * Parses a whole-number option such as `--attachment-slots 20`.
465
467
  *
@@ -586,4 +588,4 @@ declare function watchPathsFor(config: ResolvedSnapshotConfig): WatchPaths;
586
588
  */
587
589
  declare function watchSupportProblem(platform?: string, version?: string): string | null;
588
590
 
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 };
591
+ 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, parsePort, parsePositiveInteger, watchPathsFor, watchSupportProblem };
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { O as OutputFormat, P as PromptTask, D as DiscoveryMode, C as CliOptions, 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-DnYsA6_Y.js';
2
2
 
3
3
  /**
4
4
  * The machine-readable description of this tool.
@@ -460,6 +460,8 @@ declare function parsePositiveInteger(raw: string | undefined, optionName: strin
460
460
  * as well as raw byte counts.
461
461
  */
462
462
  declare function parseByteOption(raw: string | undefined, optionName: string, minimum: number, unit?: string): number | undefined;
463
+ /** Parses a TCP port, where 0 is the documented "pick an ephemeral port" value. */
464
+ declare function parsePort(raw: string | undefined): number | undefined;
463
465
  /**
464
466
  * Parses a whole-number option such as `--attachment-slots 20`.
465
467
  *
@@ -586,4 +588,4 @@ declare function watchPathsFor(config: ResolvedSnapshotConfig): WatchPaths;
586
588
  */
587
589
  declare function watchSupportProblem(platform?: string, version?: string): string | null;
588
590
 
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 };
591
+ 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, parsePort, parsePositiveInteger, watchPathsFor, watchSupportProblem };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
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';
1
+ import { startHttpTransport } from './chunk-HYTY6T7P.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-C3WVC4FV.js';
3
+ export { buildAgentContract } from './chunk-C3WVC4FV.js';
4
4
  import { spawnSync } from 'child_process';
5
5
  import * as fs2 from 'fs';
6
6
  import * as path2 from 'path';
@@ -341,6 +341,13 @@ function parseByteOption(raw, optionName, minimum, unit = "byte count") {
341
341
  }
342
342
  return value;
343
343
  }
344
+ function parsePort(raw) {
345
+ const value = parsePositiveInteger(raw, "port", 0);
346
+ if (value !== void 0 && value > 65535) {
347
+ throw new UsageError(`--port must be at most 65535, received "${raw}".`);
348
+ }
349
+ return value;
350
+ }
344
351
  function parseCountOption(raw, optionName, minimum = 0) {
345
352
  if (raw === void 0) return void 0;
346
353
  const trimmed = raw.trim();
@@ -629,7 +636,7 @@ function parseCliArgs(argv) {
629
636
  sarif: values.sarif === true ? true : void 0,
630
637
  strict: values.strict === true ? true : void 0,
631
638
  http: values.http === true ? true : void 0,
632
- port: parsePositiveInteger(values.port, "port", 1),
639
+ port: parsePort(values.port),
633
640
  host: values.host === void 0 ? void 0 : String(values.host),
634
641
  token: values.token === void 0 ? void 0 : String(values.token),
635
642
  noAuth: values["no-auth"] === true ? true : void 0,
@@ -1598,6 +1605,14 @@ ${USAGE}
1598
1605
  );
1599
1606
  }
1600
1607
  const outRoot = path2.resolve(invocation.cwd, invocation.outDir ?? "snapshot");
1608
+ const workspaceCwd = path2.resolve(invocation.cwd);
1609
+ const outRootRelative = path2.relative(outRoot, workspaceCwd);
1610
+ if (outRootRelative === "" || !outRootRelative.startsWith("..") && !path2.isAbsolute(outRootRelative)) {
1611
+ return fail(
1612
+ invocation.format,
1613
+ `--workspace refuses --out-dir ${outRoot}: it is the working directory or one of its ancestors.`
1614
+ );
1615
+ }
1601
1616
  const records = [];
1602
1617
  let failed = 0;
1603
1618
  for (const member of members) {
@@ -1617,7 +1632,10 @@ ${USAGE}
1617
1632
  continue;
1618
1633
  }
1619
1634
  try {
1620
- const manifest = generateSnapshot({ cwd: directory, outDir: path2.join(outRoot, name) });
1635
+ const manifest = generateSnapshot(
1636
+ { cwd: directory, outDir: path2.join(outRoot, name) },
1637
+ { dryRun: invocation.dryRun }
1638
+ );
1621
1639
  records.push({
1622
1640
  name,
1623
1641
  path: directory,
@@ -1633,7 +1651,7 @@ ${USAGE}
1633
1651
  failed += 1;
1634
1652
  }
1635
1653
  }
1636
- fs2.mkdirSync(outRoot, { recursive: true });
1654
+ if (!invocation.dryRun) fs2.mkdirSync(outRoot, { recursive: true });
1637
1655
  const links = [];
1638
1656
  for (const record of records) {
1639
1657
  const counts = /* @__PURE__ */ new Map();
@@ -1663,9 +1681,17 @@ ${USAGE}
1663
1681
  members: records.map(({ imports: _imports, ...rest }) => rest),
1664
1682
  links
1665
1683
  };
1666
- fs2.writeFileSync(path2.join(outRoot, "WORKSPACE.json"), JSON.stringify(document, null, 2) + "\n", "utf8");
1684
+ if (!invocation.dryRun) {
1685
+ fs2.writeFileSync(
1686
+ path2.join(outRoot, "WORKSPACE.json"),
1687
+ JSON.stringify(document, null, 2) + "\n",
1688
+ "utf8"
1689
+ );
1690
+ }
1667
1691
  emit(invocation.format, document, () => {
1668
- info("\n\u{1F5C2} Workspace: " + records.length + " of " + members.length + " member(s) written under " + outRoot);
1692
+ info(
1693
+ "\n\u{1F5C2} Workspace: " + records.length + " of " + members.length + (invocation.dryRun ? " member(s) planned; nothing was written." : " member(s) written under " + outRoot)
1694
+ );
1669
1695
  for (const record of records) {
1670
1696
  info(" - " + record.name + " (" + record.fingerprint.slice(0, 12) + ")");
1671
1697
  }
@@ -2039,4 +2065,4 @@ if (invokedDirectly) {
2039
2065
  );
2040
2066
  }
2041
2067
 
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 };
2068
+ export { CLI_OPTIONS, UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, beginWatchRun, cleanInstallEnv, decideWatchEvent, finishWatchRun, generateCliOptions, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parseCountOption, parsePort, parsePositiveInteger, watchPathsFor, watchSupportProblem };