Skip to content

refactor!: remove the Block Tune tool kind - #193

Open
gohabereg wants to merge 5 commits into
feat/plugin-block-datafrom
feat/remove-block-tunes
Open

gohabereg wants to merge 5 commits into
feat/plugin-block-datafrom
feat/remove-block-tunes

Conversation

@gohabereg

Copy link
Copy Markdown
Member

Implements the remove-block-tunes change from #189. Stacked on #192 — this diff is only the tool-kind removal.

The Block Tune tool kind is dead weight. A registered tune gets a BlockTuneFacade built and sorted into ToolsManager.blockTunes, and then nothing ever reads it: no adapter, no rendering, no core wiring. So deleting it breaks no working feature — it just removes the half-wired second way to build what plugins now do, and with it the extension point #157 grew an adapter and a manager around.

What's in it

  • SDK. Deletes ToolType.Tune, the BlockTune* entity exports and BlockTuneFacade, plus everything referencing them: BaseToolFacade#isTune(), ToolsCollection#blockTunes (its only consumer), BlockTuneConstructor from ToolConstructable, BlockTuneFacade from ToolFacadeClass, ToolTypeToOptions[ToolType.Tune], BlockToolOptionKey.Tunes and its BlockToolOptions member, UserToolOptions.EnabledBlockTunes, and BlockToolFacade#tunes/#enabledBlockTunes.
  • Core. Removes the Tune branch from Core#use, the getAll(ToolType.Tune) preparation step, the Tune case in ToolsFactory, and ToolsManager#blockTunes.
  • shortcuts-plugin. Its dead #processBlockTune and the BlockTuneFacade import go with the facade.

"Tune" becomes a UI term only: a former tune is written as a plugin that uses plugin data and the block-settings API.

How the removals are tested

Each deleted name is guarded by a @ts-expect-error on its import specifier. Under ts-jest a stale directive is itself a diagnostic (TS2578), so every one of these fails the suite the moment its name comes back — the assertions are live, not decorative. I verified that by temporarily pointing one directive at an existing export and confirming it fired.

One name resisted: BlockToolOptions['tunes'] can't be asserted gone, because the interface carries an open [key: string]: unknown index signature for tool-author options, so any key resolves. BlockToolOptionKey.Tunes is the removable surface and is asserted instead; the spec notes this.

New specs for ToolsCollection and ToolsFactory. The latter had zero coverage, which let a mutant collapsing the remaining Inline case survive — it's now at 100% mutation score.

Breaking (pre-1.0)

Anything that registers a tune via core.use() or sets a tool's tunes option. The model layer's tune vocabulary is renamed by #192, not here.

Notes for review

Task 4.5 — commenting on #157 to point at the three replacement changes — is left unchecked on purpose; that's a public comment on someone else's PR and wants a human to send it.

Verified: yarn build and yarn lint clean, 1,048 tests passing, openspec validate remove-block-tunes --type change passes, archive gate OK.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Unit Tests

Package Coverage Delta
@editorjs/ot-server 20% 0% ⚪️
@editorjs/collaboration-manager 86.75% 0% ⚪️
@editorjs/dom-adapters 86.95% 0% ⚪️
@editorjs/shortcuts-plugin 100% 0% ⚪️
@editorjs/clipboard-plugin 66.66% 0% ⚪️
@editorjs/editorjs 100% 0% ⚪️
@editorjs/core 77.77% +1.08% 🟢
@editorjs/model N/A N/A
@editorjs/model-types N/A N/A

Mutation Tests

Package Mutation score Dashboard URL
@editorjs/shortcuts-plugin 96.15% 🟢 Dashboard
@editorjs/core 32.79% 🔴 Dashboard
@editorjs/clipboard-plugin No files to mutate found.
@editorjs/collaboration-manager No files to mutate found.
@editorjs/dom-adapters No files to mutate found.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The intentional breaking removal is consistent across contracts, core wiring, dependents, and regression tests, with no blocking issues identified.

0 open findings

What changed in this PR

Removes the unused Block Tune tool kind, continuing #189’s move toward plugin-based block settings. Model-layer changes remain in #192.

Changes:

  • Removes tune contracts, facades, options, and registration paths.
  • Adds removal guards and coverage for remaining tool kinds.
  • Updates documentation and implementation tasks.
