@holdpoint/cli 0.1.0-alpha.14 → 0.1.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -17
- package/dist/index.js.map +1 -1
- package/dist/templates/MASTER_PROMPT.md +15 -15
- package/dist/templates/_base.yaml +1 -1
- package/dist/templates/fullstack.yaml +1 -1
- package/dist/templates/go.yaml +1 -1
- package/dist/templates/nextjs.yaml +1 -1
- package/dist/templates/python.yaml +1 -1
- package/dist/templates/typescript.yaml +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/commands/init.ts
|
|
7
|
+
import { execSync } from "child_process";
|
|
7
8
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync, mkdirSync, copyFileSync } from "fs";
|
|
8
9
|
import { join, dirname } from "path";
|
|
9
10
|
import { fileURLToPath } from "url";
|
|
@@ -107,13 +108,13 @@ async function initCommand(options) {
|
|
|
107
108
|
const agentOpt = options.agent;
|
|
108
109
|
const agents = !agentOpt || agentOpt === "all" ? ["copilot", "claude", "cursor", "codex"] : [agentOpt];
|
|
109
110
|
spinner.text = `Stack: ${chalk.cyan(stack)} \u2014 installing for: ${chalk.cyan(agents.join(", "))}`;
|
|
111
|
+
const pm = detectPackageManager();
|
|
110
112
|
let yamlContent = MINIMAL_CHECKS_YAML;
|
|
111
113
|
if (!existsSync2("checks.yaml")) {
|
|
112
114
|
const templatePath = getTemplatePath(stack);
|
|
113
115
|
if (templatePath) {
|
|
114
116
|
yamlContent = readFileSync2(templatePath, "utf8");
|
|
115
117
|
}
|
|
116
|
-
const pm = detectPackageManager();
|
|
117
118
|
if (pm !== "pnpm") {
|
|
118
119
|
yamlContent = yamlContent.replace(/\bpnpm\b/g, pm);
|
|
119
120
|
}
|
|
@@ -175,19 +176,34 @@ async function initCommand(options) {
|
|
|
175
176
|
} else {
|
|
176
177
|
writeFileSync(
|
|
177
178
|
"MASTER_PROMPT.md",
|
|
178
|
-
"# Holdpoint\n\nRun `
|
|
179
|
+
"# Holdpoint\n\nRun `holdpoint check` before marking any task complete.\nSee `checks.yaml` for the full list of checks.\n",
|
|
179
180
|
"utf8"
|
|
180
181
|
);
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
|
-
spinner.
|
|
184
|
+
spinner.text = "Installing holdpoint as a devDependency\u2026";
|
|
185
|
+
const installCmds = {
|
|
186
|
+
pnpm: "pnpm add -D holdpoint@alpha",
|
|
187
|
+
yarn: "yarn add --dev holdpoint@alpha",
|
|
188
|
+
npm: "npm install --save-dev holdpoint@alpha"
|
|
189
|
+
};
|
|
190
|
+
const installCmd = installCmds[pm];
|
|
191
|
+
try {
|
|
192
|
+
execSync(installCmd, { stdio: "pipe" });
|
|
193
|
+
spinner.succeed(chalk.bold.green("Holdpoint initialised!"));
|
|
194
|
+
} catch {
|
|
195
|
+
spinner.warn(
|
|
196
|
+
chalk.yellow(`Holdpoint initialised, but could not install the package automatically.`) + `
|
|
197
|
+
Run manually: ${chalk.yellow(installCmd)}`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
184
200
|
console.log(`
|
|
185
201
|
${chalk.cyan("Next steps:")}
|
|
186
202
|
1. Edit ${chalk.yellow("checks.yaml")} to customise your eval checkpoints
|
|
187
203
|
2. Commit ${chalk.yellow("checks.yaml")} and the generated engine files
|
|
188
|
-
3. Run ${chalk.yellow("
|
|
204
|
+
3. Run ${chalk.yellow("holdpoint check")} at any time to validate
|
|
189
205
|
|
|
190
|
-
Visual builder: ${chalk.yellow("
|
|
206
|
+
Visual builder: ${chalk.yellow("holdpoint builder")} (opens localhost:4321)
|
|
191
207
|
Stack: ${chalk.cyan(stack)} Agents: ${chalk.cyan(agents.join(", "))}
|
|
192
208
|
`);
|
|
193
209
|
}
|
|
@@ -199,14 +215,14 @@ import chalk2 from "chalk";
|
|
|
199
215
|
import ora2 from "ora";
|
|
200
216
|
import { parseHoldpointYaml as parseHoldpointYaml2, matchesWhen } from "@holdpoint/yaml-core";
|
|
201
217
|
import { runDeterministicChecks } from "@holdpoint/yaml-core/runner";
|
|
202
|
-
import { execSync } from "child_process";
|
|
218
|
+
import { execSync as execSync2 } from "child_process";
|
|
203
219
|
var COMMIT_CACHE_PATH = ".holdpoint/checked-commits.json";
|
|
204
220
|
var COMMIT_CACHE_MAX = 100;
|
|
205
221
|
var CHECK_REPORTS_PATH = ".holdpoint/check-reports.json";
|
|
206
222
|
var CHECK_REPORTS_MAX = 50;
|
|
207
223
|
function getStagedFiles() {
|
|
208
224
|
try {
|
|
209
|
-
const out =
|
|
225
|
+
const out = execSync2("git diff --cached --name-only", {
|
|
210
226
|
encoding: "utf8",
|
|
211
227
|
stdio: ["pipe", "pipe", "ignore"]
|
|
212
228
|
});
|
|
@@ -217,7 +233,7 @@ function getStagedFiles() {
|
|
|
217
233
|
}
|
|
218
234
|
function getAllChangedFiles() {
|
|
219
235
|
try {
|
|
220
|
-
const out =
|
|
236
|
+
const out = execSync2("git diff --name-only HEAD", {
|
|
221
237
|
encoding: "utf8",
|
|
222
238
|
stdio: ["pipe", "pipe", "ignore"]
|
|
223
239
|
});
|
|
@@ -228,7 +244,7 @@ function getAllChangedFiles() {
|
|
|
228
244
|
}
|
|
229
245
|
function getLastCommitFiles() {
|
|
230
246
|
try {
|
|
231
|
-
const out =
|
|
247
|
+
const out = execSync2("git diff --name-only HEAD~1 HEAD", {
|
|
232
248
|
encoding: "utf8",
|
|
233
249
|
stdio: ["pipe", "pipe", "ignore"]
|
|
234
250
|
});
|
|
@@ -239,7 +255,7 @@ function getLastCommitFiles() {
|
|
|
239
255
|
}
|
|
240
256
|
function getHeadSha() {
|
|
241
257
|
try {
|
|
242
|
-
return
|
|
258
|
+
return execSync2("git rev-parse HEAD", {
|
|
243
259
|
encoding: "utf8",
|
|
244
260
|
stdio: ["pipe", "pipe", "ignore"]
|
|
245
261
|
}).trim();
|
|
@@ -546,7 +562,7 @@ import { createServer } from "http";
|
|
|
546
562
|
import { createReadStream, existsSync as existsSync6 } from "fs";
|
|
547
563
|
import { join as join3, extname, dirname as dirname2 } from "path";
|
|
548
564
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
549
|
-
import { execSync as
|
|
565
|
+
import { execSync as execSync3 } from "child_process";
|
|
550
566
|
import chalk5 from "chalk";
|
|
551
567
|
var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
|
|
552
568
|
var MIME = {
|
|
@@ -615,7 +631,7 @@ ${chalk5.green("\u2713")} Holdpoint builder running at ${chalk5.cyan(`http://loc
|
|
|
615
631
|
console.log(chalk5.dim(" Press Ctrl+C to stop\n"));
|
|
616
632
|
const openCmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
617
633
|
try {
|
|
618
|
-
|
|
634
|
+
execSync3(`${openCmd} http://localhost:${port}`, { stdio: "ignore" });
|
|
619
635
|
} catch {
|
|
620
636
|
}
|
|
621
637
|
});
|
|
@@ -629,7 +645,7 @@ ${chalk5.green("\u2713")} Holdpoint builder running at ${chalk5.cyan(`http://loc
|
|
|
629
645
|
|
|
630
646
|
// src/commands/evolve.ts
|
|
631
647
|
import { existsSync as existsSync9, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
632
|
-
import { execSync as
|
|
648
|
+
import { execSync as execSync6 } from "child_process";
|
|
633
649
|
import chalk6 from "chalk";
|
|
634
650
|
import ora4 from "ora";
|
|
635
651
|
import { parseHoldpointYaml as parseHoldpointYaml5, generateYaml } from "@holdpoint/yaml-core";
|
|
@@ -637,7 +653,7 @@ import { parseHoldpointYaml as parseHoldpointYaml5, generateYaml } from "@holdpo
|
|
|
637
653
|
// src/evolve/scanner.ts
|
|
638
654
|
import { existsSync as existsSync7, readFileSync as readFileSync6, readdirSync } from "fs";
|
|
639
655
|
import { join as join4 } from "path";
|
|
640
|
-
import { execSync as
|
|
656
|
+
import { execSync as execSync4 } from "child_process";
|
|
641
657
|
function tryReadJson(path) {
|
|
642
658
|
try {
|
|
643
659
|
return JSON.parse(readFileSync6(path, "utf8"));
|
|
@@ -715,7 +731,7 @@ function scanProject(cwd = process.cwd()) {
|
|
|
715
731
|
}
|
|
716
732
|
|
|
717
733
|
// src/evolve/dead-checker.ts
|
|
718
|
-
import { execSync as
|
|
734
|
+
import { execSync as execSync5 } from "child_process";
|
|
719
735
|
import { readdirSync as readdirSync2, existsSync as existsSync8 } from "fs";
|
|
720
736
|
import { join as join5 } from "path";
|
|
721
737
|
var NAMED_SCOPES = /* @__PURE__ */ new Set([
|
|
@@ -772,7 +788,7 @@ function walkDir(dir, root, depth, maxDepth) {
|
|
|
772
788
|
}
|
|
773
789
|
function getRepoFiles(cwd) {
|
|
774
790
|
try {
|
|
775
|
-
const out =
|
|
791
|
+
const out = execSync5("git ls-files", {
|
|
776
792
|
cwd,
|
|
777
793
|
encoding: "utf8",
|
|
778
794
|
stdio: ["pipe", "pipe", "ignore"]
|
|
@@ -1135,7 +1151,7 @@ async function evolveCommand(options) {
|
|
|
1135
1151
|
writeFileSync4("checks.yaml", newYaml, "utf8");
|
|
1136
1152
|
applySpinner.text = "Running holdpoint update\u2026";
|
|
1137
1153
|
try {
|
|
1138
|
-
|
|
1154
|
+
execSync6("npx @holdpoint/cli@alpha update", { stdio: "pipe" });
|
|
1139
1155
|
} catch {
|
|
1140
1156
|
applySpinner.warn(
|
|
1141
1157
|
chalk6.yellow("checks.yaml updated, but `holdpoint update` failed \u2014 run it manually.")
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/init.ts","../src/detect.ts","../src/commands/check.ts","../src/commands/validate.ts","../src/commands/update.ts","../src/commands/build.ts","../src/commands/evolve.ts","../src/evolve/scanner.ts","../src/evolve/dead-checker.ts","../src/evolve/templates.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { initCommand } from \"./commands/init.js\";\nimport { checkCommand } from \"./commands/check.js\";\nimport { validateCommand } from \"./commands/validate.js\";\nimport { updateCommand } from \"./commands/update.js\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { evolveCommand } from \"./commands/evolve.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"holdpoint\")\n .description(\"Universal eval-guard for AI coding agents (alpha)\")\n .version(\"0.1.0-alpha.2\");\n\nprogram\n .command(\"init\")\n .description(\"Initialise Holdpoint in the current project\")\n .option(\"--stack <stack>\", \"Stack type: typescript | python | nextjs | fullstack\")\n .option(\n \"--agent <agent>\",\n \"Agent to install for: copilot | claude | cursor | codex (default: all four)\",\n )\n .action(initCommand);\n\nprogram\n .command(\"check\")\n .description(\"Run task checks from checks.yaml\")\n .option(\"--staged\", \"Only check against git-staged files\")\n .action(checkCommand);\n\nprogram\n .command(\"validate\")\n .description(\"Validate checks.yaml schema and print any errors\")\n .action(validateCommand);\n\nprogram\n .command(\"update\")\n .description(\"Regenerate engine files from current checks.yaml (preserves checks.yaml)\")\n .action(updateCommand);\n\nprogram\n .command(\"builder\")\n .description(\"Open the visual builder UI on localhost:4321\")\n .action(buildCommand);\n\nprogram\n .command(\"evolve\")\n .description(\"Scan project and propose (or apply) new checks to keep checks.yaml in sync\")\n .option(\"--apply\", \"Write proposed changes to checks.yaml and regenerate engine files\")\n .action(evolveCommand);\n\nprogram.parse();\n","import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { buildConfigJson, buildEngine } from \"@holdpoint/engine-copilot\";\nimport { buildEngineJson as buildClaudeEngineJson } from \"@holdpoint/engine-claude\";\nimport { buildEngine as buildCursorEngine } from \"@holdpoint/engine-cursor\";\nimport {\n buildConfigToml as buildCodexConfigToml,\n buildHooksJson as buildCodexHooksJson,\n buildCheckScript as buildCodexCheckScript,\n spliceAgentsMd,\n buildAgentsMd,\n} from \"@holdpoint/engine-codex\";\nimport { parseHoldpointYaml } from \"@holdpoint/yaml-core\";\nimport type { AgentType, StackType } from \"@holdpoint/types\";\nimport { detectStack, detectPackageManager } from \"../detect.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nfunction getTemplatePath(stack: StackType): string {\n const name = stack === \"unknown\" ? \"_base\" : stack;\n const candidates = [\n join(__dirname, \"templates\", `${name}.yaml`), // dist/templates/ (published package)\n join(__dirname, \"../../../templates\", `${name}.yaml`), // monorepo dev fallback\n join(process.cwd(), \"templates\", `${name}.yaml`), // cwd fallback\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return \"\";\n}\n\nfunction getMasterPromptPath(): string {\n const candidates = [\n join(__dirname, \"templates/MASTER_PROMPT.md\"), // dist/templates/ (published package)\n join(__dirname, \"../../../templates/MASTER_PROMPT.md\"), // monorepo dev fallback\n join(process.cwd(), \"templates/MASTER_PROMPT.md\"), // cwd fallback\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return \"\";\n}\n\nconst MINIMAL_CHECKS_YAML = `version: 1\ncontext:\n guides: {}\nconditions: []\nchecks:\n - id: lint\n label: \"Lint codebase\"\n cmd: \"echo 'Add your lint command here'\"\n\n - id: jsdoc\n label: \"JSDoc on changed public functions\"\n prompt: \"Ensure all changed public functions and exports have JSDoc comments.\"\n`;\n\n/**\n * Initialise Holdpoint in the current project.\n *\n * Writes `checks.yaml` (from a stack template if available), `checks.immutable.json`,\n * and engine adapter files for each target agent (Copilot, Claude, Cursor, Codex).\n * Defaults to installing all four agents; pass `--agent` to restrict to one.\n */\nexport async function initCommand(options: { stack?: string; agent?: string }): Promise<void> {\n const spinner = ora(\"Initialising Holdpoint…\").start();\n\n const stack = (options.stack as StackType | undefined) ?? detectStack();\n\n // Default: install for all agents. Pass --agent=copilot|claude|cursor to restrict.\n const agentOpt = options.agent;\n const agents: AgentType[] =\n !agentOpt || agentOpt === \"all\"\n ? [\"copilot\", \"claude\", \"cursor\", \"codex\"]\n : [agentOpt as AgentType];\n\n spinner.text = `Stack: ${chalk.cyan(stack)} — installing for: ${chalk.cyan(agents.join(\", \"))}`;\n\n // 1. Read or create checks.yaml\n let yamlContent = MINIMAL_CHECKS_YAML;\n if (!existsSync(\"checks.yaml\")) {\n const templatePath = getTemplatePath(stack);\n if (templatePath) {\n yamlContent = readFileSync(templatePath, \"utf8\");\n }\n // Substitute the package manager so checks use the right runner (npm/yarn/pnpm).\n const pm = detectPackageManager();\n if (pm !== \"pnpm\") {\n yamlContent = yamlContent.replace(/\\bpnpm\\b/g, pm);\n }\n writeFileSync(\"checks.yaml\", yamlContent, \"utf8\");\n } else {\n yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n }\n\n const config = parseHoldpointYaml(yamlContent);\n\n // 2. Write checks.immutable.json — read by holdpoint-check.mjs at runtime\n const generatedDir = \".github/holdpoint/generated\";\n mkdirSync(generatedDir, { recursive: true });\n writeFileSync(`${generatedDir}/checks.immutable.json`, buildConfigJson(config), \"utf8\");\n\n // 3. Install engine files for each target agent\n if (agents.includes(\"copilot\")) {\n // extension.mjs handles both session context injection (onSessionStart) and\n // check enforcement (onPreToolUse → task_complete). No separate hooks files needed.\n const extDir = \".github/extensions/holdpoint\";\n mkdirSync(extDir, { recursive: true });\n writeFileSync(join(extDir, \"extension.mjs\"), buildEngine(config), \"utf8\");\n }\n\n if (agents.includes(\"claude\")) {\n mkdirSync(\".claude\", { recursive: true });\n const settingsPath = \".claude/settings.json\";\n let existing: Record<string, unknown> = {};\n if (existsSync(settingsPath)) {\n try {\n existing = JSON.parse(readFileSync(settingsPath, \"utf8\")) as Record<string, unknown>;\n } catch {\n /* ignore */\n }\n }\n const holdpointHooks = JSON.parse(buildClaudeEngineJson(config)) as Record<string, unknown>;\n writeFileSync(\n settingsPath,\n JSON.stringify({ ...existing, hooks: holdpointHooks.hooks }, null, 2),\n \"utf8\",\n );\n }\n\n if (agents.includes(\"cursor\")) {\n const cursorRules = buildCursorEngine(config);\n const cursorPath = \".cursorrules\";\n if (existsSync(cursorPath)) {\n const existing = readFileSync(cursorPath, \"utf8\");\n if (!existing.includes(\"Holdpoint Rules\")) {\n writeFileSync(cursorPath, existing + \"\\n\" + cursorRules, \"utf8\");\n }\n } else {\n writeFileSync(cursorPath, cursorRules, \"utf8\");\n }\n }\n\n if (agents.includes(\"codex\")) {\n mkdirSync(\".codex\", { recursive: true });\n writeFileSync(\".codex/hooks.json\", buildCodexHooksJson(config), \"utf8\");\n writeFileSync(\".codex/holdpoint-check.mjs\", buildCodexCheckScript(config), \"utf8\");\n writeFileSync(\".codex/config.toml\", buildCodexConfigToml(), \"utf8\");\n const agentsMdPath = \"AGENTS.md\";\n const existing = existsSync(agentsMdPath) ? readFileSync(agentsMdPath, \"utf8\") : \"\";\n writeFileSync(agentsMdPath, spliceAgentsMd(existing, config), \"utf8\");\n }\n\n // 4. Create MASTER_PROMPT.md if not present\n if (!existsSync(\"MASTER_PROMPT.md\")) {\n const guidePath = getMasterPromptPath();\n if (guidePath) {\n copyFileSync(guidePath, \"MASTER_PROMPT.md\");\n } else {\n // Fallback: minimal prompt if template file is not bundled\n writeFileSync(\n \"MASTER_PROMPT.md\",\n \"# Holdpoint\\n\\nRun `npx @holdpoint/cli@alpha check` before marking any task complete.\\nSee `checks.yaml` for the full list of checks.\\n\",\n \"utf8\",\n );\n }\n }\n\n spinner.succeed(chalk.bold.green(\"Holdpoint initialised!\"));\n\n console.log(`\n${chalk.cyan(\"Next steps:\")}\n 1. Edit ${chalk.yellow(\"checks.yaml\")} to customise your eval checkpoints\n 2. Commit ${chalk.yellow(\"checks.yaml\")} and the generated engine files\n 3. Run ${chalk.yellow(\"npx @holdpoint/cli@alpha check\")} at any time to validate\n\n Visual builder: ${chalk.yellow(\"npx @holdpoint/cli@alpha builder\")} (opens localhost:4321)\n Stack: ${chalk.cyan(stack)} Agents: ${chalk.cyan(agents.join(\", \"))}\n`);\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport type { AgentType, StackType } from \"@holdpoint/types\";\n\nexport type PackageManager = \"pnpm\" | \"yarn\" | \"npm\";\n\n/** Detect which package manager owns the current project by checking lock files. */\nexport function detectPackageManager(): PackageManager {\n if (existsSync(\"pnpm-lock.yaml\")) return \"pnpm\";\n if (existsSync(\"yarn.lock\")) return \"yarn\";\n return \"npm\";\n}\n\n/** @deprecated Use detectInstalledAgents() — single-agent detection is no longer the default. */\nexport function detectAgent(): AgentType {\n if (existsSync(\".github/extensions\")) return \"copilot\";\n if (existsSync(\".claude\")) return \"claude\";\n if (existsSync(\".cursorrules\")) return \"cursor\";\n if (existsSync(\".codex\")) return \"codex\";\n return \"unknown\";\n}\n\n/**\n * Returns every agent whose Holdpoint engine files are already present in the\n * current working directory. Used by `holdpoint update` so it regenerates only\n * the engines that were previously installed.\n */\nexport function detectInstalledAgents(): AgentType[] {\n const agents: AgentType[] = [];\n if (existsSync(\".github/extensions/holdpoint/extension.mjs\")) agents.push(\"copilot\");\n if (existsSync(\".claude/settings.json\")) agents.push(\"claude\");\n if (existsSync(\".cursorrules\")) {\n try {\n if (readFileSync(\".cursorrules\", \"utf8\").includes(\"Holdpoint Rules\")) {\n agents.push(\"cursor\");\n }\n } catch {\n /* ignore unreadable file */\n }\n }\n // Detect Codex by the generated check script (more specific than .codex/ existence)\n if (existsSync(\".codex/holdpoint-check.mjs\")) agents.push(\"codex\");\n return agents;\n}\n\nexport function detectStack(): StackType {\n const hasNext =\n existsSync(\"next.config.ts\") || existsSync(\"next.config.js\") || existsSync(\"next.config.mjs\");\n const hasTsConfig = existsSync(\"tsconfig.json\");\n const hasPyproject =\n existsSync(\"pyproject.toml\") || existsSync(\"requirements.txt\") || existsSync(\"setup.py\");\n const hasPrisma = existsSync(\"prisma/schema.prisma\");\n const hasApi = existsSync(\"server\") || existsSync(\"api\") || existsSync(\"backend\");\n const hasGoMod = existsSync(\"go.mod\");\n\n if (hasNext && (hasPrisma || hasApi)) return \"fullstack\";\n if (hasNext) return \"nextjs\";\n if (hasTsConfig) return \"typescript\";\n if (hasPyproject) return \"python\";\n if (hasGoMod) return \"go\";\n return \"unknown\";\n}\n","import { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml, matchesWhen } from \"@holdpoint/yaml-core\";\nimport { runDeterministicChecks } from \"@holdpoint/yaml-core/runner\";\nimport type { CheckResult, CheckRun, CheckReports } from \"@holdpoint/types\";\nimport { execSync } from \"node:child_process\";\n\nconst COMMIT_CACHE_PATH = \".holdpoint/checked-commits.json\";\nconst COMMIT_CACHE_MAX = 100;\nconst CHECK_REPORTS_PATH = \".holdpoint/check-reports.json\";\nconst CHECK_REPORTS_MAX = 50;\n\nfunction getStagedFiles(): string[] {\n try {\n const out = execSync(\"git diff --cached --name-only\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\nfunction getAllChangedFiles(): string[] {\n try {\n const out = execSync(\"git diff --name-only HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\n/**\n * Returns the files changed in the most recent commit (HEAD vs HEAD~1).\n * Used as a fallback when no staged files exist but the agent has already committed.\n */\nfunction getLastCommitFiles(): string[] {\n try {\n const out = execSync(\"git diff --name-only HEAD~1 HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\n/** Returns the current HEAD commit SHA, or null if unavailable. */\nfunction getHeadSha(): string | null {\n try {\n return execSync(\"git rev-parse HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n return null;\n }\n}\n\n/** Returns the set of already-verified commit SHAs from the local cache. */\nfunction readCommitCache(): Set<string> {\n try {\n const raw = readFileSync(COMMIT_CACHE_PATH, \"utf8\");\n const parsed = JSON.parse(raw) as { verified?: unknown };\n return new Set(Array.isArray(parsed.verified) ? (parsed.verified as string[]) : []);\n } catch {\n return new Set();\n }\n}\n\n/**\n * Records a commit SHA as verified in the local cache.\n * Caps the cache at COMMIT_CACHE_MAX entries (newest first).\n */\nfunction recordCommitCache(sha: string): void {\n try {\n const existing = readCommitCache();\n const updated = [sha, ...[...existing].filter((s) => s !== sha)].slice(0, COMMIT_CACHE_MAX);\n mkdirSync(join(COMMIT_CACHE_PATH, \"..\"), { recursive: true });\n writeFileSync(COMMIT_CACHE_PATH, JSON.stringify({ verified: updated }, null, 2) + \"\\n\", \"utf8\");\n } catch {\n // Non-fatal: cache write failure just means the next run re-checks this commit.\n }\n}\n\n/**\n * Appends a check run report to `.holdpoint/check-reports.json`.\n * Caps to CHECK_REPORTS_MAX runs, newest first. Non-fatal if write fails.\n */\nfunction recordCheckReport(run: CheckRun): void {\n try {\n mkdirSync(join(CHECK_REPORTS_PATH, \"..\"), { recursive: true });\n let existing: CheckReports = { runs: [] };\n if (existsSync(CHECK_REPORTS_PATH)) {\n try {\n existing = JSON.parse(readFileSync(CHECK_REPORTS_PATH, \"utf8\")) as CheckReports;\n if (!Array.isArray(existing.runs)) existing.runs = [];\n } catch {\n existing = { runs: [] };\n }\n }\n const updated: CheckReports = {\n runs: [run, ...existing.runs].slice(0, CHECK_REPORTS_MAX),\n };\n writeFileSync(CHECK_REPORTS_PATH, JSON.stringify(updated, null, 2) + \"\\n\", \"utf8\");\n } catch {\n // Non-fatal: report write failure does not affect check outcomes.\n }\n}\n\nexport async function checkCommand(options: { staged?: boolean }): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n let config;\n try {\n config = parseHoldpointYaml(yamlContent);\n } catch (err: unknown) {\n console.error(chalk.red(\"Invalid checks.yaml:\"), (err as Error).message);\n process.exit(1);\n }\n\n // Always resolve HEAD SHA — used for both cache and reports.\n const headSha = getHeadSha();\n\n let changedFiles: string[];\n let usedHeadShaForCache = false;\n\n if (options.staged) {\n const staged = getStagedFiles();\n if (staged.length > 0) {\n changedFiles = staged;\n } else {\n // Nothing staged — check if HEAD was already verified to avoid a check loop.\n if (headSha && readCommitCache().has(headSha)) {\n console.log(\n chalk.green(`✓ Commit ${headSha.slice(0, 8)} already verified — nothing to re-check.`),\n );\n process.exit(0);\n }\n\n // Fall back to files in the most recent commit (covers the\n // \"agent committed then called task_complete\" workflow).\n const lastCommit = getLastCommitFiles();\n if (lastCommit.length > 0) {\n changedFiles = lastCommit;\n usedHeadShaForCache = true;\n console.log(\n chalk.yellow(\"No staged files. Running checks scoped to the most recent commit's files.\"),\n );\n } else {\n // Truly nothing changed (investigative session, no recent commit).\n console.log(chalk.green(\"✓ No staged changes and no recent commit — nothing to check.\"));\n process.exit(0);\n }\n }\n } else {\n changedFiles = getAllChangedFiles();\n if (changedFiles.length === 0) {\n console.log(\n chalk.yellow(\"No changed files detected. Running all checks with no file filter.\"),\n );\n console.log(\n chalk.dim(\n \" Tip: if you just ran `holdpoint init`, commit the generated files to clear the git-commit check.\",\n ),\n );\n }\n }\n\n // Print project guides so the agent/human sees them before running checks\n const guides = Object.entries(config.context?.guides ?? {});\n if (guides.length > 0) {\n console.log(chalk.cyan(\"\\nProject guides:\"));\n for (const [key, text] of guides) {\n console.log(chalk.bold(` ${key}:`), chalk.dim(String(text).trim()));\n }\n console.log(\"\");\n }\n\n const taskCount = config.checks.filter((c) => c.cmd !== undefined).length;\n const spinner = ora(`Running ${taskCount} task(s)…`).start();\n const effectiveFiles = changedFiles.length > 0 ? changedFiles : [\"__all__\"];\n const results = runDeterministicChecks(config, effectiveFiles);\n\n const passed = results.filter((r) => r.status === \"pass\");\n const failed = results.filter((r) => r.status === \"fail\");\n const skipped = results.filter((r) => r.status === \"skip\");\n\n spinner.stop();\n\n // Print results\n for (const result of results) {\n printResult(result);\n }\n\n // Summary\n console.log(\"\");\n console.log(\n [\n chalk.green(`✓ ${passed.length} passed`),\n failed.length > 0 ? chalk.red(`✗ ${failed.length} failed`) : \"\",\n skipped.length > 0 ? chalk.gray(`◌ ${skipped.length} skipped`) : \"\",\n ]\n .filter(Boolean)\n .join(\" \"),\n );\n\n // Prompt checks: show those whose when filter matches the changed files\n const promptChecks = config.checks.filter(\n (c) =>\n c.prompt !== undefined &&\n matchesWhen(c.when, changedFiles.length > 0 ? changedFiles : [\"__all__\"], config.patterns),\n );\n if (promptChecks.length > 0) {\n console.log(`\\n${chalk.cyan(\"Agent prompts to act on:\")}`);\n for (const c of promptChecks) {\n console.log(` ${chalk.yellow(\"□\")} [${c.label}] ${c.prompt ?? \"\"}`);\n }\n }\n\n // Write rich check run report BEFORE exiting so failed runs are always recorded.\n const reportResults = [\n ...results.map((r) => ({\n id: r.check.id,\n label: r.check.label,\n kind: \"cmd\" as const,\n status: r.status as \"pass\" | \"fail\" | \"skip\",\n ...(r.output !== undefined ? { output: r.output } : {}),\n ...(r.exitCode !== undefined ? { exitCode: r.exitCode } : {}),\n ...(r.skipReason !== undefined ? { skipReason: r.skipReason } : {}),\n })),\n ...promptChecks.map((c) => ({\n id: c.id,\n label: c.label,\n kind: \"prompt\" as const,\n status: \"shown\" as const,\n })),\n ];\n\n const run = {\n sha: headSha,\n shortSha: headSha ? headSha.slice(0, 8) : null,\n timestamp: new Date().toISOString(),\n files: changedFiles.length > 0 ? changedFiles : [],\n results: reportResults,\n summary: {\n passed: passed.length,\n failed: failed.length,\n skipped: skipped.length,\n shown: promptChecks.length,\n },\n };\n recordCheckReport(run);\n\n if (failed.length > 0) {\n process.exit(1);\n }\n\n // All checks passed — if we ran against a committed HEAD (no staged files), mark it verified.\n if (usedHeadShaForCache && headSha) {\n recordCommitCache(headSha);\n }\n}\n\nfunction printResult(result: CheckResult): void {\n const icon =\n result.status === \"pass\"\n ? chalk.green(\"✓\")\n : result.status === \"fail\"\n ? chalk.red(\"✗\")\n : result.status === \"skip\"\n ? chalk.gray(\"◌\")\n : chalk.yellow(\"…\");\n\n const label = result.check.label;\n console.log(`${icon} ${label}`);\n\n if (result.status === \"fail\" && result.output) {\n const trimmed = result.output.trim().split(\"\\n\").slice(0, 10).join(\"\\n\");\n console.log(chalk.dim(trimmed.replace(/^/gm, \" \")));\n }\n if (result.status === \"skip\" && result.skipReason) {\n console.log(chalk.dim(` ${result.skipReason}`));\n }\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { parseHoldpointYaml, validateConfig } from \"@holdpoint/yaml-core\";\n\nexport async function validateCommand(): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const text = readFileSync(\"checks.yaml\", \"utf8\");\n\n let config;\n try {\n config = parseHoldpointYaml(text);\n } catch (err: unknown) {\n console.error(chalk.red(\"Parse error:\"), (err as Error).message);\n process.exit(1);\n }\n\n const result = validateConfig(config);\n\n if (result.valid) {\n console.log(chalk.green(\"✓ checks.yaml is valid\"));\n console.log(\n chalk.dim(\n ` ${config.checks.filter((c) => c.cmd !== undefined).length} tasks, ${config.checks.filter((c) => c.prompt !== undefined).length} prompts, ${config.conditions.length} conditions`,\n ),\n );\n } else {\n console.error(chalk.red(\"✗ checks.yaml has errors:\"));\n for (const err of result.errors) {\n console.error(` ${chalk.yellow(err.path)}: ${err.message}`);\n }\n process.exit(1);\n }\n}\n","import { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml } from \"@holdpoint/yaml-core\";\nimport { buildConfigJson, buildEngine } from \"@holdpoint/engine-copilot\";\nimport { buildEngineJson as buildClaudeEngineJson } from \"@holdpoint/engine-claude\";\nimport { buildEngine as buildCursorEngine } from \"@holdpoint/engine-cursor\";\nimport {\n buildConfigToml as buildCodexConfigToml,\n buildHooksJson as buildCodexHooksJson,\n buildCheckScript as buildCodexCheckScript,\n spliceAgentsMd,\n} from \"@holdpoint/engine-codex\";\nimport { detectInstalledAgents } from \"../detect.js\";\nimport type { AgentType } from \"@holdpoint/types\";\n\n/**\n * Regenerate all Holdpoint engine adapter files from the current `checks.yaml`.\n *\n * Detects which agents were previously installed via `detectInstalledAgents()` and\n * regenerates only their files. Falls back to all four agents if no engine files\n * are found (e.g. first run after a manual `checks.yaml` edit).\n */\nexport async function updateCommand(): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const spinner = ora(\"Updating Holdpoint engine files…\").start();\n const config = parseHoldpointYaml(readFileSync(\"checks.yaml\", \"utf8\"));\n\n // Regenerate for every agent that was previously installed.\n // Fall back to all four if no engine files exist yet (e.g. first run after manual checks.yaml edit).\n const detected = detectInstalledAgents();\n const agents: AgentType[] =\n detected.length > 0 ? detected : [\"copilot\", \"claude\", \"cursor\", \"codex\"];\n\n // Always write checks.immutable.json — read by holdpoint-check.mjs at runtime\n const generatedDir = \".github/holdpoint/generated\";\n mkdirSync(generatedDir, { recursive: true });\n writeFileSync(`${generatedDir}/checks.immutable.json`, buildConfigJson(config), \"utf8\");\n\n if (agents.includes(\"copilot\")) {\n const extDir = \".github/extensions/holdpoint\";\n mkdirSync(extDir, { recursive: true });\n writeFileSync(`${extDir}/extension.mjs`, buildEngine(config), \"utf8\");\n }\n\n if (agents.includes(\"claude\")) {\n mkdirSync(\".claude\", { recursive: true });\n const settingsPath = \".claude/settings.json\";\n let existing: Record<string, unknown> = {};\n if (existsSync(settingsPath)) {\n try {\n existing = JSON.parse(readFileSync(settingsPath, \"utf8\")) as Record<string, unknown>;\n } catch {\n /* */\n }\n }\n const hooks = JSON.parse(buildClaudeEngineJson(config)) as Record<string, unknown>;\n writeFileSync(\n settingsPath,\n JSON.stringify({ ...existing, hooks: hooks.hooks }, null, 2) + \"\\n\",\n );\n }\n\n if (agents.includes(\"cursor\")) {\n const cursorRules = buildCursorEngine(config);\n const cursorPath = \".cursorrules\";\n if (existsSync(cursorPath)) {\n const content = readFileSync(cursorPath, \"utf8\");\n const start = content.indexOf(\"# ─── Holdpoint Rules\");\n const end = content.indexOf(\"# ─── End Holdpoint Rules ───\");\n if (start !== -1 && end !== -1) {\n // Slice past the end-marker line (find its newline to avoid hardcoded offsets)\n const afterEnd = content.indexOf(\"\\n\", end);\n const updated =\n content.slice(0, start) +\n cursorRules +\n content.slice(afterEnd === -1 ? end : afterEnd + 1);\n writeFileSync(cursorPath, updated);\n } else {\n writeFileSync(cursorPath, content + \"\\n\" + cursorRules);\n }\n }\n }\n\n if (agents.includes(\"codex\")) {\n mkdirSync(\".codex\", { recursive: true });\n // hooks.json is fully managed by Holdpoint; users who need additional Codex hooks\n // should add them in .codex/config.toml (Codex merges both sources).\n writeFileSync(\".codex/hooks.json\", buildCodexHooksJson(config), \"utf8\");\n writeFileSync(\".codex/holdpoint-check.mjs\", buildCodexCheckScript(config), \"utf8\");\n // Ensure hooks are explicitly enabled at the repo level.\n const configTomlPath = \".codex/config.toml\";\n if (!existsSync(configTomlPath)) {\n writeFileSync(configTomlPath, buildCodexConfigToml(), \"utf8\");\n } else {\n const existing = readFileSync(configTomlPath, \"utf8\");\n if (!existing.includes(\"[features]\")) {\n writeFileSync(configTomlPath, existing.trimEnd() + \"\\n\\n\" + buildCodexConfigToml(), \"utf8\");\n }\n // [features] already present — trust the user's settings\n }\n const agentsMdPath = \"AGENTS.md\";\n const existing = existsSync(agentsMdPath) ? readFileSync(agentsMdPath, \"utf8\") : \"\";\n writeFileSync(agentsMdPath, spliceAgentsMd(existing, config), \"utf8\");\n }\n\n spinner.succeed(chalk.green(\"Engine files updated from current checks.yaml\"));\n}\n","import { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport { createReadStream, existsSync } from \"node:fs\";\nimport { join, extname, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { execSync } from \"node:child_process\";\nimport chalk from \"chalk\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst MIME: Record<string, string> = {\n \".html\": \"text/html; charset=utf-8\",\n \".js\": \"text/javascript\",\n \".mjs\": \"text/javascript\",\n \".css\": \"text/css\",\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".ico\": \"image/x-icon\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".json\": \"application/json\",\n};\n\n/**\n * Serve a static file with the appropriate MIME type.\n */\nfunction serveFile(res: ServerResponse, filePath: string): void {\n const mime = MIME[extname(filePath)] ?? \"application/octet-stream\";\n res.writeHead(200, { \"Content-Type\": mime });\n createReadStream(filePath).pipe(res);\n}\n\n/**\n * Handle an incoming HTTP request: serve `/__holdpoint/initial-yaml` from the\n * user's `checks.yaml`, `/__holdpoint/initial-reports` from the run history,\n * and all other paths as static files from `uiDir` with a SPA fallback to `index.html`.\n */\nfunction handleRequest(req: IncomingMessage, res: ServerResponse, uiDir: string): void {\n const url = (req.url ?? \"/\").split(\"?\")[0] ?? \"/\";\n\n // Serve the user's checks.yaml for the builder UI to load\n if (url === \"/__holdpoint/initial-yaml\") {\n const checksPath = join(process.cwd(), \"checks.yaml\");\n if (existsSync(checksPath)) {\n res.writeHead(200, { \"Content-Type\": \"text/yaml; charset=utf-8\" });\n createReadStream(checksPath).pipe(res);\n } else {\n res.writeHead(404, { \"Content-Type\": \"text/plain\" });\n res.end(\"checks.yaml not found in current directory\");\n }\n return;\n }\n\n // Serve the check run history for the History tab\n if (url === \"/__holdpoint/initial-reports\") {\n const reportsPath = join(process.cwd(), \".holdpoint\", \"check-reports.json\");\n if (existsSync(reportsPath)) {\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n createReadStream(reportsPath).pipe(res);\n } else {\n res.writeHead(404, { \"Content-Type\": \"text/plain\" });\n res.end(\"No check reports found\");\n }\n return;\n }\n\n // Static files\n const candidate = join(uiDir, url === \"/\" ? \"index.html\" : url);\n const filePath = existsSync(candidate) ? candidate : join(uiDir, \"index.html\"); // SPA fallback\n serveFile(res, filePath);\n}\n\n/**\n * Start the Holdpoint visual builder on localhost:4321.\n *\n * Serves the pre-built React SPA from `dist/builder-ui/` (bundled into the CLI\n * package at publish time) and exposes a `/__holdpoint/initial-yaml` endpoint\n * that returns the user's `checks.yaml` so the builder can load it on startup.\n */\nexport async function buildCommand(): Promise<void> {\n const port = 4321;\n const uiDir = join(__dirname, \"builder-ui\");\n\n if (!existsSync(uiDir)) {\n console.error(chalk.red(\"✗ Builder UI not found.\\n\"));\n console.log(chalk.dim(\" This is unexpected for a published build of @holdpoint/cli.\"));\n console.log(chalk.dim(\" If you installed from source, rebuild with: pnpm turbo build\\n\"));\n process.exit(1);\n }\n\n const server = createServer((req, res) => handleRequest(req, res, uiDir));\n\n await new Promise<void>((resolve, reject) => {\n server.listen(port, () => {\n console.log(\n `\\n${chalk.green(\"✓\")} Holdpoint builder running at ${chalk.cyan(`http://localhost:${port}`)}`,\n );\n console.log(chalk.dim(\" Edit checks.yaml, then reload the page to see updates\"));\n console.log(chalk.dim(\" Press Ctrl+C to stop\\n\"));\n\n const openCmd =\n process.platform === \"darwin\"\n ? \"open\"\n : process.platform === \"win32\"\n ? \"start\"\n : \"xdg-open\";\n try {\n execSync(`${openCmd} http://localhost:${port}`, { stdio: \"ignore\" });\n } catch {\n /* non-fatal */\n }\n });\n\n server.on(\"error\", reject);\n\n process.on(\"SIGINT\", () => {\n console.log(chalk.dim(\"\\n Stopping builder…\"));\n server.close(() => resolve());\n });\n });\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { execSync } from \"node:child_process\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml, generateYaml } from \"@holdpoint/yaml-core\";\nimport type { HoldpointConfig, CheckDef, ConditionDef } from \"@holdpoint/types\";\nimport { scanProject } from \"../evolve/scanner.js\";\nimport { getRepoFiles, detectStaleChecks } from \"../evolve/dead-checker.js\";\nimport { getTemplates } from \"../evolve/templates.js\";\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Strip leading comment lines from a checks.yaml so we can re-prepend them\n * after re-serialising — preserves the documentation header.\n */\nfunction extractHeader(yaml: string): string {\n const lines = yaml.split(\"\\n\");\n const commentLines: string[] = [];\n for (const line of lines) {\n if (line.startsWith(\"#\") || (commentLines.length > 0 && line.trim() === \"\")) {\n commentLines.push(line);\n } else {\n break;\n }\n }\n // Trim trailing blank lines\n while (commentLines.length > 0 && commentLines[commentLines.length - 1]?.trim() === \"\") {\n commentLines.pop();\n }\n return commentLines.join(\"\\n\");\n}\n\nfunction withHeader(header: string, newYaml: string): string {\n if (!header) return newYaml;\n return header + \"\\n\\n\" + newYaml;\n}\n\n// ── The command ───────────────────────────────────────────────────────────────\n\nexport async function evolveCommand(options: { apply?: boolean }): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const spinner = ora(\"Scanning project profile…\").start();\n const cwd = process.cwd();\n\n // 1. Scan project\n const profile = scanProject(cwd);\n const repoFiles = getRepoFiles(cwd);\n\n // 2. Parse checks.yaml\n const yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n let config: HoldpointConfig;\n try {\n config = parseHoldpointYaml(yamlContent);\n } catch (err: unknown) {\n spinner.fail(chalk.red(\"Invalid checks.yaml:\") + \" \" + (err as Error).message);\n process.exit(1);\n }\n\n spinner.stop();\n\n // 3. Compute proposals — templates whose trigger matches AND id not already in config\n const existingIds = new Set(config.checks.map((c) => c.id));\n const existingConditionIds = new Set(config.conditions.map((c) => c.id));\n const allTemplates = getTemplates(profile);\n const proposals = allTemplates.filter((t) => t.trigger(profile) && !existingIds.has(t.id));\n\n // 4. Detect stale checks\n const staleChecks = detectStaleChecks(config, repoFiles);\n\n // ── Print report ─────────────────────────────────────────────────────────\n\n // Profile summary — show detected items\n console.log(chalk.bold(\"\\n📋 Project profile:\"));\n const traits: [string, boolean, string][] = [\n [\"TypeScript\", profile.hasTypeScript, \"tsconfig.json\"],\n [\"ESLint\", profile.hasEslint, \"eslint.config.*\"],\n [\"Biome\", profile.hasBiome, \"biome.json\"],\n [\"Ruff\", profile.hasRuff, \"pyproject.toml / ruff\"],\n [\"Prettier\", profile.hasPrettier, \".prettierrc\"],\n [\"Vitest\", profile.hasVitest, \"devDependencies\"],\n [\"Jest\", profile.hasJest, \"devDependencies\"],\n [\"Python\", profile.hasPython, \"pyproject.toml\"],\n [\"Pytest\", profile.hasPytest, \"pytest.ini\"],\n [\"Go\", profile.hasGo, \"go.mod\"],\n [\"Rust\", profile.hasRust, \"Cargo.toml\"],\n [\"Next.js\", profile.hasNext, \"next.config.*\"],\n [\"React\", profile.hasReact, \"dependencies\"],\n [\"Prisma\", profile.hasPrisma, \"prisma/schema.prisma\"],\n [\"Drizzle\", profile.hasDrizzle, \"drizzle-orm\"],\n [\"Migrations\", profile.hasMigrations, \"migrations/\"],\n [\"Docker\", profile.hasDocker, \"Dockerfile\"],\n [\"Terraform\", profile.hasTerraform, \"*.tf\"],\n [\"Kubernetes\", profile.hasKubernetes, \"k8s/\"],\n [\"OpenAPI\", profile.hasOpenApi, \"openapi.yaml\"],\n [\"GitHub Actions\", profile.hasGithubActions, \".github/workflows/\"],\n ];\n const detected = traits.filter(([, yes]) => yes);\n if (detected.length === 0) {\n console.log(chalk.dim(\" (empty project — only universal checks apply)\"));\n } else {\n for (const [name, , hint] of detected) {\n console.log(` ${chalk.green(\"✓\")} ${name.padEnd(18)} ${chalk.dim(hint)}`);\n }\n }\n\n // Stale checks\n if (staleChecks.length > 0) {\n console.log(chalk.bold(`\\n⚠️ Stale checks (${staleChecks.length}):`));\n for (const { check, reason, suggestedConditionPath } of staleChecks) {\n const fix = suggestedConditionPath\n ? chalk.dim(` → will wrap with conditionId: file_exists: ${suggestedConditionPath}`)\n : chalk.dim(\" → no path inferred; review manually\");\n console.log(` ${chalk.yellow(\"◌\")} ${chalk.bold(check.id)} ${chalk.dim(reason)}${fix}`);\n }\n }\n\n // Proposals\n if (proposals.length === 0 && staleChecks.length === 0) {\n console.log(chalk.green(\"\\n✓ checks.yaml is fully in sync with the project profile.\"));\n return;\n }\n\n if (proposals.length > 0) {\n console.log(chalk.bold(`\\n💡 Proposed additions (${proposals.length}):`));\n for (const t of proposals) {\n const scope = t.when ? chalk.cyan(` when: ${t.when}`) : \"\";\n const type = t.cmd ? chalk.dim(\"cmd\") : chalk.dim(\"prompt\");\n const preview = t.cmd\n ? chalk.dim(` ${t.cmd.slice(0, 80)}${t.cmd.length > 80 ? \"…\" : \"\"}`)\n : chalk.dim(` ${(t.prompt ?? \"\").slice(0, 80)}${(t.prompt?.length ?? 0) > 80 ? \"…\" : \"\"}`);\n console.log(` ${chalk.green(\"+\")} ${chalk.bold(t.id.padEnd(24))} [${type}]${scope}`);\n console.log(` ${preview}`);\n }\n }\n\n if (!options.apply) {\n console.log(\n chalk.red(`\\n✗ checks.yaml is out of sync with the project profile.`) +\n `\\n Run ${chalk.bold(\"npx @holdpoint/cli@alpha evolve --apply\")} to apply these changes.`,\n );\n process.exit(1);\n }\n\n // ── Apply ───────────────────────────────────────────────────────────────\n\n const applySpinner = ora(\"Applying changes to checks.yaml…\").start();\n\n // Build updated conditions list\n const newConditions = [...config.conditions];\n\n // Collect conditions needed by proposals\n for (const t of proposals) {\n if (t.condition && !existingConditionIds.has(t.condition.id)) {\n newConditions.push(t.condition as ConditionDef);\n existingConditionIds.add(t.condition.id);\n }\n }\n\n // Wrap stale checks with file_exists conditions\n const updatedChecks: CheckDef[] = config.checks.map((check) => {\n const stale = staleChecks.find((s) => s.check.id === check.id);\n if (!stale || !stale.suggestedConditionPath) return check;\n\n const condId = `has-${check.id}`;\n if (!existingConditionIds.has(condId)) {\n newConditions.push({\n id: condId,\n operator: \"file_exists\",\n path: stale.suggestedConditionPath,\n });\n existingConditionIds.add(condId);\n }\n return { ...check, conditionId: condId };\n });\n\n // Append proposed checks\n const newChecks: CheckDef[] = proposals.map((t) => ({\n id: t.id,\n label: t.label,\n ...(t.when ? { when: t.when } : {}),\n ...(t.cmd ? { cmd: t.cmd } : {}),\n ...(t.prompt ? { prompt: t.prompt } : {}),\n ...(t.conditionId ? { conditionId: t.conditionId } : {}),\n }));\n\n const updatedConfig: HoldpointConfig = {\n ...config,\n conditions: newConditions,\n checks: [...updatedChecks, ...newChecks],\n };\n\n const header = extractHeader(yamlContent);\n const newYaml = withHeader(header, generateYaml(updatedConfig));\n writeFileSync(\"checks.yaml\", newYaml, \"utf8\");\n\n // Regenerate engine files\n applySpinner.text = \"Running holdpoint update…\";\n try {\n execSync(\"npx @holdpoint/cli@alpha update\", { stdio: \"pipe\" });\n } catch {\n // holdpoint update failure is non-fatal — checks.yaml is already written\n applySpinner.warn(\n chalk.yellow(\"checks.yaml updated, but `holdpoint update` failed — run it manually.\"),\n );\n printAppliedSummary(proposals.length, staleChecks.length);\n return;\n }\n\n applySpinner.succeed(chalk.green(\"checks.yaml updated and engine files regenerated.\"));\n printAppliedSummary(proposals.length, staleChecks.length);\n}\n\nfunction printAppliedSummary(added: number, wrapped: number): void {\n const parts: string[] = [];\n if (added > 0) parts.push(chalk.green(`${added} check${added === 1 ? \"\" : \"s\"} added`));\n if (wrapped > 0)\n parts.push(chalk.yellow(`${wrapped} stale check${wrapped === 1 ? \"\" : \"s\"} wrapped`));\n if (parts.length > 0) console.log(\" \" + parts.join(\" · \"));\n console.log(\n chalk.dim(\"\\n Review checks.yaml, then commit: \") +\n chalk.yellow(\"git add checks.yaml && git commit -m 'chore: evolve holdpoint checks'\"),\n );\n}\n","import { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nexport interface ProjectProfile {\n // Languages\n hasTypeScript: boolean;\n hasPython: boolean;\n hasGo: boolean;\n hasRust: boolean;\n hasJava: boolean;\n hasRuby: boolean;\n // Frameworks\n hasNext: boolean;\n hasReact: boolean;\n // Linting\n hasEslint: boolean;\n hasBiome: boolean;\n hasRuff: boolean;\n hasPrettier: boolean;\n // Testing\n hasVitest: boolean;\n hasJest: boolean;\n hasPytest: boolean;\n // DB\n hasPrisma: boolean;\n hasDrizzle: boolean;\n hasMigrations: boolean;\n hasAlembic: boolean;\n // Infra\n hasDocker: boolean;\n hasTerraform: boolean;\n hasKubernetes: boolean;\n // API\n hasOpenApi: boolean;\n // CI\n hasGithubActions: boolean;\n // Package manager\n packageManager: \"pnpm\" | \"yarn\" | \"bun\" | \"npm\";\n // Raw scripts from package.json\n scripts: Record<string, string>;\n // All dep names (deps + devDeps)\n deps: Set<string>;\n}\n\ntype PkgJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n};\n\nfunction tryReadJson<T>(path: string): T | null {\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as T;\n } catch {\n return null;\n }\n}\n\nfunction tryReadText(path: string): string {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return \"\";\n }\n}\n\n/**\n * Walk a directory up to maxDepth levels, returning all file paths relative to root.\n * Excludes common build artifacts and dependency directories.\n */\nfunction walkDir(\n dir: string,\n root: string,\n depth: number,\n maxDepth: number,\n ignored: Set<string>,\n): string[] {\n if (depth > maxDepth) return [];\n let entries: string[] = [];\n try {\n entries = readdirSync(dir);\n } catch {\n return [];\n }\n const results: string[] = [];\n for (const entry of entries) {\n if (ignored.has(entry)) continue;\n const full = join(dir, entry);\n const rel = full.slice(root.length + 1);\n try {\n // Use stat-free heuristic: if it has an extension it's likely a file\n // If no extension and doesn't start with \".\", try as directory\n const hasExt = entry.includes(\".\");\n if (!hasExt || entry.startsWith(\".\")) {\n // Could be a dir — try recursing\n const children = walkDir(full, root, depth + 1, maxDepth, ignored);\n if (children.length > 0) {\n results.push(...children);\n } else if (hasExt) {\n results.push(rel);\n }\n } else {\n results.push(rel);\n }\n } catch {\n // skip\n }\n }\n return results;\n}\n\nconst WALK_IGNORED = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".turbo\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n \".mypy_cache\",\n \"target\",\n \".cache\",\n \"coverage\",\n \".nyc_output\",\n]);\n\n/**\n * Returns a list of all files in the repo (relative paths from cwd).\n * Uses `git ls-files` when inside a git repo; falls back to directory walk.\n */\nexport function getRepoFiles(cwd: string): string[] {\n try {\n const out = execSync(\"git ls-files\", {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n const files = out.trim().split(\"\\n\").filter(Boolean);\n if (files.length > 0) return files;\n } catch {\n // not a git repo or git not available\n }\n return walkDir(cwd, cwd, 0, 6, WALK_IGNORED);\n}\n\n/**\n * Returns true if the file path is a structural project indicator — i.e., a file\n * whose addition or modification may require new checks to be added to checks.yaml.\n * Mirrors the detection patterns used in `scanProject()`.\n */\nexport function isStructuralFile(file: string): boolean {\n const f = file.replace(/\\\\/g, \"/\");\n\n // JS / TS project structure\n if (f === \"package.json\") return true;\n if (/^tsconfig[^/]*\\.json$/.test(f)) return true;\n\n // Python\n if (/^requirements[^/]*\\.txt$/.test(f)) return true;\n if (f === \"pyproject.toml\") return true;\n if (f === \"Pipfile\") return true;\n if (f === \"setup.py\") return true;\n if (f === \"setup.cfg\") return true;\n if (f === \"pytest.ini\") return true;\n if (f === \"tox.ini\") return true;\n\n // Go\n if (f === \"go.mod\") return true;\n\n // Rust\n if (f === \"Cargo.toml\") return true;\n\n // Java / Kotlin\n if (f === \"pom.xml\") return true;\n if (/^build\\.gradle(\\.kts)?$/.test(f)) return true;\n\n // Ruby\n if (f === \"Gemfile\") return true;\n\n // Test frameworks\n if (/^vitest\\.config\\.[^/]+$/.test(f)) return true;\n if (/^jest\\.config\\.[^/]+$/.test(f)) return true;\n if (/^playwright\\.config\\.[^/]+$/.test(f)) return true;\n\n // Linters / formatters\n if (/^eslint\\.config\\.[^/]+$/.test(f)) return true;\n if (/^\\.eslintrc[^/]*$/.test(f)) return true;\n if (/^biome\\.jsonc?$/.test(f)) return true;\n if (/^prettier\\.config\\.[^/]+$/.test(f)) return true;\n if (/^\\.prettierrc[^/]*$/.test(f)) return true;\n\n // Next.js\n if (/^next\\.config\\.[^/]+$/.test(f)) return true;\n\n // Docker / infra\n if (/^Dockerfile[^/]*$/.test(f)) return true;\n if (/^docker-compose[^/]*\\.ya?ml$/.test(f)) return true;\n if (/[^/]*\\.tf$/.test(f)) return true;\n\n // Database\n if (f === \"prisma/schema.prisma\") return true;\n\n // OpenAPI\n if (/^(api\\/)?openapi\\.(yaml|yml|json)$/.test(f)) return true;\n\n // CI\n if (/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(f)) return true;\n if (/^\\.circleci\\/.+$/.test(f)) return true;\n if (f === \"Jenkinsfile\") return true;\n if (f === \".gitlab-ci.yml\") return true;\n if (f === \".travis.yml\") return true;\n\n return false;\n}\n\n/**\n * Scan the project at `cwd` and return a `ProjectProfile`.\n * All detection is pure filesystem reads — no shell commands executed.\n */\nexport function scanProject(cwd = process.cwd()): ProjectProfile {\n const exists = (p: string) => existsSync(join(cwd, p));\n\n // Package manager\n const packageManager: ProjectProfile[\"packageManager\"] = exists(\"pnpm-lock.yaml\")\n ? \"pnpm\"\n : exists(\"yarn.lock\")\n ? \"yarn\"\n : exists(\"bun.lockb\")\n ? \"bun\"\n : \"npm\";\n\n // package.json\n const pkg = tryReadJson<PkgJson>(join(cwd, \"package.json\"));\n const scripts = pkg?.scripts ?? {};\n const deps = new Set<string>([\n ...Object.keys(pkg?.dependencies ?? {}),\n ...Object.keys(pkg?.devDependencies ?? {}),\n ]);\n\n // Python manifest scanning\n const pyprojectText = tryReadText(join(cwd, \"pyproject.toml\"));\n const requirementsText = tryReadText(join(cwd, \"requirements.txt\"));\n const pipfileText = tryReadText(join(cwd, \"Pipfile\"));\n const allPyText = pyprojectText + requirementsText + pipfileText;\n\n const hasPytest =\n exists(\"pytest.ini\") ||\n exists(\"setup.cfg\") ||\n allPyText.includes(\"pytest\") ||\n allPyText.includes(\"[tool.pytest\");\n const hasRuff = allPyText.includes(\"ruff\") || deps.has(\"ruff\");\n const hasAlembic = allPyText.includes(\"alembic\") || deps.has(\"alembic\");\n\n // Root-level file listing (for Dockerfile variants and .tf files)\n let rootFiles: string[] = [];\n try {\n rootFiles = readdirSync(cwd);\n } catch {\n // ignore\n }\n\n const hasDocker =\n rootFiles.some((f) => f === \"Dockerfile\" || f.startsWith(\"Dockerfile.\")) ||\n exists(\"docker-compose.yml\") ||\n exists(\"docker-compose.yaml\") ||\n exists(\"docker-compose.dev.yml\");\n\n const hasTerraform =\n rootFiles.some((f) => f.endsWith(\".tf\")) || exists(\"terraform\") || exists(\"infra\");\n\n return {\n // Languages\n hasTypeScript: exists(\"tsconfig.json\") || deps.has(\"typescript\"),\n hasPython:\n Boolean(pyprojectText) ||\n Boolean(requirementsText) ||\n Boolean(pipfileText) ||\n exists(\"setup.py\"),\n hasGo: exists(\"go.mod\"),\n hasRust: exists(\"Cargo.toml\"),\n hasJava: exists(\"pom.xml\") || exists(\"build.gradle\") || exists(\"build.gradle.kts\"),\n hasRuby: exists(\"Gemfile\"),\n\n // Frameworks\n hasNext:\n exists(\"next.config.ts\") ||\n exists(\"next.config.js\") ||\n exists(\"next.config.mjs\") ||\n deps.has(\"next\"),\n hasReact: deps.has(\"react\"),\n\n // Linting\n hasEslint:\n exists(\"eslint.config.js\") ||\n exists(\"eslint.config.ts\") ||\n exists(\"eslint.config.mjs\") ||\n exists(\".eslintrc.js\") ||\n exists(\".eslintrc.json\") ||\n exists(\".eslintrc.yml\") ||\n exists(\".eslintrc.yaml\") ||\n deps.has(\"eslint\"),\n hasBiome: exists(\"biome.json\") || exists(\"biome.jsonc\") || deps.has(\"@biomejs/biome\"),\n hasRuff,\n hasPrettier:\n exists(\"prettier.config.js\") ||\n exists(\"prettier.config.ts\") ||\n exists(\"prettier.config.mjs\") ||\n exists(\".prettierrc\") ||\n exists(\".prettierrc.json\") ||\n deps.has(\"prettier\"),\n\n // Testing\n hasVitest: deps.has(\"vitest\") || Boolean(scripts[\"test\"]?.includes(\"vitest\")),\n hasJest: deps.has(\"jest\") || Boolean(scripts[\"test\"]?.includes(\"jest\")),\n hasPytest,\n\n // DB\n hasPrisma: exists(\"prisma/schema.prisma\") || deps.has(\"@prisma/client\"),\n hasDrizzle: deps.has(\"drizzle-orm\"),\n hasMigrations: exists(\"migrations\") || exists(\"db/migrations\") || exists(\"database/migrations\"),\n hasAlembic,\n\n // Infra\n hasDocker,\n hasTerraform,\n hasKubernetes: exists(\"k8s\") || exists(\"kubernetes\") || exists(\"helm\"),\n\n // API\n hasOpenApi:\n exists(\"openapi.yaml\") ||\n exists(\"openapi.yml\") ||\n exists(\"openapi.json\") ||\n exists(\"api/openapi.yaml\"),\n\n // CI\n hasGithubActions: exists(\".github/workflows\"),\n\n packageManager,\n scripts,\n deps,\n };\n}\n","import { execSync } from \"node:child_process\";\nimport { readdirSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckDef, HoldpointConfig } from \"@holdpoint/types\";\n\nexport interface StaleCheck {\n check: CheckDef;\n reason: string;\n /** Path to use in a file_exists condition, if it can be inferred from the when: regex */\n suggestedConditionPath?: string;\n}\n\n/** Named scopes handled by matchesWhen() — these are never \"stale\" (intentionally broad) */\nconst NAMED_SCOPES = new Set([\n \"frontend\",\n \"backend\",\n \"socket\",\n \"visual\",\n \"python\",\n \"go\",\n \"rust\",\n \"java\",\n \"ruby\",\n \"database\",\n \"prisma\",\n \"testing\",\n \"infra\",\n \"ci\",\n \"docs\",\n \"structural\",\n]);\n\nconst WALK_IGNORED = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".turbo\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n \".mypy_cache\",\n \"target\",\n \".cache\",\n \"coverage\",\n]);\n\nfunction walkDir(dir: string, root: string, depth: number, maxDepth: number): string[] {\n if (depth > maxDepth) return [];\n let entries: string[] = [];\n try {\n entries = readdirSync(dir);\n } catch {\n return [];\n }\n const results: string[] = [];\n for (const entry of entries) {\n if (WALK_IGNORED.has(entry) || entry.startsWith(\".\")) continue;\n const full = join(dir, entry);\n const rel = full.slice(root.length + 1);\n results.push(rel);\n // Try to recurse (will just return [] if it's a file, not a dir)\n const children = walkDir(full, root, depth + 1, maxDepth);\n results.push(...children);\n }\n return results;\n}\n\n/**\n * Returns a list of all files in the repo (relative paths from cwd).\n * Uses `git ls-files` when available; falls back to directory walk.\n */\nexport function getRepoFiles(cwd: string): string[] {\n try {\n const out = execSync(\"git ls-files\", {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n const files = out.trim().split(\"\\n\").filter(Boolean);\n if (files.length > 0) return files;\n } catch {\n // not a git repo or git not available\n }\n return walkDir(cwd, cwd, 0, 6);\n}\n\n/**\n * Try to extract a simple path hint from a regex pattern, for use as a\n * `file_exists` condition path.\n * e.g. \"^prisma/\" → \"prisma\", \"^checks\\\\.yaml$\" → \"checks.yaml\"\n */\nfunction extractPathFromRegex(pattern: string): string | undefined {\n const cleaned = pattern\n .replace(/^\\^/, \"\")\n .replace(/\\$$/, \"\")\n .replace(/\\\\\\./g, \".\")\n .replace(/\\(\\?:/g, \"\")\n .replace(/\\)/g, \"\")\n .replace(/[|*+?[\\]{}()]/g, \"\");\n const candidate = cleaned.replace(/\\/$/, \"\").trim();\n if (candidate.length > 0 && /^[\\w\\-./]+$/.test(candidate)) return candidate;\n return undefined;\n}\n\n/**\n * Detect checks whose `when:` regex pattern matches zero files in the repo.\n * Named scope whens (frontend, backend, structural, etc.) are never flagged as stale.\n * User-defined named patterns (from config.patterns) are resolved to their regex before checking.\n * Checks that already have a conditionId are skipped (already guarded).\n */\nexport function detectStaleChecks(config: HoldpointConfig, repoFiles: string[]): StaleCheck[] {\n const stale: StaleCheck[] = [];\n const userPatterns = config.patterns ?? {};\n\n for (const check of config.checks) {\n if (!check.when) continue;\n if (NAMED_SCOPES.has(check.when)) continue;\n if (check.conditionId) continue; // already guarded by a condition\n\n // Resolve user-defined named patterns to their regex value\n const patternAlias = check.when in userPatterns ? check.when : undefined;\n const regexStr = patternAlias ? userPatterns[patternAlias]! : check.when;\n\n let re: RegExp;\n try {\n re = new RegExp(regexStr);\n } catch {\n stale.push({ check, reason: `Invalid regex: '${regexStr}'` });\n continue;\n }\n\n const matches = repoFiles.filter((f) => re.test(f));\n if (matches.length === 0) {\n const label = patternAlias\n ? `Pattern '${patternAlias}' (= '${regexStr}')`\n : `Regex '${regexStr}'`;\n const suggestedConditionPath = extractPathFromRegex(regexStr);\n // Verify the suggested path doesn't actually exist either\n const pathGone =\n !suggestedConditionPath || !existsSync(join(process.cwd(), suggestedConditionPath));\n if (pathGone) {\n stale.push({\n check,\n reason: `${label} matches 0 files in the repo`,\n ...(suggestedConditionPath ? { suggestedConditionPath } : {}),\n });\n }\n }\n }\n\n return stale;\n}\n","import type { ConditionDef } from \"@holdpoint/types\";\nimport type { ProjectProfile } from \"./scanner.js\";\n\nexport interface EvolveTemplate {\n id: string;\n label: string;\n when?: string;\n cmd?: string;\n prompt?: string;\n conditionId?: string;\n /** Condition to add to checks.yaml alongside the check (only if conditionId is set) */\n condition?: Omit<ConditionDef, \"id\"> & { id: string };\n /** Returns true if this check is relevant to the given project profile */\n trigger: (p: ProjectProfile) => boolean;\n}\n\n/** Returns the correct run command for a package.json script, respecting the detected package manager. */\nfunction pmScript(profile: ProjectProfile, script: string, fallback: string): string {\n if (!profile.scripts[script]) return fallback;\n if (profile.packageManager === \"npm\") return `npm run ${script}`;\n return `${profile.packageManager} ${script}`;\n}\n\n/**\n * Returns all applicable check templates for the given project profile.\n * Caller should filter out templates whose IDs already exist in checks.yaml.\n */\nexport function getTemplates(profile: ProjectProfile): EvolveTemplate[] {\n return [\n // ── Universal checks (always proposed for any project) ──────────────────\n {\n id: \"git-commit\",\n label: \"Commit all changes before finishing\",\n cmd: 'git rev-parse --is-inside-work-tree 2>/dev/null || exit 0; [ -z \"$(git status --porcelain)\" ] && exit 0; git status --short; exit 1',\n trigger: () => true,\n },\n {\n id: \"changelog-update\",\n label: \"Add a CHANGELOG.md entry for this session\",\n prompt:\n \"Before committing, add an entry to CHANGELOG.md describing what was done. \" +\n \"Use Keep a Changelog format — add under ## [Unreleased] (create the file \" +\n \"and that section if absent). Group entries as Added, Changed, Fixed, or Removed. \" +\n \"Be concise but specific. The entry text will serve as the commit message.\",\n trigger: () => true,\n },\n {\n id: \"readme-sync\",\n label: \"Update README.md if user-facing changes were made\",\n prompt:\n \"If you added, changed, or removed user-facing functionality — CLI commands, \" +\n \"configuration options, public APIs, or significant new features — update \" +\n \"README.md to reflect those changes.\",\n trigger: () => true,\n },\n {\n id: \"no-todos\",\n label: \"No TODO/FIXME left in changed code\",\n prompt:\n \"Scan the files you changed for any TODO, FIXME, HACK, or XXX comments. \" +\n \"Either resolve them before finishing or convert them to GitHub issues. \" +\n \"Don't leave incomplete work silently behind.\",\n trigger: () => true,\n },\n\n // ── TypeScript / JavaScript ──────────────────────────────────────────────\n {\n id: \"typecheck\",\n label: \"TypeScript type check\",\n cmd: pmScript(profile, \"typecheck\", \"npx tsc --noEmit\"),\n trigger: (p) => p.hasTypeScript,\n },\n {\n id: \"lint\",\n label: \"Lint codebase\",\n cmd: profile.hasEslint\n ? pmScript(profile, \"lint\", \"npx eslint .\")\n : profile.hasBiome\n ? pmScript(profile, \"lint\", \"npx @biomejs/biome check .\")\n : pmScript(profile, \"lint\", \"echo 'No linter detected'\"),\n trigger: (p) => p.hasEslint || p.hasBiome,\n },\n {\n id: \"format-check\",\n label: \"Prettier — format check\",\n cmd: pmScript(profile, \"format:check\", \"npx prettier --check .\"),\n trigger: (p) => p.hasPrettier,\n },\n {\n id: \"test\",\n label: \"Unit tests\",\n cmd: profile.hasVitest\n ? pmScript(profile, \"test\", \"npx vitest run\")\n : pmScript(profile, \"test\", \"npx jest --passWithNoTests\"),\n trigger: (p) => p.hasVitest || p.hasJest,\n },\n {\n id: \"jsdoc\",\n label: \"JSDoc on changed public functions\",\n prompt:\n \"Ensure all changed public functions, classes, and module exports have \" +\n \"accurate JSDoc comments (description + @param + @returns where applicable).\",\n trigger: (p) => p.hasTypeScript || p.hasReact,\n },\n {\n id: \"build\",\n label: \"Production build passes\",\n cmd: pmScript(profile, \"build\", \"echo 'No build script detected'\"),\n trigger: (p) => Boolean(p.scripts[\"build\"]),\n },\n\n // ── Python ───────────────────────────────────────────────────────────────\n {\n id: \"python-lint\",\n label: \"Ruff — Python linting\",\n cmd: \"ruff check .\",\n when: \"python\",\n trigger: (p) => p.hasPython && p.hasRuff,\n },\n {\n id: \"python-test\",\n label: \"Pytest — Python unit tests\",\n cmd: \"pytest\",\n when: \"python\",\n trigger: (p) => p.hasPython && p.hasPytest,\n },\n\n // ── Go ───────────────────────────────────────────────────────────────────\n {\n id: \"go-test\",\n label: \"Go tests\",\n cmd: \"go test ./...\",\n when: \"go\",\n trigger: (p) => p.hasGo,\n },\n {\n id: \"go-vet\",\n label: \"Go vet\",\n cmd: \"go vet ./...\",\n when: \"go\",\n trigger: (p) => p.hasGo,\n },\n\n // ── Database ─────────────────────────────────────────────────────────────\n {\n id: \"db-migrations\",\n label: \"Database migration for schema changes\",\n when: \"database\",\n prompt:\n \"If schema or migration files changed, ensure the appropriate migration was \" +\n \"generated with your ORM tool (e.g. `prisma migrate dev`, `alembic revision`, \" +\n \"`rails db:migrate`) and committed alongside the schema change.\",\n trigger: (p) => p.hasPrisma || p.hasAlembic || p.hasMigrations || p.hasDrizzle,\n },\n {\n id: \"prisma-format\",\n label: \"Prisma schema format check\",\n when: \"prisma\",\n cmd: \"npx prisma format --check 2>/dev/null || npx prisma format\",\n conditionId: \"has-prisma\",\n condition: {\n id: \"has-prisma\",\n operator: \"file_exists\",\n path: \"prisma/schema.prisma\",\n },\n trigger: (p) => p.hasPrisma,\n },\n\n // ── OpenAPI ──────────────────────────────────────────────────────────────\n {\n id: \"openapi-sync\",\n label: \"OpenAPI spec updated for API changes\",\n when: \"backend\",\n conditionId: \"has-openapi\",\n condition: {\n id: \"has-openapi\",\n operator: \"file_exists\",\n path: \"openapi.yaml\",\n },\n prompt:\n \"If any API routes were added or changed, update openapi.yaml (or openapi.json) \" +\n \"to reflect the new endpoints, request/response shapes, and error codes.\",\n trigger: (p) => p.hasOpenApi,\n },\n\n // ── Infra ─────────────────────────────────────────────────────────────────\n {\n id: \"docker-build\",\n label: \"Docker build passes\",\n when: \"infra\",\n cmd: \"docker build . --quiet -t app:ci\",\n conditionId: \"has-dockerfile\",\n condition: {\n id: \"has-dockerfile\",\n operator: \"file_exists\",\n path: \"Dockerfile\",\n },\n trigger: (p) => p.hasDocker,\n },\n {\n id: \"terraform-validate\",\n label: \"Terraform validate\",\n when: \"infra\",\n cmd: \"terraform validate\",\n trigger: (p) => p.hasTerraform,\n },\n\n // ── Frontend ─────────────────────────────────────────────────────────────\n {\n id: \"i18n\",\n label: \"i18n — no hardcoded user-facing strings\",\n when: \"frontend\",\n prompt:\n \"Confirm all user-visible strings are wrapped in the project's i18n function \" +\n \"(e.g. `t()`, `useTranslation`, `<Trans>`) and that locale files are updated \" +\n \"for any new copy.\",\n trigger: (p) => p.hasNext && p.hasReact,\n },\n ];\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,cAAAA,aAAY,gBAAAC,eAAc,eAAe,WAAW,oBAAoB;AACjF,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,SAAS,iBAAiB,mBAAmB;AAC7C,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,eAAe,yBAAyB;AACjD;A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AO,CAAC;AAC5D,UAAQ;AAAA,IACNA,OAAM,IAAI,uCAAuC,IAC/CA,OAAM,OAAO,uEAAuE;AAAA,EACxF;AACF;;;AP3NA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,WAAW,EAChB,YAAY,mDAAmD,EAC/D,QAAQ,eAAe;AAE1B,QACG,QAAQ,MAAM,EACd,YAAY,6CAA6C,EACzD,OAAO,mBAAmB,sDAAsD,EAChF;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,WAAW;AAErB,QACG,QAAQ,OAAO,EACf,YAAY,kCAAkC,EAC9C,OAAO,YAAY,qCAAqC,EACxD,OAAO,YAAY;AAEtB,QACG,QAAQ,UAAU,EAClB,YAAY,kDAAkD,EAC9D,OAAO,eAAe;AAEzB,QACG,QAAQ,QAAQ,EAChB,YAAY,0EAA0E,EACtF,OAAO,aAAa;AAEvB,QACG,QAAQ,SAAS,EACjB,YAAY,8CAA8C,EAC1D,OAAO,YAAY;AAEtB,QACG,QAAQ,QAAQ,EAChB,YAAY,4EAA4E,EACxF,OAAO,WAAW,mEAAmE,EACrF,OAAO,aAAa;AAEvB,QAAQ,MAAM;","names":["existsSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","writeFileSync","mkdirSync","join","chalk","ora","parseHoldpointYaml","existsSync","readFileSync","chalk","parseHoldpointYaml","existsSync","readFileSync","writeFileSync","mkdirSync","chalk","ora","parseHoldpointYaml","buildConfigJson","buildEngine","buildClaudeEngineJson","buildCursorEngine","buildCodexConfigToml","buildCodexHooksJson","buildCodexCheckScript","spliceAgentsMd","existsSync","chalk","ora","parseHoldpointYaml","readFileSync","mkdirSync","writeFileSync","buildConfigJson","buildEngine","buildClaudeEngineJson","buildCursorEngine","buildCodexHooksJson","buildCodexCheckScript","buildCodexConfigToml","existing","spliceAgentsMd","existsSync","join","dirname","fileURLToPath","execSync","chalk","__dirname","existsSync","readFileSync","writeFileSync","execSync","chalk","ora","parseHoldpointYaml","existsSync","readFileSync","join","execSync","existsSync","join","execSync","readdirSync","existsSync","join","existsSync","chalk","ora","readFileSync","parseHoldpointYaml","writeFileSync","execSync"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/init.ts","../src/detect.ts","../src/commands/check.ts","../src/commands/validate.ts","../src/commands/update.ts","../src/commands/build.ts","../src/commands/evolve.ts","../src/evolve/scanner.ts","../src/evolve/dead-checker.ts","../src/evolve/templates.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport { initCommand } from \"./commands/init.js\";\nimport { checkCommand } from \"./commands/check.js\";\nimport { validateCommand } from \"./commands/validate.js\";\nimport { updateCommand } from \"./commands/update.js\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { evolveCommand } from \"./commands/evolve.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"holdpoint\")\n .description(\"Universal eval-guard for AI coding agents (alpha)\")\n .version(\"0.1.0-alpha.2\");\n\nprogram\n .command(\"init\")\n .description(\"Initialise Holdpoint in the current project\")\n .option(\"--stack <stack>\", \"Stack type: typescript | python | nextjs | fullstack\")\n .option(\n \"--agent <agent>\",\n \"Agent to install for: copilot | claude | cursor | codex (default: all four)\",\n )\n .action(initCommand);\n\nprogram\n .command(\"check\")\n .description(\"Run task checks from checks.yaml\")\n .option(\"--staged\", \"Only check against git-staged files\")\n .action(checkCommand);\n\nprogram\n .command(\"validate\")\n .description(\"Validate checks.yaml schema and print any errors\")\n .action(validateCommand);\n\nprogram\n .command(\"update\")\n .description(\"Regenerate engine files from current checks.yaml (preserves checks.yaml)\")\n .action(updateCommand);\n\nprogram\n .command(\"builder\")\n .description(\"Open the visual builder UI on localhost:4321\")\n .action(buildCommand);\n\nprogram\n .command(\"evolve\")\n .description(\"Scan project and propose (or apply) new checks to keep checks.yaml in sync\")\n .option(\"--apply\", \"Write proposed changes to checks.yaml and regenerate engine files\")\n .action(evolveCommand);\n\nprogram.parse();\n","import { execSync } from \"node:child_process\";\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { buildConfigJson, buildEngine } from \"@holdpoint/engine-copilot\";\nimport { buildEngineJson as buildClaudeEngineJson } from \"@holdpoint/engine-claude\";\nimport { buildEngine as buildCursorEngine } from \"@holdpoint/engine-cursor\";\nimport {\n buildConfigToml as buildCodexConfigToml,\n buildHooksJson as buildCodexHooksJson,\n buildCheckScript as buildCodexCheckScript,\n spliceAgentsMd,\n buildAgentsMd,\n} from \"@holdpoint/engine-codex\";\nimport { parseHoldpointYaml } from \"@holdpoint/yaml-core\";\nimport type { AgentType, StackType } from \"@holdpoint/types\";\nimport { detectStack, detectPackageManager, type PackageManager } from \"../detect.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nfunction getTemplatePath(stack: StackType): string {\n const name = stack === \"unknown\" ? \"_base\" : stack;\n const candidates = [\n join(__dirname, \"templates\", `${name}.yaml`), // dist/templates/ (published package)\n join(__dirname, \"../../../templates\", `${name}.yaml`), // monorepo dev fallback\n join(process.cwd(), \"templates\", `${name}.yaml`), // cwd fallback\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return \"\";\n}\n\nfunction getMasterPromptPath(): string {\n const candidates = [\n join(__dirname, \"templates/MASTER_PROMPT.md\"), // dist/templates/ (published package)\n join(__dirname, \"../../../templates/MASTER_PROMPT.md\"), // monorepo dev fallback\n join(process.cwd(), \"templates/MASTER_PROMPT.md\"), // cwd fallback\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return \"\";\n}\n\nconst MINIMAL_CHECKS_YAML = `version: 1\ncontext:\n guides: {}\nconditions: []\nchecks:\n - id: lint\n label: \"Lint codebase\"\n cmd: \"echo 'Add your lint command here'\"\n\n - id: jsdoc\n label: \"JSDoc on changed public functions\"\n prompt: \"Ensure all changed public functions and exports have JSDoc comments.\"\n`;\n\n/**\n * Initialise Holdpoint in the current project.\n *\n * Writes `checks.yaml` (from a stack template if available), `checks.immutable.json`,\n * and engine adapter files for each target agent (Copilot, Claude, Cursor, Codex).\n * Defaults to installing all four agents; pass `--agent` to restrict to one.\n */\nexport async function initCommand(options: { stack?: string; agent?: string }): Promise<void> {\n const spinner = ora(\"Initialising Holdpoint…\").start();\n\n const stack = (options.stack as StackType | undefined) ?? detectStack();\n\n // Default: install for all agents. Pass --agent=copilot|claude|cursor to restrict.\n const agentOpt = options.agent;\n const agents: AgentType[] =\n !agentOpt || agentOpt === \"all\"\n ? [\"copilot\", \"claude\", \"cursor\", \"codex\"]\n : [agentOpt as AgentType];\n\n spinner.text = `Stack: ${chalk.cyan(stack)} — installing for: ${chalk.cyan(agents.join(\", \"))}`;\n\n // Detect package manager once — used both for template substitution and devDep install.\n const pm = detectPackageManager();\n\n // 1. Read or create checks.yaml\n let yamlContent = MINIMAL_CHECKS_YAML;\n if (!existsSync(\"checks.yaml\")) {\n const templatePath = getTemplatePath(stack);\n if (templatePath) {\n yamlContent = readFileSync(templatePath, \"utf8\");\n }\n // Substitute the package manager so checks use the right runner (npm/yarn/pnpm).\n if (pm !== \"pnpm\") {\n yamlContent = yamlContent.replace(/\\bpnpm\\b/g, pm);\n }\n writeFileSync(\"checks.yaml\", yamlContent, \"utf8\");\n } else {\n yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n }\n\n const config = parseHoldpointYaml(yamlContent);\n\n // 2. Write checks.immutable.json — read by holdpoint-check.mjs at runtime\n const generatedDir = \".github/holdpoint/generated\";\n mkdirSync(generatedDir, { recursive: true });\n writeFileSync(`${generatedDir}/checks.immutable.json`, buildConfigJson(config), \"utf8\");\n\n // 3. Install engine files for each target agent\n if (agents.includes(\"copilot\")) {\n // extension.mjs handles both session context injection (onSessionStart) and\n // check enforcement (onPreToolUse → task_complete). No separate hooks files needed.\n const extDir = \".github/extensions/holdpoint\";\n mkdirSync(extDir, { recursive: true });\n writeFileSync(join(extDir, \"extension.mjs\"), buildEngine(config), \"utf8\");\n }\n\n if (agents.includes(\"claude\")) {\n mkdirSync(\".claude\", { recursive: true });\n const settingsPath = \".claude/settings.json\";\n let existing: Record<string, unknown> = {};\n if (existsSync(settingsPath)) {\n try {\n existing = JSON.parse(readFileSync(settingsPath, \"utf8\")) as Record<string, unknown>;\n } catch {\n /* ignore */\n }\n }\n const holdpointHooks = JSON.parse(buildClaudeEngineJson(config)) as Record<string, unknown>;\n writeFileSync(\n settingsPath,\n JSON.stringify({ ...existing, hooks: holdpointHooks.hooks }, null, 2),\n \"utf8\",\n );\n }\n\n if (agents.includes(\"cursor\")) {\n const cursorRules = buildCursorEngine(config);\n const cursorPath = \".cursorrules\";\n if (existsSync(cursorPath)) {\n const existing = readFileSync(cursorPath, \"utf8\");\n if (!existing.includes(\"Holdpoint Rules\")) {\n writeFileSync(cursorPath, existing + \"\\n\" + cursorRules, \"utf8\");\n }\n } else {\n writeFileSync(cursorPath, cursorRules, \"utf8\");\n }\n }\n\n if (agents.includes(\"codex\")) {\n mkdirSync(\".codex\", { recursive: true });\n writeFileSync(\".codex/hooks.json\", buildCodexHooksJson(config), \"utf8\");\n writeFileSync(\".codex/holdpoint-check.mjs\", buildCodexCheckScript(config), \"utf8\");\n writeFileSync(\".codex/config.toml\", buildCodexConfigToml(), \"utf8\");\n const agentsMdPath = \"AGENTS.md\";\n const existing = existsSync(agentsMdPath) ? readFileSync(agentsMdPath, \"utf8\") : \"\";\n writeFileSync(agentsMdPath, spliceAgentsMd(existing, config), \"utf8\");\n }\n\n // 4. Create MASTER_PROMPT.md if not present\n if (!existsSync(\"MASTER_PROMPT.md\")) {\n const guidePath = getMasterPromptPath();\n if (guidePath) {\n copyFileSync(guidePath, \"MASTER_PROMPT.md\");\n } else {\n // Fallback: minimal prompt if template file is not bundled\n writeFileSync(\n \"MASTER_PROMPT.md\",\n \"# Holdpoint\\n\\nRun `holdpoint check` before marking any task complete.\\nSee `checks.yaml` for the full list of checks.\\n\",\n \"utf8\",\n );\n }\n }\n\n // Install holdpoint as a devDependency so hooks resolve via node_modules/.bin\n // rather than downloading on every hook fire via npx.\n spinner.text = \"Installing holdpoint as a devDependency…\";\n const installCmds: Record<PackageManager, string> = {\n pnpm: \"pnpm add -D holdpoint@alpha\",\n yarn: \"yarn add --dev holdpoint@alpha\",\n npm: \"npm install --save-dev holdpoint@alpha\",\n };\n const installCmd = installCmds[pm];\n try {\n execSync(installCmd, { stdio: \"pipe\" });\n spinner.succeed(chalk.bold.green(\"Holdpoint initialised!\"));\n } catch {\n spinner.warn(\n chalk.yellow(`Holdpoint initialised, but could not install the package automatically.`) +\n `\\n Run manually: ${chalk.yellow(installCmd)}`,\n );\n }\n\n console.log(`\n${chalk.cyan(\"Next steps:\")}\n 1. Edit ${chalk.yellow(\"checks.yaml\")} to customise your eval checkpoints\n 2. Commit ${chalk.yellow(\"checks.yaml\")} and the generated engine files\n 3. Run ${chalk.yellow(\"holdpoint check\")} at any time to validate\n\n Visual builder: ${chalk.yellow(\"holdpoint builder\")} (opens localhost:4321)\n Stack: ${chalk.cyan(stack)} Agents: ${chalk.cyan(agents.join(\", \"))}\n`);\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport type { AgentType, StackType } from \"@holdpoint/types\";\n\nexport type PackageManager = \"pnpm\" | \"yarn\" | \"npm\";\n\n/** Detect which package manager owns the current project by checking lock files. */\nexport function detectPackageManager(): PackageManager {\n if (existsSync(\"pnpm-lock.yaml\")) return \"pnpm\";\n if (existsSync(\"yarn.lock\")) return \"yarn\";\n return \"npm\";\n}\n\n/** @deprecated Use detectInstalledAgents() — single-agent detection is no longer the default. */\nexport function detectAgent(): AgentType {\n if (existsSync(\".github/extensions\")) return \"copilot\";\n if (existsSync(\".claude\")) return \"claude\";\n if (existsSync(\".cursorrules\")) return \"cursor\";\n if (existsSync(\".codex\")) return \"codex\";\n return \"unknown\";\n}\n\n/**\n * Returns every agent whose Holdpoint engine files are already present in the\n * current working directory. Used by `holdpoint update` so it regenerates only\n * the engines that were previously installed.\n */\nexport function detectInstalledAgents(): AgentType[] {\n const agents: AgentType[] = [];\n if (existsSync(\".github/extensions/holdpoint/extension.mjs\")) agents.push(\"copilot\");\n if (existsSync(\".claude/settings.json\")) agents.push(\"claude\");\n if (existsSync(\".cursorrules\")) {\n try {\n if (readFileSync(\".cursorrules\", \"utf8\").includes(\"Holdpoint Rules\")) {\n agents.push(\"cursor\");\n }\n } catch {\n /* ignore unreadable file */\n }\n }\n // Detect Codex by the generated check script (more specific than .codex/ existence)\n if (existsSync(\".codex/holdpoint-check.mjs\")) agents.push(\"codex\");\n return agents;\n}\n\nexport function detectStack(): StackType {\n const hasNext =\n existsSync(\"next.config.ts\") || existsSync(\"next.config.js\") || existsSync(\"next.config.mjs\");\n const hasTsConfig = existsSync(\"tsconfig.json\");\n const hasPyproject =\n existsSync(\"pyproject.toml\") || existsSync(\"requirements.txt\") || existsSync(\"setup.py\");\n const hasPrisma = existsSync(\"prisma/schema.prisma\");\n const hasApi = existsSync(\"server\") || existsSync(\"api\") || existsSync(\"backend\");\n const hasGoMod = existsSync(\"go.mod\");\n\n if (hasNext && (hasPrisma || hasApi)) return \"fullstack\";\n if (hasNext) return \"nextjs\";\n if (hasTsConfig) return \"typescript\";\n if (hasPyproject) return \"python\";\n if (hasGoMod) return \"go\";\n return \"unknown\";\n}\n","import { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml, matchesWhen } from \"@holdpoint/yaml-core\";\nimport { runDeterministicChecks } from \"@holdpoint/yaml-core/runner\";\nimport type { CheckResult, CheckRun, CheckReports } from \"@holdpoint/types\";\nimport { execSync } from \"node:child_process\";\n\nconst COMMIT_CACHE_PATH = \".holdpoint/checked-commits.json\";\nconst COMMIT_CACHE_MAX = 100;\nconst CHECK_REPORTS_PATH = \".holdpoint/check-reports.json\";\nconst CHECK_REPORTS_MAX = 50;\n\nfunction getStagedFiles(): string[] {\n try {\n const out = execSync(\"git diff --cached --name-only\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\nfunction getAllChangedFiles(): string[] {\n try {\n const out = execSync(\"git diff --name-only HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\n/**\n * Returns the files changed in the most recent commit (HEAD vs HEAD~1).\n * Used as a fallback when no staged files exist but the agent has already committed.\n */\nfunction getLastCommitFiles(): string[] {\n try {\n const out = execSync(\"git diff --name-only HEAD~1 HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n return out.trim().split(\"\\n\").filter(Boolean);\n } catch {\n return [];\n }\n}\n\n/** Returns the current HEAD commit SHA, or null if unavailable. */\nfunction getHeadSha(): string | null {\n try {\n return execSync(\"git rev-parse HEAD\", {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n }).trim();\n } catch {\n return null;\n }\n}\n\n/** Returns the set of already-verified commit SHAs from the local cache. */\nfunction readCommitCache(): Set<string> {\n try {\n const raw = readFileSync(COMMIT_CACHE_PATH, \"utf8\");\n const parsed = JSON.parse(raw) as { verified?: unknown };\n return new Set(Array.isArray(parsed.verified) ? (parsed.verified as string[]) : []);\n } catch {\n return new Set();\n }\n}\n\n/**\n * Records a commit SHA as verified in the local cache.\n * Caps the cache at COMMIT_CACHE_MAX entries (newest first).\n */\nfunction recordCommitCache(sha: string): void {\n try {\n const existing = readCommitCache();\n const updated = [sha, ...[...existing].filter((s) => s !== sha)].slice(0, COMMIT_CACHE_MAX);\n mkdirSync(join(COMMIT_CACHE_PATH, \"..\"), { recursive: true });\n writeFileSync(COMMIT_CACHE_PATH, JSON.stringify({ verified: updated }, null, 2) + \"\\n\", \"utf8\");\n } catch {\n // Non-fatal: cache write failure just means the next run re-checks this commit.\n }\n}\n\n/**\n * Appends a check run report to `.holdpoint/check-reports.json`.\n * Caps to CHECK_REPORTS_MAX runs, newest first. Non-fatal if write fails.\n */\nfunction recordCheckReport(run: CheckRun): void {\n try {\n mkdirSync(join(CHECK_REPORTS_PATH, \"..\"), { recursive: true });\n let existing: CheckReports = { runs: [] };\n if (existsSync(CHECK_REPORTS_PATH)) {\n try {\n existing = JSON.parse(readFileSync(CHECK_REPORTS_PATH, \"utf8\")) as CheckReports;\n if (!Array.isArray(existing.runs)) existing.runs = [];\n } catch {\n existing = { runs: [] };\n }\n }\n const updated: CheckReports = {\n runs: [run, ...existing.runs].slice(0, CHECK_REPORTS_MAX),\n };\n writeFileSync(CHECK_REPORTS_PATH, JSON.stringify(updated, null, 2) + \"\\n\", \"utf8\");\n } catch {\n // Non-fatal: report write failure does not affect check outcomes.\n }\n}\n\nexport async function checkCommand(options: { staged?: boolean }): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n let config;\n try {\n config = parseHoldpointYaml(yamlContent);\n } catch (err: unknown) {\n console.error(chalk.red(\"Invalid checks.yaml:\"), (err as Error).message);\n process.exit(1);\n }\n\n // Always resolve HEAD SHA — used for both cache and reports.\n const headSha = getHeadSha();\n\n let changedFiles: string[];\n let usedHeadShaForCache = false;\n\n if (options.staged) {\n const staged = getStagedFiles();\n if (staged.length > 0) {\n changedFiles = staged;\n } else {\n // Nothing staged — check if HEAD was already verified to avoid a check loop.\n if (headSha && readCommitCache().has(headSha)) {\n console.log(\n chalk.green(`✓ Commit ${headSha.slice(0, 8)} already verified — nothing to re-check.`),\n );\n process.exit(0);\n }\n\n // Fall back to files in the most recent commit (covers the\n // \"agent committed then called task_complete\" workflow).\n const lastCommit = getLastCommitFiles();\n if (lastCommit.length > 0) {\n changedFiles = lastCommit;\n usedHeadShaForCache = true;\n console.log(\n chalk.yellow(\"No staged files. Running checks scoped to the most recent commit's files.\"),\n );\n } else {\n // Truly nothing changed (investigative session, no recent commit).\n console.log(chalk.green(\"✓ No staged changes and no recent commit — nothing to check.\"));\n process.exit(0);\n }\n }\n } else {\n changedFiles = getAllChangedFiles();\n if (changedFiles.length === 0) {\n console.log(\n chalk.yellow(\"No changed files detected. Running all checks with no file filter.\"),\n );\n console.log(\n chalk.dim(\n \" Tip: if you just ran `holdpoint init`, commit the generated files to clear the git-commit check.\",\n ),\n );\n }\n }\n\n // Print project guides so the agent/human sees them before running checks\n const guides = Object.entries(config.context?.guides ?? {});\n if (guides.length > 0) {\n console.log(chalk.cyan(\"\\nProject guides:\"));\n for (const [key, text] of guides) {\n console.log(chalk.bold(` ${key}:`), chalk.dim(String(text).trim()));\n }\n console.log(\"\");\n }\n\n const taskCount = config.checks.filter((c) => c.cmd !== undefined).length;\n const spinner = ora(`Running ${taskCount} task(s)…`).start();\n const effectiveFiles = changedFiles.length > 0 ? changedFiles : [\"__all__\"];\n const results = runDeterministicChecks(config, effectiveFiles);\n\n const passed = results.filter((r) => r.status === \"pass\");\n const failed = results.filter((r) => r.status === \"fail\");\n const skipped = results.filter((r) => r.status === \"skip\");\n\n spinner.stop();\n\n // Print results\n for (const result of results) {\n printResult(result);\n }\n\n // Summary\n console.log(\"\");\n console.log(\n [\n chalk.green(`✓ ${passed.length} passed`),\n failed.length > 0 ? chalk.red(`✗ ${failed.length} failed`) : \"\",\n skipped.length > 0 ? chalk.gray(`◌ ${skipped.length} skipped`) : \"\",\n ]\n .filter(Boolean)\n .join(\" \"),\n );\n\n // Prompt checks: show those whose when filter matches the changed files\n const promptChecks = config.checks.filter(\n (c) =>\n c.prompt !== undefined &&\n matchesWhen(c.when, changedFiles.length > 0 ? changedFiles : [\"__all__\"], config.patterns),\n );\n if (promptChecks.length > 0) {\n console.log(`\\n${chalk.cyan(\"Agent prompts to act on:\")}`);\n for (const c of promptChecks) {\n console.log(` ${chalk.yellow(\"□\")} [${c.label}] ${c.prompt ?? \"\"}`);\n }\n }\n\n // Write rich check run report BEFORE exiting so failed runs are always recorded.\n const reportResults = [\n ...results.map((r) => ({\n id: r.check.id,\n label: r.check.label,\n kind: \"cmd\" as const,\n status: r.status as \"pass\" | \"fail\" | \"skip\",\n ...(r.output !== undefined ? { output: r.output } : {}),\n ...(r.exitCode !== undefined ? { exitCode: r.exitCode } : {}),\n ...(r.skipReason !== undefined ? { skipReason: r.skipReason } : {}),\n })),\n ...promptChecks.map((c) => ({\n id: c.id,\n label: c.label,\n kind: \"prompt\" as const,\n status: \"shown\" as const,\n })),\n ];\n\n const run = {\n sha: headSha,\n shortSha: headSha ? headSha.slice(0, 8) : null,\n timestamp: new Date().toISOString(),\n files: changedFiles.length > 0 ? changedFiles : [],\n results: reportResults,\n summary: {\n passed: passed.length,\n failed: failed.length,\n skipped: skipped.length,\n shown: promptChecks.length,\n },\n };\n recordCheckReport(run);\n\n if (failed.length > 0) {\n process.exit(1);\n }\n\n // All checks passed — if we ran against a committed HEAD (no staged files), mark it verified.\n if (usedHeadShaForCache && headSha) {\n recordCommitCache(headSha);\n }\n}\n\nfunction printResult(result: CheckResult): void {\n const icon =\n result.status === \"pass\"\n ? chalk.green(\"✓\")\n : result.status === \"fail\"\n ? chalk.red(\"✗\")\n : result.status === \"skip\"\n ? chalk.gray(\"◌\")\n : chalk.yellow(\"…\");\n\n const label = result.check.label;\n console.log(`${icon} ${label}`);\n\n if (result.status === \"fail\" && result.output) {\n const trimmed = result.output.trim().split(\"\\n\").slice(0, 10).join(\"\\n\");\n console.log(chalk.dim(trimmed.replace(/^/gm, \" \")));\n }\n if (result.status === \"skip\" && result.skipReason) {\n console.log(chalk.dim(` ${result.skipReason}`));\n }\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport { parseHoldpointYaml, validateConfig } from \"@holdpoint/yaml-core\";\n\nexport async function validateCommand(): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const text = readFileSync(\"checks.yaml\", \"utf8\");\n\n let config;\n try {\n config = parseHoldpointYaml(text);\n } catch (err: unknown) {\n console.error(chalk.red(\"Parse error:\"), (err as Error).message);\n process.exit(1);\n }\n\n const result = validateConfig(config);\n\n if (result.valid) {\n console.log(chalk.green(\"✓ checks.yaml is valid\"));\n console.log(\n chalk.dim(\n ` ${config.checks.filter((c) => c.cmd !== undefined).length} tasks, ${config.checks.filter((c) => c.prompt !== undefined).length} prompts, ${config.conditions.length} conditions`,\n ),\n );\n } else {\n console.error(chalk.red(\"✗ checks.yaml has errors:\"));\n for (const err of result.errors) {\n console.error(` ${chalk.yellow(err.path)}: ${err.message}`);\n }\n process.exit(1);\n }\n}\n","import { existsSync, readFileSync, writeFileSync, mkdirSync } from \"node:fs\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml } from \"@holdpoint/yaml-core\";\nimport { buildConfigJson, buildEngine } from \"@holdpoint/engine-copilot\";\nimport { buildEngineJson as buildClaudeEngineJson } from \"@holdpoint/engine-claude\";\nimport { buildEngine as buildCursorEngine } from \"@holdpoint/engine-cursor\";\nimport {\n buildConfigToml as buildCodexConfigToml,\n buildHooksJson as buildCodexHooksJson,\n buildCheckScript as buildCodexCheckScript,\n spliceAgentsMd,\n} from \"@holdpoint/engine-codex\";\nimport { detectInstalledAgents } from \"../detect.js\";\nimport type { AgentType } from \"@holdpoint/types\";\n\n/**\n * Regenerate all Holdpoint engine adapter files from the current `checks.yaml`.\n *\n * Detects which agents were previously installed via `detectInstalledAgents()` and\n * regenerates only their files. Falls back to all four agents if no engine files\n * are found (e.g. first run after a manual `checks.yaml` edit).\n */\nexport async function updateCommand(): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const spinner = ora(\"Updating Holdpoint engine files…\").start();\n const config = parseHoldpointYaml(readFileSync(\"checks.yaml\", \"utf8\"));\n\n // Regenerate for every agent that was previously installed.\n // Fall back to all four if no engine files exist yet (e.g. first run after manual checks.yaml edit).\n const detected = detectInstalledAgents();\n const agents: AgentType[] =\n detected.length > 0 ? detected : [\"copilot\", \"claude\", \"cursor\", \"codex\"];\n\n // Always write checks.immutable.json — read by holdpoint-check.mjs at runtime\n const generatedDir = \".github/holdpoint/generated\";\n mkdirSync(generatedDir, { recursive: true });\n writeFileSync(`${generatedDir}/checks.immutable.json`, buildConfigJson(config), \"utf8\");\n\n if (agents.includes(\"copilot\")) {\n const extDir = \".github/extensions/holdpoint\";\n mkdirSync(extDir, { recursive: true });\n writeFileSync(`${extDir}/extension.mjs`, buildEngine(config), \"utf8\");\n }\n\n if (agents.includes(\"claude\")) {\n mkdirSync(\".claude\", { recursive: true });\n const settingsPath = \".claude/settings.json\";\n let existing: Record<string, unknown> = {};\n if (existsSync(settingsPath)) {\n try {\n existing = JSON.parse(readFileSync(settingsPath, \"utf8\")) as Record<string, unknown>;\n } catch {\n /* */\n }\n }\n const hooks = JSON.parse(buildClaudeEngineJson(config)) as Record<string, unknown>;\n writeFileSync(\n settingsPath,\n JSON.stringify({ ...existing, hooks: hooks.hooks }, null, 2) + \"\\n\",\n );\n }\n\n if (agents.includes(\"cursor\")) {\n const cursorRules = buildCursorEngine(config);\n const cursorPath = \".cursorrules\";\n if (existsSync(cursorPath)) {\n const content = readFileSync(cursorPath, \"utf8\");\n const start = content.indexOf(\"# ─── Holdpoint Rules\");\n const end = content.indexOf(\"# ─── End Holdpoint Rules ───\");\n if (start !== -1 && end !== -1) {\n // Slice past the end-marker line (find its newline to avoid hardcoded offsets)\n const afterEnd = content.indexOf(\"\\n\", end);\n const updated =\n content.slice(0, start) +\n cursorRules +\n content.slice(afterEnd === -1 ? end : afterEnd + 1);\n writeFileSync(cursorPath, updated);\n } else {\n writeFileSync(cursorPath, content + \"\\n\" + cursorRules);\n }\n }\n }\n\n if (agents.includes(\"codex\")) {\n mkdirSync(\".codex\", { recursive: true });\n // hooks.json is fully managed by Holdpoint; users who need additional Codex hooks\n // should add them in .codex/config.toml (Codex merges both sources).\n writeFileSync(\".codex/hooks.json\", buildCodexHooksJson(config), \"utf8\");\n writeFileSync(\".codex/holdpoint-check.mjs\", buildCodexCheckScript(config), \"utf8\");\n // Ensure hooks are explicitly enabled at the repo level.\n const configTomlPath = \".codex/config.toml\";\n if (!existsSync(configTomlPath)) {\n writeFileSync(configTomlPath, buildCodexConfigToml(), \"utf8\");\n } else {\n const existing = readFileSync(configTomlPath, \"utf8\");\n if (!existing.includes(\"[features]\")) {\n writeFileSync(configTomlPath, existing.trimEnd() + \"\\n\\n\" + buildCodexConfigToml(), \"utf8\");\n }\n // [features] already present — trust the user's settings\n }\n const agentsMdPath = \"AGENTS.md\";\n const existing = existsSync(agentsMdPath) ? readFileSync(agentsMdPath, \"utf8\") : \"\";\n writeFileSync(agentsMdPath, spliceAgentsMd(existing, config), \"utf8\");\n }\n\n spinner.succeed(chalk.green(\"Engine files updated from current checks.yaml\"));\n}\n","import { createServer, type IncomingMessage, type ServerResponse } from \"node:http\";\nimport { createReadStream, existsSync } from \"node:fs\";\nimport { join, extname, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { execSync } from \"node:child_process\";\nimport chalk from \"chalk\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst MIME: Record<string, string> = {\n \".html\": \"text/html; charset=utf-8\",\n \".js\": \"text/javascript\",\n \".mjs\": \"text/javascript\",\n \".css\": \"text/css\",\n \".svg\": \"image/svg+xml\",\n \".png\": \"image/png\",\n \".ico\": \"image/x-icon\",\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".json\": \"application/json\",\n};\n\n/**\n * Serve a static file with the appropriate MIME type.\n */\nfunction serveFile(res: ServerResponse, filePath: string): void {\n const mime = MIME[extname(filePath)] ?? \"application/octet-stream\";\n res.writeHead(200, { \"Content-Type\": mime });\n createReadStream(filePath).pipe(res);\n}\n\n/**\n * Handle an incoming HTTP request: serve `/__holdpoint/initial-yaml` from the\n * user's `checks.yaml`, `/__holdpoint/initial-reports` from the run history,\n * and all other paths as static files from `uiDir` with a SPA fallback to `index.html`.\n */\nfunction handleRequest(req: IncomingMessage, res: ServerResponse, uiDir: string): void {\n const url = (req.url ?? \"/\").split(\"?\")[0] ?? \"/\";\n\n // Serve the user's checks.yaml for the builder UI to load\n if (url === \"/__holdpoint/initial-yaml\") {\n const checksPath = join(process.cwd(), \"checks.yaml\");\n if (existsSync(checksPath)) {\n res.writeHead(200, { \"Content-Type\": \"text/yaml; charset=utf-8\" });\n createReadStream(checksPath).pipe(res);\n } else {\n res.writeHead(404, { \"Content-Type\": \"text/plain\" });\n res.end(\"checks.yaml not found in current directory\");\n }\n return;\n }\n\n // Serve the check run history for the History tab\n if (url === \"/__holdpoint/initial-reports\") {\n const reportsPath = join(process.cwd(), \".holdpoint\", \"check-reports.json\");\n if (existsSync(reportsPath)) {\n res.writeHead(200, { \"Content-Type\": \"application/json\" });\n createReadStream(reportsPath).pipe(res);\n } else {\n res.writeHead(404, { \"Content-Type\": \"text/plain\" });\n res.end(\"No check reports found\");\n }\n return;\n }\n\n // Static files\n const candidate = join(uiDir, url === \"/\" ? \"index.html\" : url);\n const filePath = existsSync(candidate) ? candidate : join(uiDir, \"index.html\"); // SPA fallback\n serveFile(res, filePath);\n}\n\n/**\n * Start the Holdpoint visual builder on localhost:4321.\n *\n * Serves the pre-built React SPA from `dist/builder-ui/` (bundled into the CLI\n * package at publish time) and exposes a `/__holdpoint/initial-yaml` endpoint\n * that returns the user's `checks.yaml` so the builder can load it on startup.\n */\nexport async function buildCommand(): Promise<void> {\n const port = 4321;\n const uiDir = join(__dirname, \"builder-ui\");\n\n if (!existsSync(uiDir)) {\n console.error(chalk.red(\"✗ Builder UI not found.\\n\"));\n console.log(chalk.dim(\" This is unexpected for a published build of @holdpoint/cli.\"));\n console.log(chalk.dim(\" If you installed from source, rebuild with: pnpm turbo build\\n\"));\n process.exit(1);\n }\n\n const server = createServer((req, res) => handleRequest(req, res, uiDir));\n\n await new Promise<void>((resolve, reject) => {\n server.listen(port, () => {\n console.log(\n `\\n${chalk.green(\"✓\")} Holdpoint builder running at ${chalk.cyan(`http://localhost:${port}`)}`,\n );\n console.log(chalk.dim(\" Edit checks.yaml, then reload the page to see updates\"));\n console.log(chalk.dim(\" Press Ctrl+C to stop\\n\"));\n\n const openCmd =\n process.platform === \"darwin\"\n ? \"open\"\n : process.platform === \"win32\"\n ? \"start\"\n : \"xdg-open\";\n try {\n execSync(`${openCmd} http://localhost:${port}`, { stdio: \"ignore\" });\n } catch {\n /* non-fatal */\n }\n });\n\n server.on(\"error\", reject);\n\n process.on(\"SIGINT\", () => {\n console.log(chalk.dim(\"\\n Stopping builder…\"));\n server.close(() => resolve());\n });\n });\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { execSync } from \"node:child_process\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { parseHoldpointYaml, generateYaml } from \"@holdpoint/yaml-core\";\nimport type { HoldpointConfig, CheckDef, ConditionDef } from \"@holdpoint/types\";\nimport { scanProject } from \"../evolve/scanner.js\";\nimport { getRepoFiles, detectStaleChecks } from \"../evolve/dead-checker.js\";\nimport { getTemplates } from \"../evolve/templates.js\";\n\n// ── Helpers ───────────────────────────────────────────────────────────────────\n\n/**\n * Strip leading comment lines from a checks.yaml so we can re-prepend them\n * after re-serialising — preserves the documentation header.\n */\nfunction extractHeader(yaml: string): string {\n const lines = yaml.split(\"\\n\");\n const commentLines: string[] = [];\n for (const line of lines) {\n if (line.startsWith(\"#\") || (commentLines.length > 0 && line.trim() === \"\")) {\n commentLines.push(line);\n } else {\n break;\n }\n }\n // Trim trailing blank lines\n while (commentLines.length > 0 && commentLines[commentLines.length - 1]?.trim() === \"\") {\n commentLines.pop();\n }\n return commentLines.join(\"\\n\");\n}\n\nfunction withHeader(header: string, newYaml: string): string {\n if (!header) return newYaml;\n return header + \"\\n\\n\" + newYaml;\n}\n\n// ── The command ───────────────────────────────────────────────────────────────\n\nexport async function evolveCommand(options: { apply?: boolean }): Promise<void> {\n if (!existsSync(\"checks.yaml\")) {\n console.error(chalk.red(\"No checks.yaml found. Run `holdpoint init` first.\"));\n process.exit(1);\n }\n\n const spinner = ora(\"Scanning project profile…\").start();\n const cwd = process.cwd();\n\n // 1. Scan project\n const profile = scanProject(cwd);\n const repoFiles = getRepoFiles(cwd);\n\n // 2. Parse checks.yaml\n const yamlContent = readFileSync(\"checks.yaml\", \"utf8\");\n let config: HoldpointConfig;\n try {\n config = parseHoldpointYaml(yamlContent);\n } catch (err: unknown) {\n spinner.fail(chalk.red(\"Invalid checks.yaml:\") + \" \" + (err as Error).message);\n process.exit(1);\n }\n\n spinner.stop();\n\n // 3. Compute proposals — templates whose trigger matches AND id not already in config\n const existingIds = new Set(config.checks.map((c) => c.id));\n const existingConditionIds = new Set(config.conditions.map((c) => c.id));\n const allTemplates = getTemplates(profile);\n const proposals = allTemplates.filter((t) => t.trigger(profile) && !existingIds.has(t.id));\n\n // 4. Detect stale checks\n const staleChecks = detectStaleChecks(config, repoFiles);\n\n // ── Print report ─────────────────────────────────────────────────────────\n\n // Profile summary — show detected items\n console.log(chalk.bold(\"\\n📋 Project profile:\"));\n const traits: [string, boolean, string][] = [\n [\"TypeScript\", profile.hasTypeScript, \"tsconfig.json\"],\n [\"ESLint\", profile.hasEslint, \"eslint.config.*\"],\n [\"Biome\", profile.hasBiome, \"biome.json\"],\n [\"Ruff\", profile.hasRuff, \"pyproject.toml / ruff\"],\n [\"Prettier\", profile.hasPrettier, \".prettierrc\"],\n [\"Vitest\", profile.hasVitest, \"devDependencies\"],\n [\"Jest\", profile.hasJest, \"devDependencies\"],\n [\"Python\", profile.hasPython, \"pyproject.toml\"],\n [\"Pytest\", profile.hasPytest, \"pytest.ini\"],\n [\"Go\", profile.hasGo, \"go.mod\"],\n [\"Rust\", profile.hasRust, \"Cargo.toml\"],\n [\"Next.js\", profile.hasNext, \"next.config.*\"],\n [\"React\", profile.hasReact, \"dependencies\"],\n [\"Prisma\", profile.hasPrisma, \"prisma/schema.prisma\"],\n [\"Drizzle\", profile.hasDrizzle, \"drizzle-orm\"],\n [\"Migrations\", profile.hasMigrations, \"migrations/\"],\n [\"Docker\", profile.hasDocker, \"Dockerfile\"],\n [\"Terraform\", profile.hasTerraform, \"*.tf\"],\n [\"Kubernetes\", profile.hasKubernetes, \"k8s/\"],\n [\"OpenAPI\", profile.hasOpenApi, \"openapi.yaml\"],\n [\"GitHub Actions\", profile.hasGithubActions, \".github/workflows/\"],\n ];\n const detected = traits.filter(([, yes]) => yes);\n if (detected.length === 0) {\n console.log(chalk.dim(\" (empty project — only universal checks apply)\"));\n } else {\n for (const [name, , hint] of detected) {\n console.log(` ${chalk.green(\"✓\")} ${name.padEnd(18)} ${chalk.dim(hint)}`);\n }\n }\n\n // Stale checks\n if (staleChecks.length > 0) {\n console.log(chalk.bold(`\\n⚠️ Stale checks (${staleChecks.length}):`));\n for (const { check, reason, suggestedConditionPath } of staleChecks) {\n const fix = suggestedConditionPath\n ? chalk.dim(` → will wrap with conditionId: file_exists: ${suggestedConditionPath}`)\n : chalk.dim(\" → no path inferred; review manually\");\n console.log(` ${chalk.yellow(\"◌\")} ${chalk.bold(check.id)} ${chalk.dim(reason)}${fix}`);\n }\n }\n\n // Proposals\n if (proposals.length === 0 && staleChecks.length === 0) {\n console.log(chalk.green(\"\\n✓ checks.yaml is fully in sync with the project profile.\"));\n return;\n }\n\n if (proposals.length > 0) {\n console.log(chalk.bold(`\\n💡 Proposed additions (${proposals.length}):`));\n for (const t of proposals) {\n const scope = t.when ? chalk.cyan(` when: ${t.when}`) : \"\";\n const type = t.cmd ? chalk.dim(\"cmd\") : chalk.dim(\"prompt\");\n const preview = t.cmd\n ? chalk.dim(` ${t.cmd.slice(0, 80)}${t.cmd.length > 80 ? \"…\" : \"\"}`)\n : chalk.dim(` ${(t.prompt ?? \"\").slice(0, 80)}${(t.prompt?.length ?? 0) > 80 ? \"…\" : \"\"}`);\n console.log(` ${chalk.green(\"+\")} ${chalk.bold(t.id.padEnd(24))} [${type}]${scope}`);\n console.log(` ${preview}`);\n }\n }\n\n if (!options.apply) {\n console.log(\n chalk.red(`\\n✗ checks.yaml is out of sync with the project profile.`) +\n `\\n Run ${chalk.bold(\"npx @holdpoint/cli@alpha evolve --apply\")} to apply these changes.`,\n );\n process.exit(1);\n }\n\n // ── Apply ───────────────────────────────────────────────────────────────\n\n const applySpinner = ora(\"Applying changes to checks.yaml…\").start();\n\n // Build updated conditions list\n const newConditions = [...config.conditions];\n\n // Collect conditions needed by proposals\n for (const t of proposals) {\n if (t.condition && !existingConditionIds.has(t.condition.id)) {\n newConditions.push(t.condition as ConditionDef);\n existingConditionIds.add(t.condition.id);\n }\n }\n\n // Wrap stale checks with file_exists conditions\n const updatedChecks: CheckDef[] = config.checks.map((check) => {\n const stale = staleChecks.find((s) => s.check.id === check.id);\n if (!stale || !stale.suggestedConditionPath) return check;\n\n const condId = `has-${check.id}`;\n if (!existingConditionIds.has(condId)) {\n newConditions.push({\n id: condId,\n operator: \"file_exists\",\n path: stale.suggestedConditionPath,\n });\n existingConditionIds.add(condId);\n }\n return { ...check, conditionId: condId };\n });\n\n // Append proposed checks\n const newChecks: CheckDef[] = proposals.map((t) => ({\n id: t.id,\n label: t.label,\n ...(t.when ? { when: t.when } : {}),\n ...(t.cmd ? { cmd: t.cmd } : {}),\n ...(t.prompt ? { prompt: t.prompt } : {}),\n ...(t.conditionId ? { conditionId: t.conditionId } : {}),\n }));\n\n const updatedConfig: HoldpointConfig = {\n ...config,\n conditions: newConditions,\n checks: [...updatedChecks, ...newChecks],\n };\n\n const header = extractHeader(yamlContent);\n const newYaml = withHeader(header, generateYaml(updatedConfig));\n writeFileSync(\"checks.yaml\", newYaml, \"utf8\");\n\n // Regenerate engine files\n applySpinner.text = \"Running holdpoint update…\";\n try {\n execSync(\"npx @holdpoint/cli@alpha update\", { stdio: \"pipe\" });\n } catch {\n // holdpoint update failure is non-fatal — checks.yaml is already written\n applySpinner.warn(\n chalk.yellow(\"checks.yaml updated, but `holdpoint update` failed — run it manually.\"),\n );\n printAppliedSummary(proposals.length, staleChecks.length);\n return;\n }\n\n applySpinner.succeed(chalk.green(\"checks.yaml updated and engine files regenerated.\"));\n printAppliedSummary(proposals.length, staleChecks.length);\n}\n\nfunction printAppliedSummary(added: number, wrapped: number): void {\n const parts: string[] = [];\n if (added > 0) parts.push(chalk.green(`${added} check${added === 1 ? \"\" : \"s\"} added`));\n if (wrapped > 0)\n parts.push(chalk.yellow(`${wrapped} stale check${wrapped === 1 ? \"\" : \"s\"} wrapped`));\n if (parts.length > 0) console.log(\" \" + parts.join(\" · \"));\n console.log(\n chalk.dim(\"\\n Review checks.yaml, then commit: \") +\n chalk.yellow(\"git add checks.yaml && git commit -m 'chore: evolve holdpoint checks'\"),\n );\n}\n","import { existsSync, readFileSync, readdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { execSync } from \"node:child_process\";\n\nexport interface ProjectProfile {\n // Languages\n hasTypeScript: boolean;\n hasPython: boolean;\n hasGo: boolean;\n hasRust: boolean;\n hasJava: boolean;\n hasRuby: boolean;\n // Frameworks\n hasNext: boolean;\n hasReact: boolean;\n // Linting\n hasEslint: boolean;\n hasBiome: boolean;\n hasRuff: boolean;\n hasPrettier: boolean;\n // Testing\n hasVitest: boolean;\n hasJest: boolean;\n hasPytest: boolean;\n // DB\n hasPrisma: boolean;\n hasDrizzle: boolean;\n hasMigrations: boolean;\n hasAlembic: boolean;\n // Infra\n hasDocker: boolean;\n hasTerraform: boolean;\n hasKubernetes: boolean;\n // API\n hasOpenApi: boolean;\n // CI\n hasGithubActions: boolean;\n // Package manager\n packageManager: \"pnpm\" | \"yarn\" | \"bun\" | \"npm\";\n // Raw scripts from package.json\n scripts: Record<string, string>;\n // All dep names (deps + devDeps)\n deps: Set<string>;\n}\n\ntype PkgJson = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n};\n\nfunction tryReadJson<T>(path: string): T | null {\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as T;\n } catch {\n return null;\n }\n}\n\nfunction tryReadText(path: string): string {\n try {\n return readFileSync(path, \"utf8\");\n } catch {\n return \"\";\n }\n}\n\n/**\n * Walk a directory up to maxDepth levels, returning all file paths relative to root.\n * Excludes common build artifacts and dependency directories.\n */\nfunction walkDir(\n dir: string,\n root: string,\n depth: number,\n maxDepth: number,\n ignored: Set<string>,\n): string[] {\n if (depth > maxDepth) return [];\n let entries: string[] = [];\n try {\n entries = readdirSync(dir);\n } catch {\n return [];\n }\n const results: string[] = [];\n for (const entry of entries) {\n if (ignored.has(entry)) continue;\n const full = join(dir, entry);\n const rel = full.slice(root.length + 1);\n try {\n // Use stat-free heuristic: if it has an extension it's likely a file\n // If no extension and doesn't start with \".\", try as directory\n const hasExt = entry.includes(\".\");\n if (!hasExt || entry.startsWith(\".\")) {\n // Could be a dir — try recursing\n const children = walkDir(full, root, depth + 1, maxDepth, ignored);\n if (children.length > 0) {\n results.push(...children);\n } else if (hasExt) {\n results.push(rel);\n }\n } else {\n results.push(rel);\n }\n } catch {\n // skip\n }\n }\n return results;\n}\n\nconst WALK_IGNORED = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".turbo\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n \".mypy_cache\",\n \"target\",\n \".cache\",\n \"coverage\",\n \".nyc_output\",\n]);\n\n/**\n * Returns a list of all files in the repo (relative paths from cwd).\n * Uses `git ls-files` when inside a git repo; falls back to directory walk.\n */\nexport function getRepoFiles(cwd: string): string[] {\n try {\n const out = execSync(\"git ls-files\", {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n const files = out.trim().split(\"\\n\").filter(Boolean);\n if (files.length > 0) return files;\n } catch {\n // not a git repo or git not available\n }\n return walkDir(cwd, cwd, 0, 6, WALK_IGNORED);\n}\n\n/**\n * Returns true if the file path is a structural project indicator — i.e., a file\n * whose addition or modification may require new checks to be added to checks.yaml.\n * Mirrors the detection patterns used in `scanProject()`.\n */\nexport function isStructuralFile(file: string): boolean {\n const f = file.replace(/\\\\/g, \"/\");\n\n // JS / TS project structure\n if (f === \"package.json\") return true;\n if (/^tsconfig[^/]*\\.json$/.test(f)) return true;\n\n // Python\n if (/^requirements[^/]*\\.txt$/.test(f)) return true;\n if (f === \"pyproject.toml\") return true;\n if (f === \"Pipfile\") return true;\n if (f === \"setup.py\") return true;\n if (f === \"setup.cfg\") return true;\n if (f === \"pytest.ini\") return true;\n if (f === \"tox.ini\") return true;\n\n // Go\n if (f === \"go.mod\") return true;\n\n // Rust\n if (f === \"Cargo.toml\") return true;\n\n // Java / Kotlin\n if (f === \"pom.xml\") return true;\n if (/^build\\.gradle(\\.kts)?$/.test(f)) return true;\n\n // Ruby\n if (f === \"Gemfile\") return true;\n\n // Test frameworks\n if (/^vitest\\.config\\.[^/]+$/.test(f)) return true;\n if (/^jest\\.config\\.[^/]+$/.test(f)) return true;\n if (/^playwright\\.config\\.[^/]+$/.test(f)) return true;\n\n // Linters / formatters\n if (/^eslint\\.config\\.[^/]+$/.test(f)) return true;\n if (/^\\.eslintrc[^/]*$/.test(f)) return true;\n if (/^biome\\.jsonc?$/.test(f)) return true;\n if (/^prettier\\.config\\.[^/]+$/.test(f)) return true;\n if (/^\\.prettierrc[^/]*$/.test(f)) return true;\n\n // Next.js\n if (/^next\\.config\\.[^/]+$/.test(f)) return true;\n\n // Docker / infra\n if (/^Dockerfile[^/]*$/.test(f)) return true;\n if (/^docker-compose[^/]*\\.ya?ml$/.test(f)) return true;\n if (/[^/]*\\.tf$/.test(f)) return true;\n\n // Database\n if (f === \"prisma/schema.prisma\") return true;\n\n // OpenAPI\n if (/^(api\\/)?openapi\\.(yaml|yml|json)$/.test(f)) return true;\n\n // CI\n if (/^\\.github\\/workflows\\/[^/]+\\.ya?ml$/.test(f)) return true;\n if (/^\\.circleci\\/.+$/.test(f)) return true;\n if (f === \"Jenkinsfile\") return true;\n if (f === \".gitlab-ci.yml\") return true;\n if (f === \".travis.yml\") return true;\n\n return false;\n}\n\n/**\n * Scan the project at `cwd` and return a `ProjectProfile`.\n * All detection is pure filesystem reads — no shell commands executed.\n */\nexport function scanProject(cwd = process.cwd()): ProjectProfile {\n const exists = (p: string) => existsSync(join(cwd, p));\n\n // Package manager\n const packageManager: ProjectProfile[\"packageManager\"] = exists(\"pnpm-lock.yaml\")\n ? \"pnpm\"\n : exists(\"yarn.lock\")\n ? \"yarn\"\n : exists(\"bun.lockb\")\n ? \"bun\"\n : \"npm\";\n\n // package.json\n const pkg = tryReadJson<PkgJson>(join(cwd, \"package.json\"));\n const scripts = pkg?.scripts ?? {};\n const deps = new Set<string>([\n ...Object.keys(pkg?.dependencies ?? {}),\n ...Object.keys(pkg?.devDependencies ?? {}),\n ]);\n\n // Python manifest scanning\n const pyprojectText = tryReadText(join(cwd, \"pyproject.toml\"));\n const requirementsText = tryReadText(join(cwd, \"requirements.txt\"));\n const pipfileText = tryReadText(join(cwd, \"Pipfile\"));\n const allPyText = pyprojectText + requirementsText + pipfileText;\n\n const hasPytest =\n exists(\"pytest.ini\") ||\n exists(\"setup.cfg\") ||\n allPyText.includes(\"pytest\") ||\n allPyText.includes(\"[tool.pytest\");\n const hasRuff = allPyText.includes(\"ruff\") || deps.has(\"ruff\");\n const hasAlembic = allPyText.includes(\"alembic\") || deps.has(\"alembic\");\n\n // Root-level file listing (for Dockerfile variants and .tf files)\n let rootFiles: string[] = [];\n try {\n rootFiles = readdirSync(cwd);\n } catch {\n // ignore\n }\n\n const hasDocker =\n rootFiles.some((f) => f === \"Dockerfile\" || f.startsWith(\"Dockerfile.\")) ||\n exists(\"docker-compose.yml\") ||\n exists(\"docker-compose.yaml\") ||\n exists(\"docker-compose.dev.yml\");\n\n const hasTerraform =\n rootFiles.some((f) => f.endsWith(\".tf\")) || exists(\"terraform\") || exists(\"infra\");\n\n return {\n // Languages\n hasTypeScript: exists(\"tsconfig.json\") || deps.has(\"typescript\"),\n hasPython:\n Boolean(pyprojectText) ||\n Boolean(requirementsText) ||\n Boolean(pipfileText) ||\n exists(\"setup.py\"),\n hasGo: exists(\"go.mod\"),\n hasRust: exists(\"Cargo.toml\"),\n hasJava: exists(\"pom.xml\") || exists(\"build.gradle\") || exists(\"build.gradle.kts\"),\n hasRuby: exists(\"Gemfile\"),\n\n // Frameworks\n hasNext:\n exists(\"next.config.ts\") ||\n exists(\"next.config.js\") ||\n exists(\"next.config.mjs\") ||\n deps.has(\"next\"),\n hasReact: deps.has(\"react\"),\n\n // Linting\n hasEslint:\n exists(\"eslint.config.js\") ||\n exists(\"eslint.config.ts\") ||\n exists(\"eslint.config.mjs\") ||\n exists(\".eslintrc.js\") ||\n exists(\".eslintrc.json\") ||\n exists(\".eslintrc.yml\") ||\n exists(\".eslintrc.yaml\") ||\n deps.has(\"eslint\"),\n hasBiome: exists(\"biome.json\") || exists(\"biome.jsonc\") || deps.has(\"@biomejs/biome\"),\n hasRuff,\n hasPrettier:\n exists(\"prettier.config.js\") ||\n exists(\"prettier.config.ts\") ||\n exists(\"prettier.config.mjs\") ||\n exists(\".prettierrc\") ||\n exists(\".prettierrc.json\") ||\n deps.has(\"prettier\"),\n\n // Testing\n hasVitest: deps.has(\"vitest\") || Boolean(scripts[\"test\"]?.includes(\"vitest\")),\n hasJest: deps.has(\"jest\") || Boolean(scripts[\"test\"]?.includes(\"jest\")),\n hasPytest,\n\n // DB\n hasPrisma: exists(\"prisma/schema.prisma\") || deps.has(\"@prisma/client\"),\n hasDrizzle: deps.has(\"drizzle-orm\"),\n hasMigrations: exists(\"migrations\") || exists(\"db/migrations\") || exists(\"database/migrations\"),\n hasAlembic,\n\n // Infra\n hasDocker,\n hasTerraform,\n hasKubernetes: exists(\"k8s\") || exists(\"kubernetes\") || exists(\"helm\"),\n\n // API\n hasOpenApi:\n exists(\"openapi.yaml\") ||\n exists(\"openapi.yml\") ||\n exists(\"openapi.json\") ||\n exists(\"api/openapi.yaml\"),\n\n // CI\n hasGithubActions: exists(\".github/workflows\"),\n\n packageManager,\n scripts,\n deps,\n };\n}\n","import { execSync } from \"node:child_process\";\nimport { readdirSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckDef, HoldpointConfig } from \"@holdpoint/types\";\n\nexport interface StaleCheck {\n check: CheckDef;\n reason: string;\n /** Path to use in a file_exists condition, if it can be inferred from the when: regex */\n suggestedConditionPath?: string;\n}\n\n/** Named scopes handled by matchesWhen() — these are never \"stale\" (intentionally broad) */\nconst NAMED_SCOPES = new Set([\n \"frontend\",\n \"backend\",\n \"socket\",\n \"visual\",\n \"python\",\n \"go\",\n \"rust\",\n \"java\",\n \"ruby\",\n \"database\",\n \"prisma\",\n \"testing\",\n \"infra\",\n \"ci\",\n \"docs\",\n \"structural\",\n]);\n\nconst WALK_IGNORED = new Set([\n \"node_modules\",\n \".git\",\n \"dist\",\n \"build\",\n \".next\",\n \".turbo\",\n \"__pycache__\",\n \".venv\",\n \"venv\",\n \".mypy_cache\",\n \"target\",\n \".cache\",\n \"coverage\",\n]);\n\nfunction walkDir(dir: string, root: string, depth: number, maxDepth: number): string[] {\n if (depth > maxDepth) return [];\n let entries: string[] = [];\n try {\n entries = readdirSync(dir);\n } catch {\n return [];\n }\n const results: string[] = [];\n for (const entry of entries) {\n if (WALK_IGNORED.has(entry) || entry.startsWith(\".\")) continue;\n const full = join(dir, entry);\n const rel = full.slice(root.length + 1);\n results.push(rel);\n // Try to recurse (will just return [] if it's a file, not a dir)\n const children = walkDir(full, root, depth + 1, maxDepth);\n results.push(...children);\n }\n return results;\n}\n\n/**\n * Returns a list of all files in the repo (relative paths from cwd).\n * Uses `git ls-files` when available; falls back to directory walk.\n */\nexport function getRepoFiles(cwd: string): string[] {\n try {\n const out = execSync(\"git ls-files\", {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"ignore\"],\n });\n const files = out.trim().split(\"\\n\").filter(Boolean);\n if (files.length > 0) return files;\n } catch {\n // not a git repo or git not available\n }\n return walkDir(cwd, cwd, 0, 6);\n}\n\n/**\n * Try to extract a simple path hint from a regex pattern, for use as a\n * `file_exists` condition path.\n * e.g. \"^prisma/\" → \"prisma\", \"^checks\\\\.yaml$\" → \"checks.yaml\"\n */\nfunction extractPathFromRegex(pattern: string): string | undefined {\n const cleaned = pattern\n .replace(/^\\^/, \"\")\n .replace(/\\$$/, \"\")\n .replace(/\\\\\\./g, \".\")\n .replace(/\\(\\?:/g, \"\")\n .replace(/\\)/g, \"\")\n .replace(/[|*+?[\\]{}()]/g, \"\");\n const candidate = cleaned.replace(/\\/$/, \"\").trim();\n if (candidate.length > 0 && /^[\\w\\-./]+$/.test(candidate)) return candidate;\n return undefined;\n}\n\n/**\n * Detect checks whose `when:` regex pattern matches zero files in the repo.\n * Named scope whens (frontend, backend, structural, etc.) are never flagged as stale.\n * User-defined named patterns (from config.patterns) are resolved to their regex before checking.\n * Checks that already have a conditionId are skipped (already guarded).\n */\nexport function detectStaleChecks(config: HoldpointConfig, repoFiles: string[]): StaleCheck[] {\n const stale: StaleCheck[] = [];\n const userPatterns = config.patterns ?? {};\n\n for (const check of config.checks) {\n if (!check.when) continue;\n if (NAMED_SCOPES.has(check.when)) continue;\n if (check.conditionId) continue; // already guarded by a condition\n\n // Resolve user-defined named patterns to their regex value\n const patternAlias = check.when in userPatterns ? check.when : undefined;\n const regexStr = patternAlias ? userPatterns[patternAlias]! : check.when;\n\n let re: RegExp;\n try {\n re = new RegExp(regexStr);\n } catch {\n stale.push({ check, reason: `Invalid regex: '${regexStr}'` });\n continue;\n }\n\n const matches = repoFiles.filter((f) => re.test(f));\n if (matches.length === 0) {\n const label = patternAlias\n ? `Pattern '${patternAlias}' (= '${regexStr}')`\n : `Regex '${regexStr}'`;\n const suggestedConditionPath = extractPathFromRegex(regexStr);\n // Verify the suggested path doesn't actually exist either\n const pathGone =\n !suggestedConditionPath || !existsSync(join(process.cwd(), suggestedConditionPath));\n if (pathGone) {\n stale.push({\n check,\n reason: `${label} matches 0 files in the repo`,\n ...(suggestedConditionPath ? { suggestedConditionPath } : {}),\n });\n }\n }\n }\n\n return stale;\n}\n","import type { ConditionDef } from \"@holdpoint/types\";\nimport type { ProjectProfile } from \"./scanner.js\";\n\nexport interface EvolveTemplate {\n id: string;\n label: string;\n when?: string;\n cmd?: string;\n prompt?: string;\n conditionId?: string;\n /** Condition to add to checks.yaml alongside the check (only if conditionId is set) */\n condition?: Omit<ConditionDef, \"id\"> & { id: string };\n /** Returns true if this check is relevant to the given project profile */\n trigger: (p: ProjectProfile) => boolean;\n}\n\n/** Returns the correct run command for a package.json script, respecting the detected package manager. */\nfunction pmScript(profile: ProjectProfile, script: string, fallback: string): string {\n if (!profile.scripts[script]) return fallback;\n if (profile.packageManager === \"npm\") return `npm run ${script}`;\n return `${profile.packageManager} ${script}`;\n}\n\n/**\n * Returns all applicable check templates for the given project profile.\n * Caller should filter out templates whose IDs already exist in checks.yaml.\n */\nexport function getTemplates(profile: ProjectProfile): EvolveTemplate[] {\n return [\n // ── Universal checks (always proposed for any project) ──────────────────\n {\n id: \"git-commit\",\n label: \"Commit all changes before finishing\",\n cmd: 'git rev-parse --is-inside-work-tree 2>/dev/null || exit 0; [ -z \"$(git status --porcelain)\" ] && exit 0; git status --short; exit 1',\n trigger: () => true,\n },\n {\n id: \"changelog-update\",\n label: \"Add a CHANGELOG.md entry for this session\",\n prompt:\n \"Before committing, add an entry to CHANGELOG.md describing what was done. \" +\n \"Use Keep a Changelog format — add under ## [Unreleased] (create the file \" +\n \"and that section if absent). Group entries as Added, Changed, Fixed, or Removed. \" +\n \"Be concise but specific. The entry text will serve as the commit message.\",\n trigger: () => true,\n },\n {\n id: \"readme-sync\",\n label: \"Update README.md if user-facing changes were made\",\n prompt:\n \"If you added, changed, or removed user-facing functionality — CLI commands, \" +\n \"configuration options, public APIs, or significant new features — update \" +\n \"README.md to reflect those changes.\",\n trigger: () => true,\n },\n {\n id: \"no-todos\",\n label: \"No TODO/FIXME left in changed code\",\n prompt:\n \"Scan the files you changed for any TODO, FIXME, HACK, or XXX comments. \" +\n \"Either resolve them before finishing or convert them to GitHub issues. \" +\n \"Don't leave incomplete work silently behind.\",\n trigger: () => true,\n },\n\n // ── TypeScript / JavaScript ──────────────────────────────────────────────\n {\n id: \"typecheck\",\n label: \"TypeScript type check\",\n cmd: pmScript(profile, \"typecheck\", \"npx tsc --noEmit\"),\n trigger: (p) => p.hasTypeScript,\n },\n {\n id: \"lint\",\n label: \"Lint codebase\",\n cmd: profile.hasEslint\n ? pmScript(profile, \"lint\", \"npx eslint .\")\n : profile.hasBiome\n ? pmScript(profile, \"lint\", \"npx @biomejs/biome check .\")\n : pmScript(profile, \"lint\", \"echo 'No linter detected'\"),\n trigger: (p) => p.hasEslint || p.hasBiome,\n },\n {\n id: \"format-check\",\n label: \"Prettier — format check\",\n cmd: pmScript(profile, \"format:check\", \"npx prettier --check .\"),\n trigger: (p) => p.hasPrettier,\n },\n {\n id: \"test\",\n label: \"Unit tests\",\n cmd: profile.hasVitest\n ? pmScript(profile, \"test\", \"npx vitest run\")\n : pmScript(profile, \"test\", \"npx jest --passWithNoTests\"),\n trigger: (p) => p.hasVitest || p.hasJest,\n },\n {\n id: \"jsdoc\",\n label: \"JSDoc on changed public functions\",\n prompt:\n \"Ensure all changed public functions, classes, and module exports have \" +\n \"accurate JSDoc comments (description + @param + @returns where applicable).\",\n trigger: (p) => p.hasTypeScript || p.hasReact,\n },\n {\n id: \"build\",\n label: \"Production build passes\",\n cmd: pmScript(profile, \"build\", \"echo 'No build script detected'\"),\n trigger: (p) => Boolean(p.scripts[\"build\"]),\n },\n\n // ── Python ───────────────────────────────────────────────────────────────\n {\n id: \"python-lint\",\n label: \"Ruff — Python linting\",\n cmd: \"ruff check .\",\n when: \"python\",\n trigger: (p) => p.hasPython && p.hasRuff,\n },\n {\n id: \"python-test\",\n label: \"Pytest — Python unit tests\",\n cmd: \"pytest\",\n when: \"python\",\n trigger: (p) => p.hasPython && p.hasPytest,\n },\n\n // ── Go ───────────────────────────────────────────────────────────────────\n {\n id: \"go-test\",\n label: \"Go tests\",\n cmd: \"go test ./...\",\n when: \"go\",\n trigger: (p) => p.hasGo,\n },\n {\n id: \"go-vet\",\n label: \"Go vet\",\n cmd: \"go vet ./...\",\n when: \"go\",\n trigger: (p) => p.hasGo,\n },\n\n // ── Database ─────────────────────────────────────────────────────────────\n {\n id: \"db-migrations\",\n label: \"Database migration for schema changes\",\n when: \"database\",\n prompt:\n \"If schema or migration files changed, ensure the appropriate migration was \" +\n \"generated with your ORM tool (e.g. `prisma migrate dev`, `alembic revision`, \" +\n \"`rails db:migrate`) and committed alongside the schema change.\",\n trigger: (p) => p.hasPrisma || p.hasAlembic || p.hasMigrations || p.hasDrizzle,\n },\n {\n id: \"prisma-format\",\n label: \"Prisma schema format check\",\n when: \"prisma\",\n cmd: \"npx prisma format --check 2>/dev/null || npx prisma format\",\n conditionId: \"has-prisma\",\n condition: {\n id: \"has-prisma\",\n operator: \"file_exists\",\n path: \"prisma/schema.prisma\",\n },\n trigger: (p) => p.hasPrisma,\n },\n\n // ── OpenAPI ──────────────────────────────────────────────────────────────\n {\n id: \"openapi-sync\",\n label: \"OpenAPI spec updated for API changes\",\n when: \"backend\",\n conditionId: \"has-openapi\",\n condition: {\n id: \"has-openapi\",\n operator: \"file_exists\",\n path: \"openapi.yaml\",\n },\n prompt:\n \"If any API routes were added or changed, update openapi.yaml (or openapi.json) \" +\n \"to reflect the new endpoints, request/response shapes, and error codes.\",\n trigger: (p) => p.hasOpenApi,\n },\n\n // ── Infra ─────────────────────────────────────────────────────────────────\n {\n id: \"docker-build\",\n label: \"Docker build passes\",\n when: \"infra\",\n cmd: \"docker build . --quiet -t app:ci\",\n conditionId: \"has-dockerfile\",\n condition: {\n id: \"has-dockerfile\",\n operator: \"file_exists\",\n path: \"Dockerfile\",\n },\n trigger: (p) => p.hasDocker,\n },\n {\n id: \"terraform-validate\",\n label: \"Terraform validate\",\n when: \"infra\",\n cmd: \"terraform validate\",\n trigger: (p) => p.hasTerraform,\n },\n\n // ── Frontend ─────────────────────────────────────────────────────────────\n {\n id: \"i18n\",\n label: \"i18n — no hardcoded user-facing strings\",\n when: \"frontend\",\n prompt:\n \"Confirm all user-visible strings are wrapped in the project's i18n function \" +\n \"(e.g. `t()`, `useTranslation`, `<Trans>`) and that locale files are updated \" +\n \"for any new copy.\",\n trigger: (p) => p.hasNext && p.hasReact,\n },\n ];\n}\n"],"mappings":";;;AAAA,SAAS,eAAe;;;ACAxB,SAAS,gBAAgB;AACzB,SAAS,cAAAA,aAAY,gBAAAC,eAAc,eAAe,WAAW,oBAAoB;AACjF,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,SAAS,iBAAiB,mBAAmB;AAC7C,SAAS,mBAAmB,6BAA6B;AACzD,SAAS,eAAe,yBAAyB;AACjD;AAAA,EACE,mBAAmB;AAAA,EACnB,kBAAkB;AAAA,EAClB,oBAAoB;AAAA,EACpB;AAAA,OAEK;AACP,SAAS,0BAA0B;;;AChBnC,SAAS,YAAY,oBAAoB;AAMlC,SAAS,uBAAuC;AACrD,MAAI,WAAW,gBAAgB,EAAG,QAAO;AACzC,MAAI,WAAW,WAAW,EAAG,QAAO;AACpC,SAAO;AACT;AAgBO,SAAS,wBAAqC;AACnD,QAAM,SAAsB,CAAC;AAC7B,MAAI,WAAW,4CAA4C,EAAG,QAAO,KAAK,SAAS;AACnF,MAAI,WAAW,uBAAuB,EAAG,QAAO,KAAK,QAAQ;AAC7D,MAAI,WAAW,cAAc,GAAG;AAC9B,QAAI;AACF,UAAI,aAAa,gBAAgB,MAAM,EAAE,SAAS,iBAAiB,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B,YAAY,mDAAmD,EAC/D,QAAQ,eAAe;AAE1B,QACG,QAAQ,MAAM,EACd,YAAY,6CAA6C,EACzD,OAAO,mBAAmB,sDAAsD,EAChF;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,WAAW;AAErB,QACG,QAAQ,OAAO,EACf,YAAY,kCAAkC,EAC9C,OAAO,YAAY,qCAAqC,EACxD,OAAO,YAAY;AAEtB,QACG,QAAQ,UAAU,EAClB,YAAY,kDAAkD,EAC9D,OAAO,eAAe;AAEzB,QACG,QAAQ,QAAQ,EAChB,YAAY,0EAA0E,EACtF,OAAO,aAAa;AAEvB,QACG,QAAQ,SAAS,EACjB,YAAY,8CAA8C,EAC1D,OAAO,YAAY;AAEtB,QACG,QAAQ,QAAQ,EAChB,YAAY,4EAA4E,EACxF,OAAO,WAAW,mEAAmE,EACrF,OAAO,aAAa;AAEvB,QAAQ,MAAM;","names":["existsSync","readFileSync","existsSync","readFileSync","existsSync","readFileSync","writeFileSync","mkdirSync","join","chalk","ora","parseHoldpointYaml","execSync","existsSync","readFileSync","chalk","parseHoldpointYaml","existsSync","readFileSync","writeFileSync","mkdirSync","chalk","ora","parseHoldpointYaml","buildConfigJson","buildEngine","buildClaudeEngineJson","buildCursorEngine","buildCodexConfigToml","buildCodexHooksJson","buildCodexCheckScript","spliceAgentsMd","existsSync","chalk","ora","parseHoldpointYaml","readFileSync","mkdirSync","writeFileSync","buildConfigJson","buildEngine","buildClaudeEngineJson","buildCursorEngine","buildCodexHooksJson","buildCodexCheckScript","buildCodexConfigToml","existing","spliceAgentsMd","existsSync","join","dirname","fileURLToPath","execSync","chalk","__dirname","existsSync","readFileSync","writeFileSync","execSync","chalk","ora","parseHoldpointYaml","existsSync","readFileSync","join","execSync","existsSync","join","execSync","readdirSync","existsSync","join","existsSync","chalk","ora","readFileSync","parseHoldpointYaml","writeFileSync","execSync"]}
|
|
@@ -9,7 +9,7 @@ eval checkpoints. Before marking any task done, all checks must pass.
|
|
|
9
9
|
|
|
10
10
|
Before marking **any** task complete:
|
|
11
11
|
|
|
12
|
-
1. Run `
|
|
12
|
+
1. Run `holdpoint check` — all tasks must exit 0.
|
|
13
13
|
2. `holdpoint check` also prints every **prompt** check whose `when` matches the
|
|
14
14
|
files you changed. Read and act on each listed instruction before finishing.
|
|
15
15
|
|
|
@@ -19,12 +19,12 @@ Before marking **any** task complete:
|
|
|
19
19
|
|
|
20
20
|
`checks.yaml` is not static — it grows alongside the project automatically.
|
|
21
21
|
|
|
22
|
-
**`holdpoint-evolve` is a deterministic check** in `checks.yaml` that fires whenever you change a structural file (`package.json`, `pyproject.toml`, `go.mod`, `Dockerfile`, `tsconfig.json`, `vitest.config.*`, etc.). When it fires, `
|
|
22
|
+
**`holdpoint-evolve` is a deterministic check** in `checks.yaml` that fires whenever you change a structural file (`package.json`, `pyproject.toml`, `go.mod`, `Dockerfile`, `tsconfig.json`, `vitest.config.*`, etc.). When it fires, `holdpoint evolve` runs and **exits 1 if `checks.yaml` is out of sync** — blocking task completion until you apply the proposals.
|
|
23
23
|
|
|
24
24
|
When blocked by `holdpoint-evolve`, run:
|
|
25
25
|
|
|
26
26
|
```
|
|
27
|
-
|
|
27
|
+
holdpoint evolve --apply # scan, apply proposals, regenerate engine files
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Then commit:
|
|
@@ -56,7 +56,7 @@ remove, or change checkpoints.
|
|
|
56
56
|
After every edit, regenerate the engine files and commit everything together:
|
|
57
57
|
|
|
58
58
|
```
|
|
59
|
-
|
|
59
|
+
holdpoint update
|
|
60
60
|
git add checks.yaml .github/holdpoint/generated/ .github/hooks/
|
|
61
61
|
git commit -m "chore: update holdpoint checks"
|
|
62
62
|
```
|
|
@@ -200,7 +200,7 @@ context:
|
|
|
200
200
|
|
|
201
201
|
1. Open `checks.yaml`.
|
|
202
202
|
2. Add your entry under `checks:`.
|
|
203
|
-
3. Run `
|
|
203
|
+
3. Run `holdpoint update`.
|
|
204
204
|
4. Commit `checks.yaml` and the generated files.
|
|
205
205
|
|
|
206
206
|
**Add a task check (runs a shell command automatically):**
|
|
@@ -283,15 +283,15 @@ skipped.
|
|
|
283
283
|
|
|
284
284
|
## Commands
|
|
285
285
|
|
|
286
|
-
| Command
|
|
287
|
-
|
|
|
288
|
-
| `
|
|
289
|
-
| `
|
|
290
|
-
| `
|
|
291
|
-
| `
|
|
292
|
-
| `
|
|
293
|
-
| `
|
|
294
|
-
| `
|
|
286
|
+
| Command | What it does |
|
|
287
|
+
| -------------------------- | ------------------------------------------------------- |
|
|
288
|
+
| `holdpoint check` | Run checks against all files changed vs HEAD |
|
|
289
|
+
| `holdpoint check --staged` | Run checks against staged files only |
|
|
290
|
+
| `holdpoint evolve` | Scan project and show proposed additions to checks.yaml |
|
|
291
|
+
| `holdpoint evolve --apply` | Apply proposals and regenerate engine files |
|
|
292
|
+
| `holdpoint update` | Regenerate engine files from the current `checks.yaml` |
|
|
293
|
+
| `holdpoint validate` | Validate `checks.yaml` schema (no commands run) |
|
|
294
|
+
| `holdpoint builder` | Open the visual builder UI at localhost:4321 |
|
|
295
295
|
|
|
296
296
|
---
|
|
297
297
|
|
|
@@ -305,5 +305,5 @@ skipped.
|
|
|
305
305
|
| `.claude/settings.json` | Claude |
|
|
306
306
|
| `.cursorrules` (Holdpoint section) | Cursor |
|
|
307
307
|
|
|
308
|
-
All generated files are overwritten by `
|
|
308
|
+
All generated files are overwritten by `holdpoint update`. Edit `checks.yaml`,
|
|
309
309
|
then run `update` — never edit the generated files directly.
|
|
@@ -50,7 +50,7 @@ checks:
|
|
|
50
50
|
- id: holdpoint-evolve
|
|
51
51
|
label: "Evolve checks when project structure changes"
|
|
52
52
|
when: structural
|
|
53
|
-
cmd: "
|
|
53
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
54
54
|
|
|
55
55
|
- id: git-commit
|
|
56
56
|
label: "Commit all changes before finishing"
|
|
@@ -86,7 +86,7 @@ checks:
|
|
|
86
86
|
- id: holdpoint-evolve
|
|
87
87
|
label: "Evolve checks when project structure changes"
|
|
88
88
|
when: structural
|
|
89
|
-
cmd: "
|
|
89
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
90
90
|
|
|
91
91
|
- id: git-commit
|
|
92
92
|
label: "Commit all changes before finishing"
|
package/dist/templates/go.yaml
CHANGED
|
@@ -53,7 +53,7 @@ checks:
|
|
|
53
53
|
- id: holdpoint-evolve
|
|
54
54
|
label: "Evolve checks when project structure changes"
|
|
55
55
|
when: structural
|
|
56
|
-
cmd: "
|
|
56
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
57
57
|
|
|
58
58
|
- id: git-commit
|
|
59
59
|
label: "Commit all changes before finishing"
|
|
@@ -69,7 +69,7 @@ checks:
|
|
|
69
69
|
- id: holdpoint-evolve
|
|
70
70
|
label: "Evolve checks when project structure changes"
|
|
71
71
|
when: structural
|
|
72
|
-
cmd: "
|
|
72
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
73
73
|
|
|
74
74
|
- id: git-commit
|
|
75
75
|
label: "Commit all changes before finishing"
|
|
@@ -53,7 +53,7 @@ checks:
|
|
|
53
53
|
- id: holdpoint-evolve
|
|
54
54
|
label: "Evolve checks when project structure changes"
|
|
55
55
|
when: structural
|
|
56
|
-
cmd: "
|
|
56
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
57
57
|
|
|
58
58
|
- id: git-commit
|
|
59
59
|
label: "Commit all changes before finishing"
|
|
@@ -45,7 +45,7 @@ checks:
|
|
|
45
45
|
- id: holdpoint-evolve
|
|
46
46
|
label: "Evolve checks when project structure changes"
|
|
47
47
|
when: structural
|
|
48
|
-
cmd: "
|
|
48
|
+
cmd: "node_modules/.bin/holdpoint evolve"
|
|
49
49
|
|
|
50
50
|
- id: git-commit
|
|
51
51
|
label: "Commit all changes before finishing"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holdpoint/cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.15",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"tag": "alpha"
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"chalk": "^5.3.0",
|
|
50
50
|
"commander": "^12.1.0",
|
|
51
51
|
"ora": "^8.1.1",
|
|
52
|
-
"@holdpoint/engine-claude": "0.1.0-alpha.
|
|
53
|
-
"@holdpoint/engine-codex": "0.1.0-alpha.
|
|
54
|
-
"@holdpoint/engine-cursor": "0.1.0-alpha.
|
|
52
|
+
"@holdpoint/engine-claude": "0.1.0-alpha.10",
|
|
53
|
+
"@holdpoint/engine-codex": "0.1.0-alpha.11",
|
|
54
|
+
"@holdpoint/engine-cursor": "0.1.0-alpha.9",
|
|
55
|
+
"@holdpoint/engine-copilot": "0.1.0-alpha.11",
|
|
55
56
|
"@holdpoint/types": "0.1.0-alpha.6",
|
|
56
|
-
"@holdpoint/engine-copilot": "0.1.0-alpha.10",
|
|
57
57
|
"@holdpoint/yaml-core": "0.1.0-alpha.7"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|