Skip to content

refactor: ablate redundant abstractions across packages - #352

Merged
antfu merged 1 commit into
mainfrom
refactor/ablation-redundant-abstractions
Sep 4, 2026
Merged

refactor: ablate redundant abstractions across packages#352
antfu merged 1 commit into
mainfrom
refactor/ablation-redundant-abstractions

Conversation

@antfubot

@antfubot antfubot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

What

A full ablation study across every package and built-in devframe, removing duplicated and vestigial internal design. No runtime behaviour changes and no breaking changes — every shipped public entry point is preserved. All removals are dead code, internal single-consumer indirection, byte-identical duplicates collapsed into one implementation, or unpublished source (not in any package's exports).

Verified green end to end: pnpm lint && pnpm knip && pnpm test && pnpm typecheck && pnpm build.

Ablations

Plugins

  • Drop 12 per-plugin re-creations of defineRpcFunction — each was createDefineWrapperWithContext<DevframeNodeContext>(), identical to the pre-bound export already shipped from devframe. Import the core wrapper directly (matches how terminals/code-server/a11y already do it). Deletes inspect/_define.ts; messages/data-inspector _define.ts keep their real helpers (getMessagesHost, NS). RPC wire names are unchanged.
  • Collapse the single-consumer connectAssets/connectOg/connectCodeServer/connectInspect SPA pass-throughs (each just return connectDevframe(options)) into direct connectDevframe() calls; the connect modules stay as type barrels. (These live in each plugin's app/ SPA source, not in any published entry.)
  • git: delete the unrendered BranchesPanelView/DiffPanelView (+ their stories — the only consumers), plus the now-orphaned shiki dev dependency and RpcContext export they alone used.
  • terminals: drop the unreachable snapshot: true flags — the plugin declares capabilities.build: false, so the static-build RPC dump that reads snapshot never runs for it.

devframe core (all internal, none exported from an entry point)

  • argsToJsonSchema returned { schema, unwrapped } where unwrapped was hard-coded false and read by nothing but its own test — return the schema directly.
  • Inline promiseWithResolver to the native Promise.withResolvers() (already the recommended migration).
  • Move the test-only AssertEqual type out of src/rpc/utils.ts into the test that uses it.
  • Extract the byte-identical node/client settings-store body into one shared createSettingsStore(store); the exported createNodeSettings/createClientSettings signatures are unchanged.

hub / hub-ui

  • Delete the dead logs dock-script-context property (rode in via an as any cast; nothing reads it).
  • Remove two stale docblocks stranded above serveDevframeAssets.

Framework kits

  • nuxt: remove a discarded createResolver() call, a self-merging Object.assign, and an unreachable === undefined branch.
  • next: reuse devframe's normalizeBasePath/resolveBasePath instead of a local normalizeBase copy.
  • json-render-ui: delete the src/index.ts barrel — it was not in package.json exports (only ./hub/./spa ship) and was not a tsdown entry, so it was never a published surface — and the createRenderer helper only it reached; prune the dead @devframes/json-render-ui and /components workspace aliases and the knip entry that masked them.

The one API snapshot delta (plugin-assets/rpc) is a type-rendering change only: DevframeNodeContext now prints as import("devframe").DevframeNodeContext because the RPC functions use the root defineRpcFunction — the same type, same wire surface.

Created with the help of an agent.

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 4, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +1 new · 🟠 ~13 changed · 🔴 -4 removed · 1 flow · 25 files · commit e48cb6a


Architecture

Architecture diagram for devframes/devframe at e48cb6a

18 components touched across 7 lanes.

Open full size


Inside the changed components — 3 views

Component view — Devframe Settings Store Consolidation

Consolidates client and node settings persistence on top of a shared createSettingsStore abstraction over reactive shared state.

Architecture view of Component view — Devframe Settings Store Consolidation in devframes/devframe

Component view — Git Plugin UI Cleanup

Retires unreferenced branch and diff panel views and the unused shiki syntax highlighter dependency from the Git devframe.

Architecture view of Component view — Git Plugin UI Cleanup in devframes/devframe

Component view — JSON Render UI Entry Point Cleanup

Removes the root source barrel export to enforce subpath imports and cleans up the unused createRenderer factory helper.

Architecture view of Component view — JSON Render UI Entry Point Cleanup in devframes/devframe

Data flow

Data flow diagram for devframes/devframe at e48cb6a

Settings Store Read/Write Synchronization

Open full size


Drill down
Client Runtimes & UI — 3 components
🟡 CHANGED Dock UI & Web Component

Host dock UI with redundant logs reference removed from docks context.

🟡 CHANGED Browser RPC Client

Browser RPC client using native Promise.withResolvers and consolidated client settings store.

🟡 CHANGED Client Settings Store

Browser RPC settings mirror synchronizing with the server over shared state via createSettingsStore.

Framework Kits & Hosts — 2 components
🟡 CHANGED Next.js Framework Kit

Next.js integration kit using standardized base path normalization helpers.

🟡 CHANGED Nuxt Framework Kit

Nuxt module adapter with simplified middleware config evaluation and cleaned imports.

Hub Orchestration — 1 component
🟡 CHANGED Hub Core & Lifecycle

Central Hub coordinator orchestrating multi-devframe installs and docks lifecycle.

Devframe Core Engine — 5 components
🟡 CHANGED MCP Server Adapter

Model Context Protocol adapter with simplified argument JSON schema projection.

🟡 CHANGED Single-Tool Instance Shell

Core devframe runtime instance incorporating unified settings store and direct defineRpcFunction helper.

🟢 NEW Settings Store Helper

Shared key-value store wrapper over reactive shared state, unifying client and node read/write/subscribe logic.

🟡 CHANGED Node Settings Store

File-backed storage provider for global and project settings delegating store operations to createSettingsStore.

🔴 REMOVED Promise Resolver Utility

Retired custom promise resolver polyfill in favor of native Promise.withResolvers.

Built-in Devframes — 4 components
🟡 CHANGED Git Dashboard Devframe

Git devframe UI cleaned of dead branch and diff panel views and unused Shiki dependency.

🟡 CHANGED Git RPC Provider

React context provider for Git Devframe client connection with internal context scope.

🔴 REMOVED Branches Panel View

Retired unreferenced Git branches panel component and Storybook stories.

🔴 REMOVED Diff Panel View

Retired unreferenced Git diff panel component, Storybook stories, and Shiki highlight dependency.

JSON View Protocol & UI — 3 components
🟡 CHANGED JSON Render UI Renderer

Declarative JSON component renderer cleaned of root index barrel and unused createRenderer helper.

🔴 REMOVED JSON Render UI Barrel

Retired root index barrel export to prevent accidental node runtime bundling.

🟡 CHANGED Vue JsonRenderView

Vue component renderer cleaned of unused createRenderer factory helper.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail
  • Show unchanged neighbours

Tip

The boxes under View are live. Tick Architecture lens or Data flow lens to choose which diagrams appear, or Expand every detail to open every drill-down at once. The comment redraws in place a few seconds later.

🪧 More tips
  • Run PR Lens on your own machine: npx skills add coldteadotai/pr-lens installs the agent skill. Then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Draw a diff before it is even a pull request: npx @coldtea/pr-lens-cli analyze --base origin/main reads the diff with your own model key, and npx @coldtea/pr-lens-cli render .pr-lens/graph.json draws the same lenses on your machine.
  • Show unchanged neighbours lists the components this change did not touch alongside the ones it did, so the drill-down shows what the changed code sits next to.
  • GitHub will not let you zoom an image in a comment. The link under each diagram opens it full size on a page of its own, where you can.
  • The CLI's render picks up .github/pr-lens.yml automatically and applies your corrections (renames, exclusions, lane pins) at draw time.
  • Would you rather run it from CI on a key of your own? Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and a model key in your repository secrets, say GEMINI_API_KEY. The Action asks Gemini by default, or OpenAI and any endpoint speaking /chat/completions through its provider input.
  • PR Lens is free for open source. A star on the repository is what keeps it going.
  • Push a new commit and the whole comment re-renders for the new head. An older run never overwrites a newer one, so a slow render cannot put a stale diagram back.
  • The diagrams follow your GitHub theme, so dark mode gets the dark render and light mode the light one, and the moving dots show this pull request's data in motion.

◈ Rendered by PR Lens · crafted with ❤️ by the Coldtea team · Come say hi on Discord

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devframe Ready Ready Preview Sep 4, 2026 2:29am UTC

Remove duplicated and vestigial internal design surfaced by a full
ablation study, with no change to runtime behaviour and no change to any
shipped public entry point (only internal machinery and unpublished
source removed).

- plugins: drop 12 per-plugin re-creations of `defineRpcFunction`
  (each was `createDefineWrapperWithContext<DevframeNodeContext>()`,
  identical to the pre-bound export from `devframe`); import the core
  wrapper directly instead
- plugins: collapse single-consumer `connectAssets`/`connectOg`/
  `connectCodeServer`/`connectInspect` SPA pass-throughs to
  `connectDevframe` (connect modules stay as type barrels)
- plugins/git: delete unrendered `BranchesPanelView`/`DiffPanelView`
  (+ stories) and the now-unused `shiki` dev dep and `RpcContext` export
- plugins/terminals: drop dead `snapshot: true` (the plugin sets
  `capabilities.build: false`, so the snapshot dump never runs)
- devframe: drop the always-`false` `unwrapped` field from the internal
  `argsToJsonSchema`; inline `promiseWithResolver` to native
  `Promise.withResolvers`; move the test-only `AssertEqual` into its test;
  extract the byte-identical node/client settings-store body into a
  shared `createSettingsStore`
- hub: delete the dead `logs` script-context prop and two stale docblocks
- kits: remove a discarded `createResolver()` call, a self-merging
  `Object.assign`, and an unreachable `undefined` branch in nuxt; reuse
  devframe's `normalizeBasePath`/`resolveBasePath` in the next handler;
  delete json-render-ui's unbuilt (non-exported) barrel + `createRenderer`
  and prune the dead workspace aliases

Created with the help of an agent.
@antfubot
antfubot force-pushed the refactor/ablation-redundant-abstractions branch from 1ba6f5a to e48cb6a Compare September 4, 2026 02:28
@antfu
antfu merged commit b7fdf7f into main Sep 4, 2026
14 checks passed
@antfu
antfu deleted the refactor/ablation-redundant-abstractions branch September 4, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants