spell 0.8.8 → 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 +60 -20
- package/app/package.json +1 -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/epic/cli/EpicProgram.js +15 -6
- package/dist/epic/cli/epicGroups.js +5 -0
- package/dist/epic/command/BaseBranch.js +1 -1
- package/dist/epic/command/PullRequest.d.ts +45 -0
- package/dist/epic/command/PullRequest.js +100 -0
- package/dist/epic/command/RepoInit.d.ts +96 -47
- package/dist/epic/command/RepoInit.js +222 -96
- package/dist/epic/command/Requests.js +2 -1
- package/dist/epic/command/Worktrees.d.ts +5 -3
- package/dist/epic/command/Worktrees.js +9 -8
- package/dist/epic/components/__pack/epics.entry.js +43 -43
- package/dist/epic/components/__pack/epics.pack.js +2 -2
- package/dist/epic/config/CodeHost.d.ts +96 -0
- package/dist/epic/config/CodeHost.js +89 -0
- package/dist/epic/config/EpicConfig.d.ts +9 -2
- package/dist/epic/config/EpicConfig.js +16 -0
- package/dist/epic/config/EpicRepo.js +1 -1
- package/dist/epic/config/GitHub.d.ts +34 -2
- package/dist/epic/config/GitHub.js +36 -7
- package/dist/epic/config/GitLab.d.ts +138 -0
- package/dist/epic/config/GitLab.js +297 -0
- 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 +10 -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-parts/UIHeader.d.ts +12 -2
- 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/UIParts.css +18 -0
- package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
- 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/package.json +1 -1
- package/epic/skills/epic/SKILL.md +2 -2
- package/epic/skills/epic/guide.md +2 -3
- package/epic/skills/isolate/SKILL.md +25 -27
- package/epic/src/AGENTS.md +5 -0
- 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 +1 -1
|
@@ -21,6 +21,7 @@ import { CLI } from "spell/cli";
|
|
|
21
21
|
import { Editor } from "../config/Editor.js";
|
|
22
22
|
import { EpicConfig } from "../config/EpicConfig.js";
|
|
23
23
|
import { EpicHome } from "../config/EpicHome.js";
|
|
24
|
+
import { CodeHost } from "../config/CodeHost.js";
|
|
24
25
|
import { GitHub } from "../config/GitHub.js";
|
|
25
26
|
import { PeopleColors } from "../config/PeopleColors.js";
|
|
26
27
|
import { VoiceColor } from "../config/VoiceColor.js";
|
|
@@ -67,7 +68,12 @@ var RepoInit = class _RepoInit {
|
|
|
67
68
|
throw new EpicCommandError("epic init: give one of --content-repo, --remote or --no-remote");
|
|
68
69
|
if (contentRepo && !REPO_NAME.test(contentRepo))
|
|
69
70
|
throw new EpicCommandError(
|
|
70
|
-
`epic init: --content-repo ${contentRepo} isn't a
|
|
71
|
+
`epic init: --content-repo ${contentRepo} isn't a repo name; letters, digits, ".", "-" and "_" only`
|
|
72
|
+
);
|
|
73
|
+
const host = flags.host;
|
|
74
|
+
if (host !== void 0 && !CodeHost.isKind(host))
|
|
75
|
+
throw new EpicCommandError(
|
|
76
|
+
`epic init: --host ${String(host)} isn't a code host: one of ${CodeHost.KINDS.join(", ")}`
|
|
71
77
|
);
|
|
72
78
|
const color = stringFlag(flags.color);
|
|
73
79
|
if (color !== void 0 && !VoiceColor.isColor(color))
|
|
@@ -89,6 +95,7 @@ var RepoInit = class _RepoInit {
|
|
|
89
95
|
contentRepo,
|
|
90
96
|
visibility: flags.public === true ? "public" : void 0,
|
|
91
97
|
noRemote,
|
|
98
|
+
host,
|
|
92
99
|
say
|
|
93
100
|
});
|
|
94
101
|
print(_RepoInit.summaryLines(answers.plan));
|
|
@@ -104,6 +111,7 @@ var RepoInit = class _RepoInit {
|
|
|
104
111
|
noRemote,
|
|
105
112
|
color: answers.color,
|
|
106
113
|
cloned: answers.cloned,
|
|
114
|
+
codeHost: answers.codeHost,
|
|
107
115
|
protectedBase: flags.protectedBase === true,
|
|
108
116
|
say
|
|
109
117
|
});
|
|
@@ -112,12 +120,12 @@ var RepoInit = class _RepoInit {
|
|
|
112
120
|
if (flags.noCommit !== true && report.content.action !== "missing") {
|
|
113
121
|
if (_RepoInit.changedFiles(report).length) print(["", chalk.bold(_RepoInit.commitHeader(report))]);
|
|
114
122
|
report.commit = await _RepoInit.commitStep({ report, ask, say });
|
|
115
|
-
print(_RepoInit.commitResultLines(report.commit));
|
|
123
|
+
print(_RepoInit.commitResultLines(report.commit, _RepoInit.wordsOf(report)));
|
|
116
124
|
} else if (flags.noCommit === true && report.config.settings.baseBranchProtected) {
|
|
117
125
|
const files = _RepoInit.changedFiles(report);
|
|
118
126
|
if (files.length)
|
|
119
127
|
print([
|
|
120
|
-
`> Not committed (--no-commit): ${report.config.settings.baseBranch} takes only
|
|
128
|
+
`> Not committed (--no-commit): ${report.config.settings.baseBranch} takes only ${_RepoInit.wordsOf(report).pullRequest}s, so put ${files.join(" and ")} on a branch and open one`
|
|
121
129
|
]);
|
|
122
130
|
}
|
|
123
131
|
if (flags.noServer !== true && report.content.action !== "missing" && report.commit?.action !== "on branch") {
|
|
@@ -131,10 +139,11 @@ var RepoInit = class _RepoInit {
|
|
|
131
139
|
/**
|
|
132
140
|
* `epic init`'s questions, ALL asked before anything is done (Owen, 2026-10-29): the answers, and what they come to.
|
|
133
141
|
* - their name, every time (`askName()`); `name` (`--name`) answers it
|
|
142
|
+
* - where the code is hosted, only when the `origin` address doesn't say and nothing else does (`codeHostChoice()`)
|
|
134
143
|
* - their colour, from the names nobody has (`askColor()`), unless they have one already; `color` answers it
|
|
135
144
|
* - a teammate joining, the team's plans not here yet: cloned FIRST, quietly, so the taken colours are known
|
|
136
145
|
* (`cloned`; `init()` reports it)
|
|
137
|
-
* - the epic repo's name and private or public, only when `init()` will make it on
|
|
146
|
+
* - the epic repo's name and private or public, only when `init()` will make it on the code host (`willMakeRepo()`)
|
|
138
147
|
* - no terminal (`ask` off): nothing asked; the plan says what the flags and the suggestions come to
|
|
139
148
|
* - SIDE EFFECT: the clone, for a teammate joining (not `dryRun`)
|
|
140
149
|
*/
|
|
@@ -147,14 +156,18 @@ var RepoInit = class _RepoInit {
|
|
|
147
156
|
contentRepo,
|
|
148
157
|
visibility,
|
|
149
158
|
noRemote,
|
|
159
|
+
host,
|
|
150
160
|
say = /* @__PURE__ */ __name(() => {
|
|
151
161
|
}, "say")
|
|
152
162
|
}) {
|
|
153
163
|
const { main } = this;
|
|
154
|
-
const
|
|
155
|
-
const content = join(main,
|
|
164
|
+
const found = _RepoInit.settingsOf(main);
|
|
165
|
+
const content = join(main, found.contentFolder);
|
|
156
166
|
const answers = { name, color, contentRepo, visibility, plan: {} };
|
|
157
|
-
|
|
167
|
+
answers.codeHost = await _RepoInit.codeHostChoice({ main, host, ask });
|
|
168
|
+
const settings = { ...found, codeHost: answers.codeHost.kind };
|
|
169
|
+
const codeHost = CodeHost.of({ main, codeHost: settings.codeHost });
|
|
170
|
+
if (ask && !name) answers.name = await _RepoInit.askName(codeHost);
|
|
158
171
|
const person = answers.name?.trim() || EpicHome.person().name;
|
|
159
172
|
const address = settings.contentRemote;
|
|
160
173
|
if (address && !noRemote && !dryRun && !existsSync(content)) {
|
|
@@ -179,9 +192,9 @@ var RepoInit = class _RepoInit {
|
|
|
179
192
|
return answers;
|
|
180
193
|
}
|
|
181
194
|
/**
|
|
182
|
-
* Whether `init()` will make the epic repo on
|
|
195
|
+
* Whether `init()` will make the epic repo on the code host: its owner when it will, else `undefined`.
|
|
183
196
|
* - not when the epic repo has a remote, the config names one, or `remote` / `noRemote` was given
|
|
184
|
-
* - only with
|
|
197
|
+
* - only with the host's command installed and logged in (`status()`, a few seconds), as `remoteStep()` asks
|
|
185
198
|
*/
|
|
186
199
|
willMakeRepo({
|
|
187
200
|
settings,
|
|
@@ -191,8 +204,9 @@ var RepoInit = class _RepoInit {
|
|
|
191
204
|
}) {
|
|
192
205
|
if (noRemote || remote || settings.contentRemote) return void 0;
|
|
193
206
|
if (existsSync(join(content, ".git")) && Git.out(["remote", "get-url", "origin"], content)) return void 0;
|
|
194
|
-
|
|
195
|
-
|
|
207
|
+
const host = CodeHost.of({ main: this.main, codeHost: settings.codeHost });
|
|
208
|
+
if (host.status() !== "ready") return void 0;
|
|
209
|
+
const owner = _RepoInit.ownerFor(this.main, host);
|
|
196
210
|
return owner ? { owner } : void 0;
|
|
197
211
|
}
|
|
198
212
|
/** The settings in force in checkout `main`: its config's, else what `epic init` would write. */
|
|
@@ -203,7 +217,7 @@ var RepoInit = class _RepoInit {
|
|
|
203
217
|
* Set the repo up (the class's steps); what it did, or would do with `dryRun`.
|
|
204
218
|
* - the options: `InitOptions`
|
|
205
219
|
* - SIDE EFFECT (not `dryRun`): writes the config and `.gitignore`, makes (or clones) the epic repo and the
|
|
206
|
-
* links, may make the epic repo on
|
|
220
|
+
* links, may make the epic repo on the code host and push to it, keeps the person's name in the epic home
|
|
207
221
|
*/
|
|
208
222
|
async init({
|
|
209
223
|
dryRun = false,
|
|
@@ -219,6 +233,7 @@ var RepoInit = class _RepoInit {
|
|
|
219
233
|
commit = false,
|
|
220
234
|
cloned = false,
|
|
221
235
|
protectedBase = false,
|
|
236
|
+
codeHost,
|
|
222
237
|
say = /* @__PURE__ */ __name(() => {
|
|
223
238
|
}, "say")
|
|
224
239
|
} = {}) {
|
|
@@ -227,14 +242,18 @@ var RepoInit = class _RepoInit {
|
|
|
227
242
|
const configFile = join(main, EpicConfig.FILE);
|
|
228
243
|
const hadConfig = existsSync(configFile);
|
|
229
244
|
const found = hadConfig ? new EpicConfig(main).settings : EpicConfig.defaultsFor(main);
|
|
230
|
-
const
|
|
231
|
-
const
|
|
245
|
+
const hosted = codeHost ?? await _RepoInit.codeHostChoice({ main, ask: false });
|
|
246
|
+
const withHost = { ...found, codeHost: hosted.kind };
|
|
247
|
+
const protection = _RepoInit.protectionStep({ main, configFile, hadConfig, settings: withHost, protectedBase });
|
|
248
|
+
const settings = { ...withHost, baseBranchProtected: protection.on };
|
|
232
249
|
if (!hadConfig && !dryRun) {
|
|
233
250
|
mkdirSync(dirname(configFile), { recursive: true });
|
|
234
251
|
writeFileSync(configFile, _RepoInit.configText(settings));
|
|
235
252
|
}
|
|
236
253
|
if (hadConfig && !dryRun && (protection.action === "flag" || protection.action === "detected"))
|
|
237
254
|
_RepoInit.keepProtected(configFile);
|
|
255
|
+
if (hadConfig && !dryRun && (hosted.source === "flag" || hosted.source === "asked"))
|
|
256
|
+
_RepoInit.keepCodeHost(configFile, hosted.kind);
|
|
238
257
|
const content = join(main, settings.contentFolder);
|
|
239
258
|
const folders = settings.sharedFolders;
|
|
240
259
|
const report = {
|
|
@@ -246,6 +265,7 @@ var RepoInit = class _RepoInit {
|
|
|
246
265
|
remote: { action: "skipped" },
|
|
247
266
|
gitignore: { file: join(main, ".gitignore"), action: "ok" },
|
|
248
267
|
protection,
|
|
268
|
+
codeHost: hosted,
|
|
249
269
|
person: _RepoInit.personStep({ dryRun, name }),
|
|
250
270
|
...pluginReport && { plugin: pluginReport }
|
|
251
271
|
};
|
|
@@ -363,8 +383,8 @@ var RepoInit = class _RepoInit {
|
|
|
363
383
|
* taken back first, keeping its files (`undoOwnCommit()`)
|
|
364
384
|
* - the branch is made without checking it out (`commitOnSetupBranch()`), then the base branch's checkout put back as
|
|
365
385
|
* it was (`restoreBase()`): so "safe to run again", whatever else is staged or changed
|
|
366
|
-
* - the pull request:
|
|
367
|
-
* to run
|
|
386
|
+
* - the pull or merge request: opened when the host's command is logged in; else `pullRequestError` says why, and the
|
|
387
|
+
* lines say what to run
|
|
368
388
|
* - NEVER throws
|
|
369
389
|
* - SIDE EFFECT (not `dryRun`): a branch, a push, a pull request, the two files out of the checkout
|
|
370
390
|
*/
|
|
@@ -383,7 +403,7 @@ var RepoInit = class _RepoInit {
|
|
|
383
403
|
if (!files.length) return { action: "none", files, branch: base, ...via };
|
|
384
404
|
if (branch !== base) return { action: "other branch", files, branch, ...via };
|
|
385
405
|
if (dryRun) return { action: "would branch", files, branch: SETUP_BRANCH, ...via };
|
|
386
|
-
const question = `Put ${files.join(" and ")} on a new branch ${SETUP_BRANCH}, push it, and open a
|
|
406
|
+
const question = `Put ${files.join(" and ")} on a new branch ${SETUP_BRANCH}, push it, and open a ${_RepoInit.wordsOf(report).pullRequest}?`;
|
|
387
407
|
const answer = ask ? await CLI.ask(question, { suggestion: "y" }) : "y";
|
|
388
408
|
if (/^n/i.test(answer.trim())) return { action: "declined", files, branch, ...via };
|
|
389
409
|
try {
|
|
@@ -394,7 +414,8 @@ var RepoInit = class _RepoInit {
|
|
|
394
414
|
}
|
|
395
415
|
const pushed = _RepoInit.pushBranch(main, SETUP_BRANCH, say);
|
|
396
416
|
const done = { action: "on branch", files, branch: SETUP_BRANCH, ...via, ...pushed };
|
|
397
|
-
|
|
417
|
+
const host = CodeHost.of({ main, codeHost: report.config.settings.codeHost });
|
|
418
|
+
return pushed.push === "pushed" ? { ...done, ..._RepoInit.pullRequestStep(main, base, say, host) } : done;
|
|
398
419
|
}
|
|
399
420
|
/**
|
|
400
421
|
* Take back `epic init`'s own commit from base branch `base`, when it's its last commit and the only one `origin`'s
|
|
@@ -463,18 +484,25 @@ ${missing.join("\n")}
|
|
|
463
484
|
`);
|
|
464
485
|
}
|
|
465
486
|
/**
|
|
466
|
-
* The pull request for `SETUP_BRANCH`, opened
|
|
487
|
+
* The pull or merge request for `SETUP_BRANCH`, opened by `host`: its address, or why not.
|
|
467
488
|
* - NEVER throws
|
|
468
|
-
* - SIDE EFFECT: a pull request on
|
|
489
|
+
* - SIDE EFFECT: a pull or merge request on the code host
|
|
469
490
|
*/
|
|
470
|
-
static pullRequestStep(main, base, say) {
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
if (status === "
|
|
474
|
-
|
|
491
|
+
static pullRequestStep(main, base, say, host) {
|
|
492
|
+
const { words } = host;
|
|
493
|
+
const status = host.status();
|
|
494
|
+
if (status === "missing") return { pullRequestError: `${words.name}'s command, ${words.command}, isn't installed` };
|
|
495
|
+
if (status === "logged-out") return { pullRequestError: `${words.command} isn't logged in to ${words.name}` };
|
|
496
|
+
say(`opening the ${words.pullRequest}…`);
|
|
475
497
|
try {
|
|
476
498
|
return {
|
|
477
|
-
pullRequest:
|
|
499
|
+
pullRequest: host.openPullRequest({
|
|
500
|
+
branch: SETUP_BRANCH,
|
|
501
|
+
base,
|
|
502
|
+
title: PR_TITLE,
|
|
503
|
+
body: prBody(words.pullRequest),
|
|
504
|
+
cwd: main
|
|
505
|
+
})
|
|
478
506
|
};
|
|
479
507
|
} catch (error) {
|
|
480
508
|
return { pullRequestError: error.message };
|
|
@@ -484,7 +512,7 @@ ${missing.join("\n")}
|
|
|
484
512
|
* Whether the base branch takes only pull requests, and how that's known; what `init()` puts in the config.
|
|
485
513
|
* - already on in the config, or in the setup branch's (run again, its pull request not merged yet): `config`
|
|
486
514
|
* - `protectedBase` (`--protected-base`): `flag`
|
|
487
|
-
* - else
|
|
515
|
+
* - else the code host's word (`hostRequiresPullRequest()`): `detected`; no such rule: `off`
|
|
488
516
|
* - a config that says `false` in so many words stays so (a file already there is kept): `says off`, and a note
|
|
489
517
|
* - NEVER throws: failing to find out is `off`, never a failed init
|
|
490
518
|
*/
|
|
@@ -498,7 +526,7 @@ ${missing.join("\n")}
|
|
|
498
526
|
if (settings.baseBranchProtected || _RepoInit.setupBranchSaysProtected(main)) return { action: "config", on: true };
|
|
499
527
|
if (protectedBase) return { action: "flag", on: true };
|
|
500
528
|
try {
|
|
501
|
-
if (!_RepoInit.
|
|
529
|
+
if (!_RepoInit.hostRequiresPullRequest(main, settings)) return { action: "off", on: false };
|
|
502
530
|
const written = hadConfig ? EpicConfig.parse(readFileSync(configFile, "utf8"), configFile) : {};
|
|
503
531
|
return "baseBranchProtected" in written ? { action: "says off", on: false } : { action: "detected", on: true };
|
|
504
532
|
} catch {
|
|
@@ -515,11 +543,60 @@ ${missing.join("\n")}
|
|
|
515
543
|
return false;
|
|
516
544
|
}
|
|
517
545
|
}
|
|
518
|
-
/** Whether
|
|
519
|
-
static
|
|
546
|
+
/** Whether the code host, as its command can see it, requires a request into the base branch of checkout `main`. */
|
|
547
|
+
static hostRequiresPullRequest(main, settings) {
|
|
548
|
+
const host = CodeHost.of({ main, codeHost: settings.codeHost });
|
|
520
549
|
const origin = Git.out(["remote", "get-url", "origin"], main);
|
|
521
|
-
const repo = origin ?
|
|
522
|
-
return repo !== void 0 &&
|
|
550
|
+
const repo = origin ? host.repoIn(origin) : void 0;
|
|
551
|
+
return repo !== void 0 && host.status() === "ready" && host.requiresPullRequest(repo, settings.baseBranch);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Where the code is hosted, and how that's known (`init()`'s `codeHost`, `epic init`'s question).
|
|
555
|
+
* - `--host` (`host`): `flag`; the config names one: `config`
|
|
556
|
+
* - else the `origin` address's: `address`; it doesn't say (`git.acme.com`): `asked` in a terminal, else `assumed`
|
|
557
|
+
* GitHub, which `noteLines()` says in one line; no remote: `default`, GitHub
|
|
558
|
+
* - NEVER throws
|
|
559
|
+
*/
|
|
560
|
+
static async codeHostChoice({
|
|
561
|
+
main,
|
|
562
|
+
host,
|
|
563
|
+
ask
|
|
564
|
+
}) {
|
|
565
|
+
const origin = CodeHost.originOf(main);
|
|
566
|
+
const hostName = CodeHost.hostOf(origin);
|
|
567
|
+
const said = { ...hostName && { host: hostName }, ...origin && { address: origin } };
|
|
568
|
+
if (host) return { kind: host, source: "flag", ...said };
|
|
569
|
+
if (existsSync(join(main, EpicConfig.FILE))) {
|
|
570
|
+
try {
|
|
571
|
+
const written = EpicConfig.parse(readFileSync(join(main, EpicConfig.FILE), "utf8"), EpicConfig.FILE);
|
|
572
|
+
if (CodeHost.isKind(written.codeHost)) return { kind: written.codeHost, source: "config", ...said };
|
|
573
|
+
} catch {
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
if (!CodeHost.isUnknownAddress(origin))
|
|
577
|
+
return { kind: CodeHost.kindOfAddress(origin), source: origin ? "address" : "default", ...said };
|
|
578
|
+
if (ask && process.stdin.isTTY && process.stdout.isTTY)
|
|
579
|
+
return {
|
|
580
|
+
kind: await CLI.choose(HOST_QUESTION, HOST_CHOICES),
|
|
581
|
+
source: "asked",
|
|
582
|
+
...said
|
|
583
|
+
};
|
|
584
|
+
return { kind: "github", source: "assumed", ...said };
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Write `kind` into config file `file` as its `codeHost`, keeping the rest as written.
|
|
588
|
+
* - a line that's there is changed in place; else the key goes in through `DataFile`, its comments kept
|
|
589
|
+
* - SIDE EFFECT: writes the file
|
|
590
|
+
*/
|
|
591
|
+
static keepCodeHost(file, kind) {
|
|
592
|
+
const text = readFileSync(file, "utf8");
|
|
593
|
+
const line = /^(\s*"codeHost":\s*)"(?:[^"\\]|\\.)*"/m;
|
|
594
|
+
if (line.test(text))
|
|
595
|
+
writeFileSync(
|
|
596
|
+
file,
|
|
597
|
+
text.replace(line, (_all, key) => key + JSON.stringify(kind))
|
|
598
|
+
);
|
|
599
|
+
else DataFile.edit(file, (settings) => ({ ...settings, codeHost: kind }));
|
|
523
600
|
}
|
|
524
601
|
/**
|
|
525
602
|
* Turn `baseBranchProtected` on in config file `file`, keeping the rest as written.
|
|
@@ -532,9 +609,16 @@ ${missing.join("\n")}
|
|
|
532
609
|
if (line.test(text)) writeFileSync(file, text.replace(line, "$1true"));
|
|
533
610
|
else DataFile.edit(file, (settings) => ({ ...settings, baseBranchProtected: true }));
|
|
534
611
|
}
|
|
535
|
-
/** What the commit section says first: why `epic init` asks to commit, or to open a pull request. */
|
|
536
|
-
static commitHeader(
|
|
537
|
-
return config.settings.baseBranchProtected ?
|
|
612
|
+
/** What the commit section says first: why `epic init` asks to commit, or to open a pull or merge request. */
|
|
613
|
+
static commitHeader(report) {
|
|
614
|
+
return report.config.settings.baseBranchProtected ? pullRequestHeader(_RepoInit.wordsOf(report).pullRequest) : COMMIT_HEADER;
|
|
615
|
+
}
|
|
616
|
+
/** What a person reads about `report`'s code host: "merge request" on GitLab, GitHub's by default. */
|
|
617
|
+
static wordsOf({
|
|
618
|
+
config,
|
|
619
|
+
codeHost
|
|
620
|
+
}) {
|
|
621
|
+
return CodeHost.wordsFor(config.settings.codeHost, codeHost?.host);
|
|
538
622
|
}
|
|
539
623
|
/**
|
|
540
624
|
* The files `epic init` changed in the repo, still to commit: the config, `.gitignore`.
|
|
@@ -618,12 +702,13 @@ ${missing.join("\n")}
|
|
|
618
702
|
* - `remote` naming another: throws `EpicCommandError`, saying how to change it
|
|
619
703
|
* - `noRemote`: `skipped`
|
|
620
704
|
* - `remote`, else the config's `contentRemote`: made the remote, pushed (`added`)
|
|
621
|
-
* - else made on
|
|
622
|
-
* words when
|
|
705
|
+
* - else made on the code host (`made`), when its command is there and logged in (`no gh` for either's, `logged out`);
|
|
706
|
+
* `failed` with its words when it said no
|
|
623
707
|
* - its name: `contentRepo`, else asked when `ask` (in a terminal), else `<repo>.epics`
|
|
624
708
|
* - private or public: `visibility`, else asked when `ask` (`askVisibility()`), else private
|
|
625
709
|
* - a push that failed is in `error`: the repo and its address stand
|
|
626
|
-
* -
|
|
710
|
+
* - GitLab: after the first push, its default branch opened up to teammates (`warning`, when it couldn't be)
|
|
711
|
+
* - SIDE EFFECT (not `dryRun`): the repo on the code host, the remote, the push, `contentRemote` in the config
|
|
627
712
|
*/
|
|
628
713
|
async remoteStep({
|
|
629
714
|
shared,
|
|
@@ -656,9 +741,10 @@ ${missing.join("\n")}
|
|
|
656
741
|
if (given !== settings.contentRemote) _RepoInit.keepRemote(configFile, given);
|
|
657
742
|
return { action: "added", address: given, ...error2 && { error: error2 } };
|
|
658
743
|
}
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
|
|
744
|
+
const host = CodeHost.of({ main: this.main, codeHost: settings.codeHost });
|
|
745
|
+
const status = host.status();
|
|
746
|
+
if (status === "missing") return { action: "no gh" };
|
|
747
|
+
const owner = status === "ready" ? _RepoInit.ownerFor(this.main, host) : void 0;
|
|
662
748
|
if (!owner) return { action: "logged out" };
|
|
663
749
|
const suggestion = `${basename(this.main)}.epics`;
|
|
664
750
|
const repoName = contentRepo ?? (ask ? await CLI.ask(REPO_QUESTION, { suggestion }) : suggestion);
|
|
@@ -667,20 +753,22 @@ ${missing.join("\n")}
|
|
|
667
753
|
const repo = `${owner}/${repoName}`;
|
|
668
754
|
const seenBy = visibility ?? (ask ? await _RepoInit.askVisibility() : "private");
|
|
669
755
|
if (dryRun) return { action: "would make", repo, visibility: seenBy };
|
|
670
|
-
say(`making ${repo} on
|
|
756
|
+
say(`making ${repo} on ${host.words.name}…`);
|
|
671
757
|
let address;
|
|
672
758
|
try {
|
|
673
|
-
|
|
759
|
+
host.createRepo(repo, {
|
|
674
760
|
visibility: seenBy,
|
|
675
761
|
description: `The epic pages of ${basename(this.main)}: plans, guides and sagas`
|
|
676
762
|
});
|
|
677
|
-
address =
|
|
763
|
+
address = host.addressOf(repo);
|
|
678
764
|
} catch (error2) {
|
|
679
765
|
return { action: "failed", repo, visibility: seenBy, error: error2.message };
|
|
680
766
|
}
|
|
681
767
|
const error = shared.publish(address);
|
|
682
768
|
_RepoInit.keepRemote(configFile, address);
|
|
683
|
-
|
|
769
|
+
const branch = Git.out(["rev-parse", "--abbrev-ref", "HEAD"], shared.config.dir) ?? "main";
|
|
770
|
+
const warning = error ? void 0 : host.letTeamPush(repo, branch);
|
|
771
|
+
return { action: "made", repo, address, visibility: seenBy, ...error && { error }, ...warning && { warning } };
|
|
684
772
|
}
|
|
685
773
|
////////////////
|
|
686
774
|
// ## Statics: the values, the files' text, the report's lines
|
|
@@ -695,16 +783,17 @@ ${missing.join("\n")}
|
|
|
695
783
|
return Git.mainRoot(cwd);
|
|
696
784
|
}
|
|
697
785
|
/**
|
|
698
|
-
* Whose
|
|
699
|
-
* an ORGANIZATION (
|
|
786
|
+
* Whose account a new epic repo goes in, for the code repo at `main`: the code repo's owner when that's
|
|
787
|
+
* an ORGANIZATION (a GitHub org, a GitLab group or subgroup), else the person's own login; `undefined` when the
|
|
788
|
+
* host's command knows no login.
|
|
700
789
|
* - why not always the code repo's owner: a person can't make a repo in someone else's own account
|
|
701
|
-
* - runs
|
|
790
|
+
* - runs its command (the login, `CodeHost.loginOn()`; the owner's kind)
|
|
702
791
|
*/
|
|
703
|
-
static ownerFor(main) {
|
|
704
|
-
const login =
|
|
792
|
+
static ownerFor(main, host) {
|
|
793
|
+
const login = CodeHost.loginOn(host);
|
|
705
794
|
const origin = Git.out(["remote", "get-url", "origin"], main);
|
|
706
|
-
const owner = origin ?
|
|
707
|
-
if (owner && owner !== login &&
|
|
795
|
+
const owner = origin ? host.ownerIn(origin) : void 0;
|
|
796
|
+
if (owner && owner !== login && host.isOrganization(owner)) return owner;
|
|
708
797
|
return login;
|
|
709
798
|
}
|
|
710
799
|
/**
|
|
@@ -745,16 +834,16 @@ ${missing.join("\n")}
|
|
|
745
834
|
}
|
|
746
835
|
/**
|
|
747
836
|
* The name to keep, asked in a terminal EVERY time (Owen, 2026-10-29: "never asked for my user name"):
|
|
748
|
-
* "What do you want to be called?", suggesting the name kept already, else their
|
|
749
|
-
* `user.name`; Enter keeps it.
|
|
750
|
-
* - the login looked up first (`
|
|
837
|
+
* "What do you want to be called?", suggesting the name kept already, else their login on the code host, else
|
|
838
|
+
* git's `user.name`; Enter keeps it.
|
|
839
|
+
* - the login looked up first (`CodeHost.loginOn()`; GitHub's is kept, so pages never run `gh`)
|
|
751
840
|
* - `undefined` when nothing was said and nobody knows a name
|
|
752
841
|
* - no terminal: the suggestion, asking nothing (`CLI.ask()`)
|
|
753
842
|
*/
|
|
754
|
-
static async askName() {
|
|
755
|
-
|
|
843
|
+
static async askName(host = GitHub) {
|
|
844
|
+
const login = CodeHost.loginOn(host);
|
|
756
845
|
const now = EpicHome.person();
|
|
757
|
-
const suggestion = (now.source === "kept" ? now.name : void 0) ?? now.github ?? now.fullName ?? "";
|
|
846
|
+
const suggestion = (now.source === "kept" ? now.name : void 0) ?? login ?? now.github ?? now.fullName ?? "";
|
|
758
847
|
return await CLI.ask(NAME_QUESTION, { suggestion }) || void 0;
|
|
759
848
|
}
|
|
760
849
|
/**
|
|
@@ -824,9 +913,12 @@ ${missing.join("\n")}
|
|
|
824
913
|
"contentRemote": ${value("contentRemote")},
|
|
825
914
|
// the branch worktrees start from and merge into
|
|
826
915
|
"baseBranch": ${value("baseBranch")},
|
|
827
|
-
// whether that branch can't be pushed to, and work reaches it only through a pull request
|
|
828
|
-
// epic init opens one, epic merge refuses, and the skills finish with
|
|
916
|
+
// whether that branch can't be pushed to, and work reaches it only through a pull request (a merge request, on
|
|
917
|
+
// GitLab): epic init opens one, epic merge refuses, and the skills finish with one
|
|
829
918
|
"baseBranchProtected": ${value("baseBranchProtected")},
|
|
919
|
+
// where the code is hosted, "github" or "gitlab": picks gh or glab, and which words pages say;
|
|
920
|
+
// left out, it's worked out from the origin remote each time it's read
|
|
921
|
+
"codeHost": ${value("codeHost")},
|
|
830
922
|
// where new worktrees go, one folder each: <worktreesFolder>/<name>
|
|
831
923
|
"worktreesFolder": ${value("worktreesFolder")},
|
|
832
924
|
// what makes a new worktree ready to run, from its root ("": nothing to install)
|
|
@@ -908,7 +1000,11 @@ ${missing.join("\n")}
|
|
|
908
1000
|
...report.plugin ? _RepoInit.pluginLines(report.plugin) : [],
|
|
909
1001
|
..._RepoInit.fileLines(report),
|
|
910
1002
|
..._RepoInit.noteLines(report),
|
|
911
|
-
...report.commit?.action && report.commit.action !== "none" ? [
|
|
1003
|
+
...report.commit?.action && report.commit.action !== "none" ? [
|
|
1004
|
+
"",
|
|
1005
|
+
chalk.bold(_RepoInit.commitHeader(report)),
|
|
1006
|
+
..._RepoInit.commitResultLines(report.commit, _RepoInit.wordsOf(report))
|
|
1007
|
+
] : [],
|
|
912
1008
|
..._RepoInit.doneLines(report)
|
|
913
1009
|
];
|
|
914
1010
|
}
|
|
@@ -959,6 +1055,7 @@ ${missing.join("\n")}
|
|
|
959
1055
|
*/
|
|
960
1056
|
static fileLines(report, { head = true } = {}) {
|
|
961
1057
|
const { dryRun, config, content, remote, gitignore, person, color, main } = report;
|
|
1058
|
+
const hostName = _RepoInit.wordsOf(report).name;
|
|
962
1059
|
const would = /* @__PURE__ */ __name((done, wouldDo) => dryRun ? wouldDo : done, "would");
|
|
963
1060
|
const rows = [
|
|
964
1061
|
[config.action === "kept" ? "already present" : would("wrote", "would write"), config.file]
|
|
@@ -981,7 +1078,7 @@ ${missing.join("\n")}
|
|
|
981
1078
|
break;
|
|
982
1079
|
default:
|
|
983
1080
|
}
|
|
984
|
-
rows.push(...remoteRowsFor(remote));
|
|
1081
|
+
rows.push(...remoteRowsFor(remote, hostName));
|
|
985
1082
|
for (const { path, action } of report.links)
|
|
986
1083
|
rows.push([action === "ok" ? "already linked" : action, join(main, path)]);
|
|
987
1084
|
rows.push([
|
|
@@ -1003,16 +1100,21 @@ ${missing.join("\n")}
|
|
|
1003
1100
|
}
|
|
1004
1101
|
/** What needs a word of its own, under the files: the epic repo's problems, the colour's, no name. */
|
|
1005
1102
|
static noteLines(report) {
|
|
1006
|
-
const notes = [
|
|
1103
|
+
const notes = [
|
|
1104
|
+
...codeHostNotesFor(report),
|
|
1105
|
+
...protectionNotesFor(report),
|
|
1106
|
+
...remoteNotesFor(report),
|
|
1107
|
+
...colorNotesFor(report.color)
|
|
1108
|
+
];
|
|
1007
1109
|
if (report.person.action === "none") notes.push("no name yet (git has no user.name): epic whoami <name> keeps one");
|
|
1008
1110
|
if (!notes.length) return [];
|
|
1009
1111
|
return ["", chalk.bold("Note:"), ...notes];
|
|
1010
1112
|
}
|
|
1011
|
-
/** What the commit came to (`commitStep()`), under its question. */
|
|
1012
|
-
static commitResultLines(commit) {
|
|
1113
|
+
/** What the commit came to (`commitStep()`), under its question; `words`: the code host's. */
|
|
1114
|
+
static commitResultLines(commit, words = CodeHost.wordsFor("github")) {
|
|
1013
1115
|
const { action, files, branch, error, push, pushError } = commit;
|
|
1014
1116
|
const named = files.join(" and ");
|
|
1015
|
-
if (commit.viaPullRequest) return viaPullRequestLines(commit);
|
|
1117
|
+
if (commit.viaPullRequest) return viaPullRequestLines(commit, words);
|
|
1016
1118
|
switch (action) {
|
|
1017
1119
|
case "committed":
|
|
1018
1120
|
if (push === "pushed") return ["> Committed and pushed"];
|
|
@@ -1021,7 +1123,7 @@ ${missing.join("\n")}
|
|
|
1021
1123
|
`> Committed; the push failed: ${pushError}`,
|
|
1022
1124
|
` push it by hand: git push origin ${branch}`,
|
|
1023
1125
|
...PUSH_REFUSED.test(pushError ?? "") ? [
|
|
1024
|
-
` or, if ${branch} takes only
|
|
1126
|
+
` or, if ${branch} takes only ${words.pullRequest}s: epic init --protected-base (it moves this commit onto a branch, and opens one)`
|
|
1025
1127
|
] : []
|
|
1026
1128
|
];
|
|
1027
1129
|
return ["> Committed; no remote to push to"];
|
|
@@ -1044,7 +1146,8 @@ ${missing.join("\n")}
|
|
|
1044
1146
|
static doneLines(report) {
|
|
1045
1147
|
if (report.dryRun) return ["", "dry run: nothing changed"];
|
|
1046
1148
|
if (report.content.action === "missing") return [];
|
|
1047
|
-
if (report.commit?.action === "on branch")
|
|
1149
|
+
if (report.commit?.action === "on branch")
|
|
1150
|
+
return ["", chalk.green.bold(doneOnceMerged(_RepoInit.wordsOf(report).pullRequest))];
|
|
1048
1151
|
const editor = Editor.of({ setting: report.config.settings.editor });
|
|
1049
1152
|
const { server, main } = report;
|
|
1050
1153
|
const browser = server?.action === "started" && server.address ? terminalLink(server.address) : "epic server start, then the address it prints";
|
|
@@ -1060,12 +1163,12 @@ ${missing.join("\n")}
|
|
|
1060
1163
|
];
|
|
1061
1164
|
}
|
|
1062
1165
|
};
|
|
1063
|
-
function remoteRowsFor({ action, address, repo, visibility, error }) {
|
|
1166
|
+
function remoteRowsFor({ action, address, repo, visibility, error }, hostName) {
|
|
1064
1167
|
switch (action) {
|
|
1065
1168
|
case "made":
|
|
1066
|
-
return [[error ? "made" : "made, pushed", `${repo} on
|
|
1169
|
+
return [[error ? "made" : "made, pushed", `${repo} on ${hostName}, ${visibility} (${address})`]];
|
|
1067
1170
|
case "would make":
|
|
1068
|
-
return [["would make", `${repo} on
|
|
1171
|
+
return [["would make", `${repo} on ${hostName}, ${visibility}`]];
|
|
1069
1172
|
case "added":
|
|
1070
1173
|
return [[error ? "remote" : "pushed to", address ?? ""]];
|
|
1071
1174
|
case "would add":
|
|
@@ -1080,21 +1183,29 @@ function remoteRowsFor({ action, address, repo, visibility, error }) {
|
|
|
1080
1183
|
}
|
|
1081
1184
|
}
|
|
1082
1185
|
__name(remoteRowsFor, "remoteRowsFor");
|
|
1083
|
-
function
|
|
1186
|
+
function codeHostNotesFor({ codeHost }) {
|
|
1187
|
+
if (codeHost?.source !== "assumed") return [];
|
|
1188
|
+
return [`${codeHost.host} doesn't say whose it is: treated as GitHub; on GitLab, run: epic init --host gitlab`];
|
|
1189
|
+
}
|
|
1190
|
+
__name(codeHostNotesFor, "codeHostNotesFor");
|
|
1191
|
+
function protectionNotesFor(report) {
|
|
1192
|
+
const { protection, config } = report;
|
|
1084
1193
|
const base = config.settings.baseBranch;
|
|
1194
|
+
const { name, pullRequest } = RepoInit.wordsOf(report);
|
|
1085
1195
|
if (protection.action === "detected")
|
|
1086
|
-
return [
|
|
1196
|
+
return [`${name} requires a ${pullRequest} into ${base}: baseBranchProtected is on (${EpicConfig.FILE})`];
|
|
1087
1197
|
if (protection.action === "says off")
|
|
1088
1198
|
return [
|
|
1089
|
-
|
|
1199
|
+
`${name} requires a ${pullRequest} into ${base}, but ${EpicConfig.FILE} says baseBranchProtected false: epic init --protected-base turns it on`
|
|
1090
1200
|
];
|
|
1091
1201
|
return [];
|
|
1092
1202
|
}
|
|
1093
1203
|
__name(protectionNotesFor, "protectionNotesFor");
|
|
1094
|
-
function viaPullRequestLines(commit) {
|
|
1204
|
+
function viaPullRequestLines(commit, words) {
|
|
1095
1205
|
const { action, files, branch, error, push, pushError, pullRequest, pullRequestError, base } = commit;
|
|
1096
1206
|
const named = files.join(" and ");
|
|
1097
|
-
const
|
|
1207
|
+
const asked = words.pullRequest;
|
|
1208
|
+
const openIt = [` ${words.openCommand(base ?? "", SETUP_BRANCH)}`];
|
|
1098
1209
|
const merged = [
|
|
1099
1210
|
`> Once it's merged: git pull on ${base}, and epics work here; teammates can join then (epic init in their clone)`
|
|
1100
1211
|
];
|
|
@@ -1111,20 +1222,16 @@ function viaPullRequestLines(commit) {
|
|
|
1111
1222
|
...merged
|
|
1112
1223
|
];
|
|
1113
1224
|
if (push === "nowhere")
|
|
1114
|
-
return [
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
...merged
|
|
1118
|
-
];
|
|
1119
|
-
if (pullRequest) return [...said, `> Pull request: ${pullRequest}`, ...merged];
|
|
1120
|
-
return [...said, `> Pushed; no pull request yet (${pullRequestError}). To open one:`, ...openIt, ...merged];
|
|
1225
|
+
return [...said, `> No remote to push to: push ${SETUP_BRANCH} once there is, and open a ${asked}`, ...merged];
|
|
1226
|
+
if (pullRequest) return [...said, `> ${words.PullRequest}: ${pullRequest}`, ...merged];
|
|
1227
|
+
return [...said, `> Pushed; no ${asked} yet (${pullRequestError}). To open one:`, ...openIt, ...merged];
|
|
1121
1228
|
}
|
|
1122
1229
|
case "would branch":
|
|
1123
1230
|
return [
|
|
1124
|
-
`> would put ${named} on a new branch ${SETUP_BRANCH}, push it and open a
|
|
1231
|
+
`> would put ${named} on a new branch ${SETUP_BRANCH}, push it and open a ${asked}; ${base} stays as it is`
|
|
1125
1232
|
];
|
|
1126
1233
|
case "declined":
|
|
1127
|
-
return [`> Not done: ${base} takes only
|
|
1234
|
+
return [`> Not done: ${base} takes only ${asked}s, so ${named} need one before epics work here`];
|
|
1128
1235
|
case "other branch":
|
|
1129
1236
|
return [`> Not done: you're on ${branch}; run epic init on ${base}, which puts ${named} on a new branch`];
|
|
1130
1237
|
case "failed":
|
|
@@ -1134,13 +1241,15 @@ function viaPullRequestLines(commit) {
|
|
|
1134
1241
|
}
|
|
1135
1242
|
}
|
|
1136
1243
|
__name(viaPullRequestLines, "viaPullRequestLines");
|
|
1137
|
-
function remoteNotesFor(
|
|
1138
|
-
const {
|
|
1244
|
+
function remoteNotesFor(report) {
|
|
1245
|
+
const { remote, content, main } = report;
|
|
1246
|
+
const words = RepoInit.wordsOf(report);
|
|
1247
|
+
const { address, repo, error, warning, visibility = "private" } = remote;
|
|
1139
1248
|
const pushByHand = [`the push failed: ${error}`, ` push it by hand: git -C ${content.folder} push -u origin HEAD`];
|
|
1140
1249
|
switch (remote.action) {
|
|
1141
1250
|
case "made":
|
|
1142
1251
|
case "would make":
|
|
1143
|
-
return [...error ? pushByHand : [], ...publicWarning(visibility)];
|
|
1252
|
+
return [...error ? pushByHand : [], ...warning ? [warning] : [], ...publicWarning(visibility)];
|
|
1144
1253
|
case "added":
|
|
1145
1254
|
return error ? pushByHand : [];
|
|
1146
1255
|
case "clone failed":
|
|
@@ -1152,16 +1261,15 @@ function remoteNotesFor({ remote, content, main }) {
|
|
|
1152
1261
|
return ["no epic repo (--no-remote): the plans stay on this machine"];
|
|
1153
1262
|
case "failed":
|
|
1154
1263
|
return [
|
|
1155
|
-
`couldn't make ${repo} on
|
|
1264
|
+
`couldn't make ${repo} on ${words.name}: ${error}`,
|
|
1156
1265
|
` another name: epic init --content-repo <name>; a repo you made: epic init --remote <address>`
|
|
1157
1266
|
];
|
|
1158
1267
|
case "no gh":
|
|
1159
1268
|
case "logged out": {
|
|
1160
|
-
const why = remote.action === "no gh" ?
|
|
1269
|
+
const why = remote.action === "no gh" ? `${words.name}'s command, ${words.command}, isn't installed` : `${words.command} isn't logged in to ${words.name}`;
|
|
1161
1270
|
return [
|
|
1162
|
-
`no epic repo made: ${why}.
|
|
1163
|
-
|
|
1164
|
-
" gh auth login",
|
|
1271
|
+
`no epic repo made: ${why}. To share the epics, run:`,
|
|
1272
|
+
...words.install,
|
|
1165
1273
|
` then epic init again, in ${main}; or epic init --remote <address>, for a repo you made yourself`
|
|
1166
1274
|
];
|
|
1167
1275
|
}
|
|
@@ -1193,6 +1301,11 @@ function terminalLink(url) {
|
|
|
1193
1301
|
__name(terminalLink, "terminalLink");
|
|
1194
1302
|
var NAME_QUESTION = "What do you want to be called?";
|
|
1195
1303
|
var COLOR_QUESTION = "Which colour should your words be?";
|
|
1304
|
+
var HOST_QUESTION = "Where is this repo hosted?";
|
|
1305
|
+
var HOST_CHOICES = [
|
|
1306
|
+
{ value: "github", label: "GitHub", hint: "uses gh" },
|
|
1307
|
+
{ value: "gitlab", label: "GitLab", hint: "uses glab, self-hosted too" }
|
|
1308
|
+
];
|
|
1196
1309
|
var REPO_QUESTION = "What should the shared epics repo be called?";
|
|
1197
1310
|
var VISIBILITY_CHOICES = [
|
|
1198
1311
|
{ value: "private", label: "private", hint: "only the people you add can see the plans" },
|
|
@@ -1212,13 +1325,26 @@ var SHOW_README = /* @__PURE__ */ new Set([
|
|
|
1212
1325
|
]);
|
|
1213
1326
|
var README_EPICS = "https://github.com/spell-app/spell/blob/main/README-epics.md";
|
|
1214
1327
|
var DONE = "Epics initialized!";
|
|
1215
|
-
|
|
1328
|
+
function doneOnceMerged(pullRequest) {
|
|
1329
|
+
return `Epics are set up, and start here once that ${pullRequest} is merged.`;
|
|
1330
|
+
}
|
|
1331
|
+
__name(doneOnceMerged, "doneOnceMerged");
|
|
1216
1332
|
var FILES_HEAD = "Setting up epic files:";
|
|
1217
1333
|
var COMMIT_HEADER = "We need to make a commit in the main repo to enable epics.";
|
|
1218
|
-
|
|
1334
|
+
function pullRequestHeader(pullRequest) {
|
|
1335
|
+
return `This repo takes only ${pullRequest}s into its base branch, so epics are enabled through one.`;
|
|
1336
|
+
}
|
|
1337
|
+
__name(pullRequestHeader, "pullRequestHeader");
|
|
1219
1338
|
var SETUP_BRANCH = "epic-setup";
|
|
1220
1339
|
var PR_TITLE = "Set up epics";
|
|
1221
|
-
|
|
1340
|
+
function prBody(pullRequest) {
|
|
1341
|
+
return `Adds \`.epic/config.json5\` and the \`.gitignore\` lines that the \`epic\` tooling needs, nothing else.
|
|
1342
|
+
|
|
1343
|
+
Once this is merged: \`git pull\` on the base branch, and teammates can run \`epic init\`.
|
|
1344
|
+
|
|
1345
|
+
The epic pages live in a repo of their own beside this one, which needs direct pushes: if an org-wide rule requires ${pullRequest}s, it must leave that repo out.`;
|
|
1346
|
+
}
|
|
1347
|
+
__name(prBody, "prBody");
|
|
1222
1348
|
var EXCLUDE_NOTE = "# epic init: its links, until the pull request that lists them in .gitignore is merged";
|
|
1223
1349
|
var PUSH_REFUSED = /rejected|declined|protected|pull request|GH0\d\d/i;
|
|
1224
1350
|
var PUSH_TIMEOUT = 12e4;
|