























@@ -82,7 +82,7 @@ export function shouldSkipAppLintForMissingSwiftlint(options = {}) {
8282}
83838484export function shouldDelegateChangedCheckToCrabbox(argv = [], env = process.env) {
85-if (!isTruthyEnvFlag(env.OPENCLAW_TESTBOX)) {
85+if (isTruthyEnvFlag(env.OPENCLAW_CHECK_CHANGED_REMOTE_CHILD)) {
8686return false;
8787}
8888if (isTruthyEnvFlag(env.CI) || isTruthyEnvFlag(env.GITHUB_ACTIONS)) {
@@ -94,7 +94,8 @@ export function shouldDelegateChangedCheckToCrabbox(argv = [], env = process.env
9494return true;
9595}
969697-export function buildChangedCheckCrabboxArgs(argv = []) {
97+export function buildChangedCheckCrabboxArgs(argv = [], options = {}) {
98+const delegatedArgv = buildDelegatedChangedCheckArgv(argv, options);
9899return [
99100"crabbox:run",
100101"--",
@@ -114,13 +115,36 @@ export function buildChangedCheckCrabboxArgs(argv = []) {
114115"240m",
115116"--timing-json",
116117"--",
118+"env",
119+"OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1",
120+"OPENCLAW_CHANGED_LANES_RAW_SYNC=1",
121+"CI=1",
117122"corepack",
118123"pnpm",
119124"check:changed",
120- ...argv,
125+ ...delegatedArgv,
121126];
122127}
123128129+function buildDelegatedChangedCheckArgv(argv, options = {}) {
130+const args = parseArgs(argv);
131+if (!args.staged || args.paths.length > 0) {
132+return argv;
133+}
134+const stagedPaths = listStagedChangedPaths(options.cwd);
135+const next = [];
136+if (args.timed) {
137+next.push("--timed");
138+}
139+if (stagedPaths.length === 0) {
140+next.push("--no-changes");
141+return next;
142+}
143+next.push("--base", "HEAD", "--head", "HEAD");
144+next.push("--", ...stagedPaths);
145+return next;
146+}
147+124148export function shouldRunShrinkwrapGuard(paths) {
125149return paths.some((changedPath) => SHRINKWRAP_POLICY_PATH_RE.test(changedPath));
126150}
@@ -148,9 +172,7 @@ export function createShrinkwrapGuardCommand(paths) {
148172}
149173150174export async function runChangedCheckViaCrabbox(argv = [], env = process.env) {
151-console.error(
152-"[check:changed] OPENCLAW_TESTBOX=1 set; delegating to Blacksmith Testbox via `pnpm crabbox:run`.",
153-);
175+console.error("[check:changed] delegating to Blacksmith Testbox via `pnpm crabbox:run`.");
154176return await runManagedCommand({
155177bin: "pnpm",
156178args: buildChangedCheckCrabboxArgs(argv),
@@ -477,6 +499,7 @@ function parseArgs(argv) {
477499staged: false,
478500dryRun: false,
479501timed: false,
502+noChanges: false,
480503help: false,
481504paths: [],
482505};
@@ -489,6 +512,7 @@ function parseArgs(argv) {
489512booleanFlag("--staged", "staged"),
490513booleanFlag("--dry-run", "dryRun"),
491514booleanFlag("--timed", "timed"),
515+booleanFlag("--no-changes", "noChanges"),
492516booleanFlag("--help", "help"),
493517booleanFlag("-h", "help"),
494518],
@@ -515,6 +539,7 @@ function printUsage() {
515539" --staged Check staged paths instead of git diff paths",
516540" --dry-run Print the planned checks without running them",
517541" --timed Print timing summary",
542+" --no-changes Treat the changed path set as empty",
518543" -h, --help Show this help",
519544"",
520545].join("\n"),
@@ -534,8 +559,9 @@ if (isDirectRun()) {
534559} else if (shouldDelegateChangedCheckToCrabbox(argv, process.env)) {
535560process.exitCode = await runChangedCheckViaCrabbox(argv, process.env);
536561} else {
537-const paths =
538-args.paths.length > 0
562+const paths = args.noChanges
563+ ? []
564+ : args.paths.length > 0
539565 ? args.paths
540566 : args.staged
541567 ? listStagedChangedPaths()
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。