@claudexor/workspace 4.8.1 → 5.0.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.
- package/dist/anchor-store.d.ts +20 -9
- package/dist/anchor-store.d.ts.map +1 -1
- package/dist/anchor-store.js +96 -16
- package/dist/anchor-store.js.map +1 -1
- package/dist/capture-failure.d.ts.map +1 -1
- package/dist/capture-failure.js +7 -2
- package/dist/capture-failure.js.map +1 -1
- package/dist/capture-inventory.d.ts +10 -0
- package/dist/capture-inventory.d.ts.map +1 -0
- package/dist/capture-inventory.js +63 -0
- package/dist/capture-inventory.js.map +1 -0
- package/dist/capture-objects.d.ts +32 -0
- package/dist/capture-objects.d.ts.map +1 -0
- package/dist/capture-objects.js +129 -0
- package/dist/capture-objects.js.map +1 -0
- package/dist/cleanup-fault.d.ts +18 -0
- package/dist/cleanup-fault.d.ts.map +1 -0
- package/dist/cleanup-fault.js +45 -0
- package/dist/cleanup-fault.js.map +1 -0
- package/dist/continuation-evidence.d.ts +61 -15
- package/dist/continuation-evidence.d.ts.map +1 -1
- package/dist/continuation-evidence.js +151 -36
- package/dist/continuation-evidence.js.map +1 -1
- package/dist/continuation-facts.d.ts +93 -0
- package/dist/continuation-facts.d.ts.map +1 -0
- package/dist/continuation-facts.js +162 -0
- package/dist/continuation-facts.js.map +1 -0
- package/dist/directory-workspace.d.ts.map +1 -1
- package/dist/directory-workspace.js +1 -3
- package/dist/directory-workspace.js.map +1 -1
- package/dist/files-io.d.ts.map +1 -1
- package/dist/files-io.js +1 -7
- package/dist/files-io.js.map +1 -1
- package/dist/fs-presence.d.ts +12 -0
- package/dist/fs-presence.d.ts.map +1 -0
- package/dist/fs-presence.js +35 -0
- package/dist/fs-presence.js.map +1 -0
- package/dist/git-nested-repositories.d.ts.map +1 -1
- package/dist/git-nested-repositories.js +11 -2
- package/dist/git-nested-repositories.js.map +1 -1
- package/dist/git-observed.d.ts +75 -0
- package/dist/git-observed.d.ts.map +1 -0
- package/dist/git-observed.js +172 -0
- package/dist/git-observed.js.map +1 -0
- package/dist/git-result.d.ts +36 -0
- package/dist/git-result.d.ts.map +1 -0
- package/dist/git-result.js +96 -0
- package/dist/git-result.js.map +1 -0
- package/dist/git-run.d.ts +11 -0
- package/dist/git-run.d.ts.map +1 -1
- package/dist/git-run.js +24 -0
- package/dist/git-run.js.map +1 -1
- package/dist/git-snapshot.d.ts +40 -0
- package/dist/git-snapshot.d.ts.map +1 -0
- package/dist/git-snapshot.js +238 -0
- package/dist/git-snapshot.js.map +1 -0
- package/dist/git-transient-capture.d.ts +63 -16
- package/dist/git-transient-capture.d.ts.map +1 -1
- package/dist/git-transient-capture.js +170 -57
- package/dist/git-transient-capture.js.map +1 -1
- package/dist/git.d.ts +46 -21
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +164 -103
- package/dist/git.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/lanes.d.ts +2 -1
- package/dist/lanes.d.ts.map +1 -1
- package/dist/lanes.js +7 -6
- package/dist/lanes.js.map +1 -1
- package/dist/manager.d.ts +21 -7
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +30 -17
- package/dist/manager.js.map +1 -1
- package/dist/object-compose.d.ts +58 -0
- package/dist/object-compose.d.ts.map +1 -0
- package/dist/object-compose.js +444 -0
- package/dist/object-compose.js.map +1 -0
- package/dist/object-materialize.d.ts +52 -0
- package/dist/object-materialize.d.ts.map +1 -0
- package/dist/object-materialize.js +467 -0
- package/dist/object-materialize.js.map +1 -0
- package/dist/object-occupied.d.ts +27 -0
- package/dist/object-occupied.d.ts.map +1 -0
- package/dist/object-occupied.js +131 -0
- package/dist/object-occupied.js.map +1 -0
- package/dist/object-revert.d.ts +45 -0
- package/dist/object-revert.d.ts.map +1 -0
- package/dist/object-revert.js +265 -0
- package/dist/object-revert.js.map +1 -0
- package/dist/object-saved-files.d.ts +50 -0
- package/dist/object-saved-files.d.ts.map +1 -0
- package/dist/object-saved-files.js +176 -0
- package/dist/object-saved-files.js.map +1 -0
- package/dist/object-sparse.d.ts +22 -0
- package/dist/object-sparse.d.ts.map +1 -0
- package/dist/object-sparse.js +72 -0
- package/dist/object-sparse.js.map +1 -0
- package/dist/object-store-leases.d.ts +41 -0
- package/dist/object-store-leases.d.ts.map +1 -0
- package/dist/object-store-leases.js +277 -0
- package/dist/object-store-leases.js.map +1 -0
- package/dist/object-store-roots.d.ts +25 -0
- package/dist/object-store-roots.d.ts.map +1 -0
- package/dist/object-store-roots.js +114 -0
- package/dist/object-store-roots.js.map +1 -0
- package/dist/object-store.d.ts +110 -0
- package/dist/object-store.d.ts.map +1 -0
- package/dist/object-store.js +404 -0
- package/dist/object-store.js.map +1 -0
- package/dist/object-transfer.d.ts +41 -0
- package/dist/object-transfer.d.ts.map +1 -0
- package/dist/object-transfer.js +267 -0
- package/dist/object-transfer.js.map +1 -0
- package/dist/plain-diff-capture.d.ts +1 -2
- package/dist/plain-diff-capture.d.ts.map +1 -1
- package/dist/plain-diff-capture.js +2 -7
- package/dist/plain-diff-capture.js.map +1 -1
- package/dist/plain-diff.d.ts +0 -4
- package/dist/plain-diff.d.ts.map +1 -1
- package/dist/plain-diff.js +2 -44
- package/dist/plain-diff.js.map +1 -1
- package/dist/raw-patch.d.ts.map +1 -1
- package/dist/raw-patch.js +5 -8
- package/dist/raw-patch.js.map +1 -1
- package/dist/run-expiry.d.ts +3 -0
- package/dist/run-expiry.d.ts.map +1 -0
- package/dist/run-expiry.js +15 -0
- package/dist/run-expiry.js.map +1 -0
- package/dist/thread-tree.d.ts +36 -2
- package/dist/thread-tree.d.ts.map +1 -1
- package/dist/thread-tree.js +87 -11
- package/dist/thread-tree.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,91 +1,171 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { delimiter, join } from "node:path";
|
|
4
|
+
import { CAPTURE_BUFFER_BUDGET_BYTES, CaptureOutputExceeded, WorkspaceError, } from "@claudexor/core";
|
|
5
|
+
import { changedFileInventory } from "./capture-inventory.js";
|
|
6
|
+
import { noteCleanupFault } from "./cleanup-fault.js";
|
|
7
|
+
import { estimatePatchViewBytes, objectDirectoryProgress, preflightCaptureSpace, } from "./capture-objects.js";
|
|
6
8
|
import { nestedRepositoryExcludes, untrackedNestedRepositories, } from "./git-nested-repositories.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
+
import { gitObserved, GitOperationError, proofStallMs, treeBlobBytes } from "./git-observed.js";
|
|
10
|
+
import { makeGitObjectResult, repositoryObjectFormat, storeBoundaryCommit, treeOf, } from "./git-result.js";
|
|
11
|
+
import { assertNoBinaryStubs, gitEnv, SCRATCH_INDEX_CONFIG } from "./git-run.js";
|
|
12
|
+
import { PINNED_DIFF_CONFIG, PINNED_DIFF_FLAGS } from "./object-compose.js";
|
|
13
|
+
import { assertProjectObjectFormat, beginPendingRoots, endPendingRoots, objectStorePath, retainInObjectStore, } from "./object-store.js";
|
|
14
|
+
function alternates(paths) {
|
|
15
|
+
// Git parses this as a path-list; C-style quoting keeps a legal `:` in a
|
|
16
|
+
// macOS path from becoming a separator (and escapes quotes/backslashes).
|
|
17
|
+
return paths.map((path) => JSON.stringify(path)).join(delimiter);
|
|
18
|
+
}
|
|
19
|
+
export async function captureWorkingTreeTransient(repo, baseSha, pathExcludes = [], options = {}) {
|
|
20
|
+
const projectRoot = options.projectRoot ?? repo;
|
|
21
|
+
const viewLimit = options.viewLimitBytes ?? CAPTURE_BUFFER_BUDGET_BYTES;
|
|
9
22
|
const scratchDir = mkdtempSync(join(tmpdir(), "claudexor-transient-diff-"));
|
|
10
23
|
const objectDir = join(scratchDir, "objects");
|
|
11
24
|
const indexPath = join(scratchDir, "index");
|
|
12
25
|
mkdirSync(objectDir, { recursive: true, mode: 0o700 });
|
|
13
26
|
let primaryError;
|
|
27
|
+
// The written candidate tree, for the refusal's own non-exact inventory pass.
|
|
28
|
+
let candidate;
|
|
29
|
+
let lease = null;
|
|
14
30
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"--git-path",
|
|
19
|
-
"objects",
|
|
20
|
-
]);
|
|
31
|
+
// One project keeps one object format: refused before anything is written or mounted.
|
|
32
|
+
await assertProjectObjectFormat(projectRoot, await repositoryObjectFormat(repo));
|
|
33
|
+
const actualObjects = await gitObserved(repo, ["rev-parse", "--path-format=absolute", "--git-path", "objects"], { label: "rev-parse objects", allowFailure: true });
|
|
21
34
|
if (actualObjects.code !== 0 || !actualObjects.stdout.trim()) {
|
|
22
35
|
throw new WorkspaceError(`transient diff could not resolve Git objects: ${actualObjects.stderr.trim()}`);
|
|
23
36
|
}
|
|
37
|
+
await preflightCaptureSpace(repo, scratchDir, { GIT_OPTIONAL_LOCKS: "0" });
|
|
38
|
+
// The lease comes first: a prune then either finished before or yields until
|
|
39
|
+
// the capture's own custody is recorded. No store yet: nothing to mount.
|
|
40
|
+
const store = objectStorePath(projectRoot);
|
|
41
|
+
if (existsSync(join(store, "objects")))
|
|
42
|
+
lease = await beginPendingRoots(store, []);
|
|
24
43
|
const env = {
|
|
25
44
|
GIT_INDEX_FILE: indexPath,
|
|
26
45
|
GIT_OBJECT_DIRECTORY: objectDir,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
46
|
+
GIT_ALTERNATE_OBJECT_DIRECTORIES: alternates([
|
|
47
|
+
actualObjects.stdout.trim(),
|
|
48
|
+
...(lease ? [join(store, "objects")] : []),
|
|
49
|
+
]),
|
|
30
50
|
GIT_OPTIONAL_LOCKS: "0",
|
|
31
51
|
};
|
|
32
|
-
const
|
|
52
|
+
const progress = objectDirectoryProgress(objectDir);
|
|
53
|
+
const read = await gitObserved(repo, [...SCRATCH_INDEX_CONFIG, "read-tree", baseSha], {
|
|
54
|
+
env,
|
|
55
|
+
label: "read-tree (capture base)",
|
|
56
|
+
allowFailure: true,
|
|
57
|
+
});
|
|
33
58
|
if (read.code !== 0) {
|
|
34
59
|
throw new WorkspaceError(`transient diff read-tree failed: ${read.stderr.trim()}`);
|
|
35
60
|
}
|
|
36
61
|
const nested = await untrackedNestedRepositories(repo, env, [".", ...pathExcludes], "transient diff");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
await gitObserved(repo, [
|
|
63
|
+
...SCRATCH_INDEX_CONFIG,
|
|
64
|
+
"add",
|
|
65
|
+
"-A",
|
|
66
|
+
"--",
|
|
67
|
+
".",
|
|
68
|
+
...pathExcludes,
|
|
69
|
+
...nestedRepositoryExcludes(nested),
|
|
70
|
+
],
|
|
71
|
+
// A tracked file whose blob the base already holds is re-hashed without a sign
|
|
72
|
+
// (no output, no new object), so the silent read is bounded by the base's bytes.
|
|
73
|
+
{
|
|
74
|
+
env,
|
|
75
|
+
label: "add -A (capture)",
|
|
76
|
+
progress,
|
|
77
|
+
stallMs: proofStallMs(await treeBlobBytes(repo, baseSha, env)),
|
|
78
|
+
});
|
|
79
|
+
const tree = (await gitObserved(repo, [...SCRATCH_INDEX_CONFIG, "write-tree"], {
|
|
80
|
+
env,
|
|
81
|
+
label: "write-tree",
|
|
82
|
+
progress,
|
|
83
|
+
})).stdout.trim();
|
|
84
|
+
if (!tree)
|
|
85
|
+
throw new WorkspaceError("transient diff write-tree returned no tree");
|
|
86
|
+
candidate = { tree, env };
|
|
87
|
+
const baseCommit = (await gitObserved(repo, ["rev-parse", "--verify", "--quiet", `${baseSha}^{commit}`], {
|
|
88
|
+
env,
|
|
89
|
+
label: "rev-parse base commit",
|
|
90
|
+
allowFailure: true,
|
|
91
|
+
})).stdout.trim();
|
|
92
|
+
const baseTree = await treeOf(repo, baseSha, env);
|
|
93
|
+
const objectFormat = await repositoryObjectFormat(repo, env);
|
|
94
|
+
const commit = /^[0-9a-f]{40,64}$/.test(baseCommit) ? baseCommit : null;
|
|
95
|
+
const boundaryCommit = await storeBoundaryCommit(repo, commit, env);
|
|
96
|
+
const result = makeGitObjectResult({
|
|
97
|
+
object_format: objectFormat,
|
|
98
|
+
base_tree: baseTree,
|
|
99
|
+
candidate_tree: tree,
|
|
100
|
+
base_commit: commit,
|
|
101
|
+
store_boundary_commit: boundaryCommit,
|
|
102
|
+
});
|
|
103
|
+
const nestedFacts = nested.length ? { excludedNestedRepositories: nested } : {};
|
|
104
|
+
if (baseTree === tree) {
|
|
105
|
+
return { patch: "", captureIncomplete: false, result, ...nestedFacts };
|
|
44
106
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
107
|
+
// Custody: the candidate tree, plus a dirty base snapshot's own closure.
|
|
108
|
+
const roots = [tree, ...(commit && boundaryCommit !== commit ? [commit] : [])];
|
|
109
|
+
await retainInObjectStore({
|
|
110
|
+
projectRoot,
|
|
111
|
+
source: { cwd: repo, env, objectsDir: objectDir },
|
|
112
|
+
roots,
|
|
113
|
+
boundary: boundaryCommit
|
|
114
|
+
? { commit: boundaryCommit, tree: await treeOf(repo, boundaryCommit, env) }
|
|
115
|
+
: null,
|
|
116
|
+
objectFormat,
|
|
117
|
+
owner: options.owner ?? projectRoot,
|
|
118
|
+
});
|
|
119
|
+
const estimate = await estimatePatchViewBytes(repo, baseSha, tree, env);
|
|
120
|
+
const view = estimate.bytes <= viewLimit
|
|
121
|
+
? await renderPatchView(repo, baseSha, tree, env)
|
|
122
|
+
: "exceeds_view_limit";
|
|
123
|
+
if (view === "exceeds_view_limit" || view === "render_failed") {
|
|
124
|
+
const inventory = await changedFileInventory(repo, baseSha, tree, env);
|
|
125
|
+
return {
|
|
126
|
+
patch: "",
|
|
127
|
+
captureIncomplete: false,
|
|
128
|
+
result,
|
|
129
|
+
patchViewUnavailable: {
|
|
130
|
+
reason: view,
|
|
131
|
+
limitBytes: viewLimit,
|
|
132
|
+
// A render that overflowed proves more than an estimate that fit; one
|
|
133
|
+
// that failed for another reason proves nothing about its size.
|
|
134
|
+
estimatedBytes: view === "render_failed" ? estimate.bytes : Math.max(estimate.bytes, viewLimit + 1),
|
|
135
|
+
},
|
|
136
|
+
...(inventory ? { inventory } : {}),
|
|
137
|
+
changedPaths: estimate.paths,
|
|
138
|
+
existingPaths: estimate.existingPaths,
|
|
139
|
+
...nestedFacts,
|
|
140
|
+
};
|
|
74
141
|
}
|
|
75
142
|
return {
|
|
76
|
-
patch:
|
|
77
|
-
binarySecretPaths: [...flagged],
|
|
143
|
+
patch: view,
|
|
78
144
|
captureIncomplete: false,
|
|
79
|
-
|
|
145
|
+
result,
|
|
146
|
+
...nestedFacts,
|
|
80
147
|
};
|
|
81
148
|
}
|
|
82
149
|
catch (error) {
|
|
83
150
|
primaryError = error;
|
|
84
|
-
|
|
85
|
-
|
|
151
|
+
// Before the scratch goes, a separate bounded pass over the same candidate
|
|
152
|
+
// tree names its largest changed files: diagnostic evidence only.
|
|
153
|
+
if (candidate && error instanceof Error && !Object.isFrozen(error)) {
|
|
154
|
+
const inventory = await changedFileInventory(repo, baseSha, candidate.tree, candidate.env);
|
|
155
|
+
if (inventory)
|
|
156
|
+
Object.defineProperty(error, "captureInventory", { value: inventory });
|
|
157
|
+
}
|
|
158
|
+
// Typed packaging failures (an overflow of a bounded read, no space, a
|
|
159
|
+
// stalled or signalled Git, a read error, a missing object) are an honest
|
|
160
|
+
// capture refusal; anything else stays a thrown workspace fault.
|
|
161
|
+
if (error instanceof CaptureOutputExceeded || error instanceof GitOperationError)
|
|
162
|
+
return { patch: "", captureIncomplete: true, captureFailure: error };
|
|
86
163
|
throw error;
|
|
87
164
|
}
|
|
88
165
|
finally {
|
|
166
|
+
// Never throws: a pending record that stays only delays a prune, and the
|
|
167
|
+
// scratch below is still removed under its own terminal rule.
|
|
168
|
+
const leaseFault = endPendingRoots(lease);
|
|
89
169
|
// Unlike ordinary best-effort scratch cleanup, this directory may contain
|
|
90
170
|
// a candidate token blob. A cleanup failure is therefore terminal and must
|
|
91
171
|
// never be hidden behind the original capture result.
|
|
@@ -119,6 +199,24 @@ export async function captureWorkingTreeTransient(repo, baseSha, pathExcludes =
|
|
|
119
199
|
}
|
|
120
200
|
}
|
|
121
201
|
}
|
|
202
|
+
// A failed capture's evidence also names a lease record that stayed, unless the
|
|
203
|
+
// scratch fault was recorded first.
|
|
204
|
+
noteCleanupFault(primaryError, leaseFault);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/** Today's patch of B..C, rendered under the view limit, else why there is none. A
|
|
208
|
+
* failed render costs only the view (the exact objects are already kept), never
|
|
209
|
+
* the capture: a timeout, a Git failure or a binary stub is a typed absence. */
|
|
210
|
+
async function renderPatchView(repo, base, tree, env) {
|
|
211
|
+
try {
|
|
212
|
+
const diff = await gitEnv(repo, [...PINNED_DIFF_CONFIG, "diff", "--binary", ...PINNED_DIFF_FLAGS, base, tree], env);
|
|
213
|
+
if (diff.code !== 0)
|
|
214
|
+
return "render_failed";
|
|
215
|
+
assertNoBinaryStubs(diff.stdout, `transient git diff ${base}`);
|
|
216
|
+
return diff.stdout;
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
return error instanceof CaptureOutputExceeded ? "exceeds_view_limit" : "render_failed";
|
|
122
220
|
}
|
|
123
221
|
}
|
|
124
222
|
export async function diffWorkingTreeTransient(repo, baseSha, pathExcludes = []) {
|
|
@@ -127,4 +225,19 @@ export async function diffWorkingTreeTransient(repo, baseSha, pathExcludes = [])
|
|
|
127
225
|
throw captured.captureFailure;
|
|
128
226
|
return captured.patch;
|
|
129
227
|
}
|
|
228
|
+
/** The capture's object-backed facts, carried unchanged to its consumers. */
|
|
229
|
+
export function captureObjectFacts(captured) {
|
|
230
|
+
return {
|
|
231
|
+
...(captured.result ? { result: captured.result } : {}),
|
|
232
|
+
...(captured.patchViewUnavailable
|
|
233
|
+
? { patchViewUnavailable: captured.patchViewUnavailable }
|
|
234
|
+
: {}),
|
|
235
|
+
...(captured.inventory ? { inventory: captured.inventory } : {}),
|
|
236
|
+
...(captured.changedPaths ? { changedPaths: captured.changedPaths } : {}),
|
|
237
|
+
...(captured.existingPaths ? { existingPaths: captured.existingPaths } : {}),
|
|
238
|
+
...(captured.excludedNestedRepositories
|
|
239
|
+
? { excludedNestedRepositories: captured.excludedNestedRepositories }
|
|
240
|
+
: {}),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
130
243
|
//# sourceMappingURL=git-transient-capture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-transient-capture.js","sourceRoot":"","sources":["../src/git-transient-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"git-transient-capture.js","sourceRoot":"","sources":["../src/git-transient-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,2BAA2B,EAC3B,qBAAqB,EACrB,cAAc,GACf,MA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,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,GAAG,CAAC,QAAQ,CAAC,0BAA0B;YACrC,CAAC,CAAC,EAAE,0BAA0B,EAAE,QAAQ,CAAC,0BAA0B,EAAE;YACrE,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
package/dist/git.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type EnsureGitRepositoryDependencies, type EnsureGitRepositoryResult } from "./git-initialization.js";
|
|
2
|
-
export { git } from "./git-run.js";
|
|
2
|
+
export { git, revParse } from "./git-run.js";
|
|
3
3
|
export { captureWorkingTreeTransient, diffWorkingTreeTransient } from "./git-transient-capture.js";
|
|
4
4
|
export { GitBoundaryRootRefusedError, GitInitializationError, type EnsureGitRepositoryDependencies, type EnsureGitRepositoryResult, } from "./git-initialization.js";
|
|
5
5
|
export declare function isGitRepo(repo: string): Promise<boolean>;
|
|
6
|
-
export declare function revParse(repo: string, ref: string): Promise<string>;
|
|
7
6
|
/**
|
|
8
7
|
* Make a project folder usable as a git boundary for write-mode runs.
|
|
9
8
|
*
|
|
@@ -19,23 +18,7 @@ export declare function revParse(repo: string, ref: string): Promise<string>;
|
|
|
19
18
|
*/
|
|
20
19
|
export declare function ensureGitRepository(repo: string, dependencies?: EnsureGitRepositoryDependencies): Promise<EnsureGitRepositoryResult>;
|
|
21
20
|
export declare function statusPorcelain(repo: string): Promise<string>;
|
|
22
|
-
|
|
23
|
-
* Capture the full dirty working tree (tracked AND untracked) as a dangling
|
|
24
|
-
* commit; null if clean. Plain `git stash create` captures only TRACKED
|
|
25
|
-
* changes, silently dropping the user's new-but-unstaged files from the run's
|
|
26
|
-
* base. We instead seed a scratch index from HEAD, `add -A` into it (which
|
|
27
|
-
* respects .gitignore, so run artifacts stay out), and commit-tree the result.
|
|
28
|
-
*/
|
|
29
|
-
export declare function stashCreate(repo: string): Promise<string | null>;
|
|
30
|
-
/**
|
|
31
|
-
* Capture the CURRENT working-tree state (tracked + untracked, minus `.claudexor`)
|
|
32
|
-
* as a commit sha — always returns one. Dirty trees become a dangling snapshot
|
|
33
|
-
* commit (via `stashCreate`); a clean tree resolves to HEAD. This is the per-turn
|
|
34
|
-
* diff base for in-place threads: snapshot at turn start, snapshot at turn end,
|
|
35
|
-
* `diffTrees(base, end)` yields exactly that turn's net change (pre-existing dirty
|
|
36
|
-
* state is folded into `base`, so the reviewer never sees prior turns' edits).
|
|
37
|
-
*/
|
|
38
|
-
export declare function snapshotTree(repo: string): Promise<string>;
|
|
21
|
+
export { snapshotTree, stashCreate } from "./git-snapshot.js";
|
|
39
22
|
/** Net diff between two tree-ish shas (used for in-place per-turn diffs).
|
|
40
23
|
* `--binary`: binary changes carry an APPLYABLE payload instead of
|
|
41
24
|
* degrading to a "Binary files differ" stub that silently loses the work. */
|
|
@@ -50,11 +33,45 @@ export declare function materializePatchTree(repo: string, baseSha: string, diff
|
|
|
50
33
|
export declare function worktreeAdd(repo: string, path: string, branch: string, baseSha: string): Promise<void>;
|
|
51
34
|
/** Disposable candidate checkout with private refs/index/objects. The source
|
|
52
35
|
* repository is only an object alternate, so harness `git add`/`commit` cannot
|
|
53
|
-
* write candidate blobs or refs into the user's repository.
|
|
54
|
-
|
|
36
|
+
* write candidate blobs or refs into the user's repository. Claudexor's own
|
|
37
|
+
* clone lists the project object store as a SECOND alternate (#535 D2): a
|
|
38
|
+
* dirty base resolves after the user's prune; the user repo never gets it. */
|
|
39
|
+
export declare function isolatedCloneAdd(repo: string, path: string, branch: string, baseSha: string, storeObjects?: string): Promise<void>;
|
|
55
40
|
/** Recreate a worktree for an EXISTING branch (recovery: dir lost, branch survived). */
|
|
56
41
|
export declare function worktreeAddExisting(repo: string, path: string, branch: string): Promise<void>;
|
|
42
|
+
/** Best-effort: Git's exit status is ignored. An owner that must not report a
|
|
43
|
+
* refused removal as done uses `worktreeRemoveRegistered`. */
|
|
57
44
|
export declare function worktreeRemove(repo: string, path: string): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Deregister the linked worktree Git records at `path`; Git deletes its
|
|
47
|
+
* directory too. A path Git does not register is already removed. A refusal
|
|
48
|
+
* (a locked worktree, an unreadable registration) throws and leaves the
|
|
49
|
+
* registration and the directory as they were. A directory Git cannot delete
|
|
50
|
+
* (a permission error) throws after Git deleted the registration: the
|
|
51
|
+
* directory stays, its `.git` file naming what is gone. The registration is
|
|
52
|
+
* found by `samePlace` and removed in Git's own spelling, so a stale one whose
|
|
53
|
+
* directory is gone still goes. Git prints porcelain paths unquoted, one per
|
|
54
|
+
* line, so a path holding a line break cannot be read back and is refused
|
|
55
|
+
* rather than reported absent. `beforeRemove` runs once Git is known to
|
|
56
|
+
* register the path, right before the removal.
|
|
57
|
+
*/
|
|
58
|
+
export declare function worktreeRemoveRegistered(repo: string, path: string, beforeRemove?: () => Promise<void>): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* The common Git directory of the repository that registered the linked
|
|
61
|
+
* worktree at `path`, from Git's own records: the worktree's `.git` file names
|
|
62
|
+
* its registration, which must still exist and name this worktree back. Null
|
|
63
|
+
* when `path` holds no such file. A registration that is gone or names another
|
|
64
|
+
* worktree is what a moved or deleted repository leaves, and also a removal
|
|
65
|
+
* that deleted the registration but not the directory
|
|
66
|
+
* (`worktreeRemoveRegistered`; a later worktree can take the freed name).
|
|
67
|
+
* `recorded`, called only then, tells them apart: the common Git directory a
|
|
68
|
+
* caller kept from before its removal is returned when the registration was
|
|
69
|
+
* in it. Otherwise this throws, since whatever a moved repository still
|
|
70
|
+
* records cannot be proven gone.
|
|
71
|
+
*/
|
|
72
|
+
export declare function worktreeRepository(path: string, recorded?: () => string | null): string | null;
|
|
73
|
+
/** The common Git directory of the repository `dir` is in; throws when Git cannot tell. */
|
|
74
|
+
export declare function gitCommonDir(dir: string): Promise<string>;
|
|
58
75
|
/**
|
|
59
76
|
* Apply a unified diff to a tree with a 3-way merge (race-winner adoption into
|
|
60
77
|
* the live in-place tree). Throws loudly on conflict so the caller can disclose
|
|
@@ -110,4 +127,12 @@ export declare function reversePatchAndIndexProtected(repo: string, diff: string
|
|
|
110
127
|
export declare function worktreePrune(repo: string): Promise<void>;
|
|
111
128
|
/** Delete a local branch (best-effort GC of per-attempt claudexor/* branches). */
|
|
112
129
|
export declare function branchDelete(repo: string, branch: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Delete a local branch, or throw when Git refuses (a held ref lock, a
|
|
132
|
+
* worktree that still uses it). An absent branch is already deleted. Presence
|
|
133
|
+
* is read first because `branch -D` reports "not found" and a refusal with the
|
|
134
|
+
* same exit code. `beforeDelete` runs only for a present branch, right before
|
|
135
|
+
* the deletion.
|
|
136
|
+
*/
|
|
137
|
+
export declare function branchDeleteIfPresent(repo: string, branch: string, beforeDelete?: () => Promise<void>): Promise<void>;
|
|
113
138
|
//# sourceMappingURL=git.d.ts.map
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,yBAAyB,EAC/B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,4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