Files
d349868c31 feat(agents): one definition per coding agent, and Cursor's CLI
Every list of the coding agents now derives from internal/agents'
registry, one Def each, and Cursor's CLI (cursor-agent) is a fifth
agent.

The registry:
- each agent's login command, login formats and capture on its Def;
  one message for every agent where each had its own
- the agents' table, the README's list and the docs' history lists are
  generated from the registry (cli.DocBlocks, TestDocBlocks); scripts
  and Go tests take their lists from it too
- each agent's own code lives in a file named for it; the structure
  test lets only an agent's own files choose by its name, following
  constants named after an agent
- a VM remade by clone on/off keeps no agent's login files
  (agents.LoginFiles from every Def.Logins; Claude Code's .claude.json
  stays, as it is also history)

Cursor's CLI:
- `devvm --agents cursor`, `devvm agent login cursor`, history import
  and export of ~/.cursor/chats
- the proxy captures its login at a GET endpoint, guards a shared host
  by path, and puts the login in only where the CLI sends it, bound to
  the CLI's 57 methods
- account changes and the agent store are refused in a VM; Cursor's
  headers and trailers are scanned for tokens
- e2e: Cursor's CLI in the network section, its poll behind the fake
  company proxy

Docs: the agents' pages lead with commands, with a How it works page
for the agents.

Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:49:48 -07:00

45 lines
1.2 KiB
Go

// Command docgen writes the CLI reference, docs/content/docs/cli/, from
// devvm's commands: one Hugo page per command users can run, and the
// section's _index.md. It also writes the hand-written pages' generated
// blocks (cli.DocBlocks), such as the docs' table of the agents. Run it
// with mise run cli-docs, which gives it the repo's root.
package main
import (
"io"
"log"
"os"
"path/filepath"
"strings"
"github.com/spf13/cobra"
"github.com/devvmhq/devvm/internal/cli"
"github.com/devvmhq/devvm/internal/ui"
)
func main() {
if len(os.Args) != 2 {
log.Fatal("usage: docgen ROOT")
}
if err := run(os.Args[1]); err != nil {
log.Fatal(err)
}
}
// run writes the reference and the pages' generated blocks below root, the
// repo's root.
func run(root string) error {
if err := write(newRoot(), filepath.Join(root, "docs", "content", "docs", "cli")); err != nil {
return err
}
_, err := blocks(root, false)
return err
}
// newRoot is devvm's command, for its pages only: none of it runs, so its
// UI has no input and prints nowhere.
func newRoot() *cobra.Command {
return cli.NewRoot(ui.New(strings.NewReader(""), io.Discard, io.Discard, func(string) string { return "" }))
}