Skip to content

Release tree: inline the sourced shell libraries into each hook so the directory validator can follow every hook (clears COMMAND_SCRIPT_NOT_FOLLOWED) #900

Closed

Description

@fdaviddpt

Why

The maintainer's goal (2026-10-03): zero policy holds. Every hold means a human review on every release, and the plugin has already waited about three weeks on one. A portal Validate of release-preview @ 302e8f5 (#899 round 2) left two holds. One of them is:

Scripts the validator couldn't follow (COMMAND_SCRIPT_NOT_FOLLOWED), policy hold on scripts/post-tool-hook.sh: "The plugin's commands run scripts that run … a further file the validator did not read … : scripts/post-tool-hook.sh, scripts/session-end-hook.sh, scripts/session-start-hook.sh, scripts/user-prompt-hook.sh." Remedy: "Point each command at a plain shell script by a literal path under CLAUDE_PLUGIN_ROOT … A file that script runs in turn isn't followed and always goes to a reviewer."

#899 removed the other triggers it used to list: the "." directory fallback, and script names written in comments. What remains is structural: each of the four hooks.json hooks does source "$_HOOK_DIR/lib-*.sh", resolve-paths.sh, detect-tools.sh, log.sh and so on.

Precedent

claude-jit-context cleared exactly this hold by compiling at release-build time: each shipped hook script gets the libraries it sources inlined, with whole-line comments stripped. Its library went from 274 KB to scripts of 61 to 98 KB. The repo keeps its source structure; only the release tree has self-contained hooks. Its tests run the hook suites against the compiled scripts. See https://github.com/Digital-Process-Tools/claude-jit-context/blob/feat/release-compile/docs/directory-validator.md.

Do

  1. Measure first: for each hooks.json hook, the full transitive source closure and the size it would reach once inlined, with and without whole-line comments. The per-file limit is 256 KiB; scripts/session-start-hook.sh is already 147 KB. Report the numbers before building anything big.
  2. In .github/scripts/build_release_tree.py: inline each sourced file at its source / . line, recursively and once per file (honour include guards); strip whole-line comments, not shebangs and not lines inside heredocs or quoted strings; and leave nothing in a shipped hook that sources, runs or names another shipped shell file. Python entry points that hooks call (python3 -m pipeline...) need a decision: report whether the validator counts them as "a further file". It names only shell scripts so far.
  3. A guard in check_release_tree.py: a hooks.json hook that still sources or runs another file → FAIL.
  4. Run the hook test suites against the compiled release tree in CI, as jit-context's tests/test-release-branch-461.sh does, so what ships is what was tested. Every platform matters, Windows / Git Bash included.
  5. docs/releasing.md: describe the compile step and its size budget.

Verification: a portal Validate of a release-preview built from this branch shows no COMMAND_SCRIPT_NOT_FOLLOWED. The maintainer runs the push and the Validate.

Related: #898 / #899, #893.

[AI-generated]

Activity

  1. added
    priority:high
    lane-other
    on Oct 3, 2026
  2. added 13 commits that reference this issue on Oct 3, 2026
  3. 66 remaining items

  4. added 4 commits that reference this issue on Oct 5, 2026
  5. added 6 commits that reference this issue on Oct 6, 2026
  6. added 4 commits that reference this issue on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lane-otherpriority:high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions