@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,48 @@
1
+ import type { ObjectId } from "@statewalker/vcs-core";
2
+ /**
3
+ * Represents a stashed commit entry.
4
+ *
5
+ * Based on JGit's stash structure where each stash is a merge commit with:
6
+ * - Parent 0: The HEAD commit at stash time
7
+ * - Parent 1: The index state
8
+ * - Parent 2 (optional): Untracked files
9
+ */
10
+ export interface StashEntry {
11
+ /** The stash commit ID */
12
+ readonly commitId: ObjectId;
13
+ /** The original HEAD commit at stash time */
14
+ readonly headCommit: ObjectId;
15
+ /** The index commit (staged changes) */
16
+ readonly indexCommit: ObjectId;
17
+ /** The untracked files commit (optional) */
18
+ readonly untrackedCommit?: ObjectId;
19
+ /** The stash message */
20
+ readonly message: string;
21
+ /** The stash index (0-based, most recent first) */
22
+ readonly index: number;
23
+ /** Timestamp when stash was created */
24
+ readonly timestamp: number;
25
+ }
26
+ /**
27
+ * Status of stash apply operation.
28
+ */
29
+ export declare enum StashApplyStatus {
30
+ /** Stash was applied successfully */
31
+ OK = "ok",
32
+ /** Stash apply resulted in conflicts */
33
+ CONFLICTS = "conflicts",
34
+ /** Stash apply failed */
35
+ FAILED = "failed"
36
+ }
37
+ /**
38
+ * Result of stash apply operation.
39
+ */
40
+ export interface StashApplyResult {
41
+ /** Status of the apply */
42
+ readonly status: StashApplyStatus;
43
+ /** The stash commit that was applied */
44
+ readonly stashCommit?: ObjectId;
45
+ /** List of conflicting paths */
46
+ readonly conflicts?: string[];
47
+ }
48
+ //# sourceMappingURL=stash-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stash-result.d.ts","sourceRoot":"","sources":["../../src/results/stash-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,0BAA0B;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAE5B,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;IAE9B,wCAAwC;IACxC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC;IAE/B,4CAA4C;IAC5C,QAAQ,CAAC,eAAe,CAAC,EAAE,QAAQ,CAAC;IAEpC,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,qCAAqC;IACrC,EAAE,OAAO;IAET,wCAAwC;IACxC,SAAS,cAAc;IAEvB,yBAAyB;IACzB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0BAA0B;IAC1B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAElC,wCAAwC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;IAEhC,gCAAgC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Status of the staging area compared to HEAD.
3
+ *
4
+ * This is a simplified version for repositories without working trees,
5
+ * focusing on staged changes and conflicts.
6
+ *
7
+ * Based on JGit's Status but without working tree operations.
8
+ */
9
+ export interface Status {
10
+ /**
11
+ * Files added to staging (not in HEAD).
12
+ */
13
+ readonly added: Set<string>;
14
+ /**
15
+ * Files modified in staging (different from HEAD).
16
+ */
17
+ readonly changed: Set<string>;
18
+ /**
19
+ * Files removed from staging (in HEAD but not in staging).
20
+ */
21
+ readonly removed: Set<string>;
22
+ /**
23
+ * Files with merge conflicts.
24
+ */
25
+ readonly conflicting: Set<string>;
26
+ /**
27
+ * Check if the staging area is clean (no changes, no conflicts).
28
+ */
29
+ isClean(): boolean;
30
+ /**
31
+ * Check if there are uncommitted changes.
32
+ * True if any files are added, changed, removed, or conflicting.
33
+ */
34
+ hasUncommittedChanges(): boolean;
35
+ }
36
+ /**
37
+ * Implementation of Status interface.
38
+ */
39
+ export declare class StatusImpl implements Status {
40
+ readonly added: Set<string>;
41
+ readonly changed: Set<string>;
42
+ readonly removed: Set<string>;
43
+ readonly conflicting: Set<string>;
44
+ constructor(added: Set<string>, changed: Set<string>, removed: Set<string>, conflicting: Set<string>);
45
+ isClean(): boolean;
46
+ hasUncommittedChanges(): boolean;
47
+ }
48
+ //# sourceMappingURL=status-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-result.d.ts","sourceRoot":"","sources":["../../src/results/status-result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC;IAEnB;;;OAGG;IACH,qBAAqB,IAAI,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;aAErB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;aAClB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC;aACpB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC;aACpB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC;IAJ1C,YACkB,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,EAClB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,EACtC;IAEJ,OAAO,IAAI,OAAO,CAOjB;IAED,qBAAqB,IAAI,OAAO,CAE/B;CACF"}
@@ -0,0 +1,409 @@
1
+ //#region src/results/cherry-pick-result.ts
2
+ /**
3
+ * Status of a cherry-pick operation.
4
+ *
5
+ * Based on JGit's CherryPickResult.CherryPickStatus.
6
+ */
7
+ let CherryPickStatus = /* @__PURE__ */ function(CherryPickStatus) {
8
+ /** Cherry-pick completed successfully */
9
+ CherryPickStatus["OK"] = "ok";
10
+ /** Cherry-pick failed due to conflicts */
11
+ CherryPickStatus["CONFLICTING"] = "conflicting";
12
+ /** Cherry-pick failed (preconditions not met) */
13
+ CherryPickStatus["FAILED"] = "failed";
14
+ return CherryPickStatus;
15
+ }({});
16
+ //#endregion
17
+ //#region src/results/merge-result.ts
18
+ /**
19
+ * Status of a merge operation.
20
+ *
21
+ * Based on JGit's MergeResult.MergeStatus.
22
+ */
23
+ let MergeStatus = /* @__PURE__ */ function(MergeStatus) {
24
+ /** Merge is a fast-forward (only HEAD moved) */
25
+ MergeStatus["FAST_FORWARD"] = "fast-forward";
26
+ /** Fast-forward merge with squash (HEAD not moved, changes staged) */
27
+ MergeStatus["FAST_FORWARD_SQUASHED"] = "fast-forward-squashed";
28
+ /** Merge was a no-op - already up to date */
29
+ MergeStatus["ALREADY_UP_TO_DATE"] = "already-up-to-date";
30
+ /** Merge completed successfully (merge commit created) */
31
+ MergeStatus["MERGED"] = "merged";
32
+ /** Merge completed but not committed (--no-commit) */
33
+ MergeStatus["MERGED_NOT_COMMITTED"] = "merged-not-committed";
34
+ /** Merge was squashed (not committed, HEAD not updated) */
35
+ MergeStatus["MERGED_SQUASHED"] = "merged-squashed";
36
+ /** Merge has conflicts that need to be resolved */
37
+ MergeStatus["CONFLICTING"] = "conflicting";
38
+ /** Merge failed (preconditions not met) */
39
+ MergeStatus["FAILED"] = "failed";
40
+ /** Merge aborted (e.g., FF_ONLY when not possible) */
41
+ MergeStatus["ABORTED"] = "aborted";
42
+ return MergeStatus;
43
+ }({});
44
+ /**
45
+ * Fast-forward merge mode.
46
+ *
47
+ * Based on JGit's MergeCommand.FastForwardMode.
48
+ */
49
+ let FastForwardMode = /* @__PURE__ */ function(FastForwardMode) {
50
+ /** Allow fast-forward when possible (default) */
51
+ FastForwardMode["FF"] = "ff";
52
+ /** Never fast-forward, always create merge commit */
53
+ FastForwardMode["NO_FF"] = "no-ff";
54
+ /** Only allow fast-forward, abort if not possible */
55
+ FastForwardMode["FF_ONLY"] = "ff-only";
56
+ return FastForwardMode;
57
+ }({});
58
+ /**
59
+ * Content merge strategy.
60
+ *
61
+ * Determines how to handle file-level conflicts.
62
+ * Based on JGit's ContentMergeStrategy.
63
+ */
64
+ let ContentMergeStrategy = /* @__PURE__ */ function(ContentMergeStrategy) {
65
+ /** Take our version for conflicts */
66
+ ContentMergeStrategy["OURS"] = "ours";
67
+ /** Take their version for conflicts */
68
+ ContentMergeStrategy["THEIRS"] = "theirs";
69
+ /** Perform union merge (both sides) */
70
+ ContentMergeStrategy["UNION"] = "union";
71
+ return ContentMergeStrategy;
72
+ }({});
73
+ /**
74
+ * Merge strategy.
75
+ *
76
+ * Based on JGit's MergeStrategy.
77
+ */
78
+ let MergeStrategy = /* @__PURE__ */ function(MergeStrategy) {
79
+ /**
80
+ * Recursive three-way merge (default).
81
+ *
82
+ * Standard merge algorithm that finds common ancestor and
83
+ * performs three-way merge on each file.
84
+ */
85
+ MergeStrategy["RECURSIVE"] = "recursive";
86
+ /**
87
+ * Always take our side.
88
+ *
89
+ * Creates a merge commit but keeps our tree unchanged.
90
+ * The other branch's changes are completely ignored.
91
+ * Use case: record that merge happened without accepting changes.
92
+ */
93
+ MergeStrategy["OURS"] = "ours";
94
+ /**
95
+ * Always take their side.
96
+ *
97
+ * Creates a merge commit but replaces our tree with theirs.
98
+ * Our changes are completely discarded.
99
+ * Use case: replace our branch with theirs while preserving history.
100
+ */
101
+ MergeStrategy["THEIRS"] = "theirs";
102
+ /**
103
+ * Simple resolve strategy.
104
+ *
105
+ * Similar to recursive but doesn't handle criss-cross merges.
106
+ * Uses a single merge base.
107
+ */
108
+ MergeStrategy["RESOLVE"] = "resolve";
109
+ return MergeStrategy;
110
+ }({});
111
+ /**
112
+ * Check if merge status represents a successful merge.
113
+ */
114
+ function isMergeSuccessful(status) {
115
+ return status === "fast-forward" || status === "fast-forward-squashed" || status === "already-up-to-date" || status === "merged" || status === "merged-not-committed" || status === "merged-squashed";
116
+ }
117
+ //#endregion
118
+ //#region src/results/fetch-result.ts
119
+ /**
120
+ * Status of a ref update.
121
+ *
122
+ * Based on JGit's RefUpdate.Result.
123
+ */
124
+ let RefUpdateStatus = /* @__PURE__ */ function(RefUpdateStatus) {
125
+ /** Update was performed successfully */
126
+ RefUpdateStatus["NEW"] = "new";
127
+ /** Update was a fast-forward */
128
+ RefUpdateStatus["FAST_FORWARD"] = "fast-forward";
129
+ /** Update was forced (non-fast-forward) */
130
+ RefUpdateStatus["FORCED"] = "forced";
131
+ /** No update needed (already up to date) */
132
+ RefUpdateStatus["NO_CHANGE"] = "no-change";
133
+ /** Update rejected (non-fast-forward without force) */
134
+ RefUpdateStatus["REJECTED"] = "rejected";
135
+ /** Update rejected (ref is locked) */
136
+ RefUpdateStatus["LOCK_FAILURE"] = "lock-failure";
137
+ /** Ref was deleted */
138
+ RefUpdateStatus["DELETED"] = "deleted";
139
+ /** Update renamed the ref */
140
+ RefUpdateStatus["RENAMED"] = "renamed";
141
+ return RefUpdateStatus;
142
+ }({});
143
+ /**
144
+ * Check if fetch result has any updates.
145
+ */
146
+ function hasUpdates(result) {
147
+ return result.trackingRefUpdates.some((u) => u.status !== "no-change");
148
+ }
149
+ /**
150
+ * Get successful updates from fetch result.
151
+ */
152
+ function getSuccessfulUpdates(result) {
153
+ return result.trackingRefUpdates.filter((u) => u.status === "new" || u.status === "fast-forward" || u.status === "forced");
154
+ }
155
+ //#endregion
156
+ //#region src/results/diff-entry.ts
157
+ /**
158
+ * Type of change in a diff entry.
159
+ */
160
+ let ChangeType = /* @__PURE__ */ function(ChangeType) {
161
+ /** File was added */
162
+ ChangeType["ADD"] = "ADD";
163
+ /** File was modified */
164
+ ChangeType["MODIFY"] = "MODIFY";
165
+ /** File was deleted */
166
+ ChangeType["DELETE"] = "DELETE";
167
+ /** File was renamed */
168
+ ChangeType["RENAME"] = "RENAME";
169
+ /** File was copied */
170
+ ChangeType["COPY"] = "COPY";
171
+ return ChangeType;
172
+ }({});
173
+ /**
174
+ * Create a DiffEntry for an added file.
175
+ */
176
+ function createAddEntry(path, id, mode) {
177
+ return {
178
+ changeType: "ADD",
179
+ newPath: path,
180
+ newId: id,
181
+ newMode: mode
182
+ };
183
+ }
184
+ /**
185
+ * Create a DiffEntry for a deleted file.
186
+ */
187
+ function createDeleteEntry(path, id, mode) {
188
+ return {
189
+ changeType: "DELETE",
190
+ oldPath: path,
191
+ oldId: id,
192
+ oldMode: mode
193
+ };
194
+ }
195
+ /**
196
+ * Create a DiffEntry for a modified file.
197
+ */
198
+ function createModifyEntry(path, oldId, newId, oldMode, newMode) {
199
+ return {
200
+ changeType: "MODIFY",
201
+ oldPath: path,
202
+ newPath: path,
203
+ oldId,
204
+ newId,
205
+ oldMode,
206
+ newMode
207
+ };
208
+ }
209
+ /**
210
+ * Create a DiffEntry for a renamed file.
211
+ */
212
+ function createRenameEntry(oldPath, newPath, oldId, newId, oldMode, newMode, score) {
213
+ return {
214
+ changeType: "RENAME",
215
+ oldPath,
216
+ newPath,
217
+ oldId,
218
+ newId,
219
+ oldMode,
220
+ newMode,
221
+ score
222
+ };
223
+ }
224
+ /**
225
+ * Create a DiffEntry for a copied file.
226
+ */
227
+ function createCopyEntry(oldPath, newPath, oldId, newId, oldMode, newMode, score) {
228
+ return {
229
+ changeType: "COPY",
230
+ oldPath,
231
+ newPath,
232
+ oldId,
233
+ newId,
234
+ oldMode,
235
+ newMode,
236
+ score
237
+ };
238
+ }
239
+ //#endregion
240
+ //#region src/results/push-result.ts
241
+ /**
242
+ * Status of a ref update during push.
243
+ *
244
+ * Based on JGit's RemoteRefUpdate.Status.
245
+ */
246
+ let PushStatus = /* @__PURE__ */ function(PushStatus) {
247
+ /** Update was performed successfully */
248
+ PushStatus["OK"] = "ok";
249
+ /** Update was rejected (not fast-forward) */
250
+ PushStatus["REJECTED_NONFASTFORWARD"] = "rejected-nonfastforward";
251
+ /** Update was rejected (other reason) */
252
+ PushStatus["REJECTED_OTHER"] = "rejected-other";
253
+ /** Update failed (remote error) */
254
+ PushStatus["FAILED"] = "failed";
255
+ /** Update not attempted (nothing to push) */
256
+ PushStatus["NOT_ATTEMPTED"] = "not-attempted";
257
+ /** Update already up to date */
258
+ PushStatus["UP_TO_DATE"] = "up-to-date";
259
+ /** Waiting for other updates to complete (atomic push) */
260
+ PushStatus["AWAITING_REPORT"] = "awaiting-report";
261
+ return PushStatus;
262
+ }({});
263
+ /**
264
+ * Check if all updates in push result were successful.
265
+ */
266
+ function isPushSuccessful(result) {
267
+ return result.remoteUpdates.every((u) => u.status === "ok" || u.status === "up-to-date");
268
+ }
269
+ /**
270
+ * Get failed updates from push result.
271
+ */
272
+ function getFailedUpdates(result) {
273
+ return result.remoteUpdates.filter((u) => u.status !== "ok" && u.status !== "up-to-date" && u.status !== "not-attempted");
274
+ }
275
+ //#endregion
276
+ //#region src/results/rebase-result.ts
277
+ /**
278
+ * Status of a rebase operation.
279
+ *
280
+ * Based on JGit's RebaseResult.Status.
281
+ */
282
+ let RebaseStatus = /* @__PURE__ */ function(RebaseStatus) {
283
+ /**
284
+ * Rebase was successful.
285
+ */
286
+ RebaseStatus["OK"] = "ok";
287
+ /**
288
+ * Fast-forward was performed (no actual rebase needed).
289
+ */
290
+ RebaseStatus["FAST_FORWARD"] = "fast-forward";
291
+ /**
292
+ * Already up-to-date (no rebase needed).
293
+ */
294
+ RebaseStatus["UP_TO_DATE"] = "up-to-date";
295
+ /**
296
+ * Rebase stopped due to conflict.
297
+ */
298
+ RebaseStatus["STOPPED"] = "stopped";
299
+ /**
300
+ * Rebase was aborted.
301
+ */
302
+ RebaseStatus["ABORTED"] = "aborted";
303
+ /**
304
+ * Rebase was aborted due to failure (not conflict).
305
+ */
306
+ RebaseStatus["FAILED"] = "failed";
307
+ /**
308
+ * Uncommitted changes prevented rebase from starting.
309
+ */
310
+ RebaseStatus["UNCOMMITTED_CHANGES"] = "uncommitted-changes";
311
+ /**
312
+ * Interactive rebase is prepared but not started.
313
+ */
314
+ RebaseStatus["INTERACTIVE_PREPARED"] = "interactive-prepared";
315
+ /**
316
+ * Continue was called but there was nothing to commit.
317
+ */
318
+ RebaseStatus["NOTHING_TO_COMMIT"] = "nothing-to-commit";
319
+ /**
320
+ * Stash apply failed after successful rebase.
321
+ */
322
+ RebaseStatus["STASH_APPLY_CONFLICTS"] = "stash-apply-conflicts";
323
+ /**
324
+ * Rebase stopped at edit step.
325
+ */
326
+ RebaseStatus["EDIT"] = "edit";
327
+ return RebaseStatus;
328
+ }({});
329
+ /**
330
+ * Rebase todo line action.
331
+ *
332
+ * Based on JGit's RebaseTodoLine.Action.
333
+ */
334
+ let RebaseAction = /* @__PURE__ */ function(RebaseAction) {
335
+ /** Pick the commit (apply it) */
336
+ RebaseAction["PICK"] = "pick";
337
+ /** Reword: pick but edit commit message */
338
+ RebaseAction["REWORD"] = "reword";
339
+ /** Edit: stop for amending */
340
+ RebaseAction["EDIT"] = "edit";
341
+ /** Squash into previous commit (combine messages) */
342
+ RebaseAction["SQUASH"] = "squash";
343
+ /** Fixup: squash but discard this commit's message */
344
+ RebaseAction["FIXUP"] = "fixup";
345
+ /** Comment line (ignored) */
346
+ RebaseAction["COMMENT"] = "comment";
347
+ return RebaseAction;
348
+ }({});
349
+ /**
350
+ * Check if rebase status indicates success.
351
+ */
352
+ function isRebaseSuccessful(status) {
353
+ return status === "ok" || status === "fast-forward" || status === "up-to-date";
354
+ }
355
+ //#endregion
356
+ //#region src/results/revert-result.ts
357
+ /**
358
+ * Status of a revert operation.
359
+ *
360
+ * Based on JGit's RevertCommand result patterns.
361
+ */
362
+ let RevertStatus = /* @__PURE__ */ function(RevertStatus) {
363
+ /** Revert completed successfully */
364
+ RevertStatus["OK"] = "ok";
365
+ /** Revert resulted in conflicts */
366
+ RevertStatus["CONFLICTING"] = "conflicting";
367
+ /** Revert failed due to dirty working tree or other issues */
368
+ RevertStatus["FAILED"] = "failed";
369
+ return RevertStatus;
370
+ }({});
371
+ //#endregion
372
+ //#region src/results/stash-result.ts
373
+ /**
374
+ * Status of stash apply operation.
375
+ */
376
+ let StashApplyStatus = /* @__PURE__ */ function(StashApplyStatus) {
377
+ /** Stash was applied successfully */
378
+ StashApplyStatus["OK"] = "ok";
379
+ /** Stash apply resulted in conflicts */
380
+ StashApplyStatus["CONFLICTS"] = "conflicts";
381
+ /** Stash apply failed */
382
+ StashApplyStatus["FAILED"] = "failed";
383
+ return StashApplyStatus;
384
+ }({});
385
+ //#endregion
386
+ //#region src/results/status-result.ts
387
+ /**
388
+ * Implementation of Status interface.
389
+ */
390
+ var StatusImpl = class {
391
+ added;
392
+ changed;
393
+ removed;
394
+ conflicting;
395
+ constructor(added, changed, removed, conflicting) {
396
+ this.added = added;
397
+ this.changed = changed;
398
+ this.removed = removed;
399
+ this.conflicting = conflicting;
400
+ }
401
+ isClean() {
402
+ return this.added.size === 0 && this.changed.size === 0 && this.removed.size === 0 && this.conflicting.size === 0;
403
+ }
404
+ hasUncommittedChanges() {
405
+ return !this.isClean();
406
+ }
407
+ };
408
+ //#endregion
409
+ export { isMergeSuccessful as C, MergeStrategy as S, getSuccessfulUpdates as _, RebaseStatus as a, FastForwardMode as b, getFailedUpdates as c, createAddEntry as d, createCopyEntry as f, RefUpdateStatus as g, createRenameEntry as h, RebaseAction as i, isPushSuccessful as l, createModifyEntry as m, StashApplyStatus as n, isRebaseSuccessful as o, createDeleteEntry as p, RevertStatus as r, PushStatus as s, StatusImpl as t, ChangeType as u, hasUpdates as v, CherryPickStatus as w, MergeStatus as x, ContentMergeStrategy as y };
@@ -0,0 +1,83 @@
1
+ import type { Credentials, ProgressInfo } from "@statewalker/vcs-transport";
2
+ import { GitCommand } from "./git-command.js";
3
+ /**
4
+ * Progress callback type for transport operations.
5
+ */
6
+ export type ProgressCallback = (info: ProgressInfo) => void;
7
+ /**
8
+ * Options for transport operations.
9
+ */
10
+ export interface TransportOptions {
11
+ /** Authentication credentials */
12
+ auth?: Credentials;
13
+ /** Custom HTTP headers */
14
+ headers?: Record<string, string>;
15
+ /** Request timeout in milliseconds */
16
+ timeout?: number;
17
+ /** Progress callback */
18
+ onProgress?: ProgressCallback;
19
+ /** Raw progress message callback */
20
+ onProgressMessage?: (message: string) => void;
21
+ }
22
+ /**
23
+ * Base class for commands that require network transport.
24
+ *
25
+ * Adds authentication, timeout, and progress support on top of GitCommand.
26
+ * Based on JGit's TransportCommand<C, R>.
27
+ *
28
+ * @typeParam T - The return type of the command's call() method
29
+ */
30
+ export declare abstract class TransportCommand<T> extends GitCommand<T> {
31
+ /** Authentication credentials */
32
+ protected credentials?: Credentials;
33
+ /** Request timeout in milliseconds */
34
+ protected timeout?: number;
35
+ /** Custom HTTP headers */
36
+ protected headers?: Record<string, string>;
37
+ /** Progress callback */
38
+ protected progressCallback?: ProgressCallback;
39
+ /** Progress message callback */
40
+ protected progressMessageCallback?: (message: string) => void;
41
+ /**
42
+ * Set authentication credentials.
43
+ *
44
+ * @param credentials Username/password or token credentials
45
+ */
46
+ setCredentials(credentials: Credentials): this;
47
+ /**
48
+ * Set authentication using username and password.
49
+ *
50
+ * @param username Username
51
+ * @param password Password
52
+ */
53
+ setCredentialsProvider(username: string, password: string): this;
54
+ /**
55
+ * Set request timeout.
56
+ *
57
+ * @param timeout Timeout in milliseconds
58
+ */
59
+ setTimeout(timeout: number): this;
60
+ /**
61
+ * Set custom HTTP headers.
62
+ *
63
+ * @param headers Custom headers
64
+ */
65
+ setHeaders(headers: Record<string, string>): this;
66
+ /**
67
+ * Set progress callback.
68
+ *
69
+ * @param callback Progress callback function
70
+ */
71
+ setProgressMonitor(callback: ProgressCallback): this;
72
+ /**
73
+ * Set progress message callback.
74
+ *
75
+ * @param callback Progress message callback function
76
+ */
77
+ setProgressMessageCallback(callback: (message: string) => void): this;
78
+ /**
79
+ * Get transport options for passing to transport operations.
80
+ */
81
+ protected getTransportOptions(): TransportOptions;
82
+ }
83
+ //# sourceMappingURL=transport-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport-command.d.ts","sourceRoot":"","sources":["../src/transport-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,oCAAoC;IACpC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,8BAAsB,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAC7D,iCAAiC;IACjC,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACpC,sCAAsC;IACtC,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC3B,0BAA0B;IAC1B,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,wBAAwB;IACxB,SAAS,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAC9C,gCAAgC;IAChC,SAAS,CAAC,uBAAuB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE9D;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAI7C;IAED;;;;;OAKG;IACH,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI/D;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhC;IAED;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAIhD;IAED;;;;OAIG;IACH,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAInD;IAED;;;;OAIG;IACH,0BAA0B,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAIpE;IAED;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,gBAAgB,CAQhD;CACF"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Path-level three-way tree merge shared by the commands that replay one
3
+ * tree's changes onto another (`rebase`, `stash apply`).
4
+ *
5
+ * Internal: not re-exported from `src/index.ts`.
6
+ */
7
+ export { mergeTreesThreeWay, type TreeMergeResult } from "./tree-merge.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tree-merge/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ObjectId } from "@statewalker/vcs-core";
2
+ import type { CommandTrees } from "../git-command.js";
3
+ /**
4
+ * The outcome of a three-way tree merge.
5
+ *
6
+ * `conflicts` is absent on a clean merge. When it is present `tree` is the
7
+ * *theirs* tree, not a merged one: a conflicting merge never builds a tree, so
8
+ * callers must halt rather than record `tree` as a result.
9
+ */
10
+ export interface TreeMergeResult {
11
+ tree: ObjectId;
12
+ conflicts?: string[];
13
+ }
14
+ /**
15
+ * Path-level three-way tree merge with recursive support.
16
+ *
17
+ * Merges per path against the `base` tree: a path only one side changed takes
18
+ * that side, a path both sides changed identically merges cleanly, and a path
19
+ * the two sides changed differently is reported as a conflict. So is a path
20
+ * one side made a file and the other made a directory, which no tree can
21
+ * represent.
22
+ *
23
+ * The merge is path-level only - it never merges the *contents* of a file.
24
+ * Two sides editing different regions of the same file conflict here where
25
+ * git would resolve them.
26
+ *
27
+ * Shared by `rebase` (base = the replayed commit's parent, ours = that commit,
28
+ * theirs = the commit being replayed onto) and `stash apply` (base = the
29
+ * commit the stash was taken from, ours = the stash, theirs = HEAD). It is
30
+ * *not* what `merge` uses: that command keeps its own entry-level merge
31
+ * because it also resolves conflicts at the content level and writes conflict
32
+ * stages into the index.
33
+ *
34
+ * @param trees The tree store to read from and write the merged tree to
35
+ * @param base The common ancestor tree
36
+ * @param ours The tree whose changes are being applied
37
+ * @param theirs The tree being applied onto
38
+ * @returns The merged tree, or `theirs` plus the conflicting paths
39
+ */
40
+ export declare function mergeTreesThreeWay(trees: CommandTrees, base: ObjectId, ours: ObjectId, theirs: ObjectId): Promise<TreeMergeResult>;
41
+ //# sourceMappingURL=tree-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-merge.d.ts","sourceRoot":"","sources":["../../src/tree-merge/tree-merge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAetD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AA0GD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,QAAQ,GACf,OAAO,CAAC,eAAe,CAAC,CAoF1B"}