feat: dev publish workflow, parser refactor, and quality-of-life improvements#25
feat: dev publish workflow, parser refactor, and quality-of-life improvements#25carlos-alm merged 19 commits intomainfrom
Conversation
Add dev-publish.yml that triggers on every merge to main, publishing prerelease versions (e.g. 2.0.1-dev.abc1234) with --tag dev. Includes concurrency control and skip logic for stable release version bumps. Simplify publish.yml to release-event-only: remove workflow_dispatch trigger and inputs, add explicit --tag latest, disable prepublishOnly in CI since tests already run in preflight.
Merge dev-publish and stable-publish into one publish.yml to satisfy npm Trusted Publishing's one-workflow-per-package constraint. - push to main → dev release (e.g. 2.0.1-dev.abc1234) with --tag dev - GitHub Release event → stable release with --tag latest - Concurrency group cancels in-flight dev publishes on rapid merges - Skip logic for stable version bump commits (chore: release v*) - Version computed in dedicated job, shared via outputs - No git commits/tags/PRs for dev releases
The Rust resolve_import function produced paths like src/./db.js because Path::join preserves . segments from relative imports. This caused import edges to be lost for native engine users. Fix by normalizing the resolved PathBuf immediately after join using components().collect(), and upgrading normalize_path to also clean . / .. segments. Remove the temporary path.normalize() JS workaround since the Rust side now returns clean paths directly.
Prevent registry pollution from temp directory builds by checking os.tmpdir() before auto-registration. Auto-prune stale entries on `registry list` (CLI) and `list_repos` (MCP) so users and AI agents always see a clean registry.
Prevent concurrent Claude Code instances from unstaging, deleting, or reverting each other's files.
Wrap native resolveImport and resolveImports results with normalizePath(path.normalize()) to catch any remaining ./.. segments that the Rust engine might produce on edge cases.
Track lastAccessedAt on registry entries (updated on build and MCP query). pruneRegistry now removes entries not accessed within a configurable TTL (default 30 days) in addition to missing directories. CLI `registry prune --ttl <days>` exposes the TTL parameter.
Move 9 language extractors (~1,630 lines) from parser.js into src/extractors/, mirroring the native engine's per-file structure. parser.js re-exports all extractors for backward compatibility. Also fix config.test.js to match current embeddings default (jina-code).
…PATH env var The cli.test.js afterAll called pruneRegistry() with no arguments, operating on the real ~/.codegraph/registry.json. The run() helper also lacked HOME isolation, risking writes to the real registry. Add CODEGRAPH_REGISTRY_PATH env var support to registry.js, isolate all CLI spawns with a fake HOME, and remove the bare pruneRegistry() call.
Previously --engine native silently fell back to WASM with a warning, which was easy to miss. Now it throws a clear error with install instructions, matching user intent. Auto mode remains unchanged.
…ctors Each extractor's internal AST traversal function was identically named `walk`, making codegraph search results ambiguous across languages. Renamed to walkPythonNode, walkJavaScriptNode, walkGoNode, etc. so symbol searches return unique, language-specific hits.
Unified command showing node/edge breakdowns, language distribution, cycle counts, coupling hotspots, and embedding status. Supports --json.
Add guard-git.sh (PreToolUse) to block dangerous git commands that interfere with parallel sessions, and track-edits.sh (PostToolUse) to log edited files so commits can be validated against the session log. Update CLAUDE.md with worktree-first workflow and fix the Claude Code hooks example in recommended-practices.md to use the correct schema.
Add integration test that runs the embed+search pipeline with the real minilm model to catch regressions from model updates, embedding text format changes, or pipeline bugs. Includes a dedicated CI workflow (weekly + on relevant PR changes) with HuggingFace model caching.
check-readme.sh and enrich-context.sh used jq for JSON parsing, which isn't available on Windows. Switch to node inline scripts matching the pattern used by guard-git.sh and track-edits.sh. Also commit rebuild-graph.sh which was wired into settings.json but never tracked.
Greptile SummaryConsolidated dev+stable publish workflows into a single Refactored the 1917-line monolithic Added Enhanced registry with TTL-based auto-pruning (30-day default) that removes idle entries, Fixed native engine import path normalization issues by cleaning Implemented worktree workflow safety with three new hooks: Replaced Added embedding regression test with real ML model validation and dedicated weekly CI workflow. All test changes include proper isolation (skipRegistry, temp HOME override) to prevent cross-test registry pollution. Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Main Push to main] --> B{Event Type?}
B -->|push| C[Dev Publish Flow]
B -->|release| D[Stable Release Flow]
C --> E[Compute Dev Version<br/>MAJOR.MINOR.PATCH+1-dev.SHA]
D --> F[Extract Version from Tag]
E --> G[Run Tests]
F --> G
G --> H[Build Native Binaries<br/>Linux/macOS/Windows]
H --> I[Publish to npm]
I --> J{Is Stable?}
J -->|Yes| K[Create Version Bump PR<br/>+ Push Git Tag]
J -->|No| L[Skip PR/Tag<br/>Show Dev Install Instructions]
subgraph "Parser Refactor"
M[parser.js<br/>1917 lines] -.refactor.-> N[parser.js<br/>thin wrapper]
N --> O[extractors/javascript.js]
N --> P[extractors/python.js]
N --> Q[extractors/go.js]
N --> R[extractors/rust.js]
N --> S[extractors/java.js]
N --> T[extractors/...]
O & P & Q & R & S & T --> U[extractors/helpers.js]
end
subgraph "Worktree Hooks"
V[Edit/Write] --> W[track-edits.sh<br/>Log to session-edits.log]
W --> X[rebuild-graph.sh<br/>Incremental rebuild]
Y[git commit] --> Z[guard-git.sh<br/>Validate staged files]
Z -.check.-> W
end
subgraph "Registry TTL"
AA[registerRepo] --> AB[Set lastAccessedAt]
AC[resolveRepoDbPath] --> AB
AD[pruneRegistry] --> AE{Check each entry}
AE -->|Missing dir| AF[Remove: missing]
AE -->|Idle > 30 days| AG[Remove: expired]
AE -->|Active| AH[Keep]
end
Last reviewed commit: ac0b198 |
Summary
publish.ymlworkflow withworkflow_dispatchinputsparser.jsextractors into per-language files undersrc/extractors/codegraph statscommand: new CLI command for graph health overview--engine nativewhen addon unavailableguard-git.sh,track-edits.sh,rebuild-graph.shfor parallel session safetyjqwithnodein hooksTest plan
codegraph statsoutput on a real repopublish.ymlworkflow_dispatch triggers correctly for dev and stable channels