@omniralph/agent 2.1.0 → 2.2.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
@@ -375,14 +375,17 @@ var DEFAULT_STALL_ROUNDS = 3;
375
375
  var DEFAULT_MAX_ITERATIONS_PER_RUN = 50;
376
376
  var CODING_MAX_FIX_ROUNDS = 20;
377
377
  var DEFAULT_FIX_ROUNDS = 3;
378
- var MAX_VERIFY_COMMANDS = 50;
378
+ var MAX_CHECKS = 50;
379
379
  var MAX_CODING_COMMAND_LENGTH = 4e3;
380
380
  var MAX_UNMERGED_BRANCH_TIMEOUT_MINUTES = 7 * 24 * 60;
381
381
  var PUSH_TIMINGS = ["per-story", "end"];
382
382
  var DRAFT_PULL_REQUEST_TIMINGS = ["early", "end"];
383
383
  var DEFAULT_PR_DESCRIPTION_TASK_ID = "builtin:describe-pr";
384
384
  var FixRounds = z6.int().min(0).max(CODING_MAX_FIX_ROUNDS);
385
- var CodingCommand = z6.string().trim().min(1).max(MAX_CODING_COMMAND_LENGTH).regex(/^[^\u0000-\u001f\u007f]+$/, "Commands are one line, without control characters.");
385
+ var CodingCommand = z6.string().trim().min(1, "Enter a command.").max(
386
+ MAX_CODING_COMMAND_LENGTH,
387
+ `Commands can be at most ${MAX_CODING_COMMAND_LENGTH.toLocaleString("en-US")} characters.`
388
+ ).regex(/^[^\u0000-\u001f\u007f]+$/, "Commands are one line, without control characters.");
386
389
  var CODING_FIELDS = {
387
390
  maxAttemptsPerStory: z6.int().min(1).max(20).optional(),
388
391
  /** Rounds of a review loop (blocked results that file follow-ups) a story gets. */
@@ -399,8 +402,6 @@ var CODING_FIELDS = {
399
402
  draftPullRequest: z6.enum(DRAFT_PULL_REQUEST_TIMINGS).optional(),
400
403
  /** Query task (accepting `run.invoked`) that writes the PR title and description. */
401
404
  prDescriptionTaskId: DefinitionId.optional(),
402
- /** Quality gates every story and request runs, before the PRD's. */
403
- verifyCommands: z6.array(CodingCommand).max(MAX_VERIFY_COMMANDS).optional(),
404
405
  /** Run once in a fresh branch worktree (e.g. `pnpm install`); null for none. */
405
406
  worktreeSetupCommand: CodingCommand.nullable().optional(),
406
407
  /** Also run the PRD's `## Quality Gates` commands. */
@@ -427,7 +428,6 @@ var CODING_DEFAULTS = {
427
428
  maxFixRounds: DEFAULT_FIX_ROUNDS,
428
429
  pushTiming: "per-story",
429
430
  prDescriptionTaskId: DEFAULT_PR_DESCRIPTION_TASK_ID,
430
- verifyCommands: [],
431
431
  worktreeSetupCommand: null,
432
432
  runPrdQualityGates: true,
433
433
  allowPreparation: true,
@@ -881,6 +881,11 @@ var VARIABLES = [
881
881
  ["story.identifier", STORY_TRIGGERS, "Tracker identifier of the story (null without one)."],
882
882
  ["story.url", STORY_TRIGGERS, "URL of the story in the tracker (null without one)."],
883
883
  ["story.title", STORY_TRIGGERS, "Title of the story, on one line."],
884
+ [
885
+ "story.kind",
886
+ STORY_TRIGGERS,
887
+ "Kind of the story: `Fix` (a bug, by the tracker's fix labels) or `Story` (new work)."
888
+ ],
884
889
  [
885
890
  "story.repository",
886
891
  STORY_TRIGGERS,
@@ -1017,8 +1022,8 @@ var VARIABLES = [
1017
1022
  "Extra instructions from the repository's settings (null without any)."
1018
1023
  ],
1019
1024
  [
1020
- "verifyCommands.items",
1021
- "A command the orchestrator runs itself after the session (`verifyCommands` is null without any)."
1025
+ "checks.items",
1026
+ "A command the orchestrator runs itself after the session: the repo's checks, then the PRD's gates it runs (`checks` is null without any)."
1022
1027
  ],
1023
1028
  ["remoteUrl", "URL of the worktree's `origin` remote (null without one)."],
1024
1029
  [
@@ -1564,8 +1569,10 @@ var REFUSED_PLAYBOOK_FIELDS = {
1564
1569
  sink: "A playbook's role sets where its output goes; remove sink.",
1565
1570
  pool: "A run's pool follows from its role's task type; remove pool.",
1566
1571
  triggers: "A playbook's role sets what starts its runs; remove triggers.",
1567
- draftPullRequest: `The repo's "open PR early" setting decides when the draft PR opens; remove draftPullRequest.`
1572
+ draftPullRequest: `The repo's "open PR early" setting decides when the draft PR opens; remove draftPullRequest.`,
1573
+ verifyCommands: "Checks are set per repo, on its Coding card; remove verifyCommands."
1568
1574
  };
1575
+ var REFUSED_CODING_FIELDS = ["draftPullRequest", "verifyCommands"];
1569
1576
  function isRecord(value) {
1570
1577
  return typeof value === "object" && value !== null && !Array.isArray(value);
1571
1578
  }
@@ -1574,12 +1581,16 @@ function refuseRemovedFields(input, ctx) {
1574
1581
  for (const [field2, message] of Object.entries(REFUSED_PLAYBOOK_FIELDS)) {
1575
1582
  if (field2 in input) ctx.addIssue({ code: "custom", path: [field2], message });
1576
1583
  }
1577
- if (isRecord(input.coding) && "draftPullRequest" in input.coding) {
1578
- ctx.addIssue({
1579
- code: "custom",
1580
- path: ["coding", "draftPullRequest"],
1581
- message: REFUSED_PLAYBOOK_FIELDS.draftPullRequest
1582
- });
1584
+ if (isRecord(input.coding)) {
1585
+ for (const field2 of REFUSED_CODING_FIELDS) {
1586
+ if (field2 in input.coding) {
1587
+ ctx.addIssue({
1588
+ code: "custom",
1589
+ path: ["coding", field2],
1590
+ message: REFUSED_PLAYBOOK_FIELDS[field2]
1591
+ });
1592
+ }
1593
+ }
1583
1594
  }
1584
1595
  const { skills: _skills, ...rest } = input;
1585
1596
  return rest;
@@ -2137,6 +2148,7 @@ Each session starts with a fresh context: the PRD, the progress log and the repo
2137
2148
  {{#story.identifier}}
2138
2149
  {{tracker.name}} issue: {{story.identifier}}{{#story.url}} ({{story.url}}){{/story.url}}
2139
2150
  {{/story.identifier}}
2151
+ Kind: {{story.kind}}
2140
2152
 
2141
2153
  {{#story.repository}}
2142
2154
  Repository: \`{{story.repository}}\`. This story belongs in this repository rather than the epic's main one, and this worktree is a checkout of it: make every change here.
@@ -2172,14 +2184,14 @@ Files attached in {{tracker.name}} (screenshots, mockups, documents). Open each
2172
2184
  {{/items}}
2173
2185
 
2174
2186
  {{/qualityGates}}
2175
- {{#verifyCommands}}
2187
+ {{#checks}}
2176
2188
  ### Checked by the Orchestrator
2177
2189
  The orchestrator runs these itself after you report the story complete and sends any failure back to you, so you don't need to run them as a final check (run one earlier only if you need its output while working):
2178
2190
  {{#items}}
2179
2191
  - \`{{.}}\`
2180
2192
  {{/items}}
2181
2193
 
2182
- {{/verifyCommands}}
2194
+ {{/checks}}
2183
2195
  {{#guidance}}
2184
2196
  ## Guidance From Your Team (follow this)
2185
2197
  {{#items}}
@@ -2742,7 +2754,7 @@ Omniralph treats the whole description as one story, and would split it into sub
2742
2754
  \`stories\` and \`subIssueUpdates\` stay empty.
2743
2755
 
2744
2756
  ### 7. Reformatting sub-issues (\`subIssueUpdates\`; \`reformat\` only)
2745
- For each sub-issue in state type \`backlog\` or \`unstarted\` that isn't in the story format above, add an entry with its \`id\` (as given below), its title without ID prefixes, its body in the story format (keep its intent and criteria; drop \`## Ralph Metadata\`, story IDs, priority and dependency lines, and turn criteria into a \`## Acceptance Criteria\` checklist), its \`priority\` (1\u20134; keep the current one unless it has none) and \`blockedBy\` (the \`id\`s of the sibling sub-issues it depends on, including the existing relations). Leave out sub-issues that are already fine and every sub-issue in any other state.
2757
+ For each sub-issue in state type \`backlog\` or \`unstarted\` that isn't in the story format above, add an entry with its \`id\` (as given below), its title without ID prefixes, its body in the story format (keep its intent and criteria; drop \`## Ralph Metadata\`, story IDs, priority and dependency lines, and turn criteria into a \`## Acceptance Criteria\` checklist), its \`priority\` (1\u20134; keep the current one unless it has none) and \`blockedBy\` (the \`id\`s of the sibling sub-issues it depends on, and the identifiers of work items outside this issue it is blocked by, including the existing relations under Blocked by; Omniralph blocks it on a task's epic when that task is in another epic). Leave out sub-issues that are already fine and every sub-issue in any other state.
2746
2758
 
2747
2759
  ### 8. Open questions (\`openQuestions\`)
2748
2760
  You can't ask anyone during the session. Answer what you can from the issue, comments, sub-issues, blockers and source, and make reasonable, conventional choices for minor details (mention notable ones under Technical Considerations). Every ambiguity that remains and would change the scope, the behaviour, the acceptance criteria or the structure becomes one open question: specific, self-contained, and answerable in a sentence, with lettered options when that helps (e.g. "Who can delete a project? A. Owners only B. Owners and admins"). Don't ask about anything the issue already answers. Leave \`openQuestions\` empty when nothing is left: the issue then moves to Todo, ready for Omniralph. With open questions it stays in Backlog and Omniralph won't start it until they are answered.
@@ -2939,7 +2951,7 @@ var TRIAGE_OUTPUT_SCHEMA = {
2939
2951
  items: {
2940
2952
  type: "string"
2941
2953
  },
2942
- description: "Ids of the sibling sub-issues it is blocked by."
2954
+ description: "Ids of the sibling sub-issues, and identifiers of work items outside the issue, it is blocked by."
2943
2955
  }
2944
2956
  },
2945
2957
  required: ["id", "title", "body", "priority", "blockedBy"],
@@ -4079,7 +4091,9 @@ var RepositoryCodingInput = z17.strictObject({
4079
4091
  openPullRequestEarly: z17.boolean({ error: "Choose on or off." }),
4080
4092
  historyRewrite: z17.enum(RALPH_HISTORY_REWRITE_POLICIES, { error: "Choose a policy." }),
4081
4093
  /** Fix review comments, `@bot` requests and failed CI on its runs' PRs. */
4082
- respondToReviewsAndCi: z17.boolean({ error: "Choose on or off." })
4094
+ respondToReviewsAndCi: z17.boolean({ error: "Choose on or off." }),
4095
+ /** The commands that must pass after every story and request on it, in order. */
4096
+ checks: z17.array(CodingCommand).max(MAX_CHECKS, `Add at most ${MAX_CHECKS} checks.`)
4083
4097
  });
4084
4098
 
4085
4099
  // ../../packages/shared/src/rules.ts
@@ -4273,6 +4287,7 @@ var RalphIssue = z22.object({
4273
4287
  });
4274
4288
  var RALPH_EPIC_KINDS = ["children", "prd", "single"];
4275
4289
  var RALPH_STORY_LIST_STATUSES = ["open", "in_progress", "completed", "cancelled"];
4290
+ var RALPH_STORY_KINDS = ["fix", "story"];
4276
4291
  var MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024;
4277
4292
  var MAX_ATTACHMENT_DOWNLOADS_PER_JOB = 20;
4278
4293
  var RalphAttachmentId = z22.string().regex(/^[0-9a-f]{32}$/);
@@ -4312,15 +4327,17 @@ var RalphStoryPayload = RalphJobBase.extend({
4312
4327
  /** The work item's ID in the tracker. */
4313
4328
  trackerIssueId: z22.string().min(1).max(64),
4314
4329
  url: z22.url().nullable().default(null),
4315
- description: z22.string().max(MAX_DOCUMENT_LENGTH)
4330
+ description: z22.string().max(MAX_DOCUMENT_LENGTH),
4331
+ /** `fix` when the work item has one of the tracker's fix labels, else `story`. */
4332
+ kind: z22.enum(RALPH_STORY_KINDS).default("story")
4316
4333
  }),
4317
4334
  /** Every story of the epic in order (the prompt lists them); may be empty. */
4318
4335
  stories: z22.array(RalphStoryListItem).max(500).default([]),
4319
4336
  /** The commit message, e.g. `feat(TOOL-83): <title>` (or `TOOL-83: <title>` for a single issue). */
4320
4337
  commitMessage: z22.string().min(1).max(2e3),
4321
4338
  /**
4322
- * The story's quality gates, run by the job after the session: the story
4323
- * playbook's `verifyCommands`, then (with `runPrdQualityGates`) the PRD's.
4339
+ * The story's quality gates, run by the job after the session: the lane
4340
+ * repository's checks, then (with `runPrdQualityGates`) the PRD's.
4324
4341
  */
4325
4342
  qualityGates: z22.array(z22.string().min(1).max(4e3)).max(100),
4326
4343
  /** The PRD's `## Quality Gates` commands, shown in the prompt (those the job runs aren't repeated). */
@@ -4462,7 +4479,7 @@ var RalphRequestPayload = RalphJobBase.extend({
4462
4479
  prUrl: z22.url().nullable().default(null),
4463
4480
  /** The run's progress log so far. */
4464
4481
  progress: z22.string().max(MAX_DOCUMENT_LENGTH),
4465
- /** The request playbook's `verifyCommands`, then (with `runPrdQualityGates`) the PRD's gates. */
4482
+ /** The lane repository's checks, then (with `runPrdQualityGates`) the PRD's gates. */
4466
4483
  qualityGates: z22.array(z22.string().min(1).max(4e3)).max(100).default([]),
4467
4484
  /** Whether an explicit request may rebase and `--force-with-lease` the branch (the repo's). */
4468
4485
  historyRewrite: z22.enum(RALPH_HISTORY_REWRITE_POLICIES).default("when-asked"),
@@ -4682,7 +4699,7 @@ var TriageSubIssueUpdate = z23.object({
4682
4699
  title: z23.string().trim().min(1).max(255),
4683
4700
  body: z23.string().trim().min(1).max(MAX_DOCUMENT_LENGTH2),
4684
4701
  priority: StoryPriority,
4685
- /** Tracker IDs of the sibling sub-issues it is blocked by. */
4702
+ /** Tracker IDs of the sibling sub-issues, and identifiers of work items outside the issue, it is blocked by. */
4686
4703
  blockedBy: z23.array(TrackerId).max(100).default([])
4687
4704
  });
4688
4705
  var TriageOutcome = z23.object({
@@ -8864,7 +8881,7 @@ Omniralph treats the whole description as one story, and would split it into sub
8864
8881
  \`stories\` and \`subIssueUpdates\` stay empty.
8865
8882
 
8866
8883
  ### 7. Reformatting sub-issues (\`subIssueUpdates\`; \`reformat\` only)
8867
- For each sub-issue in state type \`backlog\` or \`unstarted\` that isn't in the story format above, add an entry with its \`id\` (as given below), its title without ID prefixes, its body in the story format (keep its intent and criteria; drop \`## Ralph Metadata\`, story IDs, priority and dependency lines, and turn criteria into a \`## Acceptance Criteria\` checklist), its \`priority\` (1\u20134; keep the current one unless it has none) and \`blockedBy\` (the \`id\`s of the sibling sub-issues it depends on, including the existing relations). Leave out sub-issues that are already fine and every sub-issue in any other state.
8884
+ For each sub-issue in state type \`backlog\` or \`unstarted\` that isn't in the story format above, add an entry with its \`id\` (as given below), its title without ID prefixes, its body in the story format (keep its intent and criteria; drop \`## Ralph Metadata\`, story IDs, priority and dependency lines, and turn criteria into a \`## Acceptance Criteria\` checklist), its \`priority\` (1\u20134; keep the current one unless it has none) and \`blockedBy\` (the \`id\`s of the sibling sub-issues it depends on, and the identifiers of work items outside this issue it is blocked by, including the existing relations under Blocked by; Omniralph blocks it on a task's epic when that task is in another epic). Leave out sub-issues that are already fine and every sub-issue in any other state.
8868
8885
 
8869
8886
  ### 8. Open questions (\`openQuestions\`)
8870
8887
  You can't ask anyone during the session. Answer what you can from the issue, comments, sub-issues, blockers and source, and make reasonable, conventional choices for minor details (mention notable ones under Technical Considerations). Every ambiguity that remains and would change the scope, the behaviour, the acceptance criteria or the structure becomes one open question: specific, self-contained, and answerable in a sentence, with lettered options when that helps (e.g. "Who can delete a project? A. Owners only B. Owners and admins"). Don't ask about anything the issue already answers. Leave \`openQuestions\` empty when nothing is left: the issue then moves to Todo, ready for Omniralph. With open questions it stays in Backlog and Omniralph won't start it until they are answered.
@@ -8908,12 +8925,15 @@ function completedCount(epic) {
8908
8925
  return epic.stories.filter((s) => s.status === "completed" || s.status === "cancelled").length;
8909
8926
  }
8910
8927
  function storyGates(ctx) {
8911
- const verifyCommands = uniqueCommands(ctx.verifyCommands ?? []);
8912
- const checked = new Set(verifyCommands.map(normalizeCommand));
8928
+ const checks = uniqueCommands(ctx.checks ?? []);
8929
+ const checked = new Set(checks.map(normalizeCommand));
8913
8930
  const qualityGates = uniqueCommands(ctx.epic.qualityGates).filter(
8914
8931
  (g) => !checked.has(normalizeCommand(g))
8915
8932
  );
8916
- return { verifyCommands, qualityGates };
8933
+ return { checks, qualityGates };
8934
+ }
8935
+ function storyKindLabel(story) {
8936
+ return story.kind === "fix" ? "Fix" : "Story";
8917
8937
  }
8918
8938
  function capitalize(text3) {
8919
8939
  return text3.charAt(0).toUpperCase() + text3.slice(1);
@@ -8941,7 +8961,7 @@ function storyListContext(epic, current) {
8941
8961
  }
8942
8962
  function storyTemplateContext(ctx) {
8943
8963
  const { epic, story } = ctx;
8944
- const { verifyCommands, qualityGates } = storyGates(ctx);
8964
+ const { checks, qualityGates } = storyGates(ctx);
8945
8965
  return {
8946
8966
  tracker: { name: ctx.trackerName },
8947
8967
  epic: {
@@ -8957,13 +8977,14 @@ function storyTemplateContext(ctx) {
8957
8977
  identifier: story.identifier || null,
8958
8978
  url: story.url || null,
8959
8979
  title: oneLine(story.title),
8980
+ kind: storyKindLabel(story),
8960
8981
  repository: story.repo?.name ?? null,
8961
8982
  description: story.description.trim() || null,
8962
8983
  acceptanceCriteria: templateList(story.acceptanceCriteria),
8963
8984
  notes: story.notes || null
8964
8985
  },
8965
8986
  qualityGates: commandList(qualityGates),
8966
- verifyCommands: commandList(verifyCommands),
8987
+ checks: commandList(checks),
8967
8988
  guidance: templateList(ctx.guidance),
8968
8989
  feedback: ctx.previousAttemptFeedback || null,
8969
8990
  attempt: ctx.attempt,
@@ -9216,7 +9237,9 @@ var TriageAgentOutput = z30.object({
9216
9237
  title: z30.string().describe("The plain story title, without IDs."),
9217
9238
  body: z30.string().describe("The story body, ending with a `## Acceptance Criteria` checklist."),
9218
9239
  priority: TrackerPriority,
9219
- blockedBy: z30.array(z30.string()).describe("Ids of the sibling sub-issues it is blocked by.")
9240
+ blockedBy: z30.array(z30.string()).describe(
9241
+ "Ids of the sibling sub-issues, and identifiers of work items outside the issue, it is blocked by."
9242
+ )
9220
9243
  })
9221
9244
  ).describe(
9222
9245
  "outcome reformat only: Backlog/Todo sub-issues rewritten in the story format. Empty otherwise."
@@ -11525,6 +11548,7 @@ function promptEpic(payload) {
11525
11548
  storyId: payload.story.identifier,
11526
11549
  identifier: payload.story.identifier,
11527
11550
  issueId: payload.story.trackerIssueId,
11551
+ kind: payload.story.kind,
11528
11552
  ...payload.story.url && { url: payload.story.url },
11529
11553
  title: payload.story.title,
11530
11554
  description: body.description,
@@ -11987,7 +12011,7 @@ function storyRunPrompt(spec, payload, prepared, now, setup = {}) {
11987
12011
  attempt: payload.attempt,
11988
12012
  maxAttempts: spec.task.maxAttemptsPerStory ?? MAX_ATTEMPTS_PER_STORY,
11989
12013
  followUps: payload.epic.kind !== "single",
11990
- verifyCommands: payload.qualityGates,
12014
+ checks: payload.qualityGates,
11991
12015
  ...payload.settings.appendInstruction && {
11992
12016
  appendInstruction: payload.settings.appendInstruction
11993
12017
  },