@workit-dev/codex 1.9.3 → 1.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "1.9.3",
3
+ "version": "1.11.0",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -27104,7 +27104,7 @@ var ytrackDetail = (out) => out.stderr.trim().split(`
27104
27104
  var YTRACK_MISSING = "ytrack is not on PATH: Workit reaches YouTrack only through ytrack";
27105
27105
 
27106
27106
  // packages/workit-core/src/core/youtrack.ts
27107
- var ISSUE_RE = /^[A-Z]+-\d+$/;
27107
+ var ISSUE_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
27108
27108
  var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path29.join(resolveConfigDir(), "youtrack.json");
27109
27109
  var readYouTrackContextConfig = () => {
27110
27110
  const cfgPath = youTrackReadOnlyConfigPath();
@@ -27160,11 +27160,11 @@ function parseIssueRef(input) {
27160
27160
  if (ISSUE_RE.test(trimmed)) {
27161
27161
  return { issueId: trimmed, source: "id" };
27162
27162
  }
27163
- const fromPath = trimmed.match(/\/(?:issue|issues)\/([A-Z]+-\d+)/i);
27163
+ const fromPath = trimmed.match(/\/(?:issue|issues)\/([A-Z][A-Z0-9_]*-\d+)/i);
27164
27164
  if (fromPath && ISSUE_RE.test(fromPath[1])) {
27165
27165
  return { issueId: fromPath[1], source: "url" };
27166
27166
  }
27167
- const anywhere = trimmed.match(/([A-Z]+-\d+)/);
27167
+ const anywhere = trimmed.match(/([A-Z][A-Z0-9_]*-\d+)/);
27168
27168
  if (anywhere && ISSUE_RE.test(anywhere[1])) {
27169
27169
  return { issueId: anywhere[1], source: "url" };
27170
27170
  }
@@ -31378,7 +31378,7 @@ var SCAN_MS = 30 * 60000;
31378
31378
  var UNLISTED = new Set(["description", "prompt"]);
31379
31379
 
31380
31380
  // packages/workit-core/src/hooks/ytrack-guard.ts
31381
- var VALUE = new Set(("--host --body -b --body-file --text --date --duration --type --project -p --summary -s " + "--description --description-file --field --tag --add-tag --remove-tag --assignee --comment " + "--json --jq -X --method -f -F --raw-field --input --fields -q --query --author --since --limit").split(" "));
31381
+ var VALUE = new Set(("--host --body -b --body-file --text --date --duration --type --project -p --summary -s " + "--description --description-file --field --tag --add-tag --remove-tag --assignee --comment " + "--json --jq -X --method -f -F --raw-field --input --fields -q --query --author --since --limit " + "--attach -H --header").split(" "));
31382
31382
  var BARE = new Set("--debug --no-color --paginate --include --dry-run --silent --yes --meeting --help -h".split(" "));
31383
31383
  var gap = (part) => ({ workit: null, gap: part });
31384
31384
  var READ = new Map;
@@ -23133,7 +23133,7 @@ var minutesOf = (text = "") => {
23133
23133
  });
23134
23134
  return rest.trim() || !Number.isInteger(total) || total <= 0 ? null : total;
23135
23135
  };
23136
- var VALUE = new Set(("--host --body -b --body-file --text --date --duration --type --project -p --summary -s " + "--description --description-file --field --tag --add-tag --remove-tag --assignee --comment " + "--json --jq -X --method -f -F --raw-field --input --fields -q --query --author --since --limit").split(" "));
23136
+ var VALUE = new Set(("--host --body -b --body-file --text --date --duration --type --project -p --summary -s " + "--description --description-file --field --tag --add-tag --remove-tag --assignee --comment " + "--json --jq -X --method -f -F --raw-field --input --fields -q --query --author --since --limit " + "--attach -H --header").split(" "));
23137
23137
  var BARE = new Set("--debug --no-color --paginate --include --dry-run --silent --yes --meeting --help -h".split(" "));
23138
23138
  var standsAlone = (args, at) => {
23139
23139
  const before = args[at - 1] ?? "";
@@ -23152,7 +23152,7 @@ var ASKS = /^(?:post|put|patch|delete)$/i;
23152
23152
  var BODY = /^(?:-[fF]|--(?:field|raw-field|input))(?:=|$)|^-[fF]./;
23153
23153
  var QUIET = /^--(?:debug|no-color|json|jq)$/;
23154
23154
  var CARRIES = {
23155
- note: { "--body": "body", "-b": "body", "--body-file": "file" },
23155
+ note: { "--body": "body", "-b": "body", "--body-file": "file", "--attach": "attach" },
23156
23156
  time: { "--duration": "duration", "--text": "text", "--date": "date" },
23157
23157
  create: {
23158
23158
  "--project": "project",
@@ -23164,9 +23164,60 @@ var CARRIES = {
23164
23164
  }
23165
23165
  };
23166
23166
  var gap = (part) => ({ workit: null, gap: part });
23167
+ var ISSUE = /^[A-Z][A-Z0-9_]*-\d+$/;
23168
+ var EXPANDS = /[$`*?[\]]|^~/;
23169
+ var commandFlag = (command) => {
23170
+ const state = /^State\s+(\S.*)$/u.exec(command)?.[1];
23171
+ return state ? pair("--state", state) : pair("--command", command);
23172
+ };
23173
+ var callFor = (effect) => {
23174
+ const comment = effect.markdown !== undefined || effect.file !== undefined;
23175
+ const time = effect.minutes !== undefined;
23176
+ const timeFlags = [
23177
+ effect.text === undefined ? "" : pair("--text", effect.text),
23178
+ effect.date === undefined ? "" : pair("--date", effect.date)
23179
+ ];
23180
+ const commentFlag = effect.markdown !== undefined ? pair("--markdown", effect.markdown) : effect.file !== undefined ? pair("--file", effect.file) : "";
23181
+ const only = !effect.attach?.length && effect.command === undefined;
23182
+ if (only && comment && !time)
23183
+ return `workit youtrack note ${effect.issue} ${commentFlag}`;
23184
+ if (only && time && !comment)
23185
+ return [`workit youtrack time ${effect.issue} --minutes ${effect.minutes}`, ...timeFlags].filter(Boolean).join(" ");
23186
+ return [
23187
+ `workit youtrack update ${effect.issue}`,
23188
+ commentFlag,
23189
+ ...(effect.attach ?? []).map((file) => pair("--attach", file)),
23190
+ time ? `--minutes ${effect.minutes}` : "",
23191
+ ...time ? timeFlags : [],
23192
+ effect.command === undefined ? "" : commandFlag(effect.command)
23193
+ ].filter(Boolean).join(" ");
23194
+ };
23195
+ var mapped = (effect) => ({ workit: callFor(effect), effect });
23196
+ var combine = (effects) => {
23197
+ const out = { issue: effects[0].issue };
23198
+ for (const effect of effects) {
23199
+ if (effect.issue !== out.issue)
23200
+ return null;
23201
+ const comment = effect.markdown !== undefined || effect.file !== undefined;
23202
+ if (comment && (out.markdown !== undefined || out.file !== undefined))
23203
+ return null;
23204
+ if (effect.minutes !== undefined && out.minutes !== undefined)
23205
+ return null;
23206
+ if (effect.command !== undefined && out.command !== undefined)
23207
+ return null;
23208
+ Object.assign(out, {
23209
+ ...effect,
23210
+ attach: [...out.attach ?? [], ...effect.attach ?? []]
23211
+ });
23212
+ }
23213
+ if (!out.attach?.length)
23214
+ delete out.attach;
23215
+ return out;
23216
+ };
23167
23217
  var pair = (flag, value) => value.startsWith("-") ? `${flag}=${quote2(value)}` : `${flag} ${quote2(value)}`;
23168
23218
  var mapWrite = (verb, args) => {
23169
23219
  const values = {};
23220
+ const attach = [];
23170
23221
  const operands = [];
23171
23222
  for (let at = 0;at < args.length; at++) {
23172
23223
  const arg = args[at];
@@ -23182,9 +23233,12 @@ var mapWrite = (verb, args) => {
23182
23233
  const key = CARRIES[verb][flag];
23183
23234
  if (!key || value === undefined || key in values)
23184
23235
  return gap(`\`${flag}\``);
23185
- if (/[$`]|^~/.test(value))
23236
+ if (/[$`]|^~/.test(value) || key === "attach" && EXPANDS.test(value))
23186
23237
  return gap(`the value of \`${flag}\`, which the shell expands when it runs`);
23187
- values[key] = value;
23238
+ if (key === "attach")
23239
+ attach.push(value);
23240
+ else
23241
+ values[key] = value;
23188
23242
  }
23189
23243
  const [issue, ...more] = operands.slice(2);
23190
23244
  const v = values;
@@ -23207,7 +23261,7 @@ var mapWrite = (verb, args) => {
23207
23261
  ].filter(Boolean).join(" ")
23208
23262
  };
23209
23263
  }
23210
- if (issue === undefined || more.length || !/^[A-Z]+-\d+$/.test(issue))
23264
+ if (issue === undefined || more.length || !ISSUE.test(issue))
23211
23265
  return gap("the issue, which must be one id like ABC-123");
