spell 0.8.7 → 0.8.9

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 (304) hide show
  1. package/README-epics.md +149 -49
  2. package/app/package.json +25 -1
  3. package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
  4. package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
  5. package/dist/app/app/pages/SiteBoardView.css +5 -5
  6. package/dist/app/app/pages/SiteBoardView.js +1 -1
  7. package/dist/app/app/pages/SiteEditorPage.js +6 -3
  8. package/dist/app/app/pages/SiteEdits.js +27 -10
  9. package/dist/app/app/pages/SiteWrites.js +11 -0
  10. package/dist/app/app/runner/spellRuntime.js +1 -0
  11. package/dist/cli/publish/PublishedPackage.d.ts +2 -1
  12. package/dist/cli/publish/PublishedPackage.js +6 -3
  13. package/dist/cli/publish/ScratchInstall.d.ts +14 -3
  14. package/dist/cli/publish/ScratchInstall.js +69 -8
  15. package/dist/epic/cli/EpicProgram.js +20 -5
  16. package/dist/epic/cli/epicGroups.js +7 -1
  17. package/dist/epic/command/BaseBranch.d.ts +35 -0
  18. package/dist/epic/command/BaseBranch.js +58 -0
  19. package/dist/epic/command/EpicCheckout.d.ts +1 -1
  20. package/dist/epic/command/EpicCheckout.js +4 -4
  21. package/dist/epic/command/EpicGuide.js +3 -2
  22. package/dist/epic/command/EpicTools.d.ts +5 -0
  23. package/dist/epic/command/EpicTools.js +14 -3
  24. package/dist/epic/command/MainMerge.d.ts +26 -15
  25. package/dist/epic/command/MainMerge.js +60 -16
  26. package/dist/epic/command/PullRequest.d.ts +45 -0
  27. package/dist/epic/command/PullRequest.js +100 -0
  28. package/dist/epic/command/RepoInit.d.ts +196 -39
  29. package/dist/epic/command/RepoInit.js +481 -60
  30. package/dist/epic/command/Requests.d.ts +1 -0
  31. package/dist/epic/command/Requests.js +7 -1
  32. package/dist/epic/command/SessionMoves.js +2 -1
  33. package/dist/epic/command/SkillsCheck.js +3 -2
  34. package/dist/epic/command/Stock.js +3 -1
  35. package/dist/epic/command/TurnEnd.d.ts +1 -1
  36. package/dist/epic/command/TurnEnd.js +4 -3
  37. package/dist/epic/command/Worktrees.d.ts +20 -3
  38. package/dist/epic/command/Worktrees.js +39 -7
  39. package/dist/epic/command/command.types.d.ts +3 -0
  40. package/dist/epic/components/__pack/epics.entry.js +43 -43
  41. package/dist/epic/components/__pack/epics.pack.js +36 -12794
  42. package/dist/epic/config/CodeHost.d.ts +96 -0
  43. package/dist/epic/config/CodeHost.js +89 -0
  44. package/dist/epic/config/EngineFiles.mjs +60 -0
  45. package/dist/epic/config/EpicConfig.d.ts +20 -3
  46. package/dist/epic/config/EpicConfig.js +25 -1
  47. package/dist/epic/config/EpicRepo.js +1 -1
  48. package/dist/epic/config/GitHub.d.ts +75 -3
  49. package/dist/epic/config/GitHub.js +106 -5
  50. package/dist/epic/config/GitLab.d.ts +138 -0
  51. package/dist/epic/config/GitLab.js +297 -0
  52. package/dist/epic/config/LayeredSettings.js +3 -2
  53. package/dist/epic/server/EpicServer.d.ts +1 -1
  54. package/dist/epic/server/EpicServer.js +26 -12
  55. package/dist/epic/tool/InboxPoller.mjs +2 -1
  56. package/dist/epic/tool/MigrateCommands.js +6 -8
  57. package/dist/epic/tool/PlanCommits.d.ts +7 -4
  58. package/dist/epic/tool/PlanCommits.js +7 -5
  59. package/dist/epic/tool/PlanDocCommands.js +3 -4
  60. package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
  61. package/dist/epic/tool/PlanDocFiles.js +13 -5
  62. package/dist/epic/tool/ServedFolders.d.ts +1 -1
  63. package/dist/epic/tool/ServedFolders.js +4 -4
  64. package/dist/epic/tools/PageInboxes.js +3 -3
  65. package/dist/epic/tools/_assets/commands.entry.js +149 -68
  66. package/dist/epic/tools/_assets/commands.js +20 -2073
  67. package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
  68. package/dist/epic/tools/_assets/core-reference.js +20 -2142
  69. package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
  70. package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
  71. package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
  72. package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
  73. package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
  74. package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
  75. package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
  76. package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
  77. package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
  78. package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
  79. package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
  80. package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
  81. package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
  82. package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
  83. package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
  84. package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
  85. package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
  86. package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
  87. package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
  88. package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
  89. package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
  90. package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
  91. package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
  92. package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
  93. package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
  94. package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
  95. package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
  96. package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
  97. package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
  98. package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
  99. package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
  100. package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
  101. package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
  102. package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
  103. package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
  104. package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
  105. package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
  106. package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
  107. package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
  108. package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
  109. package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
  110. package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
  111. package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
  112. package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
  113. package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
  114. package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
  115. package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
  116. package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
  117. package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
  118. package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
  119. package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
  120. package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
  121. package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
  122. package/dist/epic/tools/_assets/goals-live.js +318 -210
  123. package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
  124. package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
  125. package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
  126. package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
  127. package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
  128. package/dist/epic/tools/_assets/spell-comments.js +24 -3716
  129. package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
  130. package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
  131. package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
  132. package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
  133. package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
  134. package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
  135. package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
  136. package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
  137. package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
  138. package/dist/epic/tools/pages.d.ts +5 -6
  139. package/dist/epic/tools/pages.js +7 -6
  140. package/dist/epic/window.mjs +2 -3
  141. package/dist/parser/core/classes/View.d.ts +20 -0
  142. package/dist/parser/core/classes/View.js +91 -17
  143. package/dist/parser/core/core.declarations.json5 +18 -0
  144. package/dist/parser/core/core.scopes.js +5 -0
  145. package/dist/parser/core/sites.d.ts +10 -0
  146. package/dist/parser/core/sites.js +12 -0
  147. package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
  148. package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
  149. package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
  150. package/dist/parser/parser/tokenizer/Tokens.js +4 -0
  151. package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
  152. package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
  153. package/dist/parser/py/core/spell_core/apps.py +2 -0
  154. package/dist/parser/spell/PARSING.md +21 -0
  155. package/dist/parser/spell/SpellParser.d.ts +2 -0
  156. package/dist/parser/spell/SpellParser.js +58 -3
  157. package/dist/parser/spell/SpellxTokenizer.js +2 -1
  158. package/dist/parser/spell/SpellxTwin.d.ts +4 -1
  159. package/dist/parser/spell/SpellxTwin.js +10 -3
  160. package/dist/parser/spell/builtinTypes.js +24 -1
  161. package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
  162. package/dist/parser/spell/languages/Language.d.ts +11 -2
  163. package/dist/parser/spell/languages/en/words.js +3 -2
  164. package/dist/parser/spell/languages/es/words.js +7 -4
  165. package/dist/parser/spell/rules/Statement.js +1 -1
  166. package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
  167. package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
  168. package/dist/parser/spell/rules/sites/SitePage.js +2 -2
  169. package/dist/parser/spell/rules/sites/sites.en.js +1 -1
  170. package/dist/parser/spell/rules/sites/sites.es.js +1 -1
  171. package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
  172. package/dist/parser/spell/spell.types.d.ts +7 -0
  173. package/dist/parser/spell/spellSyntax.es.json +6 -6
  174. package/dist/parser/spell/spellSyntax.json +6 -6
  175. package/dist/parser/spellx/SpellxView.js +2 -1
  176. package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
  177. package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
  178. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
  179. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
  180. package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
  181. package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
  182. package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
  183. package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
  184. package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
  185. package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
  186. package/dist/ui/components/ui-card/UICards.d.ts +31 -0
  187. package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
  188. package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
  189. package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
  190. package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
  191. package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
  192. package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
  193. package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
  194. package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
  195. package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
  196. package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
  197. package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
  198. package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
  199. package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
  200. package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
  201. package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
  202. package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
  203. package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
  204. package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
  205. package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
  206. package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
  207. package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
  208. package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
  209. package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
  210. package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
  211. package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
  212. package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
  213. package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
  214. package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
  215. package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
  216. package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
  217. package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
  218. package/dist/ui/components/ui-list/UIList.d.ts +2 -0
  219. package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
  220. package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
  221. package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
  222. package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
  223. package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
  224. package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
  225. package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
  226. package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
  227. package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
  228. package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
  229. package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
  230. package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
  231. package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
  232. package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
  233. package/dist/ui/components/ui-parts/UIHeader.d.ts +15 -3
  234. package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
  235. package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
  236. package/dist/ui/components/ui-parts/UIHeader.js +45 -5
  237. package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
  238. package/dist/ui/components/ui-parts/UIParts.css +18 -0
  239. package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
  240. package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
  241. package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
  242. package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
  243. package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
  244. package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
  245. package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
  246. package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
  247. package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
  248. package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
  249. package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
  250. package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
  251. package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
  252. package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
  253. package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
  254. package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
  255. package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
  256. package/dist/ui/components/ui-section/UISections.d.ts +1 -0
  257. package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
  258. package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
  259. package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
  260. package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
  261. package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
  262. package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
  263. package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
  264. package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
  265. package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
  266. package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
  267. package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
  268. package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
  269. package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
  270. package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
  271. package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
  272. package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
  273. package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
  274. package/dist/ui/components/ui-table/UICell.d.ts +1 -0
  275. package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
  276. package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
  277. package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
  278. package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
  279. package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
  280. package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
  281. package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
  282. package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
  283. package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
  284. package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
  285. package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
  286. package/dist/ui/jsx.d.ts +4 -4
  287. package/dist/ui/vocabulary/defaults.generated.js +1 -1
  288. package/dist/util/spell/constants.js +1 -1
  289. package/epic/.claude-plugin/plugin.json +1 -1
  290. package/epic/.codex-plugin/plugin.json +1 -1
  291. package/epic/hooks/handoff.mjs +4 -3
  292. package/epic/hooks/worktree.mjs +22 -3
  293. package/epic/package.json +41 -2
  294. package/epic/skills/details/SKILL.md +2 -1
  295. package/epic/skills/epic/SKILL.md +7 -1
  296. package/epic/skills/epic/guide.md +3 -0
  297. package/epic/skills/isolate/SKILL.md +53 -20
  298. package/epic/src/AGENTS.md +11 -2
  299. package/epic/templates/durable.html +1 -1
  300. package/epic/vscode/package.json +1 -1
  301. package/epic/vscode/spell-epic.vsix +0 -0
  302. package/package.json +1 -1
  303. package/parser/package.json +1 -1
  304. package/ui/package.json +15 -2
