@brainervirus/workit-codex 1.3.0 → 1.3.1

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.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -14904,7 +14904,47 @@ function operationJsonSchema(family) {
14904
14904
  return toJSONSchema(operationSchemas[family], { target: "draft-2020-12" });
14905
14905
  }
14906
14906
  var OPERATION_SCHEMA_DEPTH = 1;
14907
- var canonicalFieldsDescription = (fields) => `Canonical object fields: ${fields.join(", ")}. Workit validates the complete nested value.`;
14907
+ var schemaShapeDescription = (value, depth = 0) => {
14908
+ if (!value || typeof value !== "object")
14909
+ return "value";
14910
+ const schema = value;
14911
+ if (Array.isArray(schema.oneOf) || Array.isArray(schema.anyOf)) {
14912
+ const options = Array.isArray(schema.oneOf) ? schema.oneOf : schema.anyOf;
14913
+ return `(${options.map((option) => schemaShapeDescription(option, depth)).join("|")})`;
14914
+ }
14915
+ if (schema.const !== undefined)
14916
+ return `=${JSON.stringify(schema.const)}`;
14917
+ if (Array.isArray(schema.enum))
14918
+ return `[${schema.enum.map(String).join("|")}]`;
14919
+ const type = Array.isArray(schema.type) ? schema.type.join("/") : schema.type;
14920
+ if (type === "array")
14921
+ return `arr<${schemaShapeDescription(schema.items, depth)}>`;
14922
+ if (type === "object" && schema.properties && typeof schema.properties === "object") {
14923
+ if (depth >= 2)
14924
+ return "obj";
14925
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
14926
+ const properties = schema.properties;
14927
+ const fields = Object.entries(properties).map(([name, child]) => `${name}${required.has(name) ? "!" : ""}:${schemaShapeDescription(child, depth + 1)}`);
14928
+ return `obj{${fields.join(",")}}`;
14929
+ }
14930
+ if (typeof type !== "string")
14931
+ return "?";
14932
+ return type.split("/").map((part) => ({ string: "str", boolean: "bool", number: "num", null: "null" })[part] ?? part).join("|");
14933
+ };
14934
+ var canonicalFieldsDescription = (value) => {
14935
+ if (Array.isArray(value))
14936
+ return `Canonical object fields: ${value.join(", ")}. Workit validates the complete nested value.`;
14937
+ const isZodType = (schema) => ("_zod" in schema) && typeof schema._zod === "object";
14938
+ const schema = isZodType(value) ? toJSONSchema(value, { target: "draft-2020-12" }) : value;
14939
+ if (!schema.properties || typeof schema.properties !== "object") {
14940
+ const variants = Array.isArray(schema.oneOf) ? schema.oneOf : Array.isArray(schema.anyOf) ? schema.anyOf : null;
14941
+ return variants ? `Canonical shapes: ${variants.map((variant) => schemaShapeDescription(variant)).join(" | ")}. Full nested value is validated.` : "Canonical nested value; Workit validates the complete value.";
14942
+ }
14943
+ const properties = schema.properties;
14944
+ const required = new Set(Array.isArray(schema.required) ? schema.required : []);
14945
+ const fields = Object.entries(properties).map(([name, child]) => `${name}${required.has(name) ? "!" : ""}:${schemaShapeDescription(child)}`);
14946
+ return `Fields (! required): ${fields.join(", ")}. Full nested value is validated.`;
14947
+ };
14908
14948
  function boundedOperationJsonSchema(family, maxDepth = OPERATION_SCHEMA_DEPTH, stringifiedObjects = false) {
14909
14949
  const tolerate = (projected) => {
14910
14950
  if (!stringifiedObjects)
@@ -14928,9 +14968,10 @@ function boundedOperationJsonSchema(family, maxDepth = OPERATION_SCHEMA_DEPTH, s
14928
14968
  return node;
14929
14969
  const record = node;
14930
14970
  if (record.properties && typeof record.properties === "object") {
14931
- const fields = Object.keys(record.properties);
14971
+ const properties = record.properties;
14972
+ const fields = Object.keys(properties);
14932
14973
  if (currentDepth >= maxDepth || fields.length === 0) {
14933
- const description = stringifiedObjects ? `${canonicalFieldsDescription(fields)} A JSON-encoded string is also accepted.` : canonicalFieldsDescription(fields);
14974
+ const description = stringifiedObjects ? `${canonicalFieldsDescription(record)} A JSON-encoded string is also accepted.` : canonicalFieldsDescription(record);
14934
14975
  return tolerate({ type: "object", description });
14935
14976
  }
14936
14977
  return tolerate({
@@ -17222,6 +17263,28 @@ var canonicalGlob = (glob) => {
17222
17263
  const real = realpathOf(prefix.replace(/\/+$/, "") || "/");
17223
17264
  return real + (prefix.endsWith("/") ? "/" : "") + rest;
17224
17265
  };
17266
+ var globSpecificity = (glob) => glob.replaceAll("\\", "/").split("/").filter((segment) => segment.length > 0 && !/[*?[\]{]/.test(segment)).length;
17267
+ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
17268
+ if (workspaceName !== undefined) {
17269
+ const named = matches.filter((entry) => entry.name === workspaceName);
17270
+ if (named.length === 1)
17271
+ return named[0];
17272
+ if (named.length > 1)
17273
+ throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
17274
+ if (matches.length > 0) {
17275
+ throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
17276
+ }
17277
+ throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
17278
+ }
17279
+ if (matches.length < 2)
17280
+ return matches[0];
17281
+ const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
17282
+ const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
17283
+ if (mostSpecific.length > 1) {
17284
+ throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
17285
+ }
17286
+ return mostSpecific[0];
17287
+ };
17225
17288
  var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
17226
17289
  const result = readWorkspacesResult(dir);
17227
17290
  if (result.status === "malformed" || result.status === "invalid")
@@ -17241,20 +17304,7 @@ var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
17241
17304
  if (matched)
17242
17305
  matches.push(ws);
17243
17306
  }
17244
- if (workspaceName !== undefined) {
17245
- const selected = matches.find((ws) => ws.name === workspaceName);
17246
- if (!selected && matches.length > 0) {
17247
- const matchingNames = matches.map((ws) => ws.name);
17248
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matchingNames.join(", ")}`);
17249
- }
17250
- if (selected)
17251
- return selected;
17252
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
17253
- }
17254
- if (matches.length > 1) {
17255
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${matches.map((ws) => ws.name).join(", ")}`);
17256
- }
17257
- return matches[0] ?? null;
17307
+ return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
17258
17308
  };
17259
17309
  var runtimeWorkspacePolicySchema = (kind) => {
17260
17310
  const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
@@ -17311,21 +17361,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
17311
17361
  return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
17312
17362
  });
17313
17363
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
17314
- let selected;
17315
- if (workspaceName) {
17316
- const named = matches.filter((entry) => entry.name === workspaceName);
17317
- if (named.length === 1)
17318
- selected = named[0];
17319
- else if (named.length > 1)
17320
- throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
17321
- else if (matches.length)
17322
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
17323
- else
17324
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
17325
- } else if (matches.length > 1)
17326
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${matches.map((entry) => entry.name).join(", ")}`);
17327
- else
17328
- selected = matches[0];
17364
+ const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
17329
17365
  if (!selected)
17330
17366
  return null;
17331
17367
  const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
@@ -19254,6 +19290,7 @@ function resolveRequirements(input) {
19254
19290
  dependentAction: null,
19255
19291
  acceptanceAllowed: false
19256
19292
  }));
19293
+ const independentBehaviorReview = input.preferences?.thorough === true || input.assessment.consequences.some((consequence) => ["security", "data", "public_contract", "operations"].includes(consequence.area));
19257
19294
  if (signals.behaviorChange.value === true)
19258
19295
  requirements.push(requirement({
19259
19296
  ruleId: "behavioral-verification",
@@ -19265,14 +19302,14 @@ function resolveRequirements(input) {
19265
19302
  dependentAction: null,
19266
19303
  acceptanceAllowed: false
19267
19304
  }), requirement({
19268
- ruleId: "fresh-context-review",
19305
+ ruleId: independentBehaviorReview ? "fresh-context-review" : "self-review",
19269
19306
  dimension: "review",
19270
19307
  scope,
19271
- reason: "A non-mechanical behavior change requires fresh-context review.",
19272
- satisfaction: "A separate review context examines the current candidate and records its result.",
19308
+ reason: independentBehaviorReview ? "Consequential behavior or the thorough preference requires fresh-context review." : "Bounded behavior changes use self-review unless consequential risks or trusted rules require more.",
19309
+ satisfaction: independentBehaviorReview ? "A separate review context examines the current candidate and records its result." : "The lead reviews the resulting diff and records the relevant scope and checks.",
19273
19310
  before: "close",
19274
19311
  dependentAction: null,
19275
- acceptanceAllowed: false
19312
+ acceptanceAllowed: !independentBehaviorReview
19276
19313
  }));
19277
19314
  else if (signals.mechanicalLowRisk.value === true)
19278
19315
  requirements.push(requirement({
@@ -10300,6 +10300,28 @@ var canonicalGlob = (glob) => {
10300
10300
  const real = realpathOf(prefix.replace(/\/+$/, "") || "/");
10301
10301
  return real + (prefix.endsWith("/") ? "/" : "") + rest;
10302
10302
  };
10303
+ var globSpecificity = (glob) => glob.replaceAll("\\", "/").split("/").filter((segment) => segment.length > 0 && !/[*?[\]{]/.test(segment)).length;
10304
+ var selectWorkspaceMatch = (matches, cwd, workspaceName) => {
10305
+ if (workspaceName !== undefined) {
10306
+ const named = matches.filter((entry) => entry.name === workspaceName);
10307
+ if (named.length === 1)
10308
+ return named[0];
10309
+ if (named.length > 1)
10310
+ throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
10311
+ if (matches.length > 0) {
10312
+ throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
10313
+ }
10314
+ throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
10315
+ }
10316
+ if (matches.length < 2)
10317
+ return matches[0];
10318
+ const highestSpecificity = Math.max(...matches.map((entry) => globSpecificity(entry.glob)));
10319
+ const mostSpecific = matches.filter((entry) => globSpecificity(entry.glob) === highestSpecificity);
10320
+ if (mostSpecific.length > 1) {
10321
+ throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${mostSpecific.map((entry) => entry.name).join(", ")}`);
10322
+ }
10323
+ return mostSpecific[0];
10324
+ };
10303
10325
  var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
10304
10326
  const result = readWorkspacesResult(dir);
10305
10327
  if (result.status === "malformed" || result.status === "invalid")
@@ -10319,20 +10341,7 @@ var resolveWorkspaceFrom = (cwd, dir, workspaceName) => {
10319
10341
  if (matched)
10320
10342
  matches.push(ws);
10321
10343
  }
10322
- if (workspaceName !== undefined) {
10323
- const selected = matches.find((ws) => ws.name === workspaceName);
10324
- if (!selected && matches.length > 0) {
10325
- const matchingNames = matches.map((ws) => ws.name);
10326
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matchingNames.join(", ")}`);
10327
- }
10328
- if (selected)
10329
- return selected;
10330
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
10331
- }
10332
- if (matches.length > 1) {
10333
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${matches.map((ws) => ws.name).join(", ")}`);
10334
- }
10335
- return matches[0] ?? null;
10344
+ return selectWorkspaceMatch(matches, cwd, workspaceName) ?? null;
10336
10345
  };
10337
10346
  var runtimeWorkspacePolicySchema = (kind) => {
10338
10347
  const key = kind === "branch" ? "branchPolicy" : kind === "commit" ? "commitPolicy" : "vcs";
@@ -10389,21 +10398,7 @@ var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
10389
10398
  return targets.some((target) => matchWorkspace(glob, target) || canonical !== glob && matchWorkspace(canonical, target));
10390
10399
  });
10391
10400
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
10392
- let selected;
10393
- if (workspaceName) {
10394
- const named = matches.filter((entry) => entry.name === workspaceName);
10395
- if (named.length === 1)
10396
- selected = named[0];
10397
- else if (named.length > 1)
10398
- throw new Error(`ambiguous workspace ${JSON.stringify(workspaceName)} for ${cwd}`);
10399
- else if (matches.length)
10400
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}; matching choices: ${matches.map((entry) => entry.name).join(", ")}`);
10401
- else
10402
- throw new Error(`workspace ${JSON.stringify(workspaceName)} does not match ${cwd}`);
10403
- } else if (matches.length > 1)
10404
- throw new Error(`ambiguous workspace for ${cwd}; choose one of: ${matches.map((entry) => entry.name).join(", ")}`);
10405
- else
10406
- selected = matches[0];
10401
+ const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
10407
10402
  if (!selected)
10408
10403
  return null;
10409
10404
  const policy = runtimeWorkspacePolicySchema(kind).safeParse(selected);
@@ -11903,6 +11898,15 @@ need zero Workit task, assessment, or writer calls. Use one compact tracked
11903
11898
  record only when handoff, dependent steps, concurrent actors, or meaningful
11904
11899
  decisions make continuity useful; similar titles alone never merge tasks.
11905
11900
 
11901
+ For a routine user-authorized branch or commit, prefer native host Git/shell
11902
+ tools from the outset when managed coordination or outcome reconciliation is
11903
+ not needed. Inspect the actual target checkout and its configured conventions;
11904
+ use Workit's read-only context/policy tools when needed. Do not start a task,
11905
+ acquire a writer, or mint a decision receipt solely for a native Git action.
11906
+ Native permissions still apply. Never switch execution paths to evade a denial
11907
+ or repeat an uncertain managed effect. A local-commit endpoint does not imply
11908
+ PR readiness, a fresh review, or post-commit assessment/closure paperwork.
11909
+
11906
11910
  For tracked work, inspect its current state and use the shared operations for
11907
11911
  task, policy, evidence, finding, decision, worker, writer, and state changes.
11908
11912
  Start a record once for an explicit tracked objective; assess or reassess only
@@ -12355,6 +12359,7 @@ function resolveRequirements(input) {
12355
12359
  dependentAction: null,
12356
12360
  acceptanceAllowed: false
12357
12361
  }));
12362
+ const independentBehaviorReview = input.preferences?.thorough === true || input.assessment.consequences.some((consequence) => ["security", "data", "public_contract", "operations"].includes(consequence.area));
12358
12363
  if (signals.behaviorChange.value === true)
12359
12364
  requirements.push(requirement({
12360
12365
  ruleId: "behavioral-verification",
@@ -12366,14 +12371,14 @@ function resolveRequirements(input) {
12366
12371
  dependentAction: null,
12367
12372
  acceptanceAllowed: false
12368
12373
  }), requirement({
12369
- ruleId: "fresh-context-review",
12374
+ ruleId: independentBehaviorReview ? "fresh-context-review" : "self-review",
12370
12375
  dimension: "review",
12371
12376
  scope,
12372
- reason: "A non-mechanical behavior change requires fresh-context review.",
12373
- satisfaction: "A separate review context examines the current candidate and records its result.",
12377
+ reason: independentBehaviorReview ? "Consequential behavior or the thorough preference requires fresh-context review." : "Bounded behavior changes use self-review unless consequential risks or trusted rules require more.",
12378
+ satisfaction: independentBehaviorReview ? "A separate review context examines the current candidate and records its result." : "The lead reviews the resulting diff and records the relevant scope and checks.",
12374
12379
  before: "close",
12375
12380
  dependentAction: null,
12376
- acceptanceAllowed: false
12381
+ acceptanceAllowed: !independentBehaviorReview
12377
12382
  }));
12378
12383
  else if (signals.mechanicalLowRisk.value === true)
12379
12384
  requirements.push(requirement({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-codex",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "private": false,
5
5
  "description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, and fourteen method skills",
6
6
  "keywords": [
@@ -38,8 +38,8 @@
38
38
  "build": "bun scripts/build.ts"
39
39
  },
40
40
  "dependencies": {
41
- "@brainervirus/workit-core": "^1.3.0",
42
- "@brainervirus/workit-mcp": "^1.3.0"
41
+ "@brainervirus/workit-core": "^1.3.1",
42
+ "@brainervirus/workit-mcp": "^1.3.1"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=24"