@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,246 @@
1
+ import type { Commit, ObjectId } from "@statewalker/vcs-core";
2
+ import { GitCommand } from "../git-command.js";
3
+ /**
4
+ * Result of a log command iteration.
5
+ *
6
+ * Extends Commit with the object ID.
7
+ */
8
+ export interface LogResult extends Commit {
9
+ /** The SHA-1 object ID of the commit */
10
+ id: ObjectId;
11
+ }
12
+ /**
13
+ * Revision filter for LogCommand.
14
+ *
15
+ * Based on JGit's RevFilter.
16
+ */
17
+ export declare enum RevFilter {
18
+ /** Include all commits (default) */
19
+ ALL = "all",
20
+ /** Only include merge commits (commits with more than one parent) */
21
+ ONLY_MERGES = "only-merges",
22
+ /** Exclude merge commits */
23
+ NO_MERGES = "no-merges"
24
+ }
25
+ /**
26
+ * Show commit history.
27
+ *
28
+ * Equivalent to `git log`.
29
+ *
30
+ * Based on JGit's LogCommand.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Get all commits from HEAD
35
+ * for await (const commit of await git.log().call()) {
36
+ * console.log(commit.message);
37
+ * }
38
+ *
39
+ * // Get commits from a specific ref
40
+ * const commits = await git.log().add(commitId).call();
41
+ *
42
+ * // Limit number of commits
43
+ * const recent = await git.log().setMaxCount(10).call();
44
+ *
45
+ * // Skip first N commits
46
+ * const older = await git.log().setSkip(10).setMaxCount(10).call();
47
+ *
48
+ * // Filter by date range
49
+ * const thisWeek = await git.log()
50
+ * .setSince(Date.now() - 7 * 24 * 60 * 60 * 1000)
51
+ * .call();
52
+ *
53
+ * // Filter by author
54
+ * const myCommits = await git.log()
55
+ * .setAuthorFilter("john@example.com")
56
+ * .call();
57
+ *
58
+ * // Exclude commits
59
+ * const newCommits = await git.log()
60
+ * .not(oldBranchHead)
61
+ * .call();
62
+ *
63
+ * // Only merge commits
64
+ * const merges = await git.log()
65
+ * .setRevFilter(RevFilter.ONLY_MERGES)
66
+ * .call();
67
+ *
68
+ * // Exclude merge commits
69
+ * const nonMerges = await git.log()
70
+ * .setRevFilter(RevFilter.NO_MERGES)
71
+ * .call();
72
+ *
73
+ * // Range syntax (commits in feature not in main)
74
+ * const newInFeature = await git.log()
75
+ * .addRange(mainHead, featureHead)
76
+ * .call();
77
+ * ```
78
+ */
79
+ export declare class LogCommand extends GitCommand<AsyncIterable<LogResult>> {
80
+ private startCommits;
81
+ private excludeCommits;
82
+ private paths;
83
+ private excludePaths;
84
+ private maxCount?;
85
+ private skip;
86
+ private includeAll;
87
+ private firstParentOnly;
88
+ private sinceTime?;
89
+ private untilTime?;
90
+ private authorPattern?;
91
+ private committerPattern?;
92
+ private revFilter;
93
+ /**
94
+ * Add a starting commit for the log.
95
+ *
96
+ * Multiple start commits can be added - the log will include
97
+ * ancestors of all of them.
98
+ *
99
+ * @param commit ObjectId of commit to start from
100
+ */
101
+ add(commit: ObjectId): this;
102
+ /**
103
+ * Filter commits to only those affecting the given path.
104
+ *
105
+ * @param path Repository-relative path to filter by
106
+ */
107
+ addPath(path: string): this;
108
+ /**
109
+ * Exclude commits that only affect the given path.
110
+ *
111
+ * If a path is both added and excluded, the exclusion wins.
112
+ *
113
+ * @param path Repository-relative path to exclude
114
+ */
115
+ excludePath(path: string): this;
116
+ /**
117
+ * Limit the number of commits returned.
118
+ *
119
+ * @param maxCount Maximum number of commits to return
120
+ */
121
+ setMaxCount(maxCount: number): this;
122
+ /**
123
+ * Skip the first N commits.
124
+ *
125
+ * @param skip Number of commits to skip
126
+ */
127
+ setSkip(skip: number): this;
128
+ /**
129
+ * Include commits from all refs.
130
+ *
131
+ * When set, starts from all refs instead of just HEAD.
132
+ */
133
+ all(): this;
134
+ /**
135
+ * Follow only the first parent on merges.
136
+ *
137
+ * Useful for seeing the linear history of a branch.
138
+ */
139
+ setFirstParent(firstParent: boolean): this;
140
+ /**
141
+ * Exclude commits reachable from the given commit.
142
+ *
143
+ * Equivalent to `git log ^commit` or `A..B` syntax.
144
+ * Useful for finding commits in one branch but not another.
145
+ *
146
+ * @param commit ObjectId to exclude along with its ancestors
147
+ */
148
+ not(commit: ObjectId): this;
149
+ /**
150
+ * Set minimum commit time (--since/--after).
151
+ *
152
+ * Only include commits after this timestamp.
153
+ *
154
+ * @param timestamp Unix timestamp in milliseconds or seconds
155
+ */
156
+ setSince(timestamp: number): this;
157
+ /**
158
+ * Set maximum commit time (--until/--before).
159
+ *
160
+ * Only include commits before this timestamp.
161
+ *
162
+ * @param timestamp Unix timestamp in milliseconds or seconds
163
+ */
164
+ setUntil(timestamp: number): this;
165
+ /**
166
+ * Filter by author name or email (case-insensitive).
167
+ *
168
+ * Matches against "Author Name <email>" string.
169
+ *
170
+ * @param pattern Substring to match in author field
171
+ */
172
+ setAuthorFilter(pattern: string): this;
173
+ /**
174
+ * Filter by committer name or email (case-insensitive).
175
+ *
176
+ * Matches against "Committer Name <email>" string.
177
+ *
178
+ * @param pattern Substring to match in committer field
179
+ */
180
+ setCommitterFilter(pattern: string): this;
181
+ /**
182
+ * Set revision filter.
183
+ *
184
+ * - ALL: Include all commits (default)
185
+ * - ONLY_MERGES: Only include merge commits
186
+ * - NO_MERGES: Exclude merge commits
187
+ *
188
+ * @param filter Revision filter
189
+ */
190
+ setRevFilter(filter: RevFilter): this;
191
+ /**
192
+ * Add a commit range.
193
+ *
194
+ * Equivalent to `git log since..until` - includes commits reachable
195
+ * from `until` but not from `since`.
196
+ *
197
+ * @param since Commits reachable from here are excluded
198
+ * @param until Commits reachable from here are included (start point)
199
+ */
200
+ addRange(since: ObjectId, until: ObjectId): this;
201
+ /**
202
+ * Execute the log command.
203
+ *
204
+ * @returns AsyncIterable of commits in reverse chronological order
205
+ */
206
+ call(): Promise<AsyncIterable<LogResult>>;
207
+ /**
208
+ * Get all commit IDs from all refs.
209
+ */
210
+ private getAllRefs;
211
+ /**
212
+ * Walk commits and yield them.
213
+ */
214
+ private walkCommits;
215
+ /**
216
+ * Build set of commits to exclude.
217
+ */
218
+ private buildExcludedSet;
219
+ /**
220
+ * Check if commit author matches the filter pattern.
221
+ */
222
+ private matchesAuthor;
223
+ /**
224
+ * Check if commit committer matches the filter pattern.
225
+ */
226
+ private matchesCommitter;
227
+ /**
228
+ * Check if a commit affects any of the filtered paths.
229
+ */
230
+ private affectsPath;
231
+ /**
232
+ * Check if a commit only affects excluded paths.
233
+ *
234
+ * If the commit only changes files in excludePaths, it should be filtered out.
235
+ */
236
+ private onlyAffectsExcludedPaths;
237
+ /**
238
+ * Check if tree contains any of the filtered paths.
239
+ */
240
+ private treeHasPath;
241
+ /**
242
+ * Get tree entry for a path (supports nested paths).
243
+ */
244
+ private getTreeEntryForPath;
245
+ }
246
+ //# sourceMappingURL=log-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-command.d.ts","sourceRoot":"","sources":["../../src/commands/log-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,wCAAwC;IACxC,EAAE,EAAE,QAAQ,CAAC;CACd;AAED;;;;GAIG;AACH,oBAAY,SAAS;IACnB,oCAAoC;IACpC,GAAG,QAAQ;IAC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AAE,MAAM,GAAG,IAAI,CAKhC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAKhC;IAED;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrC;IAED;;;;;;OAMG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIxC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAIpC;IAED;;;;;;;;OAQG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAK/C;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAgB9C;IAED;;OAEG;YACW,UAAU;IAUxB;;OAEG;YACY,WAAW;IAgF1B;;OAEG;YACW,gBAAgB;IAc9B;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAMxB;;OAEG;YACW,WAAW;IA8BzB;;;;OAIG;YACW,wBAAwB;IAmCtC;;OAEG;YACW,WAAW;IAUzB;;OAEG;YACW,mBAAmB;CA2BlC"}
@@ -0,0 +1,122 @@
1
+ import type { ObjectId } from "@statewalker/vcs-core";
2
+ import { TransportCommand } from "../transport-command.js";
3
+ /**
4
+ * A remote ref entry.
5
+ *
6
+ * Based on JGit's Ref with additional remote context.
7
+ */
8
+ export interface RemoteRef {
9
+ /** Full ref name (e.g., "refs/heads/main") */
10
+ name: string;
11
+ /** Object ID the ref points to */
12
+ objectId: ObjectId;
13
+ /** Peeled object ID for tags (if applicable) */
14
+ peeledObjectId?: ObjectId;
15
+ /** Whether this is a symbolic ref */
16
+ symbolic?: boolean;
17
+ /** Target of symbolic ref */
18
+ target?: string;
19
+ }
20
+ /**
21
+ * Result of ls-remote operation.
22
+ */
23
+ export interface LsRemoteResult {
24
+ /** URI that was queried */
25
+ uri: string;
26
+ /** Remote refs */
27
+ refs: RemoteRef[];
28
+ /** Default branch (from HEAD symref) */
29
+ defaultBranch?: string;
30
+ }
31
+ /**
32
+ * List references in a remote repository.
33
+ *
34
+ * Equivalent to `git ls-remote`.
35
+ *
36
+ * Based on JGit's LsRemoteCommand.
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * // List all refs
41
+ * const result = await git.lsRemote()
42
+ * .setRemote("https://github.com/user/repo")
43
+ * .call();
44
+ *
45
+ * // List only heads
46
+ * const result = await git.lsRemote()
47
+ * .setRemote("origin")
48
+ * .setHeads(true)
49
+ * .call();
50
+ *
51
+ * // List only tags
52
+ * const result = await git.lsRemote()
53
+ * .setRemote("origin")
54
+ * .setTags(true)
55
+ * .call();
56
+ * ```
57
+ */
58
+ export declare class LsRemoteCommand extends TransportCommand<LsRemoteResult> {
59
+ private remote?;
60
+ private heads;
61
+ private tags;
62
+ private uploadPack?;
63
+ /**
64
+ * Set the remote to query.
65
+ *
66
+ * Can be either a remote name (e.g., "origin") or a URL.
67
+ *
68
+ * @param remote Remote name or URL
69
+ */
70
+ setRemote(remote: string): this;
71
+ /**
72
+ * Get the remote being queried.
73
+ */
74
+ getRemote(): string | undefined;
75
+ /**
76
+ * Set whether to show only refs under refs/heads.
77
+ *
78
+ * @param heads Whether to show only heads
79
+ */
80
+ setHeads(heads: boolean): this;
81
+ /**
82
+ * Whether to show only heads.
83
+ */
84
+ isHeads(): boolean;
85
+ /**
86
+ * Set whether to show only refs under refs/tags.
87
+ *
88
+ * @param tags Whether to show only tags
89
+ */
90
+ setTags(tags: boolean): this;
91
+ /**
92
+ * Whether to show only tags.
93
+ */
94
+ isTags(): boolean;
95
+ /**
96
+ * Set custom upload-pack path for the remote.
97
+ *
98
+ * @param uploadPack Path to git-upload-pack on remote
99
+ */
100
+ setUploadPack(uploadPack: string): this;
101
+ /**
102
+ * Execute the ls-remote operation.
103
+ *
104
+ * @returns Refs from the remote repository
105
+ * @throws InvalidRemoteError if remote is not specified or cannot be resolved
106
+ */
107
+ call(): Promise<LsRemoteResult>;
108
+ /**
109
+ * Call and return just the refs map.
110
+ *
111
+ * Convenience method for simple use cases.
112
+ */
113
+ callAsMap(): Promise<Map<string, ObjectId>>;
114
+ /**
115
+ * Resolve remote name to URL.
116
+ *
117
+ * A named remote resolves through `remote.<name>.url` in the working copy
118
+ * configuration; an unconfigured name is passed through unchanged.
119
+ */
120
+ private resolveRemoteUrl;
121
+ }
122
+ //# sourceMappingURL=ls-remote-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls-remote-command.d.ts","sourceRoot":"","sources":["../../src/commands/ls-remote-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,gDAAgD;IAChD,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,kBAAkB;IAClB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,eAAgB,SAAQ,gBAAgB,CAAC,cAAc,CAAC;IACnE,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,UAAU,CAAC,CAAS;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI9B;IAED;;OAEG;IACH,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9B;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAI7B;IAED;;OAEG;IACH,OAAO,IAAI,OAAO,CAEjB;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAI3B;IAED;;OAEG;IACH,MAAM,IAAI,OAAO,CAEhB;IAED;;;;OAIG;IACH,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAItC;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,CA8DpC;IAED;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAOhD;IAED;;;;;OAKG;YACW,gBAAgB;CAQ/B"}
@@ -0,0 +1,169 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ import { ContentMergeStrategy, FastForwardMode, type MergeResult, MergeStrategy } from "../results/merge-result.js";
3
+ /**
4
+ * Merge branches.
5
+ *
6
+ * Equivalent to `git merge`.
7
+ *
8
+ * Based on JGit's MergeCommand.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Fast-forward merge
13
+ * const result = await git.merge()
14
+ * .include("feature-branch")
15
+ * .call();
16
+ *
17
+ * // Force merge commit (no fast-forward)
18
+ * const result = await git.merge()
19
+ * .include("feature-branch")
20
+ * .setFastForwardMode(FastForwardMode.NO_FF)
21
+ * .call();
22
+ *
23
+ * // Fail if fast-forward not possible
24
+ * const result = await git.merge()
25
+ * .include("feature-branch")
26
+ * .setFastForwardMode(FastForwardMode.FF_ONLY)
27
+ * .call();
28
+ *
29
+ * // Use "ours" strategy (keep our tree, ignore theirs)
30
+ * const result = await git.merge()
31
+ * .include("feature-branch")
32
+ * .setStrategy(MergeStrategy.OURS)
33
+ * .call();
34
+ *
35
+ * // Use "theirs" strategy (replace our tree with theirs)
36
+ * const result = await git.merge()
37
+ * .include("feature-branch")
38
+ * .setStrategy(MergeStrategy.THEIRS)
39
+ * .call();
40
+ * ```
41
+ */
42
+ export declare class MergeCommand extends GitCommand<MergeResult> {
43
+ private includes;
44
+ private fastForwardMode;
45
+ private strategy;
46
+ private contentStrategy?;
47
+ private squash;
48
+ private commit;
49
+ private message?;
50
+ /**
51
+ * Add a commit/branch to merge.
52
+ *
53
+ * @param refOrId Commit ID, branch name, or tag name to merge
54
+ */
55
+ include(refOrId: string): this;
56
+ /**
57
+ * Set fast-forward mode.
58
+ *
59
+ * - FF (default): Fast-forward when possible
60
+ * - NO_FF: Always create merge commit
61
+ * - FF_ONLY: Abort if fast-forward not possible
62
+ *
63
+ * @param mode Fast-forward mode
64
+ */
65
+ setFastForwardMode(mode: FastForwardMode): this;
66
+ /**
67
+ * Set merge strategy.
68
+ *
69
+ * - RECURSIVE (default): Standard three-way merge
70
+ * - OURS: Keep our tree, ignore their changes (creates merge commit)
71
+ * - THEIRS: Replace our tree with theirs (creates merge commit)
72
+ * - RESOLVE: Simple resolve strategy
73
+ *
74
+ * @param strategy Merge strategy
75
+ */
76
+ setStrategy(strategy: MergeStrategy): this;
77
+ /**
78
+ * Set content merge strategy for handling file-level conflicts.
79
+ *
80
+ * - OURS: Take our version for conflicts
81
+ * - THEIRS: Take their version for conflicts
82
+ * - UNION: Concatenate both sides (ours first, then theirs)
83
+ *
84
+ * When set, conflicts are resolved automatically using this strategy
85
+ * instead of producing conflict markers.
86
+ *
87
+ * @param contentStrategy Content merge strategy
88
+ */
89
+ setContentMergeStrategy(contentStrategy: ContentMergeStrategy): this;
90
+ /**
91
+ * Set squash mode.
92
+ *
93
+ * When true, changes are staged but not committed, and HEAD is not updated.
94
+ *
95
+ * @param squash Whether to squash
96
+ */
97
+ setSquash(squash: boolean): this;
98
+ /**
99
+ * Set whether to commit after merge.
100
+ *
101
+ * @param commit Whether to commit (default: true)
102
+ */
103
+ setCommit(commit: boolean): this;
104
+ /**
105
+ * Set the merge commit message.
106
+ *
107
+ * @param message Commit message
108
+ */
109
+ setMessage(message: string): this;
110
+ /**
111
+ * Execute the merge.
112
+ *
113
+ * @returns MergeResult with status and details
114
+ */
115
+ call(): Promise<MergeResult>;
116
+ /**
117
+ * Perform a fast-forward merge.
118
+ */
119
+ private doFastForward;
120
+ /**
121
+ * Perform a three-way merge.
122
+ */
123
+ private doMerge;
124
+ /**
125
+ * Check if commitA is an ancestor of commitB.
126
+ */
127
+ private isAncestor;
128
+ /**
129
+ * Perform three-way tree merge.
130
+ *
131
+ * Returns merged entries and conflicts.
132
+ */
133
+ private mergeTreesThreeWay;
134
+ /**
135
+ * Try to perform content-level merge using the configured strategy.
136
+ *
137
+ * @returns Merged tree entry if successful, undefined if content merge not applicable
138
+ */
139
+ private tryContentMerge;
140
+ /**
141
+ * Collect all bytes from a blob into a single Uint8Array.
142
+ */
143
+ private collectBlobContent;
144
+ /**
145
+ * Convert ContentMergeStrategy to utils MergeContentStrategy.
146
+ */
147
+ private convertContentStrategy;
148
+ /**
149
+ * Collect all blob entries from a tree recursively.
150
+ */
151
+ private collectTreeEntries;
152
+ /**
153
+ * Merge a single entry using three-way merge logic.
154
+ */
155
+ private mergeEntry;
156
+ /**
157
+ * Check if two tree entries are the same.
158
+ */
159
+ private sameEntry;
160
+ /**
161
+ * Write conflict state to staging area.
162
+ */
163
+ private writeConflictStaging;
164
+ /**
165
+ * Write successfully merged entries to staging.
166
+ */
167
+ private writeMergedStaging;
168
+ }
169
+ //# sourceMappingURL=merge-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-command.d.ts","sourceRoot":"","sources":["../../src/commands/merge-command.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,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;IA8BlB;;OAEG;IACH,OAAO,CAAC,SAAS;IAMjB;;OAEG;YACW,oBAAoB;IAiDlC;;OAEG;YACW,kBAAkB;CAgBjC"}
@@ -0,0 +1,57 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ /**
3
+ * Result of packing refs
4
+ */
5
+ export interface PackRefsResult {
6
+ /** Number of refs packed */
7
+ refsPacked: number;
8
+ /** Whether operation succeeded */
9
+ success: boolean;
10
+ }
11
+ /**
12
+ * Pack loose references into packed-refs.
13
+ *
14
+ * Equivalent to `git pack-refs`.
15
+ *
16
+ * This command packs loose reference files (.git/refs/*) into the
17
+ * single .git/packed-refs file for efficiency.
18
+ *
19
+ * Based on JGit's PackRefsCommand.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Pack all refs
24
+ * const result = await git.packRefs()
25
+ * .setAll(true)
26
+ * .call();
27
+ *
28
+ * // Pack specific refs
29
+ * const result = await git.packRefs()
30
+ * .addRef("refs/heads/main")
31
+ * .addRef("refs/heads/feature")
32
+ * .call();
33
+ * ```
34
+ */
35
+ export declare class PackRefsCommand extends GitCommand<PackRefsResult> {
36
+ private all;
37
+ private refs;
38
+ /**
39
+ * Pack all loose refs.
40
+ *
41
+ * @param all Whether to pack all refs
42
+ */
43
+ setAll(all: boolean): this;
44
+ /**
45
+ * Add a specific ref to pack.
46
+ *
47
+ * @param refName The ref name to pack
48
+ */
49
+ addRef(refName: string): this;
50
+ /**
51
+ * Execute the pack-refs command.
52
+ *
53
+ * @returns PackRefsResult
54
+ */
55
+ call(): Promise<PackRefsResult>;
56
+ }
57
+ //# sourceMappingURL=pack-refs-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-refs-command.d.ts","sourceRoot":"","sources":["../../src/commands/pack-refs-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,eAAgB,SAAQ,UAAU,CAAC,cAAc,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,IAAI,CAAgB;IAE5B;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAIzB;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI5B;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,CAgCpC;CACF"}