npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

conso-cli

v0.8.0

Published

Console Platform CLI — query projects, pipelines, services, resources and more

Readme

conso-cli

让 AI Agent 操作 Console —— 服务、Pod、流水线、环境变量、动态配置

npm version License: MIT


Console 是 Kanyun 的部署运行平台。人用网页操作 Console 就行;conso-cli 是给 AI agent 用的——让 agent 能查服务状态和 Pod、触发构建部署、 管环境变量和动态配置,在安全围栏内自主完成运维操作。

它和 octo-cli 互补,一起构成 agent 的运维信息 + 执行能力:

| | conso-cli | octo-cli | |---|---|---| | 领域 | 部署——什么版本在跑、怎么部署的、怎么配置的 | 运行时——跑得怎么样、有没有异常 | | 数据 | Console(服务/Pod/流水线/环境变量/资源) | Octopus(日志/链路/指标/告警/RUM/事件) | | | 能(deploy / env-set / fdc publish) | 不能(只读) |

线上问题多种多样,排查路径每次不同。两个 CLI 提供的是信息渠道和执行能力,不是写死的流程。 怎么组合、怎么推理——交给 agent。

让 agent 用上 conso-cli

1. 安装 conso-cli 和 skill

# 全局安装 CLI(agent 需要这个才能跑命令)
npm install -g conso-cli

# 安装 skill(让 agent 知道怎么用 conso-cli)
npx reskill install @kanyun/conso-cli -a claude-code cursor codex -y

skill 装的是用法知识(命令索引、三种日志区分、部署门禁、secrets 处理、安全规则), 随 conso-cli 版本更新。CLI 和 skill 要都装——光有 skill 没有 CLI,agent 跑命令会报 command not found。

2. 配置认证

agent 自己跑不了交互登录(要开浏览器读剪贴板),需要你配一次:

# 你在终端里跑(不是 agent)
conso-cli login --auto                  # 交互式,开浏览器读 token
conso-cli login --auto -p my-project    # 带默认项目

或通过环境变量(CI / MCP server / agent host):

export CONSOLE_TOKEN_GARAGE=<token>      # infra-garage / phoenix / piplinx / 大部分 API
export CONSOLE_TOKEN_FDC=<token>         # fdc-console(动态配置)
export CONSOLE_PROJECT=my-project        # 默认项目

3. 在项目里 init(可选但推荐)

# 在项目 repo 里跑一次
npx conso-cli init
# → 生成 CONSOLE.md(项目规则模板,agent 扫代码后填写:敏感服务、部署流程、已知坑)
# → 安装/更新 conso skill
# → 写 .claude/rules/console.md 指针

4. 配 MCP server(可选,查询更高效)

{
  "mcpServers": {
    "console": {
      "command": "conso-cli",
      "args": ["mcp"],
      "env": {
        "CONSOLE_TOKEN_GARAGE": "...",
        "CONSOLE_TOKEN_FDC": "...",
        "CONSOLE_PROJECT": "my-project",
        "CONSOLE_ALLOWED_PROJECTS": "my-project",
        "CONSOLE_REQUIRE_PROJECT_MEMBER": "true"
      }
    }
  }
}

装完后 agent 有两条通道:查询走 MCPconsole_* 工具,无副作用),写操作走 CLI (触发确认门禁)。

5. SDK — 在 Node.js 服务里封装 Console 操作(可选)

除了 CLI 和 MCP,conso-cli 还导出 SDK。适合在 Node.js 应用里直接调用 Console API, 不走 CLI 命令行——比如内部平台封装 Console 操作、自动化脚本、服务端集成。

import { ConsoleClient } from 'conso-cli/sdk';

// 用环境变量认证(CONSOLE_TOKEN_GARAGE / CONSOLE_TOKEN_FDC)
const client = new ConsoleClient();

const services = await client.serviceDetail('my-project');
const status = await client.pipelineDetail(4989341, 'rush-agent-version');
await client.createService({
  project: 'my-project',
  name: 'my-worker',
  fromService: 'my-app',
  envs: ['testing'],
});

也支持显式传 token(服务端场景,不依赖环境变量):

const client = new ConsoleClient({
  tokens: {
    garage: process.env.CONSOLE_TOKEN_GARAGE,
    fdc: process.env.CONSOLE_TOKEN_FDC,
  },
});

SDK 和 CLI/MCP 共用同一个 ConsoleClient,安全检查(项目白名单、成员校验)一致。 写操作没有 CLI 的 prompt 确认——SDK 调用方自己负责安全。

