@granular-software/fractory 0.0.0-stage → 0.1.25
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/LICENSE +4 -0
- package/README.md +28 -2
- package/dist/activity-volume.d.ts +18 -0
- package/dist/activity-volume.js +94 -0
- package/dist/annotations.d.ts +122 -0
- package/dist/annotations.js +304 -0
- package/dist/benchmark-cli.d.ts +1 -0
- package/dist/benchmark-cli.js +95 -0
- package/dist/benchmark-worker.d.ts +2 -0
- package/dist/benchmark-worker.js +22 -0
- package/dist/benchmarks.d.ts +19 -0
- package/dist/benchmarks.js +414 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +63 -0
- package/dist/block-cli.d.ts +1 -0
- package/dist/block-cli.js +88 -0
- package/dist/block-documents.d.ts +35 -0
- package/dist/block-documents.js +84 -0
- package/dist/change-impact.d.ts +55 -0
- package/dist/change-impact.js +223 -0
- package/dist/check-source.d.ts +2 -0
- package/dist/check-source.js +66 -0
- package/dist/checks-model.d.ts +64 -0
- package/dist/checks-model.js +36 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +359 -0
- package/dist/code-model.d.ts +38 -0
- package/dist/code-model.js +94 -0
- package/dist/code-store.d.ts +9 -0
- package/dist/code-store.js +79 -0
- package/dist/compare-artifact.d.ts +6 -0
- package/dist/compare-artifact.js +277 -0
- package/dist/compare.d.ts +81 -0
- package/dist/compare.js +291 -0
- package/dist/compiler.d.ts +10 -0
- package/dist/compiler.js +1240 -0
- package/dist/compose.d.ts +9 -0
- package/dist/compose.js +72 -0
- package/dist/core.d.ts +87 -0
- package/dist/core.js +207 -0
- package/dist/coverage-cli.d.ts +1 -0
- package/dist/coverage-cli.js +42 -0
- package/dist/declaration-sources.d.ts +3 -0
- package/dist/declaration-sources.js +51 -0
- package/dist/declared-graph.d.ts +3 -0
- package/dist/declared-graph.js +67 -0
- package/dist/display-name.d.ts +2 -0
- package/dist/display-name.js +8 -0
- package/dist/error-heat.d.ts +58 -0
- package/dist/error-heat.js +96 -0
- package/dist/evidence.d.ts +3 -0
- package/dist/evidence.js +68 -0
- package/dist/factory-graph.d.ts +7 -0
- package/dist/factory-graph.js +389 -0
- package/dist/factory-model.d.ts +111 -0
- package/dist/factory-model.js +1 -0
- package/dist/git-code.d.ts +47 -0
- package/dist/git-code.js +352 -0
- package/dist/git-refs.d.ts +4 -0
- package/dist/git-refs.js +37 -0
- package/dist/history-activity.d.ts +4 -0
- package/dist/history-activity.js +129 -0
- package/dist/history-churn.d.ts +36 -0
- package/dist/history-churn.js +302 -0
- package/dist/history-git.d.ts +21 -0
- package/dist/history-git.js +125 -0
- package/dist/history-ledger.d.ts +43 -0
- package/dist/history-ledger.js +450 -0
- package/dist/history-ownership.d.ts +10 -0
- package/dist/history-ownership.js +75 -0
- package/dist/history-source.d.ts +13 -0
- package/dist/history-source.js +100 -0
- package/dist/integrations-cli.d.ts +2 -0
- package/dist/integrations-cli.js +159 -0
- package/dist/interface-map.d.ts +15 -0
- package/dist/interface-map.js +125 -0
- package/dist/issue-cache.d.ts +9 -0
- package/dist/issue-cache.js +68 -0
- package/dist/issue-cli.d.ts +1 -0
- package/dist/issue-cli.js +89 -0
- package/dist/issue-links.d.ts +15 -0
- package/dist/issue-links.js +125 -0
- package/dist/linear-issues.d.ts +19 -0
- package/dist/linear-issues.js +124 -0
- package/dist/local-runtime.d.ts +8 -0
- package/dist/local-runtime.js +59 -0
- package/dist/map-activity.d.ts +73 -0
- package/dist/map-activity.js +234 -0
- package/dist/map-model.d.ts +5 -0
- package/dist/map-model.js +166 -0
- package/dist/map-quality.d.ts +20 -0
- package/dist/map-quality.js +61 -0
- package/dist/mapping-coverage.d.ts +87 -0
- package/dist/mapping-coverage.js +404 -0
- package/dist/model.d.ts +186 -0
- package/dist/model.js +66 -0
- package/dist/operation-benchmark-worker.d.ts +2 -0
- package/dist/operation-benchmark-worker.js +60 -0
- package/dist/operation-benchmark.d.ts +29 -0
- package/dist/operation-benchmark.js +1 -0
- package/dist/otel-metrics.d.ts +21 -0
- package/dist/otel-metrics.js +146 -0
- package/dist/performance-model.d.ts +185 -0
- package/dist/performance-model.js +396 -0
- package/dist/product-map.d.ts +71 -0
- package/dist/product-map.js +197 -0
- package/dist/provider-access.cjs +207 -0
- package/dist/provider-access.d.cts +14 -0
- package/dist/public-boundaries.d.ts +13 -0
- package/dist/public-boundaries.js +115 -0
- package/dist/reports-cli.d.ts +1 -0
- package/dist/reports-cli.js +111 -0
- package/dist/reports-model.d.ts +27 -0
- package/dist/reports-model.js +39 -0
- package/dist/reports.d.ts +23 -0
- package/dist/reports.js +223 -0
- package/dist/repository-map.d.ts +22 -0
- package/dist/repository-map.js +153 -0
- package/dist/resource-cache.d.ts +17 -0
- package/dist/resource-cache.js +65 -0
- package/dist/review-cli.d.ts +19 -0
- package/dist/review-cli.js +224 -0
- package/dist/review.d.ts +48 -0
- package/dist/review.js +289 -0
- package/dist/runtime-metrics.d.ts +26 -0
- package/dist/runtime-metrics.js +290 -0
- package/dist/scope.d.ts +14 -0
- package/dist/scope.js +168 -0
- package/dist/sentry-activity.d.ts +39 -0
- package/dist/sentry-activity.js +174 -0
- package/dist/sentry.d.ts +130 -0
- package/dist/sentry.js +369 -0
- package/dist/service-release.d.ts +16 -0
- package/dist/service-release.js +14 -0
- package/dist/setup-cli.d.ts +2 -0
- package/dist/setup-cli.js +52 -0
- package/dist/setup-kit.cjs +163 -0
- package/dist/setup-kit.d.cts +32 -0
- package/dist/source-index.d.ts +37 -0
- package/dist/source-index.js +170 -0
- package/dist/source-review-git.d.ts +7 -0
- package/dist/source-review-git.js +105 -0
- package/dist/source-review.d.ts +18 -0
- package/dist/source-review.js +573 -0
- package/dist/telemetry.d.ts +17 -0
- package/dist/telemetry.js +51 -0
- package/dist/time-window.d.ts +9 -0
- package/dist/time-window.js +35 -0
- package/dist/trace-evidence.d.ts +23 -0
- package/dist/trace-evidence.js +55 -0
- package/dist/trace-model.d.ts +26 -0
- package/dist/trace-model.js +1 -0
- package/dist/tracing.d.ts +44 -0
- package/dist/tracing.js +123 -0
- package/dist/work-check.d.ts +18 -0
- package/dist/work-check.js +115 -0
- package/dist/work-cli.d.ts +1 -0
- package/dist/work-cli.js +176 -0
- package/dist/work-context.d.ts +59 -0
- package/dist/work-context.js +594 -0
- package/dist/work-intents.d.ts +6 -0
- package/dist/work-intents.js +140 -0
- package/dist/work-items.d.ts +58 -0
- package/dist/work-items.js +86 -0
- package/dist/work-lock-check.d.ts +12 -0
- package/dist/work-lock-check.js +339 -0
- package/dist/work-locks.d.ts +10 -0
- package/dist/work-locks.js +98 -0
- package/dist/work-model.d.ts +119 -0
- package/dist/work-model.js +310 -0
- package/dist/work-review-git.d.ts +8 -0
- package/dist/work-review-git.js +111 -0
- package/dist/work-review.d.ts +26 -0
- package/dist/work-review.js +426 -0
- package/dist/work-switcher-model.d.ts +43 -0
- package/dist/work-switcher-model.js +79 -0
- package/dist/work-switcher.d.ts +6 -0
- package/dist/work-switcher.js +171 -0
- package/dist/working-cli.d.ts +1 -0
- package/dist/working-cli.js +33 -0
- package/dist/working-code.d.ts +74 -0
- package/dist/working-code.js +421 -0
- package/dist/workspace-notes.d.ts +71 -0
- package/dist/workspace-notes.js +177 -0
- package/dist/workspace-tests.d.ts +21 -0
- package/dist/workspace-tests.js +573 -0
- package/package.json +547 -4
- package/src/activity-volume.ts +149 -0
- package/src/annotations.ts +485 -0
- package/src/benchmark-cli.ts +118 -0
- package/src/benchmark-worker.ts +22 -0
- package/src/benchmarks.ts +493 -0
- package/src/bin.ts +54 -0
- package/src/block-cli.ts +106 -0
- package/src/block-documents.ts +117 -0
- package/src/change-impact.ts +280 -0
- package/src/check-source.ts +82 -0
- package/src/checks-model.ts +108 -0
- package/src/cli.ts +440 -0
- package/src/code-model.ts +159 -0
- package/src/code-store.ts +98 -0
- package/src/compare-artifact.ts +314 -0
- package/src/compare.ts +440 -0
- package/src/compiler.ts +1512 -0
- package/src/compose.ts +94 -0
- package/src/core.ts +361 -0
- package/src/coverage-cli.ts +52 -0
- package/src/declaration-sources.ts +69 -0
- package/src/declared-graph.ts +75 -0
- package/src/display-name.ts +8 -0
- package/src/error-heat.ts +161 -0
- package/src/evidence.ts +94 -0
- package/src/factory-graph.ts +462 -0
- package/src/factory-model.ts +82 -0
- package/src/git-code.ts +461 -0
- package/src/git-refs.ts +43 -0
- package/src/history-activity.ts +146 -0
- package/src/history-churn.ts +416 -0
- package/src/history-git.ts +163 -0
- package/src/history-ledger.ts +636 -0
- package/src/history-ownership.ts +116 -0
- package/src/history-source.ts +117 -0
- package/src/integrations-cli.ts +187 -0
- package/src/interface-map.ts +166 -0
- package/src/issue-cache.ts +96 -0
- package/src/issue-cli.ts +137 -0
- package/src/issue-links.ts +153 -0
- package/src/linear-issues.ts +154 -0
- package/src/local-runtime.ts +70 -0
- package/src/map-activity.ts +309 -0
- package/src/map-model.ts +213 -0
- package/src/map-quality.ts +66 -0
- package/src/mapping-coverage.ts +570 -0
- package/src/model.ts +228 -0
- package/src/operation-benchmark-worker.ts +60 -0
- package/src/operation-benchmark.ts +28 -0
- package/src/otel-metrics.ts +176 -0
- package/src/performance-model.ts +575 -0
- package/src/product-map.ts +271 -0
- package/src/provider-access.cjs +207 -0
- package/src/provider-access.d.cts +14 -0
- package/src/public-boundaries.ts +143 -0
- package/src/reports-cli.ts +125 -0
- package/src/reports-model.ts +73 -0
- package/src/reports.ts +276 -0
- package/src/repository-map.ts +191 -0
- package/src/resource-cache.ts +76 -0
- package/src/review-cli.ts +256 -0
- package/src/review.ts +376 -0
- package/src/runtime-metrics.ts +386 -0
- package/src/scope.ts +192 -0
- package/src/sentry-activity.ts +234 -0
- package/src/sentry.ts +545 -0
- package/src/service-release.ts +18 -0
- package/src/setup-cli.ts +58 -0
- package/src/setup-kit.cjs +163 -0
- package/src/setup-kit.d.cts +32 -0
- package/src/source-index.ts +208 -0
- package/src/source-review-git.ts +131 -0
- package/src/source-review.ts +736 -0
- package/src/telemetry.ts +68 -0
- package/src/time-window.ts +51 -0
- package/src/trace-evidence.ts +80 -0
- package/src/trace-model.ts +26 -0
- package/src/tracing.ts +165 -0
- package/src/work-check.ts +149 -0
- package/src/work-cli.ts +229 -0
- package/src/work-context.ts +753 -0
- package/src/work-intents.ts +196 -0
- package/src/work-items.ts +151 -0
- package/src/work-lock-check.ts +549 -0
- package/src/work-locks.ts +108 -0
- package/src/work-model.ts +466 -0
- package/src/work-review-git.ts +130 -0
- package/src/work-review.ts +573 -0
- package/src/work-switcher-model.ts +121 -0
- package/src/work-switcher.ts +191 -0
- package/src/working-cli.ts +38 -0
- package/src/working-code.ts +582 -0
- package/src/workspace-notes.ts +203 -0
- package/src/workspace-tests.ts +654 -0
- package/toolkit/GUIDE.md +354 -0
- package/toolkit/SKILL.md +142 -0
- package/toolkit/bin/fractory +2 -0
- package/toolkit/build.json +1 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/** Read-only, bounded Git adapter for live edits. No compiler, source graph builder or application imports. */
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import { realpath, lstat } from "node:fs/promises";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
const execute = promisify(execFile);
|
|
8
|
+
const identifier = (path) => createHash("sha256").update(path).digest("hex").slice(0, 20);
|
|
9
|
+
async function git(root, args) {
|
|
10
|
+
const { stdout } = await execute("git", [
|
|
11
|
+
"--no-pager",
|
|
12
|
+
"-c",
|
|
13
|
+
"core.quotePath=false",
|
|
14
|
+
"-c",
|
|
15
|
+
"core.fsmonitor=false",
|
|
16
|
+
...args,
|
|
17
|
+
], {
|
|
18
|
+
cwd: root,
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
timeout: 8_000,
|
|
21
|
+
maxBuffer: 2 * 1024 * 1024,
|
|
22
|
+
env: {
|
|
23
|
+
...process.env,
|
|
24
|
+
GIT_OPTIONAL_LOCKS: "0",
|
|
25
|
+
GIT_LITERAL_PATHSPECS: "1",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return stdout;
|
|
29
|
+
}
|
|
30
|
+
/** Exact saved files for a worktree review. No scan of sibling checkouts and no directory placeholders. */
|
|
31
|
+
export async function currentWorkingPaths(root) {
|
|
32
|
+
const paths = parseWorkingStatus(await git(root, [
|
|
33
|
+
"status",
|
|
34
|
+
"--porcelain=v2",
|
|
35
|
+
"-z",
|
|
36
|
+
"--untracked-files=all",
|
|
37
|
+
"--no-renames",
|
|
38
|
+
]));
|
|
39
|
+
if (paths.length > 20000)
|
|
40
|
+
throw Error("This worktree exceeds the 20,000-file review budget; no partial comparison was returned.");
|
|
41
|
+
for (let at = 0; at < paths.length; at += 32)
|
|
42
|
+
await Promise.all(paths.slice(at, at + 32).map(async (file) => {
|
|
43
|
+
try {
|
|
44
|
+
file.modifiedAt = (await lstat(resolve(root, file.path))).mtime.toISOString();
|
|
45
|
+
}
|
|
46
|
+
catch { }
|
|
47
|
+
}));
|
|
48
|
+
return paths;
|
|
49
|
+
}
|
|
50
|
+
export function parseWorkingStatus(output) {
|
|
51
|
+
const parts = output.split("\0"), paths = [];
|
|
52
|
+
for (let i = 0; i < parts.length; i++) {
|
|
53
|
+
const row = parts[i];
|
|
54
|
+
if (!row || row.startsWith("# "))
|
|
55
|
+
continue;
|
|
56
|
+
if (row.startsWith("? ")) {
|
|
57
|
+
const path = row.slice(2);
|
|
58
|
+
paths.push({
|
|
59
|
+
path,
|
|
60
|
+
index: ".",
|
|
61
|
+
working: ".",
|
|
62
|
+
kind: path.endsWith("/") ? "directory" : "file",
|
|
63
|
+
untracked: true,
|
|
64
|
+
conflict: false,
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const fields = row.split(" "), type = fields[0];
|
|
69
|
+
if (!["1", "2", "u"].includes(type))
|
|
70
|
+
continue;
|
|
71
|
+
const path = fields
|
|
72
|
+
.slice(type === "u" ? 10 : type === "2" ? 9 : 8)
|
|
73
|
+
.join(" ");
|
|
74
|
+
if (!path)
|
|
75
|
+
throw Error("Incomplete Git status record");
|
|
76
|
+
paths.push({
|
|
77
|
+
path,
|
|
78
|
+
index: fields[1][0],
|
|
79
|
+
indexRevision: identifier(fields.slice(type === "u" ? 7 : 6, type === "u" ? 10 : 8).join(" ")),
|
|
80
|
+
working: fields[1][1],
|
|
81
|
+
kind: fields[2].startsWith("S") ? "submodule" : "file",
|
|
82
|
+
untracked: false,
|
|
83
|
+
conflict: type === "u",
|
|
84
|
+
...(type === "2" ? { originalPath: parts[++i] } : {}),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return paths;
|
|
88
|
+
}
|
|
89
|
+
async function trees(root) {
|
|
90
|
+
const current = await realpath((await git(root, ["rev-parse", "--show-toplevel"])).trim());
|
|
91
|
+
const common = await realpath(resolve(root, (await git(root, ["rev-parse", "--git-common-dir"])).trim()));
|
|
92
|
+
const records = (await git(root, ["worktree", "list", "--porcelain", "-z"]))
|
|
93
|
+
.split("\0\0")
|
|
94
|
+
.filter(Boolean);
|
|
95
|
+
return {
|
|
96
|
+
current,
|
|
97
|
+
common,
|
|
98
|
+
entries: records.flatMap((record) => {
|
|
99
|
+
const fields = record.split("\0"), path = fields.find((v) => v.startsWith("worktree "))?.slice(9);
|
|
100
|
+
if (!path || fields.includes("bare"))
|
|
101
|
+
return [];
|
|
102
|
+
return [
|
|
103
|
+
{
|
|
104
|
+
path,
|
|
105
|
+
head: fields.find((v) => v.startsWith("HEAD "))?.slice(5) || null,
|
|
106
|
+
branch: fields
|
|
107
|
+
.find((v) => v.startsWith("branch "))
|
|
108
|
+
?.slice(7)
|
|
109
|
+
.replace(/^refs\/heads\//, "") || null,
|
|
110
|
+
locked: fields.some((v) => v === "locked" || v.startsWith("locked ")),
|
|
111
|
+
prunable: fields.some((v) => v === "prunable" || v.startsWith("prunable ")),
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
async function scanOne(tree, current, common) {
|
|
118
|
+
let paths = [], unavailable, currentTree = false;
|
|
119
|
+
try {
|
|
120
|
+
currentTree = (await realpath(tree.path)) === current;
|
|
121
|
+
if (tree.prunable)
|
|
122
|
+
throw Error("prunable");
|
|
123
|
+
if ((await realpath(resolve(tree.path, (await git(tree.path, ["rev-parse", "--git-common-dir"])).trim()))) !== common)
|
|
124
|
+
throw Error("Worktree belongs to another repository");
|
|
125
|
+
const status = await git(tree.path, [
|
|
126
|
+
"status",
|
|
127
|
+
"--porcelain=v2",
|
|
128
|
+
"-z",
|
|
129
|
+
"--branch",
|
|
130
|
+
"--untracked-files=normal",
|
|
131
|
+
"--no-renames",
|
|
132
|
+
]);
|
|
133
|
+
paths = parseWorkingStatus(status);
|
|
134
|
+
// Metadata only, bounded to the paths shown. A repeated edit to an already-dirty
|
|
135
|
+
// file must be visible without hashing source or compiling on each poll.
|
|
136
|
+
const shown = paths.slice(0, 500);
|
|
137
|
+
for (let at = 0; at < shown.length; at += 32)
|
|
138
|
+
await Promise.all(shown.slice(at, at + 32).map(async (file) => {
|
|
139
|
+
if (file.path.startsWith("/") || file.path.split("/").includes(".."))
|
|
140
|
+
return;
|
|
141
|
+
try {
|
|
142
|
+
file.modifiedAt = (await lstat(resolve(tree.path, file.path))).mtime.toISOString();
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
/* A deletion has no mtime. */
|
|
146
|
+
}
|
|
147
|
+
}));
|
|
148
|
+
const headers = status.split("\0").filter((row) => row.startsWith("# "));
|
|
149
|
+
const oid = headers
|
|
150
|
+
.find((row) => row.startsWith("# branch.oid "))
|
|
151
|
+
?.slice(13);
|
|
152
|
+
const branch = headers
|
|
153
|
+
.find((row) => row.startsWith("# branch.head "))
|
|
154
|
+
?.slice(14);
|
|
155
|
+
tree = {
|
|
156
|
+
...tree,
|
|
157
|
+
head: oid && oid !== "(initial)" ? oid : null,
|
|
158
|
+
branch: branch && branch !== "(detached)" ? branch : null,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
unavailable = "Checkout unavailable or Git status exceeded its read budget";
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
id: identifier(tree.path),
|
|
166
|
+
path: tree.path,
|
|
167
|
+
branch: tree.branch,
|
|
168
|
+
head: tree.head && !/^0+$/.test(tree.head) ? tree.head : null,
|
|
169
|
+
current: currentTree,
|
|
170
|
+
checkedAt: new Date().toISOString(),
|
|
171
|
+
locked: tree.locked,
|
|
172
|
+
...(unavailable ? { unavailable } : {}),
|
|
173
|
+
changed: unavailable ? null : paths.length,
|
|
174
|
+
staged: unavailable
|
|
175
|
+
? null
|
|
176
|
+
: paths.filter((p) => !p.untracked && !p.conflict && p.index !== ".")
|
|
177
|
+
.length,
|
|
178
|
+
unstaged: unavailable
|
|
179
|
+
? null
|
|
180
|
+
: paths.filter((p) => !p.untracked && !p.conflict && p.working !== ".")
|
|
181
|
+
.length,
|
|
182
|
+
conflicts: unavailable ? null : paths.filter((p) => p.conflict).length,
|
|
183
|
+
untracked: unavailable ? null : paths.filter((p) => p.untracked).length,
|
|
184
|
+
paths: unavailable ? [] : paths,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
async function scan(root, previous) {
|
|
188
|
+
const { current, common, entries } = await trees(root);
|
|
189
|
+
// Resolve only directory metadata so a symlinked current checkout is never excluded by the cap.
|
|
190
|
+
const currentPaths = new Set((await Promise.all(entries.map(async (e) => {
|
|
191
|
+
try {
|
|
192
|
+
return (await realpath(e.path)) === current ? e.path : undefined;
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return undefined;
|
|
196
|
+
}
|
|
197
|
+
}))).filter((p) => !!p));
|
|
198
|
+
entries.sort((a, b) => Number(currentPaths.has(b.path)) - Number(currentPaths.has(a.path)));
|
|
199
|
+
const before = new Map(previous?.worktrees.map((tree) => [tree.id, tree]) || []);
|
|
200
|
+
// Listing worktrees must not trigger a status walk of every checkout.
|
|
201
|
+
const result = entries.slice(0, 128).map((tree) => {
|
|
202
|
+
const id = identifier(tree.path);
|
|
203
|
+
const head = tree.head && !/^0+$/.test(tree.head) ? tree.head : null;
|
|
204
|
+
const cached = before.get(id);
|
|
205
|
+
if (cached &&
|
|
206
|
+
cached.head === head &&
|
|
207
|
+
cached.branch === tree.branch &&
|
|
208
|
+
!tree.prunable)
|
|
209
|
+
return {
|
|
210
|
+
...cached,
|
|
211
|
+
current: currentPaths.has(tree.path),
|
|
212
|
+
locked: tree.locked,
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
id,
|
|
216
|
+
path: tree.path,
|
|
217
|
+
head,
|
|
218
|
+
branch: tree.branch,
|
|
219
|
+
locked: tree.locked,
|
|
220
|
+
current: currentPaths.has(tree.path),
|
|
221
|
+
checkedAt: null,
|
|
222
|
+
changed: null,
|
|
223
|
+
staged: null,
|
|
224
|
+
unstaged: null,
|
|
225
|
+
conflicts: null,
|
|
226
|
+
untracked: null,
|
|
227
|
+
paths: [],
|
|
228
|
+
...(tree.prunable
|
|
229
|
+
? { unavailable: "Checkout is no longer available" }
|
|
230
|
+
: {}),
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
return {
|
|
234
|
+
checkedAt: new Date().toISOString(),
|
|
235
|
+
current,
|
|
236
|
+
common,
|
|
237
|
+
worktrees: result,
|
|
238
|
+
omittedWorktrees: Math.max(0, entries.length - result.length),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const scans = new Map();
|
|
242
|
+
async function cachedScan(root, fresh) {
|
|
243
|
+
root = await realpath(root);
|
|
244
|
+
const existing = scans.get(root);
|
|
245
|
+
if (existing &&
|
|
246
|
+
(existing.pending || (!fresh && Date.now() - existing.at < 30_000)))
|
|
247
|
+
return existing.value;
|
|
248
|
+
const value = (async () => {
|
|
249
|
+
const previous = existing
|
|
250
|
+
? await existing.value.catch(() => undefined)
|
|
251
|
+
: undefined;
|
|
252
|
+
return scan(root, previous);
|
|
253
|
+
})();
|
|
254
|
+
const entry = { at: Date.now(), pending: true, value };
|
|
255
|
+
scans.set(root, entry);
|
|
256
|
+
try {
|
|
257
|
+
return await value;
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
if (scans.get(root)?.value === value)
|
|
261
|
+
scans.delete(root);
|
|
262
|
+
throw error;
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
entry.pending = false;
|
|
266
|
+
entry.at = Date.now();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
const activeReads = new Map();
|
|
270
|
+
export async function workingOverview(root, options = {}) {
|
|
271
|
+
const value = await cachedScan(root, !!options.fresh);
|
|
272
|
+
let selected = options.worktree
|
|
273
|
+
? value.worktrees.find((t) => t.id === options.worktree)
|
|
274
|
+
: value.worktrees.find((t) => t.current);
|
|
275
|
+
if (!selected)
|
|
276
|
+
throw Error("Unknown repository worktree");
|
|
277
|
+
if (options.fresh ||
|
|
278
|
+
options.refreshSelected ||
|
|
279
|
+
!selected.checkedAt ||
|
|
280
|
+
Date.now() - Date.parse(selected.checkedAt) > 2_000) {
|
|
281
|
+
const index = value.worktrees.indexOf(selected);
|
|
282
|
+
const key = value.common + "\0" + value.current + "\0" + selected.id;
|
|
283
|
+
let pending = activeReads.get(key);
|
|
284
|
+
if (!pending) {
|
|
285
|
+
pending = scanOne({ ...selected, prunable: false }, value.current, value.common);
|
|
286
|
+
activeReads.set(key, pending);
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
selected = await pending;
|
|
290
|
+
}
|
|
291
|
+
finally {
|
|
292
|
+
if (activeReads.get(key) === pending)
|
|
293
|
+
activeReads.delete(key);
|
|
294
|
+
}
|
|
295
|
+
value.worktrees[index] = selected;
|
|
296
|
+
}
|
|
297
|
+
const selectedId = selected.id;
|
|
298
|
+
const worktrees = value.worktrees.map(({ paths, ...tree }) => tree.id !== selectedId &&
|
|
299
|
+
tree.checkedAt &&
|
|
300
|
+
Date.now() - Date.parse(tree.checkedAt) > 30_000
|
|
301
|
+
? {
|
|
302
|
+
...tree,
|
|
303
|
+
stale: true,
|
|
304
|
+
changed: null,
|
|
305
|
+
staged: null,
|
|
306
|
+
unstaged: null,
|
|
307
|
+
conflicts: null,
|
|
308
|
+
untracked: null,
|
|
309
|
+
}
|
|
310
|
+
: tree);
|
|
311
|
+
const paths = options.allPaths
|
|
312
|
+
? selected.paths
|
|
313
|
+
: selected.paths.slice(0, 500);
|
|
314
|
+
return {
|
|
315
|
+
checkedAt: selected.checkedAt || value.checkedAt,
|
|
316
|
+
worktreesCheckedAt: value.checkedAt,
|
|
317
|
+
revision: identifier(JSON.stringify({ worktrees, paths })),
|
|
318
|
+
attribution: "worktree",
|
|
319
|
+
worktrees,
|
|
320
|
+
selected: selected.id,
|
|
321
|
+
paths,
|
|
322
|
+
truncated: selected.changed !== null && selected.changed > paths.length,
|
|
323
|
+
omittedWorktrees: value.omittedWorktrees,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
function parseHunks(patch) {
|
|
327
|
+
return patch.split("\n").flatMap((line) => {
|
|
328
|
+
const m = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/.exec(line);
|
|
329
|
+
return m
|
|
330
|
+
? [
|
|
331
|
+
{
|
|
332
|
+
beforeStart: Number(m[1]),
|
|
333
|
+
beforeCount: Number(m[2] ?? 1),
|
|
334
|
+
afterStart: Number(m[3]),
|
|
335
|
+
afterCount: Number(m[4] ?? 1),
|
|
336
|
+
},
|
|
337
|
+
]
|
|
338
|
+
: [];
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
export async function workingDetail(root, worktree, file) {
|
|
342
|
+
if (!file ||
|
|
343
|
+
file.includes("\0") ||
|
|
344
|
+
file.startsWith("/") ||
|
|
345
|
+
file.split(/[\\/]/).includes(".."))
|
|
346
|
+
throw Error("Expected a changed repository path");
|
|
347
|
+
const inventory = await trees(root), tree = inventory.entries.find((t) => identifier(t.path) === worktree);
|
|
348
|
+
if (!tree || tree.prunable)
|
|
349
|
+
throw Error("Unknown or unavailable worktree");
|
|
350
|
+
if ((await realpath(resolve(tree.path, (await git(tree.path, ["rev-parse", "--git-common-dir"])).trim()))) !== inventory.common)
|
|
351
|
+
throw Error("Worktree belongs to another repository");
|
|
352
|
+
const paths = parseWorkingStatus(await git(tree.path, [
|
|
353
|
+
"status",
|
|
354
|
+
"--porcelain=v2",
|
|
355
|
+
"-z",
|
|
356
|
+
"--untracked-files=normal",
|
|
357
|
+
"--no-renames",
|
|
358
|
+
]));
|
|
359
|
+
const path = paths.find((p) => p.path === file);
|
|
360
|
+
// An expanded untracked directory may contain this file; Git must confirm membership below.
|
|
361
|
+
const directory = paths.find((p) => p.untracked && p.kind === "directory" && file.startsWith(p.path));
|
|
362
|
+
if (!path && !directory)
|
|
363
|
+
throw Error("This path is no longer changed; refresh the working view");
|
|
364
|
+
if (path?.conflict) {
|
|
365
|
+
const records = (await git(tree.path, ["ls-files", "--unmerged", "-z", "--", file]))
|
|
366
|
+
.split("\0")
|
|
367
|
+
.filter(Boolean);
|
|
368
|
+
const stages = [
|
|
369
|
+
...new Set(records.map((record) => Number(record.split("\t")[0].split(" ")[2]))),
|
|
370
|
+
]
|
|
371
|
+
.filter((stage) => [1, 2, 3].includes(stage))
|
|
372
|
+
.sort();
|
|
373
|
+
return {
|
|
374
|
+
path: file,
|
|
375
|
+
untracked: false,
|
|
376
|
+
conflict: { stages },
|
|
377
|
+
truncated: false,
|
|
378
|
+
layers: [],
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
if (path?.untracked || directory) {
|
|
382
|
+
const members = (await git(tree.path, [
|
|
383
|
+
"ls-files",
|
|
384
|
+
"--others",
|
|
385
|
+
"--exclude-standard",
|
|
386
|
+
"-z",
|
|
387
|
+
"--",
|
|
388
|
+
file,
|
|
389
|
+
]))
|
|
390
|
+
.split("\0")
|
|
391
|
+
.filter(Boolean);
|
|
392
|
+
if (!members.length)
|
|
393
|
+
throw Error("This untracked path is no longer available");
|
|
394
|
+
return {
|
|
395
|
+
path: file,
|
|
396
|
+
untracked: true,
|
|
397
|
+
members: members.slice(0, 500),
|
|
398
|
+
truncated: members.length > 500,
|
|
399
|
+
layers: [],
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const layers = await Promise.all(["staged", "unstaged"].map(async (layer) => {
|
|
403
|
+
const patch = await git(tree.path, [
|
|
404
|
+
"diff",
|
|
405
|
+
...(layer === "staged" ? ["--cached"] : []),
|
|
406
|
+
"--no-ext-diff",
|
|
407
|
+
"--no-textconv",
|
|
408
|
+
"--no-renames",
|
|
409
|
+
"--no-color",
|
|
410
|
+
"--unified=0",
|
|
411
|
+
"--",
|
|
412
|
+
file,
|
|
413
|
+
]);
|
|
414
|
+
return {
|
|
415
|
+
layer,
|
|
416
|
+
binary: /^Binary files |^GIT binary patch/m.test(patch),
|
|
417
|
+
hunks: parseHunks(patch),
|
|
418
|
+
};
|
|
419
|
+
}));
|
|
420
|
+
return { path: file, untracked: false, truncated: false, layers };
|
|
421
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { DefinitionGraph } from "./model.js";
|
|
2
|
+
export declare class WorkspaceConflict extends Error {
|
|
3
|
+
}
|
|
4
|
+
export declare const noteRevision: (body: string) => string;
|
|
5
|
+
export declare function checkedPath(root: string, file: string, create?: boolean): string;
|
|
6
|
+
export declare function blockNoteFile(block: string): string;
|
|
7
|
+
export declare function blockNotes(graph: DefinitionGraph, block: string, root?: string): {
|
|
8
|
+
file: string;
|
|
9
|
+
label: string;
|
|
10
|
+
owner: string;
|
|
11
|
+
inherited: boolean;
|
|
12
|
+
}[];
|
|
13
|
+
export declare function readBlockNote(root: string, graph: DefinitionGraph, block: string, file?: string): {
|
|
14
|
+
documents: {
|
|
15
|
+
label: string;
|
|
16
|
+
exists: boolean;
|
|
17
|
+
file: string;
|
|
18
|
+
owner: string;
|
|
19
|
+
inherited: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
file: string;
|
|
22
|
+
body: string;
|
|
23
|
+
revision: null;
|
|
24
|
+
} | {
|
|
25
|
+
documents: {
|
|
26
|
+
label: string;
|
|
27
|
+
exists: boolean;
|
|
28
|
+
file: string;
|
|
29
|
+
owner: string;
|
|
30
|
+
inherited: boolean;
|
|
31
|
+
}[];
|
|
32
|
+
file: string;
|
|
33
|
+
body: string;
|
|
34
|
+
revision: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function saveBlockNote(root: string, graph: DefinitionGraph, block: string, file: string, body: string, revision: string | null): {
|
|
37
|
+
documents: {
|
|
38
|
+
label: string;
|
|
39
|
+
exists: boolean;
|
|
40
|
+
file: string;
|
|
41
|
+
owner: string;
|
|
42
|
+
inherited: boolean;
|
|
43
|
+
}[];
|
|
44
|
+
file: string;
|
|
45
|
+
body: string;
|
|
46
|
+
revision: null;
|
|
47
|
+
} | {
|
|
48
|
+
documents: {
|
|
49
|
+
label: string;
|
|
50
|
+
exists: boolean;
|
|
51
|
+
file: string;
|
|
52
|
+
owner: string;
|
|
53
|
+
inherited: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
file: string;
|
|
56
|
+
body: string;
|
|
57
|
+
revision: string;
|
|
58
|
+
};
|
|
59
|
+
/** Read a reference without checking it out or borrowing uncommitted Markdown. */
|
|
60
|
+
export declare function readBlockNoteAt(root: string, graph: DefinitionGraph, block: string, ref: string, file?: string): {
|
|
61
|
+
documents: {
|
|
62
|
+
exists: boolean;
|
|
63
|
+
label: string;
|
|
64
|
+
file: string;
|
|
65
|
+
owner: string;
|
|
66
|
+
inherited: boolean;
|
|
67
|
+
}[];
|
|
68
|
+
file: string;
|
|
69
|
+
body: string;
|
|
70
|
+
revision: string | null;
|
|
71
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { readGit } from "./git-refs.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
export class WorkspaceConflict extends Error {
|
|
6
|
+
}
|
|
7
|
+
export const noteRevision = (body) => createHash("sha256").update(body).digest("hex");
|
|
8
|
+
export function checkedPath(root, file, create = false) {
|
|
9
|
+
if (isAbsolute(file) || file.includes("\\") || file.includes("\0"))
|
|
10
|
+
throw Error("Invalid repository path");
|
|
11
|
+
const base = realpathSync(root), path = resolve(base, file);
|
|
12
|
+
if (!relative(base, path) || relative(base, path).startsWith(".."))
|
|
13
|
+
throw Error("Path must stay in the repository");
|
|
14
|
+
let current = path;
|
|
15
|
+
while (!existsSync(current))
|
|
16
|
+
current = dirname(current);
|
|
17
|
+
const resolved = realpathSync(current);
|
|
18
|
+
if (relative(base, resolved).startsWith("..") ||
|
|
19
|
+
isAbsolute(relative(base, resolved)))
|
|
20
|
+
throw Error("Linked path leaves the repository");
|
|
21
|
+
if (existsSync(path) && lstatSync(path).isSymbolicLink())
|
|
22
|
+
throw Error("Edit the original file instead of a symlink");
|
|
23
|
+
if (!create && !existsSync(path))
|
|
24
|
+
throw Error("File no longer exists");
|
|
25
|
+
return path;
|
|
26
|
+
}
|
|
27
|
+
export function blockNoteFile(block) {
|
|
28
|
+
const slug = block
|
|
29
|
+
.split("/")
|
|
30
|
+
.at(-1)
|
|
31
|
+
.replace(/[^a-zA-Z0-9_-]/g, "-")
|
|
32
|
+
.slice(0, 48);
|
|
33
|
+
return `docs/fractory/blocks/${slug}-${noteRevision(block).slice(0, 12)}.md`;
|
|
34
|
+
}
|
|
35
|
+
export function blockNotes(graph, block, root) {
|
|
36
|
+
const byId = new Map(graph.elements.map((n) => [n.id, n]));
|
|
37
|
+
const owner = byId.get(block);
|
|
38
|
+
if (!owner)
|
|
39
|
+
throw Error("Unknown block");
|
|
40
|
+
const own = blockNoteFile(block);
|
|
41
|
+
const documents = [
|
|
42
|
+
{ file: own, label: "Block notes", owner: block, inherited: false },
|
|
43
|
+
];
|
|
44
|
+
const seen = new Set([own]);
|
|
45
|
+
if (root) {
|
|
46
|
+
const directory = own.replace(/\.md$/, "");
|
|
47
|
+
try {
|
|
48
|
+
for (const name of readdirSync(checkedPath(root, directory))
|
|
49
|
+
.sort()
|
|
50
|
+
.slice(0, 32)) {
|
|
51
|
+
if (!/^[a-zA-Z0-9_-]+\.md$/.test(name))
|
|
52
|
+
continue;
|
|
53
|
+
const file = directory + "/" + name;
|
|
54
|
+
seen.add(file);
|
|
55
|
+
documents.push({
|
|
56
|
+
file,
|
|
57
|
+
label: name.replace(/\.md$/, "").replace(/-/g, " "),
|
|
58
|
+
owner: block,
|
|
59
|
+
inherited: false,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
/* An additional-pages directory is optional. */
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let current = owner;
|
|
68
|
+
const visited = new Set();
|
|
69
|
+
while (current && !visited.has(current.id)) {
|
|
70
|
+
visited.add(current.id);
|
|
71
|
+
for (const file of current.attachments?.docs || []) {
|
|
72
|
+
if (!/\.(md|markdown)$/i.test(file) || seen.has(file))
|
|
73
|
+
continue;
|
|
74
|
+
seen.add(file);
|
|
75
|
+
documents.push({
|
|
76
|
+
file,
|
|
77
|
+
label: file.split("/").at(-1),
|
|
78
|
+
owner: current.id,
|
|
79
|
+
inherited: current.id !== block,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
current = byId.get(current.parent || "");
|
|
83
|
+
}
|
|
84
|
+
return documents;
|
|
85
|
+
}
|
|
86
|
+
export function readBlockNote(root, graph, block, file) {
|
|
87
|
+
const documents = blockNotes(graph, block, root).map((document) => {
|
|
88
|
+
// A proposed note filename is not a document yet. Prefer documentation
|
|
89
|
+
// already on disk, while keeping the empty block note available to create.
|
|
90
|
+
let exists = false;
|
|
91
|
+
try {
|
|
92
|
+
const path = checkedPath(root, document.file, true);
|
|
93
|
+
exists = existsSync(path) && lstatSync(path).isFile();
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Explicit selection still goes through checkedPath below and fails.
|
|
97
|
+
}
|
|
98
|
+
let label = document.label;
|
|
99
|
+
if (exists)
|
|
100
|
+
try {
|
|
101
|
+
const path = checkedPath(root, document.file);
|
|
102
|
+
if (lstatSync(path).size <= 128000)
|
|
103
|
+
label =
|
|
104
|
+
/^#\s+(.+)$/m.exec(readFileSync(path, "utf8"))?.[1]?.trim() ||
|
|
105
|
+
label;
|
|
106
|
+
}
|
|
107
|
+
catch { }
|
|
108
|
+
return { ...document, label, exists };
|
|
109
|
+
});
|
|
110
|
+
const selected = file
|
|
111
|
+
? documents.find((d) => d.file === file)
|
|
112
|
+
: documents.find((d) => d.exists && !d.inherited) ||
|
|
113
|
+
documents.find((d) => d.exists) ||
|
|
114
|
+
documents[0];
|
|
115
|
+
if (!selected)
|
|
116
|
+
throw Error("This document is not attached to the block");
|
|
117
|
+
const path = checkedPath(root, selected.file, true);
|
|
118
|
+
if (!existsSync(path))
|
|
119
|
+
return { documents, file: selected.file, body: "", revision: null };
|
|
120
|
+
if (lstatSync(path).size > 128_000)
|
|
121
|
+
throw Error("This note exceeds the 128 KB editor limit");
|
|
122
|
+
const body = readFileSync(path, "utf8");
|
|
123
|
+
return { documents, file: selected.file, body, revision: noteRevision(body) };
|
|
124
|
+
}
|
|
125
|
+
export function saveBlockNote(root, graph, block, file, body, revision) {
|
|
126
|
+
if (Buffer.byteLength(body) > 128_000)
|
|
127
|
+
throw Error("Keep this note below 128 KB");
|
|
128
|
+
const current = readBlockNote(root, graph, block, file);
|
|
129
|
+
if (current.revision !== revision)
|
|
130
|
+
throw new WorkspaceConflict("This note changed on disk. Reload it before saving.");
|
|
131
|
+
const path = checkedPath(root, file, true);
|
|
132
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
133
|
+
checkedPath(root, file, true);
|
|
134
|
+
const temporary = join(dirname(path), `.fractory-${crypto.randomUUID()}.tmp`);
|
|
135
|
+
try {
|
|
136
|
+
writeFileSync(temporary, body, { flag: "wx", mode: 0o600 });
|
|
137
|
+
renameSync(temporary, path);
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
if (existsSync(temporary))
|
|
141
|
+
unlinkSync(temporary);
|
|
142
|
+
}
|
|
143
|
+
return readBlockNote(root, graph, block, file);
|
|
144
|
+
}
|
|
145
|
+
/** Read a reference without checking it out or borrowing uncommitted Markdown. */
|
|
146
|
+
export function readBlockNoteAt(root, graph, block, ref, file) {
|
|
147
|
+
const bodies = new Map();
|
|
148
|
+
const documents = blockNotes(graph, block).map((d) => {
|
|
149
|
+
let body;
|
|
150
|
+
try {
|
|
151
|
+
body = readGit(root, ["show", `${ref}:${d.file}`]);
|
|
152
|
+
if (Buffer.byteLength(body) > 128000)
|
|
153
|
+
throw Error("Note exceeds read budget");
|
|
154
|
+
bodies.set(d.file, body);
|
|
155
|
+
}
|
|
156
|
+
catch { }
|
|
157
|
+
return {
|
|
158
|
+
...d,
|
|
159
|
+
exists: body !== undefined,
|
|
160
|
+
label: body ? /^#\s+(.+)$/m.exec(body)?.[1]?.trim() || d.label : d.label,
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
const selected = file
|
|
164
|
+
? documents.find((d) => d.file === file)
|
|
165
|
+
: documents.find((d) => d.exists && !d.inherited) ||
|
|
166
|
+
documents.find((d) => d.exists) ||
|
|
167
|
+
documents[0];
|
|
168
|
+
if (!selected)
|
|
169
|
+
throw Error("This document is not attached to the block");
|
|
170
|
+
const body = bodies.get(selected.file) || "";
|
|
171
|
+
return {
|
|
172
|
+
documents,
|
|
173
|
+
file: selected.file,
|
|
174
|
+
body,
|
|
175
|
+
revision: bodies.has(selected.file) ? noteRevision(body) : null,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type DefinitionGraph } from "./model.js";
|
|
2
|
+
import type { CheckFile, CheckRun, CheckResult, CheckSource } from "./checks-model.js";
|
|
3
|
+
export declare function checkPlan(root: string, graph: DefinitionGraph, block: string): CheckFile[];
|
|
4
|
+
export declare function readTestSource(root: string, graph: DefinitionGraph, block: string, file: string, ref?: string): CheckSource;
|
|
5
|
+
export declare function bunReport(body: string, cwd: string, root: string): CheckResult[];
|
|
6
|
+
export declare function vitestReport(body: string, root: string): CheckResult[];
|
|
7
|
+
export declare class WorkspaceTestRunner {
|
|
8
|
+
private root;
|
|
9
|
+
private graph;
|
|
10
|
+
private directory;
|
|
11
|
+
private fileHashes;
|
|
12
|
+
private currentHash;
|
|
13
|
+
private active?;
|
|
14
|
+
constructor(root: string, graph: DefinitionGraph, directory?: string);
|
|
15
|
+
private save;
|
|
16
|
+
list(): CheckRun[];
|
|
17
|
+
start(block: string, files: string[]): CheckRun;
|
|
18
|
+
private stop;
|
|
19
|
+
cancel(id: string): CheckRun;
|
|
20
|
+
private execute;
|
|
21
|
+
}
|