mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-04 07:47:27 +01:00
autoplan/DRIVER.md (from autoplan/DRIVER.md.tmpl) is what a parent agent on any host reads instead of autoplan/SKILL.md: phase order and scope flags, the next/submit/ answer/revise/export loop with the plan-specified submit --record/--attest/ --unavailable, revise --incorporates/--withdraw and next --scaffold, the reviewer RESULT FORMAT, the gate grammar including all as-is, the run files, the result codes and the coordinator contract, every list rendered from code (117 lines). gen:skill-docs emits it as a Claude asset, so normal, out-dir and dry-run inventories and the freshness check cover it. gstack-autoplan --help and the first next print DRIVER: <root>/autoplan/DRIVER.md, resolved through an install root's recorded .source-path (new lib/source-root.ts) (field wave item 13). Intentional pin change: test/gen-skill-docs-checks.test.ts asset inventory gains autoplan/DRIVER.md. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
18 lines
768 B
TypeScript
18 lines
768 B
TypeScript
/**
|
|
* source-root — the gstack checkout behind an install root. setup records the
|
|
* source checkout in `<install root>/.source-path` (`_link_runtime_dists`,
|
|
* Windows copy roots and the Copilot root); files that live only in the
|
|
* checkout (autoplan/DRIVER.md) resolve through it. A root without the file,
|
|
* or whose recorded path no longer exists, is its own source.
|
|
*/
|
|
import * as fs from 'node:fs';
|
|
import * as path from 'node:path';
|
|
|
|
export function resolveSourceRoot(root: string): string {
|
|
try {
|
|
const recorded = fs.readFileSync(path.join(root, '.source-path'), 'utf8').split('\n', 1)[0]!.trim();
|
|
if (recorded && fs.statSync(recorded).isDirectory()) return path.resolve(recorded);
|
|
} catch { /* no record, or a stale one */ }
|
|
return root;
|
|
}
|