@diffohq/diffo 0.14.1 → 0.15.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.
Files changed (98) hide show
  1. package/dist/cli.mjs +50 -5
  2. package/dist/client/assets/{abnfDiagram-O67JEVCF-CWLH81FZ.js → abnfDiagram-O67JEVCF-DTuIcRnI.js} +1 -1
  3. package/dist/client/assets/{arc-Boi3vJx1.js → arc-DDRFqotA.js} +1 -1
  4. package/dist/client/assets/architecture-7GRP2DOG-fgLoXisK.js +1 -0
  5. package/dist/client/assets/{architectureDiagram-NJMV4G6O-Dv6FL33A.js → architectureDiagram-NJMV4G6O-Cm18T2lO.js} +1 -1
  6. package/dist/client/assets/{blockDiagram-BEXU5L5S-JL6NkjcT.js → blockDiagram-BEXU5L5S-D7TX1ex3.js} +1 -1
  7. package/dist/client/assets/{c4Diagram-YGBWAQC7-BX8kio45.js → c4Diagram-YGBWAQC7-WU9XIH3K.js} +1 -1
  8. package/dist/client/assets/channel-C-BwnKOJ.js +1 -0
  9. package/dist/client/assets/{chunk-3FUC2YCW-CO9Amjtk.js → chunk-3FUC2YCW-BLG7xLt6.js} +1 -1
  10. package/dist/client/assets/{chunk-5DYCD2WN-2rOrgg5f.js → chunk-5DYCD2WN-DBZoBewf.js} +1 -1
  11. package/dist/client/assets/{chunk-742MDFTN-I1URsrBZ.js → chunk-742MDFTN-CHgG0KmN.js} +1 -1
  12. package/dist/client/assets/{chunk-7INBJB4K-CUZj-C6g.js → chunk-7INBJB4K-CTi3A7Wb.js} +1 -1
  13. package/dist/client/assets/{chunk-7M6MHVWA-DPNR3NbA.js → chunk-7M6MHVWA-DmA_QxZA.js} +1 -1
  14. package/dist/client/assets/{chunk-7PRAP22T-C9q-YcpS.js → chunk-7PRAP22T-huHpXmw3.js} +1 -1
  15. package/dist/client/assets/{chunk-GTNCS2PH-CzwPny5O.js → chunk-GTNCS2PH-vCx7ar7r.js} +1 -1
  16. package/dist/client/assets/{chunk-GWA4HPMP-CRfFZn0F.js → chunk-GWA4HPMP-CHwKEoZZ.js} +1 -1
  17. package/dist/client/assets/{chunk-MBY4JIJT-BHlU7n-C.js → chunk-MBY4JIJT-RnXnXe-z.js} +1 -1
  18. package/dist/client/assets/{chunk-NETBCI7D-CEyXgnax.js → chunk-NETBCI7D-CSDd9o_Q.js} +1 -1
  19. package/dist/client/assets/{chunk-O7XYJQB3-DxdkNc8m.js → chunk-O7XYJQB3-CEhzWv7d.js} +1 -1
  20. package/dist/client/assets/{chunk-UA2S7LBM-CWz4tJRd.js → chunk-UA2S7LBM-C7B09LWx.js} +1 -1
  21. package/dist/client/assets/{chunk-WEXAMYUT-Dyj5_bjS.js → chunk-WEXAMYUT-3n4dn1BR.js} +1 -1
  22. package/dist/client/assets/{chunk-XXDRQBXY-D9nUo8qv.js → chunk-XXDRQBXY-4FCi-T48.js} +1 -1
  23. package/dist/client/assets/{chunk-Z7XXMR3K-CKwjz3Sm.js → chunk-Z7XXMR3K-DKIhLDzz.js} +1 -1
  24. package/dist/client/assets/{chunk-ZIGJFQKS-D9Hg0L-2.js → chunk-ZIGJFQKS-Co29XAiZ.js} +1 -1
  25. package/dist/client/assets/{classDiagram-v2-NBCMYWYE-Szi56-yb.js → classDiagram-v2-NBCMYWYE-Cf-7xcq8.js} +1 -1
  26. package/dist/client/assets/{core-CmtFUBrQ.js → core-BOw1SZCI.js} +1 -1
  27. package/dist/client/assets/{cose-bilkent-JH36ORCC-BWNiEgAI.js → cose-bilkent-JH36ORCC-BHLAIITd.js} +1 -1
  28. package/dist/client/assets/{cynefin-OW5HDTMX-BRwo_ga9.js → cynefin-OW5HDTMX-BhCsrk_o.js} +1 -1
  29. package/dist/client/assets/{cynefinDiagram-VND7K2PF-HwqbUUIy.js → cynefinDiagram-VND7K2PF-BDA7M5Wl.js} +1 -1
  30. package/dist/client/assets/{dagre-6A5THRUB-Vr9XVRxE.js → dagre-6A5THRUB-C3HwSc-A.js} +1 -1
  31. package/dist/client/assets/{diagram-22UHCM2B-D2AV1t0V.js → diagram-22UHCM2B-OOAY005D.js} +1 -1
  32. package/dist/client/assets/{diagram-3UASUU5V-BebAfmaQ.js → diagram-3UASUU5V-D8gs9Wez.js} +1 -1
  33. package/dist/client/assets/{diagram-ATOU4E4O-DyOZr1ty.js → diagram-ATOU4E4O-BUEcrLGw.js} +1 -1
  34. package/dist/client/assets/{diagram-CDSNMT55-CfUcq-A2.js → diagram-CDSNMT55-CrFP70a4.js} +1 -1
  35. package/dist/client/assets/{diagram-MLGK6HIB-feBafK9Y.js → diagram-MLGK6HIB-xovbjRVR.js} +1 -1
  36. package/dist/client/assets/{diagram-MPIPVDR6-fuRWH1sG.js → diagram-MPIPVDR6-BG_1fWmv.js} +1 -1
  37. package/dist/client/assets/{dist-BNObUdRB.js → dist-B_DAp0_g.js} +1 -1
  38. package/dist/client/assets/{dist-D8Qb0Dmg.js → dist-CywLYZgD.js} +1 -1
  39. package/dist/client/assets/{ebnfDiagram-ZINNZB2B-BQOIIWkD.js → ebnfDiagram-ZINNZB2B-CdYluvLS.js} +1 -1
  40. package/dist/client/assets/{elk-276RUBZZ-BUXjENa5.js → elk-276RUBZZ-CKVIYlEg.js} +1 -1
  41. package/dist/client/assets/{engine-oniguruma-BjMH3wEI.js → engine-oniguruma-DuP4VPQE.js} +1 -1
  42. package/dist/client/assets/{erDiagram-OPXOYQCR-CLVWgAj1.js → erDiagram-OPXOYQCR-DEAtTayB.js} +1 -1
  43. package/dist/client/assets/eventmodeling-NTZA5JFV-BNmObmiU.js +1 -0
  44. package/dist/client/assets/flowDiagram-KWPJA3E3-BRd_3uWq.js +1 -0
  45. package/dist/client/assets/{ganttDiagram-FUAMR5RP-zhdMVh3n.js → ganttDiagram-FUAMR5RP-B4UhUPVD.js} +1 -1
  46. package/dist/client/assets/{gitGraph-4MIJSDKK-BRDusxYN.js → gitGraph-4MIJSDKK-B03FOBVa.js} +1 -1
  47. package/dist/client/assets/{gitGraphDiagram-X574FWY7-hi2GrOpe.js → gitGraphDiagram-X574FWY7-CybhLjCJ.js} +1 -1
  48. package/dist/client/assets/{index-BA230KUb.css → index-BH1cCDEv.css} +1 -1
  49. package/dist/client/assets/index-BegbfTbp.js +93 -0
  50. package/dist/client/assets/{info-A6RAGUB7-B8_M0GwD.js → info-A6RAGUB7-DvT6IPzh.js} +1 -1
  51. package/dist/client/assets/{infoDiagram-VRGFBTTK-D1SckQLr.js → infoDiagram-VRGFBTTK-Buj66Qti.js} +1 -1
  52. package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-BWGRW6iu.js → ishikawaDiagram-OU5B5YK6-DXACcJqu.js} +1 -1
  53. package/dist/client/assets/{journeyDiagram-ZHPQQLJL-BZMBlD-u.js → journeyDiagram-ZHPQQLJL-C3oi2FTw.js} +1 -1
  54. package/dist/client/assets/{kanban-definition-PNTS6WVX-BawAhHrc.js → kanban-definition-PNTS6WVX-CKSGqUhu.js} +1 -1
  55. package/dist/client/assets/{line-Kb3oE4Aw.js → line-B8ynvvTM.js} +1 -1
  56. package/dist/client/assets/{linear-CzZmB-YY.js → linear-rsuuxg2X.js} +1 -1
  57. package/dist/client/assets/{mermaid-parser.core-30zdyqZr.js → mermaid-parser.core-DeKeZJ3Y.js} +3 -3
  58. package/dist/client/assets/{mermaid.core-BZsTuSGk.js → mermaid.core-70lbADcC.js} +4 -4
  59. package/dist/client/assets/{mindmap-definition-NLK3R4M7-Bm7FCTi7.js → mindmap-definition-NLK3R4M7-DDuY48Uq.js} +1 -1
  60. package/dist/client/assets/{packet-AYTQ26CC-BwuhQpcj.js → packet-AYTQ26CC-B0oRPa-1.js} +1 -1
  61. package/dist/client/assets/{pegDiagram-GJSIUBJH-BbRs1Ryb.js → pegDiagram-GJSIUBJH-Dy9hxlwP.js} +1 -1
  62. package/dist/client/assets/{pie-WAS4IAKB-DtQofJX0.js → pie-WAS4IAKB-DugeSiGc.js} +1 -1
  63. package/dist/client/assets/{pieDiagram-5QR66LMP-Cdu1hQd1.js → pieDiagram-5QR66LMP-DGj6Sei1.js} +1 -1
  64. package/dist/client/assets/{quadrantDiagram-O4NWA36T-Bshr17Y5.js → quadrantDiagram-O4NWA36T-BqXtSB0g.js} +1 -1
  65. package/dist/client/assets/{radar-RG4KPBEZ-BuerLUtq.js → radar-RG4KPBEZ-Bs0T3I3e.js} +1 -1
  66. package/dist/client/assets/{railroad-74A4TZTK-BsE8b9hd.js → railroad-74A4TZTK-DYJx-n-7.js} +1 -1
  67. package/dist/client/assets/railroad-abnf-HS5TGJTU-uR7W81iW.js +1 -0
  68. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BHGUfY0n.js +1 -0
  69. package/dist/client/assets/railroad-peg-WCYAUIDC-O7-GYORB.js +1 -0
  70. package/dist/client/assets/{railroadDiagram-XR7U4H2S-BqIA3pC6.js → railroadDiagram-XR7U4H2S-CXdiQULA.js} +1 -1
  71. package/dist/client/assets/{requirementDiagram-PLB6GJNP-Bm2AGotF.js → requirementDiagram-PLB6GJNP-Bm3SrRx3.js} +1 -1
  72. package/dist/client/assets/{sankeyDiagram-IPEJSGJF-99nr1xkQ.js → sankeyDiagram-IPEJSGJF-CkNgX2Ez.js} +1 -1
  73. package/dist/client/assets/{sequenceDiagram-PO4LG4MO-CApQASjN.js → sequenceDiagram-PO4LG4MO-B5YPWkjn.js} +1 -1
  74. package/dist/client/assets/{src-BSYgMDEE.js → src-Do7M-gKD.js} +1 -1
  75. package/dist/client/assets/{stateDiagram-v2-GCMORJYK-CrQnTrn1.js → stateDiagram-v2-GCMORJYK-DAsRcrO8.js} +1 -1
  76. package/dist/client/assets/{swimlanes-2SLR337P-Ce21f9vx.js → swimlanes-2SLR337P-B_Vo0T35.js} +1 -1
  77. package/dist/client/assets/swimlanesDiagram-TC7HE7FX-Beo3TPph.js +8 -0
  78. package/dist/client/assets/{timeline-definition-EJHVYXUP-BoeRsX3e.js → timeline-definition-EJHVYXUP-B9c9U9LA.js} +1 -1
  79. package/dist/client/assets/{treeView-Q6P3EWNA-HKKOZRne.js → treeView-Q6P3EWNA-0HaTq9Pa.js} +1 -1
  80. package/dist/client/assets/{treemap-WGGIJYW6-BG5rp2bZ.js → treemap-WGGIJYW6-CteTfKpY.js} +1 -1
  81. package/dist/client/assets/{usecaseDiagram-POWQR4AR-sx5gD3FR.js → usecaseDiagram-POWQR4AR-BU8VBKEg.js} +1 -1
  82. package/dist/client/assets/{vennDiagram-UO4OBE2U-ckr2KNS0.js → vennDiagram-UO4OBE2U-DgDSjyxl.js} +1 -1
  83. package/dist/client/assets/{wardley-WFR3VGLG-C52x6tow.js → wardley-WFR3VGLG-DoBbSTxP.js} +1 -1
  84. package/dist/client/assets/{wardleyDiagram-VNRHLVJA-C-4Ioqpr.js → wardleyDiagram-VNRHLVJA-B4ZaLucs.js} +1 -1
  85. package/dist/client/assets/{xychartDiagram-PMCCYNJV-C0feTPPk.js → xychartDiagram-PMCCYNJV-DjnxHhkd.js} +1 -1
  86. package/dist/client/index.html +2 -2
  87. package/package.json +1 -1
  88. package/plugin.json +1 -1
  89. package/skills/diffo/SKILL.md +3 -0
  90. package/dist/client/assets/architecture-7GRP2DOG-6Io79Z_R.js +0 -1
  91. package/dist/client/assets/channel-DYSvh7rY.js +0 -1
  92. package/dist/client/assets/eventmodeling-NTZA5JFV-BnOGyEbk.js +0 -1
  93. package/dist/client/assets/flowDiagram-KWPJA3E3-Dh4oiyMW.js +0 -1
  94. package/dist/client/assets/index-BBBJbJZo.js +0 -93
  95. package/dist/client/assets/railroad-abnf-HS5TGJTU-CADz2x_5.js +0 -1
  96. package/dist/client/assets/railroad-ebnf-LZEXJU2U-CfWuG45A.js +0 -1
  97. package/dist/client/assets/railroad-peg-WCYAUIDC-9Ce0sj3N.js +0 -1
  98. package/dist/client/assets/swimlanesDiagram-TC7HE7FX-8cvzmsNb.js +0 -8
