Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
287 lines
7.4 KiB
JavaScript
287 lines
7.4 KiB
JavaScript
// Runs oxlint with local heavy-check policy, sparse-checkout filtering, and
|
|
// plugin package-boundary artifact preparation when needed.
|
|
import { spawnSync } from "node:child_process";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import {
|
|
acquireLocalHeavyCheckLockSync,
|
|
applyLocalOxlintPolicy,
|
|
resolveLocalHeavyCheckEnv,
|
|
shouldAcquireLocalHeavyCheckLockForOxlint,
|
|
} from "./lib/local-heavy-check-runtime.mjs";
|
|
import { createManagedCommandInvocation, runManagedCommand } from "./lib/managed-child-process.mjs";
|
|
|
|
const oxlintPath = path.resolve("node_modules", ".bin", "oxlint");
|
|
const PREPARE_EXTENSION_BOUNDARY_ARGS = [
|
|
path.resolve("scripts", "prepare-extension-package-boundary-artifacts.mjs"),
|
|
];
|
|
const OXLINT_PREPARE_SKIP_FLAGS = new Set([
|
|
"--help",
|
|
"-h",
|
|
"--version",
|
|
"-V",
|
|
"--print-config",
|
|
"--rules",
|
|
"--init",
|
|
"--lsp",
|
|
]);
|
|
const OXLINT_VALUE_FLAGS = new Set([
|
|
"--config",
|
|
"--deny",
|
|
"--env",
|
|
"--format",
|
|
"--globals",
|
|
"--ignore-path",
|
|
"--max-warnings",
|
|
"--output-file",
|
|
"--plugin",
|
|
"--rules",
|
|
"--tsconfig",
|
|
"--warn",
|
|
]);
|
|
|
|
function hasOxlintFormatArg(args) {
|
|
return args.some(
|
|
(arg) =>
|
|
arg === "--format" ||
|
|
arg.startsWith("--format=") ||
|
|
arg === "-f" ||
|
|
arg.startsWith("-f=") ||
|
|
(arg.startsWith("-f") && arg.length > 2),
|
|
);
|
|
}
|
|
|
|
function addOxlintFormatArg(args, value) {
|
|
const separatorIndex = args.indexOf("--");
|
|
const insertIndex = separatorIndex === -1 ? args.length : separatorIndex;
|
|
args.splice(insertIndex, 0, "--format", value);
|
|
}
|
|
|
|
/**
|
|
* Returns whether oxlint args need package-boundary declaration artifacts first.
|
|
*/
|
|
export function shouldPrepareExtensionPackageBoundaryArtifacts(args) {
|
|
return !args.some((arg) => OXLINT_PREPARE_SKIP_FLAGS.has(arg));
|
|
}
|
|
|
|
/**
|
|
* Drops tracked-but-missing sparse-checkout targets so narrow sparse checks can pass.
|
|
*/
|
|
export function filterSparseMissingOxlintTargets(
|
|
args,
|
|
{
|
|
cwd = process.cwd(),
|
|
fileExists = fs.existsSync,
|
|
isSparseCheckoutEnabled = getSparseCheckoutEnabled,
|
|
isTrackedPath = hasTrackedPath,
|
|
} = {},
|
|
) {
|
|
if (!isSparseCheckoutEnabled({ cwd })) {
|
|
return {
|
|
args,
|
|
hadExplicitTargets: false,
|
|
remainingExplicitTargets: 0,
|
|
skippedTargets: [],
|
|
skippedConfigs: [],
|
|
};
|
|
}
|
|
|
|
const filteredArgs = [];
|
|
const skippedTargets = [];
|
|
const skippedConfigs = [];
|
|
let hadExplicitTargets = false;
|
|
let remainingExplicitTargets = 0;
|
|
let consumeNextValue = false;
|
|
|
|
for (let index = 0; index < args.length; index += 1) {
|
|
const arg = args[index];
|
|
if (consumeNextValue) {
|
|
filteredArgs.push(arg);
|
|
consumeNextValue = false;
|
|
continue;
|
|
}
|
|
|
|
if (arg === "--") {
|
|
filteredArgs.push(arg);
|
|
continue;
|
|
}
|
|
|
|
if (arg.startsWith("--")) {
|
|
if (arg === "--tsconfig") {
|
|
const value = args[index + 1];
|
|
if (value !== undefined) {
|
|
index += 1;
|
|
if (!fileExists(path.resolve(cwd, value)) && isTrackedPath({ cwd, target: value })) {
|
|
skippedConfigs.push(value);
|
|
continue;
|
|
}
|
|
filteredArgs.push(arg, value);
|
|
continue;
|
|
}
|
|
}
|
|
if (arg.startsWith("--tsconfig=")) {
|
|
const value = arg.slice("--tsconfig=".length);
|
|
if (
|
|
value &&
|
|
!fileExists(path.resolve(cwd, value)) &&
|
|
isTrackedPath({ cwd, target: value })
|
|
) {
|
|
skippedConfigs.push(value);
|
|
continue;
|
|
}
|
|
}
|
|
filteredArgs.push(arg);
|
|
if (!arg.includes("=") && OXLINT_VALUE_FLAGS.has(arg)) {
|
|
consumeNextValue = true;
|
|
}
|
|
continue;
|
|
}
|
|
|
|
if (arg.startsWith("-")) {
|
|
filteredArgs.push(arg);
|
|
continue;
|
|
}
|
|
|
|
hadExplicitTargets = true;
|
|
const absoluteTarget = path.resolve(cwd, arg);
|
|
if (!fileExists(absoluteTarget) && isTrackedPath({ cwd, target: arg })) {
|
|
skippedTargets.push(arg);
|
|
continue;
|
|
}
|
|
|
|
remainingExplicitTargets += 1;
|
|
filteredArgs.push(arg);
|
|
}
|
|
|
|
return {
|
|
args: filteredArgs,
|
|
hadExplicitTargets,
|
|
remainingExplicitTargets,
|
|
skippedTargets,
|
|
skippedConfigs,
|
|
};
|
|
}
|
|
|
|
function getSparseCheckoutEnabled({ cwd }) {
|
|
const git = createManagedCommandInvocation({
|
|
args: ["config", "--get", "--bool", "core.sparseCheckout"],
|
|
bin: "git",
|
|
});
|
|
const result = spawnSync(git.command, git.args, {
|
|
cwd,
|
|
encoding: "utf8",
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
shell: git.shell,
|
|
windowsVerbatimArguments: git.windowsVerbatimArguments,
|
|
});
|
|
|
|
return result.status === 0 && result.stdout.trim() === "true";
|
|
}
|
|
|
|
function hasTrackedPath({ cwd, target }) {
|
|
const git = createManagedCommandInvocation({
|
|
args: ["ls-files", "--", target],
|
|
bin: "git",
|
|
});
|
|
const result = spawnSync(git.command, git.args, {
|
|
cwd,
|
|
encoding: "utf8",
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
shell: git.shell,
|
|
windowsVerbatimArguments: git.windowsVerbatimArguments,
|
|
});
|
|
|
|
return result.status === 0 && result.stdout.trim().length > 0;
|
|
}
|
|
|
|
async function prepareExtensionPackageBoundaryArtifacts(env) {
|
|
const releaseArtifactsLock = acquireLocalHeavyCheckLockSync({
|
|
cwd: process.cwd(),
|
|
env,
|
|
toolName: "extension-package-boundary-artifacts",
|
|
lockName: "extension-package-boundary-artifacts",
|
|
});
|
|
|
|
try {
|
|
const status = await runManagedCommand({
|
|
bin: process.execPath,
|
|
args: PREPARE_EXTENSION_BOUNDARY_ARGS,
|
|
env,
|
|
});
|
|
|
|
if (status !== 0) {
|
|
throw new Error(
|
|
`prepare-extension-package-boundary-artifacts failed with exit code ${status}`,
|
|
);
|
|
}
|
|
} finally {
|
|
releaseArtifactsLock();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Applies wrapper policy and runs oxlint with the final argument list.
|
|
*/
|
|
export async function main(argv = process.argv.slice(2), runtimeEnv = process.env) {
|
|
const { args: policyArgs, env } = applyLocalOxlintPolicy(
|
|
argv,
|
|
resolveLocalHeavyCheckEnv(runtimeEnv),
|
|
);
|
|
const sparseTargets = filterSparseMissingOxlintTargets(policyArgs);
|
|
const finalArgs = sparseTargets.args;
|
|
if (env.GITHUB_ACTIONS === "true" && !hasOxlintFormatArg(finalArgs)) {
|
|
addOxlintFormatArg(finalArgs, "stylish");
|
|
}
|
|
if (sparseTargets.skippedTargets.length > 0) {
|
|
console.error(
|
|
`[oxlint] sparse checkout is missing tracked target(s); skipping ${sparseTargets.skippedTargets.join(", ")}`,
|
|
);
|
|
}
|
|
if (sparseTargets.skippedConfigs.length > 0) {
|
|
console.error(
|
|
`[oxlint] sparse checkout is missing tracked config(s); skipping oxlint: ${sparseTargets.skippedConfigs.join(", ")}`,
|
|
);
|
|
return;
|
|
}
|
|
if (sparseTargets.hadExplicitTargets && sparseTargets.remainingExplicitTargets === 0) {
|
|
console.error("[oxlint] no present sparse-checkout targets remain; skipping oxlint.");
|
|
return;
|
|
}
|
|
|
|
const releaseLock =
|
|
env.OPENCLAW_OXLINT_SKIP_LOCK === "1"
|
|
? () => {}
|
|
: shouldAcquireLocalHeavyCheckLockForOxlint(finalArgs, {
|
|
cwd: process.cwd(),
|
|
env,
|
|
})
|
|
? acquireLocalHeavyCheckLockSync({
|
|
cwd: process.cwd(),
|
|
env,
|
|
toolName: "oxlint",
|
|
})
|
|
: () => {};
|
|
|
|
try {
|
|
if (
|
|
env.OPENCLAW_OXLINT_SKIP_PREPARE !== "1" &&
|
|
shouldPrepareExtensionPackageBoundaryArtifacts(finalArgs)
|
|
) {
|
|
await prepareExtensionPackageBoundaryArtifacts(env);
|
|
}
|
|
|
|
const status = await runManagedCommand({
|
|
bin: oxlintPath,
|
|
args: finalArgs,
|
|
env,
|
|
});
|
|
process.exitCode = status;
|
|
} finally {
|
|
releaseLock();
|
|
}
|
|
}
|
|
|
|
if (import.meta.main) {
|
|
await main();
|
|
}
|