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
@@ -2,7 +2,17 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/command/RepoInit.ts
5
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
+ import {
6
+ appendFileSync,
7
+ existsSync,
8
+ mkdirSync,
9
+ mkdtempSync,
10
+ readFileSync,
11
+ rmSync,
12
+ rmdirSync,
13
+ writeFileSync
14
+ } from "node:fs";
15
+ import { tmpdir } from "node:os";
6
16
  import { basename, dirname, join, relative } from "node:path";
7
17
  import chalk from "chalk";
8
18
  import { DataFile } from "spell/server/DataFile";
@@ -11,6 +21,7 @@ import { CLI } from "spell/cli";
11
21
  import { Editor } from "../config/Editor.js";
12
22
  import { EpicConfig } from "../config/EpicConfig.js";
13
23
  import { EpicHome } from "../config/EpicHome.js";
24
+ import { CodeHost } from "../config/CodeHost.js";
14
25
  import { GitHub } from "../config/GitHub.js";
15
26
  import { PeopleColors } from "../config/PeopleColors.js";
16
27
  import { VoiceColor } from "../config/VoiceColor.js";
@@ -39,7 +50,16 @@ var RepoInit = class _RepoInit {
39
50
  }
40
51
  /** Run `epic init <args>`; resolves to the exit code. Throws `EpicCommandError` outside a git repo. */
41
52
  async run(args) {
42
- const { flags } = parseVerbArgs(args, ["dryRun", "json", "noRemote", "public", "noPlugin", "noServer", "noCommit"]);
53
+ const { flags } = parseVerbArgs(args, [
54
+ "dryRun",
55
+ "json",
56
+ "noRemote",
57
+ "public",
58
+ "noPlugin",
59
+ "noServer",
60
+ "noCommit",
61
+ "protectedBase"
62
+ ]);
43
63
  const dryRun = flags.dryRun === true;
44
64
  const remote = stringFlag(flags.remote);
45
65
  const contentRepo = stringFlag(flags.contentRepo);
@@ -48,7 +68,12 @@ var RepoInit = class _RepoInit {
48
68
  throw new EpicCommandError("epic init: give one of --content-repo, --remote or --no-remote");
49
69
  if (contentRepo && !REPO_NAME.test(contentRepo))
50
70
  throw new EpicCommandError(
51
- `epic init: --content-repo ${contentRepo} isn't a GitHub repo name; letters, digits, ".", "-" and "_" only`
71
+ `epic init: --content-repo ${contentRepo} isn't a repo name; letters, digits, ".", "-" and "_" only`
72
+ );
73
+ const host = flags.host;
74
+ if (host !== void 0 && !CodeHost.isKind(host))
75
+ throw new EpicCommandError(
76
+ `epic init: --host ${String(host)} isn't a code host: one of ${CodeHost.KINDS.join(", ")}`
52
77
  );
53
78
  const color = stringFlag(flags.color);
54
79
  if (color !== void 0 && !VoiceColor.isColor(color))
@@ -70,6 +95,7 @@ var RepoInit = class _RepoInit {
70
95
  contentRepo,
71
96
  visibility: flags.public === true ? "public" : void 0,
72
97
  noRemote,
98
+ host,
73
99
  say
74
100
  });
75
101
  print(_RepoInit.summaryLines(answers.plan));
@@ -85,16 +111,24 @@ var RepoInit = class _RepoInit {
85
111
  noRemote,
86
112
  color: answers.color,
87
113
  cloned: answers.cloned,
114
+ codeHost: answers.codeHost,
115
+ protectedBase: flags.protectedBase === true,
88
116
  say
89
117
  });
90
118
  if (plugin) report.plugin = plugin;
91
119
  print([..._RepoInit.fileLines(report, { head: false }), ..._RepoInit.noteLines(report)]);
92
120
  if (flags.noCommit !== true && report.content.action !== "missing") {
93
- if (_RepoInit.changedFiles(report).length) print(["", chalk.bold(COMMIT_HEADER)]);
121
+ if (_RepoInit.changedFiles(report).length) print(["", chalk.bold(_RepoInit.commitHeader(report))]);
94
122
  report.commit = await _RepoInit.commitStep({ report, ask, say });
95
- print(_RepoInit.commitResultLines(report.commit));
123
+ print(_RepoInit.commitResultLines(report.commit, _RepoInit.wordsOf(report)));
124
+ } else if (flags.noCommit === true && report.config.settings.baseBranchProtected) {
125
+ const files = _RepoInit.changedFiles(report);
126
+ if (files.length)
127
+ print([
128
+ `> Not committed (--no-commit): ${report.config.settings.baseBranch} takes only ${_RepoInit.wordsOf(report).pullRequest}s, so put ${files.join(" and ")} on a branch and open one`
129
+ ]);
96
130
  }
