@datadog/ai-setup-cli

中文文档
2.0.37发布于 2026/11/06Apache-2.0TypeScriptES Module近 30 天下载 2987

Interactive tool for Datadog setup

原始使用文档
文档目录7 节
  1. Quick Start
  2. Headless mode
  3. Arguments
  4. Product-specific arguments
  5. Environment variables
  6. Supported Sites
  7. Supported Products

AI Setup CLI

An interactive CLI that uses AI agents to automatically instrument projects with Datadog. Instead of manual SDK integration, this tool leverages Claude to detect your project structure, modify your codebase, and set up Datadog products — frontend, backend, infrastructure, AI, security, and CI testing.

Quick Start

Run it interactively — the CLI walks you through sign-in / sign-up, picks a product group, confirms the workspace, and instruments your code:

npx @datadog/ai-setup-cli --site datadoghq.com

Or skip the picker by passing --product:

npx @datadog/ai-setup-cli --site datadoghq.com --product rum

Headless mode

Use --headless for automated runs (CI, agents, scripts). It skips the interactive UI and requires both --site and --product:

DD_API_KEY=... DD_APP_KEY=... \
  npx @datadog/ai-setup-cli \
  --headless \
  --site datadoghq.com \
  --product rum

Set the DD_API_KEY and DD_APP_KEY environment variables (both are required together), or set DD_ACCESS_TOKEN to a pre-obtained OAuth access token (for example, the one pup forwards to its extensions). Omit all three to use browser OAuth, the only step that may need user input. In remote or fully unattended environments, use the env vars; browser OAuth needs a localhost callback. Keys and DD_ACCESS_TOKEN cannot be combined.

By using --headless, you confirm that source-code upload and automatic command execution are authorized for the target project.

Arguments

ArgumentDescriptionRequiredDefault
--siteDatadog site (see Supported Sites)Yes—
--productProduct to instrument (see Supported Products). Required with --headless; otherwise the CLI shows an interactive picker.No—
--auto-approveAuto-approve all bash commands without promptingNofalse
--headlessRun without the interactive terminal UI. Requires --site and --product. Auth via DD_API_KEY / DD_APP_KEY, DD_ACCESS_TOKEN, or browser OAuth.Nofalse
-h, --helpShow help (includes all product-specific flags)——

Product-specific arguments

Each product can define additional flags in its products/<name>/config.yaml. Pass them as --flag=value. The full set is also printed by --help.

ProductFlagDescription
rum--app-id / --rum-application-idRUM Application ID
rum--rum-client-tokenRUM client token
rum--rum-frameworkFramework (e.g. react, browser)
error-tracking--app-idRUM Application ID for Error Tracking
product-analytics--app-idRUM Application ID
llm-obs--api-keyDatadog API Key
llm-obs--llm-obs-appLLM application name (DD_LLMOBS_ML_APP)
infra-monitoring (Kubernetes)--k8s-products / --enabled-productsComma-separated products to enable (apm, logs, infrastructure, otel). --enabled-products wins if both are set.
infra-monitoring--k8s-distrogke, eks, minikube, aks, …
infra-monitoring--k8s-cluster-nameCluster name
infra-monitoring--k8s-env-nameDD_ENV value
infra-monitoring--k8s-library-versionse.g. java:v1,python:v4,js:v5
infra-monitoring--k8s-target-namespacesNamespaces to include
infra-monitoring--k8s-disabled-namespacesNamespaces to exclude
infra-monitoring--k8s-registryOverride container registry
docker--productsComma-separated products (infra, apm, logs). Default: infra,apm,logs.
docker--library-versionsLanguage tracer/library versions
docker--envDD_ENV value
linux--productsComma-separated products (infra, apm, logs, otel). Default: infra,apm,logs.
linux--envDD_ENV value
ecs--ecs-launch-typeECS launch type (fargate, ec2). Prompts if omitted.
ecs--ecs-deployment-methodDeployment method (terraform, cdk, cloudformation, cli). Prompts if omitted.
serverless--api-keyDatadog API Key
serverless--serverless-compute-typeaws-lambda, gcp-cloud-run, gcp-cloud-run-functions, azure-container-apps (inferred if omitted)
serverless--serverless-runtimenodejs, python, java, ruby, dotnet, go, php (inferred if omitted; php only on Cloud Run/Container Apps)
serverless--development-frameworkaws-cdk, aws-sam, serverless-framework, terraform, ci, other (inferred if omitted)
test-optimization--api-keyDatadog API Key
ci_code_coverage--api-keyDatadog API Key

Environment variables

VariableDescriptionValues
COLOR_THEMEForce light/dark color theme (default: auto-detect via COLORFGBG, falls back to dark)light, dark
COLOR_SCHEMESwitch color schemedatadog (default), high-contrast
DD_API_KEYDatadog API key used by --headless; must be set with DD_APP_KEYAPI key
DD_APP_KEYDatadog application key used by --headless; must be set with DD_API_KEYApplication key
DD_ACCESS_TOKENOAuth access token used by --headless; cannot be combined with DD_API_KEY / DD_APP_KEYAccess token
AI_SETUP_CLI_PACKAGE_MANAGERPackage manager to use in headless mode when it cannot be detectednpm, yarn, pnpm, bun, expo
AI_SETUP_CLI_CLAUDE_PERMISSION_MODEClaude permission mode (defaults to bypassPermissions; use acceptEdits when running as root)bypassPermissions, acceptEdits

Supported Sites

SiteValue
US1datadoghq.com
US3us3.datadoghq.com
US5us5.datadoghq.com
EU1datadoghq.eu
AP1ap1.datadoghq.com
AP2ap2.datadoghq.com
UK1uk1.datadoghq.com

Supported Products

Shown in the interactive picker, grouped by category:

GroupProduct--product value
Infrastructure (pick one)Kubernetesinfra-monitoring
InfrastructureDockerdocker
InfrastructureLinuxlinux
InfrastructureServerlessserverless
InfrastructureAmazon ECSecs
Frontend MonitoringRUMrum
Frontend MonitoringError Trackingerror-tracking
Frontend MonitoringProduct Analyticsproduct-analytics
LLM-Based applicationsLLM Observabilityllm-obs
CI TestingTest Optimizationtest-optimization
CI TestingCode Coverageci_code_coverage

Hidden from the picker but installable via --product=<value>:

Product--product value
App and API Protectionapp_and_api_protection
OpenTelemetryotel
Studiostudio

版本与发布记录

@datadog/ai-setup-cli 共发布 49 个版本,首次发布于 2026/04/08;过去 12 个月发布了 49 个版本。

版本发布日期距今
2.0.37latest2026/11/065 天前
2.0.362026/11/046 天前
2.0.352026/10/3012 天前
2.0.342026/10/3012 天前
2.0.332026/10/2913 天前
2.0.322026/10/2813 天前

关于 @datadog/ai-setup-cli 的常见问题

@datadog/ai-setup-cli 是什么?

Interactive tool for Datadog setup

如何安装 @datadog/ai-setup-cli?

在项目目录运行 npm install @datadog/ai-setup-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ai-setup-cli,可以用 npx ai-setup-cli 直接运行。

@datadog/ai-setup-cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@datadog/ai-setup-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@datadog/ai-setup-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@datadog/ai-setup-cli 可以商用吗?

@datadog/ai-setup-cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@datadog/ai-setup-cli 的下载量有多少?

根据 npm 官方下载统计,@datadog/ai-setup-cli 在 2026/10/12 – 2026/11/10 这 30 天内被下载 2,987 次,日均约 100 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@datadog/ai-setup-cli 还在维护吗?

最新版本 2.0.37 发布于 2026/11/06(5 天前);至今共发布 49 个版本,其中过去 12 个月发布了 49 个;首次发布于 2026/04/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。