创建扩展包
本指南面向准备分发团队工作流的扩展作者。完成后,你会得到一个包含 manifest、profile、workflow 和 slash command 的本地 pack 目录。
1. 创建目录
标题为“1. 创建目录”的章节mkdir -p my-pack/profiles my-pack/workflows推荐结构:
my-pack/ jarvis-pack.yaml README.md profiles/ reviewer.yaml workflows/ review-pr.yaml2. 添加 Agent Profile
标题为“2. 添加 Agent Profile”的章节profiles/reviewer.yaml 使用 Jarvis profile YAML 格式:
version: 2name: PR Reviewerdescription: Reviews pull requests with the team's checklist and reports risks first.runtime: claude-codetools: builtin: - Read - Grep mcp_servers: {}permissions: mode: acceptEdits不要在 profile 中写入 token、private key 或真实服务器地址。需要变量时,在 manifest 的 secrets 中声明名称。
3. 添加 Workflow
标题为“3. 添加 Workflow”的章节workflows/review-pr.yaml 使用现有 workflow spec。引用同一 pack 内 profile 时,用 profile:<local-id>:
name: Review pull requestdescription: Review a pull request and return findings first.failure_policy: pauseauto_supervise: truenodes: - id: review name: Review changes profile_id: "profile:reviewer" prompt_template: | Review this pull request:
{{task}} runtime: auto permission_mode: bounded depends_on: []安装时,Jarvis 会把 profile:reviewer 改写为真实 materialized profile id。
4. 写 manifest
标题为“4. 写 manifest”的章节jarvis-pack.yaml 是扩展包入口:
schemaVersion: 1id: example.pr-reviewpublisher: examplename: pr-reviewdisplayName: PR Review Workflow Packversion: 0.1.0description: Team pull request review workflow.engines: jarvis: ">=0.0.1"activation: manual: truepermissions: sessions: launch: truecontributes: profiles: - id: reviewer path: profiles/reviewer.yaml workflows: - id: review-pr path: workflows/review-pr.yaml title: Review pull request commands: - command: "/review-pr" title: Review pull request description: Start the PR review workflow. usage: "/review-pr <pull request url>" action: type: startWorkflow workflow: review-pr taskTemplate: "{{args}}"id 必须等于 {publisher}.{name}。字段细节见 Manifest 参考。
5. 验证
标题为“5. 验证”的章节.venv/bin/jarvis extensions validate my-pack修复所有 errors 后再安装。warnings 不会阻止安装,但应该在 README 中说明。
6. 安装到本机 Jarvis
标题为“6. 安装到本机 Jarvis”的章节.venv/bin/jarvis extensions install my-pack --enable安装后检查:
- Settings → Extensions 显示 pack 为 enabled。
- Agent Profiles 列表中出现 extension-owned profile,并显示扩展来源。
- Studio 的 Workflow 列表中出现 extension-owned workflow。
- slash command 菜单中出现你声明的命令。
7. 发布前检查
标题为“7. 发布前检查”的章节jarvis-pack.yaml没有main、entrypoint、scripts、preInstall或postInstall。- 所有 contribution path 都在 pack 目录内。
- 所有 slash command 都以
/开头,小写,不和内置命令冲突。 - README 说明 permissions、secrets 和运行结果。
- 示例命令使用占位符,不包含私有地址、账号或密钥。