feat(cli): hf user create --agent-id/--claw-identifier + hf user bind-agent #6
Reference in New Issue
Block a user
Delete Branch "feat/user-bind-agent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements NEXT_WAVE_DEV_DIRECTION.md §7.3 — never shipped before. Backend
POST /usershas acceptedagent_id+claw_identifiersince BE-CAL-003 but the cli never sent them, so historically every agent user (zhi/lyn/mirror/sherlock/orion/nav on prod today) ended up with only a user row — agents table empty, all downstream calendar/heartbeat/schedule-type flows that go through_require_agent()404.hf user create— new flagsBoth required together (matches backend invariant). Either can come from pcexec env:
AGENT_IDenv for agent-id,openclaw config get plugins.harbor-forge.identifierfor claw-identifier. Partial pair → treated as "neither" so plain user creation (no binding intended) still works without a 400.hf user bind-agent <username>— NEWBackfills agents row for an existing user.
PATCH /users/{username}/bind-agent. Same flags + pcexec env fallback. Errors out if pair can't be resolved (the binding is the whole point of this command).Pairs with HF.Backend PR #20 (the bind-agent endpoint).
🤖 Generated with Claude Code
Implements NEXT_WAVE_DEV_DIRECTION.md §7.3 (was 4 lines of spec, never shipped). Backend's POST /users has accepted agent_id+claw_identifier since BE-CAL-003 but the cli never sent them, so historically every agent user (zhi/lyn/mirror/sherlock/orion/nav on prod today) was created with only the user row — agents table left empty, and all downstream calendar/heartbeat/schedule-type flows that go through _require_agent() returned 404. ## hf user create — new flags --agent-id <id> --claw-identifier <id> Both required together (matches backend invariant). Either can come from pcexec env: AGENT_ID env for agent-id, `openclaw config get plugins.harbor-forge.identifier` for claw-identifier. Partial pair is treated as "neither" so plain user creation (no binding intended) still works without a 400. ## hf user bind-agent <username> — NEW subcommand Backfills agents row for an existing user. PATCH /users/{username}/bind-agent. Same accept --agent-id/--claw-identifier flags + pcexec env fallback. requireBoth=true here — fail loudly if the pair can't be resolved since the whole command is the binding. ## Wiring - userCreatePayload gains AgentID + ClawIdentifier omitempty fields - new userBindAgentPayload struct (both required) - resolveAgentBinding helper shared by both commands - main.go user create case parses --agent-id/--claw-identifier; new user bind-agent case parses positional username + the same flags - surface.go lists bind-agent so `hf user` and `hf --help` show it Build: clean. Smoke-tested both subcommand usage strings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>