@@ -19,7 +19,7 @@ var ScratchInstall = class {
19
19
  }
20
20
  /** The scratch project's folder. */
21
21
  dir;
22
- /** Install, then run the three checks; every result, passed or failed. NEVER throws. */
22
+ /** Install, then run the checks; every result, passed or failed. NEVER throws. */
23
23
  async run() {
24
24
  const checks = [];
25
25
  const install = this.step("npm install of every .tgz, outside the checkout", () => this.install());
@@ -28,8 +28,10 @@ var ScratchInstall = class {
28
28
  checks.push(this.step("node imports spell/util and spell/parser/parser", () => this.nodeImports()));
29
29
  checks.push(await this.asyncStep("a Vite page draws <ui-button>, with one DOMElement", () => this.page()));
30
30
  checks.push(this.step("npx spell help runs", () => this.spellHelp()));
31
- if (this.packed.some((pkg) => pkg.name === "spell-epic"))
31
+ if (this.packed.some((pkg) => pkg.name === "spell-epic")) {
32
32
  checks.push(this.step("npx epic --help runs (spell-epic's bin, on spell's code)", () => this.epicHelp()));
33
+ checks.push(await this.asyncStep("the epic server starts and serves an epic page", () => this.epicServer()));
34
+ }
33
35
  }
34
36
  if (checks.every((check) => check.ok)) rmSync(this.dir, { recursive: true, force: true });
35
37
  else checks.push({ check: "scratch project kept, to look into", ok: true, detail: this.dir });
@@ -49,7 +51,7 @@ var ScratchInstall = class {
49
51
  dependencies,
50
52
  overrides
51
53
  });
