Add harness workflow and Material showcase design system
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { execFileSync, spawnSync } from "node:child_process";
|
||||
|
||||
import { repoRoot } from "./core.mjs";
|
||||
|
||||
const orchBin =
|
||||
process.env.CADENCE_UI_ORCH_BIN ?? "/Users/xd/.codex/skills/orch/assets/orch";
|
||||
const defaultDbPath = path.join(repoRoot, ".artifacts", "orch", "coord.db");
|
||||
const defaultWorkspaceRoot = path.join(repoRoot, ".artifacts", "orch", "worktrees");
|
||||
|
||||
function printHelp() {
|
||||
process.stdout.write(`Cadence UI orchestration wrapper
|
||||
|
||||
Usage:
|
||||
pnpm harness:orch -- <orch command> [flags]
|
||||
|
||||
Examples:
|
||||
pnpm harness:orch -- run init --run cadence_ui_demo --goal "Refine release UX" --summary "Break work into isolated tasks"
|
||||
pnpm harness:orch -- task add --run cadence_ui_demo --task T1 --title "Stabilize smoke tests" --summary "Fix Storybook smoke drift"
|
||||
pnpm harness:orch -- dispatch --run cadence_ui_demo --task T1 --to default-worker --body-file docs/exec-plans/task-t1.md
|
||||
pnpm harness:orch -- status --run cadence_ui_demo
|
||||
|
||||
Defaults applied by this wrapper:
|
||||
--db ${path.relative(repoRoot, defaultDbPath)}
|
||||
dispatch --repo-path ${repoRoot}
|
||||
dispatch --workspace-root ${path.relative(repoRoot, defaultWorkspaceRoot)}
|
||||
dispatch --strict-worktree
|
||||
dispatch --base-ref <current branch>
|
||||
`);
|
||||
}
|
||||
|
||||
function hasFlag(args, flag) {
|
||||
return args.includes(flag);
|
||||
}
|
||||
|
||||
function getCurrentBranch() {
|
||||
try {
|
||||
return execFileSync("git", ["branch", "--show-current"], {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf8"
|
||||
}).trim();
|
||||
} catch {
|
||||
return "main";
|
||||
}
|
||||
}
|
||||
|
||||
const rawArgs = process.argv.slice(2).filter((value) => value !== "--");
|
||||
|
||||
if (
|
||||
rawArgs.length === 0 ||
|
||||
rawArgs[0] === "help" ||
|
||||
rawArgs[0] === "--help" ||
|
||||
rawArgs[0] === "-h"
|
||||
) {
|
||||
printHelp();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
fs.mkdirSync(path.dirname(defaultDbPath), { recursive: true });
|
||||
fs.mkdirSync(defaultWorkspaceRoot, { recursive: true });
|
||||
|
||||
const command = rawArgs[0];
|
||||
const orchArgs = [...rawArgs];
|
||||
|
||||
if (!hasFlag(orchArgs, "--db")) {
|
||||
orchArgs.unshift(defaultDbPath);
|
||||
orchArgs.unshift("--db");
|
||||
}
|
||||
|
||||
if (command === "dispatch") {
|
||||
if (!hasFlag(orchArgs, "--repo-path")) {
|
||||
orchArgs.push("--repo-path", repoRoot);
|
||||
}
|
||||
|
||||
if (!hasFlag(orchArgs, "--workspace-root")) {
|
||||
orchArgs.push("--workspace-root", defaultWorkspaceRoot);
|
||||
}
|
||||
|
||||
if (!hasFlag(orchArgs, "--strict-worktree")) {
|
||||
orchArgs.push("--strict-worktree");
|
||||
}
|
||||
|
||||
if (!hasFlag(orchArgs, "--base-ref")) {
|
||||
orchArgs.push("--base-ref", getCurrentBranch());
|
||||
}
|
||||
}
|
||||
|
||||
const result = spawnSync(orchBin, orchArgs, {
|
||||
cwd: repoRoot,
|
||||
stdio: "inherit"
|
||||
});
|
||||
|
||||
process.exit(result.status ?? 1);
|
||||
Reference in New Issue
Block a user