feat(onboarding): add pup commands for the agentic onboarding API#640
feat(onboarding): add pup commands for the agentic onboarding API#640tedkahwaji wants to merge 2 commits into
Conversation
Wrap the three public agentic-onboarding-api routes so an AI assistant can
run `pup onboarding ...` instead of raw HTTP calls to fetch onboarding
skills and record sessions.
- skills list / skills get -> GET /api/v2/onboarding/skills[/{id}]
- sessions create -> POST /api/v2/onboarding/sessions (JSON:API envelope)
- Optional auth: routes are OpenAuth, so credentials are attached when
present but never required (unlike client::apply_auth)
Adds src/commands/onboarding.rs with 7 tests covering happy paths,
org_id forwarding, and validation/error cases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e4ac4bb84
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[arg(long = "skill-id")] | ||
| skill_ids: Vec<String>, |
There was a problem hiding this comment.
Require at least one --skill-id
When pup onboarding sessions create omits --skill-id, clap derives Vec<T> as 0.. occurrences with required(false) (clap derive docs), so this command still parses and posts skill_ids: []. That can record an unusable onboarding session or defer a required-input error to the backend even though the help describes a touched skill ID; add required = true/a minimum count or an explicit empty check before posting.
Useful? React with 👍 / 👎.
clap derives Vec<String> as optional, so `sessions create` would post an empty skill_ids and defer the error to the backend. Mirror the API's SessionStatus.IsTerminal() rule client-side: require at least one --skill-id for completed/failed/abandoned, still allow empty for in_progress. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6784b62eab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| query.push(("org_id", o.as_str())); | ||
| } | ||
|
|
||
| let path = format!("{SKILLS_PATH}/{skill_id}"); |
There was a problem hiding this comment.
Percent-encode skill IDs in the request path
If a skill ID returned by skills list contains reserved URL characters such as / or ?, interpolating it directly into the path changes the route or starts a query string before reqwest sends the request, so pup onboarding skills get can fetch the wrong URL or 404. Other raw path construction in this repo uses util::percent_encode for IDs with reserved characters; apply the same encoding before appending skill_id to /skills/.
Useful? React with 👍 / 👎.
Summary
Adds a
pup onboardingcommand group that wraps the three public routes of the agentic-onboarding-api, so an AI assistant can runpup onboarding …instead of raw HTTP calls to discover onboarding skills and record sessions.Changes
src/commands/onboarding.rs(new) — three commands + a small optional-auth HTTP layer:pup onboarding skills list [--org-id N]→GET /api/v2/onboarding/skillspup onboarding skills get <skill_id> [--intent …] [--onboarding-run-id …] [--org-id N]→GET /api/v2/onboarding/skills/{skill_id}pup onboarding sessions create --session-id … --skill-id … --summary … --status … [--org-id N]→POST /api/v2/onboarding/sessions(JSON:API envelope withdata.id= session id)src/commands/mod.rs— registers the module.src/main.rs—Onboardingcommand,Onboarding*Actionsenums, dispatch arm (novalidate_auth()).Auth is opportunistic: these routes are
OpenAuth, so credentials are attached when present (OAuth bearer or API+App key) but never required — the flow works before a customer is authenticated, unlike the sharedclient::apply_auth.Testing
cargo build,cargo clippy --all-targets -- -D warnings,cargo fmt --check— all clean.cargo test onboarding— 7 tests pass: happy paths,org_idquery forwarding, plus negative cases (invalidintent, invalidstatus, 404 surfacing).--helpon each subcommand.🤖 Generated with Claude Code