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.
Files changed (92) hide show
  1. package/README-epics.md +60 -20
  2. package/app/package.json +1 -1
  3. package/app/spaces/@spell/guides/SpellUI/SpellUI.spellml +486 -486
  4. package/app/spaces/@spell/sites/SpellApp/SpellApp.spellml +50 -124
  5. package/dist/app/app/pages/SiteBoardView.css +5 -5
  6. package/dist/app/app/pages/SiteBoardView.js +1 -1
  7. package/dist/app/app/pages/SiteEditorPage.js +6 -3
  8. package/dist/app/app/pages/SiteEdits.js +27 -10
  9. package/dist/app/app/pages/SiteWrites.js +11 -0
  10. package/dist/app/app/runner/spellRuntime.js +1 -0
  11. package/dist/epic/cli/EpicProgram.js +15 -6
  12. package/dist/epic/cli/epicGroups.js +5 -0
  13. package/dist/epic/command/BaseBranch.js +1 -1
  14. package/dist/epic/command/PullRequest.d.ts +45 -0
  15. package/dist/epic/command/PullRequest.js +100 -0
  16. package/dist/epic/command/RepoInit.d.ts +96 -47
  17. package/dist/epic/command/RepoInit.js +222 -96
  18. package/dist/epic/command/Requests.js +2 -1
  19. package/dist/epic/command/Worktrees.d.ts +5 -3
  20. package/dist/epic/command/Worktrees.js +9 -8
  21. package/dist/epic/components/__pack/epics.entry.js +43 -43
  22. package/dist/epic/components/__pack/epics.pack.js +2 -2
  23. package/dist/epic/config/CodeHost.d.ts +96 -0
  24. package/dist/epic/config/CodeHost.js +89 -0
  25. package/dist/epic/config/EpicConfig.d.ts +9 -2
  26. package/dist/epic/config/EpicConfig.js +16 -0
  27. package/dist/epic/config/EpicRepo.js +1 -1
  28. package/dist/epic/config/GitHub.d.ts +34 -2
  29. package/dist/epic/config/GitHub.js +36 -7
  30. package/dist/epic/config/GitLab.d.ts +138 -0
  31. package/dist/epic/config/GitLab.js +297 -0
  32. package/dist/epic/tool/PlanCommits.d.ts +7 -4
  33. package/dist/epic/tool/PlanCommits.js +7 -5
  34. package/dist/epic/tool/PlanDocCommands.js +3 -4
  35. package/dist/epic/tool/PlanDocFiles.d.ts +3 -1
  36. package/dist/epic/tool/PlanDocFiles.js +10 -3
  37. package/dist/parser/core/classes/View.d.ts +20 -0
  38. package/dist/parser/core/classes/View.js +91 -17
  39. package/dist/parser/core/core.declarations.json5 +18 -0
  40. package/dist/parser/core/core.scopes.js +5 -0
  41. package/dist/parser/core/sites.d.ts +10 -0
  42. package/dist/parser/core/sites.js +12 -0
  43. package/dist/parser/parser/tokenizer/Tokenizer.d.ts +9 -1
  44. package/dist/parser/parser/tokenizer/Tokenizer.js +43 -5
  45. package/dist/parser/parser/tokenizer/Tokens.d.ts +4 -0
  46. package/dist/parser/parser/tokenizer/Tokens.js +4 -0
  47. package/dist/parser/parser/tokenizer/tokenizer.types.d.ts +5 -0
  48. package/dist/parser/parser/tokenizer/tokenizer.types.js +2 -0
  49. package/dist/parser/py/core/spell_core/apps.py +2 -0
  50. package/dist/parser/spell/PARSING.md +21 -0
  51. package/dist/parser/spell/SpellParser.d.ts +2 -0
  52. package/dist/parser/spell/SpellParser.js +58 -3
  53. package/dist/parser/spell/SpellxTokenizer.js +2 -1
  54. package/dist/parser/spell/SpellxTwin.d.ts +4 -1
  55. package/dist/parser/spell/SpellxTwin.js +10 -3
  56. package/dist/parser/spell/builtinTypes.js +24 -1
  57. package/dist/parser/spell/ingest/PlaceIngest.js +3 -1
  58. package/dist/parser/spell/languages/Language.d.ts +11 -2
  59. package/dist/parser/spell/languages/en/words.js +3 -2
  60. package/dist/parser/spell/languages/es/words.js +7 -4
  61. package/dist/parser/spell/rules/Statement.js +1 -1
  62. package/dist/parser/spell/rules/classes/DrawSlot.js +6 -1
  63. package/dist/parser/spell/rules/sites/SitePage.d.ts +3 -3
  64. package/dist/parser/spell/rules/sites/SitePage.js +2 -2
  65. package/dist/parser/spell/rules/sites/sites.en.js +1 -1
  66. package/dist/parser/spell/rules/sites/sites.es.js +1 -1
  67. package/dist/parser/spell/rules/sites/sites.shared.d.ts +2 -2
  68. package/dist/parser/spell/spell.types.d.ts +7 -0
  69. package/dist/parser/spell/spellSyntax.es.json +6 -6
  70. package/dist/parser/spell/spellSyntax.json +6 -6
  71. package/dist/parser/spellx/SpellxView.js +2 -1
  72. package/dist/ui/components/ui-parts/UIHeader.d.ts +12 -2
  73. package/dist/ui/components/ui-parts/UIHeader.en.d.ts +5 -2
  74. package/dist/ui/components/ui-parts/UIHeader.en.js +6 -3
  75. package/dist/ui/components/ui-parts/UIHeader.js +45 -5
  76. package/dist/ui/components/ui-parts/UIParts.css +18 -0
  77. package/dist/ui/components/ui-parts/UIParts.css.inline.js +1 -1
  78. package/dist/ui/jsx.d.ts +4 -4
  79. package/dist/ui/vocabulary/defaults.generated.js +1 -1
  80. package/dist/util/spell/constants.js +1 -1
  81. package/epic/.claude-plugin/plugin.json +1 -1
  82. package/epic/.codex-plugin/plugin.json +1 -1
  83. package/epic/package.json +1 -1
  84. package/epic/skills/epic/SKILL.md +2 -2
  85. package/epic/skills/epic/guide.md +2 -3
  86. package/epic/skills/isolate/SKILL.md +25 -27
  87. package/epic/src/AGENTS.md +5 -0
  88. package/epic/vscode/package.json +1 -1
  89. package/epic/vscode/spell-epic.vsix +0 -0
  90. package/package.json +1 -1
  91. package/parser/package.json +1 -1
  92. package/ui/package.json +1 -1
@@ -1,17 +1,10 @@
1
1
  <!--
2
- Spell's own app as a site: a page per screen, each showing a picture of how it looks today.
3
- What opens over a page is a dialog or a sidebar, opened from the buttons above its picture.
2
+ Spell's own app as a site: a page per screen, each with a thumbnail of how it looks today.
3
+ What opens over a page is a dialog or a sidebar, opened from the buttons above its thumbnail.
4
4
  Most addresses name a project, so they aren't in the navigation: Home links to one of each.
5
5
  -->
6
6
 
7
- <spell-view "picture">
8
- <property "file" description="The picture's file, in snapshots/, without its .jpg">text</property>
9
- <draw>
10
- <image src={"/spaces/@spell/sites/SpellApp/snapshots/" + its file + ".jpg"}/>
11
- </draw>
12
- </>
13
-
14
- <spell-page "home page">
7
+ <spell-page "home page" thumbnail="snapshots/home.jpg">
15
8
  <spell-stories>
16
9
  - [x] open an example, a guide, a notebook or one of my projects from its card
17
10
  - [x] start from a blank app, a small starter or Solitaire
@@ -28,31 +21,25 @@
28
21
  <link link={"/site/@spell/examples/StarWarsSite"}>The site editor</link>
29
22
  <link link={"/apps/@spell/examples/TaskList"}>A hosted app</link>
30
23
  </stack>
31
- draw (a new picture with file = "home")
24
+ draw its thumbnail
32
25
  </draw>
33
26
  </>
34
27
 
35
- <spell-page "notebook page">
28
+ <spell-page "notebook page" thumbnail="snapshots/notebook.jpg">
36
29
  <spell-stories>
37
30
  - [x] read a notebook, its words and its code in cells
38
31
  </>
39
32
  <property "notebook" description="What the address names">text</property>
40
- <draw>
41
- draw (a new picture with file = "notebook")
42
- </draw>
43
33
  </>
44
34
 
45
- <spell-page "guide page">
35
+ <spell-page "guide page" thumbnail="snapshots/guide.jpg">
46
36
  <spell-stories>
47
37
  - [x] read a guide in the editor, its words as the comments of its spell file
48
38
  </>
49
39
  <property "guide" description="What the address names">text</property>
50
- <draw>
51
- draw (a new picture with file = "guide")
52
- </draw>
53
40
  </>
54
41
 
55
- <spell-page "code editor page">
42
+ <spell-page "code editor page" thumbnail="snapshots/edit.jpg">
56
43
  <spell-stories>
57
44
  - [x] change the code in its file tabs, with the running app beside it
58
45
  - [x] see the program's output, its compiled code and what I can use, in the Program panel under the code
@@ -75,22 +62,19 @@
75
62
  <button appearance="basic" onClick={show the publish clash dialog}>Publish Clash</button>
76
63
  <button appearance="basic" onClick={show the person dialog}>You</button>
77
64
  </stack>
78
- draw (a new picture with file = "edit")
65
+ draw its thumbnail
79
66
  </draw>
80
67
  </>
81
68
 
82
- <spell-page "running app page">
69
+ <spell-page "running app page" thumbnail="snapshots/run.jpg">
83
70
  <spell-stories>
84
71
  - [x] use the program by itself, with no code showing
85
72
  - [x] restart it
86
73
  </>
87
74
  <property "project" description="What the address names">text</property>
88
- <draw>
89
- draw (a new picture with file = "run")
90
- </draw>
91
75
  </>
92
76
 
93
- <spell-page "site editor page">
77
+ <spell-page "site editor page" thumbnail="snapshots/site-pages.jpg">
94
78
  <spell-stories>
95
79
  - [x] see a site's pages as a tree and a board of cards
96
80
  - [x] drag a row to move a page, with its pages
@@ -103,21 +87,18 @@
103
87
  <stack direction="horizontal" wrap spacing="s">
104
88
  <button appearance="basic" onClick={show the site data sidebar}>Data</button>
105
89
  </stack>
106
- draw (a new picture with file = "site-pages")
90
+ draw its thumbnail
107
91
  </draw>
108
92
  </>
109
93
 
110
- <spell-page "theme editor page">
94
+ <spell-page "theme editor page" thumbnail="snapshots/theme.jpg">
111
95
  <spell-stories>
112
96
  - [x] change a theme and see it on real pages
113
97
  - [x] save it by name, to pick from every theme menu
114
98
  </>
115
- <draw>
116
- draw (a new picture with file = "theme")
117
- </draw>
118
99
  </>
119
100
 
120
- <spell-page "hosted app page">
101
+ <spell-page "hosted app page" thumbnail="snapshots/hosted-program.jpg">
121
102
  <spell-stories>
122
103
  - [x] use a program at its own address on Spell's cloud
123
104
  </>
@@ -126,122 +107,67 @@
126
107
  <stack direction="horizontal" wrap spacing="s">
127
108
  <button appearance="basic" onClick={show the sign-in dialog}>Sign In</button>
128
109
  </stack>
129
- draw (a new picture with file = "hosted-program")
110
+ draw its thumbnail
130
111
  </draw>
131
112
  </>
132
113
 
133
- <spell-page "terms page">
114
+ <spell-page "terms page" thumbnail="snapshots/terms.jpg">
134
115
  <spell-stories>
135
116
  - [x] read Spell's terms
136
117
  </>
137
- <draw>
138
- draw (a new picture with file = "terms")
139
- </draw>
140
118
  </>
141
119
 
142
- <spell-view "inspector sidebar">
143
- <draw>
144
- draw (a new picture with file = "inspector")
145
- </draw>
146
- </>
120
+ <spell-view "inspector sidebar" thumbnail="snapshots/inspector.jpg"/>
147
121
 
148
- <spell-view "palette sidebar">
149
- <draw>
150
- draw (a new picture with file = "palette")
151
- </draw>
152
- </>
122
+ <spell-view "palette sidebar" thumbnail="snapshots/palette.jpg"/>
153
123
 
154
- <spell-view "site data sidebar">
155
- <draw>
156
- draw (a new picture with file = "site-data")
157
- </draw>
158
- </>
124
+ <spell-view "site data sidebar" thumbnail="snapshots/site-data.jpg"/>
159
125
 
160
- <spell-view "project settings dialog">
161
- <draw>
162
- draw (a new picture with file = "project-settings")
163
- </draw>
164
- </>
126
+ <spell-view "project settings dialog" thumbnail="snapshots/project-settings.jpg"/>
165
127
 
166
- <spell-view "code settings dialog">
167
- <draw>
168
- draw (a new picture with file = "code-settings")
169
- </draw>
170
- </>
128
+ <spell-view "code settings dialog" thumbnail="snapshots/code-settings.jpg"/>
171
129
 
172
- <spell-view "project versions dialog">
173
- <draw>
174
- draw (a new picture with file = "versions")
175
- </draw>
176
- </>
130
+ <spell-view "project versions dialog" thumbnail="snapshots/versions.jpg"/>
177
131
 
178
- <spell-view "new file dialog">
179
- <draw>
180
- draw (a new picture with file = "new-file")
181
- </draw>
182
- </>
132
+ <spell-view "new file dialog" thumbnail="snapshots/new-file.jpg"/>
183
133
 
184
- <spell-view "new project dialog">
185
- <draw>
186
- draw (a new picture with file = "new-project")
187
- </draw>
188
- </>
134
+ <spell-view "new project dialog" thumbnail="snapshots/new-project.jpg"/>
189
135
 
190
- <spell-view "duplicate project dialog">
191
- <draw>
192
- draw (a new picture with file = "duplicate-project")
193
- </draw>
194
- </>
136
+ <spell-view "duplicate project dialog" thumbnail="snapshots/duplicate-project.jpg"/>
195
137
 
196
- <spell-view "change this dialog">
197
- <draw>
198
- draw (a new picture with file = "change-this")
199
- </draw>
200
- </>
138
+ <spell-view "change this dialog" thumbnail="snapshots/change-this.jpg"/>
201
139
 
202
- <spell-view "publish clash dialog">
203
- <draw>
204
- draw (a new picture with file = "publish-clash")
205
- </draw>
206
- </>
140
+ <spell-view "publish clash dialog" thumbnail="snapshots/publish-clash.jpg"/>
207
141
 
208
- <spell-view "person dialog">
209
- <draw>
210
- draw (a new picture with file = "you")
211
- </draw>
212
- </>
142
+ <spell-view "person dialog" thumbnail="snapshots/you.jpg"/>
213
143
 
214
- <spell-view "sign-in dialog">
215
- <draw>
216
- draw (a new picture with file = "sign-in")
217
- </draw>
218
- </>
144
+ <spell-view "sign-in dialog" thumbnail="snapshots/sign-in.jpg"/>
219
145
 
220
146
  <spell-site "spell app">
221
- <page "home page" address="/" title="Home" state="old" picture="snapshots/home.jpg" color="red"/>
222
- <page "notebook page" address="/edit/@spell/guides/SpellUI/:notebook*" title="Notebook" state="old" picture="snapshots/notebook.jpg" color="orange"/>
223
- <page "guide page" address="/edit/@spell/guides/:guide" title="Guide" state="old" picture="snapshots/guide.jpg" color="yellow"/>
224
- <page "code editor page" address="/edit/:project*" title="Edit" state="old" picture="snapshots/edit.jpg" color="olive">
225
- <page "running app page" address="/run/:project*" title="Run" state="old" picture="snapshots/run.jpg"/>
147
+ <page "home page" address="/" title="Home" state="old" color="red"/>
148
+ <page "notebook page" address="/edit/@spell/guides/SpellUI/:notebook*" title="Notebook" state="old" color="orange"/>
149
+ <page "guide page" address="/edit/@spell/guides/:guide" title="Guide" state="old" color="yellow"/>
150
+ <page "code editor page" address="/edit/:project*" title="Edit" state="old" color="olive">
151
+ <page "running app page" address="/run/:project*" title="Run" state="old"/>
226
152
  </>
227
- <page "site editor page" address="/site/:project*" title="Site Editor" state="old" picture="snapshots/site-pages.jpg" color="green"/>
228
- <page "theme editor page" address="/theme" title="Theme Editor" state="old" picture="snapshots/theme.jpg" color="teal"/>
229
- <page "hosted app page" address="/apps/:project*" title="Hosted App" state="old" picture="snapshots/hosted-program.jpg" color="blue">
230
- <page "terms page" address="/terms" title="Terms" state="old" picture="snapshots/terms.jpg"/>
153
+ <page "site editor page" address="/site/:project*" title="Site Editor" state="old" color="green"/>
154
+ <page "theme editor page" address="/theme" title="Theme Editor" state="old" color="teal"/>
155
+ <page "hosted app page" address="/apps/:project*" title="Hosted App" state="old" color="blue">
156
+ <page "terms page" address="/terms" title="Terms" state="old"/>
231
157
  </>
232
- <sidebar "inspector sidebar" picture="snapshots/inspector.jpg"/>
233
- <sidebar "palette sidebar" picture="snapshots/palette.jpg"/>
234
- <sidebar "site data sidebar" picture="snapshots/site-data.jpg"/>
235
- <dialog "project settings dialog" picture="snapshots/project-settings.jpg"/>
236
- <dialog "code settings dialog" picture="snapshots/code-settings.jpg"/>
237
- <dialog "project versions dialog" picture="snapshots/versions.jpg"/>
238
- <dialog "new file dialog" picture="snapshots/new-file.jpg"/>
239
- <dialog "new project dialog" picture="snapshots/new-project.jpg"/>
240
- <dialog "duplicate project dialog" picture="snapshots/duplicate-project.jpg"/>
241
- <dialog "change this dialog" picture="snapshots/change-this.jpg"/>
242
- <dialog "publish clash dialog" picture="snapshots/publish-clash.jpg"/>
243
- <dialog "person dialog" picture="snapshots/you.jpg"/>
244
- <dialog "sign-in dialog" picture="snapshots/sign-in.jpg"/>
158
+ <sidebar "inspector sidebar"/>
159
+ <sidebar "palette sidebar"/>
160
+ <sidebar "site data sidebar"/>
161
+ <dialog "project settings dialog"/>
162
+ <dialog "code settings dialog"/>
163
+ <dialog "project versions dialog"/>
164
+ <dialog "new file dialog"/>
165
+ <dialog "new project dialog"/>
166
+ <dialog "duplicate project dialog"/>
167
+ <dialog "change this dialog"/>
168
+ <dialog "publish clash dialog"/>
169
+ <dialog "person dialog"/>
170
+ <dialog "sign-in dialog"/>
245
171
  <page "not found page"/>
246
172
  <page "error page"/>
247
173
  </>
@@ -3,13 +3,13 @@
3
3
  * of one width, so a section's columns line up with the others'.
4
4
  * - A card's DOM element has no box (`display: contents`): its `::part(card)` is what sits in the grid,
5
5
  * at its `--SiteCard-row` and `--SiteCard-column`.
