@statewalker/vcs-commands 0.1.1
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/LICENSE +21 -0
- package/README.md +591 -0
- package/dist/commands/add-command.d.ts +170 -0
- package/dist/commands/add-command.d.ts.map +1 -0
- package/dist/commands/blame-command.d.ts +267 -0
- package/dist/commands/blame-command.d.ts.map +1 -0
- package/dist/commands/branch-command.d.ts +211 -0
- package/dist/commands/branch-command.d.ts.map +1 -0
- package/dist/commands/checkout-command.d.ts +261 -0
- package/dist/commands/checkout-command.d.ts.map +1 -0
- package/dist/commands/cherry-pick-command.d.ts +128 -0
- package/dist/commands/cherry-pick-command.d.ts.map +1 -0
- package/dist/commands/clean-command.d.ts +91 -0
- package/dist/commands/clean-command.d.ts.map +1 -0
- package/dist/commands/clone-command.d.ts +233 -0
- package/dist/commands/clone-command.d.ts.map +1 -0
- package/dist/commands/commit-command.d.ts +199 -0
- package/dist/commands/commit-command.d.ts.map +1 -0
- package/dist/commands/describe-command.d.ts +175 -0
- package/dist/commands/describe-command.d.ts.map +1 -0
- package/dist/commands/diff-command.d.ts +96 -0
- package/dist/commands/diff-command.d.ts.map +1 -0
- package/dist/commands/fetch-command.d.ts +266 -0
- package/dist/commands/fetch-command.d.ts.map +1 -0
- package/dist/commands/gc-command.d.ts +83 -0
- package/dist/commands/gc-command.d.ts.map +1 -0
- package/dist/commands/index.d.ts +32 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +2 -0
- package/dist/commands/init-command.d.ts +175 -0
- package/dist/commands/init-command.d.ts.map +1 -0
- package/dist/commands/log-command.d.ts +246 -0
- package/dist/commands/log-command.d.ts.map +1 -0
- package/dist/commands/ls-remote-command.d.ts +122 -0
- package/dist/commands/ls-remote-command.d.ts.map +1 -0
- package/dist/commands/merge-command.d.ts +169 -0
- package/dist/commands/merge-command.d.ts.map +1 -0
- package/dist/commands/pack-refs-command.d.ts +57 -0
- package/dist/commands/pack-refs-command.d.ts.map +1 -0
- package/dist/commands/pull-command.d.ts +111 -0
- package/dist/commands/pull-command.d.ts.map +1 -0
- package/dist/commands/push-command.d.ts +220 -0
- package/dist/commands/push-command.d.ts.map +1 -0
- package/dist/commands/rebase-command.d.ts +186 -0
- package/dist/commands/rebase-command.d.ts.map +1 -0
- package/dist/commands/reflog-command.d.ts +45 -0
- package/dist/commands/reflog-command.d.ts.map +1 -0
- package/dist/commands/remote-command.d.ts +205 -0
- package/dist/commands/remote-command.d.ts.map +1 -0
- package/dist/commands/reset-command.d.ts +114 -0
- package/dist/commands/reset-command.d.ts.map +1 -0
- package/dist/commands/revert-command.d.ts +129 -0
- package/dist/commands/revert-command.d.ts.map +1 -0
- package/dist/commands/rm-command.d.ts +72 -0
- package/dist/commands/rm-command.d.ts.map +1 -0
- package/dist/commands/stash-apply-command.d.ts +132 -0
- package/dist/commands/stash-apply-command.d.ts.map +1 -0
- package/dist/commands/stash-create-command.d.ts +137 -0
- package/dist/commands/stash-create-command.d.ts.map +1 -0
- package/dist/commands/stash-drop-command.d.ts +63 -0
- package/dist/commands/stash-drop-command.d.ts.map +1 -0
- package/dist/commands/stash-list-command.d.ts +42 -0
- package/dist/commands/stash-list-command.d.ts.map +1 -0
- package/dist/commands/status-command.d.ts +55 -0
- package/dist/commands/status-command.d.ts.map +1 -0
- package/dist/commands/tag-command.d.ts +155 -0
- package/dist/commands/tag-command.d.ts.map +1 -0
- package/dist/commands/tree-restore.d.ts +51 -0
- package/dist/commands/tree-restore.d.ts.map +1 -0
- package/dist/commands-COO4tJhv.js +10274 -0
- package/dist/core-commands/add.command.d.ts +71 -0
- package/dist/core-commands/add.command.d.ts.map +1 -0
- package/dist/core-commands/add.command.impl.d.ts +53 -0
- package/dist/core-commands/add.command.impl.d.ts.map +1 -0
- package/dist/core-commands/checkout.command.d.ts +103 -0
- package/dist/core-commands/checkout.command.d.ts.map +1 -0
- package/dist/core-commands/checkout.command.impl.d.ts +114 -0
- package/dist/core-commands/checkout.command.impl.d.ts.map +1 -0
- package/dist/core-commands/index.d.ts +6 -0
- package/dist/core-commands/index.d.ts.map +1 -0
- package/dist/errors/add-errors.d.ts +16 -0
- package/dist/errors/add-errors.d.ts.map +1 -0
- package/dist/errors/checkout-errors.d.ts +24 -0
- package/dist/errors/checkout-errors.d.ts.map +1 -0
- package/dist/errors/command-errors.d.ts +38 -0
- package/dist/errors/command-errors.d.ts.map +1 -0
- package/dist/errors/commit-errors.d.ts +27 -0
- package/dist/errors/commit-errors.d.ts.map +1 -0
- package/dist/errors/git-api-error.d.ts +9 -0
- package/dist/errors/git-api-error.d.ts.map +1 -0
- package/dist/errors/index.d.ts +13 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +509 -0
- package/dist/errors/merge-errors.d.ts +63 -0
- package/dist/errors/merge-errors.d.ts.map +1 -0
- package/dist/errors/rebase-errors.d.ts +21 -0
- package/dist/errors/rebase-errors.d.ts.map +1 -0
- package/dist/errors/ref-errors.d.ts +63 -0
- package/dist/errors/ref-errors.d.ts.map +1 -0
- package/dist/errors/remote-errors.d.ts +16 -0
- package/dist/errors/remote-errors.d.ts.map +1 -0
- package/dist/errors/stash-errors.d.ts +24 -0
- package/dist/errors/stash-errors.d.ts.map +1 -0
- package/dist/errors/tag-errors.d.ts +11 -0
- package/dist/errors/tag-errors.d.ts.map +1 -0
- package/dist/errors/transport-errors.d.ts +42 -0
- package/dist/errors/transport-errors.d.ts.map +1 -0
- package/dist/git-command.d.ts +139 -0
- package/dist/git-command.d.ts.map +1 -0
- package/dist/git.d.ts +637 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/pack-import/index.d.ts +8 -0
- package/dist/pack-import/index.d.ts.map +1 -0
- package/dist/pack-import/pack-import.d.ts +11 -0
- package/dist/pack-import/pack-import.d.ts.map +1 -0
- package/dist/remote-config/index.d.ts +7 -0
- package/dist/remote-config/index.d.ts.map +1 -0
- package/dist/remote-config/remote-config-store.d.ts +93 -0
- package/dist/remote-config/remote-config-store.d.ts.map +1 -0
- package/dist/rename/index.d.ts +5 -0
- package/dist/rename/index.d.ts.map +1 -0
- package/dist/rename/similarity-index.d.ts +64 -0
- package/dist/rename/similarity-index.d.ts.map +1 -0
- package/dist/results/cherry-pick-result.d.ts +33 -0
- package/dist/results/cherry-pick-result.d.ts.map +1 -0
- package/dist/results/clone-result.d.ts +24 -0
- package/dist/results/clone-result.d.ts.map +1 -0
- package/dist/results/diff-entry.d.ts +77 -0
- package/dist/results/diff-entry.d.ts.map +1 -0
- package/dist/results/diff-formatter.d.ts +149 -0
- package/dist/results/diff-formatter.d.ts.map +1 -0
- package/dist/results/fetch-result.d.ts +78 -0
- package/dist/results/fetch-result.d.ts.map +1 -0
- package/dist/results/index.d.ts +14 -0
- package/dist/results/index.d.ts.map +1 -0
- package/dist/results/index.js +247 -0
- package/dist/results/init-result.d.ts +23 -0
- package/dist/results/init-result.d.ts.map +1 -0
- package/dist/results/merge-result.d.ts +117 -0
- package/dist/results/merge-result.d.ts.map +1 -0
- package/dist/results/pull-result.d.ts +24 -0
- package/dist/results/pull-result.d.ts.map +1 -0
- package/dist/results/push-result.d.ts +71 -0
- package/dist/results/push-result.d.ts.map +1 -0
- package/dist/results/rebase-result.d.ts +108 -0
- package/dist/results/rebase-result.d.ts.map +1 -0
- package/dist/results/revert-result.d.ts +33 -0
- package/dist/results/revert-result.d.ts.map +1 -0
- package/dist/results/stash-result.d.ts +48 -0
- package/dist/results/stash-result.d.ts.map +1 -0
- package/dist/results/status-result.d.ts +48 -0
- package/dist/results/status-result.d.ts.map +1 -0
- package/dist/status-result-BwAyxq6R.js +409 -0
- package/dist/transport-command.d.ts +83 -0
- package/dist/transport-command.d.ts.map +1 -0
- package/dist/tree-merge/index.d.ts +8 -0
- package/dist/tree-merge/index.d.ts.map +1 -0
- package/dist/tree-merge/tree-merge.d.ts +41 -0
- package/dist/tree-merge/tree-merge.d.ts.map +1 -0
- package/dist/types.d.ts +64 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { GitCommand } from "../git-command.js";
|
|
2
|
+
import { type DiffEntry } from "../results/diff-entry.js";
|
|
3
|
+
/**
|
|
4
|
+
* Show changes between commits, trees, and staging.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `git diff`.
|
|
7
|
+
*
|
|
8
|
+
* Based on JGit's DiffCommand.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Compare two commits
|
|
13
|
+
* const entries = await git.diff()
|
|
14
|
+
* .setOldTree(commitA)
|
|
15
|
+
* .setNewTree(commitB)
|
|
16
|
+
* .call();
|
|
17
|
+
*
|
|
18
|
+
* // Compare HEAD to staging
|
|
19
|
+
* const staged = await git.diff()
|
|
20
|
+
* .setCached(true)
|
|
21
|
+
* .call();
|
|
22
|
+
*
|
|
23
|
+
* // Filter by path prefix
|
|
24
|
+
* const srcChanges = await git.diff()
|
|
25
|
+
* .setOldTree(commitA)
|
|
26
|
+
* .setNewTree(commitB)
|
|
27
|
+
* .setPathFilter("src/")
|
|
28
|
+
* .call();
|
|
29
|
+
*
|
|
30
|
+
* for (const entry of entries) {
|
|
31
|
+
* console.log(`${entry.changeType}: ${entry.newPath ?? entry.oldPath}`);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class DiffCommand extends GitCommand<DiffEntry[]> {
|
|
36
|
+
private oldTree?;
|
|
37
|
+
private newTree?;
|
|
38
|
+
private cached;
|
|
39
|
+
private pathFilter?;
|
|
40
|
+
/**
|
|
41
|
+
* Set the old (base) tree/commit for comparison.
|
|
42
|
+
*
|
|
43
|
+
* Can be a commit ID, branch name, tag name, or tree ID.
|
|
44
|
+
* If not set, defaults to HEAD.
|
|
45
|
+
*
|
|
46
|
+
* @param refOrId Commit-ish or tree ID
|
|
47
|
+
*/
|
|
48
|
+
setOldTree(refOrId: string): this;
|
|
49
|
+
/**
|
|
50
|
+
* Set the new tree/commit for comparison.
|
|
51
|
+
*
|
|
52
|
+
* Can be a commit ID, branch name, tag name, or tree ID.
|
|
53
|
+
* If not set and cached=true, compares to staging.
|
|
54
|
+
* If not set and cached=false, compares to HEAD.
|
|
55
|
+
*
|
|
56
|
+
* @param refOrId Commit-ish or tree ID
|
|
57
|
+
*/
|
|
58
|
+
setNewTree(refOrId: string): this;
|
|
59
|
+
/**
|
|
60
|
+
* Compare HEAD to staging area instead of working tree.
|
|
61
|
+
*
|
|
62
|
+
* Equivalent to `git diff --cached` or `git diff --staged`.
|
|
63
|
+
*
|
|
64
|
+
* @param cached Whether to compare to staging
|
|
65
|
+
*/
|
|
66
|
+
setCached(cached: boolean): this;
|
|
67
|
+
/**
|
|
68
|
+
* Filter results to only paths starting with this prefix.
|
|
69
|
+
*
|
|
70
|
+
* @param path Path prefix to filter by
|
|
71
|
+
*/
|
|
72
|
+
setPathFilter(path: string): this;
|
|
73
|
+
/**
|
|
74
|
+
* Execute the diff.
|
|
75
|
+
*
|
|
76
|
+
* @returns List of diff entries representing changes
|
|
77
|
+
*/
|
|
78
|
+
call(): Promise<DiffEntry[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve a ref to its tree ID.
|
|
81
|
+
*/
|
|
82
|
+
private resolveTreeId;
|
|
83
|
+
/**
|
|
84
|
+
* Compare two trees and return list of differences.
|
|
85
|
+
*/
|
|
86
|
+
private diffTrees;
|
|
87
|
+
/**
|
|
88
|
+
* Collect all blob entries from a tree recursively.
|
|
89
|
+
*/
|
|
90
|
+
private collectTreeEntries;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Format a DiffEntry for display.
|
|
94
|
+
*/
|
|
95
|
+
export declare function formatDiffEntry(entry: DiffEntry): string;
|
|
96
|
+
//# sourceMappingURL=diff-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-command.d.ts","sourceRoot":"","sources":["../../src/commands/diff-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,WAAY,SAAQ,UAAU,CAAC,SAAS,EAAE,CAAC;IACtD,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAC,CAAS;IAE5B;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;;;;;OAQG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAI/B;IAED;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CA8BjC;IAED;;OAEG;YACW,aAAa;IAgB3B;;OAEG;YACW,SAAS;IAuDvB;;OAEG;YACW,kBAAkB;CAmBjC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAaxD"}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { type FetchResult } from "../results/fetch-result.js";
|
|
2
|
+
import { TransportCommand } from "../transport-command.js";
|
|
3
|
+
/**
|
|
4
|
+
* Tag fetching option.
|
|
5
|
+
*
|
|
6
|
+
* Based on JGit's TagOpt.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum TagOption {
|
|
9
|
+
/** Automatically follow tags that point to fetched commits */
|
|
10
|
+
AUTO_FOLLOW = "auto-follow",
|
|
11
|
+
/** Fetch all tags */
|
|
12
|
+
FETCH_TAGS = "fetch-tags",
|
|
13
|
+
/** Don't fetch any tags */
|
|
14
|
+
NO_TAGS = "no-tags"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Fetch objects and refs from a remote repository.
|
|
18
|
+
*
|
|
19
|
+
* Equivalent to `git fetch`.
|
|
20
|
+
*
|
|
21
|
+
* Based on JGit's FetchCommand.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* // Fetch from default remote
|
|
26
|
+
* const result = await git.fetch().call();
|
|
27
|
+
*
|
|
28
|
+
* // Fetch from specific remote
|
|
29
|
+
* const result = await git.fetch()
|
|
30
|
+
* .setRemote("upstream")
|
|
31
|
+
* .call();
|
|
32
|
+
*
|
|
33
|
+
* // Fetch specific refs
|
|
34
|
+
* const result = await git.fetch()
|
|
35
|
+
* .setRefSpecs("refs/heads/main:refs/remotes/origin/main")
|
|
36
|
+
* .call();
|
|
37
|
+
*
|
|
38
|
+
* // Shallow fetch
|
|
39
|
+
* const result = await git.fetch()
|
|
40
|
+
* .setDepth(10)
|
|
41
|
+
* .call();
|
|
42
|
+
*
|
|
43
|
+
* // Fetch with authentication
|
|
44
|
+
* const result = await git.fetch()
|
|
45
|
+
* .setCredentialsProvider("user", "token")
|
|
46
|
+
* .call();
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare class FetchCommand extends TransportCommand<FetchResult> {
|
|
50
|
+
private remote;
|
|
51
|
+
private refSpecs;
|
|
52
|
+
private removeDeletedRefs;
|
|
53
|
+
private tagOption;
|
|
54
|
+
private thin;
|
|
55
|
+
private depth?;
|
|
56
|
+
private dryRun;
|
|
57
|
+
private forceUpdate;
|
|
58
|
+
private checkFetchedObjects;
|
|
59
|
+
private initialBranch?;
|
|
60
|
+
private shallowSince?;
|
|
61
|
+
private shallowExcludes;
|
|
62
|
+
private unshallow;
|
|
63
|
+
/**
|
|
64
|
+
* Set the remote to fetch from.
|
|
65
|
+
*
|
|
66
|
+
* Can be either a remote name (e.g., "origin") or a URL.
|
|
67
|
+
* Default is "origin".
|
|
68
|
+
*
|
|
69
|
+
* @param remote Remote name or URL
|
|
70
|
+
*/
|
|
71
|
+
setRemote(remote: string): this;
|
|
72
|
+
/**
|
|
73
|
+
* Get the remote being fetched from.
|
|
74
|
+
*/
|
|
75
|
+
getRemote(): string;
|
|
76
|
+
/**
|
|
77
|
+
* Set refspecs to fetch.
|
|
78
|
+
*
|
|
79
|
+
* If not set, uses the default refspec for the remote.
|
|
80
|
+
*
|
|
81
|
+
* @param refSpecs Refspec strings
|
|
82
|
+
*/
|
|
83
|
+
setRefSpecs(...refSpecs: string[]): this;
|
|
84
|
+
/**
|
|
85
|
+
* Add a refspec to fetch.
|
|
86
|
+
*
|
|
87
|
+
* @param refSpec Refspec string
|
|
88
|
+
*/
|
|
89
|
+
addRefSpec(refSpec: string): this;
|
|
90
|
+
/**
|
|
91
|
+
* Set whether to remove refs that no longer exist on the remote.
|
|
92
|
+
*
|
|
93
|
+
* Equivalent to `git fetch --prune`.
|
|
94
|
+
*
|
|
95
|
+
* @param remove Whether to prune deleted refs
|
|
96
|
+
*/
|
|
97
|
+
setRemoveDeletedRefs(remove: boolean): this;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to remove deleted refs.
|
|
100
|
+
*/
|
|
101
|
+
isRemoveDeletedRefs(): boolean;
|
|
102
|
+
setTagOpt(option: TagOption): this;
|
|
103
|
+
/**
|
|
104
|
+
* Set thin-pack preference.
|
|
105
|
+
*
|
|
106
|
+
* @param thin Whether to use thin packs
|
|
107
|
+
*/
|
|
108
|
+
setThin(thin: boolean): this;
|
|
109
|
+
/**
|
|
110
|
+
* Whether thin packs are enabled.
|
|
111
|
+
*/
|
|
112
|
+
isThin(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Set shallow clone depth.
|
|
115
|
+
*
|
|
116
|
+
* @param depth Number of commits to fetch
|
|
117
|
+
*/
|
|
118
|
+
setDepth(depth: number): this;
|
|
119
|
+
/**
|
|
120
|
+
* Set dry run mode.
|
|
121
|
+
*
|
|
122
|
+
* In dry run mode, refs are not actually updated.
|
|
123
|
+
*
|
|
124
|
+
* @param dryRun Whether to do a dry run
|
|
125
|
+
*/
|
|
126
|
+
setDryRun(dryRun: boolean): this;
|
|
127
|
+
/**
|
|
128
|
+
* Whether dry run mode is enabled.
|
|
129
|
+
*/
|
|
130
|
+
isDryRun(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Set force update mode.
|
|
133
|
+
*
|
|
134
|
+
* When enabled, allows non-fast-forward updates.
|
|
135
|
+
*
|
|
136
|
+
* @param force Whether to force updates
|
|
137
|
+
*/
|
|
138
|
+
setForceUpdate(force: boolean): this;
|
|
139
|
+
/**
|
|
140
|
+
* Whether force update mode is enabled.
|
|
141
|
+
*/
|
|
142
|
+
isForceUpdate(): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Set whether to check received objects for validity.
|
|
145
|
+
*
|
|
146
|
+
* If true, objects received will be verified.
|
|
147
|
+
*
|
|
148
|
+
* @param check Whether to check objects
|
|
149
|
+
*/
|
|
150
|
+
setCheckFetchedObjects(check: boolean): this;
|
|
151
|
+
/**
|
|
152
|
+
* Whether to check received objects for validity.
|
|
153
|
+
*/
|
|
154
|
+
isCheckFetchedObjects(): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Set the initial branch to check out.
|
|
157
|
+
*
|
|
158
|
+
* Can be specified as ref name (refs/heads/main), branch name (main),
|
|
159
|
+
* or tag name (v1.0.0).
|
|
160
|
+
*
|
|
161
|
+
* @param branch Initial branch name
|
|
162
|
+
*/
|
|
163
|
+
setInitialBranch(branch: string): this;
|
|
164
|
+
/**
|
|
165
|
+
* Get the initial branch.
|
|
166
|
+
*/
|
|
167
|
+
getInitialBranch(): string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Deepens or shortens the history of a shallow repository to include
|
|
170
|
+
* all reachable commits after a specified time.
|
|
171
|
+
*
|
|
172
|
+
* Equivalent to `git fetch --shallow-since=<date>`.
|
|
173
|
+
*
|
|
174
|
+
* @param shallowSince The timestamp
|
|
175
|
+
*/
|
|
176
|
+
setShallowSince(shallowSince: Date): this;
|
|
177
|
+
/**
|
|
178
|
+
* Get the shallow-since date.
|
|
179
|
+
*/
|
|
180
|
+
getShallowSince(): Date | undefined;
|
|
181
|
+
/**
|
|
182
|
+
* Deepens or shortens the history of a shallow repository to exclude
|
|
183
|
+
* commits reachable from a specified remote branch or tag.
|
|
184
|
+
*
|
|
185
|
+
* Equivalent to `git fetch --shallow-exclude=<ref>`.
|
|
186
|
+
*
|
|
187
|
+
* @param shallowExclude The ref or commit to exclude
|
|
188
|
+
*/
|
|
189
|
+
addShallowExclude(shallowExclude: string): this;
|
|
190
|
+
/**
|
|
191
|
+
* Get the shallow excludes.
|
|
192
|
+
*/
|
|
193
|
+
getShallowExcludes(): string[];
|
|
194
|
+
/**
|
|
195
|
+
* If the source repository is complete, converts a shallow repository
|
|
196
|
+
* to a complete one, removing all the limitations imposed by shallow
|
|
197
|
+
* repositories.
|
|
198
|
+
*
|
|
199
|
+
* Equivalent to `git fetch --unshallow`.
|
|
200
|
+
*
|
|
201
|
+
* @param unshallow Whether to unshallow
|
|
202
|
+
*/
|
|
203
|
+
setUnshallow(unshallow: boolean): this;
|
|
204
|
+
/**
|
|
205
|
+
* Whether unshallow mode is enabled.
|
|
206
|
+
*/
|
|
207
|
+
isUnshallow(): boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Execute the fetch operation.
|
|
210
|
+
*
|
|
211
|
+
* @returns Fetch result with updated refs
|
|
212
|
+
* @throws InvalidRemoteError if remote cannot be resolved
|
|
213
|
+
*/
|
|
214
|
+
call(): Promise<FetchResult>;
|
|
215
|
+
/**
|
|
216
|
+
* Map a server ref name to a local ref name using parsed refspecs.
|
|
217
|
+
* Returns undefined if no refspec matches.
|
|
218
|
+
*/
|
|
219
|
+
private mapServerRef;
|
|
220
|
+
/**
|
|
221
|
+
* Check if any matching refspec has the force flag for a given server ref.
|
|
222
|
+
*/
|
|
223
|
+
private isRefSpecForced;
|
|
224
|
+
/**
|
|
225
|
+
* The refspecs this fetch runs with.
|
|
226
|
+
*
|
|
227
|
+
* Explicit refspecs win; otherwise a configured remote contributes its
|
|
228
|
+
* `remote.<name>.fetch` lines, which is what makes `fetch().setRemote("origin")`
|
|
229
|
+
* update tracking refs without being told how. A remote given as a bare URL
|
|
230
|
+
* has no config and so still needs its refspecs spelled out.
|
|
231
|
+
*/
|
|
232
|
+
private effectiveRefSpecs;
|
|
233
|
+
/**
|
|
234
|
+
* Resolve remote name to URL.
|
|
235
|
+
*
|
|
236
|
+
* A named remote resolves through `remote.<name>.url` in the working copy
|
|
237
|
+
* configuration. An unconfigured name is passed through unchanged, so a URL
|
|
238
|
+
* given straight to {@link setRemote} still works.
|
|
239
|
+
*/
|
|
240
|
+
private resolveRemoteUrl;
|
|
241
|
+
/**
|
|
242
|
+
* Compute ref update status using pre-fetch ref values.
|
|
243
|
+
*
|
|
244
|
+
* Uses saved pre-fetch values to correctly determine
|
|
245
|
+
* NEW vs NO_CHANGE vs FAST_FORWARD status.
|
|
246
|
+
*/
|
|
247
|
+
private computeRefUpdate;
|
|
248
|
+
/**
|
|
249
|
+
* Check if one commit is an ancestor of another.
|
|
250
|
+
*/
|
|
251
|
+
private isAncestor;
|
|
252
|
+
/**
|
|
253
|
+
* Prune refs that no longer exist on remote.
|
|
254
|
+
*/
|
|
255
|
+
private pruneDeletedRefs;
|
|
256
|
+
/**
|
|
257
|
+
* Store received pack data.
|
|
258
|
+
*
|
|
259
|
+
* Unpacks the pack into the working copy's history, so the objects the
|
|
260
|
+
* freshly written tracking refs point at are actually available locally.
|
|
261
|
+
* Import is idempotent: the stores are content-addressed, so re-importing
|
|
262
|
+
* a pack rewrites the same object IDs.
|
|
263
|
+
*/
|
|
264
|
+
private storePack;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=fetch-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-command.d.ts","sourceRoot":"","sources":["../../src/commands/fetch-command.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { GitCommand } from "../git-command.js";
|
|
2
|
+
/**
|
|
3
|
+
* Result of garbage collection
|
|
4
|
+
*/
|
|
5
|
+
export interface GCCommandResult {
|
|
6
|
+
/** Number of objects removed */
|
|
7
|
+
objectsRemoved: number;
|
|
8
|
+
/** Bytes freed by removing objects */
|
|
9
|
+
bytesFreed: number;
|
|
10
|
+
/** Whether refs were packed */
|
|
11
|
+
refsPacked: boolean;
|
|
12
|
+
/** Duration of the GC operation in milliseconds */
|
|
13
|
+
durationMs: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Run garbage collection on the repository.
|
|
17
|
+
*
|
|
18
|
+
* Equivalent to `git gc`.
|
|
19
|
+
*
|
|
20
|
+
* Garbage collection removes unreachable objects and optimizes
|
|
21
|
+
* repository storage. This includes:
|
|
22
|
+
* - Removing objects not reachable from any ref
|
|
23
|
+
* - Packing loose refs into packed-refs
|
|
24
|
+
* - Repacking objects into pack files (optional)
|
|
25
|
+
*
|
|
26
|
+
* Based on JGit's GarbageCollectCommand.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // Basic garbage collection
|
|
31
|
+
* const result = await git.gc().call();
|
|
32
|
+
* console.log(`Removed ${result.objectsRemoved} objects`);
|
|
33
|
+
*
|
|
34
|
+
* // Aggressive GC with repacking
|
|
35
|
+
* const result = await git.gc()
|
|
36
|
+
* .setAggressive(true)
|
|
37
|
+
* .call();
|
|
38
|
+
*
|
|
39
|
+
* // GC with expiration date (keep recent unreachable objects)
|
|
40
|
+
* const twoWeeksAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000);
|
|
41
|
+
* const result = await git.gc()
|
|
42
|
+
* .setExpire(twoWeeksAgo)
|
|
43
|
+
* .call();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare class GarbageCollectCommand extends GitCommand<GCCommandResult> {
|
|
47
|
+
private _packRefs;
|
|
48
|
+
private _aggressive;
|
|
49
|
+
private _expire?;
|
|
50
|
+
/**
|
|
51
|
+
* Set aggressive mode.
|
|
52
|
+
*
|
|
53
|
+
* In aggressive mode, GC will also repack objects for better compression.
|
|
54
|
+
*
|
|
55
|
+
* @param aggressive Whether to run aggressive GC
|
|
56
|
+
*/
|
|
57
|
+
setAggressive(aggressive: boolean): this;
|
|
58
|
+
/**
|
|
59
|
+
* Set whether to pack refs.
|
|
60
|
+
*
|
|
61
|
+
* When true (default), loose refs are packed into packed-refs.
|
|
62
|
+
*
|
|
63
|
+
* @param packRefs Whether to pack refs
|
|
64
|
+
*/
|
|
65
|
+
setPackRefs(packRefs: boolean): this;
|
|
66
|
+
/**
|
|
67
|
+
* Set expiration date for unreachable objects.
|
|
68
|
+
*
|
|
69
|
+
* Objects unreachable but modified after this date will not be deleted.
|
|
70
|
+
* This provides a grace period to prevent deleting objects that might
|
|
71
|
+
* still be needed by in-progress operations.
|
|
72
|
+
*
|
|
73
|
+
* @param expire Expiration date (objects older than this may be deleted)
|
|
74
|
+
*/
|
|
75
|
+
setExpire(expire: Date): this;
|
|
76
|
+
/**
|
|
77
|
+
* Execute the garbage collection.
|
|
78
|
+
*
|
|
79
|
+
* @returns GC result with statistics
|
|
80
|
+
*/
|
|
81
|
+
call(): Promise<GCCommandResult>;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=gc-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gc-command.d.ts","sourceRoot":"","sources":["../../src/commands/gc-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,gCAAgC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,+BAA+B;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,qBAAsB,SAAQ,UAAU,CAAC,eAAe,CAAC;IACpE,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAAC,CAAO;IAEvB;;;;;;OAMG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAIvC;IAED;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAInC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,IAAI,CAI5B;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC,CAqDrC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export * from "./add-command.js";
|
|
2
|
+
export * from "./blame-command.js";
|
|
3
|
+
export * from "./branch-command.js";
|
|
4
|
+
export * from "./checkout-command.js";
|
|
5
|
+
export * from "./cherry-pick-command.js";
|
|
6
|
+
export * from "./clean-command.js";
|
|
7
|
+
export * from "./clone-command.js";
|
|
8
|
+
export * from "./commit-command.js";
|
|
9
|
+
export * from "./describe-command.js";
|
|
10
|
+
export * from "./diff-command.js";
|
|
11
|
+
export * from "./fetch-command.js";
|
|
12
|
+
export * from "./gc-command.js";
|
|
13
|
+
export * from "./init-command.js";
|
|
14
|
+
export * from "./log-command.js";
|
|
15
|
+
export * from "./ls-remote-command.js";
|
|
16
|
+
export * from "./merge-command.js";
|
|
17
|
+
export * from "./pack-refs-command.js";
|
|
18
|
+
export * from "./pull-command.js";
|
|
19
|
+
export * from "./push-command.js";
|
|
20
|
+
export * from "./rebase-command.js";
|
|
21
|
+
export * from "./reflog-command.js";
|
|
22
|
+
export * from "./remote-command.js";
|
|
23
|
+
export * from "./reset-command.js";
|
|
24
|
+
export * from "./revert-command.js";
|
|
25
|
+
export * from "./rm-command.js";
|
|
26
|
+
export * from "./stash-apply-command.js";
|
|
27
|
+
export * from "./stash-create-command.js";
|
|
28
|
+
export * from "./stash-drop-command.js";
|
|
29
|
+
export * from "./stash-list-command.js";
|
|
30
|
+
export * from "./status-command.js";
|
|
31
|
+
export * from "./tag-command.js";
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { A as DiffCommand, B as CheckoutCommand, C as MergeCommand, D as InitCommand, E as RevFilter, F as FetchCommand, G as ListBranchCommand, H as CheckoutStatus, I as TagOption, K as RenameBranchCommand, M as DescribeCommand, N as CommitCommand, P as CloneCommand, R as CleanCommand, S as PackRefsCommand, T as LogCommand, U as CreateBranchCommand, V as CheckoutStage, W as DeleteBranchCommand, X as AddCommand, Y as BlameCommand, _ as ReflogCommand, a as StashDropCommand, b as PushCommand, c as STASH_REF, d as RevertCommand, f as ResetCommand, g as RemoteSetUrlCommand, h as RemoteRemoveCommand, i as StatusCommand, j as formatDiffEntry, k as GarbageCollectCommand, l as StashListCommand, m as RemoteListCommand, n as ListTagCommand, o as StashCreateCommand, p as RemoteAddCommand, r as TagCommand, s as StashApplyCommand, t as DeleteTagCommand, u as RmCommand, v as RebaseCommand, w as LsRemoteCommand, x as PullCommand, y as RebaseOperation, z as CherryPickCommand } from "../commands-COO4tJhv.js";
|
|
2
|
+
export { AddCommand, BlameCommand, CheckoutCommand, CheckoutStage, CheckoutStatus, CherryPickCommand, CleanCommand, CloneCommand, CommitCommand, CreateBranchCommand, DeleteBranchCommand, DeleteTagCommand, DescribeCommand, DiffCommand, FetchCommand, GarbageCollectCommand, InitCommand, ListBranchCommand, ListTagCommand, LogCommand, LsRemoteCommand, MergeCommand, PackRefsCommand, PullCommand, PushCommand, RebaseCommand, RebaseOperation, ReflogCommand, RemoteAddCommand, RemoteListCommand, RemoteRemoveCommand, RemoteSetUrlCommand, RenameBranchCommand, ResetCommand, RevFilter, RevertCommand, RmCommand, STASH_REF, StashApplyCommand, StashCreateCommand, StashDropCommand, StashListCommand, StatusCommand, TagCommand, TagOption, formatDiffEntry };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { type FilesApi } from "@statewalker/vcs-core";
|
|
2
|
+
import { type Staging, type Worktree } from "@statewalker/vcs-working-tree";
|
|
3
|
+
import type { InitResult } from "../results/init-result.js";
|
|
4
|
+
/**
|
|
5
|
+
* Command to initialize a new Git repository.
|
|
6
|
+
*
|
|
7
|
+
* Based on JGit's InitCommand pattern. This command creates a new
|
|
8
|
+
* Git repository with the specified configuration.
|
|
9
|
+
*
|
|
10
|
+
* Note: Unlike other commands, InitCommand does not extend GitCommand
|
|
11
|
+
* because it creates a new repository rather than operating on an existing one.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Initialize in-memory repository
|
|
16
|
+
* const result = await new InitCommand().call();
|
|
17
|
+
* const git = result.git;
|
|
18
|
+
*
|
|
19
|
+
* // Initialize file-based repository
|
|
20
|
+
* import { createNodeFilesApi } from "@statewalker/vcs-utils-node/files";
|
|
21
|
+
* const files = createNodeFilesApi({ fs, rootDir: "/path/to/project" });
|
|
22
|
+
* const result = await new InitCommand()
|
|
23
|
+
* .setFilesApi(files)
|
|
24
|
+
* .setDirectory(".git")
|
|
25
|
+
* .call();
|
|
26
|
+
*
|
|
27
|
+
* // Initialize bare repository
|
|
28
|
+
* const result = await new InitCommand()
|
|
29
|
+
* .setBare(true)
|
|
30
|
+
* .setInitialBranch("main")
|
|
31
|
+
* .call();
|
|
32
|
+
*
|
|
33
|
+
* // Initialize with custom staging store and worktree support
|
|
34
|
+
* const result = await new InitCommand()
|
|
35
|
+
* .setFilesApi(files)
|
|
36
|
+
* .setStagingStore(new FileStagingStore(files, ".git/index"))
|
|
37
|
+
* .setWorktree(true)
|
|
38
|
+
* .call();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class InitCommand {
|
|
42
|
+
private files?;
|
|
43
|
+
private directory?;
|
|
44
|
+
private gitDir?;
|
|
45
|
+
private bare;
|
|
46
|
+
private initialBranch;
|
|
47
|
+
private stagingStore?;
|
|
48
|
+
private worktreeEnabled;
|
|
49
|
+
private worktreeStore?;
|
|
50
|
+
private callable;
|
|
51
|
+
/**
|
|
52
|
+
* Set the FilesApi implementation for storage.
|
|
53
|
+
*
|
|
54
|
+
* If not set, an in-memory FilesApi will be used.
|
|
55
|
+
*
|
|
56
|
+
* @param files The FilesApi to use for repository storage
|
|
57
|
+
* @returns this for method chaining
|
|
58
|
+
*/
|
|
59
|
+
setFilesApi(files: FilesApi): this;
|
|
60
|
+
/**
|
|
61
|
+
* Set the working directory for the repository.
|
|
62
|
+
*
|
|
63
|
+
* For non-bare repositories, this is the parent of the .git directory.
|
|
64
|
+
* If gitDir is not explicitly set, it will be `${directory}/.git`.
|
|
65
|
+
*
|
|
66
|
+
* @param directory The working directory path
|
|
67
|
+
* @returns this for method chaining
|
|
68
|
+
*/
|
|
69
|
+
setDirectory(directory: string): this;
|
|
70
|
+
/**
|
|
71
|
+
* Set the git directory path.
|
|
72
|
+
*
|
|
73
|
+
* For non-bare repositories, this is typically `.git` inside the working directory.
|
|
74
|
+
* For bare repositories, this is the repository root.
|
|
75
|
+
*
|
|
76
|
+
* @param gitDir The .git directory path
|
|
77
|
+
* @returns this for method chaining
|
|
78
|
+
*/
|
|
79
|
+
setGitDir(gitDir: string): this;
|
|
80
|
+
/**
|
|
81
|
+
* Set whether to create a bare repository.
|
|
82
|
+
*
|
|
83
|
+
* Bare repositories have no working tree and are typically used
|
|
84
|
+
* as central repositories for pushing/pulling.
|
|
85
|
+
*
|
|
86
|
+
* @param bare True for bare repository, false for normal
|
|
87
|
+
* @returns this for method chaining
|
|
88
|
+
*/
|
|
89
|
+
setBare(bare: boolean): this;
|
|
90
|
+
/**
|
|
91
|
+
* Set the initial branch name.
|
|
92
|
+
*
|
|
93
|
+
* This is the branch that HEAD will point to after initialization.
|
|
94
|
+
* Defaults to "main".
|
|
95
|
+
*
|
|
96
|
+
* @param branch The initial branch name
|
|
97
|
+
* @returns this for method chaining
|
|
98
|
+
*/
|
|
99
|
+
setInitialBranch(branch: string): this;
|
|
100
|
+
/**
|
|
101
|
+
* Set a custom staging store.
|
|
102
|
+
*
|
|
103
|
+
* If not set, a MemoryStagingStore will be used.
|
|
104
|
+
* Use FileStagingStore for native git compatibility.
|
|
105
|
+
*
|
|
106
|
+
* @param stagingStore The staging store to use
|
|
107
|
+
* @returns this for method chaining
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* // For native git compatibility
|
|
112
|
+
* const fileStaging = new FileStagingStore(files, ".git/index");
|
|
113
|
+
* await fileStaging.read(); // Load existing index if present
|
|
114
|
+
*
|
|
115
|
+
* const result = await new InitCommand()
|
|
116
|
+
* .setFilesApi(files)
|
|
117
|
+
* .setStagingStore(fileStaging)
|
|
118
|
+
* .call();
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
setStagingStore(stagingStore: Staging): this;
|
|
122
|
+
/**
|
|
123
|
+
* Enable worktree support for porcelain commands like git.add().
|
|
124
|
+
*
|
|
125
|
+
* When enabled, creates a WorktreeStore from the FilesApi that allows
|
|
126
|
+
* commands like AddCommand to iterate and read files from the working tree.
|
|
127
|
+
*
|
|
128
|
+
* Ignored for bare repositories.
|
|
129
|
+
*
|
|
130
|
+
* @param enabled True to enable worktree support
|
|
131
|
+
* @returns this for method chaining
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const result = await new InitCommand()
|
|
136
|
+
* .setFilesApi(files)
|
|
137
|
+
* .setWorktree(true)
|
|
138
|
+
* .call();
|
|
139
|
+
*
|
|
140
|
+
* // Now git.add() works
|
|
141
|
+
* await result.git.add().addFilepattern("src/").call();
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
setWorktree(enabled: boolean): this;
|
|
145
|
+
/**
|
|
146
|
+
* Set a custom worktree store.
|
|
147
|
+
*
|
|
148
|
+
* Alternative to setWorktree(true) when you need custom worktree configuration.
|
|
149
|
+
*
|
|
150
|
+
* @param worktree The worktree store to use
|
|
151
|
+
* @returns this for method chaining
|
|
152
|
+
*/
|
|
153
|
+
setWorktreeStore(worktree: Worktree): this;
|
|
154
|
+
/**
|
|
155
|
+
* Execute the init command and create a new repository.
|
|
156
|
+
*
|
|
157
|
+
* @returns InitResult containing the Git facade, store, and repository
|
|
158
|
+
* @throws Error if the command has already been called
|
|
159
|
+
*/
|
|
160
|
+
call(): Promise<InitResult>;
|
|
161
|
+
/**
|
|
162
|
+
* Resolve the git directory path based on configuration.
|
|
163
|
+
*/
|
|
164
|
+
private resolveGitDir;
|
|
165
|
+
/**
|
|
166
|
+
* Check if the command is still callable.
|
|
167
|
+
* @throws Error if the command has already been executed
|
|
168
|
+
*/
|
|
169
|
+
private checkCallable;
|
|
170
|
+
/**
|
|
171
|
+
* Set the callable state.
|
|
172
|
+
*/
|
|
173
|
+
private setCallable;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=init-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-command.d.ts","sourceRoot":"","sources":["../../src/commands/init-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACnG,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AAKvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAAC,CAAW;IACzB,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,aAAa,CAAU;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAU;IAC/B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,aAAa,CAAC,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAQ;IAExB;;;;;;;OAOG;IACH,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAIjC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAIpC;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI9B;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAI3B;IAED;;;;;;;;OAQG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAIrC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAI3C;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIlC;IAED;;;;;;;OAOG;IACH,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAKzC;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CA+GhC;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,WAAW;CAGpB"}
|