Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f9bbd99
fix(conversation): a first message to a new user compiles the draft f…
Bradenream Nov 30, 2026
35f552f
fix(conversation): refuse an action type vf doesn't know before sending
Bradenream Nov 30, 2026
6bb8e2d
fix(conversation): a send missing only its action keeps the flags given
Bradenream Nov 30, 2026
084aa77
fix(prompt): send's flag menu leads with --text, not --action
Bradenream Nov 30, 2026
972814f
fix(output): empty values and multi-line strings keep pretty output's…
Bradenream Nov 30, 2026
7e397c8
fix(knowledge-base): a query shows its answer first, then its sources
Bradenream Nov 30, 2026
e1c80f7
fix(output): -o yaml prints the keys and values -o json prints
Bradenream Nov 30, 2026
36acdc0
fix(test): `test run get` shows the verdict, then the conversation
Bradenream Nov 30, 2026
04f22b6
fix(output): TOON output ends with a newline
Bradenream Nov 30, 2026
736c10d
fix(tool): a bare tool list lists the agent's own tools
Bradenream Nov 30, 2026
d65b0f3
fix(tool): a function tool that leaves out its function's inputs says so
Bradenream Nov 30, 2026
ab926d8
fix(variable): a new variable gets the editor's color by default
Bradenream Nov 30, 2026
31508dd
fix(output): updates, deletes and a passing wait end with a ✓ line
Bradenream Nov 30, 2026
a3568e1
fix(document): say when a document is ready, and --wait for it
Bradenream Nov 30, 2026
cc36e82
fix(document): long text flags read a file, and a path isn't sent as …
Bradenream Nov 30, 2026
ba1bc83
fix(document): a table's rows can come from a CSV file
Bradenream Nov 30, 2026
9706e26
fix(document): a name that's taken points at --overwrite true
Bradenream Nov 30, 2026
cbdedd8
fix(document): create-text says it uploads a file
Bradenream Nov 30, 2026
1ef08da
fix(home): update and delete keep the current project and environment
Bradenream Nov 30, 2026
bb5789e
fix(home): Ctrl-C just after Enter cancels the line, not vf
Bradenream Nov 30, 2026
e6c844b
fix(forms): Esc cancels a form, as Ctrl-C does
Bradenream Nov 30, 2026
7b79a1a
fix(forms): a delete's question names what it deletes
Bradenream Nov 30, 2026
240288c
fix(help): help, replies and warnings break between words at the term…
Bradenream Nov 30, 2026
f50aea7
fix(help): --usage describes each flag as --help does
Bradenream Nov 30, 2026
b1195e9
fix(help): a command's help names the global flags in one line
Bradenream Nov 30, 2026
6ae0e1a
fix(help): help and messages say nothing meant for the MCP server
Bradenream Nov 30, 2026
01fdce5
fix(help): flags the spec left undescribed say what they are
Bradenream Nov 30, 2026
d4d386d
fix(help): a list of commands says what each does, not its name again
Bradenream Dec 1, 2026
b35d59e
Merge braden/sweep-r4 into braden/sweep-r5: vet.sh skips module downl…
Bradenream Dec 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Worth knowing before you script against the CLI:

- **`--version-param draft` runs what you are editing; `published` runs the live version.** A new project is created with a first release already in place, so either works immediately — you do not have to publish anything first.
- **`--action '{"type":"launch"}'` is optional.** Sending a `text` action straight away works; the runtime starts the conversation itself. The launch step is shown because it makes the first turn explicit.
- **A conversation with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it before `conversation run-script` and before a `send` with a `launch` action. If a later turn still ran an older build (you edited mid-conversation, or started with a `text` action), vf compiles right after it and warns, so the next turn runs the edits. `--no-compile` talks to the last build as it is; the published version is never compiled.
- **A conversation with the draft runs your latest edits.** The draft runs as last compiled, so vf compiles it before `conversation run-script` and before a `send` that starts a conversation: a `launch` action, or any message to a user ID with no conversation going (new, or its last one ended; vf reads the user's state to tell). A later turn runs the build as it is. If that turn ran an older build (you edited mid-conversation), vf compiles right after it and warns, so the next turn runs the edits; a new `--user-id` runs them at once. `--no-compile` talks to the last build as it is; the published version is never compiled.
- **Pass `--output-format json` explicitly when piping.** Inside AI coding agents (`CLAUDECODE`, `CURSOR_AGENT`, …) the default output is TOON, not JSON.
- **Capture values with `--jq`**: `ID=$(vf project create … --jq .project.id)`. A string result prints raw, as `jq -r` prints it; anything else prints as JSON.
- **`vf whoami` is offline** — it shows which credential source is configured but does not validate the token. `vf workspace list` is the real check.
Expand Down
1 change: 1 addition & 0 deletions internal/cli/agent/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func initUpdateCmd(parent *cobra.Command) error {
RunE: runUpdateCmd,
}
flagutil.RegisterFlags(cmd, updateCmdMeta)
flagutil.ReadsText(cmd, "prompt", "instructions") // flagutil/textfile.go: @file and - read the text
if err := flagutil.ValidateMeta[operations.StableAgentControllerUpdateV2Request](updateCmdMeta); err != nil {
return fmt.Errorf("invalid metadata for update: %w", err)
}
Expand Down
3 changes: 2 additions & 1 deletion internal/cli/analytics/query/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ func InitQueryRoot(parent *cobra.Command) error {
return err
}

dateRanges(QueryCmd) // daterange.go: dates take a day, and a range is checked
dateRanges(QueryCmd) // daterange.go: dates take a day, and a range is checked
versionScopes(QueryCmd) // versionscope.go: --version-scope's help names vf's flags
parent.AddCommand(QueryCmd)
return nil
}
26 changes: 26 additions & 0 deletions internal/cli/analytics/query/versionscope.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// This file is not generated by Speakeasy. It gives an analytics query's
// --version-scope help in vf's terms.
//
// The spec describes the field as the MCP tool takes it: "the live version
// and release history of 'projectEnvironmentID' … Takes precedence over
// 'versionIDs' and 'environmentID'". vf's queries have none of those; they
// take --environment-alias, so the help named three things a person could
// not pass. It now says what the flag covers with the flag vf has.

