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
|
@@ -9,12 +9,26 @@ import { findUp } from "spell/util/node/findUp";
|
|
|
9
9
|
import { Git } from "spell/server/Git";
|
|
10
10
|
import { pathInside } from "spell/server/RealPath";
|
|
11
11
|
import { EpicConfig } from "../config/EpicConfig.js";
|
|
12
|
+
import { BaseBranch } from "./BaseBranch.js";
|
|
12
13
|
import { EXIT, EpicCommandError } from "./command.types.js";
|
|
13
14
|
import { StrayFiles } from "./StrayFiles.js";
|
|
14
15
|
var SNAPSHOTS = ["tests/*/**/__snapshots__/*.snap", "packages/*/**/__snapshots__/*.snap"];
|
|
15
16
|
var isSnapshot = /* @__PURE__ */ __name((file) => SNAPSHOTS.some((glob) => matchesGlob(file, glob)), "isSnapshot");
|
|
16
17
|
var SNAPSHOT_UPDATE = /* @__PURE__ */ __name((tests) => ["yarn", "vp", "test", "run", ...tests, "--update"], "SNAPSHOT_UPDATE");
|
|
17
18
|
var LOCKFILES = ["yarn.lock", "package-lock.json", "pnpm-lock.yaml", "bun.lock"];
|
|
19
|
+
var LOCKFILE_REGENERATORS = {
|
|
20
|
+
"yarn.lock": ["yarn", "install"],
|
|
21
|
+
"package-lock.json": ["npm", "install", "--package-lock-only", "--ignore-scripts"],
|
|
22
|
+
"pnpm-lock.yaml": ["pnpm", "install", "--lockfile-only", "--ignore-scripts"],
|
|
23
|
+
"bun.lock": ["bun", "install", "--lockfile-only"]
|
|
24
|
+
};
|
|
25
|
+
var READS_CONFLICT_MARKERS = /* @__PURE__ */ new Set(["yarn.lock", "package-lock.json", "pnpm-lock.yaml"]);
|
|
26
|
+
var PACKAGE_RUNNERS = [
|
|
27
|
+
["yarn.lock", ["yarn"]],
|
|
28
|
+
["pnpm-lock.yaml", ["pnpm", "exec"]],
|
|
29
|
+
["bun.lock", ["bunx"]],
|
|
30
|
+
["bun.lockb", ["bunx"]]
|
|
31
|
+
];
|
|
18
32
|
var KIT_PROGRAM = "bin/spell.mjs";
|
|
19
33
|
var RENAME = ["node", KIT_PROGRAM, "ui", "rename", "--write"];
|
|
20
34
|
var RENAME_MESSAGE = "merge-main: old Spell UI names renamed (spell ui rename)";
|
|
@@ -26,7 +40,7 @@ var MainMerge = class _MainMerge {
|
|
|
26
40
|
root;
|
|
27
41
|
/** the generated outputs and their commands (tests pass their own) */
|
|
28
42
|
generators;
|
|
29
|
-
/** the command that updates the snapshots of `tests` */
|
|
43
|
+
/** the command that updates the snapshots of `tests`; `null`: this repo has no runner we know */
|
|
30
44
|
snapshotUpdate;
|
|
31
45
|
/** the command that installs the packages, as words; `[]`: none */
|
|
32
46
|
install;
|
|
@@ -42,24 +56,16 @@ var MainMerge = class _MainMerge {
|
|
|
42
56
|
/**
|
|
43
57
|
* - `root`: the checkout (a worktree, usually)
|
|
44
58
|
* - `generators`: default the checkout's own list (`generatorsOf()`)
|
|
45
|
-
* - `snapshotUpdate`: default
|
|
46
|
-
* - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `
|
|
59
|
+
* - `snapshotUpdate`: default the repo's own runner (`snapshotUpdateOf()`)
|
|
60
|
+
* - `install`: default the checkout's `installCommand` (`.epic/config.json5`; `npm install`)
|
|
47
61
|
* - `rename`: default `node bin/spell.mjs ui rename --write`
|
|
48
62
|
* - `kitRoot`: default the nearest folder at or above `root` with `bin/spell.mjs` (`kitRootOf()`):
|
|
49
63
|
* the merged checkout's own kit, so a worktree's child repo uses its worktree's kit, never main's
|
|
50
64
|
*/
|
|
51
|
-
constructor({
|
|
52
|
-
root,
|
|
53
|
-
generators,
|
|
54
|
-
snapshotUpdate = SNAPSHOT_UPDATE,
|
|
55
|
-
install,
|
|
56
|
-
rename = RENAME,
|
|
57
|
-
kitRoot,
|
|
58
|
-
carryOn
|
|
59
|
-
}) {
|
|
65
|
+
constructor({ root, generators, snapshotUpdate, install, rename = RENAME, kitRoot, carryOn }) {
|
|
60
66
|
this.root = root;
|
|
61
67
|
this.generators = generators ?? _MainMerge.generatorsOf(root);
|
|
62
|
-
this.snapshotUpdate = snapshotUpdate;
|
|
68
|
+
this.snapshotUpdate = snapshotUpdate === void 0 ? _MainMerge.snapshotUpdateOf(root) : snapshotUpdate;
|
|
63
69
|
this.install = install ?? EpicConfig.of(root).installCommand.split(/\s+/).filter(Boolean);
|
|
64
70
|
this.rename = rename;
|
|
65
71
|
this.kitRoot = kitRoot ?? _MainMerge.kitRootOf(root);
|
|
@@ -110,6 +116,8 @@ var MainMerge = class _MainMerge {
|
|
|
110
116
|
if (merging)
|
|
111
117
|
throw new EpicCommandError("merge-main: a merge is in progress; `--continue` it, or `git merge --abort`");
|
|
112
118
|
if (Git.out(["status", "--porcelain", "--untracked-files=no"], root)) Object.assign(report, this.ditchStrays());
|
|
119
|
+
const config = EpicConfig.of(root);
|
|
120
|
+
if (config.baseBranchProtected) report.baseCatchUp = BaseBranch.catchUp(config.main, upstream).line || void 0;
|
|
113
121
|
if (Git.run(["merge-base", "--is-ancestor", upstream, "HEAD"], root).ok)
|
|
114
122
|
return { ...report, result: "up-to-date" };
|
|
115
123
|
if (Git.run(["merge-base", "--is-ancestor", "HEAD", upstream], root).ok) {
|
|
@@ -147,7 +155,8 @@ var MainMerge = class _MainMerge {
|
|
|
147
155
|
if (report.conflicts.length) return { ...report, result: "conflicts" };
|
|
148
156
|
for (const { generator, files } of plan) {
|
|
149
157
|
for (const file of files) {
|
|
150
|
-
if (unmerged.includes(file) &&
|
|
158
|
+
if (unmerged.includes(file) && !READS_CONFLICT_MARKERS.has(file))
|
|
159
|
+
Git.run(["checkout", "--ours", "--", file], root);
|
|
151
160
|
}
|
|
152
161
|
const run = spawnSync(generator.run[0], generator.run.slice(1), {
|
|
153
162
|
cwd: join(root, generator.cwd),
|
|
@@ -347,14 +356,23 @@ ${run.stdout ?? ""}`) || run.error?.message || `exit ${run.status}`;
|
|
|
347
356
|
}
|
|
348
357
|
/**
|
|
349
358
|
* The generators `files` need, in run order, each with the files it covers:
|
|
350
|
-
* `generators`' (a checkout's list, `generatorsOf()`), then one
|
|
359
|
+
* a root lockfile's own tool (`LOCKFILE_REGENERATORS`), `generators`' (a checkout's list, `generatorsOf()`), then one
|
|
360
|
+
* snapshot update per package.
|
|
351
361
|
* - a file no generator covers isn't in any step
|
|
362
|
+
* - a lockfile `generators` covers is theirs
|
|
363
|
+
* - `snapshotUpdate` `null`: no snapshot steps
|
|
352
364
|
* - `root`: the checkout, where each snapshot's package folder is looked for (`packageFolder()`); left out,
|
|
353
365
|
* `packages/<name>`
|
|
354
366
|
* - static: pure, but for looking in `root`
|
|
355
367
|
*/
|
|
356
368
|
static generatorsFor(files, generators, snapshotUpdate = SNAPSHOT_UPDATE, root) {
|
|
357
369
|
const steps = generators.map((generator) => ({ generator, files: files.filter((file) => matchesAny(file, generator.outputs)) })).filter((step) => step.files.length);
|
|
370
|
+
const listed = new Set(steps.flatMap((step) => step.files));
|
|
371
|
+
const lockfiles = files.filter((file) => LOCKFILE_REGENERATORS[file] && !listed.has(file)).map((file) => ({
|
|
372
|
+
generator: { name: file, outputs: [file], cwd: ".", run: LOCKFILE_REGENERATORS[file] },
|
|
373
|
+
files: [file]
|
|
374
|
+
}));
|
|
375
|
+
if (!snapshotUpdate) return [...lockfiles, ...steps];
|
|
358
376
|
const snapshots = /* @__PURE__ */ new Map();
|
|
359
377
|
for (const snap of files.filter(isSnapshot)) {
|
|
360
378
|
const cwd = _MainMerge.packageFolder(snap.split("/")[1], root);
|
|
@@ -366,7 +384,22 @@ ${run.stdout ?? ""}`) || run.error?.message || `exit ${run.status}`;
|
|
|
366
384
|
const generator = { name, outputs: snaps, cwd, run: snapshotUpdate(tests) };
|
|
367
385
|
steps.push({ generator, files: snaps });
|
|
368
386
|
}
|
|
369
|
-
return steps;
|
|
387
|
+
return [...lockfiles, ...steps];
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The command that updates Vitest snapshots in checkout `root`, from the test runner its `package.json` names:
|
|
391
|
+
* - `vite-plus`: `<runner> vp test run <tests> --update`, Spell's
|
|
392
|
+
* - `vitest`: `<runner> vitest run <tests> --update`
|
|
393
|
+
* - neither (or no `package.json`): `null`, so `merge-main` never runs a command the repo hasn't got
|
|
394
|
+
* - `<runner>`: how the repo's lock file runs an installed program (`PACKAGE_RUNNERS`): `yarn`, `pnpm exec` ...,
|
|
395
|
+
* else `npx`
|
|
396
|
+
*/
|
|
397
|
+
static snapshotUpdateOf(root) {
|
|
398
|
+
const packages = dependenciesOf(root);
|
|
399
|
+
const runner = PACKAGE_RUNNERS.find(([file]) => existsSync(join(root, file)))?.[1] ?? ["npx"];
|
|
400
|
+
if (packages.has("vite-plus")) return (tests) => [...runner, "vp", "test", "run", ...tests, "--update"];
|
|
401
|
+
if (packages.has("vitest")) return (tests) => [...runner, "vitest", "run", ...tests, "--update"];
|
|
402
|
+
return null;
|
|
370
403
|
}
|
|
371
404
|
/**
|
|
372
405
|
* Package `name`'s folder in checkout `root`, from its root: where its snapshots are updated (its own
|
|
@@ -408,6 +441,17 @@ function renamedFiles(out) {
|
|
|
408
441
|
});
|
|
409
442
|
}
|
|
410
443
|
__name(renamedFiles, "renamedFiles");
|
|
444
|
+
function dependenciesOf(root) {
|
|
445
|
+
try {
|
|
446
|
+
const { dependencies = {}, devDependencies = {} } = JSON.parse(
|
|
447
|
+
readFileSync(join(root, "package.json"), "utf8")
|
|
448
|
+
);
|
|
449
|
+
return /* @__PURE__ */ new Set([...Object.keys(dependencies), ...Object.keys(devDependencies)]);
|
|
450
|
+
} catch {
|
|
451
|
+
return /* @__PURE__ */ new Set();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
__name(dependenciesOf, "dependenciesOf");
|
|
411
455
|
function lastLine(text) {
|
|
412
456
|
return text.split("\n").map((line) => line.trim()).filter(Boolean).at(-1) ?? "";
|
|
413
457
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type CodeHostClient } from "spell/epic/config/CodeHost";
|
|
2
|
+
import { EpicConfig } from "spell/epic/config/EpicConfig";
|
|
3
|
+
/****************
|
|
4
|
+
* ### `PullRequest`
|
|
5
|
+
* `epic pr <name> [--title <title>] [--body-file <file>]`: push branch `<name>` and open its pull request, or merge
|
|
6
|
+
* request on GitLab, against the repo's base branch.
|
|
7
|
+
* - Refuses, plainly, a branch that isn't there, the base branch itself, or one with nothing `origin`'s base lacks.
|
|
8
|
+
* - `git push -u origin <name>`, NEVER `--force`, never the base branch.
|
|
9
|
+
* - One open already: says its address, and that the push updated it.
|
|
10
|
+
* - The host's command missing or logged out: the branch is pushed anyway, and it prints exactly what to run.
|
|
11
|
+
* - Host-neutral: it asks `CodeHost.of()` for GitHub or GitLab, and says "pull request" or "merge request" as told.
|
|
12
|
+
* - Who: the isolate and epic skills' finish, where the base branch takes only pull requests.
|
|
13
|
+
* - Its position: a verb of the `epic` command; node only, imported by path.
|
|
14
|
+
****************/
|
|
15
|
+
export declare class PullRequest {
|
|
16
|
+
/** the repo's main checkout */
|
|
17
|
+
readonly main: string;
|
|
18
|
+
/** this repo's settings */
|
|
19
|
+
readonly config: EpicConfig;
|
|
20
|
+
/** the code host to talk to */
|
|
21
|
+
readonly host: CodeHostClient;
|
|
22
|
+
/** where it prints */
|
|
23
|
+
readonly print: (line: string) => void;
|
|
24
|
+
/** - `main`: default the repo the current folder is in; `print`: a test's stand-in */
|
|
25
|
+
constructor({ main, print }?: PullRequestProps);
|
|
26
|
+
/**
|
|
27
|
+
* Run `epic pr <args>`: resolves to the exit code.
|
|
28
|
+
* - throws `EpicCommandError`, in plain words, for what it refuses
|
|
29
|
+
* - SIDE EFFECT: the branch pushed, a request opened on the code host
|
|
30
|
+
*/
|
|
31
|
+
run(args: string[]): Promise<number>;
|
|
32
|
+
/** The file's text for the body; throws `EpicCommandError` for one that won't read. */
|
|
33
|
+
private readBody;
|
|
34
|
+
/** What a request says with no `--body-file`: each commit it brings, a bullet. */
|
|
35
|
+
private defaultBody;
|
|
36
|
+
/** What a request is called with no `--title`: its one commit's subject, else the branch's name. */
|
|
37
|
+
private defaultTitle;
|
|
38
|
+
}
|
|
39
|
+
/** What `PullRequest` takes. */
|
|
40
|
+
export type PullRequestProps = {
|
|
41
|
+
/** the repo's main checkout; default the one the current folder is in */
|
|
42
|
+
main?: string;
|
|
43
|
+
/** where it prints; default the terminal */
|
|
44
|
+
print?: (line: string) => void;
|
|
45
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/command/PullRequest.ts
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
|
+
import { Git } from "spell/server/Git";
|
|
7
|
+
import { CLI } from "spell/cli";
|
|
8
|
+
import { CodeHost } from "../config/CodeHost.js";
|
|
9
|
+
import { EpicConfig } from "../config/EpicConfig.js";
|
|
10
|
+
import { EXIT, EpicCommandError, parseVerbArgs, stringFlag } from "./command.types.js";
|
|
11
|
+
import { EpicCheckout } from "./EpicCheckout.js";
|
|
12
|
+
var PullRequest = class {
|
|
13
|
+
static {
|
|
14
|
+
__name(this, "PullRequest");
|
|
15
|
+
}
|
|
16
|
+
/** the repo's main checkout */
|
|
17
|
+
main;
|
|
18
|
+
/** this repo's settings */
|
|
19
|
+
config;
|
|
20
|
+
/** the code host to talk to */
|
|
21
|
+
host;
|
|
22
|
+
/** where it prints */
|
|
23
|
+
print;
|
|
24
|
+
/** - `main`: default the repo the current folder is in; `print`: a test's stand-in */
|
|
25
|
+
constructor({ main, print = /* @__PURE__ */ __name((line) => CLI.out(line), "print") } = {}) {
|
|
26
|
+
this.config = new EpicConfig(main ?? EpicConfig.mainOf(EpicCheckout.nearest()));
|
|
27
|
+
this.main = this.config.main;
|
|
28
|
+
this.host = CodeHost.of(this.config);
|
|
29
|
+
this.print = print;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Run `epic pr <args>`: resolves to the exit code.
|
|
33
|
+
* - throws `EpicCommandError`, in plain words, for what it refuses
|
|
34
|
+
* - SIDE EFFECT: the branch pushed, a request opened on the code host
|
|
35
|
+
*/
|
|
36
|
+
async run(args) {
|
|
37
|
+
const { positional, flags } = parseVerbArgs(args);
|
|
38
|
+
const name = positional[0];
|
|
39
|
+
if (!name) throw new EpicCommandError("epic pr: name the branch: epic pr <name>");
|
|
40
|
+
const { main } = this;
|
|
41
|
+
const base = this.config.baseBranch;
|
|
42
|
+
const { words } = this.host;
|
|
43
|
+
if (name === base) throw new EpicCommandError(`epic pr: ${name} is the base branch: name the branch to propose`);
|
|
44
|
+
if (!Git.run(["rev-parse", "--verify", "--quiet", `refs/heads/${name}`], main).ok)
|
|
45
|
+
throw new EpicCommandError(`epic pr: no branch ${name} here (${main}): git branch lists what there is`);
|
|
46
|
+
if (!Git.out(["remote", "get-url", "origin"], main))
|
|
47
|
+
throw new EpicCommandError("epic pr: this repo has no remote origin to push to");
|
|
48
|
+
Git.run(["fetch", "-q", "origin", base], main, { timeout: PUSH_TIMEOUT });
|
|
49
|
+
const against = Git.run(["rev-parse", "--verify", "--quiet", `refs/remotes/origin/${base}`], main).ok ? `refs/remotes/origin/${base}` : `refs/heads/${base}`;
|
|
50
|
+
const ahead = Git.out(["rev-list", "--count", `${against}..${name}`], main) ?? "0";
|
|
51
|
+
if (ahead === "0") throw new EpicCommandError(`epic pr: ${name} has nothing ahead of ${base}; nothing to propose`);
|
|
52
|
+
const bodyFile = stringFlag(flags.bodyFile);
|
|
53
|
+
const body = bodyFile ? this.readBody(bodyFile) : this.defaultBody(name, against);
|
|
54
|
+
const title = stringFlag(flags.title) ?? this.defaultTitle(name, ahead);
|
|
55
|
+
const pushed = Git.run(["push", "-u", "origin", name], main, { timeout: PUSH_TIMEOUT });
|
|
56
|
+
if (!pushed.ok)
|
|
57
|
+
throw new EpicCommandError(`epic pr: git refused the push of ${name}: ${pushed.err || "no reason given"}`);
|
|
58
|
+
const status = this.host.status();
|
|
59
|
+
if (status !== "ready") {
|
|
60
|
+
const why = status === "missing" ? `${words.name}'s command, ${words.command}, isn't installed` : `${words.command} isn't logged in to ${words.name}`;
|
|
61
|
+
this.print(`${name} is pushed; no ${words.pullRequest} opened: ${why}. To open one:`);
|
|
62
|
+
for (const line of [...words.install, ` ${words.openCommand(base, name)}`]) this.print(line);
|
|
63
|
+
return EXIT.ERRORS;
|
|
64
|
+
}
|
|
65
|
+
const open = this.host.openPullRequestOf(name, base, main);
|
|
66
|
+
if (open) {
|
|
67
|
+
this.print(`${words.PullRequest} open already: ${open}`);
|
|
68
|
+
this.print(`The push updated it.`);
|
|
69
|
+
return EXIT.OK;
|
|
70
|
+
}
|
|
71
|
+
try {
|
|
72
|
+
this.print(
|
|
73
|
+
`${words.PullRequest} opened: ${this.host.openPullRequest({ branch: name, base, title, body, cwd: main })}`
|
|
74
|
+
);
|
|
75
|
+
} catch (error) {
|
|
76
|
+
throw new EpicCommandError(`epic pr: ${name} is pushed; ${error.message}`);
|
|
77
|
+
}
|
|
78
|
+
return EXIT.OK;
|
|
79
|
+
}
|
|
80
|
+
/** The file's text for the body; throws `EpicCommandError` for one that won't read. */
|
|
81
|
+
readBody(file) {
|
|
82
|
+
try {
|
|
83
|
+
return readFileSync(file, "utf8");
|
|
84
|
+
} catch {
|
|
85
|
+
throw new EpicCommandError(`epic pr: can't read --body-file ${file}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** What a request says with no `--body-file`: each commit it brings, a bullet. */
|
|
89
|
+
defaultBody(name, against) {
|
|
90
|
+
return Git.out(["log", "--reverse", "--format=- %s", `${against}..${name}`], this.main) || name;
|
|
91
|
+
}
|
|
92
|
+
/** What a request is called with no `--title`: its one commit's subject, else the branch's name. */
|
|
93
|
+
defaultTitle(name, ahead) {
|
|
94
|
+
return ahead === "1" && Git.out(["log", "-1", "--format=%s", name], this.main) || name;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var PUSH_TIMEOUT = 12e4;
|
|
98
|
+
export {
|
|
99
|
+
PullRequest
|
|
100
|
+
};
|