Skip to content

chore(hooks): path-guard + token-guard + .sh→.mts conversion#628

Merged
John-David Dalton (jdalton) merged 2 commits intomainfrom
chore/hooks-mts-path-token
Apr 27, 2026
Merged

chore(hooks): path-guard + token-guard + .sh→.mts conversion#628
John-David Dalton (jdalton) merged 2 commits intomainfrom
chore/hooks-mts-path-token

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

Self-landable split from #620. Combines the hook overhaul into one atomic PR.

Path-guard infra

  • .claude/hooks/path-guard/ — hook + tests + canonical segments.mts
  • .claude/skills/path-guard/ — audit-and-fix skill
  • .claude/skills/_shared/path-guard-rule.md — canonical mantra rule
  • scripts/check-paths.mts — the whole-repo gate
  • .github/paths-allowlist.yml — empty starter, full schema docs
  • .claude/settings.json — wires hook on Edit|Write
  • scripts/check.mts — invokes the gate

Detection features: template-literal path detection · drift-resistant allowlist via snippet_hash · --show-hashes CLI flag · paren-balanced parser · multi-line YAML reasons.

Token-guard hook

  • .claude/hooks/token-guard/ — renamed from token-hygiene. Word-boundary match for sensitive env names. ALWAYS_DANGEROUS check skips when a redaction pipeline is present (so env | sed s/=.*/=<redacted>/ — the suggested fix — actually passes).

.sh.mts hook conversion (Node 25+)

  • .git-hooks/_helpers.mts (was _helpers.sh) — exports filterAllowedApiKeys + scanners for personal paths, AWS keys, GitHub tokens, private keys, AI attribution
  • .git-hooks/{commit-msg,pre-commit,pre-push}.mts (were .sh)
  • .husky/* shims invoke node directly

Fleet hooks

  • .claude/hooks/check-new-deps — npm dep introspection
  • .claude/hooks/private-name-guard
  • .claude/hooks/public-surface-reminder
  • .claude/hooks/release-workflow-guard

Verification

pnpm install         ✓
pnpm run check --all ✓
pnpm test --all      ✓ 565/565 tests pass

Test plan

  • Lint + typecheck pass locally
  • All 565 tests pass locally
  • CI matrix passes

Self-landable split from #620. Combines the hook overhaul into one
atomic PR: path-guard infra, token-guard hook, .sh→.mts conversion
of git hooks, and the assorted fleet hooks (private-name-guard,
public-surface-reminder, release-workflow-guard, check-new-deps).

What's included:

  Path-guard infra
  - .claude/hooks/path-guard/ (hook + tests + segments.mts)
  - .claude/skills/path-guard/ (audit-and-fix skill)
  - .claude/skills/_shared/path-guard-rule.md (canonical rule)
  - scripts/check-paths.mts (the gate)
  - .github/paths-allowlist.yml (empty starter, full schema docs)
  - .claude/settings.json (wires hook on Edit|Write)
  - scripts/check.mts (invokes the gate)

  Token-guard hook
  - .claude/hooks/token-guard/ (renamed from token-hygiene; word-
    boundary match for sensitive env names; ALWAYS_DANGEROUS check
    skips when redaction pipeline is present)

  .sh → .mts hook conversion (Node 25+)
  - .git-hooks/_helpers.mts (was _helpers.sh) — exports
    filterAllowedApiKeys + scanners (personal paths, AWS keys,
    GitHub tokens, private keys, AI attribution)
  - .git-hooks/{commit-msg,pre-commit,pre-push}.mts (were .sh)
  - .husky/* shims invoke node directly

  Fleet hooks
  - .claude/hooks/check-new-deps (npm dep introspection)
  - .claude/hooks/private-name-guard
  - .claude/hooks/public-surface-reminder
  - .claude/hooks/release-workflow-guard

Verification:
  pnpm install         ✓
  pnpm run check --all ✓
  pnpm test --all      ✓ 565/565 tests pass
@jdalton
Copy link
Copy Markdown
Contributor Author

bugbot run

@jdalton John-David Dalton (jdalton) merged commit 6a1bb11 into main Apr 27, 2026
11 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/hooks-mts-path-token branch April 27, 2026 19:04
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.

2 participants