spell 0.8.7 → 0.8.8

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 (243) hide show
  1. package/README-epics.md +96 -36
  2. package/app/package.json +25 -1
  3. package/dist/cli/publish/PublishedPackage.d.ts +2 -1
  4. package/dist/cli/publish/PublishedPackage.js +6 -3
  5. package/dist/cli/publish/ScratchInstall.d.ts +14 -3
  6. package/dist/cli/publish/ScratchInstall.js +69 -8
  7. package/dist/epic/cli/EpicProgram.js +7 -1
  8. package/dist/epic/cli/epicGroups.js +2 -1
  9. package/dist/epic/command/BaseBranch.d.ts +35 -0
  10. package/dist/epic/command/BaseBranch.js +58 -0
  11. package/dist/epic/command/EpicCheckout.d.ts +1 -1
  12. package/dist/epic/command/EpicCheckout.js +4 -4
  13. package/dist/epic/command/EpicGuide.js +3 -2
  14. package/dist/epic/command/EpicTools.d.ts +5 -0
  15. package/dist/epic/command/EpicTools.js +14 -3
  16. package/dist/epic/command/MainMerge.d.ts +26 -15
  17. package/dist/epic/command/MainMerge.js +60 -16
  18. package/dist/epic/command/RepoInit.d.ts +116 -8
  19. package/dist/epic/command/RepoInit.js +308 -13
  20. package/dist/epic/command/Requests.d.ts +1 -0
  21. package/dist/epic/command/Requests.js +6 -1
  22. package/dist/epic/command/SessionMoves.js +2 -1
  23. package/dist/epic/command/SkillsCheck.js +3 -2
  24. package/dist/epic/command/Stock.js +3 -1
  25. package/dist/epic/command/TurnEnd.d.ts +1 -1
  26. package/dist/epic/command/TurnEnd.js +4 -3
  27. package/dist/epic/command/Worktrees.d.ts +18 -3
  28. package/dist/epic/command/Worktrees.js +38 -7
  29. package/dist/epic/command/command.types.d.ts +3 -0
  30. package/dist/epic/components/__pack/epics.entry.js +43 -43
  31. package/dist/epic/components/__pack/epics.pack.js +36 -12794
  32. package/dist/epic/config/EngineFiles.mjs +60 -0
  33. package/dist/epic/config/EpicConfig.d.ts +12 -2
  34. package/dist/epic/config/EpicConfig.js +9 -1
  35. package/dist/epic/config/GitHub.d.ts +41 -1
  36. package/dist/epic/config/GitHub.js +75 -3
  37. package/dist/epic/config/LayeredSettings.js +3 -2
  38. package/dist/epic/server/EpicServer.d.ts +1 -1
  39. package/dist/epic/server/EpicServer.js +26 -12
  40. package/dist/epic/tool/InboxPoller.mjs +2 -1
  41. package/dist/epic/tool/MigrateCommands.js +6 -8
  42. package/dist/epic/tool/PlanDocFiles.js +3 -2
  43. package/dist/epic/tool/ServedFolders.d.ts +1 -1
  44. package/dist/epic/tool/ServedFolders.js +4 -4
  45. package/dist/epic/tools/PageInboxes.js +3 -3
  46. package/dist/epic/tools/_assets/commands.entry.js +149 -68
  47. package/dist/epic/tools/_assets/commands.js +20 -2073
  48. package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
  49. package/dist/epic/tools/_assets/core-reference.js +20 -2142
  50. package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
  51. package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
  52. package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
  53. package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
  54. package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
  55. package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
  56. package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
  57. package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
  58. package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
  59. package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
  60. package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
  61. package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
  62. package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
  63. package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
  64. package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
  65. package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
  66. package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
  67. package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
  68. package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
  69. package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
  70. package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
  71. package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
  72. package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
  73. package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
  74. package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
  75. package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
  76. package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
  77. package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
  78. package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
  79. package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
  80. package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
  81. package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
  82. package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
  83. package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
  84. package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
  85. package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
  86. package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
  87. package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
  88. package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
  89. package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
  90. package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
  91. package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
  92. package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
  93. package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
  94. package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
  95. package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
  96. package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
  97. package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
  98. package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
  99. package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
  100. package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
  101. package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
  102. package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
  103. package/dist/epic/tools/_assets/goals-live.js +318 -210
  104. package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
  105. package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
  106. package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
  107. package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
  108. package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
  109. package/dist/epic/tools/_assets/spell-comments.js +24 -3716
  110. package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
  111. package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
  112. package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
  113. package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
  114. package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
  115. package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
  116. package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
  117. package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
  118. package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
  119. package/dist/epic/tools/pages.d.ts +5 -6
  120. package/dist/epic/tools/pages.js +7 -6
  121. package/dist/epic/window.mjs +2 -3
  122. package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
  123. package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
  124. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
  125. package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
  126. package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
  127. package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
  128. package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
  129. package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
  130. package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
  131. package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
  132. package/dist/ui/components/ui-card/UICards.d.ts +31 -0
  133. package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
  134. package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
  135. package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
  136. package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
  137. package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
  138. package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
  139. package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
  140. package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
  141. package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
  142. package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
  143. package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
  144. package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
  145. package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
  146. package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
  147. package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
  148. package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
  149. package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
  150. package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
  151. package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
  152. package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
  153. package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
  154. package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
  155. package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
  156. package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
  157. package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
  158. package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
  159. package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
  160. package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
  161. package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
  162. package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
  163. package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
  164. package/dist/ui/components/ui-list/UIList.d.ts +2 -0
  165. package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
  166. package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
  167. package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
  168. package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
  169. package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
  170. package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
  171. package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
  172. package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
  173. package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
  174. package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
  175. package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
  176. package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
  177. package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
  178. package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
  179. package/dist/ui/components/ui-parts/UIHeader.d.ts +3 -1
  180. package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
  181. package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
  182. package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
  183. package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
  184. package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
  185. package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
  186. package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
  187. package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
  188. package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
  189. package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
  190. package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
  191. package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
  192. package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
  193. package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
  194. package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
  195. package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
  196. package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
  197. package/dist/ui/components/ui-section/UISections.d.ts +1 -0
  198. package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
  199. package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
  200. package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
  201. package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
  202. package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
  203. package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
  204. package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
  205. package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
  206. package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
  207. package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
  208. package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
  209. package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
  210. package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
  211. package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
  212. package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
  213. package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
  214. package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
  215. package/dist/ui/components/ui-table/UICell.d.ts +1 -0
  216. package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
  217. package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
  218. package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
  219. package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
  220. package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
  221. package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
  222. package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
  223. package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
  224. package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
  225. package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
  226. package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
  227. package/dist/util/spell/constants.js +1 -1
  228. package/epic/.claude-plugin/plugin.json +1 -1
  229. package/epic/.codex-plugin/plugin.json +1 -1
  230. package/epic/hooks/handoff.mjs +4 -3
  231. package/epic/hooks/worktree.mjs +22 -3
  232. package/epic/package.json +41 -2
  233. package/epic/skills/details/SKILL.md +2 -1
  234. package/epic/skills/epic/SKILL.md +7 -1
  235. package/epic/skills/epic/guide.md +4 -0
  236. package/epic/skills/isolate/SKILL.md +35 -0
  237. package/epic/src/AGENTS.md +6 -2
  238. package/epic/templates/durable.html +1 -1
  239. package/epic/vscode/package.json +1 -1
  240. package/epic/vscode/spell-epic.vsix +0 -0
  241. package/package.json +1 -1
  242. package/parser/package.json +1 -1
  243. package/ui/package.json +15 -2
