@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.
Files changed (165) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +591 -0
  3. package/dist/commands/add-command.d.ts +170 -0
  4. package/dist/commands/add-command.d.ts.map +1 -0
  5. package/dist/commands/blame-command.d.ts +267 -0
  6. package/dist/commands/blame-command.d.ts.map +1 -0
  7. package/dist/commands/branch-command.d.ts +211 -0
  8. package/dist/commands/branch-command.d.ts.map +1 -0
  9. package/dist/commands/checkout-command.d.ts +261 -0
  10. package/dist/commands/checkout-command.d.ts.map +1 -0
  11. package/dist/commands/cherry-pick-command.d.ts +128 -0
  12. package/dist/commands/cherry-pick-command.d.ts.map +1 -0
  13. package/dist/commands/clean-command.d.ts +91 -0
  14. package/dist/commands/clean-command.d.ts.map +1 -0
  15. package/dist/commands/clone-command.d.ts +233 -0
  16. package/dist/commands/clone-command.d.ts.map +1 -0
  17. package/dist/commands/commit-command.d.ts +199 -0
  18. package/dist/commands/commit-command.d.ts.map +1 -0
  19. package/dist/commands/describe-command.d.ts +175 -0
  20. package/dist/commands/describe-command.d.ts.map +1 -0
  21. package/dist/commands/diff-command.d.ts +96 -0
  22. package/dist/commands/diff-command.d.ts.map +1 -0
  23. package/dist/commands/fetch-command.d.ts +266 -0
  24. package/dist/commands/fetch-command.d.ts.map +1 -0
  25. package/dist/commands/gc-command.d.ts +83 -0
  26. package/dist/commands/gc-command.d.ts.map +1 -0
  27. package/dist/commands/index.d.ts +32 -0
  28. package/dist/commands/index.d.ts.map +1 -0
  29. package/dist/commands/index.js +2 -0
  30. package/dist/commands/init-command.d.ts +175 -0
  31. package/dist/commands/init-command.d.ts.map +1 -0
  32. package/dist/commands/log-command.d.ts +246 -0
  33. package/dist/commands/log-command.d.ts.map +1 -0
  34. package/dist/commands/ls-remote-command.d.ts +122 -0
  35. package/dist/commands/ls-remote-command.d.ts.map +1 -0
  36. package/dist/commands/merge-command.d.ts +169 -0
  37. package/dist/commands/merge-command.d.ts.map +1 -0
  38. package/dist/commands/pack-refs-command.d.ts +57 -0
  39. package/dist/commands/pack-refs-command.d.ts.map +1 -0
  40. package/dist/commands/pull-command.d.ts +111 -0
  41. package/dist/commands/pull-command.d.ts.map +1 -0
  42. package/dist/commands/push-command.d.ts +220 -0
  43. package/dist/commands/push-command.d.ts.map +1 -0
  44. package/dist/commands/rebase-command.d.ts +186 -0
  45. package/dist/commands/rebase-command.d.ts.map +1 -0
  46. package/dist/commands/reflog-command.d.ts +45 -0
  47. package/dist/commands/reflog-command.d.ts.map +1 -0
  48. package/dist/commands/remote-command.d.ts +205 -0
  49. package/dist/commands/remote-command.d.ts.map +1 -0
  50. package/dist/commands/reset-command.d.ts +114 -0
  51. package/dist/commands/reset-command.d.ts.map +1 -0
  52. package/dist/commands/revert-command.d.ts +129 -0
  53. package/dist/commands/revert-command.d.ts.map +1 -0
  54. package/dist/commands/rm-command.d.ts +72 -0
  55. package/dist/commands/rm-command.d.ts.map +1 -0
  56. package/dist/commands/stash-apply-command.d.ts +132 -0
  57. package/dist/commands/stash-apply-command.d.ts.map +1 -0
  58. package/dist/commands/stash-create-command.d.ts +137 -0
  59. package/dist/commands/stash-create-command.d.ts.map +1 -0
  60. package/dist/commands/stash-drop-command.d.ts +63 -0
  61. package/dist/commands/stash-drop-command.d.ts.map +1 -0
  62. package/dist/commands/stash-list-command.d.ts +42 -0
  63. package/dist/commands/stash-list-command.d.ts.map +1 -0
  64. package/dist/commands/status-command.d.ts +55 -0
  65. package/dist/commands/status-command.d.ts.map +1 -0
  66. package/dist/commands/tag-command.d.ts +155 -0
  67. package/dist/commands/tag-command.d.ts.map +1 -0
  68. package/dist/commands/tree-restore.d.ts +51 -0
  69. package/dist/commands/tree-restore.d.ts.map +1 -0
  70. package/dist/commands-COO4tJhv.js +10274 -0
  71. package/dist/core-commands/add.command.d.ts +71 -0
  72. package/dist/core-commands/add.command.d.ts.map +1 -0
  73. package/dist/core-commands/add.command.impl.d.ts +53 -0
  74. package/dist/core-commands/add.command.impl.d.ts.map +1 -0
  75. package/dist/core-commands/checkout.command.d.ts +103 -0
  76. package/dist/core-commands/checkout.command.d.ts.map +1 -0
  77. package/dist/core-commands/checkout.command.impl.d.ts +114 -0
  78. package/dist/core-commands/checkout.command.impl.d.ts.map +1 -0
  79. package/dist/core-commands/index.d.ts +6 -0
  80. package/dist/core-commands/index.d.ts.map +1 -0
  81. package/dist/errors/add-errors.d.ts +16 -0
  82. package/dist/errors/add-errors.d.ts.map +1 -0
  83. package/dist/errors/checkout-errors.d.ts +24 -0
  84. package/dist/errors/checkout-errors.d.ts.map +1 -0
  85. package/dist/errors/command-errors.d.ts +38 -0
  86. package/dist/errors/command-errors.d.ts.map +1 -0
  87. package/dist/errors/commit-errors.d.ts +27 -0
  88. package/dist/errors/commit-errors.d.ts.map +1 -0
  89. package/dist/errors/git-api-error.d.ts +9 -0
  90. package/dist/errors/git-api-error.d.ts.map +1 -0
  91. package/dist/errors/index.d.ts +13 -0
  92. package/dist/errors/index.d.ts.map +1 -0
  93. package/dist/errors/index.js +509 -0
  94. package/dist/errors/merge-errors.d.ts +63 -0
  95. package/dist/errors/merge-errors.d.ts.map +1 -0
  96. package/dist/errors/rebase-errors.d.ts +21 -0
  97. package/dist/errors/rebase-errors.d.ts.map +1 -0
  98. package/dist/errors/ref-errors.d.ts +63 -0
  99. package/dist/errors/ref-errors.d.ts.map +1 -0
  100. package/dist/errors/remote-errors.d.ts +16 -0
  101. package/dist/errors/remote-errors.d.ts.map +1 -0
  102. package/dist/errors/stash-errors.d.ts +24 -0
  103. package/dist/errors/stash-errors.d.ts.map +1 -0
  104. package/dist/errors/tag-errors.d.ts +11 -0
  105. package/dist/errors/tag-errors.d.ts.map +1 -0
  106. package/dist/errors/transport-errors.d.ts +42 -0
  107. package/dist/errors/transport-errors.d.ts.map +1 -0
  108. package/dist/git-command.d.ts +139 -0
  109. package/dist/git-command.d.ts.map +1 -0
  110. package/dist/git.d.ts +637 -0
  111. package/dist/git.d.ts.map +1 -0
  112. package/dist/index.d.ts +8 -0
  113. package/dist/index.d.ts.map +1 -0
  114. package/dist/index.js +5 -0
  115. package/dist/pack-import/index.d.ts +8 -0
  116. package/dist/pack-import/index.d.ts.map +1 -0
  117. package/dist/pack-import/pack-import.d.ts +11 -0
  118. package/dist/pack-import/pack-import.d.ts.map +1 -0
  119. package/dist/remote-config/index.d.ts +7 -0
  120. package/dist/remote-config/index.d.ts.map +1 -0
  121. package/dist/remote-config/remote-config-store.d.ts +93 -0
  122. package/dist/remote-config/remote-config-store.d.ts.map +1 -0
  123. package/dist/rename/index.d.ts +5 -0
  124. package/dist/rename/index.d.ts.map +1 -0
  125. package/dist/rename/similarity-index.d.ts +64 -0
  126. package/dist/rename/similarity-index.d.ts.map +1 -0
  127. package/dist/results/cherry-pick-result.d.ts +33 -0
  128. package/dist/results/cherry-pick-result.d.ts.map +1 -0
  129. package/dist/results/clone-result.d.ts +24 -0
  130. package/dist/results/clone-result.d.ts.map +1 -0
  131. package/dist/results/diff-entry.d.ts +77 -0
  132. package/dist/results/diff-entry.d.ts.map +1 -0
  133. package/dist/results/diff-formatter.d.ts +149 -0
  134. package/dist/results/diff-formatter.d.ts.map +1 -0
  135. package/dist/results/fetch-result.d.ts +78 -0
  136. package/dist/results/fetch-result.d.ts.map +1 -0
  137. package/dist/results/index.d.ts +14 -0
  138. package/dist/results/index.d.ts.map +1 -0
  139. package/dist/results/index.js +247 -0
  140. package/dist/results/init-result.d.ts +23 -0
  141. package/dist/results/init-result.d.ts.map +1 -0
  142. package/dist/results/merge-result.d.ts +117 -0
  143. package/dist/results/merge-result.d.ts.map +1 -0
  144. package/dist/results/pull-result.d.ts +24 -0
  145. package/dist/results/pull-result.d.ts.map +1 -0
  146. package/dist/results/push-result.d.ts +71 -0
  147. package/dist/results/push-result.d.ts.map +1 -0
  148. package/dist/results/rebase-result.d.ts +108 -0
  149. package/dist/results/rebase-result.d.ts.map +1 -0
  150. package/dist/results/revert-result.d.ts +33 -0
  151. package/dist/results/revert-result.d.ts.map +1 -0
  152. package/dist/results/stash-result.d.ts +48 -0
  153. package/dist/results/stash-result.d.ts.map +1 -0
  154. package/dist/results/status-result.d.ts +48 -0
  155. package/dist/results/status-result.d.ts.map +1 -0
  156. package/dist/status-result-BwAyxq6R.js +409 -0
  157. package/dist/transport-command.d.ts +83 -0
  158. package/dist/transport-command.d.ts.map +1 -0
  159. package/dist/tree-merge/index.d.ts +8 -0
  160. package/dist/tree-merge/index.d.ts.map +1 -0
  161. package/dist/tree-merge/tree-merge.d.ts +41 -0
  162. package/dist/tree-merge/tree-merge.d.ts.map +1 -0
  163. package/dist/types.d.ts +64 -0
  164. package/dist/types.d.ts.map +1 -0
  165. package/package.json +62 -0
