@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Nakazawa Tech
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @nkzw/codiff-core
2
+
3
+ Reusable code diffing primitives from Codiff.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ import type { SharedWalkthroughSnapshot } from '@nkzw/codiff-core';
9
+ import { ReviewSurface } from '@nkzw/codiff-core/react';
10
+ import '@nkzw/codiff-core/styles.css';
11
+
12
+ export function Review({ snapshot }: { snapshot: SharedWalkthroughSnapshot }) {
13
+ return <ReviewSurface snapshot={snapshot} />;
14
+ }
15
+ ```
@@ -0,0 +1,32 @@
1
+ import { type MarkdownCommentTarget } from '@nkzw/mdx-editor';
2
+ import type { GitIdentity, PlanCommentThread, SharedPlanSnapshot } from './types.ts';
3
+ export declare const getPlanCommentColorIndex: (username: string) => number;
4
+ export declare const getPlanCommentIdentityColorIndex: (identity: GitIdentity | null, threads: ReadonlyArray<PlanCommentThread>) => number | null;
5
+ export declare const getPlanCommentAffordancePosition: ({ contentPaddingRight, contentRight, target, workspaceLeft, workspaceTop, }: {
6
+ contentPaddingRight: number;
7
+ contentRight: number;
8
+ target: MarkdownCommentTarget;
9
+ workspaceLeft: number;
10
+ workspaceTop: number;
11
+ }) => {
12
+ left: number;
13
+ target: MarkdownCommentTarget;
14
+ top: number;
15
+ width: number;
16
+ };
17
+ export type PlanReviewCommenting = {
18
+ canComment: boolean;
19
+ identity: GitIdentity | null;
20
+ onCreateThread: (anchor: MarkdownCommentTarget['anchor'], body: string) => Promise<void>;
21
+ onDeleteMessage: (messageId: string) => Promise<void>;
22
+ onReply: (threadId: string, body: string) => Promise<void>;
23
+ onResolve: (threadId: string, resolved: boolean) => Promise<void>;
24
+ onSignIn: () => Promise<void> | void;
25
+ onUpdateMessage: (messageId: string, body: string) => Promise<void>;
26
+ };
27
+ export declare const getSharedPlanDownloadContent: (snapshot: SharedPlanSnapshot) => string;
28
+ export declare function PlanReviewSurface({ commenting, signInLabel, snapshot, }: {
29
+ commenting?: PlanReviewCommenting;
30
+ signInLabel?: string;
31
+ snapshot: SharedPlanSnapshot;
32
+ }): import("react").JSX.Element;
@@ -0,0 +1,40 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type ReviewCommenting } from './app/components/merge-request/GeneralComments.tsx';
3
+ import type { GitIdentity, PullRequestMergeOptions, PullRequestExistingReviewComment, PullRequestReviewComment, PullRequestReviewEvent, SharedWalkthroughSnapshot } from './types.ts';
4
+ export { ReadOnlyGeneralCommentCard, type ReviewCommenting, } from './app/components/merge-request/GeneralComments.tsx';
5
+ export type ReviewWalkthroughStatus = 'failed' | 'generating' | 'idle' | 'ready';
6
+ export type ReviewMode = 'comments' | 'tree' | 'walkthrough';
7
+ export type ReviewSurfaceProps = {
8
+ commenting?: ReviewCommenting;
9
+ externalUrl?: string;
10
+ gitIdentity?: GitIdentity | null;
11
+ initialMode?: ReviewMode;
12
+ interactive?: {
13
+ onCancelAutoMerge?: () => Promise<void> | void;
14
+ onClosePullRequest?: () => Promise<void> | void;
15
+ onGenerateWalkthrough: () => Promise<void> | void;
16
+ onHome: () => void;
17
+ onMergePullRequest?: (options: PullRequestMergeOptions & {
18
+ autoMerge: boolean;
19
+ }) => Promise<void> | void;
20
+ onResolveDiscussion?: (discussionId: string, resolved: boolean) => Promise<void>;
21
+ onSubmitComment: (comment: PullRequestReviewComment) => Promise<PullRequestExistingReviewComment>;
22
+ onSubmitGeneralComment: (body: string) => Promise<void>;
23
+ onSubmitReview: (event: PullRequestReviewEvent, comments: ReadonlyArray<PullRequestReviewComment>, body?: string) => Promise<void>;
24
+ onUpdateComment: (commentId: string, body: string) => Promise<void>;
25
+ onUpdateDescription?: (body: string) => Promise<void> | void;
26
+ onUpdateGeneralComment: (commentId: string, body: string) => Promise<void>;
27
+ onUpdateTitle?: (title: string) => Promise<void> | void;
28
+ onUploadDescriptionAsset?: (file: File) => Promise<string> | string;
29
+ walkthroughError?: string | null;
30
+ walkthroughStatus: ReviewWalkthroughStatus;
31
+ };
32
+ onModeChange?: (mode: ReviewMode) => void;
33
+ providerLabel?: string;
34
+ settingsBar?: ReactNode;
35
+ signInLabel?: string;
36
+ snapshot: SharedWalkthroughSnapshot;
37
+ sourceDescriptionFooterAside?: ReactNode;
38
+ title?: string;
39
+ };
40
+ export declare function ReviewSurface({ commenting, externalUrl, gitIdentity, initialMode, interactive, onModeChange, providerLabel, settingsBar, signInLabel, snapshot, sourceDescriptionFooterAside, title, }: ReviewSurfaceProps): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ declare function Avatar({ name, size, url }: {
2
+ name: string;
3
+ size: 'medium' | 'small';
4
+ url?: string;
5
+ }): import("react").JSX.Element;
6
+ export { Avatar };
@@ -0,0 +1,12 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import { type ButtonHTMLAttributes, type ReactNode } from 'react';
3
+ export declare const buttonVariants: (props?: ({
4
+ size?: "default" | "icon" | "lg" | "sm" | null | undefined;
5
+ variant?: "default" | "destructive" | "ghost" | "link" | "outline" | "secondary" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof buttonVariants> & {
8
+ action?: () => Promise<unknown> | unknown;
9
+ asChild?: boolean;
10
+ pendingPlaceholder?: ReactNode;
11
+ };
12
+ export declare function Button({ action, asChild, children, className, disabled, onClick: initialOnClick, pendingPlaceholder, size, type, variant, ...props }: ButtonProps): import("react").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { CodiffKeymap } from '../../config/types.ts';
2
+ import type { Command } from '../../lib/command-registry.ts';
3
+ export declare function CommandBar({ commands, keymap, onClose, visible, }: {
4
+ commands: ReadonlyArray<Command>;
5
+ keymap: CodiffKeymap;
6
+ onClose: () => void;
7
+ visible: boolean;
8
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,10 @@
1
+ import type { ChangedFile } from '../../types.ts';
2
+ export declare function ReviewFileTree({ files, onActivatePath, reloadDeltaPaths, scrollSelectedPathIntoView, selectedPath, showWhitespace, viewed, }: {
3
+ files: ReadonlyArray<ChangedFile>;
4
+ onActivatePath: (path: string) => void;
5
+ reloadDeltaPaths?: ReadonlySet<string>;
6
+ scrollSelectedPathIntoView?: boolean;
7
+ selectedPath: string | null;
8
+ showWhitespace: boolean;
9
+ viewed?: Readonly<Record<string, string>>;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { CodiffKeymap } from '../../config/types.ts';
2
+ export declare function KeyboardShortcutsHelp({ keymap, visible, }: {
3
+ keymap: CodiffKeymap;
4
+ visible: boolean;
5
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,26 @@
1
+ import type { MarkdownAnnotation, MarkdownAnnotationAnchor, MarkdownAnnotationLayout, MarkdownCommentTarget } from '@nkzw/mdx-editor';
2
+ import type { CodiffMarkdownDocument } from '../../types.ts';
3
+ export type MarkdownDocumentEditorHandle = {
4
+ createAnnotation: (id: string, target?: MarkdownCommentTarget | null) => MarkdownAnnotationAnchor | null;
5
+ flush: () => Promise<boolean>;
6
+ focusAnnotation: (id: string) => void;
7
+ getAnnotationAnchor: (id: string) => MarkdownAnnotationAnchor | null;
8
+ removeAnnotation: (id: string) => void;
9
+ };
10
+ export declare const MarkdownDocumentEditor: import("react").ForwardRefExoticComponent<{
11
+ activeAnnotationId?: string | null;
12
+ annotations?: ReadonlyArray<MarkdownAnnotation>;
13
+ autoFocus?: boolean;
14
+ className?: string;
15
+ document: CodiffMarkdownDocument;
16
+ onAnnotationAnchorChange?: (id: string, anchor: MarkdownAnnotationAnchor | null) => void;
17
+ onAnnotationLayoutChange?: (layouts: ReadonlyArray<MarkdownAnnotationLayout>) => void;
18
+ onCommentTargetChange?: (target: MarkdownCommentTarget | null) => void;
19
+ onDocumentChange?: (document: CodiffMarkdownDocument) => void;
20
+ onHeightChange?: (height: number) => void;
21
+ readOnly?: boolean;
22
+ } & import("react").RefAttributes<MarkdownDocumentEditorHandle>>;
23
+ export declare const RepositoryMarkdownEditor: import("react").ForwardRefExoticComponent<{
24
+ onHeightChange?: (height: number) => void;
25
+ path: string;
26
+ } & import("react").RefAttributes<MarkdownDocumentEditorHandle>>;
@@ -0,0 +1,71 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { CodiffKeymap } from '../../config/types.ts';
3
+ import type { RepositoryLoadError, ReviewComment } from '../../lib/app-types.ts';
4
+ import type { ChangedFile, PullRequestMergeOptions, PullRequestMergeState, PullRequestReviewEvent, PullRequestReviewStatus } from '../../types.ts';
5
+ export declare function ReviewSourceLoading(): import("react").JSX.Element;
6
+ export declare function RepositoryChangeBanner({ onRefresh, visible, }: {
7
+ onRefresh: () => void;
8
+ visible: boolean;
9
+ }): import("react").JSX.Element;
10
+ export declare function WalkthroughOutdatedBanner({ onDismiss, reason, }: {
11
+ onDismiss: () => void;
12
+ reason: string | null;
13
+ }): import("react").JSX.Element;
14
+ export declare function FirstRunPanel({ agentSkillInstalled, agentSkillInstalling, agentSkillLabel, installing, onInstallAgentSkill, onInstallTerminalHelper, }: {
15
+ agentSkillInstalled: boolean;
16
+ agentSkillInstalling: boolean;
17
+ agentSkillLabel: string;
18
+ installing: boolean;
19
+ onInstallAgentSkill: () => void;
20
+ onInstallTerminalHelper: () => void;
21
+ }): import("react").JSX.Element;
22
+ export declare function RepositoryLoadErrorPanel({ error }: {
23
+ error: RepositoryLoadError;
24
+ }): import("react").JSX.Element;
25
+ export declare function AgentUnavailablePanel({ agentLabel, onShowFiles, reason, title, }: {
26
+ agentLabel: string;
27
+ onShowFiles: () => void;
28
+ reason?: string;
29
+ title?: string;
30
+ }): import("react").JSX.Element;
31
+ export declare function DiffSearchPanel({ activeIndex, focusRequest, keymap, matchCount, onChange, onClose, onNext, onPrevious, query, visible, }: {
32
+ activeIndex: number;
33
+ focusRequest: number;
34
+ keymap: CodiffKeymap;
35
+ matchCount: number;
36
+ onChange: (query: string) => void;
37
+ onClose: () => void;
38
+ onNext: () => void;
39
+ onPrevious: () => void;
40
+ query: string;
41
+ visible: boolean;
42
+ }): import("react").JSX.Element;
43
+ export declare function CopyCommentsButton({ comments, files, reviewCommentsPrefix, showWhitespace, }: {
44
+ comments: ReadonlyArray<ReviewComment>;
45
+ files: ReadonlyArray<ChangedFile>;
46
+ reviewCommentsPrefix: string;
47
+ showWhitespace: boolean;
48
+ }): import("react").JSX.Element | null;
49
+ export declare const isPullRequestReviewActionDisabled: (reviewStatus: PullRequestReviewStatus | undefined, event: PullRequestReviewEvent) => boolean;
50
+ export declare function PullRequestReviewButtons({ children, disabled, hasPendingComments, onClosePullRequest, onSubmitReview, reviewStatus, showCommentReview, }: {
51
+ children?: ReactNode;
52
+ disabled: boolean;
53
+ hasPendingComments: boolean;
54
+ onClosePullRequest?: () => void;
55
+ onSubmitReview: (event: PullRequestReviewEvent, body?: string) => Promise<void> | void;
56
+ reviewStatus?: PullRequestReviewStatus;
57
+ showCommentReview?: boolean;
58
+ }): import("react").JSX.Element | null;
59
+ export declare const isTerminalPullRequestMergeState: (mergeState: PullRequestMergeState) => boolean;
60
+ export declare function PullRequestMergeStatusBadge({ mergeState }: {
61
+ mergeState: PullRequestMergeState;
62
+ }): import("react").JSX.Element | null;
63
+ export declare function PullRequestMergeControls({ disabled, isPending, mergeState, onCancelAutoMerge, onMergePullRequest, }: {
64
+ disabled: boolean;
65
+ isPending?: boolean;
66
+ mergeState: PullRequestMergeState;
67
+ onCancelAutoMerge?: () => Promise<void> | void;
68
+ onMergePullRequest?: (options: PullRequestMergeOptions & {
69
+ autoMerge: boolean;
70
+ }) => Promise<void> | void;
71
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,18 @@
1
+ import type { CodiffMarkdownDocument, PlanCommentThread } from '../../types.ts';
2
+ export declare function PlanCommentCard({ active, detached, onActivate, onBodyChange, onDelete, onEmptyBlur, onHeightChange, onReveal, readOnly, showDelete, thread, }: {
3
+ active: boolean;
4
+ detached: boolean;
5
+ onActivate: () => void;
6
+ onBodyChange: (body: string) => void;
7
+ onDelete: () => void;
8
+ onEmptyBlur: () => void;
9
+ onHeightChange: () => void;
10
+ onReveal: () => void;
11
+ readOnly: boolean;
12
+ showDelete: boolean;
13
+ thread: PlanCommentThread;
14
+ }): import("react").JSX.Element;
15
+ export declare function PlanEditorView({ document: initialDocument, shareEnabled, }: {
16
+ document: CodiffMarkdownDocument;
17
+ shareEnabled?: boolean;
18
+ }): import("react").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { MarkdownEditor } from '@nkzw/mdx-editor';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ type MarkdownEditorProps = ComponentProps<typeof MarkdownEditor>;
4
+ export declare const normalizeReadOnlyMarkdownValue: (value: string) => string;
5
+ export declare function ReadOnlyMarkdownView({ additionalPlugins, ariaLabel, className, contentClassName, density, fallback, onHeightChange, value, variant, }: {
6
+ additionalPlugins?: MarkdownEditorProps['additionalPlugins'];
7
+ ariaLabel: string;
8
+ className: string;
9
+ contentClassName?: string;
10
+ density?: MarkdownEditorProps['density'];
11
+ fallback?: ReactNode;
12
+ onHeightChange?: (height: number) => void;
13
+ value: string;
14
+ variant?: MarkdownEditorProps['variant'];
15
+ }): import("react").JSX.Element | null;
16
+ export {};
@@ -0,0 +1,103 @@
1
+ import { type FileDiffLoadedFiles } from '@pierre/diffs';
2
+ import { type ReactNode } from 'react';
3
+ import type { CodiffDiffStyle, CodiffKeymap } from '../../config/types.ts';
4
+ import type { CodeViewInstance, DiffSearchMatch, ReviewComment, ReviewIdentity, ReviewScrollTarget, WalkthroughNote } from '../../lib/app-types.ts';
5
+ import type { ChangedFile, CodiffPreferences, CommitMetadata, DiffImageContentRequest, DiffImageContentResult, DiffSection, GitIdentity, PullRequestCodeQualityFinding, ReviewSource } from '../../types.ts';
6
+ type PullRequestSource = Extract<ReviewSource, {
7
+ type: 'pull-request';
8
+ }>;
9
+ export declare function PullRequestSourceDescription({ actions, footer, keymap, onUpdateDescription, onUpdateTitle, onUploadDescriptionAsset, source, }: {
10
+ actions?: ReactNode;
11
+ footer?: ReactNode;
12
+ keymap?: CodiffKeymap;
13
+ onUpdateDescription?: (body: string) => Promise<void> | void;
14
+ onUpdateTitle?: (title: string) => Promise<void> | void;
15
+ onUploadDescriptionAsset?: (file: File) => Promise<string> | string;
16
+ source: PullRequestSource;
17
+ }): import("react").JSX.Element | null;
18
+ type HunkNavigationRequest = {
19
+ direction: 1 | -1;
20
+ request: number;
21
+ };
22
+ type FileReviewDiffBlock = {
23
+ comments?: ReadonlyArray<ReviewComment>;
24
+ file: ChangedFile;
25
+ fileSelected?: boolean;
26
+ header?: ReactNode;
27
+ headerSelected?: boolean;
28
+ id: string;
29
+ itemIdPrefix?: string;
30
+ note?: string;
31
+ reviewIdentity?: ReviewIdentity;
32
+ selected?: boolean;
33
+ };
34
+ type HeaderReviewDiffBlock = {
35
+ file?: undefined;
36
+ header: ReactNode;
37
+ headerSelected?: boolean;
38
+ id: string;
39
+ selected?: boolean;
40
+ };
41
+ export type ReviewDiffBlock = FileReviewDiffBlock | HeaderReviewDiffBlock;
42
+ export declare function ReviewCodeView({ activeSearchMatch, agentId, agentLabel, allowViewedToggle, blocks, bottomInset, codeQualityFindings, collapsed, comments, commitMetadata, diffLineHeight, diffStyle, disableWorkerPool, expandedGenerated, files, focusCommentId, focusCommentRequest, forceExpandedPaths, gitIdentity, hunkNavigation, initialMarkdownPreviewSectionIds, isPullRequest, isReadOnly, itemVersionByKey, keymap, loadingSectionIds, onActiveBlockChange, onAskCodex, onCommentDraftChange, onCreateComment, onDeleteComment, onLoadImageContent, onLoadSection, onLoadSectionContents, onOpenFile, onRefreshMarkdown, onResolveThread, onSaveCommentEdit, onSelectPathFromScroll, onSubmitComment, onToggleCollapsed, onToggleViewed, onUpdateComment, onUpdateSourceDescription, onUpdateSourceTitle, onUploadSourceDescriptionAsset, reviewIdentityByPath, scrollTarget, searchQuery, selectedPath, showSourceDescription, showWhitespace, source, sourceDescriptionActions, sourceDescriptionFooter, theme, viewed, walkthroughNotes, wordWrap, }: {
43
+ activeSearchMatch: DiffSearchMatch | null;
44
+ agentId: 'codex' | 'claude' | 'opencode' | 'pi';
45
+ agentLabel: string;
46
+ allowViewedToggle?: boolean;
47
+ blocks?: ReadonlyArray<ReviewDiffBlock>;
48
+ bottomInset?: number;
49
+ codeQualityFindings?: ReadonlyArray<PullRequestCodeQualityFinding>;
50
+ collapsed: ReadonlySet<string>;
51
+ comments: ReadonlyArray<ReviewComment>;
52
+ commitMetadata: CommitMetadata | null;
53
+ diffLineHeight?: number;
54
+ diffStyle: CodiffDiffStyle;
55
+ disableWorkerPool?: boolean;
56
+ expandedGenerated?: ReadonlySet<string>;
57
+ files: ReadonlyArray<ChangedFile>;
58
+ focusCommentId: string | null;
59
+ focusCommentRequest: number;
60
+ forceExpandedPaths: ReadonlySet<string>;
61
+ gitIdentity: GitIdentity | null;
62
+ hunkNavigation: HunkNavigationRequest | null;
63
+ initialMarkdownPreviewSectionIds?: ReadonlySet<string>;
64
+ isPullRequest: boolean;
65
+ isReadOnly?: boolean;
66
+ itemVersionByKey: Readonly<Record<string, number>>;
67
+ keymap: CodiffKeymap;
68
+ loadingSectionIds: ReadonlySet<string>;
69
+ onActiveBlockChange?: (blockId: string) => void;
70
+ onAskCodex?: (commentId: string) => void;
71
+ onCommentDraftChange?: (comment: Pick<ReviewComment, 'body' | 'id'> | null) => void;
72
+ onCreateComment: (comment: Omit<ReviewComment, 'body' | 'id'>) => void;
73
+ onDeleteComment: (commentId: string) => void;
74
+ onLoadImageContent?: (request: DiffImageContentRequest) => Promise<DiffImageContentResult>;
75
+ onLoadSection: (file: ChangedFile, section: DiffSection) => void;
76
+ onLoadSectionContents?: (file: ChangedFile, section: DiffSection) => Promise<FileDiffLoadedFiles>;
77
+ onOpenFile?: (file: ChangedFile) => void;
78
+ onRefreshMarkdown?: (file: ChangedFile, section: DiffSection) => Promise<boolean>;
79
+ onResolveThread?: (threadId: string, resolved: boolean) => Promise<void> | void;
80
+ onSaveCommentEdit: (commentId: string, body: string) => Promise<void> | void;
81
+ onSelectPathFromScroll: (viewer: CodeViewInstance) => void;
82
+ onSubmitComment: (commentId: string) => void;
83
+ onToggleCollapsed: (file: ChangedFile, isCollapsed: boolean, reviewKey: string) => void;
84
+ onToggleViewed: (file: ChangedFile, isViewed: boolean, reviewIdentity: ReviewIdentity) => void;
85
+ onUpdateComment: (commentId: string, body: string) => void;
86
+ onUpdateSourceDescription?: (body: string) => Promise<void> | void;
87
+ onUpdateSourceTitle?: (title: string) => Promise<void> | void;
88
+ onUploadSourceDescriptionAsset?: (file: File) => Promise<string> | string;
89
+ reviewIdentityByPath?: ReadonlyMap<string, ReviewIdentity>;
90
+ scrollTarget: ReviewScrollTarget | null;
91
+ searchQuery: string;
92
+ selectedPath: string | null;
93
+ showSourceDescription?: boolean;
94
+ showWhitespace: boolean;
95
+ source: ReviewSource;
96
+ sourceDescriptionActions?: ReactNode;
97
+ sourceDescriptionFooter?: ReactNode;
98
+ theme?: CodiffPreferences['theme'];
99
+ viewed: Record<string, string>;
100
+ walkthroughNotes: ReadonlyMap<string, WalkthroughNote>;
101
+ wordWrap: boolean;
102
+ }): import("react").JSX.Element;
103
+ export {};
@@ -0,0 +1,48 @@
1
+ import type { CodiffKeymap } from '../../config/types.ts';
2
+ import type { DiffLineCount, PullRequestSource, SidebarMode, WalkthroughError } from '../../lib/app-types.ts';
3
+ import type { ChangedFile, HistoryEntry, NarrativeWalkthrough, ReviewSource } from '../../types.ts';
4
+ import type { NarrativeNavigation } from './walkthrough/useNarrativeNavigation.ts';
5
+ export declare function Sidebar({ branchSource, commitFiles, commitViewOpen, currentSource, files, historyEntries, historyHasMore, historyLoading, keymap, mode, narrativeNavigation, narrativeWalkthrough, onActivatePath, onLoadMoreHistory, onModeChange, onSearchQueryChange, onSelectSource, onShareWalkthrough, onToggleCommitView, pullRequestSource, reloadDeltaPaths, searchQuery, selectedPath, shareWalkthroughDisabled, showWhitespace, viewed, walkthroughError, walkthroughLoading, walkthroughOutdatedPaths, walkthroughProgress, walkthroughUnread, }: {
6
+ branchSource: Extract<ReviewSource, {
7
+ type: 'branch-diff';
8
+ }> | null;
9
+ commitFiles: ReadonlyArray<ChangedFile>;
10
+ commitViewOpen: boolean;
11
+ currentSource: ReviewSource;
12
+ files: ReadonlyArray<ChangedFile>;
13
+ historyEntries: ReadonlyArray<HistoryEntry>;
14
+ historyHasMore: boolean;
15
+ historyLoading: boolean;
16
+ keymap: CodiffKeymap;
17
+ mode: SidebarMode;
18
+ narrativeNavigation: NarrativeNavigation;
19
+ narrativeWalkthrough: NarrativeWalkthrough | null;
20
+ onActivatePath: (path: string) => void;
21
+ onLoadMoreHistory: () => void;
22
+ onModeChange: (mode: SidebarMode) => void;
23
+ onSearchQueryChange: (query: string) => void;
24
+ onSelectSource: (source: ReviewSource) => void;
25
+ onShareWalkthrough?: () => void;
26
+ onToggleCommitView: () => void;
27
+ pullRequestSource: PullRequestSource | null;
28
+ reloadDeltaPaths: ReadonlySet<string>;
29
+ searchQuery: string;
30
+ selectedPath: string | null;
31
+ shareWalkthroughDisabled?: boolean;
32
+ showWhitespace: boolean;
33
+ viewed: Record<string, string>;
34
+ walkthroughError: WalkthroughError | null;
35
+ walkthroughLoading: boolean;
36
+ walkthroughOutdatedPaths: ReadonlySet<string>;
37
+ walkthroughProgress: {
38
+ phase: import('../../types.ts').WalkthroughProgressPhase | null;
39
+ responseLabelIndex: number;
40
+ stageRevision: number;
41
+ };
42
+ walkthroughUnread: boolean;
43
+ }): import("react").JSX.Element;
44
+ export declare function DiffLineCountBadge({ ariaLabelPrefix, className, lineCount, }: {
45
+ ariaLabelPrefix?: string;
46
+ className?: string;
47
+ lineCount: DiffLineCount;
48
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ export type WalkthroughFileError = {
2
+ path: string;
3
+ reason: string;
4
+ };
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { CodiffKeymap } from '../../../config/types.ts';
3
+ import type { GitIdentity, PullRequestExistingReviewComment, PullRequestGeneralComment, PullRequestGeneralCommentThread, PullRequestReviewComment } from '../../../types.ts';
4
+ export type ReviewCommenting = {
5
+ canComment: boolean;
6
+ onDeleteComment: (commentId: string) => Promise<void>;
7
+ onDeleteGeneralComment: (commentId: string) => Promise<void>;
8
+ onReplyGeneralComment: (threadId: string, body: string) => Promise<void>;
9
+ onResolveDiscussion: (discussionId: string, resolved: boolean) => Promise<void>;
10
+ onSignIn: () => Promise<void> | void;
11
+ onSubmitComment: (comment: PullRequestReviewComment) => Promise<PullRequestExistingReviewComment>;
12
+ onSubmitGeneralComment: (body: string) => Promise<void>;
13
+ onUpdateComment: (commentId: string, body: string) => Promise<void>;
14
+ onUpdateGeneralComment: (commentId: string, body: string) => Promise<void>;
15
+ };
16
+ export declare function ReadOnlyGeneralCommentCard({ className, comment, focused, }: {
17
+ className?: string;
18
+ comment: PullRequestGeneralComment;
19
+ focused?: boolean;
20
+ }): import("react").JSX.Element;
21
+ export declare function SidebarGeneralCommentList({ comments, focusedCommentId, onActivateComment, }: {
22
+ comments: ReadonlyArray<PullRequestGeneralComment>;
23
+ focusedCommentId: string | null;
24
+ onActivateComment: (commentId: string) => void;
25
+ }): import("react").JSX.Element;
26
+ export declare function MergeRequestCommentsView({ canComment, commenting, draft, editDraft, editError, editingCommentId, editSubmitting, error, focusedCommentId, focusedCommentRequest, gitIdentity, keymap, onCancelEdit, onChangeDraft, onChangeEditDraft, onSaveEdit, onStartEdit, onSubmit, signInLabel, sourceDescription, submitting, threads, }: {
27
+ canComment: boolean;
28
+ commenting?: ReviewCommenting;
29
+ draft: string;
30
+ editDraft: string;
31
+ editError: string | null;
32
+ editingCommentId: string | null;
33
+ editSubmitting: boolean;
34
+ error: string | null;
35
+ focusedCommentId: string | null;
36
+ focusedCommentRequest: number;
37
+ gitIdentity: GitIdentity | null;
38
+ keymap: CodiffKeymap;
39
+ onCancelEdit: () => void;
40
+ onChangeDraft: (draft: string) => void;
41
+ onChangeEditDraft: (draft: string) => void;
42
+ onSaveEdit: () => void;
43
+ onStartEdit: (comment: PullRequestGeneralComment) => void;
44
+ onSubmit: () => void;
45
+ signInLabel: string;
46
+ sourceDescription?: ReactNode;
47
+ submitting: boolean;
48
+ threads: ReadonlyArray<PullRequestGeneralCommentThread>;
49
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function useCopiedState(timeoutMs: number): readonly [boolean, () => void];
@@ -0,0 +1,23 @@
1
+ import { type CommitModel } from '../../../lib/narrative-walkthrough.ts';
2
+ import type { WalkthroughCommitMessageRequest, WalkthroughCommitMessageResult, WalkthroughCommitRequest, WalkthroughCommitResult } from '../../../types.ts';
3
+ export type CommitHandler = (request: WalkthroughCommitRequest) => Promise<WalkthroughCommitResult>;
4
+ export type CommitMessageHandler = (request: WalkthroughCommitMessageRequest) => Promise<WalkthroughCommitMessageResult>;
5
+ /** Subscribe to live commit output (pre-commit hook logs); returns unsubscribe. */
6
+ export type CommitOutputSubscriber = (callback: (chunk: string) => void) => () => void;
7
+ export type CommitDraftState = {
8
+ commitBody: string;
9
+ commitSelected: ReadonlySet<string>;
10
+ commitSubject: string;
11
+ setCommitBody: (value: string) => void;
12
+ setCommitSubject: (value: string) => void;
13
+ toggleCommitFile: (path: string) => void;
14
+ toggleCommitGroup: (paths: ReadonlyArray<string>) => void;
15
+ };
16
+ export declare function CommitView({ branch, draft, model, onCommit, onCommitOutput, onUpdateMessage, }: {
17
+ branch: string | null;
18
+ draft: CommitDraftState;
19
+ model: CommitModel;
20
+ onCommit: CommitHandler;
21
+ onCommitOutput?: CommitOutputSubscriber;
22
+ onUpdateMessage: CommitMessageHandler;
23
+ }): import("react").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import type { ChangedFile, NarrativeWalkthrough } from '../../../types.ts';
2
+ import type { NarrativeNavigation } from './useNarrativeNavigation.ts';
3
+ export declare function NarrativeSidebar({ allowCommit, changedPaths, files, navigation, onShareWalkthrough, shareWalkthroughDisabled, showWhitespace, walkthrough, }: {
4
+ allowCommit?: boolean;
5
+ changedPaths?: ReadonlySet<string>;
6
+ files: ReadonlyArray<ChangedFile>;
7
+ navigation: NarrativeNavigation;
8
+ onShareWalkthrough?: () => void;
9
+ shareWalkthroughDisabled?: boolean;
10
+ showWhitespace: boolean;
11
+ walkthrough: NarrativeWalkthrough;
12
+ }): import("react").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { ReviewIdentity } from '../../../lib/app-types.ts';
3
+ import type { ReviewScrollBehavior } from '../../../lib/app-types.ts';
4
+ import type { ChangedFile, NarrativeWalkthrough } from '../../../types.ts';
5
+ import type { ReviewDiffBlock } from '../ReviewCodeView.tsx';
6
+ import { type CommitHandler, type CommitMessageHandler, type CommitOutputSubscriber } from './CommitView.tsx';
7
+ import type { NarrativeNavigation } from './useNarrativeNavigation.ts';
8
+ export type WalkthroughReviewTarget = {
9
+ file: ChangedFile;
10
+ reviewIdentity: ReviewIdentity;
11
+ };
12
+ export type WalkthroughBlockScrollTarget = {
13
+ behavior?: ReviewScrollBehavior;
14
+ blockId: string;
15
+ request: number;
16
+ };
17
+ export declare const getWalkthroughBlockScrollTarget: ({ activeBlockId, firstSupportBlockId, mode, stopScrollRequest, supportScrollRequest, }: {
18
+ activeBlockId: string | null | undefined;
19
+ firstSupportBlockId: string | null;
20
+ mode: NarrativeNavigation['mode'];
21
+ stopScrollRequest: number;
22
+ supportScrollRequest: number;
23
+ }) => WalkthroughBlockScrollTarget | null;
24
+ export type RenderWalkthroughDiffBlocks = (blocks: ReadonlyArray<ReviewDiffBlock>, scrollTarget: WalkthroughBlockScrollTarget | null, onActiveBlockChange: (blockId: string) => void) => ReactNode;
25
+ type WalkthroughNavigationKeyEvent = Pick<KeyboardEvent, 'altKey' | 'ctrlKey' | 'key' | 'metaKey' | 'shiftKey'>;
26
+ export declare const getWalkthroughNavigationKeyDirection: (event: WalkthroughNavigationKeyEvent) => -1 | 0 | 1;
27
+ export declare function NarrativeWalkthroughView({ allowCommit, changedPaths, files, navigation, onActiveReviewTargetChange, onCommit, onCommitOutput, onRegenerateWalkthrough, onShareWalkthrough, onUpdateCommitMessage, regenerateDisabled, renderDiffBlocks, shareWalkthroughDisabled, showWhitespace, walkthrough, }: {
28
+ allowCommit?: boolean;
29
+ changedPaths?: ReadonlySet<string>;
30
+ files: ReadonlyArray<ChangedFile>;
31
+ navigation: NarrativeNavigation;
32
+ onActiveReviewTargetChange: (target: WalkthroughReviewTarget | null) => void;
33
+ onCommit: CommitHandler;
34
+ onCommitOutput?: CommitOutputSubscriber;
35
+ onRegenerateWalkthrough?: () => void;
36
+ onShareWalkthrough?: () => void;
37
+ onUpdateCommitMessage: CommitMessageHandler;
38
+ regenerateDisabled?: boolean;
39
+ renderDiffBlocks: RenderWalkthroughDiffBlocks;
40
+ shareWalkthroughDisabled?: boolean;
41
+ showWhitespace: boolean;
42
+ walkthrough: NarrativeWalkthrough;
43
+ }): import("react").JSX.Element;
44
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { ReviewCodeView, type ReviewDiffBlock } from '../ReviewCodeView.tsx';
3
+ import type { WalkthroughBlockScrollTarget } from './NarrativeWalkthroughView.tsx';
4
+ type ReviewCodeViewProps = ComponentProps<typeof ReviewCodeView>;
5
+ type WalkthroughReviewProps = Omit<ReviewCodeViewProps, 'blocks' | 'bottomInset' | 'commitMetadata' | 'files' | 'forceExpandedPaths' | 'onActiveBlockChange' | 'onSelectPathFromScroll' | 'scrollTarget' | 'selectedPath' | 'showSourceDescription' | 'walkthroughNotes'>;
6
+ export declare function WalkthroughDiffSurface({ allowViewedToggle, blocks, forceExpandedPaths, onActiveBlockChange, reviewProps, scrollTarget, sourceDescriptionActions, sourceDescriptionFooter, }: {
7
+ allowViewedToggle?: boolean;
8
+ blocks: ReadonlyArray<ReviewDiffBlock>;
9
+ forceExpandedPaths?: ReadonlySet<string>;
10
+ onActiveBlockChange: (blockId: string) => void;
11
+ reviewProps: WalkthroughReviewProps;
12
+ scrollTarget: WalkthroughBlockScrollTarget | null;
13
+ sourceDescriptionActions?: ReviewCodeViewProps['sourceDescriptionActions'];
14
+ sourceDescriptionFooter?: ReviewCodeViewProps['sourceDescriptionFooter'];
15
+ }): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { WalkthroughProgressPhase } from '../../../types.ts';
2
+ export declare const walkthroughResponseLabels: readonly ['Building walkthrough…', 'Composing walkthrough…', 'Writing walkthrough…', 'Assembling walkthrough…', 'Creating walkthrough…', 'Producing walkthrough…'];
3
+ export declare const nextWalkthroughResponseLabelIndex: (current: number) => number;
4
+ export declare function WalkthroughProgress({ phase, responseLabelIndex, stageRevision, }: {
5
+ phase: WalkthroughProgressPhase | null;
6
+ responseLabelIndex: number;
7
+ stageRevision: number;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import type { WalkthroughIcon, WalkthroughStop } from '../../../types.ts';
2
+ export declare function ChapterIcon({ icon, size }: {
3
+ icon: WalkthroughIcon;
4
+ size?: number;
5
+ }): import("react").JSX.Element;
6
+ export declare function ImportancePill({ importance }: {
7
+ importance: WalkthroughStop['importance'];
8
+ }): import("react").JSX.Element;
9
+ export declare function WalkthroughLineCount({ added, deleted }: {
10
+ added: number;
11
+ deleted: number;
12
+ }): import("react").JSX.Element;
13
+ export declare function Narration({ prose }: {
14
+ prose: string;
15
+ }): import("react").JSX.Element;