@fro.bot/systematic 3.16.4 → 3.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/dist/cli.js CHANGED
@@ -33,7 +33,7 @@ import {
33
33
  findCommandsInDir,
34
34
  findSkillsInDir,
35
35
  discoverSkills
36
- } from "./index-65g87tgr.js";
36
+ } from "./index-y33enbkc.js";
37
37
  var __defProp = Object.defineProperty;
38
38
  var __returnValue = (v) => v;
39
39
  function __exportSetter(name, newValue) {
@@ -197,7 +197,8 @@ function readOpencodeLayerField(agentOverlay, categoryOverlay, layer, field) {
197
197
  }
198
198
  function resolveOpencodeModelAndVariant(agentOverlay, categoryOverlay) {
199
199
  const modelLayerIndex = OPENCODE_MODEL_VARIANT_LAYERS.findIndex((layer) => readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "model") !== undefined);
200
- const rawModel = modelLayerIndex === -1 ? undefined : readOpencodeLayerField(agentOverlay, categoryOverlay, OPENCODE_MODEL_VARIANT_LAYERS[modelLayerIndex], "model");
200
+ const modelLayer = modelLayerIndex === -1 ? undefined : OPENCODE_MODEL_VARIANT_LAYERS[modelLayerIndex];
201
+ const rawModel = modelLayer === undefined ? undefined : readOpencodeLayerField(agentOverlay, categoryOverlay, modelLayer, "model");
201
202
  const model = narrowModelValue(rawModel);
202
203
  const hasModel = model !== undefined;
203
204
  const modelSource = hasModel ? OPENCODE_MODEL_VARIANT_LAYERS[modelLayerIndex] : undefined;
@@ -205,8 +206,7 @@ function resolveOpencodeModelAndVariant(agentOverlay, categoryOverlay) {
205
206
  let qualifierSource;
206
207
  if (model !== null) {
207
208
  const eligibleLayerCount = hasModel ? modelLayerIndex + 1 : OPENCODE_MODEL_VARIANT_LAYERS.length;
208
- for (let i = 0;i < eligibleLayerCount; i++) {
209
- const layer = OPENCODE_MODEL_VARIANT_LAYERS[i];
209
+ for (const layer of OPENCODE_MODEL_VARIANT_LAYERS.slice(0, eligibleLayerCount)) {
210
210
  const narrowed = narrowQualifierValue(readOpencodeLayerField(agentOverlay, categoryOverlay, layer, "variant"));
211
211
  if (narrowed !== undefined) {
212
212
  qualifier = narrowed;
@@ -1761,6 +1761,7 @@ var BUNDLED_SKILL_NAMES = [
1761
1761
  "ce:ideate",
1762
1762
  "ce:plan",
1763
1763
  "ce:review",
1764
+ "ce:review-cleanup",
1764
1765
  "ce:work",
1765
1766
  "compound-docs",
1766
1767
  "deepen-plan",
@@ -8686,8 +8687,7 @@ function parseFrontmatter(content) {
8686
8687
  parseError: false
8687
8688
  };
8688
8689
  }
8689
- const yamlContent = match[1];
8690
- const body = match[2];
8690
+ const [, yamlContent = "", body = ""] = match;
8691
8691
  try {
8692
8692
  const parsed = yaml.load(yamlContent, { schema: yaml.JSON_SCHEMA });
8693
8693
  const data = parsed ?? {};
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  extractCommandFrontmatter,
20
20
  findSkillsInDir,
21
21
  discoverSkills
22
- } from "./index-65g87tgr.js";
22
+ } from "./index-y33enbkc.js";
23
23
 
24
24
  // src/index.ts
25
25
  import { createHash as createHash4 } from "crypto";
@@ -75,14 +75,14 @@ var removeCompleteBootstrapBlocks = (entry) => {
75
75
  return result;
76
76
  };
77
77
  var applyBootstrapContent = (output, content) => {
78
- for (let i2 = 0;i2 < output.system.length; i2++) {
79
- output.system[i2] = removeCompleteBootstrapBlocks(output.system[i2]);
78
+ for (const [i2, entry] of output.system.entries()) {
79
+ output.system[i2] = removeCompleteBootstrapBlocks(entry);
80
80
  }
81
- if (output.system.length === 0) {
81
+ const [first] = output.system;
82
+ if (first === undefined) {
82
83
  output.system.push(content);
83
84
  return;
84
85
  }
85
- const first = output.system[0];
86
86
  output.system[0] = first.length > 0 ? `${first}
87
87
 
88
88
  ${content}` : content;
@@ -265,6 +265,9 @@ function parseOverlayShape(overlay, targetType) {
265
265
  return { skills: result.data.skills };
266
266
  }
267
267
  function throwOverlaySchemaError(overlay, issue) {
268
+ if (!issue) {
269
+ throwConfigError(overlay.sourcePath, overlay.keyPath, "schema validation failed");
270
+ }
268
271
  const zodPath = issue.code === "unrecognized_keys" ? issue.message.match(/"([^"]+)"/)?.[1] ?? issue.path.join(".") : issue.path.join(".");
269
272
  const fullPath = zodPath ? `${overlay.keyPath}.${zodPath}` : overlay.keyPath;
270
273
  throwConfigError(overlay.sourcePath, fullPath, issue.message);
@@ -332,7 +335,8 @@ $ARGUMENTS
332
335
  }
333
336
  function extractSkillBody(wrappedTemplate) {
334
337
  const match = wrappedTemplate.match(/<skill-instruction>([\s\S]*?)<\/skill-instruction>/);
335
- return match ? match[1].trim() : wrappedTemplate;
338
+ const [, body2] = match ?? [];
339
+ return body2 !== undefined ? body2.trim() : wrappedTemplate;
336
340
  }
337
341
  function loadSkill(skillInfo) {
338
342
  try {
@@ -956,7 +960,8 @@ function readGitfileTarget(gitfilePath, realPath = fs6.realpathSync) {
956
960
  const match = /^gitdir:\s*(.+?)\s*$/im.exec(contents);
957
961
  if (!match)
958
962
  return;
959
- const target = path5.isAbsolute(match[1]) ? match[1] : path5.resolve(path5.dirname(gitfilePath), match[1]);
963
+ const [, gitdirTarget = ""] = match;
964
+ const target = path5.isAbsolute(gitdirTarget) ? gitdirTarget : path5.resolve(path5.dirname(gitfilePath), gitdirTarget);
960
965
  return canonicalPath(target, realPath);
961
966
  }
962
967
  function readGitdirBacklink(backlinkPath, realPath) {
@@ -7869,7 +7874,7 @@ function parseCommand(node) {
7869
7874
  const commandName = node.childForFieldName("name");
7870
7875
  if (commandName?.type !== "command_name")
7871
7876
  return;
7872
- const executable = parsePlainToken(commandName.namedChildren[0]);
7877
+ const executable = parsePlainToken(commandName.namedChildren[0] ?? null);
7873
7878
  if (!executable)
7874
7879
  return;
7875
7880
  if (!hasSafeCommandChildren(node))
@@ -7936,13 +7941,14 @@ function containsDynamicSyntax(node) {
7936
7941
  return false;
7937
7942
  }
7938
7943
  function classifyCommands(commands) {
7939
- if (commands.length === 0)
7944
+ const lastCommand = commands.at(-1);
7945
+ if (lastCommand === undefined)
7940
7946
  return;
7941
7947
  for (const prefix of commands.slice(0, -1)) {
7942
7948
  if (!isAllowedPrefix(prefix))
7943
7949
  return;
7944
7950
  }
7945
- return classifyFinalCommand(commands[commands.length - 1]);
7951
+ return classifyFinalCommand(lastCommand);
7946
7952
  }
7947
7953
  function isAllowedPrefix(command) {
7948
7954
  return PREFIX_COMMANDS.has(command.executable) && command.arguments.length === 1 && isSafeRelativeCwd(command.arguments[0] ?? "");
@@ -8015,7 +8021,7 @@ function isDestructivePushArgument(value) {
8015
8021
  function classifyGhCommand(args2) {
8016
8022
  if (args2[0] !== "pr")
8017
8023
  return;
8018
- if (args2.length === 6 && args2[1] === "create" && args2[2] === "--title" && args2[3]?.length > 0 && args2[4] === "--body" && args2[5]?.length > 0 && !isEmptyShellString(args2[3]) && !isEmptyShellString(args2[5])) {
8024
+ if (args2.length === 6 && args2[1] === "create" && args2[2] === "--title" && (args2[3]?.length ?? 0) > 0 && args2[4] === "--body" && (args2[5]?.length ?? 0) > 0 && !isEmptyShellString(args2[3]) && !isEmptyShellString(args2[5])) {
8019
8025
  return "pr-creation";
8020
8026
  }
8021
8027
  if (args2.length === 3 && args2[1] === "checks" && isPullRequestNumber(args2[2]))
@@ -10726,8 +10732,7 @@ function canonicalPatchText(patchText, sessionLocation) {
10726
10732
  if (patchTextFileTargets(patchText) === undefined)
10727
10733
  return;
10728
10734
  const segments = patchText.split(/(\r?\n)/);
10729
- for (let index = 0;index < segments.length; index += 1) {
10730
- const line = segments[index];
10735
+ for (const [index, line] of segments.entries()) {
10731
10736
  if (line === `
10732
10737
  ` || line === `\r
10733
10738
  `)
@@ -11776,6 +11781,15 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11776
11781
  }
11777
11782
  return source;
11778
11783
  }
11784
+ function withoutStaleConditionalMetadata(existingMetadata) {
11785
+ if (!("questionAttestation" in existingMetadata))
11786
+ return existingMetadata;
11787
+ if (existingMetadata.sourceDigest !== currentMarkerSource().source) {
11788
+ return existingMetadata;
11789
+ }
11790
+ const { questionAttestation: _stale, ...rest } = existingMetadata;
11791
+ return rest;
11792
+ }
11779
11793
  function metadata2() {
11780
11794
  const source = currentMarkerSource();
11781
11795
  const result = {
@@ -11821,7 +11835,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11821
11835
  output.title = "Workflow unit started";
11822
11836
  output.output = JSON.stringify({ status: "started" });
11823
11837
  output.metadata = {
11824
- ...existingMetadata,
11838
+ ...withoutStaleConditionalMetadata(existingMetadata),
11825
11839
  ...metadata2(),
11826
11840
  workflowGuard: { status: "started" }
11827
11841
  };
@@ -11834,7 +11848,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11834
11848
  reasonCode
11835
11849
  });
11836
11850
  output.metadata = {
11837
- ...existingMetadata,
11851
+ ...withoutStaleConditionalMetadata(existingMetadata),
11838
11852
  ...metadata2(),
11839
11853
  workflowGuard: {
11840
11854
  status: "rejected",
@@ -11842,46 +11856,49 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
11842
11856
  }
11843
11857
  };
11844
11858
  }
11845
- function writeCompletionResult(output, result, target) {
11859
+ function targetMetadataField(target) {
11860
+ return target ? { target } : {};
11861
+ }
11862
+ function writeSuccessfulCompletionResult(output, target) {
11846
11863
  if (!isRecord7(output))
11847
11864
  return;
11848
11865
  const existingMetadata = isRecord7(output.metadata) ? output.metadata : {};
11849
- if (result.status === "completed" || result.status === "duplicate") {
11850
- output.title = "Workflow transition completed";
11851
- output.output = `workflow guard completed ${target}`;
11852
- output.metadata = {
11853
- ...existingMetadata,
11854
- ...metadata2(),
11855
- workflowGuard: { status: "completed", target }
11856
- };
11866
+ output.title = "Workflow transition completed";
11867
+ output.output = `workflow guard completed ${target}`;
11868
+ output.metadata = {
11869
+ ...withoutStaleConditionalMetadata(existingMetadata),
11870
+ ...metadata2(),
11871
+ workflowGuard: { status: "completed", target }
11872
+ };
11873
+ }
11874
+ function writeTerminalCompletionResult(output, result, target) {
11875
+ if (!isRecord7(output))
11857
11876
  return;
11858
- }
11859
- const reasonCode = "reasonCode" in result ? result.reasonCode : "guard-unavailable";
11860
- const resultStatus = result.status === "waiting" ? "unavailable" : result.status;
11877
+ const existingMetadata = isRecord7(output.metadata) ? output.metadata : {};
11861
11878
  output.title = "Workflow transition unavailable";
11862
11879
  output.output = JSON.stringify({
11863
- status: resultStatus,
11864
- reasonCode
11880
+ status: result.status,
11881
+ reasonCode: result.reasonCode
11865
11882
  });
11866
11883
  output.metadata = {
11867
- ...existingMetadata,
11884
+ ...withoutStaleConditionalMetadata(existingMetadata),
11868
11885
  ...metadata2(),
11869
11886
  workflowGuard: {
11870
- status: resultStatus,
11871
- target,
11872
- reasonCode
11887
+ status: result.status,
11888
+ ...targetMetadataField(target),
11889
+ reasonCode: result.reasonCode
11873
11890
  }
11874
11891
  };
11875
11892
  }
11876
11893
  function writeAbandonedCompletionResult(output, target, reasonCode) {
11877
- writeCompletionResult(output, { target, status: "unavailable", reasonCode }, target);
11894
+ writeTerminalCompletionResult(output, { target, status: "unavailable", reasonCode }, target);
11878
11895
  }
11879
11896
  function writeAbandonedCompletionMetadata(output, target, reasonCode) {
11880
11897
  if (!isRecord7(output))
11881
11898
  return;
11882
11899
  const existingMetadata = isRecord7(output.metadata) ? output.metadata : {};
11883
11900
  output.metadata = {
11884
- ...existingMetadata,
11901
+ ...withoutStaleConditionalMetadata(existingMetadata),
11885
11902
  ...metadata2(),
11886
11903
  workflowGuard: { status: "unavailable", target, reasonCode }
11887
11904
  };
@@ -12303,6 +12320,13 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12303
12320
  transitionId: pending.transitionId
12304
12321
  });
12305
12322
  writeAbandonedCompletionMetadata(output, pending.target, "failed-operation");
12323
+ abandonedCompletes.set(callDigest, pending.target);
12324
+ terminalCompletes.set(callDigest, {
12325
+ target: pending.target,
12326
+ status: "unavailable",
12327
+ reasonCode: "failed-operation",
12328
+ metadataOnly: true
12329
+ });
12306
12330
  return;
12307
12331
  }
12308
12332
  const result = guard.finalizeTransition({
@@ -12312,7 +12336,7 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12312
12336
  });
12313
12337
  if (result.status === "completed" || result.status === "duplicate") {
12314
12338
  finalizedCompletes.set(callDigest, pending);
12315
- writeCompletionResult(output, result, pending.target);
12339
+ writeSuccessfulCompletionResult(output, pending.target);
12316
12340
  return;
12317
12341
  }
12318
12342
  markUnavailable();
@@ -12324,7 +12348,14 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12324
12348
  };
12325
12349
  abandonedCompletes.set(callDigest, pending.target);
12326
12350
  terminalCompletes.set(callDigest, terminal);
12327
- writeCompletionResult(output, terminal, pending.target);
12351
+ writeTerminalCompletionResult(output, terminal, pending.target);
12352
+ }
12353
+ function writeTerminalReplay(output, terminal, target) {
12354
+ if (terminal.metadataOnly) {
12355
+ writeAbandonedCompletionMetadata(output, target, terminal.reasonCode);
12356
+ return;
12357
+ }
12358
+ writeTerminalCompletionResult(output, terminal, target);
12328
12359
  }
12329
12360
  function replayTerminalComplete(callDigest, finalTarget, output) {
12330
12361
  const questionChallengeID = blockedQuestionCalls.get(callDigest);
@@ -12335,10 +12366,15 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12335
12366
  return true;
12336
12367
  }
12337
12368
  }
12369
+ const terminal = terminalCompletes.get(callDigest);
12370
+ if (terminal?.target) {
12371
+ writeTerminalReplay(output, terminal, terminal.target);
12372
+ blockedCompletes.delete(callDigest);
12373
+ return true;
12374
+ }
12338
12375
  const replay = finalizedCompletes.get(callDigest);
12339
12376
  const abandonedTarget = abandonedCompletes.get(callDigest);
12340
12377
  const blockedTarget = blockedCompletes.get(callDigest);
12341
- const terminal = terminalCompletes.get(callDigest);
12342
12378
  const expectedTarget = replay?.target ?? abandonedTarget ?? blockedTarget;
12343
12379
  if (!expectedTarget)
12344
12380
  return false;
@@ -12348,8 +12384,6 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12348
12384
  }
12349
12385
  if (replay)
12350
12386
  replayComplete(callDigest);
12351
- if (terminal)
12352
- writeCompletionResult(output, terminal, expectedTarget);
12353
12387
  blockedCompletes.delete(callDigest);
12354
12388
  return true;
12355
12389
  }
@@ -12458,13 +12492,18 @@ function createSessionRuntime(options, operationObservers, recoveredOperationCon
12458
12492
  return readbacks;
12459
12493
  }
12460
12494
  function finishMismatchedTarget(callDigest, pending, output) {
12461
- abandonComplete(callDigest, pending, false);
12495
+ abandonComplete(callDigest, pending, true);
12496
+ terminalCompletes.set(callDigest, {
12497
+ target: pending.target,
12498
+ status: "unavailable",
12499
+ reasonCode: "invalid-transition"
12500
+ });
12462
12501
  markUnavailable();
12463
12502
  writeAbandonedCompletionResult(output, pending.target, "invalid-transition");
12464
12503
  }
12465
12504
  function finishUnreplayableComplete(finalTarget, output) {
12466
12505
  markUnavailable();
12467
- writeAbandonedCompletionResult(output, finalTarget ?? "unit", "guard-unavailable");
12506
+ writeAbandonedCompletionResult(output, finalTarget, "guard-unavailable");
12468
12507
  }
12469
12508
  function finishUnavailableReadback(callDigest, pending, output) {
12470
12509
  abandonComplete(callDigest, pending, true);
@@ -1,5 +1,5 @@
1
1
  export declare const BUNDLED_AGENT_NAMES: readonly ['adversarial-document-reviewer', 'adversarial-reviewer', 'agent-native-reviewer', 'api-contract-reviewer', 'architecture-strategist', 'best-practices-researcher', 'bug-reproduction-validator', 'cli-readiness-reviewer', 'code-simplicity-reviewer', 'coherence-reviewer', 'correctness-reviewer', 'data-migrations-reviewer', 'deployment-verification-agent', 'design-iterator', 'design-lens-reviewer', 'feasibility-reviewer', 'framework-docs-researcher', 'git-history-analyzer', 'issue-intelligence-analyst', 'kieran-typescript-reviewer', 'learnings-researcher', 'maintainability-reviewer', 'pattern-recognition-specialist', 'performance-reviewer', 'pr-comment-resolver', 'previous-comments-reviewer', 'product-lens-reviewer', 'project-standards-reviewer', 'reliability-reviewer', 'repo-research-analyst', 'scope-guardian-reviewer', 'security-lens-reviewer', 'security-reviewer', 'slack-researcher', 'spec-flow-analyzer', 'systematic-implementer', 'testing-reviewer'];
2
2
  export declare const BUNDLED_AGENT_QUALIFIED_IDS: readonly ['design/design-iterator', 'document-review/adversarial-document-reviewer', 'document-review/coherence-reviewer', 'document-review/design-lens-reviewer', 'document-review/feasibility-reviewer', 'document-review/product-lens-reviewer', 'document-review/scope-guardian-reviewer', 'document-review/security-lens-reviewer', 'research/best-practices-researcher', 'research/framework-docs-researcher', 'research/git-history-analyzer', 'research/issue-intelligence-analyst', 'research/learnings-researcher', 'research/repo-research-analyst', 'research/slack-researcher', 'review/adversarial-reviewer', 'review/agent-native-reviewer', 'review/api-contract-reviewer', 'review/architecture-strategist', 'review/cli-readiness-reviewer', 'review/code-simplicity-reviewer', 'review/correctness-reviewer', 'review/data-migrations-reviewer', 'review/deployment-verification-agent', 'review/kieran-typescript-reviewer', 'review/maintainability-reviewer', 'review/pattern-recognition-specialist', 'review/performance-reviewer', 'review/previous-comments-reviewer', 'review/project-standards-reviewer', 'review/reliability-reviewer', 'review/security-reviewer', 'review/testing-reviewer', 'workflow/bug-reproduction-validator', 'workflow/pr-comment-resolver', 'workflow/spec-flow-analyzer', 'workflow/systematic-implementer'];
3
- export declare const BUNDLED_SKILL_NAMES: readonly ['agent-browser', 'agent-native-architecture', 'agent-native-audit', 'ce:brainstorm', 'ce:compound', 'ce:compound-refresh', 'ce:ideate', 'ce:plan', 'ce:review', 'ce:work', 'compound-docs', 'deepen-plan', 'deploy-docs', 'document-review', 'frontend-design', 'git-clean-gone-branches', 'git-commit', 'git-commit-push-pr', 'git-worktree', 'lfg', 'onboarding', 'orchestrating-subagents', 'report-bug-ce', 'reproduce-bug', 'resolve-pr-feedback', 'slfg', 'test-browser', 'test-driven-development', 'todos', 'using-systematic', 'writing-skills'];
3
+ export declare const BUNDLED_SKILL_NAMES: readonly ['agent-browser', 'agent-native-architecture', 'agent-native-audit', 'ce:brainstorm', 'ce:compound', 'ce:compound-refresh', 'ce:ideate', 'ce:plan', 'ce:review', 'ce:review-cleanup', 'ce:work', 'compound-docs', 'deepen-plan', 'deploy-docs', 'document-review', 'frontend-design', 'git-clean-gone-branches', 'git-commit', 'git-commit-push-pr', 'git-worktree', 'lfg', 'onboarding', 'orchestrating-subagents', 'report-bug-ce', 'reproduce-bug', 'resolve-pr-feedback', 'slfg', 'test-browser', 'test-driven-development', 'todos', 'using-systematic', 'writing-skills'];
4
4
  export type BundledAgentName = (typeof BUNDLED_AGENT_NAMES)[number];
5
5
  export type BundledSkillName = (typeof BUNDLED_SKILL_NAMES)[number];