Skip to content

docs: add feature backlog and track file moves in hooks#71

Merged
carlos-alm merged 2 commits intomainfrom
docs/backlog-and-roadmap-reorg
Feb 24, 2026
Merged

docs: add feature backlog and track file moves in hooks#71
carlos-alm merged 2 commits intomainfrom
docs/backlog-and-roadmap-reorg

Conversation

@carlos-alm
Copy link
Copy Markdown
Contributor

Summary

  • Create roadmap/ folder and add BACKLOG.md with 20 prioritized feature items derived from competitive analysis, including assessment columns for dependency impact, foundation alignment, problem-fit scoring, and breaking change tracking
  • Move ROADMAP.md and llm-integration.md into roadmap/ to consolidate planning docs
  • Add track-moves.sh PostToolUse hook that detects mv/git mv/cp in Bash commands and logs affected paths to session-edits.log, fixing false blocks from guard-git.sh when files are moved

Test plan

  • Verify roadmap/BACKLOG.md renders correctly with all 20 items and scoring guide
  • Verify roadmap/ROADMAP.md and roadmap/llm-integration.md are intact after move
  • Test track-moves.sh by running mv in a session and confirming paths appear in .claude/session-edits.log
  • Confirm guard-git.sh allows committing moved files after track-moves.sh logs them

Move ROADMAP.md and llm-integration.md into roadmap/ folder.
Add BACKLOG.md with 20 prioritized feature items derived from
competitive analysis, including assessment columns for dependency
impact, foundation alignment, problem-fit scoring, and breaking
change tracking.
Add track-moves.sh PostToolUse hook for Bash that detects mv, git mv,
and cp commands, extracts all source and destination paths, and logs
them to .claude/session-edits.log. This prevents guard-git.sh from
blocking commits that include moved or copied files.
@claude
Copy link
Copy Markdown

claude bot commented Feb 24, 2026

Claude finished @carlos-alm's task —— View job


PR Review Completed ✅

Root Cause Analysis

Problem Being Solved: This PR addresses two distinct issues:

  1. Documentation organization - Consolidating planning docs under roadmap/ and adding a comprehensive feature backlog derived from competitive analysis
  2. Hook system gap - Fixing false positives in guard-git.sh when files are moved/copied but not tracked in the session edit log

Why This Approach: The file move tracking uses a PostToolUse hook on Bash commands to detect mv/git mv/cp operations and log all affected paths to the session edit log. This ensures guard-git.sh can validate commits that include moved files. The documentation reorganization follows a logical structure.

Risk Assessment: Low risk - this is primarily documentation organization with a defensive shell script addition.

Critical Concerns (if any)

None identified. All changes are additive and defensive in nature.

Code Quality Assessment

Excellent Documentation Structure

  • Comprehensive backlog: 20 well-researched features with clear assessment criteria
  • Proper organization: roadmap/ folder consolidates all planning docs logically
  • Scoring methodology: The 4-column assessment framework (Zero-dep, Foundation-aligned, Problem-fit, Breaking) provides systematic prioritization

Robust Hook Implementation

  • Correct command detection: Lines 27,48 - Regex properly matches mv, git mv, and cp with word boundaries
  • Smart argument parsing: Lines 51-77 - Handles quoted arguments, filters flags, and respects shell quoting rules
  • Safe path resolution: Lines 69-73 - Uses path.relative() to prevent directory traversal, only logs paths within project
  • Defensive coding: Lines 20,78 - Multiple fallback points with || true to never break the tool chain
  • Informational only: Line 93 - Always exits 0, never blocks execution (correct for PostToolUse hook)

Configuration Integration

  • Proper hook registration: Lines 67-75 in .claude/settings.json correctly add the new hook to PostToolUse for Bash commands
  • Consistent timeout: 5s timeout matches other tracking hooks

Security Considerations

  • No shell injection: Uses execFileSync semantics via Node.js argument parsing
  • Input validation: Extracts JSON safely, validates commands before processing
  • Privilege principle: Logging only - no file system modifications

⚠️ Minor Technical Notes

  1. Line 48: Regex could theoretically match git mvp or git mv-branch but this is extremely unlikely in practice
  2. Lines 69-72: The relative path calculation assumes $PROJECT_DIR is always the git root, which should be true given the hook context

Final Assessment

Root Cause Analysis

Problem Being Solved: Addresses real issues - false positives in commit validation when files are moved, and lack of organized feature planning documentation.

Why This Approach: File move tracking is the correct architectural solution - detect at the Bash command level and integrate with existing session tracking. Documentation organization follows established patterns.

Risk Assessment: Minimal risk - purely additive changes that improve existing safety mechanisms.

Final Recommendation

  • Rating: ⭐⭐⭐⭐☆ (4/5)
  • Action: APPROVE
  • Reasoning: Well-implemented solution to real problems. The hook script demonstrates strong understanding of shell command parsing and defensive programming. Documentation organization is excellent and will improve project maintainability. No breaking changes or risky patterns detected.

Minor suggestions for follow-up (not blocking):

  1. Consider adding a test case for the regex patterns in future hook testing
  2. The backlog assessment columns could be filled out in a future planning session

This PR successfully solves the stated problems with clean, defensive implementations.


@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 24, 2026

Greptile Summary

