feat: add mxl-* tests (batch 3), support cwd in skill config and preRun

- mxl-compile, mxl-validate, mxl-info, mxl-decompile: 4 cases
- runner: cwd option in _skill.json and preRun steps for skills
  that resolve OutputPath relative to current directory
- Finding: mxl-compile only accepts relative OutputPath

21 tests across 9 skills, all passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-03-28 13:44:37 +03:00
parent 74b3f76a32
commit 8b38f8f78d
13 changed files with 266 additions and 5 deletions
+8 -5
View File
@@ -122,13 +122,14 @@ function resolveScript(scriptRelPath, runtime) {
return full;
}
function execSkillRaw(runtime, scriptPath, args) {
function execSkillRaw(runtime, scriptPath, args, cwd) {
const execCwd = cwd || REPO_ROOT;
if (runtime === 'python') {
return execFileSync(process.env.PYTHON || 'python', [scriptPath, ...args], {
encoding: 'utf8',
timeout: 60_000,
stdio: ['pipe', 'pipe', 'pipe'],
cwd: REPO_ROOT,
cwd: execCwd,
});
}
// PowerShell
@@ -139,7 +140,7 @@ function execSkillRaw(runtime, scriptPath, args) {
encoding: 'utf8',
timeout: 60_000,
stdio: ['pipe', 'pipe', 'pipe'],
cwd: REPO_ROOT,
cwd: execCwd,
});
}
@@ -358,7 +359,8 @@ function runCase(testCase, opts) {
}
}
try {
execSkillRaw(opts.runtime, preScript, preArgs);
const preCwd = step.cwd === '{workDir}' ? workDir : undefined;
execSkillRaw(opts.runtime, preScript, preArgs, preCwd);
} catch (e) {
throw new Error(`preRun step "${step.script}" failed: ${e.stderr || e.message}`);
}
@@ -377,7 +379,8 @@ function runCase(testCase, opts) {
let stdout = '', stderr = '', exitCode = 0;
try {
stdout = execSkillRaw(opts.runtime, scriptPath, args);
const execCwd = skillConfig.cwd === 'workDir' ? workDir : undefined;
stdout = execSkillRaw(opts.runtime, scriptPath, args, execCwd);
} catch (e) {
exitCode = e.status ?? 1;
stdout = e.stdout || '';