Skip to content

feat(setup): Add AI-CLI Pup Setup command - #881

Draft
tedkahwaji wants to merge 1 commit into
DataDog:mainfrom
tedkahwaji:teddy.kahwaji/first-party-extension-autoinstall
Draft

tedkahwaji wants to merge 1 commit into
DataDog:mainfrom
tedkahwaji:teddy.kahwaji/first-party-extension-autoinstall

Conversation

@tedkahwaji

@tedkahwaji tedkahwaji commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

The following change adds pup setup, which runs Datadog's AI Setup CLI through npx with the user's pup login.

We're consolidating AI Setup into pup so users and agents have one Datadog CLI. AI Setup stays its own Node.js package on npm, and pup setup runs npx -y --package @datadog/ai-setup-cli@latest ai-setup-cli with every argument passed through. That keeps AI Setup releasing on its own schedule and needs no extension install, at the cost of requiring Node.js 22+. The standalone npx @datadog/ai-setup-cli keeps working.

PR Stack

  1. Signup service (Datadog internal): https://github.com/ddoghq/dd-source/pull/120923
  2. AI Setup headless token (Datadog internal): https://github.com/ddoghq/ai-setup-cli/pull/497
  3. AI Setup JSON help and pup login reuse (Datadog internal): https://github.com/ddoghq/ai-setup-cli/pull/501
  4. pup setup command: feat(setup): Add AI-CLI Pup Setup command #881 <- Current PR
  5. pup on npm: feat(npm): Publish pup as npm package #915

You can find implementation details in the design doc (Datadog internal) and test cases in the test plan (Datadog internal).

Changes

  • Node.js check: requires Node.js 22+ and npx, prints install instructions when either is missing, and sends one best-effort event to the Datadog logs intake so we can measure how often Node blocks setup.
  • Auth: forwards pup's token as DD_ACCESS_TOKEN. In agent or non-terminal runs with no login, pup points new users to sign-up and runs its own login first. At a terminal, AI Setup's own sign-in runs, then pup offers to log in too.
  • Logins started by setup request api_keys_read, which AI Setup needs to write the org's API key into the project.
  • --site given to setup becomes pup's site for the run, so the login, the site check and AI Setup all agree.
  • pup setup --help shows AI Setup's products and flags in pup's format, as text or agent JSON.
  • pup's global flags after setup, such as --org and --read-only, are handled by pup. Read-only mode blocks setup but allows its help.
  • PUP_SETUP_AI_SETUP_PACKAGE overrides the npm package, to test unreleased AI Setup builds.

@tedkahwaji tedkahwaji changed the title POC: offer to install first-party extensions on first use POC: built-in pup setup command that installs its extension on first use Oct 5, 2026
@tedkahwaji tedkahwaji changed the title POC: built-in pup setup command that installs its extension on first use feat(setup): add pup setup to run AI Setup from npm Oct 5, 2026
@datadog-datadog-prod-us1

This comment has been minimized.

@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 4 times, most recently from 37b16df to 29afbd1 Compare October 13, 2026 17:35
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 3 times, most recently from c8afc35 to e60a79a Compare October 14, 2026 15:00
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch from e60a79a to 67807f1 Compare October 14, 2026 16:42
@tedkahwaji tedkahwaji changed the title feat(setup): add pup setup to run AI Setup from npm feat(setup): add pup setup Oct 14, 2026
@tedkahwaji tedkahwaji changed the title feat(setup): add pup setup feat(setup): Add AI-CLI Pup Setup command Oct 14, 2026
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch 2 times, most recently from d660660 to a8dc0d1 Compare October 14, 2026 16:59
`pup setup` runs Datadog's AI Setup CLI with
`npx -y --package @datadog/ai-setup-cli@latest ai-setup-cli`, passing every
argument through. AI Setup is already published to npm, so this needs no
extension install, release repository or checksums, at the cost of
requiring Node.js 22+ when `setup` runs.

- Checks for Node.js 22+ and npx, prints how to install what is missing,
  and sends one best-effort log event (setup_prerequisite_missing,
  service:setup-cli, 2s timeout) to the Datadog logs intake, the channel AI
  Setup uses for its own telemetry, so we can measure how often Node is
  missing. It needs no login, and includes the org UUID (dd_oid) when pup
  has a session.
- Forwards pup's session as DD_ACCESS_TOKEN. When an OAuth session exists,
  shell API/app keys are dropped, and a lone key is never forwarded. The
  help lookup uses the same environment.
- `--site` passed to setup becomes pup's site for the run, so the site
  check, the forwarded session and AI Setup's `--site` all agree.
- Adds --headless and --site in agent mode or when stdin/stdout isn't a
  terminal; a person at a terminal gets AI Setup's interactive flow unless
  they pass --headless.
- Headless runs with no session point people without an account to the
  sign-up page and run pup's OAuth login first. At a terminal, AI Setup's
  own sign-in runs, and pup offers to log in too after a successful run.
- Logins started by pup setup request api_keys_read, which AI Setup needs
  to write the org's API key into the project. A saved session without it
  gets one more login; `pup auth login` is unchanged. `auth::login` now
  returns the session it saved, so setup continues with the right session
  when the login lands in another region or org.
- `pup setup --help` builds a setup command from AI Setup's --help --json
  and renders it with pup's agent schema or clap help, so new products and
  flags show up without a pup release. Flags AI Setup requires in headless
  mode, such as --product, are marked required in the agent schema, and
  the schema says setup passes AI Setup's output through (ending with an
  AI_SETUP_RESULT line in headless runs) instead of returning an API body.
  `pup setup help` and `pup help setup` are aliases.
- pup's global flags work after `setup`, and `pup setup --read-only` is
  blocked, though `pup setup --help` still works in read-only mode.
- PUP_SETUP_AI_SETUP_PACKAGE overrides the package spec (version, tag,
  tarball path or file: spec) to test unreleased AI Setup builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tedkahwaji
tedkahwaji force-pushed the teddy.kahwaji/first-party-extension-autoinstall branch from a8dc0d1 to 2f7c012 Compare October 14, 2026 17:11

This branch has not been deployed

No deployments
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