stackone-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

StackOne CLI — Connector Development

StackOne CLI — 连接器开发

Important

重要说明

The CLI is actively developed and commands change between versions. Before providing CLI guidance:
  1. Fetch
    https://docs.stackone.com/guides/connector-engine/cli-reference
    for the current command reference
  2. Fetch
    https://www.npmjs.com/package/@stackone/cli
    for the latest version
Do not guess CLI commands or flags — always verify against live docs.
该CLI正处于活跃开发阶段,不同版本间的命令会有所变化。在提供CLI指导之前:
  1. 获取
    https://docs.stackone.com/guides/connector-engine/cli-reference
    以获取当前的命令参考文档
  2. 获取
    https://www.npmjs.com/package/@stackone/cli
    以查看最新版本
请勿猜测CLI命令或参数——始终对照实时文档进行验证。

Instructions

操作步骤

Step 1: Install the CLI

步骤1:安装CLI

bash
npm install -g @stackone/cli
This installs the global
stackone
command. Verify with
stackone --version
.
bash
npm install -g @stackone/cli
此命令会安装全局的
stackone
命令。可通过
stackone --version
验证安装是否成功。

Step 2: Understand when to build a custom connector

步骤2:了解何时需要构建自定义连接器

Custom connectors are for platforms that StackOne doesn't natively support. Before building one:
  • Check if the provider already exists: use the
    stackone-connectors
    skill or browse https://docs.stackone.com/connectors/introduction
  • If the provider exists but is missing specific actions, you may not need a full custom connector — check the Actions RPC endpoint first
自定义连接器适用于StackOne未原生支持的平台。在构建之前:
  • 检查该提供商是否已存在:使用
    stackone-connectors
    技能或浏览https://docs.stackone.com/connectors/introduction
  • 如果该提供商已存在,但缺少特定操作,则可能不需要完整的自定义连接器——请先检查Actions RPC端点

Step 3: Initialize a connector project

步骤3:初始化连接器项目

Fetch the connector structure guide for the current project layout:
https://docs.stackone.com/guides/connector-engine/connector-structure
The Connector Engine provides:
  • Project scaffolding
  • Local development server for testing
  • Type-safe action definitions
  • Deployment tooling
获取连接器结构指南以了解当前的项目布局:
https://docs.stackone.com/guides/connector-engine/connector-structure
Connector Engine提供以下功能:
  • 项目脚手架
  • 用于测试的本地开发服务器
  • 类型安全的操作定义
  • 部署工具

Step 4: Use the AI Builder (optional)

步骤4:使用AI构建器(可选)

The AI Builder can generate connector scaffolding from API documentation. Fetch the guide:
https://docs.stackone.com/guides/connector-engine/ai-builder
This accelerates development by generating boilerplate from an OpenAPI spec or API docs URL.
AI构建器可以根据API文档生成连接器脚手架。获取相关指南:
https://docs.stackone.com/guides/connector-engine/ai-builder
通过从OpenAPI规范或API文档URL生成样板代码,这可以加速开发进程。

Step 5: Test locally

步骤5:本地测试

Run the connector locally to test against the target API before deploying. Fetch the CLI reference for the exact test commands:
https://docs.stackone.com/guides/connector-engine/cli-reference
在部署之前,先在本地运行连接器以针对目标API进行测试。获取CLI参考文档以了解确切的测试命令:
https://docs.stackone.com/guides/connector-engine/cli-reference

Step 6: Deploy

步骤6:部署

Deploy to StackOne's infrastructure. For automated deployments, set up CI/CD:
https://docs.stackone.com/guides/connector-engine/github-workflow
将连接器部署到StackOne的基础设施中。如需自动化部署,请设置CI/CD:
https://docs.stackone.com/guides/connector-engine/github-workflow

Examples

示例

Example 1: User wants to build a connector for an internal API

示例1:用户想要为内部API构建连接器

User says: "We have an internal HR system. Can I connect it to StackOne?"
Actions:
  1. Confirm the internal API has a REST/GraphQL endpoint
  2. Install the CLI:
    npm install -g @stackone/cli
  3. Fetch the connector structure guide for the scaffolding command
  4. If they have an OpenAPI spec, suggest the AI Builder for faster scaffolding
  5. Walk through the init → develop → test → deploy flow
Result: Custom connector project initialized with the right structure.
用户提问:“我们有一个内部HR系统,能否将其连接到StackOne?”
操作步骤:
  1. 确认内部API具有REST/GraphQL端点
  2. 安装CLI:
    npm install -g @stackone/cli
  3. 获取连接器结构指南以了解脚手架命令
  4. 如果他们有OpenAPI规范,建议使用AI构建器以更快地生成脚手架
  5. 引导完成初始化→开发→测试→部署的流程
结果:初始化具有正确结构的自定义连接器项目。

Example 2: User wants to set up CI/CD for connector deployment

示例2:用户想要为连接器部署设置CI/CD

User says: "How do I auto-deploy connectors from GitHub?"
Actions:
  1. Fetch
    https://docs.stackone.com/guides/connector-engine/github-workflow
  2. Walk through the GitHub Actions workflow configuration
  3. Explain the deployment stages (dev → staging → production)
Result: Working GitHub Actions pipeline for connector deployment.
用户提问:“如何从GitHub自动部署连接器?”
操作步骤:
  1. 获取
    https://docs.stackone.com/guides/connector-engine/github-workflow
  2. 引导完成GitHub Actions工作流的配置
  3. 解释部署阶段(开发→预发布→生产)
结果:用于连接器部署的可用GitHub Actions流水线。

Troubleshooting

故障排除

CLI command not found after install

安装后找不到CLI命令

Cause: Global npm bin directory not in PATH.
  • Run
    npm config get prefix
    to find the install location
  • Add
    {prefix}/bin
    to your PATH
  • Alternatively, use
    npx @stackone/cli
    instead of the global command
原因:全局npm bin目录未在PATH中。
  • 运行
    npm config get prefix
    以找到安装位置
  • {prefix}/bin
    添加到你的PATH中
  • 或者,使用
    npx @stackone/cli
    代替全局命令

Authentication failures in CLI

CLI中的身份验证失败

Cause: Missing or invalid credentials.
  • The CLI requires a StackOne API key
  • Fetch the CLI reference for the current auth setup command
  • Verify the key is active at https://app.stackone.com
原因:缺少或无效的凭据。

Connector deployment fails

连接器部署失败

Cause: Various — check the error message.
  • Fetch the CLI reference for deployment troubleshooting
  • Common issues: missing required fields in connector config, network timeouts
  • For CI/CD failures, check that secrets are correctly configured in GitHub Actions
原因:多种情况——请查看错误消息。
  • 获取CLI参考文档以了解部署故障排除方法
  • 常见问题:连接器配置中缺少必填字段、网络超时
  • 对于CI/CD失败,请检查GitHub Actions中的密钥是否配置正确