package/dist/cli.mjs CHANGED
@@ -393,6 +393,24 @@ function nextStepFor(kind, actionable) {
393
393
  function prOpenNote(worktree, pr) {
394
394
  return `this is pull request #${pr.number} by @${pr.author.login} — not your code. It is checked out at \`${worktree}\`; run your investigation from there (tests, grep, the code itself) and leave it as you found it. The reviewer's public comments go to GitHub when they finish; you never post there. \`${CLI} help agent\` has the pull-request section.`;
395
395
  }
396
+ /**
397
+ * Printed by `diffo <PR>` instead of opening when the pull request is the
398
+ * user's own and was not spelled `diffo pr <PR>`. The one name covers two
399
+ * reviews that teach the agent opposite things — a local branch review where
400
+ * the agent fixes the user's own work, or the GitHub pull request review where
401
+ * it drafts comments for an author — so the user decides, through the agent,
402
+ * before anything is checked out.
403
+ */
404
+ function ownPrAsk(target, pr, checkout) {
405
+ const base = `\`${CLI} --base ${pr.base.ref}\``;
406
+ const where = !checkout.sameRepo ? `${base} from a checkout of \`${pr.owner}/${pr.repo}\` on \`${pr.head.ref}\` (this checkout is a different repo)` : checkout.branch === pr.head.ref ? `${base}, right here` : `\`git checkout ${pr.head.ref}\` then ${base} (this checkout is on ${checkout.branch || "no branch"})`;
407
+ return [
408
+ `pull request #${pr.number} "${pr.title}" is yours (@${pr.viewer.login}), so nothing was opened: a pull request of your own names two different reviews, and the user picks.`,
409
+ ` - Branch review — local only, nothing touches GitHub: ${where}. The review is of the user's own work and the agent fixes what they flag.`,
410
+ ` - PR review — the GitHub pull request: \`${CLI} pr ${target}\`. Checked out in a worktree of its own; the agent is a copilot that drafts review comments, and the user's review posts to GitHub when they submit.`,
411
+ "ask: the commands above are for you, not the user. Say nothing about the CLI, exit codes, or that nothing opened — the user only reviews code. Ask exactly this, and nothing more: \"This pull request is yours. Branch review (local, I fix what you flag) or PR review (the GitHub pull request, I draft comments)?\" Then run the matching command. Someone who wants to fix their own changes means the branch review. Never pick for them."
412
+ ].join("\n");
413
+ }
396
414
  const ACK_NEXT_STEP = {
397
415
  reply: `When every thread is handled, run \`${CLI_COMMANDS.poll}\` again to keep listening (${POLL_STANCE}).`,
398
416
  replyMore: "Interim reply posted — the reviewer still sees you working on this thread. Post the follow-up as a plain reply (no --more) BEFORE your next poll: re-polling closes the batch and counts the promise as never kept.",
@@ -406,6 +424,15 @@ const ACK_NEXT_STEP = {
406
424
  };
407
425
  /** The pull-request section of `diffo help agent`. */
408
426
  const HELP_AGENT_PR = `Reviewing a pull request (\`diffo <PR URL | owner/repo#N | #N>\`):
427
+ - The user's own pull request is not opened: the CLI stops and prints two
428
+ commands — a branch review (\`diffo --base <base>\`: local, nothing touches
429
+ GitHub, you fix what they flag) or a PR review (\`diffo pr <PR>\`: the
430
+ GitHub pull request, you draft comments). The commands are for you, and so
431
+ is the stop: say nothing about the CLI or what did not open. Ask the user
432
+ exactly "This pull request is yours. Branch review (local, I fix what you
433
+ flag) or PR review (the GitHub pull request, I draft comments)?", then run
434
+ their choice. Never pick for them; fixing their own changes means the
435
+ branch review.
409
436
  - You did not write this code. It is checked out in a Diffo worktree whose
410
437
  path the open prints; work from there — run the tests, read the code — and
411
438
  leave it as you found it (\`git checkout -- .\`). Never commit or push.
@@ -1350,7 +1377,8 @@ The target:
1350
1377
  (the short forms resolve against this repo's origin)
1351
1378
 
1352
1379
  For the reviewer:
1353
- pr <target> Review a pull request (the same as \`diffo <target>\`;
1380
+ pr <target> Review a pull request (the same as \`diffo <target>\`,
1381
+ and the explicit answer for a pull request of your own;
1354
1382
  help pr explains the flow)
1355
1383
  status Show this repo's review server, if one is running
1356
1384
  (--json for a machine-readable answer)
@@ -1538,6 +1566,11 @@ reviews and comments are imported as threads; the agent you invite is a
1538
1566
  copilot for code it did not write. Your public comments post to GitHub as one
1539
1567
  review when you finish; nothing leaves before that.
1540
1568
 
1569
+ A pull request of your own is two reviews in one name, so \`diffo <PR>\` stops
1570
+ and asks which: a branch review (\`diffo --base <base>\` on the branch — local,
1571
+ nothing touches GitHub, your agent fixes what you flag) or a PR review
1572
+ (\`diffo pr <PR>\` — the GitHub pull request, your comments post when you submit).
1573
+
1541
1574
  Needs the GitHub CLI signed in: gh auth login --hostname <host>. Every GitHub
1542
1575
  call goes through your own gh; diffo holds no token.
1543
1576
 
@@ -1843,6 +1876,7 @@ function looksLikePr(word) {
1843
1876
  }
1844
1877
  function parseCliArgs(argv) {
1845
1878
  let target;
1879
+ let explicitPr = false;
1846
1880
  let rest = argv;
1847
1881
  if (argv[0] !== void 0 && !argv[0].startsWith("-")) {
1848
1882
  if (argv[0] === "help") return parseHelp(argv.slice(1));
@@ -1855,6 +1889,7 @@ function parseCliArgs(argv) {
1855
1889
  message: "pr needs a pull request: a URL, owner/repo#N, #N, or N"
1856
1890
  };
1857
1891
  target = argv[1];
1892
+ explicitPr = true;
1858
1893
  rest = argv.slice(2);
1859
1894
  } else if (VERBS.has(argv[0])) return parseVerb(argv[0], argv.slice(1));
1860
1895
  else {
@@ -1939,7 +1974,8 @@ function parseCliArgs(argv) {
1939
1974
  ...target !== void 0 ? { target } : {},
1940
1975
  port,
1941
1976
  open: !values["no-open"],
1942
- foreground: values.foreground === true
1977
+ foreground: values.foreground === true,
1978
+ explicitPr
1943
1979
  };
1944
1980
  }
1945
1981
  /**
@@ -8138,7 +8174,7 @@ function serverSpawnArgs(entry, execArgv, port, base, target) {
8138
8174
  const args = [
8139
8175
  ...execArgv,
8140
8176
  entry,
8141
- ...target !== void 0 ? [target] : [],
8177
+ ...target !== void 0 ? ["pr", target] : [],
8142
8178
  "--no-open",
8143
8179
  "--foreground"
8144
8180
  ];
@@ -9171,7 +9207,7 @@ function rebuildDevClient(foreground) {
9171
9207
  * there as an ordinary branch review, and the forge rides along so the server
9172
9208
  * can pull the conversation and post the reviewer's comments.
9173
9209
  */
9174
- async function openPullRequest(ref, baseOverride) {
9210
+ async function openPullRequest(target, ref, baseOverride, explicitPr) {
9175
9211
  const forge = new GhClient();
9176
9212
  const auth = await forge.authStatus(ref.host);
9177
9213
  if (!auth.ok) fail(auth.message);
@@ -9181,6 +9217,15 @@ async function openPullRequest(ref, baseOverride) {
9181
9217
  } catch (err) {
9182
9218
  fail(`could not read pull request #${ref.number} from ${ref.host}/${ref.owner}/${ref.repo}: ${err.message}`);
9183
9219
  }
9220
+ if (pr.viewer.isAuthor && !explicitPr) {
9221
+ const origin = parseRemoteUrl(getRemoteUrl(repoPath) ?? "");
9222
+ const sameRepo = origin !== null && origin.host === ref.host && origin.owner.toLowerCase() === ref.owner.toLowerCase() && origin.repo.toLowerCase() === ref.repo.toLowerCase();
9223
+ console.log(ownPrAsk(target, pr, {
9224
+ branch: getBranchName(repoPath),
9225
+ sameRepo
9226
+ }));
9227
+ process.exit(0);
9228
+ }
9184
9229
  if (pr.state !== "open") process.stderr.write(`diffo: pull request #${pr.number} is ${pr.state}, opening it read-mostly\n`);
9185
9230
  const mainRepo = mainRepoOf(repoPath);
9186
9231
  const db = new DiffoDb();
@@ -9212,7 +9257,7 @@ if (command.target !== void 0) {
9212
9257
  const parsed = parseTarget(command.target, getRemoteUrl(repoPath));
9213
9258
  if (!parsed.ok) fail(parsed.error);
9214
9259
  if (parsed.target.kind === "pr") {
9215
- prOpen = await openPullRequest(parsed.target.ref, command.spec.kind === "branch" ? command.spec.base.replace(/^origin\//, "") : void 0);
9260
+ prOpen = await openPullRequest(command.target, parsed.target.ref, command.spec.kind === "branch" ? command.spec.base.replace(/^origin\//, "") : void 0, command.explicitPr);
9216
9261
  root = prOpen.prepared.path;
9217
9262
  repoPath = resolve(root);
9218
9263
  spec = {
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-30zdyqZr.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-BSYgMDEE.js";import"./chunk-O7XYJQB3-DxdkNc8m.js";import{n as i,r as a,t as o}from"./chunk-GTNCS2PH-CzwPny5O.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-BZsTuSGk.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{m as e,t}from"./mermaid-parser.core-DeKeZJ3Y.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-Do7M-gKD.js";import"./chunk-O7XYJQB3-CEhzWv7d.js";import{n as i,r as a,t as o}from"./chunk-GTNCS2PH-vCx7ar7r.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-70lbADcC.js";var c=e().RailroadAbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=n(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=n(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=n(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=n(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[ABNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[ABNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
@@ -1 +1 @@
1
- import{n as e,t}from"./path-fybaL0A-.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-D8Qb0Dmg.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i){if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
1
+ import{n as e,t}from"./path-fybaL0A-.js";import{a as n,c as r,d as i,f as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,u as p}from"./dist-CywLYZgD.js";function m(e){return e.innerRadius}function h(e){return e.outerRadius}function g(e){return e.startAngle}function _(e){return e.endAngle}function v(e){return e&&e.padAngle}function y(e,t,n,r,i,a,o,s){var c=n-e,l=r-t,u=o-i,d=s-a,f=d*c-u*l;if(!(f*f<1e-12))return f=(u*(t-a)-d*(e-i))/f,[e+f*c,t+f*l]}function b(e,t,n,r,i,a,o){var c=e-n,l=t-r,u=(o?a:-a)/d(c*c+l*l),f=u*l,p=-u*c,m=e+f,h=t+p,g=n+f,_=r+p,v=(m+g)/2,y=(h+_)/2,b=g-m,x=_-h,S=b*b+x*x,C=i-a,w=m*_-g*h,T=(x<0?-1:1)*d(s(0,C*C*S-w*w)),E=(w*x-b*T)/S,D=(-w*b-x*T)/S,O=(w*x+b*T)/S,k=(-w*b+x*T)/S,A=E-v,j=D-y,M=O-v,N=k-y;return A*A+j*j>M*M+N*N&&(E=O,D=k),{cx:E,cy:D,x01:-f,y01:-p,x11:E*(i/C-1),y11:D*(i/C-1)}}function x(){var s=m,x=h,S=e(0),C=null,w=g,T=_,E=v,D=null,O=t(k);function k(){var e,t,m=+s.apply(this,arguments),h=+x.apply(this,arguments),g=w.apply(this,arguments)-r,_=T.apply(this,arguments)-r,v=l(_-g),k=_>g;if(D||=e=O(),h<m&&(t=h,h=m,m=t),!(h>1e-12))D.moveTo(0,0);else if(v>c-1e-12)D.moveTo(h*u(g),h*a(g)),D.arc(0,0,h,g,_,!k),m>1e-12&&(D.moveTo(m*u(_),m*a(_)),D.arc(0,0,m,_,g,k));else{var A=g,j=_,M=g,N=_,P=v,F=v,I=E.apply(this,arguments)/2,L=I>1e-12&&(C?+C.apply(this,arguments):d(m*m+h*h)),R=p(l(h-m)/2,+S.apply(this,arguments)),z=R,B=R,V,H;if(L>1e-12){var U=o(L/m*a(I)),W=o(L/h*a(I));(P-=U*2)>1e-12?(U*=k?1:-1,M+=U,N-=U):(P=0,M=N=(g+_)/2),(F-=W*2)>1e-12?(W*=k?1:-1,A+=W,j-=W):(F=0,A=j=(g+_)/2)}var G=h*u(A),K=h*a(A),q=m*u(N),J=m*a(N);if(R>1e-12){var Y=h*u(j),X=h*a(j),Z=m*u(M),Q=m*a(M),$;if(v<i){if($=y(G,K,Z,Q,Y,X,q,J)){var ee=G-$[0],te=K-$[1],ne=Y-$[0],re=X-$[1],ie=1/a(f((ee*ne+te*re)/(d(ee*ee+te*te)*d(ne*ne+re*re)))/2),ae=d($[0]*$[0]+$[1]*$[1]);z=p(R,(m-ae)/(ie-1)),B=p(R,(h-ae)/(ie+1))}else z=B=0}}F>1e-12?B>1e-12?(V=b(Z,Q,G,K,h,B,k),H=b(Y,X,q,J,h,B,k),D.moveTo(V.cx+V.x01,V.cy+V.y01),B<R?D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,B,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,h,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),!k),D.arc(H.cx,H.cy,B,n(H.y11,H.x11),n(H.y01,H.x01),!k))):(D.moveTo(G,K),D.arc(0,0,h,A,j,!k)):D.moveTo(G,K),!(m>1e-12)||!(P>1e-12)?D.lineTo(q,J):z>1e-12?(V=b(q,J,Y,X,m,-z,k),H=b(G,K,Z,Q,m,-z,k),D.lineTo(V.cx+V.x01,V.cy+V.y01),z<R?D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(H.y01,H.x01),!k):(D.arc(V.cx,V.cy,z,n(V.y01,V.x01),n(V.y11,V.x11),!k),D.arc(0,0,m,n(V.cy+V.y11,V.cx+V.x11),n(H.cy+H.y11,H.cx+H.x11),k),D.arc(H.cx,H.cy,z,n(H.y11,H.x11),n(H.y01,H.x01),!k))):D.arc(0,0,m,N,M,k)}if(D.closePath(),e)return D=null,e+``||null}return k.centroid=function(){var e=(+s.apply(this,arguments)+ +x.apply(this,arguments))/2,t=(+w.apply(this,arguments)+ +T.apply(this,arguments))/2-i/2;return[u(t)*e,a(t)*e]},k.innerRadius=function(t){return arguments.length?(s=typeof t==`function`?t:e(+t),k):s},k.outerRadius=function(t){return arguments.length?(x=typeof t==`function`?t:e(+t),k):x},k.cornerRadius=function(t){return arguments.length?(S=typeof t==`function`?t:e(+t),k):S},k.padRadius=function(t){return arguments.length?(C=t==null?null:typeof t==`function`?t:e(+t),k):C},k.startAngle=function(t){return arguments.length?(w=typeof t==`function`?t:e(+t),k):w},k.endAngle=function(t){return arguments.length?(T=typeof t==`function`?t:e(+t),k):T},k.padAngle=function(t){return arguments.length?(E=typeof t==`function`?t:e(+t),k):E},k.context=function(e){return arguments.length?(D=e??null,k):D},k}export{x as t};
@@ -0,0 +1 @@
1
+ import"./chunk-FOHPRMQF-DzxwRta7.js";import{M as e}from"./mermaid-parser.core-DeKeZJ3Y.js";export{e as createArchitectureServices};