Skip to content

Use @extrachill/chat canonical diff parser, delete local fork#7

Merged
chubes4 merged 1 commit intomainfrom
use-chat-package-diff-parser
Apr 24, 2026
Merged

Use @extrachill/chat canonical diff parser, delete local fork#7
chubes4 merged 1 commit intomainfrom
use-chat-package-diff-parser

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 24, 2026

Summary

The editor carried a parallel src/diff/canonicalDiff.ts with its own CanonicalDiffType / CanonicalDiffStatus / CanonicalDiffItem / CanonicalDiffData types and its own parseCanonicalDiffFromJson. That duplication existed because the upstream parser only recognized container.diff as a nesting layer, while Data Machine's unified PendingActionHelper::stage() envelope nests the preview payload under container.preview.

@extrachill/chat@0.11.0 (just published) lands three relevant changes:

  • chat #21 — adds actionId as the canonical field on CanonicalDiffData (alongside a deprecated diffId alias). The editor already spoke actionId so no vocabulary change was needed here, but the type on the upstream package was missing it until 0.11.
  • chat #22 — forwards onToolCalls + sessionContext from <Chat> to useChat. Not used by this file directly, but relevant for other editor work.
  • chat #23parseCanonicalDiff now recognizes container.preview and container.preview_data as nesting keys. That's exactly the shape our local fork existed to handle.

With 0.11 in place, the local fork is redundant.

Migration

  • src/types.ts — import CanonicalDiffData / CanonicalDiffType from @extrachill/chat instead of ./diff/canonicalDiff.
  • src/sidebar/EditorChatSidebar.tsx — add parseCanonicalDiffFromJson to the existing @extrachill/chat imports, drop the local import.
  • Delete src/diff/canonicalDiff.ts (92 lines).
  • Bump @extrachill/chat from ^0.10.1 to ^0.11.0 in package.json.

Behaviour

No runtime change. The upstream parser now handles the same nesting shapes our fork did, and we were already consuming the actionId field which v0.11 surfaces on the typed shape.

Validation

  • npm install @extrachill/chat@^0.11.0 — resolves to 0.11.0 from the npm registry.
  • npm run typecheck — clean.
  • npm run build — clean.

Diff stat

 package-lock.json                 |  8 ++--
 package.json                      |  2 +-
 src/diff/canonicalDiff.ts         | 92 ---------------------------------------
 src/sidebar/EditorChatSidebar.tsx |  2 +-
 src/types.ts                      |  2 +-
 5 files changed, 7 insertions(+), 99 deletions(-)

AI assistance

  • AI assistance: Yes
  • Tool(s): Claude Code (Opus 4.7)
  • Used for: Identified the parallel-parser duplication during the cross-repo chat audit, drafted the upstream chat changes (#21/#22/#23) to eliminate the divergence, then cut 0.11 and migrated this consumer. Chris flagged the editor alignment and cut the release.

The editor carried a parallel `src/diff/canonicalDiff.ts` with its
own CanonicalDiffType / CanonicalDiffStatus / CanonicalDiffItem /
CanonicalDiffData types and its own parseCanonicalDiffFromJson.
That duplication existed because the upstream parser only
recognized `container.diff` as a nesting layer, while Data Machine's
unified PendingActionHelper::stage() envelope nests under `preview`.

@extrachill/chat v0.11.0 landed three relevant changes:
- #21: adds `actionId` as the canonical field on CanonicalDiffData
  (alongside the deprecated `diffId` alias). The editor already
  spoke `actionId` so no vocabulary change was needed here, but the
  type on the upstream package was missing it until 0.11.
- #22: forwards onToolCalls + sessionContext from <Chat> to useChat
  (not used by this file directly, but relevant for other editor
  work).
- #23: parseCanonicalDiff now recognizes `container.preview` and
  `container.preview_data` as nesting keys, which is exactly the
  shape our local fork existed to handle.

With 0.11 in place, the local fork is redundant. Migration:

- src/types.ts: import CanonicalDiffData / CanonicalDiffType from
  '@extrachill/chat' instead of './diff/canonicalDiff'.
- src/sidebar/EditorChatSidebar.tsx: add parseCanonicalDiffFromJson
  to the existing @extrachill/chat imports, drop the local import.
- Delete src/diff/canonicalDiff.ts (92 lines).
- Bump @extrachill/chat from ^0.10.1 to ^0.11.0 in package.json.

No runtime behaviour change — the upstream parser now handles the
same nesting shapes our fork did, and we were already consuming the
`actionId` field which v0.11 surfaces on the typed shape.
@chubes4 chubes4 merged commit b022bf8 into main Apr 24, 2026
@chubes4 chubes4 deleted the use-chat-package-diff-parser branch April 24, 2026 18:26
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.

1 participant