@@ -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 {};
@@ -9,12 +9,26 @@ import { findUp } from "spell/util/node/findUp";
9
9
  import { Git } from "spell/server/Git";
10
10
  import { pathInside } from "spell/server/RealPath";
11
11
  import { EpicConfig } from "../config/EpicConfig.js";
12
+ import { BaseBranch } from "./BaseBranch.js";
12
13
  import { EXIT, EpicCommandError } from "./command.types.js";
13
14
  import { StrayFiles } from "./StrayFiles.js";
14
15
  var SNAPSHOTS = ["tests/*/**/__snapshots__/*.snap", "packages/*/**/__snapshots__/*.snap"];
15
16
  var isSnapshot = /* @__PURE__ */ __name((file) => SNAPSHOTS.some((glob) => matchesGlob(file, glob)), "isSnapshot");
16
17
  var SNAPSHOT_UPDATE = /* @__PURE__ */ __name((tests) => ["yarn", "vp", "test", "run", ...tests, "--update"], "SNAPSHOT_UPDATE");
17
18
  var LOCKFILES = ["yarn.lock", "package-lock.json", "pnpm-lock.yaml", "bun.lock"];
19
+ var LOCKFILE_REGENERATORS = {
20
+ "yarn.lock": ["yarn", "install"],
21
+ "package-lock.json": ["npm", "install", "--package-lock-only", "--ignore-scripts"],
22
+ "pnpm-lock.yaml": ["pnpm", "install", "--lockfile-only", "--ignore-scripts"],
23
+ "bun.lock": ["bun", "install", "--lockfile-only"]
24
+ };
25
+ var READS_CONFLICT_MARKERS = /* @__PURE__ */ new Set(["yarn.lock", "package-lock.json", "pnpm-lock.yaml"]);
26
+ var PACKAGE_RUNNERS = [
27
+ ["yarn.lock", ["yarn"]],
28
+ ["pnpm-lock.yaml", ["pnpm", "exec"]],
29
+ ["bun.lock", ["bunx"]],
30
+ ["bun.lockb", ["bunx"]]
31
+ ];
18
32
  var KIT_PROGRAM = "bin/spell.mjs";
