@workit-dev/opencode 2.12.0 → 2.13.0
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 +73 -47
- 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 existsSync14, 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
|
|
@@ -18577,7 +18577,7 @@ var exportDigest = (bundle) => sha256({
|
|
|
18577
18577
|
});
|
|
18578
18578
|
// packages/workit-core/src/core/route-intent.ts
|
|
18579
18579
|
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
18580
|
-
import { existsSync as
|
|
18580
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
18581
18581
|
import path30 from "node:path";
|
|
18582
18582
|
|
|
18583
18583
|
// packages/workit-core/src/hooks/raw-git.ts
|
|
@@ -18588,6 +18588,7 @@ import os6 from "node:os";
|
|
|
18588
18588
|
import path29 from "node:path";
|
|
18589
18589
|
|
|
18590
18590
|
// packages/workit-core/src/autonomy.ts
|
|
18591
|
+
import { closeSync as closeSync2, copyFileSync as copyFileSync2, existsSync as existsSync11, openSync as openSync2 } from "node:fs";
|
|
18591
18592
|
import path27 from "node:path";
|
|
18592
18593
|
|
|
18593
18594
|
// packages/workit-core/src/core/eval-world.ts
|
|
@@ -18684,12 +18685,36 @@ function checkSeal(dir) {
|
|
|
18684
18685
|
}
|
|
18685
18686
|
|
|
18686
18687
|
// packages/workit-core/src/autonomy.ts
|
|
18687
|
-
var
|
|
18688
|
+
var accountHomeDir = () => {
|
|
18688
18689
|
const home = grantsHome.resolve();
|
|
18689
18690
|
return home === null ? null : configDir({ HOME: home });
|
|
18690
18691
|
};
|
|
18691
|
-
var
|
|
18692
|
+
var deniedFile = (dir) => {
|
|
18693
|
+
for (const name of ["workspaces.json", SEAL_FILE]) {
|
|
18694
|
+
const file = path27.join(dir, name);
|
|
18695
|
+
try {
|
|
18696
|
+
closeSync2(openSync2(file, "r"));
|
|
18697
|
+
} catch (error) {
|
|
18698
|
+
const code = error.code;
|
|
18699
|
+
if (code === "EACCES" || code === "EPERM")
|
|
18700
|
+
return file;
|
|
18701
|
+
}
|
|
18702
|
+
}
|
|
18703
|
+
return null;
|
|
18704
|
+
};
|
|
18705
|
+
var accountDir = () => {
|
|
18706
|
+
const dir = accountHomeDir();
|
|
18707
|
+
return dir === null || deniedFile(dir) !== null ? null : dir;
|
|
18708
|
+
};
|
|
18709
|
+
var grantsDir = () => accountHomeDir() ?? resolveConfigDir();
|
|
18692
18710
|
var NO_ACCOUNT = "no OS account record answered (core/account-home.ts), so no grants are read: the D4 defaults apply";
|
|
18711
|
+
var accountUnread = () => {
|
|
18712
|
+
const dir = accountHomeDir();
|
|
18713
|
+
if (dir === null)
|
|
18714
|
+
return NO_ACCOUNT;
|
|
18715
|
+
const file = deniedFile(dir);
|
|
18716
|
+
return file === null ? null : `the account's ${path27.basename(file)} cannot be read (permission denied), so it reads as no workspace entries: no grants, no models, the D4 defaults apply`;
|
|
18717
|
+
};
|
|
18693
18718
|
var entriesIn = (dir) => dir === null ? [] : loadWorkspacesFrom(dir);
|
|
18694
18719
|
var fileSource = (dir = accountDir()) => ({
|
|
18695
18720
|
resolve: (cwd, name) => dir === null ? null : resolveWorkspaceFrom(cwd, dir, name),
|
|
@@ -18749,7 +18774,7 @@ var benchWorld = (cwd) => {
|
|
|
18749
18774
|
var grantsOverride = () => {
|
|
18750
18775
|
const shown = shownGrantsDir();
|
|
18751
18776
|
if (shown === null)
|
|
18752
|
-
return NO_ACCOUNT;
|
|
18777
|
+
return accountUnread() ?? NO_ACCOUNT;
|
|
18753
18778
|
const configured = path27.resolve(resolveConfigDir());
|
|
18754
18779
|
return configured === path27.resolve(shown) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path27.join(grantsDir(), "workspaces.json")}, and under a redirect they never exceed the D4 defaults`;
|
|
18755
18780
|
};
|
|
@@ -18918,9 +18943,10 @@ function capAt(source, named, where, by, why, main = false) {
|
|
|
18918
18943
|
}
|
|
18919
18944
|
function resolveAutonomy(cwd, target) {
|
|
18920
18945
|
const world = benchWorld(cwd);
|
|
18946
|
+
const unread = world ? null : accountUnread();
|
|
18947
|
+
if (unread !== null)
|
|
18948
|
+
return { ...autonomyOf(null), note: unread };
|
|
18921
18949
|
const override = world ? null : grantsOverride();
|
|
18922
|
-
if (override === NO_ACCOUNT)
|
|
18923
|
-
return { ...autonomyOf(null), note: override };
|
|
18924
18950
|
let resolved;
|
|
18925
18951
|
const once = typeof target === "function" ? () => resolved ??= target() : target;
|
|
18926
18952
|
const account = accountAuthority(cwd, world, once);
|
|
@@ -19019,9 +19045,9 @@ function capAtRemotes(source, autonomy, cwd, target) {
|
|
|
19019
19045
|
return capped;
|
|
19020
19046
|
}
|
|
19021
19047
|
var grantsMatter = (kind) => {
|
|
19022
|
-
|
|
19023
|
-
if (override === NO_ACCOUNT)
|
|
19048
|
+
if (accountUnread() !== null)
|
|
19024
19049
|
return false;
|
|
19050
|
+
const override = grantsOverride();
|
|
19025
19051
|
const entries = entriesIn(accountDir());
|
|
19026
19052
|
const matters = entries.some((entry) => {
|
|
19027
19053
|
const autonomy = autonomyOf(entry);
|
|
@@ -21599,7 +21625,7 @@ var judgedDir = (root, dir) => {
|
|
|
21599
21625
|
if (dir === null)
|
|
21600
21626
|
return root;
|
|
21601
21627
|
const resolved = path30.resolve(root, dir);
|
|
21602
|
-
return
|
|
21628
|
+
return existsSync12(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
|
|
21603
21629
|
};
|
|
21604
21630
|
var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
|
|
21605
21631
|
let judged = false;
|
|
@@ -23595,7 +23621,7 @@ class WorkitCore {
|
|
|
23595
23621
|
}
|
|
23596
23622
|
// packages/workit-core/src/core/repo-context.ts
|
|
23597
23623
|
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
23598
|
-
import { existsSync as
|
|
23624
|
+
import { existsSync as existsSync13, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "node:fs";
|
|
23599
23625
|
import path31 from "node:path";
|
|
23600
23626
|
var isSafeContextRange = (value) => value.length <= 4096 && (() => {
|
|
23601
23627
|
try {
|
|
@@ -23777,7 +23803,7 @@ var diffStatForRange = (cwd, range) => {
|
|
|
23777
23803
|
};
|
|
23778
23804
|
var packageScripts = (cwd, keys) => {
|
|
23779
23805
|
const pkgPath = path31.join(cwd, "package.json");
|
|
23780
|
-
if (!
|
|
23806
|
+
if (!existsSync13(pkgPath))
|
|
23781
23807
|
return [];
|
|
23782
23808
|
try {
|
|
23783
23809
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
@@ -23812,7 +23838,7 @@ var documentationFiles = (cwd) => {
|
|
|
23812
23838
|
return matches.toSorted().slice(0, 200);
|
|
23813
23839
|
};
|
|
23814
23840
|
var readTrimmed2 = (file, maxLines) => {
|
|
23815
|
-
if (!
|
|
23841
|
+
if (!existsSync13(file))
|
|
23816
23842
|
return "";
|
|
23817
23843
|
const lines = readFileSync11(file, "utf8").split(`
|
|
23818
23844
|
`);
|
|
@@ -23888,7 +23914,7 @@ ${status.stderr}` : "");
|
|
|
23888
23914
|
stdout += `
|
|
23889
23915
|
`;
|
|
23890
23916
|
stdout += printSection("Recent Validation Signals");
|
|
23891
|
-
if (
|
|
23917
|
+
if (existsSync13(path31.join(cwd, "package.json"))) {
|
|
23892
23918
|
stdout += `package.json detected. Common scripts:
|
|
23893
23919
|
`;
|
|
23894
23920
|
const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
|
|
@@ -23897,7 +23923,7 @@ ${status.stderr}` : "");
|
|
|
23897
23923
|
`) + `
|
|
23898
23924
|
`;
|
|
23899
23925
|
}
|
|
23900
|
-
if (
|
|
23926
|
+
if (existsSync13(path31.join(cwd, "Cargo.toml")) || existsSync13(path31.join(cwd, "src-tauri/Cargo.toml"))) {
|
|
23901
23927
|
stdout += `Rust project detected.
|
|
23902
23928
|
`;
|
|
23903
23929
|
}
|
|
@@ -23949,7 +23975,7 @@ function changelogContext(root, range) {
|
|
|
23949
23975
|
`;
|
|
23950
23976
|
stdout += printSection("Existing CHANGELOG.md");
|
|
23951
23977
|
const changelogPath = path31.join(cwd, "CHANGELOG.md");
|
|
23952
|
-
if (
|
|
23978
|
+
if (existsSync13(changelogPath)) {
|
|
23953
23979
|
stdout += readTrimmed2(changelogPath, 260) + `
|
|
23954
23980
|
`;
|
|
23955
23981
|
} else {
|
|
@@ -23991,7 +24017,7 @@ function docsRefreshContext(root, range) {
|
|
|
23991
24017
|
`;
|
|
23992
24018
|
stdout += printSection("README Preview");
|
|
23993
24019
|
const readme = path31.join(cwd, "README.md");
|
|
23994
|
-
if (
|
|
24020
|
+
if (existsSync13(readme)) {
|
|
23995
24021
|
stdout += readTrimmed2(readme, 220) + `
|
|
23996
24022
|
`;
|
|
23997
24023
|
} else {
|
|
@@ -24000,7 +24026,7 @@ function docsRefreshContext(root, range) {
|
|
|
24000
24026
|
}
|
|
24001
24027
|
stdout += printSection("Package Scripts");
|
|
24002
24028
|
const pkgPath = path31.join(cwd, "package.json");
|
|
24003
|
-
if (
|
|
24029
|
+
if (existsSync13(pkgPath)) {
|
|
24004
24030
|
try {
|
|
24005
24031
|
const pkg = JSON.parse(readFileSync11(pkgPath, "utf8"));
|
|
24006
24032
|
stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
|
|
@@ -24056,7 +24082,7 @@ function releaseNotesContext(root, rangeOrTag) {
|
|
|
24056
24082
|
`;
|
|
24057
24083
|
stdout += printSection("Existing Release Files");
|
|
24058
24084
|
for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
|
|
24059
|
-
if (
|
|
24085
|
+
if (existsSync13(path31.join(cwd, rel)))
|
|
24060
24086
|
stdout += rel + `
|
|
24061
24087
|
`;
|
|
24062
24088
|
}
|
|
@@ -24793,7 +24819,7 @@ function resolveInside(root, candidate) {
|
|
|
24793
24819
|
throw new Error("path must stay inside repository root");
|
|
24794
24820
|
}
|
|
24795
24821
|
let ancestor = target;
|
|
24796
|
-
while (!
|
|
24822
|
+
while (!existsSync14(ancestor))
|
|
24797
24823
|
ancestor = path35.dirname(ancestor);
|
|
24798
24824
|
const canonicalAncestor = realpathSync9(ancestor);
|
|
24799
24825
|
if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path35.sep)) {
|
|
@@ -26001,7 +26027,7 @@ function heavyGate(cwd, command, options) {
|
|
|
26001
26027
|
}
|
|
26002
26028
|
// packages/workit-core/src/hooks/write-gate.ts
|
|
26003
26029
|
import {
|
|
26004
|
-
existsSync as
|
|
26030
|
+
existsSync as existsSync15,
|
|
26005
26031
|
readdirSync as readdirSync5,
|
|
26006
26032
|
readFileSync as readFileSync12,
|
|
26007
26033
|
readlinkSync as readlinkSync3,
|
|
@@ -26713,7 +26739,7 @@ var linkSources = (args, at) => {
|
|
|
26713
26739
|
const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
|
|
26714
26740
|
const target = dest === undefined ? null : at(dest);
|
|
26715
26741
|
const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
|
|
26716
|
-
const base = target === null ? null : into >= 0 || sources.length > 1 ||
|
|
26742
|
+
const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync15(target) || /[\\/]$/.test(dest ?? "") ? target : path41.dirname(target);
|
|
26717
26743
|
return sources.flatMap((source) => {
|
|
26718
26744
|
if (symbolic && base !== null && !path41.isAbsolute(homeExpanded(source)))
|
|
26719
26745
|
return [path41.resolve(base, source)];
|
|
@@ -29576,7 +29602,7 @@ if (false) {}
|
|
|
29576
29602
|
import path49 from "node:path";
|
|
29577
29603
|
|
|
29578
29604
|
// packages/workit-core/src/core/gitignore.ts
|
|
29579
|
-
import { existsSync as
|
|
29605
|
+
import { existsSync as existsSync16, readFileSync as readFileSync13, writeFileSync as writeFileSync5 } from "node:fs";
|
|
29580
29606
|
import path45 from "node:path";
|
|
29581
29607
|
var GITIGNORE_ENTRIES = [
|
|
29582
29608
|
"# workit: SDD working state (never commit)",
|
|
@@ -29598,7 +29624,7 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
|
29598
29624
|
if (!confirmed)
|
|
29599
29625
|
return { ok: false, error: "confirmed: true required" };
|
|
29600
29626
|
const file = path45.join(workspaceRoot, ".gitignore");
|
|
29601
|
-
const existing =
|
|
29627
|
+
const existing = existsSync16(file) ? readFileSync13(file, "utf8") : "";
|
|
29602
29628
|
const existingLines = new Set(existing.split(`
|
|
29603
29629
|
`).map((l) => l.trim()).filter(Boolean));
|
|
29604
29630
|
const added = [];
|
|
@@ -29617,19 +29643,19 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
|
29617
29643
|
` : "") + append.join(`
|
|
29618
29644
|
`) + `
|
|
29619
29645
|
`, "utf8");
|
|
29620
|
-
} else if (!
|
|
29646
|
+
} else if (!existsSync16(file)) {
|
|
29621
29647
|
writeFileSync5(file, "", "utf8");
|
|
29622
29648
|
}
|
|
29623
29649
|
return { ok: true, path: file, added };
|
|
29624
29650
|
};
|
|
29625
29651
|
|
|
29626
29652
|
// packages/workit-core/src/core/hygiene.ts
|
|
29627
|
-
import { existsSync as
|
|
29653
|
+
import { existsSync as existsSync17, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
29628
29654
|
import path46 from "node:path";
|
|
29629
29655
|
var repoRoot3 = assetRoot();
|
|
29630
29656
|
var templatesDir = () => path46.join(repoRoot3, "templates", "hygiene");
|
|
29631
29657
|
var packageJson = (root) => {
|
|
29632
|
-
if (!
|
|
29658
|
+
if (!existsSync17(path46.join(root, "package.json")))
|
|
29633
29659
|
return null;
|
|
29634
29660
|
try {
|
|
29635
29661
|
return JSON.parse(readFileSync14(path46.join(root, "package.json"), "utf8"));
|
|
@@ -29638,7 +29664,7 @@ var packageJson = (root) => {
|
|
|
29638
29664
|
}
|
|
29639
29665
|
};
|
|
29640
29666
|
var isOpenSource = (root) => {
|
|
29641
|
-
if (
|
|
29667
|
+
if (existsSync17(path46.join(root, "LICENSE")))
|
|
29642
29668
|
return true;
|
|
29643
29669
|
const pkg = packageJson(root);
|
|
29644
29670
|
if (pkg && !pkg.private)
|
|
@@ -29666,10 +29692,10 @@ var planHygieneFiles = (root, opts = {}) => {
|
|
|
29666
29692
|
files.push("LICENSE", "CONTRIBUTING.md");
|
|
29667
29693
|
const planned = [];
|
|
29668
29694
|
for (const file of files) {
|
|
29669
|
-
if (
|
|
29695
|
+
if (existsSync17(path46.join(root, file)))
|
|
29670
29696
|
continue;
|
|
29671
29697
|
const tpl = path46.join(templatesDir(), file);
|
|
29672
|
-
if (!
|
|
29698
|
+
if (!existsSync17(tpl))
|
|
29673
29699
|
continue;
|
|
29674
29700
|
const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path46.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
|
|
29675
29701
|
planned.push({ path: path46.join(root, file), content });
|
|
@@ -30418,7 +30444,7 @@ import path53 from "node:path";
|
|
|
30418
30444
|
|
|
30419
30445
|
// packages/workit-core/src/git/ops.ts
|
|
30420
30446
|
import { spawnSync as spawnSync27 } from "node:child_process";
|
|
30421
|
-
import { copyFileSync as
|
|
30447
|
+
import { copyFileSync as copyFileSync3, existsSync as existsSync18, readdirSync as readdirSync7, readFileSync as readFileSync16, rmSync as rmSync4 } from "node:fs";
|
|
30422
30448
|
import path52 from "node:path";
|
|
30423
30449
|
var COMMIT_TIMEOUT_MS = 10 * 60000;
|
|
30424
30450
|
var git5 = (cwd, args, options = {}) => {
|
|
@@ -30456,11 +30482,11 @@ function operationInProgress(cwd) {
|
|
|
30456
30482
|
const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
|
|
30457
30483
|
for (const [index, [, operation]] of markers.entries()) {
|
|
30458
30484
|
const marker = found[index];
|
|
30459
|
-
if (!marker || !
|
|
30485
|
+
if (!marker || !existsSync18(marker))
|
|
30460
30486
|
continue;
|
|
30461
|
-
if (index === 1 &&
|
|
30487
|
+
if (index === 1 && existsSync18(path52.join(marker, "applying")))
|
|
30462
30488
|
return { operation: "am", commitAllowed: false, branch: null };
|
|
30463
|
-
if (index === 0 &&
|
|
30489
|
+
if (index === 0 && existsSync18(path52.join(marker, "amend")) && !conflicted()) {
|
|
30464
30490
|
let headName = "";
|
|
30465
30491
|
try {
|
|
30466
30492
|
headName = readFileSync16(path52.join(marker, "head-name"), "utf8").trim();
|
|
@@ -32107,11 +32133,11 @@ var createStopControl = (root, port) => {
|
|
|
32107
32133
|
};
|
|
32108
32134
|
|
|
32109
32135
|
// packages/workit-opencode/src/v2/registry.ts
|
|
32110
|
-
import { existsSync as
|
|
32136
|
+
import { existsSync as existsSync20, readFileSync as readFileSync17 } from "node:fs";
|
|
32111
32137
|
import path57 from "node:path";
|
|
32112
32138
|
|
|
32113
32139
|
// packages/workit-opencode/src/shared/assets.ts
|
|
32114
|
-
import { existsSync as
|
|
32140
|
+
import { existsSync as existsSync19, realpathSync as realpathSync13 } from "node:fs";
|
|
32115
32141
|
import path56 from "node:path";
|
|
32116
32142
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
32117
32143
|
var moduleDir = () => {
|
|
@@ -32128,7 +32154,7 @@ var packageRoot2 = () => {
|
|
|
32128
32154
|
path56.resolve(dir, "..", ".."),
|
|
32129
32155
|
path56.resolve(dir, "..", "..", "..")
|
|
32130
32156
|
]) {
|
|
32131
|
-
if (
|
|
32157
|
+
if (existsSync19(path56.join(candidate, "package.json")))
|
|
32132
32158
|
return candidate;
|
|
32133
32159
|
}
|
|
32134
32160
|
return path56.resolve(dir, "..");
|
|
@@ -32136,7 +32162,7 @@ var packageRoot2 = () => {
|
|
|
32136
32162
|
var skillsRoot = () => {
|
|
32137
32163
|
const root = packageRoot2();
|
|
32138
32164
|
const canonical = path56.resolve(root, "..", "workit-core", "skills");
|
|
32139
|
-
if (
|
|
32165
|
+
if (existsSync19(path56.join(root, "src")) && existsSync19(canonical))
|
|
32140
32166
|
return canonical;
|
|
32141
32167
|
return path56.join(root, "assets", "skills");
|
|
32142
32168
|
};
|
|
@@ -32162,7 +32188,7 @@ var parseFrontmatter = (markdown) => {
|
|
|
32162
32188
|
};
|
|
32163
32189
|
var registerSkills = async (ctx) => {
|
|
32164
32190
|
const skillsDir = skillsRoot();
|
|
32165
|
-
if (!
|
|
32191
|
+
if (!existsSync20(skillsDir))
|
|
32166
32192
|
return new Set;
|
|
32167
32193
|
const listed = await ctx.skill.list().catch(() => ({ data: [] }));
|
|
32168
32194
|
const own = (skill) => typeof skill.path === "string" && path57.resolve(skill.path).startsWith(skillsDir + path57.sep);
|
|
@@ -32170,7 +32196,7 @@ var registerSkills = async (ctx) => {
|
|
|
32170
32196
|
const packaged = new Map;
|
|
32171
32197
|
for (const id of WORKIT_METHOD_SKILLS) {
|
|
32172
32198
|
const file = path57.join(skillsDir, id, "SKILL.md");
|
|
32173
|
-
if (!userSkills.has(id) &&
|
|
32199
|
+
if (!userSkills.has(id) && existsSync20(file))
|
|
32174
32200
|
packaged.set(id, file);
|
|
32175
32201
|
}
|
|
32176
32202
|
await ctx.skill.transform((editor) => {
|
|
@@ -32216,11 +32242,11 @@ var registerCommands = async (ctx, registeredSkills) => {
|
|
|
32216
32242
|
};
|
|
32217
32243
|
|
|
32218
32244
|
// packages/workit-opencode/src/stale-sources.ts
|
|
32219
|
-
import { existsSync as
|
|
32245
|
+
import { existsSync as existsSync21, readdirSync as readdirSync8 } from "node:fs";
|
|
32220
32246
|
import path58 from "node:path";
|
|
32221
32247
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
32222
32248
|
var typescriptFiles = (directory) => {
|
|
32223
|
-
if (!
|
|
32249
|
+
if (!existsSync21(directory))
|
|
32224
32250
|
return [];
|
|
32225
32251
|
return readdirSync8(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
32226
32252
|
const file = path58.join(directory, entry.name);
|
|
@@ -32234,10 +32260,10 @@ var pluginSourceFiles = [
|
|
|
32234
32260
|
path58.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
|
|
32235
32261
|
...typescriptFiles(path58.join(packageRoot2(), "..", "workit-core", "src", "core"))
|
|
32236
32262
|
])
|
|
32237
|
-
].filter((file) =>
|
|
32263
|
+
].filter((file) => existsSync21(file)).toSorted();
|
|
32238
32264
|
|
|
32239
32265
|
// packages/workit-core/src/core/cli-locate.ts
|
|
32240
|
-
import { closeSync as
|
|
32266
|
+
import { closeSync as closeSync3, existsSync as existsSync22, openSync as openSync3, readSync } from "node:fs";
|
|
32241
32267
|
import path59 from "node:path";
|
|
32242
32268
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
32243
32269
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
@@ -32252,7 +32278,7 @@ var ownedCurrentEntry = (env, platform = process.platform) => path59.join(instal
|
|
|
32252
32278
|
var head = (file) => {
|
|
32253
32279
|
let fd;
|
|
32254
32280
|
try {
|
|
32255
|
-
fd =
|
|
32281
|
+
fd = openSync3(file, "r");
|
|
32256
32282
|
const buffer = Buffer.alloc(256);
|
|
32257
32283
|
const read = readSync(fd, buffer, 0, buffer.length, 0);
|
|
32258
32284
|
return buffer.subarray(0, read).toString("utf8");
|
|
@@ -32260,13 +32286,13 @@ var head = (file) => {
|
|
|
32260
32286
|
return "";
|
|
32261
32287
|
} finally {
|
|
32262
32288
|
if (fd !== undefined)
|
|
32263
|
-
|
|
32289
|
+
closeSync3(fd);
|
|
32264
32290
|
}
|
|
32265
32291
|
};
|
|
32266
32292
|
var locateWorkitCli = (options = {}) => {
|
|
32267
32293
|
const env = options.env ?? process.env;
|
|
32268
32294
|
const platform = options.platform ?? process.platform;
|
|
32269
|
-
const exists = options.exists ??
|
|
32295
|
+
const exists = options.exists ?? existsSync22;
|
|
32270
32296
|
const read = options.read ?? head;
|
|
32271
32297
|
const node = options.node ?? process.execPath;
|
|
32272
32298
|
const launcher = ownedLauncherPath(env, platform);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
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.
|
|
44
|
+
"@workit-dev/core": "^2.13.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|