@@ -0,0 +1,233 @@
1
+ import type { CloneResult } from "../results/clone-result.js";
2
+ import { TransportCommand } from "../transport-command.js";
3
+ import { TagOption } from "./fetch-command.js";
4
+ /**
5
+ * Clone a remote repository.
6
+ *
7
+ * Equivalent to `git clone`.
8
+ *
9
+ * Based on JGit's CloneCommand.
10
+ *
11
+ * Note: Unlike other commands, CloneCommand initializes a new repository
12
+ * rather than operating on an existing one. The store passed to the
13
+ * constructor should be an empty/new store that will be populated.
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Basic clone
18
+ * const result = await git.clone()
19
+ * .setURI("https://github.com/user/repo")
20
+ * .call();
21
+ *
22
+ * // Clone specific branch
23
+ * const result = await git.clone()
24
+ * .setURI("https://github.com/user/repo")
25
+ * .setBranch("develop")
26
+ * .call();
27
+ *
28
+ * // Shallow clone
29
+ * const result = await git.clone()
30
+ * .setURI("https://github.com/user/repo")
31
+ * .setDepth(1)
32
+ * .call();
33
+ *
34
+ * // Bare clone
35
+ * const result = await git.clone()
36
+ * .setURI("https://github.com/user/repo")
37
+ * .setBare(true)
38
+ * .call();
39
+ * ```
40
+ */
41
+ export declare class CloneCommand extends TransportCommand<CloneResult> {
42
+ private uri?;
43
+ private branch?;
44
+ private depth?;
45
+ private bare;
46
+ private noCheckout;
47
+ private remoteName;
48
+ private cloneAllBranches;
49
+ private mirror;
50
+ private branchesToClone;
51
+ private tagOption;
52
+ private shallowSince?;
53
+ private shallowExcludes;
54
+ /**
55
+ * Set the URI to clone from.
56
+ *
57
+ * @param uri Repository URI (HTTPS, SSH, or Git protocol)
58
+ */
59
+ setURI(uri: string): this;
60
+ /**
61
+ * Get the URI being cloned.
62
+ */
63
+ getURI(): string | undefined;
64
+ /**
65
+ * Set the branch to clone.
66
+ *
67
+ * If set, only this branch will be fetched.
68
+ * Otherwise, all branches are fetched.
69
+ *
70
+ * @param branch Branch name (e.g., "main" or "refs/heads/main")
71
+ */
72
+ setBranch(branch: string): this;
73
+ /**
74
+ * Get the branch being cloned.
75
+ */
76
+ getBranch(): string | undefined;
77
+ /**
78
+ * Set shallow clone depth.
79
+ *
80
+ * @param depth Number of commits to fetch
81
+ */
82
+ setDepth(depth: number): this;
83
+ /**
84
+ * Set whether to create a bare repository.
85
+ *
86
+ * @param bare Whether to create bare repository
87
+ */
88
+ setBare(bare: boolean): this;
89
+ /**
90
+ * Whether bare clone is enabled.
91
+ */
92
+ isBare(): boolean;
93
+ /**
94
+ * Set whether to skip checkout.
95
+ *
96
+ * @param noCheckout Whether to skip checkout
97
+ */
98
+ setNoCheckout(noCheckout: boolean): this;
99
+ /**
100
+ * Whether checkout is skipped.
101
+ */
102
+ isNoCheckout(): boolean;
103
+ /**
104
+ * Set the remote name.
105
+ *
106
+ * Default is "origin".
107
+ *
108
+ * @param remoteName Remote name
109
+ */
110
+ setRemote(remoteName: string): this;
111
+ /**
112
+ * Get the remote name.
113
+ */
114
+ getRemote(): string;
115
+ /**
116
+ * Set whether to clone all branches.
117
+ *
118
+ * Default is true. If set to false and no branch is specified,
119
+ * only the default branch will be cloned.
120
+ *
121
+ * @param cloneAllBranches Whether to clone all branches
122
+ */
123
+ setCloneAllBranches(cloneAllBranches: boolean): this;
124
+ /**
125
+ * Whether clone all branches is enabled.
126
+ */
127
+ isCloneAllBranches(): boolean;
128
+ /**
129
+ * Set up a mirror of the source repository.
130
+ *
131
+ * This implies that a bare repository will be created.
132
+ * Compared to setBare, setMirror not only maps local branches
133
+ * of the source to local branches of the target, it maps all refs
134
+ * (including remote-tracking branches, notes, etc.).
135
+ *
136
+ * Equivalent to `git clone --mirror`.
137
+ *
138
+ * @param mirror Whether to mirror all refs
139
+ */
140
+ setMirror(mirror: boolean): this;
141
+ /**
142
+ * Whether mirror mode is enabled.
143
+ */
144
+ isMirror(): boolean;
145
+ /**
146
+ * Set branches or tags to clone.
147
+ *
148
+ * This is ignored if setCloneAllBranches(true) or setMirror(true) is used.
149
+ * If branchesToClone is empty, it's also ignored.
150
+ *
151
+ * @param branchesToClone Collection of branches to clone (full ref names)
152
+ */
153
+ setBranchesToClone(branchesToClone: string[]): this;
154
+ /**
155
+ * Get branches to clone.
156
+ */
157
+ getBranchesToClone(): string[];
158
+ /**
159
+ * Set the tag option for the remote configuration.
160
+ *
161
+ * @param tagOption Tag option
162
+ */
163
+ setTagOption(tagOption: TagOption): this;
164
+ /**
165
+ * Get the tag option.
166
+ */
167
+ getTagOption(): TagOption;
168
+ /**
169
+ * Set the --no-tags option.
170
+ *
171
+ * Tags are not cloned and the remote configuration is initialized
172
+ * with the --no-tags option as well.
173
+ *
174
+ * Equivalent to `git clone --no-tags`.
175
+ */
176
+ setNoTags(): this;
177
+ /**
178
+ * Create a shallow clone with a history after the specified time.
179
+ *
180
+ * Equivalent to `git clone --shallow-since=<date>`.
181
+ *
182
+ * @param shallowSince The timestamp
183
+ */
184
+ setShallowSince(shallowSince: Date): this;
185
+ /**
186
+ * Get the shallow-since date.
187
+ */
188
+ getShallowSince(): Date | undefined;
189
+ /**
190
+ * Create a shallow clone excluding commits reachable from a specified
191
+ * remote branch or tag.
192
+ *
193
+ * Equivalent to `git clone --shallow-exclude=<ref>`.
194
+ *
195
+ * @param shallowExclude The ref or commit to exclude
196
+ */
197
+ addShallowExclude(shallowExclude: string): this;
198
+ /**
199
+ * Get the shallow excludes.
200
+ */
201
+ getShallowExcludes(): string[];
202
+ /**
203
+ * Execute the clone operation.
204
+ *
205
+ * @returns Clone result
206
+ * @throws InvalidRemoteError if URI is not specified
207
+ */
208
+ call(): Promise<CloneResult>;
209
+ /**
210
+ * Determine which branch to clone based on options.
211
+ */
212
+ private determineBranchToClone;
213
+ /**
214
+ * Check if a ref should be skipped based on tag option.
215
+ */
216
+ private shouldSkipRef;
217
+ /**
218
+ * Convert a remote ref name to mirror ref name.
219
+ */
220
+ private toMirrorRefName;
221
+ /**
222
+ * Store received pack data.
223
+ *
224
+ * Unpacks the pack into the working copy's history, so the objects the
225
+ * cloned refs point at are actually available locally.
226
+ */
227
+ private storePack;
228
+ /**
229
+ * Checkout HEAD commit to staging area.
230
+ */
231
+ private checkoutHead;
232
+ }
233
+ //# sourceMappingURL=clone-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone-command.d.ts","sourceRoot":"","sources":["../../src/commands/clone-command.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAM9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,YAAa,SAAQ,gBAAgB,CAAC,WAAW,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,KAAK,CAAC,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,eAAe,C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S,CAExB;IAED;;;;;;;OAOG;IACH,SAAS,IAAI,IAAI,CAEhB;IAED;;;;;;OAMG;IACH,eAAe,CAAC,YAAY,EAAE,IAAI,GAAG,IAAI,CAIxC;IAED;;OAEG;IACH,eAAe,IAAI,IAAI,GAAG,SAAS,CAElC;IAED;;;;;;;OAOG;IACH,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAI9C;IAED;;OAEG;IACH,kBAAkB,IAAI,MAAM,EAAE,CAE7B;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,CAAC,CAmHjC;IAED;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAwB9B;;OAEG;IACH,OAAO,CAAC,aAAa;IAQrB;;OAEG;IACH,OAAO,CAAC,eAAe;IASvB;;;;;OAKG;YACW,SAAS;IAIvB;;OAEG;YACW,YAAY;CAY3B"}
@@ -0,0 +1,199 @@
1
+ import type { Commit, ObjectId, PersonIdent } from "@statewalker/vcs-core";
2
+ import type { Worktree } from "@statewalker/vcs-working-tree";
3
+ import { GitCommand } from "../git-command.js";
4
+ /**
5
+ * Result of a commit operation.
6
+ *
7
+ * Extends Commit with the ID of the created commit.
8
+ * JGit's CommitCommand returns RevCommit which includes getId().
9
+ */
10
+ export interface CommitResult extends Commit {
11
+ /** The ObjectId of the created commit */
12
+ id: ObjectId;
13
+ }
14
+ /**
15
+ * Create a commit from staged changes.
16
+ *
17
+ * Equivalent to `git commit`.
18
+ *
19
+ * Based on JGit's CommitCommand.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Simple commit
24
+ * const commit = await git.commit()
25
+ * .setMessage("Fix bug in parser")
26
+ * .call();
27
+ *
28
+ * // Commit with author
29
+ * const commit = await git.commit()
30
+ * .setMessage("Add feature")
31
+ * .setAuthor("John Doe", "john@example.com")
32
+ * .call();
33
+ *
34
+ * // Amend previous commit
35
+ * const commit = await git.commit()
36
+ * .setMessage("Updated message")
37
+ * .setAmend(true)
38
+ * .call();
39
+ *
40
+ * // Allow empty commit
41
+ * const commit = await git.commit()
42
+ * .setMessage("Empty commit")
43
+ * .setAllowEmpty(true)
44
+ * .call();
45
+ *
46
+ * // Commit only specific paths
47
+ * const commit = await git.commit()
48
+ * .setMessage("Partial commit")
49
+ * .setOnly("src/file.ts", "tests/file.test.ts")
50
+ * .call();
51
+ *
52
+ * // Auto-stage and commit tracked changes (requires worktree)
53
+ * const commit = await git.commit()
54
+ * .setMessage("All changes")
55
+ * .setAll(true)
56
+ * .setWorktree(worktree)
57
+ * .call();
58
+ * ```
59
+ */
60
+ export declare class CommitCommand extends GitCommand<CommitResult> {
61
+ private message?;
62
+ private author?;
63
+ private committer?;
64
+ private amend;
65
+ private allowEmpty;
66
+ private parents;
67
+ private onlyPaths;
68
+ private all;
69
+ private worktreeIterator;
70
+ /**
71
+ * Set the commit message.
72
+ *
73
+ * @param message Commit message
74
+ */
75
+ setMessage(message: string): this;
76
+ /**
77
+ * Set the author identity.
78
+ *
79
+ * @param name Author name
80
+ * @param email Author email
81
+ */
82
+ setAuthor(name: string, email: string): this;
83
+ /**
84
+ * Set the author identity from a PersonIdent.
85
+ *
86
+ * @param author Author identity
87
+ */
88
+ setAuthorIdent(author: PersonIdent): this;
89
+ /**
90
+ * Set the committer identity.
91
+ *
92
+ * @param name Committer name
93
+ * @param email Committer email
94
+ */
95
+ setCommitter(name: string, email: string): this;
96
+ /**
97
+ * Set the committer identity from a PersonIdent.
98
+ *
99
+ * @param committer Committer identity
100
+ */
101
+ setCommitterIdent(committer: PersonIdent): this;
102
+ /**
103
+ * Set whether to amend the previous commit.
104
+ *
105
+ * @param amend Whether to amend
106
+ */
107
+ setAmend(amend: boolean): this;
108
+ /**
109
+ * Set whether to allow an empty commit.
110
+ *
111
+ * @param allowEmpty Whether to allow empty commits
112
+ */
113
+ setAllowEmpty(allowEmpty: boolean): this;
114
+ /**
115
+ * Set explicit parent commits.
116
+ *
117
+ * Normally parents are determined automatically, but this
118
+ * can be used for merge commits or special cases.
119
+ *
120
+ * @param parents Parent commit IDs
121
+ */
122
+ setParentIds(...parents: ObjectId[]): this;
123
+ /**
124
+ * Set paths to commit (--only mode).
125
+ *
126
+ * When set, only the specified paths are taken from the staging area.
127
+ * All other paths are taken from the parent commit's tree. This allows
128
+ * partial commits without affecting unstaged changes to other files.
129
+ *
130
+ * Cannot be combined with setAll().
131
+ *
132
+ * @param paths Paths to include in commit
133
+ * @throws Error if combined with --all mode
134
+ */
135
+ setOnly(...paths: string[]): this;
136
+ /**
137
+ * Set whether to auto-stage modified tracked files before committing.
138
+ *
139
+ * If true, stages all modified and deleted tracked files before
140
+ * creating the commit. Requires a working tree iterator.
141
+ *
142
+ * Cannot be combined with setOnly().
143
+ *
144
+ * Equivalent to `git commit -a` or `git commit --all`.
145
+ *
146
+ * @param all Whether to auto-stage tracked changes
147
+ * @returns this for chaining
148
+ * @throws Error if combined with --only paths
149
+ */
150
+ setAll(all: boolean): this;
151
+ /**
152
+ * Whether --all mode is enabled.
153
+ */
154
+ isAll(): boolean;
155
+ /**
156
+ * Set a custom working tree iterator.
157
+ *
158
+ * Required when using setAll(true) if the store doesn't have
159
+ * a built-in working tree.
160
+ *
161
+ * @param iterator Custom working tree iterator
162
+ * @returns this for chaining
163
+ */
164
+ setWorktree(iterator: Worktree): this;
165
+ /**
166
+ * Execute the commit.
167
+ *
168
+ * @returns The created commit with its ID
169
+ * @throws NoMessageError if message is not set and not amending
170
+ * @throws UnmergedPathsError if there are unresolved conflicts
171
+ * @throws EmptyCommitError if nothing to commit and allowEmpty is false
172
+ */
173
+ call(): Promise<CommitResult>;
174
+ /**
175
+ * Build tree for --only mode.
176
+ *
177
+ * Combines parent tree with specified paths from staging area.
178
+ *
179
+ * @param parentCommitId Parent commit ID
180
+ * @returns Tree ObjectId
181
+ */
182
+ private buildOnlyTree;
183
+ /**
184
+ * Recursively walk tree and add entries to builder, excluding specified paths.
185
+ */
186
+ private addTreeFiltered;
187
+ /**
188
+ * Stage all modified/deleted tracked files.
189
+ *
190
+ * Uses AddCommand with setUpdate(true) to stage changes,
191
+ * equivalent to `git add -u .` which JGit does for --all.
192
+ */
193
+ private stageTrackedChanges;
194
+ /**
195
+ * Get working tree iterator from store or explicitly set.
196
+ */
197
+ private getWorktreeIterator;
198
+ }
199
+ //# sourceMappingURL=commit-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-command.d.ts","sourceRoot":"","sources":["../../src/commands/commit-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAY9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC1C,yCAAyC;IACzC,EAAE,EAAE,QAAQ,CAAC;CACd;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,YAAY,CAAC;IACzD,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,gBAAgB,CAAuB;IAE/C;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAS3C;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAIxC;IAED;;;;;OAKG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAS9C;IAED;;;;OAIG;IACH,iBAAiB,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAI9C;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI7B;IAED;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAIvC;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAIzC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAQhC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQzB;IAED;;OAEG;IACH,KAAK,IAAI,OAAO,CAEf;IAED;;;;;;;;OAQG;IACH,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIpC;IAED;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,CAkIlC;IAED;;;;;;;OAOG;YACW,aAAa;IA0C3B;;OAEG;YACW,eAAe;IA8B7B;;;;;OAKG;YACW,mBAAmB;IAmBjC;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAQ5B"}
@@ -0,0 +1,175 @@
1
+ import type { ObjectId } from "@statewalker/vcs-core";
2
+ import { GitCommand } from "../git-command.js";
3
+ /**
4
+ * Result of describe operation.
5
+ */
6
+ export interface DescribeResult {
7
+ /** The description string (tag name or tag-depth-gSHA format) */
8
+ readonly description: string | undefined;
9
+ /** The tag that was found (if any) */
10
+ readonly tag?: string;
11
+ /** Distance from the tag (number of commits) */
12
+ readonly depth?: number;
13
+ /** Abbreviated commit hash */
14
+ readonly abbrevHash?: string;
15
+ }
16
+ /**
17
+ * Given a commit, show the most recent tag that is reachable from it.
18
+ *
19
+ * Equivalent to `git describe`.
20
+ *
21
+ * Based on JGit's DescribeCommand.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * // Describe HEAD
26
+ * const desc = await git.describe().call();
27
+ *
28
+ * // Describe a specific commit
29
+ * const desc = await git.describe()
30
+ * .setTarget(commitId)
31
+ * .call();
32
+ *
33
+ * // Use long format
34
+ * const desc = await git.describe()
35
+ * .setLong(true)
36
+ * .call();
37
+ *
38
+ * // Include lightweight tags
39
+ * const desc = await git.describe()
40
+ * .setTags(true)
41
+ * .call();
42
+ *
43
+ * // Always output something (fall back to commit hash)
44
+ * const desc = await git.describe()
45
+ * .setAlways(true)
46
+ * .call();
47
+ *
48
+ * // Match specific tag patterns
49
+ * const desc = await git.describe()
50
+ * .setMatch("v*")
51
+ * .call();
52
+ * ```
53
+ */
54
+ export declare class DescribeCommand extends GitCommand<DescribeResult> {
55
+ private target?;
56
+ private longFormat;
57
+ private useTags;
58
+ private useAll;
59
+ private always;
60
+ private abbrev;
61
+ private matchPatterns;
62
+ private excludePatterns;
63
+ private maxCandidates;
64
+ /**
65
+ * Set the commit to describe.
66
+ *
67
+ * @param target ObjectId of commit to describe
68
+ */
69
+ setTarget(target: ObjectId): this;
70
+ /**
71
+ * Set the commit to describe by reference.
72
+ *
73
+ * @param rev Reference string (branch, tag, commit ID)
74
+ */
75
+ setTargetRef(rev: string): Promise<this>;
76
+ /**
77
+ * Whether to always use long output format.
78
+ *
79
+ * When true, outputs tag-depth-gSHA even if commit matches a tag exactly.
80
+ *
81
+ * @param longFormat Whether to use long format (default: false)
82
+ */
83
+ setLong(longFormat: boolean): this;
84
+ /**
85
+ * Whether to use any tag (including lightweight tags).
86
+ *
87
+ * By default, only annotated tags are considered.
88
+ *
89
+ * @param tags Whether to include lightweight tags (default: false)
90
+ */
91
+ setTags(tags: boolean): this;
92
+ /**
93
+ * Whether to use any ref in refs/ namespace.
94
+ *
95
+ * Enables matching branches and remote-tracking branches.
96
+ *
97
+ * @param all Whether to use all refs (default: false)
98
+ */
99
+ setAll(all: boolean): this;
100
+ /**
101
+ * Always output something, even if no tag is found.
102
+ *
103
+ * Falls back to abbreviated commit hash.
104
+ *
105
+ * @param always Whether to always output (default: false)
106
+ */
107
+ setAlways(always: boolean): this;
108
+ /**
109
+ * Set the abbreviation length for commit hash.
110
+ *
111
+ * @param abbrev Abbreviation length (default: 7)
112
+ */
113
+ setAbbrev(abbrev: number): this;
114
+ /**
115
+ * Get the abbreviation length.
116
+ */
117
+ getAbbrev(): number;
118
+ /**
119
+ * Set glob patterns that tags must match.
120
+ *
121
+ * @param patterns Glob patterns (e.g., "v*", "release-*")
122
+ */
123
+ setMatch(...patterns: string[]): this;
124
+ /**
125
+ * Set glob patterns to exclude tags.
126
+ *
127
+ * @param patterns Glob patterns to exclude
128
+ */
129
+ setExclude(...patterns: string[]): this;
130
+ /**
131
+ * Set maximum number of tag candidates to consider.
132
+ *
133
+ * @param max Maximum candidates (default: 10)
134
+ */
135
+ setMaxCandidates(max: number): this;
136
+ /**
137
+ * Execute the describe command.
138
+ *
139
+ * @returns Description result with tag name, depth, and/or commit hash
140
+ */
141
+ call(): Promise<DescribeResult>;
142
+ /**
143
+ * Collect all tags/refs into a map by commit ID.
144
+ */
145
+ private collectTags;
146
+ /**
147
+ * Check if a ref name matches the patterns.
148
+ */
149
+ private matchesPatterns;
150
+ /**
151
+ * Simple glob matching (supports * and ?).
152
+ */
153
+ private globMatch;
154
+ /**
155
+ * Select the best tag from multiple candidates.
156
+ */
157
+ private selectBestTag;
158
+ /**
159
+ * Find tag candidates by walking ancestors.
160
+ */
161
+ private findCandidates;
162
+ /**
163
+ * Format a ref name to tag name.
164
+ */
165
+ private formatTagName;
166
+ /**
167
+ * Format long description: tag-depth-gSHA.
168
+ */
169
+ private formatLong;
170
+ /**
171
+ * Abbreviate a commit ID.
172
+ */
173
+ private abbreviate;
174
+ }
175
+ //# sourceMappingURL=describe-command.d.ts.map
@@ -0,0 +1 @@
1
+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