Repository navigation
refactor(core): deduplicate local plugin, formatter, and session shims - #67205
Conversation
There was a problem hiding this comment.
Looks sound. The deduplicated pieces behave the same as before, and the removed helpers have no remaining callers in packages/. I checked the generate.ts mapError change most closely. The resolver's error set is exactly the six old tags plus Integration.Authorization. With no model named, that error passes through as before. With a model named, it goes through resolutionError, which also returns it unchanged. bun run typecheck:tsc in packages/core is clean, and the related core tests pass. The only failures (GitLab OAuth on a busy port 8080, and one MCP process-cleanup test) fail the same way on dev.
Public API is unchanged: the removed Integration connection.update, SessionCwd.locate/CwdError and ConfigManaged.Document were internal to packages/core and are not exposed through the plugin API, server or SDK.
Removes about 130 lines of duplicated or unused code in the core package. Nothing a user sees changes.
This is cleanup only. Commands, formatting, image notices, and session delivery work exactly as before.
❌ Before
/initand/reviewcommands were two copy-pasted blocks.✅ After
/initand/reviewcome from one loop, in the same order.🟰 Behavior change: none. Output strings, event metadata, and the order of error mapping are unchanged.
📊 Size: source −100 lines net (+84 / −184), tests −33 lines (a test for the removed cwd helper, plus stale mock fields).
👀 Read:
generate.ts, the newmapError. The resolver's error set is exactly the six old tags plus the authorization error, and the authorization error must still pass through when no model is named. The rest is routine.🔍 Found in a code audit · no user reports · several candidates were checked and left alone because they would change behavior (listed under Checks run)
Checks run
bun testfrompackages/coreon formatter, command, config, generate, model-resolver, session-cwd, session-inbox, session-prompt, session-execution, shell-restart, shell-result, tool-shell, image and video tools, integration, voice, usage-limits, MCP, instruction-discovery, and plugin tests: 672 pass, 7 skip, 3 fail. The 3 failures are intool-shell.test.ts(process substitution, sh/zsh arithmetic) and fail the same way ondevwithout this change.bun typecheck(packages/core): no errorsbun run typecheck:tsc(packages/core): no errorsbun run check(repo root): 37/37 tasks passLeft alone on purpose:
metadata()derived fromoutput(): it would leak extra tool fields into metadata.provideServicecalls for the image, decision, and video clients ingenerate.ts: they are not no-ops. The layer provides those clients only while it is being built, so the effects need them again when they run.