Skip to content

InstallHooks: reconcile copied hooks against registered hooks after apply#1540

Open
tzioup wants to merge 1 commit into
danielmiessler:mainfrom
tzioup:reconcile-hooks-at-install
Open

InstallHooks: reconcile copied hooks against registered hooks after apply#1540
tzioup wants to merge 1 commit into
danielmiessler:mainfrom
tzioup:reconcile-hooks-at-install

Conversation

@tzioup

@tzioup tzioup commented Jul 19, 2026

Copy link
Copy Markdown

Fixes the detection gap in #1539.

What this changes

InstallHooks.ts does two independent things and verifies each on its own: it cpSyncs the payload hooks/ tree onto disk (checked by file count), and it merges hooks.json into settings.json (checked by added/skipped/events). Both succeed. Nothing compares the set of files copied against the set of hooks registered, so a hook can land on disk with no settings entry naming it and the install still reports success — accurately.

After --apply, this shells Doctor.ts --reconcile (already on disk at that point, copied by the same install) with CLAUDE_CONFIG_DIR pointed at the target config root, and includes its unwired list in the existing report JSON.

No logic is duplicated — the reconciler you shipped in v7.1.1 already does the transitive closure through dispatcher imports correctly. This just asks it.

Behaviour

On a clean v7.1.1 payload into an empty config root:

{
  "ok": true,
  "added": 45,
  "events": 11,
  "hookFilesCopied": 72,
  "unwired": [
    "LoopDetector.hook.ts",
    "DriftReminder.hook.ts",
    "PostToolObserver.hook.ts"
  ]
}

If Doctor.ts isn't present at that path, the report carries a reconcile string saying so rather than skipping silently — matching the "LOUD blocker, never a silent no-op" rule in Workflows/Setup.md.

Testing

Ran the patched installer against a scratch config root containing only settings.json ({}) and LIFEOS/TOOLS/Doctor.ts, with --skill-root pointed at this repo's LifeOS/. Output above is verbatim from that run. Existing report fields are unchanged; the two new keys are additive.

Note

unwired is reported, not enforced — this doesn't fail the install or change exit codes. Happy to make it a blocker instead, or to drop the subprocess and inline the comparison, whichever you'd prefer.

…pply

Copying the hook scripts and merging hooks.json are two independent
operations, each verified on its own. A hook can land on disk without any
settings entry naming it, and nothing currently compares the two sets.

After --apply, shell the shipped reconciler (Doctor.ts --reconcile, already
on disk at this point) and include its unwired list in the install report.
Degrades loudly if Doctor.ts is absent rather than skipping silently.

On a clean v7.1.1 payload this reports LoopDetector, DriftReminder and
PostToolObserver. Refs danielmiessler#1539.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant