@workit-dev/opencode 2.4.1 → 2.4.2
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/plugin.js +72 -72
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -183,7 +183,7 @@ function define(plugin) {
|
|
|
183
183
|
|
|
184
184
|
// packages/workit-core/src/core.ts
|
|
185
185
|
import { spawnSync as spawnSync22 } from "node:child_process";
|
|
186
|
-
import { existsSync as
|
|
186
|
+
import { existsSync as existsSync13, realpathSync as realpathSync9 } from "node:fs";
|
|
187
187
|
import path35 from "node:path";
|
|
188
188
|
|
|
189
189
|
// packages/workit-core/src/core/task-contract.ts
|
|
@@ -8085,11 +8085,11 @@ var gitContext = (workspaceRoot, paths = []) => {
|
|
|
8085
8085
|
// packages/workit-core/src/core/workspaces.ts
|
|
8086
8086
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
8087
8087
|
import { createHash as createHash5 } from "node:crypto";
|
|
8088
|
-
import { existsSync as
|
|
8088
|
+
import { existsSync as existsSync3, lstatSync as lstatSync2, readFileSync as readFileSync4, realpathSync as realpathSync3 } from "node:fs";
|
|
8089
8089
|
import path9 from "node:path";
|
|
8090
8090
|
|
|
8091
8091
|
// packages/workit-core/src/core/remotes.ts
|
|
8092
|
-
import { lstatSync, readFileSync as readFileSync3, realpathSync, statSync } from "node:fs";
|
|
8092
|
+
import { lstatSync, readFileSync as readFileSync3, realpathSync as realpathSync2, statSync } from "node:fs";
|
|
8093
8093
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
8094
8094
|
import path8 from "node:path";
|
|
8095
8095
|
|
|
@@ -9047,7 +9047,7 @@ function resolveSshHost(alias, sshConfig) {
|
|
|
9047
9047
|
|
|
9048
9048
|
// packages/workit-core/src/core/account-home.ts
|
|
9049
9049
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
9050
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
9050
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
9051
9051
|
import os3 from "node:os";
|
|
9052
9052
|
var WINDOWS = "C:\\Windows";
|
|
9053
9053
|
var SYSTEM32 = `${WINDOWS}\\System32\\`;
|
|
@@ -9148,7 +9148,7 @@ var isRepoDir = (dir) => ["HEAD", "objects", "refs"].every((name) => {
|
|
|
9148
9148
|
var gitDirAt = (at, depth = 0) => {
|
|
9149
9149
|
let real;
|
|
9150
9150
|
try {
|
|
9151
|
-
real =
|
|
9151
|
+
real = realpathSync2.native(at);
|
|
9152
9152
|
} catch {
|
|
9153
9153
|
return null;
|
|
9154
9154
|
}
|
|
@@ -9180,7 +9180,7 @@ var gitDirAt = (at, depth = 0) => {
|
|
|
9180
9180
|
} catch {
|
|
9181
9181
|
continue;
|
|
9182
9182
|
}
|
|
9183
|
-
const resolved =
|
|
9183
|
+
const resolved = realpathSync2.native(item);
|
|
9184
9184
|
const rel = path8.relative(real, resolved);
|
|
9185
9185
|
if (rel && !rel.startsWith("..") && !path8.isAbsolute(rel))
|
|
9186
9186
|
continue;
|
|
@@ -9307,7 +9307,7 @@ var TRANSPORT_ENV = ["GIT_SSH", "GIT_SSH_COMMAND", "GIT_PROXY_COMMAND"];
|
|
|
9307
9307
|
var userGitSeam = { home: accountHome };
|
|
9308
9308
|
var realOrSelf = (file) => {
|
|
9309
9309
|
try {
|
|
9310
|
-
return
|
|
9310
|
+
return realpathSync2.native(file);
|
|
9311
9311
|
} catch {
|
|
9312
9312
|
return path8.resolve(file);
|
|
9313
9313
|
}
|
|
@@ -9702,8 +9702,8 @@ var probeCheckout = (cwd) => {
|
|
|
9702
9702
|
if (cached !== undefined)
|
|
9703
9703
|
return cached;
|
|
9704
9704
|
let dir = path9.resolve(cwd);
|
|
9705
|
-
while (!
|
|
9706
|
-
if (["HEAD", "objects", "refs"].every((name) =>
|
|
9705
|
+
while (!existsSync3(path9.join(dir, ".git"))) {
|
|
9706
|
+
if (["HEAD", "objects", "refs"].every((name) => existsSync3(path9.join(dir, name)))) {
|
|
9707
9707
|
const real = realpathOf(dir);
|
|
9708
9708
|
const owner = ownInternals(real) === true ? gitDirOwner(real) : null;
|
|
9709
9709
|
if (owner === null)
|
|
@@ -9787,7 +9787,7 @@ var ownInternals = (real) => {
|
|
|
9787
9787
|
}
|
|
9788
9788
|
let resolved;
|
|
9789
9789
|
try {
|
|
9790
|
-
resolved = (
|
|
9790
|
+
resolved = (realpathSync3.native ?? realpathSync3)(at);
|
|
9791
9791
|
} catch {
|
|
9792
9792
|
return false;
|
|
9793
9793
|
}
|
|
@@ -9845,7 +9845,7 @@ var matchingEntries = (cwd, entries) => {
|
|
|
9845
9845
|
return main ? match(main) : direct;
|
|
9846
9846
|
};
|
|
9847
9847
|
var realpathOf = (p) => {
|
|
9848
|
-
const real =
|
|
9848
|
+
const real = realpathSync3.native ?? realpathSync3;
|
|
9849
9849
|
try {
|
|
9850
9850
|
return real(p);
|
|
9851
9851
|
} catch {
|
|
@@ -12469,14 +12469,14 @@ function acquireFileLockSync(targetPath, options) {
|
|
|
12469
12469
|
}
|
|
12470
12470
|
}
|
|
12471
12471
|
// packages/workit-core/src/core/package-root.ts
|
|
12472
|
-
import { existsSync as
|
|
12472
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
12473
12473
|
import path16 from "node:path";
|
|
12474
12474
|
import { fileURLToPath } from "node:url";
|
|
12475
12475
|
var packageRoot = () => {
|
|
12476
12476
|
let dir = path16.dirname(fileURLToPath(import.meta.url));
|
|
12477
12477
|
while (true) {
|
|
12478
12478
|
const parent = path16.dirname(dir);
|
|
12479
|
-
if (
|
|
12479
|
+
if (existsSync4(path16.join(dir, "package.json")) || parent === dir)
|
|
12480
12480
|
return dir;
|
|
12481
12481
|
dir = parent;
|
|
12482
12482
|
}
|
|
@@ -12484,7 +12484,7 @@ var packageRoot = () => {
|
|
|
12484
12484
|
var assetRoot = () => {
|
|
12485
12485
|
const root = packageRoot();
|
|
12486
12486
|
const assets = path16.join(root, "assets");
|
|
12487
|
-
return
|
|
12487
|
+
return existsSync4(assets) ? assets : root;
|
|
12488
12488
|
};
|
|
12489
12489
|
|
|
12490
12490
|
// packages/workit-core/src/core/store-lock.ts
|
|
@@ -14976,7 +14976,7 @@ function lightCommand(argv, cwd) {
|
|
|
14976
14976
|
}
|
|
14977
14977
|
|
|
14978
14978
|
// packages/workit-core/src/core/policy/derive.ts
|
|
14979
|
-
import { existsSync as
|
|
14979
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
14980
14980
|
import path22 from "node:path";
|
|
14981
14981
|
|
|
14982
14982
|
// packages/workit-core/src/ledger.ts
|
|
@@ -15063,7 +15063,7 @@ function bookkeepingPaths(cwd, input) {
|
|
|
15063
15063
|
}
|
|
15064
15064
|
|
|
15065
15065
|
// packages/workit-core/src/core/policy/lane.ts
|
|
15066
|
-
import { existsSync as
|
|
15066
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
15067
15067
|
import path20 from "node:path";
|
|
15068
15068
|
|
|
15069
15069
|
// packages/workit-core/src/git/default-base.ts
|
|
@@ -17142,7 +17142,7 @@ var productDecision = (task, ledger) => {
|
|
|
17142
17142
|
};
|
|
17143
17143
|
};
|
|
17144
17144
|
var planRecorded = (task, root) => {
|
|
17145
|
-
const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" &&
|
|
17145
|
+
const cited = (latestJudgment(task)?.refs ?? []).find((ref) => ref.kind === "external" || ref.kind === "file" && existsSync8(path22.resolve(root, ref.path)));
|
|
17146
17146
|
if (cited)
|
|
17147
17147
|
return {
|
|
17148
17148
|
met: true,
|
|
@@ -18573,7 +18573,7 @@ var exportDigest = (bundle) => sha256({
|
|
|
18573
18573
|
});
|
|
18574
18574
|
// packages/workit-core/src/core/route-intent.ts
|
|
18575
18575
|
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
18576
|
-
import { existsSync as
|
|
18576
|
+
import { existsSync as existsSync11 } from "node:fs";
|
|
18577
18577
|
import path30 from "node:path";
|
|
18578
18578
|
|
|
18579
18579
|
// packages/workit-core/src/hooks/raw-git.ts
|
|
@@ -18587,7 +18587,7 @@ import path29 from "node:path";
|
|
|
18587
18587
|
import path27 from "node:path";
|
|
18588
18588
|
|
|
18589
18589
|
// packages/workit-core/src/core/eval-world.ts
|
|
18590
|
-
import { existsSync as
|
|
18590
|
+
import { existsSync as existsSync10, realpathSync as realpathSync6 } from "node:fs";
|
|
18591
18591
|
import os5 from "node:os";
|
|
18592
18592
|
import path25 from "node:path";
|
|
18593
18593
|
var EVAL_WORLD_ENV = "WORKIT_EVAL_WORLD";
|
|
@@ -18601,8 +18601,8 @@ var evalWorld = (cwd) => {
|
|
|
18601
18601
|
if (!raw || !path25.isAbsolute(raw))
|
|
18602
18602
|
return null;
|
|
18603
18603
|
try {
|
|
18604
|
-
const world =
|
|
18605
|
-
return inside2(
|
|
18604
|
+
const world = realpathSync6(raw);
|
|
18605
|
+
return inside2(realpathSync6(os5.tmpdir()), world) && inside2(world, realpathSync6(cwd)) && existsSync10(path25.join(world, EVAL_WORLD_MARKER)) ? world : null;
|
|
18606
18606
|
} catch {
|
|
18607
18607
|
return null;
|
|
18608
18608
|
}
|
|
@@ -21595,7 +21595,7 @@ var judgedDir = (root, dir) => {
|
|
|
21595
21595
|
if (dir === null)
|
|
21596
21596
|
return root;
|
|
21597
21597
|
const resolved = path30.resolve(root, dir);
|
|
21598
|
-
return
|
|
21598
|
+
return existsSync11(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
|
|
21599
21599
|
};
|
|
21600
21600
|
var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
|
|
21601
21601
|
let judged = false;
|
|
@@ -21616,7 +21616,7 @@ var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
|
|
|
21616
21616
|
return judged ? { ok: true } : null;
|
|
21617
21617
|
};
|
|
21618
21618
|
// packages/workit-core/src/core/task-engine.ts
|
|
21619
|
-
import { realpathSync as
|
|
21619
|
+
import { realpathSync as realpathSync8 } from "node:fs";
|
|
21620
21620
|
|
|
21621
21621
|
// packages/workit-core/src/core/policy-resolver.ts
|
|
21622
21622
|
function resolvePolicy(input) {
|
|
@@ -21865,12 +21865,12 @@ var judgeInputSummary = (raw) => {
|
|
|
21865
21865
|
};
|
|
21866
21866
|
|
|
21867
21867
|
// packages/workit-core/src/core/task-view.ts
|
|
21868
|
-
import { realpathSync as
|
|
21868
|
+
import { realpathSync as realpathSync7 } from "node:fs";
|
|
21869
21869
|
var environment = () => [];
|
|
21870
21870
|
var sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor;
|
|
21871
21871
|
function contextRootError(store, context) {
|
|
21872
21872
|
try {
|
|
21873
|
-
|
|
21873
|
+
realpathSync7(context.root);
|
|
21874
21874
|
const root = checkoutRootOf(context.root);
|
|
21875
21875
|
if (root !== store.root && !sameDirectoryIdentity(root, store.root))
|
|
21876
21876
|
return failure2("invalid_input", "operation context root does not match the task store root");
|
|
@@ -23340,7 +23340,7 @@ class WorkitCore {
|
|
|
23340
23340
|
if (view.task.workspaceId !== view.workspace.id)
|
|
23341
23341
|
return failure2("invalid_input", "task and workspace bindings are invalid");
|
|
23342
23342
|
try {
|
|
23343
|
-
if (
|
|
23343
|
+
if (realpathSync8(view.workspace.root) !== this.store.root)
|
|
23344
23344
|
return failure2("invalid_input", "task view root does not match the task store");
|
|
23345
23345
|
} catch {
|
|
23346
23346
|
return failure2("invalid_input", "task view root cannot be resolved");
|
|
@@ -23591,7 +23591,7 @@ class WorkitCore {
|
|
|
23591
23591
|
}
|
|
23592
23592
|
// packages/workit-core/src/core/repo-context.ts
|
|
23593
23593
|
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
23594
|
-
import { existsSync as
|
|
23594
|
+
import { existsSync as existsSync12, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
23595
23595
|
import path31 from "node:path";
|
|
23596
23596
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
23597
23597
|
try {
|
|
@@ -23773,7 +23773,7 @@ var diffStatForRange = (cwd, range) => {
|
|
|
23773
23773
|
};
|
|
23774
23774
|
var packageScripts = (cwd, keys) => {
|
|
23775
23775
|
const pkgPath = path31.join(cwd, "package.json");
|
|
23776
|
-
if (!
|
|
23776
|
+
if (!existsSync12(pkgPath))
|
|
23777
23777
|
return [];
|
|
23778
23778
|
try {
|
|
23779
23779
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
@@ -23808,7 +23808,7 @@ var documentationFiles = (cwd) => {
|
|
|
23808
23808
|
return matches.toSorted().slice(0, 200);
|
|
23809
23809
|
};
|
|
23810
23810
|
var readTrimmed2 = (file, maxLines) => {
|
|
23811
|
-
if (!
|
|
23811
|
+
if (!existsSync12(file))
|
|
23812
23812
|
return "";
|
|
23813
23813
|
const lines = readFileSync11(file, "utf8").split(`
|
|
23814
23814
|
`);
|
|
@@ -23884,7 +23884,7 @@ ${status.stderr}` : "");
|
|
|
23884
23884
|
stdout += `
|
|
23885
23885
|
`;
|
|
23886
23886
|
stdout += printSection("Recent Validation Signals");
|
|
23887
|
-
if (
|
|
23887
|
+
if (existsSync12(path31.join(cwd, "package.json"))) {
|
|
23888
23888
|
stdout += `package.json detected. Common scripts:
|
|
23889
23889
|
`;
|
|
23890
23890
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -23893,7 +23893,7 @@ ${status.stderr}` : "");
|
|
|
23893
23893
|
`) + `
|
|
23894
23894
|
`;
|
|
23895
23895
|
}
|
|
23896
|
-
if (
|
|
23896
|
+
if (existsSync12(path31.join(cwd, "Cargo.toml")) || existsSync12(path31.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
23897
23897
|
stdout += `Rust project detected.
|
|
23898
23898
|
`;
|
|
23899
23899
|
}
|
|
@@ -23945,7 +23945,7 @@ function changelogContext(root, range) {
|
|
|
23945
23945
|
`;
|
|
23946
23946
|
stdout += printSection("Existing CHANGELOG.md");
|
|
23947
23947
|
const changelogPath = path31.join(cwd, "CHANGELOG.md");
|
|
23948
|
-
if (
|
|
23948
|
+
if (existsSync12(changelogPath)) {
|
|
23949
23949
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
23950
23950
|
`;
|
|
23951
23951
|
} else {
|
|
@@ -23987,7 +23987,7 @@ function docsRefreshContext(root, range) {
|
|
|
23987
23987
|
`;
|
|
23988
23988
|
stdout += printSection("README Preview");
|
|
23989
23989
|
const readme = path31.join(cwd, "README.md");
|
|
23990
|
-
if (
|
|
23990
|
+
if (existsSync12(readme)) {
|
|
23991
23991
|
stdout += readTrimmed2(readme, 220) + `
|
|
23992
23992
|
`;
|
|
23993
23993
|
} else {
|
|
@@ -23996,7 +23996,7 @@ function docsRefreshContext(root, range) {
|
|
|
23996
23996
|
}
|
|
23997
23997
|
stdout += printSection("Package Scripts");
|
|
23998
23998
|
const pkgPath = path31.join(cwd, "package.json");
|
|
23999
|
-
if (
|
|
23999
|
+
if (existsSync12(pkgPath)) {
|
|
24000
24000
|
try {
|
|
24001
24001
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
24002
24002
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
@@ -24052,7 +24052,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
24052
24052
|
`;
|
|
24053
24053
|
stdout += printSection("Existing Release Files");
|
|
24054
24054
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
24055
|
-
if (
|
|
24055
|
+
if (existsSync12(path31.join(cwd, rel)))
|
|
24056
24056
|
stdout += rel + `
|
|
24057
24057
|
`;
|
|
24058
24058
|
}
|
|
@@ -24783,22 +24783,22 @@ function resolveGitRevision(root, value) {
|
|
|
24783
24783
|
}
|
|
24784
24784
|
}
|
|
24785
24785
|
function resolveInside(root, candidate) {
|
|
24786
|
-
const base =
|
|
24786
|
+
const base = realpathSync9(root);
|
|
24787
24787
|
const target = path35.resolve(base, candidate);
|
|
24788
24788
|
if (target !== base && !target.startsWith(base + path35.sep)) {
|
|
24789
24789
|
throw new Error("path must stay inside repository root");
|
|
24790
24790
|
}
|
|
24791
24791
|
let ancestor = target;
|
|
24792
|
-
while (!
|
|
24792
|
+
while (!existsSync13(ancestor))
|
|
24793
24793
|
ancestor = path35.dirname(ancestor);
|
|
24794
|
-
const canonicalAncestor =
|
|
24794
|
+
const canonicalAncestor = realpathSync9(ancestor);
|
|
24795
24795
|
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path35.sep)) {
|
|
24796
24796
|
throw new Error("path must stay inside repository root");
|
|
24797
24797
|
}
|
|
24798
24798
|
return target;
|
|
24799
24799
|
}
|
|
24800
24800
|
function run2(root, executable, args, env = {}) {
|
|
24801
|
-
const cwd =
|
|
24801
|
+
const cwd = realpathSync9(root);
|
|
24802
24802
|
const result = spawnSync22(executable, args, {
|
|
24803
24803
|
cwd,
|
|
24804
24804
|
encoding: "utf8",
|
|
@@ -25862,11 +25862,11 @@ function heavyGate(cwd, command, options) {
|
|
|
25862
25862
|
}
|
|
25863
25863
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
25864
25864
|
import {
|
|
25865
|
-
existsSync as
|
|
25865
|
+
existsSync as existsSync14,
|
|
25866
25866
|
readdirSync as readdirSync5,
|
|
25867
25867
|
readFileSync as readFileSync12,
|
|
25868
25868
|
readlinkSync as readlinkSync2,
|
|
25869
|
-
realpathSync as
|
|
25869
|
+
realpathSync as realpathSync10,
|
|
25870
25870
|
statSync as statSync5
|
|
25871
25871
|
} from "node:fs";
|
|
25872
25872
|
import os9 from "node:os";
|
|
@@ -26081,7 +26081,7 @@ var linkTarget = (file) => {
|
|
|
26081
26081
|
const to = readlinkSync2(file);
|
|
26082
26082
|
let from = path41.dirname(file);
|
|
26083
26083
|
try {
|
|
26084
|
-
from =
|
|
26084
|
+
from = realpathSync10.native(from);
|
|
26085
26085
|
} catch {}
|
|
26086
26086
|
return path41.resolve(from, to);
|
|
26087
26087
|
} catch {
|
|
@@ -26093,7 +26093,7 @@ var realPath = (file, dangling = true) => {
|
|
|
26093
26093
|
let rest = "";
|
|
26094
26094
|
for (let hops = 0;; ) {
|
|
26095
26095
|
try {
|
|
26096
|
-
return path41.join(
|
|
26096
|
+
return path41.join(realpathSync10.native(dir), rest);
|
|
26097
26097
|
} catch {
|
|
26098
26098
|
const link = dangling ? linkTarget(dir) : null;
|
|
26099
26099
|
if (link !== null) {
|
|
@@ -26548,7 +26548,7 @@ var linkSources = (args, at) => {
|
|
|
26548
26548
|
const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
|
|
26549
26549
|
const target = dest === undefined ? null : at(dest);
|
|
26550
26550
|
const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
|
|
26551
|
-
const base = target === null ? null : into >= 0 || sources.length > 1 ||
|
|
26551
|
+
const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync14(target) || /[\\/]$/.test(dest ?? "") ? target : path41.dirname(target);
|
|
26552
26552
|
return sources.flatMap((source) => {
|
|
26553
26553
|
if (symbolic && base !== null && !path41.isAbsolute(homeExpanded(source)))
|
|
26554
26554
|
return [path41.resolve(base, source)];
|
|
@@ -29338,7 +29338,7 @@ if (false) {}
|
|
|
29338
29338
|
import path48 from "node:path";
|
|
29339
29339
|
|
|
29340
29340
|
// packages/workit-core/src/core/gitignore.ts
|
|
29341
|
-
import { existsSync as
|
|
29341
|
+
import { existsSync as existsSync15, readFileSync as readFileSync13, writeFileSync as writeFileSync5 } from "node:fs";
|
|
29342
29342
|
import path44 from "node:path";
|
|
29343
29343
|
var GITIGNORE_ENTRIES = [
|
|
29344
29344
|
"# workit: SDD working state (never commit)",
|
|
@@ -29360,7 +29360,7 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
|
29360
29360
|
if (!confirmed)
|
|
29361
29361
|
return { ok: false, error: "confirmed: true required" };
|
|
29362
29362
|
const file = path44.join(workspaceRoot, ".gitignore");
|
|
29363
|
-
const existing =
|
|
29363
|
+
const existing = existsSync15(file) ? readFileSync13(file, "utf8") : "";
|
|
29364
29364
|
const existingLines = new Set(existing.split(`
|
|
29365
29365
|
`).map((l) => l.trim()).filter(Boolean));
|
|
29366
29366
|
const added = [];
|
|
@@ -29379,19 +29379,19 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
|
29379
29379
|
` : "") + append.join(`
|
|
29380
29380
|
`) + `
|
|
29381
29381
|
`, "utf8");
|
|
29382
|
-
} else if (!
|
|
29382
|
+
} else if (!existsSync15(file)) {
|
|
29383
29383
|
writeFileSync5(file, "", "utf8");
|
|
29384
29384
|
}
|
|
29385
29385
|
return { ok: true, path: file, added };
|
|
29386
29386
|
};
|
|
29387
29387
|
|
|
29388
29388
|
// packages/workit-core/src/core/hygiene.ts
|
|
29389
|
-
import { existsSync as
|
|
29389
|
+
import { existsSync as existsSync16, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
29390
29390
|
import path45 from "node:path";
|
|
29391
29391
|
var repoRoot3 = assetRoot();
|
|
29392
29392
|
var templatesDir = () => path45.join(repoRoot3, "templates", "hygiene");
|
|
29393
29393
|
var packageJson = (root) => {
|
|
29394
|
-
if (!
|
|
29394
|
+
if (!existsSync16(path45.join(root, "package.json")))
|
|
29395
29395
|
return null;
|
|
29396
29396
|
try {
|
|
29397
29397
|
return JSON.parse(readFileSync14(path45.join(root, "package.json"), "utf8"));
|
|
@@ -29400,7 +29400,7 @@ var packageJson = (root) => {
|
|
|
29400
29400
|
}
|
|
29401
29401
|
};
|
|
29402
29402
|
var isOpenSource = (root) => {
|
|
29403
|
-
if (
|
|
29403
|
+
if (existsSync16(path45.join(root, "LICENSE")))
|
|
29404
29404
|
return true;
|
|
29405
29405
|
const pkg = packageJson(root);
|
|
29406
29406
|
if (pkg && !pkg.private)
|
|
@@ -29428,10 +29428,10 @@ var planHygieneFiles = (root, opts = {}) => {
|
|
|
29428
29428
|
files.push("LICENSE", "CONTRIBUTING.md");
|
|
29429
29429
|
const planned = [];
|
|
29430
29430
|
for (const file of files) {
|
|
29431
|
-
if (
|
|
29431
|
+
if (existsSync16(path45.join(root, file)))
|
|
29432
29432
|
continue;
|
|
29433
29433
|
const tpl = path45.join(templatesDir(), file);
|
|
29434
|
-
if (!
|
|
29434
|
+
if (!existsSync16(tpl))
|
|
29435
29435
|
continue;
|
|
29436
29436
|
const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path45.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
|
|
29437
29437
|
planned.push({ path: path45.join(root, file), content });
|
|
@@ -29819,13 +29819,13 @@ var executeInitApply = (args, directory, runtime) => {
|
|
|
29819
29819
|
};
|
|
29820
29820
|
|
|
29821
29821
|
// packages/workit-opencode/src/shared/session.ts
|
|
29822
|
-
import { realpathSync as
|
|
29822
|
+
import { realpathSync as realpathSync11 } from "node:fs";
|
|
29823
29823
|
import path49 from "node:path";
|
|
29824
29824
|
var sameWorkspace = (expected, observed) => {
|
|
29825
29825
|
if (typeof observed !== "string" || !observed)
|
|
29826
29826
|
return false;
|
|
29827
29827
|
try {
|
|
29828
|
-
return
|
|
29828
|
+
return realpathSync11(expected) === realpathSync11(observed);
|
|
29829
29829
|
} catch {
|
|
29830
29830
|
return path49.resolve(expected) === path49.resolve(observed);
|
|
29831
29831
|
}
|
|
@@ -29898,7 +29898,7 @@ var workitFamilyOf = (toolName) => {
|
|
|
29898
29898
|
};
|
|
29899
29899
|
|
|
29900
29900
|
// packages/workit-opencode/src/tools/context.ts
|
|
29901
|
-
import { realpathSync as
|
|
29901
|
+
import { realpathSync as realpathSync12 } from "node:fs";
|
|
29902
29902
|
import path50 from "node:path";
|
|
29903
29903
|
var createContextTool = () => ({
|
|
29904
29904
|
description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
|
|
@@ -29909,7 +29909,7 @@ var createContextTool = () => ({
|
|
|
29909
29909
|
let root;
|
|
29910
29910
|
try {
|
|
29911
29911
|
const cwd = parsed.data.cwd;
|
|
29912
|
-
root =
|
|
29912
|
+
root = realpathSync12(cwd ? path50.resolve(context.directory, cwd) : context.directory);
|
|
29913
29913
|
} catch {
|
|
29914
29914
|
return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
|
|
29915
29915
|
}
|
|
@@ -30180,7 +30180,7 @@ import path52 from "node:path";
|
|
|
30180
30180
|
|
|
30181
30181
|
// packages/workit-core/src/git/ops.ts
|
|
30182
30182
|
import { spawnSync as spawnSync27 } from "node:child_process";
|
|
30183
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
30183
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync17, readdirSync as readdirSync7, readFileSync as readFileSync16, rmSync as rmSync4 } from "node:fs";
|
|
30184
30184
|
import path51 from "node:path";
|
|
30185
30185
|
var COMMIT_TIMEOUT_MS = 10 * 60000;
|
|
30186
30186
|
var git5 = (cwd, args, options = {}) => {
|
|
@@ -30218,11 +30218,11 @@ function operationInProgress(cwd) {
|
|
|
30218
30218
|
const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
|
|
30219
30219
|
for (const [index, [, operation]] of markers.entries()) {
|
|
30220
30220
|
const marker = found[index];
|
|
30221
|
-
if (!marker || !
|
|
30221
|
+
if (!marker || !existsSync17(marker))
|
|
30222
30222
|
continue;
|
|
30223
|
-
if (index === 1 &&
|
|
30223
|
+
if (index === 1 && existsSync17(path51.join(marker, "applying")))
|
|
30224
30224
|
return { operation: "am", commitAllowed: false, branch: null };
|
|
30225
|
-
if (index === 0 &&
|
|
30225
|
+
if (index === 0 && existsSync17(path51.join(marker, "amend")) && !conflicted()) {
|
|
30226
30226
|
let headName = "";
|
|
30227
30227
|
try {
|
|
30228
30228
|
headName = readFileSync16(path51.join(marker, "head-name"), "utf8").trim();
|
|
@@ -31860,16 +31860,16 @@ var createStopControl = (root, port) => {
|
|
|
31860
31860
|
};
|
|
31861
31861
|
|
|
31862
31862
|
// packages/workit-opencode/src/v2/registry.ts
|
|
31863
|
-
import { existsSync as
|
|
31863
|
+
import { existsSync as existsSync19, readFileSync as readFileSync17 } from "node:fs";
|
|
31864
31864
|
import path56 from "node:path";
|
|
31865
31865
|
|
|
31866
31866
|
// packages/workit-opencode/src/shared/assets.ts
|
|
31867
|
-
import { existsSync as
|
|
31867
|
+
import { existsSync as existsSync18, realpathSync as realpathSync13 } from "node:fs";
|
|
31868
31868
|
import path55 from "node:path";
|
|
31869
31869
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
31870
31870
|
var moduleDir = () => {
|
|
31871
31871
|
try {
|
|
31872
|
-
return
|
|
31872
|
+
return realpathSync13(path55.dirname(fileURLToPath2(import.meta.url)));
|
|
31873
31873
|
} catch {
|
|
31874
31874
|
return path55.dirname(fileURLToPath2(import.meta.url));
|
|
31875
31875
|
}
|
|
@@ -31881,7 +31881,7 @@ var packageRoot2 = () => {
|
|
|
31881
31881
|
path55.resolve(dir, "..", ".."),
|
|
31882
31882
|
path55.resolve(dir, "..", "..", "..")
|
|
31883
31883
|
]) {
|
|
31884
|
-
if (
|
|
31884
|
+
if (existsSync18(path55.join(candidate, "package.json")))
|
|
31885
31885
|
return candidate;
|
|
31886
31886
|
}
|
|
31887
31887
|
return path55.resolve(dir, "..");
|
|
@@ -31889,7 +31889,7 @@ var packageRoot2 = () => {
|
|
|
31889
31889
|
var skillsRoot = () => {
|
|
31890
31890
|
const root = packageRoot2();
|
|
31891
31891
|
const canonical = path55.resolve(root, "..", "workit-core", "skills");
|
|
31892
|
-
if (
|
|
31892
|
+
if (existsSync18(path55.join(root, "src")) && existsSync18(canonical))
|
|
31893
31893
|
return canonical;
|
|
31894
31894
|
return path55.join(root, "assets", "skills");
|
|
31895
31895
|
};
|
|
@@ -31915,7 +31915,7 @@ var parseFrontmatter = (markdown) => {
|
|
|
31915
31915
|
};
|
|
31916
31916
|
var registerSkills = async (ctx) => {
|
|
31917
31917
|
const skillsDir = skillsRoot();
|
|
31918
|
-
if (!
|
|
31918
|
+
if (!existsSync19(skillsDir))
|
|
31919
31919
|
return new Set;
|
|
31920
31920
|
const listed = await ctx.skill.list().catch(() => ({ data: [] }));
|
|
31921
31921
|
const own = (skill) => typeof skill.path === "string" && path56.resolve(skill.path).startsWith(skillsDir + path56.sep);
|
|
@@ -31923,7 +31923,7 @@ var registerSkills = async (ctx) => {
|
|
|
31923
31923
|
const packaged = new Map;
|
|
31924
31924
|
for (const id of WORKIT_METHOD_SKILLS) {
|
|
31925
31925
|
const file = path56.join(skillsDir, id, "SKILL.md");
|
|
31926
|
-
if (!userSkills.has(id) &&
|
|
31926
|
+
if (!userSkills.has(id) && existsSync19(file))
|
|
31927
31927
|
packaged.set(id, file);
|
|
31928
31928
|
}
|
|
31929
31929
|
await ctx.skill.transform((editor) => {
|
|
@@ -31969,11 +31969,11 @@ var registerCommands = async (ctx, registeredSkills) => {
|
|
|
31969
31969
|
};
|
|
31970
31970
|
|
|
31971
31971
|
// packages/workit-opencode/src/stale-sources.ts
|
|
31972
|
-
import { existsSync as
|
|
31972
|
+
import { existsSync as existsSync20, readdirSync as readdirSync8 } from "node:fs";
|
|
31973
31973
|
import path57 from "node:path";
|
|
31974
31974
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
31975
31975
|
var typescriptFiles = (directory) => {
|
|
31976
|
-
if (!
|
|
31976
|
+
if (!existsSync20(directory))
|
|
31977
31977
|
return [];
|
|
31978
31978
|
return readdirSync8(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
31979
31979
|
const file = path57.join(directory, entry.name);
|
|
@@ -31987,10 +31987,10 @@ var pluginSourceFiles = [
|
|
|
31987
31987
|
path57.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
|
|
31988
31988
|
...typescriptFiles(path57.join(packageRoot2(), "..", "workit-core", "src", "core"))
|
|
31989
31989
|
])
|
|
31990
|
-
].filter((file) =>
|
|
31990
|
+
].filter((file) => existsSync20(file)).toSorted();
|
|
31991
31991
|
|
|
31992
31992
|
// packages/workit-core/src/core/cli-locate.ts
|
|
31993
|
-
import { closeSync as closeSync2, existsSync as
|
|
31993
|
+
import { closeSync as closeSync2, existsSync as existsSync21, openSync as openSync2, readSync } from "node:fs";
|
|
31994
31994
|
import path58 from "node:path";
|
|
31995
31995
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
31996
31996
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
@@ -32019,7 +32019,7 @@ var head = (file) => {
|
|
|
32019
32019
|
var locateWorkitCli = (options = {}) => {
|
|
32020
32020
|
const env = options.env ?? process.env;
|
|
32021
32021
|
const platform = options.platform ?? process.platform;
|
|
32022
|
-
const exists = options.exists ??
|
|
32022
|
+
const exists = options.exists ?? existsSync21;
|
|
32023
32023
|
const read = options.read ?? head;
|
|
32024
32024
|
const node = options.node ?? process.execPath;
|
|
32025
32025
|
const launcher = ownedLauncherPath(env, platform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@opencode/plugin": "2.0.18",
|
|
44
|
-
"@workit-dev/core": "^2.4.
|
|
44
|
+
"@workit-dev/core": "^2.4.2"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|