* Add inline, in-file ignore comments for the detector (issue #283) Complement config ignores with eslint-disable-style waivers that live where they apply and travel with the file when it leaves the repo. The motivating case is a generated/exported standalone document that legitimately uses a first-party brand typeface (on the overused-font list) and is later scanned without .impeccable/config.json present. Marker is comment-syntax-agnostic (works in //, /* */, <!-- -->, #, {/* */}): impeccable-disable <rule>[, <rule>...] [-- reason | : reason] whole file impeccable-disable-line <rule>... same line impeccable-disable-next-line <rule>... next line Bare directive or * means every rule; reason is optional and discarded at scan time. Behavior is suppression, for parity with config ignores. Implementation: - New pure module cli/engine/shared/inline-ignores.mjs (parser + filter, no Node deps). Static-HTML findings have no line number, so only whole-file directives apply there -- exactly the standalone-document case; the regex/text engine additionally honors the line-scoped forms. - Wired into detectText and detectHtml, gated by options.inlineIgnores. - detect CLI applies inline ignores by default; --no-inline-ignores skips just them, --no-config skips config and inline ignores together. Docs: config.md (new section), detector.md, README. skill/reference/hooks.md reversed its prior "inline comments are not supported" guidance and now points the agent to inline waivers for the travels-with-the-file case. Changelog 3.x. Tests: tests/inline-ignores.test.mjs (parser units, detectText/detectHtml integration, CLI end-to-end), registered in the detector suite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Reconcile design hook wording with inline ignores Two hook-side fixes prompted by review of the new inline-ignore feature: 1. Clean-ack steer line. The old line ("Keep typography hierarchy, spacing rhythm, and color contrast intentional on the next change.") read as an odd non-sequitur after "No anti-patterns." Reworded the whole clean ack to say what it means: a clean scan only clears the deterministic rule set, not overall design quality, so keep following the design system and skill guidance. Now: "Design hook scanned X. No deterministic design-quality issues found. That does not mean the design is good: keep following the project design system and the impeccable skill guidance." 2. Directive footer. It still told the agent "Do not add source comments such as `impeccable: ignore`; those pollute the code and do not suppress hook findings." That is now misleading: the hook runs the same detector engine as the CLI, which honors inline `impeccable-disable` waivers, so they DO suppress hook findings (consistent with config ignores, which filterFindings already honors). Reworded to: don't silence a real finding to skip fixing it; suppress only after the user confirms intent; prefer a config ignore, and reach for an inline `impeccable-disable <rule>` comment only when the waiver must travel with a file that leaves the repo. Added a hook test asserting an inline `impeccable-disable-line` comment makes the hook scan the file clean (locks in the cross-cutting behavior), and updated the clean-ack / footer assertions to the new wording. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Address review on inline-ignores parser - Case-insensitive fast-path bail-out (Cursor): the cheap substring guard was lowercase-only while DIRECTIVE_RE has the `i` flag, so a mixed-case marker like `Impeccable-Disable` skipped parsing entirely and never suppressed. Switched the guard to `/impeccable-disable/i.test(...)`. Added a regression test. - Removed the unreachable `-->` branch from TRAILING_CLOSER_RE (Greptile): `--+>` already matches `-->` and any longer dash run. - Replaced the always-truthy lazy-match + `if (sep)` reason strip with an explicit first-separator slice (Greptile): clearer and drops the dead branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Align inline-ignore line numbering with the detector (CRLF/CR endings) parseInlineIgnores split lines with /\r\n|\r|\n/, but detectText numbers lines with split('\n'). On classic `\r`-only endings the two diverged, so a disable-line / disable-next-line directive could key a different line than the finding it should waive (Cursor review). Split on '\n' only, matching the detector exactly; the directive regex already excludes '\r', so a trailing '\r' on CRLF files is never captured into the rule list. Added a CRLF regression test through the real detectText. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8.2 KiB
/impeccable hooks
Manage the design detector hook for the current project.
The hook runs the impeccable design detector on direct file edits to design-relevant files (.tsx, .jsx, .html, .vue, .svelte, .astro, .css, .scss, .sass, .less, .ts, .js). Claude Code, Codex, and GitHub Copilot use a post-tool-use hook and push a short system reminder into the agent's context after the edit; findings get a correction prompt, pending issues get a re-nudge, and clean UI-ish files get a short ack unless quiet mode is on (hook.quiet in config). Plain .ts and .js files are still scanned, but stay quiet unless the detector finds something. Cursor uses preToolUse to block bad proposed writes before they land and stays silent when it allows a clean write.
This command toggles the hook per project by editing .impeccable/config.json (the unified Impeccable config; hook runtime settings live under its hook key, and shared detector ignores live under detector). Per-developer overrides, including the install consent decision (hook.consent) the CLI records, live in the gitignored .impeccable/config.local.json. Set hook.enabled: false to turn the hook off, hook.quiet: true to silence the clean/pending acks, or hook.auditLog to a file path for an NDJSON log. The legacy IMPECCABLE_HOOK_DISABLED, IMPECCABLE_HOOK_QUIET, and IMPECCABLE_HOOK_LOG env vars are still honored and override these config values when set.
Manual npx impeccable detect scans use the same project filter config by default: detector.ignoreRules, detector.ignoreFiles, detector.ignoreValues, and detector.designSystem.enabled. hook.enabled only controls automatic hook execution, not manual CLI scans. Use npx impeccable detect --no-config ... for a raw detector run that ignores project config/context. Use npx impeccable ignores ... for direct CLI CRUD on the same detector ignores.
Supported harnesses: Claude Code (.claude/settings.local.json in the project, which is gitignored so the hook stays machine-local; a hook you move into the shared settings.json is honored in place too), Codex (.codex/hooks.json in the project), Cursor (.cursor/hooks.json in the project), and GitHub Copilot (.github/hooks/impeccable.json in the project, a team-shared committed file that both the Copilot CLI and the cloud agent read). For the Copilot CLI, repo-level hooks fire once .github/hooks/impeccable.json is committed to the repository's default branch.
On Cursor, preToolUse checks proposed Write/Edit/Shell write content and denies only when the real detector finds an issue. The denial message is visible to the agent as the tool error, so the agent can reconsider before the bad write lands.
Routing
The first argument is the action. Defaults to status.
| Action | What it does |
|---|---|
status |
Print current state, shared/local config paths, ignored rules / files / values, env override. |
on |
Set enabled: true in .impeccable/config.json, record local hook consent as accepted, and install/repair provider hook manifests when the skill is installed. |
off |
Set enabled: false in .impeccable/config.json. |
ignore-rule <id> |
Append <id> to detector.ignoreRules; for overused-font, requires --all-values. |
ignore-file <glob> |
Append <glob> to detector.ignoreFiles. |
ignore-value <id> <value> [--shared] [--reason "..."] |
Append a rule/value suppression to shared .impeccable/config.json. |
ignore-value <id> <value> --local [--reason "..."] |
Append a private rule/value suppression to .impeccable/config.local.json. |
reset |
Delete the project config, dedup cache, and Cursor pending queue. |
Flow
-
Resolve the action from the user's argument. If no action was given, default to
status. -
Invoke the admin script and pass the user's output through verbatim:
node {{scripts_path}}/hook-admin.mjs <action> [args...] -
If
<action>isoff, follow up with a one-line note: "Done. New edits will not trigger the design hook in this project until you run{{command_prefix}}impeccable hooks on." -
If
<action>ison, follow up with: "Done. The design hook will fire after the next Edit/Write/MultiEdit on a UI file." -
If
<action>isignore-value,ignore-file, orignore-rule, just print the script output. The default scope is shared.impeccable/config.json; add--localonly when the user explicitly asks for a private exception. -
If
<action>isstatus, just print the script output. Do not add commentary unless the user asked a follow-up question.
Intentional findings
The hook itself never writes ignore config. Persist an exception only after the user explicitly confirms the flagged issue is intentional, and always go through hook-admin.mjs.
Prefer the narrowest exception:
- If the finding line shows an exact
ignore-valuecommand, run that command. This writes shared.impeccable/config.jsonby default. - For value-specific findings such as
overused-fontandbounce-easing, useignore-valuewhen the user confirms the specific value. Do not useignore-rule overused-fontfor a specific font. - If the finding has no value-specific command, such as
side-tab, preferignore-file <path>for the current file. - Use
ignore-rule <id>only when the user asks to suppress that whole rule across the project. For broad overused-font suppression, useignore-rule overused-font --all-valuesonly when the user asks to ignore overused fonts generally. - Prefer config ignores (the commands above) by default; they keep suppressions in one reviewable place. Reach for an inline comment only when the waiver must travel with a single file that leaves the repo (a generated/exported standalone document, an emailed HTML file). The supported marker is
impeccable-disable <rule>(whole file) orimpeccable-disable-line/impeccable-disable-next-line(one line), in any comment syntax, with an optional reason after:or--. The detector honors it by default;--no-inline-ignoresor--no-configbypasses it.
Example value-specific exception:
node {{scripts_path}}/hook-admin.mjs ignore-value overused-font Inter --shared --reason "User confirmed Inter is intentional"
Example intentional motion exception:
node {{scripts_path}}/hook-admin.mjs ignore-value bounce-easing bounce-ball --shared --reason "User confirmed ball bounce animation is intentional"
Example whole-rule font exception:
node {{scripts_path}}/hook-admin.mjs ignore-rule overused-font --all-values --reason "User asked to ignore overused fonts generally"
Example file-scoped exception:
node {{scripts_path}}/hook-admin.mjs ignore-file "src/legacy/Card.tsx"
Constraints
- Never modify
.impeccable/config.jsonor.impeccable/config.local.jsonby hand from this command. Always go throughhook-admin.mjsso writes stay validated and the file shape stays consistent. - Do not edit the hook scripts themselves (
hook.mjs,hook-lib.mjs,hook-before-edit.mjs) from this flow. Those are skill plumbing. - Cursor can block a proposed write when the detector finds a real issue. Claude Code, Codex, and GitHub Copilot do not block the edit; they emit a post-edit reminder instead. Disabling stops both blocking and reminders.
- The hook is bundled with the Impeccable skill and installed through project-local manifests:
.claude/settings.local.json,.codex/hooks.json,.cursor/hooks.json, and.github/hooks/impeccable.json. On Codex, the user must approve the hook via/hooksthe first time. On Cursor, confirm hooks are enabled under Settings -> Hooks. On GitHub Copilot, the CLI loads.github/hooks/impeccable.jsononce it is committed to the repository's default branch, and the cloud agent reads it from the repo directly.
Failure modes
- If
.impeccable/config.jsonor.impeccable/config.local.jsonis unreadable or malformed, the hook ignores that file and uses the remaining valid config/defaults.hook-admin.mjs statuswill show malformed files as ignored. - If the user asks to "disable the hook" globally, lead with
{{command_prefix}}impeccable hooks off(persistent for this project; writeshook.enabled: falseto config). The legacyIMPECCABLE_HOOK_DISABLED=1env var also works as a one-shot override that follows the shell.