6
- * - On a board with any picture, every card is the same size, and a picture shows only as much of itself as fits,
6
+ * - On a board with any thumbnail, every card is the same size, and a thumbnail shows only as much of itself as fits,
7
7
  * from its top: a tall sidebar is cut off.
8
8
  */
9
9
  .SiteBoard {
10
10
  --SiteBoard-card-width: 156px;
11
11
  --SiteBoard-gap: 12px;
12
- --SiteBoard-picture-height: 96px;
12
+ --SiteBoard-thumbnail-height: 96px;
13
13
  display: flex;
14
14
  flex-direction: column;
15
15
  gap: 26px;
@@ -93,11 +93,11 @@
93
93
  }
94
94
  &::part(image) {
95
95
  flex: none;
96
- height: var(--SiteBoard-picture-height);
96
+ height: var(--SiteBoard-thumbnail-height);
97
97
  overflow: hidden;
98
98
  pointer-events: none;
99
99
  }
100
- /* its title and line, centred in what's left under a picture */
100
+ /* its title and line, centred in what's left under a thumbnail */
101
101
  &::part(content) {
102
102
  flex: 1 1 auto;
103
103
  display: flex;
@@ -139,7 +139,7 @@
139
139
  opacity: 0.45;
140
140
  }
141
141
 
