Repository navigation
feat(cli): explain how to connect an agent from the CLI and console - #174
Conversation
A user with a running host could not tell how to connect an agent. `flats connect` sounds like the answer but only chooses the host, `flats help <command>` printed one line, and Settings > Agents lacked the plugin, the Codex approval caveat and any way to check the connection. CLI: - Bare `flats connect` says it only chooses the host and points to `flats mcp-config`. - `flats help` ends with a pointer to `status` and `mcp-config`; the `connect`, `mcp` and `mcp-config` synopses say what they do. - `flats help <command>` and `<command> -h` print the usage line, the synopsis and, for connect, mcp, mcp-config and client, a description. - `--url` is named URL in `-h` output instead of `flats connect`. - `flats mcp-config` text names the plugin install commands. Console, Settings > Agents: - Each client tab shows the plugin and the direct MCP registration as two blocks with a Copy button each, so one paste never does both. - The Codex tab carries the approval line and the trusted-agents caveat that `flats mcp-config` prints. - Off-loopback consoles start the plugin and CLI blocks with `flats connect <origin>`. - A "Check the connection" row says how to tell that the agent is connected. - At phone width the code blocks wrap inside their card instead of running past its edge. Docs: README "Agent integration", docs/agents.md and docs/surfaces.md. `--json` output, exit codes, MCP tools and `flats status` are unchanged.
Review of
|
|
@gormes-agent make pr for suggested small change |
|
@oesni I opened #177 with the small fix from my review. It targets this PR's branch (
I haven't merged it. |
* fix(console): keep the Cursor plugin snippet free of shell quotes Interactive zsh does not treat # as a comment by default, so the apostrophe in "Cursor's plugin list" opened a quote and a pasted Cursor plugin block stopped at quote>. Reword the line and assert that no Agents snippet contains an apostrophe. * fix(console): drop the # line from the Cursor plugin snippet Interactive zsh does not treat a pasted # line as a comment, so the copied Cursor block printed "zsh: command not found: #". Move "Then install Flats from the Cursor plugin list" into the block title, which is not copied, and test that no shell block (plugin or CLI) holds a # line and no copied block holds an apostrophe. The Codex TOML block is a config file and keeps its comments. --------- Co-authored-by: gormes-agent[bot] <343359623+gormes-agent[bot]@users.noreply.github.com>
|
Review of head The direction is right and the change is text and layout only. One real issue, plus a couple of notes. P2: plugin and CLI blocks point at the wrong host on a non-default loopback port
The direct-registration blocks are fine because they use Suggested fix: omit Low: PR description is out of dateThe description says the reviewed tree is the pushed tree, but #177 was merged into this branch afterwards, and the review record table does not cover it. The #177 commit also carries a Notes (non-blocking)
Checked
|
The plugin and the CLI use the host saved with `flats connect`, or http://127.0.0.1:7878 when none is saved. The Agents page left out `flats connect <origin>` on any loopback address, so a console on another loopback port showed plugin and CLI blocks that talk to a different host. Leave it out only on http://127.0.0.1:7878, name that default in the CLI note, and test that the page keeps it equal to the CLI's DefaultURL.
The check that the JSON output keeps its shape only looked for the word plugin. Decode the output and compare its keys at each level with what mcpConfig writes, so an added or removed field fails the test.
Summary
A user with a running host could not tell how to connect an agent from the CLI.
flats connectsounds like the answer but only chooses the host.flats help <command>printed a single usage line. The console's Settings > Agents page lacked the plugin, the Codex approval caveat thatflats mcp-configprints, and any way to check the connection.This change adds that guidance. It changes text and layout only.
Changes
CLI
flats connectsays it only chooses the host and points toflats mcp-config. It prints this for every host source (saved,FLATS_URL,--url, default) and not for--json,--clearor a save.flats helpends with a pointer toflats statusandflats mcp-config. Theconnect,mcpandmcp-configsynopses say what the commands do.flats help <command>and<command> -hprint the usage line first (unchanged), then the synopsis and, forconnect,mcp,mcp-configandclient, a description.-hthen lists the flags.--urlis namedURLin-houtput. It printed-url flats connectbecause the usage text contained a backticked phrase, which Go'sflagpackage uses as the argument name.flats mcp-configtext names the plugin install commands for Claude Code and Codex and points todocs/agents.md#pluginfor Cursor. Its description says--jsonhas the registration commands without the plugin commands, because that is what the JSON holds.Console, Settings > Agents
default_tools_approval_mode = "approve"and the trusted-agents caveat thatflats mcp-configprints.http://127.0.0.1:7878, the plugin and CLI blocks start withflats connect <origin>. The plugin and the CLI use the host saved on their own machine, orhttp://127.0.0.1:7878when none is saved, so any other address (another device, or a loopback console on another port) has to be saved first. The CLI tab's note names that default.#line. The Cursor plugin block's follow-up step ("Then install Flats from the Cursor plugin list") is in the block title, which is not copied. The Codex TOML block is a config file and keeps its comments.check_client, and thatflats statusandflats mcp-configwork from a terminal.Docs
docs/agents.mdanddocs/surfaces.md. The README paragraph aboutget_runtime_referenceis unchanged, asTestRuntimeDocsDiscoveryConsistencyrequires.Later commits
The review record below covers the first commit,
4edceaf. Three commits came after it:5dcc865(fix(console): keep the Cursor plugin snippet free of shell quotes #177, merged into this branch): the zsh paste fix above. The Cursor plugin block had a# ...line with an apostrophe, so a pasted block stopped atquote>or printedcommand not found: #.ui_test.mjsasserts that no copied block holds an apostrophe and no shell block holds a#line.fb21947: the first commit left outflats connect <origin>on any loopback address. A console on another loopback port (a custom management port, or a Compose port mapping) then showed plugin and CLI blocks that talk tohttp://127.0.0.1:7878, a different host. Now the line is left out only onhttp://127.0.0.1:7878.ui_test.mjscovershttp://127.0.0.1:17878andhttp://localhost:7878, andTestAgentsDefaultOriginMatchesCLIkeeps the page's default equal to the CLI'sDefaultURL. Restoring a loopback-only check fails the new assertion. An independent review of this commit approved it with no findings.go vetandgo test -count=1 ./internal/console ./internal/clipass.035e4ac:TestMCPConfigNamesPluginInstalldecodesmcp-config --jsonand compares its keys at each level with whatmcpConfigwrites, instead of only checking that the wordpluginis absent. Adding a field fails it.Not changed
--jsonoutput of every command, exit codes, flag names, MCP tools and instructions,flats statusoutput, and the plugin skill (so no bootstrap revision change).Compatibility
Bare
flats connectgains a last line. Its first line is unchanged. No script in the repository parses it.Verification
gofmt -l .is empty andgo vet ./...exits 0.go test ./... -count=1passes in every package, including the node console UI test.make docs-verifyandmake docs-auditexit 0. The audit warns only about files this change does not touch.internal/cli/help_test.go, additions tointernal/cli/connect_test.goand the Agents section ofinternal/console/testdata/ui_test.mjs, including a non-loopback case that restoreslocation.Review record
Authors of all code, tests and docs:
claude-sonnet-5-5. Every review ran in a fresh session on a read-only copy of the exact snapshot, with the modelclaude-fable-5-1. The effective model came from execution metadata (claude -p --output-format json,modelUsage), not from the model's own answer. The reviewer is the same vendor as the author. No reviewer from another family was available on the machine.VERDICT: APPROVEVERDICT: APPROVEVERDICT: REJECTflats help mcp-configsaid--jsonprints "the same commands", but the JSON has no plugin commands. Fixed. Also 6 suggestions, all accepted. One of them was a real bug: a single Copy button copied two alternativesVERDICT: APPROVEIMPLEMENTATION CARRY-FORWARD: ACCEPTandTESTING VERDICT: APPROVE-hexception list, the weak block-name assertion, the one-source hint test and the report overstatement. The fifth covered three smaller surviving mutations, which are listed under LimitationsIMPLEMENTATION CARRY-FORWARD: ACCEPTandTESTING VERDICT: APPROVEIMPLEMENTATION CARRY-FORWARD: ACCEPTandTESTING VERDICT: APPROVEThe design record, the verification report and the full reviewer reports are in a local-only task report on the author's machine, so a remote reader cannot open them. The verdict lines above are quoted exactly. The review budget was raised from 6 to 7 invocations, with the reason recorded, for the last carry-forward.
Limitations and follow-up
flats connect <origin>(another device, another loopback port or name) are covered by the unit test only. The browser reached the host on loopback.mcpandmcp-configsynopses, the Copy buttonaria-labeltext, that the direct blocks omitflats connect <origin>, and that the Codex approval line sits only in the direct block.flats help <command>prints the synopsis for every command, but only four have a longer description. The other commands can get one later.For the maintainer
Main moved after this branch was cut, from
a831c45to1ce795d(#173, #176, #178, #179, #180, #181).b3e3018merges that main into this branch without conflicts;README.md,docs/surfaces.md,app.cssandui_test.mjshad changed on both sides. Before the push,go build ./..., the cli, console, docs and plugins tests, the docs-budget shard andmake docs-checkpassed on the merged tree.test (docs)timed out on earlier heads inTestGuestBusyResendKeepsOrder, a test from #180 that also failed on main. #181 fixed it, and every required check passes onb3e3018.The #177 commit carries a
Co-authored-by: gormes-agent[bot]trailer, which a squash merge would likely carry onto main.Check that the required checks ran on the current head before merging.