This PR adds infrastructure to track file moves in hooks and consolidates planning documentation. The track-moves.sh hook solves a critical gap in the session safety system: when files are moved via mv/git mv/cp, they weren't being logged to session-edits.log, causing guard-git.sh to incorrectly block commits. The hook parses Bash commands, extracts affected paths from move operations, and logs both source and destination paths.

  • Created roadmap/ folder and moved ROADMAP.md and llm-integration.md into it for better organization
  • Added BACKLOG.md with 20 prioritized feature items from competitive analysis, including assessment framework for dependency impact, foundation alignment, problem-fit scoring, and breaking change tracking
  • Implemented track-moves.sh PostToolUse hook that detects mv/git mv/cp commands and logs paths to session-edits.log
  • Registered the new hook in .claude/settings.json with 5s timeout

All changes are purely additive and non-breaking.

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • All changes are documentation moves and a new safety hook that only logs data without blocking operations. The hook implementation is defensive with proper error handling, the shell script exits 0 in all cases, and the documentation files are simple renames with no content changes.
  • No files require special attention

Important Files Changed

Filename Overview
.claude/hooks/track-moves.sh New PostToolUse hook that parses mv/git mv/cp commands and logs affected paths to session-edits.log for commit validation
.claude/settings.json Added PostToolUse hook registration for track-moves.sh on Bash tool calls with 5s timeout
roadmap/BACKLOG.md New feature backlog with 20 prioritized items derived from competitive analysis, includes scoring rubric for assessment
roadmap/ROADMAP.md Moved from root to roadmap/ directory to consolidate planning documentation
roadmap/llm-integration.md Moved from docs/ to roadmap/ directory for better planning doc organization

Last reviewed commit: cfe633b

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@carlos-alm carlos-alm merged commit ca5cf24 into main Feb 24, 2026
17 checks passed
@carlos-alm carlos-alm deleted the docs/backlog-and-roadmap-reorg branch February 24, 2026 02:06
carlos-alm added a commit that referenced this pull request Mar 16, 2026
…in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java
carlos-alm added a commit that referenced this pull request Mar 16, 2026
* docs: move 3.16 items to new Phase 5 (Runtime & Extensibility)

Expand the deferred Phase 3 items into a dedicated phase after
TypeScript Migration with detailed descriptions for each sub-item:
event-driven pipeline, unified engine strategy, subgraph export
filtering, transitive confidence, query caching, config profiles,
pagination standardization, and plugin system.

Renumber subsequent phases 5-9 → 6-10 with all cross-references
updated.

* refactor: migrate integration tests to InMemoryRepository

Add openRepo() utility that accepts an injected Repository instance or
falls back to SQLite, enabling tests to bypass the filesystem entirely.

- Add openRepo(dbPath, opts) to src/db/connection.js
- Make findMatchingNodes and buildDependencyGraph polymorphic (accept
  db or Repository via instanceof check)
- Refactor triageData, sequenceData, communitiesData to use openRepo
- Convert triage, sequence, communities test fixtures to createTestRepo()
  fluent builder (sequence dataflow tests stay on SQLite)
- Mark ROADMAP 3.13 InMemoryRepository migration item complete

Impact: 10 functions changed, 11 affected

* fix: use instanceof SqliteRepository guard and validate openRepo opts

Impact: 2 functions changed, 18 affected

* docs: add Phase 4 (Native Analysis Acceleration) to roadmap

Add new Phase 4 covering the port of JS-only build phases to Rust:
- 4.1-4.3: AST nodes, CFG, dataflow visitor ports (~587ms savings)
- 4.4: Batch SQLite inserts (~143ms)
- 4.5: Role classification & structure (~42ms)
- 4.6: Complete complexity pre-computation
- 4.7: Fix incremental rebuild data loss on native engine
- 4.8: Incremental rebuild performance (target sub-100ms)

Bump old Phases 4-10 to 5-11 with all cross-references updated.
Benchmark evidence shows ~50% of native build time is spent in
JS visitors that run identically on both engines.
carlos-alm added a commit that referenced this pull request Mar 16, 2026
* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* docs: add Phase 4 (Native Analysis Acceleration) to roadmap

Add new Phase 4 covering the port of JS-only build phases to Rust:
- 4.1-4.3: AST nodes, CFG, dataflow visitor ports (~587ms savings)
- 4.4: Batch SQLite inserts (~143ms)
- 4.5: Role classification & structure (~42ms)
- 4.6: Complete complexity pre-computation
- 4.7: Fix incremental rebuild data loss on native engine
- 4.8: Incremental rebuild performance (target sub-100ms)

Bump old Phases 4-10 to 5-11 with all cross-references updated.
Benchmark evidence shows ~50% of native build time is spent in
JS visitors that run identically on both engines.

