You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/23 21:12:00 UTC
(maka) 02/02: refactor(ui): remove unused diff line classifier
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch fix/edit-span-diff
in repository https://gitbox.apache.org/repos/asf/maka.git
commit 16f607e63e6270abc60e03d6b52ef3ff595517e6
Author: AstroHan <le...@outlook.com>
AuthorDate: Mon Aug 24 05:11:20 2026 +0800
refactor(ui): remove unused diff line classifier
DiffCodePreview owns diff row classification, leaving the former tool-result helper and barrel export without consumers.
Generated-by: Codex
---
packages/ui/src/index.ts | 5 -----
.../ui/src/tool-activity/tool-result-preview.tsx | 22 ----------------------
2 files changed, 27 deletions(-)
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index a51d3b729..ed46774b2 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -75,11 +75,6 @@ export { Card, type CardProps, type CardVariant } from '@astryxdesign/core';
// cross-package consumer — `apps/desktop`'s `artifact-preview.tsx` — which is the
// promotion condition the off-barrel convention named, so the export is the rule.
export { previewVariants } from './primitives/chat.js';
-// `diffLineKind` rides the same seam for the same reason: it decides the
-// `data-line` values those parts are selected by, so a second copy of it is a
-// second answer to "what colour is this line". `apps/desktop` had one, and the
-// two had already diverged on `diff --git` / `index` headers.
-export { diffLineKind } from './tool-activity/tool-result-preview.js';
export { DiffCodePreview } from './tool-activity/diff-code-preview.js';
export { syntaxLanguageForPath } from './tool-activity/diff-syntax.js';
export { MarkdownBody } from './markdown-body.js';
diff --git a/packages/ui/src/tool-activity/tool-result-preview.tsx b/packages/ui/src/tool-activity/tool-result-preview.tsx
index e3274e818..a78e88dab 100644
--- a/packages/ui/src/tool-activity/tool-result-preview.tsx
+++ b/packages/ui/src/tool-activity/tool-result-preview.tsx
@@ -304,28 +304,6 @@ function PtyControlPreview(props: {
);
}
-/**
- * Which tint a unified-diff line takes. Deliberately shallow: it reads the
- * line's first character, not the hunk semantics, which is all the colouring
- * needs and all a preview should promise.
- *
- * `+++`/`---` are file markers, not an addition and a deletion — they have to
- * be tested before the single-character cases or every diff opens with one
- * green and one red line that mean nothing.
- */
-export function diffLineKind(line: string): 'add' | 'del' | 'hunk' | 'meta' | 'ctx' {
- // The trailing space is what separates a file marker from content: unified
- // diff writes `--- a/path`, never a bare `---`. Without it, deleting a YAML
- // document separator or an SQL `--` comment paints the removal as a header —
- // the one line the reader most needs to see as red.
- if (line.startsWith('--- ') || line.startsWith('+++ ')) return 'meta';
- if (line.startsWith('@@')) return 'hunk';
- if (line.startsWith('+')) return 'add';
- if (line.startsWith('-')) return 'del';
- if (line.startsWith('diff ') || line.startsWith('index ')) return 'meta';
- return 'ctx';
-}
-
/**
* Line-level diff colouring — green additions, red deletions, a tinted hunk
* header — in the same surface a command uses, with the changed paths as its
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org