Skip to content

feat(onboarding): add pup commands for the agentic onboarding API#640

Draft
tedkahwaji wants to merge 2 commits into
DataDog:mainfrom
tedkahwaji:feat/onboarding-api-commands
Draft

feat(onboarding): add pup commands for the agentic onboarding API#640
tedkahwaji wants to merge 2 commits into
DataDog:mainfrom
tedkahwaji:feat/onboarding-api-commands

Conversation

@tedkahwaji

Copy link
Copy Markdown

Summary

Adds a pup onboarding command group that wraps the three public routes of the agentic-onboarding-api, so an AI assistant can run pup 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/skills
    • pup 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 with data.id = session id)
  • src/commands/mod.rs — registers the module.
  • src/main.rsOnboarding command, Onboarding*Actions enums, dispatch arm (no validate_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 shared client::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_id query forwarding, plus negative cases (invalid intent, invalid status, 404 surfacing).
  • CLI plumbing confirmed via --help on each subcommand.

🤖 Generated with Claude Code

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>
@tedkahwaji

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/main.rs
Comment on lines +6541 to +6542
#[arg(long = "skill-id")]
skill_ids: Vec<String>,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@tedkahwaji

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant