@feltdb/feltkit 0.3.20 → 0.3.22

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.
@@ -102,13 +102,31 @@ export declare class Cancelled extends Error {
102
102
  export declare function terminalPrompter(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): Prompter & {
103
103
  close(): void;
104
104
  };
105
+ /** "a" or "an" for a word the developer chose: the workspace noun is theirs, so "a acme" is their word, mis-articled. */
106
+ export declare const article: (word: string) => string;
105
107
  export declare function defaultAnswers(dir: string, name: string): Answers;
106
108
  type Section = "basics" | "kind" | "participants" | "capabilities" | "details" | "data";
107
109
  /**
108
110
  * Ask, section by section, adapting to earlier answers. Returns the answers, or throws Cancelled.
109
111
  * `sections` limits a pass to what the developer wants to change (the review loop).
110
112
  */
111
- export declare function interview(io: Prompter, start: Answers, sections?: readonly Section[]): Promise<Answers>;
113
+ /**
114
+ * Asks what the composition needs.
115
+ *
116
+ * `brief` is the first pass: it asks what shapes the application — its name, its kind, who the data belongs to, who
117
+ * uses it, which capabilities, the one account setting that has no default, and the entities — and leaves every
118
+ * other setting at the value it would have suggested anyway. The review then offers them, section by section, to
119
+ * anyone who wants them, and a re-ask is never brief.
120
+ *
121
+ * The first pass used to put around twenty questions between a developer and an application, most of them
122
+ * configuration with a perfectly good default: what a workspace is called, the role list, who manages members, who
123
+ * may create one, typed claims, a file size limit, notification type names, workflows, and a list of things that
124
+ * are not composable at all and are only recorded as text. Each one read as a decision that had to be made before
125
+ * anything could exist. They are decisions better made against something that does.
126
+ */
127
+ export declare function interview(io: Prompter, start: Answers, sections?: readonly Section[], { brief }?: {
128
+ brief?: boolean;
129
+ }): Promise<Answers>;
112
130
  /** The composition request the answers translate to: the inputs `feltkit compose` records. */
113
131
  export declare function compositionInputs(a: Answers): {
114
132
  profile: string;
@@ -25,6 +25,7 @@ import { FeltKitError } from "../errors.js";
25
25
  import { compose, parseParams } from "./compose.js";
26
26
  import { DomainError, PERMISSIONS, creationOrder, managingRoles, parseClaims, parseFields, parseRelations, parseRequire, parseUnique, renderApi, renderCollection, renderDomainTests, renderEntityModule, renderFilesTests, renderFoundationTests, validateEntities } from "./domain.js";
27
27
  import { c, line, setOutput, symbols } from "./output.js";
28
+ import { renderScreens } from "./screens.js";
28
29
  import { INDIVIDUAL_APP_SHELL } from "./shell.js";
29
30
  /** `workspaces`: the kind's data belongs to organizations people join (the default answer); `individuals`: to each person. */
30
31
  export const APP_KINDS = [
@@ -180,6 +181,8 @@ export function terminalPrompter(input = process.stdin, output = process.stdout)
180
181
  const NAME = /^[a-z][a-z0-9-]{0,62}$/;
181
182
  const IDENT = /^[a-z][a-zA-Z0-9]{0,40}$/;
182
183
  const PERMISSION = /^[a-z][a-zA-Z0-9]*(\.[a-zA-Z0-9*]+)+$/;
184
+ /** "a" or "an" for a word the developer chose: the workspace noun is theirs, so "a acme" is their word, mis-articled. */
185
+ export const article = (word) => (/^[aeiou]/i.test(word) ? "an" : "a");
183
186
  const guideFor = (id) => CAPABILITY_GUIDE.find((g) => g.id === id);
184
187
  const isCapability = (id) => CATALOG.has(id);
185
188
  export function defaultAnswers(dir, name) {
@@ -189,7 +192,21 @@ export function defaultAnswers(dir, name) {
189
192
  * Ask, section by section, adapting to earlier answers. Returns the answers, or throws Cancelled.
190
193
  * `sections` limits a pass to what the developer wants to change (the review loop).
191
194
  */
192
- export async function interview(io, start, sections = ["basics", "kind", "participants", "capabilities", "details", "data"]) {
195
+ /**
196
+ * Asks what the composition needs.
197
+ *
198
+ * `brief` is the first pass: it asks what shapes the application — its name, its kind, who the data belongs to, who
199
+ * uses it, which capabilities, the one account setting that has no default, and the entities — and leaves every
200
+ * other setting at the value it would have suggested anyway. The review then offers them, section by section, to
201
+ * anyone who wants them, and a re-ask is never brief.
202
+ *
203
+ * The first pass used to put around twenty questions between a developer and an application, most of them
204
+ * configuration with a perfectly good default: what a workspace is called, the role list, who manages members, who
205
+ * may create one, typed claims, a file size limit, notification type names, workflows, and a list of things that
206
+ * are not composable at all and are only recorded as text. Each one read as a decision that had to be made before
207
+ * anything could exist. They are decisions better made against something that does.
208
+ */
209
+ export async function interview(io, start, sections = ["basics", "kind", "participants", "capabilities", "details", "data"], { brief = false } = {}) {
193
210
  const a = { ...start, participants: [...start.participants], include: [...start.include], params: JSON.parse(JSON.stringify(start.params)), entities: [...start.entities], workflows: [...start.workflows], notComposable: [...start.notComposable], agentPermissions: [...start.agentPermissions], roles: [...start.roles], managers: [...start.managers] };
194
211
  const param = (cap, key) => a.params[cap]?.[key];
195
212
  const setParam = (cap, key, value) => {
@@ -264,14 +281,35 @@ export async function interview(io, start, sections = ["basics", "kind", "partic
264
281
  io.say(c.dim(` Offered, though usually for other participants: ${unusual.map((g) => `${g.label} (for ${g.offeredFor.join(", ")})`).join("; ")}.`));
265
282
  if (notInProfile.length)
266
283
  io.say(c.dim(` Not part of the ${profile.id} foundation: ${notInProfile.map((g) => g.label).join("; ")}.`));
267
- a.notComposable = await io.multi("Anything else it needs? These are not composable yet; they are recorded as work the application owns, with what the SDK offers instead.", NOT_COMPOSABLE.map((n) => ({ value: n.id, label: n.label, hint: n.status })), { default: a.notComposable });
284
+ if (!brief)
285
+ a.notComposable = await io.multi("Anything else it needs? These are not composable yet; they are recorded as work the application owns, with what the SDK offers instead.", NOT_COMPOSABLE.map((n) => ({ value: n.id, label: n.label, hint: n.status })), { default: a.notComposable });
268
286
  }
269
287
  if (sections.includes("details")) {
270
288
  // Accounts (required by both profiles). With workspaces the sender is required (invitations are e-mailed); without, it is optional.
271
289
  if (a.tenancy === "workspaces") {
272
290
  setParam("identity.accounts", "emailFrom", await io.text("Sender address for account e-mail (verification, sign-in links, invitations)", { default: param("identity.accounts", "emailFrom"), required: true, validate: (v) => (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? null : "An e-mail address, like auth@example.com.") }));
273
- setParam("identity.accounts", "magicLink", await io.confirm("E-mailed sign-in links (with a code) besides passwords?", param("identity.accounts", "magicLink") ?? true));
274
- setParam("identity.accounts", "signUp", (await io.choose("Who may create an account?", [{ value: "open", label: "Anyone (open sign-up)" }, { value: "invited", label: "Only people who were invited" }], { default: param("identity.accounts", "signUp") === false ? "invited" : "open" })) === "open");
291
+ if (brief) {
292
+ // The sender is the one account setting with no default the resolver accepts. The rest keep theirs.
293
+ setParam("identity.accounts", "magicLink", param("identity.accounts", "magicLink") ?? true);
294
+ setParam("identity.accounts", "signUp", param("identity.accounts", "signUp") !== false);
295
+ }
296
+ else {
297
+ setParam("identity.accounts", "magicLink", await io.confirm("E-mailed sign-in links (with a code) besides passwords?", param("identity.accounts", "magicLink") ?? true));
298
+ setParam("identity.accounts", "signUp", (await io.choose("Who may create an account?", [{ value: "open", label: "Anyone (open sign-up)" }, { value: "invited", label: "Only people who were invited" }], { default: param("identity.accounts", "signUp") === false ? "invited" : "open" })) === "open");
299
+ }
300
+ }
301
+ else if (brief) {
302
+ // No account e-mail unless asked for: the individual-accounts profile does not require a sender, and sign-up
303
+ // is open because nothing else would create an account.
304
+ setParam("identity.accounts", "emailFrom", param("identity.accounts", "emailFrom") ?? null);
305
+ setParam("identity.accounts", "magicLink", false);
306
+ setParam("identity.accounts", "signUp", true);
307
+ setParam("identity.accounts", "baseRole", param("identity.accounts", "baseRole") ?? "person");
308
+ if (!a.roles.length)
309
+ a.roles = [...suggestedAppRoles(a.participants)];
310
+ a.managers = a.managers.filter((r) => a.roles.includes(r));
311
+ if (!a.managers.length && a.roles.length)
312
+ a.managers = [a.roles[0]];
275
313
  }
276
314
  else {
277
315
  const sender = await io.text("Sender address for account e-mail (verification, password reset, sign-in links); empty for none", { default: param("identity.accounts", "emailFrom") || undefined, validate: (v) => (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v) ? null : "An e-mail address, like auth@example.com.") });
@@ -289,17 +327,17 @@ export async function interview(io, start, sections = ["basics", "kind", "partic
289
327
  // Workspaces (required by the collaborative-workspace profile): noun, roles, managers, creation.
290
328
  if (a.tenancy === "workspaces") {
291
329
  const nounDefault = param("workspace.tenancy", "noun") ?? (a.kind === "business" || a.kind === "operations" ? "organization" : a.kind === "portal" ? "account" : a.kind === "marketplace" ? "store" : "workspace");
292
- setParam("workspace.tenancy", "noun", await io.text("What is a workspace called in your application? (workspace, organization, team, account, store…)", { default: nounDefault, required: true, validate: (v) => (IDENT.test(v) ? null : "A single lower-case word.") }));
330
+ setParam("workspace.tenancy", "noun", brief ? nounDefault : await io.text("What is a workspace called in your application? (workspace, organization, team, account, store…)", { default: nounDefault, required: true, validate: (v) => (IDENT.test(v) ? null : "A single lower-case word.") }));
293
331
  const roleDefault = param("workspace.tenancy", "roles") ?? suggestedRoles(a.participants);
294
- const rolesText = await io.text("Member roles, highest first (comma-separated). The first holds every workspace permission.", { default: roleDefault.join(", "), required: true, validate: (v) => (v.split(",").map((r) => r.trim()).every((r) => IDENT.test(r)) ? null : "Lower-case words, comma-separated.") });
332
+ const rolesText = brief ? roleDefault.join(", ") : await io.text("Member roles, highest first (comma-separated). The first holds every workspace permission.", { default: roleDefault.join(", "), required: true, validate: (v) => (v.split(",").map((r) => r.trim()).every((r) => IDENT.test(r)) ? null : "Lower-case words, comma-separated.") });
295
333
  const roles = [...new Set(rolesText.split(",").map((r) => r.trim()).filter(Boolean))];
296
334
  setParam("workspace.tenancy", "roles", roles);
297
335
  const managerDefault = (param("workspace.tenancy", "managers") ?? roles.filter((r) => r === "admin")).filter((r) => roles.includes(r) && r !== roles[0]);
298
- const managers = roles.length > 1 ? await io.multi(`Which roles manage members (invite, change roles, remove) without being the ${roles[0]}?`, roles.slice(1).map((r) => ({ value: r, label: r })), { default: managerDefault }) : [];
336
+ const managers = roles.length > 1 ? (brief ? managerDefault : await io.multi(`Which roles manage members (invite, change roles, remove) without being the ${roles[0]}?`, roles.slice(1).map((r) => ({ value: r, label: r })), { default: managerDefault })) : [];
299
337
  setParam("workspace.tenancy", "managers", managers);
300
- setParam("workspace.tenancy", "create", (await io.choose(`Who may create a ${param("workspace.tenancy", "noun")}?`, [{ value: "anyone", label: "Anyone signed in" }, { value: "none", label: "Nobody through the application (you create them another way)" }], { default: param("workspace.tenancy", "create") ?? "anyone" })));
338
+ setParam("workspace.tenancy", "create", brief ? (param("workspace.tenancy", "create") ?? "anyone") : (await io.choose(`Who may create ${article(String(param("workspace.tenancy", "noun")))} ${param("workspace.tenancy", "noun")}?`, [{ value: "anyone", label: "Anyone signed in" }, { value: "none", label: "Nobody through the application (you create them another way)" }], { default: param("workspace.tenancy", "create") ?? "anyone" })));
301
339
  const existingClaims = param("workspace.tenancy", "claims") ?? {};
302
- const claimsText = await io.text(`Typed claims each membership carries beside its role: name:type, comma-separated (string, number, integer, boolean, enum(a|b); =value sets a default); empty for none`, { default: Object.entries(existingClaims).map(([n, s]) => `${n}:${s.type === "enum" ? `enum(${s.values.join("|")})` : s.type}${s.default !== undefined ? `=${String(s.default)}` : ""}`).join(", ") || undefined, validate: (v) => { try {
340
+ const claimsText = brief ? "" : await io.text(`Typed claims each membership carries beside its role: name:type, comma-separated (string, number, integer, boolean, enum(a|b); =value sets a default); empty for none`, { default: Object.entries(existingClaims).map(([n, s]) => `${n}:${s.type === "enum" ? `enum(${s.values.join("|")})` : s.type}${s.default !== undefined ? `=${String(s.default)}` : ""}`).join(", ") || undefined, validate: (v) => { try {
303
341
  parseClaims(v);
304
342
  return null;
305
343
  }
@@ -309,21 +347,24 @@ export async function interview(io, start, sections = ["basics", "kind", "partic
309
347
  const claims = parseClaims(claimsText);
310
348
  if (Object.keys(claims).length) {
311
349
  setParam("workspace.tenancy", "claims", claims);
312
- io.say(c.dim(` Claims are set per member through the server (an invitation, or POST /api/tenants/current/members/claims by a member manager), validated on write and checked on every call; a request never supplies one. Entities may require one in a moment.`));
350
+ // Where the gate is asked depends on when this section ran. In the first pass the entities come next; in a
351
+ // re-ask from the review they already exist, and gating one on a claim that has only just been declared is
352
+ // the data section's question, so the developer is told where it is rather than left to find it.
353
+ io.say(c.dim(` Claims are set per member through the server (an invitation, or POST /api/tenants/current/members/claims by a member manager), validated on write and checked on every call; a request never supplies one. ${a.entities.length ? 'To require one on an entity, choose "Change the data and workflows" next.' : "Entities may require one in a moment."}`));
313
354
  }
314
355
  else if (a.params["workspace.tenancy"])
315
356
  delete a.params["workspace.tenancy"].claims;
316
- io.say(c.dim(` Data isolation: collections you mark { tenant: true } are scoped to the current ${param("workspace.tenancy", "noun")}; you choose per entity in a moment.`));
357
+ io.say(c.dim(` Data isolation: collections you mark { tenant: true } are scoped to the current ${param("workspace.tenancy", "noun")}; you choose per entity ${a.entities.length ? "under the data section" : "in a moment"}.`));
317
358
  }
318
359
  // Optional capabilities' parameters.
319
360
  if (a.include.includes("services.files")) {
320
- const max = await io.text("Largest file, in MiB (empty keeps FeltKit's default of 1)", { default: param("services.files", "maxBytes") ? String(Number(param("services.files", "maxBytes")) / 1048576) : undefined, validate: (v) => (Number(v) > 0 ? null : "A positive number of MiB.") });
361
+ const max = brief ? "" : await io.text("Largest file, in MiB (empty keeps FeltKit's default of 1)", { default: param("services.files", "maxBytes") ? String(Number(param("services.files", "maxBytes")) / 1048576) : undefined, validate: (v) => (Number(v) > 0 ? null : "A positive number of MiB.") });
321
362
  if (max)
322
363
  setParam("services.files", "maxBytes", Math.round(Number(max) * 1048576));
323
364
  io.say(c.dim(" Who may read which files, and what they attach to, is yours (permissions files.read / files.write on your roles)."));
324
365
  }
325
366
  if (a.include.includes("services.notifications")) {
326
- const types = await io.text("Notification types, comma-separated (empty for untyped)", { default: (param("services.notifications", "types") ?? []).join(", ") || undefined });
367
+ const types = brief ? (param("services.notifications", "types") ?? []).join(", ") : await io.text("Notification types, comma-separated (empty for untyped)", { default: (param("services.notifications", "types") ?? []).join(", ") || undefined });
327
368
  setParam("services.notifications", "types", types.split(",").map((t) => t.trim()).filter(Boolean));
328
369
  }
329
370
  if (a.include.includes("services.jobs"))
@@ -331,18 +372,27 @@ export async function interview(io, start, sections = ["basics", "kind", "partic
331
372
  if (a.include.includes("services.schedules"))
332
373
  io.say(c.dim(" Scheduled work runs jobs on a schedule; the schedules are yours to declare."));
333
374
  if (a.include.includes("agents.membership")) {
334
- setParam("agents.membership", "role", await io.text("Name of the agent role", { default: param("agents.membership", "role") ?? "agent", required: true, validate: (v) => (IDENT.test(v) ? null : "A lower-case word.") }));
335
- const perms = await io.text("What may agents do? Permissions, comma-separated (e.g. notes.read, notes.create); empty for nothing yet", { default: a.agentPermissions.join(", ") || undefined, validate: (v) => (v.split(",").map((p) => p.trim()).filter(Boolean).every((p) => PERMISSION.test(p)) ? null : "Permissions like entity.action or entity.*") });
375
+ setParam("agents.membership", "role", brief ? (param("agents.membership", "role") ?? "agent") : await io.text("Name of the agent role", { default: param("agents.membership", "role") ?? "agent", required: true, validate: (v) => (IDENT.test(v) ? null : "A lower-case word.") }));
376
+ const perms = brief ? a.agentPermissions.join(", ") : await io.text("What may agents do? Permissions, comma-separated (e.g. notes.read, notes.create); empty for nothing yet", { default: a.agentPermissions.join(", ") || undefined, validate: (v) => (v.split(",").map((p) => p.trim()).filter(Boolean).every((p) => PERMISSION.test(p)) ? null : "Permissions like entity.action or entity.*") });
336
377
  a.agentPermissions = perms.split(",").map((p) => p.trim()).filter(Boolean);
337
378
  }
338
379
  if (a.include.includes("ops.operator"))
339
- setParam("ops.operator", "role", await io.text("Name of the operator role", { default: param("ops.operator", "role") ?? "operator", required: true, validate: (v) => (IDENT.test(v) ? null : "A lower-case word.") }));
380
+ setParam("ops.operator", "role", brief ? (param("ops.operator", "role") ?? "operator") : await io.text("Name of the operator role", { default: param("ops.operator", "role") ?? "operator", required: true, validate: (v) => (IDENT.test(v) ? null : "A lower-case word.") }));
340
381
  }
341
382
  if (sections.includes("data")) {
342
383
  const noun = param("workspace.tenancy", "noun") ?? "workspace";
343
384
  const base = param("identity.accounts", "baseRole") ?? "person";
344
385
  const names = await io.text("What business information does it manage? Entity names, comma-separated (e.g. notes, projects, invoices); empty for none yet", { default: a.entities.map((e) => e.name).join(", ") || undefined, validate: (v) => (v.split(",").map((e) => e.trim()).filter(Boolean).every((e) => IDENT.test(e)) ? null : "Lower-case names like notes, projects.") });
345
386
  const entityNames = [...new Set(names.split(",").map((e) => e.trim()).filter(Boolean))];
387
+ // Entities are where an application's own functionality comes from: each becomes a collection and its
388
+ // list/get/create/update/remove functions, and those functions are what the AppPort capabilities and the Studio
389
+ // screens are built from. Naming none is allowed and sometimes right, but it produced an application with no
390
+ // collections, no functions and no capabilities while the review said so only in passing, so it is said here,
391
+ // at the moment the answer is given.
392
+ if (entityNames.length === 0) {
393
+ io.say(c.dim(" No entities: the application will have no collections, no functions and no AppPort capabilities."));
394
+ io.say(c.dim(" The foundation (accounts, sign-in, roles and the rest) still works; you add entities later with `feltkit compose` or by hand."));
395
+ }
346
396
  const entities = [];
347
397
  for (const name of entityNames) {
348
398
  const previous = a.entities.find((e) => e.name === name);
@@ -403,7 +453,7 @@ export async function interview(io, start, sections = ["basics", "kind", "partic
403
453
  return interview(io, { ...a, entities }, ["data"]);
404
454
  }
405
455
  a.entities = entities;
406
- const workflows = await io.text("Important workflows it should support, comma-separated (recorded as application work; empty for none)", { default: a.workflows.join(", ") || undefined });
456
+ const workflows = brief ? a.workflows.join(", ") : await io.text("Important workflows it should support, comma-separated (recorded as application work; empty for none)", { default: a.workflows.join(", ") || undefined });
407
457
  a.workflows = workflows.split(",").map((w) => w.trim()).filter(Boolean);
408
458
  }
409
459
  return a;
@@ -612,12 +662,16 @@ export function renderPreview(a, p) {
612
662
  if (g)
613
663
  out.push(c.dim(` constraints: ${g.constraints}. yours: ${g.applicationOwned}.`));
614
664
  }
615
- if (a.tenancy === "workspaces")
616
- out.push(`Identity and authority: accounts${r.options.auth?.accounts?.magicLink ? " with sign-in links" : ""}${r.options.auth?.accounts?.signUp === false ? ", invitation-only sign-up" : ", open sign-up"}; a ${noun} per group with roles ${(r.options.auth?.tenant?.roles ?? []).join(" > ")}${r.options.auth?.tenant?.create === "none" ? `; ${noun}s are not created through the application` : ""}.`);
617
- const declaredClaims = (a.tenancy === "workspaces" ? r.options.auth?.tenant?.claims : undefined) ?? {};
618
- if (Object.keys(declaredClaims).length) {
619
- out.push(`Membership claims (typed, set through the server, checked at the boundary on every call; never a request field): ${Object.entries(declaredClaims).map(([n, s]) => `${n}: ${s.type === "enum" ? s.values.join(" | ") : s.type}${s.default !== undefined ? ` (default ${JSON.stringify(s.default)})` : ""}`).join("; ")}.`);
620
- out.push(c.dim(` Set by an invitation's claims or POST /api/tenants/current/members/claims (tenant.members.manage); a value the declaration no longer accepts is withheld until set again. No Studio screen edits claims yet.`));
665
+ // One identity line, chosen by the foundation. The individuals line used to be the `else` of the *claims* check
666
+ // below rather than of this one, so a workspace application that declared no claims printed both, and the second
667
+ // contradicted the first by saying it had no workspaces at all.
668
+ if (a.tenancy === "workspaces") {
669
+ out.push(`Identity and authority: accounts${r.options.auth?.accounts?.magicLink ? " with sign-in links" : ""}${r.options.auth?.accounts?.signUp === false ? ", invitation-only sign-up" : ", open sign-up"}; ${article(noun)} ${noun} per group with roles ${(r.options.auth?.tenant?.roles ?? []).join(" > ")}${r.options.auth?.tenant?.create === "none" ? `; ${noun}s are not created through the application` : ""}.`);
670
+ const declaredClaims = (r.options.auth?.tenant?.claims ?? {});
671
+ if (Object.keys(declaredClaims).length) {
672
+ out.push(`Membership claims (typed, set through the server, checked at the boundary on every call; never a request field): ${Object.entries(declaredClaims).map(([n, s]) => `${n}: ${s.type === "enum" ? s.values.join(" | ") : s.type}${s.default !== undefined ? ` (default ${JSON.stringify(s.default)})` : ""}`).join("; ")}.`);
673
+ out.push(c.dim(` Set by an invitation's claims or POST /api/tenants/current/members/claims (tenant.members.manage); a value the declaration no longer accepts is withheld until set again. No Studio screen edits claims yet.`));
674
+ }
621
675
  }
622
676
  else
623
677
  out.push(`Identity and authority: accounts${r.options.auth?.accounts?.magicLink ? " with sign-in links" : ""}, open sign-up${r.options.auth?.accounts?.email ? "" : ", no account e-mail (no verification or reset mail)"}; every account holds ${(r.options.auth?.accounts?.roles ?? []).join(", ")}${a.roles.length ? `; application roles ${a.roles.join(" > ")} held by accounts${a.managers.length ? ` (${a.managers.join(", ")} manage shared data)` : ""}` : ""}; no workspaces, memberships or invitations.`);
@@ -745,6 +799,9 @@ export async function createApplication(a, p) {
745
799
  writeFileSync(join(dir, "feltkit/app.ts"), renderAppModule(a, p));
746
800
  const accounts = p.result.resolved.capabilities.find((x) => x.id === "identity.accounts")?.params ?? {};
747
801
  writeFileSync(join(dir, "feltkit/_generated/api.ts"), renderApi(creationOrder(a.entities).map((e) => e.name)));
802
+ // The screens for the entities, beside the API they call. src/App.tsx renders <DataScreens /> where the
803
+ // developer's own screens will go, so a composed application shows its own data the first time it is run.
804
+ writeFileSync(join(dir, "feltkit/_generated/screens.tsx"), renderScreens(creationOrder(a.entities), a.tenancy));
748
805
  if (a.tenancy === "workspaces") {
749
806
  // The workspace's noun, roles and managers as the resolver settled them (defaults included): the one source for the modules and tests.
750
807
  const tenancy = p.result.resolved.capabilities.find((x) => x.id === "workspace.tenancy")?.params ?? {};
@@ -1067,7 +1124,8 @@ export async function createCommand(o) {
1067
1124
  start.entities = answersFromOptions({ ...o, yes: true, dir: o.dir ?? "x", tenancy: start.tenancy, params: o.params.length ? o.params : ["identity.accounts.emailFrom=placeholder@example.com"] }).entities;
1068
1125
  if (!o.dir)
1069
1126
  start.dir = await io.text("Directory to create", { default: start.name, required: true });
1070
- answers = await interview(io, start);
1127
+ // The first pass is brief; a re-ask from the review below asks its section in full.
1128
+ answers = await interview(io, start, undefined, { brief: true });
1071
1129
  answers.dir = start.dir;
1072
1130
  }
1073
1131
  // Review, change, confirm.
@@ -1094,7 +1152,7 @@ export async function createCommand(o) {
1094
1152
  { value: "kind", label: "Change the application type" },
1095
1153
  { value: "participants", label: "Change who uses it" },
1096
1154
  { value: "capabilities", label: "Change the capabilities" },
1097
- { value: "details", label: "Change accounts, roles, workspaces or capability details" },
1155
+ { value: "details", label: "Change accounts, roles, workspaces or capability details (at their defaults)" },
1098
1156
  { value: "data", label: "Change the data and workflows" },
1099
1157
  { value: "cancel", label: "Cancel (nothing is written)" },
1100
1158
  ], { default: p.result.ok ? "create" : "capabilities" });