agent-package-manager
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAgent Package Manager
Agent Package Manager
Procedures
操作流程
Step 1: Assess the repository and the requested APM outcome
- Inspect the repository root for ,
apm.yml,apm.lock.yaml,.github/,.claude/,.cursor/, and.opencode/.apm_modules/ - Execute and
apm --versionto confirm the installed CLI and current configuration.apm config - If exists, read
apm.ymlbefore changing dependencies, scripts, or compilation settings.references/manifest-and-lockfile.md - If the request is about package installation, updates, pruning, or removal, read before executing APM commands.
references/command-workflows.md - If no exists and the user wants APM in the repository, initialize the project with
apm.ymlorapm init.apm init --yes - If the repository already uses another agent configuration flow and the user did not ask to migrate it, limit the change to the requested APM scope instead of replacing the existing setup.
Step 2: Shape or repair the manifest deliberately
- Read when the repository needs a fresh or repaired manifest structure.
assets/apm.yml.template - Keep and
namepresent at the top level; treat them as required contract fields.version - Add APM package dependencies under and MCP servers under
dependencies.apm.dependencies.mcp - Prefer canonical dependency forms in after installation. Default to the repository shorthand
apm.ymlfor GitHub-hosted skills and packages, for exampleowner/repo/path, and preserve explicitwebmaxru/agent-skills/skills/webmcp,path, andrefonly when they are needed.alias - Use pinned refs for shared team packages when reproducibility matters more than automatic drift.
- Keep local path dependencies only for active local development. Replace them with remote references before recommending bundle distribution.
- If the request includes scripts, define them under and verify that each script can be previewed or executed through
scripts,apm list, orapm preview.apm run
Step 3: Manage dependencies with verification, not guesswork
- Preview risky changes with ,
apm install --dry-run, orapm uninstall --dry-runwhen the repository already has installed packages.apm prune --dry-run - Install or update packages with ,
apm install,apm install <package>, orapm install --updateaccording to the requested scope.apm deps update - After running or
apm install --update, verify the lockfileapm deps updateactually changed. If packages were served from a stale cache, follow the "Stale packages after update" workflow inresolved_commit.references/troubleshooting.md - When the request is to install a single skill from a repository, provide the package path down to that skill directory instead of a vague repo-only placeholder, for example .
apm install webmaxru/agent-skills/skills/webmcp - Verify the resolved state with ,
apm deps list, orapm deps treeafter dependency changes.apm deps info <package> - Treat as the source of truth for resolved commits and deployed files. Recommend committing it for team and CI reproducibility.
apm.lock.yaml - If the repository needs MCP discovery or selection, use ,
apm mcp list, andapm mcp search <query>before editing MCP entries by hand.apm mcp show <server> - If installation output reports collisions or skipped files, read before retrying with forceful options.
references/troubleshooting.md - If the repository consumes packages from itself (self-referencing dependency), remind the user that changes must be committed and pushed before APM can fetch them. Read for the "Self-referencing dependencies" section.
references/troubleshooting.md
Step 4: Compile and validate only when it adds value
- Read before changing compilation strategy or target selection.
references/command-workflows.md - Use to validate primitives when the goal is correctness rather than output generation.
apm compile --validate - Use before large compilation changes or when checking placement decisions.
apm compile --dry-run - Explain that already deploys prompts, agents, skills, hooks, and MCP integrations for supported tools;
apm installmainly exists to generate instruction files such asapm compileorAGENTS.md.CLAUDE.md - Use explicit targets when the repository serves more than one runtime or tool family.
- Keep aligned with build and dependency directories so compilation does not re-scan generated output.
compilation.exclude - If the project needs continuous regeneration during authoring, use only after the one-shot validation path is clean.
apm compile --watch
Step 5: Operate scripts, runtimes, and distribution flows professionally
- List project scripts with before invoking them.
apm list - Preview prompt-driven scripts with before using
apm preview <script> -p key=valuein an automation or debugging workflow.apm run <script> -p key=value - Use ,
apm runtime status, andapm runtime listwhen the repository depends on an APM-managed runtime.apm runtime setup <runtime> - If the goal is CI fan-out, air-gapped delivery, or release traceability, read and use
references/command-workflows.mdonly after a successful install has producedapm packand deployed files.apm.lock.yaml - Use only for additive extraction of a previously packed bundle. Do not present it as a replacement for dependency authoring.
apm unpack - Recommend or a prebuilt bundle when repeated installs create avoidable CI cost or network risk.
apm-action
步骤1:评估代码仓库和所需的APM操作目标
- 检查仓库根目录下是否存在 、
apm.yml、apm.lock.yaml、.github/、.claude/、.cursor/和.opencode/。apm_modules/ - 执行 和
apm --version确认已安装的CLI版本和当前配置。apm config - 如果存在 ,在修改依赖、脚本或编译设置前请先阅读
apm.yml。references/manifest-and-lockfile.md - 如果需求是关于包的安装、更新、修剪或移除,在执行APM命令前请先阅读 。
references/command-workflows.md - 如果不存在 且用户需要在仓库中使用APM,使用
apm.yml或apm init初始化项目。apm init --yes - 如果仓库已经使用其他agent配置流程,且用户没有要求迁移,仅在请求的APM范围内进行修改,不要替换现有配置。
步骤2:谨慎构建或修复清单文件
- 当仓库需要全新的或修复后的清单结构时,参考 。
assets/apm.yml.template - 顶层必须保留 和
name字段,将其视为必填的协议字段。version - 在 下添加APM包依赖,在
dependencies.apm下添加MCP服务器依赖。dependencies.mcp - 安装后优先使用 中的规范依赖格式。对于GitHub托管的skill和包,默认使用仓库简写形式
apm.yml,例如owner/repo/path,仅在必要时保留显式的webmaxru/agent-skills/skills/webmcp、path和ref。alias - 当可复现性比自动更新更重要时,对团队共享的包使用固定的ref版本。
- 仅在活跃的本地开发阶段保留本地路径依赖,在推荐分发包之前将其替换为远程引用。
- 如果需求包含脚本,在 下定义它们,并验证每个脚本都可以通过
scripts、apm list或apm preview预览或执行。apm run
步骤3:通过验证而非猜测管理依赖
- 当仓库已经安装了包时,使用 、
apm install --dry-run或apm uninstall --dry-run预览高风险变更。apm prune --dry-run - 根据需求范围,使用 、
apm install、apm install <package>或apm install --update安装或更新包。apm deps update - 运行 或
apm install --update后,验证锁文件中的apm deps update确实发生了变更。如果包是从过期缓存中拉取的,按照resolved_commit中的“更新后包过期”流程处理。references/troubleshooting.md - 如果需求是从仓库安装单个skill,提供到该skill目录的完整包路径,而不是模糊的仅仓库占位符,例如 。
apm install webmaxru/agent-skills/skills/webmcp - 依赖变更后,使用 、
apm deps list或apm deps tree验证解析后的状态。apm deps info <package> - 将 视为已解析提交和部署文件的事实来源,建议提交该文件以保证团队和CI环境的可复现性。
apm.lock.yaml - 如果仓库需要发现或选择MCP,在手动编辑MCP条目之前,使用 、
apm mcp list和apm mcp search <query>操作。apm mcp show <server> - 如果安装输出报告冲突或跳过文件,在使用强制选项重试前阅读 。
references/troubleshooting.md - 如果仓库引用自身的包(自引用依赖),提醒用户必须先提交并推送变更,APM才能拉取到这些变更。可阅读 中的“自引用依赖”部分。
references/troubleshooting.md
步骤4:仅在有价值时进行编译和校验
- 在修改编译策略或目标选择前阅读 。
references/command-workflows.md - 当目标是校验正确性而非生成输出时,使用 校验基础资源。
apm compile --validate - 在进行大的编译变更或检查文件放置规则前,使用 。
apm compile --dry-run - 说明 已经为支持的工具部署了提示词、agents、skills、钩子和MCP集成;
apm install主要用于生成说明文件,例如apm compile或AGENTS.md。CLAUDE.md - 当仓库支持多个运行时或工具家族时,使用显式目标。
- 保持 与构建和依赖目录对齐,避免编译过程重复扫描生成的输出文件。
compilation.exclude - 如果项目在编写过程中需要持续重新生成,仅在单次校验路径无问题后再使用 。
apm compile --watch
步骤5:专业运维脚本、运行时和分发流程
- 调用项目脚本前,使用 列出所有脚本。
apm list - 在自动化或调试工作流中使用 前,使用
apm run <script> -p key=value预览提示词驱动的脚本。apm preview <script> -p key=value - 当仓库依赖APM管理的运行时时,使用 、
apm runtime status和apm runtime list。apm runtime setup <runtime> - 如果目标是CI分流、离线交付或发布可追溯性,阅读 ,仅在成功安装生成
references/command-workflows.md和部署文件后再使用apm.lock.yaml。apm pack - 仅对之前打包的bundle进行增量提取时使用 ,不要将其作为依赖编写的替代方案。
apm unpack - 当重复安装会产生不必要的CI成本或网络风险时,推荐使用 或预构建的bundle。
apm-action
Error Handling
错误处理
- If is missing, install or update it first, then verify with
apmbefore editing project files.apm --version - If reports authentication failures, read
apm installand fix host authentication before retrying.references/troubleshooting.md - If reports file collisions, inspect the diagnostic summary, retry with
apm installwhen needed, and use--verboseonly when overwriting local files is clearly intended.--force - If is unnecessary for the user’s toolchain, avoid adding it as busywork; prefer the lighter install-only path.
apm compile - If fails because
apm packis missing or deployed files are absent, rerunapm.lock.yamlbefore retrying.apm install - If the repository depends on local path packages, do not recommend until those dependencies are replaced with remote references.
apm pack
- 如果缺少 ,先安装或更新它,然后用
apm验证后再编辑项目文件。apm --version - 如果 报告认证失败,阅读
apm install,修复主机认证后再重试。references/troubleshooting.md - 如果 报告文件冲突,检查诊断摘要,必要时使用
apm install重试,仅在明确要覆盖本地文件时才使用--verbose。--force - 如果用户的工具链不需要 ,不要增加多余的操作,优先使用更轻量的仅安装路径。
apm compile - 如果因为缺少 或部署文件导致
apm.lock.yaml失败,重新运行apm pack后再重试。apm install - 如果仓库依赖本地路径包,在将这些依赖替换为远程引用之前,不要推荐使用 。
apm pack