Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .changeset/ai-fix-repeated-placeholders.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@platejs/ai': patch
---

- Fix `replacePlaceholders` replacing only the first `{prompt}` and markdown placeholder occurrence in AI prompt templates
5 changes: 5 additions & 0 deletions .changeset/docx-fix-rtf-image-matching.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@platejs/docx': patch
---

- Fix RTF image extraction matching control words like `shp` inside longer tokens such as `shppict`
5 changes: 5 additions & 0 deletions .changeset/layout-fix-column-group-normalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@platejs/layout': patch
---

- Fix invalid column group normalization preserving wrapped paragraph content instead of dropping it
5 changes: 5 additions & 0 deletions .changeset/suggestion-fix-metadata-lookups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@platejs/suggestion': patch
---

- Fix suggestion metadata lookups using the actual per-suggestion keys and IDs for active descriptions, node matching, and line-break detection
224 changes: 224 additions & 0 deletions .claude/docs/plans/2026-03-22-coverage-priority-map-post-yjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
---
title: Coverage Priority Map Post Yjs Merge
type: testing
date: 2026-03-22
status: completed
---

# Coverage Priority Map Post Yjs Merge

## Goal

Run fresh repo coverage, score every `packages/*/src/**` file for non-React unit-test value, and sync the next recommendations against:

- March 6, 2026 cleanup strategy
- March 9, 2026 excellence plan
- March 17, 2026 execution passes
- the now-merged Yjs suite work

## Coverage Run

- Command:
- `bun test --coverage --coverage-reporter=lcov --coverage-dir=/Users/zbeyens/git/plate/.coverage-repo-2026-03-22b --reporter=dots`
- Result:
- `2557 pass`
- `0 fail`
- `444 files`
- `4.25s`
- Artifact:
- [lcov.info](/Users/zbeyens/git/plate/.coverage-repo-2026-03-22b/lcov.info)

## Sync From Completed Work

- March 14, 2026:
- `markdown` already got the worthwhile helper and fallback pass.
- March 15, 2026:
- `table` already got the merge, sizing, and selection helper pass.
- March 17, 2026:
- `selection`, `docx-io`, and the focused non-React `core` lane already got follow-up work.
- March 22, 2026:
- `yjs` just got the fast suite, slow collaboration lane, and follow-up upstream-inspired cases.

Strong take: the raw matrix still slightly over-scores `core` and `table` because they are big and still have uncovered leftovers. I would not reopen them next. The actual recommendation order below is the one to follow.

## Scoring Rules

- Scope is every runtime file under `packages/*/src/**`.
- `/react` files score `0` by design.
- Barrels, declaration files, and type-only files score `0`.
- Declarative rule tables under `autoformat/rules/**` score `0`.
- Recent package passes get penalized so we do not recommend the same work twice.
- Scores favor deterministic transforms, parsers, serializers, queries, provider logic, plugin contracts, and pure helpers with meaningful uncovered behavior.
- UI-skewed packages get pushed down even when they are uncovered.

## My Order

### 1. `list-classic`

Best next package.

- Why:
- best remaining mix of deterministic query and transform seams
- high-value editor behavior, not coverage cosplay
- sits exactly where the older plan already wanted the next serious spend
- Start here:
- [getTodoListItemEntry.ts](/Users/zbeyens/git/plate/packages/list-classic/src/lib/queries/getTodoListItemEntry.ts)
- [getHighestEmptyList.ts](/Users/zbeyens/git/plate/packages/list-classic/src/lib/queries/getHighestEmptyList.ts)
- [withDeleteFragmentList.ts](/Users/zbeyens/git/plate/packages/list-classic/src/lib/withDeleteFragmentList.ts)
- [withInsertBreakList.ts](/Users/zbeyens/git/plate/packages/list-classic/src/lib/withInsertBreakList.ts)
- [moveListSiblingsAfterCursor.ts](/Users/zbeyens/git/plate/packages/list-classic/src/lib/transforms/moveListSiblingsAfterCursor.ts)

### 2. `suggestion`

- Why:
- deterministic diff and suggestion-transform behavior
- strong value without any `/react` detour
- better next seam quality than reopening `core` leftovers
- Start here:
- [diffToSuggestions.ts](/Users/zbeyens/git/plate/packages/suggestion/src/lib/diffToSuggestions.ts)
- [withSuggestion.ts](/Users/zbeyens/git/plate/packages/suggestion/src/lib/withSuggestion.ts)
- [removeNodesSuggestion.ts](/Users/zbeyens/git/plate/packages/suggestion/src/lib/transforms/removeNodesSuggestion.ts)
- [getSuggestionNodeEntries.ts](/Users/zbeyens/git/plate/packages/suggestion/src/lib/utils/getSuggestionNodeEntries.ts)
- [findSuggestionNode.ts](/Users/zbeyens/git/plate/packages/suggestion/src/lib/queries/findSuggestionNode.ts)

### 3. `docx`

- Why:
- very unit-testable cleaner and import seams
- big user-facing value without dragging app wiring into package tests
- cleaner next move than `docx-io`, which already got its pure-helper pass
- Start here:
- [cleanDocxImageElements.ts](/Users/zbeyens/git/plate/packages/docx/src/lib/docx-cleaner/utils/cleanDocxImageElements.ts)
- [getRtfImageHex.ts](/Users/zbeyens/git/plate/packages/docx/src/lib/docx-cleaner/utils/getRtfImageHex.ts)
- [getRtfImagesMap.ts](/Users/zbeyens/git/plate/packages/docx/src/lib/docx-cleaner/utils/getRtfImagesMap.ts)
- [getRtfImagesByType.ts](/Users/zbeyens/git/plate/packages/docx/src/lib/docx-cleaner/utils/getRtfImagesByType.ts)
- [getRtfImageMimeType.ts](/Users/zbeyens/git/plate/packages/docx/src/lib/docx-cleaner/utils/getRtfImageMimeType.ts)

### 4. `ai`

- Why:
- the value here is in pure transforms and prompt helpers, not model fakery
- coverage is still brutally low in the exact deterministic seams that matter
- worth doing after `suggestion` and `docx`, not before them
- Start here:
- [withAIBatch.ts](/Users/zbeyens/git/plate/packages/ai/src/lib/transforms/withAIBatch.ts)
- [getEditorPrompt.ts](/Users/zbeyens/git/plate/packages/ai/src/lib/utils/getEditorPrompt.ts)
- [insertAINodes.ts](/Users/zbeyens/git/plate/packages/ai/src/lib/transforms/insertAINodes.ts)
- [replacePlaceholders.ts](/Users/zbeyens/git/plate/packages/ai/src/lib/utils/replacePlaceholders.ts)
- [undoAI.ts](/Users/zbeyens/git/plate/packages/ai/src/lib/transforms/undoAI.ts)

### 5. `layout`

- Why:
- still mostly deterministic column operations
- real regression surface
- no `/react` requirement
- Start here:
- [resizeColumn.ts](/Users/zbeyens/git/plate/packages/layout/src/lib/transforms/resizeColumn.ts)
- [moveMiddleColumn.ts](/Users/zbeyens/git/plate/packages/layout/src/lib/transforms/moveMiddleColumn.ts)
- [insertColumnGroup.ts](/Users/zbeyens/git/plate/packages/layout/src/lib/transforms/insertColumnGroup.ts)
- [withColumn.ts](/Users/zbeyens/git/plate/packages/layout/src/lib/withColumn.ts)
- [insertColumn.ts](/Users/zbeyens/git/plate/packages/layout/src/lib/transforms/insertColumn.ts)

### 6. `list`

- Why:
- still has clean query and toggle seams left
- smaller and cheaper than the packages above
- good follow-up once `list-classic` is moving
- Start here:
- [getSiblingListStyleType.ts](/Users/zbeyens/git/plate/packages/list/src/lib/queries/getSiblingListStyleType.ts)
- [toggleListByPath.ts](/Users/zbeyens/git/plate/packages/list/src/lib/transforms/toggleListByPath.ts)
- [someList.ts](/Users/zbeyens/git/plate/packages/list/src/lib/queries/someList.ts)
- [someTodoList.ts](/Users/zbeyens/git/plate/packages/list/src/lib/queries/someTodoList.ts)
- [setListNode.ts](/Users/zbeyens/git/plate/packages/list/src/lib/transforms/setListNode.ts)

### 7. `code-block`

- Why:
- remaining non-React logic is still real
- cleaner than reopening `core` or `table`
- Start here:
- [withCodeBlock.ts](/Users/zbeyens/git/plate/packages/code-block/src/lib/withCodeBlock.ts)
- [formatter.ts](/Users/zbeyens/git/plate/packages/code-block/src/lib/formatter/formatter.ts)
- [withInsertDataCodeBlock.ts](/Users/zbeyens/git/plate/packages/code-block/src/lib/withInsertDataCodeBlock.ts)
- [setCodeBlockToDecorations.ts](/Users/zbeyens/git/plate/packages/code-block/src/lib/setCodeBlockToDecorations.ts)

### 8. `autoformat`

Surgical only.

- Worth testing:
- [AutoformatPlugin.ts](/Users/zbeyens/git/plate/packages/autoformat/src/lib/AutoformatPlugin.ts)
- [autoformatBlock.ts](/Users/zbeyens/git/plate/packages/autoformat/src/lib/transforms/autoformatBlock.ts)
- [autoformatMark.ts](/Users/zbeyens/git/plate/packages/autoformat/src/lib/transforms/autoformatMark.ts)
- [autoformatText.ts](/Users/zbeyens/git/plate/packages/autoformat/src/lib/transforms/autoformatText.ts)
- Not worth the time:
- rule-table files under `packages/autoformat/src/lib/rules/**`

### 9. `csv`

Tiny but sharp.

- Start here:
- [deserializeCsv.ts](/Users/zbeyens/git/plate/packages/csv/src/lib/deserializer/utils/deserializeCsv.ts)
- [CsvPlugin.ts](/Users/zbeyens/git/plate/packages/csv/src/lib/CsvPlugin.ts)

### 10. `comment`

Good file-level value, but not a bigger campaign than the packages above.

- Start here:
- [BaseCommentPlugin.ts](/Users/zbeyens/git/plate/packages/comment/src/lib/BaseCommentPlugin.ts)
- [withComments.ts](/Users/zbeyens/git/plate/packages/comment/src/lib/withComments.ts)
- [getCommentKeys.ts](/Users/zbeyens/git/plate/packages/comment/src/lib/utils/getCommentKeys.ts)
- [getCommentCount.ts](/Users/zbeyens/git/plate/packages/comment/src/lib/utils/getCommentCount.ts)

## Not Next

- `yjs`
- just landed a serious fast plus slow pass
- current matrix score is `0`
- `media`
- current non-`/react` matrix score is `0`
- the old March 17 recommendation is stale here
- `markdown`
- down to one score-1 leftover on [defaultRules.ts](/Users/zbeyens/git/plate/packages/markdown/src/lib/rules/defaultRules.ts)
- not worth the next cycle
- `selection`
- only one real leftover file still registers
- March 17 already consumed the good internal seams
- `docx-io`
- pure-helper pass already happened on March 17
- remaining debt is lower-value export/app crossover
- `table`
- still has leftovers, especially [withSetFragmentDataTable.ts](/Users/zbeyens/git/plate/packages/table/src/lib/withSetFragmentDataTable.ts)
- still not worth reopening right now
- `core`
- still has low-coverage leftovers
- most of them are not as clean or as urgent as the packages above

## Ranking Snapshot

This is my actual recommendation order, not just the raw heuristic sort.

| Rank | Package | Score | Take |
| --- | --- | ---: | --- |
| 1 | `list-classic` | 49 | Best next deterministic editor-behavior lane |
| 2 | `suggestion` | 46 | Rich transform/diff value without `/react` |
| 3 | `docx` | 45 | Very unit-testable cleaner/import seams |
| 4 | `ai` | 47 | Good pure transform/helper lane, avoid network theater |
| 5 | `layout` | 44 | Strong column transform seams |
| 6 | `list` | 41 | Cheap query/toggle follow-up |
| 7 | `code-block` | 36 | Real non-React behavior still left |
| 8 | `autoformat` | 25 | Surgical pass only |
| 9 | `csv` | 19 | Two-file slice, clean ROI |
| 10 | `comment` | 26 | Good file-level value, smaller overall win |

## Artifacts

- [lcov.info](/Users/zbeyens/git/plate/.coverage-repo-2026-03-22b/lcov.info)
- [2026-03-22-coverage-priority-packages-post-yjs.tsv](/Users/zbeyens/git/plate/.claude/docs/plans/2026-03-22-coverage-priority-packages-post-yjs.tsv)
- [2026-03-22-coverage-priority-files-post-yjs.tsv](/Users/zbeyens/git/plate/.claude/docs/plans/2026-03-22-coverage-priority-files-post-yjs.tsv)

The TSVs are the exhaustive matrix for every package and file under `packages/*/src/**`. The markdown is the actual call on what to do next.
33 changes: 33 additions & 0 deletions .claude/docs/plans/2026-03-23-ai-deterministic-coverage-pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AI Deterministic Coverage Pass

## Goal

Add a narrow, high-value non-React coverage pass for `@platejs/ai` focused on the deterministic lib seam:

- `withAIBatch.ts`
- `getEditorPrompt.ts`
- `insertAINodes.ts`
- `replacePlaceholders.ts`
- `undoAI.ts`
- `removeAINodes.ts`
- `removeAIMarks.ts`

## Constraints

- Fast-lane only.
- No `/react`.
- No model mocks, network tests, or streaming coverage.
- Prefer tiny transform and helper contracts over wrapper coverage.

## Slice

1. Add pure stub-based specs for `withAIBatch` and `undoAI`.
2. Add helper specs for prompt resolution and placeholder replacement.
3. Add real-editor specs for insert/remove AI node transforms.
4. Allow one small runtime fix if direct tests expose an actual bug.

## Notes

- Existing non-React `ai` coverage is almost empty outside `getMarkdown.spec.tsx`.
- `replacePlaceholders.ts` currently uses `String.prototype.replace`, so repeated-placeholder coverage is likely to expose a real one-occurrence bug.
- Execution confirmed that repeated placeholders were in fact broken; the helper only replaced the first occurrence of `{prompt}` and the same bug pattern applied to other placeholder tokens.
28 changes: 28 additions & 0 deletions .claude/docs/plans/2026-03-23-autoformat-coverage-pass.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Autoformat Coverage Pass

## Goal

Add a surgical, fast-lane-only coverage pass for `@platejs/autoformat` focused on the last worthwhile non-rule seams:

- `AutoformatPlugin.ts`
- `autoformatBlock.ts`
- `isPreviousCharacterEmpty.ts`

## Constraints

- No `/react`.
- No rule-table coverage.
- Keep the slice in normal `*.spec.ts[x]`.
- Prefer real editor behavior for plugin contracts and tiny stubs for pure transform helpers.

## Slice

1. Add a direct `AutoformatPlugin` spec for query veto, `insertTrigger`, and undo-on-delete array-match restore.
2. Deepen `autoformatBlock.spec.ts` for `triggerAtBlockStart: false`, `allowSameTypeAbove`, and single-character match safety.
3. Add one tiny `isPreviousCharacterEmpty` edge for empty-string ranges.
4. Stop unless a direct test exposes a real bug.

## Notes

- Existing `withAutoformat` coverage already exercises most end-to-end mark and text flows.
- The remaining value is in the plugin override seam and a few pure `autoformatBlock` branches.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Basic Styles And Math Coverage Pass
type: testing
date: 2026-03-23
status: completed
---

# Goal

Do two tiny non-React passes:

- `@platejs/basic-styles`
- `@platejs/math`

# Scope

## `basic-styles`

- `setLineHeight`
- `toUnitLess`
- `BaseLineHeightPlugin`
- `BaseFontColorPlugin`

## `math`

- `insertEquation`
- `insertInlineEquation`
- `BaseEquationPlugin`
- `BaseInlineEquationPlugin`
- `getEquationHtml`

# Explicit Deferrals

- `/react`
- broad font plugin sweep
- extra KaTeX behavior matrices

# Verification Plan

- targeted `bun test` on touched files
- `bun test packages/basic-styles/src/lib packages/math/src/lib`
- `pnpm test:profile -- --top 20 packages/basic-styles/src packages/math/src`
- `pnpm test:slowest -- --top 20 packages/basic-styles/src packages/math/src`
- `pnpm install`
- `pnpm turbo build --filter=./packages/basic-styles --filter=./packages/math`
- `pnpm turbo typecheck --filter=./packages/basic-styles --filter=./packages/math`
- `pnpm lint:fix`

# Result

- added focused `basic-styles` specs for `setLineHeight`, `toUnitLess`, `BaseLineHeightPlugin`, and `BaseFontColorPlugin`
- added focused `math` specs for `insertEquation`, `insertInlineEquation`, `BaseEquationPlugin`, `BaseInlineEquationPlugin`, and `getEquationHtml`
- verification passed:
- targeted touched-file `bun test`
- `bun test packages/basic-styles/src/lib packages/math/src/lib`
- `pnpm test:profile -- --top 20 packages/basic-styles/src packages/math/src`
- `pnpm test:slowest -- --top 20 packages/basic-styles/src packages/math/src`
- `pnpm install`
- `pnpm turbo build --filter=./packages/basic-styles --filter=./packages/math`
- `pnpm turbo typecheck --filter=./packages/basic-styles --filter=./packages/math`
- `pnpm lint:fix`
Loading
Loading