@shiyuphan/follow-me 0.4.0 → 0.5.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 (96) hide show
  1. package/dist/src/cli.js +154 -11
  2. package/dist/src/comments.js +29 -11
  3. package/dist/src/evolve.js +6 -2
  4. package/dist/src/harness.js +4 -1
  5. package/dist/src/host.js +17 -1
  6. package/dist/src/install.js +1 -1
  7. package/dist/src/prompt.js +170 -166
  8. package/dist/ui/dist/assets/{abnfDiagram-WEYOIA3C-byISxePP.js → abnfDiagram-WEYOIA3C-BXkLs7mV.js} +1 -1
  9. package/dist/ui/dist/assets/{arc-CBzsAsP2.js → arc-DNzjw7Ie.js} +1 -1
  10. package/dist/ui/dist/assets/{architecture-WOLXFQ4H-0OSkIwdB.js → architecture-WOLXFQ4H-D66kgJJt.js} +1 -1
  11. package/dist/ui/dist/assets/{architectureDiagram-ZHVYKT53-ixHybNqO.js → architectureDiagram-ZHVYKT53-D8UWuhQr.js} +1 -1
  12. package/dist/ui/dist/assets/{blockDiagram-RJAE7QA3-1F8XL_Ou.js → blockDiagram-RJAE7QA3-BLkmr62i.js} +1 -1
  13. package/dist/ui/dist/assets/{c4Diagram-XDPPPE54-D9PFBXnc.js → c4Diagram-XDPPPE54-3rZPYwOc.js} +1 -1
  14. package/dist/ui/dist/assets/channel-B9JVdOBZ.js +1 -0
  15. package/dist/ui/dist/assets/{chunk-2E7WHVMD-zZdNfMkj.js → chunk-2E7WHVMD-MMnvAgpB.js} +1 -1
  16. package/dist/ui/dist/assets/{chunk-4EMNKR2T-CTKoxSSj.js → chunk-4EMNKR2T-D9FGWA3l.js} +1 -1
  17. package/dist/ui/dist/assets/{chunk-55XCU76K-ifFnDlcS.js → chunk-55XCU76K-DuOUaV8F.js} +1 -1
  18. package/dist/ui/dist/assets/{chunk-7S6XSTFO-BCMVdi_1.js → chunk-7S6XSTFO-p3YWPv0m.js} +1 -1
  19. package/dist/ui/dist/assets/{chunk-AQDTSKZB-DC-5Whju.js → chunk-AQDTSKZB-DWfKYjwk.js} +1 -1
  20. package/dist/ui/dist/assets/{chunk-DSNLSHJZ-DASbe_gb.js → chunk-DSNLSHJZ-C3CIwpv0.js} +1 -1
  21. package/dist/ui/dist/assets/{chunk-HAGFOTED-CArytDjj.js → chunk-HAGFOTED-Bwfl9gme.js} +1 -1
  22. package/dist/ui/dist/assets/{chunk-HNE4Q36P-Dnl-Wtud.js → chunk-HNE4Q36P-0_oeU0le.js} +1 -1
  23. package/dist/ui/dist/assets/{chunk-NQOKRVIF-wvSLaeaK.js → chunk-NQOKRVIF-z_LPPPx5.js} +1 -1
  24. package/dist/ui/dist/assets/{chunk-UHW7PFBP-CckaOGiQ.js → chunk-UHW7PFBP-BH28V2yu.js} +1 -1
  25. package/dist/ui/dist/assets/{chunk-VQ5W62QI-kQBMDJ7V.js → chunk-VQ5W62QI-BXDajDf7.js} +1 -1
  26. package/dist/ui/dist/assets/{chunk-WQQL4CDK-CMg6bbLU.js → chunk-WQQL4CDK-BphBlfKj.js} +1 -1
  27. package/dist/ui/dist/assets/{chunk-XXDRQBXY-CYlFr19K.js → chunk-XXDRQBXY-BiCT5NwV.js} +1 -1
  28. package/dist/ui/dist/assets/{chunk-YZO67HFG-CqkG1vVk.js → chunk-YZO67HFG-Bg5Pu8BX.js} +1 -1
  29. package/dist/ui/dist/assets/{chunk-ZAUX2LTX-BUNEdx-e.js → chunk-ZAUX2LTX-C_Tgd8tB.js} +1 -1
  30. package/dist/ui/dist/assets/{chunk-ZCHMQSOR-CFTbvcrm.js → chunk-ZCHMQSOR-MBRcMi8-.js} +1 -1
  31. package/dist/ui/dist/assets/{classDiagram-v2-4MYWR3UA-t2OdJ0LA.js → classDiagram-v2-4MYWR3UA-1wyeCe5y.js} +1 -1
  32. package/dist/ui/dist/assets/{cose-bilkent-JH36ORCC-FGm030gc.js → cose-bilkent-JH36ORCC-BtOYclF6.js} +1 -1
  33. package/dist/ui/dist/assets/{cynefin-EF2NZ3EQ-BtU33Lsu.js → cynefin-EF2NZ3EQ-dJmoOG8g.js} +1 -1
  34. package/dist/ui/dist/assets/{cynefinDiagram-WF24UDRP-DUr-I7hS.js → cynefinDiagram-WF24UDRP-AloyqbEN.js} +1 -1
  35. package/dist/ui/dist/assets/{dagre-NK4GIZVX-BWTHwJKt.js → dagre-NK4GIZVX-NCZhdnfb.js} +1 -1
  36. package/dist/ui/dist/assets/{diagram-CBK3MWTC-PcHrsEBn.js → diagram-CBK3MWTC-D8w7x5Gb.js} +1 -1
  37. package/dist/ui/dist/assets/{diagram-I5XIIV2D-CkGtKjYj.js → diagram-I5XIIV2D-BUFnCGlp.js} +1 -1
  38. package/dist/ui/dist/assets/{diagram-ODIL2UCW-B_HdBB1w.js → diagram-ODIL2UCW-BULmHKaW.js} +1 -1
  39. package/dist/ui/dist/assets/{diagram-PFBEJUXE-DL9zayE6.js → diagram-PFBEJUXE-B5MqFo0r.js} +1 -1
  40. package/dist/ui/dist/assets/{diagram-RJA3I4VV-By5wl8nK.js → diagram-RJA3I4VV-BIkDLL8E.js} +1 -1
  41. package/dist/ui/dist/assets/{diagram-TYUNFSNR-ziWPVayL.js → diagram-TYUNFSNR-Ca4gsQV8.js} +1 -1
  42. package/dist/ui/dist/assets/{dist-NDVqCM7k.js → dist-G85JKY5k.js} +1 -1
  43. package/dist/ui/dist/assets/{ebnfDiagram-V4P3TTPT-DH4YGkPc.js → ebnfDiagram-V4P3TTPT-rVjcFFtb.js} +1 -1
  44. package/dist/ui/dist/assets/{elk-QONTBCTQ-BL2RlCEv.js → elk-QONTBCTQ-BWPdvULh.js} +1 -1
  45. package/dist/ui/dist/assets/{erDiagram-KYQIGQAA-BKbTMaRp.js → erDiagram-KYQIGQAA-BPxJJkRl.js} +1 -1
  46. package/dist/ui/dist/assets/{eventmodeling-K75KTNOO-Dk5RCWc-.js → eventmodeling-K75KTNOO-BSB9WYV3.js} +1 -1
  47. package/dist/ui/dist/assets/flowDiagram-IUGLLWBU-N-Spyk2o.js +1 -0
  48. package/dist/ui/dist/assets/{ganttDiagram-R7GPNTJY-3vM9gxeT.js → ganttDiagram-R7GPNTJY-DKps530K.js} +1 -1
  49. package/dist/ui/dist/assets/{gitGraph-VSP46ZUC-CXGFhz54.js → gitGraph-VSP46ZUC-D1d4UAFV.js} +1 -1
  50. package/dist/ui/dist/assets/{gitGraphDiagram-PDYL7XHY-Cl4fwUuA.js → gitGraphDiagram-PDYL7XHY-N55yl6hc.js} +1 -1
  51. package/dist/ui/dist/assets/index-BKtWBS7Z.js +134 -0
  52. package/dist/ui/dist/assets/{info-OHQRW6UA-DfSsZ8ib.js → info-OHQRW6UA-CgxE3gf9.js} +1 -1
  53. package/dist/ui/dist/assets/{infoDiagram-MVDRKAX5-B_7tyrL5.js → infoDiagram-MVDRKAX5-DOnUrnMf.js} +1 -1
  54. package/dist/ui/dist/assets/{ishikawaDiagram-HPEHV2GE-DUvHljpg.js → ishikawaDiagram-HPEHV2GE-BIY0fFHB.js} +1 -1
  55. package/dist/ui/dist/assets/{journeyDiagram-BOSHW7O7-BCgqzrb8.js → journeyDiagram-BOSHW7O7-CqA2Ern0.js} +1 -1
  56. package/dist/ui/dist/assets/{kanban-definition-FNSA4HC5-DOzZ3NmE.js → kanban-definition-FNSA4HC5-vGrpQKIF.js} +1 -1
  57. package/dist/ui/dist/assets/{line-B-mPFVll.js → line-Brzv3qA6.js} +1 -1
  58. package/dist/ui/dist/assets/{linear-k7o0jout.js → linear-D9uIlqyh.js} +1 -1
  59. package/dist/ui/dist/assets/{mermaid-parser.core-CAyLSQpH.js → mermaid-parser.core-Bz9b-Thu.js} +3 -3
  60. package/dist/ui/dist/assets/{mermaid.core-vfVMjgx2.js → mermaid.core-BaZipu3b.js} +4 -4
  61. package/dist/ui/dist/assets/{mindmap-definition-6OY57UG3-B6y-B_r4.js → mindmap-definition-6OY57UG3-D6aie7uH.js} +1 -1
  62. package/dist/ui/dist/assets/{packet-JDAUHWVQ-C_r4ed30.js → packet-JDAUHWVQ-28r3jVFY.js} +1 -1
  63. package/dist/ui/dist/assets/{pegDiagram-ECIUJNBX-B8VUm3Bh.js → pegDiagram-ECIUJNBX-CbGvD4qP.js} +1 -1
  64. package/dist/ui/dist/assets/{pie-XZMESJXO-DcwtbH9y.js → pie-XZMESJXO-DHpcGnZd.js} +1 -1
  65. package/dist/ui/dist/assets/{pieDiagram-GNMPY74T-CvUNBi2F.js → pieDiagram-GNMPY74T-DuhauwnY.js} +1 -1
  66. package/dist/ui/dist/assets/{prism-core-_2ju85Ya.js → prism-core-CbZMOvrb.js} +1 -1
  67. package/dist/ui/dist/assets/{quadrantDiagram-D57K4MC3-Dg2eVS3j.js → quadrantDiagram-D57K4MC3-BfyNmVca.js} +1 -1
  68. package/dist/ui/dist/assets/{radar-ABXABTNO-xCNTcZE9.js → radar-ABXABTNO-Xp1TYwaj.js} +1 -1
  69. package/dist/ui/dist/assets/{railroad-I3PHUGI6-BI-sIL2Q.js → railroad-I3PHUGI6-c5FY4wwa.js} +1 -1
  70. package/dist/ui/dist/assets/{railroad-abnf-LNEFI6M7-Ddvk40Wx.js → railroad-abnf-LNEFI6M7-RDyWXqcL.js} +1 -1
  71. package/dist/ui/dist/assets/{railroad-ebnf-DWYD2UWJ-h35gE183.js → railroad-ebnf-DWYD2UWJ-CLD4jVou.js} +1 -1
  72. package/dist/ui/dist/assets/{railroad-peg-JR7BVNR7-Zim9iPdp.js → railroad-peg-JR7BVNR7-17EYTA-w.js} +1 -1
  73. package/dist/ui/dist/assets/{railroadDiagram-Y72NRBL7-Cz6fdmOQ.js → railroadDiagram-Y72NRBL7-C4p2wtKe.js} +1 -1
  74. package/dist/ui/dist/assets/{requirementDiagram-EQYSW5RA-DTJkCrcD.js → requirementDiagram-EQYSW5RA-DTYIFN8T.js} +1 -1
  75. package/dist/ui/dist/assets/{sankeyDiagram-SY24JHO5-Bg1iiVla.js → sankeyDiagram-SY24JHO5-YDYhRyJU.js} +1 -1
  76. package/dist/ui/dist/assets/{sequenceDiagram-BLEHNHQU-9XfetsRA.js → sequenceDiagram-BLEHNHQU-Crvy6IlU.js} +1 -1
  77. package/dist/ui/dist/assets/{src-Dym5afQ5.js → src-BPod-Ype.js} +1 -1
  78. package/dist/ui/dist/assets/{stateDiagram-v2-A6IESKWZ-CMmcMV8z.js → stateDiagram-v2-A6IESKWZ-BWr70YOQ.js} +1 -1
  79. package/dist/ui/dist/assets/{swimlanes-B3ENRKFQ-B2PcshTY.js → swimlanes-B3ENRKFQ-DvbG4I9a.js} +1 -1
  80. package/dist/ui/dist/assets/swimlanesDiagram-AYQRV4AK-D2wU-jW6.js +8 -0
  81. package/dist/ui/dist/assets/{timeline-definition-JXYKGLGB-Cr1hCNtW.js → timeline-definition-JXYKGLGB-CR950Bzb.js} +1 -1
  82. package/dist/ui/dist/assets/{treeView-D4JQ5SDB-jH5ksKnh.js → treeView-D4JQ5SDB-DSDDXGrk.js} +1 -1
  83. package/dist/ui/dist/assets/{treemap-SAJKECNS-BV90e8QL.js → treemap-SAJKECNS-Ct5w2_RR.js} +1 -1
  84. package/dist/ui/dist/assets/{usecaseDiagram-WPOLBNNX-BNwq5aJV.js → usecaseDiagram-WPOLBNNX-_eP0371y.js} +1 -1
  85. package/dist/ui/dist/assets/{vennDiagram-Q3Y3IDCW-D-lLyZCL.js → vennDiagram-Q3Y3IDCW-Cu-IA57L.js} +1 -1
  86. package/dist/ui/dist/assets/{wardley-7MLQ67FV-CWfHQUGt.js → wardley-7MLQ67FV-r8yd6frN.js} +1 -1
  87. package/dist/ui/dist/assets/{wardleyDiagram-IVAIDKWA-BL_qNKVd.js → wardleyDiagram-IVAIDKWA-CBUUiRQm.js} +1 -1
  88. package/dist/ui/dist/assets/{xychartDiagram-4URNHDU4-BHPK5Snp.js → xychartDiagram-4URNHDU4-DEVQjvgG.js} +1 -1
  89. package/dist/ui/dist/index.html +1 -1
  90. package/package.json +1 -1
  91. package/skills/follow-me/SKILL.md +69 -7
  92. package/skills/follow-me/porting.md +7 -0
  93. package/dist/ui/dist/assets/channel-B-fwsHf1.js +0 -1
  94. package/dist/ui/dist/assets/flowDiagram-IUGLLWBU-Dkjb3PCK.js +0 -1
  95. package/dist/ui/dist/assets/index-CBbx_pJk.js +0 -134
  96. package/dist/ui/dist/assets/swimlanesDiagram-AYQRV4AK-DfB3XTTn.js +0 -8
