The design language that makes your AI harness better at design.
JavaScript
Fix: doctor's user-level Codex hook advice after #1069 (#1111) (#1140)
Abdul Wahabb989d0d6bc3e
diff --git a/crates/context/src/context_cli.rs b/crates/context/src/context_cli.rsindex f886797d0..7dc34c360 100644--- a/crates/context/src/context_cli.rs+++ b/crates/context/src/context_cli.rs@@ -30,7 +30,7 @@ pub fn hook_manifests_for(provider_id: &str) -> &'static [&'static str] {}}-/// The user-level manifest a user-scope install writes for this provider:+/// The user-level hook manifest this provider's harness loads:/// Claude's `~/.claude/settings.json`; Codex and agents `$CODEX_HOME/hooks.json`/// (relative to cwd), or `~/.codex/hooks.json` when CODEX_HOME is unset or/// empty. A non-empty CODEX_HOME is exclusive.diff --git a/crates/context/src/staleness_deep.rs b/crates/context/src/staleness_deep.rsindex 35b2f0cd4..cc7a844e4 100644--- a/crates/context/src/staleness_deep.rs+++ b/crates/context/src/staleness_deep.rs@@ -308,8 +308,13 @@ pub fn check_hook_installation(ia,broken.iter().map(|c| format!("`{}`", c)).collect::<Vec<_>>().join(", ")),- if *is_user {- "Repoint this user-level manifest at the installed skill: `impeccable update --user` rewrites `~/.claude/settings.json` and `~/.codex/hooks.json`, but a hooks file under a custom `CODEX_HOME` has to be edited by hand."+ // `update --user` rewrites only Claude's user manifest; other+ // providers get project hooks, and a launcher entry in their+ // home file is never repointed.+ if *is_user && provider_id == "claude-code" {+ "Reinstall with `impeccable update --user`, which rewrites this user-level manifest against the skill's current location."+ } else if *is_user {+ "Edit this user-level manifest by hand: point the command at the installed skill's launcher, or remove the Impeccable entry. `impeccable update --user` installs project hooks and does not repoint this file."} else {"Reinstall with `impeccable hooks on`, which rewrites the manifest against the skill's current location."}@@ -587,7 +592,7 @@ mod tests {let findings = check_hook_installation(&project, None, "claude-code", Some(&manifest));assert_eq!(findings.len(), 1, "{findings:?}");assert_eq!(findings[0].id, "hook-script-missing");- assert!(findings[0].fix.contains("update --user"), "{:?}", findings[0].fix);+ assert!(findings[0].fix.starts_with("Reinstall with `impeccable update --user`"), "{:?}", findings[0].fix);let _ = std::fs::remove_dir_all(&root);}@@ -621,7 +626,7 @@ mod tests {let findings = check_hook_installation(&project, None, "codex", Some(&manifest));assert_eq!(findings.len(), 1, "{findings:?}");assert_eq!(findings[0].id, "hook-script-missing");- assert!(findings[0].fix.contains("update --user"), "{:?}", findings[0].fix);+ assert!(findings[0].fix.contains("by hand"), "{:?}", findings[0].fix);let _ = std::fs::remove_dir_all(&root);}}diff --git a/docs/CLI-CONTRACT.md b/docs/CLI-CONTRACT.mdindex 60e1ef523..7f228a325 100644--- a/docs/CLI-CONTRACT.md+++ b/docs/CLI-CONTRACT.md@@ -794,7 +794,7 @@ Tier 2 (`staleness-deep.mjs`, doctor only):- `checkDesignDrift({designPath, projectRoot, threshold=25})`: git (5 s timeout, stdout only) `rev-parse --is-inside-work-tree`; `log -1 --format=%H -- <relDesign>` (none -> []); dirs = existing of `src app pages components site styles public`; count lines of `log --oneline <hash>..HEAD -- <dirs>`; `>= 25` -> `design-md-drift` (route) with `%ad --date=short` date.- `checkDesignCoverage({design, designPath, parseDesignMd})`: seed marker `<!-- SEED: established with the user before implementation; re-run /impeccable document once there's code to capture the actual tokens and components. -->` (or `$impeccable`) -> required `colors, typography`; else `colors, typography, components`; missing = section null AND frontmatter[section] has no non-empty string leaf (empty `[]`/`{}` strings don't count; booleans/numbers don't count) -> `design-md-coverage` (mention).- `checkDetectorIgnores({projectRoot, knownRuleIds})`: per config file: `detector.ignoreRules` lowercased/trimmed, not `*`, not in registry -> `detector-ignore-rules-unknown` (mention; skipped when registry null); `detector.ignoreFiles` entries without `*` and not existing -> `detector-ignore-files-missing` (mention).-- `checkHookInstallation({projectRoot, repoRoot, providerId})`: manifests per provider (same table as context); commands containing a marker; script token extraction: double-quoted path first, `'\''` -> unparseable (skip), single-quoted, else bare token `/([^\s"'|&;()]*skills\/impeccable\/scripts\/hook(?:-before-edit)?\.mjs)/`; resolution: `$(`/backtick -> skip; `${CLAUDE_PROJECT_DIR}` -> root; any other `${VAR}`/`$VAR` -> skip; relative -> join(root). Missing -> `hook-script-missing` (mention). If any manifest installed and any config has `hook.enabled === false` -> `hook-enabled-conflict` (mention, returns after first). It also checks the provider's user-level manifest (Claude `~/.claude/settings.json`; Codex and agents the same `$CODEX_HOME/hooks.json` or `~/.codex/hooks.json` file context reads); a missing launcher there gets a fix naming `impeccable update --user`, which rewrites only the default home locations, so a custom `CODEX_HOME` file is repointed by hand. Provider `cursor` only: a manifest whose `hooks.preToolUse` still runs an Impeccable hook (the retired before-edit gate, either spelling) -> `cursor-hook-pre-edit-gate` (auto, path the manifest, summary `<rel> still runs the design hook as Cursor's \`preToolUse\` write gate, which is retired. Cursor now runs it after each edit on \`postToolUse\` and hands the findings to the agent as context.`, fix ``Move the entry to `postToolUse`: `impeccable doctor --fix`, `impeccable hooks on`, or the next `impeccable update` does it.``). It is emitted before any `hook-script-missing` for the same manifest.+- `checkHookInstallation({projectRoot, repoRoot, providerId})`: manifests per provider (same table as context); commands containing a marker; script token extraction: double-quoted path first, `'\''` -> unparseable (skip), single-quoted, else bare token `/([^\s"'|&;()]*skills\/impeccable\/scripts\/hook(?:-before-edit)?\.mjs)/`; resolution: `$(`/backtick -> skip; `${CLAUDE_PROJECT_DIR}` -> root; any other `${VAR}`/`$VAR` -> skip; relative -> join(root). Missing -> `hook-script-missing` (mention). If any manifest installed and any config has `hook.enabled === false` -> `hook-enabled-conflict` (mention, returns after first). It also checks the provider's user-level manifest (Claude `~/.claude/settings.json`; Codex and agents the same `$CODEX_HOME/hooks.json` or `~/.codex/hooks.json` file context reads); a missing launcher there gets the fix `impeccable update --user` for Claude, and a by-hand fix for Codex and agents, whose `update --user` writes project hooks and never repoints a launcher entry in the home file. Provider `cursor` only: a manifest whose `hooks.preToolUse` still runs an Impeccable hook (the retired before-edit gate, either spelling) -> `cursor-hook-pre-edit-gate` (auto, path the manifest, summary `<rel> still runs the design hook as Cursor's \`preToolUse\` write gate, which is retired. Cursor now runs it after each edit on \`postToolUse\` and hands the findings to the agent as context.`, fix ``Move the entry to `postToolUse`: `impeccable doctor --fix`, `impeccable hooks on`, or the next `impeccable update` does it.``). It is emitted before any `hook-script-missing` for the same manifest.- `checkLegacyLiveState`: `.impeccable-live.json` / `.impeccable-live` present -> `legacy-live-state` (auto).- `checkWorkspaces({repoRoot, candidates, ...})`: per candidate `{ name, path, productStatus, productPath, designStatus, designPath, platform: extractPlatform(product) || (product ? 'web (default)' : null) }`; native evidence per workspace -> `workspace-platform-native-evidence` (mention); any inherited -> `workspace-context-inherited` (mention, path null).- `loadKnownRuleIds(scriptsDir)`: `<scriptsDir>/detector/detect-antipatterns.mjs` then `<scriptsDir>/../../cli/engine/detect-antipatterns.mjs`; import `ANTIPATTERNS` -> Set of lowercase ids; null when unavailable.diff --git a/tests/oracle/golden/doctor-codex-home-hook-script-missing.json b/tests/oracle/golden/doctor-codex-home-hook-script-missing.jsonindex d5b1e7abf..ded5f27a6 100644--- a/tests/oracle/golden/doctor-codex-home-hook-script-missing.json+++ b/tests/oracle/golden/doctor-codex-home-hook-script-missing.json@@ -1,5 +1,5 @@{- "stdout": "{\n \"projectRoot\": \"<WS>\",\n \"repoRoot\": \"<WS>\",\n \"isMonorepo\": false,\n \"productPath\": \"PRODUCT.md\",\n \"designPath\": null,\n \"platform\": \"web\",\n \"ruleRegistryAvailable\": true,\n \"findings\": [\n {\n \"id\": \"hook-script-missing\",\n \"artifact\": \"hook manifest\",\n \"path\": \"codex-home/hooks.json\",\n \"severity\": \"mention\",\n \"summary\": \"codex-home/hooks.json installs the design hook, but its script path does not exist: `[ ! -f '/u/.agents/skills/impeccable/scripts/impeccable' ] || '/u/.agents/skills/impeccable/scripts/impeccable' hook`. The hook runs as a no-op, so UI edits have been going unscanned while the project looks covered.\",\n \"fix\": \"Repoint this user-level manifest at the installed skill: `impeccable update --user` rewrites `~/.claude/settings.json` and `~/.codex/hooks.json`, but a hooks file under a custom `CODEX_HOME` has to be edited by hand.\"\n }\n ],\n \"workspaces\": []\n}\n",+ "stdout": "{\n \"projectRoot\": \"<WS>\",\n \"repoRoot\": \"<WS>\",\n \"isMonorepo\": false,\n \"productPath\": \"PRODUCT.md\",\n \"designPath\": null,\n \"platform\": \"web\",\n \"ruleRegistryAvailable\": true,\n \"findings\": [\n {\n \"id\": \"hook-script-missing\",\n \"artifact\": \"hook manifest\",\n \"path\": \"codex-home/hooks.json\",\n \"severity\": \"mention\",\n \"summary\": \"codex-home/hooks.json installs the design hook, but its script path does not exist: `[ ! -f '/u/.agents/skills/impeccable/scripts/impeccable' ] || '/u/.agents/skills/impeccable/scripts/impeccable' hook`. The hook runs as a no-op, so UI edits have been going unscanned while the project looks covered.\",\n \"fix\": \"Edit this user-level manifest by hand: point the command at the installed skill's launcher, or remove the Impeccable entry. `impeccable update --user` installs project hooks and does not repoint this file.\"\n }\n ],\n \"workspaces\": []\n}\n","stderr": "","exit": 0,"signal": null,diff --git a/tests/oracle/golden/doctor-codex-user-hook-script-missing.json b/tests/oracle/golden/doctor-codex-user-hook-script-missing.jsonindex cc85f64cf..bbef4b7c8 100644--- a/tests/oracle/golden/doctor-codex-user-hook-script-missing.json+++ b/tests/oracle/golden/doctor-codex-user-hook-script-missing.json@@ -1,5 +1,5 @@{- "stdout": "{\n \"projectRoot\": \"<WS>\",\n \"repoRoot\": \"<WS>\",\n \"isMonorepo\": false,\n \"productPath\": \"PRODUCT.md\",\n \"designPath\": null,\n \"platform\": \"web\",\n \"ruleRegistryAvailable\": true,\n \"findings\": [\n {\n \"id\": \"hook-script-missing\",\n \"artifact\": \"hook manifest\",\n \"path\": \".oracle-home/.codex/hooks.json\",\n \"severity\": \"mention\",\n \"summary\": \".oracle-home/.codex/hooks.json installs the design hook, but its script path does not exist: `[ ! -f '/u/.agents/skills/impeccable/scripts/impeccable' ] || '/u/.agents/skills/impeccable/scripts/impeccable' hook`. The hook runs as a no-op, so UI edits have been going unscanned while the project looks covered.\",\n \"fix\": \"Repoint this user-level manifest at the installed skill: `impeccable update --user` rewrites `~/.claude/settings.json` and `~/.codex/hooks.json`, but a hooks file under a custom `CODEX_HOME` has to be edited by hand.\"\n }\n ],\n \"workspaces\": []\n}\n",+ "stdout": "{\n \"projectRoot\": \"<WS>\",\n \"repoRoot\": \"<WS>\",\n \"isMonorepo\": false,\n \"productPath\": \"PRODUCT.md\",\n \"designPath\": null,\n \"platform\": \"web\",\n \"ruleRegistryAvailable\": true,\n \"findings\": [\n {\n \"id\": \"hook-script-missing\",\n \"artifact\": \"hook manifest\",\n \"path\": \".oracle-home/.codex/hooks.json\",\n \"severity\": \"mention\",\n \"summary\": \".oracle-home/.codex/hooks.json installs the design hook, but its script path does not exist: `[ ! -f '/u/.agents/skills/impeccable/scripts/impeccable' ] || '/u/.agents/skills/impeccable/scripts/impeccable' hook`. The hook runs as a no-op, so UI edits have been going unscanned while the project looks covered.\",\n \"fix\": \"Edit this user-level manifest by hand: point the command at the installed skill's launcher, or remove the Impeccable entry. `impeccable update --user` installs project hooks and does not repoint this file.\"\n }\n ],\n \"workspaces\": []\n}\n","stderr": "","exit": 0,"signal": null,