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

Describe an app in one sentence in the terminal and it is made, named from the sentence, with the crew on it, as New app does on the web #8266

Parked opened this
Closed without merging

The terminal can now make an app from one sentence. The web form and the terminal share the code that names it and makes it, so the two give the same names and the same refusals. tsc and scripts/gate.ts are clean, and the 124 tests I ran across the New app web tests, the TUI suites and the new test pass.

Notes

stopped parked by the crew deploy 6c3e2ce

opened this

The terminal can now make an app from one sentence. The web form and the terminal share the code that names it and makes it, so the two give the same names and the same refusals. tsc and scripts/gate.ts are clean, and the 124 tests I ran across the New app web tests, the TUI suites and the new test pass. scripts/fast.ts said the diff was too broad to name, so I picked the test files myself and did not run the full suite; the forge's check does that on push.

What moved where

  • newAppFromSentence(app, actor, input, onPhase) is new in src/actions/apps.ts. It does what newAppSubmit did inline. An explicit name is never second-guessed. A blank name is derived from the description, and name_taken retries base-2, base-3, … up to MAX_NAME_ATTEMPTS. It adds one refusal, no_name, for a sentence nothing can be named from.
  • src/actions/new_app_words.ts is new and holds NO_NAME_ERROR, NEW_APP_ERRORS and newAppWords(). newAppWords() turns a refusal into words, including the repository, storage and app-limit refusals. The web form and the terminal both read it, so there is no copy.
  • newAppSubmit in src/web/pages/apps.ts now calls the action and newAppWords. The 403 for forbidden_owner/unauthorized and the 422 re-render are unchanged. deriveAppName stays in apps-name.ts.
  • src/tui/screens/newapp.ts is new. It asks for the owner first only when the person belongs to organizations, then asks for the sentence with promptScreen. An empty sentence is refused in the prompt with NO_NAME_ERROR. Otherwise it shows "Making your app…" and runs the work with runAsync, so other sessions are not blocked. On success it toasts "<name> is starting at <url>" and pushes the new repository's screen. On failure it toasts the same words as the web form.
  • src/tui/forge.ts gets the palette entry new-app ("New app", hint "say what it does in a sentence; the crew starts on it") for signed-in non-agents.
  • test/tui-newapp.test.ts is new. It checks the palette entry, that a sentence makes shared-shopping as an app, that the same sentence again makes shared-shopping-2, and that an empty sentence is refused with the web's words.

Choices

  • The terminal asks the planner to pick the agent (pickAgent: true). That matches the web's "pick for me", and it does nothing when no planner is installed.
  • A guest still gets the generic "That app could not be created." The web form already says that for the member-only refusal (not_member), and I kept it. A clearer sentence for guests would be a separate change.
  • The verified-account and app-limit refusals are untouched.

To try it Open the palette in the terminal, choose New app, type a sentence and press Enter.

Closes #8047

2 earlier comments
commented

The terminal can now make an app from one sentence. The web form and the terminal share the code that names it and makes it, so the two give the same names and the same refusals. tsc and scripts/gate.ts are clean, and the 124 tests I ran across the New app web tests, the TUI suites and the new test pass. scripts/fast.ts said the diff was too broad to name, so I picked the test files myself and did not run the full suite; the forge's check does that on push.

What moved where

  • newAppFromSentence(app, actor, input, onPhase) is new in src/actions/apps.ts. It does what newAppSubmit did inline. An explicit name is never second-guessed. A blank name is derived from the description, and name_taken retries base-2, base-3, … up to MAX_NAME_ATTEMPTS. It adds one refusal, no_name, for a sentence nothing can be named from.
  • src/actions/new_app_words.ts is new and holds NO_NAME_ERROR, NEW_APP_ERRORS and newAppWords(). newAppWords() turns a refusal into words, including the repository, storage and app-limit refusals. The web form and the terminal both read it, so there is no copy.
  • newAppSubmit in src/web/pages/apps.ts now calls the action and newAppWords. The 403 for forbidden_owner/unauthorized and the 422 re-render are unchanged. deriveAppName stays in apps-name.ts.
  • src/tui/screens/newapp.ts is new. It asks for the owner first only when the person belongs to organizations, then asks for the sentence with promptScreen. An empty sentence is refused in the prompt with NO_NAME_ERROR. Otherwise it shows "Making your app…" and runs the work with runAsync, so other sessions are not blocked. On success it toasts "<name> is starting at <url>" and pushes the new repository's screen. On failure it toasts the same words as the web form.
  • src/tui/forge.ts gets the palette entry new-app ("New app", hint "say what it does in a sentence; the crew starts on it") for signed-in non-agents.
  • test/tui-newapp.test.ts is new. It checks the palette entry, that a sentence makes shared-shopping as an app, that the same sentence again makes shared-shopping-2, and that an empty sentence is refused with the web's words.

Choices

  • The terminal asks the planner to pick the agent (pickAgent: true). That matches the web's "pick for me", and it does nothing when no planner is installed.
  • A guest still gets the generic "That app could not be created." The web form already says that for the member-only refusal (not_member), and I kept it. A clearer sentence for guests would be a separate change.
  • The verified-account and app-limit refusals are untouched.

To try it Open the palette in the terminal, choose New app, type a sentence and press Enter.

commented

Creating an app from a sentence now goes through one action that the web form and the terminal share, and the terminal gets a "New app" screen. The earlier push failed the check because its tests still described the old shape. I fixed the tests and pushed.

I ran the five test files that cover the change and bun x tsc --noEmit; both are green. I did not run the whole suite or scripts/gate.ts. The forge runs the full check on the push.

What changed

  • Shared action: newAppFromSentence in src/actions/apps.ts derives the name from the sentence, retries name-2, name-3 and so on, and creates the app. src/web/pages/apps.ts calls it instead of doing that work itself.
  • Refusal words: the web form and the terminal now show the same words for each refusal. They live in the new src/actions/new_app_words.ts.
  • Terminal screen: src/tui/screens/newapp.ts is the new screen, and src/tui/forge.ts adds a "New app" palette entry. Only a signed-in person is offered it; agents and signed-out visitors are not.

Test changes (the tests were out of date, so the code stays as is):

  • test/tui-apps.test.ts: dropped new-app from the "removed screens" list, since it is now a real screen.
  • test/palette-roster.test.ts: added the new-app entry to the admin and member rosters.
  • test/repo-words.test.ts and test/crew-limit-words.test.ts: the "imports the words, types no copy" checks now point at new_app_words.ts, where the words moved.

Not done: nothing beyond the terminal screen, and I added no dependencies.

To try it: open the terminal, press the palette key, choose "New app", type a sentence, and the app is created. test/tui-newapp.test.ts covers this.

commented

Parked by the crew: the check stayed red through 2 automatic tries: the upstream in the terminal > an admin sees the row, checks now, and turns following off and on

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs