@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,111 @@
1
+ import { type FastForwardMode, type MergeStrategy } from "../results/merge-result.js";
2
+ import type { PullResult } from "../results/pull-result.js";
3
+ import { TransportCommand } from "../transport-command.js";
4
+ import { type TagOption } from "./fetch-command.js";
5
+ /**
6
+ * Pull changes from a remote repository.
7
+ *
8
+ * Equivalent to `git pull` (fetch + merge).
9
+ *
10
+ * Based on JGit's PullCommand.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Pull from default remote/branch
15
+ * const result = await git.pull().call();
16
+ *
17
+ * // Pull from specific remote
18
+ * const result = await git.pull()
19
+ * .setRemote("upstream")
20
+ * .call();
21
+ *
22
+ * // Pull specific branch
23
+ * const result = await git.pull()
24
+ * .setRemoteBranchName("develop")
25
+ * .call();
26
+ *
27
+ * // Pull with rebase (not yet implemented)
28
+ * const result = await git.pull()
29
+ * .setRebase(true)
30
+ * .call();
31
+ * ```
32
+ */
33
+ export declare class PullCommand extends TransportCommand<PullResult> {
34
+ private remote;
35
+ private remoteBranchName?;
36
+ private rebase;
37
+ private strategy?;
38
+ private fastForwardMode?;
39
+ private tagOption?;
40
+ /**
41
+ * Set the remote to pull from.
42
+ *
43
+ * Default is "origin".
44
+ *
45
+ * @param remote Remote name
46
+ */
47
+ setRemote(remote: string): this;
48
+ /**
49
+ * Get the remote being pulled from.
50
+ */
51
+ getRemote(): string;
52
+ /**
53
+ * Set the remote branch to pull.
54
+ *
55
+ * If not set, uses the tracking branch for the current local branch.
56
+ *
57
+ * @param branch Remote branch name
58
+ */
59
+ setRemoteBranchName(branch: string): this;
60
+ /**
61
+ * Get the remote branch name.
62
+ */
63
+ getRemoteBranchName(): string | undefined;
64
+ /**
65
+ * Set whether to use rebase instead of merge.
66
+ *
67
+ * Note: Rebase is not yet implemented.
68
+ *
69
+ * @param rebase Whether to use rebase
70
+ */
71
+ setRebase(rebase: boolean): this;
72
+ /**
73
+ * Whether rebase mode is enabled.
74
+ */
75
+ isRebase(): boolean;
76
+ /**
77
+ * Set the merge strategy.
78
+ *
79
+ * @param strategy Merge strategy
80
+ */
81
+ setStrategy(strategy: MergeStrategy): this;
82
+ /**
83
+ * Set the fast-forward mode.
84
+ *
85
+ * @param mode Fast-forward mode
86
+ */
87
+ setFastForwardMode(mode: FastForwardMode): this;
88
+ /**
89
+ * Get the fast-forward mode.
90
+ */
91
+ getFastForwardMode(): FastForwardMode | undefined;
92
+ /**
93
+ * Set the specification of annotated tag behavior during fetch.
94
+ *
95
+ * @param tagOption Tag option
96
+ */
97
+ setTagOpt(tagOption: TagOption): this;
98
+ /**
99
+ * Get the tag option.
100
+ */
101
+ getTagOpt(): TagOption | undefined;
102
+ /**
103
+ * Execute the pull operation.
104
+ *
105
+ * @returns Pull result with fetch and merge results
106
+ * @throws NoHeadError if HEAD is not set
107
+ * @throws InvalidRemoteError if remote cannot be resolved
108
+ */
109
+ call(): Promise<PullResult>;
110
+ }
111
+ //# sourceMappingURL=pull-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pull-command.d.ts","sourceRoot":"","sources":["../../src/commands/pull-command.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,aAAa,EACnB,MAAM,4B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hC;CACF"}
@@ -0,0 +1,220 @@
1
+ import { type PushResult } from "../results/push-result.js";
2
+ import { TransportCommand } from "../transport-command.js";
3
+ /**
4
+ * Push objects and refs to a remote repository.
5
+ *
6
+ * Equivalent to `git push`.
7
+ *
8
+ * Based on JGit's PushCommand.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Push current branch to origin
13
+ * const result = await git.push().call();
14
+ *
15
+ * // Push to specific remote
16
+ * const result = await git.push()
17
+ * .setRemote("upstream")
18
+ * .call();
19
+ *
20
+ * // Push specific refs
21
+ * const result = await git.push()
22
+ * .add("refs/heads/feature:refs/heads/feature")
23
+ * .call();
24
+ *
25
+ * // Force push
26
+ * const result = await git.push()
27
+ * .setForce(true)
28
+ * .call();
29
+ *
30
+ * // Delete remote branch (empty source ref). The resulting RemoteRefUpdate has
31
+ * // `delete: true` and an all-zero `newObjectId`.
32
+ * const result = await git.push()
33
+ * .add(":refs/heads/old-branch")
34
+ * .call();
35
+ *
36
+ * // Atomic push (all-or-nothing)
37
+ * const result = await git.push()
38
+ * .setAtomic(true)
39
+ * .call();
40
+ * ```
41
+ */
42
+ export declare class PushCommand extends TransportCommand<PushResult> {
43
+ private remote;
44
+ private refSpecs;
45
+ private force;
46
+ private atomic;
47
+ private thin;
48
+ private dryRun;
49
+ private pushAll;
50
+ private pushTags;
51
+ private useBitmaps;
52
+ private pushOptions;
53
+ private receivePack?;
54
+ /**
55
+ * Set the remote to push to.
56
+ *
57
+ * Can be either a remote name (e.g., "origin") or a URL.
58
+ * Default is "origin".
59
+ *
60
+ * @param remote Remote name or URL
61
+ */
62
+ setRemote(remote: string): this;
63
+ /**
64
+ * Get the remote being pushed to.
65
+ */
66
+ getRemote(): string;
67
+ /**
68
+ * Add a refspec to push.
69
+ *
70
+ * @param refSpec Refspec string (e.g., "refs/heads/main:refs/heads/main")
71
+ */
72
+ add(refSpec: string): this;
73
+ /**
74
+ * Set refspecs to push.
75
+ *
76
+ * @param refSpecs Refspec strings
77
+ */
78
+ setRefSpecs(...refSpecs: string[]): this;
79
+ /**
80
+ * Set force push mode.
81
+ *
82
+ * When enabled, allows non-fast-forward updates.
83
+ *
84
+ * @param force Whether to force push
85
+ */
86
+ setForce(force: boolean): this;
87
+ /**
88
+ * Whether force push is enabled.
89
+ */
90
+ isForce(): boolean;
91
+ /**
92
+ * Set atomic push mode.
93
+ *
94
+ * When enabled, either all refs update or none do.
95
+ *
96
+ * @param atomic Whether to use atomic push
97
+ */
98
+ setAtomic(atomic: boolean): this;
99
+ /**
100
+ * Whether atomic push is enabled.
101
+ */
102
+ isAtomic(): boolean;
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 dry run mode.
115
+ *
116
+ * In dry run mode, refs are not actually updated on remote.
117
+ *
118
+ * @param dryRun Whether to do a dry run
119
+ */
120
+ setDryRun(dryRun: boolean): this;
121
+ /**
122
+ * Whether dry run mode is enabled.
123
+ */
124
+ isDryRun(): boolean;
125
+ /**
126
+ * Set whether to push all branches.
127
+ *
128
+ * @param pushAll Whether to push all branches
129
+ */
130
+ setPushAll(pushAll: boolean): this;
131
+ /**
132
+ * Set whether to push all tags.
133
+ *
134
+ * @param pushTags Whether to push all tags
135
+ */
136
+ setPushTags(pushTags: boolean): this;
137
+ /**
138
+ * Set whether to use bitmaps for push.
139
+ *
140
+ * Default is true.
141
+ *
142
+ * @param useBitmaps Whether to use bitmaps
143
+ */
144
+ setUseBitmaps(useBitmaps: boolean): this;
145
+ /**
146
+ * Whether bitmaps are used for push.
147
+ */
148
+ isUseBitmaps(): boolean;
149
+ /**
150
+ * Set push options associated with the push operation.
151
+ *
152
+ * Push options are strings passed to the receive-pack on the server
153
+ * side, where they can be used by hooks.
154
+ *
155
+ * @param options Push option strings
156
+ */
157
+ setPushOptions(options: string[]): this;
158
+ /**
159
+ * Get push options.
160
+ */
161
+ getPushOptions(): string[];
162
+ /**
163
+ * Set the remote executable providing receive-pack service.
164
+ *
165
+ * @param receivePack Name of the remote executable
166
+ */
167
+ setReceivePack(receivePack: string): this;
168
+ /**
169
+ * Get the receive-pack executable name.
170
+ */
171
+ getReceivePack(): string | undefined;
172
+ /**
173
+ * Execute the push operation.
174
+ *
175
+ * @returns Push result with updated refs
176
+ * @throws InvalidRemoteError if remote cannot be resolved
177
+ * @throws PushRejectedException if push is rejected
178
+ */
179
+ call(): Promise<PushResult>;
180
+ /**
181
+ * Push and throw on failure.
182
+ */
183
+ callOrThrow(): Promise<PushResult>;
184
+ /**
185
+ * Resolve remote name to URL.
186
+ *
187
+ * A named remote resolves through the working copy configuration, preferring
188
+ * `remote.<name>.pushurl` over `remote.<name>.url` as git does; an
189
+ * unconfigured name is passed through unchanged.
190
+ */
191
+ private resolveRemoteUrl;
192
+ /**
193
+ * Build refspecs for the push.
194
+ */
195
+ private buildRefSpecs;
196
+ /**
197
+ * Get objects to push.
198
+ *
199
+ * Returns objects reachable from newIds but not from oldIds.
200
+ */
201
+ private getObjectsToPush;
202
+ /**
203
+ * Collect all commits reachable from a given commit.
204
+ */
205
+ private collectReachableCommits;
206
+ /**
207
+ * Yield tree and blob objects recursively.
208
+ */
209
+ private yieldTreeObjects;
210
+ /**
211
+ * Load an object for pushing.
212
+ *
213
+ * Serializes objects to raw Git format based on type:
214
+ * - type 1 (commit): serialize via serializeCommit()
215
+ * - type 2 (tree): serialize via serializeTree()
216
+ * - type 3 (blob): load raw content from blob store
217
+ */
218
+ private loadObjectForPush;
219
+ }
220
+ //# sourceMappingURL=push-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-command.d.ts","sourceRoot":"","sources":["../../src/commands/push-command.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,UAAU,EAAoC,MAAM,2BAA2B,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;A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AAI,CAIjC;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAInC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAIvC;IAED;;OAEG;IACH,YAAY,IAAI,OAAO,CAEtB;IAED;;;;;;;OAOG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAItC;IAED;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE,CAEzB;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIxC;IAED;;OAEG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAgHhC;IAED;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,UAAU,CAAC,CAiBvC;IAED;;;;;;OAMG;YACW,gBAAgB;IAS9B;;OAEG;YACW,aAAa;IAwC3B;;;;OAIG;YACY,gBAAgB;IA4C/B;;OAEG;YACW,uBAAuB;IA0BrC;;OAEG;YACY,gBAAgB;IA6B/B;;;;;;;OAOG;YACW,iBAAiB;CAyChC"}
@@ -0,0 +1,186 @@
1
+ import type { ObjectId } from "@statewalker/vcs-core";
2
+ import { GitCommand } from "../git-command.js";
3
+ import { type ContentMergeStrategy, MergeStrategy } from "../results/merge-result.js";
4
+ import type { RebaseResult, RebaseTodoLine } from "../results/rebase-result.js";
5
+ /**
6
+ * The available rebase operations.
7
+ *
8
+ * Based on JGit's RebaseCommand.Operation.
9
+ */
10
+ export declare enum RebaseOperation {
11
+ /** Initiates rebase */
12
+ BEGIN = "begin",
13
+ /** Continues after conflict resolution */
14
+ CONTINUE = "continue",
15
+ /** Skips the current commit */
16
+ SKIP = "skip",
17
+ /** Aborts and resets the current rebase */
18
+ ABORT = "abort",
19
+ /** Process steps (internal) */
20
+ PROCESS_STEPS = "process-steps"
21
+ }
22
+ /**
23
+ * Interactive rebase handler interface.
24
+ *
25
+ * Based on JGit's RebaseCommand.InteractiveHandler.
26
+ */
27
+ export interface InteractiveHandler {
28
+ /**
29
+ * Prepare the list of steps before rebase starts.
30
+ * Can reorder, remove, or change actions.
31
+ */
32
+ prepareSteps(steps: RebaseTodoLine[]): void;
33
+ /**
34
+ * Modify commit message during reword/squash.
35
+ */
36
+ modifyCommitMessage(message: string): string;
37
+ }
38
+ /**
39
+ * Rebase command for replaying commits on top of another branch.
40
+ *
41
+ * Equivalent to `git rebase`.
42
+ *
43
+ * Based on JGit's RebaseCommand.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // Basic rebase onto main
48
+ * const result = await git.rebase()
49
+ * .setUpstream("main")
50
+ * .call();
51
+ *
52
+ * // Abort ongoing rebase
53
+ * const result = await git.rebase()
54
+ * .setOperation(RebaseOperation.ABORT)
55
+ * .call();
56
+ *
57
+ * // Rebase with merge strategy
58
+ * const result = await git.rebase()
59
+ * .setUpstream("main")
60
+ * .setStrategy(MergeStrategy.OURS)
61
+ * .call();
62
+ * ```
63
+ */
64
+ export declare class RebaseCommand extends GitCommand<RebaseResult> {
65
+ private operation;
66
+ private upstreamCommit?;
67
+ private upstreamCommitName?;
68
+ private strategy;
69
+ private contentStrategy?;
70
+ private preserveMerges;
71
+ private interactiveHandler?;
72
+ private static rebaseStates;
73
+ /**
74
+ * Set the upstream branch or commit to rebase onto.
75
+ *
76
+ * @param upstream The upstream commit ID
77
+ */
78
+ setUpstream(upstream: ObjectId): this;
79
+ /**
80
+ * Set the upstream branch name to rebase onto.
81
+ *
82
+ * @param upstream The upstream branch name
83
+ */
84
+ setUpstreamBranch(upstream: string): Promise<this>;
85
+ /**
86
+ * Override the upstream name for conflict messages.
87
+ *
88
+ * @param name The name to use for upstream in messages
89
+ */
90
+ setUpstreamName(name: string): this;
91
+ /**
92
+ * Set the operation to perform.
93
+ *
94
+ * @param operation BEGIN, CONTINUE, SKIP, or ABORT
95
+ */
96
+ setOperation(operation: RebaseOperation): this;
97
+ /**
98
+ * Get the current operation.
99
+ */
100
+ getOperation(): RebaseOperation;
101
+ /**
102
+ * Set the merge strategy to use.
103
+ *
104
+ * @param strategy The merge strategy
105
+ */
106
+ setStrategy(strategy: MergeStrategy): this;
107
+ /**
108
+ * Get the merge strategy.
109
+ */
110
+ getStrategy(): MergeStrategy;
111
+ /**
112
+ * Set the content merge strategy for file-level conflicts.
113
+ *
114
+ * @param strategy The content merge strategy
115
+ */
116
+ setContentMergeStrategy(strategy: ContentMergeStrategy): this;
117
+ /**
118
+ * Get the content merge strategy.
119
+ */
120
+ getContentMergeStrategy(): ContentMergeStrategy | undefined;
121
+ /**
122
+ * Set whether to preserve merges during rebase.
123
+ *
124
+ * @param preserve true to re-create merges
125
+ */
126
+ setPreserveMerges(preserve: boolean): this;
127
+ /**
128
+ * Get whether merges are preserved.
129
+ */
130
+ getPreserveMerges(): boolean;
131
+ /**
132
+ * Enable interactive rebase with the given handler.
133
+ *
134
+ * @param handler The interactive handler
135
+ */
136
+ runInteractively(handler: InteractiveHandler): this;
137
+ /**
138
+ * Execute the rebase command.
139
+ */
140
+ call(): Promise<RebaseResult>;
141
+ /**
142
+ * Begin the rebase operation.
143
+ */
144
+ private begin;
145
+ /**
146
+ * Process the rebase steps (cherry-pick each commit).
147
+ */
148
+ private processSteps;
149
+ /**
150
+ * Cherry-pick a single commit.
151
+ */
152
+ private cherryPickCommit;
153
+ /**
154
+ * Create a new commit preserving the original author info.
155
+ */
156
+ private createRebasedCommit;
157
+ /**
158
+ * Get default committer identity.
159
+ */
160
+ private getCommitter;
161
+ /**
162
+ * Abort the rebase and restore original HEAD.
163
+ */
164
+ private abort;
165
+ /**
166
+ * Continue rebase after conflict resolution.
167
+ */
168
+ private continueRebase;
169
+ /**
170
+ * Skip current commit and continue.
171
+ */
172
+ private skip;
173
+ /**
174
+ * Calculate which commits need to be rebased.
175
+ */
176
+ private calculateCommitsToRebase;
177
+ /**
178
+ * Check if commit A is an ancestor of commit B.
179
+ */
180
+ private isAncestor;
181
+ /**
182
+ * Update HEAD and optionally the branch it points to.
183
+ */
184
+ private updateHead;
185
+ }
186
+ //# sourceMappingURL=rebase-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rebase-command.d.ts","sourceRoot":"","sources":["../../src/commands/rebase-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,uBAAuB,CAAC;AASnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAkBhF;;;;GAIG;AACH,oBAAY,eAAe;IACzB,uBAAuB;IACvB,KAAK,UAAU;IAEf,0CAA0C;IAC1C,QAAQ,aAAa;IAErB,+BAA+B;IAC/B,IAAI,SAAS;IAEb,2CAA2C;IAC3C,KAAK,UAAU;IAEf,+BAA+B;IAC/B,aAAa,kBAAkB;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAE5C;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9C;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,YAAY,CAAC;IACzD,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAC,CAAW;IAClC,OAAO,CAAC,kBAAkB,CAAC,CAAS;IACpC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,eAAe,CAAC,CAAuB;IAC/C,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,kBAAkB,CAAC,CAAqB;IAGhD,OAAO,C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import { GitCommand } from "../git-command.js";
3
+ /**
4
+ * Read reflog entries for a ref.
5
+ *
6
+ * Equivalent to `git reflog`.
7
+ *
8
+ * The reflog records when the tip of branches and other references
9
+ * were updated in the local repository.
10
+ *
11
+ * Based on JGit's ReflogCommand.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * // Get HEAD reflog entries
16
+ * const entries = await git.reflog().call();
17
+ *
18
+ * // Get reflog for specific branch
19
+ * const branchEntries = await git.reflog()
20
+ * .setRef("refs/heads/main")
21
+ * .call();
22
+ *
23
+ * // Iterate through entries
24
+ * for (const entry of entries) {
25
+ * console.log(`${entry.newId.slice(0, 7)} ${entry.comment}`);
26
+ * }
27
+ * ```
28
+ */
29
+ export declare class ReflogCommand extends GitCommand<ReflogEntry[]> {
30
+ private ref;
31
+ /**
32
+ * Set the ref to show reflog for.
33
+ *
34
+ * @param ref Ref name (default: "HEAD")
35
+ */
36
+ setRef(ref: string): this;
37
+ /**
38
+ * Execute the reflog command.
39
+ *
40
+ * @returns Array of reflog entries in reverse chronological order (most recent first)
41
+ * @throws Error if reflog doesn't exist for the ref
42
+ */
43
+ call(): Promise<ReflogEntry[]>;
44
+ }
45
+ //# sourceMappingURL=reflog-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reflog-command.d.ts","sourceRoot":"","sources":["../../src/commands/reflog-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,WAAW,EAAE,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAU;IAErB;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIxB;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAgBnC;CACF"}