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
|
@@ -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
|
+
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { type EpicSettings } from "spell/epic/config/EpicConfig";
|
|
2
|
-
import { type
|
|
2
|
+
import { type CodeHostClient, type CodeHostKind } from "spell/epic/config/CodeHost";
|
|
3
|
+
import { type CodeHostWords, type RepoVisibility } from "spell/epic/config/GitHub";
|
|
3
4
|
import { Hub } from "./Hub";
|
|
4
5
|
import { PluginInstall } from "./PluginInstall";
|
|
5
6
|
import { Shared } from "./Shared";
|
|
6
7
|
/****************
|
|
7
8
|
* ### `RepoInit`
|
|
8
9
|
* `epic init [--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public]
|
|
9
|
-
* [--protected-base] [--no-plugin] [--no-server] [--dry-run] [--json]`:
|
|
10
|
+
* [--host github|gitlab] [--protected-base] [--no-plugin] [--no-server] [--dry-run] [--json]`:
|
|
10
11
|
* set a repo up for epics (epic `epic-eject` P9), from any folder of its main checkout or a worktree of it; the ONE
|
|
11
12
|
* command a new repo, and each teammate joining it, runs (epic `epic-friend` P13: `npx spell@next epic init`).
|
|
12
13
|
*
|
|
@@ -19,7 +20,9 @@ import { Shared } from "./Shared";
|
|
|
19
20
|
* - worktrees in `../<repo>.worktrees`
|
|
20
21
|
* - the install command its lock file names (none without one)
|
|
21
22
|
* - window names from the repo's name; the window files in the epic folder's `windows/` (git-ignored there)
|
|
22
|
-
* -
|
|
23
|
+
* - where the code is hosted (`codeHost`): `--host`, the config's, the `origin` remote's address, or asked in a
|
|
24
|
+
* terminal when that address doesn't say (`codeHostChoice()`)
|
|
25
|
+
* - a file already there is kept as it is; `--host`, or that question, writes its `codeHost`
|
|
23
26
|
* 2. makes the epic folder, a git repo of its own, with a folder for each of `sharedFolders`
|
|
24
27
|
* (`Shared.init()`): `epics`, `sagas`, `guides`, `pages`
|
|
25
28
|
* - a LATER person (the config names its `contentRemote`, the folder is missing): clones it instead
|
|
@@ -27,11 +30,12 @@ import { Shared } from "./Shared";
|
|
|
27
30
|
* 2b. gives the epic repo its REMOTE, so a team shares the plans (`remoteStep()`, epic `epic-friend` P4, Q1):
|
|
28
31
|
* - the FIRST person: asks what to call it (`CLI.ask()`, suggesting `<repo>.epics`; `--content-repo`
|
|
29
32
|
* answers), and whether it's private or public (private suggested; `--public` answers; epic `epic-friend`
|
|
30
|
-
* T19), makes it on
|
|
33
|
+
* T19), makes it on the code host (`CodeHost.of()`: GitHub or GitLab), pushes, and writes its address into the config
|
|
31
34
|
* (`contentRemote`)
|
|
32
35
|
* - no terminal to ask in: private, unless `--public`; public says, in one line, that the plans will be too
|
|
33
|
-
* - its owner: the code repo's when that's an organization, else the person's own
|
|
34
|
-
* -
|
|
36
|
+
* - its owner: the code repo's when that's an organization (a GitLab group), else the person's own account
|
|
37
|
+
* - without the host's command (`gh`, `glab`), or logged out, it says how to get it, and carries on without
|
|
38
|
+
* - GitLab protects a new project's default branch: opened up at once (`letTeamPush()`), or says what to do
|
|
35
39
|
* - `--remote <address>`: a repo made already; `--no-remote`: none, the plans stay on this machine
|
|
36
40
|
* - an epic repo with a remote already: its address written into the config, when it isn't there
|
|
37
41
|
* 3. links those folders in at the checkout's root (`Shared.link()`)
|
|
@@ -59,8 +63,9 @@ import { Shared } from "./Shared";
|
|
|
59
63
|
* leave the links alone; on another branch it says so, and commits nothing
|
|
60
64
|
* - a base branch that takes only pull requests (`baseBranchProtected`): it NEVER commits there
|
|
61
65
|
* (`commitViaPullRequest()`): the two files go on a new branch, `epic-setup`, pushed, with a pull request opened
|
|
62
|
-
* (`gh`), else what to run printed; the base branch's checkout is left as it was, and epics start once
|
|
63
|
-
*
|
|
66
|
+
* (`gh` or `glab`), else what to run printed; the base branch's checkout is left as it was, and epics start once
|
|
67
|
+
* it's merged; on GitLab it's a merge request
|
|
68
|
+
* - on when `--protected-base` says so, or the code host does (`protectionStep()`), in one line
|
|
64
69
|
* - it starts with "Initializing Epic for repo <main>" and ends with "Epics initialized!", in colour; the settings it
|
|
65
70
|
* wrote are in the file, not printed (Owen, 2026-10-29)
|
|
66
71
|
****************/
|
|
@@ -81,18 +86,19 @@ export declare class RepoInit {
|
|
|
81
86
|
/**
|
|
82
87
|
* `epic init`'s questions, ALL asked before anything is done (Owen, 2026-10-29): the answers, and what they come to.
|
|
83
88
|
* - their name, every time (`askName()`); `name` (`--name`) answers it
|
|
89
|
+
* - where the code is hosted, only when the `origin` address doesn't say and nothing else does (`codeHostChoice()`)
|
|
84
90
|
* - their colour, from the names nobody has (`askColor()`), unless they have one already; `color` answers it
|
|
85
91
|
* - a teammate joining, the team's plans not here yet: cloned FIRST, quietly, so the taken colours are known
|
|
86
92
|
* (`cloned`; `init()` reports it)
|
|
87
|
-
* - the epic repo's name and private or public, only when `init()` will make it on
|
|
93
|
+
* - the epic repo's name and private or public, only when `init()` will make it on the code host (`willMakeRepo()`)
|
|
88
94
|
* - no terminal (`ask` off): nothing asked; the plan says what the flags and the suggestions come to
|
|
89
95
|
* - SIDE EFFECT: the clone, for a teammate joining (not `dryRun`)
|
|
90
96
|
*/
|
|
91
|
-
questions({ ask, dryRun, name, color, remote, contentRepo, visibility, noRemote, say }: QuestionOptions): Promise<Answers>;
|
|
97
|
+
questions({ ask, dryRun, name, color, remote, contentRepo, visibility, noRemote, host, say }: QuestionOptions): Promise<Answers>;
|
|
92
98
|
/**
|
|
93
|
-
* Whether `init()` will make the epic repo on
|
|
99
|
+
* Whether `init()` will make the epic repo on the code host: its owner when it will, else `undefined`.
|
|
94
100
|
* - not when the epic repo has a remote, the config names one, or `remote` / `noRemote` was given
|
|
95
|
-
* - only with
|
|
101
|
+
* - only with the host's command installed and logged in (`status()`, a few seconds), as `remoteStep()` asks
|
|
96
102
|
*/
|
|
97
103
|
willMakeRepo({ settings, content, remote, noRemote }: {
|
|
98
104
|
settings: EpicSettings;
|
|
@@ -108,9 +114,9 @@ export declare class RepoInit {
|
|
|
108
114
|
* Set the repo up (the class's steps); what it did, or would do with `dryRun`.
|
|
109
115
|
* - the options: `InitOptions`
|
|
110
116
|
* - SIDE EFFECT (not `dryRun`): writes the config and `.gitignore`, makes (or clones) the epic repo and the
|
|
111
|
-
* links, may make the epic repo on
|
|
117
|
+
* links, may make the epic repo on the code host and push to it, keeps the person's name in the epic home
|
|
112
118
|
*/
|
|
113
|
-
init({ dryRun, name, remote, contentRepo, visibility, noRemote, ask, color, plugin, server, commit, cloned, protectedBase, say }?: InitOptions): Promise<InitReport>;
|
|
119
|
+
init({ dryRun, name, remote, contentRepo, visibility, noRemote, ask, color, plugin, server, commit, cloned, protectedBase, codeHost, say }?: InitOptions): Promise<InitReport>;
|
|
114
120
|
/**
|
|
115
121
|
* The files `epic init` wrote in the repo (the config, `.gitignore`) committed on its base branch, and pushed;
|
|
116
122
|
* what it did.
|
|
@@ -136,8 +142,8 @@ export declare class RepoInit {
|
|
|
136
142
|
* taken back first, keeping its files (`undoOwnCommit()`)
|
|
137
143
|
* - the branch is made without checking it out (`commitOnSetupBranch()`), then the base branch's checkout put back as
|
|
138
144
|
* it was (`restoreBase()`): so "safe to run again", whatever else is staged or changed
|
|
139
|
-
* - the pull request:
|
|
140
|
-
* to run
|
|
145
|
+
* - the pull or merge request: opened when the host's command is logged in; else `pullRequestError` says why, and the
|
|
146
|
+
* lines say what to run
|
|
141
147
|
* - NEVER throws
|
|
142
148
|
* - SIDE EFFECT (not `dryRun`): a branch, a push, a pull request, the two files out of the checkout
|
|
143
149
|
*/
|
|
@@ -171,16 +177,16 @@ export declare class RepoInit {
|
|
|
171
177
|
*/
|
|
172
178
|
private static restoreBase;
|
|
173
179
|
/**
|
|
174
|
-
* The pull request for `SETUP_BRANCH`, opened
|
|
180
|
+
* The pull or merge request for `SETUP_BRANCH`, opened by `host`: its address, or why not.
|
|
175
181
|
* - NEVER throws
|
|
176
|
-
* - SIDE EFFECT: a pull request on
|
|
182
|
+
* - SIDE EFFECT: a pull or merge request on the code host
|
|
177
183
|
*/
|
|
178
184
|
private static pullRequestStep;
|
|
179
185
|
/**
|
|
180
186
|
* Whether the base branch takes only pull requests, and how that's known; what `init()` puts in the config.
|
|
181
187
|
* - already on in the config, or in the setup branch's (run again, its pull request not merged yet): `config`
|
|
182
188
|
* - `protectedBase` (`--protected-base`): `flag`
|
|
183
|
-
* - else
|
|
189
|
+
* - else the code host's word (`hostRequiresPullRequest()`): `detected`; no such rule: `off`
|
|
184
190
|
* - a config that says `false` in so many words stays so (a file already there is kept): `says off`, and a note
|
|
185
191
|
* - NEVER throws: failing to find out is `off`, never a failed init
|
|
186
192
|
*/
|
|
@@ -193,16 +199,36 @@ export declare class RepoInit {
|
|
|
193
199
|
}): ProtectionReport;
|
|
194
200
|
/** Whether `SETUP_BRANCH`, when there is one, holds a config with `baseBranchProtected` on. */
|
|
195
201
|
private static setupBranchSaysProtected;
|
|
196
|
-
/** Whether
|
|
197
|
-
private static
|
|
202
|
+
/** Whether the code host, as its command can see it, requires a request into the base branch of checkout `main`. */
|
|
203
|
+
private static hostRequiresPullRequest;
|
|
204
|
+
/**
|
|
205
|
+
* Where the code is hosted, and how that's known (`init()`'s `codeHost`, `epic init`'s question).
|
|
206
|
+
* - `--host` (`host`): `flag`; the config names one: `config`
|
|
207
|
+
* - else the `origin` address's: `address`; it doesn't say (`git.acme.com`): `asked` in a terminal, else `assumed`
|
|
208
|
+
* GitHub, which `noteLines()` says in one line; no remote: `default`, GitHub
|
|
209
|
+
* - NEVER throws
|
|
210
|
+
*/
|
|
211
|
+
static codeHostChoice({ main, host, ask }: {
|
|
212
|
+
main: string;
|
|
213
|
+
host?: CodeHostKind;
|
|
214
|
+
ask: boolean;
|
|
215
|
+
}): Promise<CodeHostReport>;
|
|
216
|
+
/**
|
|
217
|
+
* Write `kind` into config file `file` as its `codeHost`, keeping the rest as written.
|
|
218
|
+
* - a line that's there is changed in place; else the key goes in through `DataFile`, its comments kept
|
|
219
|
+
* - SIDE EFFECT: writes the file
|
|
220
|
+
*/
|
|
221
|
+
static keepCodeHost(file: string, kind: CodeHostKind): void;
|
|
198
222
|
/**
|
|
199
223
|
* Turn `baseBranchProtected` on in config file `file`, keeping the rest as written.
|
|
200
224
|
* - the line `epic init` writes is changed in place; a file without one gets the key through `DataFile`
|
|
201
225
|
* - SIDE EFFECT: writes the file
|
|
202
226
|
*/
|
|
203
227
|
static keepProtected(file: string): void;
|
|
204
|
-
/** What the commit section says first: why `epic init` asks to commit, or to open a pull request. */
|
|
205
|
-
static commitHeader(
|
|
228
|
+
/** What the commit section says first: why `epic init` asks to commit, or to open a pull or merge request. */
|
|
229
|
+
static commitHeader(report: Pick<InitReport, "config"> & Partial<Pick<InitReport, "codeHost">>): string;
|
|
230
|
+
/** What a person reads about `report`'s code host: "merge request" on GitLab, GitHub's by default. */
|
|
231
|
+
static wordsOf({ config, codeHost }: Pick<InitReport, "config"> & Partial<Pick<InitReport, "codeHost">>): CodeHostWords;
|
|
206
232
|
/**
|
|
207
233
|
* The files `epic init` changed in the repo, still to commit: the config, `.gitignore`.
|
|
208
234
|
* - a dry run wrote nothing: the ones it would have count too
|
|
@@ -246,12 +272,13 @@ export declare class RepoInit {
|
|
|
246
272
|
* - `remote` naming another: throws `EpicCommandError`, saying how to change it
|
|
247
273
|
* - `noRemote`: `skipped`
|
|
248
274
|
* - `remote`, else the config's `contentRemote`: made the remote, pushed (`added`)
|
|
249
|
-
* - else made on
|
|
250
|
-
* words when
|
|
275
|
+
* - else made on the code host (`made`), when its command is there and logged in (`no gh` for either's, `logged out`);
|
|
276
|
+
* `failed` with its words when it said no
|
|
251
277
|
* - its name: `contentRepo`, else asked when `ask` (in a terminal), else `<repo>.epics`
|
|
252
278
|
* - private or public: `visibility`, else asked when `ask` (`askVisibility()`), else private
|
|
253
279
|
* - a push that failed is in `error`: the repo and its address stand
|
|
254
|
-
* -
|
|
280
|
+
* - GitLab: after the first push, its default branch opened up to teammates (`warning`, when it couldn't be)
|
|
281
|
+
* - SIDE EFFECT (not `dryRun`): the repo on the code host, the remote, the push, `contentRemote` in the config
|
|
255
282
|
*/
|
|
256
283
|
remoteStep({ shared, settings, dryRun, remote, contentRepo, visibility, noRemote, ask, say }: RemoteStepOptions): Promise<RemoteReport>;
|
|
257
284
|
/**
|
|
@@ -260,12 +287,13 @@ export declare class RepoInit {
|
|
|
260
287
|
*/
|
|
261
288
|
static mainHere(cwd?: string): string;
|
|
262
289
|
/**
|
|
263
|
-
* Whose
|
|
264
|
-
* an ORGANIZATION (
|
|
290
|
+
* Whose account a new epic repo goes in, for the code repo at `main`: the code repo's owner when that's
|
|
291
|
+
* an ORGANIZATION (a GitHub org, a GitLab group or subgroup), else the person's own login; `undefined` when the
|
|
292
|
+
* host's command knows no login.
|
|
265
293
|
* - why not always the code repo's owner: a person can't make a repo in someone else's own account
|
|
266
|
-
* - runs
|
|
294
|
+
* - runs its command (the login, `CodeHost.loginOn()`; the owner's kind)
|
|
267
295
|
*/
|
|
268
|
-
static ownerFor(main: string): string | undefined;
|
|
296
|
+
static ownerFor(main: string, host: CodeHostClient): string | undefined;
|
|
269
297
|
/**
|
|
270
298
|
* Write `address` into config file `file` as its `contentRemote`, keeping the rest as written.
|
|
271
299
|
* - the line `epic init` writes is changed in place; a file without one (written before epic `epic-friend` P4)
|
|
@@ -289,13 +317,13 @@ export declare class RepoInit {
|
|
|
289
317
|
static askVisibility(): Promise<RepoVisibility>;
|
|
290
318
|
/**
|
|
291
319
|
* The name to keep, asked in a terminal EVERY time (Owen, 2026-10-29: "never asked for my user name"):
|
|
292
|
-
* "What do you want to be called?", suggesting the name kept already, else their
|
|
293
|
-
* `user.name`; Enter keeps it.
|
|
294
|
-
* - the login looked up first (`
|
|
320
|
+
* "What do you want to be called?", suggesting the name kept already, else their login on the code host, else
|
|
321
|
+
* git's `user.name`; Enter keeps it.
|
|
322
|
+
* - the login looked up first (`CodeHost.loginOn()`; GitHub's is kept, so pages never run `gh`)
|
|
295
323
|
* - `undefined` when nothing was said and nobody knows a name
|
|
296
324
|
* - no terminal: the suggestion, asking nothing (`CLI.ask()`)
|
|
297
325
|
*/
|
|
298
|
-
static askName(): Promise<string | undefined>;
|
|
326
|
+
static askName(host?: CodeHostClient): Promise<string | undefined>;
|
|
299
327
|
/**
|
|
300
328
|
* Their colour (the class's step 6): kept, there already, or why not.
|
|
301
329
|
* - `person`: their short name; none, no colour
|
|
@@ -359,8 +387,8 @@ export declare class RepoInit {
|
|
|
359
387
|
}): string[];
|
|
360
388
|
/** What needs a word of its own, under the files: the epic repo's problems, the colour's, no name. */
|
|
361
389
|
static noteLines(report: InitReport): string[];
|
|
362
|
-
/** What the commit came to (`commitStep()`), under its question. */
|
|
363
|
-
static commitResultLines(commit: CommitReport): string[];
|
|
390
|
+
/** What the commit came to (`commitStep()`), under its question; `words`: the code host's. */
|
|
391
|
+
static commitResultLines(commit: CommitReport, words?: CodeHostWords): string[];
|
|
364
392
|
/** The last lines: done, and where to see the epics (a browser's link, the editor's view); a dry run's word. */
|
|
365
393
|
static doneLines(report: InitReport): string[];
|
|
366
394
|
}
|
|
@@ -394,6 +422,8 @@ export type InitReport = {
|
|
|
394
422
|
};
|
|
395
423
|
/** whether the base branch takes only pull requests, and how that's known (`protectionStep()`) */
|
|
396
424
|
protection: ProtectionReport;
|
|
425
|
+
/** where the code is hosted, and how that's known (`codeHostChoice()`) */
|
|
426
|
+
codeHost: CodeHostReport;
|
|
397
427
|
/** the name this machine's person goes by: `kept` now, kept `already`, `would keep` (a dry run), or `none` */
|
|
398
428
|
person: {
|
|
399
429
|
name: string | undefined;
|
|
@@ -426,7 +456,7 @@ export type CommitReport = {
|
|
|
426
456
|
base?: string;
|
|
427
457
|
/** the pull request's address */
|
|
428
458
|
pullRequest?: string;
|
|
429
|
-
/** why there's none yet: no
|
|
459
|
+
/** why there's none yet: no command, logged out, or its words */
|
|
430
460
|
pullRequestError?: string;
|
|
431
461
|
/** why it failed */
|
|
432
462
|
error?: string;
|
|
@@ -444,10 +474,23 @@ export type ProtectionReport = {
|
|
|
444
474
|
action: "config" | "flag" | "detected" | "off" | "says off";
|
|
445
475
|
on: boolean;
|
|
446
476
|
};
|
|
477
|
+
/**
|
|
478
|
+
* Where the code is hosted (`RepoInit.codeHostChoice()`): `kind`, and how that's known:
|
|
479
|
+
* `flag` (`--host`), `config`, `address` (`origin`'s), `asked`, `assumed` (unknown host, no terminal: GitHub), `default`
|
|
480
|
+
* (no remote)
|
|
481
|
+
*/
|
|
482
|
+
export type CodeHostReport = {
|
|
483
|
+
kind: CodeHostKind;
|
|
484
|
+
source: "flag" | "config" | "address" | "asked" | "assumed" | "default";
|
|
485
|
+
/** the `origin` remote's host */
|
|
486
|
+
host?: string;
|
|
487
|
+
/** the `origin` remote's address */
|
|
488
|
+
address?: string;
|
|
489
|
+
};
|
|
447
490
|
/** What `RepoInit.changedFiles()` reads off the report. */
|
|
448
491
|
export type ChangedFilesInput = Pick<InitReport, "main"> & Partial<Pick<InitReport, "dryRun" | "config" | "gitignore">>;
|
|
449
492
|
/** What `epic init`'s questions came to (`RepoInit.questions()`): `init()`'s answers, and the summary. */
|
|
450
|
-
export type Answers = Pick<InitOptions, "name" | "color" | "contentRepo" | "visibility" | "cloned"> & {
|
|
493
|
+
export type Answers = Pick<InitOptions, "name" | "color" | "contentRepo" | "visibility" | "cloned" | "codeHost"> & {
|
|
451
494
|
/** what the summary under the questions says */
|
|
452
495
|
plan: Plan;
|
|
453
496
|
};
|
|
@@ -466,6 +509,8 @@ export type QuestionOptions = Pick<InitOptions, "name" | "color" | "remote" | "c
|
|
|
466
509
|
ask: boolean;
|
|
467
510
|
/** only say what it would do: nothing cloned */
|
|
468
511
|
dryRun: boolean;
|
|
512
|
+
/** where the code is hosted (`--host`) */
|
|
513
|
+
host?: CodeHostKind;
|
|
469
514
|
};
|
|
470
515
|
/** What `epic init` did about the epic plugin: `installed` (and how many `changes`), `already`, ... */
|
|
471
516
|
export type PluginReport = {
|
|
@@ -529,12 +574,12 @@ export type ColorStepOptions = {
|
|
|
529
574
|
* What `epic init` did about the epic repo's remote, the Epic repo (`RepoInit.remoteStep()`):
|
|
530
575
|
* - `action`:
|
|
531
576
|
* - `cloned`: a later person's epic folder, cloned from `address`; `clone failed`, git's words in `error`
|
|
532
|
-
* - `made`: `repo` made on
|
|
577
|
+
* - `made`: `repo` made on the code host, pushed to, its `address` written in the config
|
|
533
578
|
* - `added`: `address` (`--remote`, or the config's) made the remote, pushed to
|
|
534
579
|
* - `recorded`: the remote the epic repo had, written in the config; `already`: there already
|
|
535
580
|
* - `skipped`: `--no-remote`
|
|
536
|
-
* - `no gh`, `logged out`:
|
|
537
|
-
* - `failed`:
|
|
581
|
+
* - `no gh`, `logged out`: the code host's command (`gh` or `glab`) missing, or not logged in: nothing made
|
|
582
|
+
* - `failed`: the code host said no (`error`: its words)
|
|
538
583
|
* - `would ...`: a dry run's
|
|
539
584
|
* - `error`: also a push that failed (`made`, `added`): the remote stands, the push is left to do by hand
|
|
540
585
|
*/
|
|
@@ -542,12 +587,14 @@ export type RemoteReport = {
|
|
|
542
587
|
action: RemoteAction;
|
|
543
588
|
/** the epic repo's address, as git takes it */
|
|
544
589
|
address?: string;
|
|
545
|
-
/** the
|
|
590
|
+
/** the repo made on the code host, or that would be: `owner/name` */
|
|
546
591
|
repo?: string;
|
|
547
592
|
/** who can see that repo: `private` or `public` (`made`, `would make`, `failed`) */
|
|
548
593
|
visibility?: RepoVisibility;
|
|
549
|
-
/** git's or
|
|
594
|
+
/** git's or the code host's words, when something failed */
|
|
550
595
|
error?: string;
|
|
596
|
+
/** one line about what the team must do by hand: GitLab's default branch left protected */
|
|
597
|
+
warning?: string;
|
|
551
598
|
};
|
|
552
599
|
/** What `epic init` did about the epic repo: `RemoteReport`. */
|
|
553
600
|
export type RemoteAction = "cloned" | "clone failed" | "made" | "added" | "recorded" | "already" | "skipped" | "no gh" | "logged out" | "failed" | "would clone" | "would make" | "would add" | "would record";
|
|
@@ -559,9 +606,9 @@ export type InitOptions = {
|
|
|
559
606
|
name?: string;
|
|
560
607
|
/** the epic repo's address, made already (`--remote`): made the epic repo's remote, and pushed to */
|
|
561
608
|
remote?: string;
|
|
562
|
-
/** the name to give the epic repo on
|
|
609
|
+
/** the name to give the epic repo on the code host (`--content-repo`); none: asked, else `<repo>.epics` */
|
|
563
610
|
contentRepo?: string;
|
|
564
|
-
/** whether the epic repo made on
|
|
611
|
+
/** whether the epic repo made on the code host is private or public (`--public`); none: asked, else private */
|
|
565
612
|
visibility?: RepoVisibility;
|
|
566
613
|
/** no remote, no epic repo (`--no-remote`): the plans stay on this machine; default `false` */
|
|
567
614
|
noRemote?: boolean;
|
|
@@ -580,8 +627,10 @@ export type InitOptions = {
|
|
|
580
627
|
commit?: boolean;
|
|
581
628
|
/** the team's plans cloned already (`questions()`, for the colours they hold): reported as `cloned` */
|
|
582
629
|
cloned?: boolean;
|
|
583
|
-
/** the base branch takes only pull requests (`--protected-base`); default `false`:
|
|
630
|
+
/** the base branch takes only pull requests (`--protected-base`); default `false`: the host's word, else off */
|
|
584
631
|
protectedBase?: boolean;
|
|
632
|
+
/** where the code is hosted, settled already (`questions()`); none: worked out, asking nothing */
|
|
633
|
+
codeHost?: CodeHostReport;
|
|
585
634
|
/** a progress line, before each slow step (a clone, GitHub, a push, the server); default: nothing said */
|
|
586
635
|
say?: (text: string) => void;
|
|
587
636
|
};
|
|
@@ -592,6 +641,6 @@ export type RemoteStepOptions = Pick<InitOptions, "remote" | "contentRepo" | "vi
|
|
|
592
641
|
dryRun: boolean;
|
|
593
642
|
noRemote: boolean;
|
|
594
643
|
ask: boolean;
|
|
595
|
-
/** a progress line, before
|
|
644
|
+
/** a progress line, before the code host makes the repo */
|
|
596
645
|
say?: (text: string) => void;
|
|
597
646
|
};
|