@nkzw/codiff-core 1.8.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.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/SharedPlanApp.d.ts +32 -0
  4. package/dist/SharedWalkthroughApp.d.ts +40 -0
  5. package/dist/app/components/Avatar.d.ts +6 -0
  6. package/dist/app/components/Button.d.ts +12 -0
  7. package/dist/app/components/CommandBar.d.ts +8 -0
  8. package/dist/app/components/FileTree.d.ts +10 -0
  9. package/dist/app/components/KeyboardShortcutsHelp.d.ts +5 -0
  10. package/dist/app/components/MarkdownDocumentEditor.d.ts +26 -0
  11. package/dist/app/components/Panels.d.ts +71 -0
  12. package/dist/app/components/PlanEditorView.d.ts +18 -0
  13. package/dist/app/components/ReadOnlyMarkdownView.d.ts +16 -0
  14. package/dist/app/components/ReviewCodeView.d.ts +103 -0
  15. package/dist/app/components/Sidebar.d.ts +48 -0
  16. package/dist/app/components/WalkthroughFileError.d.ts +4 -0
  17. package/dist/app/components/merge-request/GeneralComments.d.ts +49 -0
  18. package/dist/app/components/useCopiedState.d.ts +1 -0
  19. package/dist/app/components/walkthrough/CommitView.d.ts +23 -0
  20. package/dist/app/components/walkthrough/NarrativeSidebar.d.ts +12 -0
  21. package/dist/app/components/walkthrough/NarrativeWalkthroughView.d.ts +44 -0
  22. package/dist/app/components/walkthrough/WalkthroughDiffSurface.d.ts +16 -0
  23. package/dist/app/components/walkthrough/WalkthroughProgress.d.ts +8 -0
  24. package/dist/app/components/walkthrough/parts.d.ts +15 -0
  25. package/dist/app/components/walkthrough/useNarrativeNavigation.d.ts +34 -0
  26. package/dist/app/hooks/useAppCommands.d.ts +22 -0
  27. package/dist/app/hooks/useAppKeyboardShortcuts.d.ts +18 -0
  28. package/dist/app/hooks/useAppReviewComments.d.ts +38 -0
  29. package/dist/app/hooks/useAppWalkthrough.d.ts +96 -0
  30. package/dist/app/hooks/useDiffSearch.d.ts +24 -0
  31. package/dist/app/hooks/useDocumentAppearance.d.ts +10 -0
  32. package/dist/app/hooks/useResizableSidebar.d.ts +12 -0
  33. package/dist/app/hooks/useReviewCommentDrafts.d.ts +23 -0
  34. package/dist/app/hooks/useReviewState.d.ts +22 -0
  35. package/dist/config/defaults.d.ts +4 -0
  36. package/dist/config/keymap.d.ts +3 -0
  37. package/dist/config/types.d.ts +44 -0
  38. package/dist/defaults.d.ts +2 -0
  39. package/dist/fonts/firacode/FiraCode-Regular.woff2 +0 -0
  40. package/dist/fonts/firacode/FiraCode-SemiBold.woff2 +0 -0
  41. package/dist/index.d.ts +3 -0
  42. package/dist/index.mjs +12 -0
  43. package/dist/lib/app-constants.d.ts +7 -0
  44. package/dist/lib/app-types.d.ts +137 -0
  45. package/dist/lib/code-view-options.d.ts +26 -0
  46. package/dist/lib/command-registry.d.ts +14 -0
  47. package/dist/lib/diff-search.d.ts +3 -0
  48. package/dist/lib/diff.d.ts +35 -0
  49. package/dist/lib/files.d.ts +14 -0
  50. package/dist/lib/item-version.d.ts +1 -0
  51. package/dist/lib/keyboard.d.ts +2 -0
  52. package/dist/lib/markdown.d.ts +3 -0
  53. package/dist/lib/narrative-walkthrough-diff.d.ts +113 -0
  54. package/dist/lib/narrative-walkthrough-diff.mjs +257 -0
  55. package/dist/lib/narrative-walkthrough.d.ts +108 -0
  56. package/dist/lib/reload-selection.d.ts +23 -0
  57. package/dist/lib/review-command-target.d.ts +15 -0
  58. package/dist/lib/review-comments.d.ts +29 -0
  59. package/dist/lib/review-identity.d.ts +7 -0
  60. package/dist/lib/review-scroll.d.ts +5 -0
  61. package/dist/lib/search-highlights.d.ts +5 -0
  62. package/dist/lib/sidebar-width.d.ts +9 -0
  63. package/dist/lib/source.d.ts +18 -0
  64. package/dist/lib/viewed.d.ts +2 -0
  65. package/dist/react.d.ts +3 -0
  66. package/dist/react.mjs +9355 -0
  67. package/dist/share.d.ts +301 -0
  68. package/dist/share.mjs +103 -0
  69. package/dist/style.css +9142 -0
  70. package/dist/styles.css.d.ts +2 -0
  71. package/dist/types.d.ts +702 -0
  72. package/package.json +71 -0
@@ -0,0 +1,2 @@
1
+ declare const css: string;
2
+ export default css;
@@ -0,0 +1,702 @@
1
+ import type { MarkdownAnnotationAnchor } from '@nkzw/mdx-editor';
2
+ import type { CodiffDiffStyle } from './config/types.ts';
3
+ export type DiffSection = {
4
+ binary: boolean;
5
+ id: string;
6
+ kind: 'commit' | 'pull-request' | 'staged' | 'unstaged';
7
+ loadState?: 'binary' | 'deferred' | 'directory' | 'error' | 'ready' | 'too-large';
8
+ newFile?: {
9
+ cacheKey?: string;
10
+ contents: string;
11
+ name: string;
12
+ };
13
+ oldFile?: {
14
+ cacheKey?: string;
15
+ contents: string;
16
+ name: string;
17
+ };
18
+ patch: string;
19
+ summary?: {
20
+ canLoad?: boolean;
21
+ fileCount?: number;
22
+ fingerprint?: string;
23
+ limit?: number;
24
+ reason: string;
25
+ size?: number;
26
+ };
27
+ };
28
+ export type GitFileStatus = 'added' | 'deleted' | 'modified' | 'renamed' | 'untracked';
29
+ export type ChangedFile = {
30
+ fingerprint: string;
31
+ generated?: boolean;
32
+ oldPath?: string;
33
+ path: string;
34
+ sections: ReadonlyArray<DiffSection>;
35
+ status: GitFileStatus;
36
+ };
37
+ export type ReviewAuthor = {
38
+ avatarUrl?: string;
39
+ login: string;
40
+ name?: string;
41
+ url?: string;
42
+ };
43
+ export type PullRequestReviewer = ReviewAuthor & {
44
+ approved: boolean;
45
+ id: string;
46
+ };
47
+ export type PullRequestReviewActionStatus = {
48
+ disabled?: boolean;
49
+ reason?: string;
50
+ };
51
+ export type PullRequestReviewStatus = {
52
+ approve?: PullRequestReviewActionStatus;
53
+ close?: PullRequestReviewActionStatus;
54
+ comment?: PullRequestReviewActionStatus;
55
+ requestChanges?: PullRequestReviewActionStatus;
56
+ };
57
+ export type PullRequestMergeCheckStatus = 'failed' | 'neutral' | 'pending' | 'success';
58
+ export type PullRequestMergeCheck = {
59
+ detail?: string;
60
+ label: string;
61
+ status: PullRequestMergeCheckStatus;
62
+ url?: string;
63
+ };
64
+ export type PullRequestMergeOptions = {
65
+ removeSourceBranch: boolean;
66
+ squash: boolean;
67
+ };
68
+ export type PullRequestCodeQualityFinding = {
69
+ description: string;
70
+ engineName?: string;
71
+ filePath: string;
72
+ fingerprint: string;
73
+ lineNumber: number;
74
+ severity: 'blocker' | 'critical' | 'info' | 'major' | 'minor' | 'unknown';
75
+ status: 'existing' | 'new' | 'resolved';
76
+ url?: string;
77
+ };
78
+ export type PullRequestMergeState = {
79
+ autoMergeEnabled: boolean;
80
+ canCancelAutoMerge: boolean;
81
+ canMerge: boolean;
82
+ canSetAutoMerge: boolean;
83
+ checks: ReadonlyArray<PullRequestMergeCheck>;
84
+ detailedStatus?: string;
85
+ forceRemoveSourceBranch: boolean;
86
+ mergeError?: string;
87
+ options: PullRequestMergeOptions;
88
+ reason?: string;
89
+ sha: string;
90
+ status: 'blocked' | 'checking' | 'closed' | 'merged' | 'ready' | 'waiting';
91
+ statusLabel: string;
92
+ };
93
+ export type ReviewSource = {
94
+ type: 'working-tree';
95
+ } | {
96
+ ref: string;
97
+ type: 'commit';
98
+ } | {
99
+ ref: string;
100
+ type: 'branch';
101
+ } | {
102
+ /** Resolved base commit for a branch diff snapshot. */
103
+ baseRef: string;
104
+ /** Resolved head commit for a branch diff snapshot. */
105
+ headRef: string;
106
+ /** Target branch the current branch was compared against. */
107
+ ref: string;
108
+ type: 'branch-diff';
109
+ } | {
110
+ /**
111
+ * Resolved base commit for the branch part of the comparison. Optional
112
+ * because the CLI can construct this source from just a branch name
113
+ * (`codiff main`), before merge-base resolution happens; the resolved
114
+ * state's `source` always carries a concrete value.
115
+ */
116
+ baseRef?: string;
117
+ /** Resolved head commit for the branch part of the comparison. See {@link baseRef}. */
118
+ headRef?: string;
119
+ /** Target branch the current branch was compared against. */
120
+ ref: string;
121
+ type: 'branch-working-tree';
122
+ } | {
123
+ /** Base ref (left side). For symmetric ranges the diff starts at its merge-base with head. */
124
+ base: string;
125
+ /** Head ref (right side). */
126
+ head: string;
127
+ /** `true` for `base...head` (merge-base), `false` for `base..head` (direct). */
128
+ symmetric: boolean;
129
+ type: 'range';
130
+ } | {
131
+ author?: ReviewAuthor;
132
+ canEditDescription?: boolean;
133
+ canEditReviewers?: boolean;
134
+ canEditTitle?: boolean;
135
+ description?: string;
136
+ headSha?: string;
137
+ host?: string;
138
+ mergeState?: PullRequestMergeState;
139
+ number?: number;
140
+ owner?: string;
141
+ projectPath?: string;
142
+ provider?: 'github' | 'gitlab';
143
+ repo?: string;
144
+ reviewers?: ReadonlyArray<PullRequestReviewer>;
145
+ reviewStatus?: PullRequestReviewStatus;
146
+ title?: string;
147
+ type: 'pull-request';
148
+ url: string;
149
+ };
150
+ export type HistoryEntry = {
151
+ author: string;
152
+ committedAt: number;
153
+ gravatarUrl?: string;
154
+ parents: ReadonlyArray<string>;
155
+ ref: string;
156
+ scope?: 'base' | 'pull-request';
157
+ subject: string;
158
+ };
159
+ export type CommitMetadataPerson = {
160
+ date: string;
161
+ email: string;
162
+ gravatarUrl?: string;
163
+ name: string;
164
+ };
165
+ export type CommitMetadataFile = {
166
+ additions?: number;
167
+ binary: boolean;
168
+ deletions?: number;
169
+ oldPath?: string;
170
+ path: string;
171
+ status: GitFileStatus;
172
+ };
173
+ export type CommitMetadata = {
174
+ author: CommitMetadataPerson;
175
+ body: string;
176
+ committer: CommitMetadataPerson;
177
+ files: ReadonlyArray<CommitMetadataFile>;
178
+ parents: ReadonlyArray<string>;
179
+ ref: string;
180
+ refs: ReadonlyArray<string>;
181
+ shortRef: string;
182
+ signature: {
183
+ key?: string;
184
+ signer?: string;
185
+ status: string;
186
+ };
187
+ stats: {
188
+ additions: number;
189
+ binaryFiles: number;
190
+ deletions: number;
191
+ files: number;
192
+ renamedFiles: number;
193
+ };
194
+ subject: string;
195
+ trailers: ReadonlyArray<{
196
+ key: string;
197
+ value: string;
198
+ }>;
199
+ };
200
+ export type RepositoryHistory = {
201
+ entries: ReadonlyArray<HistoryEntry>;
202
+ root: string;
203
+ };
204
+ export type RepositoryState = {
205
+ branch: string | null;
206
+ codeQualityFindings?: ReadonlyArray<PullRequestCodeQualityFinding>;
207
+ commitMetadata?: CommitMetadata;
208
+ files: ReadonlyArray<ChangedFile>;
209
+ generalComments?: ReadonlyArray<PullRequestGeneralCommentThread>;
210
+ generatedAt: number;
211
+ launchPath: string;
212
+ reviewComments?: ReadonlyArray<PullRequestExistingReviewComment>;
213
+ root: string;
214
+ source: ReviewSource;
215
+ };
216
+ export type CodiffFeatureFlags = {
217
+ planSharing: boolean;
218
+ walkthroughSharing: boolean;
219
+ };
220
+ export type WalkthroughProgressPhase = 'agent-generation' | 'response-received';
221
+ export type WalkthroughProgressEvent = {
222
+ phase: WalkthroughProgressPhase;
223
+ };
224
+ export type CodiffMarkdownDocument = {
225
+ content: string;
226
+ id: string;
227
+ kind: 'plan' | 'repository';
228
+ path: string;
229
+ version: string;
230
+ };
231
+ export type SaveMarkdownDocumentRequest = {
232
+ baseVersion: string;
233
+ content: string;
234
+ kind: CodiffMarkdownDocument['kind'];
235
+ path: string;
236
+ };
237
+ export type SaveMarkdownDocumentResult = {
238
+ document: CodiffMarkdownDocument;
239
+ status: 'conflict';
240
+ } | {
241
+ document: CodiffMarkdownDocument;
242
+ status: 'saved';
243
+ };
244
+ export type PlanCommentAuthor = {
245
+ avatarUrl?: string;
246
+ email?: string;
247
+ id: string;
248
+ name: string;
249
+ username?: string;
250
+ };
251
+ export type PlanCommentMessage = {
252
+ author: PlanCommentAuthor;
253
+ body: string;
254
+ canDelete?: boolean;
255
+ canEdit?: boolean;
256
+ createdAt: string;
257
+ id: string;
258
+ updatedAt: string;
259
+ };
260
+ export type PlanCommentThread = {
261
+ anchor: MarkdownAnnotationAnchor;
262
+ canReply?: boolean;
263
+ canResolve?: boolean;
264
+ createdAt: string;
265
+ createdBy: PlanCommentAuthor;
266
+ id: string;
267
+ messages: ReadonlyArray<PlanCommentMessage>;
268
+ resolution?: {
269
+ reason: 'agent-handled' | 'anchor-removed';
270
+ resolvedAt: string;
271
+ };
272
+ status: 'open' | 'resolved';
273
+ updatedAt: string;
274
+ };
275
+ export type PlanReview = {
276
+ document: {
277
+ id: string;
278
+ path: string;
279
+ version: string;
280
+ };
281
+ threads: ReadonlyArray<PlanCommentThread>;
282
+ version: 1;
283
+ };
284
+ export type PlanHandoffStatus = 'closed' | 'done';
285
+ export type SharedWalkthroughSnapshot = {
286
+ branch: string | null;
287
+ codeQualityFindings?: ReadonlyArray<PullRequestCodeQualityFinding>;
288
+ codiffVersion: string;
289
+ exportedAt: string;
290
+ files: ReadonlyArray<ChangedFile>;
291
+ kind: 'codiff-walkthrough-share';
292
+ preferences: Pick<CodiffPreferences, 'codeFontFamily' | 'codeFontSize' | 'diffStyle' | 'showWhitespace' | 'theme' | 'wordWrap'>;
293
+ repository: {
294
+ generalComments?: ReadonlyArray<PullRequestGeneralCommentThread>;
295
+ root: string;
296
+ source: ReviewSource;
297
+ title?: string;
298
+ };
299
+ reviewComments?: ReadonlyArray<PullRequestExistingReviewComment>;
300
+ version: 1;
301
+ walkthrough: NarrativeWalkthrough;
302
+ };
303
+ export type SharedPlanSnapshot = {
304
+ codiffVersion: string;
305
+ document: {
306
+ content: string;
307
+ name: string;
308
+ title: string;
309
+ };
310
+ exportedAt: string;
311
+ kind: 'codiff-plan-share';
312
+ preferences: Pick<CodiffPreferences, 'theme'>;
313
+ review: {
314
+ threads: ReadonlyArray<PlanCommentThread>;
315
+ version: 1;
316
+ };
317
+ source?: {
318
+ agent?: 'claude' | 'codex' | 'opencode' | 'pi';
319
+ sessionId?: string;
320
+ };
321
+ version: 1;
322
+ };
323
+ export type WalkthroughShareManifestV1 = SharedWalkthroughSnapshot;
324
+ export type ShareResult = {
325
+ status: 'uploaded';
326
+ url: string;
327
+ } | {
328
+ reason: string;
329
+ status: 'failed';
330
+ };
331
+ export type SharePlanResult = ShareResult;
332
+ export type ShareWalkthroughResult = ShareResult;
333
+ export type WalkthroughContext = {
334
+ changedFiles?: ReadonlyArray<{
335
+ path: string;
336
+ rationale?: string;
337
+ role: string;
338
+ }>;
339
+ constraints?: ReadonlyArray<string>;
340
+ decisions?: ReadonlyArray<string>;
341
+ implementationSummary?: string;
342
+ messages?: ReadonlyArray<{
343
+ role: 'assistant' | 'user';
344
+ text: string;
345
+ }>;
346
+ objective?: string;
347
+ risks?: ReadonlyArray<string>;
348
+ source: {
349
+ generatedAt: string;
350
+ threadId?: string;
351
+ type: 'codex-session' | 'codex-session-excerpt' | 'claude-session' | 'claude-session-excerpt' | 'opencode-session' | 'opencode-session-excerpt' | 'pi-session' | 'pi-session-excerpt';
352
+ };
353
+ validation?: ReadonlyArray<string>;
354
+ version: 1;
355
+ };
356
+ export type CodiffLaunchOptions = {
357
+ agentBackend?: 'codex' | 'claude' | 'opencode' | 'pi';
358
+ claudeSessionId?: string;
359
+ codexSessionId?: string;
360
+ opencodeSessionId?: string;
361
+ piSessionId?: string;
362
+ /** Exact Markdown file opened by the blocking plan handoff. */
363
+ planFile?: string;
364
+ /** Result file used to resume the waiting agent process. */
365
+ planResultFile?: string;
366
+ repositoryPathProvided: boolean;
367
+ source?: ReviewSource;
368
+ walkthrough: boolean;
369
+ walkthroughContext?: WalkthroughContext;
370
+ /** Path to a pre-authored {@link NarrativeWalkthrough} JSON file (--walkthrough-file). */
371
+ walkthroughFile?: string;
372
+ };
373
+ export type AgentSkillStatus = {
374
+ installed: boolean;
375
+ path: string;
376
+ };
377
+ /** @deprecated Use {@link AgentSkillStatus}. */
378
+ export type CodexSkillStatus = AgentSkillStatus;
379
+ export type TerminalHelperStatus = {
380
+ command: string;
381
+ installed: boolean;
382
+ path: string;
383
+ };
384
+ /**
385
+ * Narrative Walkthrough. The agent authors chapters, stops, and support groups
386
+ * around deterministic hunk ids. Codiff resolves those ids against the live diff
387
+ * and computes file paths, anchors, and line counts.
388
+ */
389
+ export type WalkthroughIcon = 'bug' | 'wrench' | 'path' | 'flask' | 'beaker' | 'doc' | 'gear';
390
+ /** Where a walkthrough hunk points into the live diff. */
391
+ export type WalkthroughAnchor = {
392
+ /** Human-readable location, e.g. 'src/App.tsx:311' or 'src/hooks/useHunkOrder.ts (new)'. */
393
+ display: string;
394
+ /** End line on the {@link side} (inclusive). */
395
+ endLine?: number;
396
+ /** Matches {@link DiffSection.id}, e.g. 'src/App.tsx:staged'. */
397
+ sectionId?: string;
398
+ sectionKind?: DiffSection['kind'];
399
+ side?: 'additions' | 'deletions' | 'both';
400
+ /** Start line on the {@link side}. */
401
+ startLine?: number;
402
+ };
403
+ /** A short header note rendered above one focused walkthrough hunk diff. */
404
+ export type WalkthroughHunkNote = {
405
+ body: string;
406
+ hunkId: string;
407
+ };
408
+ /**
409
+ * Change-type tag shown on a file row in the commit composer. Mirrors the
410
+ * walkthrough's narrative roles so a reviewer recognises each file at a glance.
411
+ */
412
+ export type WalkthroughChangeType = 'fix' | 'feature' | 'refactor' | 'test' | 'generated' | 'lockfile' | 'snapshot' | 'i18n' | 'docs';
413
+ /** One resolved hunk selected by a walkthrough item, in agent-requested order. */
414
+ export type WalkthroughHunk = {
415
+ added: number;
416
+ additionEnd?: number;
417
+ additionStart?: number;
418
+ anchor: WalkthroughAnchor;
419
+ deleted: number;
420
+ deletionEnd?: number;
421
+ deletionStart?: number;
422
+ id: string;
423
+ /** `synthetic` hunks represent binary, deferred, or metadata-only review units. */
424
+ kind?: 'patch' | 'synthetic';
425
+ oldPath?: string;
426
+ path: string;
427
+ status: GitFileStatus;
428
+ };
429
+ /** Shared hunk-backed fields for a stop or support group. */
430
+ export type WalkthroughHunkGroup = {
431
+ added: number;
432
+ /** Change-type tag for the commit composer's file row. */
433
+ changeType?: WalkthroughChangeType;
434
+ /** One-line note the generated commit body uses for this file (falls back to {@link summary}). */
435
+ commitNote?: string;
436
+ deleted: number;
437
+ /** Deterministic hunk ids selected by the authoring agent, in display order. */
438
+ hunkIds: ReadonlyArray<string>;
439
+ /** Resolved hunks with Codiff-computed anchors, file paths, status, and line counts. */
440
+ hunks: ReadonlyArray<WalkthroughHunk>;
441
+ /** Stable within the document, e.g. 's1'. */
442
+ id: string;
443
+ /** Optional header notes for individual hunk ids in this item. */
444
+ notes?: ReadonlyArray<WalkthroughHunkNote>;
445
+ /** Short, plain-text gist of the slice. */
446
+ summary?: string;
447
+ title?: string;
448
+ };
449
+ /** One stop in the main walkthrough path. */
450
+ export type WalkthroughStop = WalkthroughHunkGroup & {
451
+ importance: 'critical' | 'normal' | 'context';
452
+ /** Agent narration (markdown / inline code). */
453
+ prose: string;
454
+ };
455
+ /** A changed hunk group kept off the main path. */
456
+ export type WalkthroughSupportGroup = WalkthroughHunkGroup & {
457
+ note?: string;
458
+ /** Why it is off the path, e.g. 'Generated' | 'Lockfile' | 'Snapshot' | 'Mechanical'. */
459
+ reason: string;
460
+ };
461
+ /** A named chapter in the walkthrough. */
462
+ export type WalkthroughChapter = {
463
+ blurb: string;
464
+ icon: WalkthroughIcon;
465
+ id: string;
466
+ stops: ReadonlyArray<WalkthroughStop>;
467
+ title: string;
468
+ };
469
+ /**
470
+ * Marks the walkthrough's diff as a staging set that can be committed and seeds
471
+ * the commit composer Codiff renders as the walkthrough's terminal stop. Only
472
+ * honored when {@link NarrativeWalkthrough.source} is a working tree — you can
473
+ * only commit a live staging set, never a past commit, branch, or pull request.
474
+ */
475
+ export type WalkthroughCommit = {
476
+ /**
477
+ * The agent-drafted commit body — a few paragraphs of prose describing the
478
+ * change as a whole. Shown editable by default; the reviewer can rewrite it,
479
+ * or ask the agent to regenerate it for a narrowed file selection.
480
+ */
481
+ body?: string;
482
+ /** Suggested first line for the commit message. */
483
+ title?: string;
484
+ };
485
+ export type NarrativeWalkthrough = {
486
+ agent: 'codex' | 'claude' | 'opencode' | 'pi';
487
+ chapters: ReadonlyArray<WalkthroughChapter>;
488
+ /**
489
+ * When present, the diff is a committable staging set: Codiff adds a commit
490
+ * composer at the end of the walkthrough. Stripped unless `source` is a working tree.
491
+ */
492
+ commit?: WalkthroughCommit;
493
+ /** The originating conversation, embedded for in-app Q&A. */
494
+ context?: WalkthroughContext;
495
+ /** 1–2 sentence summary of the change. */
496
+ focus: string;
497
+ /** ISO timestamp. */
498
+ generatedAt: string;
499
+ kind: 'narrative';
500
+ /** Display string, e.g. '6 stops · 4 chapters'. */
501
+ meta?: string;
502
+ repo: {
503
+ branch: string | null;
504
+ root: string;
505
+ };
506
+ source: ReviewSource;
507
+ support: ReadonlyArray<WalkthroughSupportGroup>;
508
+ title: string;
509
+ version: 4;
510
+ };
511
+ export type NarrativeWalkthroughResult = {
512
+ status: 'ready';
513
+ walkthrough: NarrativeWalkthrough;
514
+ } | {
515
+ code?: 'CODEX_NOT_FOUND' | 'CLAUDE_NOT_FOUND' | 'OPENCODE_NOT_FOUND' | 'PI_NOT_FOUND';
516
+ reason: string;
517
+ status: 'unavailable';
518
+ };
519
+ export type NarrativeWalkthroughRequestOptions = {
520
+ /** Ignore an exact cache hit and replace it with a newly generated result. */
521
+ force?: boolean;
522
+ /**
523
+ * The walkthrough currently shown. Regeneration uses its prose as continuity
524
+ * while re-anchoring every stop against the current diff.
525
+ */
526
+ previousWalkthrough?: NarrativeWalkthrough;
527
+ };
528
+ /** Commit the selected files from a walkthrough's staging set. */
529
+ export type WalkthroughCommitRequest = {
530
+ /** Body of the commit message (everything after the subject line). */
531
+ body: string;
532
+ /** Repo-relative paths to commit; other staged changes are left untouched. */
533
+ paths: ReadonlyArray<string>;
534
+ source?: ReviewSource;
535
+ /** First line of the commit message. */
536
+ subject: string;
537
+ };
538
+ export type WalkthroughCommitResult = {
539
+ /** Full SHA of the new commit. */
540
+ hash: string;
541
+ status: 'committed';
542
+ } | {
543
+ reason: string;
544
+ status: 'failed';
545
+ };
546
+ /**
547
+ * Ask the connected agent to rewrite the commit message for the current file
548
+ * selection — used when the reviewer drops files from the staging set and the
549
+ * pre-drafted body no longer matches what is being committed.
550
+ */
551
+ export type WalkthroughCommitMessageRequest = {
552
+ /** The current body, given to the agent as the message to revise. */
553
+ body: string;
554
+ /** Repo-relative paths still selected for the commit. */
555
+ paths: ReadonlyArray<string>;
556
+ source?: ReviewSource;
557
+ /** The current subject line. */
558
+ subject: string;
559
+ };
560
+ export type WalkthroughCommitMessageResult = {
561
+ body: string;
562
+ status: 'ready';
563
+ subject: string;
564
+ } | {
565
+ reason: string;
566
+ status: 'unavailable';
567
+ };
568
+ export type ReviewAssistantRequest = {
569
+ comment: {
570
+ anchor?: 'file' | 'line';
571
+ body: string;
572
+ filePath: string;
573
+ lineNumber?: number;
574
+ sectionId: string;
575
+ side?: 'additions' | 'deletions';
576
+ startLineNumber?: number;
577
+ startSide?: 'additions' | 'deletions';
578
+ };
579
+ source?: ReviewSource;
580
+ walkthroughNote?: {
581
+ action: 'review' | 'scan' | 'skim';
582
+ context: string;
583
+ groupReason: string;
584
+ groupTitle: string;
585
+ impact: 'wide' | 'contained' | 'mechanical';
586
+ reason: string;
587
+ };
588
+ };
589
+ export type ReviewAssistantResult = {
590
+ reply: string;
591
+ status: 'ready';
592
+ } | {
593
+ code?: 'CODEX_NOT_FOUND' | 'CLAUDE_NOT_FOUND' | 'OPENCODE_NOT_FOUND' | 'PI_NOT_FOUND';
594
+ reason: string;
595
+ status: 'unavailable';
596
+ };
597
+ export type GitIdentity = {
598
+ email: string;
599
+ gravatarUrl?: string;
600
+ name: string;
601
+ username?: string;
602
+ };
603
+ export type DiffSectionContentRequest = {
604
+ force?: boolean;
605
+ kind: DiffSection['kind'];
606
+ path: string;
607
+ showWhitespace?: boolean;
608
+ source?: ReviewSource;
609
+ };
610
+ export type DiffImageContentRequest = {
611
+ kind: DiffSection['kind'];
612
+ path: string;
613
+ source?: ReviewSource;
614
+ };
615
+ export type DiffImageRevision = {
616
+ dataUrl: string;
617
+ mimeType: string;
618
+ name: string;
619
+ size: number;
620
+ };
621
+ export type DiffImageContentResult = {
622
+ newImage?: DiffImageRevision;
623
+ oldImage?: DiffImageRevision;
624
+ status: 'ready';
625
+ } | {
626
+ reason: string;
627
+ status: 'unavailable';
628
+ };
629
+ export type CodiffTheme = 'system' | 'light' | 'dark';
630
+ export type CodiffPreferences = {
631
+ agentBackend: 'codex' | 'claude' | 'opencode' | 'pi';
632
+ claudeModel: string;
633
+ codeFontFamily: string;
634
+ codeFontSize: number;
635
+ copyCommentsOnClose: boolean;
636
+ diffStyle: CodiffDiffStyle;
637
+ editorCommand: string;
638
+ lastRepositoryPath: string;
639
+ openAIModel: string;
640
+ opencodeModel: string;
641
+ piModel: string;
642
+ reviewCommentsPrefix: string;
643
+ showOutdated: boolean;
644
+ showWhitespace: boolean;
645
+ theme: CodiffTheme;
646
+ walkthroughPrompt: string;
647
+ wordWrap: boolean;
648
+ };
649
+ export type ReviewPreferences = Pick<CodiffPreferences, 'codeFontFamily' | 'codeFontSize' | 'diffStyle' | 'showWhitespace' | 'theme' | 'wordWrap'>;
650
+ export type PullRequestReviewComment = {
651
+ anchor?: 'file' | 'line';
652
+ body: string;
653
+ filePath: string;
654
+ lineNumber?: number;
655
+ side?: 'additions' | 'deletions';
656
+ startLineNumber?: number;
657
+ startSide?: 'additions' | 'deletions';
658
+ threadId?: string;
659
+ };
660
+ export type PullRequestExistingReviewComment = PullRequestReviewComment & {
661
+ author: ReviewAuthor;
662
+ canDelete?: boolean;
663
+ canEdit?: boolean;
664
+ canReplyThread?: boolean;
665
+ canResolveThread?: boolean;
666
+ id: string;
667
+ isOutdated?: boolean;
668
+ isThreadResolved?: boolean;
669
+ submittedAt?: string;
670
+ url?: string;
671
+ };
672
+ export type PullRequestGeneralComment = {
673
+ author: ReviewAuthor;
674
+ body: string;
675
+ canDelete?: boolean;
676
+ canEdit?: boolean;
677
+ id: string;
678
+ submittedAt?: string;
679
+ url?: string;
680
+ };
681
+ export type PullRequestGeneralCommentThread = {
682
+ canReply?: boolean;
683
+ canResolve?: boolean;
684
+ comments: ReadonlyArray<PullRequestGeneralComment>;
685
+ id: string;
686
+ isResolved?: boolean;
687
+ };
688
+ export type PullRequestReviewEvent = 'APPROVE' | 'COMMENT' | 'REQUEST_CHANGES';
689
+ export type SubmitPullRequestCommentRequest = {
690
+ comment: PullRequestReviewComment;
691
+ source: Extract<ReviewSource, {
692
+ type: 'pull-request';
693
+ }>;
694
+ };
695
+ export type SubmitPullRequestReviewRequest = {
696
+ body?: string;
697
+ comments: ReadonlyArray<PullRequestReviewComment>;
698
+ event: PullRequestReviewEvent;
699
+ source: Extract<ReviewSource, {
700
+ type: 'pull-request';
701
+ }>;
702
+ };