@workit-dev/opencode 2.10.0 → 2.11.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.
|
@@ -22,7 +22,8 @@ way a user would.
|
|
|
22
22
|
already has a project skills directory, use it:
|
|
23
23
|
- **Launch:** one command, its ready signal (log line, port, exit 0), a timeout.
|
|
24
24
|
Builds, installs and e2e suites run under the heavy-check lease
|
|
25
|
-
(`workit check --heavy -- <cmd>`)
|
|
25
|
+
(`workit check --heavy -- <cmd>`). A dev server starts in the background
|
|
26
|
+
through `workit run --bg -- <cmd>`, which prints its id, port and log.
|
|
26
27
|
- **Doctor:** each precondition and its fix (deps, env vars, ports, services).
|
|
27
28
|
- **Drive:** how to exercise it: CLI invocations, `curl` against routes, a
|
|
28
29
|
browser tool for UI, with fixture data.
|
|
@@ -31,7 +32,7 @@ way a user would.
|
|
|
31
32
|
agent-browser, with a screenshot or console/network observation; an API
|
|
32
33
|
with a real call, response quoted. The report carries the observation.
|
|
33
34
|
App not runnable? Say so plainly, never claim success.
|
|
34
|
-
- **Cleanup:** stop
|
|
35
|
+
- **Cleanup:** `workit stop <id>` for each server it started, remove temp data.
|
|
35
36
|
- **Feature map:** feature, how to drive it, expected observation.
|
|
36
37
|
3. **Prove it end-to-end once:** launch, drive one feature, capture evidence,
|
|
37
38
|
clean up. Fix the skill until that run is clean. A generated skill that was
|
|
@@ -56,10 +57,11 @@ report `clean`, `changed` (what) or `blocked` (why).
|
|
|
56
57
|
|
|
57
58
|
Bad: "Verify by running the tests." (that is not the real surface)
|
|
58
59
|
|
|
59
|
-
Good: "Launch `bun run dev` (ready: `listening on :5173`,
|
|
60
|
-
`curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
61
|
-
/settings at .workit-scratch/settings.png. Evidence:
|
|
62
|
-
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0.
|
|
60
|
+
Good: "Launch `workit run --bg -- bun run dev` (ready: `listening on :5173`,
|
|
61
|
+
30 s). Drive: `curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
62
|
+
screenshot of /settings at .workit-scratch/settings.png. Evidence:
|
|
63
|
+
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0. Cleanup:
|
|
64
|
+
`workit stop p1abc2def3`."
|
|
63
65
|
|
|
64
66
|
## Check
|
|
65
67
|
|
|
@@ -14,6 +14,7 @@ description: Launch, drive and observe <app> on its real surface (<cli|web|api>)
|
|
|
14
14
|
|
|
15
15
|
## Launch
|
|
16
16
|
`<command>` - ready when `<log line | port open | exit 0>`, timeout <n> s.
|
|
17
|
+
A server: `workit run --bg -- <command>` (prints its id, port and log).
|
|
17
18
|
|
|
18
19
|
## Doctor
|
|
19
20
|
| Precondition | Check | Fix |
|
|
@@ -34,7 +35,7 @@ UI: also report a console or network observation. API: quote the real response.
|
|
|
34
35
|
If the app cannot be run, say so plainly instead of claiming success.
|
|
35
36
|
|
|
36
37
|
## Cleanup
|
|
37
|
-
|
|
38
|
+
`workit stop <id>` for each server Launch started; remove `<tmp dir>`.
|
|
38
39
|
|
|
39
40
|
## Feature map
|
|
40
41
|
| Feature | Drive | Expect |
|
package/dist/plugin.js
CHANGED
|
@@ -20278,7 +20278,7 @@ function workitCheckTail(words) {
|
|
|
20278
20278
|
} else if (!/^workit(?:\.exe|\.cmd)?$/.test(commandName(words[0])))
|
|
20279
20279
|
return null;
|
|
20280
20280
|
const { rest: args, cwd } = skipWorkitGlobals(words.slice(at + 1));
|
|
20281
|
-
if (args[0] !== "check" && !(args[0] === "lock" && args[1] === "run"))
|
|
20281
|
+
if (args[0] !== "check" && args[0] !== "run" && !(args[0] === "lock" && args[1] === "run"))
|
|
20282
20282
|
return null;
|
|
20283
20283
|
const split = args.indexOf("--");
|
|
20284
20284
|
const tail = split < 0 ? [] : args.slice(split + 1);
|
|
@@ -24990,7 +24990,9 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
24990
24990
|
"verify-delivery",
|
|
24991
24991
|
"policy",
|
|
24992
24992
|
"doctor",
|
|
24993
|
-
"help"
|
|
24993
|
+
"help",
|
|
24994
|
+
"ps",
|
|
24995
|
+
"stop"
|
|
24994
24996
|
];
|
|
24995
24997
|
var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
|
|
24996
24998
|
var WORKIT_USER_ONLY = [
|
|
@@ -25676,6 +25678,95 @@ function builtIn(words, depth = 0) {
|
|
|
25676
25678
|
const command = words.slice(1).find((word) => !word.startsWith("-") && !word.startsWith("+") || rule.has(word));
|
|
25677
25679
|
return command !== undefined && rule.has(command) ? label() : null;
|
|
25678
25680
|
}
|
|
25681
|
+
var SERVER_SCRIPT = /(?:^|[:_.-])(?:dev|serve|start|storybook)(?:$|[:_.-])/iu;
|
|
25682
|
+
var serverScript = (script = "") => SERVER_SCRIPT.test(script) && !HEAVY_SCRIPT.test(script);
|
|
25683
|
+
var NUXT = sub("dev", "preview", "start");
|
|
25684
|
+
var WEBPACK = sub("serve", "s", "server");
|
|
25685
|
+
var SERVER_TOOLS = {
|
|
25686
|
+
ng: sub("serve", "s"),
|
|
25687
|
+
next: sub("dev", "start"),
|
|
25688
|
+
nuxt: NUXT,
|
|
25689
|
+
nuxi: NUXT,
|
|
25690
|
+
astro: sub("dev", "preview"),
|
|
25691
|
+
"react-scripts": sub("start"),
|
|
25692
|
+
webpack: WEBPACK,
|
|
25693
|
+
"webpack-cli": WEBPACK,
|
|
25694
|
+
storybook: sub("dev", "start"),
|
|
25695
|
+
rails: sub("server", "s"),
|
|
25696
|
+
mix: sub("phx.server")
|
|
25697
|
+
};
|
|
25698
|
+
var COMPOSE_VALUES = new Set([
|
|
25699
|
+
"-f",
|
|
25700
|
+
"--file",
|
|
25701
|
+
"-p",
|
|
25702
|
+
"-H",
|
|
25703
|
+
"--host",
|
|
25704
|
+
"--context",
|
|
25705
|
+
"-c",
|
|
25706
|
+
"--config"
|
|
25707
|
+
]);
|
|
25708
|
+
function serverBuiltIn(words, depth = 0) {
|
|
25709
|
+
const name = baseName2(words[0]);
|
|
25710
|
+
if (depth > 6 || WORKIT.test(name) || words.some((word) => /^(?:-h|--help|--version)$/u.test(word)))
|
|
25711
|
+
return null;
|
|
25712
|
+
const compose = /^(?:docker|podman|nerdctl|docker-compose)$/u.test(name);
|
|
25713
|
+
const at = positional2(words, 1, compose ? COMPOSE_VALUES : PM_VALUES);
|
|
25714
|
+
const command = words[at];
|
|
25715
|
+
const yes = words.slice(0, 3).join(" ");
|
|
25716
|
+
const inner = (from) => serverBuiltIn(words.slice(from), depth + 1);
|
|
25717
|
+
const up = (from) => words[from] === "up" && !words.some((word) => /^(?:-d|--detach|--wait)$/u.test(word));
|
|
25718
|
+
if (name === "npx" || name === "bunx" || name === "pnpx")
|
|
25719
|
+
return inner(at);
|
|
25720
|
+
if (name === "corepack")
|
|
25721
|
+
return inner(1);
|
|
25722
|
+
if (command === undefined)
|
|
25723
|
+
return name === "vite" ? yes : null;
|
|
25724
|
+
if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" || name === "deno") {
|
|
25725
|
+
if (EXEC.has(command))
|
|
25726
|
+
return inner(positional2(words, at + 1));
|
|
25727
|
+
if (command === "start")
|
|
25728
|
+
return yes;
|
|
25729
|
+
if (name === "yarn" && command === "workspace")
|
|
25730
|
+
return serverScript(words[at + 2]) ? yes : inner(at + 2);
|
|
25731
|
+
if (NPM_RUN.has(command) || name === "deno" && command === "task") {
|
|
25732
|
+
if (serverScript(words[positional2(words, at + 1)]))
|
|
25733
|
+
return yes;
|
|
25734
|
+
return name === "bun" && command !== "task" ? inner(positional2(words, at + 1)) : null;
|
|
25735
|
+
}
|
|
25736
|
+
if (name === "npm" || name === "deno")
|
|
25737
|
+
return null;
|
|
25738
|
+
return serverScript(command) ? yes : inner(at);
|
|
25739
|
+
}
|
|
25740
|
+
if (PYTHONS.test(name)) {
|
|
25741
|
+
const m = words.indexOf("-m");
|
|
25742
|
+
if (words[m + 1] === "http.server" || command.endsWith("manage.py")) {
|
|
25743
|
+
return m > 0 || words[at + 1] === "runserver" ? yes : null;
|
|
25744
|
+
}
|
|
25745
|
+
return m > 0 && words[m + 1] ? inner(m + 1) : null;
|
|
25746
|
+
}
|
|
25747
|
+
if (["uv", "poetry", "pdm", "pipenv", "hatch", "rye", "bundle"].includes(name))
|
|
25748
|
+
return command === "run" || command === "exec" ? inner(positional2(words, at + 1)) : null;
|
|
25749
|
+
if (name === "make" || name === "gmake")
|
|
25750
|
+
return words.slice(1).some((word) => !/^-|=/u.test(word) && serverScript(word)) ? yes : null;
|
|
25751
|
+
if (name === "nx")
|
|
25752
|
+
return serverScript(command === "run" ? words[at + 1]?.split(":")[1] : command) ? yes : null;
|
|
25753
|
+
if (name === "docker-compose")
|
|
25754
|
+
return up(at) ? yes : null;
|
|
25755
|
+
if (compose)
|
|
25756
|
+
return command === "compose" && up(positional2(words, at + 1, COMPOSE_VALUES)) ? yes : null;
|
|
25757
|
+
if (name === "vite")
|
|
25758
|
+
return command === "build" || command === "optimize" ? null : yes;
|
|
25759
|
+
const rule = SERVER_TOOLS[name];
|
|
25760
|
+
return rule && rule !== "any" && rule.has(command) ? yes : null;
|
|
25761
|
+
}
|
|
25762
|
+
function serverCommand(command, dialect = "posix") {
|
|
25763
|
+
for (const line of linesOf(command, dialect) ?? []) {
|
|
25764
|
+
const reason = serverBuiltIn(line);
|
|
25765
|
+
if (reason)
|
|
25766
|
+
return { line, reason };
|
|
25767
|
+
}
|
|
25768
|
+
return null;
|
|
25769
|
+
}
|
|
25679
25770
|
var globWord = (word) => new RegExp(`^${word.replace(/[.+?^${}()|[\]\\]/gu, "\\$&").replaceAll("*", ".*")}$`, "u");
|
|
25680
25771
|
function parsePattern(pattern) {
|
|
25681
25772
|
const words = pattern.trim().split(/\s+/u).filter(Boolean);
|
|
@@ -25772,6 +25863,28 @@ function heavyPlan(command, options) {
|
|
|
25772
25863
|
unblock: parts[0] ?? null
|
|
25773
25864
|
};
|
|
25774
25865
|
}
|
|
25866
|
+
function serverPlan(command, options) {
|
|
25867
|
+
const dialect = options.dialect ?? "posix";
|
|
25868
|
+
if (dialect !== "posix" || !gitTop(options.cwd))
|
|
25869
|
+
return { kind: "none" };
|
|
25870
|
+
const found = serverCommand(command, dialect);
|
|
25871
|
+
if (!found)
|
|
25872
|
+
return { kind: "none" };
|
|
25873
|
+
const simple = simpleCommand(command, dialect, 0, true);
|
|
25874
|
+
const single = simple && serverBuiltIn(simple);
|
|
25875
|
+
if (options.rules !== null && !wrapAllowed(options.rules, single ? (linesOf(command, dialect) ?? []).flat() : found.line, single ? command : found.line.join(" "), options).ok)
|
|
25876
|
+
return { kind: "passthrough", note: "" };
|
|
25877
|
+
if (single) {
|
|
25878
|
+
const rewrite = leaseRewrite(command)?.replace("workit check --heavy --", "workit run --bg --");
|
|
25879
|
+
return rewrite ? { kind: "rewrite", command: rewrite, reason: single, server: true } : { kind: "none" };
|
|
25880
|
+
}
|
|
25881
|
+
const start = `workit run --bg -- ${found.line.map(quoteWord).join(" ")}`;
|
|
25882
|
+
return {
|
|
25883
|
+
kind: "split",
|
|
25884
|
+
reason: `dev_server: \`${command.trim()}\` chains a dev server (${found.reason}) with other commands. Start it alone, now: \`${start}\`; then run the other parts as their own commands.`,
|
|
25885
|
+
unblock: start
|
|
25886
|
+
};
|
|
25887
|
+
}
|
|
25775
25888
|
function workitOnPath2(env = process.env) {
|
|
25776
25889
|
const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
|
|
25777
25890
|
for (const dir of (env.PATH ?? "").split(path38.delimiter))
|
|
@@ -25869,13 +25982,18 @@ function heavyGate(cwd, command, options) {
|
|
|
25869
25982
|
const single = dialect === "posix" ? simpleCommand(command, dialect, 0, true) : null;
|
|
25870
25983
|
if (single && lightCommand(single, cwd))
|
|
25871
25984
|
return { kind: "none" };
|
|
25872
|
-
|
|
25985
|
+
const plan = {
|
|
25873
25986
|
cwd,
|
|
25874
25987
|
env,
|
|
25875
25988
|
dialect,
|
|
25876
25989
|
rules: rulesFor(options.host, cwd, env),
|
|
25877
25990
|
bypass: options.permissionMode === "bypassPermissions"
|
|
25878
|
-
}
|
|
25991
|
+
};
|
|
25992
|
+
const server = serverPlan(command, plan);
|
|
25993
|
+
if (server.kind === "rewrite")
|
|
25994
|
+
return server;
|
|
25995
|
+
const heavy = heavyPlan(command, plan);
|
|
25996
|
+
return heavy.kind === "none" ? server : heavy;
|
|
25879
25997
|
} catch {
|
|
25880
25998
|
return { kind: "none" };
|
|
25881
25999
|
}
|
|
@@ -28980,6 +29098,44 @@ var SCAN_MS = 30 * 60000;
|
|
|
28980
29098
|
// packages/workit-core/src/hooks/agent-model.ts
|
|
28981
29099
|
var UNLISTED = new Set(["description", "prompt"]);
|
|
28982
29100
|
|
|
29101
|
+
// packages/workit-core/src/hooks/server-gate.ts
|
|
29102
|
+
import fs30 from "node:fs";
|
|
29103
|
+
import path44 from "node:path";
|
|
29104
|
+
var procNoticeFile = (env, session) => path44.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
|
|
29105
|
+
var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
|
|
29106
|
+
function takeProcNotice(session, env = process.env) {
|
|
29107
|
+
if (!session)
|
|
29108
|
+
return null;
|
|
29109
|
+
const file = procNoticeFile(env, session);
|
|
29110
|
+
const taken = `${file}.${process.pid}.taken`;
|
|
29111
|
+
try {
|
|
29112
|
+
fs30.renameSync(file, taken);
|
|
29113
|
+
} catch {
|
|
29114
|
+
return null;
|
|
29115
|
+
}
|
|
29116
|
+
try {
|
|
29117
|
+
const { notices } = JSON.parse(fs30.readFileSync(taken, "utf8"));
|
|
29118
|
+
const lines = (Array.isArray(notices) ? notices : []).flatMap((notice) => {
|
|
29119
|
+
if (!notice || typeof notice !== "object")
|
|
29120
|
+
return [];
|
|
29121
|
+
const { id, cmd, cwd, rssBytes, ceilingBytes } = notice;
|
|
29122
|
+
if (typeof id !== "string")
|
|
29123
|
+
return [];
|
|
29124
|
+
return [
|
|
29125
|
+
`- ${id} \`${String(cmd)}\` in ${String(cwd)}: ${mb(rssBytes)} (ceiling ${mb(ceilingBytes)}). Restart it: \`workit run --bg --restart ${id}\`, or \`workit stop ${id}\`.`
|
|
29126
|
+
];
|
|
29127
|
+
});
|
|
29128
|
+
return lines.length ? ["Workit: a background process you started is past the memory ceiling:", ...lines].join(`
|
|
29129
|
+
`) : null;
|
|
29130
|
+
} catch {
|
|
29131
|
+
return null;
|
|
29132
|
+
} finally {
|
|
29133
|
+
try {
|
|
29134
|
+
fs30.rmSync(taken, { force: true });
|
|
29135
|
+
} catch {}
|
|
29136
|
+
}
|
|
29137
|
+
}
|
|
29138
|
+
|
|
28983
29139
|
// packages/workit-core/src/hooks/ytrack-word.ts
|
|
28984
29140
|
var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
|
|
28985
29141
|
var namesYtrack = (text) => {
|
|
@@ -29484,11 +29640,11 @@ var PROCESS_START = performance.timeOrigin;
|
|
|
29484
29640
|
// packages/workit-core/src/hooks/run.ts
|
|
29485
29641
|
if (false) {}
|
|
29486
29642
|
// packages/workit-opencode/src/shared/init-apply.ts
|
|
29487
|
-
import
|
|
29643
|
+
import path49 from "node:path";
|
|
29488
29644
|
|
|
29489
29645
|
// packages/workit-core/src/core/gitignore.ts
|
|
29490
29646
|
import { existsSync as existsSync15, readFileSync as readFileSync13, writeFileSync as writeFileSync5 } from "node:fs";
|
|
29491
|
-
import
|
|
29647
|
+
import path45 from "node:path";
|
|
29492
29648
|
var GITIGNORE_ENTRIES = [
|
|
29493
29649
|
"# workit: SDD working state (never commit)",
|
|
29494
29650
|
"docs/*/sdd/",
|
|
@@ -29508,7 +29664,7 @@ var GITIGNORE_ENTRIES = [
|
|
|
29508
29664
|
var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
29509
29665
|
if (!confirmed)
|
|
29510
29666
|
return { ok: false, error: "confirmed: true required" };
|
|
29511
|
-
const file =
|
|
29667
|
+
const file = path45.join(workspaceRoot, ".gitignore");
|
|
29512
29668
|
const existing = existsSync15(file) ? readFileSync13(file, "utf8") : "";
|
|
29513
29669
|
const existingLines = new Set(existing.split(`
|
|
29514
29670
|
`).map((l) => l.trim()).filter(Boolean));
|
|
@@ -29536,25 +29692,25 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
|
|
|
29536
29692
|
|
|
29537
29693
|
// packages/workit-core/src/core/hygiene.ts
|
|
29538
29694
|
import { existsSync as existsSync16, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
29539
|
-
import
|
|
29695
|
+
import path46 from "node:path";
|
|
29540
29696
|
var repoRoot3 = assetRoot();
|
|
29541
|
-
var templatesDir = () =>
|
|
29697
|
+
var templatesDir = () => path46.join(repoRoot3, "templates", "hygiene");
|
|
29542
29698
|
var packageJson = (root) => {
|
|
29543
|
-
if (!existsSync16(
|
|
29699
|
+
if (!existsSync16(path46.join(root, "package.json")))
|
|
29544
29700
|
return null;
|
|
29545
29701
|
try {
|
|
29546
|
-
return JSON.parse(readFileSync14(
|
|
29702
|
+
return JSON.parse(readFileSync14(path46.join(root, "package.json"), "utf8"));
|
|
29547
29703
|
} catch {
|
|
29548
29704
|
return null;
|
|
29549
29705
|
}
|
|
29550
29706
|
};
|
|
29551
29707
|
var isOpenSource = (root) => {
|
|
29552
|
-
if (existsSync16(
|
|
29708
|
+
if (existsSync16(path46.join(root, "LICENSE")))
|
|
29553
29709
|
return true;
|
|
29554
29710
|
const pkg = packageJson(root);
|
|
29555
29711
|
if (pkg && !pkg.private)
|
|
29556
29712
|
return true;
|
|
29557
|
-
return
|
|
29713
|
+
return path46.basename(root) === "workit";
|
|
29558
29714
|
};
|
|
29559
29715
|
var licenseHolder = (root) => {
|
|
29560
29716
|
const pkg = packageJson(root);
|
|
@@ -29577,13 +29733,13 @@ var planHygieneFiles = (root, opts = {}) => {
|
|
|
29577
29733
|
files.push("LICENSE", "CONTRIBUTING.md");
|
|
29578
29734
|
const planned = [];
|
|
29579
29735
|
for (const file of files) {
|
|
29580
|
-
if (existsSync16(
|
|
29736
|
+
if (existsSync16(path46.join(root, file)))
|
|
29581
29737
|
continue;
|
|
29582
|
-
const tpl =
|
|
29738
|
+
const tpl = path46.join(templatesDir(), file);
|
|
29583
29739
|
if (!existsSync16(tpl))
|
|
29584
29740
|
continue;
|
|
29585
|
-
const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g,
|
|
29586
|
-
planned.push({ path:
|
|
29741
|
+
const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path46.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
|
|
29742
|
+
planned.push({ path: path46.join(root, file), content });
|
|
29587
29743
|
}
|
|
29588
29744
|
return planned;
|
|
29589
29745
|
};
|
|
@@ -29593,19 +29749,19 @@ var ensureHygieneFiles = (root, opts) => {
|
|
|
29593
29749
|
const created = [];
|
|
29594
29750
|
for (const planned of planHygieneFiles(root, opts)) {
|
|
29595
29751
|
writeFileSync6(planned.path, planned.content, "utf8");
|
|
29596
|
-
created.push(
|
|
29752
|
+
created.push(path46.basename(planned.path));
|
|
29597
29753
|
}
|
|
29598
29754
|
return { ok: true, created };
|
|
29599
29755
|
};
|
|
29600
29756
|
|
|
29601
29757
|
// packages/workit-core/src/core/init.ts
|
|
29602
|
-
import
|
|
29603
|
-
import
|
|
29758
|
+
import fs31 from "node:fs";
|
|
29759
|
+
import path48 from "node:path";
|
|
29604
29760
|
import { spawnSync as spawnSync25 } from "node:child_process";
|
|
29605
29761
|
|
|
29606
29762
|
// packages/workit-core/src/core/workspace-branch-policy.ts
|
|
29607
29763
|
import { mkdirSync as mkdirSync5, readFileSync as readFileSync15, renameSync as renameSync4, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
|
|
29608
|
-
import
|
|
29764
|
+
import path47 from "node:path";
|
|
29609
29765
|
import { isDeepStrictEqual } from "node:util";
|
|
29610
29766
|
var readFileSafe = (p) => {
|
|
29611
29767
|
try {
|
|
@@ -29616,7 +29772,7 @@ var readFileSafe = (p) => {
|
|
|
29616
29772
|
};
|
|
29617
29773
|
function applyWorkspaceBranchPolicy(opts) {
|
|
29618
29774
|
const { workspace_root, env = process.env } = opts;
|
|
29619
|
-
const dir =
|
|
29775
|
+
const dir = path47.join(env.WORKIT_CONFIG ?? configDir2());
|
|
29620
29776
|
const {
|
|
29621
29777
|
status,
|
|
29622
29778
|
path: wsPath,
|
|
@@ -29628,7 +29784,7 @@ function applyWorkspaceBranchPolicy(opts) {
|
|
|
29628
29784
|
if (status === "malformed" || status === "invalid")
|
|
29629
29785
|
return { ok: false, error: workspacesError ?? `invalid workspaces.json: ${wsPath}` };
|
|
29630
29786
|
const detection = detectBranchPolicy(workspace_root);
|
|
29631
|
-
const name = String(env.WORKIT_BP_NAME ??
|
|
29787
|
+
const name = String(env.WORKIT_BP_NAME ?? path47.basename(workspace_root));
|
|
29632
29788
|
const integration = env.WORKIT_BP_INTEGRATION ?? detection.integration;
|
|
29633
29789
|
const policy = {
|
|
29634
29790
|
preset: detection.preset,
|
|
@@ -29677,7 +29833,7 @@ function applyWorkspaceBranchPolicy(opts) {
|
|
|
29677
29833
|
ok: false,
|
|
29678
29834
|
error: `workspaces.json changed while applying the branch policy: ${wsPath}`
|
|
29679
29835
|
};
|
|
29680
|
-
mkdirSync5(
|
|
29836
|
+
mkdirSync5(path47.dirname(wsPath), { recursive: true });
|
|
29681
29837
|
const tmp = `${wsPath}.${process.pid}.tmp`;
|
|
29682
29838
|
try {
|
|
29683
29839
|
writeFileSync7(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
|
|
@@ -29711,7 +29867,7 @@ function applyWorkspaceBranchPolicy(opts) {
|
|
|
29711
29867
|
// packages/workit-core/src/core/init.ts
|
|
29712
29868
|
var readJson3 = (p) => {
|
|
29713
29869
|
try {
|
|
29714
|
-
const parsed = JSON.parse(
|
|
29870
|
+
const parsed = JSON.parse(fs31.readFileSync(p, "utf8"));
|
|
29715
29871
|
return isConfigObject(parsed) ? parsed : null;
|
|
29716
29872
|
} catch {
|
|
29717
29873
|
return null;
|
|
@@ -29774,11 +29930,11 @@ var vcsJsonContent = () => {
|
|
|
29774
29930
|
};
|
|
29775
29931
|
function initApplyData(action, env = process.env) {
|
|
29776
29932
|
const dir = String(env.WORKIT_CONFIG ?? configDir2());
|
|
29777
|
-
|
|
29933
|
+
fs31.mkdirSync(dir, { recursive: true });
|
|
29778
29934
|
switch (action) {
|
|
29779
29935
|
case "youtrack_json": {
|
|
29780
|
-
const out =
|
|
29781
|
-
|
|
29936
|
+
const out = path48.join(dir, "youtrack.json");
|
|
29937
|
+
fs31.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
|
|
29782
29938
|
`, "utf8");
|
|
29783
29939
|
return { action, ok: true, path: out };
|
|
29784
29940
|
}
|
|
@@ -29791,10 +29947,10 @@ function initApplyData(action, env = process.env) {
|
|
|
29791
29947
|
};
|
|
29792
29948
|
}
|
|
29793
29949
|
case "youtrack_scaffold": {
|
|
29794
|
-
const jsonOut =
|
|
29795
|
-
|
|
29950
|
+
const jsonOut = path48.join(dir, "youtrack.json");
|
|
29951
|
+
fs31.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
|
|
29796
29952
|
`, "utf8");
|
|
29797
|
-
const configPath =
|
|
29953
|
+
const configPath = path48.resolve(jsonOut);
|
|
29798
29954
|
const cfg = readJson3(configPath) ?? {};
|
|
29799
29955
|
const base = String(cfg.baseUrl ?? "").replace(/\/+$/, "");
|
|
29800
29956
|
const meeting = String(cfg.meetingIssue ?? "");
|
|
@@ -29830,10 +29986,10 @@ function initApplyData(action, env = process.env) {
|
|
|
29830
29986
|
};
|
|
29831
29987
|
}
|
|
29832
29988
|
case "vcs_scaffold": {
|
|
29833
|
-
const jsonOut =
|
|
29834
|
-
|
|
29989
|
+
const jsonOut = path48.join(dir, "vcs.json");
|
|
29990
|
+
fs31.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
|
|
29835
29991
|
`, "utf8");
|
|
29836
|
-
const configPath =
|
|
29992
|
+
const configPath = path48.resolve(jsonOut);
|
|
29837
29993
|
const prev = process.env.WORKIT_VCS_CONFIG;
|
|
29838
29994
|
process.env.WORKIT_VCS_CONFIG = configPath;
|
|
29839
29995
|
try {
|
|
@@ -29952,7 +30108,7 @@ var executeInitApply = (args, directory, runtime) => {
|
|
|
29952
30108
|
protectedNames: args.branch_policy_protected
|
|
29953
30109
|
}, current);
|
|
29954
30110
|
writeConfig(next);
|
|
29955
|
-
return output(ok({ action: "config", path:
|
|
30111
|
+
return output(ok({ action: "config", path: path49.join(configDir2(), "config.json"), ...next }));
|
|
29956
30112
|
}
|
|
29957
30113
|
const env = Object.fromEntries(Object.entries({
|
|
29958
30114
|
WORKIT_YT_BASE_URL: args.base_url,
|
|
@@ -29969,14 +30125,14 @@ var executeInitApply = (args, directory, runtime) => {
|
|
|
29969
30125
|
|
|
29970
30126
|
// packages/workit-opencode/src/shared/session.ts
|
|
29971
30127
|
import { realpathSync as realpathSync11 } from "node:fs";
|
|
29972
|
-
import
|
|
30128
|
+
import path50 from "node:path";
|
|
29973
30129
|
var sameWorkspace = (expected, observed) => {
|
|
29974
30130
|
if (typeof observed !== "string" || !observed)
|
|
29975
30131
|
return false;
|
|
29976
30132
|
try {
|
|
29977
30133
|
return realpathSync11(expected) === realpathSync11(observed);
|
|
29978
30134
|
} catch {
|
|
29979
|
-
return
|
|
30135
|
+
return path50.resolve(expected) === path50.resolve(observed);
|
|
29980
30136
|
}
|
|
29981
30137
|
};
|
|
29982
30138
|
|
|
@@ -30048,7 +30204,7 @@ var workitFamilyOf = (toolName) => {
|
|
|
30048
30204
|
|
|
30049
30205
|
// packages/workit-opencode/src/tools/context.ts
|
|
30050
30206
|
import { realpathSync as realpathSync12 } from "node:fs";
|
|
30051
|
-
import
|
|
30207
|
+
import path51 from "node:path";
|
|
30052
30208
|
var createContextTool = () => ({
|
|
30053
30209
|
description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
|
|
30054
30210
|
execute: async (args, context) => {
|
|
@@ -30058,7 +30214,7 @@ var createContextTool = () => ({
|
|
|
30058
30214
|
let root;
|
|
30059
30215
|
try {
|
|
30060
30216
|
const cwd = parsed.data.cwd;
|
|
30061
|
-
root = realpathSync12(cwd ?
|
|
30217
|
+
root = realpathSync12(cwd ? path51.resolve(context.directory, cwd) : context.directory);
|
|
30062
30218
|
} catch {
|
|
30063
30219
|
return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
|
|
30064
30220
|
}
|
|
@@ -30090,8 +30246,8 @@ var workerCoordinatorFor = (task, worker) => {
|
|
|
30090
30246
|
// packages/workit-core/src/fanout.ts
|
|
30091
30247
|
import { spawnSync as spawnSync29 } from "node:child_process";
|
|
30092
30248
|
import { createHash as createHash20 } from "node:crypto";
|
|
30093
|
-
import
|
|
30094
|
-
import
|
|
30249
|
+
import fs33 from "node:fs";
|
|
30250
|
+
import path54 from "node:path";
|
|
30095
30251
|
|
|
30096
30252
|
// packages/workit-core/src/fanout-landed.ts
|
|
30097
30253
|
import { spawnSync as spawnSync26 } from "node:child_process";
|
|
@@ -30324,13 +30480,13 @@ var NOTICE_TTL_MS = 7 * 86400000;
|
|
|
30324
30480
|
// packages/workit-core/src/stack.ts
|
|
30325
30481
|
import { spawnSync as spawnSync28 } from "node:child_process";
|
|
30326
30482
|
import { createHash as createHash19, randomBytes as randomBytes4 } from "node:crypto";
|
|
30327
|
-
import
|
|
30328
|
-
import
|
|
30483
|
+
import fs32 from "node:fs";
|
|
30484
|
+
import path53 from "node:path";
|
|
30329
30485
|
|
|
30330
30486
|
// packages/workit-core/src/git/ops.ts
|
|
30331
30487
|
import { spawnSync as spawnSync27 } from "node:child_process";
|
|
30332
30488
|
import { copyFileSync as copyFileSync2, existsSync as existsSync17, readdirSync as readdirSync7, readFileSync as readFileSync16, rmSync as rmSync4 } from "node:fs";
|
|
30333
|
-
import
|
|
30489
|
+
import path52 from "node:path";
|
|
30334
30490
|
var COMMIT_TIMEOUT_MS = 10 * 60000;
|
|
30335
30491
|
var git5 = (cwd, args, options = {}) => {
|
|
30336
30492
|
const result = spawnSync27("git", args, {
|
|
@@ -30363,18 +30519,18 @@ function operationInProgress(cwd) {
|
|
|
30363
30519
|
if (!run.ok)
|
|
30364
30520
|
return null;
|
|
30365
30521
|
const found = run.stdout.split(`
|
|
30366
|
-
`).map((line) =>
|
|
30522
|
+
`).map((line) => path52.resolve(cwd, line.trim()));
|
|
30367
30523
|
const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
|
|
30368
30524
|
for (const [index, [, operation]] of markers.entries()) {
|
|
30369
30525
|
const marker = found[index];
|
|
30370
30526
|
if (!marker || !existsSync17(marker))
|
|
30371
30527
|
continue;
|
|
30372
|
-
if (index === 1 && existsSync17(
|
|
30528
|
+
if (index === 1 && existsSync17(path52.join(marker, "applying")))
|
|
30373
30529
|
return { operation: "am", commitAllowed: false, branch: null };
|
|
30374
|
-
if (index === 0 && existsSync17(
|
|
30530
|
+
if (index === 0 && existsSync17(path52.join(marker, "amend")) && !conflicted()) {
|
|
30375
30531
|
let headName = "";
|
|
30376
30532
|
try {
|
|
30377
|
-
headName = readFileSync16(
|
|
30533
|
+
headName = readFileSync16(path52.join(marker, "head-name"), "utf8").trim();
|
|
30378
30534
|
} catch {}
|
|
30379
30535
|
const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
|
|
30380
30536
|
return { operation, commitAllowed: branch !== null, branch };
|
|
@@ -30487,7 +30643,7 @@ function rebasingBranch2(dir) {
|
|
|
30487
30643
|
if (!found.ok)
|
|
30488
30644
|
continue;
|
|
30489
30645
|
try {
|
|
30490
|
-
return
|
|
30646
|
+
return fs32.readFileSync(found.stdout.trim(), "utf8").trim();
|
|
30491
30647
|
} catch {}
|
|
30492
30648
|
}
|
|
30493
30649
|
return null;
|
|
@@ -30495,14 +30651,14 @@ function rebasingBranch2(dir) {
|
|
|
30495
30651
|
function rebaseInProgress(dir) {
|
|
30496
30652
|
for (const name of ["rebase-merge", "rebase-apply"]) {
|
|
30497
30653
|
const found = gitRun4(dir, ["rev-parse", "--path-format=absolute", "--git-path", name]);
|
|
30498
|
-
if (found.ok &&
|
|
30654
|
+
if (found.ok && fs32.existsSync(found.stdout.trim()))
|
|
30499
30655
|
return true;
|
|
30500
30656
|
}
|
|
30501
30657
|
return false;
|
|
30502
30658
|
}
|
|
30503
30659
|
var scratchDir = (cwd) => {
|
|
30504
30660
|
const dir = stacksDir(cwd);
|
|
30505
|
-
return dir.ok ?
|
|
30661
|
+
return dir.ok ? path53.join(dir.data, "worktrees") : null;
|
|
30506
30662
|
};
|
|
30507
30663
|
function gitRestack(cwd, input) {
|
|
30508
30664
|
const owner = worktreeOf(cwd, input.branch);
|
|
@@ -30516,8 +30672,8 @@ function gitRestack(cwd, input) {
|
|
|
30516
30672
|
worktree: cwd,
|
|
30517
30673
|
error: "no store root"
|
|
30518
30674
|
};
|
|
30519
|
-
|
|
30520
|
-
dir =
|
|
30675
|
+
fs32.mkdirSync(scratch, { recursive: true });
|
|
30676
|
+
dir = path53.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
|
|
30521
30677
|
const added = gitRun4(cwd, ["worktree", "add", "-q", dir, input.branch], GIT_TIMEOUTS.worktree);
|
|
30522
30678
|
if (!added.ok)
|
|
30523
30679
|
return {
|
|
@@ -30576,7 +30732,7 @@ function stacksDir(cwd) {
|
|
|
30576
30732
|
const root = storeRoot(cwd);
|
|
30577
30733
|
if (!root.ok)
|
|
30578
30734
|
return stackFail(root.code, root.error, root.unblock);
|
|
30579
|
-
return { ok: true, data:
|
|
30735
|
+
return { ok: true, data: path53.join(root.value.root, "stacks") };
|
|
30580
30736
|
}
|
|
30581
30737
|
var HEARTBEAT_STALE_MS = 2 * 60000;
|
|
30582
30738
|
var SETTLED_BY_RESTACK = new Set(["checks_pending", "behind_base_required"]);
|
|
@@ -30723,7 +30879,7 @@ function fanoutsDir(cwd) {
|
|
|
30723
30879
|
const root = storeRoot(cwd);
|
|
30724
30880
|
if (!root.ok)
|
|
30725
30881
|
return fanoutFail(root.code, root.error, root.unblock);
|
|
30726
|
-
return { ok: true, data:
|
|
30882
|
+
return { ok: true, data: path54.join(root.value.root, "fanouts") };
|
|
30727
30883
|
}
|
|
30728
30884
|
function parseStored(raw) {
|
|
30729
30885
|
if (!isRecord8(raw) || typeof raw.name !== "string" || typeof raw.trunk !== "string")
|
|
@@ -30791,10 +30947,10 @@ function readFanout(cwd, name) {
|
|
|
30791
30947
|
const dir = fanoutsDir(cwd);
|
|
30792
30948
|
if (!dir.ok)
|
|
30793
30949
|
return dir;
|
|
30794
|
-
const file =
|
|
30950
|
+
const file = path54.join(dir.data, stackFileName(name));
|
|
30795
30951
|
let parsed = null;
|
|
30796
30952
|
try {
|
|
30797
|
-
parsed = parseStored(JSON.parse(
|
|
30953
|
+
parsed = parseStored(JSON.parse(fs33.readFileSync(file, "utf8")));
|
|
30798
30954
|
} catch (error) {
|
|
30799
30955
|
if (error.code === "ENOENT")
|
|
30800
30956
|
return { ok: true, data: null };
|
|
@@ -30808,7 +30964,7 @@ function listFanouts(cwd) {
|
|
|
30808
30964
|
return dir;
|
|
30809
30965
|
let names = [];
|
|
30810
30966
|
try {
|
|
30811
|
-
names =
|
|
30967
|
+
names = fs33.readdirSync(dir.data).filter((entry) => entry.endsWith(".json"));
|
|
30812
30968
|
} catch {
|
|
30813
30969
|
return { ok: true, data: [] };
|
|
30814
30970
|
}
|
|
@@ -30816,7 +30972,7 @@ function listFanouts(cwd) {
|
|
|
30816
30972
|
for (const entry of names) {
|
|
30817
30973
|
let parsed = null;
|
|
30818
30974
|
try {
|
|
30819
|
-
parsed = parseStored(JSON.parse(
|
|
30975
|
+
parsed = parseStored(JSON.parse(fs33.readFileSync(path54.join(dir.data, entry), "utf8")));
|
|
30820
30976
|
} catch {
|
|
30821
30977
|
parsed = null;
|
|
30822
30978
|
}
|
|
@@ -31675,7 +31831,7 @@ var childTaskMissing = (store, input) => {
|
|
|
31675
31831
|
var childDenial = (identity) => `OpenCode child session has no validated Workit worker: as ${identity} it may only inspect the task summary (workit_task action "inspect") or record evidence or findings (workit_evidence/workit_finding action "record") on an existing task; for anything else the lead assigns it a worker with workit_worker before launching it`;
|
|
31676
31832
|
|
|
31677
31833
|
// packages/workit-opencode/src/v2/shell.ts
|
|
31678
|
-
import
|
|
31834
|
+
import path55 from "node:path";
|
|
31679
31835
|
|
|
31680
31836
|
// packages/workit-core/src/hooks/repeat-failure.ts
|
|
31681
31837
|
import { createHash as createHash21 } from "node:crypto";
|
|
@@ -31738,7 +31894,7 @@ var commandOf = (input) => {
|
|
|
31738
31894
|
};
|
|
31739
31895
|
var hookInput = (root, sessionID, id, shell) => ({
|
|
31740
31896
|
host: "opencode",
|
|
31741
|
-
cwd: shell.workdir ?
|
|
31897
|
+
cwd: shell.workdir ? path55.resolve(root, shell.workdir) : root,
|
|
31742
31898
|
session: { id: sessionID, agentId: null, agentType: null, parentId: null },
|
|
31743
31899
|
permissionMode: null,
|
|
31744
31900
|
transcriptPath: null,
|
|
@@ -31801,7 +31957,11 @@ var observeShellResult = (root, event, failures = new Map) => {
|
|
|
31801
31957
|
if (!result)
|
|
31802
31958
|
return;
|
|
31803
31959
|
const repeated = repeatedCliFailure(failures, String(event.sessionID), shell.command, outputText(result.content));
|
|
31804
|
-
const extra = [
|
|
31960
|
+
const extra = [
|
|
31961
|
+
nudge.kind === "context" ? nudge.text : null,
|
|
31962
|
+
repeated,
|
|
31963
|
+
takeProcNotice(String(event.sessionID))
|
|
31964
|
+
].filter((text) => text !== null);
|
|
31805
31965
|
if (extra.length > 0)
|
|
31806
31966
|
event.result = appendText(result, extra.join(`
|
|
31807
31967
|
|
|
@@ -32015,37 +32175,37 @@ var createStopControl = (root, port) => {
|
|
|
32015
32175
|
|
|
32016
32176
|
// packages/workit-opencode/src/v2/registry.ts
|
|
32017
32177
|
import { existsSync as existsSync19, readFileSync as readFileSync17 } from "node:fs";
|
|
32018
|
-
import
|
|
32178
|
+
import path57 from "node:path";
|
|
32019
32179
|
|
|
32020
32180
|
// packages/workit-opencode/src/shared/assets.ts
|
|
32021
32181
|
import { existsSync as existsSync18, realpathSync as realpathSync13 } from "node:fs";
|
|
32022
|
-
import
|
|
32182
|
+
import path56 from "node:path";
|
|
32023
32183
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
32024
32184
|
var moduleDir = () => {
|
|
32025
32185
|
try {
|
|
32026
|
-
return realpathSync13(
|
|
32186
|
+
return realpathSync13(path56.dirname(fileURLToPath2(import.meta.url)));
|
|
32027
32187
|
} catch {
|
|
32028
|
-
return
|
|
32188
|
+
return path56.dirname(fileURLToPath2(import.meta.url));
|
|
32029
32189
|
}
|
|
32030
32190
|
};
|
|
32031
32191
|
var packageRoot2 = () => {
|
|
32032
32192
|
const dir = moduleDir();
|
|
32033
32193
|
for (const candidate of [
|
|
32034
|
-
|
|
32035
|
-
|
|
32036
|
-
|
|
32194
|
+
path56.resolve(dir, ".."),
|
|
32195
|
+
path56.resolve(dir, "..", ".."),
|
|
32196
|
+
path56.resolve(dir, "..", "..", "..")
|
|
32037
32197
|
]) {
|
|
32038
|
-
if (existsSync18(
|
|
32198
|
+
if (existsSync18(path56.join(candidate, "package.json")))
|
|
32039
32199
|
return candidate;
|
|
32040
32200
|
}
|
|
32041
|
-
return
|
|
32201
|
+
return path56.resolve(dir, "..");
|
|
32042
32202
|
};
|
|
32043
32203
|
var skillsRoot = () => {
|
|
32044
32204
|
const root = packageRoot2();
|
|
32045
|
-
const canonical =
|
|
32046
|
-
if (existsSync18(
|
|
32205
|
+
const canonical = path56.resolve(root, "..", "workit-core", "skills");
|
|
32206
|
+
if (existsSync18(path56.join(root, "src")) && existsSync18(canonical))
|
|
32047
32207
|
return canonical;
|
|
32048
|
-
return
|
|
32208
|
+
return path56.join(root, "assets", "skills");
|
|
32049
32209
|
};
|
|
32050
32210
|
|
|
32051
32211
|
// packages/workit-opencode/src/v2/registry.ts
|
|
@@ -32072,11 +32232,11 @@ var registerSkills = async (ctx) => {
|
|
|
32072
32232
|
if (!existsSync19(skillsDir))
|
|
32073
32233
|
return new Set;
|
|
32074
32234
|
const listed = await ctx.skill.list().catch(() => ({ data: [] }));
|
|
32075
|
-
const own = (skill) => typeof skill.path === "string" &&
|
|
32235
|
+
const own = (skill) => typeof skill.path === "string" && path57.resolve(skill.path).startsWith(skillsDir + path57.sep);
|
|
32076
32236
|
const userSkills = new Set((listed?.data ?? []).filter((skill) => !own(skill)).map((skill) => skill.id));
|
|
32077
32237
|
const packaged = new Map;
|
|
32078
32238
|
for (const id of WORKIT_METHOD_SKILLS) {
|
|
32079
|
-
const file =
|
|
32239
|
+
const file = path57.join(skillsDir, id, "SKILL.md");
|
|
32080
32240
|
if (!userSkills.has(id) && existsSync19(file))
|
|
32081
32241
|
packaged.set(id, file);
|
|
32082
32242
|
}
|
|
@@ -32124,38 +32284,38 @@ var registerCommands = async (ctx, registeredSkills) => {
|
|
|
32124
32284
|
|
|
32125
32285
|
// packages/workit-opencode/src/stale-sources.ts
|
|
32126
32286
|
import { existsSync as existsSync20, readdirSync as readdirSync8 } from "node:fs";
|
|
32127
|
-
import
|
|
32287
|
+
import path58 from "node:path";
|
|
32128
32288
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
32129
32289
|
var typescriptFiles = (directory) => {
|
|
32130
32290
|
if (!existsSync20(directory))
|
|
32131
32291
|
return [];
|
|
32132
32292
|
return readdirSync8(directory, { withFileTypes: true }).flatMap((entry) => {
|
|
32133
|
-
const file =
|
|
32293
|
+
const file = path58.join(directory, entry.name);
|
|
32134
32294
|
return entry.isDirectory() ? typescriptFiles(file) : entry.isFile() && file.endsWith(".ts") ? [file] : [];
|
|
32135
32295
|
});
|
|
32136
32296
|
};
|
|
32137
32297
|
var pluginSourceFiles = [
|
|
32138
32298
|
...new Set([
|
|
32139
32299
|
fileURLToPath3(import.meta.url),
|
|
32140
|
-
...typescriptFiles(
|
|
32141
|
-
|
|
32142
|
-
...typescriptFiles(
|
|
32300
|
+
...typescriptFiles(path58.join(packageRoot2(), "src")),
|
|
32301
|
+
path58.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
|
|
32302
|
+
...typescriptFiles(path58.join(packageRoot2(), "..", "workit-core", "src", "core"))
|
|
32143
32303
|
])
|
|
32144
32304
|
].filter((file) => existsSync20(file)).toSorted();
|
|
32145
32305
|
|
|
32146
32306
|
// packages/workit-core/src/core/cli-locate.ts
|
|
32147
32307
|
import { closeSync as closeSync2, existsSync as existsSync21, openSync as openSync2, readSync } from "node:fs";
|
|
32148
|
-
import
|
|
32308
|
+
import path59 from "node:path";
|
|
32149
32309
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
32150
32310
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
32151
32311
|
var installRoot = (env, platform = process.platform) => {
|
|
32152
32312
|
if (env.WORKIT_INSTALL_ROOT)
|
|
32153
32313
|
return env.WORKIT_INSTALL_ROOT;
|
|
32154
32314
|
const data = dataDir(env, platform);
|
|
32155
|
-
return platform === "win32" ?
|
|
32315
|
+
return platform === "win32" ? path59.join(data, "install") : data;
|
|
32156
32316
|
};
|
|
32157
|
-
var ownedLauncherPath = (env, platform = process.platform) =>
|
|
32158
|
-
var ownedCurrentEntry = (env, platform = process.platform) =>
|
|
32317
|
+
var ownedLauncherPath = (env, platform = process.platform) => path59.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
|
|
32318
|
+
var ownedCurrentEntry = (env, platform = process.platform) => path59.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
|
|
32159
32319
|
var head = (file) => {
|
|
32160
32320
|
let fd;
|
|
32161
32321
|
try {
|
|
@@ -32182,7 +32342,7 @@ var locateWorkitCli = (options = {}) => {
|
|
|
32182
32342
|
source: "owned-launcher",
|
|
32183
32343
|
command: launcher,
|
|
32184
32344
|
args: [],
|
|
32185
|
-
binDir:
|
|
32345
|
+
binDir: path59.dirname(launcher)
|
|
32186
32346
|
};
|
|
32187
32347
|
const current = ownedCurrentEntry(env, platform);
|
|
32188
32348
|
if (exists(current))
|
|
@@ -32211,7 +32371,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
|
|
|
32211
32371
|
if (located.binDir) {
|
|
32212
32372
|
const key = pathKey(env);
|
|
32213
32373
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
32214
|
-
const same = (dir) => platform === "win32" ?
|
|
32374
|
+
const same = (dir) => platform === "win32" ? path59.win32.normalize(dir).toLowerCase() === path59.win32.normalize(located.binDir).toLowerCase() : path59.posix.normalize(dir) === path59.posix.normalize(located.binDir);
|
|
32215
32375
|
const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
|
|
32216
32376
|
patch[key] = [located.binDir, ...rest].join(delimiter);
|
|
32217
32377
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.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.11.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|