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,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Git Branch Command
|
|
3
|
+
*
|
|
4
|
+
* This module implements the `gitx branch` command which manages local branches.
|
|
5
|
+
* Features include:
|
|
6
|
+
* - Listing local branches with optional verbose output
|
|
7
|
+
* - Creating new branches from HEAD or a specific start point
|
|
8
|
+
* - Deleting branches (with merge safety check or force)
|
|
9
|
+
* - Renaming branches
|
|
10
|
+
* - Showing upstream tracking information
|
|
11
|
+
*
|
|
12
|
+
* @module cli/commands/branch
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // List all branches
|
|
16
|
+
* const branches = await listBranches(cwd)
|
|
17
|
+
* for (const branch of branches) {
|
|
18
|
+
* console.log(branch.isCurrent ? '* ' : ' ', branch.name)
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Create a new branch
|
|
23
|
+
* await createBranch(cwd, 'feature/new-feature')
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Delete a merged branch
|
|
27
|
+
* await deleteBranch(cwd, 'old-feature', { force: false })
|
|
28
|
+
*/
|
|
29
|
+
import type { CommandContext } from '../index';
|
|
30
|
+
/**
|
|
31
|
+
* Information about a git branch.
|
|
32
|
+
*
|
|
33
|
+
* @description Contains all relevant information about a branch including
|
|
34
|
+
* its name, current state, and optional upstream tracking information.
|
|
35
|
+
*
|
|
36
|
+
* @property name - Branch name (e.g., "main", "feature/auth")
|
|
37
|
+
* @property sha - Full 40-character commit SHA the branch points to
|
|
38
|
+
* @property isCurrent - True if this is the currently checked out branch
|
|
39
|
+
* @property upstream - Upstream tracking branch name (e.g., "origin/main")
|
|
40
|
+
* @property ahead - Number of commits ahead of upstream
|
|
41
|
+
* @property behind - Number of commits behind upstream
|
|
42
|
+
* @property upstreamGone - True if upstream branch was deleted on remote
|
|
43
|
+
*/
|
|
44
|
+
export interface BranchInfo {
|
|
45
|
+
/** Branch name */
|
|
46
|
+
name: string;
|
|
47
|
+
/** Commit SHA the branch points to */
|
|
48
|
+
sha: string;
|
|
49
|
+
/** Whether this is the current branch */
|
|
50
|
+
isCurrent: boolean;
|
|
51
|
+
/** Upstream tracking branch (e.g., "origin/main") */
|
|
52
|
+
upstream?: string;
|
|
53
|
+
/** Number of commits ahead of upstream */
|
|
54
|
+
ahead?: number;
|
|
55
|
+
/** Number of commits behind upstream */
|
|
56
|
+
behind?: number;
|
|
57
|
+
/** Whether the upstream branch is gone (deleted on remote) */
|
|
58
|
+
upstreamGone?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Options for listing branches.
|
|
62
|
+
*
|
|
63
|
+
* @description Controls the verbosity of branch listing output.
|
|
64
|
+
*
|
|
65
|
+
* @property verbose - Show commit SHA alongside branch names (-v flag)
|
|
66
|
+
* @property veryVerbose - Show upstream tracking info (-vv flag)
|
|
67
|
+
*/
|
|
68
|
+
export interface BranchListOptions {
|
|
69
|
+
/** Show verbose output with commit info */
|
|
70
|
+
verbose?: boolean;
|
|
71
|
+
/** Show very verbose output with upstream info */
|
|
72
|
+
veryVerbose?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Options for deleting a branch.
|
|
76
|
+
*
|
|
77
|
+
* @description Controls the safety behavior when deleting branches.
|
|
78
|
+
*
|
|
79
|
+
* @property force - If true, delete even if not fully merged (-D flag)
|
|
80
|
+
*/
|
|
81
|
+
export interface DeleteBranchOptions {
|
|
82
|
+
/** Force delete even if not fully merged */
|
|
83
|
+
force: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Execute the branch command from the CLI.
|
|
87
|
+
*
|
|
88
|
+
* @description Main entry point for the `gitx branch` command. Handles all
|
|
89
|
+
* branch operations based on command-line flags:
|
|
90
|
+
* - No flags: List branches
|
|
91
|
+
* - `-v`: List with commit info
|
|
92
|
+
* - `-vv`: List with upstream info
|
|
93
|
+
* - `-d <name>`: Delete branch (safe)
|
|
94
|
+
* - `-D <name>`: Delete branch (force)
|
|
95
|
+
* - `-m <old> <new>`: Rename branch
|
|
96
|
+
* - `<name> [start]`: Create branch
|
|
97
|
+
*
|
|
98
|
+
* @param ctx - Command context with cwd, args, options, and output functions
|
|
99
|
+
* @returns Promise that resolves when command completes
|
|
100
|
+
* @throws {Error} If not in a git repository
|
|
101
|
+
* @throws {Error} If branch operation fails (see individual functions)
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* // CLI usage examples
|
|
105
|
+
* // gitx branch - List branches
|
|
106
|
+
* // gitx branch -v - List with SHAs
|
|
107
|
+
* // gitx branch feature/auth - Create branch
|
|
108
|
+
* // gitx branch -d old-branch - Delete merged branch
|
|
109
|
+
* // gitx branch -m old new - Rename branch
|
|
110
|
+
*/
|
|
111
|
+
export declare function branchCommand(ctx: CommandContext): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* List all local branches.
|
|
114
|
+
*
|
|
115
|
+
* @description Reads all branch refs from .git/refs/heads and returns
|
|
116
|
+
* information about each branch including which one is currently checked out.
|
|
117
|
+
*
|
|
118
|
+
* @param cwd - Working directory (repository root)
|
|
119
|
+
* @param options - List options (currently unused, reserved for future use)
|
|
120
|
+
* @returns Promise resolving to array of branch info, sorted alphabetically
|
|
121
|
+
* @throws {Error} If not in a git repository
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* const branches = await listBranches('/path/to/repo')
|
|
125
|
+
* const current = branches.find(b => b.isCurrent)
|
|
126
|
+
* console.log(`Current branch: ${current?.name}`)
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* // List all branch names
|
|
130
|
+
* const branches = await listBranches(cwd)
|
|
131
|
+
* console.log(branches.map(b => b.name).join('\n'))
|
|
132
|
+
*/
|
|
133
|
+
export declare function listBranches(cwd: string, options?: BranchListOptions): Promise<BranchInfo[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Create a new branch.
|
|
136
|
+
*
|
|
137
|
+
* @description Creates a new branch ref pointing to either HEAD or a specified
|
|
138
|
+
* commit/branch. The branch name is validated against git naming rules.
|
|
139
|
+
*
|
|
140
|
+
* Branch names cannot:
|
|
141
|
+
* - Start with a dash (-)
|
|
142
|
+
* - Contain double dots (..)
|
|
143
|
+
* - End with .lock
|
|
144
|
+
* - Contain spaces, tildes, carets, colons, question marks, asterisks, or backslashes
|
|
145
|
+
*
|
|
146
|
+
* @param cwd - Working directory (repository root)
|
|
147
|
+
* @param name - Name for the new branch
|
|
148
|
+
* @param startPoint - Optional commit SHA or branch name to start from (defaults to HEAD)
|
|
149
|
+
* @returns Promise that resolves when branch is created
|
|
150
|
+
* @throws {Error} If not in a git repository
|
|
151
|
+
* @throws {Error} If branch name is invalid
|
|
152
|
+
* @throws {Error} If branch already exists
|
|
153
|
+
* @throws {Error} If startPoint reference is invalid
|
|
154
|
+
* @throws {Error} If HEAD cannot be resolved
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* // Create branch from HEAD
|
|
158
|
+
* await createBranch(cwd, 'feature/new-feature')
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* // Create branch from specific commit
|
|
162
|
+
* await createBranch(cwd, 'hotfix/bug-123', 'abc1234')
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* // Create branch from another branch
|
|
166
|
+
* await createBranch(cwd, 'feature/derived', 'main')
|
|
167
|
+
*/
|
|
168
|
+
export declare function createBranch(cwd: string, name: string, startPoint?: string): Promise<void>;
|
|
169
|
+
/**
|
|
170
|
+
* Delete a branch.
|
|
171
|
+
*
|
|
172
|
+
* @description Deletes a local branch ref. By default, includes a safety check
|
|
173
|
+
* to prevent deleting unmerged branches. Use `force: true` to override.
|
|
174
|
+
*
|
|
175
|
+
* Safety checks:
|
|
176
|
+
* - Cannot delete the currently checked out branch
|
|
177
|
+
* - Cannot delete unmerged branch unless force is true
|
|
178
|
+
*
|
|
179
|
+
* @param cwd - Working directory (repository root)
|
|
180
|
+
* @param name - Name of the branch to delete
|
|
181
|
+
* @param options - Delete options controlling safety behavior
|
|
182
|
+
* @param options.force - If true, skip merge check and force delete
|
|
183
|
+
* @returns Promise that resolves when branch is deleted
|
|
184
|
+
* @throws {Error} If not in a git repository
|
|
185
|
+
* @throws {Error} If branch does not exist
|
|
186
|
+
* @throws {Error} If trying to delete the current branch
|
|
187
|
+
* @throws {Error} If branch is not fully merged and force is false
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Delete a merged branch (safe)
|
|
191
|
+
* await deleteBranch(cwd, 'old-feature', { force: false })
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* // Force delete an unmerged branch
|
|
195
|
+
* await deleteBranch(cwd, 'abandoned-work', { force: true })
|
|
196
|
+
*/
|
|
197
|
+
export declare function deleteBranch(cwd: string, name: string, options: DeleteBranchOptions): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Rename a branch.
|
|
200
|
+
*
|
|
201
|
+
* @description Renames a branch by creating a new ref with the old SHA and
|
|
202
|
+
* deleting the old ref. If renaming the current branch, also updates HEAD.
|
|
203
|
+
*
|
|
204
|
+
* @param cwd - Working directory (repository root)
|
|
205
|
+
* @param oldName - Current branch name
|
|
206
|
+
* @param newName - New branch name (validated against git naming rules)
|
|
207
|
+
* @returns Promise that resolves when branch is renamed
|
|
208
|
+
* @throws {Error} If not in a git repository
|
|
209
|
+
* @throws {Error} If new branch name is invalid
|
|
210
|
+
* @throws {Error} If old branch does not exist
|
|
211
|
+
* @throws {Error} If new branch name already exists
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* // Rename a feature branch
|
|
215
|
+
* await renameBranch(cwd, 'feature/old-name', 'feature/new-name')
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // Rename the current branch
|
|
219
|
+
* await renameBranch(cwd, 'main', 'master') // Also updates HEAD
|
|
220
|
+
*/
|
|
221
|
+
export declare function renameBranch(cwd: string, oldName: string, newName: string): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Get branches with upstream tracking information.
|
|
224
|
+
*
|
|
225
|
+
* @description Lists all local branches with additional upstream tracking
|
|
226
|
+
* information including remote name, ahead/behind counts, and whether
|
|
227
|
+
* the upstream branch still exists.
|
|
228
|
+
*
|
|
229
|
+
* This is used for the `-vv` verbose output mode.
|
|
230
|
+
*
|
|
231
|
+
* @param cwd - Working directory (repository root)
|
|
232
|
+
* @returns Promise resolving to branches with upstream info populated
|
|
233
|
+
* @throws {Error} If not in a git repository
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* const branches = await getBranchesWithUpstream(cwd)
|
|
237
|
+
* for (const branch of branches) {
|
|
238
|
+
* if (branch.upstream) {
|
|
239
|
+
* console.log(`${branch.name} tracks ${branch.upstream}`)
|
|
240
|
+
* if (branch.upstreamGone) {
|
|
241
|
+
* console.log(' (upstream deleted)')
|
|
242
|
+
* } else {
|
|
243
|
+
* console.log(` ahead ${branch.ahead}, behind ${branch.behind}`)
|
|
244
|
+
* }
|
|
245
|
+
* }
|
|
246
|
+
* }
|
|
247
|
+
*/
|
|
248
|
+
export declare function getBranchesWithUpstream(cwd: string): Promise<BranchInfo[]>;
|
|
249
|
+
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/branch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAM9C;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,KAAK,EAAE,OAAO,CAAA;CACf;AAqOD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAiHtE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAqBlG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4ChG;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDzG;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD/F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CA+BhF"}
|