142
- /* the page's link to itself in a new tab: 8px inside the card's corner, readable over a picture */
142
+ /* the page's link to itself in a new tab: 8px inside the card's corner, readable over a thumbnail */
143
143
  .new-tab {
144
144
  position: absolute;
145
145
  top: 8px;
@@ -138,7 +138,7 @@ function SiteCard(props) {
138
138
  ],
139
139
  t: part().name,
140
140
  a: props.card.color,
141
- o: props.pictureOf(part()),
141
+ o: props.thumbnailOf(part()),
142
142
  i: props.titleOf(part()),
143
143
  n: props.lineOf(part()),
144
144
  s: props.lineOf(part()),
@@ -188,8 +188,8 @@ function SiteEditorPage() {
188
188
  get lineOf() {
189
189
  return SiteEditorPage.lineOf;
190
190
  },
191
- get pictureOf() {
192
- return SiteEditorPage.pictureOf;
191
+ get thumbnailOf() {
192
+ return SiteEditorPage.thumbnailOf;
193
193
  },
194
194
  get newTabUrlOf() {
195
195
  return SiteEditorPage.newTabUrlOf;
@@ -289,7 +289,10 @@ SiteEditorPage.cardTitleOf = (part) => {
289
289
  const words = title.replace(/\s+(?:dialog|modal|sidebar|flyout)$/i, "");
290
290
  return words.charAt(0).toUpperCase() + words.slice(1);
291
291
  };
292
- SiteEditorPage.pictureOf = (part) => part.picture && SP.SpellUrls.fileUrl(`${editor.project?.path}/${part.picture}`);
292
+ SiteEditorPage.thumbnailOf = (part) => {
293
+ const thumbnail = part.thumbnail ?? SiteWrites.thumbnailOf(part.name);
294
+ return thumbnail && SP.SpellUrls.fileUrl(`${editor.project?.path}/${thumbnail}`);
295
+ };
293
296
  SiteEditorPage.newTabUrlOf = (part) => part.kind === "page" && part.address && editor.project ? RunSite.runUrlFor(editor.project.path, part.address) : void 0;
294
297
  SiteEditorPage.freeAddress = (parts) => {
295
298
  const taken = new Set(parts.map((part) => part.address));
@@ -2,6 +2,7 @@ var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
4
  // src/app/pages/SiteEdits.ts
5
+ import { escapeRegExp } from "spell/util/string";
5
6
  import { CODE_SITE, SPELLX_SITE, declaresSite } from "../../spaces/models/siteFiles.js";
6
7
  var SiteEdits = class _SiteEdits {
7
8
  static {
@@ -143,6 +144,22 @@ var SiteEdits = class _SiteEdits {
143
144
  static declarationOf(text, name) {
144
145
  return declarationOf(text, name);
145
146
  }
147
+ /**
148
+ * The thumbnail written on part `name`'s own page or view in `text`, if it's declared there.
149
+ * - `<spell-page "x" thumbnail="...">`, `<spell-view "x" thumbnail="...">`, or a line of its body,
150
+ * `- its thumbnail is "..."`.
151
+ * - A site's `button usage page` may be declared as `button usage`: either name finds it.
152
+ */
153
+ static thumbnailOf(text, name) {
154
+ if (!text.includes("thumbnail")) return void 0;
155
+ for (const quoted of [name, name.replace(/ page$/, "")].map((each) => escapeRegExp(JSON.stringify(each)))) {
156
+ const tag = new RegExp(`^<spell-(?:page|view) ${quoted}[^\\n]*`, "m").exec(text)?.[0];
157
+ if (tag) return ATTRIBUTE("thumbnail").exec(tag)?.[1];
158
+ const body = new RegExp(`^an? ${quoted} is an? (?:page|view)[^\\n]*\\n((?:[ \\t]+[^\\n]*\\n)*)`, "m").exec(text);
159
+ if (body) return /^[ \t]*- its thumbnail is "([^"]*)"/m.exec(body[1])?.[1];
160
+ }
161
+ return void 0;
162
+ }
146
163
  /**
147
164
  * Can `part` have pages under it?
148
165
  * - Only a page with an address: the not found and error pages are shown when no address matches,
@@ -300,7 +317,7 @@ function spellxPartsIn(text, start) {
300
317
  tab: ATTRIBUTE("tab").exec(attributes)?.[1],
301
318
  tags: ATTRIBUTE("tags").exec(attributes)?.[1],
302
319
  state: ATTRIBUTE("state").exec(attributes)?.[1],
303
- picture: ATTRIBUTE("picture").exec(attributes)?.[1],
320
+ thumbnail: ATTRIBUTE("thumbnail").exec(attributes)?.[1],
304
321
  row: numberIn(ATTRIBUTE("row").exec(attributes)?.[1]),
305
322
  column: numberIn(ATTRIBUTE("column").exec(attributes)?.[1]),
306
323
  color: ATTRIBUTE("color").exec(attributes)?.[1],
@@ -325,7 +342,7 @@ function codePartsIn(text, start) {
325
342
  if (line.text.trim() && !/^[ \t]/.test(line.text)) break;
326
343
  const written = CODE_PART.exec(line.text);
327
344
  if (!written) continue;
328
- const [, indent, written_name, address, title, tab, tags, state, picture, row, column, color] = written;
345
+ const [, indent, written_name, address, title, tab, tags, state, thumbnail, row, column, color] = written;
329
346
  const isQuoted = /^".*"$/.test(written_name);
330
347
  const name = isQuoted ? written_name.slice(1, -1) : written_name;
331
348
  while (open.length && open.at(-1).indent.length >= indent.length) open.pop();
@@ -337,7 +354,7 @@ function codePartsIn(text, start) {
337
354
  tab,
338
355
  tags,
339
356
  state,
340
- picture,
357
+ thumbnail,
341
358
  row: numberIn(row),
342
359
  column: numberIn(column),
343
360
  color,
@@ -424,7 +441,7 @@ function declarationOf(text, name) {
424
441
  return { start: first.start, end };
425
442
  }
426
443
  __name(declarationOf, "declarationOf");
427
- function spellxLineWith(line, { address, title, tab, tags, state, picture, row, column, color }) {
444
+ function spellxLineWith(line, { address, title, tab, tags, state, thumbnail, row, column, color }) {
428
445
  let changed = line;
429
446
  for (const [word, value] of [
430
447
  ["address", address],
@@ -432,7 +449,7 @@ function spellxLineWith(line, { address, title, tab, tags, state, picture, row,
432
449
  ["tab", tab],
433
450
  ["tags", tags],
434
451
  ["state", state],
435
- ["picture", picture],
452
+ ["thumbnail", thumbnail],
436
453
  ["row", row === void 0 ? void 0 : `${row}`],
437
454
  ["column", column === void 0 ? void 0 : `${column}`],
438
455
  ["color", color]
@@ -445,22 +462,22 @@ function spellxLineWith(line, { address, title, tab, tags, state, picture, row,
445
462
  return changed;
446
463
  }
447
464
  __name(spellxLineWith, "spellxLineWith");
448
- function wordsOf({ address, title, tab, tags, state, picture, row, column, color }) {
449
- return { address, title, tab, tags, state, picture, row, column, color };
465
+ function wordsOf({ address, title, tab, tags, state, thumbnail, row, column, color }) {
466
+ return { address, title, tab, tags, state, thumbnail, row, column, color };
450
467
  }
451
468
  __name(wordsOf, "wordsOf");
452
469
  function numberIn(text) {
453
470
  return text === void 0 ? void 0 : Number(text);
454
471
  }
455
472
  __name(numberIn, "numberIn");
456
- function codeLineWith(line, part, { address, title, tab, tags, state, picture, row, column, color }) {
473
+ function codeLineWith(line, part, { address, title, tab, tags, state, thumbnail, row, column, color }) {
457
474
  const ending = line.endsWith("\n") ? "\n" : "";
458
475
  const at = address === void 0 ? "" : ` at ${JSON.stringify(address)}`;
459
476
  const named = title === void 0 || !address ? "" : `, named ${JSON.stringify(title)}`;
460
477
  const tabbed = tab === void 0 || !address ? "" : `, tab ${JSON.stringify(tab)}`;
461
478
  const tagged = tags === void 0 || !address ? "" : `, tagged ${JSON.stringify(tags)}`;
462
479
  const stated = state === void 0 || !address ? "" : `, ${state}`;
463
- const pictured = picture === void 0 || !address ? "" : `, pictured in ${JSON.stringify(picture)}`;
480
+ const pictured = thumbnail === void 0 || !address ? "" : `, thumbnail ${JSON.stringify(thumbnail)}`;
464
481
  const placed = row === void 0 || column === void 0 ? "" : `, in row ${row} column ${column}`;
465
482
  const colored = color === void 0 ? "" : `, colored ${color}`;
466
483
  const name = part.isQuoted ? JSON.stringify(part.name) : part.name;
@@ -472,7 +489,7 @@ function articleOf(name) {
472
489
  }
473
490
  __name(articleOf, "articleOf");
474
491
  var SPELLX_PART = /^<(page|dialog|sidebar)\s+"([^"]+)"([^>]*?)\s*(\/>|>)$/;
475
- var CODE_PART = /^([ \t]+)- it has an? (.+?)(?: at "([^"]*)")?(?:, named "([^"]*)")?(?:, tab "([^"]*)")?(?:, tagged "([^"]*)")?(?:, (old|new|mocked|built))?(?:, pictured in "([^"]*)")?(?:, in row (\d+) column (\d+))?(?:, colou?red (\w+))?\s*$/;
492
+ var CODE_PART = /^([ \t]+)- it has an? (.+?)(?: at "([^"]*)")?(?:, named "([^"]*)")?(?:, tab "([^"]*)")?(?:, tagged "([^"]*)")?(?:, (old|new|mocked|built))?(?:, thumbnail "([^"]*)")?(?:, in row (\d+) column (\d+))?(?:, colou?red (\w+))?\s*$/;
476
493
  var SPELLX_CLOSES_ITSELF = /\s*\/>(\s*)$/;
477
494
  var ATTRIBUTE = /* @__PURE__ */ __name((word) => new RegExp(`\\b${word}="([^"]*)"`), "ATTRIBUTE");
478
495
  var PART_NAME = /^[\p{L}\p{N}][\p{L}\p{N} _-]*$/u;
@@ -124,6 +124,17 @@ var SiteWrites = class _SiteWrites {
124
124
  (text) => PageStories.withStories(text, name, stories)
125
125
  );
126
126
  }
127
+ /**
128
+ * The thumbnail on part `name`'s own page or view, from whichever of the project's files declares it.
129
+ * - None for a part another project declares: its site line has to say.
130
+ */
131
+ static thumbnailOf(name) {
132
+ for (const file of editor.project?.files ?? []) {
133
+ const thumbnail = SiteEdits.thumbnailOf(file.contents ?? "", name);
134
+ if (thumbnail) return thumbnail;
135
+ }
136
+ return void 0;
137
+ }
127
138
  /** The project's file declaring page `name`: the site's own, else another of its files; none for an imported page. */
128
139
  static declaringFile(name) {
129
140
  const files = editor.project?.files ?? [];
@@ -35,6 +35,7 @@ function runApp(compiled, { appRoot, layout, siteHost, ...options }) {
35
35
  if (appRoot) core.appRoot = appRoot;
36
36
  core.appLayout = !!layout;
37
37
  core.siteHost = siteHost;
38
+ core.projectFolder = options.projectId ? `/spaces/${encodeURI(options.projectId)}` : void 0;
38
39
  return runCompiled(compiled, options);
39
40
  }
40
41
  __name(runApp, "runApp");
@@ -18,6 +18,7 @@ import { PersonCommands } from "../command/PersonCommands.js";
18
18
  import { PluginInstall } from "../command/PluginInstall.js";
19
19
  import { SkillsCheck } from "../command/SkillsCheck.js";
20
20
  import { RepoInit } from "../command/RepoInit.js";
21
+ import { PullRequest } from "../command/PullRequest.js";
21
22
  import { Repos } from "../command/Repos.js";
22
23
  import { Requests } from "../command/Requests.js";
23
24
  import { Sessions } from "../command/Sessions.js";
@@ -81,6 +82,9 @@ var EpicProgram = class _EpicProgram {
81
82
  requests(epic.command("merge")).description(
82
83
  "a standing epic's phase onto main at once, fast-forward only; run in the main checkout; a stray snapshot or generated file there is moved aside first, and --ditch moves up to 3 others too, once you say so"
83
84
  ).usage("<epic> [--ditch]").addHelpText("after", example("epic merge epic-workflow"));
85
+ this.verb(epic.command("pr"), (args) => new PullRequest().run(args)).description(
86
+ "push a branch (never forced) and open its pull request against the base branch, a merge request on GitLab; if one's open, says its address and that the push updated it"
87
+ ).usage("<name> [--title <title>] [--body-file <file>]").addHelpText("after", example("epic pr seo --title 'Better titles' --body-file notes.md"));
84
88
  }
85
89
  ////////////////
86
90
  // ## Epic page: making and reading
@@ -445,9 +449,9 @@ var EpicProgram = class _EpicProgram {
445
449
  "the VOICE a kind of page is written in (readme, code ...): its file, for a skill to read; or every voice"
446
450
  ).usage("[<name> | --for <kind>] [--json]").addHelpText("after", VOICE_HELP);
447
451
  this.verb(epic.command("init"), (args) => new RepoInit().run(args)).description(
448
- "set this repo up for epics, the one command to start (npx spell@next epic init): the plugin, its .epic/config.json5, the epic repo beside it (made, or cloned from the team's), shared on GitHub, the links and their .gitignore lines, your name and colour, then the epic server; safe to run again"
452
+ "set this repo up for epics, the one command to start (npx spell@next epic init): the plugin, its .epic/config.json5, the epic repo beside it (made, or cloned from the team's), shared on GitHub or GitLab, the links and their .gitignore lines, your name and colour, then the epic server; safe to run again"
449
453
  ).usage(
450
- "[--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public] [--protected-base] [--no-plugin] [--no-commit] [--no-server] [--dry-run] [--json]"
454
+ "[--name <name>] [--color <colour>] [--content-repo <name> | --remote <address> | --no-remote] [--public] [--host github|gitlab] [--protected-base] [--no-plugin] [--no-commit] [--no-server] [--dry-run] [--json]"
451
455
  ).addHelpText("after", INIT_HELP);
452
456
  this.verb(epic.command("whoami"), (args) => new PersonCommands().whoami(args)).description(
453
457
  "who you are on the epics: your short name (kept, else your GitHub login, else git's user.name), your full name and GitHub login; with a name, keeps it; --rename also writes it over the old one on every page"
@@ -873,10 +877,10 @@ From any folder of the repo (a worktree's too), each step skipped when it's done
873
877
  window names from the repo's; a file already there is kept
874
878
  ../<repo>.epics the epic repo, a git repo of its own: epics/, sagas/, guides/, pages/;
875
879
  cloned instead, when the config names the team's (contentRemote) and it isn't here
876
- the epic repo the epic repo on GitHub, so the team shares the plans: asks what to call it
880
+ the epic repo the epic repo on GitHub or GitLab, so the team shares the plans: asks what to call it
877
881
  (<repo>.epics) and "Private or public?" (private), makes it, pushes, and writes its
878
- address in the config (contentRemote); needs GitHub's command, gh, logged in: without
879
- it, says how to get it
882
+ address in the config (contentRemote); needs the host's command (gh, glab), logged in:
883
+ without it, says how to get it
880
884
  the links each of those folders linked in at the checkout's root
881
885
  .gitignore the links listed between # shared:start and # shared:end
882
886
  your name "What do you want to be called?" (--name), kept in ~/.spell-epic/person.json5
@@ -895,7 +899,12 @@ Then push the base branch: a teammate's epic init then clones the plans.
895
899
  A public one shows everything in the plans (epic pages, guides, comments) to anyone.
896
900
 
897
901
  --protected-base: the base branch takes only pull requests (baseBranchProtected in the config). Without it,
898
- epic init asks GitHub, with gh logged in and a GitHub remote, and says in one line when it found so.
902
+ epic init asks GitHub or GitLab, with its command (gh, glab) logged in and a remote there, and says in one line when
903
+ it found so.
904
+
905
+ --host github|gitlab: where the code is hosted (codeHost in the config). Left out, it's read off the origin
906
+ remote's address; for an address that doesn't say (git.acme.com), epic init asks in a terminal, and with no
907
+ terminal stays on GitHub and says so.
899
908
 
900
909
  --name <name> is the name you go by on the epics, kept in ~/.spell-epic/person.json5 (epic whoami);
901
910
  without it, epic init asks in a terminal, suggesting your GitHub login (else git's user.name), and takes that
@@ -1242,9 +1242,14 @@ var VERB_FLAGS = {
1242
1242
  "--no-commit": "don't commit .epic/config.json5 and .gitignore on the base branch",
1243
1243
  "--protected-base": "the base branch takes only pull requests: put the two files on a new branch, epic-setup, and open one",
1244
1244
  "--no-server": "don't start the epic server",
1245
+ "--host <github|gitlab>": "where the code is hosted, for an address that doesn't say",
1245
1246
  "--dry-run": "only say what it would do",
1246
1247
  "--json": "print what it did as JSON"
1247
1248
  },
1249
+ pr: {
1250
+ "--title <title>": "the request's title (default: its one commit's subject, else the branch's name)",
1251
+ "--body-file <file>": "the request's description, from a file"
1252
+ },
1248
1253
  whoami: {
1249
1254
  "--rename": "keep the name, and write it over your old one wherever it says who wrote something",
1250
1255
  "--dry-run": "with --rename: only say what it would change",
@@ -31,7 +31,7 @@ var BaseBranch = class {
31
31
  if (ahead !== "0")
32
32
  return behind === "0" ? {
33
33
  action: "ahead",
34
- line: `local ${base} is ${ahead} commit(s) ahead of origin's, which only a pull request can bring there`
34
+ line: `local ${base} is ${ahead} commit(s) ahead of origin's, which only a pull or merge request can bring there`
35
35
  } : {
36
36
  action: "diverged",
37
37
  line: `local ${base} and origin's have diverged (${ahead} commit(s) only here): going on from local ${base}`
@@ -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
+ };