opencode-magi 0.0.0-dev-20260520165420 → 0.0.0-dev-20260520165753

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/index.js CHANGED
@@ -118,6 +118,11 @@ function parseOptionalPr(value) {
118
118
  return undefined;
119
119
  return parsePrToken(value);
120
120
  }
121
+ function parseOptionalPrs(value) {
122
+ if (!value?.trim())
123
+ return undefined;
124
+ return parsePrs(value);
125
+ }
121
126
  function parseOptionalIssue(value) {
122
127
  if (!value?.trim())
123
128
  return undefined;
@@ -432,7 +437,7 @@ export const MagiPlugin = async ({ client, directory }) => {
432
437
  block: args.block,
433
438
  issue: parseOptionalIssue(args.issue),
434
439
  outputDir: await configuredOutputDir(),
435
- pr: parseOptionalPr(args.pr),
440
+ pr: parseOptionalPrs(args.pr),
436
441
  runId: args.runId,
437
442
  timeoutMs: args.timeoutSeconds == null
438
443
  ? undefined
@@ -35,6 +35,19 @@ function isActiveStatus(status) {
35
35
  status === "running" ||
36
36
  status === "posting");
37
37
  }
38
+ function matchesNumberFilter(value, filter) {
39
+ if (filter == null)
40
+ return true;
41
+ return Array.isArray(filter)
42
+ ? value != null && filter.includes(value)
43
+ : value === filter;
44
+ }
45
+ function hasAllRequestedPrStates(states, pr) {
46
+ if (pr == null)
47
+ return true;
48
+ const prs = Array.isArray(pr) ? pr : [pr];
49
+ return prs.every((item) => states.some((state) => state.pr === item));
50
+ }
38
51
  function isWithinDirectory(directory, path) {
39
52
  const relation = relative(directory, path);
40
53
  return (relation === "" || (!relation.startsWith("..") && !isAbsolute(relation)));
@@ -548,6 +561,7 @@ export class MagiRunManager {
548
561
  while (input.block) {
549
562
  const states = await this.filteredStates(input);
550
563
  if (states.length &&
564
+ hasAllRequestedPrStates(states, input.pr) &&
551
565
  states.every((state) => !isActiveStatus(state.status)))
552
566
  return states;
553
567
  if (Date.now() - startedAt >= timeoutMs)
@@ -1661,7 +1675,7 @@ export class MagiRunManager {
1661
1675
  return states
1662
1676
  .filter((state) => input.command == null || state.command === input.command)
1663
1677
  .filter((state) => input.issue == null || state.issue === input.issue)
1664
- .filter((state) => input.pr == null || state.pr === input.pr)
1678
+ .filter((state) => matchesNumberFilter(state.pr, input.pr))
1665
1679
  .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
1666
1680
  }
1667
1681
  async selectState(input) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260520165420",
3
+ "version": "0.0.0-dev-20260520165753",
4
4
  "description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
5
5
  "license": "MIT",
6
6
  "author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",