23212
23266
  if (verb === "note") {
23213
23267
  if (v.body === undefined === (v.file === undefined))
@@ -23216,22 +23270,108 @@ var mapWrite = (verb, args) => {
23216
23270
  return gap("text read from standard input");
23217
23271
  if (v.body !== undefined && !v.body.trim())
23218
23272
  return gap("an empty --body");
23219
- return {
23220
- workit: `workit youtrack note ${issue} ${v.body === undefined ? pair("--file", v.file) : pair("--markdown", v.body)}`
23221
- };
23273
+ return mapped({
23274
+ issue,
23275
+ ...v.body === undefined ? { file: v.file } : { markdown: v.body },
23276
+ ...attach.length ? { attach } : {}
23277
+ });
23222
23278
  }
23223
23279
  const minutes = minutesOf(v.duration);
23224
23280
  if (minutes === null)
23225
23281
  return gap(`\`--duration ${v.duration ?? ""}\`, which is no whole number of minutes`);
23226
23282
  if (v.date !== undefined && !/^(?:auto|\d{4}-\d{2}-\d{2})$/.test(v.date))
23227
23283
  return gap(`\`--date ${v.date}\``);
23228
- return {
23229
- workit: [
23230
- `workit youtrack time ${issue} --minutes ${minutes}`,
23231
- v.text === undefined ? "" : pair("--text", v.text),
23232
- v.date === undefined ? "" : pair("--date", v.date)
23233
- ].filter(Boolean).join(" ")
23234
- };
23284
+ return mapped({
23285
+ issue,
23286
+ minutes,
23287
+ ...v.text === undefined ? {} : { text: v.text },
23288
+ ...v.date === undefined ? {} : { date: v.date }
23289
+ });
23290
+ };
23291
+ var mapIssueWrite = (verb, args) => {
23292
+ const operands = [];
23293
+ for (let at = 0;at < args.length; at++) {
23294
+ const arg = args[at];
23295
+ if (!arg.startsWith("-") || arg === "-") {
23296
+ operands.push(arg);
23297
+ continue;
23298
+ }
23299
+ const eq = arg.startsWith("--") ? arg.indexOf("=") : -1;
23300
+ const flag = eq > 0 ? arg.slice(0, eq) : arg;
23301
+ if (!QUIET.test(flag))
23302
+ return gap(`\`${flag}\``);
23303
+ if (eq < 0 && VALUE.has(flag))
23304
+ at++;
23305
+ }
23306
+ const [issue, ...rest] = operands.slice(2);
23307
+ if (issue === undefined || !ISSUE.test(issue))
23308
+ return gap("the issue, which must be one id like ABC-123");
23309
+ if (verb === "attach") {
23310
+ if (!rest.length)
23311
+ return gap("an attach with no file");
23312
+ const odd = rest.find((file) => file === "-" || EXPANDS.test(file));
23313
+ if (odd !== undefined)
23314
+ return gap(`the file \`${odd}\`, which the shell expands or reads from standard input`);
23315
+ return mapped({ issue, attach: rest });
23316
+ }
23317
+ if (rest.length !== 1 || !rest[0].trim())
23318
+ return gap("a command that is not one quoted word (`ytrack issue command X-1 'State Done'`)");
23319
+ if (/[$`]/.test(rest[0]))
23320
+ return gap("a command the shell expands when it runs");
23321
+ return mapped({ issue, command: rest[0].trim() });
23322
+ };
23323
+ var mapApi = (args, target) => {
23324
+ const where = /^\/?(?:api\/)?issues\/([A-Z][A-Z0-9_]*-\d+)\/(comments|attachments)\/?(?:\?.*)?$/u.exec(target);
23325
+ if (!where)
23326
+ return null;
23327
+ const [, issue, kind] = where;
23328
+ const fields = [];
23329
+ for (let at = 0;at < args.length; at++) {
23330
+ const arg = args[at];
23331
+ if (!arg.startsWith("-"))
23332
+ continue;
23333
+ const eq = arg.startsWith("--") ? arg.indexOf("=") : -1;
23334
+ const glued = /^-[fFX]./.test(arg) && !arg.startsWith("--");
23335
+ const flag = glued ? arg.slice(0, 2) : eq > 0 ? arg.slice(0, eq) : arg;
23336
+ const value = glued ? arg.slice(2) : eq > 0 ? arg.slice(eq + 1) : VALUE.has(flag) ? args[++at] : undefined;
23337
+ if (QUIET.test(flag))
23338
+ continue;
23339
+ if (/^(?:-X|--method)$/.test(flag)) {
23340
+ if (!/^=?post$/i.test(value ?? ""))
23341
+ return gap(`\`${flag} ${value ?? ""}\``);
23342
+ continue;
23343
+ }
23344
+ if (/^(?:-H|--header)$/.test(flag) && /^(?:content-type|accept)\s*:/i.test(value ?? ""))
23345
+ continue;
23346
+ if (!/^(?:-f|-F|--field|--raw-field)$/.test(flag) || value === undefined)
23347
+ return gap(`\`${flag}\``);
23348
+ const split = value.indexOf("=");
23349
+ if (split <= 0)
23350
+ return gap(`the field \`${value}\``);
23351
+ fields.push({
23352
+ typed: flag === "-F" || flag === "--field",
23353
+ key: value.slice(0, split),
23354
+ value: value.slice(split + 1)
23355
+ });
23356
+ }
23357
+ if (fields.some((field) => /[$`]/.test(field.value)))
23358
+ return gap("a field value the shell expands when it runs");
23359
+ if (kind === "comments") {
23360
+ const [field, ...more] = fields;
23361
+ if (!field || more.length || field.key !== "text")
23362
+ return gap("a comment body other than one `text` field");
23363
+ if (field.typed && field.value.startsWith("@")) {
23364
+ const file = field.value.slice(1);
23365
+ if (!file || file === "-" || EXPANDS.test(file))
23366
+ return gap(`the file \`${file}\``);
23367
+ return mapped({ issue, file });
23368
+ }
23369
+ return field.value.trim() ? mapped({ issue, markdown: field.value }) : gap("an empty `text`");
23370
+ }
23371
+ const files = fields.map((field) => field.typed && field.value.startsWith("@") ? field.value.slice(1) : null);
23372
+ if (!files.length || files.some((file) => !file || file === "-" || EXPANDS.test(file)))
23373
+ return gap("an upload other than `-F <name>=@<file>` fields");
23374
+ return mapped({ issue, attach: files });
23235
23375
  };
