@brainervirus/workit-claude-code 8.40.3 → 8.40.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/.claude-plugin/plugin.json +1 -1
- package/dist/workit-hook.js +86 -86
- package/dist/workit.js +201 -167
- package/package.json +3 -3
package/dist/workit.js
CHANGED
|
@@ -6389,7 +6389,7 @@ var init_zod = __esm(() => {
|
|
|
6389
6389
|
// packages/workit-core/src/core/workspaces.ts
|
|
6390
6390
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
6391
6391
|
import { createHash } from "node:crypto";
|
|
6392
|
-
import { readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
6392
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
6393
6393
|
import path2 from "node:path";
|
|
6394
6394
|
function workspaceDefaultTarget(cwd, globalDefault) {
|
|
6395
6395
|
const ws = resolveRuntimeWorkspaceVcs(cwd);
|
|
@@ -6531,10 +6531,17 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
6531
6531
|
};
|
|
6532
6532
|
}
|
|
6533
6533
|
return { ok: true };
|
|
6534
|
-
}, WorkspaceConfigError,
|
|
6535
|
-
const cached =
|
|
6534
|
+
}, WorkspaceConfigError, probes, probeCheckout = (cwd) => {
|
|
6535
|
+
const cached = probes.get(cwd);
|
|
6536
6536
|
if (cached !== undefined)
|
|
6537
6537
|
return cached;
|
|
6538
|
+
let dir = path2.resolve(cwd);
|
|
6539
|
+
while (!existsSync2(path2.join(dir, ".git"))) {
|
|
6540
|
+
const up = path2.dirname(dir);
|
|
6541
|
+
if (up === dir)
|
|
6542
|
+
return null;
|
|
6543
|
+
dir = up;
|
|
6544
|
+
}
|
|
6538
6545
|
const env = { ...process.env };
|
|
6539
6546
|
for (const name of ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"])
|
|
6540
6547
|
delete env[name];
|
|
@@ -6548,15 +6555,43 @@ var nonBlank, branchPreset, commitPreset, workspaceBranchPolicySchema, workspace
|
|
|
6548
6555
|
});
|
|
6549
6556
|
return run.status === 0 ? run.stdout : null;
|
|
6550
6557
|
};
|
|
6558
|
+
const failed = Error(`git could not tell what checkout ${cwd} is`);
|
|
6559
|
+
const [gitDir, common, superproject] = (git([
|
|
6560
|
+
"rev-parse",
|
|
6561
|
+
"--path-format=absolute",
|
|
6562
|
+
"--git-dir",
|
|
6563
|
+
"--git-common-dir",
|
|
6564
|
+
"--show-superproject-working-tree"
|
|
6565
|
+
]) ?? "").trim().split(/\r?\n/u);
|
|
6566
|
+
if (!gitDir || !common)
|
|
6567
|
+
return failed;
|
|
6551
6568
|
let main = null;
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
main =
|
|
6557
|
-
}
|
|
6558
|
-
|
|
6559
|
-
|
|
6569
|
+
if (path2.resolve(gitDir) !== path2.resolve(common)) {
|
|
6570
|
+
const list = git(["worktree", "list", "--porcelain"]);
|
|
6571
|
+
if (list === null)
|
|
6572
|
+
return failed;
|
|
6573
|
+
main = /^worktree (.+)$/mu.exec(list)?.[1]?.trim() || (path2.basename(common) === ".git" ? path2.dirname(common) : common);
|
|
6574
|
+
}
|
|
6575
|
+
const probe = { main, superproject: superproject || null };
|
|
6576
|
+
probes.set(cwd, probe);
|
|
6577
|
+
return probe;
|
|
6578
|
+
}, mainCheckoutOf = (cwd) => {
|
|
6579
|
+
const probe = probeCheckout(cwd);
|
|
6580
|
+
return probe instanceof Error ? null : probe?.main ?? null;
|
|
6581
|
+
}, checkoutsAbove = (cwd, seen = new Set) => {
|
|
6582
|
+
const probe = probeCheckout(cwd);
|
|
6583
|
+
if (probe instanceof Error)
|
|
6584
|
+
return probe;
|
|
6585
|
+
const out = [];
|
|
6586
|
+
for (const above of [probe?.main, probe?.superproject])
|
|
6587
|
+
if (above && !seen.has(above)) {
|
|
6588
|
+
seen.add(above);
|
|
6589
|
+
const rest = checkoutsAbove(above, seen);
|
|
6590
|
+
if (rest instanceof Error)
|
|
6591
|
+
return rest;
|
|
6592
|
+
out.push(above, ...rest);
|
|
6593
|
+
}
|
|
6594
|
+
return out;
|
|
6560
6595
|
}, matchingEntries = (cwd, entries) => {
|
|
6561
6596
|
const match = (where) => {
|
|
6562
6597
|
const targets = [where, realpathOf(where)].map((value) => value.replaceAll("\\", "/"));
|
|
@@ -6999,7 +7034,7 @@ var init_workspaces = __esm(() => {
|
|
|
6999
7034
|
WorkspaceConfigError = class WorkspaceConfigError extends Error {
|
|
7000
7035
|
name = "WorkspaceConfigError";
|
|
7001
7036
|
};
|
|
7002
|
-
|
|
7037
|
+
probes = new Map;
|
|
7003
7038
|
runtimeWorkspaceIndexSchema = object({
|
|
7004
7039
|
workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
|
|
7005
7040
|
}).passthrough();
|
|
@@ -9317,7 +9352,7 @@ var package_default;
|
|
|
9317
9352
|
var init_package = __esm(() => {
|
|
9318
9353
|
package_default = {
|
|
9319
9354
|
name: "@brainervirus/workit-cli",
|
|
9320
|
-
version: "8.40.
|
|
9355
|
+
version: "8.40.4",
|
|
9321
9356
|
private: false,
|
|
9322
9357
|
description: "Workit CLI — setup wizard, doctor, and task control for agentic coding workflows",
|
|
9323
9358
|
keywords: [
|
|
@@ -9355,13 +9390,13 @@ var init_package = __esm(() => {
|
|
|
9355
9390
|
},
|
|
9356
9391
|
dependencies: {
|
|
9357
9392
|
"@babel/parser": "7.29.9",
|
|
9358
|
-
"@brainervirus/workit-cursor": "^8.40.
|
|
9393
|
+
"@brainervirus/workit-cursor": "^8.40.4",
|
|
9359
9394
|
"@inkjs/ui": "2.0.0",
|
|
9360
9395
|
ink: "7.1.1",
|
|
9361
9396
|
react: "19.2.8"
|
|
9362
9397
|
},
|
|
9363
9398
|
devDependencies: {
|
|
9364
|
-
"@brainervirus/workit-core": "^8.40.
|
|
9399
|
+
"@brainervirus/workit-core": "^8.40.4"
|
|
9365
9400
|
},
|
|
9366
9401
|
engines: {
|
|
9367
9402
|
node: ">=24"
|
|
@@ -9700,7 +9735,7 @@ function writeFileAtomic(file, content, mode) {
|
|
|
9700
9735
|
var init_safe_write = () => {};
|
|
9701
9736
|
|
|
9702
9737
|
// packages/workit-core/src/autonomy.ts
|
|
9703
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
9738
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync3 } from "node:fs";
|
|
9704
9739
|
import os4 from "node:os";
|
|
9705
9740
|
import path11 from "node:path";
|
|
9706
9741
|
function endpointOf(entry) {
|
|
@@ -9726,7 +9761,7 @@ function effectiveEndpoint(endpoint, context) {
|
|
|
9726
9761
|
if (context.configured.length > 0 && !context.accountConfigured)
|
|
9727
9762
|
return {
|
|
9728
9763
|
endpoint: "commit",
|
|
9729
|
-
reason: `vcs.account missing;
|
|
9764
|
+
reason: `vcs.account missing; ${accountHint(context.workspace)}`
|
|
9730
9765
|
};
|
|
9731
9766
|
if (endpoint === "merged" && context.grants.merge === false)
|
|
9732
9767
|
return { endpoint: "green", reason: missing("merge") };
|
|
@@ -9800,17 +9835,28 @@ function autonomyOf(workspace) {
|
|
|
9800
9835
|
verification: verificationOf(workspace)
|
|
9801
9836
|
};
|
|
9802
9837
|
}
|
|
9803
|
-
function
|
|
9804
|
-
|
|
9838
|
+
function capAt(named, where, by, why, main = false) {
|
|
9839
|
+
let folder = null;
|
|
9840
|
+
let none = "";
|
|
9841
|
+
try {
|
|
9842
|
+
if (where instanceof Error)
|
|
9843
|
+
throw where;
|
|
9844
|
+
folder = autonomyOf(resolveWorkspaceFrom(where, grantsDir()));
|
|
9845
|
+
} catch (error) {
|
|
9846
|
+
none = error.message;
|
|
9847
|
+
}
|
|
9848
|
+
if (!main && folder?.workspace === named.workspace)
|
|
9805
9849
|
return named;
|
|
9806
9850
|
const nothing = !folder || folder.configured.length > 0 && !folder.accountConfigured;
|
|
9807
9851
|
const grants = { ...named.grants };
|
|
9852
|
+
const unblocks = { ...named.unblocks };
|
|
9808
9853
|
const lowered = [];
|
|
9809
9854
|
for (const kind of GRANT_KINDS) {
|
|
9810
9855
|
const floor = !nothing && folder.grants[kind];
|
|
9811
9856
|
if (!raises(kind, floor, grants[kind]))
|
|
9812
9857
|
continue;
|
|
9813
9858
|
grants[kind] = floor;
|
|
9859
|
+
unblocks[kind] = folder ? nothing ? accountHint(folder.workspace) : grantHint(folder.workspace, kind) : `ask the user to fix: ${none}`;
|
|
9814
9860
|
lowered.push(kind);
|
|
9815
9861
|
}
|
|
9816
9862
|
const ceiling = !nothing && folder.effectiveEndpoint || DEFAULT_ENDPOINT;
|
|
@@ -9823,40 +9869,28 @@ function capByFolder(named, folder, name) {
|
|
|
9823
9869
|
lowered.push("verification");
|
|
9824
9870
|
if (lowered.length === 0)
|
|
9825
9871
|
return named;
|
|
9872
|
+
const note = `${by}: ${lowered.join(", ")} capped at ${folder ? `workspace ${folder.workspace}` : `nothing (${none})`}; ${why}`;
|
|
9826
9873
|
return {
|
|
9827
9874
|
...named,
|
|
9828
9875
|
grants,
|
|
9876
|
+
unblocks,
|
|
9829
9877
|
...endpoint ? { effectiveEndpoint: ceiling, endpointReason: undefined } : {},
|
|
9830
9878
|
verification: looser ? strict : named.verification,
|
|
9831
|
-
note:
|
|
9879
|
+
note: named.note ? `${named.note}; ${note}` : note
|
|
9832
9880
|
};
|
|
9833
9881
|
}
|
|
9834
9882
|
function resolveAutonomy(cwd) {
|
|
9835
9883
|
const override = grantsOverride();
|
|
9836
9884
|
if (override)
|
|
9837
|
-
return {
|
|
9838
|
-
workspace: null,
|
|
9839
|
-
grants: { ...DEFAULT_GRANTS },
|
|
9840
|
-
configured: [],
|
|
9841
|
-
source: "default",
|
|
9842
|
-
accountConfigured: false,
|
|
9843
|
-
defaultEndpoint: DEFAULT_ENDPOINT,
|
|
9844
|
-
configuredEndpoint: null,
|
|
9845
|
-
effectiveEndpoint: DEFAULT_ENDPOINT,
|
|
9846
|
-
verification: DEFAULT_VERIFICATION,
|
|
9847
|
-
note: override
|
|
9848
|
-
};
|
|
9885
|
+
return { ...autonomyOf(null), note: override };
|
|
9849
9886
|
const name = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
|
|
9850
|
-
|
|
9851
|
-
if (name
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
folder = null;
|
|
9858
|
-
}
|
|
9859
|
-
return capByFolder(named, folder, name);
|
|
9887
|
+
let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
|
|
9888
|
+
if (name)
|
|
9889
|
+
autonomy = capAt(autonomy, cwd, `WORKFLOW_WORKSPACE_NAME=${name}`, "a name never raises grants");
|
|
9890
|
+
const above = checkoutsAbove(cwd);
|
|
9891
|
+
for (const where of above instanceof Error ? [above] : above)
|
|
9892
|
+
autonomy = capAt(autonomy, where, where instanceof Error ? "git" : `checkout ${where}`, "a worktree or submodule never exceeds it", true);
|
|
9893
|
+
return autonomy;
|
|
9860
9894
|
}
|
|
9861
9895
|
function requireGrant(cwd, kind, options = {}) {
|
|
9862
9896
|
let autonomy;
|
|
@@ -9881,7 +9915,7 @@ function requireGrant(cwd, kind, options = {}) {
|
|
|
9881
9915
|
kind,
|
|
9882
9916
|
reason: "grant_required",
|
|
9883
9917
|
error: `grant_required: ${kind} is not granted for ${workspace ? `workspace "${workspace}"` : "this checkout (no workspace matches it)"}${configured ? "" : " (the default ceiling stops at verified, ready)"}${autonomy.note ? `; ${autonomy.note}` : ""}`,
|
|
9884
|
-
unblock: workspace ? grantHint(workspace, kind) : "ask the user to add a workspace for this checkout (workit init → Workspaces), then: workit grant set <workspace> " + `${kind}=${suggested(kind)}
|
|
9918
|
+
unblock: autonomy.unblocks?.[kind] ?? (workspace ? grantHint(workspace, kind) : "ask the user to add a workspace for this checkout (workit init → Workspaces), then: workit grant set <workspace> " + `${kind}=${suggested(kind)}`),
|
|
9885
9919
|
workspace
|
|
9886
9920
|
};
|
|
9887
9921
|
if (autonomy.configured.length > 0 && !autonomy.accountConfigured && options.forge !== false && kind !== "release")
|
|
@@ -9890,7 +9924,7 @@ function requireGrant(cwd, kind, options = {}) {
|
|
|
9890
9924
|
kind,
|
|
9891
9925
|
reason: "account_required",
|
|
9892
9926
|
error: `account_required: workspace "${workspace ?? "?"}" has autonomy grants but no vcs.account, so the credential cannot be checked`,
|
|
9893
|
-
unblock:
|
|
9927
|
+
unblock: accountHint(workspace),
|
|
9894
9928
|
workspace
|
|
9895
9929
|
};
|
|
9896
9930
|
return {
|
|
@@ -9947,7 +9981,7 @@ function writeGrants(workspaceName, changes, dir = grantsDir(), endpoint, verifi
|
|
|
9947
9981
|
return { ok: false, code: "failed", error: `${current.path} changed; retry` };
|
|
9948
9982
|
let backup = null;
|
|
9949
9983
|
try {
|
|
9950
|
-
if (
|
|
9984
|
+
if (existsSync3(current.path)) {
|
|
9951
9985
|
backup = `${current.path}.bak`;
|
|
9952
9986
|
copyFileSync2(current.path, backup);
|
|
9953
9987
|
}
|
|
@@ -10028,7 +10062,7 @@ var accountHome = () => {
|
|
|
10028
10062
|
else if (item === "merge")
|
|
10029
10063
|
grants.merge = "verified";
|
|
10030
10064
|
return Object.keys(grants).length > 0 ? grants : null;
|
|
10031
|
-
}, accountOf = (entry) => entry?.vcs?.account, suggested = (kind) => kind === "merge" ? "verified" : "true", grantHint = (workspace, kind) => `ask the user to run, in their own terminal: workit grant set ${workspace ?? "<workspace>"} ${kind}=${suggested(kind)}`, raises = (kind, current, next) => {
|
|
10065
|
+
}, accountOf = (entry) => entry?.vcs?.account, suggested = (kind) => kind === "merge" ? "verified" : "true", accountHint = (workspace) => `set vcs.account for workspace "${workspace ?? "?"}" in ~/.config/workit/workspaces.json`, grantHint = (workspace, kind) => `ask the user to run, in their own terminal: workit grant set ${workspace ?? "<workspace>"} ${kind}=${suggested(kind)}`, raises = (kind, current, next) => {
|
|
10032
10066
|
const rank = (value) => value === true ? 2 : value === "verified" ? 1 : 0;
|
|
10033
10067
|
return rank(normalized(kind, next)) > rank(normalized(kind, current));
|
|
10034
10068
|
};
|
|
@@ -10686,21 +10720,21 @@ var init_file_lock = __esm(() => {
|
|
|
10686
10720
|
});
|
|
10687
10721
|
|
|
10688
10722
|
// packages/workit-core/src/core/package-root.ts
|
|
10689
|
-
import { existsSync as
|
|
10723
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
10690
10724
|
import path14 from "node:path";
|
|
10691
10725
|
import { fileURLToPath } from "node:url";
|
|
10692
10726
|
var packageRoot = () => {
|
|
10693
10727
|
let dir = path14.dirname(fileURLToPath(import.meta.url));
|
|
10694
10728
|
while (true) {
|
|
10695
10729
|
const parent = path14.dirname(dir);
|
|
10696
|
-
if (
|
|
10730
|
+
if (existsSync4(path14.join(dir, "package.json")) || parent === dir)
|
|
10697
10731
|
return dir;
|
|
10698
10732
|
dir = parent;
|
|
10699
10733
|
}
|
|
10700
10734
|
}, assetRoot = () => {
|
|
10701
10735
|
const root = packageRoot();
|
|
10702
10736
|
const assets = path14.join(root, "assets");
|
|
10703
|
-
return
|
|
10737
|
+
return existsSync4(assets) ? assets : root;
|
|
10704
10738
|
};
|
|
10705
10739
|
var init_package_root = () => {};
|
|
10706
10740
|
|
|
@@ -14307,7 +14341,7 @@ var init_substance = __esm(() => {
|
|
|
14307
14341
|
});
|
|
14308
14342
|
|
|
14309
14343
|
// packages/workit-core/src/core/policy/lane.ts
|
|
14310
|
-
import { existsSync as
|
|
14344
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "node:fs";
|
|
14311
14345
|
import path18 from "node:path";
|
|
14312
14346
|
function kindOf(file) {
|
|
14313
14347
|
if (file.binary)
|
|
@@ -14521,7 +14555,7 @@ function branchLane(cwd, options) {
|
|
|
14521
14555
|
}
|
|
14522
14556
|
function untrackedRiskPathsWarning(cwd) {
|
|
14523
14557
|
const root = worktreeTop(cwd);
|
|
14524
|
-
if (!root || !
|
|
14558
|
+
if (!root || !existsSync6(path18.join(root, RISK_PATHS_FILE)))
|
|
14525
14559
|
return null;
|
|
14526
14560
|
return isTracked(root, RISK_PATHS_FILE) ? null : `${RISK_PATHS_FILE} is not committed: it does not apply until it is committed on the base branch`;
|
|
14527
14561
|
}
|
|
@@ -16139,7 +16173,7 @@ var init_ledger = __esm(() => {
|
|
|
16139
16173
|
});
|
|
16140
16174
|
|
|
16141
16175
|
// packages/workit-core/src/core/policy/derive.ts
|
|
16142
|
-
import { existsSync as
|
|
16176
|
+
import { existsSync as existsSync7 } from "node:fs";
|
|
16143
16177
|
import path21 from "node:path";
|
|
16144
16178
|
function deriveRequirements(judgment, scope, constraints, verification = "self") {
|
|
16145
16179
|
const out = [];
|
|
@@ -16294,7 +16328,7 @@ var RULES, derived2 = (spec) => ({
|
|
|
16294
16328
|
decisionIds: []
|
|
16295
16329
|
};
|
|
16296
16330
|
}, planRecorded = (task, root) => {
|
|
16297
|
-
const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" &&
|
|
16331
|
+
const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" && existsSync7(path21.resolve(root, ref.path)));
|
|
16298
16332
|
if (cited)
|
|
16299
16333
|
return {
|
|
16300
16334
|
met: true,
|
|
@@ -21311,7 +21345,7 @@ var init_context_read = __esm(() => {
|
|
|
21311
21345
|
});
|
|
21312
21346
|
|
|
21313
21347
|
// packages/workit-core/src/core.ts
|
|
21314
|
-
import { existsSync as
|
|
21348
|
+
import { existsSync as existsSync9, realpathSync as realpathSync6 } from "node:fs";
|
|
21315
21349
|
import path26 from "node:path";
|
|
21316
21350
|
function resolveInside(root, candidate) {
|
|
21317
21351
|
const base = realpathSync6(root);
|
|
@@ -21320,7 +21354,7 @@ function resolveInside(root, candidate) {
|
|
|
21320
21354
|
throw new Error("path must stay inside repository root");
|
|
21321
21355
|
}
|
|
21322
21356
|
let ancestor = target;
|
|
21323
|
-
while (!
|
|
21357
|
+
while (!existsSync9(ancestor))
|
|
21324
21358
|
ancestor = path26.dirname(ancestor);
|
|
21325
21359
|
const canonicalAncestor = realpathSync6(ancestor);
|
|
21326
21360
|
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path26.sep)) {
|
|
@@ -65556,10 +65590,10 @@ var init_changelog = __esm(() => {
|
|
|
65556
65590
|
|
|
65557
65591
|
// packages/workit-core/src/core/hygiene.ts
|
|
65558
65592
|
import { spawnSync as spawnSync12 } from "node:child_process";
|
|
65559
|
-
import { existsSync as
|
|
65593
|
+
import { existsSync as existsSync11, readFileSync as readFileSync11, readdirSync as readdirSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
65560
65594
|
import path29 from "node:path";
|
|
65561
65595
|
var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene"), packageJson = (root) => {
|
|
65562
|
-
if (!
|
|
65596
|
+
if (!existsSync11(path29.join(root, "package.json")))
|
|
65563
65597
|
return null;
|
|
65564
65598
|
try {
|
|
65565
65599
|
return JSON.parse(readFileSync11(path29.join(root, "package.json"), "utf8"));
|
|
@@ -65567,7 +65601,7 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
|
|
|
65567
65601
|
return null;
|
|
65568
65602
|
}
|
|
65569
65603
|
}, isOpenSource = (root) => {
|
|
65570
|
-
if (
|
|
65604
|
+
if (existsSync11(path29.join(root, "LICENSE")))
|
|
65571
65605
|
return true;
|
|
65572
65606
|
const pkg = packageJson(root);
|
|
65573
65607
|
if (pkg && !pkg.private)
|
|
@@ -65594,7 +65628,7 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
|
|
|
65594
65628
|
return { ok: true, root: path29.resolve(root) };
|
|
65595
65629
|
let children = [];
|
|
65596
65630
|
try {
|
|
65597
|
-
children = readdirSync5(start, { withFileTypes: true }).filter((entry) => entry.isDirectory() &&
|
|
65631
|
+
children = readdirSync5(start, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync11(path29.join(start, entry.name, ".git"))).map((entry) => path29.join(start, entry.name)).toSorted();
|
|
65598
65632
|
} catch {
|
|
65599
65633
|
children = [];
|
|
65600
65634
|
}
|
|
@@ -65610,10 +65644,10 @@ var repoRoot2, templatesDir = () => path29.join(repoRoot2, "templates", "hygiene
|
|
|
65610
65644
|
files.push("LICENSE", "CONTRIBUTING.md");
|
|
65611
65645
|
const planned = [];
|
|
65612
65646
|
for (const file of files) {
|
|
65613
|
-
if (
|
|
65647
|
+
if (existsSync11(path29.join(root, file)))
|
|
65614
65648
|
continue;
|
|
65615
65649
|
const tpl = path29.join(templatesDir(), file);
|
|
65616
|
-
if (!
|
|
65650
|
+
if (!existsSync11(tpl))
|
|
65617
65651
|
continue;
|
|
65618
65652
|
const content = readFileSync11(tpl, "utf8").replace(/<PROJECT>/g, path29.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
|
|
65619
65653
|
planned.push({ path: path29.join(root, file), content });
|
|
@@ -65627,7 +65661,7 @@ var init_hygiene = __esm(() => {
|
|
|
65627
65661
|
});
|
|
65628
65662
|
|
|
65629
65663
|
// packages/workit-cli/src/admin/setup-state.ts
|
|
65630
|
-
import { existsSync as
|
|
65664
|
+
import { existsSync as existsSync12, readFileSync as readFileSync12 } from "node:fs";
|
|
65631
65665
|
import path30 from "node:path";
|
|
65632
65666
|
var classifySetupFile = (dir, name) => {
|
|
65633
65667
|
const file = path30.join(dir, name);
|
|
@@ -65635,7 +65669,7 @@ var classifySetupFile = (dir, name) => {
|
|
|
65635
65669
|
try {
|
|
65636
65670
|
raw = readFileSync12(file, "utf8");
|
|
65637
65671
|
} catch {
|
|
65638
|
-
if (
|
|
65672
|
+
if (existsSync12(file)) {
|
|
65639
65673
|
return { file, status: "malformed", error: `${file} is not readable` };
|
|
65640
65674
|
}
|
|
65641
65675
|
return { file, status: "missing" };
|
|
@@ -66073,7 +66107,7 @@ import { spawnSync as spawnSync14 } from "node:child_process";
|
|
|
66073
66107
|
import {
|
|
66074
66108
|
accessSync,
|
|
66075
66109
|
constants as constants2,
|
|
66076
|
-
existsSync as
|
|
66110
|
+
existsSync as existsSync13,
|
|
66077
66111
|
readFileSync as readFileSync13,
|
|
66078
66112
|
readdirSync as readdirSync6,
|
|
66079
66113
|
realpathSync as realpathSync7,
|
|
@@ -66096,7 +66130,7 @@ function hostCommand(name, args, options = {}) {
|
|
|
66096
66130
|
}
|
|
66097
66131
|
return { command: executable, args, cwd: options.cwd, purpose: `${name} CLI` };
|
|
66098
66132
|
}
|
|
66099
|
-
function resolveWindowsShimEntry(contents, shim, exists =
|
|
66133
|
+
function resolveWindowsShimEntry(contents, shim, exists = existsSync13) {
|
|
66100
66134
|
const root = path33.win32.dirname(shim);
|
|
66101
66135
|
const matches = contents.matchAll(/(["']?)([^\r\n"']*node_modules[\\/][^\r\n"']+?\.js)\1/gi);
|
|
66102
66136
|
for (const match of matches) {
|
|
@@ -66139,7 +66173,7 @@ function findHostExecutable(name, options = {}) {
|
|
|
66139
66173
|
}
|
|
66140
66174
|
return null;
|
|
66141
66175
|
}
|
|
66142
|
-
function installedHostApp(host, home, env = process.env, platform = process.platform, exists =
|
|
66176
|
+
function installedHostApp(host, home, env = process.env, platform = process.platform, exists = existsSync13) {
|
|
66143
66177
|
const candidates = [];
|
|
66144
66178
|
const pathApi = platform === "win32" ? path33.win32 : path33;
|
|
66145
66179
|
if (platform === "darwin") {
|
|
@@ -66296,7 +66330,7 @@ ${result.stdout}
|
|
|
66296
66330
|
${result.stderr}`;
|
|
66297
66331
|
if (command.packageRoot && command.packageTarget) {
|
|
66298
66332
|
try {
|
|
66299
|
-
if (!
|
|
66333
|
+
if (!existsSync13(command.packageRoot)) {
|
|
66300
66334
|
return {
|
|
66301
66335
|
ok: false,
|
|
66302
66336
|
results: [
|
|
@@ -66526,7 +66560,7 @@ var resolveWindowsShimScript = (shim) => {
|
|
|
66526
66560
|
path33.join(dir, "..", "node_modules", "npm", "bin", "npm-cli.js"),
|
|
66527
66561
|
path33.join(dir, "..", "lib", "node_modules", "npm", "bin", "npm-cli.js")
|
|
66528
66562
|
];
|
|
66529
|
-
return candidates.find((candidate) =>
|
|
66563
|
+
return candidates.find((candidate) => existsSync13(candidate)) ?? null;
|
|
66530
66564
|
};
|
|
66531
66565
|
var init_host_install = __esm(() => {
|
|
66532
66566
|
CLAUDE_PLUGIN_ID = `workit@${CLAUDE_MARKETPLACE_NAME}`;
|
|
@@ -66534,9 +66568,9 @@ var init_host_install = __esm(() => {
|
|
|
66534
66568
|
});
|
|
66535
66569
|
|
|
66536
66570
|
// packages/workit-core/src/core/skill-manifests.ts
|
|
66537
|
-
import { cpSync as cpSync3, existsSync as
|
|
66571
|
+
import { cpSync as cpSync3, existsSync as existsSync14, readFileSync as readFileSync14, readdirSync as readdirSync7, statSync as statSync3, writeFileSync as writeFileSync6 } from "node:fs";
|
|
66538
66572
|
import path34 from "node:path";
|
|
66539
|
-
var WORKIT_METHOD_SKILLS, skillManifestNames = (root) =>
|
|
66573
|
+
var WORKIT_METHOD_SKILLS, skillManifestNames = (root) => existsSync14(root) ? readdirSync7(root).filter((name) => existsSync14(path34.join(root, name, "SKILL.md"))).toSorted() : [], validateSkillManifests = (root, expected, label) => {
|
|
66540
66574
|
const actual = skillManifestNames(root);
|
|
66541
66575
|
const missing = expected.filter((name) => !actual.includes(name));
|
|
66542
66576
|
const extra = actual.filter((name) => !expected.includes(name));
|
|
@@ -66582,7 +66616,7 @@ var init_skill_manifests = __esm(() => {
|
|
|
66582
66616
|
import { spawnSync as spawnSync15 } from "node:child_process";
|
|
66583
66617
|
import {
|
|
66584
66618
|
chmodSync,
|
|
66585
|
-
existsSync as
|
|
66619
|
+
existsSync as existsSync15,
|
|
66586
66620
|
lstatSync as lstatSync4,
|
|
66587
66621
|
mkdirSync as mkdirSync5,
|
|
66588
66622
|
readFileSync as readFileSync15,
|
|
@@ -66594,7 +66628,7 @@ import {
|
|
|
66594
66628
|
import path35 from "node:path";
|
|
66595
66629
|
function inspectSessionHook(cwd, env = process.env) {
|
|
66596
66630
|
const none = { hooksDir: null, hookPath: null, helperPath: null, helperCurrent: false };
|
|
66597
|
-
if (!
|
|
66631
|
+
if (!existsSync15(cwd))
|
|
66598
66632
|
return { state: "not_git", ...none };
|
|
66599
66633
|
const top = run2(cwd, ["rev-parse", "--show-toplevel"], env);
|
|
66600
66634
|
if (!top.ok || !top.out)
|
|
@@ -66799,7 +66833,7 @@ exit 0
|
|
|
66799
66833
|
} catch {
|
|
66800
66834
|
return false;
|
|
66801
66835
|
}
|
|
66802
|
-
}, LEFTHOOK_CONFIGS, lefthookConfig = (top) => LEFTHOOK_CONFIGS.map((name) => path35.join(top, name)).find((file) =>
|
|
66836
|
+
}, LEFTHOOK_CONFIGS, lefthookConfig = (top) => LEFTHOOK_CONFIGS.map((name) => path35.join(top, name)).find((file) => existsSync15(file)) ?? null, isComment = (line) => /^\s*#/.test(line), COMMAND_SH, DIRECT_CALL, VAR_CALL, runsHelperText = (text) => {
|
|
66803
66837
|
const lines = text.split(/\r?\n/).filter((line) => !isComment(line));
|
|
66804
66838
|
const assigned = lines.some((line) => /(?:^|[\s;])h=/.test(line) && line.includes(HELPER_REF));
|
|
66805
66839
|
return lines.some((line) => DIRECT_CALL.test(line) || assigned && VAR_CALL.test(line));
|
|
@@ -66851,7 +66885,7 @@ exit 0
|
|
|
66851
66885
|
if (text === null || !runsHelperText(text))
|
|
66852
66886
|
return false;
|
|
66853
66887
|
return input.owner === "husky" && target !== input.hookPath || isExecutable(target);
|
|
66854
|
-
}, isHuskyV9 = (text, hooksDir) => /\$\(dirname (?:-- )?"\$0"\)\/h"/.test(text) &&
|
|
66888
|
+
}, isHuskyV9 = (text, hooksDir) => /\$\(dirname (?:-- )?"\$0"\)\/h"/.test(text) && existsSync15(path35.join(hooksDir, "h")), ownerOf = (text, hooksDir, top) => {
|
|
66855
66889
|
if (text.includes("husky.sh") || isHuskyV9(text, hooksDir))
|
|
66856
66890
|
return "husky";
|
|
66857
66891
|
if (/lefthook/i.test(text) || lefthookConfig(top))
|
|
@@ -67010,7 +67044,7 @@ var init_delivery_verbs = __esm(() => {
|
|
|
67010
67044
|
// packages/workit-cli/src/admin/host-permissions.ts
|
|
67011
67045
|
import {
|
|
67012
67046
|
copyFileSync as copyFileSync4,
|
|
67013
|
-
existsSync as
|
|
67047
|
+
existsSync as existsSync16,
|
|
67014
67048
|
readdirSync as readdirSync9,
|
|
67015
67049
|
mkdirSync as mkdirSync7,
|
|
67016
67050
|
readFileSync as readFileSync17,
|
|
@@ -67114,7 +67148,7 @@ function planHostPermissions(options) {
|
|
|
67114
67148
|
if (!PERMISSION_HOSTS.has(host))
|
|
67115
67149
|
continue;
|
|
67116
67150
|
const target = permissionTarget(host, paths);
|
|
67117
|
-
if (!
|
|
67151
|
+
if (!existsSync16(target.hostDir)) {
|
|
67118
67152
|
plan.notes.push(`${host}: not installed (${target.hostDir} is missing); nothing written`);
|
|
67119
67153
|
continue;
|
|
67120
67154
|
}
|
|
@@ -67267,7 +67301,7 @@ function applyHostPermissions(plan, options = {}) {
|
|
|
67267
67301
|
}
|
|
67268
67302
|
function permissionHealth(host, options = {}) {
|
|
67269
67303
|
const target = permissionTarget(host, options);
|
|
67270
|
-
if (!
|
|
67304
|
+
if (!existsSync16(target.hostDir))
|
|
67271
67305
|
return { state: "no-host" };
|
|
67272
67306
|
const text = readText4(target.file);
|
|
67273
67307
|
if (host === "codex") {
|
|
@@ -67301,7 +67335,7 @@ function permissionHealth(host, options = {}) {
|
|
|
67301
67335
|
}
|
|
67302
67336
|
function permissionCoverage(host, commands, options = {}) {
|
|
67303
67337
|
const target = permissionTarget(host, options);
|
|
67304
|
-
if (!
|
|
67338
|
+
if (!existsSync16(target.hostDir))
|
|
67305
67339
|
return { state: "no-host" };
|
|
67306
67340
|
const cwd = options.cwd ?? process.cwd();
|
|
67307
67341
|
let missing;
|
|
@@ -67486,7 +67520,7 @@ ${[...rules, ...lease, grant].join(`
|
|
|
67486
67520
|
return null;
|
|
67487
67521
|
}, setupCommand = (hosts) => `workit setup --hosts=${hosts.join(",")}`, removeCodexRules = (file, options = {}) => {
|
|
67488
67522
|
const expected = permissionTarget("codex", options).file;
|
|
67489
|
-
if (path38.resolve(file) !== path38.resolve(expected) || !
|
|
67523
|
+
if (path38.resolve(file) !== path38.resolve(expected) || !existsSync16(expected))
|
|
67490
67524
|
return false;
|
|
67491
67525
|
rmSync3(expected);
|
|
67492
67526
|
return true;
|
|
@@ -67627,7 +67661,7 @@ var init_host_permissions = __esm(() => {
|
|
|
67627
67661
|
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
67628
67662
|
import { createHash as createHash14 } from "node:crypto";
|
|
67629
67663
|
import {
|
|
67630
|
-
existsSync as
|
|
67664
|
+
existsSync as existsSync17,
|
|
67631
67665
|
lstatSync as lstatSync5,
|
|
67632
67666
|
mkdirSync as mkdirSync8,
|
|
67633
67667
|
mkdtempSync,
|
|
@@ -67645,7 +67679,7 @@ import path39 from "node:path";
|
|
|
67645
67679
|
var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
67646
67680
|
let dir = path39.resolve(cwd);
|
|
67647
67681
|
while (true) {
|
|
67648
|
-
if (
|
|
67682
|
+
if (existsSync17(path39.join(dir, "packages", "workit-core", "package.json")))
|
|
67649
67683
|
return dir;
|
|
67650
67684
|
const parent = path39.dirname(dir);
|
|
67651
67685
|
if (parent === dir)
|
|
@@ -67750,14 +67784,14 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67750
67784
|
}
|
|
67751
67785
|
return true;
|
|
67752
67786
|
}, resolveBun = (env) => {
|
|
67753
|
-
if (env.BUN &&
|
|
67787
|
+
if (env.BUN && existsSync17(env.BUN))
|
|
67754
67788
|
return env.BUN;
|
|
67755
67789
|
for (const candidate of [
|
|
67756
67790
|
path39.join(env.HOME || os12.homedir(), ".bun/bin/bun"),
|
|
67757
67791
|
"/usr/local/bin/bun",
|
|
67758
67792
|
"/usr/bin/bun"
|
|
67759
67793
|
]) {
|
|
67760
|
-
if (
|
|
67794
|
+
if (existsSync17(candidate))
|
|
67761
67795
|
return candidate;
|
|
67762
67796
|
}
|
|
67763
67797
|
return commandOnPath("bun", env) ? "bun" : null;
|
|
@@ -67982,7 +68016,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
67982
68016
|
const dir = path39.join(codexHome, "plugins", "cache", marketplace, "workit");
|
|
67983
68017
|
let versions = [];
|
|
67984
68018
|
try {
|
|
67985
|
-
versions = readdirSync10(dir).filter((v) =>
|
|
68019
|
+
versions = readdirSync10(dir).filter((v) => existsSync17(path39.join(dir, v, ".codex-plugin")));
|
|
67986
68020
|
} catch {
|
|
67987
68021
|
versions = [];
|
|
67988
68022
|
}
|
|
@@ -68091,7 +68125,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68091
68125
|
const installed = [];
|
|
68092
68126
|
for (const install of installs) {
|
|
68093
68127
|
const source = install.root ? path39.join(install.root, "agents") : null;
|
|
68094
|
-
const files = source &&
|
|
68128
|
+
const files = source && existsSync17(source) ? readdirSync10(source).filter((f) => f.endsWith(".toml")).toSorted() : [];
|
|
68095
68129
|
if (files.length === 0) {
|
|
68096
68130
|
problems.push(`${install.id} ${install.version ?? "?"} bundles no agents`);
|
|
68097
68131
|
fixes.push(`codex plugin remove ${install.id} && codex plugin add ${install.id}`);
|
|
@@ -68227,7 +68261,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68227
68261
|
return kept;
|
|
68228
68262
|
}, checkPiExtension = (res) => {
|
|
68229
68263
|
const agentDir = piAgentDirOf(res);
|
|
68230
|
-
if (!
|
|
68264
|
+
if (!existsSync17(agentDir) && !commandOnPath("pi", res.env))
|
|
68231
68265
|
return {
|
|
68232
68266
|
id: "pi_extension",
|
|
68233
68267
|
status: "pass",
|
|
@@ -68253,7 +68287,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68253
68287
|
fix: entry.npm ? installCmd(entry.scope, entry.source) : `restore ${entry.root}, then ${rebuild}`
|
|
68254
68288
|
};
|
|
68255
68289
|
const declared = Array.isArray(pkg.pi?.extensions) ? pkg.pi.extensions.some((e) => typeof e === "string" && e.replace(/^\.\//, "") === PI_EXTENSION) : false;
|
|
68256
|
-
if (!declared || !
|
|
68290
|
+
if (!declared || !existsSync17(path39.join(entry.root, PI_EXTENSION)))
|
|
68257
68291
|
return {
|
|
68258
68292
|
id: "pi_extension",
|
|
68259
68293
|
status: "warn",
|
|
@@ -68310,7 +68344,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68310
68344
|
switch (host) {
|
|
68311
68345
|
case "opencode": {
|
|
68312
68346
|
const packaged = path39.join(pkg, "assets", "skills");
|
|
68313
|
-
const root =
|
|
68347
|
+
const root = existsSync17(packaged) ? packaged : path39.join(dev, "packages", "workit-core", "skills");
|
|
68314
68348
|
return WORKIT_METHOD_SKILLS.map((skill) => path39.join(root, skill, "SKILL.md"));
|
|
68315
68349
|
}
|
|
68316
68350
|
case "cursor":
|
|
@@ -68324,7 +68358,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68324
68358
|
}
|
|
68325
68359
|
}, hostsFor = (host) => host === "cli" ? ["opencode", "cursor", "cli"] : [host], checkAssets = (res) => {
|
|
68326
68360
|
const dev = res.dev;
|
|
68327
|
-
const missing = dev ? hostsFor(res.host).flatMap((h) => assetPathsFor(h, dev).filter((p) => !
|
|
68361
|
+
const missing = dev ? hostsFor(res.host).flatMap((h) => assetPathsFor(h, dev).filter((p) => !existsSync17(p)).map((p) => `${h}: ${p}`)) : [];
|
|
68328
68362
|
if (res.host === "cursor" || res.host === "cli") {
|
|
68329
68363
|
const cursorError = validateCursorSkills(res.cursorPluginDir, WORKIT_METHOD_SKILLS);
|
|
68330
68364
|
if (cursorError)
|
|
@@ -68375,7 +68409,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68375
68409
|
return false;
|
|
68376
68410
|
}
|
|
68377
68411
|
}, registeredCursorLauncher = (res) => {
|
|
68378
|
-
if (!
|
|
68412
|
+
if (!existsSync17(res.cursorMcp))
|
|
68379
68413
|
return "invalid";
|
|
68380
68414
|
const config = readJson(res.cursorMcp);
|
|
68381
68415
|
if (!config)
|
|
@@ -68404,7 +68438,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68404
68438
|
};
|
|
68405
68439
|
}, canonicalCursorHook, isCanonicalCursorHook = (command, res) => command === canonicalCursorHook || command === cursorHooksEntry(res.cursorPluginDir).command, registeredCursorHook = (res) => {
|
|
68406
68440
|
const hooksFile = path39.join(res.cursorPluginDir, "hooks", "hooks-cursor.json");
|
|
68407
|
-
if (!
|
|
68441
|
+
if (!existsSync17(hooksFile))
|
|
68408
68442
|
return "invalid";
|
|
68409
68443
|
const config = readJson(hooksFile);
|
|
68410
68444
|
if (!config)
|
|
@@ -68447,7 +68481,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68447
68481
|
}
|
|
68448
68482
|
}
|
|
68449
68483
|
if (dev) {
|
|
68450
|
-
missing.push(...hosts.filter((h) => h !== "cursor").flatMap((h) => launcherSlotsFor(h, dev).filter((slot) => !slot.some((p) =>
|
|
68484
|
+
missing.push(...hosts.filter((h) => h !== "cursor").flatMap((h) => launcherSlotsFor(h, dev).filter((slot) => !slot.some((p) => existsSync17(p))).map((slot) => `${h}: ${slot.join(" or ")}`)));
|
|
68451
68485
|
}
|
|
68452
68486
|
if (missing.length > 0) {
|
|
68453
68487
|
return {
|
|
@@ -68473,7 +68507,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68473
68507
|
const problems = [];
|
|
68474
68508
|
const fixes = [];
|
|
68475
68509
|
if (hostsFor(res.host).includes("cursor")) {
|
|
68476
|
-
const settings =
|
|
68510
|
+
const settings = existsSync17(res.cursorSettings) ? readJson(res.cursorSettings) : null;
|
|
68477
68511
|
const dirs = Array.isArray(settings?.plugin_dirs) ? settings.plugin_dirs : [];
|
|
68478
68512
|
for (const entry of dirs.map(String)) {
|
|
68479
68513
|
const normal = entry.replaceAll("\\", "/").replace(/\/+$/, "");
|
|
@@ -68517,14 +68551,14 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68517
68551
|
status: "pass",
|
|
68518
68552
|
detail: "cursor hook not inspected on this host"
|
|
68519
68553
|
};
|
|
68520
|
-
if (!
|
|
68554
|
+
if (!existsSync17(res.cursorPluginDir))
|
|
68521
68555
|
return {
|
|
68522
68556
|
id: "cursor_hook",
|
|
68523
68557
|
status: "pass",
|
|
68524
68558
|
detail: "no Cursor plugin install — hook launcher not inspected"
|
|
68525
68559
|
};
|
|
68526
68560
|
const launcher = path39.join(res.cursorPluginDir, "hooks", "launch.mjs");
|
|
68527
|
-
if (!
|
|
68561
|
+
if (!existsSync17(launcher))
|
|
68528
68562
|
return {
|
|
68529
68563
|
id: "cursor_hook",
|
|
68530
68564
|
status: "warn",
|
|
@@ -68646,7 +68680,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68646
68680
|
return "fragile-cache";
|
|
68647
68681
|
if (entry.startsWith("file:")) {
|
|
68648
68682
|
const target = entry.replace(/^file:\/\//, "").replace(/^file:/, "");
|
|
68649
|
-
return
|
|
68683
|
+
return existsSync17(target) ? "ok" : "missing-file";
|
|
68650
68684
|
}
|
|
68651
68685
|
return "ok";
|
|
68652
68686
|
}, checkStalePin = (res) => {
|
|
@@ -68657,7 +68691,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68657
68691
|
detail: "opencode pin not inspected on the cursor host"
|
|
68658
68692
|
};
|
|
68659
68693
|
}
|
|
68660
|
-
if (!
|
|
68694
|
+
if (!existsSync17(res.opencodeConfig)) {
|
|
68661
68695
|
return {
|
|
68662
68696
|
id: "stale_pin",
|
|
68663
68697
|
status: "pass",
|
|
@@ -68710,7 +68744,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68710
68744
|
return { id: "stale_pin", status: "pass", detail: "opencode pin resolves" };
|
|
68711
68745
|
}, pluginMcpSelectors = (res) => {
|
|
68712
68746
|
const p = path39.join(res.cursorPluginDir, "mcp.json");
|
|
68713
|
-
if (!
|
|
68747
|
+
if (!existsSync17(p))
|
|
68714
68748
|
return null;
|
|
68715
68749
|
const cfg = readJson(p);
|
|
68716
68750
|
const server = cfg?.mcpServers?.workit;
|
|
@@ -68758,7 +68792,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68758
68792
|
dir = path39.dirname(dir);
|
|
68759
68793
|
return { version: found.version, dir };
|
|
68760
68794
|
}, checkOpenCodePackageCache = (res) => {
|
|
68761
|
-
if (!
|
|
68795
|
+
if (!existsSync17(res.opencodeConfig)) {
|
|
68762
68796
|
return {
|
|
68763
68797
|
id: "stale_install",
|
|
68764
68798
|
status: "pass",
|
|
@@ -68833,7 +68867,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68833
68867
|
detail: "cursor plugin not inspected on this host"
|
|
68834
68868
|
};
|
|
68835
68869
|
}
|
|
68836
|
-
if (
|
|
68870
|
+
if (existsSync17(res.cursorPluginDir) && lstatSync5(res.cursorPluginDir).isSymbolicLink()) {
|
|
68837
68871
|
let target = "";
|
|
68838
68872
|
try {
|
|
68839
68873
|
target = readlinkSync2(res.cursorPluginDir);
|
|
@@ -68871,7 +68905,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68871
68905
|
fix: "Re-run install-cursor-plugin.sh — it rewrites the sessionStart hook to the canonical pinned launcher"
|
|
68872
68906
|
};
|
|
68873
68907
|
}
|
|
68874
|
-
const hookDrift =
|
|
68908
|
+
const hookDrift = existsSync17(hooksFile) ? cursorHookDrift(readJson(hooksFile), res.cursorPluginDir) : [];
|
|
68875
68909
|
if (hookDrift.length > 0) {
|
|
68876
68910
|
return {
|
|
68877
68911
|
id: "stale_install",
|
|
@@ -68955,13 +68989,13 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68955
68989
|
const problems = [];
|
|
68956
68990
|
const opencodeHost = res.host !== "cursor";
|
|
68957
68991
|
const cursorHost = res.host !== "opencode";
|
|
68958
|
-
if (opencodeHost &&
|
|
68992
|
+
if (opencodeHost && existsSync17(res.opencodeConfig)) {
|
|
68959
68993
|
const cfg = readJson(res.opencodeConfig);
|
|
68960
68994
|
const entries = pluginEntries(cfg);
|
|
68961
68995
|
if (entries.length > 1)
|
|
68962
68996
|
problems.push(`opencode registers ${entries.length} workit plugin entries`);
|
|
68963
68997
|
}
|
|
68964
|
-
if (cursorHost &&
|
|
68998
|
+
if (cursorHost && existsSync17(res.cursorSettings)) {
|
|
68965
68999
|
const settings = readJson(res.cursorSettings);
|
|
68966
69000
|
const enabled = settings?.enabled_plugins;
|
|
68967
69001
|
if (enabled && typeof enabled === "object") {
|
|
@@ -68976,7 +69010,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
68976
69010
|
if (dirs.length > 1)
|
|
68977
69011
|
problems.push(`cursor plugin_dirs has ${dirs.length} workit entries`);
|
|
68978
69012
|
}
|
|
68979
|
-
if (cursorHost &&
|
|
69013
|
+
if (cursorHost && existsSync17(res.cursorMcp)) {
|
|
68980
69014
|
const mcp = readJson(res.cursorMcp);
|
|
68981
69015
|
const servers = mcp?.mcpServers ?? {};
|
|
68982
69016
|
if (servers && typeof servers === "object") {
|
|
@@ -69002,16 +69036,16 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69002
69036
|
const files = [];
|
|
69003
69037
|
for (const name of ["config.json", "youtrack.json", "vcs.json", "workspaces.json"]) {
|
|
69004
69038
|
const p = path39.join(res.configDir, name);
|
|
69005
|
-
if (
|
|
69039
|
+
if (existsSync17(p))
|
|
69006
69040
|
files.push(p);
|
|
69007
69041
|
}
|
|
69008
69042
|
const opencodeHost = res.host !== "cursor";
|
|
69009
69043
|
const cursorHost = res.host !== "opencode";
|
|
69010
|
-
if (opencodeHost &&
|
|
69044
|
+
if (opencodeHost && existsSync17(res.opencodeConfig))
|
|
69011
69045
|
files.push(res.opencodeConfig);
|
|
69012
|
-
if (cursorHost &&
|
|
69046
|
+
if (cursorHost && existsSync17(res.cursorSettings))
|
|
69013
69047
|
files.push(res.cursorSettings);
|
|
69014
|
-
if (cursorHost &&
|
|
69048
|
+
if (cursorHost && existsSync17(res.cursorMcp))
|
|
69015
69049
|
files.push(res.cursorMcp);
|
|
69016
69050
|
const bad = files.filter((p) => !parsesAsConfigObject(p));
|
|
69017
69051
|
if (bad.length === 0)
|
|
@@ -69231,7 +69265,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69231
69265
|
const youtrackJson = readJson(path39.join(res.configDir, "youtrack.json"));
|
|
69232
69266
|
if (youtrackJson) {
|
|
69233
69267
|
tokenPaths.push(typeof youtrackJson.tokenFile === "string" ? youtrackJson.tokenFile : path39.join(res.configDir, "youtrack.token"));
|
|
69234
|
-
} else if (
|
|
69268
|
+
} else if (existsSync17(path39.join(res.configDir, "youtrack.token"))) {
|
|
69235
69269
|
tokenPaths.push(path39.join(res.configDir, "youtrack.token"));
|
|
69236
69270
|
}
|
|
69237
69271
|
if (tokenPaths.length === 0) {
|
|
@@ -69244,7 +69278,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69244
69278
|
const problems = [];
|
|
69245
69279
|
for (const raw of tokenPaths) {
|
|
69246
69280
|
const p = path39.isAbsolute(raw) ? raw : path39.resolve(res.configDir, raw);
|
|
69247
|
-
if (!
|
|
69281
|
+
if (!existsSync17(p)) {
|
|
69248
69282
|
problems.push(`${p} is missing`);
|
|
69249
69283
|
continue;
|
|
69250
69284
|
}
|
|
@@ -69571,8 +69605,8 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69571
69605
|
};
|
|
69572
69606
|
}, checkChecksConfig = (res) => {
|
|
69573
69607
|
const root = checkRoot(res.cwd);
|
|
69574
|
-
const current =
|
|
69575
|
-
const legacy =
|
|
69608
|
+
const current = existsSync17(path39.join(root, CHECKS_FILE));
|
|
69609
|
+
const legacy = existsSync17(path39.join(root, LEGACY_CHECKS_FILE));
|
|
69576
69610
|
if (!legacy)
|
|
69577
69611
|
return {
|
|
69578
69612
|
id: "checks_config",
|
|
@@ -69589,9 +69623,9 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69589
69623
|
const root = checkRoot(resolve(options).cwd);
|
|
69590
69624
|
const from = path39.join(root, LEGACY_CHECKS_FILE);
|
|
69591
69625
|
const to = path39.join(root, CHECKS_FILE);
|
|
69592
|
-
if (!
|
|
69626
|
+
if (!existsSync17(from))
|
|
69593
69627
|
return { action: "none", detail: `no ${LEGACY_CHECKS_FILE} at ${root}` };
|
|
69594
|
-
if (
|
|
69628
|
+
if (existsSync17(to))
|
|
69595
69629
|
return {
|
|
69596
69630
|
action: "skipped",
|
|
69597
69631
|
detail: `${CHECKS_FILE} already exists; ${LEGACY_CHECKS_FILE} left in place`
|
|
@@ -69885,7 +69919,7 @@ var TOKEN_PLACEHOLDER2 = "YOUR_TOKEN_HERE", findDevFromCwd = (cwd) => {
|
|
|
69885
69919
|
return {
|
|
69886
69920
|
id,
|
|
69887
69921
|
status: "warn",
|
|
69888
|
-
detail: `${host} rules in ${coverage.file} do not cover ${shown}${coverage.missing.length > 4 ? ", …" : ""}${
|
|
69922
|
+
detail: `${host} rules in ${coverage.file} do not cover ${shown}${coverage.missing.length > 4 ? ", …" : ""}${existsSync17(coverage.file) ? "" : ` (${coverage.file} does not exist yet; \`workit setup\` writes it)`}: agents get a prompt (or an auto-mode denial) on verbs the workspace grants`,
|
|
69889
69923
|
fix: `workit setup --hosts=${host}`
|
|
69890
69924
|
};
|
|
69891
69925
|
}, ago = (ms) => {
|
|
@@ -70046,7 +70080,7 @@ var init_doctor = __esm(() => {
|
|
|
70046
70080
|
import {
|
|
70047
70081
|
copyFileSync as copyFileSync5,
|
|
70048
70082
|
cpSync as cpSync4,
|
|
70049
|
-
existsSync as
|
|
70083
|
+
existsSync as existsSync18,
|
|
70050
70084
|
lstatSync as lstatSync6,
|
|
70051
70085
|
mkdirSync as mkdirSync9,
|
|
70052
70086
|
mkdtempSync as mkdtempSync2,
|
|
@@ -70157,7 +70191,7 @@ function buildSetupPreview(values, opts = {}) {
|
|
|
70157
70191
|
path: ytPath,
|
|
70158
70192
|
value: draft
|
|
70159
70193
|
});
|
|
70160
|
-
if (
|
|
70194
|
+
if (existsSync18(tokenPath))
|
|
70161
70195
|
preserved.push(tokenPath);
|
|
70162
70196
|
else
|
|
70163
70197
|
mutations.push({
|
|
@@ -70224,7 +70258,7 @@ function buildSetupPreview(values, opts = {}) {
|
|
|
70224
70258
|
if (target?.ok) {
|
|
70225
70259
|
const root = target.root;
|
|
70226
70260
|
const gitignorePath = path40.join(root, ".gitignore");
|
|
70227
|
-
const existing =
|
|
70261
|
+
const existing = existsSync18(gitignorePath) ? readFileSync19(gitignorePath, "utf8") : "";
|
|
70228
70262
|
const existingLines = new Set(existing.split(`
|
|
70229
70263
|
`).map((l) => l.trim()).filter(Boolean));
|
|
70230
70264
|
const entries = GITIGNORE_ENTRIES.filter((e) => e.trim() !== "" && !existingLines.has(e.trim()));
|
|
@@ -70500,11 +70534,11 @@ function applyOpenCode(root, res) {
|
|
|
70500
70534
|
function copyPluginDir(src, dest) {
|
|
70501
70535
|
const realSrc = realpathSync9(src);
|
|
70502
70536
|
const marker = path40.join(dest, ".workit-root");
|
|
70503
|
-
const destIsLink =
|
|
70537
|
+
const destIsLink = existsSync18(dest) && lstatSync6(dest).isSymbolicLink();
|
|
70504
70538
|
const synced = !destIsLink && readFileSafe(marker)?.trim() === realSrc && samePluginContent(realSrc, dest, dest);
|
|
70505
70539
|
if (synced)
|
|
70506
70540
|
return "Skipped";
|
|
70507
|
-
const hadDir =
|
|
70541
|
+
const hadDir = existsSync18(dest);
|
|
70508
70542
|
const rules = preservedCursorRules(realSrc, dest);
|
|
70509
70543
|
const parent = path40.dirname(dest);
|
|
70510
70544
|
mkdirSync9(parent, { recursive: true });
|
|
@@ -70517,7 +70551,7 @@ function copyPluginDir(src, dest) {
|
|
|
70517
70551
|
filter: (entry) => !path40.relative(realSrc, entry).split(path40.sep).includes("node_modules")
|
|
70518
70552
|
});
|
|
70519
70553
|
const stagedHooks = path40.join(stage, CURSOR_HOOKS_FILE);
|
|
70520
|
-
if (
|
|
70554
|
+
if (existsSync18(stagedHooks))
|
|
70521
70555
|
writeFileSync10(stagedHooks, localizedCursorHooks(readFileSync19(stagedHooks), dest));
|
|
70522
70556
|
for (const [name, content] of rules) {
|
|
70523
70557
|
mkdirSync9(path40.join(stage, "rules"), { recursive: true });
|
|
@@ -70535,7 +70569,7 @@ function copyPluginDir(src, dest) {
|
|
|
70535
70569
|
try {
|
|
70536
70570
|
renameSync5(stage, dest);
|
|
70537
70571
|
} catch (error) {
|
|
70538
|
-
if (hadDir && !
|
|
70572
|
+
if (hadDir && !existsSync18(dest))
|
|
70539
70573
|
renameSync5(backup, dest);
|
|
70540
70574
|
throw error;
|
|
70541
70575
|
}
|
|
@@ -70613,9 +70647,9 @@ function applyCursorMcp(root, res) {
|
|
|
70613
70647
|
};
|
|
70614
70648
|
}
|
|
70615
70649
|
function verifyPlatform(platform, res) {
|
|
70616
|
-
if (platform === "opencode" && !
|
|
70650
|
+
if (platform === "opencode" && !existsSync18(res.opencodeConfig))
|
|
70617
70651
|
return null;
|
|
70618
|
-
if (platform === "cursor" && !
|
|
70652
|
+
if (platform === "cursor" && !existsSync18(res.cursorSettings) && !existsSync18(res.cursorMcp)) {
|
|
70619
70653
|
return null;
|
|
70620
70654
|
}
|
|
70621
70655
|
return runDoctor({
|
|
@@ -70896,7 +70930,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70896
70930
|
try {
|
|
70897
70931
|
raw = readFileSync19(p, "utf8");
|
|
70898
70932
|
} catch {
|
|
70899
|
-
if (
|
|
70933
|
+
if (existsSync18(p))
|
|
70900
70934
|
return { kind: "malformed", error: `${p} is not readable` };
|
|
70901
70935
|
return { kind: "missing" };
|
|
70902
70936
|
}
|
|
@@ -70951,7 +70985,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70951
70985
|
return OPENCODE_NPM_PIN;
|
|
70952
70986
|
for (const rel of ["src/plugin.ts", "dist/plugin.js"]) {
|
|
70953
70987
|
const entry = path40.join(root, rel);
|
|
70954
|
-
if (
|
|
70988
|
+
if (existsSync18(entry))
|
|
70955
70989
|
return `file://${entry}`;
|
|
70956
70990
|
}
|
|
70957
70991
|
return null;
|
|
@@ -70981,7 +71015,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
70981
71015
|
}
|
|
70982
71016
|
}
|
|
70983
71017
|
for (const entry of readdirSync11(dest, { withFileTypes: true })) {
|
|
70984
|
-
if (
|
|
71018
|
+
if (existsSync18(path40.join(src, entry.name)))
|
|
70985
71019
|
continue;
|
|
70986
71020
|
const rel = path40.join(relative, entry.name);
|
|
70987
71021
|
if (rel === ".workit-root")
|
|
@@ -71002,7 +71036,7 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
71002
71036
|
for (const entry of readdirSync11(installedRules, { withFileTypes: true })) {
|
|
71003
71037
|
if (!entry.isFile() || !entry.name.endsWith(".mdc"))
|
|
71004
71038
|
continue;
|
|
71005
|
-
if (
|
|
71039
|
+
if (existsSync18(path40.join(sourceRules, entry.name)))
|
|
71006
71040
|
continue;
|
|
71007
71041
|
preserved.set(entry.name, readFileSync19(path40.join(installedRules, entry.name)));
|
|
71008
71042
|
}
|
|
@@ -71010,17 +71044,17 @@ var TOKEN_PLACEHOLDER3 = "YOUR_TOKEN_HERE", YT_OVERRIDES, VCS_OVERRIDES, SETUP_O
|
|
|
71010
71044
|
return preserved;
|
|
71011
71045
|
}, removeLegacyCursorDir = (res) => {
|
|
71012
71046
|
const legacy = path40.join(res.home, ".cursor", "plugins", "local", "workflow-toolkit");
|
|
71013
|
-
if (legacy === res.cursorPluginDir || !
|
|
71047
|
+
if (legacy === res.cursorPluginDir || !existsSync18(legacy))
|
|
71014
71048
|
return;
|
|
71015
71049
|
const legacyRules = path40.join(legacy, "rules");
|
|
71016
|
-
if (
|
|
71050
|
+
if (existsSync18(legacyRules)) {
|
|
71017
71051
|
try {
|
|
71018
71052
|
mkdirSync9(path40.join(res.cursorPluginDir, "rules"), { recursive: true });
|
|
71019
71053
|
for (const entry of readdirSync11(legacyRules, { withFileTypes: true })) {
|
|
71020
71054
|
if (!entry.isFile() || !entry.name.endsWith(".mdc"))
|
|
71021
71055
|
continue;
|
|
71022
71056
|
const target = path40.join(res.cursorPluginDir, "rules", entry.name);
|
|
71023
|
-
if (!
|
|
71057
|
+
if (!existsSync18(target))
|
|
71024
71058
|
copyFileSync5(path40.join(legacyRules, entry.name), target);
|
|
71025
71059
|
}
|
|
71026
71060
|
} catch {}
|
|
@@ -71409,7 +71443,7 @@ var init_logic = __esm(() => {
|
|
|
71409
71443
|
});
|
|
71410
71444
|
|
|
71411
71445
|
// packages/workit-cli/src/wizard-state.ts
|
|
71412
|
-
import { existsSync as
|
|
71446
|
+
import { existsSync as existsSync19, statSync as statSync8 } from "node:fs";
|
|
71413
71447
|
import path42 from "node:path";
|
|
71414
71448
|
import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
|
|
71415
71449
|
function resolveBasePath(values, env = process.env) {
|
|
@@ -71938,7 +71972,7 @@ var NEXT, PREV, skipsCustomBranch = (screen, preset) => (screen === "branchAllow
|
|
|
71938
71972
|
if (!p)
|
|
71939
71973
|
return "workspace root path is required";
|
|
71940
71974
|
return !path42.isAbsolute(p) || !isDirectory(p) ? `invalid workspace root "${p}" — enter an existing absolute directory` : null;
|
|
71941
|
-
}, skipsBranchPolicy = (screen, basePath) => (screen === "branchPolicy" || screen === "branchPolicyDevelop") && !
|
|
71975
|
+
}, skipsBranchPolicy = (screen, basePath) => (screen === "branchPolicy" || screen === "branchPolicyDevelop") && !existsSync19(path42.join(basePath, ".git")), decodeBranchPreset = (value, fallback) => value === "gitflow" || value === "github-flow" || value === "trunk-based" || value === "custom" ? value : fallback, decodeVcsProvider = (value, fallback) => value === "gitlab" || value === "github" || value === "skip" ? value : fallback, decodeIssueTracker = (value, fallback) => value === "youtrack" || value === "github" || value === "gitlab" || value === "none" ? value : fallback, GITHUB_ISSUES, withGithubIssues = (draft, tracker) => tracker === "github" ? { ...draft, issues: { ...GITHUB_ISSUES } } : draft;
|
|
71942
71976
|
var init_wizard_state = __esm(() => {
|
|
71943
71977
|
init_config();
|
|
71944
71978
|
init_workspaces();
|
|
@@ -71997,7 +72031,7 @@ var init_wizard_state = __esm(() => {
|
|
|
71997
72031
|
});
|
|
71998
72032
|
|
|
71999
72033
|
// packages/workit-cli/src/admin/uninstall.ts
|
|
72000
|
-
import { existsSync as
|
|
72034
|
+
import { existsSync as existsSync20, readFileSync as readFileSync21, realpathSync as realpathSync10, rmSync as rmSync7, writeFileSync as writeFileSync12 } from "node:fs";
|
|
72001
72035
|
import os14 from "node:os";
|
|
72002
72036
|
import path43 from "node:path";
|
|
72003
72037
|
function cleanCursorSettings(settings, pluginDir) {
|
|
@@ -72099,7 +72133,7 @@ function planUninstall(paths = {}) {
|
|
|
72099
72133
|
const mcpExisting = readJsonRecord(res.cursorMcp);
|
|
72100
72134
|
const settingsDirty = settingsExisting.kind === "malformed" || settingsExisting.kind === "record" && cleanCursorSettings(settingsExisting.value, res.cursorPluginDir).changed;
|
|
72101
72135
|
const mcpDirty = mcpExisting.kind === "malformed" || mcpExisting.kind === "record" && cleanCursorMcp(mcpExisting.value).changed;
|
|
72102
|
-
const dirExists =
|
|
72136
|
+
const dirExists = existsSync20(res.cursorPluginDir);
|
|
72103
72137
|
const actions = [];
|
|
72104
72138
|
if (settingsDirty) {
|
|
72105
72139
|
actions.push({
|
|
@@ -72127,7 +72161,7 @@ function planUninstall(paths = {}) {
|
|
|
72127
72161
|
installed: settingsDirty || mcpDirty || dirExists,
|
|
72128
72162
|
actions
|
|
72129
72163
|
};
|
|
72130
|
-
const codexInstalled =
|
|
72164
|
+
const codexInstalled = existsSync20(res.codexPluginDir);
|
|
72131
72165
|
const codex = {
|
|
72132
72166
|
host: "codex",
|
|
72133
72167
|
installed: codexInstalled,
|
|
@@ -72175,7 +72209,7 @@ function planUninstall(paths = {}) {
|
|
|
72175
72209
|
detail: `remove Workit's permission block from ${path43.basename(file)}`
|
|
72176
72210
|
});
|
|
72177
72211
|
}
|
|
72178
|
-
if (
|
|
72212
|
+
if (existsSync20(res.codexRules))
|
|
72179
72213
|
codex.actions.push({
|
|
72180
72214
|
kind: "remove-file",
|
|
72181
72215
|
path: res.codexRules,
|
|
@@ -72211,7 +72245,7 @@ function applyUninstall(plan, paths = {}) {
|
|
|
72211
72245
|
if (!allowed) {
|
|
72212
72246
|
status = "failed";
|
|
72213
72247
|
detail = `refusing to remove non-canonical plugin directory: ${resolved}`;
|
|
72214
|
-
} else if (!
|
|
72248
|
+
} else if (!existsSync20(resolved)) {
|
|
72215
72249
|
status = "skipped";
|
|
72216
72250
|
detail = "directory already absent";
|
|
72217
72251
|
} else {
|
|
@@ -72261,7 +72295,7 @@ var resolveUninstallPaths = (options = {}) => {
|
|
|
72261
72295
|
try {
|
|
72262
72296
|
raw = readFileSync21(file, "utf8");
|
|
72263
72297
|
} catch {
|
|
72264
|
-
if (
|
|
72298
|
+
if (existsSync20(file))
|
|
72265
72299
|
return { kind: "malformed", error: `${file} is not readable` };
|
|
72266
72300
|
return { kind: "missing" };
|
|
72267
72301
|
}
|
|
@@ -75110,7 +75144,7 @@ var init_setup2 = __esm(() => {
|
|
|
75110
75144
|
});
|
|
75111
75145
|
|
|
75112
75146
|
// packages/workit-cli/src/upgrade/shared.ts
|
|
75113
|
-
import { existsSync as
|
|
75147
|
+
import { existsSync as existsSync21, readFileSync as readFileSync22 } from "node:fs";
|
|
75114
75148
|
import path44 from "node:path";
|
|
75115
75149
|
import os16 from "node:os";
|
|
75116
75150
|
import { createHash as createHash15 } from "node:crypto";
|
|
@@ -75143,7 +75177,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
|
|
|
75143
75177
|
cursorRoot: path44.join(home, ".cursor/plugins/local/workit")
|
|
75144
75178
|
};
|
|
75145
75179
|
}, object2 = (file) => {
|
|
75146
|
-
if (!
|
|
75180
|
+
if (!existsSync21(file))
|
|
75147
75181
|
return null;
|
|
75148
75182
|
let data;
|
|
75149
75183
|
try {
|
|
@@ -75160,7 +75194,7 @@ var LAUNCH_HOSTS, HOSTS2, LIVE_HOSTS, OPENCODE_PACKAGE = "@brainervirus/workit-o
|
|
|
75160
75194
|
} catch {
|
|
75161
75195
|
return null;
|
|
75162
75196
|
}
|
|
75163
|
-
}, digest2 = (file) =>
|
|
75197
|
+
}, digest2 = (file) => existsSync21(file) ? createHash15("sha256").update(readFileSync22(file)).digest("hex") : "missing", runner = (deps) => deps.run ?? ((command, args) => {
|
|
75164
75198
|
const { home, env } = upgradePaths(deps);
|
|
75165
75199
|
let step;
|
|
75166
75200
|
try {
|
|
@@ -75256,7 +75290,7 @@ var init_processes = __esm(() => {
|
|
|
75256
75290
|
});
|
|
75257
75291
|
|
|
75258
75292
|
// packages/workit-cli/src/upgrade/apply.ts
|
|
75259
|
-
import { existsSync as
|
|
75293
|
+
import { existsSync as existsSync22, readdirSync as readdirSync12, mkdirSync as mkdirSync11, copyFileSync as copyFileSync6, chmodSync as chmodSync2, cpSync as cpSync5 } from "node:fs";
|
|
75260
75294
|
import path46 from "node:path";
|
|
75261
75295
|
import { createHash as createHash16 } from "node:crypto";
|
|
75262
75296
|
function applyUpgrade(plan, deps = {}) {
|
|
@@ -75295,7 +75329,7 @@ function applyUpgrade(plan, deps = {}) {
|
|
|
75295
75329
|
const backup = path46.join(home, ".local/state/workit/upgrades", new Date().toISOString().replaceAll(":", "-"));
|
|
75296
75330
|
mkdirSync11(backup, { recursive: true, mode: 448 });
|
|
75297
75331
|
for (const file of Object.keys(plan.configDigests))
|
|
75298
|
-
if (
|
|
75332
|
+
if (existsSync22(file)) {
|
|
75299
75333
|
const target = path46.join(backup, createHash16("sha256").update(file).digest("hex").slice(0, 12) + "-" + path46.basename(file));
|
|
75300
75334
|
copyFileSync6(file, target);
|
|
75301
75335
|
chmodSync2(target, 384);
|
|
@@ -75315,7 +75349,7 @@ function applyUpgrade(plan, deps = {}) {
|
|
|
75315
75349
|
}
|
|
75316
75350
|
const run = runner(deps);
|
|
75317
75351
|
let cursorBackupError = null;
|
|
75318
|
-
if (plan.entries.some((entry) => entry.host === "cursor") &&
|
|
75352
|
+
if (plan.entries.some((entry) => entry.host === "cursor") && existsSync22(paths.cursorRoot))
|
|
75319
75353
|
try {
|
|
75320
75354
|
cpSync5(paths.cursorRoot, path46.join(backup, "cursor-package"), {
|
|
75321
75355
|
recursive: true
|
|
@@ -75582,7 +75616,7 @@ var codexPluginRoot = (codexHome) => {
|
|
|
75582
75616
|
}, refreshCodexAgents = (run, codexHome) => {
|
|
75583
75617
|
const root = codexPluginRoot(codexHome);
|
|
75584
75618
|
const launcher = root && path46.join(root, "dist", "launch-mcp.js");
|
|
75585
|
-
if (!launcher || !
|
|
75619
|
+
if (!launcher || !existsSync22(launcher))
|
|
75586
75620
|
return { ok: true, note: "" };
|
|
75587
75621
|
const fix = `node ${JSON.stringify(launcher)} --install-agents`;
|
|
75588
75622
|
return run("node", [launcher, "--install-agents"]).status === 0 ? { ok: true, note: "agents refreshed" } : { ok: false, note: "agent refresh failed", fix };
|
|
@@ -75621,7 +75655,7 @@ var init_apply = __esm(() => {
|
|
|
75621
75655
|
});
|
|
75622
75656
|
|
|
75623
75657
|
// packages/workit-cli/src/upgrade/plan.ts
|
|
75624
|
-
import { existsSync as
|
|
75658
|
+
import { existsSync as existsSync23, mkdtempSync as mkdtempSync3, rmSync as rmSync8, lstatSync as lstatSync7, readFileSync as readFileSync23 } from "node:fs";
|
|
75625
75659
|
import path47 from "node:path";
|
|
75626
75660
|
import os17 from "node:os";
|
|
75627
75661
|
function previewUpgrade(hosts = HOSTS2, deps = {}) {
|
|
@@ -75808,7 +75842,7 @@ var codexRegistered = (configFile) => {
|
|
|
75808
75842
|
}
|
|
75809
75843
|
};
|
|
75810
75844
|
guard("opencode", () => {
|
|
75811
|
-
if (
|
|
75845
|
+
if (existsSync23(paths.opencodeConfig + "c"))
|
|
75812
75846
|
throw new Error("OpenCode JSONC config is present; inspect effective native configuration before updating");
|
|
75813
75847
|
const oc = object2(paths.opencodeConfig);
|
|
75814
75848
|
if (oc && [oc.plugins, oc.plugin].some((value) => value !== undefined && !Array.isArray(value)))
|
|
@@ -75865,7 +75899,7 @@ var codexRegistered = (configFile) => {
|
|
|
75865
75899
|
hostCommand("codex", [], { home, env: paths.env });
|
|
75866
75900
|
available = true;
|
|
75867
75901
|
} catch {}
|
|
75868
|
-
if (available ||
|
|
75902
|
+
if (available || existsSync23(paths.codexConfig))
|
|
75869
75903
|
throw new Error("Codex plugin inventory failed; inspect the native host before upgrading");
|
|
75870
75904
|
return;
|
|
75871
75905
|
}
|
|
@@ -77327,7 +77361,7 @@ __export(exports_workspace, {
|
|
|
77327
77361
|
run: () => run11,
|
|
77328
77362
|
runWorkspace: () => runWorkspace
|
|
77329
77363
|
});
|
|
77330
|
-
import { copyFileSync as copyFileSync7, existsSync as
|
|
77364
|
+
import { copyFileSync as copyFileSync7, existsSync as existsSync24 } from "node:fs";
|
|
77331
77365
|
function list2(argv, io) {
|
|
77332
77366
|
if (argv.length)
|
|
77333
77367
|
return usage3(io, `unexpected argument ${argv[0]}`);
|
|
@@ -77636,7 +77670,7 @@ usage: ${USAGE5}`)), load = (io) => {
|
|
|
77636
77670
|
return { ok: false, error: `${current.path} changed; retry` };
|
|
77637
77671
|
let backup = null;
|
|
77638
77672
|
try {
|
|
77639
|
-
if (
|
|
77673
|
+
if (existsSync24(current.path)) {
|
|
77640
77674
|
backup = `${current.path}.bak`;
|
|
77641
77675
|
copyFileSync7(current.path, backup);
|
|
77642
77676
|
}
|
|
@@ -79472,7 +79506,7 @@ var exports_models = {};
|
|
|
79472
79506
|
__export(exports_models, {
|
|
79473
79507
|
run: () => run14
|
|
79474
79508
|
});
|
|
79475
|
-
import { existsSync as
|
|
79509
|
+
import { existsSync as existsSync25, readdirSync as readdirSync13, readFileSync as readFileSync24, statSync as statSync9 } from "node:fs";
|
|
79476
79510
|
import os22 from "node:os";
|
|
79477
79511
|
import path55 from "node:path";
|
|
79478
79512
|
async function run14(argv, io) {
|
|
@@ -79568,7 +79602,7 @@ var USAGE8 = "workit models show [--role <role>] [--tier <tier>] [--host <host>]
|
|
|
79568
79602
|
continue;
|
|
79569
79603
|
const agentType = JSON.parse(readFileSync24(meta, "utf8")).agentType;
|
|
79570
79604
|
const transcript = meta.replace(/\.meta\.json$/, ".jsonl");
|
|
79571
|
-
if (typeof agentType !== "string" || !
|
|
79605
|
+
if (typeof agentType !== "string" || !existsSync25(transcript))
|
|
79572
79606
|
continue;
|
|
79573
79607
|
const ran = modelsOf(transcript);
|
|
79574
79608
|
if (!ran.size)
|
|
@@ -79707,7 +79741,7 @@ var success2 = (data) => ({ ok: true, data }), failure3 = (code, error, unblock)
|
|
|
79707
79741
|
|
|
79708
79742
|
// packages/workit-core/src/git/ops.ts
|
|
79709
79743
|
import { spawnSync as spawnSync20 } from "node:child_process";
|
|
79710
|
-
import { existsSync as
|
|
79744
|
+
import { existsSync as existsSync26, readFileSync as readFileSync25 } from "node:fs";
|
|
79711
79745
|
import path56 from "node:path";
|
|
79712
79746
|
function operationInProgress(cwd) {
|
|
79713
79747
|
const markers = [
|
|
@@ -79725,11 +79759,11 @@ function operationInProgress(cwd) {
|
|
|
79725
79759
|
const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
|
|
79726
79760
|
for (const [index, [, operation]] of markers.entries()) {
|
|
79727
79761
|
const marker = found[index];
|
|
79728
|
-
if (!marker || !
|
|
79762
|
+
if (!marker || !existsSync26(marker))
|
|
79729
79763
|
continue;
|
|
79730
|
-
if (index === 1 &&
|
|
79764
|
+
if (index === 1 && existsSync26(path56.join(marker, "applying")))
|
|
79731
79765
|
return { operation: "am", commitAllowed: false, branch: null };
|
|
79732
|
-
if (index === 0 &&
|
|
79766
|
+
if (index === 0 && existsSync26(path56.join(marker, "amend")) && !conflicted()) {
|
|
79733
79767
|
let headName = "";
|
|
79734
79768
|
try {
|
|
79735
79769
|
headName = readFileSync25(path56.join(marker, "head-name"), "utf8").trim();
|
|
@@ -80060,7 +80094,7 @@ function gitCommit(cwd, input) {
|
|
|
80060
80094
|
if (paths.some((value) => value.startsWith("-") || !value.trim()))
|
|
80061
80095
|
return failure3("invalid_input", "paths must not be empty or start with -");
|
|
80062
80096
|
const tracked = new Set(nulList(git5(cwd, ["ls-files", "-z", "--", ...paths]).stdout));
|
|
80063
|
-
const addable = paths.filter((value) =>
|
|
80097
|
+
const addable = paths.filter((value) => existsSync26(path56.resolve(cwd, value)) || [...tracked].some((file) => file === value || file.startsWith(`${value}/`)));
|
|
80064
80098
|
if (addable.length) {
|
|
80065
80099
|
const added = git5(cwd, ["add", "-A", "--", ...addable]);
|
|
80066
80100
|
if (!added.ok)
|
|
@@ -87041,7 +87075,7 @@ __export(exports_pr, {
|
|
|
87041
87075
|
checkPrTitle: () => checkPrTitle,
|
|
87042
87076
|
run: () => run15
|
|
87043
87077
|
});
|
|
87044
|
-
import { existsSync as
|
|
87078
|
+
import { existsSync as existsSync27, readFileSync as readFileSync27 } from "node:fs";
|
|
87045
87079
|
import path66 from "node:path";
|
|
87046
87080
|
function titleRules(cwd) {
|
|
87047
87081
|
let root;
|
|
@@ -87054,7 +87088,7 @@ function titleRules(cwd) {
|
|
|
87054
87088
|
let name = "";
|
|
87055
87089
|
for (const candidate of COMMITLINT_FILES) {
|
|
87056
87090
|
const full = path66.join(root, candidate);
|
|
87057
|
-
if (!
|
|
87091
|
+
if (!existsSync27(full))
|
|
87058
87092
|
continue;
|
|
87059
87093
|
text = readFileSync27(full, "utf8");
|
|
87060
87094
|
name = candidate;
|
|
@@ -106749,7 +106783,7 @@ var init_rules = __esm(() => {
|
|
|
106749
106783
|
|
|
106750
106784
|
// packages/workit-cli/src/test-audit/audit.ts
|
|
106751
106785
|
import { spawnSync as spawnSync29 } from "node:child_process";
|
|
106752
|
-
import { existsSync as
|
|
106786
|
+
import { existsSync as existsSync28, readdirSync as readdirSync14, readFileSync as readFileSync29, statSync as statSync10 } from "node:fs";
|
|
106753
106787
|
import path71 from "node:path";
|
|
106754
106788
|
function git7(cwd, args) {
|
|
106755
106789
|
const run = spawnSync29("git", ["-c", "core.quotepath=off", ...args], {
|
|
@@ -106776,7 +106810,7 @@ function expandPaths(cwd, inputs) {
|
|
|
106776
106810
|
const missing = [];
|
|
106777
106811
|
for (const input of inputs.length > 0 ? inputs : ["."]) {
|
|
106778
106812
|
const full = path71.resolve(cwd, input);
|
|
106779
|
-
if (!
|
|
106813
|
+
if (!existsSync28(full))
|
|
106780
106814
|
missing.push(input);
|
|
106781
106815
|
else if (statSync10(full).isDirectory())
|
|
106782
106816
|
walkTests(full, files);
|
|
@@ -106892,7 +106926,7 @@ var init_audit = __esm(() => {
|
|
|
106892
106926
|
// packages/workit-cli/src/test-audit/mutate.ts
|
|
106893
106927
|
import { spawn as spawn2 } from "node:child_process";
|
|
106894
106928
|
import {
|
|
106895
|
-
existsSync as
|
|
106929
|
+
existsSync as existsSync29,
|
|
106896
106930
|
lstatSync as lstatSync8,
|
|
106897
106931
|
mkdirSync as mkdirSync12,
|
|
106898
106932
|
mkdtempSync as mkdtempSync4,
|
|
@@ -107121,7 +107155,7 @@ function copyWorkingTree(repo) {
|
|
|
107121
107155
|
}
|
|
107122
107156
|
for (const parent of dirs) {
|
|
107123
107157
|
const modules = path72.join(repo, parent, "node_modules");
|
|
107124
|
-
if (
|
|
107158
|
+
if (existsSync29(modules) && !existsSync29(path72.join(tree, parent, "node_modules")))
|
|
107125
107159
|
linkNodeModules(modules, path72.join(tree, parent, "node_modules"), repo, tree);
|
|
107126
107160
|
}
|
|
107127
107161
|
return { dir, tree };
|
|
@@ -107171,7 +107205,7 @@ async function runMutation(options) {
|
|
|
107171
107205
|
const relative = toPosix(path72.relative(repo, absolute));
|
|
107172
107206
|
if (!CODE_FILE.test(relative) || TEST_FILE.test(relative) || relative.endsWith(".d.ts"))
|
|
107173
107207
|
continue;
|
|
107174
|
-
if (NOT_SOURCE.test(relative) || !
|
|
107208
|
+
if (NOT_SOURCE.test(relative) || !existsSync29(absolute))
|
|
107175
107209
|
continue;
|
|
107176
107210
|
try {
|
|
107177
107211
|
candidates.push(...mutantsFor(readFileSync30(absolute, "utf8"), relative, lines));
|
|
@@ -107361,7 +107395,7 @@ var exports_test_audit = {};
|
|
|
107361
107395
|
__export(exports_test_audit, {
|
|
107362
107396
|
run: () => run23
|
|
107363
107397
|
});
|
|
107364
|
-
import { existsSync as
|
|
107398
|
+
import { existsSync as existsSync30 } from "node:fs";
|
|
107365
107399
|
import path73 from "node:path";
|
|
107366
107400
|
function parse8(argv) {
|
|
107367
107401
|
const options = {
|
|
@@ -107485,7 +107519,7 @@ usage: ${USAGE16}`));
|
|
|
107485
107519
|
}
|
|
107486
107520
|
let files;
|
|
107487
107521
|
if (options.diff && changed)
|
|
107488
|
-
files = [...changed.keys()].filter((file) => TEST_FILE.test(toPosix(file)) &&
|
|
107522
|
+
files = [...changed.keys()].filter((file) => TEST_FILE.test(toPosix(file)) && existsSync30(file)).toSorted();
|
|
107489
107523
|
else {
|
|
107490
107524
|
const expanded = expandPaths(io.cwd, options.paths);
|
|
107491
107525
|
if (expanded.missing.length > 0)
|