19
33
  var RENAME = ["node", KIT_PROGRAM, "ui", "rename", "--write"];
20
34
  var RENAME_MESSAGE = "merge-main: old Spell UI names renamed (spell ui rename)";
@@ -26,7 +40,7 @@ var MainMerge = class _MainMerge {
26
40
  root;
27
41
  /** the generated outputs and their commands (tests pass their own) */
28
42
  generators;
29
- /** the command that updates the snapshots of `tests` */
43
+ /** the command that updates the snapshots of `tests`; `null`: this repo has no runner we know */
30
44
  snapshotUpdate;
31
45
  /** the command that installs the packages, as words; `[]`: none */
32
46
  install;
@@ -42,24 +56,16 @@ var MainMerge = class _MainMerge {
42
56
  /**
43
57
  * - `root`: the checkout (a worktree, usually)
44
58
  * - `generators`: default the checkout's own list (`generatorsOf()`)
45
- * - `snapshotUpdate`: default `yarn vp test run <tests> --update`
46
- * - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `yarn install`)
59
+ * - `snapshotUpdate`: default the repo's own runner (`snapshotUpdateOf()`)
60
+ * - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `npm install`)
47
61
  * - `rename`: default `node bin/spell.mjs ui rename --write`
48
62
  * - `kitRoot`: default the nearest folder at or above `root` with `bin/spell.mjs` (`kitRootOf()`):
49
63
  * the merged checkout's own kit, so a worktree's child repo uses its worktree's kit, never main's
50
64
  */
51
- constructor({
52
- root,
53
- generators,
54
- snapshotUpdate = SNAPSHOT_UPDATE,
55
- install,
56
- rename = RENAME,
57
- kitRoot,
58
- carryOn
59
- }) {
65
+ constructor({ root, generators, snapshotUpdate, install, rename = RENAME, kitRoot, carryOn }) {
60
66
  this.root = root;
61
67
  this.generators = generators ?? _MainMerge.generatorsOf(root);
62
- this.snapshotUpdate = snapshotUpdate;
68
+ this.snapshotUpdate = snapshotUpdate === void 0 ? _MainMerge.snapshotUpdateOf(root) : snapshotUpdate;
63
69
  this.install = install ?? EpicConfig.of(root).installCommand.split(/\s+/).filter(Boolean);
64
70
  this.rename = rename;
65
71
  this.kitRoot = kitRoot ?? _MainMerge.kitRootOf(root);
@@ -110,6 +116,8 @@ var MainMerge = class _MainMerge {
110
116
  if (merging)
111
117
  throw new EpicCommandError("merge-main: a merge is in progress; `--continue` it, or `git merge --abort`");
112
118
  if (Git.out(["status", "--porcelain", "--untracked-files=no"], root)) Object.assign(report, this.ditchStrays());
119
+ const config = EpicConfig.of(root);
120
+ if (config.baseBranchProtected) report.baseCatchUp = BaseBranch.catchUp(config.main, upstream).line || void 0;
113
121
  if (Git.run(["merge-base", "--is-ancestor", upstream, "HEAD"], root).ok)
114
122
  return { ...report, result: "up-to-date" };
115
123
  if (Git.run(["merge-base", "--is-ancestor", "HEAD", upstream], root).ok) {
@@ -147,7 +155,8 @@ var MainMerge = class _MainMerge {
147
155
  if (report.conflicts.length) return { ...report, result: "conflicts" };
148
156
  for (const { generator, files } of plan) {
149
157
  for (const file of files) {
150
- if (unmerged.includes(file) && file !== "yarn.lock") Git.run(["checkout", "--ours", "--", file], root);
158
+ if (unmerged.includes(file) && !READS_CONFLICT_MARKERS.has(file))
159
+ Git.run(["checkout", "--ours", "--", file], root);
151
160
  }
152
161
  const run = spawnSync(generator.run[0], generator.run.slice(1), {
153
162
  cwd: join(root, generator.cwd),
@@ -347,14 +356,23 @@ ${run.stdout ?? ""}`) || run.error?.message || `exit ${run.status}`;
347
356
  }
348
357
  /**
349
358
  * The generators `files` need, in run order, each with the files it covers:
350
- * `generators`' (a checkout's list, `generatorsOf()`), then one snapshot update per package.
359
+ * a root lockfile's own tool (`LOCKFILE_REGENERATORS`), `generators`' (a checkout's list, `generatorsOf()`), then one
360
+ * snapshot update per package.
351
361
  * - a file no generator covers isn't in any step
362
+ * - a lockfile `generators` covers is theirs
363
+ * - `snapshotUpdate` `null`: no snapshot steps
352
364
  * - `root`: the checkout, where each snapshot's package folder is looked for (`packageFolder()`); left out,
353
365
  * `packages/<name>`
354
366
  * - static: pure, but for looking in `root`
355
367
  */
356
368
  static generatorsFor(files, generators, snapshotUpdate = SNAPSHOT_UPDATE, root) {
357
369
  const steps = generators.map((generator) => ({ generator, files: files.filter((file) => matchesAny(file, generator.outputs)) })).filter((step) => step.files.length);
370
+ const listed = new Set(steps.flatMap((step) => step.files));
371
+ const lockfiles = files.filter((file) => LOCKFILE_REGENERATORS[file] && !listed.has(file)).map((file) => ({
372
+ generator: { name: file, outputs: [file], cwd: ".", run: LOCKFILE_REGENERATORS[file] },
373
+ files: [file]
374
+ }));
375
+ if (!snapshotUpdate) return [...lockfiles, ...steps];
358
376
  const snapshots = /* @__PURE__ */ new Map();
359
377
  for (const snap of files.filter(isSnapshot)) {
360
378
  const cwd = _MainMerge.packageFolder(snap.split("/")[1], root);
@@ -366,7 +384,22 @@ ${run.stdout ?? ""}`) || run.error?.message || `exit ${run.status}`;
366
384
  const generator = { name, outputs: snaps, cwd, run: snapshotUpdate(tests) };
367
385
  steps.push({ generator, files: snaps });
368
386
  }
369
- return steps;
387
+ return [...lockfiles, ...steps];
388
+ }
389
+ /**
390
+ * The command that updates Vitest snapshots in checkout `root`, from the test runner its `package.json` names:
391
+ * - `vite-plus`: `<runner> vp test run <tests> --update`, Spell's
392
+ * - `vitest`: `<runner> vitest run <tests> --update`
393
+ * - neither (or no `package.json`): `null`, so `merge-main` never runs a command the repo hasn't got
394
+ * - `<runner>`: how the repo's lock file runs an installed program (`PACKAGE_RUNNERS`): `yarn`, `pnpm exec` ...,
395
+ * else `npx`
396
+ */
397
+ static snapshotUpdateOf(root) {
398
+ const packages = dependenciesOf(root);
399
+ const runner = PACKAGE_RUNNERS.find(([file]) => existsSync(join(root, file)))?.[1] ?? ["npx"];
400
+ if (packages.has("vite-plus")) return (tests) => [...runner, "vp", "test", "run", ...tests, "--update"];
401
+ if (packages.has("vitest")) return (tests) => [...runner, "vitest", "run", ...tests, "--update"];
402
+ return null;
370
403
  }
371
404
  /**
372
405
  * Package `name`'s folder in checkout `root`, from its root: where its snapshots are updated (its own
@@ -408,6 +441,17 @@ function renamedFiles(out) {
408
441
  });
409
442
  }
410
443
  __name(renamedFiles, "renamedFiles");
444
+ function dependenciesOf(root) {
445
+ try {
446
+ const { dependencies = {}, devDependencies = {} } = JSON.parse(
447
+ readFileSync(join(root, "package.json"), "utf8")
448
+ );
449
+ return /* @__PURE__ */ new Set([...Object.keys(dependencies), ...Object.keys(devDependencies)]);
450
+ } catch {
451
+ return /* @__PURE__ */ new Set();
452
+ }
453
+ }
454
+ __name(dependenciesOf, "dependenciesOf");
411
455
  function lastLine(text) {
412
456
  return text.split("\n").map((line) => line.trim()).filter(Boolean).at(-1) ?? "";
413
457
  }
@@ -6,7 +6,7 @@ import { Shared } from "./Shared";
6
6
  /****************
7
7
  * ### `RepoInit`
8
8
  * `epic init [--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public]
9
- * [--no-plugin] [--no-server] [--dry-run] [--json]`:
9
+ * [--protected-base] [--no-plugin] [--no-server] [--dry-run] [--json]`:
10
10
  * set a repo up for epics (epic `epic-eject` P9), from any folder of its main checkout or a worktree of it; the ONE
11
11
  * command a new repo, and each teammate joining it, runs (epic `epic-friend` P13: `npx spell@next epic init`).
12
12
  *
@@ -57,6 +57,10 @@ import { Shared } from "./Shared";
57
57
  * - it commits the files it wrote in the repo (the config and `.gitignore`) on the base branch, asking first in a
58
58
  * terminal (`commitStep()`; `--no-commit`): every new worktree branches from there, and needs the `.gitignore` to
59
59
  * leave the links alone; on another branch it says so, and commits nothing
60
+ * - a base branch that takes only pull requests (`baseBranchProtected`): it NEVER commits there
61
+ * (`commitViaPullRequest()`): the two files go on a new branch, `epic-setup`, pushed, with a pull request opened
62
+ * (`gh`), else what to run printed; the base branch's checkout is left as it was, and epics start once it's merged
63
+ * - on when `--protected-base` says so, or GitHub does (`protectionStep()`), in one line
60
64
  * - it starts with "Initializing Epic for repo <main>" and ends with "Epics initialized!", in colour; the settings it
61
65
  * wrote are in the file, not printed (Owen, 2026-10-29)
62
66
  ****************/
@@ -106,7 +110,7 @@ export declare class RepoInit {
106
110
  * - SIDE EFFECT (not `dryRun`): writes the config and `.gitignore`, makes (or clones) the epic repo and the
107
111
  * links, may make the epic repo on GitHub and push to it, keeps the person's name in the epic home
108
112
  */
109
- init({ dryRun, name, remote, contentRepo, visibility, noRemote, ask, color, plugin, server, commit, cloned, say }?: InitOptions): Promise<InitReport>;
113
+ init({ dryRun, name, remote, contentRepo, visibility, noRemote, ask, color, plugin, server, commit, cloned, protectedBase, say }?: InitOptions): Promise<InitReport>;
110
114
  /**
111
115
  * The files `epic init` wrote in the repo (the config, `.gitignore`) committed on its base branch, and pushed;
112
116
  * what it did.
@@ -114,6 +118,7 @@ export declare class RepoInit {
114
118
  * - only those files, whatever else is staged (`git commit -- <files>`); none changed: `none`
115
119
  * - on another branch: `other branch`, nothing committed (a worktree branches from the base branch)
116
120
  * - pushed (`pushBranch()`): to the branch's upstream, else `origin`; neither: committed, nothing to push to
121
+ * - a base branch that takes only pull requests: `commitViaPullRequest()` instead, NEVER a commit on it
117
122
  * - NEVER throws: a failed commit is `failed`, a failed push `push: "failed"`, with git's words
118
123
  * - SIDE EFFECT (not `dryRun`): a commit in the repo, a push
119
124
  */
@@ -122,8 +127,87 @@ export declare class RepoInit {
122
127
  ask: boolean;
123
128
  say?: (text: string) => void;
124
129
  }): Promise<CommitReport>;
125
- /** The files `epic init` changed in the repo, still to commit: the config, `.gitignore`. */
126
- static changedFiles({ main }: Pick<InitReport, "main">): string[];
130
+ /**
131
+ * The files `epic init` wrote, for a base branch that takes only pull requests: committed on a new branch
132
+ * (`SETUP_BRANCH`) WITHOUT touching the base branch, pushed, a pull request opened; what it did.
133
+ * - asks first in a terminal, `y` suggested; with no terminal, yes
134
+ * - on another branch: `other branch`, nothing done
135
+ * - a commit of `epic init`'s own on the base branch, not pushed (a run before this setting was on, its push refused):
136
+ * taken back first, keeping its files (`undoOwnCommit()`)
137
+ * - the branch is made without checking it out (`commitOnSetupBranch()`), then the base branch's checkout put back as
138
+ * it was (`restoreBase()`): so "safe to run again", whatever else is staged or changed
139
+ * - the pull request: `gh pr create` when `gh` is logged in; else `pullRequestError` says why, and the lines say what
140
+ * to run
141
+ * - NEVER throws
142
+ * - SIDE EFFECT (not `dryRun`): a branch, a push, a pull request, the two files out of the checkout
143
+ */
144
+ static commitViaPullRequest({ report, ask, say }: {
145
+ report: InitReport;
146
+ ask: boolean;
147
+ say?: (text: string) => void;
148
+ }): Promise<CommitReport>;
149
+ /**
150
+ * Take back `epic init`'s own commit from base branch `base`, when it's its last commit and the only one `origin`'s
151
+ * lacks: an earlier run's, its push refused. Its files stay, uncommitted.
152
+ * - anything else on the branch that `origin`'s lacks: left alone
153
+ * - SIDE EFFECT: `git reset --mixed HEAD~1`
154
+ */
155
+ private static undoOwnCommit;
156
+ /**
157
+ * `files`, as they are on disk, committed on `SETUP_BRANCH`: with a temporary index, so HEAD, the checkout's own
158
+ * index and any other change there are never touched.
159
+ * - from `base`, or on top of the branch when it holds work `base` doesn't (a run before, its pull request open)
160
+ * - nothing new to commit: the branch stays
161
+ * - throws a `GitError` when git can't
162
+ * - SIDE EFFECT: a commit, and the branch made or moved
163
+ */
164
+ private static commitOnSetupBranch;
165
+ /**
166
+ * Put the base branch's checkout back: `files` as HEAD has them, or gone when it hasn't any, so `git status` is clean.
167
+ * - the links `init()` made (`links`) are listed in `.git/info/exclude`: the `.gitignore` that names them is on the
168
+ * setup branch until it's merged
169
+ * - throws a `GitError` when git can't
170
+ * - SIDE EFFECT: the two files, the exclude file
171
+ */
172
+ private static restoreBase;
173
+ /**
174
+ * The pull request for `SETUP_BRANCH`, opened with `gh`: its address, or why not.
175
+ * - NEVER throws
176
+ * - SIDE EFFECT: a pull request on GitHub
177
+ */
178
+ private static pullRequestStep;
179
+ /**
180
+ * Whether the base branch takes only pull requests, and how that's known; what `init()` puts in the config.
181
+ * - already on in the config, or in the setup branch's (run again, its pull request not merged yet): `config`
182
+ * - `protectedBase` (`--protected-base`): `flag`
183
+ * - else GitHub's word (`githubRequiresPullRequest()`): `detected`; no such rule: `off`
184
+ * - a config that says `false` in so many words stays so (a file already there is kept): `says off`, and a note
185
+ * - NEVER throws: failing to find out is `off`, never a failed init
186
+ */
187
+ static protectionStep({ main, configFile, hadConfig, settings, protectedBase }: {
188
+ main: string;
189
+ configFile: string;
190
+ hadConfig: boolean;
191
+ settings: EpicSettings;
192
+ protectedBase: boolean;
193
+ }): ProtectionReport;
194
+ /** Whether `SETUP_BRANCH`, when there is one, holds a config with `baseBranchProtected` on. */
195
+ private static setupBranchSaysProtected;
196
+ /** Whether GitHub, as `gh` can see it, requires a pull request into `base` of checkout `main`'s `origin`. */
197
+ private static githubRequiresPullRequest;
198
+ /**
199
+ * Turn `baseBranchProtected` on in config file `file`, keeping the rest as written.
200
+ * - the line `epic init` writes is changed in place; a file without one gets the key through `DataFile`
201
+ * - SIDE EFFECT: writes the file
202
+ */
203
+ static keepProtected(file: string): void;
204
+ /** What the commit section says first: why `epic init` asks to commit, or to open a pull request. */
205
+ static commitHeader({ config }: Pick<InitReport, "config">): string;
206
+ /**
207
+ * The files `epic init` changed in the repo, still to commit: the config, `.gitignore`.
208
+ * - a dry run wrote nothing: the ones it would have count too
209
+ */
210
+ static changedFiles({ main, dryRun, config, gitignore }: ChangedFilesInput): string[];
127
211
  /** Where `branch` of checkout `main` pushes: its upstream (`git push`), else `origin`; none: `undefined`. */
128
212
  static pushTarget(main: string, branch: string): string[] | undefined;
129
213
  /**
@@ -276,7 +360,7 @@ export declare class RepoInit {
276
360
  /** What needs a word of its own, under the files: the epic repo's problems, the colour's, no name. */
277
361
  static noteLines(report: InitReport): string[];
278
362
  /** What the commit came to (`commitStep()`), under its question. */
279
- static commitResultLines({ action, files, branch, error, push, pushError }: CommitReport): string[];
363
+ static commitResultLines(commit: CommitReport): string[];
280
364
  /** The last lines: done, and where to see the epics (a browser's link, the editor's view); a dry run's word. */
281
365
  static doneLines(report: InitReport): string[];
282
366
  }
@@ -308,6 +392,8 @@ export type InitReport = {
308
392
  file: string;
309
393
  action: "ok" | "updated" | "written";
310
394
  };
395
+ /** whether the base branch takes only pull requests, and how that's known (`protectionStep()`) */
396
+ protection: ProtectionReport;
311
397
  /** the name this machine's person goes by: `kept` now, kept `already`, `would keep` (a dry run), or `none` */
312
398
  person: {
313
399
  name: string | undefined;
@@ -325,14 +411,23 @@ export type InitReport = {
325
411
  /**
326
412
  * What `epic init` did about committing the files it wrote in the repo (`RepoInit.commitStep()`):
327
413
  * `committed`, `would commit`, `declined` (asked, and no), `other branch` (not the base branch), `failed`,
328
- * `none` (nothing to commit)
414
+ * `none` (nothing to commit); for a base branch that takes only pull requests, `on branch` (`SETUP_BRANCH`) and
415
+ * `would branch` in place of the commits
329
416
  */
330
417
  export type CommitReport = {
331
- action: "committed" | "would commit" | "declined" | "other branch" | "failed" | "none";
418
+ action: "committed" | "would commit" | "on branch" | "would branch" | "declined" | "other branch" | "failed" | "none";
332
419
  /** the files, from the repo's root: the config, `.gitignore` */
333
420
  files: string[];
334
- /** the branch the repo is on (the base branch, unless `other branch`) */
421
+ /** the branch the repo is on (the base branch, unless `other branch`), or the setup branch */
335
422
  branch: string;
423
+ /** the base branch takes only pull requests: `commitViaPullRequest()` did this */
424
+ viaPullRequest?: boolean;
425
+ /** the base branch, with `viaPullRequest` */
426
+ base?: string;
427
+ /** the pull request's address */
428
+ pullRequest?: string;
429
+ /** why there's none yet: no `gh`, logged out, or gh's words */
430
+ pullRequestError?: string;
336
431
  /** why it failed */
337
432
  error?: string;
338
433
  /** after the commit: `pushed`, `nowhere` (no upstream, no `origin`), or `failed` (`pushError`, git's words) */
@@ -340,6 +435,17 @@ export type CommitReport = {
340
435
  /** why the push failed */
341
436
  pushError?: string;
342
437
  };
438
+ /**
439
+ * Whether the base branch takes only pull requests (`RepoInit.protectionStep()`): `on`, and how that's known:
440
+ * `config` (it says so), `flag` (`--protected-base`), `detected` (GitHub says so), `off`, or `says off` (GitHub requires
441
+ * one, but the config says `false`, and stays so)
442
+ */
443
+ export type ProtectionReport = {
444
+ action: "config" | "flag" | "detected" | "off" | "says off";
445
+ on: boolean;
446
+ };
447
+ /** What `RepoInit.changedFiles()` reads off the report. */
448
+ export type ChangedFilesInput = Pick<InitReport, "main"> & Partial<Pick<InitReport, "dryRun" | "config" | "gitignore">>;
343
449
  /** What `epic init`'s questions came to (`RepoInit.questions()`): `init()`'s answers, and the summary. */
344
450
  export type Answers = Pick<InitOptions, "name" | "color" | "contentRepo" | "visibility" | "cloned"> & {
345
451
  /** what the summary under the questions says */
@@ -474,6 +580,8 @@ export type InitOptions = {
474
580
  commit?: boolean;
475
581
  /** the team's plans cloned already (`questions()`, for the colours they hold): reported as `cloned` */
476
582
  cloned?: boolean;
583
+ /** the base branch takes only pull requests (`--protected-base`); default `false`: GitHub's word, else off */
584
+ protectedBase?: boolean;
477
585
  /** a progress line, before each slow step (a clone, GitHub, a push, the server); default: nothing said */
478
586
  say?: (text: string) => void;
479
587
  };