@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,137 @@
|
|
|
1
|
+
import type { ObjectId, PersonIdent } from "@statewalker/vcs-core";
|
|
2
|
+
import { GitCommand } from "../git-command.js";
|
|
3
|
+
/**
|
|
4
|
+
* Interface for providing working tree and index state.
|
|
5
|
+
*
|
|
6
|
+
* The stash create operation requires access to the working directory
|
|
7
|
+
* and index, which requires a WorkingCopy with worktree access.
|
|
8
|
+
*/
|
|
9
|
+
export interface StashWorkingTreeProvider {
|
|
10
|
+
/**
|
|
11
|
+
* Get the current index tree (staged changes).
|
|
12
|
+
*/
|
|
13
|
+
getIndexTree(): Promise<ObjectId>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the working tree with uncommitted changes.
|
|
16
|
+
*/
|
|
17
|
+
getWorkingTree(): Promise<ObjectId>;
|
|
18
|
+
/**
|
|
19
|
+
* Get tree of untracked files (optional).
|
|
20
|
+
*/
|
|
21
|
+
getUntrackedTree?(): Promise<ObjectId | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if there are local changes to stash.
|
|
24
|
+
*/
|
|
25
|
+
hasLocalChanges(): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Reset working directory to HEAD after stash.
|
|
28
|
+
*/
|
|
29
|
+
resetHard(): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Command to create a stash commit.
|
|
33
|
+
*
|
|
34
|
+
* Equivalent to `git stash` or `git stash push`.
|
|
35
|
+
*
|
|
36
|
+
* Based on JGit's StashCreateCommand.
|
|
37
|
+
*
|
|
38
|
+
* Note: This command requires a working tree provider to access
|
|
39
|
+
* uncommitted changes. Without a provider, it creates a stash
|
|
40
|
+
* from the current HEAD state (no actual changes stashed).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // Create a stash with working tree provider
|
|
45
|
+
* const stashCommit = await git.stashCreate()
|
|
46
|
+
* .setWorkingTreeProvider(provider)
|
|
47
|
+
* .setMessage("WIP: feature work")
|
|
48
|
+
* .call();
|
|
49
|
+
*
|
|
50
|
+
* // Create stash including untracked files
|
|
51
|
+
* const stashCommit = await git.stashCreate()
|
|
52
|
+
* .setWorkingTreeProvider(provider)
|
|
53
|
+
* .setIncludeUntracked(true)
|
|
54
|
+
* .call();
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class StashCreateCommand extends GitCommand<ObjectId | undefined> {
|
|
58
|
+
private indexMessage;
|
|
59
|
+
private workingDirectoryMessage;
|
|
60
|
+
private ref;
|
|
61
|
+
private includeUntracked;
|
|
62
|
+
private workingTreeProvider?;
|
|
63
|
+
private customMessage?;
|
|
64
|
+
private author?;
|
|
65
|
+
/**
|
|
66
|
+
* Set the message used when committing index changes.
|
|
67
|
+
*
|
|
68
|
+
* The message will be formatted with the current branch, abbreviated
|
|
69
|
+
* commit ID, and short commit message.
|
|
70
|
+
*
|
|
71
|
+
* @param message The index message template
|
|
72
|
+
*/
|
|
73
|
+
setIndexMessage(message: string): this;
|
|
74
|
+
/**
|
|
75
|
+
* Set the message used when committing working directory changes.
|
|
76
|
+
*
|
|
77
|
+
* @param message The working directory message template
|
|
78
|
+
*/
|
|
79
|
+
setWorkingDirectoryMessage(message: string): this;
|
|
80
|
+
/**
|
|
81
|
+
* Set a custom stash message.
|
|
82
|
+
*
|
|
83
|
+
* @param message The custom message
|
|
84
|
+
*/
|
|
85
|
+
setMessage(message: string): this;
|
|
86
|
+
/**
|
|
87
|
+
* Set the reference to update with the stashed commit ID.
|
|
88
|
+
* If null, no reference is updated.
|
|
89
|
+
*
|
|
90
|
+
* @param ref The ref name (default: refs/stash)
|
|
91
|
+
*/
|
|
92
|
+
setRef(ref: string | null): this;
|
|
93
|
+
/**
|
|
94
|
+
* Set whether to include untracked files in the stash.
|
|
95
|
+
*
|
|
96
|
+
* @param includeUntracked true to include untracked files
|
|
97
|
+
*/
|
|
98
|
+
setIncludeUntracked(includeUntracked: boolean): this;
|
|
99
|
+
/**
|
|
100
|
+
* Get whether untracked files will be included.
|
|
101
|
+
*/
|
|
102
|
+
getIncludeUntracked(): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Set the working tree provider for accessing uncommitted changes.
|
|
105
|
+
*
|
|
106
|
+
* @param provider The working tree provider
|
|
107
|
+
*/
|
|
108
|
+
setWorkingTreeProvider(provider: StashWorkingTreeProvider): this;
|
|
109
|
+
/**
|
|
110
|
+
* Set the author/committer identity for the stash commits.
|
|
111
|
+
*
|
|
112
|
+
* @param author The author identity
|
|
113
|
+
*/
|
|
114
|
+
setAuthor(author: PersonIdent): this;
|
|
115
|
+
/**
|
|
116
|
+
* Execute the stash create command.
|
|
117
|
+
*
|
|
118
|
+
* @returns The stash commit ID, or undefined if nothing to stash
|
|
119
|
+
*/
|
|
120
|
+
call(): Promise<ObjectId | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Format a message template.
|
|
123
|
+
*/
|
|
124
|
+
private formatMessage;
|
|
125
|
+
/**
|
|
126
|
+
* Get the current branch name.
|
|
127
|
+
*/
|
|
128
|
+
private getCurrentBranchName;
|
|
129
|
+
/**
|
|
130
|
+
* Update the stash ref.
|
|
131
|
+
*
|
|
132
|
+
* Note: Reflog support is not part of the core RefStore interface.
|
|
133
|
+
* Stash history is tracked via parent commit chain instead.
|
|
134
|
+
*/
|
|
135
|
+
private updateStashRef;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=stash-create-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stash-create-command.d.ts","sourceRoot":"","sources":["../../src/commands/stash-create-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAgC/C;;;;;GAKG;AACH,MAA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AW,GAAG,IAAI,CAInC;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CA0G1C;IAED;;OAEG;IACH,OAAO,CAAC,aAAa;IASrB;;OAEG;YACW,oBAAoB;IASlC;;;;;OAKG;YACW,cAAc;CAI7B"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ObjectId } from "@statewalker/vcs-core";
|
|
2
|
+
import { GitCommand } from "../git-command.js";
|
|
3
|
+
/**
|
|
4
|
+
* Command to drop (delete) a stashed commit.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `git stash drop`.
|
|
7
|
+
*
|
|
8
|
+
* Based on JGit's StashDropCommand.
|
|
9
|
+
*
|
|
10
|
+
* Note: Without reflog support in RefStore, only the most recent stash (index 0)
|
|
11
|
+
* can be dropped. Dropping by index > 0 requires reflog support.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Drop most recent stash
|
|
16
|
+
* const result = await git.stashDrop().call();
|
|
17
|
+
*
|
|
18
|
+
* // Drop specific stash (requires reflog support)
|
|
19
|
+
* const result = await git.stashDrop()
|
|
20
|
+
* .setStashRef(2)
|
|
21
|
+
* .call();
|
|
22
|
+
*
|
|
23
|
+
* // Drop all stashes
|
|
24
|
+
* const result = await git.stashDrop()
|
|
25
|
+
* .setAll(true)
|
|
26
|
+
* .call();
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class StashDropCommand extends GitCommand<ObjectId | undefined> {
|
|
30
|
+
private stashRefEntry;
|
|
31
|
+
private dropAll;
|
|
32
|
+
/**
|
|
33
|
+
* Set the stash reference to drop (0-based index).
|
|
34
|
+
*
|
|
35
|
+
* Defaults to 0 (most recent) if not specified.
|
|
36
|
+
*
|
|
37
|
+
* Note: Without reflog support, only index 0 is valid.
|
|
38
|
+
*
|
|
39
|
+
* @param stashRef The 0-based index of the stash to drop
|
|
40
|
+
*/
|
|
41
|
+
setStashRef(stashRef: number): this;
|
|
42
|
+
/**
|
|
43
|
+
* Get the stash index to drop.
|
|
44
|
+
*/
|
|
45
|
+
getStashRef(): number;
|
|
46
|
+
/**
|
|
47
|
+
* Set whether to drop all stashed commits.
|
|
48
|
+
*
|
|
49
|
+
* @param all true to drop all stashes
|
|
50
|
+
*/
|
|
51
|
+
setAll(all: boolean): this;
|
|
52
|
+
/**
|
|
53
|
+
* Get whether all stashes will be dropped.
|
|
54
|
+
*/
|
|
55
|
+
getAll(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Execute the stash drop command.
|
|
58
|
+
*
|
|
59
|
+
* @returns The new stash ref after drop, or undefined if no stashes remain
|
|
60
|
+
*/
|
|
61
|
+
call(): Promise<ObjectId | undefined>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=stash-drop-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stash-drop-command.d.ts","sourceRoot":"","sources":["../../src/commands/stash-drop-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,QAAQ,GAAG,SAAS,CAAC;IACpE,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,OAAO,CAAS;IAExB;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAOlC;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,CAEpB;IAED;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAIzB;IAED;;OAEG;IACH,MAAM,IAAI,OAAO,CAEhB;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CA6B1C;CACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GitCommand } from "../git-command.js";
|
|
2
|
+
import type { StashEntry } from "../results/stash-result.js";
|
|
3
|
+
/**
|
|
4
|
+
* Reference name for stash.
|
|
5
|
+
*/
|
|
6
|
+
export declare const STASH_REF = "refs/stash";
|
|
7
|
+
/**
|
|
8
|
+
* Command to list stashed commits.
|
|
9
|
+
*
|
|
10
|
+
* Equivalent to `git stash list`.
|
|
11
|
+
*
|
|
12
|
+
* Based on JGit's StashListCommand.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // List all stashes
|
|
17
|
+
* const stashes = await git.stashList().call();
|
|
18
|
+
* for (const stash of stashes) {
|
|
19
|
+
* console.log(`stash@{${stash.index}}: ${stash.message}`);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class StashListCommand extends GitCommand<StashEntry[]> {
|
|
24
|
+
/**
|
|
25
|
+
* Execute the stash list command.
|
|
26
|
+
*
|
|
27
|
+
* @returns Array of stash entries, most recent first
|
|
28
|
+
*/
|
|
29
|
+
call(): Promise<StashEntry[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get stash entries.
|
|
32
|
+
*
|
|
33
|
+
* Note: Without reflog support in the core RefStore interface,
|
|
34
|
+
* this returns only the most recent stash (if any).
|
|
35
|
+
*/
|
|
36
|
+
private getStashReflog;
|
|
37
|
+
/**
|
|
38
|
+
* Parse a stash commit into a StashEntry.
|
|
39
|
+
*/
|
|
40
|
+
private parseStashEntry;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=stash-list-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stash-list-command.d.ts","sourceRoot":"","sources":["../../src/commands/stash-list-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,UAAU,EAAE,CAAC;IAC5D;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAwBlC;IAED;;;;;OAKG;YACW,cAAc;IAmB5B;;OAEG;YACW,eAAe;CA6B9B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { GitCommand } from "../git-command.js";
|
|
2
|
+
import { type Status } from "../results/status-result.js";
|
|
3
|
+
/**
|
|
4
|
+
* Shows the staging area status compared to HEAD.
|
|
5
|
+
*
|
|
6
|
+
* This is a simplified version for repositories without working trees,
|
|
7
|
+
* focusing on staged changes and conflicts.
|
|
8
|
+
*
|
|
9
|
+
* Equivalent to `git status` but only for staged changes.
|
|
10
|
+
*
|
|
11
|
+
* Based on JGit's StatusCommand (staged-only subset).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // Get repository status
|
|
16
|
+
* const status = await git.status().call();
|
|
17
|
+
*
|
|
18
|
+
* // Check if clean
|
|
19
|
+
* if (status.isClean()) {
|
|
20
|
+
* console.log("Nothing to commit");
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* // Check for changes
|
|
24
|
+
* console.log("Added:", status.added);
|
|
25
|
+
* console.log("Changed:", status.changed);
|
|
26
|
+
* console.log("Removed:", status.removed);
|
|
27
|
+
* console.log("Conflicting:", status.conflicting);
|
|
28
|
+
*
|
|
29
|
+
* // Filter by path
|
|
30
|
+
* const subStatus = await git.status()
|
|
31
|
+
* .addPath("src/")
|
|
32
|
+
* .call();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class StatusCommand extends GitCommand<Status> {
|
|
36
|
+
private paths;
|
|
37
|
+
/**
|
|
38
|
+
* Add a path filter.
|
|
39
|
+
*
|
|
40
|
+
* Only status for paths starting with this prefix will be returned.
|
|
41
|
+
*
|
|
42
|
+
* @param path Path prefix to filter by
|
|
43
|
+
*/
|
|
44
|
+
addPath(path: string): this;
|
|
45
|
+
call(): Promise<Status>;
|
|
46
|
+
/**
|
|
47
|
+
* Check if a path matches the configured path filters.
|
|
48
|
+
*/
|
|
49
|
+
private matchesPath;
|
|
50
|
+
/**
|
|
51
|
+
* Collect all blob entries from a tree recursively.
|
|
52
|
+
*/
|
|
53
|
+
private collectTreeEntries;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=status-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-command.d.ts","sourceRoot":"","sources":["../../src/commands/status-command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,6BAA6B,CAAC;AAWtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,MAAM,CAAC;IACnD,OAAO,CAAC,KAAK,CAAgB;IAE7B;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAEK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAkE5B;IAED;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB;;OAEG;YACW,kBAAkB;CAiBjC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { ObjectId, PersonIdent, Ref } from "@statewalker/vcs-core";
|
|
2
|
+
import { GitCommand } from "../git-command.js";
|
|
3
|
+
/**
|
|
4
|
+
* Create a tag (lightweight or annotated).
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `git tag`.
|
|
7
|
+
*
|
|
8
|
+
* Based on JGit's TagCommand.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Create lightweight tag at HEAD
|
|
13
|
+
* await git.tag().setName("v1.0.0").call();
|
|
14
|
+
*
|
|
15
|
+
* // Create lightweight tag at specific commit
|
|
16
|
+
* await git.tag()
|
|
17
|
+
* .setName("v1.0.0")
|
|
18
|
+
* .setObjectId(commitId)
|
|
19
|
+
* .call();
|
|
20
|
+
*
|
|
21
|
+
* // Create annotated tag
|
|
22
|
+
* await git.tag()
|
|
23
|
+
* .setName("v1.0.0")
|
|
24
|
+
* .setMessage("Release version 1.0.0")
|
|
25
|
+
* .setAnnotated(true)
|
|
26
|
+
* .call();
|
|
27
|
+
*
|
|
28
|
+
* // Force overwrite existing tag
|
|
29
|
+
* await git.tag()
|
|
30
|
+
* .setName("v1.0.0")
|
|
31
|
+
* .setForce(true)
|
|
32
|
+
* .call();
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class TagCommand extends GitCommand<Ref> {
|
|
36
|
+
private name?;
|
|
37
|
+
private message?;
|
|
38
|
+
private objectId?;
|
|
39
|
+
private tagger?;
|
|
40
|
+
private annotated;
|
|
41
|
+
private force;
|
|
42
|
+
private signed;
|
|
43
|
+
/**
|
|
44
|
+
* Set the tag name.
|
|
45
|
+
*
|
|
46
|
+
* @param name Tag name (without refs/tags/ prefix)
|
|
47
|
+
*/
|
|
48
|
+
setName(name: string): this;
|
|
49
|
+
/**
|
|
50
|
+
* Set the tag message.
|
|
51
|
+
*
|
|
52
|
+
* Setting a message implies an annotated tag.
|
|
53
|
+
*
|
|
54
|
+
* @param message Tag message
|
|
55
|
+
*/
|
|
56
|
+
setMessage(message: string): this;
|
|
57
|
+
/**
|
|
58
|
+
* Set the object to tag.
|
|
59
|
+
*
|
|
60
|
+
* If not set, tags HEAD.
|
|
61
|
+
*
|
|
62
|
+
* @param objectId Object to tag
|
|
63
|
+
*/
|
|
64
|
+
setObjectId(objectId: ObjectId): this;
|
|
65
|
+
/**
|
|
66
|
+
* Set whether this is an annotated tag.
|
|
67
|
+
*
|
|
68
|
+
* Annotated tags are stored as objects and can have messages.
|
|
69
|
+
*
|
|
70
|
+
* @param annotated Whether to create annotated tag
|
|
71
|
+
*/
|
|
72
|
+
setAnnotated(annotated: boolean): this;
|
|
73
|
+
/**
|
|
74
|
+
* Set the tagger identity.
|
|
75
|
+
*
|
|
76
|
+
* @param name Tagger name
|
|
77
|
+
* @param email Tagger email
|
|
78
|
+
*/
|
|
79
|
+
setTagger(name: string, email: string): this;
|
|
80
|
+
/**
|
|
81
|
+
* Set the tagger identity from a PersonIdent.
|
|
82
|
+
*
|
|
83
|
+
* @param tagger Tagger identity
|
|
84
|
+
*/
|
|
85
|
+
setTaggerIdent(tagger: PersonIdent): this;
|
|
86
|
+
/**
|
|
87
|
+
* Set whether to force overwrite existing tag.
|
|
88
|
+
*
|
|
89
|
+
* @param force Whether to force
|
|
90
|
+
*/
|
|
91
|
+
setForce(force: boolean): this;
|
|
92
|
+
/**
|
|
93
|
+
* Set whether to create a signed tag.
|
|
94
|
+
*
|
|
95
|
+
* Note: Signing is not implemented yet.
|
|
96
|
+
*
|
|
97
|
+
* @param signed Whether to sign
|
|
98
|
+
*/
|
|
99
|
+
setSigned(signed: boolean): this;
|
|
100
|
+
/**
|
|
101
|
+
* Execute the tag creation.
|
|
102
|
+
*
|
|
103
|
+
* @returns The created tag ref
|
|
104
|
+
* @throws InvalidTagNameError if tag name is invalid
|
|
105
|
+
* @throws RefAlreadyExistsError if tag exists and force is false
|
|
106
|
+
*/
|
|
107
|
+
call(): Promise<Ref>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Delete tags.
|
|
111
|
+
*
|
|
112
|
+
* Equivalent to `git tag -d`.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // Delete a tag
|
|
117
|
+
* const deleted = await git.tagDelete().setTags("v1.0.0").call();
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare class DeleteTagCommand extends GitCommand<string[]> {
|
|
121
|
+
private tags;
|
|
122
|
+
/**
|
|
123
|
+
* Set the tags to delete.
|
|
124
|
+
*
|
|
125
|
+
* @param tags Tag names (without refs/tags/ prefix)
|
|
126
|
+
*/
|
|
127
|
+
setTags(...tags: string[]): this;
|
|
128
|
+
/**
|
|
129
|
+
* Execute the tag deletion.
|
|
130
|
+
*
|
|
131
|
+
* @returns List of deleted tag names (full ref names)
|
|
132
|
+
* @throws RefNotFoundError if tag doesn't exist
|
|
133
|
+
*/
|
|
134
|
+
call(): Promise<string[]>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* List tags.
|
|
138
|
+
*
|
|
139
|
+
* Equivalent to `git tag -l`.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* // List all tags
|
|
144
|
+
* const tags = await git.tagList().call();
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export declare class ListTagCommand extends GitCommand<Ref[]> {
|
|
148
|
+
/**
|
|
149
|
+
* Execute the tag listing.
|
|
150
|
+
*
|
|
151
|
+
* @returns List of tag refs
|
|
152
|
+
*/
|
|
153
|
+
call(): Promise<Ref[]>;
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=tag-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-command.d.ts","sourceRoot":"","sources":["../../src/commands/tag-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,QAAQ,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAStF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAmE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,UAAW,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,O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gB3B;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writing a tree back into the working tree.
|
|
3
|
+
*
|
|
4
|
+
* Shared by the commands that make the working tree match a tree object -
|
|
5
|
+
* `reset --hard` and `stash apply`. Both need the same two-phase shape: plan
|
|
6
|
+
* and validate the whole restore first, then write. A tree that cannot be
|
|
7
|
+
* restored faithfully therefore fails with the working tree still intact,
|
|
8
|
+
* rather than half-way through rewriting it.
|
|
9
|
+
*/
|
|
10
|
+
import type { Blobs, ObjectId } from "@statewalker/vcs-core";
|
|
11
|
+
import type { Worktree } from "@statewalker/vcs-working-tree";
|
|
12
|
+
import type { CommandTrees } from "../git-command.js";
|
|
13
|
+
/** One file a restore plans to write back into the working tree. */
|
|
14
|
+
export interface RestoreEntry {
|
|
15
|
+
path: string;
|
|
16
|
+
objectId: ObjectId;
|
|
17
|
+
mode: number;
|
|
18
|
+
}
|
|
19
|
+
/** A validated restore, ready to execute. */
|
|
20
|
+
export interface TreeRestorePlan {
|
|
21
|
+
/** The files to write. */
|
|
22
|
+
entries: RestoreEntry[];
|
|
23
|
+
/**
|
|
24
|
+
* Every path the tree accounts for - the files above plus the gitlinks
|
|
25
|
+
* that are deliberately not written. A tracked path missing from this set
|
|
26
|
+
* is one the target tree deletes.
|
|
27
|
+
*/
|
|
28
|
+
paths: Set<string>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Walk a tree and plan which files to restore, validating as it goes.
|
|
32
|
+
*
|
|
33
|
+
* Throws on anything that cannot be restored faithfully, so the caller can
|
|
34
|
+
* abort before mutating the working tree.
|
|
35
|
+
*
|
|
36
|
+
* @param trees Tree storage to walk
|
|
37
|
+
* @param blobs Blob storage, checked for the content of every planned file
|
|
38
|
+
* @param treeId Tree to restore
|
|
39
|
+
* @param operation Names the operation in failure messages, e.g. `reset --hard`
|
|
40
|
+
*/
|
|
41
|
+
export declare function planTreeRestore(trees: CommandTrees, blobs: Blobs, treeId: ObjectId, operation: string): Promise<TreeRestorePlan>;
|
|
42
|
+
/**
|
|
43
|
+
* Execute a plan produced by {@link planTreeRestore}, writing every file.
|
|
44
|
+
*
|
|
45
|
+
* @param worktree Working tree to write into
|
|
46
|
+
* @param blobs Blob storage to read content from
|
|
47
|
+
* @param plan The validated plan
|
|
48
|
+
* @param operation Names the operation in failure messages
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeTreeRestorePlan(worktree: Worktree, blobs: Blobs, plan: TreeRestorePlan, operation: string): Promise<void>;
|
|
51
|
+
//# sourceMappingURL=tree-restore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-restore.d.ts","sourceRoot":"","sources":["../../src/commands/tree-restore.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oEAAoE;AACpE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB;;;;OAIG;IACH,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,QAAQ,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,eAAe,CAAC,CAI1B;AA2CD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,eAAe,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAcf"}
|