File Description
packages/​sdk/​src/​tools/​ToolsCollection.ts Removes the tune collection view.
packages/​sdk/​src/​tools/​ToolsCollection.spec.ts Tests remaining views and tune removal.
packages/​sdk/​src/​tools/​facades/​index.ts Removes tune facade exports and union member.
packages/​sdk/​src/​tools/​facades/​BlockTuneFacade.ts Deletes the unused facade.
packages/​sdk/​src/​tools/​facades/​BlockToolFacade.ts Removes tune collections and options.
packages/​sdk/​src/​tools/​facades/​BaseToolFacade.ts Removes tune types and predicate.
packages/​sdk/​src/​tools/​facades/​BaseToolFacade.spec.ts Guards removed SDK APIs.
packages/​sdk/​src/​entities/​MenuConfig.ts Updates menu documentation.
packages/​sdk/​src/​entities/​index.ts Removes tune contract exports.
packages/​sdk/​src/​entities/​EntityType.ts Removes ToolType.Tune.
packages/​sdk/​src/​entities/​BlockTune.ts Deletes tune contracts.
packages/​sdk/​src/​entities/​BlockTool.ts Removes the tune option.
packages/​sdk/​src/​entities/​BaseTool.ts Narrows option types to remaining kinds.
packages/​sdk/​src/​api/​BlocksAPI.ts Removes tune references from commented API.
packages/​plugins/​shortcuts-plugin/​src/​index.ts Removes unused tune shortcut stub.
packages/​core/​src/​tools/​ToolsManager.ts Removes the tune collection getter.
packages/​core/​src/​tools/​ToolsFactory.ts Removes tune facade construction.
packages/​core/​src/​tools/​ToolsFactory.spec.ts Tests factory behavior for remaining kinds.
packages/​core/​src/​index.ts Removes tune registration and preparation.
packages/​core/​src/​index.spec.ts Tests plugin routing and collection removal.
openspec/​changes/​remove-block-tunes/​tasks.md Records completed implementation tasks.
docs/​README.md Updates supported tool contracts.
docs/​plugins.md Explains plugin-based tune replacement.
docs/​diagrams/​plugin-lifecycle-flow.mmd Removes tune lifecycle paths.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@gohabereg
gohabereg force-pushed the feat/plugin-block-data branch from dd75828 to d555032 Compare October 16, 2026 23:01
@gohabereg
gohabereg force-pushed the feat/remove-block-tunes branch 2 times, most recently from 5f852d7 to 119c8bf Compare October 17, 2026 16:30
gohabereg and others added 5 commits October 17, 2026 19:32
A registered tune got a `BlockTuneFacade` built and sorted into
`ToolsManager.blockTunes`, and nothing ever read it — no adapter, no
rendering, no model wiring. It was a second, half-built way to do what a
plugin now does, so it goes rather than stays as an alternative to
document around.

Removed from `sdk`: `ToolType.Tune`, the `BlockTune*` contracts and
`BlockTuneFacade`, `BaseToolFacade#isTune()`, `ToolsCollection#blockTunes`,
`ToolTypeToOptions[ToolType.Tune]`, and the tune members of the
`ToolConstructable`/`ToolFacadeClass` unions. The per-tool allow-list goes
too — `BlockToolOptionKey.Tunes`, `UserToolOptions.EnabledBlockTunes`,
`BlockToolFacade#enabledBlockTunes` and `BlockToolFacade#tunes` — because
per-tool filtering belongs to the providers, which get `tool` in their
context. If integrators want the allow-list back it returns through
`options.plugins['block-settings']`, not as a member of the tool contract.

Removed from `core`: the Tune branch of `use()`, the
`getAll(ToolType.Tune)` preparation step, the Tune case in `ToolsFactory`
and `ToolsManager#blockTunes`. `shortcuts-plugin` loses its never-called
`#processBlockTune`.

The removal is guarded by compile-time assertions rather than runtime
ones: under `ts-jest` a stale `@ts-expect-error` is itself a diagnostic,
so each directive fails the suite while the name it points at exists.
`BlockToolOptions['tunes']` is the one member that cannot be asserted —
the interface carries an open index signature for tool-author options, so
every key resolves.

BREAKING CHANGE: registering a tune through `core.use()` or setting a
tool's `tunes` option no longer compiles. Write a plugin instead: it puts
an item in the block settings menu and stores state as per-block plugin
data.

Co-Authored-By: Claude Opus 5 <[email protected]>
`docs/plugins.md` loses the registration-table row and gains a line
pointing a would-be tune author at the block settings menu and per-block
plugin data instead; `docs/README.md` and the plugin-lifecycle diagram
drop their `BlockTune` / `ToolType.Tune` / `blockTunes` mentions.

Two live specs are hand-edited because the mechanical archive fold only
rewrites `### Requirement:` blocks: the `sdk` **Purpose** preamble, and
the `shortcuts-plugin` reserved-work note, which now reserves shortcuts
for block settings items rather than for block tunes.

Co-Authored-By: Claude Opus 5 <[email protected]>
`ToolsFactory#getConstructor` had no coverage at all, so the switch this
branch removed the Tune case from was unguarded: a mutant collapsing the
remaining Inline case survived. The new spec pins both remaining kinds to
their facades, along with the `defaultBlock` flag, the options handed to
the facade, and the unregistered-tool error. `ToolsFactory.ts` now scores
100 on mutation testing, up from 40.

Co-Authored-By: Claude Opus 5 <[email protected]>
Task 4.5 stays open: closing PR #157 with links to its three replacement
changes is a public comment, so it waits for the maintainer.

Co-Authored-By: Claude Opus 5 <[email protected]>
`MenuConfig` still advertised itself as the shape for "Block Tune's
render()", the last reference in shipped source to the tool kind this
change removes.

Co-Authored-By: Claude Opus 5 <[email protected]>
@gohabereg
gohabereg force-pushed the feat/remove-block-tunes branch from 119c8bf to 36fa683 Compare October 17, 2026 18:52
@gohabereg
gohabereg force-pushed the feat/plugin-block-data branch from 24efab2 to 7aefa42 Compare October 17, 2026 18:52
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