Skip to content

Conversation

@MO2k4
Copy link
Contributor

@MO2k4 MO2k4 commented Feb 11, 2026

Summary

  • SCIP import (src/scip/index.ts): ScipImporter class with two-pass SCIP JSON processing (definitions first, then references), content-hash fingerprinting for idempotent imports, and findSCIPFiles() auto-detection
  • Git hooks (src/sync/git-hooks.ts): GitHooksManager class for installing/removing post-commit hooks with worktree support, marker-based hook identification, and safe append/remove operations
  • Version tracking (src/version.ts): getRuntimeVersion() returning package version + git rev with caching
  • CLI enhancements (src/bin/codegraph.ts): hooks install/hooks remove/hooks status commands, displayIndexStats in status output, version display
  • Public API (src/index.ts): New methods on CodeGraph class — importSCIP(), getVersion(), installGitHooks(), removeGitHooks(), isGitRepository(), isGitHookInstalled(), getMetadata()

Details

SCIP Import

The ScipImporter processes SCIP (Source Code Intelligence Protocol) JSON files in two passes:

  1. Pass 1 — Build symbol definitions map from SCIP occurrences with SymbolRole.Definition
  2. Pass 2 — Resolve references by matching SCIP symbols to indexed CodeGraph nodes using line-proximity matching

Content-hash fingerprinting (SHA-256 of the SCIP file) enables idempotent imports — re-importing the same file is a no-op.

Git Hooks Manager

The GitHooksManager handles post-commit hook installation for automatic codegraph sync:

  • Resolves .git directory correctly for worktrees
  • Uses CODEGRAPH_MARKER comments to identify managed hook sections
  • Safely appends to existing hooks without overwriting user content
  • Returns structured HookInstallResult/HookRemoveResult with status details

Dead code verification

Every new export has at least one caller within this PR:

  • ScipImporter → called by importSCIP() in src/index.ts
  • GitHooksManager → used in CodeGraph constructor + CLI commands
  • createGitHooksManager → called in CodeGraph constructor
  • getRuntimeVersion() → called by CLI status + CodeGraph.getVersion()
  • HookInstallResult/HookRemoveResult → used in method signatures

Test plan

  • npm run build compiles without errors
  • npm test passes with same baseline (28 pre-existing failures, 326 passing)
  • 6 files changed/created: src/scip/index.ts (new), src/sync/git-hooks.ts (new), src/version.ts (new), src/sync/index.ts, src/index.ts, src/bin/codegraph.ts
  • All new exports verified to have callers (see dead code verification above)
  • Sentry preserved — 17 references in CLI (initSentry, captureException, error handlers)
  • All existing exports from src/index.ts preserved
  • No upstream features removed

- Add ScipImporter for SCIP JSON semantic data import with two-pass processing
- Add getRuntimeVersion() with package.json + git rev caching
- Add GitHooksManager for post-commit hook installation/removal
- Add CLI hooks command group (install, remove, status)
- Add version display in CLI status command
- Add displayIndexStats helper for enhanced status display
- Add importSCIP() and getVersion() methods to CodeGraph class
- Add git integration methods: isGitRepository, installGitHooks, removeGitHooks
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