gitx.do 0.0.2 → 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 +1 -1
@@ -0,0 +1,523 @@
1
+ /**
2
+ * @fileoverview CLI Entry Point for gitx
3
+ *
4
+ * This module provides the main command-line interface for gitx, a git-compatible
5
+ * version control system. It handles argument parsing, command routing, and
6
+ * provides the foundation for all CLI subcommands.
7
+ *
8
+ * @module cli/index
9
+ *
10
+ * @example
11
+ * // Create and run CLI programmatically
12
+ * import { createCLI, runCLI } from './cli'
13
+ *
14
+ * const cli = createCLI({ name: 'gitx', version: '1.0.0' })
15
+ * cli.registerCommand('status', statusHandler)
16
+ * await cli.run(['status', '--short'])
17
+ *
18
+ * @example
19
+ * // Parse arguments without running
20
+ * import { parseArgs } from './cli'
21
+ *
22
+ * const parsed = parseArgs(['status', '--short', '--branch'])
23
+ * console.log(parsed.command) // 'status'
24
+ * console.log(parsed.options) // { short: true, branch: true }
25
+ */
26
+ import cac from 'cac';
27
+ import { existsSync } from 'fs';
28
+ import { resolve } from 'path';
29
+ // ============================================================================
30
+ // Constants
31
+ // ============================================================================
32
+ /** Available subcommands for the CLI */
33
+ const SUBCOMMANDS = ['status', 'diff', 'log', 'blame', 'commit', 'branch', 'review', 'web'];
34
+ /** Current CLI version */
35
+ const VERSION = '0.0.1';
36
+ /** CLI name */
37
+ const NAME = 'gitx';
38
+ // ============================================================================
39
+ // CLI Class
40
+ // ============================================================================
41
+ /**
42
+ * Main CLI class for gitx command-line interface.
43
+ *
44
+ * @description Provides command registration, argument parsing, help generation,
45
+ * and command execution. Supports custom output streams for testing.
46
+ *
47
+ * @example
48
+ * const cli = new CLI({ name: 'gitx', version: '1.0.0' })
49
+ * cli.registerCommand('status', statusHandler)
50
+ * const result = await cli.run(['status', '--short'])
51
+ *
52
+ * @example
53
+ * // With custom output streams for testing
54
+ * const output: string[] = []
55
+ * const cli = new CLI({
56
+ * stdout: (msg) => output.push(msg),
57
+ * stderr: (msg) => output.push(`ERROR: ${msg}`)
58
+ * })
59
+ */
60
+ export class CLI {
61
+ /** The name of the CLI tool */
62
+ name;
63
+ /** The version of the CLI tool */
64
+ version;
65
+ /** Registered command handlers */
66
+ handlers = new Map();
67
+ /** Function for standard output */
68
+ stdout;
69
+ /** Function for error output */
70
+ stderr;
71
+ /**
72
+ * Creates a new CLI instance.
73
+ *
74
+ * @description Initializes the CLI with optional name, version, and I/O functions.
75
+ * Defaults are provided for all options.
76
+ *
77
+ * @param options - Configuration options
78
+ * @param options.name - CLI name (default: 'gitx')
79
+ * @param options.version - CLI version (default: '0.0.1')
80
+ * @param options.stdout - Standard output function (default: console.log)
81
+ * @param options.stderr - Error output function (default: console.error)
82
+ *
83
+ * @example
84
+ * const cli = new CLI({ name: 'my-tool', version: '2.0.0' })
85
+ */
86
+ constructor(options = {}) {
87
+ this.name = options.name ?? NAME;
88
+ this.version = options.version ?? VERSION;
89
+ this.stdout = options.stdout ?? console.log;
90
+ this.stderr = options.stderr ?? console.error;
91
+ }
92
+ /**
93
+ * Registers a command handler for a subcommand.
94
+ *
95
+ * @description Associates a handler function with a command name. The handler
96
+ * will be invoked when that command is executed.
97
+ *
98
+ * @param name - The command name (e.g., 'status', 'diff')
99
+ * @param handler - The function to handle the command
100
+ *
101
+ * @example
102
+ * cli.registerCommand('status', async (ctx) => {
103
+ * const status = await getStatus(ctx.cwd)
104
+ * ctx.stdout(formatStatus(status))
105
+ * })
106
+ */
107
+ registerCommand(name, handler) {
108
+ this.handlers.set(name, handler);
109
+ }
110
+ /**
111
+ * Runs the CLI with the provided arguments.
112
+ *
113
+ * @description Parses arguments, handles help/version flags, validates commands,
114
+ * and executes the appropriate handler. Returns a result object with exit code.
115
+ *
116
+ * @param args - Command-line arguments (excluding 'node' and script name)
117
+ * @param options - Run options
118
+ * @param options.skipCwdCheck - Skip validation of --cwd directory existence
119
+ * @returns Promise<CLIResult> with exitCode, command, and potential error
120
+ *
121
+ * @throws Never throws directly - errors are captured in CLIResult.error
122
+ *
123
+ * @example
124
+ * const result = await cli.run(['status', '--short'])
125
+ * if (result.exitCode === 0) {
126
+ * console.log('Success!')
127
+ * } else {
128
+ * console.error('Failed:', result.error?.message)
129
+ * }
130
+ *
131
+ * @example
132
+ * // Skip cwd validation for testing
133
+ * const result = await cli.run(['status'], { skipCwdCheck: true })
134
+ */
135
+ async run(args, options = {}) {
136
+ const parsed = parseArgs(args);
137
+ // Check for help flag
138
+ if (parsed.options.help || parsed.options.h) {
139
+ if (parsed.command) {
140
+ this.stdout(this.getSubcommandHelp(parsed.command));
141
+ }
142
+ else {
143
+ this.stdout(this.getHelp());
144
+ }
145
+ return { exitCode: 0, command: parsed.command };
146
+ }
147
+ // Check for version flag (only when no command is specified)
148
+ // When a command is present, -v should be interpreted as verbose for that command
149
+ if (!parsed.command && (parsed.options.version || parsed.options.v)) {
150
+ this.stdout(`${this.name} ${this.version}`);
151
+ return { exitCode: 0 };
152
+ }
153
+ // For --version flag without command
154
+ if (!parsed.command && parsed.options.version) {
155
+ this.stdout(`${this.name} ${this.version}`);
156
+ return { exitCode: 0 };
157
+ }
158
+ // Check for unknown flags (flags starting with -- that aren't recognized)
159
+ const knownFlags = ['cwd', 'C', 'help', 'h', 'version', 'v', 'short', 'branch', 'staged',
160
+ 'cached', 'n', 'oneline', 'graph', 'all', 'format', 'L', 'm', 'amend', 'a', 'd', 'D', 'list',
161
+ 'interactive', 'port', 'open', 'verbose', 'vv'];
162
+ for (const key of Object.keys(parsed.options)) {
163
+ if (!knownFlags.includes(key) && key !== '--') {
164
+ this.stderr(`Unknown option: --${key}\nRun 'gitx --help' for available commands.`);
165
+ return { exitCode: 1, error: new Error(`Unknown option: --${key}`) };
166
+ }
167
+ }
168
+ // If no command, show help
169
+ if (!parsed.command) {
170
+ this.stdout(this.getHelp());
171
+ return { exitCode: 0 };
172
+ }
173
+ // Check if command exists
174
+ if (!SUBCOMMANDS.includes(parsed.command) && !this.handlers.has(parsed.command)) {
175
+ const suggestion = this.suggestCommand(parsed.command);
176
+ let errorMsg = `Unknown command: ${parsed.command}`;
177
+ if (suggestion) {
178
+ errorMsg += `\nDid you mean '${suggestion}'?`;
179
+ }
180
+ errorMsg += `\nRun 'gitx --help' for available commands.`;
181
+ this.stderr(errorMsg);
182
+ return { exitCode: 1, command: parsed.command, error: new Error(`Unknown command: ${parsed.command}`) };
183
+ }
184
+ // Execute command handler if registered
185
+ const handler = this.handlers.get(parsed.command);
186
+ if (handler) {
187
+ try {
188
+ await handler({
189
+ cwd: parsed.cwd,
190
+ args: parsed.args,
191
+ options: parsed.options,
192
+ rawArgs: parsed.rawArgs,
193
+ stdout: this.stdout,
194
+ stderr: this.stderr
195
+ });
196
+ return { exitCode: 0, command: parsed.command };
197
+ }
198
+ catch (err) {
199
+ const error = err instanceof Error ? err : new Error(String(err));
200
+ this.stderr(`Error: ${error.message}`);
201
+ return { exitCode: 1, command: parsed.command, error };
202
+ }
203
+ }
204
+ // Check if --cwd directory exists (only for built-in commands without handlers)
205
+ if (parsed.cwd !== process.cwd() && !options.skipCwdCheck) {
206
+ if (!existsSync(parsed.cwd)) {
207
+ this.stderr(`Error: directory does not exist: ${parsed.cwd}`);
208
+ return { exitCode: 1, command: parsed.command, error: new Error(`directory does not exist: ${parsed.cwd}`) };
209
+ }
210
+ }
211
+ // Default behavior for built-in commands without handler
212
+ return { exitCode: 0, command: parsed.command };
213
+ }
214
+ /**
215
+ * Generates the main help text for the CLI.
216
+ *
217
+ * @description Creates formatted help output showing available commands,
218
+ * options, and usage information.
219
+ *
220
+ * @returns Formatted help string
221
+ */
222
+ getHelp() {
223
+ return `${this.name} v${this.version}
224
+
225
+ Usage: ${this.name} [options] <command> [args...]
226
+
227
+ Commands:
228
+ status Show the working tree status
229
+ diff Show changes between commits
230
+ log Show commit logs
231
+ blame Show what revision and author last modified each line
232
+ commit Record changes to the repository
233
+ branch List, create, or delete branches
234
+ review Review pull requests
235
+ web Start the web interface
236
+
237
+ Options:
238
+ -h, --help Show help
239
+ -v, --version Show version
240
+ -C, --cwd Set the working directory`;
241
+ }
242
+ /**
243
+ * Generates help text for a specific subcommand.
244
+ *
245
+ * @description Creates formatted help output for a specific command
246
+ * including its description and usage pattern.
247
+ *
248
+ * @param command - The command name to get help for
249
+ * @returns Formatted help string for the command
250
+ */
251
+ getSubcommandHelp(command) {
252
+ const descriptions = {
253
+ status: 'Show the working tree status',
254
+ diff: 'Show changes between commits',
255
+ log: 'Show commit logs',
256
+ blame: 'Show what revision and author last modified each line',
257
+ commit: 'Record changes to the repository',
258
+ branch: 'List, create, or delete branches',
259
+ review: 'Review pull requests',
260
+ web: 'Start the web interface'
261
+ };
262
+ return `${this.name} ${command}
263
+
264
+ ${descriptions[command] || 'Command help'}
265
+
266
+ Usage: ${this.name} ${command} [options] [args...]`;
267
+ }
268
+ /**
269
+ * Suggests a command based on a misspelled input.
270
+ *
271
+ * @description Uses Levenshtein distance to find the closest matching
272
+ * command when the user enters an unknown command. Only suggests
273
+ * commands within a distance of 3 edits.
274
+ *
275
+ * @param input - The misspelled command input
276
+ * @returns The suggested command name, or null if no close match
277
+ */
278
+ suggestCommand(input) {
279
+ // Simple Levenshtein distance for typo detection
280
+ let minDistance = Infinity;
281
+ let suggestion = null;
282
+ for (const cmd of SUBCOMMANDS) {
283
+ const distance = levenshteinDistance(input, cmd);
284
+ if (distance < minDistance && distance <= 3) {
285
+ minDistance = distance;
286
+ suggestion = cmd;
287
+ }
288
+ }
289
+ return suggestion;
290
+ }
291
+ }
292
+ // ============================================================================
293
+ // Utility Functions
294
+ // ============================================================================
295
+ /**
296
+ * Calculates the Levenshtein distance between two strings.
297
+ *
298
+ * @description Computes the minimum number of single-character edits
299
+ * (insertions, deletions, or substitutions) required to change one
300
+ * string into the other. Used for command suggestion/typo detection.
301
+ *
302
+ * @param a - First string
303
+ * @param b - Second string
304
+ * @returns The edit distance between the strings
305
+ *
306
+ * @example
307
+ * levenshteinDistance('status', 'staus') // Returns 1
308
+ * levenshteinDistance('commit', 'comit') // Returns 1
309
+ * levenshteinDistance('diff', 'branch') // Returns 6
310
+ */
311
+ function levenshteinDistance(a, b) {
312
+ const matrix = [];
313
+ for (let i = 0; i <= b.length; i++) {
314
+ matrix[i] = [i];
315
+ }
316
+ for (let j = 0; j <= a.length; j++) {
317
+ matrix[0][j] = j;
318
+ }
319
+ for (let i = 1; i <= b.length; i++) {
320
+ for (let j = 1; j <= a.length; j++) {
321
+ if (b.charAt(i - 1) === a.charAt(j - 1)) {
322
+ matrix[i][j] = matrix[i - 1][j - 1];
323
+ }
324
+ else {
325
+ matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
326
+ }
327
+ }
328
+ }
329
+ return matrix[b.length][a.length];
330
+ }
331
+ // ============================================================================
332
+ // Exported Functions
333
+ // ============================================================================
334
+ /**
335
+ * Creates a new CLI instance with the provided options.
336
+ *
337
+ * @description Factory function for creating CLI instances. Provides a
338
+ * convenient way to instantiate the CLI with custom configuration.
339
+ *
340
+ * @param options - Configuration options for the CLI
341
+ * @param options.name - CLI name (default: 'gitx')
342
+ * @param options.version - CLI version (default: '0.0.1')
343
+ * @param options.stdout - Standard output function (default: console.log)
344
+ * @param options.stderr - Error output function (default: console.error)
345
+ * @returns A new CLI instance
346
+ *
347
+ * @example
348
+ * const cli = createCLI({ name: 'my-git', version: '1.0.0' })
349
+ * cli.registerCommand('status', statusHandler)
350
+ * await cli.run(['status'])
351
+ *
352
+ * @example
353
+ * // For testing with captured output
354
+ * const output: string[] = []
355
+ * const cli = createCLI({
356
+ * stdout: (msg) => output.push(msg)
357
+ * })
358
+ */
359
+ export function createCLI(options = {}) {
360
+ return new CLI(options);
361
+ }
362
+ /**
363
+ * Parses command-line arguments into a structured format.
364
+ *
365
+ * @description Uses the cac library to parse arguments, extracting the command,
366
+ * positional arguments, options/flags, and handling special cases like --cwd
367
+ * and the '--' separator for raw arguments.
368
+ *
369
+ * @param args - Array of command-line arguments (excluding 'node' and script name)
370
+ * @returns ParsedArgs object with command, args, options, rawArgs, and cwd
371
+ *
372
+ * @example
373
+ * const parsed = parseArgs(['status', '--short', '--branch'])
374
+ * // Returns: {
375
+ * // command: 'status',
376
+ * // args: [],
377
+ * // options: { short: true, branch: true },
378
+ * // rawArgs: [],
379
+ * // cwd: process.cwd()
380
+ * // }
381
+ *
382
+ * @example
383
+ * const parsed = parseArgs(['--cwd', '/repo', 'diff', '--staged'])
384
+ * // Returns: {
385
+ * // command: 'diff',
386
+ * // args: [],
387
+ * // options: { staged: true, cwd: '/repo' },
388
+ * // rawArgs: [],
389
+ * // cwd: '/repo'
390
+ * // }
391
+ *
392
+ * @example
393
+ * // With raw args after '--'
394
+ * const parsed = parseArgs(['commit', '-m', 'msg', '--', 'file.txt'])
395
+ * // Returns: {
396
+ * // command: 'commit',
397
+ * // args: [],
398
+ * // options: { m: 'msg' },
399
+ * // rawArgs: ['file.txt'],
400
+ * // cwd: process.cwd()
401
+ * // }
402
+ */
403
+ export function parseArgs(args) {
404
+ const cli = cac('gitx');
405
+ // Global options
406
+ cli.option('-C, --cwd <path>', 'Set the working directory');
407
+ cli.option('-h, --help', 'Show help');
408
+ cli.option('-v, --version', 'Show version');
409
+ // Status command options
410
+ cli.option('--short', 'Give the output in short format');
411
+ cli.option('--branch', 'Show the branch info');
412
+ // Diff command options
413
+ cli.option('--staged', 'Show staged changes');
414
+ cli.option('--cached', 'Show cached changes (alias for staged)');
415
+ // Log command options
416
+ cli.option('-n <count>', 'Limit the number of commits');
417
+ cli.option('--oneline', 'Show each commit on a single line');
418
+ cli.option('--graph', 'Draw a text-based graph');
419
+ cli.option('--all', 'Show all refs');
420
+ cli.option('--format <format>', 'Pretty-print format');
421
+ // Blame command options
422
+ cli.option('-L <range>', 'Line range');
423
+ // Commit command options
424
+ cli.option('-m <message>', 'Commit message');
425
+ cli.option('--amend', 'Amend the previous commit');
426
+ cli.option('-a', 'Stage all modified files');
427
+ // Branch command options
428
+ cli.option('-d', 'Delete a branch');
429
+ cli.option('-D', 'Force delete a branch');
430
+ cli.option('--list', 'List branches');
431
+ cli.option('-v, --verbose', 'Verbose output');
432
+ cli.option('-vv', 'Very verbose output');
433
+ // Review command options
434
+ cli.option('--interactive', 'Interactive review mode');
435
+ // Web command options
436
+ cli.option('--port <port>', 'Port number');
437
+ cli.option('--open', 'Open in browser');
438
+ // Parse arguments
439
+ const parsed = cli.parse(['node', 'gitx', ...args], { run: false });
440
+ // Extract command and args
441
+ const positionalArgs = parsed.args.slice(); // Clone to avoid mutation
442
+ let command;
443
+ const commandArgs = [];
444
+ let rawArgs = [];
445
+ // Find command from positional args
446
+ for (let i = 0; i < positionalArgs.length; i++) {
447
+ const arg = positionalArgs[i];
448
+ if (!command && SUBCOMMANDS.includes(arg)) {
449
+ command = arg;
450
+ }
451
+ else if (arg === '--') {
452
+ rawArgs = positionalArgs.slice(i + 1);
453
+ break;
454
+ }
455
+ else if (command) {
456
+ commandArgs.push(arg);
457
+ }
458
+ else if (!arg.startsWith('-')) {
459
+ // This is either a command we don't recognize or a positional arg before command
460
+ command = arg;
461
+ }
462
+ }
463
+ // Handle --cwd option
464
+ let cwd = process.cwd();
465
+ if (parsed.options.cwd) {
466
+ cwd = resolve(process.cwd(), parsed.options.cwd);
467
+ }
468
+ else if (parsed.options.C) {
469
+ cwd = resolve(process.cwd(), parsed.options.C);
470
+ }
471
+ // Get rawArgs from cac's '--' key
472
+ if (parsed.options['--'] && Array.isArray(parsed.options['--'])) {
473
+ rawArgs = parsed.options['--'];
474
+ }
475
+ // Clean up options object
476
+ const options = { ...parsed.options };
477
+ delete options['--'];
478
+ // Convert numeric options
479
+ if (options.n !== undefined && typeof options.n === 'string') {
480
+ options.n = parseInt(options.n, 10);
481
+ }
482
+ if (options.port !== undefined && typeof options.port === 'string') {
483
+ options.port = parseInt(options.port, 10);
484
+ }
485
+ return {
486
+ command,
487
+ args: commandArgs,
488
+ options,
489
+ rawArgs,
490
+ cwd
491
+ };
492
+ }
493
+ /**
494
+ * Convenience function to create a CLI and run it with the provided arguments.
495
+ *
496
+ * @description Creates a new CLI instance with the provided options and
497
+ * immediately runs it with the given arguments. Useful for simple one-off
498
+ * CLI executions.
499
+ *
500
+ * @param args - Command-line arguments to run
501
+ * @param options - CLI options including output streams
502
+ * @returns Promise<CLIResult> with exitCode, command, and potential error
503
+ *
504
+ * @example
505
+ * const result = await runCLI(['status', '--short'])
506
+ * console.log(result.exitCode) // 0 or 1
507
+ *
508
+ * @example
509
+ * // With custom output handling
510
+ * const output: string[] = []
511
+ * const result = await runCLI(['status'], {
512
+ * stdout: (msg) => output.push(msg),
513
+ * stderr: (msg) => console.error(msg)
514
+ * })
515
+ */
516
+ export async function runCLI(args, options = {}) {
517
+ const cli = createCLI({
518
+ stdout: options.stdout,
519
+ stderr: options.stderr
520
+ });
521
+ return cli.run(args);
522
+ }
523
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAoJ9B,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,wCAAwC;AACxC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAA;AAEpG,0BAA0B;AAC1B,MAAM,OAAO,GAAG,OAAO,CAAA;AAEvB,eAAe;AACf,MAAM,IAAI,GAAG,MAAM,CAAA;AAEnB,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;;GAkBG;A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AAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;IACrC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpB,0BAA0B;IAC1B,IAAI,OAAO,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC7D,OAAO,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACnE,OAAO,CAAC,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,OAAO;QACP,GAAG;KACJ,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc,EAAE,UAAsB,EAAE;IACnE,MAAM,GAAG,GAAG,SAAS,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAA;IAEF,OAAO,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface DiffViewProps {
3
+ diff: string;
4
+ viewMode: 'split' | 'unified';
5
+ }
6
+ export declare function DiffView(props: DiffViewProps): ReactNode;
7
+ //# sourceMappingURL=DiffView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffView.d.ts","sourceRoot":"","sources":["../../../../src/cli/ui/components/DiffView.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,CAOxD"}
@@ -0,0 +1,11 @@
1
+ // Diff View Component for gitx terminal UI
2
+ // GREEN phase implementation
3
+ export function DiffView(props) {
4
+ return {
5
+ type: 'DiffView',
6
+ props,
7
+ diff: props.diff,
8
+ viewMode: props.viewMode
9
+ };
10
+ }
11
+ //# sourceMappingURL=DiffView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffView.js","sourceRoot":"","sources":["../../../../src/cli/ui/components/DiffView.tsx"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,6BAA6B;AAS7B,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface ErrorDisplayProps {
3
+ error: Error | string;
4
+ }
5
+ export declare function ErrorDisplay(props: ErrorDisplayProps): ReactNode;
6
+ //# sourceMappingURL=ErrorDisplay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorDisplay.d.ts","sourceRoot":"","sources":["../../../../src/cli/ui/components/ErrorDisplay.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAA;CACtB;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAOhE"}
@@ -0,0 +1,11 @@
1
+ // Error Display Component for gitx terminal UI
2
+ // GREEN phase implementation
3
+ export function ErrorDisplay(props) {
4
+ const message = props.error instanceof Error ? props.error.message : props.error;
5
+ return {
6
+ type: 'ErrorDisplay',
7
+ props,
8
+ message
9
+ };
10
+ }
11
+ //# sourceMappingURL=ErrorDisplay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorDisplay.js","sourceRoot":"","sources":["../../../../src/cli/ui/components/ErrorDisplay.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,6BAA6B;AAQ7B,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAA;IAChF,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,KAAK;QACL,OAAO;KACR,CAAA;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface FuzzySearchProps {
3
+ items: string[];
4
+ onSelect: (item: string) => void;
5
+ onCancel: () => void;
6
+ placeholder?: string;
7
+ }
8
+ export declare function FuzzySearch(props: FuzzySearchProps): ReactNode;
9
+ //# sourceMappingURL=FuzzySearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FuzzySearch.d.ts","sourceRoot":"","sources":["../../../../src/cli/ui/components/FuzzySearch.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAQ9D"}
@@ -0,0 +1,12 @@
1
+ // Fuzzy Search Component for gitx terminal UI
2
+ // GREEN phase implementation
3
+ export function FuzzySearch(props) {
4
+ return {
5
+ type: 'FuzzySearch',
6
+ props,
7
+ items: props.items,
8
+ onSelect: props.onSelect,
9
+ onCancel: props.onCancel
10
+ };
11
+ }
12
+ //# sourceMappingURL=FuzzySearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FuzzySearch.js","sourceRoot":"","sources":["../../../../src/cli/ui/components/FuzzySearch.tsx"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,6BAA6B;AAW7B,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAA;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface LoadingSpinnerProps {
3
+ message?: string;
4
+ }
5
+ export declare function LoadingSpinner(props: LoadingSpinnerProps): ReactNode;
6
+ //# sourceMappingURL=LoadingSpinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingSpinner.d.ts","sourceRoot":"","sources":["../../../../src/cli/ui/components/LoadingSpinner.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAMpE"}
@@ -0,0 +1,10 @@
1
+ // Loading Spinner Component for gitx terminal UI
2
+ // GREEN phase implementation
3
+ export function LoadingSpinner(props) {
4
+ return {
5
+ type: 'LoadingSpinner',
6
+ props,
7
+ message: props.message
8
+ };
9
+ }
10
+ //# sourceMappingURL=LoadingSpinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../../../src/cli/ui/components/LoadingSpinner.tsx"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,6BAA6B;AAQ7B,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,KAAK;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAA;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface NavigationListProps {
3
+ items: string[];
4
+ selectedIndex: number;
5
+ onSelect: (index: number) => void;
6
+ onNavigate: (direction: 'up' | 'down') => void;
7
+ }
8
+ export declare function NavigationList(props: NavigationListProps): ReactNode;
9
+ //# sourceMappingURL=NavigationList.d.ts.map