@workit-dev/codex 2.16.1 → 2.17.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/.codex-plugin/plugin.json +1 -1
- package/agents/workit-implementer.toml +10 -1
- package/dist/{workit-hook-y2n74h79.js → workit-hook-0paqaefq.js} +65 -37
- package/dist/workit-hook.js +1 -1
- package/package.json +3 -3
- package/skills/workit-fanout/SKILL.md +8 -9
- package/skills/workit-fanout/references/brief.md +21 -0
- package/skills/workit-ship/SKILL.md +1 -1
- package/skills/workit-ship/references/changelog.md +14 -10
|
@@ -6,16 +6,25 @@ names (its WORKTREE line), which the lead made with
|
|
|
6
6
|
`workit fanout worktree create <slice>` before spawning you; never in the
|
|
7
7
|
lead's checkout.
|
|
8
8
|
|
|
9
|
+
Your first step: a prompt that points at the brief (its WORKTREE, WORKER, TIER
|
|
10
|
+
and TIMEBOX lines and `workit fanout brief <slice> --name <plan>`) means run
|
|
11
|
+
that command and follow its text; a prompt that names a brief file means read
|
|
12
|
+
that file.
|
|
13
|
+
|
|
9
14
|
Refuse to start without a complete brief. It must state: goal, scope (files
|
|
10
15
|
or areas you may touch), acceptance (observable outcomes), verify (exact
|
|
11
16
|
commands), timebox, forbidden (what you must not touch or do), report (what to
|
|
12
17
|
hand back), standing orders, mode (`new` or `resume`) and the worktree path.
|
|
13
|
-
If a field is missing, report which and stop.
|
|
18
|
+
If a field is missing, report which and stop. An unplanned slice
|
|
19
|
+
(`fanout worktree create <slice>` with no plan) has a short brief: the lead's
|
|
20
|
+
prompt states the task, and its acceptance and verify count as the brief's.
|
|
14
21
|
|
|
15
22
|
1. In a Workit worktree (the default), run each git and check command against
|
|
16
23
|
it, one verb per call:
|
|
17
24
|
`workit git --cwd <worktree> commit …`, `workit check --cwd <worktree> <name>`
|
|
18
25
|
(verb first, so the host's allow rules match).
|
|
26
|
+
Read-only git (`status`, `log`, `diff`, `show`) is plain
|
|
27
|
+
`git -C <worktree> …`; `workit git` takes branch, commit, stage and push.
|
|
19
28
|
Never `cd <worktree> && …` chains, `$VAR` paths or compound commands. Edit
|
|
20
29
|
files by their path under the worktree. Workit's hooks deny an edit or a
|
|
21
30
|
mutating git command outside it.
|
|
@@ -6623,6 +6623,9 @@ function resolveRef(cwd, ref) {
|
|
|
6623
6623
|
function originHeadRef(cwd) {
|
|
6624
6624
|
return line(git(cwd, ["symbolic-ref", "-q", "--short", "refs/remotes/origin/HEAD"]));
|
|
6625
6625
|
}
|
|
6626
|
+
function worktreeTop(cwd) {
|
|
6627
|
+
return gitDirs(cwd)?.top ?? null;
|
|
6628
|
+
}
|
|
6626
6629
|
function ownChangeDrift(cwd, range) {
|
|
6627
6630
|
const before = diffRaw(cwd, range.fromFork, range.from);
|
|
6628
6631
|
const after = diffRaw(cwd, range.toFork, range.to);
|
|
@@ -13251,10 +13254,12 @@ function judgeBranch(cwd) {
|
|
|
13251
13254
|
const branch = currentBranch(cwd);
|
|
13252
13255
|
return branch && !isProtectedTarget(cwd, branch) ? branch : null;
|
|
13253
13256
|
}
|
|
13257
|
+
var shellQuote = (value) => /^[\w@%+=:,./-]+$/u.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
|
|
13254
13258
|
function verdictCommand(options) {
|
|
13255
13259
|
const kind = options.judge === "verifier" ? "<live|unit>" : options.judge === "reviewer" ? "review" : "<live|unit|review>";
|
|
13256
13260
|
return [
|
|
13257
13261
|
"workit ledger verdict <verified|failed|blocked>",
|
|
13262
|
+
options.cwd ? `--cwd ${shellQuote(options.cwd)}` : null,
|
|
13258
13263
|
`--kind ${kind}`,
|
|
13259
13264
|
`--branch ${options.branch ?? "<branch>"}`,
|
|
13260
13265
|
options.session ? `--session ${options.session}` : null,
|
|
@@ -17786,9 +17791,9 @@ var autocorrected = (name, config) => {
|
|
|
17786
17791
|
}
|
|
17787
17792
|
return tie ? null : best;
|
|
17788
17793
|
};
|
|
17789
|
-
var
|
|
17794
|
+
var shellQuote2 = (word) => `'${word.replaceAll("'", "'\\''")}'`;
|
|
17790
17795
|
var positional = (script, args) => {
|
|
17791
|
-
const word = (arg) => /^[\w./@+:=-]+$/.test(arg) ? arg :
|
|
17796
|
+
const word = (arg) => /^[\w./@+:=-]+$/.test(arg) ? arg : shellQuote2(arg);
|
|
17792
17797
|
return script.replace(/\$\{?([1-9])\}?/g, (_, n) => word(args[Number(n) - 1] ?? "")).replace(/\$\{?[@*]\}?/g, args.map(word).join(" "));
|
|
17793
17798
|
};
|
|
17794
17799
|
var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
|
|
@@ -17805,7 +17810,7 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
|
|
|
17805
17810
|
return corrected ? [{ ...invocation, args: [corrected, ...invocation.args.slice(1)] }] : [invocation];
|
|
17806
17811
|
}
|
|
17807
17812
|
const rest = invocation.args.slice(1);
|
|
17808
|
-
const expanded = alias.startsWith("!") ? rawInvocations([positional(alias.slice(1), rest), ...rest.map(
|
|
17813
|
+
const expanded = alias.startsWith("!") ? rawInvocations([positional(alias.slice(1), rest), ...rest.map(shellQuote2)].join(" ")).map((inner) => ({
|
|
17809
17814
|
...inner,
|
|
17810
17815
|
dir: rebase(invocation.dir, inner.dir),
|
|
17811
17816
|
...inner.tool === "git" && (invocation.config || inner.config) ? { config: [...invocation.config ?? [], ...inner.config ?? []] } : {},
|
|
@@ -18132,7 +18137,7 @@ var policyDeclared = () => {
|
|
|
18132
18137
|
return false;
|
|
18133
18138
|
}
|
|
18134
18139
|
};
|
|
18135
|
-
var word = (text) => /^[\w./@%+:,=-]+$/u.test(text) ? text :
|
|
18140
|
+
var word = (text) => /^[\w./@%+:,=-]+$/u.test(text) ? text : shellQuote2(text);
|
|
18136
18141
|
var HEREDOC = /^cat <<(['"])(\w+)\1\n([\s\S]*)\n\2\n?$/u;
|
|
18137
18142
|
var messageOf = (segment, index) => {
|
|
18138
18143
|
const text = segment.words[index];
|
|
@@ -18216,7 +18221,7 @@ var cdCommitCall = (input, command, target, repo) => {
|
|
|
18216
18221
|
}
|
|
18217
18222
|
return [
|
|
18218
18223
|
`workit git --cwd ${word(target)} commit`,
|
|
18219
|
-
...messages.map((message) => `-m ${
|
|
18224
|
+
...messages.map((message) => `-m ${shellQuote2(message)}`),
|
|
18220
18225
|
...allowEmpty ? ["--allow-empty"] : [],
|
|
18221
18226
|
all ? "--all" : `-- ${[...new Set(paths)].map(word).join(" ")}`
|
|
18222
18227
|
].join(" ");
|
|
@@ -18706,6 +18711,7 @@ var workitBypassFlag = (command, dialect = "posix") => {
|
|
|
18706
18711
|
}
|
|
18707
18712
|
return null;
|
|
18708
18713
|
};
|
|
18714
|
+
var helpOnly = (call, needle) => call.length > needle.length && needle.every((word, index) => call[index] === word) && call.slice(needle.length).every((word) => word === "--help" || word === "-h");
|
|
18709
18715
|
var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
18710
18716
|
if (!mayRunUserOnly(command))
|
|
18711
18717
|
return null;
|
|
@@ -18732,7 +18738,7 @@ var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
|
18732
18738
|
}
|
|
18733
18739
|
const call = args.slice(at);
|
|
18734
18740
|
const found = WORKIT_USER_ONLY.find((needle) => call[0] === needle[0] && hasWordsInOrder(call, needle));
|
|
18735
|
-
if (found)
|
|
18741
|
+
if (found && !helpOnly(call, found))
|
|
18736
18742
|
return [...found];
|
|
18737
18743
|
}
|
|
18738
18744
|
return null;
|
|
@@ -23670,6 +23676,10 @@ var cdWorkitSplit = (command) => {
|
|
|
23670
23676
|
return null;
|
|
23671
23677
|
};
|
|
23672
23678
|
|
|
23679
|
+
// packages/workit-core/src/hooks/spawn-gate.ts
|
|
23680
|
+
import fs23 from "node:fs";
|
|
23681
|
+
import path35 from "node:path";
|
|
23682
|
+
|
|
23673
23683
|
// packages/workit-core/src/hooks/model-limit.ts
|
|
23674
23684
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync4, readSync, statSync as statSync5 } from "node:fs";
|
|
23675
23685
|
import os10 from "node:os";
|
|
@@ -23993,20 +24003,37 @@ var agentModelDecision = (cwd, tool, options = {}) => {
|
|
|
23993
24003
|
|
|
23994
24004
|
// packages/workit-core/src/hooks/spawn-gate.ts
|
|
23995
24005
|
var MADE_WORKTREE = /^WORKTREE:[ \t]*(?!not made yet)\S(?![^\n]*not made yet)/mu;
|
|
23996
|
-
var
|
|
23997
|
-
|
|
24006
|
+
var namesMade = (word) => {
|
|
24007
|
+
try {
|
|
24008
|
+
const stat = fs23.statSync(word);
|
|
24009
|
+
if (stat.isFile())
|
|
24010
|
+
return stat.size < 1e6 && MADE_WORKTREE.test(fs23.readFileSync(word, "utf8"));
|
|
24011
|
+
const dotGit = path35.join(word, ".git");
|
|
24012
|
+
const link = fs23.statSync(dotGit);
|
|
24013
|
+
const admin = link.isFile() && link.size <= 4096 && /^gitdir: *(.+)/u.exec(fs23.readFileSync(dotGit, "utf8"));
|
|
24014
|
+
return !!admin && fs23.existsSync(path35.resolve(word, admin[1].trim(), FANOUT_TOKEN_FILE));
|
|
24015
|
+
} catch {
|
|
24016
|
+
return false;
|
|
24017
|
+
}
|
|
24018
|
+
};
|
|
24019
|
+
var namesWorktree = (prompt) => MADE_WORKTREE.test(prompt) || (prompt.match(/(?<![\w.~])(?:[a-z]:[\\/]|\/)[^\s'"`<>|;,()]+/giu) ?? []).some((word) => namesMade(word.replace(/[.:]+$/u, "")));
|
|
24020
|
+
var sliceWord = (tool) => (/(?:\bfanout brief|\bworktree create|\bWORKER:) +([a-z0-9][\w.-]*)/iu.exec(String(tool.prompt))?.[1] ?? String(tool.description ?? "")).toLowerCase().replace(/[^a-z0-9._-]+/gu, "-").replace(/^[-._]+|-+$/gu, "").slice(0, 40) || "slice";
|
|
23998
24021
|
var gate = (descriptor, tool) => {
|
|
23999
24022
|
const type = typeof tool.subagent_type === "string" ? tool.subagent_type : "";
|
|
24000
24023
|
const implementer = workitRole(descriptor, type) === "implementer";
|
|
24001
|
-
if (implementer && (typeof tool.prompt !== "string" || !
|
|
24024
|
+
if (implementer && (typeof tool.prompt !== "string" || !namesWorktree(tool.prompt))) {
|
|
24025
|
+
const slice = sliceWord(tool);
|
|
24026
|
+
const unblock = `workit fanout worktree create ${slice}`;
|
|
24002
24027
|
return {
|
|
24003
24028
|
kind: "deny",
|
|
24004
24029
|
decision: {
|
|
24005
24030
|
kind: "deny",
|
|
24006
|
-
reason: `workit spawn gate:
|
|
24007
|
-
|
|
24031
|
+
reason: `workit spawn gate: this ${type} prompt names no worktree Workit made.
|
|
24032
|
+
Retry as: ${unblock} (or --name <plan> for a planned slice), then spawn again with the WORKTREE line it prints as the prompt's first line.`,
|
|
24033
|
+
unblock
|
|
24008
24034
|
}
|
|
24009
24035
|
};
|
|
24036
|
+
}
|
|
24010
24037
|
if (tool.isolation === undefined)
|
|
24011
24038
|
return { kind: "run", input: tool, change: { dropped: [], reasons: [], notes: [] } };
|
|
24012
24039
|
const { isolation: _dropped, ...input } = tool;
|
|
@@ -24030,8 +24057,8 @@ var spawnDecision = (descriptor, cwd, tool, permissionMode = null) => {
|
|
|
24030
24057
|
|
|
24031
24058
|
// packages/workit-core/src/hooks/teardown.ts
|
|
24032
24059
|
import { spawn } from "node:child_process";
|
|
24033
|
-
import
|
|
24034
|
-
import
|
|
24060
|
+
import fs24 from "node:fs";
|
|
24061
|
+
import path36 from "node:path";
|
|
24035
24062
|
var REAP_INTERVAL_MS = 10 * 60000;
|
|
24036
24063
|
var LOG_MAX_BYTES = 1 << 20;
|
|
24037
24064
|
var ENDS = {
|
|
@@ -24042,9 +24069,9 @@ var ENDS = {
|
|
|
24042
24069
|
};
|
|
24043
24070
|
var SAFE_SESSION = /^[\w.@+][\w.:@/+-]{0,127}$/u;
|
|
24044
24071
|
var HOST_SESSION_VARS = ["OPENCODE_SESSION_ID", "PI_SESSION_ID", "CODEX_THREAD_ID"];
|
|
24045
|
-
var teardownDir = (env) =>
|
|
24046
|
-
var teardownLog = (env) =>
|
|
24047
|
-
var reapStamp = (env) =>
|
|
24072
|
+
var teardownDir = (env) => path36.join(stateDir3(env), "procs");
|
|
24073
|
+
var teardownLog = (env) => path36.join(teardownDir(env), "teardown.log");
|
|
24074
|
+
var reapStamp = (env) => path36.join(teardownDir(env), "reap-at-start.stamp");
|
|
24048
24075
|
function spawnDetached(request) {
|
|
24049
24076
|
try {
|
|
24050
24077
|
const shell = process.platform === "win32" && !/\.exe$/iu.test(request.command);
|
|
@@ -24071,13 +24098,13 @@ var teardownDeps = {
|
|
|
24071
24098
|
var openLog = (env, args) => {
|
|
24072
24099
|
try {
|
|
24073
24100
|
const file = teardownLog(env);
|
|
24074
|
-
|
|
24101
|
+
fs24.mkdirSync(path36.dirname(file), { recursive: true });
|
|
24075
24102
|
let size = 0;
|
|
24076
24103
|
try {
|
|
24077
|
-
size =
|
|
24104
|
+
size = fs24.statSync(file).size;
|
|
24078
24105
|
} catch {}
|
|
24079
|
-
const fd =
|
|
24080
|
-
|
|
24106
|
+
const fd = fs24.openSync(file, size > LOG_MAX_BYTES ? "w" : "a", 384);
|
|
24107
|
+
fs24.writeSync(fd, `${new Date(teardownDeps.now()).toISOString()} workit ${args.join(" ")}
|
|
24081
24108
|
`);
|
|
24082
24109
|
return fd;
|
|
24083
24110
|
} catch {
|
|
@@ -24089,7 +24116,7 @@ function runCli(args, env) {
|
|
|
24089
24116
|
try {
|
|
24090
24117
|
const cli = locateWorkitCli2({ env });
|
|
24091
24118
|
const cwd = teardownDir(env);
|
|
24092
|
-
|
|
24119
|
+
fs24.mkdirSync(cwd, { recursive: true });
|
|
24093
24120
|
log = openLog(env, args);
|
|
24094
24121
|
const started = teardownDeps.spawn({
|
|
24095
24122
|
command: cli.command,
|
|
@@ -24099,7 +24126,7 @@ function runCli(args, env) {
|
|
|
24099
24126
|
log
|
|
24100
24127
|
});
|
|
24101
24128
|
if (!started && log !== null)
|
|
24102
|
-
|
|
24129
|
+
fs24.writeSync(log, ` not started
|
|
24103
24130
|
`);
|
|
24104
24131
|
return started;
|
|
24105
24132
|
} catch {
|
|
@@ -24107,7 +24134,7 @@ function runCli(args, env) {
|
|
|
24107
24134
|
} finally {
|
|
24108
24135
|
if (log !== null)
|
|
24109
24136
|
try {
|
|
24110
|
-
|
|
24137
|
+
fs24.closeSync(log);
|
|
24111
24138
|
} catch {}
|
|
24112
24139
|
}
|
|
24113
24140
|
}
|
|
@@ -24126,24 +24153,24 @@ function endSession(end, env = process.env) {
|
|
|
24126
24153
|
var claim2 = (file, now) => {
|
|
24127
24154
|
for (let attempt = 0;attempt < 2; attempt += 1)
|
|
24128
24155
|
try {
|
|
24129
|
-
|
|
24156
|
+
fs24.writeFileSync(file, String(now), { flag: "wx", mode: 384 });
|
|
24130
24157
|
return true;
|
|
24131
24158
|
} catch (error) {
|
|
24132
24159
|
if (error.code !== "EEXIST")
|
|
24133
24160
|
return false;
|
|
24134
24161
|
let held = Number.NaN;
|
|
24135
24162
|
try {
|
|
24136
|
-
held = Number(
|
|
24163
|
+
held = Number(fs24.readFileSync(file, "utf8"));
|
|
24137
24164
|
} catch {}
|
|
24138
24165
|
if (now - held < REAP_INTERVAL_MS)
|
|
24139
24166
|
return false;
|
|
24140
|
-
|
|
24167
|
+
fs24.rmSync(file, { force: true });
|
|
24141
24168
|
}
|
|
24142
24169
|
return false;
|
|
24143
24170
|
};
|
|
24144
24171
|
var fresh = (stamp, now) => {
|
|
24145
24172
|
try {
|
|
24146
|
-
const last = Number(
|
|
24173
|
+
const last = Number(fs24.readFileSync(stamp, "utf8"));
|
|
24147
24174
|
return now - last < REAP_INTERVAL_MS && last <= now;
|
|
24148
24175
|
} catch {
|
|
24149
24176
|
return false;
|
|
@@ -24156,7 +24183,7 @@ function reapAtStart(_cwd, env = process.env) {
|
|
|
24156
24183
|
try {
|
|
24157
24184
|
if (fresh(stamp, now))
|
|
24158
24185
|
return false;
|
|
24159
|
-
|
|
24186
|
+
fs24.mkdirSync(path36.dirname(stamp), { recursive: true });
|
|
24160
24187
|
if (!claim2(lock, now))
|
|
24161
24188
|
return false;
|
|
24162
24189
|
} catch {
|
|
@@ -24169,12 +24196,12 @@ function reapAtStart(_cwd, env = process.env) {
|
|
|
24169
24196
|
started = runCli(["stop", "--orphans", "--reason", "session-start"], env);
|
|
24170
24197
|
if (started) {
|
|
24171
24198
|
const temp = `${stamp}.${process.pid}`;
|
|
24172
|
-
|
|
24173
|
-
|
|
24199
|
+
fs24.writeFileSync(temp, String(now), { mode: 384 });
|
|
24200
|
+
fs24.renameSync(temp, stamp);
|
|
24174
24201
|
}
|
|
24175
24202
|
} catch {} finally {
|
|
24176
24203
|
try {
|
|
24177
|
-
|
|
24204
|
+
fs24.rmSync(lock, { force: true });
|
|
24178
24205
|
} catch {}
|
|
24179
24206
|
}
|
|
24180
24207
|
return started;
|
|
@@ -24715,14 +24742,15 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
|
|
|
24715
24742
|
const judge = event.agentType.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
24716
24743
|
const pick = judge === "verifier" ? ", --kind live when you drove the real surface" : "";
|
|
24717
24744
|
const branch = judgeBranch(cwd);
|
|
24745
|
+
const at = currentBranch(cwd) === null ? null : worktreeTop(cwd) ?? null;
|
|
24718
24746
|
const checks = judgeChecksLine(cwd);
|
|
24719
24747
|
const checksText = checks ? ` ${checks}` : "";
|
|
24720
24748
|
if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
|
|
24721
|
-
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
24749
|
+
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge, cwd: at })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
24722
24750
|
const token = session ? recordIssuedSession(cwd, session, own) : null;
|
|
24723
24751
|
if (session && !token)
|
|
24724
24752
|
return `${readOnly} ${own} was already issued to an earlier subagent, so no token is handed out again and a verdict under it would be refused (unbound_session). Record no verdict as ${own}: spawn a fresh verifier or reviewer, which gets its own session and token.`;
|
|
24725
|
-
const line = verdictCommand({ branch, judge, session: own, token });
|
|
24753
|
+
const line = verdictCommand({ branch, judge, session: own, token, cwd: at });
|
|
24726
24754
|
return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${JUDGE_CWD}${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
|
|
24727
24755
|
};
|
|
24728
24756
|
var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
|
|
@@ -24823,12 +24851,12 @@ function decide(input, deps) {
|
|
|
24823
24851
|
if (input.host === "claude_code")
|
|
24824
24852
|
return {
|
|
24825
24853
|
kind: "ask",
|
|
24826
|
-
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: the user decides this call.`
|
|
24854
|
+
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: the user decides this call (its help: \`workit help ${userOnly.join(" ")}\`).`
|
|
24827
24855
|
};
|
|
24828
24856
|
if (canDeny && ["cursor", "codex_cli", "codex_desktop", "pi"].includes(input.host))
|
|
24829
24857
|
return {
|
|
24830
24858
|
kind: "deny",
|
|
24831
|
-
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: run it in your own terminal.`,
|
|
24859
|
+
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: run it in your own terminal (its help: \`workit help ${userOnly.join(" ")}\`).`,
|
|
24832
24860
|
unblock: null
|
|
24833
24861
|
};
|
|
24834
24862
|
}
|
|
@@ -24976,7 +25004,7 @@ var dispatchHook = (adapter, raw, env = process.env) => {
|
|
|
24976
25004
|
};
|
|
24977
25005
|
// packages/workit-core/src/hooks/deadline.ts
|
|
24978
25006
|
import { appendFileSync, mkdirSync as mkdirSync4 } from "node:fs";
|
|
24979
|
-
import
|
|
25007
|
+
import path37 from "node:path";
|
|
24980
25008
|
var HOOK_SKIP_TEXT = "workit context skipped: host under load";
|
|
24981
25009
|
var HOOK_DEADLINE_MS = 8000;
|
|
24982
25010
|
var HOST_DEADLINES = {
|
|
@@ -24994,7 +25022,7 @@ var hookDeadlineMs = (env, host = "", native) => {
|
|
|
24994
25022
|
const row = HOST_DEADLINES[host];
|
|
24995
25023
|
return override(env) ?? (row ? native === undefined ? Math.min(...Object.values(row)) : row[native] ?? row[""] : HOOK_DEADLINE_MS);
|
|
24996
25024
|
};
|
|
24997
|
-
var skipsFile = (stateDir) =>
|
|
25025
|
+
var skipsFile = (stateDir) => path37.join(stateDir, HOOK_SKIPS_FILE);
|
|
24998
25026
|
var recordHookSkip = (skip, stateDir = resolveStateDir()) => {
|
|
24999
25027
|
try {
|
|
25000
25028
|
mkdirSync4(stateDir, { recursive: true });
|
package/dist/workit-hook.js
CHANGED
|
@@ -101,7 +101,7 @@ if (quiet) {
|
|
|
101
101
|
`);
|
|
102
102
|
} else {
|
|
103
103
|
try {
|
|
104
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
104
|
+
const { runCodexHook } = await import("./workit-hook-0paqaefq.js");
|
|
105
105
|
await runCodexHook([payload]);
|
|
106
106
|
} catch (error) {
|
|
107
107
|
const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^2.
|
|
45
|
-
"@workit-dev/mcp": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.17.0",
|
|
45
|
+
"@workit-dev/mcp": "^2.17.0"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|
|
@@ -20,16 +20,15 @@ units of ~100+ lines each. Coupled work stays with one owner. Workit never spawn
|
|
|
20
20
|
PR (`references/orchestration.md`).
|
|
21
21
|
2. **Record standing orders** (`workit ledger standing add "<order>"`): every
|
|
22
22
|
user directive all workers share. Directives decay across resumes.
|
|
23
|
-
3. **
|
|
24
|
-
|
|
25
|
-
Never hand-edit it; change the plan or
|
|
23
|
+
3. **Make the worktrees**: `workit fanout worktree create <slice>…` (every host; `--name <plan.json>`
|
|
24
|
+
registers the file) prints per slice its `WORKTREE:` line and the exact spawn, whose prompt points
|
|
25
|
+
the worker at `workit fanout brief <slice> --name <plan>`. Never hand-edit it; change the plan or
|
|
26
|
+
the standing orders. One unplanned slice needs no plan (`--branch <b>` optional).
|
|
26
27
|
4. **Spawn in a rolling window**, in the background, each in its own worktree:
|
|
27
|
-
keep 4-6 in flight and refill from `spawnable` in `workit fanout status
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
Model: the brief's `model:` and `effort:` lines (`workit models show`), else TIER (`references/orchestration.md`).
|
|
32
|
-
Claude Code: the `implementer` agent; its spawn hook drops `isolation` and refuses a prompt without a WORKTREE line.
|
|
28
|
+
keep 4-6 in flight and refill from `spawnable` in `workit fanout status`.
|
|
29
|
+
Assign before spawn (OpenCode: `workit worker assign`); each prompt is the printed one
|
|
30
|
+
(budget and model hooks read its WORKTREE, WORKER, TIER and TIMEBOX lines), so batched OpenCode launches each bind their worker.
|
|
31
|
+
Claude Code: copy the printed `SPAWN:` args (a model only when the TIER differs from the agent file); the hook drops `isolation` and refuses a prompt naming no Workit worktree with a `Retry as:`.
|
|
33
32
|
5. **Judge liveness by side effects only:** `workit fanout status` (head age,
|
|
34
33
|
PR, CI, verdict, landed; STUCK past the TIMEBOX). Stop a stuck worker and
|
|
35
34
|
observe that it exited (a timeout is not proof); stop a finished one when its
|
|
@@ -103,6 +103,27 @@ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## Worktrees and the spawn they print
|
|
107
|
+
|
|
108
|
+
`workit fanout worktree create a b c` makes each slice's worktree and prints,
|
|
109
|
+
per slice, `WORKTREE: <path>` and the spawn that carries it. Its prompt starts
|
|
110
|
+
with that WORKTREE line, then `WORKER`, `TIER`, `TIMEBOX` and
|
|
111
|
+
"Run `workit fanout brief <slice> --name <plan>` and follow it exactly.";
|
|
112
|
+
Claude Code's `SPAWN:` line names `model` only when the TIER differs from the
|
|
113
|
+
`implementer` agent file. `--name` takes the plan's name or its file (`--plan`
|
|
114
|
+
is the same flag): a file is registered in that call, and a name no plan has
|
|
115
|
+
registers the one file in `workit dir plans` that starts with it. The plan
|
|
116
|
+
check refuses a slice branch the workspace branch policy refuses and names the
|
|
117
|
+
allowed one.
|
|
118
|
+
|
|
119
|
+
One unplanned slice: `workit fanout worktree create fix-login [--branch
|
|
120
|
+
fix/login] [--base <b>] [--tier <t>]` (no plan holds it) records a one-slice plan named after it
|
|
121
|
+
(the lead's prompt states the task) and prints the same lines; two or more
|
|
122
|
+
slices need a plan file. Claude Code's spawn gate passes a
|
|
123
|
+
`workit:implementer` prompt that names a Workit-made worktree as a WORKTREE
|
|
124
|
+
line, as its path, or as a brief file holding a WORKTREE line; otherwise its
|
|
125
|
+
deny is two lines ending in that ad-hoc command as `Retry as:`.
|
|
126
|
+
|
|
106
127
|
## Identity and git rules per host
|
|
107
128
|
|
|
108
129
|
`workit fanout brief` renders the identity line, the model lines and RULES 1
|
|
@@ -31,7 +31,7 @@ denial, a review comment that needs a product decision, a required update
|
|
|
31
31
|
that repeats because the base keeps moving, or after 3 failed fix attempts on
|
|
32
32
|
the same check. Fix round and recheck both failed: the decider agent (read the `workit-fanout` skill's SKILL.md and follow it).
|
|
33
33
|
|
|
34
|
-
1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`:
|
|
34
|
+
1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`: pass the Unreleased entry as `workit pr create … --changelog "<Section>: <entry>"` (it commits and pushes it); with `docs: when-user-facing` fix only docs the diff made false (`references/changelog.md`).
|
|
35
35
|
Full local check (`workit check ci` when `.workit/checks.json` has a `ci` group), push once: `workit git push`, then `workit pr template` and fill the template it prints: every heading, each `<!-- -->` replaced (Workit's: `references/pr-body.md`).
|
|
36
36
|
`workit pr create --title "<title>" --body-file <f|->` refuses a body that leaves a repo template (or `prTemplate: workit`) unfilled; add `--issue <#n|ID>` (`--refs`: no close; `workit pr edit`).
|
|
37
37
|
YouTrack issue work: `workit youtrack …` (`--help`; the `ytrack` skill for the rest). A draft that needs the user's yes (YouTrack text, release notes, a PR body they asked to review): paste it whole in chat before asking, never only its path, and again after every edit (the verb prints the diff and the new text).
|
|
@@ -17,19 +17,23 @@ belongs to). Otherwise:
|
|
|
17
17
|
do, not with internals: "Added: `workit pr create --no-changelog <reason>`
|
|
18
18
|
skips the changelog check with a recorded reason", not "refactor gate
|
|
19
19
|
module".
|
|
20
|
-
2.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
2. Open the PR with the entry in the same call:
|
|
21
|
+
`workit pr create … --changelog "<Section>: <entry>"` (sections: Added,
|
|
22
|
+
Changed, Deprecated, Removed, Fixed, Security). It merges the bullet into
|
|
23
|
+
`## [Unreleased]` of the right file (creating a missing Keep a Changelog
|
|
24
|
+
file), commits it with a subject commitlint accepts, pushes and opens the
|
|
25
|
+
PR. Never clobber CHANGELOG.md: never rewrite, reorder or delete an
|
|
25
26
|
existing entry, and never hand-edit released sections.
|
|
26
|
-
3.
|
|
27
|
-
|
|
27
|
+
3. With no PR to open yet, apply it alone with
|
|
28
|
+
`workit changelog apply --entries '{"Added": ["…"]}'` (`--path <file>` when
|
|
29
|
+
it is not the root CHANGELOG.md), then commit it
|
|
30
|
+
(`workit git commit -m "<message>" -- <file>`) with the change and push.
|
|
28
31
|
|
|
29
32
|
`workit pr create` refuses a user-facing PR without a new Unreleased bullet
|
|
30
|
-
(`changelog_required`)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
(`changelog_required`); its `Retry as:` line is your call plus
|
|
34
|
+
`--changelog "<Section>: <what users can now do>"`: fill in the entry and run
|
|
35
|
+
it. When the PR truly needs no entry, pass `--no-changelog "<why>"`: the
|
|
36
|
+
reason is written into the PR body.
|
|
33
37
|
|
|
34
38
|
## Docs (`docs: when-user-facing`)
|
|
35
39
|
|