52
- this.exec("npm", ["install", "--no-audit", "--no-fund", "--loglevel=error"], 6e5);
54
+ this.exec("npm", ["install", "--no-audit", "--no-fund", "--loglevel=error"], { timeout: 6e5 });
53
55
  return `${this.packed.length} packages in ${this.dir}`;
54
56
  }
55
57
  /** Node imports two names, from the installed packages' built files. */
@@ -73,6 +75,56 @@ var ScratchInstall = class {
73
75
  if (!/epic/.test(help)) throw new Error(`printed no help: ${help.slice(0, 200)}`);
74
76
  return `${help.split("\n").length} lines`;
75
77
  }
78
+ /**
79
+ * `epic init` in a scratch git repo, under a scratch `HOME` and on a free port: the epic server starts from the
80
+ * install, then an epic page and the epics pack answer. The server is stopped again, whatever happens.
81
+ * - `--no-plugin`: no Claude Code, no editor, no network; `--no-commit`, `--no-remote`: nothing to push
82
+ */
83
+ async epicServer() {
84
+ const home = join(this.dir, "epic-home");
85
+ const repo = join(this.dir, "epic-repo");
86
+ for (const folder of [home, repo]) mkdirSync(folder, { recursive: true });
87
+ const port = await SRV.freePort();
88
+ const env = {
89
+ HOME: home,
90
+ CLAUDE_CONFIG_DIR: join(home, ".claude"),
91
+ SPELL_EPIC_PORT: String(port),
92
+ GIT_DIR: void 0,
93
+ GIT_INDEX_FILE: void 0,
94
+ GIT_WORK_TREE: void 0
95
+ };
96
+ const epic = /* @__PURE__ */ __name((...args) => this.exec("npx", ["--no-install", "epic", ...args], { cwd: repo, env }), "epic");
97
+ this.exec("git", ["init", "-q"], { cwd: repo, env });
98
+ this.exec(
99
+ "git",
100
+ [
101
+ "-c",
102
+ "user.name=Scratch",
103
+ "-c",
104
+ "user.email=scratch@example.com",
105
+ "commit",
106
+ "-q",
107
+ "--allow-empty",
108
+ "-m",
109
+ "scratch"
110
+ ],
111
+ { cwd: repo, env }
112
+ );
113
+ try {
114
+ epic("init", "--no-plugin", "--no-remote", "--no-commit", "--name", "Scratch", "--color", "teal");
115
+ epic("create", "hello", "--title", "Hello");
116
+ const base = `http://127.0.0.1:${port}`;
117
+ const page = await answerOf(`${base}/epics/hello/hello.plan.html`);
118
+ if (!page.includes("<epic-page")) throw new Error("its epic page holds no <epic-page>");
119
+ const pack = await answerOf(`${base}/_epic/pack/epics.pack.js`);
120
+ return `port ${port}: an epic page, ${page.length} bytes; the epics pack, ${pack.length} bytes`;
121
+ } finally {
122
+ try {
123
+ epic("server", "stop");
124
+ } catch {
125
+ }
126
+ }
127
+ }
76
128
  /**
77
129
  * A page importing `spell-ui` and `spell/element`, built by the installed Vite, served, and opened in headless
78
130
  * Chromium: it draws a `<ui-button>`, whose class extends the page's own `E.DOMElement`.
@@ -85,7 +137,7 @@ var ScratchInstall = class {
85
137
  this.exec(
86
138
  "npx",
87
139
  ["--no-install", "vp", "build", "page", "--outDir", "../page-dist", "--emptyOutDir", "--minify", "false"],
88
- 3e5
140
+ { timeout: 3e5 }
89
141
  );
90
142
  const built = join(this.dir, "page-dist");
91
143
  const definitions = readdirSync(built, { recursive: true, withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".js")).map((entry) => readFileSync(join(entry.parentPath, entry.name), "utf8").match(DOM_ELEMENT_CLASS)?.length ?? 0).reduce((sum, count) => sum + count, 0);
@@ -112,15 +164,18 @@ var ScratchInstall = class {
112
164
  ////////////////
113
165
  // ## Helpers
114
166
  ////////////////
115
- /** Run `command` in the scratch folder; its output. Throws with its stderr when it fails. */
116
- exec(command, args, timeout = 12e4) {
167
+ /**
168
+ * Run `command` in the scratch folder (or `cwd`); its output. Throws with its stderr when it fails.
169
+ * - `env`: added to this process's; the checkout's own `epic` variables never reach it
170
+ */
171
+ exec(command, args, { timeout = 12e4, cwd = this.dir, env = {} } = {}) {
117
172
  try {
118
173
  return execFileSync(command, args, {
119
- cwd: this.dir,
174
+ cwd,
120
175
  encoding: "utf8",
121
176
  timeout,
122
177
  stdio: ["ignore", "pipe", "pipe"],
123
- env: { ...process.env, npm_config_update_notifier: "false" }
178
+ env: { ...process.env, EPIC_CHECKOUT: void 0, npm_config_update_notifier: "false", ...env }
124
179
  });
125
180
  } catch (error) {
126
181
  const { stderr, stdout } = error;
@@ -145,6 +200,12 @@ var ScratchInstall = class {
145
200
  }
146
201
  };
147
202
  var DOM_ELEMENT_CLASS = /\bclass DOMElement\b|\bDOMElement = class\b/g;
203
+ async function answerOf(url) {
204
+ const reply = await fetch(url);
205
+ if (!reply.ok) throw new Error(`${url} answered ${reply.status}`);
206
+ return reply.text();
207
+ }
208
+ __name(answerOf, "answerOf");
148
209
  var PAGE_HTML = `<!doctype html>
149
210
  <html>
150
211
  <head><meta charset="utf-8" /><title>spell scratch</title></head>
@@ -18,6 +18,7 @@ import { PersonCommands } from "../command/PersonCommands.js";
18
18
  import { PluginInstall } from "../command/PluginInstall.js";
19
19
  import { SkillsCheck } from "../command/SkillsCheck.js";
20
20
  import { RepoInit } from "../command/RepoInit.js";
21
+ import { PullRequest } from "../command/PullRequest.js";
21
22
  import { Repos } from "../command/Repos.js";
22
23
  import { Requests } from "../command/Requests.js";
23
24
  import { Sessions } from "../command/Sessions.js";
@@ -81,6 +82,9 @@ var EpicProgram = class _EpicProgram {
81
82
  requests(epic.command("merge")).description(
82
83
  "a standing epic's phase onto main at once, fast-forward only; run in the main checkout; a stray snapshot or generated file there is moved aside first, and --ditch moves up to 3 others too, once you say so"
83
84
  ).usage("<epic> [--ditch]").addHelpText("after", example("epic merge epic-workflow"));
85
+ this.verb(epic.command("pr"), (args) => new PullRequest().run(args)).description(
86
+ "push a branch (never forced) and open its pull request against the base branch, a merge request on GitLab; if one's open, says its address and that the push updated it"
87
+ ).usage("<name> [--title <title>] [--body-file <file>]").addHelpText("after", example("epic pr seo --title 'Better titles' --body-file notes.md"));
84
88
  }
85
89
  ////////////////
86
90
  // ## Epic page: making and reading
@@ -445,9 +449,9 @@ var EpicProgram = class _EpicProgram {
445
449
  "the VOICE a kind of page is written in (readme, code ...): its file, for a skill to read; or every voice"
446
450
  ).usage("[<name> | --for <kind>] [--json]").addHelpText("after", VOICE_HELP);
447
451
  this.verb(epic.command("init"), (args) => new RepoInit().run(args)).description(
448
- "set this repo up for epics, the one command to start (npx spell@next epic init): the plugin, its .epic/config.json5, the epic repo beside it (made, or cloned from the team's), shared on GitHub, the links and their .gitignore lines, your name and colour, then the epic server; safe to run again"
452
+ "set this repo up for epics, the one command to start (npx spell@next epic init): the plugin, its .epic/config.json5, the epic repo beside it (made, or cloned from the team's), shared on GitHub or GitLab, the links and their .gitignore lines, your name and colour, then the epic server; safe to run again"
449
453
  ).usage(
450
- "[--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public] [--no-plugin] [--no-commit] [--no-server] [--dry-run] [--json]"
454
+ "[--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public] [--host github|gitlab] [--protected-base] [--no-plugin] [--no-commit] [--no-server] [--dry-run] [--json]"
451
455
  ).addHelpText("after", INIT_HELP);
452
456
  this.verb(epic.command("whoami"), (args) => new PersonCommands().whoami(args)).description(
453
457
  "who you are on the epics: your short name (kept, else your GitHub login, else git's user.name), your full name and GitHub login; with a name, keeps it; --rename also writes it over the old one on every page"
@@ -812,6 +816,7 @@ The keys (folders print absolute; the file's are relative to the main checkout)
812
816
  contentFolder the epic repo: epics, guides, sagas, the logs
813
817
  contentRemote its address, which everyone pulls from and pushes to ("": none); epic init writes it
814
818
  baseBranch the branch worktrees start from and merge into
819
+ baseBranchProtected whether the base branch takes only pull requests: epic init opens one, epic merge refuses
815
820
  worktreesFolder where new worktrees go, <worktreesFolder>/<name>; may be beside the repo
816
821
  (../spell-app.worktrees), the old .claude/worktrees still read then
817
822
  installCommand what makes a new worktree ready to run
@@ -872,10 +877,10 @@ From any folder of the repo (a worktree's too), each step skipped when it's done
872
877
  window names from the repo's; a file already there is kept
873
878
  ../<repo>.epics the epic repo, a git repo of its own: epics/, sagas/, guides/, pages/;
874
879
  cloned instead, when the config names the team's (contentRemote) and it isn't here
875
- the epic repo the epic repo on GitHub, so the team shares the plans: asks what to call it
880
+ the epic repo the epic repo on GitHub or GitLab, so the team shares the plans: asks what to call it
876
881
  (<repo>.epics) and "Private or public?" (private), makes it, pushes, and writes its
877
- address in the config (contentRemote); needs GitHub's command, gh, logged in: without
878
- it, says how to get it
882
+ address in the config (contentRemote); needs the host's command (gh, glab), logged in:
883
+ without it, says how to get it
879
884
  the links each of those folders linked in at the checkout's root
880
885
  .gitignore the links listed between # shared:start and # shared:end
881
886
  your name "What do you want to be called?" (--name), kept in ~/.spell-epic/person.json5
@@ -883,6 +888,8 @@ From any folder of the repo (a worktree's too), each step skipped when it's done
883
888
  with the plans, in the epic repo's people/
884
889
  the commit .epic/config.json5 and .gitignore committed on the base branch ("Commit ... on main?",
885
890
  yes suggested); on another branch it says so; --no-commit skips it
891
+ a base branch that takes only pull requests: they go on a new branch, epic-setup, which it
892
+ pushes and opens a pull request for; local main stays as it was
886
893
  the epic server started, serving this repo: its address printed; --no-server skips it
887
894
  Then push the base branch: a teammate's epic init then clones the plans.
888
895
 
@@ -891,6 +898,14 @@ Then push the base branch: a teammate's epic init then clones the plans.
891
898
  --public makes the epic repo public without asking; with no terminal to ask in, it's private unless --public.
892
899
  A public one shows everything in the plans (epic pages, guides, comments) to anyone.
893
900
 
901
+ --protected-base: the base branch takes only pull requests (baseBranchProtected in the config). Without it,
902
+ epic init asks GitHub or GitLab, with its command (gh, glab) logged in and a remote there, and says in one line when
903
+ it found so.
904
+
905
+ --host github|gitlab: where the code is hosted (codeHost in the config). Left out, it's read off the origin
906
+ remote's address; for an address that doesn't say (git.acme.com), epic init asks in a terminal, and with no
907
+ terminal stays on GitHub and says so.
908
+
894
909
  --name <name> is the name you go by on the epics, kept in ~/.spell-epic/person.json5 (epic whoami);
895
910
  without it, epic init asks in a terminal, suggesting your GitHub login (else git's user.name), and takes that
896
911
  anywhere else.
@@ -387,7 +387,7 @@ var GROUP_VERBS = {
387
387
  example: "epic worktree remove seo",
388
388
  flags: {
389
389
  "--force": "git's: one with changes too",
390
- "--branches": "and its branch in each repo, when merged (git branch -d)"
390
+ "--branches": "and its branch in each repo, when merged (git branch -d; a merged pull request counts, where main takes only those)"
391
391
  }
392
392
  },
393
393
  {
@@ -1240,10 +1240,16 @@ var VERB_FLAGS = {
1240
1240
  "--public": "make the epic repo public, without asking (else asked, or private)",
1241
1241
  "--no-plugin": "don't install the epic plugin for Claude Code",
1242
1242
  "--no-commit": "don't commit .epic/config.json5 and .gitignore on the base branch",
1243
+ "--protected-base": "the base branch takes only pull requests: put the two files on a new branch, epic-setup, and open one",
1243
1244
  "--no-server": "don't start the epic server",
1245
+ "--host <github|gitlab>": "where the code is hosted, for an address that doesn't say",
1244
1246
  "--dry-run": "only say what it would do",
1245
1247
  "--json": "print what it did as JSON"
1246
1248
  },
1249
+ pr: {
1250
+ "--title <title>": "the request's title (default: its one commit's subject, else the branch's name)",
1251
+ "--body-file <file>": "the request's description, from a file"
1252
+ },
1247
1253
  whoami: {
1248
1254
  "--rename": "keep the name, and write it over your old one wherever it says who wrote something",
1249
1255
  "--dry-run": "with --rename: only say what it would change",
@@ -0,0 +1,35 @@
1
+ /****************
2
+ * ### `BaseBranch`
3
+ * Bringing the LOCAL base branch up to date with `origin`, for a repo whose base branch takes only pull requests
4
+ * (`baseBranchProtected`).
5
+ * - Why: new worktrees are cut from local `main`, and `epic worktree merge-main` merges local `main`.
6
+ * Nothing lands on it here any more, so without this it goes stale the moment GitHub merges a pull request.
7
+ * - Who: the worktree hook, before it makes a new worktree; `MainMerge`, before it merges.
8
+ * - Safe or not at all: fast-forward only, and only over a clean checkout.
9
+ * Offline, diverged, ahead or dirty, it changes nothing, says so in one line, and the caller carries on.
10
+ * - Its position: node's own modules and the kit's `Git` only, so plain `node` loads it (the worktree hook);
11
+ * NEVER an `enum` or a parameter property.
12
+ * - All `static`: no state.
13
+ ****************/
14
+ export declare class BaseBranch {
15
+ /**
16
+ * Fast-forward branch `base` of main checkout `main` from `origin`, when that can be done safely.
17
+ * - `base` checked out there: `git merge --ff-only`, only with nothing uncommitted there
18
+ * - `base` not checked out there: `git fetch origin <base>:<base>`, which git itself does only as a fast-forward
19
+ * - NEVER throws
20
+ * - SIDE EFFECT: a fetch, and the local branch and its checkout moved
21
+ */
22
+ static catchUp(main: string, base: string): BaseCatchUp;
23
+ }
24
+ /**
25
+ * What `BaseBranch.catchUp()` did.
26
+ * - `action`:
27
+ * - `fast-forwarded`: it moved; `current`: nothing to do
28
+ * - `no remote`: no `origin`, or it has no such branch
29
+ * - `offline`, `ahead`, `diverged`, `dirty`, `failed`: left as it was
30
+ * - `line`: what to tell the person; `""`: nothing worth saying
31
+ */
32
+ export type BaseCatchUp = {
33
+ action: "fast-forwarded" | "current" | "no remote" | "offline" | "ahead" | "diverged" | "dirty" | "failed";
34
+ line: string;
35
+ };
@@ -0,0 +1,58 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/command/BaseBranch.ts
5
+ import { Git } from "spell/server/Git";
6
+ var BaseBranch = class {
7
+ static {
8
+ __name(this, "BaseBranch");
9
+ }
10
+ /**
11
+ * Fast-forward branch `base` of main checkout `main` from `origin`, when that can be done safely.
12
+ * - `base` checked out there: `git merge --ff-only`, only with nothing uncommitted there
13
+ * - `base` not checked out there: `git fetch origin <base>:<base>`, which git itself does only as a fast-forward
14
+ * - NEVER throws
15
+ * - SIDE EFFECT: a fetch, and the local branch and its checkout moved
16
+ */
17
+ static catchUp(main, base) {
18
+ if (!Git.out(["remote", "get-url", "origin"], main)) return { action: "no remote", line: "" };
19
+ const fetched = Git.run(["fetch", "-q", "origin", base], main, { timeout: NETWORK_TIMEOUT });
20
+ if (!fetched.ok) {
21
+ const why = firstLine(fetched.err) || "the fetch failed";
22
+ return { action: "offline", line: `couldn't reach origin (${why}): going on from local ${base}, maybe behind` };
23
+ }
24
+ const theirs = `refs/remotes/origin/${base}`;
25
+ const ours = `refs/heads/${base}`;
26
+ const [local, remote] = [Git.out(["rev-parse", ours], main), Git.out(["rev-parse", theirs], main)];
27
+ if (!local || !remote) return { action: "no remote", line: "" };
28
+ if (local === remote) return { action: "current", line: "" };
29
+ const behind = Git.out(["rev-list", "--count", `${ours}..${theirs}`], main) ?? "0";
30
+ const ahead = Git.out(["rev-list", "--count", `${theirs}..${ours}`], main) ?? "0";
31
+ if (ahead !== "0")
32
+ return behind === "0" ? {
33
+ action: "ahead",
34
+ line: `local ${base} is ${ahead} commit(s) ahead of origin's, which only a pull or merge request can bring there`
35
+ } : {
36
+ action: "diverged",
37
+ line: `local ${base} and origin's have diverged (${ahead} commit(s) only here): going on from local ${base}`
38
+ };
39
+ const onBase = Git.out(["branch", "--show-current"], main) === base;
40
+ if (onBase && Git.out(["status", "--porcelain", "--untracked-files=no"], main))
41
+ return { action: "dirty", line: `local ${base} has uncommitted changes: not fast-forwarded, going on from it` };
42
+ const moved = onBase ? Git.run(["merge", "-q", "--ff-only", theirs], main, { timeout: NETWORK_TIMEOUT }) : Git.run(["fetch", "-q", "origin", `${base}:${base}`], main, { timeout: NETWORK_TIMEOUT });
43
+ if (!moved.ok)
44
+ return {
45
+ action: "failed",
46
+ line: `couldn't fast-forward local ${base} (${firstLine(moved.err) || "git said no"}): going on from it`
47
+ };
48
+ return { action: "fast-forwarded", line: `local ${base} fast-forwarded from origin (${behind} commit(s))` };
49
+ }
50
+ };
51
+ var NETWORK_TIMEOUT = 6e4;
52
+ function firstLine(text) {
53
+ return text.split("\n")[0]?.trim() ?? "";
54
+ }
55
+ __name(firstLine, "firstLine");
56
+ export {
57
+ BaseBranch
58
+ };
@@ -37,7 +37,7 @@ export declare class EpicCheckout {
37
37
  */
38
38
  static mustGit(args: string[], cwd: string, options?: SRV.GitOptions): string;
39
39
  /**
40
- * The checkout this code is in: `src/command/` is two folders down.
40
+ * The checkout this code is in (`EngineFiles.root`; the `epic/` of the `spell` package, in an npm install).
41
41
  * - static: where the running `epic`'s own copy of every tool is (`EpicTools`)
42
42
  */
43
43
  static readonly CODE_ROOT: string;
@@ -3,10 +3,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/command/EpicCheckout.ts
5
5
  import { existsSync } from "node:fs";
6
- import { join, resolve } from "node:path";
7
- import { fileURLToPath } from "node:url";
6
+ import { join } from "node:path";
8
7
  import { findUp } from "spell/util/node/findUp";
9
8
  import { Git } from "spell/server/Git";
9
+ import { EngineFiles } from "../config/EngineFiles.mjs";
10
10
  import { EpicCommandError } from "./command.types.js";
11
11
  var CONFIG_FILE = ".epic/config.json5";
12
12
  var EpicCheckout = class _EpicCheckout {
@@ -51,10 +51,10 @@ var EpicCheckout = class _EpicCheckout {
51
51
  }
52
52
  }
53
53
  /**
54
- * The checkout this code is in: `src/command/` is two folders down.
54
+ * The checkout this code is in (`EngineFiles.root`; the `epic/` of the `spell` package, in an npm install).
55
55
  * - static: where the running `epic`'s own copy of every tool is (`EpicTools`)
56
56
  */
57
- static CODE_ROOT = resolve(fileURLToPath(import.meta.url), "..", "..", "..");
57
+ static CODE_ROOT = EngineFiles.root;
58
58
  };
