codebase-snapshot 0.9.12 → 0.9.15
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 +513 -0
- package/README.md +2 -2
- package/SECURITY.md +23 -5
- package/dist/bin.js +2021 -953
- package/dist/{chunk-5OR3WVPW.js → chunk-AU2VNTUU.js} +663 -467
- package/dist/{chunk-3H45YMBG.js → chunk-JL4VDGXL.js} +1666 -765
- package/dist/cli.cjs +2006 -941
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +136 -110
- package/dist/{generate-worker-D5Xgh27c.d.cts → generate-worker-D_mUjgXw.d.cts} +21 -5
- package/dist/{generate-worker-D5Xgh27c.d.ts → generate-worker-D_mUjgXw.d.ts} +21 -5
- package/dist/index.cjs +1642 -758
- package/dist/index.d.cts +58 -35
- package/dist/index.d.ts +58 -35
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +4873 -3981
- package/dist/mcp.d.cts +77 -67
- package/dist/mcp.d.ts +77 -67
- package/dist/mcp.js +2 -2
- package/dist/{types-CTewen3J.d.cts → types-DIX6zWSt.d.cts} +15 -0
- package/dist/{types-CTewen3J.d.ts → types-DIX6zWSt.d.ts} +15 -0
- package/docs/cli.md +76 -48
- package/docs/configuration.md +81 -22
- package/docs/install.md +4 -3
- package/docs/mcp.md +43 -6
- package/docs/output.md +51 -9
- package/docs/stale-context-is-your-bug.md +4 -3
- package/docs/troubleshooting.md +32 -8
- package/docs/vs-code2prompt.md +1 -1
- package/docs/vs-gitingest.md +1 -1
- package/docs/vs-repomix.md +1 -1
- package/package.json +1 -2
package/dist/cli.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-DIX6zWSt.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as OutputFormat, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-
|
|
1
|
+
import { O as OutputFormat, D as DiscoveryMode, R as ResolvedSnapshotConfig } from './types-DIX6zWSt.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The machine-readable description of this tool.
|
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, planFirstRun, isEffectivelyEmpty, isInteractive, defaultIO, hasPriorSnapshot, DEFAULT_ANSWERS,
|
|
1
|
+
import { buildAgentContract, runStdioServer, COMMAND_OPTION_SCOPE, commandsForOption, SKILL_NAME, renderSkill, renderContractText } from './chunk-AU2VNTUU.js';
|
|
2
|
+
export { buildAgentContract } from './chunk-AU2VNTUU.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, parseByteSize, stripJsonComments, gitignorePath, appendGitignoreEntries, runWithStdoutCapture, escapeControls, MIN_MAX_PART_TOKENS, MIN_MAX_PART_BYTES, renderExplainText } from './chunk-JL4VDGXL.js';
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path2 from 'path';
|
|
@@ -357,7 +357,24 @@ function parseCliArgs(argv) {
|
|
|
357
357
|
let args = [];
|
|
358
358
|
const explicitMode = values.mode ? String(values.mode) : void 0;
|
|
359
359
|
const firstPositional = positionals[0];
|
|
360
|
-
|
|
360
|
+
const modeCommand = explicitMode === void 0 ? void 0 : COMMAND_ALIASES.get(explicitMode);
|
|
361
|
+
if (explicitMode !== void 0 && modeCommand === void 0) {
|
|
362
|
+
throw new UsageError(
|
|
363
|
+
`Unknown --mode "${explicitMode}". Expected one of: ${Array.from(COMMAND_ALIASES.keys()).join(", ")}.`
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
if (modeCommand !== void 0) {
|
|
367
|
+
command = modeCommand;
|
|
368
|
+
if (firstPositional !== void 0) {
|
|
369
|
+
const named = COMMAND_ALIASES.get(firstPositional);
|
|
370
|
+
if (named !== void 0 && named !== modeCommand) {
|
|
371
|
+
throw new UsageError(
|
|
372
|
+
`--mode ${explicitMode} contradicts the command "${firstPositional}". Pass one or the other.`
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
args = named !== void 0 ? positionals.slice(1) : positionals;
|
|
376
|
+
}
|
|
377
|
+
} else if (firstPositional !== void 0) {
|
|
361
378
|
const resolved = COMMAND_ALIASES.get(firstPositional);
|
|
362
379
|
if (!resolved) {
|
|
363
380
|
throw new UsageError(
|
|
@@ -366,27 +383,6 @@ function parseCliArgs(argv) {
|
|
|
366
383
|
}
|
|
367
384
|
command = resolved;
|
|
368
385
|
args = positionals.slice(1);
|
|
369
|
-
} else if (explicitMode !== void 0) {
|
|
370
|
-
const resolved = COMMAND_ALIASES.get(explicitMode);
|
|
371
|
-
if (!resolved) {
|
|
372
|
-
throw new UsageError(
|
|
373
|
-
`Unknown --mode "${explicitMode}". Expected one of: ${Array.from(COMMAND_ALIASES.keys()).join(", ")}.`
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
command = resolved;
|
|
377
|
-
}
|
|
378
|
-
if (explicitMode !== void 0) {
|
|
379
|
-
const resolvedMode = COMMAND_ALIASES.get(explicitMode);
|
|
380
|
-
if (!resolvedMode) {
|
|
381
|
-
throw new UsageError(
|
|
382
|
-
`Unknown --mode "${explicitMode}". Expected one of: ${Array.from(COMMAND_ALIASES.keys()).join(", ")}.`
|
|
383
|
-
);
|
|
384
|
-
}
|
|
385
|
-
if (firstPositional !== void 0 && resolvedMode !== command) {
|
|
386
|
-
throw new UsageError(
|
|
387
|
-
`--mode ${explicitMode} contradicts the command "${firstPositional}". Pass one or the other.`
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
386
|
}
|
|
391
387
|
const expectedArgs = COMMAND_ARITY[command];
|
|
392
388
|
if (args.length !== expectedArgs) {
|
|
@@ -576,7 +572,9 @@ function nextStepHint(cwd, scriptsAddedNow) {
|
|
|
576
572
|
let hasScript = scriptsAddedNow;
|
|
577
573
|
if (!hasScript) {
|
|
578
574
|
try {
|
|
579
|
-
const parsed = JSON.parse(
|
|
575
|
+
const parsed = JSON.parse(
|
|
576
|
+
stripJsonComments(fs.readFileSync(path2.join(cwd, "package.json"), "utf8"))
|
|
577
|
+
);
|
|
580
578
|
hasScript = typeof parsed.scripts?.snapshot === "string";
|
|
581
579
|
} catch {
|
|
582
580
|
hasScript = false;
|
|
@@ -677,19 +675,19 @@ function installDependencies(cwd) {
|
|
|
677
675
|
}
|
|
678
676
|
return { manager: manager.name, command, ok: true, detail: seconds };
|
|
679
677
|
}
|
|
680
|
-
async function
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
try {
|
|
688
|
-
const code = await fn();
|
|
689
|
-
return { code, text };
|
|
690
|
-
} finally {
|
|
691
|
-
process.stdout.write = original;
|
|
678
|
+
async function setupHookOutDir(invocation, init) {
|
|
679
|
+
if (!init.reused || invocation.outDir !== void 0) return init.outDir;
|
|
680
|
+
const loaded = await loadConfigFileDetailed(invocation.cwd);
|
|
681
|
+
if (loaded.errors.length > 0) {
|
|
682
|
+
throw new Error(
|
|
683
|
+
`The config file could not be read: ${loaded.errors.join("; ")}. Fix it, or delete it to use the defaults.`
|
|
684
|
+
);
|
|
692
685
|
}
|
|
686
|
+
return resolveConfig(loaded.config, {}, invocation.cwd).outDir;
|
|
687
|
+
}
|
|
688
|
+
async function captureStdout(fn) {
|
|
689
|
+
const { value, text } = await runWithStdoutCapture(fn);
|
|
690
|
+
return { code: value, text };
|
|
693
691
|
}
|
|
694
692
|
async function runSetupCommand(invocation, options = {}) {
|
|
695
693
|
try {
|
|
@@ -720,7 +718,13 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
720
718
|
reuseConfig: true,
|
|
721
719
|
dryRun: invocation.dryRun
|
|
722
720
|
});
|
|
723
|
-
const
|
|
721
|
+
const keptConfigPath = init.reused ? findConfigFile(invocation.cwd) ?? init.configPath : init.configPath;
|
|
722
|
+
const appliedPreset = init.reused ? null : init.preset;
|
|
723
|
+
if (init.reused && invocation.preset !== void 0) {
|
|
724
|
+
init.notes.push(
|
|
725
|
+
`--preset ${invocation.preset} was not applied: the existing config is kept. Edit its preset setting, or run \`init --force\` to write a new one.`
|
|
726
|
+
);
|
|
727
|
+
}
|
|
724
728
|
if (invocation.dryRun) {
|
|
725
729
|
const manager = invocation.noInstall ? null : detectPackageManager(invocation.cwd).name;
|
|
726
730
|
if (invocation.format === "json") {
|
|
@@ -728,9 +732,9 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
728
732
|
`${JSON.stringify(
|
|
729
733
|
{
|
|
730
734
|
dryRun: true,
|
|
731
|
-
configPath:
|
|
735
|
+
configPath: keptConfigPath,
|
|
732
736
|
configReused: init.reused,
|
|
733
|
-
preset:
|
|
737
|
+
preset: appliedPreset,
|
|
734
738
|
install: manager,
|
|
735
739
|
configText: init.configText
|
|
736
740
|
},
|
|
@@ -743,7 +747,7 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
743
747
|
}
|
|
744
748
|
info("\n\u{1F9EA} Dry run \u2014 setup would:");
|
|
745
749
|
info(
|
|
746
|
-
` 1. ${init.reused ? `keep ${path2.basename(
|
|
750
|
+
` 1. ${init.reused ? `keep ${path2.basename(keptConfigPath)}` : `write ${path2.basename(keptConfigPath)} (preset: ${appliedPreset})`}`
|
|
747
751
|
);
|
|
748
752
|
info(" 2. add the npm scripts, the devDependency and the .gitignore entries");
|
|
749
753
|
if (manager !== null) info(` 3. install with ${manager}`);
|
|
@@ -752,12 +756,13 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
752
756
|
info(init.configText);
|
|
753
757
|
return 0;
|
|
754
758
|
}
|
|
759
|
+
const hook = invocation.installHook === true ? installPreCommitHook(invocation.cwd, await setupHookOutDir(invocation, init)) : null;
|
|
755
760
|
if (invocation.format !== "json") {
|
|
756
761
|
if (!interactive) info(`\u{1F680} Setup for: ${invocation.cwd}`);
|
|
757
762
|
if (init.reused) {
|
|
758
|
-
info(`\u267B Keeping ${path2.basename(
|
|
763
|
+
info(`\u267B Keeping ${path2.basename(keptConfigPath)}`);
|
|
759
764
|
} else {
|
|
760
|
-
info(`\u2705 Created ${path2.basename(
|
|
765
|
+
info(`\u2705 Created ${path2.basename(keptConfigPath)} (${presetSummary(init)})`);
|
|
761
766
|
}
|
|
762
767
|
if (init.scripts.length > 0) info(` Added npm scripts: ${init.scripts.join(", ")}`);
|
|
763
768
|
if (init.dependency.added && init.dependency.range !== null) {
|
|
@@ -767,6 +772,9 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
767
772
|
info(` Added to .gitignore: ${init.gitignoreEntries.join(", ")}`);
|
|
768
773
|
}
|
|
769
774
|
if (hook) for (const note of hook.notes) info(` ${note}`);
|
|
775
|
+
if (init.reused && invocation.preset !== void 0) {
|
|
776
|
+
info(` \u26A0 --preset ${invocation.preset} was not applied: the existing config is kept.`);
|
|
777
|
+
}
|
|
770
778
|
}
|
|
771
779
|
let install = null;
|
|
772
780
|
if (invocation.noInstall) {
|
|
@@ -784,7 +792,9 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
784
792
|
if (invocation.includeSensitiveFiles === true) generateArgs.push("--include-sensitive-files");
|
|
785
793
|
const budget = invocation.maxPartBytesRaw ?? invocation.maxPartBytes;
|
|
786
794
|
if (budget !== void 0) generateArgs.push("--max-part-bytes", String(budget));
|
|
787
|
-
if ((invocation.
|
|
795
|
+
if ((invocation.onlyArtifacts ?? []).length > 0) {
|
|
796
|
+
generateArgs.push("--only-artifacts", (invocation.onlyArtifacts ?? []).join(","));
|
|
797
|
+
} else if ((invocation.skipArtifacts ?? []).length > 0) {
|
|
788
798
|
generateArgs.push("--skip-artifacts", (invocation.skipArtifacts ?? []).join(","));
|
|
789
799
|
}
|
|
790
800
|
if (invocation.includeMonolith === true) generateArgs.push("--include-monolith");
|
|
@@ -804,31 +814,33 @@ async function runSetupCommand(invocation, options = {}) {
|
|
|
804
814
|
if (invocation.watch) generateArgs.push("--watch");
|
|
805
815
|
if (invocation.format === "json") {
|
|
806
816
|
const generated = await captureStdout(() => main(generateArgs));
|
|
807
|
-
let
|
|
817
|
+
let parsed = null;
|
|
808
818
|
try {
|
|
809
|
-
|
|
819
|
+
parsed = JSON.parse(generated.text);
|
|
810
820
|
} catch {
|
|
811
|
-
|
|
821
|
+
parsed = null;
|
|
822
|
+
}
|
|
823
|
+
const setup = {
|
|
824
|
+
configPath: keptConfigPath,
|
|
825
|
+
configReused: init.reused,
|
|
826
|
+
preset: appliedPreset,
|
|
827
|
+
scripts: init.scripts,
|
|
828
|
+
dependency: init.dependency,
|
|
829
|
+
gitignoreEntries: init.gitignoreEntries,
|
|
830
|
+
install,
|
|
831
|
+
notes: init.notes,
|
|
832
|
+
hook
|
|
833
|
+
};
|
|
834
|
+
if (generated.code !== 0) {
|
|
835
|
+
const inner = parsed && typeof parsed.error === "object" && parsed.error !== null ? parsed.error : { message: "Snapshot generation failed during setup.", exitCode: generated.code };
|
|
836
|
+
process.stdout.write(
|
|
837
|
+
`${JSON.stringify({ error: inner, setup, manifest: null }, null, 2)}
|
|
838
|
+
`
|
|
839
|
+
);
|
|
840
|
+
return generated.code;
|
|
812
841
|
}
|
|
813
842
|
process.stdout.write(
|
|
814
|
-
`${JSON.stringify(
|
|
815
|
-
{
|
|
816
|
-
setup: {
|
|
817
|
-
configPath: init.configPath,
|
|
818
|
-
configReused: init.reused,
|
|
819
|
-
preset: init.preset,
|
|
820
|
-
scripts: init.scripts,
|
|
821
|
-
dependency: init.dependency,
|
|
822
|
-
gitignoreEntries: init.gitignoreEntries,
|
|
823
|
-
install,
|
|
824
|
-
notes: init.notes,
|
|
825
|
-
hook
|
|
826
|
-
},
|
|
827
|
-
manifest
|
|
828
|
-
},
|
|
829
|
-
null,
|
|
830
|
-
2
|
|
831
|
-
)}
|
|
843
|
+
`${JSON.stringify({ setup, manifest: parsed }, null, 2)}
|
|
832
844
|
`
|
|
833
845
|
);
|
|
834
846
|
return generated.code;
|
|
@@ -944,7 +956,19 @@ function requestsJsonFormat(argv) {
|
|
|
944
956
|
}
|
|
945
957
|
return format === "json";
|
|
946
958
|
}
|
|
959
|
+
var closedStdoutGuarded = false;
|
|
960
|
+
function guardClosedStdout() {
|
|
961
|
+
if (closedStdoutGuarded) return;
|
|
962
|
+
closedStdoutGuarded = true;
|
|
963
|
+
process.stdout.on("error", (error) => {
|
|
964
|
+
if (error.code === "EPIPE" || error.code === "ECONNRESET") {
|
|
965
|
+
process.exit(0);
|
|
966
|
+
}
|
|
967
|
+
throw error;
|
|
968
|
+
});
|
|
969
|
+
}
|
|
947
970
|
async function main(argv = process.argv.slice(2)) {
|
|
971
|
+
guardClosedStdout();
|
|
948
972
|
const pending = process.stdout.isTTY === true && shouldCheck(argv, process.env) ? checkForUpdate({ current: GENERATOR_VERSION, cacheFile: cacheFilePath() }) : null;
|
|
949
973
|
const code = await runCommand(argv);
|
|
950
974
|
if (pending) {
|
|
@@ -1000,51 +1024,49 @@ ${USAGE}
|
|
|
1000
1024
|
const skipConfig = invocation.noConfig || invocation.command === "diff";
|
|
1001
1025
|
const loaded = skipConfig ? { config: null, warnings: [], errors: [], file: null } : await loadConfigFileDetailed(invocation.cwd);
|
|
1002
1026
|
if (invocation.noConfig) info("\u2699 --no-config: using built-in defaults, config file ignored");
|
|
1003
|
-
for (const warning of loaded.warnings) warn(`\u26A0 Config: ${warning}`);
|
|
1004
1027
|
if (loaded.errors.length > 0) {
|
|
1005
|
-
|
|
1006
|
-
|
|
1028
|
+
return fail(
|
|
1029
|
+
invocation.format,
|
|
1030
|
+
`The config file could not be read: ${loaded.errors.join("; ")}. Fix it, or delete it to use the defaults.`
|
|
1031
|
+
);
|
|
1007
1032
|
}
|
|
1033
|
+
for (const warning of loaded.warnings) warn(`\u26A0 Config: ${warning}`);
|
|
1008
1034
|
if (loaded.file) info(`\u2699 Using config ${path2.relative(process.cwd(), loaded.file) || loaded.file}`);
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1035
|
+
let resolved;
|
|
1036
|
+
try {
|
|
1037
|
+
resolved = resolveConfig(
|
|
1038
|
+
loaded.config,
|
|
1039
|
+
{
|
|
1040
|
+
mode: invocation.command,
|
|
1041
|
+
format: invocation.format,
|
|
1042
|
+
dryRun: invocation.dryRun,
|
|
1043
|
+
cwd: invocation.cwd,
|
|
1044
|
+
outDir: invocation.outDir,
|
|
1045
|
+
includeMonolith: invocation.includeMonolith,
|
|
1046
|
+
includeSensitiveFiles: invocation.includeSensitiveFiles,
|
|
1047
|
+
maxPartBytes: invocation.maxPartBytes,
|
|
1048
|
+
maxPartTokens: invocation.maxPartTokens,
|
|
1049
|
+
largeFileBytes: invocation.largeFileBytes,
|
|
1050
|
+
maxMonolithBytes: invocation.maxMonolithBytes,
|
|
1051
|
+
skipArtifacts: invocation.skipArtifacts,
|
|
1052
|
+
// `--only-artifacts` is forwarded as itself, not only as the derived suppression list:
|
|
1053
|
+
// suppression cannot switch an artifact *on*, so a config that had turned one of the
|
|
1054
|
+
// requested artifacts off left the run with nothing to write.
|
|
1055
|
+
onlyArtifacts: invocation.onlyArtifacts,
|
|
1056
|
+
discovery: invocation.discovery,
|
|
1057
|
+
changedSince: invocation.changedSince,
|
|
1058
|
+
staged: invocation.staged,
|
|
1059
|
+
withDependents: invocation.withDependents,
|
|
1060
|
+
skeleton: invocation.skeleton,
|
|
1061
|
+
sarif: invocation.sarif
|
|
1062
|
+
},
|
|
1063
|
+
invocation.cwd
|
|
1064
|
+
);
|
|
1065
|
+
} catch (err) {
|
|
1066
|
+
return fail(invocation.format, err.message);
|
|
1067
|
+
}
|
|
1033
1068
|
if (invocation.command === "validate") {
|
|
1034
1069
|
const result = validateSnapshot(resolved);
|
|
1035
|
-
if (result.valid) {
|
|
1036
|
-
const manifestPath = path2.resolve(resolved.cwd, resolved.outDir, "manifest.json");
|
|
1037
|
-
let manifest;
|
|
1038
|
-
try {
|
|
1039
|
-
manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
1040
|
-
} catch {
|
|
1041
|
-
manifest = void 0;
|
|
1042
|
-
}
|
|
1043
|
-
const shapeError = manifest === void 0 ? null : describeManifestShapeProblem(manifest);
|
|
1044
|
-
if (shapeError) {
|
|
1045
|
-
return fail(invocation.format, `${manifestPath} is not a snapshot manifest: ${shapeError}`);
|
|
1046
|
-
}
|
|
1047
|
-
}
|
|
1048
1070
|
emit(invocation.format, result, () => renderValidateText(result));
|
|
1049
1071
|
return result.valid ? 0 : 1;
|
|
1050
1072
|
}
|
|
@@ -1239,10 +1261,13 @@ function isGeneratedWatchPath(candidate, paths) {
|
|
|
1239
1261
|
const outDir = comparablePath(path2.resolve(paths.cwd, paths.outDir));
|
|
1240
1262
|
const tmpDir = comparablePath(path2.resolve(paths.cwd, paths.tmpDir));
|
|
1241
1263
|
if (isSameOrInside(outDir, absolute) || isSameOrInside(tmpDir, absolute)) return true;
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1264
|
+
const offsets = [path2.basename(outDir), path2.basename(tmpDir)].filter((name) => name.length > 0);
|
|
1265
|
+
const leftover = absolute.split(/[\\/]+/).some(
|
|
1266
|
+
(segment) => offsets.some(
|
|
1267
|
+
(name) => segment.startsWith(`${name}.backup-`) || segment.startsWith(`${name}.partial-`)
|
|
1268
|
+
)
|
|
1269
|
+
);
|
|
1270
|
+
if (leftover) return true;
|
|
1246
1271
|
return absolute.split(/[\\/]+/).some((segment) => VCS_SEGMENTS.has(segment));
|
|
1247
1272
|
}
|
|
1248
1273
|
function decideWatchEvent(state, event, paths) {
|
|
@@ -1317,6 +1342,7 @@ async function runWatchLoop(invocation, resolved, options) {
|
|
|
1317
1342
|
largeFileBytes: invocation.largeFileBytes,
|
|
1318
1343
|
maxMonolithBytes: invocation.maxMonolithBytes,
|
|
1319
1344
|
skipArtifacts: invocation.skipArtifacts,
|
|
1345
|
+
onlyArtifacts: invocation.onlyArtifacts,
|
|
1320
1346
|
discovery: invocation.discovery,
|
|
1321
1347
|
changedSince: invocation.changedSince,
|
|
1322
1348
|
staged: invocation.staged,
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/** The options `resolveConfig` was called with, as the CLI would have passed them. */
|
|
2
|
+
interface WorkspaceCliOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
maxPartBytes?: number;
|
|
5
|
+
maxPartTokens?: number;
|
|
6
|
+
outDir?: string;
|
|
7
|
+
/**
|
|
8
|
+
* `true` or absent, never `false`.
|
|
9
|
+
*
|
|
10
|
+
* `resolveConfig` reads these as `cliOptions.x ?? config.x`, so a `false` here is an *explicit
|
|
11
|
+
* override* that beats `skeleton: true` in the project's configuration — the same trap the CLI
|
|
12
|
+
* documents. Absent means "whatever the configuration says".
|
|
13
|
+
*/
|
|
14
|
+
skeleton?: true;
|
|
15
|
+
sarif?: true;
|
|
16
|
+
staged?: true;
|
|
17
|
+
withDependents?: true;
|
|
18
|
+
changedSince?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
/** What the caller needs from a finished run; the whole manifest can be megabytes. */
|
|
2
22
|
interface GenerateSummary {
|
|
3
23
|
fingerprint: string;
|
|
@@ -48,10 +68,6 @@ declare function workerEntry(directory: string, isCjs: boolean): {
|
|
|
48
68
|
* as a tool failure naming the reason — never silently retried on the calling thread, because a
|
|
49
69
|
* quiet fallback would hide exactly the condition this exists to avoid.
|
|
50
70
|
*/
|
|
51
|
-
declare function generateInWorker(cwd: string, cliOptions:
|
|
52
|
-
cwd: string;
|
|
53
|
-
maxPartBytes?: number;
|
|
54
|
-
outDir?: string;
|
|
55
|
-
}): Promise<WorkerResults>;
|
|
71
|
+
declare function generateInWorker(cwd: string, cliOptions: WorkspaceCliOptions): Promise<WorkerResults>;
|
|
56
72
|
|
|
57
73
|
export { type GenerateSummary as G, type WorkerResults as W, generateInWorker as g, workerEntry as w };
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
/** The options `resolveConfig` was called with, as the CLI would have passed them. */
|
|
2
|
+
interface WorkspaceCliOptions {
|
|
3
|
+
cwd: string;
|
|
4
|
+
maxPartBytes?: number;
|
|
5
|
+
maxPartTokens?: number;
|
|
6
|
+
outDir?: string;
|
|
7
|
+
/**
|
|
8
|
+
* `true` or absent, never `false`.
|
|
9
|
+
*
|
|
10
|
+
* `resolveConfig` reads these as `cliOptions.x ?? config.x`, so a `false` here is an *explicit
|
|
11
|
+
* override* that beats `skeleton: true` in the project's configuration — the same trap the CLI
|
|
12
|
+
* documents. Absent means "whatever the configuration says".
|
|
13
|
+
*/
|
|
14
|
+
skeleton?: true;
|
|
15
|
+
sarif?: true;
|
|
16
|
+
staged?: true;
|
|
17
|
+
withDependents?: true;
|
|
18
|
+
changedSince?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
1
21
|
/** What the caller needs from a finished run; the whole manifest can be megabytes. */
|
|
2
22
|
interface GenerateSummary {
|
|
3
23
|
fingerprint: string;
|
|
@@ -48,10 +68,6 @@ declare function workerEntry(directory: string, isCjs: boolean): {
|
|
|
48
68
|
* as a tool failure naming the reason — never silently retried on the calling thread, because a
|
|
49
69
|
* quiet fallback would hide exactly the condition this exists to avoid.
|
|
50
70
|
*/
|
|
51
|
-
declare function generateInWorker(cwd: string, cliOptions:
|
|
52
|
-
cwd: string;
|
|
53
|
-
maxPartBytes?: number;
|
|
54
|
-
outDir?: string;
|
|
55
|
-
}): Promise<WorkerResults>;
|
|
71
|
+
declare function generateInWorker(cwd: string, cliOptions: WorkspaceCliOptions): Promise<WorkerResults>;
|
|
56
72
|
|
|
57
73
|
export { type GenerateSummary as G, type WorkerResults as W, generateInWorker as g, workerEntry as w };
|