Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ That keeps the viewer static-hosting friendly while removing the brittle parts o

## Bundle tradeoffs

The largest remaining deferred cost is still the diff renderer stack, primarily `@git-diff-view/*` and its highlighting internals. Its vendor stylesheet is served from `public/vendor/diff-view-pure.css` with a precompressed `.css.br` variant and injected only when a rich diff mounts, so the empty shell and non-diff artifacts do not pay that CSS cost. The stack remains because it still provides the best review-style UX for multi-file git patches, split/unified modes, and syntax-aware rendering with less product code than a bespoke replacement.
The largest remaining deferred cost is still the diff renderer stack, now `@pierre/diffs` with its Shiki grammars. There is no vendor stylesheet: styles ship inside the library's shadow roots, so the empty shell and non-diff artifacts pay no diff CSS or JS cost at all — the whole stack loads only when a diff artifact mounts, behind the existing `next/dynamic` boundary.

The JSON and markdown paths are now substantially lighter because:

Expand All @@ -71,12 +71,13 @@ The JSON and markdown paths are now substantially lighter because:

## Diff choice

`agent-render` uses `@git-diff-view/react` plus git-diff `DiffFile` instances instead of `@codemirror/merge`.
`agent-render` uses `@pierre/diffs` (`PatchDiff` per parsed patch file, `MultiFileDiff` for before/after contents) instead of `@codemirror/merge`.

- `@git-diff-view/*` matches the product goal better because it is already shaped like a GitHub-style review surface
- split and unified views are built in
- syntax highlighting and diff affordances are stronger out of the box for artifact viewing
- individual file patches can be rendered as a sequence while preserving filenames and boundaries
- `@pierre/diffs` matches the product goal better because it is already shaped like a review surface
- split and unified views are built in (`diffStyle` option)
- Shiki-based syntax highlighting is stronger out of the box for artifact viewing
- individual file patches can be rendered as a sequence while preserving filenames and boundaries via the repo's own `parseGitPatchBundle`
- before/after content diffs are computed by the library itself, which the previous stack could not do from raw contents
- CodeMirror remains the better fit for full source artifacts and markdown code fences

`@codemirror/merge` stays a reasonable future option if the project ever needs a more editor-centric comparison workflow, but it is not the best default for shareable review artifacts.
Expand Down
4 changes: 2 additions & 2 deletions docs/dependency-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- `rehype-sanitize` - MIT
- `@codemirror/*` - MIT
- `@replit/codemirror-indentation-markers` - MIT
- `@git-diff-view/*` - MIT
- `@pierre/diffs` - Apache-2.0
- `papaparse` - MIT
- `lz-string` - MIT
- `fflate` - MIT
Expand All @@ -30,7 +30,7 @@
- `next` pins its nested `postcss` dependency to `8.5.14` via `package.json` overrides so Tailwind CSS v4's `postcss ^8.5.6` peer range is satisfied in the Next.js toolchain.
- CodeMirror handles source artifacts and markdown code fences because it is excellent at read-only code presentation; JSON, markdown raw, and CSV raw views use lighter native source blocks.
- `@replit/codemirror-indentation-markers` replaces custom indent-guide logic with a maintained CM6 extension.
- `@git-diff-view/*` fits review-style diffs better than a generic merge editor for the current viewer. Its pure CSS file is mirrored into `public/vendor/diff-view-pure.css` with a Brotli-compressed `public/vendor/diff-view-pure.css.br` copy by `npm run assets:compress`, and loaded only by the diff renderer; `tests/diff-style-asset.test.ts` keeps those assets in sync with the package copy.
- `@pierre/diffs` (diffs.com) renders review-style diffs from patch strings (`PatchDiff`) or raw before/after contents (`MultiFileDiff`). It is Shiki-based, styles itself inside shadow DOM (no vendor stylesheet to mirror or serve), and is themed through `--diffs-*` CSS custom properties set on `.diff-renderer-frame`. It is imported only through the `src/lib/diff/pierre-react.ts` bridge so the deferred chunk stays stable across webpack graphs.
- `papaparse` handles CSV parsing; CSV rendering uses a native read-only table to avoid a data-grid dependency for the shipped static viewer.
- `fflate` provides portable deflate/inflate support across iOS Safari and Android Chromium without relying on browser-specific compression streams.
- `brotli-wasm` provides the arx/arx2/arx3 Brotli compression layer, including streaming decompression used to cap expanded output before allocating oversized decoded payloads.
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The suite is intentionally split by responsibility:
- visual tests protect empty state, artifact views, theme presentation, and compact-content spacing
- component tests protect selector/disclosure UI contracts
- unit tests protect transport codecs, envelope validation, diff parsing, and language inference
- `npm run assets:compress` regenerates minified/precompressed public assets, including the ARX dictionaries and mirrored diff-view stylesheet
- `npm run assets:compress` regenerates minified/precompressed public assets (the ARX dictionaries)
- `npm run bench:codecs` protects arx/arx2 compressed-byte ratios and arx3 visible-character wins against the committed `scripts/bench-baseline.json`; its corpus is fixed in `scripts/bench-codecs.mjs` so unrelated source, docs, or package metadata edits do not create false codec regressions
- `npm run check:build-budgets` reads the generated `.next` manifests after `npm run build` and fails if the homepage shell or key deferred renderer chunks exceed their gzip budgets

Expand Down
Loading
Loading