@@ -22,11 +22,13 @@ function formatSelection(unit, select) {
22
22
  function stripEol(text) {
23
23
  return text.replace(/\r?\n$/, "");
24
24
  }
25
- function renderHunk(hunk) {
25
+ /** Under a "### path" heading the path is left out of each hunk's own line. */
26
+ function renderHunk(hunk, withPath = true) {
26
27
  const lines = hunk.body.map((line) => line.op === " "
27
28
  ? ` ${stripEol(line.text)}`
28
29
  : `[${line.change}]${line.op} ${stripEol(line.text)}`);
29
- return [`${hunk.id} ${hunk.path} (${hunk.changeCount} change lines)`, ...lines].join("\n");
30
+ const where = withPath ? ` ${hunk.path}` : "";
31
+ return [`${hunk.id}${where} (${hunk.changeCount} change lines)`, ...lines].join("\n");
30
32
  }
31
33
  function renderOtherUnit(unit) {
32
34
  if (unit.kind === "mode") {
@@ -41,7 +43,7 @@ function renderUnits(diff) {
41
43
  byPath.set(unit.path, [...(byPath.get(unit.path) ?? []), unit]);
42
44
  }
43
45
  const files = [...byPath].map(([path, units]) => {
44
- const rendered = units.map((unit) => unit.kind === "hunk" ? renderHunk(unit) : renderOtherUnit(unit));
46
+ const rendered = units.map((unit) => unit.kind === "hunk" ? renderHunk(unit, false) : renderOtherUnit(unit));
45
47
  return [`### ${path}`, ...rendered].join("\n\n");
46
48
  });
47
49
  return files.join("\n\n");
@@ -162,8 +164,6 @@ function pickRows(ctx, anchor) {
162
164
  touchesContext: count(" ") > 0,
163
165
  };
164
166
  }
165
- /** Said once wherever comments reach the agent, with the same words. */
166
- const CONTEXT_RULE = "A comment on a context row (marked `>` with no + or -) is about code this branch leaves alone or depends on. The plan cannot move it, so do not move lines because of it. Answer a question with an explanation, or point at the commit that last touched those lines. Answer a change request as a code issue, not by reordering.";
167
167
  function renderComment(comment, ctx) {
168
168
  const lines = [`- ${comment.id} on ${describeAnchor(comment.anchor, ctx)}`];
169
169
  const rows = anchorRows(ctx, comment.anchor);
@@ -188,165 +188,136 @@ function renderComment(comment, ctx) {
188
188
  }
189
189
  return lines.join("\n");
190
190
  }
191
- const QUESTIONS = `A question is not a request to change the plan. Answer it by explaining, not by moving lines. Where the asked-about lines now live, add or rewrite the \`narration\` (the page shows it as your note) of that commit or unit so it answers the question, in plain sentences. When the answer is about flow, structure or order across files, add a \`diagram\` there too. Then write one response with \`"status": "answered"\`, a \`note\` of one to three sentences that answers the question directly, and \`"at"\` naming the commit (1-based) and unit that carry the explanation. Move lines only if answering shows the order itself was wrong. Say so in the note, and answer the question as well. If the diff cannot answer it, use \`"deferred"\` and say what is missing.`;
192
- const CONCERNS = `You are also a careful reviewer. Add a concern only for something you would raise in a pull request: a bug or unhandled case, a change with no test where one is expected, a name that misleads, or a risky change such as a migration, concurrency or security. Pin it to the change lines with \`lines\`. Say what goes wrong and when, in one or two sentences. Severity: \`blocker\` breaks behaviour or loses data, \`major\` should be fixed before merge, \`minor\` is worth a note. Do not flag style, formatting or taste. Do not repeat the note. Most commits deserve no concern, and a plan with none is fine. Never write more than one concern per unit. Concerns are in your voice as a reviewer, while the note stays the author's.
193
-
194
- A concern is \`{ "severity": "blocker" | "major" | "minor", "kind": "bug" | "missing-test" | "naming" | "risk", "text": "...", "lines": [0, 1] }\`. \`lines\` holds change indices of that unit and is allowed only on a unit ref. Write \`"concerns": [ ... ]\` on a commit, or on a unit written as an object: \`{ "unit": "h_x:0-3", "concerns": [ ... ] }\`. Never write an id; follow-me derives one.`;
195
- const ORDERING = `Order the commits so the story reads naturally:
196
- - Scaffolding and types come before the code that uses them.
197
- - A failing test comes before the fix that makes it pass.
198
- - Renames and moves come before the edits that build on them.
199
- - One idea per commit. Prefer many small commits over a few large ones.
200
- - Commits do not need to compile or pass tests on their own.
201
- - The last commit must bring the tree to exactly the tip, which follows from covering every unit.
202
-
203
- Write each commit message as a short imperative title, then a blank line and a body that
204
- says why. Put the why in the body first, before anything else. Keep the title to 50
205
- characters or fewer; put detail in the body.`;
206
- const GOALS = {
207
- split: {
208
- title: "plan the commits",
209
- goal: `You are reordering a finished branch into a series of commits that a reader can follow
210
- as the author's thought process. The final tree is fixed. You only decide how its change
211
- lines are grouped and ordered.
212
-
213
- ${ORDERING}`,
214
- },
215
- walk: {
216
- title: "tell the story of this branch",
217
- goal: `The reader is a reviewer meeting this branch for the first time. They will read it commit
218
- by commit and comment on the code itself. The final tree is fixed. You decide how its change
219
- lines are grouped and ordered, and why each step is there.
220
-
221
- ${ORDERING}
222
-
223
- Add a \`narration\` to a commit, or to a unit, only when it says something the commit message
224
- body does not. The page shows it as your note. A note is one plain paragraph on why, in plain
225
- text with no markdown. Say why, not what the lines already show. Leave it out when the body
226
- already says it.`,
227
- },
191
+ const TITLES = {
192
+ split: "plan the commits",
193
+ walk: "tell the story of this branch",
228
194
  };
229
- const FORMAT = (draftPath, base, tip) => `Write the plan as JSON to ${draftPath}. Write only the file, in this format:
230
-
231
- {
232
- "schema": "follow-me/plan@1",
233
- "base": "${base}",
234
- "tip": "${tip}",
235
- "commits": [
236
- { "message": "Add the Token type\\n\\nThe parser needs it.", "units": ["h_0123456789ab", "h_ba9876543210:0-3,7"] },
237
- {
238
- "message": "Parse tokens",
239
- "narration": "Tokens are read in one pass, so the loop below never backtracks.",
240
- "units": [{ "unit": "h_ba9876543210", "narration": "The loop is boring on purpose." }, "f_0123456789ab"]
241
- }
242
- ],
243
- "responses": [
244
- { "comment": "c_abc234", "status": "addressed", "note": "Split the hunk and moved it earlier." }
245
- ]
246
- }
247
-
248
- \`narration\` is optional on a commit and on a unit, and the page shows it as your note. A unit
249
- with a note is written as \`{ "unit": "<ref>", "narration": "..." }\` instead of the plain ref string.
250
-
251
- \`diagram\` is optional on a commit and on a unit, written the same way:
252
- \`{ "unit": "<ref>", "diagram": "..." }\`. It is Mermaid source that the review page draws beside
253
- the code: a commit's diagram under its commit, a unit's under its hunk. Add one only where a picture says what the code and prose cannot: data flowing between
254
- modules, a state machine, a call graph, or the before and after shape of a structure. Most commits
255
- need none. The first line names the diagram type, for example:
256
-
257
- "diagram": "flowchart LR\\n parse --> validate --> apply"
258
-
259
- The note stays plain text even when a diagram is present.
260
- \`responses\` is [] when there are no review comments. \`status\` is one of "addressed",
261
- "declined", "deferred" or, for a question, "answered", and \`note\` says what you did or why not.
262
- An "answered" response also carries \`"at": { "commit": 3, "unit": "h_x" }\`: the commit, counted from 1,
263
- and optionally the unit that holds the explanation.`;
264
- const RULES = (checkCommand) => `- A unit is "h_…" (a text hunk), "f_…" (a whole file) or "m_…" (a mode change).
265
- - "h_x:0-3,7" takes change lines 0, 1, 2, 3 and 7 of hunk h_x. Indices are the [n] shown below.
266
- - A bare "h_x" takes every change line of that hunk that no other commit claimed.
267
- - Every change line must be used exactly once across all commits. Never repeat a line.
268
- - Use the unit ids exactly as printed. Do not invent ids.
269
- - "f_…" and "m_…" units are taken whole, never with a line list.
270
- - Every commit needs a non-empty message and at least one unit.
271
- - Keep every file syntactically whole in every commit: a function with its closing brace, a block with both ends, an import before or with its first use. Commits need not build or pass tests, but each file a commit writes must parse.
272
- - Check your work with \`${checkCommand}\` and fix every issue it prints, syntax errors included.`;
195
+ /** Where the fixed instructions live: the skill a harness loads once, not every prompt. */
196
+ function pointer(input) {
197
+ const mode = input.mode === "split" ? "author mode" : "reviewer mode";
198
+ const where = input.skillPath === undefined ? "" : ` If it is not loaded, read ${input.skillPath}.`;
199
+ return `Write the draft as "Writing the draft" in the follow-me skill says, in ${mode}.${where}`;
200
+ }
201
+ function sessionLines(input) {
202
+ return [
203
+ `- draft: ${input.draftPath}`,
204
+ `- base: ${input.diff.base}`,
205
+ `- tip: ${input.diff.tip}`,
206
+ `- check: ${input.checkCommand}`,
207
+ ].join("\n");
208
+ }
273
209
  function renderUnit(unit) {
274
210
  return unit.kind === "hunk" ? renderHunk(unit) : renderOtherUnit(unit);
275
211
  }
276
- /** The vanished and new units, and the reviewer's comments on hunks that vanished, quoted. */
277
- function renderChanges(changes, input, ctx) {
278
- const { since, vanished, added } = changes;
279
- const gone = new Set(vanished.map((v) => v.unit.id));
280
- const review = input.mode === "split" ? input.review : null;
281
- const orphans = (review?.comments ?? []).filter((c) => c.author !== "agent" && c.anchor.kind === "hunk" && gone.has(c.anchor.unit));
282
- const parts = [
283
- `## Changes since v${since}\n`,
284
- `The branch moved after plan v${since}. ${input.draftPath} already holds that plan on the new tip: every unit whose hunk did not change keeps its commit, and any commit left with no unit was dropped. Put each new unit below into a commit, an existing one or a new one, and keep the rest as it is.`,
212
+ const QUOTE_LINES = 6;
213
+ const QUOTE_WIDTH = 160;
214
+ /**
215
+ * At most six rows around the picked ones (marked ">"), each cut to 160 characters: enough to
216
+ * recognise the code without a file read, short enough to send with every comment.
217
+ */
218
+ function shortQuote(rows) {
219
+ const picked = rows.flatMap((r, i) => (r.startsWith(">") ? [i] : []));
220
+ const first = picked[0] ?? 0;
221
+ const last = picked.at(-1) ?? 0;
222
+ const before = Math.max(0, Math.min(2, QUOTE_LINES - (last - first + 1)));
223
+ const start = Math.max(0, first - before);
224
+ return rows
225
+ .slice(start, start + QUOTE_LINES)
226
+ .map((r) => (r.length > QUOTE_WIDTH ? `${r.slice(0, QUOTE_WIDTH - 1)}…` : r));
227
+ }
228
+ /** One comment in a line or two, with its quote only when the agent cannot see the hunk now. */
229
+ function renderOpen(c, ctx, quote) {
230
+ const what = c.kind === "question" ? "question" : (c.severity ?? "comment");
231
+ const lines = [
232
+ `- ${c.id} ${what} on ${describeAnchor(c.anchor, ctx)}: ${JSON.stringify(c.body)}`,
233
+ ];
234
+ if (c.follows)
235
+ lines.push(` asks again after ${c.follows}`);
236
+ for (const reply of c.replies ?? []) {
237
+ lines.push(` ${reply.author} replied: ${JSON.stringify(reply.body)}`);
238
+ }
239
+ if (quote) {
240
+ const rows = anchorRows(ctx, c.anchor);
241
+ const quoted = rows.length > 0 ? rows : (c.context.lines ?? []).map((l) => `> ${l}`);
242
+ lines.push(...shortQuote(quoted).map((r) => ` ${r}`));
243
+ }
244
+ return lines.join("\n");
245
+ }
246
+ /**
247
+ * The prompt after the branch moved. The agent wrote the plan and read every comment already, so
248
+ * only new units carry bodies; the rest are one line each, and a comment is quoted only when the
249
+ * hunk it was on changed.
250
+ */
251
+ function renderMoved(input, changes, head) {
252
+ const { since, vanished, added, draft } = changes;
253
+ const { units } = input.diff;
254
+ const gone = new Map(vanished.map((v) => [v.unit.id, v.unit]));
255
+ const sections = [
256
+ head,
257
+ `## Changes since v${since}\n\nThe branch moved after plan v${since}. The draft holds that plan on the new tip.`,
285
258
  ];
286
259
  if (vanished.length > 0) {
287
- parts.push(`\nThese units of v${since} changed, so their ids are gone:`, ...vanished.map(({ unit, commits }) => {
288
- const where = commits
289
- .map((c) => `commit ${c.index + 1} ${JSON.stringify(c.message.split("\n")[0] ?? "")}`)
290
- .join(", ");
291
- return `- ${unit.id} ${unit.path}, was in ${where}`;
292
- }));
260
+ sections.push([
261
+ `## Units of v${since} that changed, so their ids are gone\n`,
262
+ ...vanished.map(({ unit, commits }) => {
263
+ const was = commits.map((c) => c.index + 1).join(", ");
264
+ return `- ${unit.id} ${unit.path} was in commit ${was}`;
265
+ }),
266
+ ].join("\n"));
293
267
  }
294
268
  if (added.length > 0) {
295
- parts.push("\nNew units, in no commit yet:\n", added.map(renderUnit).join("\n\n"));
269
+ sections.push(`## New units, in no commit yet\n\n${added.map(renderUnit).join("\n\n")}`);
296
270
  }
297
- if (orphans.length > 0) {
298
- parts.push(`\nThe reviewer commented on hunks that changed. Write a response for each saying what you changed, and post the same with \`follow-me reply <id>\`:\n`, orphans.map((c) => renderComment(c, ctx)).join("\n"));
271
+ const kept = draft.commits.flatMap((commit, k) => commit.units.map((ref) => {
272
+ const path = units.get(ref.unit)?.path ?? "";
273
+ return `- ${formatSelection(ref.unit, ref.select)} ${path} commit ${k + 1}`;
274
+ }));
275
+ if (kept.length > 0) {
276
+ sections.push(`## Unchanged units, in the draft's commits\n\n${kept.join("\n")}`);
299
277
  }
300
- return parts.join("\n");
278
+ const review = input.mode === "split" ? input.review : null;
279
+ const theirs = review?.comments.filter((c) => c.author !== "agent") ?? [];
280
+ if (review !== null && theirs.length > 0) {
281
+ const ctx = { commits: [], units: new Map([...units, ...gone]) };
282
+ const changed = (c) => c.anchor.kind === "hunk" && gone.has(c.anchor.unit);
283
+ sections.push([
284
+ `## Open comments, on plan v${review.planVersion}\n`,
285
+ ...theirs.map((c) => renderOpen(c, ctx, changed(c))),
286
+ ].join("\n"));
287
+ }
288
+ return `${sections.join("\n\n")}\n`;
301
289
  }
302
290
  /** The planner prompt for a coding agent. Pure and deterministic for the same input. */
303
291
  export function renderPrompt(input) {
304
- const { diff, draftPath } = input;
305
- const { title, goal } = GOALS[input.mode];
292
+ const { diff } = input;
306
293
  const head = [
307
- `# follow-me: ${title}\n\n${goal}`,
308
- `## Output format\n\n${FORMAT(draftPath, diff.base, diff.tip)}`,
309
- `## Rules\n\n${RULES(input.checkCommand)}`,
294
+ `# follow-me: ${TITLES[input.mode]}\n\n${pointer(input)}\n\n${sessionLines(input)}`,
310
295
  ];
311
- const units = `## Units\n\nChange lines are shown as \`[n]+ text\` or \`[n]- text\`. Indented lines without a bracket are context and cannot be selected.\n\n${renderUnits(diff)}`;
312
- if (input.mode === "walk") {
313
- const sections = [
314
- ...head,
315
- ...(input.changes === undefined
316
- ? []
317
- : [renderChanges(input.changes, input, { commits: [], units: diff.units })]),
318
- `## Concerns\n\n${CONCERNS}`,
319
- `## Questions from the reviewer\n\n${QUESTIONS}\n\n${CONTEXT_RULE}`,
320
- units,
321
- ];
322
- return `${sections.join("\n\n")}\n`;
323
- }
296
+ if (input.changes !== undefined)
297
+ return renderMoved(input, input.changes, head.join(""));
298
+ const units = `## Units\n\n${renderUnits(diff)}`;
299
+ if (input.mode === "walk")
300
+ return `${[...head, units].join("\n\n")}\n`;
324
301
  const ctx = {
325
302
  commits: input.previousCommits ?? [],
326
303
  units: diff.units,
327
304
  };
328
- const sections = [
329
- ...head,
330
- ...(input.changes === undefined ? [] : [renderChanges(input.changes, input, ctx)]),
331
- units,
332
- ];
305
+ const sections = [...head, units];
333
306
  const { previousPlan, review } = input;
334
- if (previousPlan) {
335
- sections.push(`## Previous plan\n\nCommits are numbered from 1.\n\n${renderPreviousPlan(previousPlan)}`);
336
- }
307
+ if (previousPlan)
308
+ sections.push(`## Previous plan\n\n${renderPreviousPlan(previousPlan)}`);
337
309
  const theirs = review?.comments.filter((c) => c.author !== "agent") ?? [];
338
310
  const asked = theirs.filter((c) => c.kind === "question");
339
311
  const changes = theirs.filter((c) => c.kind !== "question");
340
- const questions = [`## Questions from the reviewer\n`, QUESTIONS, `\n${CONTEXT_RULE}`];
341
312
  if (review && asked.length > 0) {
342
- questions.push(`\nThe reviewer asked ${asked.length === 1 ? "this question" : "these questions"} about plan v${review.planVersion}. Commits are numbered from 1. Write one response for each.\n`, asked.map((c) => renderComment(c, ctx)).join("\n"));
313
+ sections.push([
314
+ `## Questions from the reviewer, on plan v${review.planVersion}\n`,
315
+ asked.map((c) => renderComment(c, ctx)).join("\n"),
316
+ ].join("\n"));
343
317
  }
344
- sections.push(questions.join("\n"));
345
318
  if (review && changes.length > 0) {
346
319
  sections.push([
347
- `## Open review comments\n`,
348
- `A reviewer commented on plan v${review.planVersion}. Commits are numbered from 1.`,
349
- "Answer every comment below with one entry in `responses`, changing the plan where you agree.\n",
320
+ `## Open review comments, on plan v${review.planVersion}\n`,
350
321
  changes.map((c) => renderComment(c, ctx)).join("\n"),
351
322
  ].join("\n"));
352
323
  }
@@ -914,47 +885,49 @@ function renderIncluded(review, commits, units, opts) {
914
885
  if (!walk && (feedback.length > 0 || questions.length > 0)) {
915
886
  out.push("Answer every comment id above in `responses` of the next draft, then run `follow-me check` and `follow-me apply`.", "");
916
887
  }
917
- const onContext = review.comments.some((c) => pickRows(ctx, c.anchor)?.touchesContext);
918
- if (onContext)
919
- out.push(CONTEXT_RULE, "");
920
888
  if (!walk && items.length > 0) {
921
- out.push("Fix the code issues on the original branch, then run `follow-me extract` again.", "");
889
+ out.push("Fix the code issues on the original branch, then run `follow-me` again.", "");
922
890
  }
923
891
  return out.join("\n");
924
892
  }
893
+ function indented(body) {
894
+ return ` ${body.split("\n").join("\n ")}`;
895
+ }
896
+ /** "- head: body" for a one-line body, else the body indented under the head. */
897
+ function said(head, body) {
898
+ return body.includes("\n") ? [`${head}:`, indented(body)] : [`${head}: ${body}`];
899
+ }
900
+ /**
901
+ * A new comment carries its short quote, since the agent has not seen it; everything else is one
902
+ * line naming its id, because the agent already has the comment it refers to.
903
+ */
925
904
  function renderEvent(event, ctx) {
926
905
  switch (event.type) {
927
- case "comment":
928
- case "comment-updated": {
906
+ case "comment": {
929
907
  const { comment: c } = event;
930
- const what = c.kind === "question" ? "question" : "comment";
931
- const verb = event.type === "comment" ? "new" : "edited";
932
- const lines = [`- ${verb} ${what} ${c.id} on ${describeAnchor(c.anchor, ctx)}`];
933
- const rows = anchorRows(ctx, c.anchor);
934
- if (rows.length > 0)
935
- lines.push(...rows.map((r) => ` ${r}`));
936
- if (c.context.path)
937
- lines.push(` - file: ${c.context.path}`);
938
- if (c.severity)
939
- lines.push(` - severity: ${c.severity}`);
908
+ const what = c.kind === "question" ? "question" : (c.severity ?? "comment");
909
+ const lines = [`- ${c.id} ${what} on ${describeAnchor(c.anchor, ctx)}`];
940
910
  if (c.follows)
941
- lines.push(` - asks again after ${c.follows}`);
942
- lines.push(` - ${c.body.split("\n").join("\n ")}`);
911
+ lines.push(` asks again after ${c.follows}`);
912
+ lines.push(...shortQuote(anchorRows(ctx, c.anchor)).map((r) => ` ${r}`));
913
+ lines.push(indented(c.body));
943
914
  return lines;
944
915
  }
916
+ case "comment-updated":
917
+ return said(`- ${event.comment.id} edited`, event.comment.body);
945
918
  case "comment-deleted":
946
- return [`- comment ${event.id} was deleted`];
919
+ return [`- ${event.id} deleted`];
947
920
  case "reply":
948
- return [`- ${event.reply.author} replied under ${event.commentId}: ${event.reply.body}`];
921
+ return said(`- ${event.commentId} ${event.reply.author} replied`, event.reply.body);
949
922
  case "concern": {
950
923
  const severity = event.severity === undefined ? "" : ` as ${event.severity}`;
951
924
  const note = event.note === undefined ? "" : `: ${event.note}`;
952
- return [`- concern ${event.concernId} ${event.decision}${severity}${note}`];
925
+ return [`- ${event.concernId} ${event.decision}${severity}${note}`];
953
926
  }
954
927
  case "resolved":
955
- return [`- question ${event.commentId} marked ${event.resolved ? "resolved" : "open again"}`];
928
+ return [`- ${event.commentId} ${event.resolved ? "resolved" : "reopened"}`];
956
929
  case "version":
957
- return [`- plan v${event.version} is now open`];
930
+ return [`- plan v${event.version} is open`];
958
931
  case "submitted":
959
932
  return ["- the reviewer submitted the review"];
960
933
  case "ended":
@@ -965,11 +938,42 @@ function renderEvent(event, ctx) {
965
938
  }
966
939
  }
967
940
  }
968
- /** A markdown digest of what happened on the review page, for `follow-me watch`. */
941
+ /** What happened on the review page, for the entry and `follow-me watch`. */
969
942
  export function renderEvents(events, ctx = null) {
970
- const first = events[0]?.seq;
971
- const last = events.at(-1)?.seq;
972
- const range = first === last ? `event ${first}` : `events ${first}-${last}`;
973
- const body = events.flatMap((event) => renderEvent(event, ctx));
974
- return [`# Review activity (${range})`, "", ...body, ""].join("\n");
943
+ return `${events.flatMap((event) => renderEvent(event, ctx)).join("\n")}\n`;
944
+ }
945
+ /** A unit as prompt.md prints it, and which commits of the plan take its lines. */
946
+ export function renderShownUnit(unit, commits) {
947
+ const taken = commits.flatMap((commit, k) => commit.refs
948
+ .filter((ref) => ref.unit === unit.id)
949
+ .map((ref) => `commit ${k + 1} takes ${formatSelection(ref.unit, ref.select)}`));
950
+ const where = taken.length === 0 ? "in no commit of the plan" : taken.join("; ");
951
+ return `${renderUnit(unit)}\n${where}\n`;
952
+ }
953
+ /** A comment with every row it was made on, its words and the whole thread under it. */
954
+ export function renderShownComment(c, ctx, version) {
955
+ const what = c.kind === "question" ? "question" : (c.severity ?? "comment");
956
+ const lines = [`${c.id} ${what} on plan v${version}, on ${describeAnchor(c.anchor, ctx)}`];
957
+ if (c.follows)
958
+ lines.push(`asks again after ${c.follows}`);
959
+ const rows = anchorRows(ctx, c.anchor);
960
+ const quoted = rows.length > 0 ? rows : (c.context.lines ?? []).map((l) => `> ${l}`);
961
+ lines.push(...quoted.map((r) => ` ${r}`));
962
+ lines.push(...said(c.author === "agent" ? "agent" : "reviewer", c.body));
963
+ for (const reply of c.replies ?? []) {
964
+ const diagram = reply.diagram === undefined ? "" : " (with a diagram)";
965
+ lines.push(...said(`${reply.author} replied${diagram}`, reply.body));
966
+ }
967
+ return `${lines.join("\n")}\n`;
968
+ }
969
+ /** A concern of the plan with the lines it is pinned to, as its commit writes them. */
970
+ export function renderShownConcern(concern, commit, ctx) {
971
+ const where = whereConcern(ctx, { concern, commit, severity: concern.severity, note: null });
972
+ const place = where.path === null ? where.label : `${where.path} ${where.label}`;
973
+ return [
974
+ `${concern.id} ${concern.severity} ${concern.kind} in commit ${commit + 1}, ${place}`,
975
+ ...where.quote.map((r) => ` ${r}`),
976
+ concern.text,
977
+ "",
978
+ ].join("\n");
975
979
  }
@@ -1 +1 @@
1
- import{m as e,t}from"./mermaid-parser.core-CAyLSQpH.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-Dym5afQ5.js";import"./chunk-DSNLSHJZ-DASbe_gb.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-zZdNfMkj.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-vfVMjgx2.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-Bz9b-Thu.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-BPod-Ype.js";import"./chunk-DSNLSHJZ-C3CIwpv0.js";import{n as i,r as a,t as o}from"./chunk-2E7WHVMD-MMnvAgpB.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-BaZipu3b.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-NDVqCM7k.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-G85JKY5k.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 +1 @@
1
- import"./chunk-NGNAAXSQ-C2Wy9Xmz.js";export{M as createArchitectureServices}from"./mermaid-parser.core-CAyLSQpH.js";
1
+ import"./chunk-NGNAAXSQ-C2Wy9Xmz.js";export{M as createArchitectureServices}from"./mermaid-parser.core-Bz9b-Thu.js";