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.
- 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 +1 -1
package/dist/ops/branch.d.ts
CHANGED
|
@@ -1,215 +1,766 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Git Branch Operations
|
|
2
|
+
* @fileoverview Git Branch Operations
|
|
3
3
|
*
|
|
4
|
-
* Provides branch
|
|
5
|
-
* and
|
|
4
|
+
* Provides comprehensive branch management functionality including creating,
|
|
5
|
+
* deleting, renaming, listing, and checking out branches. Also handles
|
|
6
|
+
* tracking relationships with remote branches.
|
|
7
|
+
*
|
|
8
|
+
* ## Features
|
|
9
|
+
*
|
|
10
|
+
* - Branch creation from any commit or ref
|
|
11
|
+
* - Branch deletion with merge checking
|
|
12
|
+
* - Branch renaming with HEAD update
|
|
13
|
+
* - Branch listing with filtering and sorting
|
|
14
|
+
* - Checkout with create option
|
|
15
|
+
* - Remote tracking branch support
|
|
16
|
+
* - Default branch detection
|
|
17
|
+
*
|
|
18
|
+
* ## Usage Example
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { createBranch, checkoutBranch, listBranches } from './ops/branch'
|
|
22
|
+
*
|
|
23
|
+
* // Create a new feature branch
|
|
24
|
+
* const result = await createBranch(refStore, {
|
|
25
|
+
* name: 'feature/new-feature',
|
|
26
|
+
* startPoint: 'main',
|
|
27
|
+
* checkout: true
|
|
28
|
+
* })
|
|
29
|
+
*
|
|
30
|
+
* // List all branches
|
|
31
|
+
* const branches = await listBranches(refStore, { all: true })
|
|
32
|
+
*
|
|
33
|
+
* // Checkout existing branch
|
|
34
|
+
* await checkoutBranch(refStore, { name: 'develop' })
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @module ops/branch
|
|
6
38
|
*/
|
|
7
39
|
/**
|
|
8
|
-
* Ref store interface for branch operations
|
|
40
|
+
* Ref store interface for branch operations.
|
|
41
|
+
*
|
|
42
|
+
* Provides methods for reading and writing git refs,
|
|
43
|
+
* including HEAD and symbolic refs.
|
|
44
|
+
*
|
|
45
|
+
* @interface RefStore
|
|
9
46
|
*/
|
|
10
47
|
export interface RefStore {
|
|
48
|
+
/**
|
|
49
|
+
* Gets the SHA a ref points to.
|
|
50
|
+
* @param ref - The full ref path (e.g., 'refs/heads/main')
|
|
51
|
+
* @returns The SHA, or null if ref doesn't exist
|
|
52
|
+
*/
|
|
11
53
|
getRef(ref: string): Promise<string | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Sets a ref to point to a SHA.
|
|
56
|
+
* @param ref - The full ref path
|
|
57
|
+
* @param sha - The target SHA
|
|
58
|
+
*/
|
|
12
59
|
setRef(ref: string, sha: string): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Deletes a ref.
|
|
62
|
+
* @param ref - The full ref path to delete
|
|
63
|
+
*/
|
|
13
64
|
deleteRef(ref: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Lists refs matching a prefix.
|
|
67
|
+
* @param prefix - The prefix to match (e.g., 'refs/heads/')
|
|
68
|
+
* @returns Array of matching refs with their SHAs
|
|
69
|
+
*/
|
|
14
70
|
listRefs(prefix?: string): Promise<Array<{
|
|
15
71
|
ref: string;
|
|
16
72
|
sha: string;
|
|
17
73
|
}>>;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the current HEAD value (SHA for detached, ref for attached).
|
|
76
|
+
* @returns The HEAD value
|
|
77
|
+
*/
|
|
18
78
|
getHead(): Promise<string>;
|
|
79
|
+
/**
|
|
80
|
+
* Sets HEAD to a SHA (creates detached HEAD).
|
|
81
|
+
* @param ref - The SHA to point HEAD to
|
|
82
|
+
*/
|
|
19
83
|
setHead(ref: string): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Gets the target of a symbolic ref.
|
|
86
|
+
* @param ref - The symbolic ref name (e.g., 'HEAD')
|
|
87
|
+
* @returns The target ref path, or null if not symbolic
|
|
88
|
+
*/
|
|
20
89
|
getSymbolicRef(ref: string): Promise<string | null>;
|
|
90
|
+
/**
|
|
91
|
+
* Sets a symbolic ref to point to another ref.
|
|
92
|
+
* @param ref - The symbolic ref name
|
|
93
|
+
* @param target - The target ref path
|
|
94
|
+
*/
|
|
21
95
|
setSymbolicRef(ref: string, target: string): Promise<void>;
|
|
22
96
|
}
|
|
23
97
|
/**
|
|
24
|
-
* Options for creating a branch
|
|
98
|
+
* Options for creating a branch.
|
|
99
|
+
*
|
|
100
|
+
* @interface BranchOptions
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const options: BranchOptions = {
|
|
105
|
+
* name: 'feature/login',
|
|
106
|
+
* startPoint: 'develop',
|
|
107
|
+
* force: false,
|
|
108
|
+
* checkout: true
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
25
111
|
*/
|
|
26
112
|
export interface BranchOptions {
|
|
113
|
+
/** The name for the new branch (without refs/heads/ prefix) */
|
|
27
114
|
name: string;
|
|
115
|
+
/**
|
|
116
|
+
* Starting point for the branch (commit SHA, branch name, or tag).
|
|
117
|
+
* Defaults to current HEAD if not specified.
|
|
118
|
+
*/
|
|
28
119
|
startPoint?: string;
|
|
120
|
+
/**
|
|
121
|
+
* If true, allow overwriting an existing branch.
|
|
122
|
+
* @default false
|
|
123
|
+
*/
|
|
29
124
|
force?: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* If true, checkout the branch after creating it.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
30
129
|
checkout?: boolean;
|
|
31
130
|
}
|
|
32
131
|
/**
|
|
33
|
-
* Result of creating a branch
|
|
132
|
+
* Result of creating a branch.
|
|
133
|
+
*
|
|
134
|
+
* @interface BranchCreateResult
|
|
34
135
|
*/
|
|
35
136
|
export interface BranchCreateResult {
|
|
137
|
+
/** The branch name (without refs/heads/) */
|
|
36
138
|
name: string;
|
|
139
|
+
/** The full ref path */
|
|
37
140
|
ref: string;
|
|
141
|
+
/** The SHA the branch points to */
|
|
38
142
|
sha: string;
|
|
143
|
+
/**
|
|
144
|
+
* True if the branch was newly created.
|
|
145
|
+
* False if it already existed and force=true was used.
|
|
146
|
+
*/
|
|
39
147
|
created: boolean;
|
|
40
148
|
}
|
|
41
149
|
/**
|
|
42
|
-
* Options for deleting a branch
|
|
150
|
+
* Options for deleting a branch.
|
|
151
|
+
*
|
|
152
|
+
* @interface BranchDeleteOptions
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* // Delete single branch
|
|
157
|
+
* await deleteBranch(refStore, { name: 'old-feature', force: true })
|
|
158
|
+
*
|
|
159
|
+
* // Delete multiple branches
|
|
160
|
+
* await deleteBranch(refStore, { names: ['branch1', 'branch2'] })
|
|
161
|
+
* ```
|
|
43
162
|
*/
|
|
44
163
|
export interface BranchDeleteOptions {
|
|
164
|
+
/** Single branch name to delete */
|
|
45
165
|
name?: string;
|
|
166
|
+
/** Multiple branch names to delete */
|
|
46
167
|
names?: string[];
|
|
168
|
+
/**
|
|
169
|
+
* If true, delete even if not fully merged.
|
|
170
|
+
* @default false
|
|
171
|
+
*/
|
|
47
172
|
force?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* If true, check that branch is merged before deleting.
|
|
175
|
+
* @default false
|
|
176
|
+
*/
|
|
48
177
|
checkMerged?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* If true, delete a remote-tracking branch instead of local.
|
|
180
|
+
* @default false
|
|
181
|
+
*/
|
|
49
182
|
remote?: boolean;
|
|
50
183
|
}
|
|
51
184
|
/**
|
|
52
|
-
* Result of deleting a branch
|
|
185
|
+
* Result of deleting a branch.
|
|
186
|
+
*
|
|
187
|
+
* @interface BranchDeleteResult
|
|
53
188
|
*/
|
|
54
189
|
export interface BranchDeleteResult {
|
|
190
|
+
/** Whether any branches were deleted */
|
|
55
191
|
deleted: boolean;
|
|
192
|
+
/** The name of the first deleted branch */
|
|
56
193
|
name: string;
|
|
194
|
+
/** The SHA of the first deleted branch */
|
|
57
195
|
sha: string;
|
|
196
|
+
/** All branches that were deleted */
|
|
58
197
|
deletedBranches: Array<{
|
|
59
198
|
name: string;
|
|
60
199
|
sha: string;
|
|
61
200
|
}>;
|
|
62
201
|
}
|
|
63
202
|
/**
|
|
64
|
-
* Options for listing branches
|
|
203
|
+
* Options for listing branches.
|
|
204
|
+
*
|
|
205
|
+
* @interface BranchListOptions
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* // List all branches with verbose info
|
|
210
|
+
* const branches = await listBranches(refStore, {
|
|
211
|
+
* all: true,
|
|
212
|
+
* verbose: true,
|
|
213
|
+
* sort: '-committerdate'
|
|
214
|
+
* })
|
|
215
|
+
* ```
|
|
65
216
|
*/
|
|
66
217
|
export interface BranchListOptions {
|
|
218
|
+
/**
|
|
219
|
+
* If true, list remote-tracking branches.
|
|
220
|
+
* @default false
|
|
221
|
+
*/
|
|
67
222
|
remote?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* If true, list both local and remote branches.
|
|
225
|
+
* @default false
|
|
226
|
+
*/
|
|
68
227
|
all?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Glob pattern to filter branch names.
|
|
230
|
+
* Supports * and ? wildcards.
|
|
231
|
+
*/
|
|
69
232
|
pattern?: string;
|
|
233
|
+
/** Only list branches that contain this commit SHA */
|
|
70
234
|
contains?: string;
|
|
235
|
+
/** Only list branches merged into this ref */
|
|
71
236
|
merged?: string;
|
|
237
|
+
/** Only list branches NOT merged into this ref */
|
|
72
238
|
noMerged?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Sort field. Prefix with - for descending.
|
|
241
|
+
* Values: 'name', 'committerdate'
|
|
242
|
+
*/
|
|
73
243
|
sort?: string;
|
|
244
|
+
/**
|
|
245
|
+
* If true, include tracking info and commit subject.
|
|
246
|
+
* @default false
|
|
247
|
+
*/
|
|
74
248
|
verbose?: boolean;
|
|
75
249
|
}
|
|
76
250
|
/**
|
|
77
|
-
*
|
|
251
|
+
* Information about a branch.
|
|
252
|
+
*
|
|
253
|
+
* @interface BranchInfo
|
|
78
254
|
*/
|
|
79
255
|
export interface BranchInfo {
|
|
256
|
+
/** Branch name (without refs/heads/ or refs/remotes/) */
|
|
80
257
|
name: string;
|
|
258
|
+
/** Full ref path */
|
|
81
259
|
ref: string;
|
|
260
|
+
/** SHA the branch points to */
|
|
82
261
|
sha: string;
|
|
262
|
+
/** True if this is the current branch */
|
|
83
263
|
current: boolean;
|
|
264
|
+
/** Tracking information (if verbose=true and tracking is set) */
|
|
84
265
|
tracking?: TrackingInfo | null;
|
|
266
|
+
/** First line of head commit message (if verbose=true) */
|
|
85
267
|
commitSubject?: string;
|
|
86
268
|
}
|
|
87
269
|
/**
|
|
88
|
-
* Tracking information
|
|
270
|
+
* Tracking information for a branch.
|
|
271
|
+
*
|
|
272
|
+
* @interface TrackingInfo
|
|
89
273
|
*/
|
|
90
274
|
export interface TrackingInfo {
|
|
275
|
+
/** Full upstream ref (e.g., 'origin/main') */
|
|
91
276
|
upstream: string;
|
|
277
|
+
/** Remote name (e.g., 'origin') */
|
|
92
278
|
remote: string;
|
|
279
|
+
/** Remote branch name (e.g., 'main') */
|
|
93
280
|
remoteBranch: string;
|
|
281
|
+
/** Number of commits ahead of upstream */
|
|
94
282
|
ahead: number;
|
|
283
|
+
/** Number of commits behind upstream */
|
|
95
284
|
behind: number;
|
|
96
285
|
}
|
|
97
286
|
/**
|
|
98
|
-
* Options for renaming a branch
|
|
287
|
+
* Options for renaming a branch.
|
|
288
|
+
*
|
|
289
|
+
* @interface BranchRenameOptions
|
|
99
290
|
*/
|
|
100
291
|
export interface BranchRenameOptions {
|
|
292
|
+
/**
|
|
293
|
+
* Branch to rename. If not specified, uses current branch.
|
|
294
|
+
*/
|
|
101
295
|
oldName?: string;
|
|
296
|
+
/** New name for the branch */
|
|
102
297
|
newName: string;
|
|
298
|
+
/**
|
|
299
|
+
* If true, allow overwriting an existing branch.
|
|
300
|
+
* @default false
|
|
301
|
+
*/
|
|
103
302
|
force?: boolean;
|
|
104
303
|
}
|
|
105
304
|
/**
|
|
106
|
-
* Result of renaming a branch
|
|
305
|
+
* Result of renaming a branch.
|
|
306
|
+
*
|
|
307
|
+
* @interface BranchRenameResult
|
|
107
308
|
*/
|
|
108
309
|
export interface BranchRenameResult {
|
|
310
|
+
/** Whether the rename succeeded */
|
|
109
311
|
renamed: boolean;
|
|
312
|
+
/** Original branch name */
|
|
110
313
|
oldName: string;
|
|
314
|
+
/** New branch name */
|
|
111
315
|
newName: string;
|
|
316
|
+
/** SHA the branch points to */
|
|
112
317
|
sha: string;
|
|
113
318
|
}
|
|
114
319
|
/**
|
|
115
|
-
* Options for checking out a branch
|
|
320
|
+
* Options for checking out a branch.
|
|
321
|
+
*
|
|
322
|
+
* @interface CheckoutOptions
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* // Checkout existing branch
|
|
327
|
+
* await checkoutBranch(refStore, { name: 'develop' })
|
|
328
|
+
*
|
|
329
|
+
* // Create and checkout new branch
|
|
330
|
+
* await checkoutBranch(refStore, {
|
|
331
|
+
* name: 'feature/new',
|
|
332
|
+
* create: true,
|
|
333
|
+
* startPoint: 'main'
|
|
334
|
+
* })
|
|
335
|
+
*
|
|
336
|
+
* // Detached HEAD checkout
|
|
337
|
+
* await checkoutBranch(refStore, { sha: 'abc123', detach: true })
|
|
338
|
+
* ```
|
|
116
339
|
*/
|
|
117
340
|
export interface CheckoutOptions {
|
|
341
|
+
/** Branch name to checkout */
|
|
118
342
|
name?: string;
|
|
343
|
+
/** SHA to checkout (for detached HEAD) */
|
|
119
344
|
sha?: string;
|
|
345
|
+
/**
|
|
346
|
+
* If true, create the branch if it doesn't exist.
|
|
347
|
+
* @default false
|
|
348
|
+
*/
|
|
120
349
|
create?: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* If true, overwrite existing branch when creating.
|
|
352
|
+
* @default false
|
|
353
|
+
*/
|
|
121
354
|
force?: boolean;
|
|
355
|
+
/** Starting point when creating a new branch */
|
|
122
356
|
startPoint?: string;
|
|
357
|
+
/**
|
|
358
|
+
* If true, checkout as detached HEAD.
|
|
359
|
+
* @default false
|
|
360
|
+
*/
|
|
123
361
|
detach?: boolean;
|
|
362
|
+
/** Set up tracking for this upstream (e.g., 'origin/main') */
|
|
124
363
|
track?: string;
|
|
125
364
|
}
|
|
126
365
|
/**
|
|
127
|
-
* Result of checking out a branch
|
|
366
|
+
* Result of checking out a branch.
|
|
367
|
+
*
|
|
368
|
+
* @interface CheckoutResult
|
|
128
369
|
*/
|
|
129
370
|
export interface CheckoutResult {
|
|
371
|
+
/** Whether checkout succeeded */
|
|
130
372
|
success: boolean;
|
|
373
|
+
/** Branch name (null if detached HEAD) */
|
|
131
374
|
branch: string | null;
|
|
375
|
+
/** SHA that is now checked out */
|
|
132
376
|
sha: string;
|
|
377
|
+
/** True if a new branch was created */
|
|
133
378
|
created?: boolean;
|
|
379
|
+
/** True if now in detached HEAD state */
|
|
134
380
|
detached?: boolean;
|
|
381
|
+
/** Upstream tracking ref if set */
|
|
135
382
|
tracking?: string;
|
|
136
383
|
}
|
|
137
384
|
/**
|
|
138
|
-
* Result of setting branch tracking
|
|
385
|
+
* Result of setting branch tracking.
|
|
386
|
+
*
|
|
387
|
+
* @interface SetTrackingResult
|
|
139
388
|
*/
|
|
140
389
|
export interface SetTrackingResult {
|
|
390
|
+
/** Whether the operation succeeded */
|
|
141
391
|
success: boolean;
|
|
392
|
+
/** Local branch name */
|
|
142
393
|
branch: string;
|
|
394
|
+
/** Full upstream ref */
|
|
143
395
|
upstream: string;
|
|
396
|
+
/** Remote name */
|
|
144
397
|
remote: string;
|
|
398
|
+
/** Remote branch name */
|
|
145
399
|
remoteBranch: string;
|
|
146
400
|
}
|
|
147
401
|
/**
|
|
148
|
-
* Result of removing branch tracking
|
|
402
|
+
* Result of removing branch tracking.
|
|
403
|
+
*
|
|
404
|
+
* @interface RemoveTrackingResult
|
|
149
405
|
*/
|
|
150
406
|
export interface RemoveTrackingResult {
|
|
407
|
+
/** Whether the operation succeeded */
|
|
151
408
|
success: boolean;
|
|
152
409
|
}
|
|
153
410
|
/**
|
|
154
|
-
*
|
|
411
|
+
* Validates a branch name according to Git naming rules.
|
|
412
|
+
*
|
|
413
|
+
* Git branch names have specific rules to ensure they work correctly
|
|
414
|
+
* across all platforms and don't conflict with Git's special syntax.
|
|
415
|
+
*
|
|
416
|
+
* Rules checked:
|
|
417
|
+
* - Not empty
|
|
418
|
+
* - Not longer than 255 characters
|
|
419
|
+
* - Does not start with '-'
|
|
420
|
+
* - Does not end with '.lock', '/', or '.'
|
|
421
|
+
* - Does not contain '..', '//', '@{', or '@'
|
|
422
|
+
* - Is not 'HEAD' and does not start with 'refs/'
|
|
423
|
+
* - Contains no invalid characters (space, ~, ^, :, \, ?, *, [, control chars)
|
|
424
|
+
* - Contains only ASCII characters
|
|
425
|
+
*
|
|
426
|
+
* @param name - The branch name to validate
|
|
427
|
+
* @returns true if the name is valid
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* ```typescript
|
|
431
|
+
* isValidBranchName('feature/login') // true
|
|
432
|
+
* isValidBranchName('my-branch') // true
|
|
433
|
+
* isValidBranchName('-invalid') // false (starts with dash)
|
|
434
|
+
* isValidBranchName('refs/heads/x') // false (starts with refs/)
|
|
435
|
+
* isValidBranchName('has space') // false (contains space)
|
|
436
|
+
* ```
|
|
155
437
|
*/
|
|
156
438
|
export declare function isValidBranchName(name: string): boolean;
|
|
157
439
|
/**
|
|
158
|
-
*
|
|
440
|
+
* Normalizes a branch name by removing refs/heads/ prefix.
|
|
441
|
+
*
|
|
442
|
+
* @param name - The branch name or ref path
|
|
443
|
+
* @returns The normalized branch name
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```typescript
|
|
447
|
+
* normalizeBranchName('refs/heads/main') // 'main'
|
|
448
|
+
* normalizeBranchName('main') // 'main'
|
|
449
|
+
* ```
|
|
159
450
|
*/
|
|
160
451
|
export declare function normalizeBranchName(name: string): string;
|
|
161
452
|
/**
|
|
162
|
-
*
|
|
453
|
+
* Creates a new branch.
|
|
454
|
+
*
|
|
455
|
+
* Creates a branch pointing to the specified commit or the current HEAD.
|
|
456
|
+
* Optionally checks out the branch after creation.
|
|
457
|
+
*
|
|
458
|
+
* @param refStore - The ref store for accessing refs
|
|
459
|
+
* @param options - Branch creation options
|
|
460
|
+
* @returns Result of the branch creation
|
|
461
|
+
*
|
|
462
|
+
* @throws {Error} If the branch name is invalid
|
|
463
|
+
* @throws {Error} If the branch already exists and force is false
|
|
464
|
+
* @throws {Error} If the start point cannot be resolved
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```typescript
|
|
468
|
+
* // Create branch from current HEAD
|
|
469
|
+
* const result = await createBranch(refStore, { name: 'feature/new' })
|
|
470
|
+
*
|
|
471
|
+
* // Create branch from specific commit
|
|
472
|
+
* const result = await createBranch(refStore, {
|
|
473
|
+
* name: 'hotfix/urgent',
|
|
474
|
+
* startPoint: 'abc123def456...'
|
|
475
|
+
* })
|
|
476
|
+
*
|
|
477
|
+
* // Create and checkout
|
|
478
|
+
* const result = await createBranch(refStore, {
|
|
479
|
+
* name: 'develop',
|
|
480
|
+
* startPoint: 'main',
|
|
481
|
+
* checkout: true
|
|
482
|
+
* })
|
|
483
|
+
* ```
|
|
163
484
|
*/
|
|
164
485
|
export declare function createBranch(refStore: RefStore, options: BranchOptions): Promise<BranchCreateResult>;
|
|
165
486
|
/**
|
|
166
|
-
*
|
|
487
|
+
* Deletes a branch.
|
|
488
|
+
*
|
|
489
|
+
* Removes the specified branch ref. Can delete multiple branches at once.
|
|
490
|
+
* Supports checking if the branch is merged before deleting.
|
|
491
|
+
*
|
|
492
|
+
* @param refStore - The ref store for accessing refs
|
|
493
|
+
* @param options - Delete options
|
|
494
|
+
* @returns Result of the delete operation
|
|
495
|
+
*
|
|
496
|
+
* @throws {Error} If no branch name is provided
|
|
497
|
+
* @throws {Error} If the branch doesn't exist
|
|
498
|
+
* @throws {Error} If trying to delete the current branch
|
|
499
|
+
* @throws {Error} If branch is not merged and force is false
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```typescript
|
|
503
|
+
* // Delete a single branch
|
|
504
|
+
* await deleteBranch(refStore, { name: 'old-feature' })
|
|
505
|
+
*
|
|
506
|
+
* // Force delete unmerged branch
|
|
507
|
+
* await deleteBranch(refStore, { name: 'experimental', force: true })
|
|
508
|
+
*
|
|
509
|
+
* // Delete remote-tracking branch
|
|
510
|
+
* await deleteBranch(refStore, {
|
|
511
|
+
* name: 'origin/old-feature',
|
|
512
|
+
* remote: true
|
|
513
|
+
* })
|
|
514
|
+
* ```
|
|
167
515
|
*/
|
|
168
516
|
export declare function deleteBranch(refStore: RefStore, options: BranchDeleteOptions): Promise<BranchDeleteResult>;
|
|
169
517
|
/**
|
|
170
|
-
*
|
|
518
|
+
* Lists branches.
|
|
519
|
+
*
|
|
520
|
+
* Returns a list of branches with optional filtering and sorting.
|
|
521
|
+
* Can list local branches, remote-tracking branches, or both.
|
|
522
|
+
*
|
|
523
|
+
* @param refStore - The ref store for accessing refs
|
|
524
|
+
* @param options - Listing options
|
|
525
|
+
* @returns Array of branch information
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```typescript
|
|
529
|
+
* // List local branches
|
|
530
|
+
* const branches = await listBranches(refStore)
|
|
531
|
+
*
|
|
532
|
+
* // List all branches sorted by name descending
|
|
533
|
+
* const branches = await listBranches(refStore, {
|
|
534
|
+
* all: true,
|
|
535
|
+
* sort: '-name'
|
|
536
|
+
* })
|
|
537
|
+
*
|
|
538
|
+
* // List branches matching pattern with verbose info
|
|
539
|
+
* const branches = await listBranches(refStore, {
|
|
540
|
+
* pattern: 'feature/*',
|
|
541
|
+
* verbose: true
|
|
542
|
+
* })
|
|
543
|
+
* ```
|
|
171
544
|
*/
|
|
172
545
|
export declare function listBranches(refStore: RefStore, options?: BranchListOptions): Promise<BranchInfo[]>;
|
|
173
546
|
/**
|
|
174
|
-
*
|
|
547
|
+
* Renames a branch.
|
|
548
|
+
*
|
|
549
|
+
* Renames the specified branch, or the current branch if none specified.
|
|
550
|
+
* Updates HEAD if renaming the current branch. Transfers tracking info.
|
|
551
|
+
*
|
|
552
|
+
* @param refStore - The ref store for accessing refs
|
|
553
|
+
* @param options - Rename options
|
|
554
|
+
* @returns Result of the rename operation
|
|
555
|
+
*
|
|
556
|
+
* @throws {Error} If no current branch when oldName not specified
|
|
557
|
+
* @throws {Error} If the new name is invalid
|
|
558
|
+
* @throws {Error} If the old branch doesn't exist
|
|
559
|
+
* @throws {Error} If the new name exists and force is false
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```typescript
|
|
563
|
+
* // Rename current branch
|
|
564
|
+
* await renameBranch(refStore, { newName: 'better-name' })
|
|
565
|
+
*
|
|
566
|
+
* // Rename specific branch
|
|
567
|
+
* await renameBranch(refStore, {
|
|
568
|
+
* oldName: 'old-feature',
|
|
569
|
+
* newName: 'feature/improved'
|
|
570
|
+
* })
|
|
571
|
+
*
|
|
572
|
+
* // Force rename (overwrites existing)
|
|
573
|
+
* await renameBranch(refStore, {
|
|
574
|
+
* oldName: 'temp',
|
|
575
|
+
* newName: 'main',
|
|
576
|
+
* force: true
|
|
577
|
+
* })
|
|
578
|
+
* ```
|
|
175
579
|
*/
|
|
176
580
|
export declare function renameBranch(refStore: RefStore, options: BranchRenameOptions): Promise<BranchRenameResult>;
|
|
177
581
|
/**
|
|
178
|
-
*
|
|
582
|
+
* Checks out a branch.
|
|
583
|
+
*
|
|
584
|
+
* Switches HEAD to point to the specified branch or commit.
|
|
585
|
+
* Can create a new branch during checkout and set up tracking.
|
|
586
|
+
*
|
|
587
|
+
* @param refStore - The ref store for accessing refs
|
|
588
|
+
* @param options - Checkout options
|
|
589
|
+
* @returns Result of the checkout operation
|
|
590
|
+
*
|
|
591
|
+
* @throws {Error} If neither name nor sha is provided
|
|
592
|
+
* @throws {Error} If branch doesn't exist and create is false
|
|
593
|
+
* @throws {Error} If branch exists when creating and force is false
|
|
594
|
+
*
|
|
595
|
+
* @example
|
|
596
|
+
* ```typescript
|
|
597
|
+
* // Checkout existing branch
|
|
598
|
+
* await checkoutBranch(refStore, { name: 'develop' })
|
|
599
|
+
*
|
|
600
|
+
* // Create and checkout new branch from main
|
|
601
|
+
* await checkoutBranch(refStore, {
|
|
602
|
+
* name: 'feature/new',
|
|
603
|
+
* create: true,
|
|
604
|
+
* startPoint: 'main'
|
|
605
|
+
* })
|
|
606
|
+
*
|
|
607
|
+
* // Detached HEAD checkout
|
|
608
|
+
* await checkoutBranch(refStore, {
|
|
609
|
+
* sha: 'abc123def456...',
|
|
610
|
+
* detach: true
|
|
611
|
+
* })
|
|
612
|
+
*
|
|
613
|
+
* // Create branch with tracking
|
|
614
|
+
* await checkoutBranch(refStore, {
|
|
615
|
+
* name: 'feature/tracked',
|
|
616
|
+
* create: true,
|
|
617
|
+
* track: 'origin/feature/tracked'
|
|
618
|
+
* })
|
|
619
|
+
* ```
|
|
179
620
|
*/
|
|
180
621
|
export declare function checkoutBranch(refStore: RefStore, options: CheckoutOptions): Promise<CheckoutResult>;
|
|
181
622
|
/**
|
|
182
|
-
*
|
|
623
|
+
* Gets the current branch name.
|
|
624
|
+
*
|
|
625
|
+
* Returns the name of the currently checked out branch, or null
|
|
626
|
+
* if in detached HEAD state.
|
|
627
|
+
*
|
|
628
|
+
* @param refStore - The ref store for accessing refs
|
|
629
|
+
* @returns The current branch name, or null if detached
|
|
630
|
+
*
|
|
631
|
+
* @example
|
|
632
|
+
* ```typescript
|
|
633
|
+
* const current = await getCurrentBranch(refStore)
|
|
634
|
+
* if (current) {
|
|
635
|
+
* console.log(`On branch ${current}`)
|
|
636
|
+
* } else {
|
|
637
|
+
* console.log('HEAD detached')
|
|
638
|
+
* }
|
|
639
|
+
* ```
|
|
183
640
|
*/
|
|
184
641
|
export declare function getCurrentBranch(refStore: RefStore): Promise<string | null>;
|
|
185
642
|
/**
|
|
186
|
-
*
|
|
643
|
+
* Gets detailed information about a branch.
|
|
644
|
+
*
|
|
645
|
+
* @param refStore - The ref store for accessing refs
|
|
646
|
+
* @param name - The branch name
|
|
647
|
+
* @returns Branch info, or null if branch doesn't exist
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* const info = await getBranchInfo(refStore, 'feature/login')
|
|
652
|
+
* if (info) {
|
|
653
|
+
* console.log(`${info.name} -> ${info.sha.slice(0, 8)}`)
|
|
654
|
+
* if (info.current) {
|
|
655
|
+
* console.log(' (current branch)')
|
|
656
|
+
* }
|
|
657
|
+
* }
|
|
658
|
+
* ```
|
|
187
659
|
*/
|
|
188
660
|
export declare function getBranchInfo(refStore: RefStore, name: string): Promise<BranchInfo | null>;
|
|
189
661
|
/**
|
|
190
|
-
*
|
|
662
|
+
* Checks if a branch exists.
|
|
663
|
+
*
|
|
664
|
+
* @param refStore - The ref store for accessing refs
|
|
665
|
+
* @param name - The branch name to check
|
|
666
|
+
* @param options - Options for the check
|
|
667
|
+
* @param options.remote - If true, check remote-tracking branches
|
|
668
|
+
* @returns true if the branch exists
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```typescript
|
|
672
|
+
* if (await branchExists(refStore, 'feature/login')) {
|
|
673
|
+
* console.log('Branch exists')
|
|
674
|
+
* }
|
|
675
|
+
*
|
|
676
|
+
* // Check remote branch
|
|
677
|
+
* if (await branchExists(refStore, 'origin/main', { remote: true })) {
|
|
678
|
+
* console.log('Remote branch exists')
|
|
679
|
+
* }
|
|
680
|
+
* ```
|
|
191
681
|
*/
|
|
192
682
|
export declare function branchExists(refStore: RefStore, name: string, options?: {
|
|
193
683
|
remote?: boolean;
|
|
194
684
|
}): Promise<boolean>;
|
|
195
685
|
/**
|
|
196
|
-
*
|
|
686
|
+
* Sets tracking information for a branch.
|
|
687
|
+
*
|
|
688
|
+
* Configures a local branch to track a remote branch, enabling
|
|
689
|
+
* push/pull shortcuts and status information.
|
|
690
|
+
*
|
|
691
|
+
* @param refStore - The ref store for accessing refs
|
|
692
|
+
* @param branch - The local branch name
|
|
693
|
+
* @param upstream - The upstream ref (e.g., 'origin/main')
|
|
694
|
+
* @returns Result of setting tracking
|
|
695
|
+
*
|
|
696
|
+
* @throws {Error} If the local branch doesn't exist
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* await setBranchTracking(refStore, 'feature/login', 'origin/feature/login')
|
|
701
|
+
* ```
|
|
197
702
|
*/
|
|
198
703
|
export declare function setBranchTracking(refStore: RefStore, branch: string, upstream: string): Promise<SetTrackingResult>;
|
|
199
704
|
/**
|
|
200
|
-
*
|
|
705
|
+
* Gets tracking information for a branch.
|
|
706
|
+
*
|
|
707
|
+
* @param refStore - The ref store for accessing refs
|
|
708
|
+
* @param branch - The branch name
|
|
709
|
+
* @returns Tracking info, or null if not tracking
|
|
710
|
+
*
|
|
711
|
+
* @example
|
|
712
|
+
* ```typescript
|
|
713
|
+
* const tracking = await getBranchTracking(refStore, 'main')
|
|
714
|
+
* if (tracking) {
|
|
715
|
+
* console.log(`Tracking ${tracking.upstream}`)
|
|
716
|
+
* console.log(`${tracking.ahead} ahead, ${tracking.behind} behind`)
|
|
717
|
+
* }
|
|
718
|
+
* ```
|
|
201
719
|
*/
|
|
202
720
|
export declare function getBranchTracking(refStore: RefStore, branch: string): Promise<TrackingInfo | null>;
|
|
203
721
|
/**
|
|
204
|
-
*
|
|
722
|
+
* Removes tracking information from a branch.
|
|
723
|
+
*
|
|
724
|
+
* @param refStore - The ref store for accessing refs
|
|
725
|
+
* @param branch - The branch name
|
|
726
|
+
* @returns Result of removing tracking
|
|
727
|
+
*
|
|
728
|
+
* @example
|
|
729
|
+
* ```typescript
|
|
730
|
+
* await removeBranchTracking(refStore, 'feature/old')
|
|
731
|
+
* ```
|
|
205
732
|
*/
|
|
206
733
|
export declare function removeBranchTracking(refStore: RefStore, branch: string): Promise<RemoveTrackingResult>;
|
|
207
734
|
/**
|
|
208
|
-
*
|
|
735
|
+
* Gets the default branch name for a repository.
|
|
736
|
+
*
|
|
737
|
+
* Returns the configured default branch, or attempts to detect it
|
|
738
|
+
* by checking for 'main' or 'master' branches.
|
|
739
|
+
*
|
|
740
|
+
* @param refStore - The ref store for accessing refs
|
|
741
|
+
* @returns The default branch name, or null if none found
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* ```typescript
|
|
745
|
+
* const defaultBranch = await getDefaultBranch(refStore)
|
|
746
|
+
* if (defaultBranch) {
|
|
747
|
+
* console.log(`Default branch: ${defaultBranch}`)
|
|
748
|
+
* }
|
|
749
|
+
* ```
|
|
209
750
|
*/
|
|
210
751
|
export declare function getDefaultBranch(refStore: RefStore): Promise<string | null>;
|
|
211
752
|
/**
|
|
212
|
-
*
|
|
753
|
+
* Sets the default branch for a repository.
|
|
754
|
+
*
|
|
755
|
+
* @param refStore - The ref store for accessing refs
|
|
756
|
+
* @param name - The branch name to set as default
|
|
757
|
+
*
|
|
758
|
+
* @throws {Error} If the branch doesn't exist
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* ```typescript
|
|
762
|
+
* await setDefaultBranch(refStore, 'main')
|
|
763
|
+
* ```
|
|
213
764
|
*/
|
|
214
765
|
export declare function setDefaultBranch(refStore: RefStore, name: string): Promise<void>;
|
|
215
766
|
//# sourceMappingURL=branch.d.ts.map
|