Files
msd-core/hooks/managed-hooks-registry.cjs
Tom Boucher 9e5d4b266b fix(#997): ensure canonical ~/.claude/gsd-core path for plugin installs (#1207)
* fix(#997): ensure canonical ~/.claude/gsd-core path for plugin installs via SessionStart hook

Claude Code marketplace plugin installs unpack the package into the
version-pinned plugin cache and never run bin/install.js, so
~/.claude/gsd-core/ is never created. Agents, commands, and templates
markdown-@-include the canonical ~/.claude/gsd-core/... path (which
expands ~ but NOT ${CLAUDE_PLUGIN_ROOT}), so every include resolved to
nothing and agents (e.g. the executor) failed.

Add a SessionStart hook (hooks/gsd-ensure-canonical-path.js) that, on a
plugin install, symlinks the canonical path's immutable subdirs (bin,
contexts, references, templates, workflows) to the plugin's bundled
gsd-core/ tree. It changes zero @-references, is a no-op in classic
installs, preserves user-generated files (USER-PROFILE.md, STATE.md),
prunes stale links so it self-heals after `claude plugin update`, uses
Windows junctions, and rejects bundled/canonical paths that escape the
resolved plugin root (no traversal, no clobber).

Registered in HOOKS_TO_COPY (build-hooks), MANAGED_HOOKS, hooks.json
SessionStart (runs first, timeout 5), and BUNDLED_GSD_HOOK_FILES.
Behavioral regression tests folded into issue-766-plugin-manifest.test.cjs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* chore(#997): backfill changeset PR number to #1207

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 09:37:41 -04:00

40 lines
1.3 KiB
JavaScript

'use strict';
/**
* Authoritative list of GSD-managed hook files.
*
* Extracted from the worker script into a shared CJS module so that:
* 1. gsd-check-update-worker.js can require() it directly (no source-level
* duplication).
* 2. Tests can assert against the exported array instead of regex-parsing
* the worker source (retiring the pending-migration-to-typed-ir token
* on managed-hooks.test.cjs and orphaned-hooks.test.cjs, per #455).
*
* These are the files GSD ships into ~/.claude/hooks/ (or equivalent) and
* checks for staleness after an update. Orphaned files from removed features
* (e.g., gsd-intel-*.js) must NOT be listed here — that would cause permanent
* stale warnings for users who haven't cleaned up manually (#1750).
*/
const MANAGED_HOOKS = [
'gsd-check-update-worker.js',
'gsd-check-update.js',
'gsd-config-reload.js',
'gsd-context-monitor.js',
'gsd-cursor-post-tool.js',
'gsd-cursor-session-start.js',
'gsd-ensure-canonical-path.js',
'gsd-graphify-update.sh',
'gsd-phase-boundary.sh',
'gsd-prompt-guard.js',
'gsd-read-guard.js',
'gsd-read-injection-scanner.js',
'gsd-session-state.sh',
'gsd-statusline.js',
'gsd-update-banner.js',
'gsd-validate-commit.sh',
'gsd-workflow-guard.js',
'gsd-worktree-path-guard.js',
];
module.exports = { MANAGED_HOOKS };