gitx.do 0.0.1 → 0.0.3

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 (237) hide show
  1. package/dist/cli/commands/blame.d.ts +259 -0
  2. package/dist/cli/commands/blame.d.ts.map +1 -0
  3. package/dist/cli/commands/blame.js +609 -0
  4. package/dist/cli/commands/blame.js.map +1 -0
  5. package/dist/cli/commands/branch.d.ts +249 -0
  6. package/dist/cli/commands/branch.d.ts.map +1 -0
  7. package/dist/cli/commands/branch.js +693 -0
  8. package/dist/cli/commands/branch.js.map +1 -0
  9. package/dist/cli/commands/commit.d.ts +182 -0
  10. package/dist/cli/commands/commit.d.ts.map +1 -0
  11. package/dist/cli/commands/commit.js +437 -0
  12. package/dist/cli/commands/commit.js.map +1 -0
  13. package/dist/cli/commands/diff.d.ts +464 -0
  14. package/dist/cli/commands/diff.d.ts.map +1 -0
  15. package/dist/cli/commands/diff.js +958 -0
  16. package/dist/cli/commands/diff.js.map +1 -0
  17. package/dist/cli/commands/log.d.ts +239 -0
  18. package/dist/cli/commands/log.d.ts.map +1 -0
  19. package/dist/cli/commands/log.js +535 -0
  20. package/dist/cli/commands/log.js.map +1 -0
  21. package/dist/cli/commands/review.d.ts +457 -0
  22. package/dist/cli/commands/review.d.ts.map +1 -0
  23. package/dist/cli/commands/review.js +533 -0
  24. package/dist/cli/commands/review.js.map +1 -0
  25. package/dist/cli/commands/status.d.ts +269 -0
  26. package/dist/cli/commands/status.d.ts.map +1 -0
  27. package/dist/cli/commands/status.js +493 -0
  28. package/dist/cli/commands/status.js.map +1 -0
  29. package/dist/cli/commands/web.d.ts +199 -0
  30. package/dist/cli/commands/web.d.ts.map +1 -0
  31. package/dist/cli/commands/web.js +696 -0
  32. package/dist/cli/commands/web.js.map +1 -0
  33. package/dist/cli/fs-adapter.d.ts +656 -0
  34. package/dist/cli/fs-adapter.d.ts.map +1 -0
  35. package/dist/cli/fs-adapter.js +1179 -0
  36. package/dist/cli/fs-adapter.js.map +1 -0
  37. package/dist/cli/index.d.ts +387 -0
  38. package/dist/cli/index.d.ts.map +1 -0
  39. package/dist/cli/index.js +523 -0
  40. package/dist/cli/index.js.map +1 -0
  41. package/dist/cli/ui/components/DiffView.d.ts +7 -0
  42. package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
  43. package/dist/cli/ui/components/DiffView.js +11 -0
  44. package/dist/cli/ui/components/DiffView.js.map +1 -0
  45. package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
  46. package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
  47. package/dist/cli/ui/components/ErrorDisplay.js +11 -0
  48. package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
  49. package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
  50. package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
  51. package/dist/cli/ui/components/FuzzySearch.js +12 -0
  52. package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
  53. package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
  54. package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
  55. package/dist/cli/ui/components/LoadingSpinner.js +10 -0
  56. package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
  57. package/dist/cli/ui/components/NavigationList.d.ts +9 -0
  58. package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
  59. package/dist/cli/ui/components/NavigationList.js +11 -0
  60. package/dist/cli/ui/components/NavigationList.js.map +1 -0
  61. package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
  62. package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
  63. package/dist/cli/ui/components/ScrollableContent.js +11 -0
  64. package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
  65. package/dist/cli/ui/components/index.d.ts +7 -0
  66. package/dist/cli/ui/components/index.d.ts.map +1 -0
  67. package/dist/cli/ui/components/index.js +9 -0
  68. package/dist/cli/ui/components/index.js.map +1 -0
  69. package/dist/cli/ui/terminal-ui.d.ts +52 -0
  70. package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
  71. package/dist/cli/ui/terminal-ui.js +121 -0
  72. package/dist/cli/ui/terminal-ui.js.map +1 -0
  73. package/dist/durable-object/object-store.d.ts +401 -23
  74. package/dist/durable-object/object-store.d.ts.map +1 -1
  75. package/dist/durable-object/object-store.js +414 -25
  76. package/dist/durable-object/object-store.js.map +1 -1
  77. package/dist/durable-object/schema.d.ts +188 -0
  78. package/dist/durable-object/schema.d.ts.map +1 -1
  79. package/dist/durable-object/schema.js +160 -0
  80. package/dist/durable-object/schema.js.map +1 -1
  81. package/dist/durable-object/wal.d.ts +336 -31
  82. package/dist/durable-object/wal.d.ts.map +1 -1
  83. package/dist/durable-object/wal.js +272 -27
  84. package/dist/durable-object/wal.js.map +1 -1
  85. package/dist/index.d.ts +379 -3
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +379 -7
  88. package/dist/index.js.map +1 -1
  89. package/dist/mcp/adapter.d.ts +579 -38
  90. package/dist/mcp/adapter.d.ts.map +1 -1
  91. package/dist/mcp/adapter.js +426 -33
  92. package/dist/mcp/adapter.js.map +1 -1
  93. package/dist/mcp/sandbox.d.ts +532 -29
  94. package/dist/mcp/sandbox.d.ts.map +1 -1
  95. package/dist/mcp/sandbox.js +389 -22
  96. package/dist/mcp/sandbox.js.map +1 -1
  97. package/dist/mcp/sdk-adapter.d.ts +478 -56
  98. package/dist/mcp/sdk-adapter.d.ts.map +1 -1
  99. package/dist/mcp/sdk-adapter.js +346 -44
  100. package/dist/mcp/sdk-adapter.js.map +1 -1
  101. package/dist/mcp/tools.d.ts +445 -30
  102. package/dist/mcp/tools.d.ts.map +1 -1
  103. package/dist/mcp/tools.js +363 -33
  104. package/dist/mcp/tools.js.map +1 -1
  105. package/dist/ops/blame.d.ts +424 -21
  106. package/dist/ops/blame.d.ts.map +1 -1
  107. package/dist/ops/blame.js +303 -20
  108. package/dist/ops/blame.js.map +1 -1
  109. package/dist/ops/branch.d.ts +583 -32
  110. package/dist/ops/branch.d.ts.map +1 -1
  111. package/dist/ops/branch.js +365 -23
  112. package/dist/ops/branch.js.map +1 -1
  113. package/dist/ops/commit-traversal.d.ts +164 -24
  114. package/dist/ops/commit-traversal.d.ts.map +1 -1
  115. package/dist/ops/commit-traversal.js +68 -2
  116. package/dist/ops/commit-traversal.js.map +1 -1
  117. package/dist/ops/commit.d.ts +387 -53
  118. package/dist/ops/commit.d.ts.map +1 -1
  119. package/dist/ops/commit.js +249 -29
  120. package/dist/ops/commit.js.map +1 -1
  121. package/dist/ops/merge-base.d.ts +195 -21
  122. package/dist/ops/merge-base.d.ts.map +1 -1
  123. package/dist/ops/merge-base.js +122 -12
  124. package/dist/ops/merge-base.js.map +1 -1
  125. package/dist/ops/merge.d.ts +600 -130
  126. package/dist/ops/merge.d.ts.map +1 -1
  127. package/dist/ops/merge.js +408 -60
  128. package/dist/ops/merge.js.map +1 -1
  129. package/dist/ops/tag.d.ts +67 -2
  130. package/dist/ops/tag.d.ts.map +1 -1
  131. package/dist/ops/tag.js +42 -1
  132. package/dist/ops/tag.js.map +1 -1
  133. package/dist/ops/tree-builder.d.ts +102 -6
  134. package/dist/ops/tree-builder.d.ts.map +1 -1
  135. package/dist/ops/tree-builder.js +30 -5
  136. package/dist/ops/tree-builder.js.map +1 -1
  137. package/dist/ops/tree-diff.d.ts +50 -2
  138. package/dist/ops/tree-diff.d.ts.map +1 -1
  139. package/dist/ops/tree-diff.js +50 -2
  140. package/dist/ops/tree-diff.js.map +1 -1
  141. package/dist/pack/delta.d.ts +211 -39
  142. package/dist/pack/delta.d.ts.map +1 -1
  143. package/dist/pack/delta.js +232 -46
  144. package/dist/pack/delta.js.map +1 -1
  145. package/dist/pack/format.d.ts +390 -28
  146. package/dist/pack/format.d.ts.map +1 -1
  147. package/dist/pack/format.js +344 -33
  148. package/dist/pack/format.js.map +1 -1
  149. package/dist/pack/full-generation.d.ts +313 -28
  150. package/dist/pack/full-generation.d.ts.map +1 -1
  151. package/dist/pack/full-generation.js +238 -19
  152. package/dist/pack/full-generation.js.map +1 -1
  153. package/dist/pack/generation.d.ts +346 -23
  154. package/dist/pack/generation.d.ts.map +1 -1
  155. package/dist/pack/generation.js +269 -21
  156. package/dist/pack/generation.js.map +1 -1
  157. package/dist/pack/index.d.ts +407 -86
  158. package/dist/pack/index.d.ts.map +1 -1
  159. package/dist/pack/index.js +351 -70
  160. package/dist/pack/index.js.map +1 -1
  161. package/dist/refs/branch.d.ts +517 -71
  162. package/dist/refs/branch.d.ts.map +1 -1
  163. package/dist/refs/branch.js +410 -26
  164. package/dist/refs/branch.js.map +1 -1
  165. package/dist/refs/storage.d.ts +610 -57
  166. package/dist/refs/storage.d.ts.map +1 -1
  167. package/dist/refs/storage.js +481 -29
  168. package/dist/refs/storage.js.map +1 -1
  169. package/dist/refs/tag.d.ts +677 -67
  170. package/dist/refs/tag.d.ts.map +1 -1
  171. package/dist/refs/tag.js +497 -30
  172. package/dist/refs/tag.js.map +1 -1
  173. package/dist/storage/lru-cache.d.ts +556 -53
  174. package/dist/storage/lru-cache.d.ts.map +1 -1
  175. package/dist/storage/lru-cache.js +439 -36
  176. package/dist/storage/lru-cache.js.map +1 -1
  177. package/dist/storage/object-index.d.ts +483 -38
  178. package/dist/storage/object-index.d.ts.map +1 -1
  179. package/dist/storage/object-index.js +388 -22
  180. package/dist/storage/object-index.js.map +1 -1
  181. package/dist/storage/r2-pack.d.ts +957 -94
  182. package/dist/storage/r2-pack.d.ts.map +1 -1
  183. package/dist/storage/r2-pack.js +756 -48
  184. package/dist/storage/r2-pack.js.map +1 -1
  185. package/dist/tiered/cdc-pipeline.d.ts +1610 -38
  186. package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
  187. package/dist/tiered/cdc-pipeline.js +1131 -22
  188. package/dist/tiered/cdc-pipeline.js.map +1 -1
  189. package/dist/tiered/migration.d.ts +903 -41
  190. package/dist/tiered/migration.d.ts.map +1 -1
  191. package/dist/tiered/migration.js +646 -24
  192. package/dist/tiered/migration.js.map +1 -1
  193. package/dist/tiered/parquet-writer.d.ts +944 -47
  194. package/dist/tiered/parquet-writer.d.ts.map +1 -1
  195. package/dist/tiered/parquet-writer.js +667 -39
  196. package/dist/tiered/parquet-writer.js.map +1 -1
  197. package/dist/tiered/read-path.d.ts +728 -34
  198. package/dist/tiered/read-path.d.ts.map +1 -1
  199. package/dist/tiered/read-path.js +310 -27
  200. package/dist/tiered/read-path.js.map +1 -1
  201. package/dist/types/objects.d.ts +457 -0
  202. package/dist/types/objects.d.ts.map +1 -1
  203. package/dist/types/objects.js +305 -4
  204. package/dist/types/objects.js.map +1 -1
  205. package/dist/types/storage.d.ts +407 -35
  206. package/dist/types/storage.d.ts.map +1 -1
  207. package/dist/types/storage.js +27 -3
  208. package/dist/types/storage.js.map +1 -1
  209. package/dist/utils/hash.d.ts +133 -12
  210. package/dist/utils/hash.d.ts.map +1 -1
  211. package/dist/utils/hash.js +133 -12
  212. package/dist/utils/hash.js.map +1 -1
  213. package/dist/utils/sha1.d.ts +102 -9
  214. package/dist/utils/sha1.d.ts.map +1 -1
  215. package/dist/utils/sha1.js +114 -11
  216. package/dist/utils/sha1.js.map +1 -1
  217. package/dist/wire/capabilities.d.ts +896 -88
  218. package/dist/wire/capabilities.d.ts.map +1 -1
  219. package/dist/wire/capabilities.js +566 -62
  220. package/dist/wire/capabilities.js.map +1 -1
  221. package/dist/wire/pkt-line.d.ts +293 -15
  222. package/dist/wire/pkt-line.d.ts.map +1 -1
  223. package/dist/wire/pkt-line.js +251 -15
  224. package/dist/wire/pkt-line.js.map +1 -1
  225. package/dist/wire/receive-pack.d.ts +814 -64
  226. package/dist/wire/receive-pack.d.ts.map +1 -1
  227. package/dist/wire/receive-pack.js +542 -41
  228. package/dist/wire/receive-pack.js.map +1 -1
  229. package/dist/wire/smart-http.d.ts +575 -97
  230. package/dist/wire/smart-http.d.ts.map +1 -1
  231. package/dist/wire/smart-http.js +337 -46
  232. package/dist/wire/smart-http.js.map +1 -1
  233. package/dist/wire/upload-pack.d.ts +492 -98
  234. package/dist/wire/upload-pack.d.ts.map +1 -1
  235. package/dist/wire/upload-pack.js +347 -59
  236. package/dist/wire/upload-pack.js.map +1 -1
  237. package/package.json +10 -2
