-
Notifications
You must be signed in to change notification settings - Fork 0
feat: close the setup-contract wave — final setups + contract gate #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| name: setup | ||
| description: "Verify the disk-hygiene plugin's runtime prerequisites and platform posture for this machine. Use when: 'set up disk-hygiene', 'configure disk-hygiene', 'is disk-hygiene working', a clean run reported a missing prerequisite, or before a first audit on a new machine. Actions: check (read-only verification, default) | apply (resolve what check found). Re-runnable and safe." | ||
| argument-hint: "check | apply" | ||
| user-invocable: true | ||
| disable-model-invocation: true | ||
| --- | ||
|
|
||
| ## Purpose | ||
|
|
||
| Thin check-centric setup per the uniform contract: `check` inspects and reports, `apply` | ||
| resolves. This plugin owns no consumer-project configuration — targets and modes arrive as | ||
| `/disk-hygiene:clean` arguments, and the only tunable is the native `userConfig` toggle — | ||
| so `apply` is pure guidance and writes nothing. | ||
|
|
||
| Action routing: no argument or `check` runs the check; `apply` runs the check first, then | ||
| points at each remediation. Both are non-interactive — never prompt when the action is given. | ||
|
|
||
| ## `check` (read-only) | ||
|
|
||
| The clean skill and its bundled scripts (`${CLAUDE_PLUGIN_ROOT}/skills/clean/`) are the | ||
| single source of truth for what the plugin requires per platform. **Read them first** — | ||
| probe what they actually require, don't recite this file. Then run each probe via Bash and | ||
| report a PASS/FAIL/INFO table with one remediation line per FAIL. | ||
|
|
||
| When the plugin's toggle is disabled, every prerequisite absence downgrades from FAIL to | ||
| INFO — a deliberately disabled plugin is not broken. Report the probes informationally and | ||
| note that re-enabling restores the FAIL semantics. | ||
|
|
||
| 1. **Python 3.11+ on `PATH`** — the interpreter used by scanning, validation, the | ||
| skill-scoped guard, and cleanup. FAIL if absent or older, with the README's requirement | ||
| as the remediation; the plugin never downloads a runtime. Report the absolute | ||
| interpreter path (guarded engine calls must use the same absolute interpreter the guard | ||
| reports — Bash aliases and functions cannot substitute). | ||
| 2. **Git** — `command -v git`. Conditional per the README: optional for ordinary trees, | ||
| required when a target contains or sits inside a Git worktree. Report presence as INFO | ||
| with that conditionality stated; absence is only a FAIL for worktree-containing targets. | ||
| 3. **Platform posture** — detect the current OS family and report its documented lane per | ||
| the README: Windows (full, `lstat` reparse + Win32, never UAC), Linux (full when | ||
| `/proc/self/mountinfo` is readable; `lsof` needed only for the optional execution | ||
| lane — absent `lsof` is INFO with the reduced-capability note), macOS (audit/report | ||
| only by design — INFO, not a defect). | ||
| 4. **Hook toggle** — report the effective `disk_hygiene_enabled` value: | ||
| `${user_config.disk_hygiene_enabled}` (unexpanded or empty means default `true`). | ||
| 5. **Plugin registration** — INFO: confirm the plugin is enabled for this project | ||
| (`/plugin` → Installed) rather than parsing settings files. | ||
|
|
||
| ## `apply` (idempotent) | ||
|
|
||
| Run `check`, then for each FAIL point at the resolution. Every prerequisite is a system | ||
| tool or an OS capability, so `apply` installs nothing and writes nothing — it only points: | ||
|
|
||
| - missing/old Python: the platform's own Python 3.11+ install channel; never a plugin | ||
| download. | ||
| - missing git (worktree targets): platform install instructions. | ||
| - toggle off: direct to `/plugin configure disk-hygiene` (interactive, any time). | ||
| Headless: `--config` only applies on a fresh install (ignored once installed), so | ||
| reconfigure via `claude plugin uninstall disk-hygiene` then | ||
| `claude plugin install disk-hygiene@<marketplace> --config disk_hygiene_enabled=true`; | ||
| this skill never writes user settings or `pluginConfigs`. | ||
|
|
||
| Re-running `apply` after everything passes changes nothing and reports "already configured". | ||
|
|
||
| ## What this skill does NOT do | ||
|
|
||
| - Run an audit or cleanup — that is `/disk-hygiene:clean`. | ||
| - Write the plugin cache, Claude Code user settings, or `pluginConfigs`. | ||
| - Install any tool or runtime, during either `check` or `apply` — guidance only. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| --- | ||
| name: setup | ||
| description: "Verify the guardrails hooks' runtime prerequisites and per-guard toggle state for this machine. Use when: 'set up guardrails', 'configure guardrails', 'is guardrails working', 'which guards are on', a guard failed open with a jq notice, or after tuning guard toggles. Actions: check (read-only verification, default) | apply (resolve what check found). Re-runnable and safe." | ||
| argument-hint: "check | apply" | ||
| user-invocable: true | ||
| disable-model-invocation: true | ||
| --- | ||
|
|
||
| ## Purpose | ||
|
|
||
| Thin check-centric setup per the uniform contract: `check` inspects and reports, `apply` | ||
| resolves. This plugin owns no consumer-project configuration — every tunable is a native | ||
| `userConfig` option (eight per-guard toggles plus the `cli_flag_verify_bins`, | ||
| `cli_flag_verify_skip_bins`, and `block_dangerous_git_allow` scalars) — so `apply` is pure | ||
| guidance and writes nothing. | ||
|
|
||
| Action routing: no argument or `check` runs the check; `apply` runs the check first, then | ||
| points at each remediation. Both are non-interactive — never prompt when the action is given. | ||
|
|
||
| ## `check` (read-only) | ||
|
|
||
| The guard scripts (`${CLAUDE_PLUGIN_ROOT}/hooks/*.sh`) and `hooks.json` are the single | ||
| source of truth for the guard inventory and each guard's runtime needs. **Read them | ||
| first** — probe what they actually require, don't recite this file. Then run each probe | ||
| via Bash and report a PASS/FAIL/INFO table with one remediation line per FAIL. | ||
|
|
||
| When every guard's toggle is disabled, prerequisite absences downgrade from FAIL to INFO — | ||
| a deliberately disabled plugin is not broken. Report the probes informationally and note | ||
| that re-enabling restores the FAIL semantics. | ||
|
|
||
| 1. **Bash 5.0+** — the guards' documented runtime floor (Git Bash on native Windows). | ||
| FAIL below the floor with the README Requirements remediation. | ||
| 2. **`jq`** — `command -v jq`. FAIL if absent: per the README, every guard then fails | ||
| OPEN (disabled) with a one-line stderr notice — the machine is unguarded, which is | ||
| exactly what this check exists to surface. | ||
| 3. **Per-guard toggles** — report each guard's effective value from its | ||
| `${user_config.<guard>_enabled}` rendering (unexpanded or empty means default `true`), | ||
| one row per guard, so the user sees the live guard surface at a glance. | ||
| 4. **`cli-flag-verify` scan surface** — report the effective `cli_flag_verify_bins` / | ||
| `cli_flag_verify_skip_bins` values and INFO-note the guard's own behavior for scanned | ||
| binaries missing from `PATH` (skipped, never flagged — per the guard source). | ||
| 5. **`block-dangerous-git` allowlist** — report the effective `block_dangerous_git_allow` | ||
| value (patterns only, verbatim; it contains no secrets by design). | ||
| 6. **Hook registration** — INFO: confirm the plugin is enabled for this project | ||
| (`/plugin` → Installed) rather than parsing settings files. | ||
|
|
||
| ## `apply` (idempotent) | ||
|
|
||
| Run `check`, then for each FAIL point at the resolution. Every prerequisite is a system | ||
| tool and every tunable is native `userConfig`, so `apply` installs nothing and writes | ||
| nothing — it only points: | ||
|
|
||
| - missing `jq` / old Bash: platform install instructions from the README Requirements | ||
| section; this skill never installs system packages. | ||
| - any toggle or scalar change: direct to `/plugin configure guardrails` (interactive, any | ||
| time). Headless: `--config` only applies on a fresh install (ignored once installed), so | ||
| reconfigure via `claude plugin uninstall guardrails` then | ||
| `claude plugin install guardrails@<marketplace> --config KEY=VALUE …` (repeatable); | ||
| this skill never writes user settings or `pluginConfigs`. | ||
|
|
||
| Re-running `apply` after everything passes changes nothing and reports "already configured". | ||
|
|
||
| ## What this skill does NOT do | ||
|
|
||
| - Exercise a guard — any matching tool call does that end-to-end. | ||
| - Write the plugin cache, Claude Code user settings, or `pluginConfigs`. | ||
| - Install any tool, during either `check` or `apply` — guidance only. | ||
| - Weaken a guard: it reports and routes; disabling is always the user's explicit act | ||
| through the native configuration surface. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,19 @@ for (const path of setupSkills) { | |
| if (!/^disable-model-invocation:\s*true\s*$/m.test(frontmatter)) { | ||
| fail(path, "setup skills must set disable-model-invocation: true"); | ||
| } | ||
| // Uniform contract shape (PLUGIN-PHILOSOPHY "Setup is explicit and repeatable"): | ||
| // check is the default read-only action; apply exists unless the skill declares the | ||
| // userConfig-only check-only carve-out the doctrine sanctions. | ||
| if (!/^argument-hint:\s*"check(?:\s*\||\s*\[|")/m.test(frontmatter)) { | ||
| fail(path, 'setup skills must declare check as the leading action in argument-hint ("check", "check | apply ...", or "check [<subaction>]")'); | ||
| } | ||
| const body = content.slice(content.indexOf("---", 3) + 3); | ||
| if (!/`check`/.test(body)) { | ||
| fail(path, "setup skills must document the read-only check action"); | ||
| } | ||
| if (!/`apply`/.test(body) && !/check-only/i.test(body)) { | ||
| fail(path, "setup skills must document apply, or declare the check-only userConfig-only carve-out"); | ||
|
Comment on lines
+52
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This only checks whether the body contains the literal Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
|
|
||
| const setupContractFiles = pluginFiles.filter( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows, this check is instructed to report a “full” lane, but the README explicitly says that Windows “never enters the execution lane” and returns
execution-platform-unsupportedat preview. Consequently, a Windows user can receive a successful setup posture and only discover at cleanup time that deletion is unavailable; classify Windows as audit/report-only (an INFO, like macOS) and state that execution requires Linux.Useful? React with 👍 / 👎.