@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,205 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ import { type RemoteConfig } from "../remote-config/index.js";
3
+ export type { RemoteConfig };
4
+ /**
5
+ * Add a remote to the repository.
6
+ *
7
+ * Equivalent to `git remote add`.
8
+ *
9
+ * Based on JGit's RemoteAddCommand.
10
+ *
11
+ * The remote is written to the working copy configuration as a
12
+ * `[remote "<name>"]` section, so it survives the command that created it.
13
+ * A remote already known from `refs/remotes/<name>/*` counts as existing even
14
+ * without a config section.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * await git.remoteAdd()
19
+ * .setName("upstream")
20
+ * .setUri("https://github.com/user/repo")
21
+ * .call();
22
+ * ```
23
+ */
24
+ export declare class RemoteAddCommand extends GitCommand<RemoteConfig> {
25
+ private name?;
26
+ private uri?;
27
+ private fetchRefspec?;
28
+ /**
29
+ * Set the remote name.
30
+ *
31
+ * @param name Remote name
32
+ */
33
+ setName(name: string): this;
34
+ /**
35
+ * Get the remote name.
36
+ */
37
+ getName(): string | undefined;
38
+ /**
39
+ * Set the remote URI.
40
+ *
41
+ * @param uri Remote URL
42
+ */
43
+ setUri(uri: string): this;
44
+ /**
45
+ * Get the remote URI.
46
+ */
47
+ getUri(): string | undefined;
48
+ /**
49
+ * Set custom fetch refspec.
50
+ *
51
+ * If not set, defaults to +refs/heads/*:refs/remotes/{name}/*
52
+ *
53
+ * @param refspec Fetch refspec
54
+ */
55
+ setFetchRefspec(refspec: string): this;
56
+ /**
57
+ * Execute the remote add operation.
58
+ *
59
+ * @returns Remote configuration
60
+ * @throws Error if name or URI is not set
61
+ */
62
+ call(): Promise<RemoteConfig>;
63
+ /** Whether any `refs/remotes/<name>/*` ref exists. */
64
+ private hasTrackingRefs;
65
+ }
66
+ /**
67
+ * Remove a remote from the repository.
68
+ *
69
+ * Equivalent to `git remote remove`.
70
+ *
71
+ * Based on JGit's RemoteRemoveCommand.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * await git.remoteRemove()
76
+ * .setRemoteName("upstream")
77
+ * .call();
78
+ * ```
79
+ */
80
+ export declare class RemoteRemoveCommand extends GitCommand<RemoteConfig | undefined> {
81
+ private remoteName?;
82
+ /**
83
+ * Set the remote name to remove.
84
+ *
85
+ * @param name Remote name
86
+ */
87
+ setRemoteName(name: string): this;
88
+ /**
89
+ * Get the remote name.
90
+ */
91
+ getRemoteName(): string | undefined;
92
+ /**
93
+ * Execute the remote remove operation.
94
+ *
95
+ * Drops both halves of a remote: its config section and its tracking refs.
96
+ * A remote that has only one of the two is still removable.
97
+ *
98
+ * @returns Removed remote config, or undefined if not found
99
+ */
100
+ call(): Promise<RemoteConfig | undefined>;
101
+ }
102
+ /**
103
+ * List remotes in the repository.
104
+ *
105
+ * Equivalent to `git remote -v`.
106
+ *
107
+ * Based on JGit's RemoteListCommand.
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const remotes = await git.remoteList().call();
112
+ * for (const remote of remotes) {
113
+ * console.log(remote.name, remote.urls[0]);
114
+ * }
115
+ * ```
116
+ */
117
+ export declare class RemoteListCommand extends GitCommand<RemoteConfig[]> {
118
+ /**
119
+ * Execute the remote list operation.
120
+ *
121
+ * Lists the union of the configured remotes and the names appearing under
122
+ * `refs/remotes/`; a remote with no config section is reported with no URLs
123
+ * and the default fetch refspec.
124
+ *
125
+ * @returns List of remote configurations
126
+ */
127
+ call(): Promise<RemoteConfig[]>;
128
+ }
129
+ /**
130
+ * Set URL for a remote.
131
+ *
132
+ * Equivalent to `git remote set-url`.
133
+ *
134
+ * Based on JGit's RemoteSetUrlCommand.
135
+ *
136
+ * @example
137
+ * ```typescript
138
+ * await git.remoteSetUrl()
139
+ * .setRemoteName("origin")
140
+ * .setRemoteUri("https://github.com/user/repo")
141
+ * .call();
142
+ * ```
143
+ */
144
+ export declare class RemoteSetUrlCommand extends GitCommand<RemoteConfig> {
145
+ private remoteName?;
146
+ private remoteUri?;
147
+ private pushUri;
148
+ private oldUri?;
149
+ /**
150
+ * Set the remote name.
151
+ *
152
+ * @param name Remote name
153
+ */
154
+ setRemoteName(name: string): this;
155
+ /**
156
+ * Get the remote name.
157
+ */
158
+ getRemoteName(): string | undefined;
159
+ /**
160
+ * Set the new remote URI.
161
+ *
162
+ * @param uri New remote URL
163
+ */
164
+ setRemoteUri(uri: string): this;
165
+ /**
166
+ * Get the new remote URI.
167
+ */
168
+ getRemoteUri(): string | undefined;
169
+ /**
170
+ * Set whether this is a push URL.
171
+ *
172
+ * @param push Whether to set push URL
173
+ */
174
+ setPush(push: boolean): this;
175
+ /**
176
+ * Whether this is a push URL.
177
+ */
178
+ isPush(): boolean;
179
+ /**
180
+ * Set the URL to replace.
181
+ *
182
+ * Only this URL is replaced, leaving the remote's other URLs alone — the
183
+ * `<oldurl>` argument of `git remote set-url <name> <newurl> <oldurl>`.
184
+ * Without it, the new URL replaces all of them.
185
+ *
186
+ * @param uri Old URI to replace
187
+ */
188
+ setOldUri(uri: string): this;
189
+ /**
190
+ * Execute the remote set-url operation.
191
+ *
192
+ * The URL is written to the working copy configuration, so it survives the
193
+ * command. The remote may be known from its config section or from its
194
+ * tracking refs; in the latter case, this is what first gives it a URL.
195
+ *
196
+ * @returns Updated remote configuration
197
+ * @throws MissingArgumentError if remote name or URI is not set
198
+ * @throws RemoteNotFoundError if the remote is neither configured nor tracked
199
+ * @throws InvalidArgumentError if {@link setOldUri} names a URL the remote does not have
200
+ */
201
+ call(): Promise<RemoteConfig>;
202
+ /** Whether any `refs/remotes/<name>/*` ref exists. */
203
+ private hasTrackingRefs;
204
+ }
205
+ //# sourceMappingURL=remote-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-command.d.ts","sourceRoot":"","sources":["../../src/commands/remote-command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,YAAY,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAS;IACtB,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,YAAY,CAAC,CAAS;IAE9B;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;OAEG;IACH,OAAO,IAAI,MAAM,GAAG,SAAS,CAE5B;IAED;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIxB;IAED;;OAEG;IACH,MAAM,IAAI,MAAM,GAAG,SAAS,CAE3B;IAED;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrC;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,CA8BlC;IAED,sDAAsD;YACxC,eAAe;CAM9B;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,YAAY,GAAG,SAAS,CAAC;IAC3E,OAAO,CAAC,UAAU,CAAC,CAAS;IAE5B;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,SAAS,CAElC;IAED;;;;;;;OAOG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAiC9C;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,YAAY,EAAE,CAAC;IAC/D;;;;;;;;OAQG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAOpC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,SAAQ,UAAU,CAAC,YAAY,CAAC;IAC/D,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAC,CAAS;IAExB;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;OAEG;IACH,aAAa,IAAI,MAAM,GAAG,SAAS,CAElC;IAED;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI9B;IAED;;OAEG;IACH,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAI3B;IAED;;OAEG;IACH,MAAM,IAAI,OAAO,CAEhB;IAED;;;;;;;;OAQG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI3B;IAED;;;;;;;;;;;OAWG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,CAuBlC;IAED,sDAAsD;YACxC,eAAe;CAM9B"}
@@ -0,0 +1,114 @@
1
+ import type { Ref } from "@statewalker/vcs-core";
2
+ import { GitCommand } from "../git-command.js";
3
+ import { ResetMode } from "../types.js";
4
+ /**
5
+ * Reset HEAD to a specified state.
6
+ *
7
+ * Equivalent to `git reset`.
8
+ *
9
+ * Based on JGit's ResetCommand.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Soft reset - move HEAD only
14
+ * await git.reset()
15
+ * .setRef("HEAD~1")
16
+ * .setMode(ResetMode.SOFT)
17
+ * .call();
18
+ *
19
+ * // Mixed reset (default) - move HEAD and reset staging
20
+ * await git.reset()
21
+ * .setRef("abc123")
22
+ * .call();
23
+ *
24
+ * // Hard reset - move HEAD, reset staging, and reset working tree
25
+ * await git.reset()
26
+ * .setRef("HEAD~1")
27
+ * .setMode(ResetMode.HARD)
28
+ * .call();
29
+ *
30
+ * // Reset specific paths
31
+ * await git.reset()
32
+ * .addPath("src/file.ts")
33
+ * .call();
34
+ * ```
35
+ */
36
+ export declare class ResetCommand extends GitCommand<Ref> {
37
+ private ref?;
38
+ private mode;
39
+ private paths;
40
+ /**
41
+ * Set the ref to reset to.
42
+ *
43
+ * Can be a commit ID, branch name, tag name, or relative ref like HEAD~1.
44
+ * If not set, defaults to HEAD.
45
+ *
46
+ * @param ref Commit-ish to reset to
47
+ */
48
+ setRef(ref: string): this;
49
+ /**
50
+ * Set the reset mode.
51
+ *
52
+ * - SOFT: Move HEAD only
53
+ * - MIXED (default): Move HEAD and reset staging
54
+ * - HARD: Move HEAD, reset staging, and reset working tree. DESTRUCTIVE -
55
+ * uncommitted changes to tracked files are discarded and tracked files
56
+ * absent from the target commit are deleted from the working tree.
57
+ *
58
+ * @param mode Reset mode
59
+ */
60
+ setMode(mode: ResetMode): this;
61
+ /**
62
+ * Add a path to reset.
63
+ *
64
+ * When paths are specified, only those paths are reset in the staging area.
65
+ * The ref must be HEAD when using paths.
66
+ *
67
+ * @param path Repository-relative path
68
+ */
69
+ addPath(path: string): this;
70
+ /**
71
+ * Execute the reset.
72
+ *
73
+ * @returns The ref that HEAD now points to
74
+ * @throws RefNotFoundError if ref cannot be resolved
75
+ */
76
+ call(): Promise<Ref>;
77
+ /**
78
+ * Reset specific paths in staging area.
79
+ */
80
+ private resetPaths;
81
+ /**
82
+ * Move HEAD (and branch if applicable) to target commit.
83
+ */
84
+ private moveHead;
85
+ /**
86
+ * Collect every path currently tracked in the staging area.
87
+ */
88
+ private collectTrackedPaths;
89
+ /**
90
+ * Make the working tree match the target commit's tree (HARD reset).
91
+ *
92
+ * This is destructive: uncommitted modifications to tracked files are
93
+ * overwritten, and tracked files missing from the target tree are deleted.
94
+ * Untracked files are left alone - removing those is `git clean`.
95
+ *
96
+ * A repository without a worktree (bare) has no working tree to reset, so
97
+ * this is a no-op there. The restore is planned and validated in full before
98
+ * any file is touched, so a tree this command cannot restore faithfully
99
+ * (a symlink, a missing blob) fails with the working tree still intact.
100
+ *
101
+ * @param targetId Commit to reset the working tree to
102
+ * @param trackedBefore Paths tracked before staging was reset
103
+ */
104
+ private resetWorkingTree;
105
+ /**
106
+ * Reset staging area to match a tree.
107
+ */
108
+ private resetStaging;
109
+ /**
110
+ * Get tree entry for a path.
111
+ */
112
+ private getTreeEntryForPath;
113
+ }
114
+ //# sourceMappingURL=reset-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset-command.d.ts","sourceRoot":"","sources":["../../src/commands/reset-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAI3D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,YAAa,SAAQ,UAAU,CAAC,GAAG,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,IAAI,CAAmB;IAC/B,OAAO,CAAC,KAAK,CAAgB;IAE7B;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIxB;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,CAI7B;IAED;;;;;;;OAOG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAI1B;IAED;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAmCzB;IAED;;OAEG;YACW,UAAU;IA8CxB;;OAEG;YACW,QAAQ;IAYtB;;OAEG;YACW,mBAAmB;IAQjC;;;;;;;;;;;;;;OAcG;YACW,gBAAgB;IAyB9B;;OAEG;YACW,YAAY;IAQ1B;;OAEG;YACW,mBAAmB;CA0BlC"}
@@ -0,0 +1,129 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ import { type ContentMergeStrategy, MergeStrategy } from "../results/merge-result.js";
3
+ import { type RevertResult } from "../results/revert-result.js";
4
+ /**
5
+ * Revert commits on current branch.
6
+ *
7
+ * Equivalent to `git revert`.
8
+ *
9
+ * Based on JGit's RevertCommand.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Revert a single commit
14
+ * const result = await git.revert()
15
+ * .include(commitId)
16
+ * .call();
17
+ *
18
+ * // Revert without committing
19
+ * const result = await git.revert()
20
+ * .include(commitId)
21
+ * .setNoCommit(true)
22
+ * .call();
23
+ *
24
+ * // Revert a merge commit
25
+ * const result = await git.revert()
26
+ * .include(mergeCommitId)
27
+ * .setMainlineParentNumber(1)
28
+ * .call();
29
+ * ```
30
+ */
31
+ export declare class RevertCommand extends GitCommand<RevertResult> {
32
+ private includes;
33
+ private noCommit;
34
+ private mainlineParent?;
35
+ private strategy;
36
+ private contentStrategy?;
37
+ private ourCommitName?;
38
+ private reflogPrefix;
39
+ /**
40
+ * Add a commit to revert.
41
+ *
42
+ * @param refOrId Commit ID or reference to revert
43
+ */
44
+ include(refOrId: string): this;
45
+ /**
46
+ * Set whether to commit after revert.
47
+ *
48
+ * When true, changes are staged but not committed.
49
+ *
50
+ * @param noCommit Whether to skip committing (default: false)
51
+ */
52
+ setNoCommit(noCommit: boolean): this;
53
+ /**
54
+ * Set mainline parent number for reverting merge commits.
55
+ *
56
+ * For regular commits, this is not needed. For merge commits,
57
+ * this specifies which parent to diff against (1-indexed).
58
+ *
59
+ * @param parent Parent number (1 = first parent, 2 = second parent)
60
+ */
61
+ setMainlineParentNumber(parent: number): this;
62
+ /**
63
+ * Set the merge strategy.
64
+ *
65
+ * Default is "recursive".
66
+ *
67
+ * @param strategy Merge strategy to use
68
+ */
69
+ setStrategy(strategy: MergeStrategy): this;
70
+ /**
71
+ * Get the merge strategy.
72
+ */
73
+ getStrategy(): MergeStrategy;
74
+ /**
75
+ * Set the content merge strategy for handling conflicts.
76
+ *
77
+ * @param contentStrategy Content merge strategy
78
+ */
79
+ setContentMergeStrategy(contentStrategy: ContentMergeStrategy): this;
80
+ /**
81
+ * Get the content merge strategy.
82
+ */
83
+ getContentMergeStrategy(): ContentMergeStrategy | undefined;
84
+ /**
85
+ * Set the name to be used for "ours" in conflict markers.
86
+ *
87
+ * @param name Name for ours side (default: HEAD)
88
+ */
89
+ setOurCommitName(name: string): this;
90
+ /**
91
+ * Get the name used for "ours" in conflict markers.
92
+ */
93
+ getOurCommitName(): string | undefined;
94
+ /**
95
+ * Set the reflog prefix.
96
+ *
97
+ * @param prefix Reflog message prefix (default: "revert:")
98
+ */
99
+ setReflogPrefix(prefix: string): this;
100
+ /**
101
+ * Get the reflog prefix.
102
+ */
103
+ getReflogPrefix(): string;
104
+ call(): Promise<RevertResult>;
105
+ /**
106
+ * Revert a single commit.
107
+ */
108
+ private revertOne;
109
+ /**
110
+ * Collect all blob entries from a tree recursively.
111
+ */
112
+ private collectTreeEntries;
113
+ /**
114
+ * Perform three-way merge for revert.
115
+ *
116
+ * The revert merge is: apply changes from commit->parent onto head.
117
+ * This is the INVERSE of cherry-pick.
118
+ */
119
+ private threeWayMerge;
120
+ /**
121
+ * Merge a single entry in three-way merge.
122
+ */
123
+ private mergeEntry;
124
+ /**
125
+ * Write conflict entries to staging.
126
+ */
127
+ private writeConflictStaging;
128
+ }
129
+ //# sourceMappingURL=revert-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"revert-command.d.ts","sourceRoot":"","sources":["../../src/commands/revert-command.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,6BAA6B,CAAC;AAqC9E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,aAAc,SAAQ,UAAU,CAAC,YAAY,CAAC;IACzD,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,cAAc,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAuB;IAC/C,OAAO,CAAC,aAAa,CAAC,CAAS;IAC/B,OAAO,CAAC,YAAY,CAAa;IAEjC;;;;OAIG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI7B;IAED;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAInC;IAED;;;;;;;OAOG;IACH,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAI5C;IAED;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAIzC;IAED;;OAEG;IACH,WAAW,IAAI,aAAa,CAE3B;IAED;;;;OAIG;IACH,uBAAuB,CAAC,eAAe,EAAE,oBAAoB,GAAG,IAAI,CAInE;IAED;;OAEG;IACH,uBAAuB,IAAI,oBAAoB,GAAG,SAAS,CAE1D;IAED;;;;OAIG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAInC;IAED;;OAEG;IACH,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAErC;IAED;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAIpC;IAED;;OAEG;IACH,eAAe,IAAI,MAAM,CAExB;IAEK,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,CA8BlC;IAED;;OAEG;YACW,SAAS;IAgIvB;;OAEG;YACW,kBAAkB;IAoBhC;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IA0BrB;;OAEG;IACH,OAAO,CAAC,UAAU;IAqElB;;OAEG;YACW,oBAAoB;CA8DnC"}
@@ -0,0 +1,72 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ /**
3
+ * Result of RmCommand execution.
4
+ */
5
+ export interface RmResult {
6
+ /** Paths that were removed from the index */
7
+ removedPaths: string[];
8
+ }
9
+ /**
10
+ * Remove files from the index (and optionally from working tree).
11
+ *
12
+ * Equivalent to `git rm`.
13
+ *
14
+ * Based on JGit's RmCommand.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Remove file from index and working tree
19
+ * await git.rm()
20
+ * .addFilepattern("file.txt")
21
+ * .call();
22
+ *
23
+ * // Remove from index only (keep in working tree)
24
+ * await git.rm()
25
+ * .addFilepattern("file.txt")
26
+ * .setCached(true)
27
+ * .call();
28
+ *
29
+ * // Remove directory recursively
30
+ * await git.rm()
31
+ * .addFilepattern("src/old/")
32
+ * .call();
33
+ * ```
34
+ */
35
+ export declare class RmCommand extends GitCommand<RmResult> {
36
+ private filepatterns;
37
+ private cached;
38
+ /**
39
+ * Add a file pattern to remove.
40
+ *
41
+ * @param filepattern Path pattern to remove (with `/` as separator)
42
+ */
43
+ addFilepattern(filepattern: string): this;
44
+ /**
45
+ * Set whether to only remove from index (keep in working tree).
46
+ *
47
+ * When true, files are only removed from the staging area
48
+ * but remain in the working directory (like `git rm --cached`).
49
+ *
50
+ * @param cached true to only remove from index
51
+ */
52
+ setCached(cached: boolean): this;
53
+ /**
54
+ * Get whether cached mode is enabled.
55
+ */
56
+ getCached(): boolean;
57
+ /**
58
+ * Execute the rm command.
59
+ *
60
+ * @returns Result with list of removed paths
61
+ */
62
+ call(): Promise<RmResult>;
63
+ /**
64
+ * Check if a path matches any of the configured patterns.
65
+ */
66
+ private matchesPattern;
67
+ /**
68
+ * Convert a simple glob pattern to regex.
69
+ */
70
+ private patternToRegex;
71
+ }
72
+ //# sourceMappingURL=rm-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rm-command.d.ts","sourceRoot":"","sources":["../../src/commands/rm-command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,SAAU,SAAQ,UAAU,CAAC,QAAQ,CAAC;IACjD,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,MAAM,CAAS;IAEvB;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIxC;IAED;;;;;;;OAOG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAI/B;IAED;;OAEG;IACH,SAAS,IAAI,OAAO,CAEnB;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,CAmD9B;IAED;;OAEG;IACH,OAAO,CAAC,cAAc;IA+BtB;;OAEG;IACH,OAAO,CAAC,cAAc;CAOvB"}
@@ -0,0 +1,132 @@
1
+ import { GitCommand } from "../git-command.js";
2
+ import { type ContentMergeStrategy, MergeStrategy } from "../results/merge-result.js";
3
+ import type { StashApplyResult } from "../results/stash-result.js";
4
+ /**
5
+ * Command to apply a stashed commit.
6
+ *
7
+ * Equivalent to `git stash apply`.
8
+ *
9
+ * Based on JGit's StashApplyCommand.
10
+ *
11
+ * The stashed changes are three-way merged against the current HEAD and the
12
+ * result is written back: the merged working tree always, the merged index
13
+ * when `restoreIndex` is set, and the stashed untracked files when
14
+ * `restoreUntracked` is set. A conflict aborts before anything is written.
15
+ *
16
+ * Known limits, shared with `reset --hard`:
17
+ * - a symlink in the merged tree is refused, because the `Worktree` interface
18
+ * has no primitive to create one - writing the target as a regular file
19
+ * would silently produce a working tree that does not match;
20
+ * - a gitlink's contents are not restored, as in git;
21
+ * - directories left empty by a deletion are not pruned;
22
+ * - the restore is not atomic across the working tree and the index.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * // Apply most recent stash
27
+ * const result = await git.stashApply().call();
28
+ *
29
+ * // Apply specific stash
30
+ * const result = await git.stashApply()
31
+ * .setStashRef("stash@{2}")
32
+ * .call();
33
+ *
34
+ * // Apply without restoring index
35
+ * const result = await git.stashApply()
36
+ * .setRestoreIndex(false)
37
+ * .call();
38
+ * ```
39
+ */
40
+ export declare class StashApplyCommand extends GitCommand<StashApplyResult> {
41
+ private stashRef?;
42
+ private restoreIndex;
43
+ private restoreUntracked;
44
+ private strategy;
45
+ private contentStrategy?;
46
+ /**
47
+ * Set the stash reference to apply.
48
+ *
49
+ * Defaults to stash@{0} (most recent) if not specified.
50
+ *
51
+ * @param stashRef Name of the stash ref to apply
52
+ */
53
+ setStashRef(stashRef: string): this;
54
+ /**
55
+ * Get the stash reference.
56
+ */
57
+ getStashRef(): string | undefined;
58
+ /**
59
+ * Set whether to restore the index state.
60
+ *
61
+ * @param restoreIndex true to restore index (default)
62
+ */
63
+ setRestoreIndex(restoreIndex: boolean): this;
64
+ /**
65
+ * Get whether index will be restored.
66
+ */
67
+ getRestoreIndex(): boolean;
68
+ /**
69
+ * Set whether to restore untracked files.
70
+ *
71
+ * @param restoreUntracked true to restore untracked files (default)
72
+ */
73
+ setRestoreUntracked(restoreUntracked: boolean): this;
74
+ /**
75
+ * Get whether untracked files will be restored.
76
+ */
77
+ getRestoreUntracked(): boolean;
78
+ /**
79
+ * Set whether to ignore repository state when applying.
80
+ *
81
+ * Note: Currently not implemented - stash apply always ignores repo state.
82
+ *
83
+ * @param _ignore true to ignore state
84
+ */
85
+ setIgnoreRepositoryState(_ignore: boolean): this;
86
+ /**
87
+ * Set the merge strategy to use.
88
+ *
89
+ * @param strategy The merge strategy
90
+ */
91
+ setStrategy(strategy: MergeStrategy): this;
92
+ /**
93
+ * Get the merge strategy.
94
+ */
95
+ getStrategy(): MergeStrategy;
96
+ /**
97
+ * Set the content merge strategy for file-level conflicts.
98
+ *
99
+ * @param strategy The content merge strategy
100
+ */
101
+ setContentMergeStrategy(strategy: ContentMergeStrategy): this;
102
+ /**
103
+ * Get the content merge strategy.
104
+ */
105
+ getContentMergeStrategy(): ContentMergeStrategy | undefined;
106
+ /**
107
+ * Execute the stash apply command.
108
+ *
109
+ * @returns Result of the apply operation
110
+ */
111
+ call(): Promise<StashApplyResult>;
112
+ /**
113
+ * Plan the restore of the stash's untracked files, if there are any to restore.
114
+ *
115
+ * Untracked files are stashed in their own parentless commit and are not
116
+ * merged with anything: they are simply written back. A stashed untracked
117
+ * file whose path is already taken - by a file on disk, or by one the merged
118
+ * tree is about to write - is refused rather than overwritten, since nothing
119
+ * in the stash records what the displaced content was.
120
+ *
121
+ * @param untrackedCommitId The stash's third parent, if it has one
122
+ * @param worktreePlan The already-planned restore of the merged working tree
123
+ * @param worktree The working tree, checked for existing files
124
+ * @returns The plan, or undefined if there is nothing to restore
125
+ */
126
+ private planUntrackedRestore;
127
+ /**
128
+ * Resolve the stash reference to a commit ID.
129
+ */
130
+ private resolveStashRef;
131
+ }
132
+ //# sourceMappingURL=stash-apply-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stash-apply-command.d.ts","sourceRoot":"","sources":["../../src/commands/stash-apply-command.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AASnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,iBAAkB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,eAAe,CAAC,CAAuB;IAE/C;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAIlC;IAED;;OAEG;IACH,WAAW,IAAI,MAAM,GAAG,SAAS,CAEhC;IAED;;;;OAIG;IACH,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,IAAI,CAI3C;IAED;;OAEG;IACH,eAAe,IAAI,OAAO,CAEzB;IAED;;;;OAIG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAInD;IAED;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAE7B;IAED;;;;;;OAMG;IACH,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAI/C;IAED;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAIzC;IAED;;OAEG;IACH,WAAW,IAAI,aAAa,CAE3B;IAED;;;;OAIG;IACH,uBAAuB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAI5D;IAED;;OAEG;IACH,uBAAuB,IAAI,oBAAoB,GAAG,SAAS,CAE1D;IAED;;;;OAIG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAyItC;IAED;;;;;;;;;;;;;OAaG;YACW,oBAAoB;IA6BlC;;OAEG;YACW,eAAe;CA0C9B"}