* docs: fix sub-section numbering to match parent phase headings
carlos-alm added a commit that referenced this pull request Mar 17, 2026
* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* fix: include constant nodes in edge building and downstream queries (#487)

The edge-building stage excluded 'constant'-kind nodes from the node
lookup maps, so no import/dependency edges were ever created for
exported constants. This made them invisible to where, fn-impact,
query, roles, and all other graph queries. Also adds missing 'record'
kind to build-edges.js to match CORE_SYMBOL_KINDS.

Impact: 6 functions changed, 33 affected

* fix: include constant kind in whereSymbol and findMatchingNodes queries (#487)

whereSymbolImpl used ALL_SYMBOL_KINDS (core 10, no constant) so
codegraph where could not find constants. findMatchingNodes defaulted
to FUNCTION_KINDS which also excluded constant. Switch whereSymbolImpl
to EVERY_SYMBOL_KIND and add constant to FUNCTION_KINDS default.

Impact: 1 functions changed, 6 affected
carlos-alm added a commit that referenced this pull request Mar 17, 2026
* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* docs: add Phase 4 (Native Analysis Acceleration) to roadmap

Add new Phase 4 covering the port of JS-only build phases to Rust:
- 4.1-4.3: AST nodes, CFG, dataflow visitor ports (~587ms savings)
- 4.4: Batch SQLite inserts (~143ms)
- 4.5: Role classification & structure (~42ms)
- 4.6: Complete complexity pre-computation
- 4.7: Fix incremental rebuild data loss on native engine
- 4.8: Incremental rebuild performance (target sub-100ms)

Bump old Phases 4-10 to 5-11 with all cross-references updated.
Benchmark evidence shows ~50% of native build time is spent in
JS visitors that run identically on both engines.

* docs: fix sub-section numbering to match parent phase headings

* fix: align version computation between publish.yml and bench-version.js

- Add COMMITS=0 guard in publish.yml to return clean version when HEAD
  is exactly at a tag (mirrors bench-version.js early return)
- Change bench-version.js to use PATCH+1-dev.COMMITS format instead of
  PATCH+COMMITS-dev.SHA (mirrors publish.yml's new scheme)
- Fix fallback in bench-version.js to use dev.1 matching publish.yml's
  no-tags COMMITS=1 default

Impact: 1 functions changed, 0 affected

* feat: auto-detect semver bump in /release skill when no version provided

The release skill now scans commit history using conventional commit
rules to determine major/minor/patch automatically. Explicit version
argument still works as before.

* fix: restore SHA-based uniqueness in bench-version fallback and add -dev.0 suffix

The no-tags fallback hardcoded dev.1, causing repeated benchmark runs
to silently overwrite each other. Restore short SHA for uniqueness.
Also add -dev.0 suffix when COMMITS=0 so dev builds at an exact tag
are never confused with stable releases.

Impact: 1 functions changed, 0 affected

* fix: add -dev.0 suffix for COMMITS=0 dev builds in publish.yml

When HEAD is exactly at a release tag, the dev build emitted a clean
semver string identical to the stable release. Add -dev.0 suffix to
prevent confusion between dev pre-releases and stable releases.
carlos-alm added a commit that referenced this pull request Mar 17, 2026
* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* fix: include constant nodes in edge building and downstream queries (#487)

The edge-building stage excluded 'constant'-kind nodes from the node
lookup maps, so no import/dependency edges were ever created for
exported constants. This made them invisible to where, fn-impact,
query, roles, and all other graph queries. Also adds missing 'record'
kind to build-edges.js to match CORE_SYMBOL_KINDS.

Impact: 6 functions changed, 33 affected

* fix: include constant kind in whereSymbol and findMatchingNodes queries (#487)

whereSymbolImpl used ALL_SYMBOL_KINDS (core 10, no constant) so
codegraph where could not find constants. findMatchingNodes defaulted
to FUNCTION_KINDS which also excluded constant. Switch whereSymbolImpl
to EVERY_SYMBOL_KIND and add constant to FUNCTION_KINDS default.

Impact: 1 functions changed, 6 affected
carlos-alm added a commit that referenced this pull request Mar 17, 2026
* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* docs: add Phase 4 (Native Analysis Acceleration) to roadmap

Add new Phase 4 covering the port of JS-only build phases to Rust:
- 4.1-4.3: AST nodes, CFG, dataflow visitor ports (~587ms savings)
- 4.4: Batch SQLite inserts (~143ms)
- 4.5: Role classification & structure (~42ms)
- 4.6: Complete complexity pre-computation
- 4.7: Fix incremental rebuild data loss on native engine
- 4.8: Incremental rebuild performance (target sub-100ms)

Bump old Phases 4-10 to 5-11 with all cross-references updated.
Benchmark evidence shows ~50% of native build time is spent in
JS visitors that run identically on both engines.

* docs: fix sub-section numbering to match parent phase headings

* fix: align version computation between publish.yml and bench-version.js

- Add COMMITS=0 guard in publish.yml to return clean version when HEAD
  is exactly at a tag (mirrors bench-version.js early return)
- Change bench-version.js to use PATCH+1-dev.COMMITS format instead of
  PATCH+COMMITS-dev.SHA (mirrors publish.yml's new scheme)
- Fix fallback in bench-version.js to use dev.1 matching publish.yml's
  no-tags COMMITS=1 default

Impact: 1 functions changed, 0 affected

* feat: auto-detect semver bump in /release skill when no version provided

The release skill now scans commit history using conventional commit
rules to determine major/minor/patch automatically. Explicit version
argument still works as before.

* fix: restore SHA-based uniqueness in bench-version fallback and add -dev.0 suffix

The no-tags fallback hardcoded dev.1, causing repeated benchmark runs
to silently overwrite each other. Restore short SHA for uniqueness.
Also add -dev.0 suffix when COMMITS=0 so dev builds at an exact tag
are never confused with stable releases.

Impact: 1 functions changed, 0 affected

* fix: add -dev.0 suffix for COMMITS=0 dev builds in publish.yml

When HEAD is exactly at a release tag, the dev build emitted a clean
semver string identical to the stable release. Add -dev.0 suffix to
prevent confusion between dev pre-releases and stable releases.
carlos-alm added a commit that referenced this pull request Mar 18, 2026
…on table

- Python: .pyi (type stubs), PHP: .phtml, Ruby: .rake/.gemspec
- Updated WASM registry, native Rust registry, and import resolution
- Condensed README comparison table from 28×8 to 12×5, verified claims
  against actual repos, added security scanning row, grouped features
- Marked backlog #71 (type inference) as done (#501)
- Ruby/HCL type inference column: N/A (dynamic/declarative)

Impact: 3 functions changed, 3 affected
carlos-alm added a commit that referenced this pull request Mar 18, 2026
…table (#502)

* chore: remove dead exports and un-export internal constant

- Remove dead `truncate` function from ast-analysis/shared.js (0 consumers)
- Remove dead `truncStart` function from presentation/table.js (0 consumers)
- Un-export `BATCH_CHUNK` in builder/helpers.js (only used internally)

Skipped sync.json targets that were false positives:
- BUILTIN_RECEIVERS: used by incremental.js + build-edges.js
- TRANSIENT_CODES/RETRY_DELAY_MS: internal to readFileSafe
- MAX_COL_WIDTH: internal to printAutoTable
- findFunctionNode: re-exported from index.js, used in tests

Impact: 1 functions changed, 32 affected

* refactor: extract shared findNodes utility from cfg and dataflow features

Impact: 5 functions changed, 7 affected

* fix: replace empty catch blocks in db connection and migrations

connection.js: add debug() logging to all 8 catch-with-fallback blocks
so failures are observable without changing behavior.

migrations.js: replace 14 try/catch blocks in initSchema with hasColumn()
and hasTable() guards. CREATE INDEX calls use IF NOT EXISTS directly.
getBuildMeta uses hasTable() check instead of try/catch.

Impact: 10 functions changed, 19 affected

* fix: replace empty catch blocks in domain analysis layer

Add debug() logging to 10 empty catch blocks across context.js,
symbol-lookup.js, exports.js, impact.js, and module-map.js.
All catches retain their fallback behavior but failures are now
observable via debug logging.

Impact: 6 functions changed, 18 affected

* fix: replace empty catch blocks in parser.js

Add debug() logging to 6 empty catch blocks: 3 in disposeParsers()
for WASM resource cleanup, 2 in ensureWasmTrees() for file read and
parse failures, and 1 in getActiveEngine() for version lookup.

Impact: 3 functions changed, 0 affected

* fix: replace empty catch blocks in features layer

Add debug() logging to 9 empty catch blocks across complexity.js (5),
cfg.js (2), and dataflow.js (2). All catches for file read and parse
failures now log the error message before continuing.

Impact: 4 functions changed, 2 affected

* refactor: decompose extractSymbolsWalk into per-category handlers

Split the monolithic walkJavaScriptNode switch (13 cases, cognitive 228)
into 11 focused handler functions. The dispatcher is now a thin switch
that delegates to handleFunctionDecl, handleClassDecl, handleMethodDef,
handleInterfaceDecl, handleTypeAliasDecl, handleVariableDecl,
handleEnumDecl, handleCallExpr, handleImportStmt, handleExportStmt,
and handleExpressionStmt.

The expression_statement case now reuses the existing
handleCommonJSAssignment helper, eliminating ~50 lines of duplication.

Worst handler complexity: handleVariableDecl (cognitive 20), down from
the original monolithic function (cognitive 279).

Impact: 13 functions changed, 3 affected

* refactor: decompose extractPythonSymbols into per-category handlers

Split walkPythonNode switch into 7 focused handlers: handlePyFunctionDef,
handlePyClassDef, handlePyCall, handlePyImport, handlePyExpressionStmt,
handlePyImportFrom, plus the decorated_definition inline dispatch.

Moved extractPythonParameters, extractPythonClassProperties, walkInitBody,
and findPythonParentClass from closures to module-scope functions.

Impact: 12 functions changed, 5 affected

* refactor: decompose extractJavaSymbols into per-category handlers

Split walkJavaNode switch into 8 focused handlers plus an
extractJavaInterfaces helper. Moved findJavaParentClass to module scope.
The class_declaration case (deepest nesting in the file) is now split
between handleJavaClassDecl and extractJavaInterfaces.

Impact: 12 functions changed, 5 affected

* refactor: decompose remaining language extractors

Apply the same per-category handler decomposition to all remaining
language extractors: Go (6 handlers), Ruby (8 handlers), PHP (11
handlers), C# (11 handlers), Rust (9 handlers), HCL (4 handlers).

Each extractor now follows the template established by the JS extractor:
- Thin entry function creates ctx, delegates to walkXNode
- walkXNode is a thin dispatcher switch
- Each case is a named handler function at module scope
- Helper functions (findParentClass, etc.) moved to module scope

Impact: 66 functions changed, 23 affected

* refactor: decompose AST analysis visitors and engine into focused helpers

Move nested handler functions to module level in cfg-visitor.js,
dataflow-visitor.js, and complexity-visitor.js — reducing cognitive
complexity of each factory function from 100-337 down to thin
coordinators. Extract WASM pre-parse, visitor setup, result storage,
and build delegation from runAnalyses into focused helper functions.

Impact: 66 functions changed, 43 affected

* refactor: decompose domain builder stages into focused helpers

Extract edge-building by type (import, call-native, call-JS, class
hierarchy) from buildEdges. Extract per-phase insertion logic from
insertNodes. Extract scoped/incremental/full-build paths and
reverse-dep cascade from detectChanges. Extract setup, engine init,
alias loading from pipeline.js. Extract node/edge-building helpers
from incremental.js rebuildFile.

Impact: 44 functions changed, 19 affected

* refactor: decompose domain analysis functions into focused helpers

Impact: 37 functions changed, 29 affected

* refactor: decompose buildComplexityMetrics

Impact: 5 functions changed, 3 affected

* refactor: decompose buildStructure into traversal, cohesion, and classification

Impact: 8 functions changed, 3 affected

* refactor: decompose buildCFGData and buildDataflowEdges

Impact: 10 functions changed, 5 affected

* refactor: decompose sequenceData into BFS and message construction

Impact: 5 functions changed, 2 affected

* refactor: decompose explain() into section renderers

Impact: 5 functions changed, 2 affected

* refactor: decompose stats() into section printers

Impact: 12 functions changed, 6 affected

* fix: address quality issues in features (boundaries, communities, triage)

Extract per-section validators from validateBoundaryConfig (cog 101→2).
Extract buildCommunityObjects and analyzeDrift from communitiesData (cog 32→4).
Extract buildTriageItems and computeTriageSummary from triageData (bugs 1.4→0.48).

Impact: 13 functions changed, 11 affected

* fix: split data fetching from formatting in presentation queries

Extract printDiffFunctions/Coupled/Ownership/Boundaries/Summary from
diffImpact (cog 28→6, cyc 21→7). Extract printExportHeader/Symbols from
fileExports. Extract printNotFound/PathSteps from symbolPath.

Impact: 12 functions changed, 7 affected

* fix: extract subcommand dispatch in check, triage CLI and MCP server

Extract runManifesto/validateKind from check execute (cyc 14→10).
Extract runHotspots/validateFilters/parseWeights from triage execute (cyc 13→4).
Extract loadMCPSdk/createLazyLoaders/resolveDbPath/validateMultiRepoAccess
from startMCPServer (cog 34→13, cyc 19→7).

Impact: 14 functions changed, 4 affected

* fix: move startMCPServer JSDoc to correct function location

* fix: reorder imports in MCP server for lint compliance

Move createRequire assignment after all import declarations
to satisfy Biome's import sorting rule.

Impact: 3 functions changed, 1 affected

* chore: release v3.2.0

* fix: add missing changelog entries for #498 and #493, restore libc fields in lockfile

* feat: add type inference for all typed languages (WASM + native)

Extract per-file typeMap (varName → typeName) from type annotations,
new expressions, and typed parameters for JS/TS, Java, Go, Rust, C#,
PHP, and Python. The edge resolver uses typeMap to connect variable
receiver calls (x.method()) to their declared types (Type.method())
with 0.9 confidence.

Implemented in both WASM (JS extractors) and native (Rust extractors +
edge builder) engines for full parity. Updated README language table
with symbols-extracted, type-inference, and engine-parity columns.

Impact: 73 functions changed, 54 affected

* fix: check parameter name not type name for self/cls filter in Python extractor (#501)

Impact: 1 functions changed, 2 affected

* refactor: remove redundant variable typeMap extraction in walk path (#501)

Impact: 2 functions changed, 3 affected

* feat: add .pyi, .phtml, .rake, .gemspec extensions; condense comparison table

- Python: .pyi (type stubs), PHP: .phtml, Ruby: .rake/.gemspec
- Updated WASM registry, native Rust registry, and import resolution
- Condensed README comparison table from 28×8 to 12×5, verified claims
  against actual repos, added security scanning row, grouped features
- Marked backlog #71 (type inference) as done (#501)
- Ruby/HCL type inference column: N/A (dynamic/declarative)

Impact: 3 functions changed, 3 affected

* feat: add GitNexus to comparison table, fix license and roadmap

- Add GitNexus column to feature comparison table (verified against repo)
- Fix codegraph license: MIT → Apache-2.0
- Remove "Other tools evaluated" footnote (GitNexus now in table)
- Update Limitations: reflect that type inference exists, clarify tsc gap
- Sync Roadmap section with actual ROADMAP.md (11 phases, correct versions)

* fix: supplement receiver edges for older native binaries

Native binaries < 3.2.0 don't emit typeMap from parsing or handle
receiver-based method calls in buildCallEdges. This adds two fallbacks:

1. extractTypeMapRegex: when native parse results lack typeMap, extract
   `const x = new Foo()` patterns via regex so the edge builder can
   resolve variable receivers to their declared types.

2. supplementReceiverEdges: after native buildCallEdges runs, if no
   receiver edges were produced, create them JS-side using the same
   buildReceiverEdge + type-resolved method-call logic as the WASM path.

Both fallbacks are gated on the absence of the feature and will be
no-ops once native binaries >= 3.2.0 are published.

Fixes build-parity test failure on CI (native 31 edges vs WASM 33).

Impact: 6 functions changed, 15 affected

Impact: 2 functions changed, 5 affected

* fix: correct misleading WASM engine test comment (#502)

The comment incorrectly stated native type-map resolution was deferred,
but native Rust support is fully implemented in this PR. The actual
reason is that the native binary may not be present in CI.

* fix: add recursion depth guard to extractTypeMapWalk (#502)

Every other type-map extractor guards at depth 200, but the JS/TS
walker recursed unconditionally. This could cause stack overflow on
pathologically large or deeply nested auto-generated files.

Impact: 2 functions changed, 3 affected

* fix: remove dead methodCandidates guard in resolveByMethodOrGlobal (#502)

nodesByName is keyed by fully-qualified name (e.g. Router.get), so
get(call.name) with a simple name like 'get' never returns class
methods — the filter was always empty. Removed the unreachable block
so the type-aware resolution path is the clear entry point.

* fix: handle Go multi-name var declarations in type map (#502)

var x, y MyService now registers all names in the type map, not just
the first. Fixed in both JS (extractGoTypeMapDepth) and Rust
(extract_go_type_map_depth) extractors by iterating identifier children
instead of using child_by_field_name('name').

Impact: 2 functions changed, 4 affected

* fix: replace regex typeMap backfill with WASM-based AST extraction (#502)

The regex pattern matched inside comments and string literals, producing
spurious type map entries that could create phantom call edges. Replace
with WASM tree-sitter extraction which uses the AST and is immune to
false positives from non-code contexts. Also eliminates redundant disk
reads in parseFileAuto where source was already in memory.

Impact: 4 functions changed, 2 affected
carlos-alm added a commit that referenced this pull request Mar 24, 2026
…arch snapshots (#557)

* docs: promote #83 (brief command) and #71 (type inference) to Tier 0 in backlog

These two items deliver the highest immediate impact on agent experience
and graph accuracy without requiring Rust porting or TypeScript migration.
They should be implemented before any Phase 4+ roadmap work.

- #83: hook-optimized `codegraph brief` enriches passively-injected context
- #71: basic type inference closes the biggest resolution gap for TS/Java

* docs: add Phase 4 (Native Analysis Acceleration) to roadmap

Add new Phase 4 covering the port of JS-only build phases to Rust:
- 4.1-4.3: AST nodes, CFG, dataflow visitor ports (~587ms savings)
- 4.4: Batch SQLite inserts (~143ms)
- 4.5: Role classification & structure (~42ms)
- 4.6: Complete complexity pre-computation
- 4.7: Fix incremental rebuild data loss on native engine
- 4.8: Incremental rebuild performance (target sub-100ms)

Bump old Phases 4-10 to 5-11 with all cross-references updated.
Benchmark evidence shows ~50% of native build time is spent in
JS visitors that run identically on both engines.

* docs: fix sub-section numbering to match parent phase headings

* fix: align version computation between publish.yml and bench-version.js

- Add COMMITS=0 guard in publish.yml to return clean version when HEAD
  is exactly at a tag (mirrors bench-version.js early return)
- Change bench-version.js to use PATCH+1-dev.COMMITS format instead of
  PATCH+COMMITS-dev.SHA (mirrors publish.yml's new scheme)
- Fix fallback in bench-version.js to use dev.1 matching publish.yml's
  no-tags COMMITS=1 default

Impact: 1 functions changed, 0 affected

* feat: auto-detect semver bump in /release skill when no version provided

The release skill now scans commit history using conventional commit
rules to determine major/minor/patch automatically. Explicit version
argument still works as before.

* feat: add /titan-run orchestrator with diff review, semantic assertions, and architectural snapshot

Add /titan-run skill that dispatches the full Titan pipeline (recon → gauntlet →
sync → forge) to sub-agents with fresh context windows, enabling end-to-end
autonomous execution.

Hardening layers added across the pipeline:
- Pre-Agent Gate (G1-G4): git health, worktree validity, state integrity, backups
- Post-phase validation (V1-V15): artifact structure, coverage, consistency checks
- Stall detection with per-phase thresholds and no-progress abort
- Mandatory human checkpoint before forge (unless --yes)

New validation tools integrated into forge and gate:
- Diff Review Agent (forge Step 9): verifies each diff matches the gauntlet
  recommendation and sync plan intent before gate runs
- Semantic Assertions (gate Step 5): export signature stability, import resolution
  integrity, dependency direction, re-export chain validation
- Architectural Snapshot Comparator (gate Step 5.5): community stability, cross-domain
  dependency direction, cohesion delta, drift detection vs pre-forge baseline

* fix: correct undefined variable in titan-run gauntlet efficiency check

* fix: address Greptile review feedback on titan-run skill

- Fix undefined previousAuditedCountBeforeAgent variable in gauntlet
  efficiency check (save pre-update count before reassignment)
- Add AU, UA, DU, UD to merge conflict detection markers
- Add warning when --start-from forge runs without arch-snapshot.json

* fix: address Greptile review feedback on titan-run skill

- Fix undefined previousAuditedCountBeforeAgent variable in gauntlet
  efficiency check (save pre-update count before reassignment)
- Add AU, UA, DU, UD to merge conflict detection markers
- Add warning when --start-from forge runs without arch-snapshot.json

* fix: restore FORGE to codegraph exports and fn-impact in tool table

Both commands are called in titan-forge's new diff review step (Step 9):
fn-impact for deletion audit (D4) and exports for re-export chain checks.

* fix: unstage files before restoring working tree in forge Step 13 rollback

* fix: add GATE to exports/fn-impact and FORGE to context in command table

* fix: update --yes description to reflect actual orchestrator scope

* chore: checkpoint stale working tree changes from prior sessions

Impact: 43 functions changed, 46 affected

* Revert "chore: checkpoint stale working tree changes from prior sessions"

This reverts commit a296b58.

* fix: correct command table and --yes flag documentation

* fix: address titan-gate review feedback — Louvain drift, temp paths, rollback range, FAIL template

- Use codegraph communities --drift for A1 comparison instead of raw IDs
- Add unique /tmp paths per invocation (epoch+PID) with cleanup
- Update auto-rollback exception from Steps 1-3,5-7 to Steps 1-3,6-8
- Split FAIL template: test/lint (rollback) vs structural/semantic (preserved)

* fix: address titan-run review feedback — --yes scope and --start-from validation

- Update --yes description to include forge per-phase confirmation
- Add Step 0.5 artifact pre-validation for --start-from skipped phases

* fix: titan-run review — Rules exceptions, skip-flag validation, test runner

* fix: persist arch temp dir path to file instead of shell variable (#557)

TITAN_TMP_ID was set in one Bash tool invocation but referenced in
later invocations. Shell variables don't survive between separate
Bash calls. Now uses mktemp -d and writes the path to
.codegraph/titan/.arch-tmpdir for cross-invocation recovery.

* fix: capture git SHA in shell before node -e to avoid unevaluated substitution (#557)

* fix: extend no-rollback exception to include semantic failures (Steps 5-8) (#557)

* fix: add explicit DIFF WARN verdicts to D5 leftover check (#557)

* fix: remove duplicate diff-impact call in Step 5c, add before/after comparison for Step 5d (#557)

* fix: correct stale step reference and use unique temp path in titan-gate (#557)

* fix: remove stale --yes from argument-hint and add D5 explicit verdict in titan-forge (#557)

* fix: address open review items in titan-gate and titan-forge (#557)

- Disambiguate no-rollback step range: "Steps 1-3, 5-8" → "Steps 1-3, 5, 5.5, 6-8"
  so AI agents include Step 5.5 (architectural snapshot) in the exception
- Guarantee Step 5.5 cleanup runs even on failure/early exit paths
- Fix Step 13 heading: exclude diff-review (handled by Step 9's own rollback)
- Replace hardcoded npm test in gate Step 4 with test runner detection
- Applied to both .claude/skills/ and docs/examples/ copies

* fix: address round 2 Greptile feedback on titan-gate and titan-forge (#557)

- Fix BARREL_TMP cleanup: use sidecar file pattern (.barrel-tmp) to
  persist temp path across shell invocations, matching the existing
  .arch-tmpdir pattern
- Remove redundant codegraph check in Step 5b: reuse results already
  collected in Step 2 instead of re-running the command
- Spell out D4 deletion audit: add explicit guidance on identifying
  deleted symbols via pre-change file comparison and git diff
- All changes applied to both .claude/skills/ and docs/examples/ copies

* fix: correct Step 5b reference from Step 2 to Step 1 in titan-gate (#557)

* fix: replace bash process substitution with temp file in D4 deletion audit (#557)

* fix: clarify A2 boundary check uses diff-impact edges not snapshot (#557)

* fix: restore FORGE to complexity --health command table row (#557)

* fix: add V3 snapshot list to orchestrator Rules exception list (#557)

* fix: replace A4 new-drift-warning check with resolved-drift positive signal (#557)

A4 overlapped with A1 producing false positives for touched symbols and
duplicate warnings for untouched ones. A1 already covers new drift
detection with severity escalation. A4 now only reports resolved drift
as a positive architectural improvement note.

* fix: add RUN to communities/structure rows and snapshot list entry in command table (#557)

titan-run Step 3.5a directly calls codegraph communities, structure,
and snapshot list. The README command table was missing these entries.

* fix(skill): distinguish semantic vs test/lint gate failures in forge rollback (#557)

* fix(skill): add V3 to pre-validation, fix efficiency/stall overlap (#557)

* fix(skill): add FAIL message template to Step 5d barrel export check (#557)

* fix(titan-run): track per-target progress in forge stall detection (#557)

Forge stall detection only compared completed phases, causing false
aborts when a multi-target phase required several sub-agent iterations.
Now also tracks completedTargets count — stallCount only increments
when neither phases nor targets advance.

* fix: remove duplicate previousCompletedPhases assignment in titan-run (#557)

* fix: scope A2 domain check to new edges only in titan-gate (#557)

* fix: guarantee Step 5d barrel cleanup runs on FAIL verdict (#557)

* fix(titan-gate): use Step 1 --staged results for boundary check (#557)

Step 5c referenced codegraph check --boundaries without --staged,
causing false positives from pre-existing violations. Now references
the already-collected Step 1 results instead.

* fix(titan-forge): clarify rollback, document --yes, init diffWarnings (#557)

- Step 11 semantic FAIL: clarify forge does its own rollback (not gate)
- Re-add --yes to argument list as documented passthrough
- Add diffWarnings: [] to execution state init block
- Document pre-gate test as fast-fail optimization with tradeoff note

* fix(titan-gate): replace codegraph deps with path-based layer inference in A2

codegraph deps is a file-level dependency map, not a symbol lookup.
The diff-impact edge output already contains source/target file paths,
so the domain/layer can be inferred directly from the path using the
GLOBAL_ARCH.md domain map without an extra command.

* fix(titan-forge): handle dead-code targets in D2 intent-match check

Dead-code targets have no gauntlet.ndjson entry, causing D2 to fail
silently. Now checks titan-state.json deadSymbols first and validates
the diff shows only deletions without needing a gauntlet lookup.

* fix(titan-run): add try/catch to arch-snapshot builder script

The node -e script that assembles arch-snapshot.json had no error
handling — if any input file was missing or malformed, it failed
silently and no snapshot was written. Now catches errors, prints a
warning, and continues without the snapshot.

* fix(titan-run): document explicit G3 state recovery procedure

G3 referenced backup recovery without documenting the steps. Now
includes: check backup exists, validate it is valid JSON before
restoring, cp .bak over the corrupt file, and stop if backup is
also corrupt or missing.

* fix(titan-run): guard NDJSON integrity check against missing file

The node -e script crashed with ENOENT if gauntlet.ndjson did not
exist yet. Now checks fs.existsSync first and outputs a result with
missing:true so the caller can handle it gracefully.

* fix(docs): remove stale GATE consumer from codegraph deps command table

Gate A2 no longer calls codegraph deps — it uses path-based layer inference
from diff-impact edge output instead. The command table was never updated to
reflect this change.

* fix(titan-run): make checkpoint snapshot status conditional on capture success

* fix(titan-forge): add explicit DIFF FAIL rollback commands and diffWarnings schema

* fix(skill): set autoConfirm=true after checkpoint so forge sub-agents get --yes (#557)

* fix(skill): add --yes to titan-forge argument-hint frontmatter (#557)

The --yes flag was documented in the Arguments section but missing
from the frontmatter hint that Claude Code displays in autocomplete.

* fix(skill): remove D1 from diffWarnings schema — D1 only produces FAIL (#557)

* fix(skill): clarify unexpected-commits as context-gathering in titan-run (#557)

* fix(skill): document A3/A4 committed-state limitation in titan-gate (#557)

* fix: handle arch capture failures and skip V13 when no commits (#557)

* fix(skill): preserve file extension in temp files for D4 and barrel validation (#557)

mktemp without an extension creates files that codegraph cannot
parse — LANGUAGE_REGISTRY matches by extension, so extension-less
temp files silently return no symbols, making D4 deletion audit
and Step 5d barrel validation no-ops.

* fix(skill): surface diffWarnings count in titan-run final report (#557)

* fix(skill): use diff-impact edges for titan-gate Step 5b import check (#557)

* fix(skill): skip currentPhase check in Step 0.5 pre-validation (#557)

* fix(skill): add RUN as reader for gauntlet, sync, and gate-log artifacts (#557)

* fix(skill): add codegraph where to README command table (#557)

* fix(skill): add step 3.5 skip condition, move A2 before snapshot gate (#557)

- Step 3.5 now has explicit skip condition for --start-from forge when arch-snapshot.json exists
- A2 dependency direction check moved before snapshot gate so it runs on standalone invocations
- Checkpoint template now uses explicit file-existence check for snapshot status

* fix(skill): init autoConfirm from --yes at parse time, fix snapshotStatus ordering (#557)

* fix(skill): add GLOBAL_ARCH.md guard to A2 dependency direction check (#557)

* fix(skill): clarify diffWarnings append, A3 sources, V13 test detection (#557)

* fix(skill): add explicit test runner detection to forge Step 10 (#557)

Forge Step 10 used a placeholder <detected-test-command> without actual
detection logic. This caused false-positive rollbacks on projects with
non-standard test scripts (e.g. test:ci but no test). Added the same
node -e detection block and NO_TEST_SCRIPT guard that V13 in titan-run
already uses. Applied to both .claude/skills/ and docs/examples/ copies.

* fix: increase vitest hookTimeout to 30s for Windows CI (#557)

The beforeAll hooks in batch.test.js and dataflow.test.js were timing
out at the default 10s on Windows Node 20 CI. The TS migration loader
hooks in NODE_OPTIONS add overhead that pushes SQLite initialization
past the default hookTimeout on slower CI runners. Align hookTimeout
with the existing testTimeout of 30s.

* fix(skill): move V13 failure-stop inside test block, add divergence warning (#557)

V13 test-failure condition was split outside the test-run block, causing
undefined testCmd reference for agents that don't short-circuit. Moved
the Stop path inside the same conditional as the test run.

Added divergence check at forge checkpoint (Step 3.5b) to warn when main
has advanced since the initial sync, preventing silent drift on long runs.

* fix(skill): cycle FAIL triggers rollback, Step 13 uses git diff for file discovery (#557)

Gate auto-rollback exception now correctly excludes Step 2 (cycle check)
from the no-rollback list. A new-cycle FAIL triggers the same rollback
path as lint/build/test failures, preventing graph DB inconsistency.

Forge Step 13 now discovers dirty files at rollback time using
git diff --cached/--name-only instead of relying on the agent carrying
the file list forward from Step 8, which can fail under context pressure.

* fix(skill): expand --start-from hint, add || true to divergence fetch (#557)

* fix: align .claude/** glob prefix with existing exclude patterns (#557)

* fix(skill): separate Step 5c and A2 boundary checks to avoid duplicate FAIL verdicts (#557)

* fix(skill): add cycle to forge Step 11 routing and gate rollback labels (#557)

* fix(skill): clarify FAIL labels, complexity routing, stale fetch (#557)

- Gate Step 9: replace misleading "advisory" label with
  explicit "structural and semantic failures" wording
- Forge Step 11: replace "semantic/structural" catch-all
  with explicit listing of all non-rollback failure types
- Run Step 3.5b: divergence check now detects fetch failure
  and skips instead of computing against stale origin/main

* fix(skill): move divergence check before checkpoint print block (#557)

* fix(skill): disambiguate D3|D5 schema notation in diffWarnings (#557)

* fix(skill): add new-file guard to Step 5a and explicit dedup tracking for Step 5c/A2 (#557)

* fix(skill): include failedTargets in forge stall detection to avoid false stalls (#557)

* fix(skill): detect yarn/pnpm/bun in test command detection via lock file (#557)

* fix(skill): replace <test-runner> placeholder with lock-file detection (#557)

* fix(skill): use dynamic file discovery in DIFF FAIL rollback instead of placeholder (#557)

* fix(skill): resolve cycle-rollback ambiguity across gate/forge/run (#557)

* fix(skill): detect yarn/pnpm/bun for lint and build commands in gate Step 4 (#557)

* fix(skill): update forge Rules rollback description to include unstage step (#557)
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