hunkdiff 0.12.0-beta.0 → 0.12.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ import { type FileDiffMetadata } from "@pierre/diffs";
2
+ import type { DiffFile } from "../core/types";
3
+ import type { HunkDiffFile, HunkDiffFileInput } from "./types";
4
+ /** Count visible additions and deletions from Pierre metadata. */
5
+ export declare function countHunkDiffStats(metadata: FileDiffMetadata): {
6
+ additions: number;
7
+ deletions: number;
8
+ };
9
+ /** Build Hunk's public OpenTUI file model with normalized paths and default stats. */
10
+ export declare function createHunkDiffFile(input: HunkDiffFileInput): HunkDiffFile;
11
+ /** Adapt the public OpenTUI file shape into Hunk's internal review file model. */
12
+ export declare function toInternalDiffFile(diff: HunkDiffFileInput): DiffFile;
13
+ /** Parse unified diff text into Hunk's public OpenTUI file model. */
14
+ export declare function createHunkDiffFilesFromPatch(patchText: string, sourceId?: string): HunkDiffFile[];
15
+ /** Adapt a list of public OpenTUI files into Hunk's internal review file model. */
16
+ export declare function toInternalDiffFiles(files: HunkDiffFileInput[]): DiffFile[];
@@ -0,0 +1,2 @@
1
+ export declare const HUNK_DIFF_THEME_NAMES: readonly ["graphite", "midnight", "paper", "ember"];
2
+ export type HunkDiffThemeName = (typeof HUNK_DIFF_THEME_NAMES)[number];
@@ -0,0 +1,76 @@
1
+ import type { FileDiffMetadata } from "@pierre/diffs";
2
+ import type { HunkDiffThemeName } from "./themes";
3
+ export type HunkDiffLayout = "split" | "stack";
4
+ /** Line stats shown by public Hunk OpenTUI primitives. */
5
+ export interface HunkDiffStats {
6
+ additions: number;
7
+ deletions: number;
8
+ }
9
+ /** Input accepted by public OpenTUI components before defaults are normalized. */
10
+ export interface HunkDiffFileInput {
11
+ id: string;
12
+ metadata: FileDiffMetadata;
13
+ language?: string;
14
+ path?: string;
15
+ previousPath?: string;
16
+ patch?: string;
17
+ stats?: HunkDiffStats;
18
+ isBinary?: boolean;
19
+ isTooLarge?: boolean;
20
+ isUntracked?: boolean;
21
+ statsTruncated?: boolean;
22
+ }
23
+ /** Normalized diff file returned by createHunkDiffFile and patch helpers. */
24
+ export interface HunkDiffFile extends Omit<HunkDiffFileInput, "stats"> {
25
+ stats: HunkDiffStats;
26
+ }
27
+ export interface HunkDiffSelection {
28
+ fileId: string;
29
+ hunkIndex: number;
30
+ }
31
+ /** Public props shared by single-file diff body and view components. */
32
+ export interface HunkDiffBodyProps {
33
+ file?: HunkDiffFileInput;
34
+ layout?: HunkDiffLayout;
35
+ width: number;
36
+ theme?: HunkDiffThemeName;
37
+ showLineNumbers?: boolean;
38
+ showHunkHeaders?: boolean;
39
+ wrapLines?: boolean;
40
+ horizontalOffset?: number;
41
+ highlight?: boolean;
42
+ selectedHunkIndex?: number;
43
+ }
44
+ /** Public props for the reusable OpenTUI diff convenience component. */
45
+ export interface HunkDiffViewProps extends Omit<HunkDiffBodyProps, "file"> {
46
+ diff?: HunkDiffFileInput;
47
+ scrollable?: boolean;
48
+ }
49
+ export interface HunkDiffFileHeaderProps {
50
+ file: HunkDiffFileInput;
51
+ width: number;
52
+ theme?: HunkDiffThemeName;
53
+ onSelect?: () => void;
54
+ }
55
+ export interface HunkReviewStreamProps {
56
+ files: HunkDiffFileInput[];
57
+ layout?: HunkDiffLayout;
58
+ width: number;
59
+ theme?: HunkDiffThemeName;
60
+ selection?: HunkDiffSelection;
61
+ showFileHeaders?: boolean;
62
+ showFileSeparators?: boolean;
63
+ showLineNumbers?: boolean;
64
+ showHunkHeaders?: boolean;
65
+ wrapLines?: boolean;
66
+ horizontalOffset?: number;
67
+ highlight?: boolean;
68
+ onSelectionChange?: (selection: HunkDiffSelection) => void;
69
+ }
70
+ export interface HunkFileNavProps {
71
+ files: HunkDiffFileInput[];
72
+ selectedFileId?: string;
73
+ width: number;
74
+ theme?: HunkDiffThemeName;
75
+ onSelectFile?: (fileId: string) => void;
76
+ }
package/package.json CHANGED
@@ -1,16 +1,25 @@
1
1
  {
2
2
  "name": "hunkdiff",
3
- "version": "0.12.0-beta.0",
3
+ "version": "0.12.0-beta.1",
4
4
  "description": "Desktop-inspired terminal diff viewer for understanding agent-authored changesets.",
5
5
  "bin": {
6
6
  "hunk": "./bin/hunk.cjs"
7
7
  },
8
8
  "files": [
9
9
  "bin",
10
+ "dist/npm",
10
11
  "skills",
11
12
  "README.md",
12
13
  "LICENSE"
13
14
  ],
15
+ "type": "module",
16
+ "exports": {
17
+ "./opentui": {
18
+ "types": "./dist/npm/opentui/index.d.ts",
19
+ "import": "./dist/npm/opentui/index.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
14
23
  "keywords": [
15
24
  "ai",
16
25
  "code-review",
@@ -30,11 +39,23 @@
30
39
  "engines": {
31
40
  "node": ">=18"
32
41
  },
42
+ "dependencies": {
43
+ "@pierre/diffs": "^1.1.19",
44
+ "bun": "^1.3.10",
45
+ "commander": "^14.0.3",
46
+ "diff": "^8.0.3",
47
+ "zod": "^4.3.6"
48
+ },
49
+ "peerDependencies": {
50
+ "@opentui/core": "^0.1.88",
51
+ "@opentui/react": "^0.1.88",
52
+ "react": "^19.2.4"
53
+ },
33
54
  "optionalDependencies": {
34
- "hunkdiff-darwin-arm64": "0.12.0-beta.0",
35
- "hunkdiff-darwin-x64": "0.12.0-beta.0",
36
- "hunkdiff-linux-arm64": "0.12.0-beta.0",
37
- "hunkdiff-linux-x64": "0.12.0-beta.0"
55
+ "hunkdiff-darwin-arm64": "0.12.0-beta.1",
56
+ "hunkdiff-darwin-x64": "0.12.0-beta.1",
57
+ "hunkdiff-linux-arm64": "0.12.0-beta.1",
58
+ "hunkdiff-linux-x64": "0.12.0-beta.1"
38
59
  },
39
60
  "license": "MIT",
40
61
  "publishConfig": {