@@ -0,0 +1,464 @@
1
+ /**
2
+ * @fileoverview gitx diff command with Shiki syntax highlighting
3
+ *
4
+ * This module implements the `gitx diff` command which shows changes between
5
+ * commits, the index and working tree, etc. Features include:
6
+ * - Syntax highlighting via Shiki
7
+ * - Staged vs unstaged diff modes
8
+ * - Word-level diff highlighting
9
+ * - Multiple output formats (unified, raw)
10
+ * - Support for commit and branch comparisons
11
+ *
12
+ * @module cli/commands/diff
13
+ *
14
+ * @example
15
+ * // Show unstaged changes
16
+ * await diffCommand({ cwd: '/repo', options: {}, ... })
17
+ *
18
+ * @example
19
+ * // Show staged changes
20
+ * await diffCommand({ cwd: '/repo', options: { staged: true }, ... })
21
+ *
22
+ * @example
23
+ * // Programmatic usage
24
+ * const result = await getUnstagedDiff('/repo')
25
+ * const output = await formatHighlightedDiff(result)
26
+ */
27
+ import type { CommandContext } from '../index';
28
+ /**
29
+ * Options for the diff command.
30
+ *
31
+ * @description Configuration options that control diff behavior and output format.
32
+ *
33
+ * @property staged - Show staged changes (index vs HEAD)
34
+ * @property cached - Alias for staged
35
+ * @property noColor - Disable syntax highlighting
36
+ * @property context - Number of context lines around changes (default: 3)
37
+ * @property wordDiff - Enable word-level diff highlighting
38
+ * @property format - Output format: 'unified' (default) or 'raw'
39
+ * @property commit - Specific commit to compare against
40
+ */
41
+ export interface DiffOptions {
42
+ /** Show staged changes (index vs HEAD) */
43
+ staged?: boolean;
44
+ /** Alias for staged */
45
+ cached?: boolean;
46
+ /** Disable syntax highlighting */
47
+ noColor?: boolean;
48
+ /** Number of context lines */
49
+ context?: number;
50
+ /** Word-level diff highlighting */
51
+ wordDiff?: boolean;
52
+ /** Output format */
53
+ format?: 'unified' | 'raw';
54
+ /** Commit to compare against */
55
+ commit?: string;
56
+ }
57
+ /**
58
+ * A single file entry in a diff result.
59
+ *
60
+ * @description Represents the diff for a single file, including metadata
61
+ * about the change type and the actual diff hunks.
62
+ *
63
+ * @property path - File path relative to repository root
64
+ * @property oldPath - Original path for renamed files
65
+ * @property status - Change type: 'added', 'modified', 'deleted', 'renamed', 'copied'
66
+ * @property oldMode - Original file mode (e.g., '100644')
67
+ * @property newMode - New file mode
68
+ * @property binary - Whether the file is binary
69
+ * @property oldSha - Original blob SHA
70
+ * @property newSha - New blob SHA
71
+ * @property hunks - Array of diff hunks for this file
72
+ */
73
+ export interface DiffEntry {
74
+ /** File path (relative to repo root) */
75
+ path: string;
76
+ /** Old file path (for renames) */
77
+ oldPath?: string;
78
+ /** Change type */
79
+ status: 'added' | 'modified' | 'deleted' | 'renamed' | 'copied';
80
+ /** Old file mode (e.g., '100644') */
81
+ oldMode?: string;
82
+ /** New file mode */
83
+ newMode?: string;
84
+ /** Is binary file */
85
+ binary?: boolean;
86
+ /** Old blob SHA */
87
+ oldSha?: string;
88
+ /** New blob SHA */
89
+ newSha?: string;
90
+ /** Diff hunks */
91
+ hunks: DiffHunk[];
92
+ }
93
+ /**
94
+ * A diff hunk representing a contiguous block of changes.
95
+ *
96
+ * @description Contains lines around a change with context lines before
97
+ * and after. Uses standard unified diff format line numbers.
98
+ *
99
+ * @property oldStart - Starting line number in old file
100
+ * @property oldCount - Number of lines from old file
101
+ * @property newStart - Starting line number in new file
102
+ * @property newCount - Number of lines in new file
103
+ * @property header - Optional hunk header (e.g., function name)
104
+ * @property lines - Array of diff lines in this hunk
105
+ */
106
+ export interface DiffHunk {
107
+ /** Old file start line */
108
+ oldStart: number;
109
+ /** Old file line count */
110
+ oldCount: number;
111
+ /** New file start line */
112
+ newStart: number;
113
+ /** New file line count */
114
+ newCount: number;
115
+ /** Hunk header (e.g., function name) */
116
+ header?: string;
117
+ /** Lines in this hunk */
118
+ lines: DiffLine[];
119
+ }
120
+ /**
121
+ * A single line within a diff hunk.
122
+ *
123
+ * @description Represents one line of diff output with its type
124
+ * (context, addition, or deletion) and optional line numbers.
125
+ *
126
+ * @property type - Line type: 'context', 'addition', or 'deletion'
127
+ * @property content - The actual line content
128
+ * @property oldLineNo - Line number in old file (context/deletion)
129
+ * @property newLineNo - Line number in new file (context/addition)
130
+ * @property wordChanges - Optional word-level changes for inline highlighting
131
+ */
132
+ export interface DiffLine {
133
+ /** Line type */
134
+ type: 'context' | 'addition' | 'deletion';
135
+ /** Line content */
136
+ content: string;
137
+ /** Old line number (for context and deletion) */
138
+ oldLineNo?: number;
139
+ /** New line number (for context and addition) */
140
+ newLineNo?: number;
141
+ /** Word-level changes within line */
142
+ wordChanges?: WordChange[];
143
+ }
144
+ /**
145
+ * A word-level change within a line.
146
+ *
147
+ * @description Used for inline/word diff highlighting to show
148
+ * exactly which parts of a line changed.
149
+ *
150
+ * @property type - Change type: 'unchanged', 'added', or 'removed'
151
+ * @property text - The text content of this segment
152
+ */
153
+ export interface WordChange {
154
+ /** Change type */
155
+ type: 'unchanged' | 'added' | 'removed';
156
+ /** Text content */
157
+ text: string;
158
+ }
159
+ /**
160
+ * Complete result of a diff operation.
161
+ *
162
+ * @description Contains all file entries and summary statistics
163
+ * for a diff operation.
164
+ *
165
+ * @property entries - Array of DiffEntry objects for each changed file
166
+ * @property stats - Summary statistics (files changed, insertions, deletions)
167
+ */
168
+ export interface DiffResult {
169
+ /** List of file diffs */
170
+ entries: DiffEntry[];
171
+ /** Stats summary */
172
+ stats: {
173
+ /** Number of files changed */
174
+ filesChanged: number;
175
+ /** Total lines added */
176
+ insertions: number;
177
+ /** Total lines removed */
178
+ deletions: number;
179
+ };
180
+ }
181
+ /**
182
+ * Result of syntax-highlighted diff output.
183
+ *
184
+ * @description Contains the highlighted output lines and a map of detected
185
+ * programming languages for each file in the diff.
186
+ *
187
+ * @property lines - Array of output lines with ANSI color codes
188
+ * @property languages - Map from file path to detected language
189
+ */
190
+ export interface HighlightedDiff {
191
+ /** Syntax-highlighted output lines */
192
+ lines: string[];
193
+ /** Language detected for each file */
194
+ languages: Map<string, string>;
195
+ }
196
+ /**
197
+ * Execute the diff command.
198
+ *
199
+ * @description Main entry point for the diff command. Shows changes between
200
+ * the working tree and the index (unstaged) or between the index and HEAD
201
+ * (staged). Output is syntax-highlighted unless --no-color is specified.
202
+ *
203
+ * @param ctx - Command context with cwd, options, and I/O functions
204
+ *
205
+ * @example
206
+ * // Show unstaged changes
207
+ * await diffCommand({ cwd: '/repo', options: {}, stdout: console.log, stderr: console.error, args: [], rawArgs: [] })
208
+ *
209
+ * @example
210
+ * // Show staged changes
211
+ * await diffCommand({ cwd: '/repo', options: { staged: true }, stdout: console.log, stderr: console.error, args: [], rawArgs: [] })
212
+ */
213
+ export declare function diffCommand(ctx: CommandContext): Promise<void>;
214
+ /**
215
+ * Get unstaged changes (working tree vs index).
216
+ *
217
+ * @description Compares the working tree against the index (staging area)
218
+ * to find all unstaged modifications. These are changes that have been
219
+ * made but not yet added with `git add`.
220
+ *
221
+ * @param repoPath - Path to the repository root
222
+ * @returns Promise<DiffResult> with entries for each changed file
223
+ *
224
+ * @example
225
+ * const diff = await getUnstagedDiff('/path/to/repo')
226
+ * console.log(`${diff.stats.filesChanged} files changed`)
227
+ * console.log(`+${diff.stats.insertions} -${diff.stats.deletions}`)
228
+ */
229
+ export declare function getUnstagedDiff(repoPath: string): Promise<DiffResult>;
230
+ /**
231
+ * Get staged changes (index vs HEAD).
232
+ *
233
+ * @description Compares the index (staging area) against HEAD to find
234
+ * all staged changes. These are changes that have been added with
235
+ * `git add` and are ready to be committed.
236
+ *
237
+ * @param repoPath - Path to the repository root
238
+ * @returns Promise<DiffResult> with entries for each staged file
239
+ *
240
+ * @example
241
+ * const diff = await getStagedDiff('/path/to/repo')
242
+ * if (diff.entries.length === 0) {
243
+ * console.log('No staged changes')
244
+ * }
245
+ */
246
+ export declare function getStagedDiff(repoPath: string): Promise<DiffResult>;
247
+ /**
248
+ * Get diff between two commits.
249
+ *
250
+ * @description Compares two commits and returns the differences between them.
251
+ * Useful for seeing what changed between any two points in history.
252
+ *
253
+ * @param repoPath - Path to the repository root
254
+ * @param fromCommit - Starting commit SHA or ref
255
+ * @param toCommit - Ending commit SHA or ref
256
+ * @returns Promise<DiffResult> with entries for each changed file
257
+ *
258
+ * @example
259
+ * const diff = await getCommitDiff('/repo', 'HEAD~1', 'HEAD')
260
+ * console.log(`Last commit changed ${diff.stats.filesChanged} files`)
261
+ */
262
+ export declare function getCommitDiff(repoPath: string, fromCommit: string, toCommit: string): Promise<DiffResult>;
263
+ /**
264
+ * Get diff between two branches.
265
+ *
266
+ * @description Compares two branches and returns the differences. Useful for
267
+ * reviewing changes between feature branches and main.
268
+ *
269
+ * @param repoPath - Path to the repository root
270
+ * @param fromBranch - Base branch name
271
+ * @param toBranch - Target branch name
272
+ * @returns Promise<DiffResult> with entries for each changed file
273
+ *
274
+ * @example
275
+ * const diff = await getBranchDiff('/repo', 'main', 'feature/new-feature')
276
+ * console.log(`Feature branch has ${diff.stats.insertions} new lines`)
277
+ */
278
+ export declare function getBranchDiff(repoPath: string, fromBranch: string, toBranch: string): Promise<DiffResult>;
279
+ /**
280
+ * Get diff for a specific file path.
281
+ *
282
+ * @description Retrieves the diff for a single file or glob pattern.
283
+ * Can show either staged or unstaged changes.
284
+ *
285
+ * @param repoPath - Path to the repository root
286
+ * @param filePath - File path (relative to repo) or glob pattern
287
+ * @param options - Optional settings for staged mode or commit comparison
288
+ * @param options.staged - Show staged changes for this file
289
+ * @param options.commit - Compare against specific commit
290
+ * @returns Promise<DiffResult> with diff for the specified file(s)
291
+ *
292
+ * @example
293
+ * const diff = await getFileDiff('/repo', 'src/index.ts')
294
+ *
295
+ * @example
296
+ * // Staged changes only
297
+ * const diff = await getFileDiff('/repo', 'src/index.ts', { staged: true })
298
+ */
299
+ export declare function getFileDiff(repoPath: string, filePath: string, options?: {
300
+ staged?: boolean;
301
+ commit?: string;
302
+ }): Promise<DiffResult>;
303
+ /**
304
+ * Compute unified diff between two content strings.
305
+ *
306
+ * @description Uses the Myers diff algorithm (via LCS) to compute the
307
+ * minimal edit distance between two content strings and returns the
308
+ * result as unified diff hunks.
309
+ *
310
+ * @param oldContent - Original content string
311
+ * @param newContent - New content string
312
+ * @param options - Diff options
313
+ * @param options.context - Number of context lines (default: 3)
314
+ * @returns Array of DiffHunk objects representing the changes
315
+ *
316
+ * @example
317
+ * const hunks = computeUnifiedDiff(
318
+ * 'line1\nline2\nline3',
319
+ * 'line1\nmodified\nline3'
320
+ * )
321
+ */
322
+ export declare function computeUnifiedDiff(oldContent: string, newContent: string, options?: {
323
+ context?: number;
324
+ }): DiffHunk[];
325
+ /**
326
+ * Compute word-level diff within a line.
327
+ *
328
+ * @description Computes fine-grained differences at the word/token level
329
+ * within a single line. Useful for inline highlighting of small changes.
330
+ *
331
+ * @param oldLine - Original line content
332
+ * @param newLine - New line content
333
+ * @returns Array of WordChange objects showing what changed
334
+ *
335
+ * @example
336
+ * const changes = computeWordDiff('const foo = 1', 'const bar = 1')
337
+ * // Returns: [unchanged: 'const ', removed: 'foo', added: 'bar', unchanged: ' = 1']
338
+ */
339
+ export declare function computeWordDiff(oldLine: string, newLine: string): WordChange[];
340
+ /**
341
+ * Apply Shiki syntax highlighting to diff output.
342
+ *
343
+ * @description Processes a DiffResult and applies syntax highlighting
344
+ * using Shiki. Each file is highlighted according to its detected language.
345
+ * Returns ANSI-colored output suitable for terminal display.
346
+ *
347
+ * @param diff - The diff result to highlight
348
+ * @param options - Optional highlighting options
349
+ * @param options.theme - Shiki theme name (default: 'github-dark')
350
+ * @returns Promise<HighlightedDiff> with highlighted lines and language map
351
+ *
352
+ * @example
353
+ * const diff = await getUnstagedDiff('/repo')
354
+ * const highlighted = await highlightDiff(diff)
355
+ * highlighted.lines.forEach(line => console.log(line))
356
+ */
357
+ export declare function highlightDiff(diff: DiffResult, options?: {
358
+ theme?: string;
359
+ }): Promise<HighlightedDiff>;
360
+ /**
361
+ * Get language from file extension for Shiki.
362
+ *
363
+ * @description Maps file extensions to Shiki language identifiers for
364
+ * syntax highlighting. Falls back to 'plaintext' for unknown extensions.
365
+ *
366
+ * @param filePath - File path to detect language for
367
+ * @returns Shiki language identifier (e.g., 'typescript', 'python')
368
+ *
369
+ * @example
370
+ * getLanguageFromPath('src/index.ts') // Returns 'typescript'
371
+ * getLanguageFromPath('script.py') // Returns 'python'
372
+ * getLanguageFromPath('data.xyz') // Returns 'plaintext'
373
+ */
374
+ export declare function getLanguageFromPath(filePath: string): string;
375
+ /**
376
+ * Format diff output with syntax highlighting.
377
+ *
378
+ * @description Main formatting function that applies syntax highlighting
379
+ * to diff output. Respects NO_COLOR environment variable and --no-color
380
+ * option for accessibility.
381
+ *
382
+ * @param diff - The diff result to format
383
+ * @param options - Diff options including noColor flag
384
+ * @returns Promise<string[]> array of formatted output lines
385
+ *
386
+ * @example
387
+ * const diff = await getUnstagedDiff('/repo')
388
+ * const lines = await formatHighlightedDiff(diff)
389
+ * lines.forEach(line => console.log(line))
390
+ *
391
+ * @example
392
+ * // Without colors
393
+ * const lines = await formatHighlightedDiff(diff, { noColor: true })
394
+ */
395
+ export declare function formatHighlightedDiff(diff: DiffResult, options?: DiffOptions): Promise<string[]>;
396
+ /**
397
+ * Format diff as plain text (no highlighting).
398
+ *
399
+ * @description Formats diff output without any ANSI colors or syntax
400
+ * highlighting. Suitable for piping to files or non-terminal output.
401
+ *
402
+ * @param diff - The diff result to format
403
+ * @returns Array of plain text output lines
404
+ *
405
+ * @example
406
+ * const diff = await getUnstagedDiff('/repo')
407
+ * const lines = formatPlainDiff(diff)
408
+ */
409
+ export declare function formatPlainDiff(diff: DiffResult): string[];
410
+ /**
411
+ * Format diff header for a file entry.
412
+ *
413
+ * @description Generates the git-style diff header lines for a file,
414
+ * including the diff --git line, mode changes, index line, and +++ / --- lines.
415
+ *
416
+ * @param entry - The DiffEntry to generate header for
417
+ * @returns Array of header lines
418
+ *
419
+ * @example
420
+ * const header = formatDiffHeader(entry)
421
+ * // Returns: ['diff --git a/file.ts b/file.ts', '--- a/file.ts', '+++ b/file.ts']
422
+ */
423
+ export declare function formatDiffHeader(entry: DiffEntry): string[];
424
+ /**
425
+ * Format hunk header.
426
+ *
427
+ * @description Creates the @@ line that starts each diff hunk, showing
428
+ * the line ranges in both old and new files.
429
+ *
430
+ * @param hunk - The DiffHunk to format
431
+ * @returns Formatted hunk header string (e.g., '@@ -1,5 +1,7 @@ function foo')
432
+ *
433
+ * @example
434
+ * formatHunkHeader({ oldStart: 1, oldCount: 5, newStart: 1, newCount: 7 })
435
+ * // Returns: '@@ -1,5 +1,7 @@'
436
+ */
437
+ export declare function formatHunkHeader(hunk: DiffHunk): string;
438
+ /**
439
+ * Format file mode change indicator.
440
+ *
441
+ * @description Creates a human-readable string showing a file mode change.
442
+ *
443
+ * @param oldMode - Original file mode (e.g., '100644')
444
+ * @param newMode - New file mode (e.g., '100755')
445
+ * @returns Formatted mode change string
446
+ *
447
+ * @example
448
+ * formatModeChange('100644', '100755') // Returns 'mode change 100644 -> 100755'
449
+ */
450
+ export declare function formatModeChange(oldMode: string, newMode: string): string;
451
+ /**
452
+ * Format binary file indicator.
453
+ *
454
+ * @description Creates a message indicating that a file is binary
455
+ * and cannot be diffed as text.
456
+ *
457
+ * @param filePath - Path to the binary file
458
+ * @returns Formatted binary indicator string
459
+ *
460
+ * @example
461
+ * formatBinaryIndicator('image.png') // Returns 'Binary files differ: image.png'
462
+ */
463
+ export declare function formatBinaryIndicator(filePath: string): string;
464
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/diff.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAS9C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,OAAO,C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