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.
- package/README-epics.md +149 -49
- package/app/package.json +25 -1
- package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
- package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
- package/dist/app/app/pages/SiteBoardView.css +5 -5
- package/dist/app/app/pages/SiteBoardView.js +1 -1
- package/dist/app/app/pages/SiteEditorPage.js +6 -3
- package/dist/app/app/pages/SiteEdits.js +27 -10
- package/dist/app/app/pages/SiteWrites.js +11 -0
- package/dist/app/app/runner/spellRuntime.js +1 -0
- 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 +20 -5
- package/dist/epic/cli/epicGroups.js +7 -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/PullRequest.d.ts +45 -0
- package/dist/epic/command/PullRequest.js +100 -0
- package/dist/epic/command/RepoInit.d.ts +196 -39
- package/dist/epic/command/RepoInit.js +481 -60
- package/dist/epic/command/Requests.d.ts +1 -0
- package/dist/epic/command/Requests.js +7 -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 +20 -3
- package/dist/epic/command/Worktrees.js +39 -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/CodeHost.d.ts +96 -0
- package/dist/epic/config/CodeHost.js +89 -0
- package/dist/epic/config/EngineFiles.mjs +60 -0
- package/dist/epic/config/EpicConfig.d.ts +20 -3
- package/dist/epic/config/EpicConfig.js +25 -1
- package/dist/epic/config/EpicRepo.js +1 -1
- package/dist/epic/config/GitHub.d.ts +75 -3
- package/dist/epic/config/GitHub.js +106 -5
- package/dist/epic/config/GitLab.d.ts +138 -0
- package/dist/epic/config/GitLab.js +297 -0
- 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/PlanCommits.d.ts +7 -4
- package/dist/epic/tool/PlanCommits.js +7 -5
- package/dist/epic/tool/PlanDocCommands.js +3 -4
- package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
- package/dist/epic/tool/PlanDocFiles.js +13 -5
- 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/parser/core/classes/View.d.ts +20 -0
- package/dist/parser/core/classes/View.js +91 -17
- package/dist/parser/core/core.declarations.json5 +18 -0
- package/dist/parser/core/core.scopes.js +5 -0
- package/dist/parser/core/sites.d.ts +10 -0
- package/dist/parser/core/sites.js +12 -0
- package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
- package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
- package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
- package/dist/parser/parser/tokenizer/Tokens.js +4 -0
- package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
- package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
- package/dist/parser/py/core/spell_core/apps.py +2 -0
- package/dist/parser/spell/PARSING.md +21 -0
- package/dist/parser/spell/SpellParser.d.ts +2 -0
- package/dist/parser/spell/SpellParser.js +58 -3
- package/dist/parser/spell/SpellxTokenizer.js +2 -1
- package/dist/parser/spell/SpellxTwin.d.ts +4 -1
- package/dist/parser/spell/SpellxTwin.js +10 -3
- package/dist/parser/spell/builtinTypes.js +24 -1
- package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
- package/dist/parser/spell/languages/Language.d.ts +11 -2
- package/dist/parser/spell/languages/en/words.js +3 -2
- package/dist/parser/spell/languages/es/words.js +7 -4
- package/dist/parser/spell/rules/Statement.js +1 -1
- package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
- package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
- package/dist/parser/spell/rules/sites/SitePage.js +2 -2
- package/dist/parser/spell/rules/sites/sites.en.js +1 -1
- package/dist/parser/spell/rules/sites/sites.es.js +1 -1
- package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
- package/dist/parser/spell/spell.types.d.ts +7 -0
- package/dist/parser/spell/spellSyntax.es.json +6 -6
- package/dist/parser/spell/spellSyntax.json +6 -6
- package/dist/parser/spellx/SpellxView.js +2 -1
- 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 +15 -3
- package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
- package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
- package/dist/ui/components/ui-parts/UIHeader.js +45 -5
- package/dist/ui/components/ui-parts/UIMeta.d.ts +1 -0
- package/dist/ui/components/ui-parts/UIParts.css +18 -0
- package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
- 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/ui/jsx.d.ts +4 -4
- package/dist/ui/vocabulary/defaults.generated.js +1 -1
- 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 +3 -0
- package/epic/skills/isolate/SKILL.md +53 -20
- package/epic/src/AGENTS.md +11 -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
|
@@ -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;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type CodeHostKind } from "spell/epic/config/CodeHost";
|
|
1
2
|
import type { ParsedCommit } from "./planDoc.types";
|
|
2
3
|
/****************
|
|
3
4
|
* ### `PlanCommits`
|
|
4
5
|
* Commits as an epic page lists them: what a commit subject says it did (`P3: Name -- summary`, `Fix I3: ...`), the
|
|
5
|
-
* repo's
|
|
6
|
+
* repo's page on its code host, and finding a listed one (`<epic-commit sha>`).
|
|
6
7
|
* - STATIC and instance-free on purpose: pure functions of their arguments; never runs git (the command line does,
|
|
7
8
|
* and hands the log in).
|
|
8
9
|
* - From `src/tools/plan-doc.js` (epic `epic-components`, P7).
|
|
@@ -23,10 +24,12 @@ export declare class PlanCommits {
|
|
|
23
24
|
*/
|
|
24
25
|
static titleNames(title: string, name: string): boolean;
|
|
25
26
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
27
|
+
* The page a repo's commit links go under, from its remote's URL (`git remote get-url origin`);
|
|
28
|
+
* `null` for an address that isn't that host's.
|
|
29
|
+
* - `<epic-commit>` adds `/commit/<sha>`: on GitLab this is `https://host/group/project/-`, giving GitLab's
|
|
30
|
+
* `/-/commit/<sha>`
|
|
28
31
|
*/
|
|
29
|
-
static
|
|
32
|
+
static commitBase(remote: string | null | undefined, kind: CodeHostKind): string | null;
|
|
30
33
|
/**
|
|
31
34
|
* The `<epic-commit>` for commit `sha` among `host`'s children (a phase, an item), if any: by its `sha`, either one
|
|
32
35
|
* a prefix of the other (a short sha given, or listed).
|
|
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// src/tool/PlanCommits.ts
|
|
5
|
+
import { CodeHost } from "../config/CodeHost.js";
|
|
5
6
|
var PlanCommits = class _PlanCommits {
|
|
6
7
|
static {
|
|
7
8
|
__name(this, "PlanCommits");
|
|
@@ -37,12 +38,13 @@ var PlanCommits = class _PlanCommits {
|
|
|
37
38
|
return Boolean(name) && title.toLowerCase().includes(name.toLowerCase());
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
|
-
* The
|
|
41
|
-
*
|
|
41
|
+
* The page a repo's commit links go under, from its remote's URL (`git remote get-url origin`);
|
|
42
|
+
* `null` for an address that isn't that host's.
|
|
43
|
+
* - `<epic-commit>` adds `/commit/<sha>`: on GitLab this is `https://host/group/project/-`, giving GitLab's
|
|
44
|
+
* `/-/commit/<sha>`
|
|
42
45
|
*/
|
|
43
|
-
static
|
|
44
|
-
|
|
45
|
-
return match ? `https://github.com/${match[1]}/${match[2]}` : null;
|
|
46
|
+
static commitBase(remote, kind) {
|
|
47
|
+
return CodeHost.commitBase(kind, String(remote ?? "").trim());
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
50
|
* The `<epic-commit>` for commit `sha` among `host`'s children (a phase, an item), if any: by its `sha`, either one
|
|
@@ -29,7 +29,6 @@ import { ItemPicker } from "./ItemPicker.js";
|
|
|
29
29
|
import { MigrateCommands } from "./MigrateCommands.js";
|
|
30
30
|
import { OptionCommands } from "./OptionCommands.js";
|
|
31
31
|
import { PlanDoc } from "./PlanDoc.js";
|
|
32
|
-
import { PlanCommits } from "./PlanCommits.js";
|
|
33
32
|
import { EPIC_STATUSES, PlanDocFiles } from "./PlanDocFiles.js";
|
|
34
33
|
import { PlanItem } from "./PlanItem.js";
|
|
35
34
|
import { PlanMarkup } from "./PlanMarkup.js";
|
|
@@ -558,7 +557,7 @@ var PlanDocCommands = class _PlanDocCommands {
|
|
|
558
557
|
if (!found) throw new PlanDocError(`no commit "${sha}" in ${folders.join(", ")}`);
|
|
559
558
|
const { folder, full } = found;
|
|
560
559
|
const base = this.files.commitBase(file);
|
|
561
|
-
const repo =
|
|
560
|
+
const repo = PlanDocFiles.commitBaseOf(folder);
|
|
562
561
|
const { done, where } = await this.edit(file, (plan) => {
|
|
563
562
|
const target = phase !== void 0 ? { phase: plan.phasePlace(String(phase)) } : { item: String(item) };
|
|
564
563
|
const where2 = target.phase !== void 0 ? plan.phaseLabel(target.phase) : target.item.toUpperCase();
|
|
@@ -608,8 +607,8 @@ var PlanDocCommands = class _PlanDocCommands {
|
|
|
608
607
|
const repos = stringFlag(flags.repo)?.split(",").filter(Boolean) ?? [];
|
|
609
608
|
if (!maps.length || !repos.length)
|
|
610
609
|
throw new PlanDocError("commits remap <map> [<map> ...] --repo <old repo> [--to <repo>] [--dry-run]");
|
|
611
|
-
const to = stringFlag(flags.to) ??
|
|
612
|
-
if (!to) throw new PlanDocError("commits remap: this checkout's remote
|
|
610
|
+
const to = stringFlag(flags.to) ?? PlanDocFiles.commitBaseOf(this.files.root);
|
|
611
|
+
if (!to) throw new PlanDocError("commits remap: this checkout's remote has no web page: --to <repo>");
|
|
613
612
|
const remap = new CommitRemap({
|
|
614
613
|
ids: CommitRemap.readMap(maps.map((map) => resolve(map))),
|
|
615
614
|
from: repos,
|
|
@@ -294,8 +294,10 @@ export declare class PlanDocFiles {
|
|
|
294
294
|
* - so green means changed in this commit or the last: everything since the commit before those
|
|
295
295
|
*/
|
|
296
296
|
recentSince(file: string): string | null;
|
|
297
|
-
/** The
|
|
297
|
+
/** The page the doc's repo's commit links go under (`PlanCommits.commitBase()` of `origin`), or `null`. */
|
|
298
298
|
commitBase(file: string): string | null;
|
|
299
|
+
/** The page checkout `checkout`'s commit links go under, by its `origin` and its code host; `null` for none. */
|
|
300
|
+
static commitBaseOf(checkout: string): string | null;
|
|
299
301
|
/**
|
|
300
302
|
* The repos a doc's commits can be in, the doc's checkout first: it, then each of its child repos that's there
|
|
301
303
|
* (`EpicConfig.repos`: a multi-repo top's, `spell-parser` ...; none for a single repo), then each of the kit's
|
|
@@ -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) });
|
|
@@ -608,9 +609,16 @@ ${run.stdout}${run.stderr}`);
|
|
|
608
609
|
recentSince(file) {
|
|
609
610
|
return _PlanDocFiles.gitIn(this.checkoutOf(file), "log", "-1", "--format=%cI", "HEAD~2") || null;
|
|
610
611
|
}
|
|
611
|
-
/** The
|
|
612
|
+
/** The page the doc's repo's commit links go under (`PlanCommits.commitBase()` of `origin`), or `null`. */
|
|
612
613
|
commitBase(file) {
|
|
613
|
-
return
|
|
614
|
+
return _PlanDocFiles.commitBaseOf(this.checkoutOf(file));
|
|
615
|
+
}
|
|
616
|
+
/** The page checkout `checkout`'s commit links go under, by its `origin` and its code host; `null` for none. */
|
|
617
|
+
static commitBaseOf(checkout) {
|
|
618
|
+
return PlanCommits.commitBase(
|
|
619
|
+
_PlanDocFiles.gitIn(checkout, "remote", "get-url", "origin"),
|
|
620
|
+
EpicConfig.of(checkout).codeHost
|
|
621
|
+
);
|
|
614
622
|
}
|
|
615
623
|
/**
|
|
616
624
|
* The repos a doc's commits can be in, the doc's checkout first: it, then each of its child repos that's there
|
|
@@ -666,7 +674,7 @@ ${run.stdout}${run.stderr}`);
|
|
|
666
674
|
const phases = PlanDoc.parse(html).phases;
|
|
667
675
|
const timed = [];
|
|
668
676
|
for (const checkout of [checkouts].flat()) {
|
|
669
|
-
const repo =
|
|
677
|
+
const repo = _PlanDocFiles.commitBaseOf(checkout);
|
|
670
678
|
const raw = _PlanDocFiles.gitIn(
|
|
671
679
|
checkout,
|
|
672
680
|
"log",
|
|
@@ -747,7 +755,7 @@ function inboxView(inbox) {
|
|
|
747
755
|
}
|
|
748
756
|
__name(inboxView, "inboxView");
|
|
749
757
|
var EPIC_STATUSES = ["in progress", "future", "done"];
|
|
750
|
-
var CHECKOUT =
|
|
758
|
+
var CHECKOUT = EngineFiles.root;
|
|
751
759
|
var DOCS_TOOLS = fileURLToPath(new URL("../tools", import.meta.url));
|
|
752
760
|
var TEMPLATE = fileURLToPath(new URL("templates/plan.html", import.meta.url));
|
|
753
761
|
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 {
|
|
@@ -1,23 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Entry of `commands.js`: command reference pages (`templates/commands.html`, e.g. `dev/commands/commands.html`): draws the page's tables
|
|
3
|
+
* from the JSON beside it, then boots the docs bundle.
|
|
4
|
+
* - Loaded INSTEAD of `spell-ui.js`: it fetches, draws, then adds `spell-ui.js` (same folder), whatever happened
|
|
5
|
+
* (`drawThenBoot()`).
|
|
6
|
+
* - The data: `<page>.json5` (`body[data-commands]` overrides), read through the page's `ServerLink` (`getFile()`),
|
|
7
|
+
* so the page needs the PAGE SERVER (`epic pages open <page>`); from `file://` a notice where the tables go says so
|
|
8
|
+
* (`drawThenBoot()`).
|
|
9
|
+
* - JSON5, read by the kit's `parseJSON5()`; its old name, `<page>.json`, read when there's no `.json5` yet
|
|
10
|
+
* (`ServerLink.dataFileNames()`)
|
|
11
|
+
* - JSON: `{ families: [{ id, title, icon?, intro?, rows: [Row] }] }` (a family `id` shares the page's id space: never
|
|
12
|
+
* reuse a hand-written section's); `Row`:
|
|
13
|
+
* - `op` -- the operation, in words; `id?` -- anchor, default `<family id>-<slug of op>`
|
|
14
|
+
* - `cli`, `skill`, `yarn` -- `{ mark, names?, note? }`: `mark` one of `same` (✓, under the shared name),
|
|
15
|
+
* `other` (≈, another name), `could` (○, doesn't but could), `no` (—, couldn't really); `names` the commands:
|
|
16
|
+
* `spell compile`, `/epic`, `<package> <script>` (`root plan-doc`, `ui gen:icons`)
|
|
17
|
+
* - `runs` -- the tool doing the work (`src/window.mjs`, `status.py`, `prose`); `target`, `notes` -- text
|
|
18
|
+
* - in `target`, a roadmap id in parens, `(R3)`, links to `#r3`: the page's roadmap rows carry those ids
|
|
19
|
+
* - text fields: `` `code` `` becomes `<code>`; everything else is plain text, never markup
|
|
20
|
+
* - `sources` (top level, optional): what `spell commands` counts: `userSkills` (in `~/.claude/skills`),
|
|
21
|
+
* `ignore` (commands that need no row); ignored here
|
|
22
|
+
* - Built from elements (`el()`), never from markup in strings (epic `epic-engine` P3): Spell UI's own, as a page
|
|
23
|
+
* writes them (`<ui-section>`, `<ui-table>` round a real `<table>`, `<ui-statistic>`, `<ui-message>`), in the
|
|
24
|
+
* page's light DOM, so the runtime's contents, sticky titles, table widths and comment anchors take them as
|
|
25
|
+
* hand-written ones
|
|
26
|
+
* - Placeholders the template holds, all optional:
|
|
27
|
+
* - `[data-commands-families]`: REPLACED by one nested `<ui-section data-commands-family>` per family, numbered
|
|
28
|
+
* after its parent section
|
|
29
|
+
* - the sections take its place, so they're its section's children, as a page writes nested sections: inside the
|
|
30
|
+
* placeholder's box they took the reading column's indent twice (epic `epic-engine` P3, I31)
|
|
31
|
+
* - `[data-commands-stats]` (a `ui-statistics`)
|
|
32
|
+
* - `[data-commands-filter]` (a `ui-input`): hides rows without every typed word
|
|
33
|
+
* - BUNDLED (epic `coherence` C12): `node src/tools/bundle-spell-ui.js --data-pages` builds it into `commands.js`, a
|
|
34
|
+
* classic script with NO Spell UI in it (the page's `spell-ui.js` draws the `<ui-*>` markup); edit THIS, never
|
|
35
|
+
* the bundle. It imports the helpers that exist: the docs helpers' `el()` and start, the kit's `slug()` and
|
|
36
|
+
* `parseJSON5()`, `ServerLink`.
|
|
37
|
+
*/
|
|
38
|
+
import { slug } from "spell/util/string"
|
|
39
|
+
import { parseJSON5 } from "spell/util/spell/json"
|
|
40
|
+
import { ServerLink } from "spell/epic/review"
|
|
41
|
+
|
|
42
|
+
import { drawThenBoot, el, sectionNumber, withCode } from "./spell-doc-helpers.js"
|
|
43
|
+
|
|
44
|
+
/** Cell marks: the sign shown, the table cell's verdict class, the legend's words. */
|
|
45
|
+
const MARKS = {
|
|
10
46
|
same: { sign: "✓", cls: "yes positive", words: "does it, shared name" },
|
|
11
47
|
other: { sign: "≈", cls: "meh warning", words: "does it, other name" },
|
|
12
48
|
could: { sign: "○", cls: "", words: "doesn't, but could" },
|
|
13
49
|
no: { sign: "—", cls: "no negative", words: "couldn't really" }
|
|
14
|
-
}
|
|
15
|
-
|
|
50
|
+
}
|
|
51
|
+
/** Surface columns, in order: JSON key, header. */
|
|
52
|
+
const SURFACES = [
|
|
16
53
|
["cli", "CLI"],
|
|
17
54
|
["skill", "skill"],
|
|
18
55
|
["yarn", "yarn"]
|
|
19
|
-
]
|
|
20
|
-
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
/** The page's data: `<page>.json5` beside it, unless `<body data-commands>` names another. */
|
|
59
|
+
const DATA_FILE =
|
|
60
|
+
document.body.dataset.commands || location.pathname.replace(/[^/]*$/, (name) => name.replace(/\.html?$/, ".json5"))
|
|
61
|
+
|
|
21
62
|
void drawThenBoot({
|
|
22
63
|
load,
|
|
23
64
|
draw,
|
|
@@ -25,29 +66,42 @@ void drawThenBoot({
|
|
|
25
66
|
header: "Tables not drawn",
|
|
26
67
|
offServer: `This page draws its tables from ${DATA_FILE.split("/").pop()}`,
|
|
27
68
|
failure: "Couldn't draw the tables"
|
|
28
|
-
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
////////////////
|
|
72
|
+
// ## Start
|
|
73
|
+
////////////////
|
|
74
|
+
|
|
75
|
+
/** The page's data; throws when there's none. */
|
|
29
76
|
async function load() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
77
|
+
// not renamed yet (`epic migrate`): its old name
|
|
78
|
+
const text = await ServerLink.forPage().getFile(ServerLink.dataFileNames(DATA_FILE), { format: "text" })
|
|
79
|
+
if (text === undefined) throw new Error(`${DATA_FILE}: not found`)
|
|
80
|
+
return parseJSON5(text, DATA_FILE)
|
|
33
81
|
}
|
|
34
|
-
|
|
82
|
+
|
|
83
|
+
////////////////
|
|
84
|
+
// ## Drawing
|
|
85
|
+
////////////////
|
|
86
|
+
|
|
87
|
+
/** Fill every placeholder from `data`. */
|
|
35
88
|
function draw(data) {
|
|
36
|
-
const families = data.families ?? []
|
|
37
|
-
const holder = document.querySelector("[data-commands-families]")
|
|
89
|
+
const families = data.families ?? []
|
|
90
|
+
const holder = document.querySelector("[data-commands-families]")
|
|
38
91
|
if (holder) {
|
|
39
|
-
const number = sectionNumber(holder.closest("ui-section"))
|
|
40
|
-
holder.replaceWith(...families.map((each, i) => family(each, number ? `${number}.${i + 1} ` : "")))
|
|
92
|
+
const number = sectionNumber(holder.closest("ui-section"))
|
|
93
|
+
holder.replaceWith(...families.map((each, i) => family(each, number ? `${number}.${i + 1} ` : "")))
|
|
41
94
|
}
|
|
42
|
-
const stats = document.querySelector("[data-commands-stats]")
|
|
43
|
-
if (stats) stats.replaceChildren(...statistics(families))
|
|
44
|
-
const filter = document.querySelector("[data-commands-filter]")
|
|
45
|
-
if (filter) wireFilter(filter)
|
|
95
|
+
const stats = document.querySelector("[data-commands-stats]")
|
|
96
|
+
if (stats) stats.replaceChildren(...statistics(families))
|
|
97
|
+
const filter = document.querySelector("[data-commands-filter]")
|
|
98
|
+
if (filter) wireFilter(filter)
|
|
46
99
|
}
|
|
47
|
-
|
|
100
|
+
|
|
101
|
+
/** One family: a nested `<ui-section>` with its table. */
|
|
48
102
|
function family(each, prefix) {
|
|
49
|
-
const head = el("tr", {}, el("th", {}, "operation"), ...SURFACES.map(([, label]) => el("th", {}, label)))
|
|
50
|
-
head.append(el("th", {}, "runs"), el("th", {}, "target"))
|
|
103
|
+
const head = el("tr", {}, el("th", {}, "operation"), ...SURFACES.map(([, label]) => el("th", {}, label)))
|
|
104
|
+
head.append(el("th", {}, "runs"), el("th", {}, "target"))
|
|
51
105
|
return el(
|
|
52
106
|
"ui-section",
|
|
53
107
|
{
|
|
@@ -65,9 +119,10 @@ function family(each, prefix) {
|
|
|
65
119
|
{ celled: "", padding: "compact", appearance: "striped", unstackable: "" },
|
|
66
120
|
el("table", {}, el("thead", {}, head), el("tbody", {}, ...(each.rows ?? []).map((row) => operation(each, row))))
|
|
67
121
|
)
|
|
68
|
-
)
|
|
122
|
+
)
|
|
69
123
|
}
|
|
70
|
-
|
|
124
|
+
|
|
125
|
+
/** One operation's row; its notes go under the operation. */
|
|
71
126
|
function operation(each, row) {
|
|
72
127
|
return el(
|
|
73
128
|
"tr",
|
|
@@ -76,73 +131,99 @@ function operation(each, row) {
|
|
|
76
131
|
...SURFACES.map(([key]) => surface(row[key])),
|
|
77
132
|
el("td", {}, ...withCode(row.runs ?? "")),
|
|
78
133
|
el("td", {}, ...withCode(row.target ?? "", roadmapLinks))
|
|
79
|
-
)
|
|
134
|
+
)
|
|
80
135
|
}
|
|
81
|
-
|
|
136
|
+
|
|
137
|
+
/** One surface's cell: its mark, the names, the note. */
|
|
82
138
|
function surface(cell) {
|
|
83
|
-
if (!cell) return el("td")
|
|
84
|
-
const mark = MARKS[cell.mark] ?? { sign: "?", cls: "", words: "" }
|
|
85
|
-
const verdict = mark.cls ? { class: mark.cls, title: mark.words } : { title: mark.words }
|
|
86
|
-
return el("td", verdict, `${mark.sign} `, ...names(cell.names), cell.note ? notes(cell.note) : "")
|
|
139
|
+
if (!cell) return el("td")
|
|
140
|
+
const mark = MARKS[cell.mark] ?? { sign: "?", cls: "", words: "" }
|
|
141
|
+
const verdict = mark.cls ? { class: mark.cls, title: mark.words } : { title: mark.words }
|
|
142
|
+
return el("td", verdict, `${mark.sign} `, ...names(cell.names), cell.note ? notes(cell.note) : "")
|
|
87
143
|
}
|
|
88
|
-
|
|
144
|
+
|
|
145
|
+
/** A note under a cell's text, small and grey. */
|
|
89
146
|
function notes(value) {
|
|
90
|
-
return el("div", { class: "commands-notes" }, ...withCode(value))
|
|
147
|
+
return el("div", { class: "commands-notes" }, ...withCode(value))
|
|
91
148
|
}
|
|
92
|
-
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Names as code, comma-separated, yarn's grouped by script: `ts` (app, cli, core) rather than 3 `<package> ts`s.
|
|
152
|
+
* - a name of two words whose second has no space and isn't a CLI's (`spell ...`) is `<package> <script>`
|
|
153
|
+
*/
|
|
93
154
|
function names(value) {
|
|
94
|
-
if (!value) return []
|
|
95
|
-
const list = Array.isArray(value) ? value : [value]
|
|
96
|
-
const byScript =
|
|
97
|
-
const plain = []
|
|
155
|
+
if (!value) return []
|
|
156
|
+
const list = Array.isArray(value) ? value : [value]
|
|
157
|
+
const byScript = new Map()
|
|
158
|
+
const plain = []
|
|
98
159
|
for (const name of list) {
|
|
99
|
-
const words = name.split(" ")
|
|
160
|
+
const words = name.split(" ")
|
|
100
161
|
if (words.length === 2 && words[0] !== "spell" && !name.startsWith("/")) {
|
|
101
|
-
if (!byScript.has(words[1])) byScript.set(words[1], [])
|
|
102
|
-
byScript.get(words[1]).push(words[0])
|
|
103
|
-
} else plain.push([el("code", {}, name)])
|
|
162
|
+
if (!byScript.has(words[1])) byScript.set(words[1], [])
|
|
163
|
+
byScript.get(words[1]).push(words[0])
|
|
164
|
+
} else plain.push([el("code", {}, name)])
|
|
104
165
|
}
|
|
105
166
|
const grouped = [...byScript].map(([name, packages]) => [
|
|
106
167
|
el("code", {}, name),
|
|
107
168
|
" ",
|
|
108
169
|
el("span", { class: "commands-where" }, `(${packages.join(", ")})`)
|
|
109
|
-
])
|
|
110
|
-
return [...plain, ...grouped].flatMap((parts, i) => i ? [", ", ...parts] : parts)
|
|
170
|
+
])
|
|
171
|
+
return [...plain, ...grouped].flatMap((parts, i) => (i ? [", ", ...parts] : parts))
|
|
111
172
|
}
|
|
112
|
-
|
|
173
|
+
|
|
174
|
+
/** Headline numbers: operations, families, and how many each surface does. */
|
|
113
175
|
function statistics(families) {
|
|
114
|
-
const rows = families.flatMap((each) => each.rows ?? [])
|
|
176
|
+
const rows = families.flatMap((each) => each.rows ?? [])
|
|
115
177
|
return [
|
|
116
178
|
[rows.length, "operations"],
|
|
117
179
|
[does("cli"), "in the CLI"],
|
|
118
180
|
[does("skill"), "in a skill"],
|
|
119
181
|
[does("yarn"), "in yarn"]
|
|
120
|
-
].map(([value, label]) => el("ui-statistic", { value, label }))
|
|
182
|
+
].map(([value, label]) => el("ui-statistic", { value, label }))
|
|
183
|
+
|
|
184
|
+
/** How many rows surface `key` does, under either name. */
|
|
121
185
|
function does(key) {
|
|
122
|
-
return rows.filter((row) => ["same", "other"].includes(row[key]?.mark)).length
|
|
186
|
+
return rows.filter((row) => ["same", "other"].includes(row[key]?.mark)).length
|
|
123
187
|
}
|
|
124
|
-
__name(does, "does");
|
|
125
188
|
}
|
|
126
|
-
|
|
189
|
+
|
|
190
|
+
////////////////
|
|
191
|
+
// ## Filter
|
|
192
|
+
////////////////
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Hide the rows without every typed word, and the families left empty.
|
|
196
|
+
* - reads the value from the events' `detail`: during `ui-input` the element's `value` is still the old one
|
|
197
|
+
*/
|
|
127
198
|
function wireFilter(input) {
|
|
128
|
-
input.addEventListener("ui-typed", apply)
|
|
129
|
-
input.addEventListener("ui-changed", apply)
|
|
199
|
+
input.addEventListener("ui-typed", apply)
|
|
200
|
+
input.addEventListener("ui-changed", apply)
|
|
201
|
+
|
|
202
|
+
/** Apply the filter in `event`. */
|
|
130
203
|
function apply(event) {
|
|
131
|
-
const words = String(event.detail?.value ?? input.value ?? "")
|
|
204
|
+
const words = String(event.detail?.value ?? input.value ?? "")
|
|
205
|
+
.toLowerCase()
|
|
206
|
+
.split(/\s+/)
|
|
207
|
+
.filter(Boolean)
|
|
132
208
|
for (const section of document.querySelectorAll("ui-section[data-commands-family]")) {
|
|
133
|
-
let shown = 0
|
|
209
|
+
let shown = 0
|
|
134
210
|
for (const row of section.querySelectorAll("tbody tr")) {
|
|
135
|
-
const content = row.textContent.toLowerCase()
|
|
136
|
-
row.hidden = !words.every((word) => content.includes(word))
|
|
137
|
-
if (!row.hidden) shown
|
|
211
|
+
const content = row.textContent.toLowerCase()
|
|
212
|
+
row.hidden = !words.every((word) => content.includes(word))
|
|
213
|
+
if (!row.hidden) shown++
|
|
138
214
|
}
|
|
139
|
-
section.hidden = shown === 0
|
|
215
|
+
section.hidden = shown === 0
|
|
140
216
|
}
|
|
141
217
|
}
|
|
142
|
-
__name(apply, "apply");
|
|
143
218
|
}
|
|
144
|
-
|
|
219
|
+
|
|
220
|
+
////////////////
|
|
221
|
+
// ## Text
|
|
222
|
+
////////////////
|
|
223
|
+
|
|
224
|
+
/** `part` with each roadmap id in parens, `(R3)`, linked to its row, `#r3`. */
|
|
145
225
|
function roadmapLinks(part) {
|
|
146
|
-
return part
|
|
226
|
+
return part
|
|
227
|
+
.split(/\((R\d+)\)/)
|
|
228
|
+
.flatMap((piece, i) => (i % 2 ? ["(", el("a", { href: `#${piece.toLowerCase()}` }, piece), ")"] : [piece]))
|
|
147
229
|
}
|
|
148
|
-
__name(roadmapLinks, "roadmapLinks");
|