canopy-cli-tree-create-root-message-required
The repo isn't checked out in this environment (working dir is empty except for /workspace/problem.json), so I reconstructed the exact, directly-usable fix from the detailed recipe and wrote it to /workspace/SOLUTION.md.
Root cause: cmd/canopyd/cli.go's treeCreateRequest only serialized {title}. Since GAP-008 the trees endpoint (POST /api/v1/trees) is camelCase and requires rootMessage.content — the CLI never sent it, so the server rejected with [VALIDATION_ERROR] tree service: root message content is required. (The nodes API is snake_case; the trees API is camelCase — never mix them here.)
The fix (4 parts):
1. treeCreateRequest gains RootMessage *rootMessage json:"rootMessage,omitempty" + Description omitempty; new rootMessage{content, contentFormat, nodeType} type, all camelCase.
2. treeCreate → treeCreateE (returns exit code) with a manual arg scan accepting --content/--message before or after the positional name, plus --content=/--message= forms; missing content → client-side error + exit 1 (no doomed API round-trip).
3. runTreeCmdE returns exit codes and handles -h/--help at the dispatch level for tree + list/delete/navigate — so tree create --help (previously created a tree named --help) and tree --help (previously "unknown subcommand") now exit 0 with zero HTTP.
4. Docs updated to tree create "Name" --content 'text'.
Verification: exact camelCase marshal assertion (no snake_case keys), parse-args table, help-exits-0-before-HTTP tests; build with go build -o /tmp/canopyd ./cmd/canopyd (NOT root go build ., which yields a 72KB ar archive); live 201 check needs CANOPY_SERVER_URL + CANOPY_TOKEN (dev JWT extracted from frontend/vite.config.ts by joining concatenated quoted segments via regex, since a single grep won't work). PASS criterion: canopyd tree create 'X' --content 'hello' → 201.
# Evidence - Problem class: canopy-cli-tree-create-root-message-required - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-18T06:21:59.579Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Hermes Canopy CLI bug class: `canopyd tree create <name>` fails with '[VALIDATION_ERROR] tree service: root message content is required'. Root cause: cmd/canopyd/cli.go treeCreateRequest struct sent only {title} while POST /api/v1/trees requires camelCase rootMessage.content since GAP-008 (tree handler is camelCase \u2014 rootMessage{content, contentFormat, nodeType}; never snake_case for this endpoint; nodes API is snake_case, trees API is camelCase). Fix recipe (proven 2026-08-18, commit a41449a, judge PASS): (1) treeCreateRequest gains RootMessage *rootMessage json:\"rootMessage,omitempty\" + Description omitempty; (2) treeCreate refactored to treeCreateE (returns exit code) with manual arg scan supporting --content/--message before OR after the positional name, plus --content=/--message= forms; missing content -> client-side error + exit 1 (no doomed API round-trip); (3) runTreeCmdE with dispatch-level --help/-h handling on tree + list/delete/navigate (previously `tree create --help` created a tree named '--help' and `canopyd tree --help` printed 'unknown tree subcommand'); (4) update docs examples (INTEGRATION.md \u00a74 + README) to `tree create \"Name\" --content 'text'`. Verification recipe for local live checks: build fresh `go build -o /tmp/canopyd ./cmd/canopyd` (root `go build .` yields a 72KB ar archive \u2014 wrong); the CLI requires auth: CANOPY_SERVER_URL=http://localhost:8091 plus CANOPY_TOKEN=<dev JWT> \u2014 the dev JWT lives in frontend/vite.config.ts DEV_JWT_DEFAULT, which is split across CONCATENATED string literals (extract with a regex over the quoted segments joined, not a single grep); without the token the CLI errors [TOKEN_MISSING]. PASS criterion: `canopyd tree create 'X' --content 'hello'` returns 201. Tests: marshal assertion for exact camelCase body (no snake_case keys), parse-args table, help exits 0 before any HTTP.", "environment": "production", "language": "go", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "canopy-cli-tree-create-root-message-required", "provider": "openrouter", "solved_at": "2026-08-18T06:21:59.580Z", "version": "1.26"}