97
- if (flags.noServer !== true && report.content.action !== "missing") {
131
+ if (flags.noServer !== true && report.content.action !== "missing" && report.commit?.action !== "on branch") {
98
132
  if (!dryRun) say("starting the epic server…");
99
133
  report.server = await this.serverStep({ dryRun });
100
134
  }
@@ -105,10 +139,11 @@ var RepoInit = class _RepoInit {
105
139
  /**
106
140
  * `epic init`'s questions, ALL asked before anything is done (Owen, 2026-10-29): the answers, and what they come to.
107
141
  * - their name, every time (`askName()`); `name` (`--name`) answers it
142
+ * - where the code is hosted, only when the `origin` address doesn't say and nothing else does (`codeHostChoice()`)
108
143
  * - their colour, from the names nobody has (`askColor()`), unless they have one already; `color` answers it
109
144
  * - a teammate joining, the team's plans not here yet: cloned FIRST, quietly, so the taken colours are known
110
145
  * (`cloned`; `init()` reports it)
111
- * - the epic repo's name and private or public, only when `init()` will make it on GitHub (`willMakeRepo()`)
146
+ * - the epic repo's name and private or public, only when `init()` will make it on the code host (`willMakeRepo()`)
112
147
  * - no terminal (`ask` off): nothing asked; the plan says what the flags and the suggestions come to
113
148
  * - SIDE EFFECT: the clone, for a teammate joining (not `dryRun`)
114
149
  */
@@ -121,14 +156,18 @@ var RepoInit = class _RepoInit {
121
156
  contentRepo,
122
157
  visibility,
123
158
  noRemote,
159
+ host,
124
160
  say = /* @__PURE__ */ __name(() => {
125
161
  }, "say")
126
162
  }) {
127
163
  const { main } = this;
128
- const settings = _RepoInit.settingsOf(main);
129
- const content = join(main, settings.contentFolder);
164
+ const found = _RepoInit.settingsOf(main);
165
+ const content = join(main, found.contentFolder);
130
166
  const answers = { name, color, contentRepo, visibility, plan: {} };
131
- if (ask && !name) answers.name = await _RepoInit.askName();
167
+ answers.codeHost = await _RepoInit.codeHostChoice({ main, host, ask });
168
+ const settings = { ...found, codeHost: answers.codeHost.kind };
169
+ const codeHost = CodeHost.of({ main, codeHost: settings.codeHost });
170
+ if (ask && !name) answers.name = await _RepoInit.askName(codeHost);
132
171
  const person = answers.name?.trim() || EpicHome.person().name;
133
172
  const address = settings.contentRemote;
134
173
  if (address && !noRemote && !dryRun && !existsSync(content)) {
@@ -153,9 +192,9 @@ var RepoInit = class _RepoInit {
153
192
  return answers;
154
193
  }
155
194
  /**
156
- * Whether `init()` will make the epic repo on GitHub: its owner when it will, else `undefined`.
195
+ * Whether `init()` will make the epic repo on the code host: its owner when it will, else `undefined`.
157
196
  * - not when the epic repo has a remote, the config names one, or `remote` / `noRemote` was given
158
- * - only with `gh` installed and logged in (`GitHub.status()`, a few seconds), as `remoteStep()` asks
197
+ * - only with the host's command installed and logged in (`status()`, a few seconds), as `remoteStep()` asks
159
198
  */
160
199
  willMakeRepo({
161
200
  settings,
@@ -165,8 +204,9 @@ var RepoInit = class _RepoInit {
165
204
  }) {
166
205
  if (noRemote || remote || settings.contentRemote) return void 0;
167
206
  if (existsSync(join(content, ".git")) && Git.out(["remote", "get-url", "origin"], content)) return void 0;
168
- if (GitHub.status() !== "ready") return void 0;
169
- const owner = _RepoInit.ownerFor(this.main);
207
+ const host = CodeHost.of({ main: this.main, codeHost: settings.codeHost });
208
+ if (host.status() !== "ready") return void 0;
209
+ const owner = _RepoInit.ownerFor(this.main, host);
170
210
  return owner ? { owner } : void 0;
171
211
  }
172
212
  /** The settings in force in checkout `main`: its config's, else what `epic init` would write. */
@@ -177,7 +217,7 @@ var RepoInit = class _RepoInit {
177
217
  * Set the repo up (the class's steps); what it did, or would do with `dryRun`.
178
218
  * - the options: `InitOptions`
179
219
  * - SIDE EFFECT (not `dryRun`): writes the config and `.gitignore`, makes (or clones) the epic repo and the
180
- * links, may make the epic repo on GitHub and push to it, keeps the person's name in the epic home
220
+ * links, may make the epic repo on the code host and push to it, keeps the person's name in the epic home
181
221
  */
182
222
  async init({
183
223
  dryRun = false,
@@ -192,6 +232,8 @@ var RepoInit = class _RepoInit {
192
232
  server = false,
193
233
  commit = false,
194
234
  cloned = false,
235
+ protectedBase = false,
236
+ codeHost,
195
237
  say = /* @__PURE__ */ __name(() => {
196
238
  }, "say")
197
239
  } = {}) {
@@ -199,11 +241,19 @@ var RepoInit = class _RepoInit {
199
241
  const pluginReport = plugin ? this.pluginStep({ dryRun }) : void 0;
200
242
  const configFile = join(main, EpicConfig.FILE);
201
243
  const hadConfig = existsSync(configFile);
202
- const settings = hadConfig ? new EpicConfig(main).settings : EpicConfig.defaultsFor(main);
244
+ const found = hadConfig ? new EpicConfig(main).settings : EpicConfig.defaultsFor(main);
245
+ const hosted = codeHost ?? await _RepoInit.codeHostChoice({ main, ask: false });
246
+ const withHost = { ...found, codeHost: hosted.kind };
247
+ const protection = _RepoInit.protectionStep({ main, configFile, hadConfig, settings: withHost, protectedBase });
248
+ const settings = { ...withHost, baseBranchProtected: protection.on };
203
249
  if (!hadConfig && !dryRun) {
204
250
  mkdirSync(dirname(configFile), { recursive: true });
205
251
  writeFileSync(configFile, _RepoInit.configText(settings));
206
252
  }
253
+ if (hadConfig && !dryRun && (protection.action === "flag" || protection.action === "detected"))
254
+ _RepoInit.keepProtected(configFile);
255
+ if (hadConfig && !dryRun && (hosted.source === "flag" || hosted.source === "asked"))
256
+ _RepoInit.keepCodeHost(configFile, hosted.kind);
207
257
  const content = join(main, settings.contentFolder);
208
258
  const folders = settings.sharedFolders;
209
259
  const report = {
@@ -214,6 +264,8 @@ var RepoInit = class _RepoInit {
214
264
  links: [],
215
265
  remote: { action: "skipped" },
216
266
  gitignore: { file: join(main, ".gitignore"), action: "ok" },
267
+ protection,
268
+ codeHost: hosted,
217
269
  person: _RepoInit.personStep({ dryRun, name }),
218
270
  ...pluginReport && { plugin: pluginReport }
219
271
  };
@@ -295,6 +347,7 @@ var RepoInit = class _RepoInit {
295
347
  * - only those files, whatever else is staged (`git commit -- <files>`); none changed: `none`
296
348
  * - on another branch: `other branch`, nothing committed (a worktree branches from the base branch)
297
349
  * - pushed (`pushBranch()`): to the branch's upstream, else `origin`; neither: committed, nothing to push to
350
+ * - a base branch that takes only pull requests: `commitViaPullRequest()` instead, NEVER a commit on it
298
351
  * - NEVER throws: a failed commit is `failed`, a failed push `push: "failed"`, with git's words
299
352
  * - SIDE EFFECT (not `dryRun`): a commit in the repo, a push
300
353
  */
@@ -304,6 +357,7 @@ var RepoInit = class _RepoInit {
304
357
  say = /* @__PURE__ */ __name(() => {
305
358
  }, "say")
306
359
  }) {
360
+ if (report.config.settings.baseBranchProtected) return _RepoInit.commitViaPullRequest({ report, ask, say });
307
361
  const { main, dryRun } = report;
308
362
  const base = report.config.settings.baseBranch;
309
363
  const files = _RepoInit.changedFiles(report);
@@ -320,9 +374,261 @@ var RepoInit = class _RepoInit {
320
374
  if (!done.ok) return { action: "failed", files, branch, error: done.err || `git exited ${done.code}` };
321
375
  return { action: "committed", files, branch, ..._RepoInit.pushBranch(main, branch, say) };
322
376
  }
323
- /** The files `epic init` changed in the repo, still to commit: the config, `.gitignore`. */
324
- static changedFiles({ main }) {
325
- return [EpicConfig.FILE, ".gitignore"].filter((file) => Git.out(["status", "--porcelain", "--", file], main));
377
+ /**
378
+ * The files `epic init` wrote, for a base branch that takes only pull requests: committed on a new branch
379
+ * (`SETUP_BRANCH`) WITHOUT touching the base branch, pushed, a pull request opened; what it did.
380
+ * - asks first in a terminal, `y` suggested; with no terminal, yes
381
+ * - on another branch: `other branch`, nothing done
382
+ * - a commit of `epic init`'s own on the base branch, not pushed (a run before this setting was on, its push refused):
383
+ * taken back first, keeping its files (`undoOwnCommit()`)
384
+ * - the branch is made without checking it out (`commitOnSetupBranch()`), then the base branch's checkout put back as
385
+ * it was (`restoreBase()`): so "safe to run again", whatever else is staged or changed
386
+ * - the pull or merge request: opened when the host's command is logged in; else `pullRequestError` says why, and the
387
+ * lines say what to run
388
+ * - NEVER throws
389
+ * - SIDE EFFECT (not `dryRun`): a branch, a push, a pull request, the two files out of the checkout
390
+ */
391
+ static async commitViaPullRequest({
392
+ report,
393
+ ask,
394
+ say = /* @__PURE__ */ __name(() => {
395
+ }, "say")
396
+ }) {
397
+ const { main, dryRun } = report;
398
+ const base = report.config.settings.baseBranch;
399
+ const via = { viaPullRequest: true, base };
400
+ const branch = Git.out(["rev-parse", "--abbrev-ref", "HEAD"], main) ?? "";
401
+ if (!dryRun && branch === base) _RepoInit.undoOwnCommit(main, base);
402
+ const files = _RepoInit.changedFiles(report);
403
+ if (!files.length) return { action: "none", files, branch: base, ...via };
404
+ if (branch !== base) return { action: "other branch", files, branch, ...via };
405
+ if (dryRun) return { action: "would branch", files, branch: SETUP_BRANCH, ...via };
406
+ const question = `Put ${files.join(" and ")} on a new branch ${SETUP_BRANCH}, push it, and open a ${_RepoInit.wordsOf(report).pullRequest}?`;
407
+ const answer = ask ? await CLI.ask(question, { suggestion: "y" }) : "y";
408
+ if (/^n/i.test(answer.trim())) return { action: "declined", files, branch, ...via };
409
+ try {
410
+ _RepoInit.commitOnSetupBranch(main, base, files);
411
+ _RepoInit.restoreBase(main, files, report.config.settings.sharedFolders);
412
+ } catch (error) {
413
+ return { action: "failed", files, branch: SETUP_BRANCH, error: error.message, ...via };
414
+ }
415
+ const pushed = _RepoInit.pushBranch(main, SETUP_BRANCH, say);
416
+ const done = { action: "on branch", files, branch: SETUP_BRANCH, ...via, ...pushed };
417
+ const host = CodeHost.of({ main, codeHost: report.config.settings.codeHost });
418
+ return pushed.push === "pushed" ? { ...done, ..._RepoInit.pullRequestStep(main, base, say, host) } : done;
419
+ }
420
+ /**
421
+ * Take back `epic init`'s own commit from base branch `base`, when it's its last commit and the only one `origin`'s
422
+ * lacks: an earlier run's, its push refused. Its files stay, uncommitted.
423
+ * - anything else on the branch that `origin`'s lacks: left alone
424
+ * - SIDE EFFECT: `git reset --mixed HEAD~1`
425
+ */
426
+ static undoOwnCommit(main, base) {
427
+ if (Git.out(["rev-list", "--count", `refs/remotes/origin/${base}..${base}`], main) !== "1") return;
428
+ if (Git.out(["log", "-1", "--format=%s", base], main) !== COMMIT_MESSAGE) return;
429
+ Git.run(["reset", "-q", "--mixed", "HEAD~1"], main);
430
+ }
431
+ /**
432
+ * `files`, as they are on disk, committed on `SETUP_BRANCH`: with a temporary index, so HEAD, the checkout's own
433
+ * index and any other change there are never touched.
434
+ * - from `base`, or on top of the branch when it holds work `base` doesn't (a run before, its pull request open)
435
+ * - nothing new to commit: the branch stays
436
+ * - throws a `GitError` when git can't
437
+ * - SIDE EFFECT: a commit, and the branch made or moved
438
+ */
439
+ static commitOnSetupBranch(main, base, files) {
440
+ const tip = Git.out(["rev-parse", "--verify", "--quiet", `refs/heads/${SETUP_BRANCH}`], main);
441
+ const parent = tip && !Git.run(["merge-base", "--is-ancestor", tip, base], main).ok ? tip : Git.mustRun(["rev-parse", base], main);
442
+ const folder = mkdtempSync(join(tmpdir(), "epic-setup-"));
443
+ const env = { ...process.env, GIT_INDEX_FILE: join(folder, "index") };
444
+ try {
445
+ Git.mustRun(["read-tree", parent], main, { env });
446
+ for (const file of files) {
447
+ const blob = Git.mustRun(["hash-object", "-w", "--", file], main);
448
+ Git.mustRun(["update-index", "--add", "--cacheinfo", `100644,${blob},${file}`], main, { env });
449
+ }
450
+ const tree = Git.mustRun(["write-tree"], main, { env });
451
+ if (tree === Git.out(["rev-parse", `${parent}^{tree}`], main)) return;
452
+ const commit = Git.mustRun(["commit-tree", tree, "-p", parent, "-m", COMMIT_MESSAGE], main);
453
+ Git.mustRun(["update-ref", `refs/heads/${SETUP_BRANCH}`, commit], main);
454
+ } finally {
455
+ rmSync(folder, { recursive: true, force: true });
456
+ }
457
+ }
458
+ /**
459
+ * Put the base branch's checkout back: `files` as HEAD has them, or gone when it hasn't any, so `git status` is clean.
460
+ * - the links `init()` made (`links`) are listed in `.git/info/exclude`: the `.gitignore` that names them is on the
461
+ * setup branch until it's merged
462
+ * - throws a `GitError` when git can't
463
+ * - SIDE EFFECT: the two files, the exclude file
464
+ */
465
+ static restoreBase(main, files, links) {
466
+ for (const file of files) {
467
+ if (Git.run(["cat-file", "-e", `HEAD:${file}`], main).ok) Git.mustRun(["checkout", "HEAD", "--", file], main);
468
+ else {
469
+ Git.run(["rm", "-q", "--cached", "--ignore-unmatch", "--", file], main);
470
+ rmSync(join(main, file), { force: true });
471
+ }
472
+ }
473
+ try {
474
+ rmdirSync(join(main, dirname(EpicConfig.FILE)));
475
+ } catch {
476
+ }
477
+ const exclude = join(main, ".git", "info", "exclude");
478
+ const listed = existsSync(exclude) ? readFileSync(exclude, "utf8").split("\n") : [];
479
+ const missing = links.map((link) => `/${link}`).filter((line) => !listed.includes(line));
480
+ if (!missing.length) return;
481
+ mkdirSync(dirname(exclude), { recursive: true });
482
+ appendFileSync(exclude, `${EXCLUDE_NOTE}
483
+ ${missing.join("\n")}
484
+ `);
485
+ }
486
+ /**
487
+ * The pull or merge request for `SETUP_BRANCH`, opened by `host`: its address, or why not.
488
+ * - NEVER throws
489
+ * - SIDE EFFECT: a pull or merge request on the code host
490
+ */
491
+ static pullRequestStep(main, base, say, host) {
492
+ const { words } = host;
493
+ const status = host.status();
494
+ if (status === "missing") return { pullRequestError: `${words.name}'s command, ${words.command}, isn't installed` };
495
+ if (status === "logged-out") return { pullRequestError: `${words.command} isn't logged in to ${words.name}` };
496
+ say(`opening the ${words.pullRequest}…`);
497
+ try {
498
+ return {
499
+ pullRequest: host.openPullRequest({
500
+ branch: SETUP_BRANCH,
501
+ base,
502
+ title: PR_TITLE,
503
+ body: prBody(words.pullRequest),
504
+ cwd: main
505
+ })
506
+ };
507
+ } catch (error) {
508
+ return { pullRequestError: error.message };
509
+ }
510
+ }
511
+ /**
512
+ * Whether the base branch takes only pull requests, and how that's known; what `init()` puts in the config.
513
+ * - already on in the config, or in the setup branch's (run again, its pull request not merged yet): `config`
514
+ * - `protectedBase` (`--protected-base`): `flag`
515
+ * - else the code host's word (`hostRequiresPullRequest()`): `detected`; no such rule: `off`
516
+ * - a config that says `false` in so many words stays so (a file already there is kept): `says off`, and a note
517
+ * - NEVER throws: failing to find out is `off`, never a failed init
518
+ */
519
+ static protectionStep({
520
+ main,
521
+ configFile,
522
+ hadConfig,
523
+ settings,
524
+ protectedBase
525
+ }) {
526
+ if (settings.baseBranchProtected || _RepoInit.setupBranchSaysProtected(main)) return { action: "config", on: true };
527
+ if (protectedBase) return { action: "flag", on: true };
528
+ try {
529
+ if (!_RepoInit.hostRequiresPullRequest(main, settings)) return { action: "off", on: false };
530
+ const written = hadConfig ? EpicConfig.parse(readFileSync(configFile, "utf8"), configFile) : {};
531
+ return "baseBranchProtected" in written ? { action: "says off", on: false } : { action: "detected", on: true };
532
+ } catch {
533
+ return { action: "off", on: false };
534
+ }
535
+ }
536
+ /** Whether `SETUP_BRANCH`, when there is one, holds a config with `baseBranchProtected` on. */
537
+ static setupBranchSaysProtected(main) {
538
+ const text = Git.out(["show", `refs/heads/${SETUP_BRANCH}:${EpicConfig.FILE}`], main);
539
+ if (!text) return false;
540
+ try {
541
+ return EpicConfig.settingsFrom(text, EpicConfig.FILE, main).baseBranchProtected;
542
+ } catch {
543
+ return false;
544
+ }
545
+ }
546
+ /** Whether the code host, as its command can see it, requires a request into the base branch of checkout `main`. */
547
+ static hostRequiresPullRequest(main, settings) {
548
+ const host = CodeHost.of({ main, codeHost: settings.codeHost });
549
+ const origin = Git.out(["remote", "get-url", "origin"], main);
550
+ const repo = origin ? host.repoIn(origin) : void 0;
551
+ return repo !== void 0 && host.status() === "ready" && host.requiresPullRequest(repo, settings.baseBranch);
552
+ }
553
+ /**
554
+ * Where the code is hosted, and how that's known (`init()`'s `codeHost`, `epic init`'s question).
555
+ * - `--host` (`host`): `flag`; the config names one: `config`
556
+ * - else the `origin` address's: `address`; it doesn't say (`git.acme.com`): `asked` in a terminal, else `assumed`
557
+ * GitHub, which `noteLines()` says in one line; no remote: `default`, GitHub
558
+ * - NEVER throws
559
+ */
560
+ static async codeHostChoice({
561
+ main,
562
+ host,
563
+ ask
564
+ }) {
565
+ const origin = CodeHost.originOf(main);
566
+ const hostName = CodeHost.hostOf(origin);
567
+ const said = { ...hostName && { host: hostName }, ...origin && { address: origin } };
568
+ if (host) return { kind: host, source: "flag", ...said };
569
+ if (existsSync(join(main, EpicConfig.FILE))) {
570
+ try {
571
+ const written = EpicConfig.parse(readFileSync(join(main, EpicConfig.FILE), "utf8"), EpicConfig.FILE);
572
+ if (CodeHost.isKind(written.codeHost)) return { kind: written.codeHost, source: "config", ...said };
573
+ } catch {
574
+ }
575
+ }
576
+ if (!CodeHost.isUnknownAddress(origin))
577
+ return { kind: CodeHost.kindOfAddress(origin), source: origin ? "address" : "default", ...said };
578
+ if (ask && process.stdin.isTTY && process.stdout.isTTY)
579
+ return {
580
+ kind: await CLI.choose(HOST_QUESTION, HOST_CHOICES),
581
+ source: "asked",
582
+ ...said
583
+ };
584
+ return { kind: "github", source: "assumed", ...said };
585
+ }
586
+ /**
587
+ * Write `kind` into config file `file` as its `codeHost`, keeping the rest as written.
588
+ * - a line that's there is changed in place; else the key goes in through `DataFile`, its comments kept
589
+ * - SIDE EFFECT: writes the file
590
+ */
591
+ static keepCodeHost(file, kind) {
592
+ const text = readFileSync(file, "utf8");
593
+ const line = /^(\s*"codeHost":\s*)"(?:[^"\\]|\\.)*"/m;
594
+ if (line.test(text))
595
+ writeFileSync(
596
+ file,
597
+ text.replace(line, (_all, key) => key + JSON.stringify(kind))
598
+ );
599
+ else DataFile.edit(file, (settings) => ({ ...settings, codeHost: kind }));
600
+ }
601
+ /**
602
+ * Turn `baseBranchProtected` on in config file `file`, keeping the rest as written.
603
+ * - the line `epic init` writes is changed in place; a file without one gets the key through `DataFile`
604
+ * - SIDE EFFECT: writes the file
605
+ */
606
+ static keepProtected(file) {
607
+ const text = readFileSync(file, "utf8");
608
+ const line = /^(\s*"baseBranchProtected":\s*)false/m;
609
+ if (line.test(text)) writeFileSync(file, text.replace(line, "$1true"));
610
+ else DataFile.edit(file, (settings) => ({ ...settings, baseBranchProtected: true }));
611
+ }
612
+ /** What the commit section says first: why `epic init` asks to commit, or to open a pull or merge request. */
613
+ static commitHeader(report) {
614
+ return report.config.settings.baseBranchProtected ? pullRequestHeader(_RepoInit.wordsOf(report).pullRequest) : COMMIT_HEADER;
615
+ }
616
+ /** What a person reads about `report`'s code host: "merge request" on GitLab, GitHub's by default. */
617
+ static wordsOf({
618
+ config,
619
+ codeHost
620
+ }) {
621
+ return CodeHost.wordsFor(config.settings.codeHost, codeHost?.host);
622
+ }
623
+ /**
624
+ * The files `epic init` changed in the repo, still to commit: the config, `.gitignore`.
625
+ * - a dry run wrote nothing: the ones it would have count too
626
+ */
627
+ static changedFiles({ main, dryRun, config, gitignore }) {
628
+ const wouldWrite = /* @__PURE__ */ __name((file) => dryRun && (file === EpicConfig.FILE ? config?.action === "written" : gitignore?.action !== "ok"), "wouldWrite");
629
+ return [EpicConfig.FILE, ".gitignore"].filter(
630
+ (file) => wouldWrite(file) || Git.out(["status", "--porcelain", "--", file], main)
631
+ );
326
632
  }
327
633
  /** Where `branch` of checkout `main` pushes: its upstream (`git push`), else `origin`; none: `undefined`. */
328
634
  static pushTarget(main, branch) {
@@ -396,12 +702,13 @@ var RepoInit = class _RepoInit {
396
702
  * - `remote` naming another: throws `EpicCommandError`, saying how to change it
397
703
  * - `noRemote`: `skipped`
398
704
  * - `remote`, else the config's `contentRemote`: made the remote, pushed (`added`)
399
- * - else made on GitHub (`made`), when `gh` is there and logged in (`no gh`, `logged out`); `failed` with gh's
400
- * words when GitHub said no
705
+ * - else made on the code host (`made`), when its command is there and logged in (`no gh` for either's, `logged out`);
706
+ * `failed` with its words when it said no
401
707
  * - its name: `contentRepo`, else asked when `ask` (in a terminal), else `<repo>.epics`
402
708
  * - private or public: `visibility`, else asked when `ask` (`askVisibility()`), else private
403
709
  * - a push that failed is in `error`: the repo and its address stand
404
- * - SIDE EFFECT (not `dryRun`): the repo on GitHub, the remote, the push, `contentRemote` in the config
710
+ * - GitLab: after the first push, its default branch opened up to teammates (`warning`, when it couldn't be)
711
+ * - SIDE EFFECT (not `dryRun`): the repo on the code host, the remote, the push, `contentRemote` in the config
405
712
  */
406
713
  async remoteStep({
407
714
  shared,
@@ -434,9 +741,10 @@ var RepoInit = class _RepoInit {
434
741
  if (given !== settings.contentRemote) _RepoInit.keepRemote(configFile, given);
435
742
  return { action: "added", address: given, ...error2 && { error: error2 } };
436
743
  }
437
- const gh = GitHub.status();
438
- if (gh === "missing") return { action: "no gh" };
439
- const owner = gh === "ready" ? _RepoInit.ownerFor(this.main) : void 0;
744
+ const host = CodeHost.of({ main: this.main, codeHost: settings.codeHost });
745
+ const status = host.status();
746
+ if (status === "missing") return { action: "no gh" };
747
+ const owner = status === "ready" ? _RepoInit.ownerFor(this.main, host) : void 0;
440
748
  if (!owner) return { action: "logged out" };
441
749
  const suggestion = `${basename(this.main)}.epics`;
442
750
  const repoName = contentRepo ?? (ask ? await CLI.ask(REPO_QUESTION, { suggestion }) : suggestion);
@@ -445,20 +753,22 @@ var RepoInit = class _RepoInit {
445
753
  const repo = `${owner}/${repoName}`;
446
754
  const seenBy = visibility ?? (ask ? await _RepoInit.askVisibility() : "private");
447
755
  if (dryRun) return { action: "would make", repo, visibility: seenBy };
448
- say(`making ${repo} on GitHub…`);
756
+ say(`making ${repo} on ${host.words.name}…`);
449
757
  let address;
450
758
  try {
451
- GitHub.createRepo(repo, {
759
+ host.createRepo(repo, {
452
760
  visibility: seenBy,
453
761
  description: `The epic pages of ${basename(this.main)}: plans, guides and sagas`
454
762
  });
455
- address = GitHub.addressOf(repo);
763
+ address = host.addressOf(repo);
456
764
  } catch (error2) {
457
765
  return { action: "failed", repo, visibility: seenBy, error: error2.message };
458
766
  }
459
767
  const error = shared.publish(address);
460
768
  _RepoInit.keepRemote(configFile, address);
461
- return { action: "made", repo, address, visibility: seenBy, ...error && { error } };
769
+ const branch = Git.out(["rev-parse", "--abbrev-ref", "HEAD"], shared.config.dir) ?? "main";
770
+ const warning = error ? void 0 : host.letTeamPush(repo, branch);
771
+ return { action: "made", repo, address, visibility: seenBy, ...error && { error }, ...warning && { warning } };
462
772
  }
463
773
  ////////////////
464
774
  // ## Statics: the values, the files' text, the report's lines
@@ -473,16 +783,17 @@ var RepoInit = class _RepoInit {
473
783
  return Git.mainRoot(cwd);
474
784
  }
475
785
  /**
476
- * Whose GitHub account a new epic repo goes in, for the code repo at `main`: the code repo's owner when that's
477
- * an ORGANIZATION (its `origin` on GitHub), else the person's own login; `undefined` when gh knows no login.
786
+ * Whose account a new epic repo goes in, for the code repo at `main`: the code repo's owner when that's
787
+ * an ORGANIZATION (a GitHub org, a GitLab group or subgroup), else the person's own login; `undefined` when the
788
+ * host's command knows no login.
478
789
  * - why not always the code repo's owner: a person can't make a repo in someone else's own account
479
- * - runs `gh` (the login, kept as `EpicHome.refreshGithub()` keeps it; the owner's kind)
790
+ * - runs its command (the login, `CodeHost.loginOn()`; the owner's kind)
480
791
  */
481
- static ownerFor(main) {
482
- const login = EpicHome.refreshGithub();
792
+ static ownerFor(main, host) {
793
+ const login = CodeHost.loginOn(host);
483
794
  const origin = Git.out(["remote", "get-url", "origin"], main);
484
- const owner = origin ? GitHub.ownerIn(origin) : void 0;
485
- if (owner && owner !== login && GitHub.isOrganization(owner)) return owner;
795
+ const owner = origin ? host.ownerIn(origin) : void 0;
796
+ if (owner && owner !== login && host.isOrganization(owner)) return owner;
486
797
  return login;
487
798
  }
488
799
  /**
@@ -523,16 +834,16 @@ var RepoInit = class _RepoInit {
523
834
  }
524
835
  /**
525
836
  * The name to keep, asked in a terminal EVERY time (Owen, 2026-10-29: "never asked for my user name"):
526
- * "What do you want to be called?", suggesting the name kept already, else their GitHub login, else git's
527
- * `user.name`; Enter keeps it.
528
- * - the login looked up first (`EpicHome.refreshGithub()`), and kept, so pages never run `gh`
837
+ * "What do you want to be called?", suggesting the name kept already, else their login on the code host, else
838
+ * git's `user.name`; Enter keeps it.
839
+ * - the login looked up first (`CodeHost.loginOn()`; GitHub's is kept, so pages never run `gh`)
529
840
  * - `undefined` when nothing was said and nobody knows a name
530
841
  * - no terminal: the suggestion, asking nothing (`CLI.ask()`)
531
842
  */
532
- static async askName() {
533
- EpicHome.refreshGithub();
843
+ static async askName(host = GitHub) {
844
+ const login = CodeHost.loginOn(host);
534
845
  const now = EpicHome.person();
535
- const suggestion = (now.source === "kept" ? now.name : void 0) ?? now.github ?? now.fullName ?? "";
846
+ const suggestion = (now.source === "kept" ? now.name : void 0) ?? login ?? now.github ?? now.fullName ?? "";
536
847
  return await CLI.ask(NAME_QUESTION, { suggestion }) || void 0;
537
848
  }
538
849
  /**
@@ -602,6 +913,12 @@ var RepoInit = class _RepoInit {
602
913
  "contentRemote": ${value("contentRemote")},
603
914
  // the branch worktrees start from and merge into
604
915
  "baseBranch": ${value("baseBranch")},
916
+ // whether that branch can't be pushed to, and work reaches it only through a pull request (a merge request, on
917
+ // GitLab): epic init opens one, epic merge refuses, and the skills finish with one
918
+ "baseBranchProtected": ${value("baseBranchProtected")},
919
+ // where the code is hosted, "github" or "gitlab": picks gh or glab, and which words pages say;
920
+ // left out, it's worked out from the origin remote each time it's read
921
+ "codeHost": ${value("codeHost")},
605
922
  // where new worktrees go, one folder each: <worktreesFolder>/<name>
606
923
  "worktreesFolder": ${value("worktreesFolder")},
607
924
  // what makes a new worktree ready to run, from its root ("": nothing to install)
@@ -610,7 +927,7 @@ var RepoInit = class _RepoInit {
610
927
  "installOnCreate": ${value("installOnCreate")},
611
928
  // the seconds that install may take
612
929
  "installTimeout": ${value("installTimeout")},
613
- // folders that are yarn projects of their own, outside that install (a \`vscode/\` extension), from a worktree's
930
+ // folders that are projects of their own, outside that install (a \`vscode/\` extension), from a worktree's
614
931
  // root: installCommand runs in each too
615
932
  "extraInstalls": ${value("extraInstalls")},
616
933
  // the VS Code windows: the window file a worktree's window is opened from, the folder names a window shows,
@@ -683,7 +1000,11 @@ var RepoInit = class _RepoInit {
683
1000
  ...report.plugin ? _RepoInit.pluginLines(report.plugin) : [],
684
1001
  ..._RepoInit.fileLines(report),
685
1002
  ..._RepoInit.noteLines(report),
686
- ...report.commit?.action && report.commit.action !== "none" ? ["", chalk.bold(COMMIT_HEADER), ..._RepoInit.commitResultLines(report.commit)] : [],
1003
+ ...report.commit?.action && report.commit.action !== "none" ? [
1004
+ "",
1005
+ chalk.bold(_RepoInit.commitHeader(report)),
1006
+ ..._RepoInit.commitResultLines(report.commit, _RepoInit.wordsOf(report))
1007
+ ] : [],
687
1008
  ..._RepoInit.doneLines(report)
688
1009
  ];
689
1010
  }
@@ -734,6 +1055,7 @@ var RepoInit = class _RepoInit {
734
1055
  */
735
1056
  static fileLines(report, { head = true } = {}) {
736
1057
  const { dryRun, config, content, remote, gitignore, person, color, main } = report;
1058
+ const hostName = _RepoInit.wordsOf(report).name;
737
1059
  const would = /* @__PURE__ */ __name((done, wouldDo) => dryRun ? wouldDo : done, "would");
738
1060
  const rows = [
739
1061
  [config.action === "kept" ? "already present" : would("wrote", "would write"), config.file]
@@ -756,7 +1078,7 @@ var RepoInit = class _RepoInit {
756
1078
  break;
757
1079
  default:
758
1080
  }
759
- rows.push(...remoteRowsFor(remote));
1081
+ rows.push(...remoteRowsFor(remote, hostName));
760
1082
  for (const { path, action } of report.links)
761
1083
  rows.push([action === "ok" ? "already linked" : action, join(main, path)]);
762
1084
  rows.push([
@@ -778,19 +1100,32 @@ var RepoInit = class _RepoInit {
778
1100
  }
779
1101
  /** What needs a word of its own, under the files: the epic repo's problems, the colour's, no name. */
780
1102
  static noteLines(report) {
781
- const notes = [...remoteNotesFor(report), ...colorNotesFor(report.color)];
1103
+ const notes = [
1104
+ ...codeHostNotesFor(report),
1105
+ ...protectionNotesFor(report),
1106
+ ...remoteNotesFor(report),
1107
+ ...colorNotesFor(report.color)
1108
+ ];
782
1109
  if (report.person.action === "none") notes.push("no name yet (git has no user.name): epic whoami <name> keeps one");
783
1110
  if (!notes.length) return [];
784
1111
  return ["", chalk.bold("Note:"), ...notes];
785
1112
  }
786
- /** What the commit came to (`commitStep()`), under its question. */
787
- static commitResultLines({ action, files, branch, error, push, pushError }) {
1113
+ /** What the commit came to (`commitStep()`), under its question; `words`: the code host's. */
1114
+ static commitResultLines(commit, words = CodeHost.wordsFor("github")) {
1115
+ const { action, files, branch, error, push, pushError } = commit;
788
1116
  const named = files.join(" and ");
1117
+ if (commit.viaPullRequest) return viaPullRequestLines(commit, words);
789
1118
  switch (action) {
790
1119
  case "committed":
791
1120
  if (push === "pushed") return ["> Committed and pushed"];
792
1121
  if (push === "failed")
793
- return [`> Committed; the push failed: ${pushError}`, ` push it by hand: git push origin ${branch}`];
1122
+ return [
1123
+ `> Committed; the push failed: ${pushError}`,
1124
+ ` push it by hand: git push origin ${branch}`,
1125
+ ...PUSH_REFUSED.test(pushError ?? "") ? [
1126
+ ` or, if ${branch} takes only ${words.pullRequest}s: epic init --protected-base (it moves this commit onto a branch, and opens one)`
1127
+ ] : []
1128
+ ];
794
1129
  return ["> Committed; no remote to push to"];
795
1130
  case "would commit":
796
1131
  return [`> would commit ${named} on ${branch}, and push it`];
@@ -811,6 +1146,8 @@ var RepoInit = class _RepoInit {
811
1146
  static doneLines(report) {
812
1147
  if (report.dryRun) return ["", "dry run: nothing changed"];
813
1148
  if (report.content.action === "missing") return [];
1149
+ if (report.commit?.action === "on branch")
1150
+ return ["", chalk.green.bold(doneOnceMerged(_RepoInit.wordsOf(report).pullRequest))];
814
1151
  const editor = Editor.of({ setting: report.config.settings.editor });
815
1152
  const { server, main } = report;
816
1153
  const browser = server?.action === "started" && server.address ? terminalLink(server.address) : "epic server start, then the address it prints";
@@ -826,12 +1163,12 @@ var RepoInit = class _RepoInit {
826
1163
  ];
827
1164
  }
828
1165
  };
829
- function remoteRowsFor({ action, address, repo, visibility, error }) {
1166
+ function remoteRowsFor({ action, address, repo, visibility, error }, hostName) {
830
1167
  switch (action) {
831
1168
  case "made":
832
- return [[error ? "made" : "made, pushed", `${repo} on GitHub, ${visibility} (${address})`]];
1169
+ return [[error ? "made" : "made, pushed", `${repo} on ${hostName}, ${visibility} (${address})`]];
833
1170
  case "would make":
834
- return [["would make", `${repo} on GitHub, ${visibility}`]];
1171
+ return [["would make", `${repo} on ${hostName}, ${visibility}`]];
835
1172
  case "added":
836
1173
  return [[error ? "remote" : "pushed to", address ?? ""]];
837
1174
  case "would add":
@@ -846,13 +1183,73 @@ function remoteRowsFor({ action, address, repo, visibility, error }) {
846
1183
  }
847
1184
  }
848
1185
  __name(remoteRowsFor, "remoteRowsFor");
849
- function remoteNotesFor({ remote, content, main }) {
850
- const { address, repo, error, visibility = "private" } = remote;
1186
+ function codeHostNotesFor({ codeHost }) {
1187
+ if (codeHost?.source !== "assumed") return [];
1188
+ return [`${codeHost.host} doesn't say whose it is: treated as GitHub; on GitLab, run: epic init --host gitlab`];
1189
+ }
1190
+ __name(codeHostNotesFor, "codeHostNotesFor");
1191
+ function protectionNotesFor(report) {
1192
+ const { protection, config } = report;
1193
+ const base = config.settings.baseBranch;
1194
+ const { name, pullRequest } = RepoInit.wordsOf(report);
1195
+ if (protection.action === "detected")
1196
+ return [`${name} requires a ${pullRequest} into ${base}: baseBranchProtected is on (${EpicConfig.FILE})`];
1197
+ if (protection.action === "says off")
1198
+ return [
1199
+ `${name} requires a ${pullRequest} into ${base}, but ${EpicConfig.FILE} says baseBranchProtected false: epic init --protected-base turns it on`
1200
+ ];
1201
+ return [];
1202
+ }
1203
+ __name(protectionNotesFor, "protectionNotesFor");
1204
+ function viaPullRequestLines(commit, words) {
1205
+ const { action, files, branch, error, push, pushError, pullRequest, pullRequestError, base } = commit;
1206
+ const named = files.join(" and ");
1207
+ const asked = words.pullRequest;
1208
+ const openIt = [` ${words.openCommand(base ?? "", SETUP_BRANCH)}`];
1209
+ const merged = [
1210
+ `> Once it's merged: git pull on ${base}, and epics work here; teammates can join then (epic init in their clone)`
1211
+ ];
1212
+ switch (action) {
1213
+ case "on branch": {
1214
+ const said = [`> ${named} are on branch ${SETUP_BRANCH}; your ${base} is as it was`];
1215
+ if (push === "failed")
1216
+ return [
1217
+ ...said,
1218
+ `> The push failed: ${pushError}`,
1219
+ " to finish:",
1220
+ ` git push -u origin ${SETUP_BRANCH}`,
1221
+ ...openIt,
1222
+ ...merged
1223
+ ];
1224
+ if (push === "nowhere")
1225
+ return [...said, `> No remote to push to: push ${SETUP_BRANCH} once there is, and open a ${asked}`, ...merged];
1226
+ if (pullRequest) return [...said, `> ${words.PullRequest}: ${pullRequest}`, ...merged];
1227
+ return [...said, `> Pushed; no ${asked} yet (${pullRequestError}). To open one:`, ...openIt, ...merged];
1228
+ }
1229
+ case "would branch":
1230
+ return [
1231
+ `> would put ${named} on a new branch ${SETUP_BRANCH}, push it and open a ${asked}; ${base} stays as it is`
1232
+ ];
1233
+ case "declined":
1234
+ return [`> Not done: ${base} takes only ${asked}s, so ${named} need one before epics work here`];
1235
+ case "other branch":
1236
+ return [`> Not done: you're on ${branch}; run epic init on ${base}, which puts ${named} on a new branch`];
1237
+ case "failed":
1238
+ return [`> Couldn't put ${named} on branch ${SETUP_BRANCH}: ${error}`];
1239
+ default:
1240
+ return [];
1241
+ }
1242
+ }
1243
+ __name(viaPullRequestLines, "viaPullRequestLines");
1244
+ function remoteNotesFor(report) {
1245
+ const { remote, content, main } = report;
1246
+ const words = RepoInit.wordsOf(report);
1247
+ const { address, repo, error, warning, visibility = "private" } = remote;
851
1248
  const pushByHand = [`the push failed: ${error}`, ` push it by hand: git -C ${content.folder} push -u origin HEAD`];
852
1249
  switch (remote.action) {
853
1250
  case "made":
854
1251
  case "would make":
855
- return [...error ? pushByHand : [], ...publicWarning(visibility)];
1252
+ return [...error ? pushByHand : [], ...warning ? [warning] : [], ...publicWarning(visibility)];
856
1253
  case "added":
857
1254
  return error ? pushByHand : [];
858
1255
  case "clone failed":
@@ -864,16 +1261,15 @@ function remoteNotesFor({ remote, content, main }) {
864
1261
  return ["no epic repo (--no-remote): the plans stay on this machine"];
865
1262
  case "failed":
866
1263
  return [
867
- `couldn't make ${repo} on GitHub: ${error}`,
1264
+ `couldn't make ${repo} on ${words.name}: ${error}`,
868
1265
  ` another name: epic init --content-repo <name>; a repo you made: epic init --remote <address>`
869
1266
  ];
870
1267
  case "no gh":
871
1268
  case "logged out": {
872
- const why = remote.action === "no gh" ? "GitHub's command, gh, isn't installed" : "gh isn't logged in to GitHub";
1269
+ const why = remote.action === "no gh" ? `${words.name}'s command, ${words.command}, isn't installed` : `${words.command} isn't logged in to ${words.name}`;
873
1270
  return [
874
- `no epic repo made: ${why}. Sharing the epics works only with GitHub for now:`,
875
- " brew install gh (other systems: https://cli.github.com)",
876
- " gh auth login",
1271
+ `no epic repo made: ${why}. To share the epics, run:`,
1272
+ ...words.install,
877
1273
  ` then epic init again, in ${main}; or epic init --remote <address>, for a repo you made yourself`
878
1274
  ];
879
1275
  }
@@ -905,6 +1301,11 @@ function terminalLink(url) {
905
1301
  __name(terminalLink, "terminalLink");
906
1302
  var NAME_QUESTION = "What do you want to be called?";
907
1303
  var COLOR_QUESTION = "Which colour should your words be?";
1304
+ var HOST_QUESTION = "Where is this repo hosted?";
1305
+ var HOST_CHOICES = [
1306
+ { value: "github", label: "GitHub", hint: "uses gh" },
1307
+ { value: "gitlab", label: "GitLab", hint: "uses glab, self-hosted too" }
1308
+ ];
908
1309
  var REPO_QUESTION = "What should the shared epics repo be called?";
909
1310
  var VISIBILITY_CHOICES = [
910
1311
  { value: "private", label: "private", hint: "only the people you add can see the plans" },
@@ -924,8 +1325,28 @@ var SHOW_README = /* @__PURE__ */ new Set([
924
1325
  ]);
925
1326
  var README_EPICS = "https://github.com/spell-app/spell/blob/main/README-epics.md";
926
1327
  var DONE = "Epics initialized!";
1328
+ function doneOnceMerged(pullRequest) {
1329
+ return `Epics are set up, and start here once that ${pullRequest} is merged.`;
1330
+ }
1331
+ __name(doneOnceMerged, "doneOnceMerged");
927
1332
  var FILES_HEAD = "Setting up epic files:";
928
1333
  var COMMIT_HEADER = "We need to make a commit in the main repo to enable epics.";
1334
+ function pullRequestHeader(pullRequest) {
1335
+ return `This repo takes only ${pullRequest}s into its base branch, so epics are enabled through one.`;
1336
+ }
1337
+ __name(pullRequestHeader, "pullRequestHeader");
1338
+ var SETUP_BRANCH = "epic-setup";
1339
+ var PR_TITLE = "Set up epics";
1340
+ function prBody(pullRequest) {
1341
+ return `Adds \`.epic/config.json5\` and the \`.gitignore\` lines that the \`epic\` tooling needs, nothing else.
1342
+
1343
+ Once this is merged: \`git pull\` on the base branch, and teammates can run \`epic init\`.
1344
+
1345
+ The epic pages live in a repo of their own beside this one, which needs direct pushes: if an org-wide rule requires ${pullRequest}s, it must leave that repo out.`;
1346
+ }
1347
+ __name(prBody, "prBody");
1348
+ var EXCLUDE_NOTE = "# epic init: its links, until the pull request that lists them in .gitignore is merged";
1349
+ var PUSH_REFUSED = /rejected|declined|protected|pull request|GH0\d\d/i;
929
1350
  var PUSH_TIMEOUT = 12e4;
930
1351
  var TERMINAL_COLORS = {
931
1352
  red: "#DB2828",