package query

import "github.com/spf13/cobra"

// versionScopeHelp is --version-scope's help on a query that takes
// --environment-alias.
const versionScopeHelp = "Only published versions: the live version and every past release of the environment --environment-alias names, or of every environment without it. (options: published)"

// versionScopes gives --version-scope, on each query under query that takes
// it and --environment-alias, help that names the flags vf has.
func versionScopes(query *cobra.Command) {
for _, c := range query.Commands() {
if c.Flags().Lookup("version-scope") != nil && c.Flags().Lookup("environment-alias") != nil {
ownHelp(c, "version-scope", versionScopeHelp)
}
}
}
80 changes: 71 additions & 9 deletions internal/cli/autocompile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ import (
"github.com/voiceflow/cli/internal/output"
)

// conversationServer answers compile with compileStatus, and a conversation
// with answer. It records each request as "compile" or "conversation".
// conversationServer answers compile with compileStatus, the user's state
// with a conversation going, and a conversation with answer. It records each
// request as "compile", "state" or "conversation".
func conversationServer(t *testing.T, compileStatus int, answer string) (url string, requests func() []string) {
return conversationServerWithState(t, compileStatus, answer, 200, goingState)
}

// conversationServerWithState is conversationServer, with the user's state
// answered with stateStatus and state.
func conversationServerWithState(t *testing.T, compileStatus int, answer string, stateStatus int, state string) (url string, requests func() []string) {
t.Helper()
var mu sync.Mutex
var seen []string
Expand All @@ -27,14 +34,22 @@ func conversationServer(t *testing.T, compileStatus int, answer string) (url str
mu.Lock()
defer mu.Unlock()
w.Header().Set("Content-Type", "application/json")
if strings.HasSuffix(r.URL.Path, "/compile") {
switch {
case strings.HasSuffix(r.URL.Path, "/compile"):
seen = append(seen, "compile")
w.WriteHeader(compileStatus)
io.WriteString(w, `{"message":"Environment compiled","durationMs":5}`)
return
case strings.Contains(r.URL.Path, "/conversation-state/"):
seen = append(seen, "state")
if r.Method != http.MethodGet || r.URL.Query().Get("version") != "draft" {
t.Errorf("read the state with %s %s", r.Method, r.URL)
}
w.WriteHeader(stateStatus)
io.WriteString(w, state)
default:
seen = append(seen, "conversation")
io.WriteString(w, answer)
}
seen = append(seen, "conversation")
io.WriteString(w, answer)
}))
t.Cleanup(srv.Close)
return srv.URL, func() []string {
Expand Down Expand Up @@ -68,6 +83,11 @@ const (
freshTurn = `{"traces":[],"needsRecompile":false}`
staleTurn = `{"traces":[],"needsRecompile":true}`
script = `{"userID":"u1","transcriptID":null,"needsRecompile":false,"turns":[],"notSent":[]}`
// The state of a user with a conversation going, and of one with none:
// the API's answer for a user ID it hasn't met, or whose conversation
// ended.
goingState = `{"state":{"stack":[{"diagramID":"d1","nodeID":"n1","storage":{},"variables":{}}],"storage":{},"variables":{"name":"Sam"}}}`
noneState = `{"state":{"stack":[],"storage":{},"variables":{}}}`
)

func TestAConversationWithTheDraftCompilesItFirst(t *testing.T) {
Expand All @@ -83,10 +103,11 @@ func TestAConversationWithTheDraftCompilesItFirst(t *testing.T) {
{"run-script --no-compile", script, append([]string{"run-script", "-m", `["hi"]`, "--no-compile"}, scope...), "conversation"},
{"run-script on published", script, append([]string{"run-script", "-m", `["hi"]`, "--version-param", "published"}, scope...), "conversation"},
{"a launch compiles first", freshTurn, append(send, "-a", `{"type":"launch"}`), "compile conversation"},
{"a later turn doesn't", freshTurn, append(send, "-a", `{"type":"text","payload":"hi"}`), "conversation"},
{"a stale turn compiles after", staleTurn, append(send, "-a", `{"type":"text","payload":"hi"}`), "conversation compile"},
{"a stale turn compiles after, -o json", staleTurn, append(send, "-a", `{"type":"text","payload":"hi"}`, "-o", "json"), "conversation compile"},
{"a later turn doesn't", freshTurn, append(send, "-a", `{"type":"text","payload":"hi"}`), "state conversation"},
{"a stale turn compiles after", staleTurn, append(send, "-a", `{"type":"text","payload":"hi"}`), "state conversation compile"},
{"a stale turn compiles after, -o json", staleTurn, append(send, "-a", `{"type":"text","payload":"hi"}`, "-o", "json"), "state conversation compile"},
{"a stale turn with --no-compile", staleTurn, append(send, "-a", `{"type":"text","payload":"hi"}`, "--no-compile"), "conversation"},
{"a later turn on published", freshTurn, []string{"send", "-u", "u1", "-v", "published", "-p", "p1", "-e", "main", "--text", "hi"}, "conversation"},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
Expand All @@ -109,6 +130,47 @@ func TestAConversationWithTheDraftCompilesItFirst(t *testing.T) {
}
}

// A first --text to a user ID with no conversation going starts one, so it
// compiles the draft first, as a launch does. It ran the old build, and vf
// said so only after.
func TestAFirstMessageCompilesTheDraftFirst(t *testing.T) {
send := []string{"send", "-u", "new-user", "-v", "draft", "-p", "p1", "-e", "main"}
cases := []struct {
name string
stateStatus int
state string
args []string
want string
}{
{"--text to a new user", 200, noneState, []string{"--text", "hi"}, "state compile conversation"},
{"a text action to a new user", 200, noneState, []string{"-a", `{"type":"text","payload":"hi"}`}, "state compile conversation"},
{"--body to a new user", 200, noneState, []string{"--body", `{"action":{"type":"text","payload":"hi"},"version":"draft"}`}, "state compile conversation"},
{"a user the API has no state for", 404, `{"message":"Not found"}`, []string{"--text", "hi"}, "state compile conversation"},
{"a conversation going", 200, goingState, []string{"--text", "hi"}, "state conversation"},
{"a state vf can't read", 500, `{"message":"boom"}`, []string{"--text", "hi"}, "state conversation"},
{"--no-compile reads nothing first", 200, noneState, []string{"--text", "hi", "--no-compile"}, "conversation"},
}
for _, c := range cases {
t.Run(c.name, func(t *testing.T) {
url, requests := conversationServerWithState(t, 200, freshTurn, c.stateStatus, c.state)
out, err := runConversation(t, url, append(send, c.args...)...)
if err != nil {
t.Fatalf("%v\n%s", err, out)
}
if got := strings.Join(requests(), " "); got != c.want {
t.Errorf("requests = %q, want %q", got, c.want)
}
compiled := strings.Contains(c.want, "compile")
if says := strings.Contains(out, "Compiled the draft of main"); says != compiled {
t.Errorf("compiled %v, but saying so is %v:\n%s", compiled, says, out)
}
if strings.Contains(out, "older build") {
t.Errorf("warned of an older build:\n%s", out)
}
})
}
}

// A draft that won't compile stops the script before it spends credits, and
// says how to run the last build anyway.
func TestADraftThatWontCompileStopsTheScript(t *testing.T) {
Expand Down
165 changes: 165 additions & 0 deletions internal/cli/barehelp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
// This file is not generated by Speakeasy. It gives words to the flags the
// spec left undescribed.
//
// Help showed `-n, --name string [required]` on eleven create commands,
// and nothing at all after --prompt and --instructions on `agent update`,
// --limit and --offset on every paged read, or --text on `message
// update-variant`, whose namesake on add-variant the spec describes. A
// person had to guess; an agent sent whatever it guessed. Each such flag
// now says what it is: for the names below, words written for it, and
// otherwise the description its namesake has on the command's counterpart
// (update's from create, update-variant's from add-variant). JSON flags get
// their keys in flagutil/description.go, where the request's type is known.

package cli

import (
"strings"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

"github.com/voiceflow/cli/internal/flagutil"
)

// describeBareFlags gives each flag the spec left undescribed, on every
// command under root, a description.
func describeBareFlags(root *cobra.Command) {
described := map[*pflag.Flag]string{} // set after the walk, so no flag copies another's new words
var walk func(c *cobra.Command)
walk = func(c *cobra.Command) {
for _, sub := range c.Commands() {
walk(sub)
}
if !c.HasParent() {
return
}
c.LocalFlags().VisitAll(func(f *pflag.Flag) {
if f.Hidden || strings.Contains(f.Name, ".") || !bare(f.Usage) {
return
}
text := bareFlagHelp(c, f.Name)
if text == "" {
text = counterpartHelp(c, f.Name)
}
if text != "" {
described[f] = strings.TrimSpace(text + " " + f.Usage)
}
})
}
walk(root)
for f, help := range described {
f.Usage = help
}
}

// listHow is what help adds to a list flag: how to pass several values.
var listHow = []string{"Separate values with commas, repeat the flag, or pass a JSON array.", "Repeat the flag or pass a JSON array."}

// bare is whether help usage says nothing but that the flag is required or
// how to pass a list.
func bare(help string) bool {
return core(help) == ""
}

// core is help usage without "[required]", how to pass a list, and how to
// give text from a file (flagutil/textfile.go).
func core(help string) string {
help = strings.TrimSpace(strings.TrimSuffix(strings.TrimSpace(help), flagutil.TextHelp))
for _, how := range listHow {
help = strings.TrimSpace(strings.TrimSuffix(help, how))
}
help = strings.TrimSpace(strings.TrimSuffix(help, "[required]"))
return strings.TrimSpace(strings.TrimPrefix(help, "[required]"))
}

// counterpartHelp is the description flag name has on c's counterpart, the
// command that sets the same thing: create or add for update, and update
// for create or add, as add-variant is to update-variant.
func counterpartHelp(c *cobra.Command, name string) string {
verb, thing, _ := strings.Cut(c.Name(), "-")
var others []string
switch verb {
case "update":
others = []string{"create", "add"}
case "create", "add":
others = []string{"update"}
}
for _, other := range others {
if thing != "" {
other += "-" + thing
}
sibling, _, err := c.Parent().Find([]string{other})
if err != nil || sibling == c.Parent() {
continue
}
if f := sibling.LocalFlags().Lookup(name); f != nil && !bare(f.Usage) {
return core(f.Usage)
}
}
return ""
}

// bareFlagHelp is the description written for flag name on c.
func bareFlagHelp(c *cobra.Command, name string) string {
group := c.Parent().Name()
reads := strings.HasPrefix(c.Name(), "read-") // a page of numbered lines
// whole is how an update's text ends: it is sent in full, and the patch
// command, if there is one, changes part of it.
whole := func(it string) string {
if !strings.HasPrefix(c.Name(), "update") {
return "."
}
if p, _, err := c.Parent().Find([]string{"patch-" + name}); err == nil && p != c.Parent() {
return ", in full. '" + p.CommandPath() + "' changes part of " + it + "."
}
return ", in full."
}
switch {
case name == "name":
return "The " + thingOf(c) + "'s name."
case name == "description":
return "What the " + thingOf(c) + " is for."
case name == "prompt" && group == "agent":
return "The global prompt" + whole("it")
case name == "instructions" && group == "agent":
return "The main agent's routing instructions" + whole("them")
case name == "instructions" && group == "playbook":
return "The playbook's instructions" + whole("them")
case name == "limit" && reads:
return "The most lines to read."
case name == "offset" && reads:
return "The line to start at."
case name == "limit":
return "The most results to return."
case name == "offset":
return "How many results to skip."
case name == "exclude-id":
return "IDs to leave out of the results."
case name == "workspace-ids":
return "Only these workspaces, by ID."
case name == "integration":
return "The integration's identifier, from 'vf integration list'."
case name == "port-key":
return "The step's port, by its key: fail, for example, or a branch or path ID."
case name == "url" && group == "api-tool":
return "The URL the API tool calls."
}
return ""
}

// thingOf is what c makes or changes: block for `workflow create-block`,
// API tool for `api-tool create`.
func thingOf(c *cobra.Command) string {
thing := c.Parent().Name()
if _, rest, ok := strings.Cut(c.Name(), "-"); ok {
thing = rest
}
words := strings.Split(thing, "-")
for i, w := range words {
if w == "api" || w == "mcp" {
words[i] = strings.ToUpper(w)
}
}
return strings.Join(words, " ")
}
Loading
Loading