Skip to content

fix: sweep round 5: compile before the first turn, readable KB and test output, --wait on documents, help that wraps and fits - #59

Open
Bradenream wants to merge 29 commits into
braden/sweep-r4from
braden/sweep-r5
Open

Bradenream wants to merge 29 commits into
braden/sweep-r4from
braden/sweep-r5

Conversation

@Bradenream

Copy link
Copy Markdown
Contributor

Stacked on #58. Fixes the CLI-owned issues from round 4 of the usability sweep: 14 of its 19 CLI-owned majors, plus 13 minors that several testers hit. Each fix is its own commit, with tests that fail without it. The numbers below are round-4 issue numbers.

Conversation

  • feat: add E2E tests (COR-13123) #1 A --text send that starts a conversation compiles the draft first. vf reads the user's conversation state: an empty stack, or a 404, means a new conversation. Before, only a launch did this, so the first message ran the old build and vf warned afterwards.
    • Not covered: an edit made mid-conversation. The API reports needsRecompile only after a turn, so that turn still runs the old build, then vf compiles and warns.
  • [Graphite MQ] Draft PR GROUP:spec_35a0a8 (PRs 13) #14 An --action type vf doesn't know is refused before sending: exit 2, with the known types and a "did you mean". Before, {"type":"bogus"} was sent and exited 0. --custom-action sends a custom type on purpose.
  • [Graphite MQ] Draft PR GROUP:spec_3f3909 (PRs 42) #49 send missing only its action keeps the flags you gave in its command line, and agent mode gets details.
  • [Graphite MQ] Draft PR GROUP:spec_c00243 (PRs 38) #47 The home prompt's flag menu for send leads with --text.

Output

Knowledge base

Home prompt and forms

Help

Tools and variables

Integration notes

For the API team (not in this PR)

  • Say whether the draft is stale before a turn, e.g. needsRecompile on environment get.
  • Reject a path request to a path that doesn't exist; today it returns 200 with an empty reply.
  • Default tool list to the agent's tools, and wire a function tool's inputs by name.
  • --synthesis=false still returns all-zero token accounting.

Testing

  • Per commit: build, gofmt, scripts/vet.sh, go test ./..., the TS suite (181 at the tip), and go.mod unchanged.
  • Round 5 of the usability sweep ran against a build of this branch merged with the other open PRs.

…irst

The first `--text` send of a new conversation ran the old build of the
draft, and vf said so only afterwards: "This turn ran an older build of the
draft". Five testers hit it right after an edit, and read the stale reply
as "my edit didn't work". `send --help` promised vf "compiles the draft
first when a conversation starts", but compileBeforeSend counted only a
launch action as a start, while a text message to a user ID with no
conversation starts one too: the runtime launches it itself.

Now a draft send that isn't a launch reads the user's conversation state
first. An empty stack, which the API returns for a user ID it hasn't met
and after a conversation ends, means the send starts a conversation, so vf
compiles before it, as it does for a launch. A 404 counts as no
conversation; a state vf can't read counts as one going, so the send goes
on as before. A launch still compiles without the read, and --no-compile
and the published version skip both.

