feat(engine): extract computeLocalScorerTokens to gittensory-engine - #4371
Conversation
computeLocalScorerTokens (JSONbored#782) is a pure, ~35-line token scorer over changed-file metadata that is documented as needing to run in every surface (the published gittensory-mcp/gittensory-miner CLIs and the hosted Worker), but it lived in src/signals/local-scorer.ts where the CLIs cannot import it. This moves it to packages/gittensory-engine/src/local-scorer.ts and turns the src module into a thin re-export shim, following the same layout as the JSONbored#2278 duplicate-winner, JSONbored#2282 scoring, and JSONbored#4254 issue-rag-query extractions. Its only dependencies are the already-portable isCodeFile/isTestPath (engine signals/test-evidence.ts) plus 3 narrow type shapes. Per the issue, those shapes are narrowly duplicated into the engine module (structurally identical to local-branch.ts's) rather than moving the large, Node-coupled local-branch.ts itself, which stays in the backend. Exported from the package entrypoint, covered by an engine-side barrel test, and the existing test/unit/local-scorer.test.ts (+ adapter + mcp run-local-scorer tests) pass unmodified through the shim. Closes JSONbored#4253
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4371 +/- ##
=======================================
Coverage 93.95% 93.95%
=======================================
Files 400 400
Lines 36817 36817
Branches 13451 13451
=======================================
Hits 34592 34592
Misses 1569 1569
Partials 656 656
🚀 New features to boost your workflow:
|
8ddced7 to
df0ce0f
Compare
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-09 17:15:42 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 4 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
What
computeLocalScorerTokens(#782) is a pure ~35-line token scorer over changed-file metadata (paths + line counts, never source content), documented as needing to run "in every surface (stdio package AND hosted Worker)" — but it lived insrc/signals/local-scorer.tswhere the publishedgittensory-mcp/gittensory-minerCLIs cannot import it. This extracts it topackages/gittensory-engine/src/local-scorer.ts, withsrc/signals/local-scorer.tsbecoming a thin re-export shim — the same layout as the #2278 duplicate-winner, #2282 scoring, and #4254 issue-rag-query extractions.Its only dependencies are the already-portable
isCodeFile/isTestPath(enginesignals/test-evidence.ts) plus 3 narrow type shapes. Per the issue's guidance ("Lift or narrowly duplicate ... do not attempt to move local-branch.ts itself"), those 3 shapes are narrowly duplicated into the engine module (structurally identical tolocal-branch.ts's), leaving the large, Node-coupledlocal-branch.tsuntouched in the backend.Deliverables
computeLocalScorerTokensextracted topackages/gittensory-engine/src/local-scorer.tslocal-branch.ts)src/signals/local-scorer.tsis a thin re-export shim (relative source path, matching prior extraction shims)index.ts)test/unit/local-scorer.test.ts(+local-scorer-adapter+mcp-run-local-scorer) green through the shim; plus a new engine-side barrel testValidation
npm run test --workspace @jsonbored/gittensory-engine(build + 277 tests, 0 fail)npm run typecheck(0 errors)npx vitest run test/unit/local-scorer.test.ts test/unit/local-scorer-adapter.test.ts test/unit/mcp-run-local-scorer.test.ts(15 tests)npm run test:engine-paritygit diff --checkCloses #4253