mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 16:16:07 +00:00
Replace the exec approval parser/planner path with Tree-sitter-backed authorization planning, carrying planner decisions through node and gateway execution.
This keeps unpersistable shell shapes one-shot, adds typed `unavailableDecisions` for approval prompts, and refreshes coverage for allowlist matching, command rendering, durable allow-always persistence, and host approval paths.
Verification:
- GitHub PR checks for ce2381192d: CLEAN, 142 success, 32 skipped, 0 failed, 0 pending.
- /Users/jmerhi/.nvm/versions/node/v24.12.0/bin/node scripts/plugin-sdk-surface-report.mjs --check
- /Users/jmerhi/.nvm/versions/node/v24.12.0/bin/node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts --reporter=verbose
- Focused exec approval suite: 13 files, 467 tests.
31 lines
834 B
TypeScript
31 lines
834 B
TypeScript
import type { ExecCommandAnalysis } from "./exec-command-analysis-types.js";
|
|
import { resolveCommandResolutionFromArgv } from "./exec-command-resolution.js";
|
|
|
|
export function analyzeArgvCommand(params: {
|
|
argv: string[];
|
|
cwd?: string;
|
|
env?: NodeJS.ProcessEnv;
|
|
platform?: string | null;
|
|
}): ExecCommandAnalysis {
|
|
const argv = params.argv.filter((entry) => entry.trim().length > 0);
|
|
if (argv.length === 0) {
|
|
return { ok: false, reason: "empty argv", segments: [] };
|
|
}
|
|
return {
|
|
ok: true,
|
|
segments: [
|
|
{
|
|
raw: argv.join(" "),
|
|
argv,
|
|
sourceArgv: [...params.argv],
|
|
resolution: resolveCommandResolutionFromArgv(
|
|
argv,
|
|
params.cwd,
|
|
params.env,
|
|
(params.platform ?? undefined) as NodeJS.Platform | undefined,
|
|
),
|
|
},
|
|
],
|
|
};
|
|
}
|