59
59
  export {
60
60
  EpicCheckout
@@ -3,7 +3,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/command/EpicGuide.ts
5
5
  import { readFileSync } from "node:fs";
6
- import { dirname, join } from "node:path";
6
+ import { dirname } from "node:path";
7
+ import { EngineFiles } from "../config/EngineFiles.mjs";
7
8
  import { EXIT, EpicCommandError, parseVerbArgs } from "./command.types.js";
8
9
  var EpicGuide = class _EpicGuide {
9
10
  static {
@@ -75,7 +76,7 @@ var EpicGuide = class _EpicGuide {
75
76
  return EXIT.OK;
76
77
  }
77
78
  };
78
- var GUIDE_FILE = join(dirname(dirname(import.meta.dirname)), "skills", "epic", "guide.md");
79
+ var GUIDE_FILE = EngineFiles.path("skills/epic/guide.md");
79
80
  var TOPIC_HEADING = /^## ([\w-]+) -- (.+)$/m;
80
81
  var FIRST_TOPIC = "workflow";
81
82
  var TOPIC_WIDTH = 18;
@@ -38,6 +38,11 @@ export declare class EpicTools {
38
38
  * - else `codeRoot`, the running `epic`'s checkout
39
39
  */
40
40
  static codeOf(spec: ToolSpec, data: string, codeRoot?: string): string | undefined;
41
+ /**
42
+ * `spec` as it runs from code folder `code`: as written in a checkout;
43
+ * in an npm install, the built `.js`, from the engine's folder, and no `tsx` (`EngineFiles`).
44
+ */
45
+ private static builtTool;
41
46
  /**
42
47
  * Run the `epic` tool's command line `argv` (`add seo judgement "Title"`, the tool's own order) IN this process:
43
48
  * `PlanDocCommands`, on the caller's checkout's epic pages (`PlanDocFiles`).
@@ -3,9 +3,10 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
3
3
 
4
4
  // src/command/EpicTools.ts
5
5
  import { existsSync } from "node:fs";
6
- import { join } from "node:path";
6
+ import { join, relative } from "node:path";
7
7
  import { settingsParts } from "spell/server/page/settings";
8
8
  import { CLI } from "spell/cli";
9
+ import { EngineFiles } from "../config/EngineFiles.mjs";
9
10
  import { firstPackageDir, KIT_PACKAGES } from "../tools/packageDir.js";
10
11
  import { EpicCheckout } from "./EpicCheckout.js";
11
12
  import { EXIT } from "./command.types.js";
@@ -38,13 +39,14 @@ var EpicTools = class _EpicTools {
38
39
  `);
39
40
  return Promise.resolve(EXIT.ERRORS);
40
41
  }
42
+ const tool = _EpicTools.builtTool(spec, code);
41
43
  const toolCwd = spec.cwd && (existsSync(join(data, spec.cwd)) ? join(data, spec.cwd) : join(code, spec.cwd));
42
- return CLI.runChild(process.execPath, [...CLI.toolArgs(spec, code), ...args], {
44
+ return CLI.runChild(process.execPath, [...CLI.toolArgs(tool, code), ...args], {
43
45
  cwd: toolCwd || cwd,
44
46
  env: {
45
47
  ...process.env,
46
48
  EPIC_CHECKOUT: data,
47
- ...spec.tsx ? { TSX_TSCONFIG_PATH: join(code, spec.tsx) } : {},
49
+ ...tool.tsx ? { TSX_TSCONFIG_PATH: join(code, tool.tsx) } : {},
48
50
  ...env
49
51
  }
50
52
  });
@@ -59,6 +61,15 @@ var EpicTools = class _EpicTools {
59
61
  if (spec.package) return firstPackageDir(spec.package, data);
60
62
  return spec.code === "caller" ? data : codeRoot;
61
63
  }
64
+ /**
65
+ * `spec` as it runs from code folder `code`: as written in a checkout;
66
+ * in an npm install, the built `.js`, from the engine's folder, and no `tsx` (`EngineFiles`).
67
+ */
68
+ static builtTool(spec, code) {
69
+ if (spec.package || !EngineFiles.isBuilt || code !== EngineFiles.root) return spec;
70
+ const { tsx: _tsx, ...plain } = spec;
71
+ return { ...plain, tool: relative(code, EngineFiles.path(spec.tool)) };
72
+ }
62
73
  ////////////////
63
74
  // ## The `epic` tool, in this process
64
75
  ////////////////
@@ -1,9 +1,4 @@
1
1
  import { type Generator, type MergeMainReport } from "./command.types";
2
- /**
3
- * The command that updates the snapshots of `tests` (relative to their package), run in the package.
4
- * - `--update` AFTER the files: it takes an optional value, so before them it swallows the first one
5
- */
6
- declare const SNAPSHOT_UPDATE: (tests: string[]) => string[];
7
2
  /****************
8
3
  * ### `MainMerge`
9
4
  * `epic worktree merge-main`: merge `main` into this checkout's branch,
@@ -21,8 +16,11 @@ declare const SNAPSHOT_UPDATE: (tests: string[]) => string[];
21
16
  * a file `main` changed, or in conflict, that the merged `.gitignore` ignores and one side's tree lacks,
22
17
  * leaves the index and stays on disk (`untracked`).
23
18
  * - e.g. the bundles the page server builds since 2026-10-07 (`spell bundle`)
24
- * - Snapshots are regenerated with `vp test run --update`, then each entry is compared to both sides:
25
- * one NEITHER side had is new behaviour nobody reviewed, so it's reported (`review`), never hidden.
19
+ * - A root lockfile changed on both sides is rewritten by its own tool (`npm install --package-lock-only` ...), from
20
+ * the merged `package.json`, unless the checkout lists a generator of its own for it.
21
+ * - Snapshots are regenerated by the repo's own test runner (`snapshotUpdateOf()`), then each entry is compared to both
22
+ * sides: one NEITHER side had is new behaviour nobody reviewed, so it's reported (`review`), never hidden.
23
+ * - a repo with neither Vitest nor Vite+: its snapshot files are ordinary files, to resolve by hand if they conflict
26
24
  * - Any OTHER file in conflict stops it mid-merge:
27
25
  * Claude resolves those, `git add`s them, and runs it again with `--continue`.
28
26
  * - A merge (or fast-forward) that changed a lockfile runs the checkout's install command after it (`reinstall()`).
@@ -35,8 +33,8 @@ export declare class MainMerge {
35
33
  readonly root: string;
36
34
  /** the generated outputs and their commands (tests pass their own) */
37
35
  readonly generators: Generator[];
38
- /** the command that updates the snapshots of `tests` */
39
- readonly snapshotUpdate: (tests: string[]) => string[];
36
+ /** the command that updates the snapshots of `tests`; `null`: this repo has no runner we know */
37
+ readonly snapshotUpdate: SnapshotUpdate | null;
40
38
  /** the command that installs the packages, as words; `[]`: none */
41
39
  readonly install: string[];
42
40
  /** the rename step's command, as words, the files appended; `[]`: no step */
@@ -51,8 +49,8 @@ export declare class MainMerge {
51
49
  /**
52
50
  * - `root`: the checkout (a worktree, usually)
53
51
  * - `generators`: default the checkout's own list (`generatorsOf()`)
54
- * - `snapshotUpdate`: default `yarn vp test run <tests> --update`
55
- * - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `yarn install`)
52
+ * - `snapshotUpdate`: default the repo's own runner (`snapshotUpdateOf()`)
53
+ * - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `npm install`)
56
54
  * - `rename`: default `node bin/spell.mjs ui rename --write`
57
55
  * - `kitRoot`: default the nearest folder at or above `root` with `bin/spell.mjs` (`kitRootOf()`):
58
56
  * the merged checkout's own kit, so a worktree's child repo uses its worktree's kit, never main's
@@ -145,16 +143,28 @@ export declare class MainMerge {
145
143
  static generatorsOf(root: string): Generator[];
146
144
  /**
147
145
  * The generators `files` need, in run order, each with the files it covers:
148
- * `generators`' (a checkout's list, `generatorsOf()`), then one snapshot update per package.
146
+ * a root lockfile's own tool (`LOCKFILE_REGENERATORS`), `generators`' (a checkout's list, `generatorsOf()`), then one
147
+ * snapshot update per package.
149
148
  * - a file no generator covers isn't in any step
149
+ * - a lockfile `generators` covers is theirs
150
+ * - `snapshotUpdate` `null`: no snapshot steps
150
151
  * - `root`: the checkout, where each snapshot's package folder is looked for (`packageFolder()`); left out,
151
152
  * `packages/<name>`
152
153
  * - static: pure, but for looking in `root`
153
154
  */
154
- static generatorsFor(files: string[], generators: Generator[], snapshotUpdate?: typeof SNAPSHOT_UPDATE, root?: string): {
155
+ static generatorsFor(files: string[], generators: Generator[], snapshotUpdate?: SnapshotUpdate | null, root?: string): {
155
156
  generator: Generator;
156
157
  files: string[];
157
158
  }[];
159
+ /**
160
+ * The command that updates Vitest snapshots in checkout `root`, from the test runner its `package.json` names:
161
+ * - `vite-plus`: `<runner> vp test run <tests> --update`, Spell's
162
+ * - `vitest`: `<runner> vitest run <tests> --update`
163
+ * - neither (or no `package.json`): `null`, so `merge-main` never runs a command the repo hasn't got
164
+ * - `<runner>`: how the repo's lock file runs an installed program (`PACKAGE_RUNNERS`): `yarn`, `pnpm exec` ...,
165
+ * else `npx`
166
+ */
167
+ static snapshotUpdateOf(root: string): SnapshotUpdate | null;
158
168
  /**
159
169
  * Package `name`'s folder in checkout `root`, from its root: where its snapshots are updated (its own
160
170
  * `vitest.config.ts`).
@@ -172,14 +182,15 @@ export declare class MainMerge {
172
182
  */
173
183
  static snapshotEntries(text: string): Map<string, string>;
174
184
  }
185
+ /** A command that updates the snapshots of `tests` (paths from their package), as words. */
186
+ export type SnapshotUpdate = (tests: string[]) => string[];
175
187
  /** What `new MainMerge()` takes: see its constructor. */
176
188
  export type MainMergeProps = {
177
189
  root: string;
178
190
  generators?: Generator[];
179
- snapshotUpdate?: (tests: string[]) => string[];
191
+ snapshotUpdate?: SnapshotUpdate | null;
180
192
  install?: string[];
181
193
  rename?: string[];
182
194
  kitRoot?: string;
183
195
  carryOn?: string[];
184
196
  };
185
- export {};