安全围栏

conso-cli 操作生产基础设施。安全不是附加功能,是设计起点。

写操作门禁:

  • 每次写操作 prompt 确认
  • production 要打全 "yes"(不是 "y")
  • 非 TTY(管道/子 agent)阻塞,除非显式 --yes
  • 跨项目写二次确认
  • Console 后台 audit gate:canary/prod 没审计过就拒
  • P0 / archived 项目拒绝自治写

secrets 默认脱敏: env-varslogspod-logsfdc get 的密钥值默认 [REDACTED]。要原始值得显式传 --include-secrets。agent 不会意外泄露密钥。

MCP 只读,CLI 可写: MCP server 暴露 console_* 查询工具但故意不暴露写操作。agent 查询走 MCP(无副作用), 写操作必须走 CLI(触发确认)。两个通道职责分离。

项目级权限控制: 在项目 repo 的 .claude/settings.json 里配 glob,限定 agent 只能跑特定命令:

{
  "permissions": {
    "allow": [
      "Bash(npx conso-cli health -s agenthub*)",
      "Bash(npx conso-cli pods -s agenthub*)"
    ]
  },
  "env": {
    "CONSOLE_PROJECT": "pilot",
    "CONSOLE_ALLOWED_PROJECTS": "pilot"
  }
}
  • 安全读(healthpods)放 allow,自动放行,限定到服务
  • 带 secrets 的读(env-varslogspod-logs)不放 allow——它们接受 --include-secrets, 尾部 * 拦不住 --service=worker --include-secrets 泄露其他服务
  • 写命令不放 allow——每次 prompt 让人批。glob 无法可靠约束 --service/--stage (重复 flag、= 语法绕过)
  • CONSOLE_PROJECT 选目标项目;CONSOLE_ALLOWED_PROJECTS 运行时白名单——conso-cli 进程内 强制检查,--yes 和 flag tricks 绕不过。两个都设
  • deny 放永远不许跑的命令(如 service-delete
  • Claude Code 会合并 user/local/project 的 allow;别处更宽的规则可能覆盖意图,用 /permissions 检查

详见 conso skill 的 "Agent host permission scoping" 章节。

skill + CONSOLE.md 二层上下文: conso skill 装通用用法(命令索引、三种日志区分、安全规则)。init 生成 CONSOLE.md—— 项目特定规则(哪些服务敏感、部署审批流程、已知坑),agent 扫代码后填写。两层一起, agent 既有通用能力又有项目特定上下文。

三种日志——别搞混

| 想要 | 命令 | 来源 | |------|------|------| | 应用日志(代码里的 log.info) | logs -s <svc> -e <env> | Console SLS | | 容器原始日志(kubectl logs) | pod-logs <pod> -s <svc> | Plume / K8s | | 流水线构建/部署任务日志 | pipeline-log <id> --stage <stage> | Console / Jenkins |

命令

查询(只读)

| 命令 | 说明 | |---------|-------------| | whoami | 当前用户 | | meta | 项目元数据 | | members | 项目成员 | | services | 服务列表 + 运行状态 | | pods | Pod 实例 | | logs | 服务运行日志(SLS) | | pod-logs <podName> | 容器原始日志(Plume/K8s) | | pod-events <podName> | K8s 事件 | | pod-describe <podName> | Pod 状态 + K8s 事件 | | health | 服务状态 + Pod + 路由汇总 | | ingress | 路由 / ingress 配置 | | replicas | 副本状态 | | resources | 项目资源(Redis/MySQL/MQ/OSS) | | env-vars | 环境变量(默认脱敏) | | pipelines | 流水线构建列表 | | pipeline-history | 部署历史 | | pipeline-status | 流水线阶段状态 + Jenkins 映射 | | pipeline-log | 部署任务日志 / Jenkins 构建日志 | | pipeline-settings | 流水线设置 | | deployments | 当前部署(piplinx) | | events | 操作历史 | | alerts | 告警渠道配置 | | score | 项目质量分 | | governance | 服务治理(RPC) | | jobs | 定时任务 | | urls | Console/Jenkins/Plume 浏览器跳转 URL | | fdc list | FDC 配置列表 | | fdc get [name] | FDC 配置 KV | | fdc status | FDC 配置状态 |

写(需确认)

| 命令 | 说明 | |---------|-------------| | env-set <KEY=VALUE...> | 设置环境变量 | | env-del <keys...> | 删除环境变量 | | service-create <name> | 创建服务(克隆元数据/环境) | | service-delete <name> | 删除服务 | | pipeline-build | 触发构建 | | pipeline-deploy [pipelineId] | 触发部署(--service 部署单个服务) | | deploy [pipelineId] | pipeline-deploy 别名 | | redeploy | 重新部署当前候选 | | service-deploy-mode <on\|off> | 开关单服务独立部署 | | pipeline-stop | 中止部署 / 停 Jenkins 构建 | | deployment-abort <deploymentId> | 中止 Console/Saber 部署 | | fdc create <name> <config> | 创建 FDC 配置 | | fdc publish <name> <config> | 更新并发布 FDC 配置 | | exec <command> | 在 Pod 里执行命令(kubeshell) |

使用示例

服务 & Pod

conso-cli services                            # 服务列表
conso-cli pods -s my-service -e production    # 生产 Pod
conso-cli health -s my-service -e testing    # 状态 + Pod + 路由
conso-cli pod-describe my-pod -s my-service -e testing
conso-cli pod-logs my-pod -s my-service --tail 200

环境变量

conso-cli env-vars -s my-service -e production      # 列出(默认脱敏)
conso-cli env-set FOO=bar BAZ=qux -e testing        # 设置(需确认)
conso-cli env-del FOO BAZ -e testing                # 删除(需确认)

构建 & 部署

conso-cli pipelines -s my-service -n 5                  # 最近 5 次构建
conso-cli pipeline-build -p my-project -b master        # 触发构建
conso-cli deploy --service my-service --stage testing   # 部署单个服务
conso-cli redeploy -s my-service --stage testing        # 重新部署当前候选
conso-cli pipeline-status 4570257 --stage testing       # 查进度
conso-cli pipeline-log 4570257 --stage testing --tail 80 # 部署任务日志

单服务独立部署

项目有多个服务时,开启后可以只部署一个不碰其他:

conso-cli service-deploy-mode on -p my-project
conso-cli deploy --service my-service --stage testing -p my-project

FDC 动态配置

conso-cli fdc list                              # 所有配置
conso-cli fdc get my-config                     # KV(默认脱敏)
conso-cli fdc create my-config '{"k":"v"}' -e test -d "用途"
conso-cli fdc publish my-config @config.json -e online

跨项目

conso-cli services -p other-project           # 查(无需确认)
conso-cli env-set FOO=bar -p other-project    # 写(二次确认)

结合 octo-cli

octo-cli 看运行时行为(日志/链路/指标/告警/RUM/事件), conso-cli 看部署状态(服务/Pod/流水线/环境变量/资源)。两个一起,agent 有完整的运维信息。

conso-cli 的信息渠道和执行能力:

| 能力 | 命令 | |------|------| | 什么版本在跑 | pipelines / pipeline-history / deployments | | Pod 状态 / 容器日志 | pods / pod-logs / pod-describe / pod-events | | 环境变量 / 动态配置 | env-vars / fdc get / fdc list | | 服务健康 / 路由 | health / ingress / replicas | | 项目资源 | resources(Redis/MySQL/MQ/OSS) | | 部署 / 回滚 / 中止 | deploy / redeploy / pipeline-stop | | 改环境变量 / 配置 | env-set / env-del / fdc publish |

octo-cli 的信息渠道:

| 能力 | 命令 | |------|------| | 日志 / 链路 / 指标 | logs / trace / metrics | | 告警 / 错误追踪 | alerts / issues | | RUM / LLM Span | rum / llm | | 服务拓扑 / 入口 | services topo / services entries | | 部署事件 | events | | 页面 URL → 查询 | 贴 Octopus URL,agent 直接解析查 |

两个 CLI 都有 init + skill + MCP 三层结构。agent 接入一次就有完整上下文—— 拿到的不是固定流程,是信息渠道和执行能力。怎么组合、怎么推理、怎么定位,是 agent 的自由度。

通用选项

| 选项 | 说明 | |--------|-------------| | -p, --project <name> | 目标项目(默认:配置的或 rush-app) | | -e, --env <env> | 环境:productiontesting(因命令而异) | | -s, --service <name> | 服务名(默认:同项目名) | | -o, --output <fmt> | json(默认)、tablejsonl | | -n, --limit <n> | 分页大小 | | -y, --yes | 跳过确认(仅自动化) | | --include-secrets | 显示原始密钥值(默认:[REDACTED]) |

License

MIT