gitx.do 0.1.1 → 0.1.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/README.md +40 -353
- package/dist/do/logger.d.ts +50 -0
- package/dist/do/logger.d.ts.map +1 -0
- package/dist/do/logger.js +122 -0
- package/dist/do/logger.js.map +1 -0
- package/dist/{durable-object → do}/schema.d.ts +3 -3
- package/dist/do/schema.d.ts.map +1 -0
- package/dist/{durable-object → do}/schema.js +4 -3
- package/dist/do/schema.js.map +1 -0
- package/dist/do/types.d.ts +267 -0
- package/dist/do/types.d.ts.map +1 -0
- package/dist/do/types.js +62 -0
- package/dist/do/types.js.map +1 -0
- package/dist/index.d.ts +15 -469
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -481
- package/dist/index.js.map +1 -1
- package/dist/mcp/auth.d.ts +77 -0
- package/dist/mcp/auth.d.ts.map +1 -0
- package/dist/mcp/auth.js +278 -0
- package/dist/mcp/auth.js.map +1 -0
- package/dist/mcp/index.d.ts +13 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +19 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +200 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +275 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-registry.d.ts +47 -0
- package/dist/mcp/tool-registry.d.ts.map +1 -0
- package/dist/mcp/tool-registry.js +284 -0
- package/dist/mcp/tool-registry.js.map +1 -0
- package/dist/mcp/tools.d.ts +103 -515
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +676 -3087
- package/dist/mcp/tools.js.map +1 -1
- package/dist/mcp/types.d.ts +124 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +9 -0
- package/dist/mcp/types.js.map +1 -0
- package/package.json +19 -21
- package/dist/cli/commands/add.d.ts +0 -176
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -979
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/blame.d.ts +0 -259
- package/dist/cli/commands/blame.d.ts.map +0 -1
- package/dist/cli/commands/blame.js +0 -609
- package/dist/cli/commands/blame.js.map +0 -1
- package/dist/cli/commands/branch.d.ts +0 -249
- package/dist/cli/commands/branch.d.ts.map +0 -1
- package/dist/cli/commands/branch.js +0 -693
- package/dist/cli/commands/branch.js.map +0 -1
- package/dist/cli/commands/checkout.d.ts +0 -73
- package/dist/cli/commands/checkout.d.ts.map +0 -1
- package/dist/cli/commands/checkout.js +0 -725
- package/dist/cli/commands/checkout.js.map +0 -1
- package/dist/cli/commands/commit.d.ts +0 -182
- package/dist/cli/commands/commit.d.ts.map +0 -1
- package/dist/cli/commands/commit.js +0 -457
- package/dist/cli/commands/commit.js.map +0 -1
- package/dist/cli/commands/diff.d.ts +0 -464
- package/dist/cli/commands/diff.d.ts.map +0 -1
- package/dist/cli/commands/diff.js +0 -959
- package/dist/cli/commands/diff.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -239
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -535
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/merge.d.ts +0 -106
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -852
- package/dist/cli/commands/merge.js.map +0 -1
- package/dist/cli/commands/review.d.ts +0 -457
- package/dist/cli/commands/review.d.ts.map +0 -1
- package/dist/cli/commands/review.js +0 -558
- package/dist/cli/commands/review.js.map +0 -1
- package/dist/cli/commands/stash.d.ts +0 -157
- package/dist/cli/commands/stash.d.ts.map +0 -1
- package/dist/cli/commands/stash.js +0 -655
- package/dist/cli/commands/stash.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -269
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -492
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -199
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -697
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/fs-adapter.d.ts +0 -656
- package/dist/cli/fs-adapter.d.ts.map +0 -1
- package/dist/cli/fs-adapter.js +0 -1177
- package/dist/cli/fs-adapter.js.map +0 -1
- package/dist/cli/fsx-cli-adapter.d.ts +0 -359
- package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
- package/dist/cli/fsx-cli-adapter.js +0 -619
- package/dist/cli/fsx-cli-adapter.js.map +0 -1
- package/dist/cli/index.d.ts +0 -387
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -579
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/ui/components/DiffView.d.ts +0 -12
- package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
- package/dist/cli/ui/components/DiffView.js +0 -11
- package/dist/cli/ui/components/DiffView.js.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -10
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.js +0 -11
- package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +0 -15
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.js +0 -12
- package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -10
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.js +0 -10
- package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
- package/dist/cli/ui/components/NavigationList.d.ts +0 -14
- package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
- package/dist/cli/ui/components/NavigationList.js +0 -11
- package/dist/cli/ui/components/NavigationList.js.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +0 -13
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.js +0 -11
- package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
- package/dist/cli/ui/components/index.d.ts +0 -7
- package/dist/cli/ui/components/index.d.ts.map +0 -1
- package/dist/cli/ui/components/index.js +0 -9
- package/dist/cli/ui/components/index.js.map +0 -1
- package/dist/cli/ui/terminal-ui.d.ts +0 -85
- package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
- package/dist/cli/ui/terminal-ui.js +0 -121
- package/dist/cli/ui/terminal-ui.js.map +0 -1
- package/dist/do/BashModule.d.ts +0 -871
- package/dist/do/BashModule.d.ts.map +0 -1
- package/dist/do/BashModule.js +0 -1143
- package/dist/do/BashModule.js.map +0 -1
- package/dist/do/FsModule.d.ts +0 -612
- package/dist/do/FsModule.d.ts.map +0 -1
- package/dist/do/FsModule.js +0 -1120
- package/dist/do/FsModule.js.map +0 -1
- package/dist/do/GitModule.d.ts +0 -635
- package/dist/do/GitModule.d.ts.map +0 -1
- package/dist/do/GitModule.js +0 -784
- package/dist/do/GitModule.js.map +0 -1
- package/dist/do/GitRepoDO.d.ts +0 -281
- package/dist/do/GitRepoDO.d.ts.map +0 -1
- package/dist/do/GitRepoDO.js +0 -479
- package/dist/do/GitRepoDO.js.map +0 -1
- package/dist/do/bash-ast.d.ts +0 -246
- package/dist/do/bash-ast.d.ts.map +0 -1
- package/dist/do/bash-ast.js +0 -888
- package/dist/do/bash-ast.js.map +0 -1
- package/dist/do/container-executor.d.ts +0 -491
- package/dist/do/container-executor.d.ts.map +0 -1
- package/dist/do/container-executor.js +0 -731
- package/dist/do/container-executor.js.map +0 -1
- package/dist/do/index.d.ts +0 -53
- package/dist/do/index.d.ts.map +0 -1
- package/dist/do/index.js +0 -91
- package/dist/do/index.js.map +0 -1
- package/dist/do/tiered-storage.d.ts +0 -403
- package/dist/do/tiered-storage.d.ts.map +0 -1
- package/dist/do/tiered-storage.js +0 -689
- package/dist/do/tiered-storage.js.map +0 -1
- package/dist/do/withBash.d.ts +0 -231
- package/dist/do/withBash.d.ts.map +0 -1
- package/dist/do/withBash.js +0 -244
- package/dist/do/withBash.js.map +0 -1
- package/dist/do/withFs.d.ts +0 -237
- package/dist/do/withFs.d.ts.map +0 -1
- package/dist/do/withFs.js +0 -387
- package/dist/do/withFs.js.map +0 -1
- package/dist/do/withGit.d.ts +0 -180
- package/dist/do/withGit.d.ts.map +0 -1
- package/dist/do/withGit.js +0 -271
- package/dist/do/withGit.js.map +0 -1
- package/dist/durable-object/object-store.d.ts +0 -633
- package/dist/durable-object/object-store.d.ts.map +0 -1
- package/dist/durable-object/object-store.js +0 -1164
- package/dist/durable-object/object-store.js.map +0 -1
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/durable-object/wal.d.ts +0 -416
- package/dist/durable-object/wal.d.ts.map +0 -1
- package/dist/durable-object/wal.js +0 -445
- package/dist/durable-object/wal.js.map +0 -1
- package/dist/mcp/adapter.d.ts +0 -772
- package/dist/mcp/adapter.d.ts.map +0 -1
- package/dist/mcp/adapter.js +0 -895
- package/dist/mcp/adapter.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.js +0 -30
- package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -17
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -71
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox.d.ts +0 -764
- package/dist/mcp/sandbox.d.ts.map +0 -1
- package/dist/mcp/sandbox.js +0 -1362
- package/dist/mcp/sandbox.js.map +0 -1
- package/dist/mcp/sdk-adapter.d.ts +0 -835
- package/dist/mcp/sdk-adapter.d.ts.map +0 -1
- package/dist/mcp/sdk-adapter.js +0 -974
- package/dist/mcp/sdk-adapter.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -32
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -117
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/ops/blame.d.ts +0 -551
- package/dist/ops/blame.d.ts.map +0 -1
- package/dist/ops/blame.js +0 -1037
- package/dist/ops/blame.js.map +0 -1
- package/dist/ops/branch.d.ts +0 -766
- package/dist/ops/branch.d.ts.map +0 -1
- package/dist/ops/branch.js +0 -950
- package/dist/ops/branch.js.map +0 -1
- package/dist/ops/commit-traversal.d.ts +0 -349
- package/dist/ops/commit-traversal.d.ts.map +0 -1
- package/dist/ops/commit-traversal.js +0 -821
- package/dist/ops/commit-traversal.js.map +0 -1
- package/dist/ops/commit.d.ts +0 -555
- package/dist/ops/commit.d.ts.map +0 -1
- package/dist/ops/commit.js +0 -826
- package/dist/ops/commit.js.map +0 -1
- package/dist/ops/merge-base.d.ts +0 -397
- package/dist/ops/merge-base.d.ts.map +0 -1
- package/dist/ops/merge-base.js +0 -691
- package/dist/ops/merge-base.js.map +0 -1
- package/dist/ops/merge.d.ts +0 -855
- package/dist/ops/merge.d.ts.map +0 -1
- package/dist/ops/merge.js +0 -1551
- package/dist/ops/merge.js.map +0 -1
- package/dist/ops/tag.d.ts +0 -247
- package/dist/ops/tag.d.ts.map +0 -1
- package/dist/ops/tag.js +0 -649
- package/dist/ops/tag.js.map +0 -1
- package/dist/ops/tree-builder.d.ts +0 -178
- package/dist/ops/tree-builder.d.ts.map +0 -1
- package/dist/ops/tree-builder.js +0 -271
- package/dist/ops/tree-builder.js.map +0 -1
- package/dist/ops/tree-diff.d.ts +0 -291
- package/dist/ops/tree-diff.d.ts.map +0 -1
- package/dist/ops/tree-diff.js +0 -705
- package/dist/ops/tree-diff.js.map +0 -1
- package/dist/pack/delta.d.ts +0 -248
- package/dist/pack/delta.d.ts.map +0 -1
- package/dist/pack/delta.js +0 -740
- package/dist/pack/delta.js.map +0 -1
- package/dist/pack/format.d.ts +0 -446
- package/dist/pack/format.d.ts.map +0 -1
- package/dist/pack/format.js +0 -572
- package/dist/pack/format.js.map +0 -1
- package/dist/pack/full-generation.d.ts +0 -612
- package/dist/pack/full-generation.d.ts.map +0 -1
- package/dist/pack/full-generation.js +0 -1378
- package/dist/pack/full-generation.js.map +0 -1
- package/dist/pack/generation.d.ts +0 -441
- package/dist/pack/generation.d.ts.map +0 -1
- package/dist/pack/generation.js +0 -707
- package/dist/pack/generation.js.map +0 -1
- package/dist/pack/index.d.ts +0 -502
- package/dist/pack/index.d.ts.map +0 -1
- package/dist/pack/index.js +0 -833
- package/dist/pack/index.js.map +0 -1
- package/dist/refs/branch.d.ts +0 -683
- package/dist/refs/branch.d.ts.map +0 -1
- package/dist/refs/branch.js +0 -881
- package/dist/refs/branch.js.map +0 -1
- package/dist/refs/storage.d.ts +0 -833
- package/dist/refs/storage.d.ts.map +0 -1
- package/dist/refs/storage.js +0 -1023
- package/dist/refs/storage.js.map +0 -1
- package/dist/refs/tag.d.ts +0 -860
- package/dist/refs/tag.d.ts.map +0 -1
- package/dist/refs/tag.js +0 -996
- package/dist/refs/tag.js.map +0 -1
- package/dist/storage/backend.d.ts +0 -425
- package/dist/storage/backend.d.ts.map +0 -1
- package/dist/storage/backend.js +0 -41
- package/dist/storage/backend.js.map +0 -1
- package/dist/storage/fsx-adapter.d.ts +0 -204
- package/dist/storage/fsx-adapter.d.ts.map +0 -1
- package/dist/storage/fsx-adapter.js +0 -518
- package/dist/storage/fsx-adapter.js.map +0 -1
- package/dist/storage/lru-cache.d.ts +0 -691
- package/dist/storage/lru-cache.d.ts.map +0 -1
- package/dist/storage/lru-cache.js +0 -813
- package/dist/storage/lru-cache.js.map +0 -1
- package/dist/storage/object-index.d.ts +0 -585
- package/dist/storage/object-index.d.ts.map +0 -1
- package/dist/storage/object-index.js +0 -532
- package/dist/storage/object-index.js.map +0 -1
- package/dist/storage/r2-pack.d.ts +0 -1257
- package/dist/storage/r2-pack.d.ts.map +0 -1
- package/dist/storage/r2-pack.js +0 -1773
- package/dist/storage/r2-pack.js.map +0 -1
- package/dist/tiered/cdc-pipeline.d.ts +0 -1888
- package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
- package/dist/tiered/cdc-pipeline.js +0 -1880
- package/dist/tiered/cdc-pipeline.js.map +0 -1
- package/dist/tiered/migration.d.ts +0 -1104
- package/dist/tiered/migration.d.ts.map +0 -1
- package/dist/tiered/migration.js +0 -1217
- package/dist/tiered/migration.js.map +0 -1
- package/dist/tiered/parquet-writer.d.ts +0 -1145
- package/dist/tiered/parquet-writer.d.ts.map +0 -1
- package/dist/tiered/parquet-writer.js +0 -1183
- package/dist/tiered/parquet-writer.js.map +0 -1
- package/dist/tiered/read-path.d.ts +0 -835
- package/dist/tiered/read-path.d.ts.map +0 -1
- package/dist/tiered/read-path.js +0 -487
- package/dist/tiered/read-path.js.map +0 -1
- package/dist/types/capability.d.ts +0 -1385
- package/dist/types/capability.d.ts.map +0 -1
- package/dist/types/capability.js +0 -36
- package/dist/types/capability.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
- package/dist/types/interfaces.d.ts +0 -673
- package/dist/types/interfaces.d.ts.map +0 -1
- package/dist/types/interfaces.js +0 -26
- package/dist/types/interfaces.js.map +0 -1
- package/dist/types/objects.d.ts +0 -692
- package/dist/types/objects.d.ts.map +0 -1
- package/dist/types/objects.js +0 -837
- package/dist/types/objects.js.map +0 -1
- package/dist/types/storage.d.ts +0 -603
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -191
- package/dist/types/storage.js.map +0 -1
- package/dist/types/worker-loader.d.ts +0 -60
- package/dist/types/worker-loader.d.ts.map +0 -1
- package/dist/types/worker-loader.js +0 -62
- package/dist/types/worker-loader.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -198
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -272
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/sha1.d.ts +0 -325
- package/dist/utils/sha1.d.ts.map +0 -1
- package/dist/utils/sha1.js +0 -635
- package/dist/utils/sha1.js.map +0 -1
- package/dist/wire/capabilities.d.ts +0 -1044
- package/dist/wire/capabilities.d.ts.map +0 -1
- package/dist/wire/capabilities.js +0 -941
- package/dist/wire/capabilities.js.map +0 -1
- package/dist/wire/path-security.d.ts +0 -157
- package/dist/wire/path-security.d.ts.map +0 -1
- package/dist/wire/path-security.js +0 -307
- package/dist/wire/path-security.js.map +0 -1
- package/dist/wire/pkt-line.d.ts +0 -345
- package/dist/wire/pkt-line.d.ts.map +0 -1
- package/dist/wire/pkt-line.js +0 -381
- package/dist/wire/pkt-line.js.map +0 -1
- package/dist/wire/receive-pack.d.ts +0 -1059
- package/dist/wire/receive-pack.d.ts.map +0 -1
- package/dist/wire/receive-pack.js +0 -1414
- package/dist/wire/receive-pack.js.map +0 -1
- package/dist/wire/smart-http.d.ts +0 -799
- package/dist/wire/smart-http.d.ts.map +0 -1
- package/dist/wire/smart-http.js +0 -945
- package/dist/wire/smart-http.js.map +0 -1
- package/dist/wire/upload-pack.d.ts +0 -727
- package/dist/wire/upload-pack.d.ts.map +0 -1
- package/dist/wire/upload-pack.js +0 -1141
- package/dist/wire/upload-pack.js.map +0 -1
package/dist/ops/branch.d.ts
DELETED
|
@@ -1,766 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Git Branch Operations
|
|
3
|
-
*
|
|
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
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
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
|
|
46
|
-
*/
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
59
|
-
setRef(ref: string, sha: string): Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Deletes a ref.
|
|
62
|
-
* @param ref - The full ref path to delete
|
|
63
|
-
*/
|
|
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
|
-
*/
|
|
70
|
-
listRefs(prefix?: string): Promise<Array<{
|
|
71
|
-
ref: string;
|
|
72
|
-
sha: string;
|
|
73
|
-
}>>;
|
|
74
|
-
/**
|
|
75
|
-
* Gets the current HEAD value (SHA for detached, ref for attached).
|
|
76
|
-
* @returns The HEAD value
|
|
77
|
-
*/
|
|
78
|
-
getHead(): Promise<string>;
|
|
79
|
-
/**
|
|
80
|
-
* Sets HEAD to a SHA (creates detached HEAD).
|
|
81
|
-
* @param ref - The SHA to point HEAD to
|
|
82
|
-
*/
|
|
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
|
-
*/
|
|
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
|
-
*/
|
|
95
|
-
setSymbolicRef(ref: string, target: string): Promise<void>;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
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
|
-
* ```
|
|
111
|
-
*/
|
|
112
|
-
export interface BranchOptions {
|
|
113
|
-
/** The name for the new branch (without refs/heads/ prefix) */
|
|
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
|
-
*/
|
|
119
|
-
startPoint?: string;
|
|
120
|
-
/**
|
|
121
|
-
* If true, allow overwriting an existing branch.
|
|
122
|
-
* @default false
|
|
123
|
-
*/
|
|
124
|
-
force?: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* If true, checkout the branch after creating it.
|
|
127
|
-
* @default false
|
|
128
|
-
*/
|
|
129
|
-
checkout?: boolean;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Result of creating a branch.
|
|
133
|
-
*
|
|
134
|
-
* @interface BranchCreateResult
|
|
135
|
-
*/
|
|
136
|
-
export interface BranchCreateResult {
|
|
137
|
-
/** The branch name (without refs/heads/) */
|
|
138
|
-
name: string;
|
|
139
|
-
/** The full ref path */
|
|
140
|
-
ref: string;
|
|
141
|
-
/** The SHA the branch points to */
|
|
142
|
-
sha: string;
|
|
143
|
-
/**
|
|
144
|
-
* True if the branch was newly created.
|
|
145
|
-
* False if it already existed and force=true was used.
|
|
146
|
-
*/
|
|
147
|
-
created: boolean;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
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
|
-
* ```
|
|
162
|
-
*/
|
|
163
|
-
export interface BranchDeleteOptions {
|
|
164
|
-
/** Single branch name to delete */
|
|
165
|
-
name?: string;
|
|
166
|
-
/** Multiple branch names to delete */
|
|
167
|
-
names?: string[];
|
|
168
|
-
/**
|
|
169
|
-
* If true, delete even if not fully merged.
|
|
170
|
-
* @default false
|
|
171
|
-
*/
|
|
172
|
-
force?: boolean;
|
|
173
|
-
/**
|
|
174
|
-
* If true, check that branch is merged before deleting.
|
|
175
|
-
* @default false
|
|
176
|
-
*/
|
|
177
|
-
checkMerged?: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* If true, delete a remote-tracking branch instead of local.
|
|
180
|
-
* @default false
|
|
181
|
-
*/
|
|
182
|
-
remote?: boolean;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Result of deleting a branch.
|
|
186
|
-
*
|
|
187
|
-
* @interface BranchDeleteResult
|
|
188
|
-
*/
|
|
189
|
-
export interface BranchDeleteResult {
|
|
190
|
-
/** Whether any branches were deleted */
|
|
191
|
-
deleted: boolean;
|
|
192
|
-
/** The name of the first deleted branch */
|
|
193
|
-
name: string;
|
|
194
|
-
/** The SHA of the first deleted branch */
|
|
195
|
-
sha: string;
|
|
196
|
-
/** All branches that were deleted */
|
|
197
|
-
deletedBranches: Array<{
|
|
198
|
-
name: string;
|
|
199
|
-
sha: string;
|
|
200
|
-
}>;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
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
|
-
* ```
|
|
216
|
-
*/
|
|
217
|
-
export interface BranchListOptions {
|
|
218
|
-
/**
|
|
219
|
-
* If true, list remote-tracking branches.
|
|
220
|
-
* @default false
|
|
221
|
-
*/
|
|
222
|
-
remote?: boolean;
|
|
223
|
-
/**
|
|
224
|
-
* If true, list both local and remote branches.
|
|
225
|
-
* @default false
|
|
226
|
-
*/
|
|
227
|
-
all?: boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Glob pattern to filter branch names.
|
|
230
|
-
* Supports * and ? wildcards.
|
|
231
|
-
*/
|
|
232
|
-
pattern?: string;
|
|
233
|
-
/** Only list branches that contain this commit SHA */
|
|
234
|
-
contains?: string;
|
|
235
|
-
/** Only list branches merged into this ref */
|
|
236
|
-
merged?: string;
|
|
237
|
-
/** Only list branches NOT merged into this ref */
|
|
238
|
-
noMerged?: string;
|
|
239
|
-
/**
|
|
240
|
-
* Sort field. Prefix with - for descending.
|
|
241
|
-
* Values: 'name', 'committerdate'
|
|
242
|
-
*/
|
|
243
|
-
sort?: string;
|
|
244
|
-
/**
|
|
245
|
-
* If true, include tracking info and commit subject.
|
|
246
|
-
* @default false
|
|
247
|
-
*/
|
|
248
|
-
verbose?: boolean;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Information about a branch.
|
|
252
|
-
*
|
|
253
|
-
* @interface BranchInfo
|
|
254
|
-
*/
|
|
255
|
-
export interface BranchInfo {
|
|
256
|
-
/** Branch name (without refs/heads/ or refs/remotes/) */
|
|
257
|
-
name: string;
|
|
258
|
-
/** Full ref path */
|
|
259
|
-
ref: string;
|
|
260
|
-
/** SHA the branch points to */
|
|
261
|
-
sha: string;
|
|
262
|
-
/** True if this is the current branch */
|
|
263
|
-
current: boolean;
|
|
264
|
-
/** Tracking information (if verbose=true and tracking is set) */
|
|
265
|
-
tracking?: TrackingInfo | null;
|
|
266
|
-
/** First line of head commit message (if verbose=true) */
|
|
267
|
-
commitSubject?: string;
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Tracking information for a branch.
|
|
271
|
-
*
|
|
272
|
-
* @interface TrackingInfo
|
|
273
|
-
*/
|
|
274
|
-
export interface TrackingInfo {
|
|
275
|
-
/** Full upstream ref (e.g., 'origin/main') */
|
|
276
|
-
upstream: string;
|
|
277
|
-
/** Remote name (e.g., 'origin') */
|
|
278
|
-
remote: string;
|
|
279
|
-
/** Remote branch name (e.g., 'main') */
|
|
280
|
-
remoteBranch: string;
|
|
281
|
-
/** Number of commits ahead of upstream */
|
|
282
|
-
ahead: number;
|
|
283
|
-
/** Number of commits behind upstream */
|
|
284
|
-
behind: number;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Options for renaming a branch.
|
|
288
|
-
*
|
|
289
|
-
* @interface BranchRenameOptions
|
|
290
|
-
*/
|
|
291
|
-
export interface BranchRenameOptions {
|
|
292
|
-
/**
|
|
293
|
-
* Branch to rename. If not specified, uses current branch.
|
|
294
|
-
*/
|
|
295
|
-
oldName?: string;
|
|
296
|
-
/** New name for the branch */
|
|
297
|
-
newName: string;
|
|
298
|
-
/**
|
|
299
|
-
* If true, allow overwriting an existing branch.
|
|
300
|
-
* @default false
|
|
301
|
-
*/
|
|
302
|
-
force?: boolean;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Result of renaming a branch.
|
|
306
|
-
*
|
|
307
|
-
* @interface BranchRenameResult
|
|
308
|
-
*/
|
|
309
|
-
export interface BranchRenameResult {
|
|
310
|
-
/** Whether the rename succeeded */
|
|
311
|
-
renamed: boolean;
|
|
312
|
-
/** Original branch name */
|
|
313
|
-
oldName: string;
|
|
314
|
-
/** New branch name */
|
|
315
|
-
newName: string;
|
|
316
|
-
/** SHA the branch points to */
|
|
317
|
-
sha: string;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
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
|
-
* ```
|
|
339
|
-
*/
|
|
340
|
-
export interface CheckoutOptions {
|
|
341
|
-
/** Branch name to checkout */
|
|
342
|
-
name?: string;
|
|
343
|
-
/** SHA to checkout (for detached HEAD) */
|
|
344
|
-
sha?: string;
|
|
345
|
-
/**
|
|
346
|
-
* If true, create the branch if it doesn't exist.
|
|
347
|
-
* @default false
|
|
348
|
-
*/
|
|
349
|
-
create?: boolean;
|
|
350
|
-
/**
|
|
351
|
-
* If true, overwrite existing branch when creating.
|
|
352
|
-
* @default false
|
|
353
|
-
*/
|
|
354
|
-
force?: boolean;
|
|
355
|
-
/** Starting point when creating a new branch */
|
|
356
|
-
startPoint?: string;
|
|
357
|
-
/**
|
|
358
|
-
* If true, checkout as detached HEAD.
|
|
359
|
-
* @default false
|
|
360
|
-
*/
|
|
361
|
-
detach?: boolean;
|
|
362
|
-
/** Set up tracking for this upstream (e.g., 'origin/main') */
|
|
363
|
-
track?: string;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Result of checking out a branch.
|
|
367
|
-
*
|
|
368
|
-
* @interface CheckoutResult
|
|
369
|
-
*/
|
|
370
|
-
export interface CheckoutResult {
|
|
371
|
-
/** Whether checkout succeeded */
|
|
372
|
-
success: boolean;
|
|
373
|
-
/** Branch name (null if detached HEAD) */
|
|
374
|
-
branch: string | null;
|
|
375
|
-
/** SHA that is now checked out */
|
|
376
|
-
sha: string;
|
|
377
|
-
/** True if a new branch was created */
|
|
378
|
-
created?: boolean;
|
|
379
|
-
/** True if now in detached HEAD state */
|
|
380
|
-
detached?: boolean;
|
|
381
|
-
/** Upstream tracking ref if set */
|
|
382
|
-
tracking?: string;
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* Result of setting branch tracking.
|
|
386
|
-
*
|
|
387
|
-
* @interface SetTrackingResult
|
|
388
|
-
*/
|
|
389
|
-
export interface SetTrackingResult {
|
|
390
|
-
/** Whether the operation succeeded */
|
|
391
|
-
success: boolean;
|
|
392
|
-
/** Local branch name */
|
|
393
|
-
branch: string;
|
|
394
|
-
/** Full upstream ref */
|
|
395
|
-
upstream: string;
|
|
396
|
-
/** Remote name */
|
|
397
|
-
remote: string;
|
|
398
|
-
/** Remote branch name */
|
|
399
|
-
remoteBranch: string;
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Result of removing branch tracking.
|
|
403
|
-
*
|
|
404
|
-
* @interface RemoveTrackingResult
|
|
405
|
-
*/
|
|
406
|
-
export interface RemoveTrackingResult {
|
|
407
|
-
/** Whether the operation succeeded */
|
|
408
|
-
success: boolean;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
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
|
-
* ```
|
|
437
|
-
*/
|
|
438
|
-
export declare function isValidBranchName(name: string): boolean;
|
|
439
|
-
/**
|
|
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
|
-
* ```
|
|
450
|
-
*/
|
|
451
|
-
export declare function normalizeBranchName(name: string): string;
|
|
452
|
-
/**
|
|
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
|
-
* ```
|
|
484
|
-
*/
|
|
485
|
-
export declare function createBranch(refStore: RefStore, options: BranchOptions): Promise<BranchCreateResult>;
|
|
486
|
-
/**
|
|
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
|
-
* ```
|
|
515
|
-
*/
|
|
516
|
-
export declare function deleteBranch(refStore: RefStore, options: BranchDeleteOptions): Promise<BranchDeleteResult>;
|
|
517
|
-
/**
|
|
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
|
-
* ```
|
|
544
|
-
*/
|
|
545
|
-
export declare function listBranches(refStore: RefStore, options?: BranchListOptions): Promise<BranchInfo[]>;
|
|
546
|
-
/**
|
|
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
|
-
* ```
|
|
579
|
-
*/
|
|
580
|
-
export declare function renameBranch(refStore: RefStore, options: BranchRenameOptions): Promise<BranchRenameResult>;
|
|
581
|
-
/**
|
|
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
|
-
* ```
|
|
620
|
-
*/
|
|
621
|
-
export declare function checkoutBranch(refStore: RefStore, options: CheckoutOptions): Promise<CheckoutResult>;
|
|
622
|
-
/**
|
|
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
|
-
* ```
|
|
640
|
-
*/
|
|
641
|
-
export declare function getCurrentBranch(refStore: RefStore): Promise<string | null>;
|
|
642
|
-
/**
|
|
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
|
-
* ```
|
|
659
|
-
*/
|
|
660
|
-
export declare function getBranchInfo(refStore: RefStore, name: string): Promise<BranchInfo | null>;
|
|
661
|
-
/**
|
|
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
|
-
* ```
|
|
681
|
-
*/
|
|
682
|
-
export declare function branchExists(refStore: RefStore, name: string, options?: {
|
|
683
|
-
remote?: boolean;
|
|
684
|
-
}): Promise<boolean>;
|
|
685
|
-
/**
|
|
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
|
-
* ```
|
|
702
|
-
*/
|
|
703
|
-
export declare function setBranchTracking(refStore: RefStore, branch: string, upstream: string): Promise<SetTrackingResult>;
|
|
704
|
-
/**
|
|
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
|
-
* ```
|
|
719
|
-
*/
|
|
720
|
-
export declare function getBranchTracking(refStore: RefStore, branch: string): Promise<TrackingInfo | null>;
|
|
721
|
-
/**
|
|
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
|
-
* ```
|
|
732
|
-
*/
|
|
733
|
-
export declare function removeBranchTracking(refStore: RefStore, branch: string): Promise<RemoveTrackingResult>;
|
|
734
|
-
/**
|
|
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
|
-
* ```
|
|
750
|
-
*/
|
|
751
|
-
export declare function getDefaultBranch(refStore: RefStore): Promise<string | null>;
|
|
752
|
-
/**
|
|
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
|
-
* ```
|
|
764
|
-
*/
|
|
765
|
-
export declare function setDefaultBranch(refStore: RefStore, name: string): Promise<void>;
|
|
766
|
-
//# sourceMappingURL=branch.d.ts.map
|