Bug
`.claude/hooks/update-graph.sh` (PostToolUse hook for Edit/Write) only triggers an incremental `codegraph build` for a hardcoded extension allowlist:
```bash
case "$FILE_PATH" in
.js|.ts|.tsx|.jsx|.py|.go|.rs|.java|.cs|.php|.rb|.tf|*.hcl)
;;
*)
exit 0
;;
esac
```
This list is missing `.mjs` and `.cjs`, even though both are registered JavaScript extensions in `LANGUAGE_REGISTRY` (`src/domain/parser.ts`) and `EXTENSIONS` (`src/shared/constants.ts`) — confirmed by `codegraph build` itself successfully parsing `.mjs` files once run manually.
Repro
- Edit any `.mjs` file in the repo (e.g. `scripts/*.mjs`) via Claude Code's Edit/Write tool.
- The PostToolUse hook fires but silently `exit 0`s without rebuilding, because the extension isn't in the allowlist.
- `.codegraph/graph.db` mtime stays older than the edited file.
- Subsequent `codegraph complexity --file <edited.mjs>`, `codegraph fn-impact`, etc. return stale pre-edit results with no warning.
Observed during Titan Paradigm FORGE phase 4 (extracting `scripts/lib/name-map.mjs` from `scripts/import-jelly-micro.mjs` + `scripts/compare-tools.mjs`): after editing all three `.mjs` files, `.codegraph/graph.db` mtime (03:52) predated the edits (04:07). `codegraph complexity --file scripts/compare-tools.mjs --health` still reported the deleted `buildNameMap`/`buildAcgNameLookup` functions at their old line ranges until a manual `codegraph build` was run.
Fix
Sync the hook's extension allowlist with `EXTENSIONS` in `src/shared/constants.ts` (or better: derive it from that constant instead of hardcoding a second copy) so `.mjs`/`.cjs` — and any future registry additions — don't silently go stale.
Impact
Silent, not fail-fast: no error is surfaced, so agents/users get incorrect complexity/impact/dependency data for any `.mjs`/`.cjs` file edited in a session, unless they happen to notice the DB mtime is stale or manually rebuild.
Bug
`.claude/hooks/update-graph.sh` (PostToolUse hook for Edit/Write) only triggers an incremental `codegraph build` for a hardcoded extension allowlist:
```bash
case "$FILE_PATH" in
.js|.ts|.tsx|.jsx|.py|.go|.rs|.java|.cs|.php|.rb|.tf|*.hcl)
;;
*)
exit 0
;;
esac
```
This list is missing `.mjs` and `.cjs`, even though both are registered JavaScript extensions in `LANGUAGE_REGISTRY` (`src/domain/parser.ts`) and `EXTENSIONS` (`src/shared/constants.ts`) — confirmed by `codegraph build` itself successfully parsing `.mjs` files once run manually.
Repro
Observed during Titan Paradigm FORGE phase 4 (extracting `scripts/lib/name-map.mjs` from `scripts/import-jelly-micro.mjs` + `scripts/compare-tools.mjs`): after editing all three `.mjs` files, `.codegraph/graph.db` mtime (03:52) predated the edits (04:07). `codegraph complexity --file scripts/compare-tools.mjs --health` still reported the deleted `buildNameMap`/`buildAcgNameLookup` functions at their old line ranges until a manual `codegraph build` was run.
Fix
Sync the hook's extension allowlist with `EXTENSIONS` in `src/shared/constants.ts` (or better: derive it from that constant instead of hardcoding a second copy) so `.mjs`/`.cjs` — and any future registry additions — don't silently go stale.
Impact
Silent, not fail-fast: no error is surfaced, so agents/users get incorrect complexity/impact/dependency data for any `.mjs`/`.cjs` file edited in a session, unless they happen to notice the DB mtime is stale or manually rebuild.