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.
- package/README-epics.md +96 -36
- package/app/package.json +25 -1
- package/dist/cli/publish/PublishedPackage.d.ts +2 -1
- package/dist/cli/publish/PublishedPackage.js +6 -3
- package/dist/cli/publish/ScratchInstall.d.ts +14 -3
- package/dist/cli/publish/ScratchInstall.js +69 -8
- package/dist/epic/cli/EpicProgram.js +7 -1
- package/dist/epic/cli/epicGroups.js +2 -1
- package/dist/epic/command/BaseBranch.d.ts +35 -0
- package/dist/epic/command/BaseBranch.js +58 -0
- package/dist/epic/command/EpicCheckout.d.ts +1 -1
- package/dist/epic/command/EpicCheckout.js +4 -4
- package/dist/epic/command/EpicGuide.js +3 -2
- package/dist/epic/command/EpicTools.d.ts +5 -0
- package/dist/epic/command/EpicTools.js +14 -3
- package/dist/epic/command/MainMerge.d.ts +26 -15
- package/dist/epic/command/MainMerge.js +60 -16
- package/dist/epic/command/RepoInit.d.ts +116 -8
- package/dist/epic/command/RepoInit.js +308 -13
- package/dist/epic/command/Requests.d.ts +1 -0
- package/dist/epic/command/Requests.js +6 -1
- package/dist/epic/command/SessionMoves.js +2 -1
- package/dist/epic/command/SkillsCheck.js +3 -2
- package/dist/epic/command/Stock.js +3 -1
- package/dist/epic/command/TurnEnd.d.ts +1 -1
- package/dist/epic/command/TurnEnd.js +4 -3
- package/dist/epic/command/Worktrees.d.ts +18 -3
- package/dist/epic/command/Worktrees.js +38 -7
- package/dist/epic/command/command.types.d.ts +3 -0
- package/dist/epic/components/__pack/epics.entry.js +43 -43
- package/dist/epic/components/__pack/epics.pack.js +36 -12794
- package/dist/epic/config/EngineFiles.mjs +60 -0
- package/dist/epic/config/EpicConfig.d.ts +12 -2
- package/dist/epic/config/EpicConfig.js +9 -1
- package/dist/epic/config/GitHub.d.ts +41 -1
- package/dist/epic/config/GitHub.js +75 -3
- package/dist/epic/config/LayeredSettings.js +3 -2
- package/dist/epic/server/EpicServer.d.ts +1 -1
- package/dist/epic/server/EpicServer.js +26 -12
- package/dist/epic/tool/InboxPoller.mjs +2 -1
- package/dist/epic/tool/MigrateCommands.js +6 -8
- package/dist/epic/tool/PlanDocFiles.js +3 -2
- package/dist/epic/tool/ServedFolders.d.ts +1 -1
- package/dist/epic/tool/ServedFolders.js +4 -4
- package/dist/epic/tools/PageInboxes.js +3 -3
- package/dist/epic/tools/_assets/commands.entry.js +149 -68
- package/dist/epic/tools/_assets/commands.js +20 -2073
- package/dist/epic/tools/_assets/core-reference.entry.js +244 -124
- package/dist/epic/tools/_assets/core-reference.js +20 -2142
- package/dist/epic/tools/_assets/emoji/cldr/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/cldr/z.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/0.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/a.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/b.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/c.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/d.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/e.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/f.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/g.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/h.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/i.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/j.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/k.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/l.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/m.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/n.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/o.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/p.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/q.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/r.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/s.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/t.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/u.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/v.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/w.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/x.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/y.js +2 -2
- package/dist/epic/tools/_assets/emoji/fomantic/z.js +2 -2
- package/dist/epic/tools/_assets/goals-live.js +318 -210
- package/dist/epic/tools/_assets/highlight.min.js +5764 -5269
- package/dist/epic/tools/_assets/lazy/code-engine.js +5 -1270
- package/dist/epic/tools/_assets/lazy/markdown-engine.js +67 -1513
- package/dist/epic/tools/_assets/lazy/markdown-sanitizer.js +3 -753
- package/dist/epic/tools/_assets/spell-comments.entry.js +282 -159
- package/dist/epic/tools/_assets/spell-comments.js +24 -3716
- package/dist/epic/tools/_assets/spell-doc-comments.js +1243 -816
- package/dist/epic/tools/_assets/spell-doc-helpers.js +298 -165
- package/dist/epic/tools/_assets/spell-doc-runtime.js +2760 -1415
- package/dist/epic/tools/_assets/spell-doc-toolbar.js +396 -227
- package/dist/epic/tools/_assets/spell-syntax.entry.js +505 -285
- package/dist/epic/tools/_assets/spell-syntax.js +22 -2916
- package/dist/epic/tools/_assets/spell-ui-sources.js +102 -60
- package/dist/epic/tools/_assets/spell-ui.entry.js +108 -40
- package/dist/epic/tools/_assets/spell-ui.js +3131 -46465
- package/dist/epic/tools/pages.d.ts +5 -6
- package/dist/epic/tools/pages.js +7 -6
- package/dist/epic/window.mjs +2 -3
- package/dist/ui/components/ui-accordion/UIAccordion.d.ts +1 -0
- package/dist/ui/components/ui-ad/UIAd.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumb.d.ts +1 -0
- package/dist/ui/components/ui-breadcrumbs/UIBreadcrumbs.d.ts +1 -0
- package/dist/ui/components/ui-button/UIButton.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButton.fallback.d.ts +8 -3
- package/dist/ui/components/ui-button/UIButtons.d.ts +1 -0
- package/dist/ui/components/ui-button/UIOr.d.ts +1 -0
- package/dist/ui/components/ui-calendar/UICalendar.d.ts +6 -0
- package/dist/ui/components/ui-calendar/UICalendar.fallback.d.ts +6 -0
- package/dist/ui/components/ui-card/UICards.d.ts +31 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.d.ts +7 -0
- package/dist/ui/components/ui-checkbox/UICheckbox.fallback.d.ts +7 -0
- package/dist/ui/components/ui-comment/UIComment.d.ts +1 -0
- package/dist/ui/components/ui-comment/UIComments.d.ts +1 -0
- package/dist/ui/components/ui-components/UIComponents.d.ts +1 -0
- package/dist/ui/components/ui-dimmer/UIDimmer.d.ts +1 -0
- package/dist/ui/components/ui-divider/UIDivider.d.ts +2 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.d.ts +6 -0
- package/dist/ui/components/ui-dropdown/UIDropdown.fallback.d.ts +6 -0
- package/dist/ui/components/ui-embed/UIEmbed.d.ts +1 -0
- package/dist/ui/components/ui-emoji/UIEmoji.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeed.d.ts +1 -0
- package/dist/ui/components/ui-feed/UIFeedEvent.d.ts +1 -0
- package/dist/ui/components/ui-flag/UIFlag.d.ts +1 -0
- package/dist/ui/components/ui-flyout/UIFlyout.d.ts +1 -0
- package/dist/ui/components/ui-form/UIFields.d.ts +1 -0
- package/dist/ui/components/ui-form/UIRepeat.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIColumn.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIGrid.d.ts +1 -0
- package/dist/ui/components/ui-grid/UIRow.d.ts +1 -0
- package/dist/ui/components/ui-icon/UIIcon.d.ts +3 -2
- package/dist/ui/components/ui-icon/UIIcons.d.ts +1 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.d.ts +6 -0
- package/dist/ui/components/ui-icon-picker/UIIconPicker.fallback.d.ts +6 -0
- package/dist/ui/components/ui-image/UIImages.d.ts +1 -0
- package/dist/ui/components/ui-include/UIInclude.d.ts +1 -0
- package/dist/ui/components/ui-input/UIInput.fallback.d.ts +9 -2
- package/dist/ui/components/ui-items/UIItems.d.ts +1 -0
- package/dist/ui/components/ui-keys/UIKeys.d.ts +1 -0
- package/dist/ui/components/ui-label/UILabel.d.ts +2 -0
- package/dist/ui/components/ui-label/UILabels.d.ts +1 -0
- package/dist/ui/components/ui-list/UIList.d.ts +2 -0
- package/dist/ui/components/ui-loader/UILoader.d.ts +1 -0
- package/dist/ui/components/ui-message/UIMessage.d.ts +2 -0
- package/dist/ui/components/ui-modal/UIModal.d.ts +1 -0
- package/dist/ui/components/ui-nag/UINag.d.ts +1 -0
- package/dist/ui/components/ui-page/UIPage.d.ts +15 -0
- package/dist/ui/components/ui-page/UIPage.es.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIActions.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAuthor.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIAvatar.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIContent.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDate.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDescription.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIDetail.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIExtra.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIHeader.d.ts +3 -1
- package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIParts.types.d.ts +15 -1
- package/dist/ui/components/ui-parts/UISummary.d.ts +1 -0
- package/dist/ui/components/ui-parts/UITitle.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIValue.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholder.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderHeader.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderImage.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderLine.d.ts +1 -0
- package/dist/ui/components/ui-placeholder/UIPlaceholderParagraph.d.ts +1 -0
- package/dist/ui/components/ui-progress/UIProgress.d.ts +2 -0
- package/dist/ui/components/ui-quote/UIQuote.d.ts +1 -0
- package/dist/ui/components/ui-rail/UIRail.d.ts +1 -0
- package/dist/ui/components/ui-rating/UIRating.d.ts +6 -0
- package/dist/ui/components/ui-rating/UIRating.fallback.d.ts +6 -0
- package/dist/ui/components/ui-reveal/UIReveal.d.ts +1 -0
- package/dist/ui/components/ui-search/UISearch.fallback.d.ts +13 -1
- package/dist/ui/components/ui-section/UISections.d.ts +1 -0
- package/dist/ui/components/ui-segment/UISegment.d.ts +2 -0
- package/dist/ui/components/ui-segment/UISegments.d.ts +1 -0
- package/dist/ui/components/ui-select/UISelect.d.ts +6 -0
- package/dist/ui/components/ui-select/UISelect.fallback.d.ts +6 -0
- package/dist/ui/components/ui-shape/UISide.d.ts +4 -0
- package/dist/ui/components/ui-sidebar/UIPushable.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UIPusher.d.ts +1 -0
- package/dist/ui/components/ui-sidebar/UISidebar.d.ts +1 -0
- package/dist/ui/components/ui-sides/UISides.d.ts +6 -0
- package/dist/ui/components/ui-sides/UISides.fallback.d.ts +6 -0
- package/dist/ui/components/ui-slider/UISlider.d.ts +7 -0
- package/dist/ui/components/ui-slider/UISlider.fallback.d.ts +7 -0
- package/dist/ui/components/ui-space/UISpace.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistic.d.ts +1 -0
- package/dist/ui/components/ui-statistic/UIStatistics.d.ts +1 -0
- package/dist/ui/components/ui-step/UIStep.d.ts +1 -0
- package/dist/ui/components/ui-step/UISteps.d.ts +1 -0
- package/dist/ui/components/ui-table/UICell.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerm.d.ts +1 -0
- package/dist/ui/components/ui-terms/UITerms.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIColorChip.d.ts +1 -0
- package/dist/ui/components/ui-theme-editor/UIThemeToken.d.ts +1 -0
- package/dist/ui/components/ui-toast/UIToast.d.ts +1 -0
- package/dist/ui/components/ui-toc/UIToc.d.ts +1 -0
- package/dist/ui/components/ui-transition/UITransition.d.ts +1 -0
- package/dist/ui/components/ui-video/UIAudio.d.ts +1 -0
- package/dist/ui/components/ui-video/UIVideo.d.ts +1 -0
- package/dist/ui/components/ui-visibility/UIVisibility.d.ts +1 -0
- package/dist/ui/components/ui-zoom/UIZoom.d.ts +1 -0
- package/dist/util/spell/constants.js +1 -1
- package/epic/.claude-plugin/plugin.json +1 -1
- package/epic/.codex-plugin/plugin.json +1 -1
- package/epic/hooks/handoff.mjs +4 -3
- package/epic/hooks/worktree.mjs +22 -3
- package/epic/package.json +41 -2
- package/epic/skills/details/SKILL.md +2 -1
- package/epic/skills/epic/SKILL.md +7 -1
- package/epic/skills/epic/guide.md +4 -0
- package/epic/skills/isolate/SKILL.md +35 -0
- package/epic/src/AGENTS.md +6 -2
- package/epic/templates/durable.html +1 -1
- package/epic/vscode/package.json +1 -1
- package/epic/vscode/spell-epic.vsix +0 -0
- package/package.json +1 -1
- package/parser/package.json +1 -1
- package/ui/package.json +15 -2
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/config/EngineFiles.mjs
|
|
5
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
6
|
+
var EngineFiles = class _EngineFiles {
|
|
7
|
+
static {
|
|
8
|
+
__name(this, "EngineFiles");
|
|
9
|
+
}
|
|
10
|
+
/** The folder of the engine's code: `epic/src`, or `dist/epic` in an install. This file is in its `config/`. */
|
|
11
|
+
static get code() {
|
|
12
|
+
return resolve(import.meta.dirname ?? ".", "..");
|
|
13
|
+
}
|
|
14
|
+
/** Is this code the built package's (`spell`'s `dist/epic/`), not a checkout's? */
|
|
15
|
+
static get isBuilt() {
|
|
16
|
+
return basename(dirname(_EngineFiles.code)) === DIST;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The engine's folder: `epic/` of the checkout, or `epic/` of the `spell` package, beside its `dist/`:
|
|
20
|
+
* every `"spellPublish": { "files" }` of the engine, and its folder manifest.
|
|
21
|
+
*/
|
|
22
|
+
static get root() {
|
|
23
|
+
const { code } = _EngineFiles;
|
|
24
|
+
return _EngineFiles.isBuilt ? join(dirname(dirname(code)), ENGINE_FOLDER) : dirname(code);
|
|
25
|
+
}
|
|
26
|
+
/** The `epic` command, to run under `node`: this copy's, in either layout. */
|
|
27
|
+
static get bin() {
|
|
28
|
+
return _EngineFiles.isBuilt ? join(_EngineFiles.code, "cli", "epicMain.js") : join(_EngineFiles.root, "bin", "epic");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Where `path` is in this layout, `path` as a checkout of the engine has it:
|
|
32
|
+
* - `src/tools/_assets` => `dist/epic/tools/_assets`, `src/tools/x.ts` => its built `.js`, in an install
|
|
33
|
+
* - anything else (`templates`, `skills/epic/guide.md`): from the engine's folder
|
|
34
|
+
* - `engine`: an engine's folder other than this one (a test's fake checkout): plainly from it
|
|
35
|
+
*/
|
|
36
|
+
static path(path, engine = _EngineFiles.root) {
|
|
37
|
+
if (!_EngineFiles.isBuilt || resolve(engine) !== _EngineFiles.root || !path.startsWith(SOURCE))
|
|
38
|
+
return join(engine, path);
|
|
39
|
+
return join(_EngineFiles.code, path.slice(SOURCE.length).replace(/\.tsx?$/, ".js"));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* How to run `script` (a file of the engine's code) as a child `node`, for `spawnSync(process.execPath, args, { env })`:
|
|
43
|
+
* - a checkout: under `tsx`, with the engine's `tsconfig.json`: every repo's files by their package names
|
|
44
|
+
* - an install: plain `node`, the code being built (no `tsconfig.json` ships)
|
|
45
|
+
* - `env`: what to start from, default this process's
|
|
46
|
+
*/
|
|
47
|
+
static nodeRun(script, args = [], env = process.env) {
|
|
48
|
+
if (_EngineFiles.isBuilt) return { args: [script, ...args], env };
|
|
49
|
+
return {
|
|
50
|
+
args: ["--import", "tsx", script, ...args],
|
|
51
|
+
env: { ...env, TSX_TSCONFIG_PATH: join(_EngineFiles.root, "tsconfig.json") }
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var DIST = "dist";
|
|
56
|
+
var ENGINE_FOLDER = "epic";
|
|
57
|
+
var SOURCE = "src/";
|
|
58
|
+
export {
|
|
59
|
+
EngineFiles
|
|
60
|
+
};
|
|
@@ -151,6 +151,8 @@ export declare class EpicConfig {
|
|
|
151
151
|
get contentFolder(): string;
|
|
152
152
|
/** the branch worktrees start from and merge into */
|
|
153
153
|
get baseBranch(): string;
|
|
154
|
+
/** whether the base branch can't be pushed to: work reaches it only through a pull request */
|
|
155
|
+
get baseBranchProtected(): boolean;
|
|
154
156
|
/**
|
|
155
157
|
* the folder NEW worktrees go in, `<worktreesFolder>/<name>`: `worktreesFolder`, from the main checkout
|
|
156
158
|
* - existing ones may still be in the old place: `worktreesFolders`
|
|
@@ -563,17 +565,24 @@ export type EpicOldLayout = {
|
|
|
563
565
|
* epic folder is missing
|
|
564
566
|
* - `baseBranch`: the branch worktrees start from and merge into (the remote's default branch, from git):
|
|
565
567
|
* the worktree hook, `epic worktree merge-main`, `epic merge`, the behind-main notice
|
|
568
|
+
* - `baseBranchProtected`: the base branch can't be pushed to, and work reaches it only through a pull request
|
|
569
|
+
* (`false`, the default; `epic init` turns it on with `--protected-base`, or when GitHub says so)
|
|
570
|
+
* - `epic init` opens a pull request instead of committing on it; `epic merge` refuses
|
|
571
|
+
* - the worktree hook and `epic worktree merge-main` fast-forward the local base branch from `origin` first
|
|
572
|
+
* (`BaseBranch`); `epic worktree remove --branches` counts a merged pull request as merged (a squash too)
|
|
573
|
+
* - the skills' finish reads it: a pull request in place of a merge
|
|
574
|
+
* - NOT the epic repo, whose own branch every turn pushes to: an org-wide rule must leave it out
|
|
566
575
|
* - `worktreesFolder`: where NEW worktrees go, relative to the main checkout (`../my-app.worktrees`), one folder each:
|
|
567
576
|
* the worktree hook, the window script, the epics list, the page server's `/worktrees/<w>/`
|
|
568
577
|
* - outside the repo since epic `epic-eject` P8: the old place, `.claude/worktrees`, is still read for the
|
|
569
578
|
* worktrees left there (`worktreesFolders`)
|
|
570
|
-
* - `installCommand`: what makes a new worktree ready to run (what the repo's lock file names, `
|
|
579
|
+
* - `installCommand`: what makes a new worktree ready to run (what the repo's lock file names, `npm install`):
|
|
571
580
|
* `/isolate`, `/epic`, the hook; `""` for none (a repo with no packages to install)
|
|
572
581
|
* - `installOnCreate`: whether the worktree hook runs `installCommand` itself, before it hands a NEW worktree over
|
|
573
582
|
* (off: the skills run it, after entering). On (the default when there's an install command), nothing opens the
|
|
574
583
|
* worktree without its packages (I2)
|
|
575
584
|
* - `installTimeout`: the seconds the hook's install may take (600)
|
|
576
|
-
* - `extraInstalls`: folders of a new worktree that are
|
|
585
|
+
* - `extraInstalls`: folders of a new worktree that are projects of their own, NOT workspaces of the one install
|
|
577
586
|
* (`["epic/vscode", "app/vscode"]`, the extensions; epic `epic-engine` I65), each a path from the
|
|
578
587
|
* worktree's root (the top's, in a multi-repo top); `[]` (the default): none
|
|
579
588
|
* - the worktree hook runs `installCommand` in each, after the one at the root, `installTimeout` seconds each
|
|
@@ -649,6 +658,7 @@ export type EpicSettings = {
|
|
|
649
658
|
contentFolder: string;
|
|
650
659
|
contentRemote: string;
|
|
651
660
|
baseBranch: string;
|
|
661
|
+
baseBranchProtected: boolean;
|
|
652
662
|
worktreesFolder: string;
|
|
653
663
|
installCommand: string;
|
|
654
664
|
installOnCreate: boolean;
|
|
@@ -8,6 +8,7 @@ import JSON5 from "json5";
|
|
|
8
8
|
import { checkoutOf } from "spell/server/checkout";
|
|
9
9
|
import { Git } from "spell/server/Git";
|
|
10
10
|
import { RealPath } from "spell/server/RealPath";
|
|
11
|
+
import { EngineFiles } from "./EngineFiles.mjs";
|
|
11
12
|
import { peerRepos } from "spell/server/page/settings";
|
|
12
13
|
import { PeopleColors } from "./PeopleColors.js";
|
|
13
14
|
import { Editor, EDITOR_IDS } from "./Editor.js";
|
|
@@ -25,6 +26,7 @@ var EpicConfig = class _EpicConfig {
|
|
|
25
26
|
*/
|
|
26
27
|
static DEFAULTS = {
|
|
27
28
|
contentRemote: "",
|
|
29
|
+
baseBranchProtected: false,
|
|
28
30
|
installTimeout: 600,
|
|
29
31
|
extraInstalls: [],
|
|
30
32
|
windows: { worktreeOnly: true, settings: {} },
|
|
@@ -52,7 +54,7 @@ var EpicConfig = class _EpicConfig {
|
|
|
52
54
|
* computed as the class loads stopped it starting (epic `epic-engine` I76)
|
|
53
55
|
*/
|
|
54
56
|
static get ENGINE_VOICES() {
|
|
55
|
-
return
|
|
57
|
+
return EngineFiles.path("voices");
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* where the window files were before epic `epic-eject` P13, from the main checkout:
|
|
@@ -178,6 +180,10 @@ var EpicConfig = class _EpicConfig {
|
|
|
178
180
|
get baseBranch() {
|
|
179
181
|
return this.settings.baseBranch;
|
|
180
182
|
}
|
|
183
|
+
/** whether the base branch can't be pushed to: work reaches it only through a pull request */
|
|
184
|
+
get baseBranchProtected() {
|
|
185
|
+
return this.settings.baseBranchProtected;
|
|
186
|
+
}
|
|
181
187
|
/**
|
|
182
188
|
* the folder NEW worktrees go in, `<worktreesFolder>/<name>`: `worktreesFolder`, from the main checkout
|
|
183
189
|
* - existing ones may still be in the old place: `worktreesFolders`
|
|
@@ -769,6 +775,7 @@ var EpicConfig = class _EpicConfig {
|
|
|
769
775
|
contentFolder: this.contentFolder,
|
|
770
776
|
contentRemote: this.contentRemote,
|
|
771
777
|
baseBranch: this.baseBranch,
|
|
778
|
+
baseBranchProtected: this.baseBranchProtected,
|
|
772
779
|
worktreesFolder: this.worktreesFolder,
|
|
773
780
|
installCommand: this.installCommand,
|
|
774
781
|
installOnCreate: this.installOnCreate,
|
|
@@ -929,6 +936,7 @@ var EpicConfig = class _EpicConfig {
|
|
|
929
936
|
contentFolder: valueOf(given, "contentFolder", defaults.contentFolder, file),
|
|
930
937
|
contentRemote: valueOf(given, "contentRemote", defaults.contentRemote, file, "", { empty: true }),
|
|
931
938
|
baseBranch: valueOf(given, "baseBranch", defaults.baseBranch, file),
|
|
939
|
+
baseBranchProtected: valueOf(given, "baseBranchProtected", defaults.baseBranchProtected, file),
|
|
932
940
|
worktreesFolder: valueOf(given, "worktreesFolder", defaults.worktreesFolder, file),
|
|
933
941
|
installCommand: valueOf(given, "installCommand", defaults.installCommand, file, "", { empty: true }),
|
|
934
942
|
installOnCreate: valueOf(given, "installOnCreate", defaults.installOnCreate, file),
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
*
|
|
14
14
|
* - Who runs it: `EpicHome.refreshGithub()` (the person's login), `epic init` (the epic repo).
|
|
15
15
|
* Serving a page or running a hook never does: `gh` may take seconds, or be offline.
|
|
16
|
+
* And a repo whose base branch takes only pull requests: `epic init` opens one, `epic worktree remove --branches`
|
|
17
|
+
* asks whether a branch's was merged.
|
|
16
18
|
* - `$SPELL_EPIC_GH` names another `gh` (`command()`): the tests' stand-ins, or a path to none.
|
|
17
19
|
* - Git itself is the kit's `Git`, never this.
|
|
18
20
|
* - STATIC: `gh` is the machine's.
|
|
@@ -27,7 +29,7 @@ export declare class GitHub {
|
|
|
27
29
|
* - `command`: the `gh` to run, default `command()`
|
|
28
30
|
* - a missing `gh`, a timeout or a failing command is `ok: false`; NEVER throws
|
|
29
31
|
*/
|
|
30
|
-
static run(args: string[], { command, timeout }?: GhRunOptions): GhResult;
|
|
32
|
+
static run(args: string[], { command, timeout, cwd }?: GhRunOptions): GhResult;
|
|
31
33
|
/**
|
|
32
34
|
* Whether `gh` can make a repo: `ready`, `missing` (not installed: `gh --version` doesn't run) or `logged-out`
|
|
33
35
|
* (`gh auth status` says no, or can't reach GitHub). NEVER throws.
|
|
@@ -44,6 +46,28 @@ export declare class GitHub {
|
|
|
44
46
|
* `undefined` for an address that isn't GitHub's.
|
|
45
47
|
*/
|
|
46
48
|
static ownerIn(address: string): string | undefined;
|
|
49
|
+
/** The GitHub repo in git address `address`, `owner/name`; `undefined` for an address that isn't GitHub's. */
|
|
50
|
+
static repoIn(address: string): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Whether GitHub requires a pull request into `branch` of repo `fullName` (`owner/name`):
|
|
53
|
+
* a ruleset's `pull_request` rule, or, where this person may read it, classic branch protection's required reviews.
|
|
54
|
+
* - `false` for anything else: no rule, no right to read it, offline, `gh` missing. NEVER throws.
|
|
55
|
+
*/
|
|
56
|
+
static requiresPullRequest(fullName: string, branch: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The pull request of branch `branch` into `base` that GitHub merged, as `gh` run in `cwd` reports it:
|
|
59
|
+
* `{ number, url, head }` (`head`: its last commit), the newest first; `[]` when `gh` can't say. NEVER throws.
|
|
60
|
+
*/
|
|
61
|
+
static mergedPullRequests(branch: string, base: string, cwd: string): MergedPullRequest[];
|
|
62
|
+
/**
|
|
63
|
+
* Open a pull request of `branch` into `base`, from checkout `cwd`: its address.
|
|
64
|
+
* - one open already: that one's address
|
|
65
|
+
* - throws an `Error` with gh's own words when it can't
|
|
66
|
+
* - SIDE EFFECT: a pull request on GitHub
|
|
67
|
+
*/
|
|
68
|
+
static openPullRequest({ branch, base, title, body, cwd }: OpenPullRequest): string;
|
|
69
|
+
/** `gh <args>`'s output as JSON; `undefined` when it failed or wasn't JSON. NEVER throws. */
|
|
70
|
+
private static json;
|
|
47
71
|
/**
|
|
48
72
|
* Make GitHub repo `fullName` (`owner/name`), empty: private, unless `visibility` says `public`.
|
|
49
73
|
* - throws an `Error` with gh's own words when it can't (a name taken, no right to make one there)
|
|
@@ -72,6 +96,22 @@ export type GhRunOptions = {
|
|
|
72
96
|
command?: string;
|
|
73
97
|
/** how long it may take, ms; default a few seconds: it may be offline */
|
|
74
98
|
timeout?: number;
|
|
99
|
+
/** where it runs, for what asks about "this repo" (`gh pr ...`); default the current folder */
|
|
100
|
+
cwd?: string;
|
|
101
|
+
};
|
|
102
|
+
/** A pull request GitHub merged: `GitHub.mergedPullRequests()`; `head`: its last commit. */
|
|
103
|
+
export type MergedPullRequest = {
|
|
104
|
+
number: number;
|
|
105
|
+
url: string;
|
|
106
|
+
head: string;
|
|
107
|
+
};
|
|
108
|
+
/** What `GitHub.openPullRequest()` takes. */
|
|
109
|
+
export type OpenPullRequest = {
|
|
110
|
+
branch: string;
|
|
111
|
+
base: string;
|
|
112
|
+
title: string;
|
|
113
|
+
body: string;
|
|
114
|
+
cwd: string;
|
|
75
115
|
};
|
|
76
116
|
/** Whether `gh` can make a repo: `GitHub.status()`. */
|
|
77
117
|
export type GhStatus = "ready" | "missing" | "logged-out";
|
|
@@ -16,9 +16,9 @@ var GitHub = class _GitHub {
|
|
|
16
16
|
* - `command`: the `gh` to run, default `command()`
|
|
17
17
|
* - a missing `gh`, a timeout or a failing command is `ok: false`; NEVER throws
|
|
18
18
|
*/
|
|
19
|
-
static run(args, { command = _GitHub.command(), timeout = TIMEOUT_MS } = {}) {
|
|
19
|
+
static run(args, { command = _GitHub.command(), timeout = TIMEOUT_MS, cwd } = {}) {
|
|
20
20
|
try {
|
|
21
|
-
const run = spawnSync(command, args, { encoding: "utf8", timeout });
|
|
21
|
+
const run = spawnSync(command, args, { encoding: "utf8", timeout, cwd });
|
|
22
22
|
return {
|
|
23
23
|
ok: run.status === 0,
|
|
24
24
|
out: (run.stdout ?? "").trim(),
|
|
@@ -56,6 +56,76 @@ var GitHub = class _GitHub {
|
|
|
56
56
|
static ownerIn(address) {
|
|
57
57
|
return GITHUB_ADDRESS.exec(address)?.[1];
|
|
58
58
|
}
|
|
59
|
+
/** The GitHub repo in git address `address`, `owner/name`; `undefined` for an address that isn't GitHub's. */
|
|
60
|
+
static repoIn(address) {
|
|
61
|
+
const match = GITHUB_ADDRESS.exec(address);
|
|
62
|
+
return match ? `${match[1]}/${match[2]}` : void 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Whether GitHub requires a pull request into `branch` of repo `fullName` (`owner/name`):
|
|
66
|
+
* a ruleset's `pull_request` rule, or, where this person may read it, classic branch protection's required reviews.
|
|
67
|
+
* - `false` for anything else: no rule, no right to read it, offline, `gh` missing. NEVER throws.
|
|
68
|
+
*/
|
|
69
|
+
static requiresPullRequest(fullName, branch) {
|
|
70
|
+
const path = `repos/${fullName}`;
|
|
71
|
+
const name = encodeURIComponent(branch);
|
|
72
|
+
const rules = _GitHub.json(["api", `${path}/rules/branches/${name}`]);
|
|
73
|
+
if (Array.isArray(rules) && rules.some((rule) => rule.type === PULL_REQUEST_RULE)) return true;
|
|
74
|
+
const classic = _GitHub.json([
|
|
75
|
+
"api",
|
|
76
|
+
`${path}/branches/${name}/protection`
|
|
77
|
+
]);
|
|
78
|
+
return Boolean(classic?.required_pull_request_reviews);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The pull request of branch `branch` into `base` that GitHub merged, as `gh` run in `cwd` reports it:
|
|
82
|
+
* `{ number, url, head }` (`head`: its last commit), the newest first; `[]` when `gh` can't say. NEVER throws.
|
|
83
|
+
*/
|
|
84
|
+
static mergedPullRequests(branch, base, cwd) {
|
|
85
|
+
const args = [
|
|
86
|
+
"pr",
|
|
87
|
+
"list",
|
|
88
|
+
"--head",
|
|
89
|
+
branch,
|
|
90
|
+
"--base",
|
|
91
|
+
base,
|
|
92
|
+
"--state",
|
|
93
|
+
"merged",
|
|
94
|
+
"--json",
|
|
95
|
+
"number,url,headRefOid"
|
|
96
|
+
];
|
|
97
|
+
const found = _GitHub.json(args, { cwd, timeout: NETWORK_MS });
|
|
98
|
+
return Array.isArray(found) ? found.map(({ number, url, headRefOid }) => ({ number, url, head: headRefOid })) : [];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Open a pull request of `branch` into `base`, from checkout `cwd`: its address.
|
|
102
|
+
* - one open already: that one's address
|
|
103
|
+
* - throws an `Error` with gh's own words when it can't
|
|
104
|
+
* - SIDE EFFECT: a pull request on GitHub
|
|
105
|
+
*/
|
|
106
|
+
static openPullRequest({ branch, base, title, body, cwd }) {
|
|
107
|
+
const open = _GitHub.json(
|
|
108
|
+
["pr", "list", "--head", branch, "--base", base, "--state", "open", "--json", "url"],
|
|
109
|
+
{ cwd, timeout: NETWORK_MS }
|
|
110
|
+
);
|
|
111
|
+
if (Array.isArray(open) && open[0]?.url) return open[0].url;
|
|
112
|
+
const run = _GitHub.run(["pr", "create", "--base", base, "--head", branch, "--title", title, "--body", body], {
|
|
113
|
+
cwd,
|
|
114
|
+
timeout: CREATE_TIMEOUT_MS
|
|
115
|
+
});
|
|
116
|
+
if (!run.ok) throw new Error(`gh pr create failed: ${run.err || run.out || "no reason given"}`, { cause: run });
|
|
117
|
+
return run.out.split("\n").at(-1) ?? "";
|
|
118
|
+
}
|
|
119
|
+
/** `gh <args>`'s output as JSON; `undefined` when it failed or wasn't JSON. NEVER throws. */
|
|
120
|
+
static json(args, options) {
|
|
121
|
+
const run = _GitHub.run(args, options);
|
|
122
|
+
if (!run.ok) return void 0;
|
|
123
|
+
try {
|
|
124
|
+
return JSON.parse(run.out);
|
|
125
|
+
} catch {
|
|
126
|
+
return void 0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
59
129
|
/**
|
|
60
130
|
* Make GitHub repo `fullName` (`owner/name`), empty: private, unless `visibility` says `public`.
|
|
61
131
|
* - throws an `Error` with gh's own words when it can't (a name taken, no right to make one there)
|
|
@@ -85,8 +155,10 @@ var GH_ENV = "SPELL_EPIC_GH";
|
|
|
85
155
|
var HOST = "github.com";
|
|
86
156
|
var TIMEOUT_MS = 5e3;
|
|
87
157
|
var CREATE_TIMEOUT_MS = 3e4;
|
|
158
|
+
var NETWORK_MS = 15e3;
|
|
159
|
+
var PULL_REQUEST_RULE = "pull_request";
|
|
88
160
|
var LOGIN = /^[A-Za-z\d](?:[A-Za-z\d]|-(?=[A-Za-z\d])){0,38}$/;
|
|
89
|
-
var GITHUB_ADDRESS = /github\.com[:/]([^/]+)\/[^/]+?(?:\.git)?\/?$/;
|
|
161
|
+
var GITHUB_ADDRESS = /github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/;
|
|
90
162
|
export {
|
|
91
163
|
GitHub
|
|
92
164
|
};
|
|
@@ -3,8 +3,9 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/config/LayeredSettings.ts
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
|
-
import { join
|
|
6
|
+
import { join } from "node:path";
|
|
7
7
|
import { DataFile } from "spell/server/DataFile";
|
|
8
|
+
import { EngineFiles } from "./EngineFiles.mjs";
|
|
8
9
|
var LayeredSettings = class _LayeredSettings {
|
|
9
10
|
static {
|
|
10
11
|
__name(this, "LayeredSettings");
|
|
@@ -15,7 +16,7 @@ var LayeredSettings = class _LayeredSettings {
|
|
|
15
16
|
static BUILT_IN = { away: { finishedPhaseDays: 3 } };
|
|
16
17
|
/** The kit's own file: worked out when read, as `EpicConfig.ENGINE_VOICES` is. */
|
|
17
18
|
static get DEFAULT_FILE() {
|
|
18
|
-
return
|
|
19
|
+
return EngineFiles.path(_LayeredSettings.FILE);
|
|
19
20
|
}
|
|
20
21
|
/** The layers, lowest first. */
|
|
21
22
|
layers;
|
|
@@ -283,7 +283,7 @@ export declare const ROUTE_MODULES: readonly string[];
|
|
|
283
283
|
/**
|
|
284
284
|
* Folders whose code, when newer than a running server, makes `ensure()` restart it
|
|
285
285
|
* (`SRV.newestChange()`: every `.ts` / `.js` / `.mjs` file in them; `_assets/` and `node_modules/` skipped):
|
|
286
|
-
* - ALL of spell-epic's code, `src/` (epic `epic-eject` I11): the route modules import far beyond their own folders
|
|
286
|
+
* - ALL of spell-epic's code, `src/`, or its built `dist/epic/` (epic `epic-eject` I11): the route modules import far beyond their own folders
|
|
287
287
|
* (`config/`, `data/`, `links/`, `review/`, the elements' definitions ...), so watching only theirs and this one
|
|
288
288
|
* missed a change to the rest
|
|
289
289
|
* - the server package's, `spell/server` (the kit's `src/server/`), where Node's resolver finds it (`packageDir()`)
|
|
@@ -2,9 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/server/EpicServer.ts
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
5
6
|
import { existsSync, mkdirSync, statSync } from "node:fs";
|
|
6
7
|
import { join, resolve } from "node:path";
|
|
7
|
-
import {
|
|
8
|
+
import { pathToFileURL } from "node:url";
|
|
8
9
|
import { SRV } from "spell/server";
|
|
9
10
|
import {
|
|
10
11
|
componentSets,
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
withLocalCopies
|
|
17
18
|
} from "spell/server/page";
|
|
18
19
|
import { resolvedFile } from "spell/toolchain/sourceNames";
|
|
20
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
19
21
|
import { EpicHome } from "../config/EpicHome.js";
|
|
20
22
|
import { packageDir } from "../tools/packageDir.js";
|
|
21
23
|
import { RepoApp } from "./RepoApp.js";
|
|
@@ -90,7 +92,7 @@ var EpicServer = class _EpicServer {
|
|
|
90
92
|
} = {}) {
|
|
91
93
|
this.home = resolve(home);
|
|
92
94
|
this.engine = resolve(engine);
|
|
93
|
-
this.epicUiDir = resolve(epicUi ??
|
|
95
|
+
this.epicUiDir = resolve(epicUi ?? EngineFiles.path(EPIC_UI.dir, this.engine));
|
|
94
96
|
this.repos = repos ?? new RepoList({ home: this.home }).repos();
|
|
95
97
|
this.defaultRepo = this.repos.find((repo2) => repo2.isDefault) ?? this.repos[0];
|
|
96
98
|
this.setMounts = [...this.epicUiMounts(), ...this.componentSetMounts()];
|
|
@@ -120,12 +122,12 @@ var EpicServer = class _EpicServer {
|
|
|
120
122
|
const router = this.web.router;
|
|
121
123
|
router.get(SRV.SERVER_API, (_request, reply) => reply.set("Cache-Control", "no-store").json(this.info));
|
|
122
124
|
for (const repo2 of this.repos) {
|
|
123
|
-
if (!existsSync(join(repo2.content, HOME_PAGE))) continue;
|
|
124
125
|
router.get(
|
|
125
126
|
repo2.prefix,
|
|
126
|
-
(request, reply, next) => request.path.endsWith("/") ? reply.redirect(`${repo2.prefix}${HOME_PAGE}`) : next()
|
|
127
|
+
(request, reply, next) => request.path.endsWith("/") && hasHomePage(repo2) ? reply.redirect(`${repo2.prefix}${HOME_PAGE}`) : next()
|
|
127
128
|
);
|
|
128
|
-
if (repo2 === this.defaultRepo)
|
|
129
|
+
if (repo2 === this.defaultRepo)
|
|
130
|
+
router.get("/", (_request, reply, next) => hasHomePage(repo2) ? reply.redirect(`/${HOME_PAGE}`) : next());
|
|
129
131
|
}
|
|
130
132
|
const repo = this.defaultRepo;
|
|
131
133
|
this.apps = this.repos.map((each) => new RepoApp(each, this.home));
|
|
@@ -259,9 +261,9 @@ var EpicServer = class _EpicServer {
|
|
|
259
261
|
mounts() {
|
|
260
262
|
const engine = Object.values(ENGINE_ROUTES).map((route) => ({
|
|
261
263
|
prefix: route.prefix,
|
|
262
|
-
dir:
|
|
264
|
+
dir: EngineFiles.path(route.dir, this.engine)
|
|
263
265
|
}));
|
|
264
|
-
const templates =
|
|
266
|
+
const templates = EngineFiles.path(ENGINE_ROUTES.templates.dir, this.engine);
|
|
265
267
|
const repoTemplates = this.repos.map((repo2) => ({ prefix: `${repo2.prefix}templates/`, dir: templates }));
|
|
266
268
|
const repos = [
|
|
267
269
|
...repoTemplates,
|
|
@@ -424,12 +426,12 @@ var EpicServer = class _EpicServer {
|
|
|
424
426
|
}
|
|
425
427
|
if (!watchCode) return;
|
|
426
428
|
for (const route of Object.values(ENGINE_ROUTES)) {
|
|
427
|
-
const dir =
|
|
429
|
+
const dir = EngineFiles.path(route.dir, this.engine);
|
|
428
430
|
live.watch(dir, { servedAt: route.prefix });
|
|
429
431
|
if (route.prefix !== `/${route.dir}/`) live.watch(dir, { servedAt: `/${route.dir}/` });
|
|
430
432
|
}
|
|
431
433
|
for (const repo of this.repos)
|
|
432
|
-
live.watch(
|
|
434
|
+
live.watch(EngineFiles.path(ENGINE_ROUTES.templates.dir, this.engine), { servedAt: `${repo.prefix}templates/` });
|
|
433
435
|
for (const mount of this.setMounts) if (existsSync(mount.dir)) live.watch(mount.dir, { servedAt: mount.prefix });
|
|
434
436
|
}
|
|
435
437
|
////////////////
|
|
@@ -499,12 +501,24 @@ async function epicServerOn(port) {
|
|
|
499
501
|
}
|
|
500
502
|
}
|
|
501
503
|
__name(epicServerOn, "epicServerOn");
|
|
502
|
-
var ENGINE_ROOT =
|
|
503
|
-
var EPIC_BIN =
|
|
504
|
+
var ENGINE_ROOT = EngineFiles.root;
|
|
505
|
+
var EPIC_BIN = EngineFiles.bin;
|
|
504
506
|
var ROUTE_MODULES = repoSettings(ENGINE_ROOT)?.routes ?? [];
|
|
505
|
-
var SOURCES = [
|
|
507
|
+
var SOURCES = [EngineFiles.code, ...[packageDir("spell/server")].filter((dir) => dir !== void 0)];
|
|
506
508
|
var PAGE_SERVER = "spell/server/page";
|
|
507
509
|
var SPELL_UI_ASSETS = "site/_assets";
|
|
510
|
+
function hasHomePage(repo) {
|
|
511
|
+
const file = join(repo.content, HOME_PAGE);
|
|
512
|
+
if (existsSync(file)) return true;
|
|
513
|
+
spawnSync(process.execPath, [EngineFiles.path(DOCS_INDEX)], {
|
|
514
|
+
cwd: repo.checkout,
|
|
515
|
+
stdio: "ignore",
|
|
516
|
+
env: { ...process.env, EPIC_CHECKOUT: repo.checkout }
|
|
517
|
+
});
|
|
518
|
+
return existsSync(file);
|
|
519
|
+
}
|
|
520
|
+
__name(hasHomePage, "hasHomePage");
|
|
521
|
+
var DOCS_INDEX = "src/tools/index.js";
|
|
508
522
|
var HOME_PAGE = "pages/index.html";
|
|
509
523
|
var WRITABLE = ["epics", "guides", "pages", "brand", "sagas"];
|
|
510
524
|
export {
|
|
@@ -8,6 +8,7 @@ import { homedir } from "node:os";
|
|
|
8
8
|
import { dirname, join } from "node:path";
|
|
9
9
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
11
12
|
var InboxPoller = class {
|
|
12
13
|
static {
|
|
13
14
|
__name(this, "InboxPoller");
|
|
@@ -140,7 +141,7 @@ var POLL_MS = 2e3;
|
|
|
140
141
|
var SETTLE_MS = 4e3;
|
|
141
142
|
var RETRY_MS = 6e4;
|
|
142
143
|
var LOOK_TIMEOUT_MS = 6e4;
|
|
143
|
-
var EPIC =
|
|
144
|
+
var EPIC = EngineFiles.bin;
|
|
144
145
|
function listenersFolder() {
|
|
145
146
|
return process.env.SPELL_EPIC_LISTENERS_DIR || join(homedir(), ".spell-epic", "listeners");
|
|
146
147
|
}
|
|
@@ -6,6 +6,7 @@ import { spawnSync } from "node:child_process";
|
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
7
|
import { dirname, join, relative, resolve } from "node:path";
|
|
8
8
|
import { stringFlag } from "../command/command.types.js";
|
|
9
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
9
10
|
import { PlanDocError } from "./planDoc.types.js";
|
|
10
11
|
import { ContentRelink, Migrations, PAGE_KINDS, RootLinks } from "./migrations/index.js";
|
|
11
12
|
import { Renumber } from "./Renumber.js";
|
|
@@ -194,15 +195,12 @@ var MigrateCommands = class _MigrateCommands {
|
|
|
194
195
|
/** Run the docs tool with `args`, in the docs tools' package (`PlanDocFiles.docsPackage`); its stdout printed, its stderr warned; its exit code. */
|
|
195
196
|
runDocsTool(args) {
|
|
196
197
|
const { files } = this;
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
["--
|
|
200
|
-
|
|
201
|
-
cwd: files.docsPackage,
|
|
202
|
-
encoding: "utf8",
|
|
203
|
-
env: { ...files.toolEnv, TSX_TSCONFIG_PATH: join(files.docsPackage, "tsconfig.json") }
|
|
204
|
-
}
|
|
198
|
+
const script = EngineFiles.nodeRun(
|
|
199
|
+
join(files.docsTools, "migrate.js"),
|
|
200
|
+
["--root", files.root, ...args],
|
|
201
|
+
files.toolEnv
|
|
205
202
|
);
|
|
203
|
+
const run = spawnSync(process.execPath, script.args, { cwd: files.docsPackage, encoding: "utf8", env: script.env });
|
|
206
204
|
for (const line of (run.stdout ?? "").split("\n").filter(Boolean)) this.owner.print(line);
|
|
207
205
|
for (const line of (run.stderr ?? "").split("\n").filter(Boolean)) this.owner.warn(line);
|
|
208
206
|
return run.status ?? 1;
|
|
@@ -9,6 +9,7 @@ import { fileURLToPath } from "node:url";
|
|
|
9
9
|
import { parseHTML } from "linkedom";
|
|
10
10
|
import { RealPath } from "spell/server/RealPath";
|
|
11
11
|
import { ChunkFiles } from "spell/server/places/ChunkFiles";
|
|
12
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
12
13
|
import { EpicConfig } from "../config/EpicConfig.js";
|
|
13
14
|
import { EpicHome } from "../config/EpicHome.js";
|
|
14
15
|
import { LayeredSettings } from "../config/LayeredSettings.js";
|
|
@@ -84,7 +85,7 @@ var PlanDocFiles = class _PlanDocFiles {
|
|
|
84
85
|
this.epics = join(this.content, "epics");
|
|
85
86
|
this.template = template;
|
|
86
87
|
this.details = join(this.content, "pages", "details");
|
|
87
|
-
this.docsPackage =
|
|
88
|
+
this.docsPackage = EngineFiles.root;
|
|
88
89
|
this.docsTools = DOCS_TOOLS;
|
|
89
90
|
const linkRoot = new RepoList().linkRootOf(root, content);
|
|
90
91
|
this.linker = new SRV.Linker(linkRoot, { served: ServedFolders.under(linkRoot) });
|
|
@@ -747,7 +748,7 @@ function inboxView(inbox) {
|
|
|
747
748
|
}
|
|
748
749
|
__name(inboxView, "inboxView");
|
|
749
750
|
var EPIC_STATUSES = ["in progress", "future", "done"];
|
|
750
|
-
var CHECKOUT =
|
|
751
|
+
var CHECKOUT = EngineFiles.root;
|
|
751
752
|
var DOCS_TOOLS = fileURLToPath(new URL("../tools", import.meta.url));
|
|
752
753
|
var TEMPLATE = fileURLToPath(new URL("templates/plan.html", import.meta.url));
|
|
753
754
|
function decodedPath(url) {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* - STATIC: reads the disk (the link), keeps nothing.
|
|
22
22
|
****************/
|
|
23
23
|
export declare class ServedFolders {
|
|
24
|
-
/** spell-epic's root: this engine's
|
|
24
|
+
/** spell-epic's root: this engine's folder (`EngineFiles.root`). */
|
|
25
25
|
static readonly ENGINE: string;
|
|
26
26
|
/**
|
|
27
27
|
* The folders served at another address under checkout `root`, by their address folder, both relative to `root`.
|
|
@@ -3,17 +3,17 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/tool/ServedFolders.ts
|
|
5
5
|
import { existsSync, realpathSync } from "node:fs";
|
|
6
|
-
import { join, relative
|
|
7
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { join, relative } from "node:path";
|
|
8
7
|
import { componentSets, pageServerSettings } from "spell/server/page/settings";
|
|
8
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
9
9
|
import { EpicConfig } from "../config/EpicConfig.js";
|
|
10
10
|
import { EPIC_UI } from "../server/server.types.js";
|
|
11
11
|
var ServedFolders = class _ServedFolders {
|
|
12
12
|
static {
|
|
13
13
|
__name(this, "ServedFolders");
|
|
14
14
|
}
|
|
15
|
-
/** spell-epic's root: this engine's
|
|
16
|
-
static ENGINE =
|
|
15
|
+
/** spell-epic's root: this engine's folder (`EngineFiles.root`). */
|
|
16
|
+
static ENGINE = EngineFiles.root;
|
|
17
17
|
/**
|
|
18
18
|
* The folders served at another address under checkout `root`, by their address folder, both relative to `root`.
|
|
19
19
|
* - `engine`: the engine's checkout, whose `templates/` are served (default `ENGINE`)
|
|
@@ -3,8 +3,8 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
3
3
|
|
|
4
4
|
// src/tools/PageInboxes.ts
|
|
5
5
|
import { existsSync, readdirSync } from "node:fs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { join, relative, sep } from "node:path";
|
|
7
|
+
import { EngineFiles } from "../config/EngineFiles.mjs";
|
|
8
8
|
import { EpicConfig } from "../config/EpicConfig.js";
|
|
9
9
|
import { GuideInbox } from "../tool/GuideInbox.js";
|
|
10
10
|
import { SharedComments } from "../tool/SharedComments.js";
|
|
@@ -12,7 +12,7 @@ import { SeeAlso } from "../tool/SeeAlso.js";
|
|
|
12
12
|
import { EPIC_UI } from "../server/server.types.js";
|
|
13
13
|
import { ComponentSetFolders } from "./ComponentSetFolders.js";
|
|
14
14
|
var COMMENT_FOLDERS = ["guides", "pages", "epics"];
|
|
15
|
-
var EPIC_UI_DOCS =
|
|
15
|
+
var EPIC_UI_DOCS = EngineFiles.path(EPIC_UI.dir);
|
|
16
16
|
var SKIPPED = /(^|\/)(parts|experiments|node_modules)(\/|$)/;
|
|
17
17
|
var INBOX_FILE = /\.inbox\.json5?$/;
|
|
18
18
|
var PageInboxes = class {
|