23236
23376
  var UNCOVERED = { workit: null, gap: "" };
23237
23377
  var classify = (args) => {
@@ -23246,11 +23386,12 @@ var judge = (args, words) => {
23246
23386
  const verb = words[1] ?? "";
23247
23387
  if (group === "api") {
23248
23388
  const methods = args.flatMap((arg, at) => /^(?:-X|--method)$/.test(arg) ? [{ value: args[at + 1] ?? "", alone: standsAlone(args, at) }] : /^(?:-X.|--method=)/.test(arg) ? [{ value: arg.replace(/^(?:-X=?|--method=)/, ""), alone: standsAlone(args, at) }] : []);
23389
+ const posts = methods.length > 0 && methods.every((method) => /^post$/i.test(method.value));
23249
23390
  if (methods.some((method) => ASKS.test(method.value)))
23250
- return UNCOVERED;
23391
+ return (posts ? mapApi(args, words[1] ?? "") : null) ?? UNCOVERED;
23251
23392
  if (methods.some((method) => method.alone))
23252
23393
  return null;
23253
- return args.some((a) => BODY.test(a)) ? UNCOVERED : null;
23394
+ return args.some((a) => BODY.test(a)) ? mapApi(args, words[1] ?? "") ?? UNCOVERED : null;
23254
23395
  }
23255
23396
  if (group === "work-item" && /^(?:add|create)$/.test(verb))
23256
23397
  return mapWrite("time", args);
@@ -23263,7 +23404,9 @@ var judge = (args, words) => {
23263
23404
  if (verb === "create")
23264
23405
  return mapWrite("create", args);
23265
23406
  if (verb === "command")
23266
- return flagged(args, /^--dry-run$/) ? null : UNCOVERED;
23407
+ return flagged(args, /^--dry-run$/) ? null : mapIssueWrite("command", args);
23408
+ if (verb === "attach")
23409
+ return mapIssueWrite("attach", args);
23267
23410
  return /^(?:edit|update|delete|rm)$/.test(verb) ? UNCOVERED : null;
23268
23411
  };
23269
23412
  var SHELLS3 = /^(?:sh|bash|zsh|dash|ksh|ash|mksh|yash|fish)$/;
@@ -23341,7 +23484,10 @@ var passed = (words) => {
23341
23484
  };
23342
23485
  var plainLines = (command, dialect) => {
23343
23486
  let first = null;
23487
+ const chain = [];
23344
23488
  const later = [];
23489
+ let chaining = !command.includes("||");
23490
+ let piped = false;
23345
23491
  for (const segment of segmentsOf(command, dialect)) {
23346
23492
  if (segment.group || segment.unanalyzable || segment.subs?.length)
23347
23493
  return null;
@@ -23354,10 +23500,32 @@ var plainLines = (command, dialect) => {
23354
23500
  if (!names || segment.expands?.length)
23355
23501
  return null;
23356
23502
  first = passed(segment.words);
23357
- } else if (names)
23358
- later.push(segment.words);
23503
+ chaining &&= name2(first[0]) === "ytrack";
23504
+ } else {
23505
+ const words = passed(segment.words);
23506
+ chaining &&= !piped && !segment.expands?.length && !segment.stdin?.length && !segment.inputs?.length && name2(words[0]) === "ytrack";
23507
+ if (chaining)
23508
+ chain.push(words);
23509
+ else if (names)
23510
+ later.push(segment.words);
23511
+ }
23512
+ piped = segment.pipe === true;
23359
23513
  }
23360
- return first ? { first, later } : null;
23514
+ return first ? { first, chain, later } : null;
23515
+ };
23516
+ var chained = (first, chain, depth) => {
23517
+ if (first.length !== 1 || !first[0].effect || !chain.length)
23518
+ return null;
23519
+ const found = [...first];
23520
+ for (const line of chain)
23521
+ ytrackArgs(line, found, depth, new Map, true);
23522
+ const effects = found.flatMap((write) => write.effect ? [write.effect] : []);
23523
+ if (effects.length !== found.length)
23524
+ return null;
23525
+ const effect = combine(effects);
23526
+ if (!effect)
23527
+ return null;
23528
+ return [{ command: found.map((write) => write.command).join(" && "), ...mapped(effect) }];
23361
23529
  };
23362
23530
  var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
23363
23531
  if (!namesYtrack(command))
@@ -23371,7 +23539,11 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
23371
23539
  let found = [];
23372
23540
  const lines = plain ? plainLines(command, dialect) : null;
23373
23541
  const none = new Map;
23374
- if (!lines || !ytrackArgs(lines.first, found, depth, none, true) || !lines.later.every((line) => ytrackArgs(line, found, depth, none, false))) {
23542
+ const plainFirst = lines ? ytrackArgs(lines.first, found, depth, none, true) : false;
23543
+ const joined = lines && plainFirst ? chained(found, lines.chain, depth) : null;
23544
+ if (joined)
23545
+ found = joined;
23546
+ if (!lines || !plainFirst || !(joined ? [] : lines.chain).every((line) => ytrackArgs(line, found, depth, none, false)) || !lines.later.every((line) => ytrackArgs(line, found, depth, none, false))) {
23375
23547
  found = [];
23376
23548
  for (const line of commandLines(command, dialect))
23377
23549
  ytrackArgs(line, found, depth, aliases(command), false);
@@ -102,7 +102,7 @@ if (quiet) {
102
102
  `);
103
103
  } else {
104
104
  try {
105
- const { runCodexHook } = await import("./workit-hook-ct8jhghw.js");
105
+ const { runCodexHook } = await import("./workit-hook-me7q23hj.js");
106
106
  await runCodexHook([payload]);
107
107
  } catch (error) {
108
108
  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": "1.9.3",
3
+ "version": "1.11.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": "^1.9.3",
45
- "@workit-dev/mcp": "^1.9.3"
44
+ "@workit-dev/core": "^1.11.0",
45
+ "@workit-dev/mcp": "^1.11.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"