A later turn still runs the build as it is: nothing in the API says before
a turn that the draft changed since the last compile (needsRecompile comes
only in a send's answer), so a mid-conversation edit is still caught
after the turn, compiled, and warned about.

`send --help` (its description and --no-compile) and the README now say
exactly this.
`--action '{"type":"bogus"}'` was sent. The action union has two forms
that take any type, a path request (a button's request) and a general
request, so the SDK read the bogus action as a path request and added
"label": "". The live API followed a path that isn't there, the reply was
empty, and vf exited 0. A typo such as "lauch" or "txet" looked like a
silent agent to a script or an agent.

Now send refuses an action whose type none of the union's forms names,
before any request, compile included: exit 2, invalid_flag_value, with the
types there are (launch, text, end, intent, event, action, message, file,
no-reply, dtmf, live-agent-handoff) and "Did you mean ...?" for a near
miss. Agent mode gets details[{field: action.type, flag: --action}]. The
same goes for a misspelt type that fits no form at all, such as
{"type":"txet","payload":"hi"}, which got only "it isn't any of the forms
--action takes", and for --body.

The catch-all forms are there on purpose, so two ways through stay: a
button's path-... type goes as given, and the new --custom-action flag
sends any other type as given, such as one a custom action step waits for.
Refusing rather than warning after the turn, because a script reads the
exit code, not stderr. The list is the SDK's own type constants, and a
test fails if the SDK gains a form with a type the list lacks.
`vf conversation send -p … -e main -u u1 -v draft` with no --text or
--action said "Say something: 'vf conversation send --text <message>'".
Copying that dropped the project, environment, user and version, and in
agent mode the error had no `details`. With -u missing as well, the same
command got the full line from missingflags.go, so the most common case
got the weaker hint. text.go's noMessage built its own explanation instead
of the shared one.

noMessage is gone, and a missing action now reaches explainMissingFlags
like any missing flag: "vf conversation send needs --text (or --action)",
"Pass it: 'vf conversation send --environment-alias main --project-id …
--user-id u1 --version-param draft --text <value>'", and in agent mode
details [{flag: --action, message: "required, or --text"}].

The send tests' runSend now renders an error the command didn't print, as
main does, so what they read is what a user sees.
Typing `conversation send ` in the home prompt led with --action,
"required · JSON value (one of: { type: string, payload: object, …",
and --text, what a newcomer needs, came last, under "↓ 3 more". The menu
put required flags first, and --action is required unless --text, which
stands in for it, is given; --text itself isn't marked required.

The menu now knows the stand-in pair (flagutil.StandIn). A flag that
stands in for a required one leads, marked required, as "or --action ·
The message to send…". The flag it stands for moves among the optional,
as "or --text · JSON value…", without its "[required, or --text]" marker.
Once either is on the line the other isn't offered, since send refuses
both together.
… indent

The pretty printer wrote an empty object or list on the line below its
key, at column 0, so `metadata:` was followed by a flush-left `{}` and
`resources:` by `[]`. A string with newlines in it (a knowledge-base
chunk, a system prompt in a run's logs) carried on at column 0 and broke
the layout of everything after it. An unchanged `environment diff` gave
three zero counts and an empty list, and nothing said in words that
there was nothing to publish.

An empty object or list now prints on its key's line (`metadata:  {}`),
and a multi-line string prints under its key, one step in, as a YAML
block scalar (`content:  |`). Pretty `environment diff` ends with "No
differences." when it found none; JSON, YAML, TOON, tables, --jq and
agent mode get the response alone. Round-4 sweep #2 (human-poweruser,
human-newcomer, human-kb, agent-ci).
`knowledge-base query` printed the response as it came: fifteen fields of
token accounting, then every chunk with its whole text, and the answer
last, "about 470 lines down" for one tester and at line 306 of 316 for
another. With --synthesis=false there is no answer, but the zero-valued
accounting printed anyway, in pretty output, TOON and tables.

Pretty output and TOON now give the answer, then its sources best first,
one line each with the document's name (its ID when it has none) and the
chunk's score. Each chunk's text and the token use show with
--show-debug, as `conversation send` shows its traces. An empty answer
says so. With --synthesis=false the chunks are the result: their text
shows, and the accounting doesn't, in tables either. JSON, YAML and
--jq still print the response as the API sent it. Round-4 sweep #3
(human-newcomer, human-kb, agent-builder).
YAML was encoded from the SDK's Go structs, which have json tags and no
yaml tags, so every key was the Go field name lowercased: `requestname`,
`goesto`, `hascredits`. A `yq '.events[].goesTo'` script got null. Times
were Go's (`…20:30:55Z` where JSON has `…20:30:55.000Z`), fields the API
never sent appeared as empty strings, and each level was indented four
spaces.

YAML is now encoded from the JSON -o json prints: the response body as
the API sent it, or the SDK's JSON for a result vf built. It goes through
YAML nodes, so keys keep JSON's order and numbers every digit, and a
string is quoted only where YAML would read it as something else. Two
spaces indent each level, with --include-headers too. Round-4 sweep #15
(human-poweruser).
Pretty `test run get` printed the run as it came: about 400 lines of
logs, the agent's whole system prompt and every tool's schema among them,
with `passed: true` and the check's reason at the very bottom. Its table
listed each log's type and not one word of the conversation: the user's
text is at payload.payload and the agent's at payload.payload.message,
where no column reached.

Pretty output now gives the verdict first (checks passed of the total,
each check's reason, why a run failed), the run's ID, credits and time,
then the turns as a chat reads, then a count of the other logs. The logs
show with --show-debug, the flag `conversation send` and
`knowledge-base query` use. Off a terminal a failed run reads "Failed:",
not "Error:". The table brings a message two containers down up to a
MESSAGE column. JSON, YAML, TOON and --jq print the run as sent.
Round-4 sweep #13 (human-poweruser, fix-verifier).
The TOON encoder returns its text with no final newline, and vf printed
it as it came. TOON is agent mode's default, so whatever came next ran
onto the result's last line: `echo EXIT=$?` gave
`workspaceID: VzElNm0wjLEXIT=0`, a `message: Project ... deleted.` ran
into the next command's output, the error envelope on stderr began on
the result's last line (`waitedSeconds: 0{`), and `vf ... | while read
line` dropped the last line altogether.

Both TOON prints (a result, and a result with --include-headers) now end
with one newline, as JSON, YAML, pretty output and tables do. An empty
result still prints nothing.

Round-4 sweep #26 (fix-verifier, agent-builder, agent-migrator, human-kb).
The API lists one target's tools, the agent's (global) or a playbook's,
and neither flag was required. So `vf tool list -p … -e main`, run as
help showed it, got HTTP 400 "Tool target does not exist.", which named
no flag. Without --global or --playbook-id vf now asks for the agent's
tools, and help says so and shows a playbook's. --global=false alone and
--global with --playbook-id are refused before sending, exit 2, naming
the flag that fixes each. get, update and delete take a tool ID and no
target, so they weren't affected. Found by the round-4 sweep's
agent-migrator and fix-verifier.
A function tool hands the agent's values to its function only through
inputVariables, one entry per input keyed by the input's name. Left out,
the map was sent empty, and help showed it as `inputVariables?: { <key>:
{…} }`, so a tester's lookup_order tool saved with no inputs and nothing
said so. Help for tool create and update now spells out the entry
(functionInputVariableID and the optional keys), says where the input
IDs come from, and gives a worked example. After a function tool is
created or updated, vf reads the function's inputs (and, for an update,
the tool back) and names any the tool doesn't pass, with the update that
wires them: a warning for a person, a JSON warning with the hint in
agent mode. A dry run checks nothing. Found by the round-4 sweep's
agent-builder.
The API requires a variable's color, a hex code only the editor shows, so
`vf variable create --name … --description …` failed with "needs
--color-param", and the hint offered `--color-param <value>`. Help's
example passed `black`, while the flag's own text said to use #515A63
and invent no other hex code. --color-param is now optional: left out,
by flag or in --body, the variable gets #515A63, the editor's default.
Help says so, and its examples run as written, the second with a quoted
hex (an unquoted # starts a shell comment). The missing-flag tests that
used --color-param as their second missing flag now use function
create's --code. Found by the round-4 sweep's agent-builder,
agent-migrator, agent-ci and fix-verifier.
A create said "✓ Created event …", but an update, a delete and secret
set-value printed the API's bare answer, "message:  Event … updated.", and
a passing `test run wait` printed nothing after its results while a failing
one ended "✗ 1 of 1 runs did not pass". Testers (human-poweruser,
human-newcomer, agent-builder, human-kb) read the missing ✓ as "maybe
nothing happened".

Now, for a person reading pretty output at a terminal, an answer that is
only a message reads as "✓ Event … updated."; set-value's line adds which
environment and version now serve the value; and `test run wait`,
`wait-suite` and `create-suite --wait` end with "✓ 2 of 2 runs passed" on
stderr. JSON, YAML, TOON, --jq, agent mode and a pipe get the answer as the
API sent it. The output change is one hook line in output.go; the rest is
in output/done.go.
The knowledge base processes a document after the create returns, and
nothing said so: create-text, create-url and create-table printed a raw
dump ending in `status: type: PENDING`, with no ✓ line, no Next line and
no way to wait. Testers ran `document list` until it read SUCCESS, and an
agent polled `document get` by hand.

At a terminal a create now ends with "✓ Added billing.md (id) ·
processing (PENDING)" and Next lines naming `vf document get --wait` and
`vf document list -o table`. --wait on the creates, on update (new text
is processed again) and on get polls the document every 2s until it is
SUCCESS or ERROR, with a spinner at a terminal, then prints the answer
with the final status, -o json and --jq included. It exits 1 with the
API's reason when processing failed, and 5 when --max-wait (5m by
default) runs out, saying how to keep waiting. Agent mode keeps the data,
status included, and adds nothing to it. Found by the round-4 sweep's
human-kb, human-newcomer and agent-builder testers.
…text

`document update --content` took only the text itself, so a tester who
typed faq/refunds.md into the Content field replaced the live document's
text with the words "faq/refunds.md", with no warning. `agent update
--prompt` and `--instructions` had no file form either, and agents built
a --body with jq --rawfile to get a prompt file in.

`document update` takes --file for a text or Markdown file. --content,
--prompt and --instructions (agent update, playbook create and update)
take @file for a file's text and - for stdin's, read as the flag is set,
so a form's answer works too; @@ starts text that starts with @. A
--content that is one word naming a file is not sent as is: at a
terminal vf asks whether to send the file's text instead, No sending
nothing; elsewhere nobody can answer, so it refuses with exit 2 and names
--file, and --body '{"content":…}' for the words themselves. Found by the
round-4 sweep's human-kb, agent-builder and agent-ci testers.
`document create-table` took its rows only as JSON in --items, so a
table kept in a spreadsheet had to be rewritten by hand as
[{"plan":"Pro","price":"$20"},…], and a file name typed into --items was
"not valid JSON", with no word of another way.

--csv plans.csv reads the rows instead: the header row gives the keys,
and each row after it becomes an item, its values kept as text. A .tsv
file is read as tab-separated, by its extension. Excel's BOM and the
empty rows below a table are skipped. Without --schema every column is
searchable; --schema still chooses. An empty file, a header with a
blank or repeated name, a row of the wrong length, a file that isn't
UTF-8 (an .xlsx) and --csv with --items are refused with exit 2 and the
reason, before anything is sent. --csv stands in for --items, so help
and the missing-flag error offer it, and an --items that names a CSV
file points at --csv.

--csv rather than --items @rows.csv: help examples are parsed as they
are written, and a flag that read its file as it was set would fail
there; --csv also shows up in help's flag list and in --usage.

A file that isn't there no longer tells --file and --csv to write @@,
which only means something to a flag that takes text.

Found by the round-4 sweep's human-kb tester.
A second `document create-text` of the same file came back 409 "file
already exists", and vf's hints said "Use a different name, or change
the one that exists". The fix was --overwrite true, which replaces the
document in place, and nothing said so; the flag's help reads only
"true or false", and its meaning was in --folder-id's.

A 409 about a name on a document create that takes --overwrite and
wasn't given it true now says the knowledge base already has a document
with this name (this URL, for create-url), and "Add `--overwrite true`
to replace it: it keeps its ID, and is processed again", then the list
command. A conflict that isn't about the name, or a create already
given --overwrite true, keeps the hints it had.

Found by the round-4 sweep's agent-migrator and agent-ci testers.
`vf document create-text` was described as "Create a new document from
raw text.", the API's summary, at the top of its help and its form,
while its one required field is a file path. A newcomer with no file at
hand canceled there, and a knowledge-base writer read "raw text" as a
typed note, when it is how a Markdown or PDF file gets in.

Its summary is now "Upload a file as a document", and its help says it
uploads a text, Markdown, PDF or Word file, that the file's name becomes
the document's name, that --overwrite true replaces the document of that
name, and that a web page goes through create-url and rows of data
through create-table.

The summary in the OpenAPI spec, docs/ and the --usage schema still say
"raw text"; they come from the spec. Found by the round-4 sweep's
human-newcomer and human-kb testers.
In the home prompt, `agent update`, `document update` and `document
delete` ignored the project chosen with `use project`. Any command
named update*, delete* and so on asked again for every ID it could list,
so a document delete opened a list of every project in the workspace,
two of them named like the one in use, then an environment list with
one row. Picking the wrong lookalike would change another team's agent.

A command now asks again only for the ID that names what it changes:
the project of `project delete`, the environment of `environment
publish`. That is the flag whose noun is the command's group. The
project and environment a change happens in come from the context, or
are taken without asking when there is only one, or the main one, as
for any other command, and each says so ("Using project … the current
one"). The menu's note for --project-id follows: "uses … (current)".

`environment publish`, `merge` and `update-traffic-split` now take the
current project too; their environment is still always asked. Found by
the round-4 sweep's human-newcomer and human-kb testers (R4 #8).
In the home prompt, Ctrl-C pressed within about 20 ms of Enter ended vf,
history and context with it: `^C`, then the shell (killed by SIGINT,
exit -2). The prompt hands the terminal back when Enter is read, so
Ctrl-C is a signal again, but a line caught it only once its command
tree was built. A Ctrl-C in that gap found nothing listening.

Ctrl-C is now caught from before the first prompt until the prompt
closes. One pressed at any moment after Enter goes to that line and
cancels it ("✗ Canceled"), and the prompt comes back; one pressed before
the prompt shows is dropped, so it can't cancel the next line. A Ctrl-C
read in the same burst as the Enter reaches the prompt as a key, and
used to be lost while the line ran to the end: the line is now not run,
says Canceled, and stays in history. `use project` can be canceled the
same way while its list loads.

Found by the round-4 sweep's human-poweruser and fix-verifier testers
(R4 #9).
A form closed only on Ctrl-C, and nothing on it said so. People backed
out with Esc, which the home prompt's own menu takes, and the form just
stayed on screen (`┃ >`), in `document create-text` and in the project
and environment lists alike.

Esc now cancels a form too: "✗ Canceled", and nothing is sent. On a
delete's Yes/No question it answers No. In a list being filtered with
/, Esc keeps its meaning there: the first ends the filter, the next
clears it, and only then does Esc close the list.

One-line hooks in the generated interactive.go, and in pickers.go and
confirm.go. Found by the round-4 sweep's human-newcomer and human-kb
testers (R4 #39).
A delete asked "Delete document 6b0ddda34eb600496d834c6d?", and a
person can't tell from an ID whether that is the holiday note or the
FAQ. vf named the thing only when it was picked from a list or was
current in the home prompt; a typed or pasted ID got the ID alone.

Now, when a person is about to be asked and vf doesn't know the name,
it reads the thing first, with one GET of the URL the DELETE goes to,
and asks `Delete document "holiday-note.txt" (6b0d...)?`. A read that
fails, is slow (5 s cap) or has no name leaves the ID alone. Pipes,
scripts, agent mode, --yes and --dry-run are never asked, so they send
the delete and nothing else, as before.

The confirm hook in client/confirm.go now gets the command's client
for that read; the read is in the new cli/confirmname.go. Found by the
round-4 sweep's human-kb and human-poweruser testers (R4 #38).
…inal's edge

vf wrote help, hints, warnings and agent replies as one long line each,
and the terminal broke them wherever its edge fell: `--body - reads it f` /
`rom stdin` in help, `maybe our menu or d` / `irections?` in a reply, at 70
columns and at 160. At a terminal they now break at spaces and continue
under their own text: a flag's description under the description, a
status line under its message, a reply under the reply. One wrapper
(ui/wrap.go, built on the one read-prompt uses) does it for help, the
home prompt's help, error explanations and their next steps, status
lines such as the stale-build warning, agent replies and docs search
results. A quoted command, a flag and its value, a command in the accent
color, and the Usage and Examples sections stay whole, so what is copied
still runs. Pipes, -o json and agent mode are not wrapped. Found by the
round-4 sweep's human-poweruser, human-newcomer and human-kb testers.
--usage printed the generator's text from the API spec, from before vf's
own code ran, so it kept everything --help had fixed: 638 flags said only
help="[required]", 66 "string value", 39 named a generated type,
--workflow-id said "Copy its ID from voiceflow_workflow.list", and of 1648
flags only --yes had a shorthand, so -p and -e appeared nowhere. Each
command's line now takes its summary, and each flag's line its help and
shorthand, from the command tree as --help shows it. A hidden flag
(--server) is left out, and a flag vf added (--no-interactive) is put in.
The test that looks for the spec's backticks reads them from the
generated schema now, since --usage no longer shows them. Found by the
round-4 sweep's fix-verifier, agent-migrator and agent-builder testers.
Every --help ended with the 13 global flags in five sections, 20 to 35
lines that were the same on every page. On a 32-row terminal `vf secret
--help` showed only global flags, with its subcommands scrolled away, and
an agent read the same lines again for each command it looked up. A
command's help now ends with one line, "-o, --jq, --dry-run,
--no-interactive, … ('vf --help' lists all 13)", and 'vf --help' still
lists and describes every one. Found by the round-4 sweep's
human-poweruser and agent-migrator testers.
What was wrong: text the spec and server write for the MCP server still
reached vf's users. `secret create --help` said "MCP clients must omit the
value", and four more commands told MCP clients what to do. `test run wait
--run-ids` said "the IDs 'vf test run create' or create_many_runs
returned", and its 404 named vf_test_create_many_runs: the rewrite found no
command with "many" in it and left the name. Every analytics query's
--version-scope named 'projectEnvironmentID', 'versionIDs' and
'environmentID', fields of the MCP tool's request that vf has no flag for.
`document update` printed "voiceflow_document.get shows status PENDING":
success messages were never rewritten, only errors.

What changed:
- flagutil/apinames.go: an MCP tool or operation that does many at once
  is the command that does one when vf has no other, and a command named
  twice in a row ("X or X") is said once. Help leaves out sentences and
  clauses addressed to MCP clients.
- analytics/query/versionscope.go: --version-scope's help names
  --environment-alias, the flag vf has (one hook line in root.go).
- output/messagenames.go: a result's top-level message names vf's
  commands and flags as an error's does, for pretty, yaml, table and toon
  output (one hook line in output.Result). JSON and --jq output stay as
  the server sent them.

Tests: TestHelpSaysNothingMeantForTheMCPServer walks the whole tree;
TestAResultsMessageNamesVFCommands and TestJSONKeepsTheServersMessage
cover the message; TestVFNamesInMessage/TestVFNamesInHelp cover the
rewrite. test/flag-errors.test.ts accepts two names said as one command
and skips the description check for --version-scope, whose help vf now
writes itself.
What was wrong: 176 flags said nothing in help but what kind of value
they take. `agent update --prompt` and --instructions showed nothing;
-n --name showed only "[required]" on eleven create commands; -s
--settings and every tool flag said "JSON object"; --headers "list of
values"; --overwrite and the other document options "true or false";
--limit and --offset nothing at all. The spec describes some of these on
the SDK's fields but not on the flags.

What changed:
- flagutil/description.go: a JSON flag the spec described only as
  "JSON object", "list of values" or not at all says the JSON it takes,
  from the request's type: --settings is `JSON: { model?: string,
  maxTokens?: number, … }` (one hook line in jsonexample.go). The
  document options say what they do, from the spec's field docs, and
  that the LLM ones are deprecated and may be ignored.
- cli/barehelp.go: a bare flag gets words written for its name
  (--name "The workflow's name.", --prompt "The global prompt, in full.
  'vf agent patch-prompt' changes part of it.", --limit, --offset,
  --port-key, --integration, …) or else the description its namesake
  has on the command's counterpart: update-variant's --text from
  add-variant's (one hook line in root.go).

Flags with no description but their kind: 176 → 27. --usage shows the
same words, since it reads each flag's help.

Tests: TestFlagsTheSpecLeftUndescribedSayWhatTheyAre and
TestFewFlagsSayNothing (whole tree, at most 30), both failing without
the change.

A flag that reads its text from a file (flagutil/textfile.go) ends its help
with how to: "@file reads the text from a file, and - from stdin." That
ending says nothing about the flag, so it doesn't stop a description: `vf
agent update --prompt` reads "The global prompt, in full. 'vf agent
patch-prompt' changes part of it. @file reads the text from a file, and -
from stdin."
What was wrong: 251 summaries only restated the command's name, because
the generator writes them from the operation's name. `vf conversation
--help` listed "send  Send" and "run-script  Run script", `vf workflow
--help` "get  Get workflow", though each description says more ("Send
message to a conversation", "Run a list of user messages as one new
conversation"). A list of commands shows only the summary (R4 #45).

What changed:
- cli/summaries.go: where a command's Short restates its name and the
  first sentence of its description says more and fits on a line, that
  sentence is stored as the command's usage.Summary annotation.
- usage/ownhelp.go: usage.Summary and usage.SummaryOf (the Summary, else
  Short). --usage describes each command by it.
- Lists of commands use SummaryOf: Cobra's "Available Commands" (a
  "summary" template func in root.go), the home prompt's help
  (prompt_help.go) and its completion menu (prompt/complete.go), and the
  explorer's tree (explorer/tree.go).
- Short itself is unchanged, so what is built from it stays as it was:
  a delete's question ("Delete prompt …?", not "Delete a prompt and its
  messages …?") and an error's title ("Couldn't send: …").

Summaries that only restate the name: 251 → 86 (165 now say more).

Tests: TestASummarySaysMoreThanTheName (--help, --usage and the prompt's
help) and TestCompleteCommandsBySummary fail without the change;
TestASummaryLeavesShortAlone fails if the summary overwrites Short.
usagehelp_test.go and prompt_help_test.go compare lists against
SummaryOf.
Copilot AI balanced review requested due to automatic review settings December 1, 2026 01:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Interactive commands can reuse a stale environment alias after an explicit project change, potentially directing writes to an unintended environment.

5 open issues
6 files not reviewed
  • internal/cli/agent/update.go: Generated file
  • internal/cli/analytics/query/root.go: Generated file
  • internal/cli/conversation/send.go: Generated file
  • internal/cli/document/createtable.go: Generated file
  • internal/cli/document/createtext.go: Generated file
  • internal/cli/document/createurl.go: Generated file
What changed in this PR

This PR addresses Voiceflow CLI usability issues across conversation startup, document processing, terminal output, interactive forms, and help.

Changes:

  • Compiles drafts before new conversations and improves action validation and missing-action guidance.
  • Adds document waiting, file/stdin input, and CSV workflows, alongside clearer knowledge-base and test results.
  • Improves terminal formatting, cancellation, context reuse, help text, and tool/variable defaults, with regression coverage.
File Description
test/​toon-output.test.ts Checks TOON output’s final newline.
test/​run-suite-wait.test.ts Distinguishes suite-specific wait help.
test/​flag-errors.test.ts Updates help checks for live descriptions.
test/​errors-teach.test.ts Adjusts missing-flag tests for optional colors.
README.md Documents compilation before new conversations.
internal/​ui/​ui.go Adds terminal-aware width and status wrapping.
internal/​ui/​lines.go Wraps indented result lines.
internal/​prompt/​prompt.go Recognizes cancellation immediately after Enter.
internal/​prompt/​prompt_test.go Tests Enter/Ctrl-C handling.
internal/​prompt/​complete.go Uses summaries and prioritizes stand-in flags.
internal/​prompt/​complete_test.go Tests summaries and --text ordering.
internal/​output/​yamlkeys.go Encodes YAML using JSON keys and order.
internal/​output/​yamlkeys_test.go Tests YAML values, keys, and indentation.
internal/​output/​view.go Exposes output-format and human-view checks.
internal/​output/​toon_test.go Updates newline expectations.
internal/​output/​tableview.go Promotes nested messages into table columns.
internal/​output/​prettyshape.go Shapes empty values and multiline text.
internal/​output/​prettyshape_test.go Tests pretty-output indentation.
internal/​output/​pretty.go Applies pretty-output shaping.
internal/​output/​output.go Integrates YAML, newline, message, and completion rendering.
internal/​output/​messagenames.go Rewrites result messages using CLI names.
internal/​output/​messagenames_test.go Tests message rewriting and JSON preservation.
internal/​output/​explain.go Wraps explanatory next steps.
internal/​output/​endline.go Ensures nonempty TOON ends with a newline.
internal/​output/​endline_test.go Tests output newline consistency.
internal/​output/​done.go Adds terminal-only completion lines.
internal/​output/​done_test.go Tests completion-message formatting.
internal/​output/​doctype.go Adds overwrite guidance for duplicate documents.
internal/​output/​doctype_test.go Tests duplicate-document guidance.
internal/​interactive/​pickers.go Reuses scope context and enables Esc cancellation.
internal/​interactive/​interactive.go Enables Esc cancellation throughout forms.
internal/​interactive/​esccancel.go Cancels forms while respecting list filtering.
internal/​interactive/​esccancel_test.go Tests Esc behavior in forms and lists.
internal/​interactive/​confirm.go Enables Esc on confirmation prompts.
internal/​flagutil/​warning.go Exposes warning emission to commands.
internal/​flagutil/​textfile.go Adds file/stdin-backed text flags.
internal/​flagutil/​textfile_test.go Tests text sources, escaping, and errors.
internal/​flagutil/​jsonexample.go Adds shape descriptions to JSON flags.
internal/​flagutil/​description.go Improves document options and JSON-shape help.
internal/​flagutil/​apinames.go Rewrites API names and removes MCP-client notes.
internal/​flagutil/​apinames_test.go Tests name rewriting and help cleanup.
internal/​explorer/​tree.go Displays richer command summaries.
internal/​client/​spinner.go Allows polling to suppress per-request spinners.
internal/​client/​confirm.go Allows confirmation hooks to perform auxiliary reads.
internal/​client/​confirm_test.go Tests reads before confirmation.
internal/​cli/​variablecolor_test.go Tests default colors and valid examples.
internal/​cli/​variable/​create.go Applies the default variable color.
internal/​cli/​variable/​color.go Makes color optional and updates help.
internal/​cli/​usagehelp_test.go Checks usage descriptions against live flags.
internal/​cli/​tool/​wiring_test.go Tests missing-input warnings and repair hints.
internal/​cli/​tool/​update.go Adds wiring help and post-update checks.
internal/​cli/​tool/​target.go Defaults tool lists to the agent’s tools.
internal/​cli/​tool/​list.go Applies target defaults and validation.
internal/​cli/​tool/​create.go Adds wiring help and post-create checks.
internal/​cli/​test/​run/​wait_passed_test.go Tests passing-run summaries.
internal/​cli/​test/​run/​wait_exit.go Announces successful waits.
internal/​cli/​test/​run/​get.go Uses verdict-first output with optional debug logs.
internal/​cli/​test/​run/​createsuite_wait.go Announces successful suite waits.
internal/​cli/​tableview_test.go Checks test-log message columns.
internal/​cli/​summaries.go Derives richer summaries without changing command titles.
internal/​cli/​summaries_test.go Tests summaries and unchanged title behavior.
internal/​cli/​stdinhint_test.go Adjusts stdin guidance tests for optional colors.
internal/​cli/​root.go Registers help, summary, and wrapping improvements.
internal/​cli/​prompt_help.go Wraps prompt help and displays summaries.
internal/​cli/​prompt_help_test.go Updates summary and global-help expectations.
internal/​cli/​playbook/​update.go Enables file/stdin instructions on updates.
internal/​cli/​playbook/​create.go Enables file/stdin instructions on creates.
internal/​cli/​namehelp_test.go Checks help avoids MCP-specific terminology.
internal/​cli/​missingflags_test.go Tests preserved send flags and structured details.
internal/​cli/​knowledgebase/​query.go Uses answer-first rendering with optional debug output.
internal/​cli/​home_test.go Adapts prompt tests to command contexts.
internal/​cli/​home_interrupt_test.go Tests cancellation around command submission.
internal/​cli/​helpwrap.go Wraps terminal help while preserving copyable sections.
internal/​cli/​helpwrap_test.go Tests wrapping across command help.
internal/​cli/​globalflags.go Condenses inherited global-flag help.
internal/​cli/​globalflags_test.go Tests compact and full global-flag listings.
internal/​cli/​forms_test.go Updates usage expectations for shorthands.
internal/​cli/​environment/​nodiff.go Adds a human-readable no-differences message.
internal/​cli/​environment/​diff.go Integrates the no-differences message.
internal/​cli/​donetty_test.go Tests completion lines under a terminal.
internal/​cli/​document/​update.go Integrates file input and processing waits.
internal/​cli/​document/​get.go Adds waiting before document retrieval.
internal/​cli/​document/​docready_test.go Tests processing messages and raw-status replacement.
internal/​cli/​document/​createurl.go Integrates document processing waits.
internal/​cli/​document/​createtexthelp.go Clarifies that create-text uploads a file.
internal/​cli/​document/​createtext.go Adds waiting and upload-focused help.
internal/​cli/​document/​createtable.go Integrates CSV input and processing waits.
internal/​cli/​document/​contentfile_test.go Tests confirmation for path-like content.
internal/​cli/​docs.go Wraps documentation search titles and snippets.
internal/​cli/​createtexthelp_test.go Tests upload-focused help text.
internal/​cli/​conversationtext_test.go Tests missing-action guidance and flag ordering.
internal/​cli/​conversationreply_test.go Uses normal error rendering in send tests.
internal/​cli/​conversationend_test.go Uses custom actions to exercise API validation.
internal/​cli/​conversation/​text.go Removes the separate missing-action error handler.
internal/​cli/​conversation/​send.go Adds custom-action support and type validation.
internal/​cli/​conversation/​reply.go Wraps terminal conversation replies.
internal/​cli/​conversation/​autocompile.go Checks conversation state before compiling drafts.
internal/​cli/​conversation/​actiontype_test.go Tests known action types and spelling suggestions.
internal/​cli/​contentfile_test.go Tests file/stdin text and accidental-path safeguards.
internal/​cli/​confirmname.go Reads resource names for delete confirmations.
internal/​cli/​confirm.go Incorporates fetched names into delete prompts.
internal/​cli/​confirm_test.go Tests named confirmations and lookup eligibility.
internal/​cli/​barehelp_test.go Tests improved descriptions and JSON shapes.
internal/​cli/​analytics/​query/​versionscope.go Explains version scope using CLI flags.
internal/​cli/​analytics/​query/​root.go Applies version-scope help overrides.
internal/​cli/​agent/​update.go Enables file/stdin prompts and instructions.

Review effort: Balanced

Comment on lines +171 to 173
if cur, ok := session.Get(flag); ok && !p.changes(flag) {
fmt.Fprintln(p.out, p.u.Status(ui.StatusDone, "Using "+describe(picker.Noun, cur)+", the current one"))
return p.set(flag, cur.Value)
Comment on lines +90 to +96
ctx := client.WithSpinnerMessage(cmd.Context(), "Reading the conversation…")
res, err := s.Conversation.State.Get(ctx, operations.StableConversationStateControllerGetRequest{
UserID: req.UserID,
ProjectID: req.ProjectID,
EnvironmentAlias: req.EnvironmentAlias,
Version: operations.StableConversationStateControllerGetVersionDraft,
}, operations.WithSkipDeserialization())
Comment on lines +75 to 76
waited := waitBeforeGet(cmd, req) // docready.go: with --wait, polls until it's processed
res, err := s.Document.Get(cmd.Context(), *req, sdkOpts...)
if err != nil {
return err
}
return v.Value.Set(text)
Comment on lines +32 to +33
data := responseBody(res)
if data == nil {
@linear-code

linear-code Bot commented Dec 2, 2026

Copy link
Copy Markdown

COR-16419

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants