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.
- package/dist/cli/commands/blame.d.ts +259 -0
- package/dist/cli/commands/blame.d.ts.map +1 -0
- package/dist/cli/commands/blame.js +609 -0
- package/dist/cli/commands/blame.js.map +1 -0
- package/dist/cli/commands/branch.d.ts +249 -0
- package/dist/cli/commands/branch.d.ts.map +1 -0
- package/dist/cli/commands/branch.js +693 -0
- package/dist/cli/commands/branch.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +182 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +437 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +464 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +958 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/log.d.ts +239 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +535 -0
- package/dist/cli/commands/log.js.map +1 -0
- package/dist/cli/commands/review.d.ts +457 -0
- package/dist/cli/commands/review.d.ts.map +1 -0
- package/dist/cli/commands/review.js +533 -0
- package/dist/cli/commands/review.js.map +1 -0
- package/dist/cli/commands/status.d.ts +269 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +493 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/web.d.ts +199 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +696 -0
- package/dist/cli/commands/web.js.map +1 -0
- package/dist/cli/fs-adapter.d.ts +656 -0
- package/dist/cli/fs-adapter.d.ts.map +1 -0
- package/dist/cli/fs-adapter.js +1179 -0
- package/dist/cli/fs-adapter.js.map +1 -0
- package/dist/cli/index.d.ts +387 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +523 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/components/DiffView.d.ts +7 -0
- package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
- package/dist/cli/ui/components/DiffView.js +11 -0
- package/dist/cli/ui/components/DiffView.js.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.js +11 -0
- package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.js +12 -0
- package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.js +10 -0
- package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
- package/dist/cli/ui/components/NavigationList.d.ts +9 -0
- package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
- package/dist/cli/ui/components/NavigationList.js +11 -0
- package/dist/cli/ui/components/NavigationList.js.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.js +11 -0
- package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
- package/dist/cli/ui/components/index.d.ts +7 -0
- package/dist/cli/ui/components/index.d.ts.map +1 -0
- package/dist/cli/ui/components/index.js +9 -0
- package/dist/cli/ui/components/index.js.map +1 -0
- package/dist/cli/ui/terminal-ui.d.ts +52 -0
- package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
- package/dist/cli/ui/terminal-ui.js +121 -0
- package/dist/cli/ui/terminal-ui.js.map +1 -0
- package/dist/durable-object/object-store.d.ts +401 -23
- package/dist/durable-object/object-store.d.ts.map +1 -1
- package/dist/durable-object/object-store.js +414 -25
- package/dist/durable-object/object-store.js.map +1 -1
- package/dist/durable-object/schema.d.ts +188 -0
- package/dist/durable-object/schema.d.ts.map +1 -1
- package/dist/durable-object/schema.js +160 -0
- package/dist/durable-object/schema.js.map +1 -1
- package/dist/durable-object/wal.d.ts +336 -31
- package/dist/durable-object/wal.d.ts.map +1 -1
- package/dist/durable-object/wal.js +272 -27
- package/dist/durable-object/wal.js.map +1 -1
- package/dist/index.d.ts +379 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +379 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/adapter.d.ts +579 -38
- package/dist/mcp/adapter.d.ts.map +1 -1
- package/dist/mcp/adapter.js +426 -33
- package/dist/mcp/adapter.js.map +1 -1
- package/dist/mcp/sandbox.d.ts +532 -29
- package/dist/mcp/sandbox.d.ts.map +1 -1
- package/dist/mcp/sandbox.js +389 -22
- package/dist/mcp/sandbox.js.map +1 -1
- package/dist/mcp/sdk-adapter.d.ts +478 -56
- package/dist/mcp/sdk-adapter.d.ts.map +1 -1
- package/dist/mcp/sdk-adapter.js +346 -44
- package/dist/mcp/sdk-adapter.js.map +1 -1
- package/dist/mcp/tools.d.ts +445 -30
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +363 -33
- package/dist/mcp/tools.js.map +1 -1
- package/dist/ops/blame.d.ts +424 -21
- package/dist/ops/blame.d.ts.map +1 -1
- package/dist/ops/blame.js +303 -20
- package/dist/ops/blame.js.map +1 -1
- package/dist/ops/branch.d.ts +583 -32
- package/dist/ops/branch.d.ts.map +1 -1
- package/dist/ops/branch.js +365 -23
- package/dist/ops/branch.js.map +1 -1
- package/dist/ops/commit-traversal.d.ts +164 -24
- package/dist/ops/commit-traversal.d.ts.map +1 -1
- package/dist/ops/commit-traversal.js +68 -2
- package/dist/ops/commit-traversal.js.map +1 -1
- package/dist/ops/commit.d.ts +387 -53
- package/dist/ops/commit.d.ts.map +1 -1
- package/dist/ops/commit.js +249 -29
- package/dist/ops/commit.js.map +1 -1
- package/dist/ops/merge-base.d.ts +195 -21
- package/dist/ops/merge-base.d.ts.map +1 -1
- package/dist/ops/merge-base.js +122 -12
- package/dist/ops/merge-base.js.map +1 -1
- package/dist/ops/merge.d.ts +600 -130
- package/dist/ops/merge.d.ts.map +1 -1
- package/dist/ops/merge.js +408 -60
- package/dist/ops/merge.js.map +1 -1
- package/dist/ops/tag.d.ts +67 -2
- package/dist/ops/tag.d.ts.map +1 -1
- package/dist/ops/tag.js +42 -1
- package/dist/ops/tag.js.map +1 -1
- package/dist/ops/tree-builder.d.ts +102 -6
- package/dist/ops/tree-builder.d.ts.map +1 -1
- package/dist/ops/tree-builder.js +30 -5
- package/dist/ops/tree-builder.js.map +1 -1
- package/dist/ops/tree-diff.d.ts +50 -2
- package/dist/ops/tree-diff.d.ts.map +1 -1
- package/dist/ops/tree-diff.js +50 -2
- package/dist/ops/tree-diff.js.map +1 -1
- package/dist/pack/delta.d.ts +211 -39
- package/dist/pack/delta.d.ts.map +1 -1
- package/dist/pack/delta.js +232 -46
- package/dist/pack/delta.js.map +1 -1
- package/dist/pack/format.d.ts +390 -28
- package/dist/pack/format.d.ts.map +1 -1
- package/dist/pack/format.js +344 -33
- package/dist/pack/format.js.map +1 -1
- package/dist/pack/full-generation.d.ts +313 -28
- package/dist/pack/full-generation.d.ts.map +1 -1
- package/dist/pack/full-generation.js +238 -19
- package/dist/pack/full-generation.js.map +1 -1
- package/dist/pack/generation.d.ts +346 -23
- package/dist/pack/generation.d.ts.map +1 -1
- package/dist/pack/generation.js +269 -21
- package/dist/pack/generation.js.map +1 -1
- package/dist/pack/index.d.ts +407 -86
- package/dist/pack/index.d.ts.map +1 -1
- package/dist/pack/index.js +351 -70
- package/dist/pack/index.js.map +1 -1
- package/dist/refs/branch.d.ts +517 -71
- package/dist/refs/branch.d.ts.map +1 -1
- package/dist/refs/branch.js +410 -26
- package/dist/refs/branch.js.map +1 -1
- package/dist/refs/storage.d.ts +610 -57
- package/dist/refs/storage.d.ts.map +1 -1
- package/dist/refs/storage.js +481 -29
- package/dist/refs/storage.js.map +1 -1
- package/dist/refs/tag.d.ts +677 -67
- package/dist/refs/tag.d.ts.map +1 -1
- package/dist/refs/tag.js +497 -30
- package/dist/refs/tag.js.map +1 -1
- package/dist/storage/lru-cache.d.ts +556 -53
- package/dist/storage/lru-cache.d.ts.map +1 -1
- package/dist/storage/lru-cache.js +439 -36
- package/dist/storage/lru-cache.js.map +1 -1
- package/dist/storage/object-index.d.ts +483 -38
- package/dist/storage/object-index.d.ts.map +1 -1
- package/dist/storage/object-index.js +388 -22
- package/dist/storage/object-index.js.map +1 -1
- package/dist/storage/r2-pack.d.ts +957 -94
- package/dist/storage/r2-pack.d.ts.map +1 -1
- package/dist/storage/r2-pack.js +756 -48
- package/dist/storage/r2-pack.js.map +1 -1
- package/dist/tiered/cdc-pipeline.d.ts +1610 -38
- package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
- package/dist/tiered/cdc-pipeline.js +1131 -22
- package/dist/tiered/cdc-pipeline.js.map +1 -1
- package/dist/tiered/migration.d.ts +903 -41
- package/dist/tiered/migration.d.ts.map +1 -1
- package/dist/tiered/migration.js +646 -24
- package/dist/tiered/migration.js.map +1 -1
- package/dist/tiered/parquet-writer.d.ts +944 -47
- package/dist/tiered/parquet-writer.d.ts.map +1 -1
- package/dist/tiered/parquet-writer.js +667 -39
- package/dist/tiered/parquet-writer.js.map +1 -1
- package/dist/tiered/read-path.d.ts +728 -34
- package/dist/tiered/read-path.d.ts.map +1 -1
- package/dist/tiered/read-path.js +310 -27
- package/dist/tiered/read-path.js.map +1 -1
- package/dist/types/objects.d.ts +457 -0
- package/dist/types/objects.d.ts.map +1 -1
- package/dist/types/objects.js +305 -4
- package/dist/types/objects.js.map +1 -1
- package/dist/types/storage.d.ts +407 -35
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types/storage.js +27 -3
- package/dist/types/storage.js.map +1 -1
- package/dist/utils/hash.d.ts +133 -12
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +133 -12
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/sha1.d.ts +102 -9
- package/dist/utils/sha1.d.ts.map +1 -1
- package/dist/utils/sha1.js +114 -11
- package/dist/utils/sha1.js.map +1 -1
- package/dist/wire/capabilities.d.ts +896 -88
- package/dist/wire/capabilities.d.ts.map +1 -1
- package/dist/wire/capabilities.js +566 -62
- package/dist/wire/capabilities.js.map +1 -1
- package/dist/wire/pkt-line.d.ts +293 -15
- package/dist/wire/pkt-line.d.ts.map +1 -1
- package/dist/wire/pkt-line.js +251 -15
- package/dist/wire/pkt-line.js.map +1 -1
- package/dist/wire/receive-pack.d.ts +814 -64
- package/dist/wire/receive-pack.d.ts.map +1 -1
- package/dist/wire/receive-pack.js +542 -41
- package/dist/wire/receive-pack.js.map +1 -1
- package/dist/wire/smart-http.d.ts +575 -97
- package/dist/wire/smart-http.d.ts.map +1 -1
- package/dist/wire/smart-http.js +337 -46
- package/dist/wire/smart-http.js.map +1 -1
- package/dist/wire/upload-pack.d.ts +492 -98
- package/dist/wire/upload-pack.d.ts.map +1 -1
- package/dist/wire/upload-pack.js +347 -59
- package/dist/wire/upload-pack.js.map +1 -1
- package/package.json +10 -2
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Git Blame Command
|
|
3
|
+
*
|
|
4
|
+
* This module implements the `gitx blame` command which shows what revision
|
|
5
|
+
* and author last modified each line of a file. Features include:
|
|
6
|
+
* - Line-by-line attribution to commits and authors
|
|
7
|
+
* - Line range filtering
|
|
8
|
+
* - Rename tracking (-C flag)
|
|
9
|
+
* - Syntax highlighting support via Shiki
|
|
10
|
+
* - Binary file detection
|
|
11
|
+
*
|
|
12
|
+
* @module cli/commands/blame
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Blame entire file
|
|
16
|
+
* const result = await getBlame(adapter, 'src/index.ts')
|
|
17
|
+
* for (const line of result.lines) {
|
|
18
|
+
* console.log(formatBlameLine(line))
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Blame specific line range
|
|
23
|
+
* const result = await getBlame(adapter, 'src/index.ts', { lineRange: '10,20' })
|
|
24
|
+
*/
|
|
25
|
+
import type { CommandContext } from '../index';
|
|
26
|
+
import type { FSAdapter } from '../fs-adapter';
|
|
27
|
+
/**
|
|
28
|
+
* Options for the blame command.
|
|
29
|
+
*
|
|
30
|
+
* @description Configuration options that control blame output and behavior.
|
|
31
|
+
*
|
|
32
|
+
* @property lineRange - Line range to blame (e.g., '10,20' or '10,+5')
|
|
33
|
+
* @property followRenames - Track file across renames (-C flag)
|
|
34
|
+
* @property highlight - Enable syntax highlighting with Shiki
|
|
35
|
+
* @property theme - Shiki theme name for highlighting
|
|
36
|
+
*/
|
|
37
|
+
export interface BlameOptions {
|
|
38
|
+
/** Line range in format "start,end" or "start,+count" */
|
|
39
|
+
lineRange?: string;
|
|
40
|
+
/** Follow file renames (-C flag) */
|
|
41
|
+
followRenames?: boolean;
|
|
42
|
+
/** Enable syntax highlighting with Shiki */
|
|
43
|
+
highlight?: boolean;
|
|
44
|
+
/** Syntax highlighting theme */
|
|
45
|
+
theme?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Blame annotation for a single line.
|
|
49
|
+
*
|
|
50
|
+
* @description Contains all attribution information for a single line of code,
|
|
51
|
+
* including the commit that last modified it, author info, and line numbers.
|
|
52
|
+
*
|
|
53
|
+
* @property commitSha - Full 40-character commit SHA
|
|
54
|
+
* @property shortSha - Abbreviated 8-character SHA
|
|
55
|
+
* @property author - Author name
|
|
56
|
+
* @property authorEmail - Author email address
|
|
57
|
+
* @property date - Commit date
|
|
58
|
+
* @property lineNumber - Current line number in file
|
|
59
|
+
* @property originalLineNumber - Line number in the originating commit
|
|
60
|
+
* @property content - Line content
|
|
61
|
+
* @property originalPath - Original file path if file was renamed
|
|
62
|
+
*/
|
|
63
|
+
export interface BlameLineAnnotation {
|
|
64
|
+
/** Full commit SHA */
|
|
65
|
+
commitSha: string;
|
|
66
|
+
/** Short commit SHA (8 chars) */
|
|
67
|
+
shortSha: string;
|
|
68
|
+
/** Author name */
|
|
69
|
+
author: string;
|
|
70
|
+
/** Author email */
|
|
71
|
+
authorEmail: string;
|
|
72
|
+
/** Commit date */
|
|
73
|
+
date: Date;
|
|
74
|
+
/** Current line number in file */
|
|
75
|
+
lineNumber: number;
|
|
76
|
+
/** Original line number in the commit that introduced this line */
|
|
77
|
+
originalLineNumber: number;
|
|
78
|
+
/** Line content */
|
|
79
|
+
content: string;
|
|
80
|
+
/** Original file path (if different due to rename) */
|
|
81
|
+
originalPath?: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Commit information for binary files.
|
|
85
|
+
*
|
|
86
|
+
* @description For binary files that cannot be blamed line-by-line,
|
|
87
|
+
* this provides file-level commit information.
|
|
88
|
+
*/
|
|
89
|
+
export interface BlameFileCommit {
|
|
90
|
+
/** Commit SHA */
|
|
91
|
+
sha: string;
|
|
92
|
+
/** Author name */
|
|
93
|
+
author: string;
|
|
94
|
+
/** Commit date */
|
|
95
|
+
date: Date;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Complete result of a blame operation.
|
|
99
|
+
*
|
|
100
|
+
* @description Contains all blame information for a file, including
|
|
101
|
+
* line annotations, binary file handling, and optional syntax highlighting.
|
|
102
|
+
*
|
|
103
|
+
* @property path - File path that was blamed
|
|
104
|
+
* @property originalPath - Original path if file was renamed
|
|
105
|
+
* @property lines - Array of line annotations
|
|
106
|
+
* @property isBinary - True if file is binary
|
|
107
|
+
* @property message - Message for binary or error cases
|
|
108
|
+
* @property fileCommit - Commit info for binary files
|
|
109
|
+
* @property highlighted - Syntax-highlighted line content
|
|
110
|
+
* @property language - Detected programming language
|
|
111
|
+
* @property theme - Shiki theme used for highlighting
|
|
112
|
+
*/
|
|
113
|
+
export interface BlameResult {
|
|
114
|
+
/** File path being blamed */
|
|
115
|
+
path: string;
|
|
116
|
+
/** Original file path if renamed */
|
|
117
|
+
originalPath?: string;
|
|
118
|
+
/** Line annotations */
|
|
119
|
+
lines: BlameLineAnnotation[];
|
|
120
|
+
/** Whether file is binary */
|
|
121
|
+
isBinary: boolean;
|
|
122
|
+
/** Message for binary/error cases */
|
|
123
|
+
message?: string;
|
|
124
|
+
/** File-level commit info (for binary files) */
|
|
125
|
+
fileCommit?: BlameFileCommit;
|
|
126
|
+
/** Syntax highlighted lines (if highlight option enabled) */
|
|
127
|
+
highlighted?: string[];
|
|
128
|
+
/** Detected language */
|
|
129
|
+
language?: string;
|
|
130
|
+
/** Theme used for highlighting */
|
|
131
|
+
theme?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Represents a line range for filtering blame output.
|
|
135
|
+
*
|
|
136
|
+
* @property start - Starting line number (1-indexed)
|
|
137
|
+
* @property end - Ending line number (1-indexed, inclusive)
|
|
138
|
+
*/
|
|
139
|
+
export interface LineRange {
|
|
140
|
+
/** Starting line number (1-indexed) */
|
|
141
|
+
start: number;
|
|
142
|
+
/** Ending line number (1-indexed, inclusive) */
|
|
143
|
+
end: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Execute the blame command from the CLI.
|
|
147
|
+
*
|
|
148
|
+
* @description Parses command-line arguments and displays blame annotations
|
|
149
|
+
* for the specified file. This is the entry point for the `gitx blame` command.
|
|
150
|
+
*
|
|
151
|
+
* @param ctx - Command context containing cwd, args, options, and output functions
|
|
152
|
+
* @returns Promise that resolves when output is complete
|
|
153
|
+
* @throws {Error} Always throws "Not implemented" - command not yet implemented
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* // CLI usage
|
|
157
|
+
* // gitx blame src/index.ts
|
|
158
|
+
* // gitx blame -L 10,20 src/index.ts
|
|
159
|
+
* // gitx blame -C src/renamed-file.ts
|
|
160
|
+
*/
|
|
161
|
+
export declare function blameCommand(ctx: CommandContext): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Get blame annotations for a file.
|
|
164
|
+
*
|
|
165
|
+
* @description Computes blame annotations for each line of a file by walking
|
|
166
|
+
* the commit history. For each line, identifies the commit and author that
|
|
167
|
+
* last modified it. Supports line range filtering and rename tracking.
|
|
168
|
+
*
|
|
169
|
+
* The algorithm:
|
|
170
|
+
* 1. Gets the current file content at HEAD
|
|
171
|
+
* 2. Initializes all lines as attributed to HEAD
|
|
172
|
+
* 3. Walks backward through commit history
|
|
173
|
+
* 4. Uses LCS (Longest Common Subsequence) to map lines between commits
|
|
174
|
+
* 5. Updates line attribution when a line exists in a parent commit
|
|
175
|
+
*
|
|
176
|
+
* @param adapter - Filesystem adapter for reading git objects
|
|
177
|
+
* @param filePath - Path to the file to blame (relative to repo root)
|
|
178
|
+
* @param options - Blame options for filtering and behavior
|
|
179
|
+
* @returns Promise resolving to blame result with line annotations
|
|
180
|
+
* @throws {Error} If file path contains null character
|
|
181
|
+
* @throws {Error} If HEAD cannot be resolved (empty repository)
|
|
182
|
+
* @throws {Error} If HEAD commit cannot be read
|
|
183
|
+
* @throws {Error} If file does not exist in repository
|
|
184
|
+
* @throws {Error} If line range is invalid (end before start, exceeds file length)
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* // Blame entire file
|
|
188
|
+
* const result = await getBlame(adapter, 'src/index.ts')
|
|
189
|
+
* console.log(`File has ${result.lines.length} lines`)
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* // Blame specific line range
|
|
193
|
+
* const result = await getBlame(adapter, 'src/index.ts', { lineRange: '10,20' })
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* // Blame with rename tracking
|
|
197
|
+
* const result = await getBlame(adapter, 'src/new-name.ts', { followRenames: true })
|
|
198
|
+
* if (result.originalPath) {
|
|
199
|
+
* console.log(`File was renamed from ${result.originalPath}`)
|
|
200
|
+
* }
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* // Handle binary files
|
|
204
|
+
* const result = await getBlame(adapter, 'assets/image.png')
|
|
205
|
+
* if (result.isBinary) {
|
|
206
|
+
* console.log(result.message) // "binary file - cannot show line-by-line blame"
|
|
207
|
+
* console.log(`Last modified by: ${result.fileCommit?.author}`)
|
|
208
|
+
* }
|
|
209
|
+
*/
|
|
210
|
+
export declare function getBlame(adapter: FSAdapter, filePath: string, options?: BlameOptions): Promise<BlameResult>;
|
|
211
|
+
/**
|
|
212
|
+
* Format a blame line annotation for display.
|
|
213
|
+
*
|
|
214
|
+
* @description Formats a single blame line in a human-readable format similar
|
|
215
|
+
* to git blame output: `<sha> (<author> <date>) <content>`
|
|
216
|
+
*
|
|
217
|
+
* @param annotation - The blame line annotation to format
|
|
218
|
+
* @param options - Formatting options
|
|
219
|
+
* @param options.showOriginalLineNumber - If true, shows both original and current line numbers
|
|
220
|
+
* @returns Formatted string for display
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* const formatted = formatBlameLine(annotation)
|
|
224
|
+
* // Output: "abc12345 (John Doe 2024-01-15) const x = 1"
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* // With original line numbers (for renamed files)
|
|
228
|
+
* const formatted = formatBlameLine(annotation, { showOriginalLineNumber: true })
|
|
229
|
+
* // Output: "abc12345 (John Doe 2024-01-15 10 12) const x = 1"
|
|
230
|
+
*/
|
|
231
|
+
export declare function formatBlameLine(annotation: BlameLineAnnotation, options?: {
|
|
232
|
+
showOriginalLineNumber?: boolean;
|
|
233
|
+
}): string;
|
|
234
|
+
/**
|
|
235
|
+
* Parse a line range string into start and end values.
|
|
236
|
+
*
|
|
237
|
+
* @description Parses line range specifications used with the -L flag.
|
|
238
|
+
* Supports two formats:
|
|
239
|
+
* - Absolute: "start,end" (e.g., "10,20" for lines 10-20)
|
|
240
|
+
* - Relative: "start,+count" (e.g., "10,+5" for lines 10-15)
|
|
241
|
+
*
|
|
242
|
+
* @param rangeStr - Line range string in "start,end" or "start,+count" format
|
|
243
|
+
* @returns Parsed line range with start and end (1-indexed, inclusive)
|
|
244
|
+
* @throws {Error} If format is invalid (not two comma-separated values)
|
|
245
|
+
* @throws {Error} If start line is not a valid number
|
|
246
|
+
* @throws {Error} If end line or offset is not a valid number
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* // Absolute range
|
|
250
|
+
* const range = parseLineRange('10,20')
|
|
251
|
+
* console.log(range) // { start: 10, end: 20 }
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* // Relative range
|
|
255
|
+
* const range = parseLineRange('10,+5')
|
|
256
|
+
* console.log(range) // { start: 10, end: 15 }
|
|
257
|
+
*/
|
|
258
|
+
export declare function parseLineRange(rangeStr: string): LineRange;
|
|
259
|
+
//# sourceMappingURL=blame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blame.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/blame.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,eAAe,CAAA;AAOxD;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oCAAoC;IACpC,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,kBAAkB;IAClB,MAAM,EAAE,M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