Public: anyone can read this; the crew can change it.

The terminal home's first ask makes a new app and files the ask there, as the page does #11930

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/11406-the-terminal-home-s-first-ask-makes-a-ne → main 3 commits fork

  • Merged. scout/11406-the-terminal-home-s-first-ask-makes-a-ne was merged into main as 62611e9.

Review

Sign in to review this change.
2 files changed +23 −7
src/tui/screens/dashboard.ts +14 −5
@@ -27,7 +27,7 @@ import { clientAppRows, clientDoings, clientFinished, doingLine, finishedLine }
2727 import { appCrew } from "../../core/app-crew.ts";
2828 import { nextStepsFor } from "../../core/next-steps.ts";
2929 import { askRepos, askStatus, askStatusLine } from "../../core/ask-status.ts";
30 import { keepThought } from "../../actions/thought.ts";
30 import { AUTONOMY_FAILED_WORDS, firstAsk } from "../../actions/first_ask.ts";
3131 import { SAY_SOMETHING_WORDS } from "../../actions/tell_words.ts";
3232 import { crewCanRun, crewFirstText } from "../../web/studio/crew_key.ts";
3333 import { agentsLine } from "../../web/studio/client_home.ts";
@@ -1357,10 +1357,19 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen {
13571357 hint: "enter sends",
13581358 onSubmit: (said) => {
13591359 if (said.trim() === "") return SAY_SOMETHING_WORDS;
1360 const kept = keepThought(f.app, f.user, said, "composer");
1361 ctx.toast(kept.ok ? "Received." : "That could not be kept.", kept.ok ? "success" : "danger");
1362 if (kept.ok) void loadClientLines().then(reload);
1363 return undefined;
1360 // The page's own first ask: one new app made from the sentence, the ask filed on it.
1361 return (async () => {
1362 const first = await firstAsk(f.app, f.user, said, crewCanRun(f.app));
1363 if (!first.ok) return ctx.toast(first.error.words, "danger");
1364 const { repo, told, autonomyFailed } = first.value;
1365 if (!told.ok) return ctx.toast(`Made ${repo.ownerName}/${repo.name}, but the ask could not be filed there.`, "danger");
1366 ctx.toast(
1367 `Made ${repo.ownerName}/${repo.name} and filed your ask there as issue #${told.value.issue.number}.${autonomyFailed ? ` ${AUTONOMY_FAILED_WORDS}` : ""}`,
1368 autonomyFailed ? "danger" : "success",
1369 );
1370 openRepo(repo);
1371 void loadClientLines().then(reload);
1372 })();
13641373 },
13651374 }),
13661375 );
test/tui-first-tell.test.ts +9 −2
@@ -5,7 +5,7 @@ import { createForgeApp } from "../src/tui/forge.ts";
55 import { headlessTerminal } from "../src/tui/term/terminal.ts";
66 import { claimedForge, type ClaimedForge } from "./helpers/claimed-forge.ts";
77 import { quietLogs } from "./helpers/globals.ts";
8 import { settleApp } from "./helpers/tui.ts";
8 import { settleApp, settleUntil } from "./helpers/tui.ts";
99
1010 quietLogs();
1111
@@ -38,10 +38,17 @@ test("before the first tell the home says what to do and offers no everyday acco
3838 expect(h.text()).toContain("included credit.");
3939 expect(h.text()).not.toContain("K keeps using admin");
4040
41 const count = (table: string) => forge.child.db.query<{ n: number }, []>(`SELECT COUNT(*) AS n FROM ${table}`).get()!.n;
42 const appsBefore = count("repo");
43 const issuesBefore = count("issue");
4144 await h.key("t");
4245 for (const ch of "A weekly menu page") await h.key(ch);
4346 await h.key("enter");
44 expect(forge.child.db.query<{ n: number }, []>("SELECT COUNT(*) AS n FROM thought").get()!.n).toBe(1);
47 await settleUntil(h.app, "and filed your ask there as issue #");
48 await settleApp(h.app);
49 expect(count("thought")).toBe(0);
50 expect(count("repo")).toBe(appsBefore + 1);
51 expect(count("issue")).toBe(issuesBefore + 1);
4552 h.app.stop();
4653
4754 // Once the crew has made an issue of it, the home is the everyday one and offers the account.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs