@brainervirus/workit-cli 8.38.3 → 8.38.4
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/index.js +186 -100
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -9317,7 +9317,7 @@ var package_default;
|
|
|
9317
9317
|
var init_package = __esm(() => {
|
|
9318
9318
|
package_default = {
|
|
9319
9319
|
name: "@brainervirus/workit-cli",
|
|
9320
|
-
version: "8.38.
|
|
9320
|
+
version: "8.38.4",
|
|
9321
9321
|
private: false,
|
|
9322
9322
|
description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
|
|
9323
9323
|
keywords: [
|
|
@@ -9355,13 +9355,13 @@ var init_package = __esm(() => {
|
|
|
9355
9355
|
},
|
|
9356
9356
|
dependencies: {
|
|
9357
9357
|
"@babel/parser": "7.29.9",
|
|
9358
|
-
"@brainervirus/workit-cursor": "^8.38.
|
|
9358
|
+
"@brainervirus/workit-cursor": "^8.38.4",
|
|
9359
9359
|
"@inkjs/ui": "2.0.0",
|
|
9360
9360
|
ink: "7.1.1",
|
|
9361
9361
|
react: "19.2.8"
|
|
9362
9362
|
},
|
|
9363
9363
|
devDependencies: {
|
|
9364
|
-
"@brainervirus/workit-core": "^8.38.
|
|
9364
|
+
"@brainervirus/workit-core": "^8.38.4"
|
|
9365
9365
|
},
|
|
9366
9366
|
engines: {
|
|
9367
9367
|
node: ">=24"
|
|
@@ -16832,6 +16832,79 @@ var init_workers = __esm(() => {
|
|
|
16832
16832
|
UNCERTAIN_WORKER_STATES = ["dispatching", "running", "cancelling", "unknown"];
|
|
16833
16833
|
});
|
|
16834
16834
|
|
|
16835
|
+
// packages/workit-core/src/core/task-delivery.ts
|
|
16836
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
16837
|
+
function closeDeliveredTasks(store, now, options = {}) {
|
|
16838
|
+
let closedCount = 0;
|
|
16839
|
+
const index = store.listStoreIndex();
|
|
16840
|
+
if (!index.ok)
|
|
16841
|
+
return 0;
|
|
16842
|
+
const open = index.data.filter((entry) => entry.status !== "closed" && entry.branch !== null);
|
|
16843
|
+
if (open.length === 0)
|
|
16844
|
+
return 0;
|
|
16845
|
+
const file = options.cached ? ledgerPath(store.root) : null;
|
|
16846
|
+
const signature = file?.ok ? `${fileSignature(file.value) ?? "-"}|${open.map((entry) => entry.id).join(",")}` : null;
|
|
16847
|
+
const marker = file?.ok ? `${file.value}.delivery-sweep` : null;
|
|
16848
|
+
if (signature && marker) {
|
|
16849
|
+
try {
|
|
16850
|
+
if (readFileSync6(marker, "utf8") === signature)
|
|
16851
|
+
return 0;
|
|
16852
|
+
} catch {}
|
|
16853
|
+
}
|
|
16854
|
+
const ledger = readLedger(store.root);
|
|
16855
|
+
if (!ledger.ok)
|
|
16856
|
+
return 0;
|
|
16857
|
+
const rows = ledger.value.rows;
|
|
16858
|
+
const after = (row, since) => Date.parse(row.at) >= Date.parse(since);
|
|
16859
|
+
for (const entry of open) {
|
|
16860
|
+
const merged = rows.findLast((row) => row.type === "pr.merged" && row.branch === entry.branch && typeof row.pr === "number" && after(row, entry.createdAt));
|
|
16861
|
+
if (!merged)
|
|
16862
|
+
continue;
|
|
16863
|
+
const pr = merged.pr;
|
|
16864
|
+
const verified = rows.findLast((row) => row.type === "delivery.verified" && row.expect === "merged" && row.branch === entry.branch && (row.pr === undefined || row.pr === pr));
|
|
16865
|
+
if (!verified) {
|
|
16866
|
+
const next = `PR #${pr} is merged but delivery is not verified: run \`workit verify-delivery merged\``;
|
|
16867
|
+
if (entry.progress.nextAction !== next) {
|
|
16868
|
+
store.mutateTask(entry.id, entry.revision, (task, context) => success(context.revision, null, {
|
|
16869
|
+
...task,
|
|
16870
|
+
progress: { ...task.progress, nextAction: next }
|
|
16871
|
+
}));
|
|
16872
|
+
}
|
|
16873
|
+
continue;
|
|
16874
|
+
}
|
|
16875
|
+
const task = store.readTask(entry.id);
|
|
16876
|
+
if (!task.ok || task.data.status === "closed")
|
|
16877
|
+
continue;
|
|
16878
|
+
if (task.data.workers.some((worker) => workerBlocksTransition("close", worker.data.state)))
|
|
16879
|
+
continue;
|
|
16880
|
+
const closed = store.mutateTask(entry.id, task.data.revision, (value, context) => success(context.revision, null, {
|
|
16881
|
+
...value,
|
|
16882
|
+
status: "closed",
|
|
16883
|
+
closure: {
|
|
16884
|
+
outcome: "verified",
|
|
16885
|
+
at: context.now,
|
|
16886
|
+
summary: `delivered: PR #${pr} merged (pr.merged ${String(merged.id)}) and delivery verified (delivery.verified ${String(verified.id)})`,
|
|
16887
|
+
decisionIds: [],
|
|
16888
|
+
evidenceIds: []
|
|
16889
|
+
}
|
|
16890
|
+
}), now);
|
|
16891
|
+
if (closed.ok)
|
|
16892
|
+
closedCount++;
|
|
16893
|
+
}
|
|
16894
|
+
if (signature && marker && closedCount === 0 && !racySignature(signature.split("|")[0] ?? "")) {
|
|
16895
|
+
try {
|
|
16896
|
+
writeFileSync4(marker, signature);
|
|
16897
|
+
} catch {}
|
|
16898
|
+
}
|
|
16899
|
+
return closedCount;
|
|
16900
|
+
}
|
|
16901
|
+
var init_task_delivery = __esm(() => {
|
|
16902
|
+
init_ledger();
|
|
16903
|
+
init_task_store();
|
|
16904
|
+
init_task_contract();
|
|
16905
|
+
init_workers();
|
|
16906
|
+
});
|
|
16907
|
+
|
|
16835
16908
|
// packages/workit-core/src/core/task-evaluation.ts
|
|
16836
16909
|
import { createHash as createHash11 } from "node:crypto";
|
|
16837
16910
|
import * as fs14 from "node:fs";
|
|
@@ -18804,10 +18877,10 @@ var init_route_intent = __esm(() => {
|
|
|
18804
18877
|
|
|
18805
18878
|
// packages/workit-core/src/core/runtime-identity.ts
|
|
18806
18879
|
import { createHash as createHash12 } from "node:crypto";
|
|
18807
|
-
import { readFileSync as
|
|
18880
|
+
import { readFileSync as readFileSync8 } from "node:fs";
|
|
18808
18881
|
var sha256Hex = (bytes) => createHash12("sha256").update(bytes).digest("hex"), bundleHashOfFile = (file) => {
|
|
18809
18882
|
try {
|
|
18810
|
-
return sha256Hex(
|
|
18883
|
+
return sha256Hex(readFileSync8(file));
|
|
18811
18884
|
} catch {
|
|
18812
18885
|
return null;
|
|
18813
18886
|
}
|
|
@@ -21199,7 +21272,7 @@ var init_core3 = __esm(() => {
|
|
|
21199
21272
|
});
|
|
21200
21273
|
|
|
21201
21274
|
// packages/workit-cli/src/task.ts
|
|
21202
|
-
import { readFileSync as
|
|
21275
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
21203
21276
|
import path27 from "node:path";
|
|
21204
21277
|
async function readInput(input) {
|
|
21205
21278
|
if (typeof input === "string")
|
|
@@ -21216,7 +21289,7 @@ async function payloadValue(raw, deps) {
|
|
|
21216
21289
|
return { ok: true, value: {} };
|
|
21217
21290
|
let source;
|
|
21218
21291
|
try {
|
|
21219
|
-
source = raw === "-" ? await readInput(deps.stdin ?? process.stdin) : raw.startsWith("@") ? decodeUtf8(
|
|
21292
|
+
source = raw === "-" ? await readInput(deps.stdin ?? process.stdin) : raw.startsWith("@") ? decodeUtf8(readFileSync9(raw.slice(1))) : raw;
|
|
21220
21293
|
} catch (error) {
|
|
21221
21294
|
return {
|
|
21222
21295
|
ok: false,
|
|
@@ -21504,7 +21577,12 @@ async function runTaskCommand(argv, deps = {}) {
|
|
|
21504
21577
|
return parsed.usage ? 2 : 1;
|
|
21505
21578
|
}
|
|
21506
21579
|
const root = workspaceRootFor(deps);
|
|
21507
|
-
const
|
|
21580
|
+
const store = new TaskStore(root);
|
|
21581
|
+
try {
|
|
21582
|
+
const now = new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
21583
|
+
closeDeliveredTasks(store, now, { cached: parsed.parsed.action !== "list" });
|
|
21584
|
+
} catch {}
|
|
21585
|
+
const core = new WorkitCore(store, contextFor(root, parsed.parsed.actor !== undefined ? { ...deps, actor: parsed.parsed.actor } : deps));
|
|
21508
21586
|
let result;
|
|
21509
21587
|
if (parsed.parsed.handoff) {
|
|
21510
21588
|
const exported = dispatch(core, "state", parsed.parsed.request);
|
|
@@ -21600,6 +21678,7 @@ var init_task = __esm(() => {
|
|
|
21600
21678
|
init_current_judgment();
|
|
21601
21679
|
init_judgment();
|
|
21602
21680
|
init_lane();
|
|
21681
|
+
init_task_delivery();
|
|
21603
21682
|
init_task_store();
|
|
21604
21683
|
init_core3();
|
|
21605
21684
|
init_task_contract();
|
|
@@ -65285,13 +65364,13 @@ var init_changelog = __esm(() => {
|
|
|
65285
65364
|
|
|
65286
65365
|
// packages/workit-core/src/core/hygiene.ts
|
|
65287
65366
|
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
65288
|
-
import { existsSync as existsSync10, readFileSync as
|
|
65367
|
+
import { existsSync as existsSync10, readFileSync as readFileSync11, readdirSync as readdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
65289
65368
|
import path29 from "node:path";
|
|
65290
65369
|
var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene"), packageJson = (root) => {
|
|
65291
65370
|
if (!existsSync10(path29.join(root, "package.json")))
|
|
65292
65371
|
return null;
|
|
65293
65372
|
try {
|
|
65294
|
-
return JSON.parse(
|
|
65373
|
+
return JSON.parse(readFileSync11(path29.join(root, "package.json"), "utf8"));
|
|
65295
65374
|
} catch {
|
|
65296
65375
|
return null;
|
|
65297
65376
|
}
|
|
@@ -65344,7 +65423,7 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
|
|
|
65344
65423
|
const tpl = path29.join(templatesDir(), file);
|
|
65345
65424
|
if (!existsSync10(tpl))
|
|
65346
65425
|
continue;
|
|
65347
|
-
const content =
|
|
65426
|
+
const content = readFileSync11(tpl, "utf8").replace(/<PROJECT>/g, path29.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
|
|
65348
65427
|
planned.push({ path: path29.join(root, file), content });
|
|
65349
65428
|
}
|
|
65350
65429
|
return planned;
|
|
@@ -65356,13 +65435,13 @@ var init_hygiene = __esm(() => {
|
|
|
65356
65435
|
});
|
|
65357
65436
|
|
|
65358
65437
|
// packages/workit-cli/src/admin/setup-state.ts
|
|
65359
|
-
import { existsSync as existsSync11, readFileSync as
|
|
65438
|
+
import { existsSync as existsSync11, readFileSync as readFileSync12 } from "node:fs";
|
|
65360
65439
|
import path30 from "node:path";
|
|
65361
65440
|
var classifySetupFile = (dir, name) => {
|
|
65362
65441
|
const file = path30.join(dir, name);
|
|
65363
65442
|
let raw;
|
|
65364
65443
|
try {
|
|
65365
|
-
raw =
|
|
65444
|
+
raw = readFileSync12(file, "utf8");
|
|
65366
65445
|
} catch {
|
|
65367
65446
|
if (existsSync11(file)) {
|
|
65368
65447
|
return { file, status: "malformed", error: `${file} is not readable` };
|
|
@@ -65803,7 +65882,7 @@ import {
|
|
|
65803
65882
|
accessSync,
|
|
65804
65883
|
constants as constants2,
|
|
65805
65884
|
existsSync as existsSync12,
|
|
65806
|
-
readFileSync as
|
|
65885
|
+
readFileSync as readFileSync13,
|
|
65807
65886
|
readdirSync as readdirSync6,
|
|
65808
65887
|
realpathSync as realpathSync6,
|
|
65809
65888
|
statSync as statSync2
|
|
@@ -66093,7 +66172,7 @@ function runHostCommand(step, context = {}) {
|
|
|
66093
66172
|
}
|
|
66094
66173
|
var resolveWindowsShimScript = (shim) => {
|
|
66095
66174
|
try {
|
|
66096
|
-
const contents =
|
|
66175
|
+
const contents = readFileSync13(shim, "utf8");
|
|
66097
66176
|
return resolveWindowsShimEntry(contents, shim);
|
|
66098
66177
|
} catch {
|
|
66099
66178
|
return null;
|
|
@@ -66114,7 +66193,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66114
66193
|
}, isPiWorkitInstalled = (home, env = process.env) => {
|
|
66115
66194
|
const settings = path33.join(env.PI_CODING_AGENT_DIR ?? path33.join(home, ".pi", "agent"), "settings.json");
|
|
66116
66195
|
try {
|
|
66117
|
-
const document2 = JSON.parse(
|
|
66196
|
+
const document2 = JSON.parse(readFileSync13(settings, "utf8"));
|
|
66118
66197
|
return (document2.packages ?? []).some((entry) => {
|
|
66119
66198
|
const source = entry && typeof entry === "object" && !Array.isArray(entry) ? entry.source : entry;
|
|
66120
66199
|
const value = String(source).replaceAll("\\", "/").replace(/\/+$/, "");
|
|
@@ -66125,7 +66204,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66125
66204
|
}
|
|
66126
66205
|
}, OPENCODE_PLUGIN_SCOPE = "@brainervirus", OPENCODE_PLUGIN_NAME = "workit-opencode", packageVersionAt = (root, name) => {
|
|
66127
66206
|
try {
|
|
66128
|
-
const pkg = JSON.parse(
|
|
66207
|
+
const pkg = JSON.parse(readFileSync13(path33.join(root, "package.json"), "utf8"));
|
|
66129
66208
|
return pkg.name === name && typeof pkg.version === "string" ? pkg.version : null;
|
|
66130
66209
|
} catch {
|
|
66131
66210
|
return null;
|
|
@@ -66163,7 +66242,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66163
66242
|
path33.join(root, "package.json")
|
|
66164
66243
|
]) {
|
|
66165
66244
|
try {
|
|
66166
|
-
const manifest = JSON.parse(
|
|
66245
|
+
const manifest = JSON.parse(readFileSync13(file, "utf8"));
|
|
66167
66246
|
const repository = typeof manifest.repository === "string" ? manifest.repository : manifest.repository?.url;
|
|
66168
66247
|
if ((manifest.name === "workit" || manifest.name === "@brainervirus/workit-codex") && repository?.replace(/\.git$/, "").toLowerCase() === "https://github.com/brainervirus/workit")
|
|
66169
66248
|
return true;
|
|
@@ -66204,7 +66283,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66204
66283
|
return relative === "" || !relative.startsWith("..") && !path33.isAbsolute(relative);
|
|
66205
66284
|
}, isCanonicalClaudePlugin = (root) => {
|
|
66206
66285
|
try {
|
|
66207
|
-
const manifest = JSON.parse(
|
|
66286
|
+
const manifest = JSON.parse(readFileSync13(path33.join(root, ".claude-plugin", "plugin.json"), "utf8"));
|
|
66208
66287
|
const repository = typeof manifest.repository === "string" ? manifest.repository : manifest.repository?.url;
|
|
66209
66288
|
return manifest.name === "workit" && repository?.replace(/\.git$/, "").toLowerCase() === "https://github.com/brainervirus/workit";
|
|
66210
66289
|
} catch {
|
|
@@ -66214,7 +66293,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66214
66293
|
const file = path33.join(claudeConfigDir(home, env), "plugins", "installed_plugins.json");
|
|
66215
66294
|
let registry;
|
|
66216
66295
|
try {
|
|
66217
|
-
registry = JSON.parse(
|
|
66296
|
+
registry = JSON.parse(readFileSync13(file, "utf8"));
|
|
66218
66297
|
} catch {
|
|
66219
66298
|
return [];
|
|
66220
66299
|
}
|
|
@@ -66263,7 +66342,7 @@ var init_host_install = __esm(() => {
|
|
|
66263
66342
|
});
|
|
66264
66343
|
|
|
66265
66344
|
// packages/workit-core/src/core/skill-manifests.ts
|
|
66266
|
-
import { cpSync as cpSync3, existsSync as existsSync13, readFileSync as
|
|
66345
|
+
import { cpSync as cpSync3, existsSync as existsSync13, readFileSync as readFileSync14, readdirSync as readdirSync7, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
66267
66346
|
import path34 from "node:path";
|
|
66268
66347
|
var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync13(root) ? readdirSync7(root).filter((name) => existsSync13(path34.join(root, name, "SKILL.md"))).toSorted() : [], validateSkillManifests = (root, expected, label) => {
|
|
66269
66348
|
const actual = skillManifestNames(root);
|
|
@@ -66281,7 +66360,7 @@ var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync13(root) ? re
|
|
|
66281
66360
|
const file = path34.join(dir, entry.name);
|
|
66282
66361
|
if (entry.isDirectory())
|
|
66283
66362
|
pending.push(file);
|
|
66284
|
-
else if ((statSync3(file).mode & 73) !== 0 ||
|
|
66363
|
+
else if ((statSync3(file).mode & 73) !== 0 || readFileSync14(file).subarray(0, 2).toString("latin1") === "#!") {
|
|
66285
66364
|
return `Cursor vendor contains active file: ${file}`;
|
|
66286
66365
|
}
|
|
66287
66366
|
}
|
|
@@ -66314,11 +66393,11 @@ import {
|
|
|
66314
66393
|
existsSync as existsSync14,
|
|
66315
66394
|
lstatSync as lstatSync4,
|
|
66316
66395
|
mkdirSync as mkdirSync5,
|
|
66317
|
-
readFileSync as
|
|
66396
|
+
readFileSync as readFileSync15,
|
|
66318
66397
|
renameSync as renameSync3,
|
|
66319
66398
|
rmSync as rmSync2,
|
|
66320
66399
|
statSync as statSync4,
|
|
66321
|
-
writeFileSync as
|
|
66400
|
+
writeFileSync as writeFileSync7
|
|
66322
66401
|
} from "node:fs";
|
|
66323
66402
|
import path35 from "node:path";
|
|
66324
66403
|
function inspectSessionHook(cwd, env = process.env) {
|
|
@@ -66517,7 +66596,7 @@ exit 0
|
|
|
66517
66596
|
return rel === "" || !rel.startsWith("..") && !path35.isAbsolute(rel);
|
|
66518
66597
|
}, readText3 = (file) => {
|
|
66519
66598
|
try {
|
|
66520
|
-
return
|
|
66599
|
+
return readFileSync15(file, "utf8");
|
|
66521
66600
|
} catch {
|
|
66522
66601
|
return null;
|
|
66523
66602
|
}
|
|
@@ -66621,7 +66700,7 @@ exit 0
|
|
|
66621
66700
|
mkdirSync5(path35.dirname(file), { recursive: true });
|
|
66622
66701
|
const staged = `${file}.workit-new`;
|
|
66623
66702
|
try {
|
|
66624
|
-
|
|
66703
|
+
writeFileSync7(staged, content, { mode: 493 });
|
|
66625
66704
|
chmodSync(staged, 493);
|
|
66626
66705
|
renameSync3(staged, file);
|
|
66627
66706
|
} finally {
|
|
@@ -66684,7 +66763,7 @@ var init_heavy_words = __esm(() => {
|
|
|
66684
66763
|
});
|
|
66685
66764
|
|
|
66686
66765
|
// packages/workit-core/src/hooks/hook-runs.ts
|
|
66687
|
-
import { mkdirSync as mkdirSync6, readdirSync as readdirSync8, readFileSync as
|
|
66766
|
+
import { mkdirSync as mkdirSync6, readdirSync as readdirSync8, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "node:fs";
|
|
66688
66767
|
import path37 from "node:path";
|
|
66689
66768
|
var HOOK_RUNS_DIR = "hook-runs", readHookRuns = (dir) => {
|
|
66690
66769
|
const runs = [];
|
|
@@ -66696,7 +66775,7 @@ var HOOK_RUNS_DIR = "hook-runs", readHookRuns = (dir) => {
|
|
|
66696
66775
|
}
|
|
66697
66776
|
for (const name of names) {
|
|
66698
66777
|
try {
|
|
66699
|
-
const row = JSON.parse(
|
|
66778
|
+
const row = JSON.parse(readFileSync16(path37.join(dir, HOOK_RUNS_DIR, name), "utf8"));
|
|
66700
66779
|
if (typeof row.host === "string" && typeof row.event === "string" && typeof row.at === "string" && typeof row.count === "number")
|
|
66701
66780
|
runs.push({
|
|
66702
66781
|
host: row.host,
|
|
@@ -66742,7 +66821,7 @@ import {
|
|
|
66742
66821
|
existsSync as existsSync15,
|
|
66743
66822
|
readdirSync as readdirSync9,
|
|
66744
66823
|
mkdirSync as mkdirSync7,
|
|
66745
|
-
readFileSync as
|
|
66824
|
+
readFileSync as readFileSync17,
|
|
66746
66825
|
realpathSync as realpathSync7,
|
|
66747
66826
|
rmSync as rmSync3,
|
|
66748
66827
|
statSync as statSync5
|
|
@@ -67170,7 +67249,7 @@ ${[...rules, ...lease, grant].join(`
|
|
|
67170
67249
|
}, AGENT_SESSION_VARS, agentSessionVar = (env) => AGENT_SESSION_VARS.find((name) => (env[name] ?? "") !== "") ?? null, RECORD_FILE = "host-permissions.json", readOwnership = (options = {}) => {
|
|
67171
67250
|
const { stateDir } = resolvePaths(options);
|
|
67172
67251
|
try {
|
|
67173
|
-
const value = JSON.parse(
|
|
67252
|
+
const value = JSON.parse(readFileSync17(path38.join(stateDir, RECORD_FILE), "utf8"));
|
|
67174
67253
|
if (isRecord5(value) && isRecord5(value.hosts))
|
|
67175
67254
|
return { version: 1, hosts: value.hosts };
|
|
67176
67255
|
} catch {}
|
|
@@ -67199,7 +67278,7 @@ ${[...rules, ...lease, grant].join(`
|
|
|
67199
67278
|
writeOwnership(record, paths.stateDir);
|
|
67200
67279
|
}, readText4 = (file) => {
|
|
67201
67280
|
try {
|
|
67202
|
-
return
|
|
67281
|
+
return readFileSync17(file, "utf8");
|
|
67203
67282
|
} catch {
|
|
67204
67283
|
return null;
|
|
67205
67284
|
}
|
|
@@ -67361,13 +67440,13 @@ import {
|
|
|
67361
67440
|
mkdirSync as mkdirSync8,
|
|
67362
67441
|
mkdtempSync,
|
|
67363
67442
|
readdirSync as readdirSync10,
|
|
67364
|
-
readFileSync as
|
|
67443
|
+
readFileSync as readFileSync18,
|
|
67365
67444
|
readlinkSync as readlinkSync2,
|
|
67366
67445
|
renameSync as renameSync4,
|
|
67367
67446
|
rmSync as rmSync4,
|
|
67368
67447
|
statSync as statSync6,
|
|
67369
67448
|
unlinkSync as unlinkSync3,
|
|
67370
|
-
writeFileSync as
|
|
67449
|
+
writeFileSync as writeFileSync9
|
|
67371
67450
|
} from "node:fs";
|
|
67372
67451
|
import os12 from "node:os";
|
|
67373
67452
|
import path39 from "node:path";
|
|
@@ -67431,14 +67510,14 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67431
67510
|
};
|
|
67432
67511
|
}, readJson = (p) => {
|
|
67433
67512
|
try {
|
|
67434
|
-
const parsed = JSON.parse(
|
|
67513
|
+
const parsed = JSON.parse(readFileSync18(p, "utf8"));
|
|
67435
67514
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
67436
67515
|
} catch {
|
|
67437
67516
|
return null;
|
|
67438
67517
|
}
|
|
67439
67518
|
}, parsesAsConfigObject = (p) => {
|
|
67440
67519
|
try {
|
|
67441
|
-
return isConfigObject(JSON.parse(
|
|
67520
|
+
return isConfigObject(JSON.parse(readFileSync18(p, "utf8")));
|
|
67442
67521
|
} catch {
|
|
67443
67522
|
return false;
|
|
67444
67523
|
}
|
|
@@ -67661,7 +67740,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67661
67740
|
const tables = new Map;
|
|
67662
67741
|
let text;
|
|
67663
67742
|
try {
|
|
67664
|
-
text =
|
|
67743
|
+
text = readFileSync18(file, "utf8");
|
|
67665
67744
|
} catch {
|
|
67666
67745
|
return tables;
|
|
67667
67746
|
}
|
|
@@ -67832,7 +67911,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67832
67911
|
let stale = false;
|
|
67833
67912
|
for (const file of files) {
|
|
67834
67913
|
const dest = path39.join(agentsDir, file);
|
|
67835
|
-
const want = stampCodexAgent(
|
|
67914
|
+
const want = stampCodexAgent(readFileSync18(path39.join(source, file), "utf8"), version);
|
|
67836
67915
|
let link = false;
|
|
67837
67916
|
try {
|
|
67838
67917
|
link = lstatSync5(dest).isSymbolicLink();
|
|
@@ -67846,7 +67925,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67846
67925
|
}
|
|
67847
67926
|
let have = null;
|
|
67848
67927
|
try {
|
|
67849
|
-
have =
|
|
67928
|
+
have = readFileSync18(dest, "utf8");
|
|
67850
67929
|
} catch {
|
|
67851
67930
|
have = null;
|
|
67852
67931
|
}
|
|
@@ -68095,7 +68174,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68095
68174
|
}, validNodeEntry = (entry, runtime, env) => {
|
|
68096
68175
|
try {
|
|
68097
68176
|
const stat = statSync6(entry);
|
|
68098
|
-
if (!stat.isFile() || stat.size === 0 || !
|
|
68177
|
+
if (!stat.isFile() || stat.size === 0 || !readFileSync18(entry, "utf8").startsWith(`#!/usr/bin/env node
|
|
68099
68178
|
`)) {
|
|
68100
68179
|
return false;
|
|
68101
68180
|
}
|
|
@@ -68951,7 +69030,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68951
69030
|
return { ...installSessionHook(res.cwd, res.env), workspace: workspace.name };
|
|
68952
69031
|
}, isPlaceholder = (p) => {
|
|
68953
69032
|
try {
|
|
68954
|
-
return
|
|
69033
|
+
return readFileSync18(p, "utf8").trim() === TOKEN_PLACEHOLDER2;
|
|
68955
69034
|
} catch {
|
|
68956
69035
|
return false;
|
|
68957
69036
|
}
|
|
@@ -69165,7 +69244,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69165
69244
|
const probe = path39.join(logsDir, "doctor-probe.tmp");
|
|
69166
69245
|
try {
|
|
69167
69246
|
mkdirSync8(logsDir, { recursive: true, mode: 448 });
|
|
69168
|
-
|
|
69247
|
+
writeFileSync9(probe, `{"probe":true}
|
|
69169
69248
|
`, { mode: 384 });
|
|
69170
69249
|
return {
|
|
69171
69250
|
id: "log_writable",
|
|
@@ -69244,7 +69323,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69244
69323
|
const counts = { skip: 0, late: 0 };
|
|
69245
69324
|
let text = "";
|
|
69246
69325
|
try {
|
|
69247
|
-
text =
|
|
69326
|
+
text = readFileSync18(path39.join(stateDir, HOOK_SKIPS_FILE), "utf8");
|
|
69248
69327
|
} catch {
|
|
69249
69328
|
return counts;
|
|
69250
69329
|
}
|
|
@@ -69435,7 +69514,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69435
69514
|
return null;
|
|
69436
69515
|
return files.some((file) => {
|
|
69437
69516
|
try {
|
|
69438
|
-
return
|
|
69517
|
+
return readFileSync18(path39.join(root, "dist", file), "utf8").includes(HOOK_ISSUED_MARKER);
|
|
69439
69518
|
} catch {
|
|
69440
69519
|
return false;
|
|
69441
69520
|
}
|
|
@@ -69779,13 +69858,13 @@ import {
|
|
|
69779
69858
|
lstatSync as lstatSync6,
|
|
69780
69859
|
mkdirSync as mkdirSync9,
|
|
69781
69860
|
mkdtempSync as mkdtempSync2,
|
|
69782
|
-
readFileSync as
|
|
69861
|
+
readFileSync as readFileSync19,
|
|
69783
69862
|
readdirSync as readdirSync11,
|
|
69784
69863
|
realpathSync as realpathSync8,
|
|
69785
69864
|
renameSync as renameSync5,
|
|
69786
69865
|
rmSync as rmSync5,
|
|
69787
69866
|
statSync as statSync7,
|
|
69788
|
-
writeFileSync as
|
|
69867
|
+
writeFileSync as writeFileSync10
|
|
69789
69868
|
} from "node:fs";
|
|
69790
69869
|
import { createRequire as createRequire2 } from "node:module";
|
|
69791
69870
|
import os13 from "node:os";
|
|
@@ -69953,7 +70032,7 @@ function buildSetupPreview(values, opts = {}) {
|
|
|
69953
70032
|
if (target?.ok) {
|
|
69954
70033
|
const root = target.root;
|
|
69955
70034
|
const gitignorePath = path40.join(root, ".gitignore");
|
|
69956
|
-
const existing = existsSync17(gitignorePath) ?
|
|
70035
|
+
const existing = existsSync17(gitignorePath) ? readFileSync19(gitignorePath, "utf8") : "";
|
|
69957
70036
|
const existingLines = new Set(existing.split(`
|
|
69958
70037
|
`).map((l) => l.trim()).filter(Boolean));
|
|
69959
70038
|
const entries = GITIGNORE_ENTRIES.filter((e) => e.trim() !== "" && !existingLines.has(e.trim()));
|
|
@@ -70017,7 +70096,7 @@ function applyMutation(m) {
|
|
|
70017
70096
|
return { platform: "core", file: m.path, status: "Skipped", detail: "already configured" };
|
|
70018
70097
|
}
|
|
70019
70098
|
mkdirSync9(dir, { recursive: true });
|
|
70020
|
-
|
|
70099
|
+
writeFileSync10(m.path, JSON.stringify(merged, null, 2) + `
|
|
70021
70100
|
`, "utf8");
|
|
70022
70101
|
return existing.kind === "record" ? { platform: "core", file: m.path, status: "Configured" } : { platform: "core", file: m.path, status: "Installed" };
|
|
70023
70102
|
}
|
|
@@ -70061,7 +70140,7 @@ function applyMutation(m) {
|
|
|
70061
70140
|
mkdirSync9(dir, { recursive: true });
|
|
70062
70141
|
const tmp = `${m.path}.${process.pid}.tmp`;
|
|
70063
70142
|
try {
|
|
70064
|
-
|
|
70143
|
+
writeFileSync10(tmp, next, "utf8");
|
|
70065
70144
|
if (workspacesRevision(readFileSafe(m.path)) !== m.expectedRevision) {
|
|
70066
70145
|
rmSync5(tmp, { force: true });
|
|
70067
70146
|
return {
|
|
@@ -70100,7 +70179,7 @@ function applyMutation(m) {
|
|
|
70100
70179
|
const separator = existing && !existing.endsWith(`
|
|
70101
70180
|
`) ? `
|
|
70102
70181
|
` : "";
|
|
70103
|
-
|
|
70182
|
+
writeFileSync10(m.path, existing + separator + (existing ? `
|
|
70104
70183
|
` : "") + add.join(`
|
|
70105
70184
|
`) + `
|
|
70106
70185
|
`, "utf8");
|
|
@@ -70140,7 +70219,7 @@ function applyMutation(m) {
|
|
|
70140
70219
|
};
|
|
70141
70220
|
}
|
|
70142
70221
|
mkdirSync9(path40.dirname(m.path), { recursive: true });
|
|
70143
|
-
|
|
70222
|
+
writeFileSync10(m.path, JSON.stringify(merged, null, 2) + `
|
|
70144
70223
|
`, "utf8");
|
|
70145
70224
|
return existing.kind === "record" ? { platform: "core", file: m.path, status: "Configured" } : { platform: "core", file: m.path, status: "Installed" };
|
|
70146
70225
|
}
|
|
@@ -70212,7 +70291,7 @@ function applyOpenCode(root, res) {
|
|
|
70212
70291
|
detail: "already registered"
|
|
70213
70292
|
};
|
|
70214
70293
|
}
|
|
70215
|
-
|
|
70294
|
+
writeFileSync10(res.opencodeConfig, JSON.stringify(merged.config, null, 2) + `
|
|
70216
70295
|
`, "utf8");
|
|
70217
70296
|
return existing.kind === "record" ? {
|
|
70218
70297
|
platform: "opencode",
|
|
@@ -70247,12 +70326,12 @@ function copyPluginDir(src, dest) {
|
|
|
70247
70326
|
});
|
|
70248
70327
|
const stagedHooks = path40.join(stage, CURSOR_HOOKS_FILE);
|
|
70249
70328
|
if (existsSync17(stagedHooks))
|
|
70250
|
-
|
|
70329
|
+
writeFileSync10(stagedHooks, localizedCursorHooks(readFileSync19(stagedHooks), dest));
|
|
70251
70330
|
for (const [name, content] of rules) {
|
|
70252
70331
|
mkdirSync9(path40.join(stage, "rules"), { recursive: true });
|
|
70253
|
-
|
|
70332
|
+
writeFileSync10(path40.join(stage, "rules", name), content);
|
|
70254
70333
|
}
|
|
70255
|
-
|
|
70334
|
+
writeFileSync10(path40.join(stage, ".workit-root"), realSrc + `
|
|
70256
70335
|
`, "utf8");
|
|
70257
70336
|
if (!samePluginContent(realSrc, stage, dest))
|
|
70258
70337
|
throw new Error("staged adapter content is incomplete");
|
|
@@ -70294,7 +70373,7 @@ function applyCursorSettings(root, res) {
|
|
|
70294
70373
|
detail: "already registered"
|
|
70295
70374
|
};
|
|
70296
70375
|
}
|
|
70297
|
-
|
|
70376
|
+
writeFileSync10(res.cursorSettings, JSON.stringify(settings.config, null, 2) + `
|
|
70298
70377
|
`, "utf8");
|
|
70299
70378
|
return {
|
|
70300
70379
|
platform: "cursor",
|
|
@@ -70333,7 +70412,7 @@ function applyCursorMcp(root, res) {
|
|
|
70333
70412
|
detail: "already registered"
|
|
70334
70413
|
};
|
|
70335
70414
|
}
|
|
70336
|
-
|
|
70415
|
+
writeFileSync10(res.cursorMcp, JSON.stringify(mcp.config, null, 2) + `
|
|
70337
70416
|
`, "utf8");
|
|
70338
70417
|
return {
|
|
70339
70418
|
platform: "cursor",
|
|
@@ -70602,7 +70681,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70602
70681
|
return configured ?? fallback;
|
|
70603
70682
|
}, readConfigRecord = (file) => {
|
|
70604
70683
|
try {
|
|
70605
|
-
const value = JSON.parse(
|
|
70684
|
+
const value = JSON.parse(readFileSync19(file, "utf8"));
|
|
70606
70685
|
return isRecord6(value) ? value : null;
|
|
70607
70686
|
} catch {
|
|
70608
70687
|
return null;
|
|
@@ -70623,7 +70702,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70623
70702
|
}, isRecord6 = (v) => v !== null && typeof v === "object" && !Array.isArray(v), readExisting = (p) => {
|
|
70624
70703
|
let raw;
|
|
70625
70704
|
try {
|
|
70626
|
-
raw =
|
|
70705
|
+
raw = readFileSync19(p, "utf8");
|
|
70627
70706
|
} catch {
|
|
70628
70707
|
if (existsSync17(p))
|
|
70629
70708
|
return { kind: "malformed", error: `${p} is not readable` };
|
|
@@ -70640,7 +70719,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70640
70719
|
return { kind: "malformed", error: `${p} is not a JSON object` };
|
|
70641
70720
|
}, readFileSafe = (p) => {
|
|
70642
70721
|
try {
|
|
70643
|
-
return
|
|
70722
|
+
return readFileSync19(p, "utf8");
|
|
70644
70723
|
} catch {
|
|
70645
70724
|
return null;
|
|
70646
70725
|
}
|
|
@@ -70655,7 +70734,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70655
70734
|
}
|
|
70656
70735
|
}, isAdapter = (root, platform) => {
|
|
70657
70736
|
try {
|
|
70658
|
-
const pkg = JSON.parse(
|
|
70737
|
+
const pkg = JSON.parse(readFileSync19(path40.join(root, "package.json"), "utf8"));
|
|
70659
70738
|
return pkg.name === `@brainervirus/workit-${platform}`;
|
|
70660
70739
|
} catch {
|
|
70661
70740
|
return false;
|
|
@@ -70704,8 +70783,8 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70704
70783
|
if (!statSync7(installed).isDirectory() || !samePluginContent(source, installed, pluginDir, rel))
|
|
70705
70784
|
return false;
|
|
70706
70785
|
} else {
|
|
70707
|
-
const expected = rel === CURSOR_HOOKS_FILE ? localizedCursorHooks(
|
|
70708
|
-
if (!expected.equals(
|
|
70786
|
+
const expected = rel === CURSOR_HOOKS_FILE ? localizedCursorHooks(readFileSync19(source), pluginDir) : readFileSync19(source);
|
|
70787
|
+
if (!expected.equals(readFileSync19(installed)))
|
|
70709
70788
|
return false;
|
|
70710
70789
|
}
|
|
70711
70790
|
}
|
|
@@ -70733,7 +70812,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70733
70812
|
continue;
|
|
70734
70813
|
if (existsSync17(path40.join(sourceRules, entry.name)))
|
|
70735
70814
|
continue;
|
|
70736
|
-
preserved.set(entry.name,
|
|
70815
|
+
preserved.set(entry.name, readFileSync19(path40.join(installedRules, entry.name)));
|
|
70737
70816
|
}
|
|
70738
70817
|
} catch {}
|
|
70739
70818
|
return preserved;
|
|
@@ -70788,7 +70867,7 @@ var init_setup = __esm(() => {
|
|
|
70788
70867
|
});
|
|
70789
70868
|
|
|
70790
70869
|
// packages/workit-core/src/core/workspace-branch-policy.ts
|
|
70791
|
-
import { mkdirSync as mkdirSync10, readFileSync as
|
|
70870
|
+
import { mkdirSync as mkdirSync10, readFileSync as readFileSync20, renameSync as renameSync6, rmSync as rmSync6, writeFileSync as writeFileSync11 } from "node:fs";
|
|
70792
70871
|
import path41 from "node:path";
|
|
70793
70872
|
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
70794
70873
|
function applyWorkspaceBranchPolicy(opts) {
|
|
@@ -70857,7 +70936,7 @@ function applyWorkspaceBranchPolicy(opts) {
|
|
|
70857
70936
|
mkdirSync10(path41.dirname(wsPath), { recursive: true });
|
|
70858
70937
|
const tmp = `${wsPath}.${process.pid}.tmp`;
|
|
70859
70938
|
try {
|
|
70860
|
-
|
|
70939
|
+
writeFileSync11(tmp, JSON.stringify({ ...document2, workspaces: next }, null, 2) + `
|
|
70861
70940
|
`, "utf8");
|
|
70862
70941
|
if (workspacesRevision(readFileSafe2(wsPath)) !== revision) {
|
|
70863
70942
|
rmSync6(tmp, { force: true });
|
|
@@ -70886,7 +70965,7 @@ function applyWorkspaceBranchPolicy(opts) {
|
|
|
70886
70965
|
}
|
|
70887
70966
|
var readFileSafe2 = (p) => {
|
|
70888
70967
|
try {
|
|
70889
|
-
return
|
|
70968
|
+
return readFileSync20(p, "utf8");
|
|
70890
70969
|
} catch {
|
|
70891
70970
|
return null;
|
|
70892
70971
|
}
|
|
@@ -71726,7 +71805,7 @@ var init_wizard_state = __esm(() => {
|
|
|
71726
71805
|
});
|
|
71727
71806
|
|
|
71728
71807
|
// packages/workit-cli/src/admin/uninstall.ts
|
|
71729
|
-
import { existsSync as existsSync19, readFileSync as
|
|
71808
|
+
import { existsSync as existsSync19, readFileSync as readFileSync21, realpathSync as realpathSync9, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
|
|
71730
71809
|
import os14 from "node:os";
|
|
71731
71810
|
import path43 from "node:path";
|
|
71732
71811
|
function cleanCursorSettings(settings, pluginDir) {
|
|
@@ -71988,7 +72067,7 @@ var resolveUninstallPaths = (options = {}) => {
|
|
|
71988
72067
|
}, isRecord7 = (v) => v !== null && typeof v === "object" && !Array.isArray(v), readJsonRecord = (file) => {
|
|
71989
72068
|
let raw;
|
|
71990
72069
|
try {
|
|
71991
|
-
raw =
|
|
72070
|
+
raw = readFileSync21(file, "utf8");
|
|
71992
72071
|
} catch {
|
|
71993
72072
|
if (existsSync19(file))
|
|
71994
72073
|
return { kind: "malformed", error: `${file} is not readable` };
|
|
@@ -72053,7 +72132,7 @@ var resolveUninstallPaths = (options = {}) => {
|
|
|
72053
72132
|
`;
|
|
72054
72133
|
let current;
|
|
72055
72134
|
try {
|
|
72056
|
-
current =
|
|
72135
|
+
current = readFileSync21(target, "utf8");
|
|
72057
72136
|
} catch (error) {
|
|
72058
72137
|
return {
|
|
72059
72138
|
status: "failed",
|
|
@@ -72064,7 +72143,7 @@ var resolveUninstallPaths = (options = {}) => {
|
|
|
72064
72143
|
return { status: "skipped", detail: "already clean" };
|
|
72065
72144
|
}
|
|
72066
72145
|
try {
|
|
72067
|
-
|
|
72146
|
+
writeFileSync12(target, serialized, "utf8");
|
|
72068
72147
|
} catch (error) {
|
|
72069
72148
|
return {
|
|
72070
72149
|
status: "failed",
|
|
@@ -74839,7 +74918,7 @@ var init_setup2 = __esm(() => {
|
|
|
74839
74918
|
});
|
|
74840
74919
|
|
|
74841
74920
|
// packages/workit-cli/src/upgrade/shared.ts
|
|
74842
|
-
import { existsSync as existsSync20, readFileSync as
|
|
74921
|
+
import { existsSync as existsSync20, readFileSync as readFileSync22 } from "node:fs";
|
|
74843
74922
|
import path44 from "node:path";
|
|
74844
74923
|
import os16 from "node:os";
|
|
74845
74924
|
import { createHash as createHash15 } from "node:crypto";
|
|
@@ -74876,7 +74955,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
|
|
|
74876
74955
|
return null;
|
|
74877
74956
|
let data;
|
|
74878
74957
|
try {
|
|
74879
|
-
data = JSON.parse(
|
|
74958
|
+
data = JSON.parse(readFileSync22(file, "utf8"));
|
|
74880
74959
|
} catch {
|
|
74881
74960
|
throw new Error(`${file} is not valid JSON; use the native host to inspect JSONC settings`);
|
|
74882
74961
|
}
|
|
@@ -74889,7 +74968,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
|
|
|
74889
74968
|
} catch {
|
|
74890
74969
|
return null;
|
|
74891
74970
|
}
|
|
74892
|
-
}, digest2 = (file) => existsSync20(file) ? createHash15("sha256").update(
|
|
74971
|
+
}, digest2 = (file) => existsSync20(file) ? createHash15("sha256").update(readFileSync22(file)).digest("hex") : "missing", runner = (deps) => deps.run ?? ((command, args) => {
|
|
74893
74972
|
const { home, env } = upgradePaths(deps);
|
|
74894
74973
|
let step;
|
|
74895
74974
|
try {
|
|
@@ -75350,7 +75429,7 @@ var init_apply = __esm(() => {
|
|
|
75350
75429
|
});
|
|
75351
75430
|
|
|
75352
75431
|
// packages/workit-cli/src/upgrade/plan.ts
|
|
75353
|
-
import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, rmSync as rmSync8, lstatSync as lstatSync7, readFileSync as
|
|
75432
|
+
import { existsSync as existsSync22, mkdtempSync as mkdtempSync3, rmSync as rmSync8, lstatSync as lstatSync7, readFileSync as readFileSync23 } from "node:fs";
|
|
75354
75433
|
import path47 from "node:path";
|
|
75355
75434
|
import os17 from "node:os";
|
|
75356
75435
|
function previewUpgrade(hosts = HOSTS2, deps = {}) {
|
|
@@ -75504,7 +75583,7 @@ function previewUpgrade(hosts = HOSTS2, deps = {}) {
|
|
|
75504
75583
|
var codexRegistered = (configFile) => {
|
|
75505
75584
|
let text;
|
|
75506
75585
|
try {
|
|
75507
|
-
text =
|
|
75586
|
+
text = readFileSync23(configFile, "utf8");
|
|
75508
75587
|
} catch {
|
|
75509
75588
|
return false;
|
|
75510
75589
|
}
|
|
@@ -78904,7 +78983,7 @@ var exports_models = {};
|
|
|
78904
78983
|
__export(exports_models, {
|
|
78905
78984
|
run: () => run14
|
|
78906
78985
|
});
|
|
78907
|
-
import { existsSync as existsSync24, readdirSync as readdirSync13, readFileSync as
|
|
78986
|
+
import { existsSync as existsSync24, readdirSync as readdirSync13, readFileSync as readFileSync24, statSync as statSync9 } from "node:fs";
|
|
78908
78987
|
import os22 from "node:os";
|
|
78909
78988
|
import path55 from "node:path";
|
|
78910
78989
|
async function run14(argv, io) {
|
|
@@ -78967,7 +79046,7 @@ var USAGE8 = "workit models show [--role <role>] [--tier <tier>] [--host <host>]
|
|
|
78967
79046
|
const found = new Set;
|
|
78968
79047
|
let text = "";
|
|
78969
79048
|
try {
|
|
78970
|
-
text =
|
|
79049
|
+
text = readFileSync24(file, "utf8");
|
|
78971
79050
|
} catch {
|
|
78972
79051
|
return found;
|
|
78973
79052
|
}
|
|
@@ -78998,7 +79077,7 @@ var USAGE8 = "workit models show [--role <role>] [--tier <tier>] [--host <host>]
|
|
|
78998
79077
|
try {
|
|
78999
79078
|
if (statSync9(meta).mtimeMs < since)
|
|
79000
79079
|
continue;
|
|
79001
|
-
const agentType = JSON.parse(
|
|
79080
|
+
const agentType = JSON.parse(readFileSync24(meta, "utf8")).agentType;
|
|
79002
79081
|
const transcript = meta.replace(/\.meta\.json$/, ".jsonl");
|
|
79003
79082
|
if (typeof agentType !== "string" || !existsSync24(transcript))
|
|
79004
79083
|
continue;
|
|
@@ -79139,7 +79218,7 @@ var success2 = (data) => ({ ok: true, data }), failure3 = (code, error, unblock)
|
|
|
79139
79218
|
|
|
79140
79219
|
// packages/workit-core/src/git/ops.ts
|
|
79141
79220
|
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
79142
|
-
import { existsSync as existsSync25, readFileSync as
|
|
79221
|
+
import { existsSync as existsSync25, readFileSync as readFileSync25 } from "node:fs";
|
|
79143
79222
|
import path56 from "node:path";
|
|
79144
79223
|
function operationInProgress(cwd) {
|
|
79145
79224
|
const markers = [
|
|
@@ -79164,7 +79243,7 @@ function operationInProgress(cwd) {
|
|
|
79164
79243
|
if (index === 0 && existsSync25(path56.join(marker, "amend")) && !conflicted()) {
|
|
79165
79244
|
let headName = "";
|
|
79166
79245
|
try {
|
|
79167
|
-
headName =
|
|
79246
|
+
headName = readFileSync25(path56.join(marker, "head-name"), "utf8").trim();
|
|
79168
79247
|
} catch {}
|
|
79169
79248
|
const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
|
|
79170
79249
|
return { operation, commitAllowed: branch !== null, branch };
|
|
@@ -85860,7 +85939,7 @@ var init_duration = __esm(() => {
|
|
|
85860
85939
|
});
|
|
85861
85940
|
|
|
85862
85941
|
// packages/workit-cli/src/verbs/forge-common.ts
|
|
85863
|
-
import { readFileSync as
|
|
85942
|
+
import { readFileSync as readFileSync26 } from "node:fs";
|
|
85864
85943
|
function parseFlags(argv, spec) {
|
|
85865
85944
|
const parsed = { values: {}, booleans: new Set, lists: {}, positionals: [] };
|
|
85866
85945
|
for (let index = 0;index < argv.length; index += 1) {
|
|
@@ -86015,7 +86094,7 @@ var init_forge_common = __esm(() => {
|
|
|
86015
86094
|
forgeDeps = {
|
|
86016
86095
|
runner: undefined,
|
|
86017
86096
|
npm: undefined,
|
|
86018
|
-
readStdin: () =>
|
|
86097
|
+
readStdin: () => readFileSync26(0, "utf8"),
|
|
86019
86098
|
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
|
|
86020
86099
|
now: () => Date.now()
|
|
86021
86100
|
};
|
|
@@ -86026,12 +86105,12 @@ var exports_pr = {};
|
|
|
86026
86105
|
__export(exports_pr, {
|
|
86027
86106
|
run: () => run15
|
|
86028
86107
|
});
|
|
86029
|
-
import { readFileSync as
|
|
86108
|
+
import { readFileSync as readFileSync27 } from "node:fs";
|
|
86030
86109
|
import path66 from "node:path";
|
|
86031
86110
|
function readBodyFile(io, file) {
|
|
86032
86111
|
try {
|
|
86033
86112
|
return {
|
|
86034
|
-
body: file === "-" ? forgeDeps.readStdin() :
|
|
86113
|
+
body: file === "-" ? forgeDeps.readStdin() : readFileSync27(path66.resolve(io.cwd, file), "utf8")
|
|
86035
86114
|
};
|
|
86036
86115
|
} catch {
|
|
86037
86116
|
return `cannot read --body-file ${file}`;
|
|
@@ -86835,7 +86914,7 @@ var exports_git = {};
|
|
|
86835
86914
|
__export(exports_git, {
|
|
86836
86915
|
run: () => run17
|
|
86837
86916
|
});
|
|
86838
|
-
import { readFileSync as
|
|
86917
|
+
import { readFileSync as readFileSync28 } from "node:fs";
|
|
86839
86918
|
import path67 from "node:path";
|
|
86840
86919
|
function kindHint(cwd, kind) {
|
|
86841
86920
|
let kinds = [...BRANCH_KINDS];
|
|
@@ -86940,7 +87019,7 @@ function commitMessage(parsed, io) {
|
|
|
86940
87019
|
|
|
86941
87020
|
`);
|
|
86942
87021
|
try {
|
|
86943
|
-
return file === "-" ?
|
|
87022
|
+
return file === "-" ? readFileSync28(0, "utf8") : readFileSync28(path67.resolve(io.cwd, file), "utf8");
|
|
86944
87023
|
} catch (error) {
|
|
86945
87024
|
return {
|
|
86946
87025
|
error: `cannot read -F ${file}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -88101,6 +88180,11 @@ async function run19(argv, io) {
|
|
|
88101
88180
|
if (!result.ok)
|
|
88102
88181
|
return forgeFail(io, result);
|
|
88103
88182
|
const report = result.data;
|
|
88183
|
+
if (report.delivered && expect === "merged") {
|
|
88184
|
+
try {
|
|
88185
|
+
closeDeliveredTasks(new TaskStore(io.cwd), new Date().toISOString().replace(/\.\d{3}Z$/, "Z"));
|
|
88186
|
+
} catch {}
|
|
88187
|
+
}
|
|
88104
88188
|
if (report.delivered)
|
|
88105
88189
|
return emit(io, ok2(report), render2);
|
|
88106
88190
|
const failed = report.observations.filter((entry) => !entry.ok);
|
|
@@ -88119,6 +88203,8 @@ var USAGE12 = "workit verify-delivery [push|pr|merge|release] [--expect pushed|p
|
|
|
88119
88203
|
];
|
|
88120
88204
|
var init_verify_delivery = __esm(() => {
|
|
88121
88205
|
init_verify();
|
|
88206
|
+
init_task_store();
|
|
88207
|
+
init_task_delivery();
|
|
88122
88208
|
init_ledger();
|
|
88123
88209
|
init_output();
|
|
88124
88210
|
init_forge_common();
|
|
@@ -105693,7 +105779,7 @@ var init_rules = __esm(() => {
|
|
|
105693
105779
|
|
|
105694
105780
|
// packages/workit-cli/src/test-audit/audit.ts
|
|
105695
105781
|
import { spawnSync as spawnSync29 } from "node:child_process";
|
|
105696
|
-
import { existsSync as existsSync26, readdirSync as readdirSync14, readFileSync as
|
|
105782
|
+
import { existsSync as existsSync26, readdirSync as readdirSync14, readFileSync as readFileSync29, statSync as statSync10 } from "node:fs";
|
|
105697
105783
|
import path71 from "node:path";
|
|
105698
105784
|
function git7(cwd, args) {
|
|
105699
105785
|
const run = spawnSync29("git", ["-c", "core.quotepath=off", ...args], {
|
|
@@ -105773,7 +105859,7 @@ function auditFiles(files, display) {
|
|
|
105773
105859
|
const shown = display(file);
|
|
105774
105860
|
let parsed;
|
|
105775
105861
|
try {
|
|
105776
|
-
parsed = parseSource(
|
|
105862
|
+
parsed = parseSource(readFileSync29(file, "utf8"), file);
|
|
105777
105863
|
} catch (error) {
|
|
105778
105864
|
parseErrors.push({
|
|
105779
105865
|
file: shown,
|
|
@@ -105841,14 +105927,14 @@ import {
|
|
|
105841
105927
|
mkdirSync as mkdirSync12,
|
|
105842
105928
|
mkdtempSync as mkdtempSync4,
|
|
105843
105929
|
readdirSync as readdirSync15,
|
|
105844
|
-
readFileSync as
|
|
105930
|
+
readFileSync as readFileSync30,
|
|
105845
105931
|
readlinkSync as readlinkSync3,
|
|
105846
105932
|
realpathSync as realpathSync10,
|
|
105847
105933
|
renameSync as renameSync7,
|
|
105848
105934
|
rmSync as rmSync9,
|
|
105849
105935
|
statSync as statSync11,
|
|
105850
105936
|
symlinkSync,
|
|
105851
|
-
writeFileSync as
|
|
105937
|
+
writeFileSync as writeFileSync13,
|
|
105852
105938
|
copyFileSync as copyFileSync8
|
|
105853
105939
|
} from "node:fs";
|
|
105854
105940
|
import os23 from "node:os";
|
|
@@ -105950,7 +106036,7 @@ function removeStaleCopies(tmp = os23.tmpdir()) {
|
|
|
105950
106036
|
const stat = lstatSync8(dir);
|
|
105951
106037
|
if (!stat.isDirectory() || uid !== undefined && stat.uid !== uid)
|
|
105952
106038
|
continue;
|
|
105953
|
-
const pid = Number(
|
|
106039
|
+
const pid = Number(readFileSync30(path72.join(dir, PID_FILE), "utf8"));
|
|
105954
106040
|
if (Number.isInteger(pid) && pid > 0 && alive(pid))
|
|
105955
106041
|
continue;
|
|
105956
106042
|
} catch (error) {
|
|
@@ -106020,13 +106106,13 @@ function writeInside(copy, file, content) {
|
|
|
106020
106106
|
return false;
|
|
106021
106107
|
}
|
|
106022
106108
|
const temp = `${target}.workit-mutant-${process.pid}`;
|
|
106023
|
-
|
|
106109
|
+
writeFileSync13(temp, content);
|
|
106024
106110
|
renameSync7(temp, target);
|
|
106025
106111
|
return true;
|
|
106026
106112
|
}
|
|
106027
106113
|
function copyWorkingTree(repo) {
|
|
106028
106114
|
const dir = mkdtempSync4(path72.join(os23.tmpdir(), TEMP_PREFIX));
|
|
106029
|
-
|
|
106115
|
+
writeFileSync13(path72.join(dir, PID_FILE), String(process.pid));
|
|
106030
106116
|
const tree = path72.join(dir, "tree");
|
|
106031
106117
|
const head = git7(repo, ["rev-parse", "--verify", "--quiet", "HEAD"]).stdout.trim();
|
|
106032
106118
|
if (head && git7(dir, ["clone", "-q", "--shared", "--no-checkout", repo, tree]).ok) {
|
|
@@ -106105,7 +106191,7 @@ async function runMutation(options) {
|
|
|
106105
106191
|
const tracked = git7(repo, ["ls-files", "-co", "--exclude-standard", "-z"]).stdout.split("\x00").filter(Boolean);
|
|
106106
106192
|
const testFiles = tracked.filter((file) => TEST_FILE.test(file)).map((file) => {
|
|
106107
106193
|
try {
|
|
106108
|
-
return { file, text:
|
|
106194
|
+
return { file, text: readFileSync30(path72.join(repo, file), "utf8") };
|
|
106109
106195
|
} catch {
|
|
106110
106196
|
return { file, text: "" };
|
|
106111
106197
|
}
|
|
@@ -106118,7 +106204,7 @@ async function runMutation(options) {
|
|
|
106118
106204
|
if (NOT_SOURCE.test(relative) || !existsSync27(absolute))
|
|
106119
106205
|
continue;
|
|
106120
106206
|
try {
|
|
106121
|
-
candidates.push(...mutantsFor(
|
|
106207
|
+
candidates.push(...mutantsFor(readFileSync30(absolute, "utf8"), relative, lines));
|
|
106122
106208
|
} catch {}
|
|
106123
106209
|
}
|
|
106124
106210
|
const mutants = candidates.map((mutant, index) => ({ ...mutant, id: index + 1 }));
|
|
@@ -106199,7 +106285,7 @@ async function runMutation(options) {
|
|
|
106199
106285
|
record({ ...mutant, status: "skipped", durationMs: 0, tests, reason: "budget" });
|
|
106200
106286
|
continue;
|
|
106201
106287
|
}
|
|
106202
|
-
const original =
|
|
106288
|
+
const original = readFileSync30(path72.join(copy, mutant.file), "utf8");
|
|
106203
106289
|
const mutated = original.slice(0, mutant.start) + mutant.replacement + original.slice(mutant.end);
|
|
106204
106290
|
current = { file: mutant.file, original };
|
|
106205
106291
|
if (!writeInside(copy, mutant.file, mutated)) {
|
|
@@ -106550,7 +106636,7 @@ var exports_youtrack = {};
|
|
|
106550
106636
|
__export(exports_youtrack, {
|
|
106551
106637
|
run: () => run25
|
|
106552
106638
|
});
|
|
106553
|
-
import { readFileSync as
|
|
106639
|
+
import { readFileSync as readFileSync31 } from "node:fs";
|
|
106554
106640
|
import path74 from "node:path";
|
|
106555
106641
|
async function run25(argv, io) {
|
|
106556
106642
|
const [sub, ...rest] = argv;
|
|
@@ -106597,7 +106683,7 @@ async function run25(argv, io) {
|
|
|
106597
106683
|
let markdown = flags.values.markdown ?? "";
|
|
106598
106684
|
if (flags.values.file)
|
|
106599
106685
|
try {
|
|
106600
|
-
markdown =
|
|
106686
|
+
markdown = readFileSync31(path74.resolve(io.cwd, flags.values.file), "utf8");
|
|
106601
106687
|
} catch (error) {
|
|
106602
106688
|
return usage4(io, `cannot read ${flags.values.file}: ${String(error)}`, USAGE18);
|
|
106603
106689
|
}
|
|
@@ -106665,7 +106751,7 @@ var exports_changelog = {};
|
|
|
106665
106751
|
__export(exports_changelog, {
|
|
106666
106752
|
run: () => run26
|
|
106667
106753
|
});
|
|
106668
|
-
import { readFileSync as
|
|
106754
|
+
import { readFileSync as readFileSync32 } from "node:fs";
|
|
106669
106755
|
import path75 from "node:path";
|
|
106670
106756
|
async function run26(argv, io) {
|
|
106671
106757
|
const [sub, ...rest] = argv;
|
|
@@ -106712,7 +106798,7 @@ async function run26(argv, io) {
|
|
|
106712
106798
|
]);
|
|
106713
106799
|
}
|
|
106714
106800
|
var USAGE19 = "workit changelog apply (--entries <JSON|@file|-> | --normalize-only) [--path CHANGELOG.md] [--preview]", readEntries = (raw, cwd) => {
|
|
106715
|
-
const text = raw === "-" ?
|
|
106801
|
+
const text = raw === "-" ? readFileSync32(0, "utf8") : raw.startsWith("@") ? readFileSync32(path75.resolve(cwd, raw.slice(1)), "utf8") : raw;
|
|
106716
106802
|
return JSON.parse(text);
|
|
106717
106803
|
};
|
|
106718
106804
|
var init_changelog2 = __esm(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-cli",
|
|
3
|
-
"version": "8.38.
|
|
3
|
+
"version": "8.38.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
|
|
6
6
|
"keywords": [
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@babel/parser": "7.29.9",
|
|
41
|
-
"@brainervirus/workit-cursor": "^8.38.
|
|
41
|
+
"@brainervirus/workit-cursor": "^8.38.4",
|
|
42
42
|
"@inkjs/ui": "2.0.0",
|
|
43
43
|
"ink": "7.1.1",
|
|
44
44
|
"react": "19.2.8"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@brainervirus/workit-core": "^8.38.
|
|
47
|
+
"@brainervirus/workit-core": "^8.38.4"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=24"
|