@smithers-orchestrator/vcs 0.23.0 → 0.24.0
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.
- package/package.json +8 -8
- package/src/index.d.ts +33 -10
- package/src/index.js +0 -8
- package/src/jj.js +6 -1
- package/src/resolveGitBinary.js +1 -3
- package/src/resolveJjBinary.js +1 -3
- package/src/vcsToolingStatus.js +3 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smithers-orchestrator/vcs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "VCS discovery and jj workspace operations for Smithers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@effect/platform": "^0.96.0",
|
|
24
24
|
"effect": "^3.21.1",
|
|
25
|
-
"@smithers-orchestrator/observability": "0.
|
|
25
|
+
"@smithers-orchestrator/observability": "0.24.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@effect/platform-bun": "^0.89.0",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"typescript": "~5.9.3"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@smithers-orchestrator/jj-darwin-
|
|
34
|
-
"@smithers-orchestrator/jj-darwin-
|
|
35
|
-
"@smithers-orchestrator/jj-linux-x64": "0.
|
|
36
|
-
"@smithers-orchestrator/jj-
|
|
37
|
-
"@smithers-orchestrator/jj-
|
|
33
|
+
"@smithers-orchestrator/jj-darwin-x64": "0.24.0",
|
|
34
|
+
"@smithers-orchestrator/jj-darwin-arm64": "0.24.0",
|
|
35
|
+
"@smithers-orchestrator/jj-linux-x64": "0.24.0",
|
|
36
|
+
"@smithers-orchestrator/jj-linux-arm64": "0.24.0",
|
|
37
|
+
"@smithers-orchestrator/jj-win32-x64": "0.24.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "tsup --dts-only",
|
|
40
|
+
"build": "rm -f src/index.d.ts && tsup --dts-only",
|
|
41
41
|
"test": "bun test tests",
|
|
42
42
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
43
43
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -65,6 +65,19 @@ declare function runJj(args: string[], opts?: RunJjOptions): Effect.Effect<RunJj
|
|
|
65
65
|
* @returns {Effect.Effect<string | null, never, import("@effect/platform/CommandExecutor").CommandExecutor>}
|
|
66
66
|
*/
|
|
67
67
|
declare function getJjPointer(cwd?: string): Effect.Effect<string | null, never, _effect_platform_CommandExecutor.CommandExecutor>;
|
|
68
|
+
/**
|
|
69
|
+
* Capture the current working-copy state as a restorable handle.
|
|
70
|
+
*
|
|
71
|
+
* Step 1 (`jj log -r @`) forces exactly one working-copy snapshot and returns the
|
|
72
|
+
* resulting `commit_id` and `change_id`. Step 2 reads the latest operation id
|
|
73
|
+
* WITHOUT taking a second snapshot (`--ignore-working-copy`), so both ids describe
|
|
74
|
+
* the same snapshot from step 1. Returns null on any failure or timeout (a
|
|
75
|
+
* durability gap the caller records); it never throws into the agent path.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} [cwd]
|
|
78
|
+
* @returns {Effect.Effect<WorkspaceSnapshot | null, never, import("@effect/platform/CommandExecutor").CommandExecutor>}
|
|
79
|
+
*/
|
|
80
|
+
declare function captureWorkspaceSnapshot(cwd?: string): Effect.Effect<WorkspaceSnapshot | null, never, _effect_platform_CommandExecutor.CommandExecutor>;
|
|
68
81
|
/**
|
|
69
82
|
* Restore the working copy to a previously recorded jujutsu `change_id`.
|
|
70
83
|
* Used by the engine to revert attempts within the correct repo/worktree (via `cwd`).
|
|
@@ -115,6 +128,20 @@ type RunJjResult = RunJjResult$1;
|
|
|
115
128
|
type WorkspaceAddOptions = WorkspaceAddOptions$1;
|
|
116
129
|
type WorkspaceInfo = WorkspaceInfo$1;
|
|
117
130
|
type WorkspaceResult = WorkspaceResult$1;
|
|
131
|
+
type WorkspaceSnapshot = {
|
|
132
|
+
/**
|
|
133
|
+
* Working-copy commit id for this snapshot.
|
|
134
|
+
*/
|
|
135
|
+
commitId: string;
|
|
136
|
+
/**
|
|
137
|
+
* Stable JJ change id for the working copy.
|
|
138
|
+
*/
|
|
139
|
+
changeId: string;
|
|
140
|
+
/**
|
|
141
|
+
* JJ operation id for the snapshot.
|
|
142
|
+
*/
|
|
143
|
+
operationId: string;
|
|
144
|
+
};
|
|
118
145
|
|
|
119
146
|
/**
|
|
120
147
|
* A resolved VCS executable plus where Smithers found it.
|
|
@@ -123,12 +150,11 @@ type WorkspaceResult = WorkspaceResult$1;
|
|
|
123
150
|
* - `bundled`: a binary shipped inside a `@smithers-orchestrator/jj-<platform>` package
|
|
124
151
|
* - `path`: the bare command name, left for the OS to resolve against `PATH`
|
|
125
152
|
*/
|
|
126
|
-
type ResolvedBinary
|
|
153
|
+
type ResolvedBinary = {
|
|
127
154
|
path: string;
|
|
128
155
|
source: "env" | "bundled" | "path";
|
|
129
156
|
};
|
|
130
157
|
|
|
131
|
-
/** @typedef {import("./ResolvedBinary.js").ResolvedBinary} ResolvedBinary */
|
|
132
158
|
/**
|
|
133
159
|
* Resolve the `git` executable Smithers should spawn.
|
|
134
160
|
*
|
|
@@ -139,10 +165,9 @@ type ResolvedBinary$3 = {
|
|
|
139
165
|
* Git is never bundled (only jj is); this mirrors {@link resolveJjBinary} so the
|
|
140
166
|
* override and the tooling preflight share one source of truth for where git is.
|
|
141
167
|
*
|
|
142
|
-
* @returns {ResolvedBinary}
|
|
168
|
+
* @returns {import("./ResolvedBinary.js").ResolvedBinary}
|
|
143
169
|
*/
|
|
144
|
-
declare function resolveGitBinary(): ResolvedBinary
|
|
145
|
-
type ResolvedBinary$2 = ResolvedBinary$3;
|
|
170
|
+
declare function resolveGitBinary(): ResolvedBinary;
|
|
146
171
|
|
|
147
172
|
/**
|
|
148
173
|
* Resolve the `jj` executable Smithers should spawn.
|
|
@@ -156,10 +181,9 @@ type ResolvedBinary$2 = ResolvedBinary$3;
|
|
|
156
181
|
* `"jj"` simply fails to spawn, which `runJj` already normalizes to exit code
|
|
157
182
|
* 127, so callers keep their soft-failure behavior.
|
|
158
183
|
*
|
|
159
|
-
* @returns {ResolvedBinary}
|
|
184
|
+
* @returns {import("./ResolvedBinary.js").ResolvedBinary}
|
|
160
185
|
*/
|
|
161
|
-
declare function resolveJjBinary(): ResolvedBinary
|
|
162
|
-
type ResolvedBinary$1 = ResolvedBinary$3;
|
|
186
|
+
declare function resolveJjBinary(): ResolvedBinary;
|
|
163
187
|
|
|
164
188
|
/**
|
|
165
189
|
* Probe whether a usable `jj` and/or `git` exists for the current host, using
|
|
@@ -173,7 +197,6 @@ type ResolvedBinary$1 = ResolvedBinary$3;
|
|
|
173
197
|
* @returns {VcsToolingStatus}
|
|
174
198
|
*/
|
|
175
199
|
declare function vcsToolingStatus(): VcsToolingStatus;
|
|
176
|
-
type ResolvedBinary = ResolvedBinary$3;
|
|
177
200
|
/**
|
|
178
201
|
* Whether a usable `jj` and/or `git` exists for the current host. Each field is
|
|
179
202
|
* the resolved binary when `<bin> --version` runs, or null when it does not.
|
|
@@ -193,4 +216,4 @@ type VcsToolingStatus = {
|
|
|
193
216
|
ok: boolean;
|
|
194
217
|
};
|
|
195
218
|
|
|
196
|
-
export { type VcsToolingStatus, findVcsRoot, getJjPointer, isJjRepo, resolveGitBinary, resolveJjBinary, revertToJjPointer, runJj, vcsToolingStatus, workspaceAdd, workspaceClose, workspaceList };
|
|
219
|
+
export { type JjRevertResult, type RunJjOptions, type RunJjResult, type VcsToolingStatus, type WorkspaceAddOptions, type WorkspaceInfo, type WorkspaceResult, type WorkspaceSnapshot, captureWorkspaceSnapshot, findVcsRoot, getJjPointer, isJjRepo, resolveGitBinary, resolveJjBinary, revertToJjPointer, runJj, vcsToolingStatus, workspaceAdd, workspaceClose, workspaceList };
|
package/src/index.js
CHANGED
|
@@ -2,12 +2,4 @@ export * from "./find-root.js";
|
|
|
2
2
|
export * from "./jj.js";
|
|
3
3
|
export * from "./resolveGitBinary.js";
|
|
4
4
|
export * from "./resolveJjBinary.js";
|
|
5
|
-
export * from "./ResolvedBinary.js";
|
|
6
5
|
export * from "./vcsToolingStatus.js";
|
|
7
|
-
export * from "./JjRevertResult.js";
|
|
8
|
-
export * from "./RunJjOptions.js";
|
|
9
|
-
export * from "./RunJjResult.js";
|
|
10
|
-
export * from "./WorkspaceAddOptions.js";
|
|
11
|
-
export * from "./WorkspaceInfo.js";
|
|
12
|
-
export * from "./WorkspaceResult.js";
|
|
13
|
-
export * from "./WorkspaceSnapshot.js";
|
package/src/jj.js
CHANGED
|
@@ -5,7 +5,12 @@
|
|
|
5
5
|
/** @typedef {import("./WorkspaceAddOptions.js").WorkspaceAddOptions} WorkspaceAddOptions */
|
|
6
6
|
/** @typedef {import("./WorkspaceInfo.js").WorkspaceInfo} WorkspaceInfo */
|
|
7
7
|
/** @typedef {import("./WorkspaceResult.js").WorkspaceResult} WorkspaceResult */
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {object} WorkspaceSnapshot
|
|
10
|
+
* @property {string} commitId Working-copy commit id for this snapshot.
|
|
11
|
+
* @property {string} changeId Stable JJ change id for the working copy.
|
|
12
|
+
* @property {string} operationId JJ operation id for the snapshot.
|
|
13
|
+
*/
|
|
9
14
|
// @smithers-type-exports-end
|
|
10
15
|
|
|
11
16
|
import * as Command from "@effect/platform/Command";
|
package/src/resolveGitBinary.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
|
|
3
|
-
/** @typedef {import("./ResolvedBinary.js").ResolvedBinary} ResolvedBinary */
|
|
4
|
-
|
|
5
3
|
/**
|
|
6
4
|
* Resolve the `git` executable Smithers should spawn.
|
|
7
5
|
*
|
|
@@ -12,7 +10,7 @@ import { existsSync } from "node:fs";
|
|
|
12
10
|
* Git is never bundled (only jj is); this mirrors {@link resolveJjBinary} so the
|
|
13
11
|
* override and the tooling preflight share one source of truth for where git is.
|
|
14
12
|
*
|
|
15
|
-
* @returns {ResolvedBinary}
|
|
13
|
+
* @returns {import("./ResolvedBinary.js").ResolvedBinary}
|
|
16
14
|
*/
|
|
17
15
|
export function resolveGitBinary() {
|
|
18
16
|
const override = process.env.SMITHERS_GIT_PATH;
|
package/src/resolveJjBinary.js
CHANGED
|
@@ -2,8 +2,6 @@ import { existsSync } from "node:fs";
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
|
-
/** @typedef {import("./ResolvedBinary.js").ResolvedBinary} ResolvedBinary */
|
|
6
|
-
|
|
7
5
|
const require = createRequire(import.meta.url);
|
|
8
6
|
|
|
9
7
|
/**
|
|
@@ -58,7 +56,7 @@ function bundledJjPath() {
|
|
|
58
56
|
* `"jj"` simply fails to spawn, which `runJj` already normalizes to exit code
|
|
59
57
|
* 127, so callers keep their soft-failure behavior.
|
|
60
58
|
*
|
|
61
|
-
* @returns {ResolvedBinary}
|
|
59
|
+
* @returns {import("./ResolvedBinary.js").ResolvedBinary}
|
|
62
60
|
*/
|
|
63
61
|
export function resolveJjBinary() {
|
|
64
62
|
const override = process.env.SMITHERS_JJ_PATH;
|
package/src/vcsToolingStatus.js
CHANGED
|
@@ -2,15 +2,13 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { resolveJjBinary } from "./resolveJjBinary.js";
|
|
3
3
|
import { resolveGitBinary } from "./resolveGitBinary.js";
|
|
4
4
|
|
|
5
|
-
/** @typedef {import("./ResolvedBinary.js").ResolvedBinary} ResolvedBinary */
|
|
6
|
-
|
|
7
5
|
/**
|
|
8
6
|
* Whether a usable `jj` and/or `git` exists for the current host. Each field is
|
|
9
7
|
* the resolved binary when `<bin> --version` runs, or null when it does not.
|
|
10
8
|
*
|
|
11
9
|
* @typedef {object} VcsToolingStatus
|
|
12
|
-
* @property {ResolvedBinary | null} jj a usable jj (override, bundled, or PATH), else null
|
|
13
|
-
* @property {ResolvedBinary | null} git a usable git (override or PATH), else null
|
|
10
|
+
* @property {import("./ResolvedBinary.js").ResolvedBinary | null} jj a usable jj (override, bundled, or PATH), else null
|
|
11
|
+
* @property {import("./ResolvedBinary.js").ResolvedBinary | null} git a usable git (override or PATH), else null
|
|
14
12
|
* @property {boolean} ok true when at least one of jj or git is usable
|
|
15
13
|
*/
|
|
16
14
|
|
|
@@ -20,7 +18,7 @@ const VERSION_PROBE_TIMEOUT_MS = 2_000;
|
|
|
20
18
|
* Whether `<bin> --version` exits 0. Best-effort: a missing binary, a non-zero
|
|
21
19
|
* exit, or a spawn error all read as "not usable".
|
|
22
20
|
*
|
|
23
|
-
* @param {ResolvedBinary} bin
|
|
21
|
+
* @param {import("./ResolvedBinary.js").ResolvedBinary} bin
|
|
24
22
|
* @returns {boolean}
|
|
25
23
|
*/
|
|
26
24
|
function runsVersion(bin) {
|