refactor(engine): move local-write action specs into the shared engine package#5117
Conversation
…e package src/mcp/local-write-tools.ts had zero root-specific dependencies (only a generic JSON-value type) despite living in root src/ -- it builds pure, deterministic LocalWriteActionSpecs (open_pr, file_issue, apply_labels, post_eligibility_comment, create_branch, delete_branch, generate_tests, follow_up_issue) with no DB/env/Cloudflare-binding access, so it always belonged in the shared "brain" layer alongside the rest of the portable engine, not root-only. This lets packages/gittensory-miner's own real driving-loop entrypoint (in progress) construct the exact same open_pr command gittensory's MCP server would return via gittensory_open_pr, with zero network round-trip and zero duplicated/drifting logic -- both consumers import the same functions from one place. src/mcp/local-write-tools.ts is now a thin re-export preserving every existing import path (src/mcp/server.ts, src/review/fix-handoff- render.ts, src/miner/soft-claim.ts) unchanged. Root gains @jsonbored/gittensory-engine as an explicit dependency (the workspace symlink already resolved it, but it was never declared). test/unit/local-write-tools.test.ts adds the vi.mock source-redirect this session's own established pattern uses whenever a root test exercises logic that now lives behind the package-specifier re-export -- without it, v8 coverage cannot attribute hits back to the engine's .ts source (it resolves through dist/ instead), which would have silently failed codecov/patch on the new engine file despite the tests passing.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 8714892 | Commit Preview URL Branch Preview URL |
Jul 11 2026, 03:37 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5117 +/- ##
=======================================
Coverage 94.21% 94.21%
=======================================
Files 470 470
Lines 39743 39743
Branches 14506 14506
=======================================
Hits 37442 37442
Misses 1645 1645
Partials 656 656
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-11 15:40:57 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 5 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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.
|
…ration test (#5122) The Postgres integration test's import graph now reaches @jsonbored/gittensory-engine transitively (#5117 moved local-write action specs there; src/mcp/local-write-tools.ts re-exports them from the engine package). That package's dist/ is gitignored and only exists after an explicit build step, which this workflow never had -- same #ci-engine-build-order class of bug ci.yml's "Build engine package" step already exists to prevent, just missed here. Reproduced locally (removed dist/, confirmed the exact "Failed to resolve entry for package" error; rebuilt, confirmed it resolves cleanly) before landing the fix.
Summary
Advances #2337.
src/mcp/local-write-tools.tshad zero root-specific dependencies (only a generic JSON-value type) despite living in rootsrc/— it builds pure, deterministicLocalWriteActionSpecs with no DB/env/Cloudflare-binding access, so it always belonged in the shared "brain" layer alongside the rest of the portable engine, not root-only.This is a prerequisite for
packages/gittensory-miner's own real driving-loop entrypoint (in progress, separate PR) to construct the exact sameopen_prcommand gittensory's MCP server would return viagittensory_open_pr, with zero network round-trip and zero duplicated/drifting logic — both consumers now import the same functions from one place, resolving the architectural fork between "duplicate the command-construction logic" and "build new MCP-client infrastructure."packages/gittensory-engine/src/miner/local-write-tools.ts— the moved implementation, byte-identical logic,JsonValueinlined as a localLocalWriteJsonValuetype (no new cross-package type dependency).src/mcp/local-write-tools.ts— now a thin re-export, preserving every existing import path (src/mcp/server.ts,src/review/fix-handoff-render.ts,src/miner/soft-claim.ts) unchanged.@jsonbored/gittensory-engineas an explicit dependency (the workspace symlink already resolved it at runtime, but it was never declared inpackage.json).test/unit/local-write-tools.test.tsadds thevi.mocksource-redirect this session's own established pattern uses whenever a root test exercises logic that now lives behind a package-specifier re-export — without it, v8 coverage cannot attribute hits back to the engine's.tssource (it resolves throughdist/instead), which would have silently failedcodecov/patchon the new engine file despite every test passing.Scope
refactor(engine): ...).CONTRIBUTING.md.Validation
npm run build --workspace @jsonbored/gittensory-enginethennpm run typecheck— clean.npx vitest run test/unit/local-write-tools.test.ts— 19/19 passing, 100% stmts/branches/funcs/lines on bothsrc/mcp/local-write-tools.tsandpackages/gittensory-engine/src/miner/local-write-tools.ts(verified via--coverage.includeon both paths — confirmed 0% before adding thevi.mockredirect, 100% after, so this isn't assumed).test/unit/discovery-soft-claim.test.ts(9),test/unit/soft-claim.test.ts(4),test/unit/fix-handoff-render.test.ts(12) — 25/25.npm audit --audit-level=moderate— no new external dependencies (workspace-internal only).Safety
src/mcp/server.tsare unchanged; only their import source moved).