Project-2 baseline
This commit is contained in:
@@ -18,14 +18,14 @@
|
||||
* npx tsx scripts/stamp-trial-inputs.ts capture <task-dir> --out <file>
|
||||
* npx tsx scripts/stamp-trial-inputs.ts apply <capture-file> <job-dir> [job-dir...]
|
||||
*
|
||||
* Ships in the worker toolkit (see raccoon-worker-toolkit/package-worker-toolkit.ts),
|
||||
* Ships in the worker toolkit (see build/package-worker-toolkit.ts),
|
||||
* so it must only import from its shipped file set — same constraint as
|
||||
* copy-reference-run.ts.
|
||||
*/
|
||||
|
||||
import './lib/check-devcontainer';
|
||||
|
||||
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs';
|
||||
import { existsSync, readFileSync, readdirSync, realpathSync, statSync, writeFileSync } from 'fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { basename, join, resolve } from 'path';
|
||||
|
||||
@@ -126,8 +126,16 @@ export function applyCommand(captureFile: string, jobDirs: string[]): number {
|
||||
return stamped;
|
||||
}
|
||||
|
||||
// Main. Guarded so the test file can import the commands without running them.
|
||||
if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1])) {
|
||||
// Main. Guarded so the test file can import the commands without running them. Real paths
|
||||
// on both sides: a repo checkout invokes this file through a symlink.
|
||||
const isMain = (() => {
|
||||
try {
|
||||
return !!process.argv[1] && realpathSync(resolve(process.argv[1])) === realpathSync(fileURLToPath(import.meta.url));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
})();
|
||||
if (isMain) {
|
||||
const [command, ...rest] = process.argv.slice(2);
|
||||
if (command === 'capture') {
|
||||
const outIdx = rest.indexOf('--out');
|
||||
|
||||
Reference in New Issue
Block a user