codegraph-sf is a hard fork of @colbymchenry/codegraph
that adds Salesforce-stack indexing (Apex/VF/Aura/LWC cross-layer, the React↔Apex
postMessage bridge, and the SObject field-usage/impact layer). It is published to npm
under its own name but tracks upstream — upstream fixes are merged in periodically.
The codegraph bin/CLI/MCP command name is intentionally unchanged so existing MCP
configs keep working after swapping the package.
| Remote | Repo | Role |
|---|---|---|
upstream |
colbymchenry/codegraph |
source of truth for the engine |
origin |
dormonbear/codegraph |
this fork (published as codegraph-sf) |
Current base: forked from upstream main @ 471084d (2026-06-06).
If your remotes are still named the old way (origin=colbymchenry, fork=dormonbear),
rename them once so the commands below read correctly:
git remote rename origin upstream
git remote rename fork originThe fork is almost purely additive (~+2500 / −10 lines). The bulk lives in new
files upstream never touches (src/resolution/frameworks/salesforce.ts,
src/extraction/sobject-schema-extractor.ts, src/extraction/salesforce-metadata-extractor.ts,
src/extraction/wasm/tree-sitter-apex.wasm, …). The edits to shared core files are
insertions at stable hook points, not rewrites:
src/extraction/tree-sitter.ts— apex field-usage hooks invisitNode+visitForCallsAndStructuresrc/extraction/grammars.ts—isSObjectFieldMeta/isSalesforceMetadatadispatchsrc/types.ts—sobject_fieldNodeKind +field_*EdgeKindssrc/resolution/name-matcher.ts— the cross-familycallsgatesrc/mcp/tools.ts,src/index.ts,src/mcp/server-instructions.ts— the field toolspackage.json— name/version (always a conflict; keep ours)
So git merge upstream/main typically conflicts in ~6–8 known files, each a simple
"both sides added lines" resolution.
git fetch upstream
git merge upstream/main # or: git rebase upstream/main
# resolve conflicts in the files above; for package.json keep our name/version
npm install
npm test # full vitest suite must stay greenAfter merging:
- Bump
EXTRACTION_VERSIONinsrc/extraction/extraction-version.tsonly if upstream's extraction logic changed in a way that invalidates cached indexes. - Update the
forkedFromfield inpackage.jsonto the new upstream base (upstreamVersion= upstream'spackage.jsonversion,upstreamCommit= the merged upstream commit). This is the only record of "which upstream am I on" — the published version number is independent (see below).
The authoritative policy is VERSIONING.md (SemVer 2.0.0,
independent fork line). In short:
- PATCH is the default — including merging upstream (upstream shipping features does NOT make it a minor for us; our tool contracts are unchanged).
- MINOR only when the fork adds a user-facing capability (a new MCP tool, a new index layer).
- MAJOR for a backwards-incompatible change to our own tools.
Never mirror upstream's number; the upstream base is tracked in forkedFrom
(npm view codegraph-sf forkedFrom), not the version string.
Publishing is automated by .github/workflows/npm-publish.yml via npm Trusted
Publishing (OIDC) — no stored npm token. The prepare hook builds dist/ on publish.
# 1. bump "version" in package.json per the policy above
# 2. resync the lock: npm install --package-lock-only --ignore-scripts
# 3. commit, then tag — the tag MUST equal package.json's version
git commit -am "chore: release vX.Y.Z"
git tag vX.Y.Z && git push origin salesforce vX.Y.ZThe workflow verifies the tag matches package.json, runs the suite, and publishes.
A manual run is also available from the Actions tab (workflow_dispatch). Node 20–24.
- Package
namestayscodegraph-sf;binstayscodegraph. - The Salesforce new-files and the hook insertions above — re-apply them if an upstream refactor moves a hook point.