添加全局模式目标
- 作者仓库星标 15
- 作者仓库 agentsmesh
- 领域
- 文档
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @sampleXbro · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 即装即用
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
## Purpose
# Add Global Mode Target
Use this skill when the task is to add global mode support for one existing target after you have a target-specific document that describes the native global file paths and behavior.
Read `.agentsmesh/skills/add-global-mode-target/references/global-mode-target-checklist.md` before editing code. Treat it as the minimum implementation and QA checklist.
## When To Use
- The target already exists in `src/targets/<target>/`
- You have a target doc with native global paths or global behavior
- The repository-wide global-mode foundation already exists (`init|install|generate|import|diff|lint|watch|check|merge|matrix --global`)
- The work is scoped to one target at a time
## Do Not Use This Skill For
- Adding a brand-new target from scratch
- Defining the shared global-mode architecture for the first time
- Guessing a target's global behavior without a concrete doc or official source
Use `add-agent-target` for new targets. Use this skill only for the per-target global-mode pass.
## Non-Negotiable Rules
### MUST
- Start from the target doc and verify it against the live target implementation.
- Treat current code as the source of truth for project-mode behavior; preserve it unless the target doc requires a change.
- Write failing tests first for every new global-mode behavior.
- Keep the change target-scoped. Do not scatter new target-specific branches through shared code if descriptor metadata can carry the behavior.
- Add or update `descriptor.global` and keep project/global layout semantics explicit.
- Verify link rewriting and import normalization for the target's global paths, not just generation paths.
- Test unsupported global features explicitly. If the target has no meaningful native global support, encode that and test the skip/warning behavior.
- Update docs if the supported-tools matrix, README, or global-mode docs change.
- Run the full verification stack before claiming completion.
### MUST NOT
- Do not infer global paths from project-mode paths.
- Do not hardcode the target's global paths in shared cleanup or reference code when descriptor metadata can own them.
- Do not stop at “files generate”; global import, reference rewriting, and stale cleanup must also be checked when applicable.
- Do not silently mark a target as globally supported if only a subset of features work natively.
## Workflow
1. Extract the contract from the doc.
- Record the target's native global root.
- Record which features are globally supported: rules, commands, agents, skills, MCP, hooks, ignore, permissions.
- Record root-instruction behavior, fallback paths, legacy paths, and any GUI-only/unsupported areas.
- Record whether import from global files is meaningful and lossless.
2. Cross-check the live target implementation.
- Read `src/targets/<target>/index.ts`, `constants.ts`, `generator.ts`, `importer.ts`, and `linter.ts`.
- Identify the current project layout in `descriptor.project`.
- Identify where global behavior can reuse the same structure and where it cannot.
3. Write failing tests first.
- Add unit tests for target layout metadata (`descriptor.global`, supported/unsupported features).
- Add generation tests for global paths and root artifacts.
- Add import/reference-rewrite tests if the target can import from global files.
- Add stale-cleanup coverage if managed outputs differ from project mode.
- Add command/integration coverage that proves the existing `--global` CLI surface works for the new target where applicable.
4. Implement the target-global layout.
- Prefer target metadata over shared branching.
- Fill `descriptor.global` for supported targets.
- Keep managed outputs, root instruction paths, and path resolvers explicit.
- If only some features are global, encode that precisely and keep unsupported ones absent or skipped.
5. Wire shared behavior only where necessary.
- Update shared scope-aware path or import code only if the target truly needs it.
- Keep shared changes generic and descriptor-driven.
- If the target doc reveals a shared architectural gap, fix the gap once rather than adding one-off target branches.
- Do not re-architect CLI scope handling unless the target proves a real shared gap.
6. Update docs and matrix surfaces.
- Update `README.md` and `website/src/content/docs/reference/supported-tools.mdx` if support levels or notes change.
- Update `docs/plan-global-mode.md` if the target behavior clarifies the implementation contract.
7. Verify and QA.
- Run targeted tests during iteration.
- Run the full verification stack at the end.
- Apply the local `post-feature-qa` skill before marking the work done.
## Required Touchpoints
- Target descriptor and layout metadata:
`src/targets/<target>/index.ts`
- Shared target lookup/path helpers:
`src/targets/catalog/builtin-targets.ts`
`src/core/reference/map-targets.ts`
`src/core/reference/map.ts`
- If the target imports or rewrites links in global scope:
`src/core/reference/rewriter.ts`
`src/core/reference/output-source-map.ts`
`src/core/reference/import-rewriter.ts`
`src/core/reference/import-map-builders.ts`
- If managed output ownership changes:
`src/core/generate/stale-cleanup.ts`
- If the target needs command-surface proof:
`tests/unit/cli/commands/*.test.ts`
`tests/integration/*global*.test.ts`
Read the checklist reference for the full test and review matrix.
## Required Verification
- `pnpm lint`
- `pnpm typecheck`
- `pnpm build`
- `pnpm test`
Add narrower unit/integration/e2e commands while iterating, but do not skip the full stack.
## Completion Standard
The task is not done until all of the following are true:
- The target's global contract is derived from the provided doc and encoded in code, not left implicit.
- `descriptor.global` is either implemented correctly or omitted intentionally for unsupported targets.
- Global generation paths are tested.
- Global import and reference rewriting are tested when the target supports them.
- Managed outputs and stale cleanup are correct for the target's global footprint.
- Docs and support matrix entries are current.
- Full verification passes. 章节与文件索引
按说明文件中的顺序排列。
目的
何时使用
请勿将此技能用于
必须
绝不能
文件/命令 -> .agentsmesh/skills/add-global-mode-target/references/global-mode-target-checklist.md · src/targets/<target>/ · init|install|generate|import|diff|lint|watch|check|merge|matrix --global · add-agent-target · descriptor.global · src/targets/<target>/index.ts · constants.ts · generator.ts
内容校验值 -> 59ceb9c4d5f5
当前原文的自动摘译,尚未人工审校。
目的
添加全局模式目标 当您拥有描述本机全局文件路径和行为的特定于目标的文档后,任务是为一个现有目标添加全局模式支持时,请使用此技能。编辑代码之前请阅读
.agentsmesh/skills/add-global-mode-target/references/global-mode-target-checklist.md。将其视为最低实施和质量检查清单。何时使用
目标已存在于
src/targets/<target>/中您有一个具有本机全局路径或全局行为的目标文档存储库范围的全局模式基础已存在(init|install|generate|import|diff|lint|watch|check|merge|matrix --global)工作范围一次仅限于一个目标请勿将此技能用于
从头开始添加全新的目标 首次定义共享全局模式架构 在没有具体文档或官方来源的情况下猜测目标的全局行为 对新目标使用
add-agent-target。仅将此技能用于每个目标的全局模式传递。必须
从目标文档开始,并根据实时目标实现对其进行验证。将当前代码视为项目模式行为的真实来源;保留它,除非目标文档需要更改。首先为每个新的全局模式行为编写失败的测试。保持变更目标范围。如果描述符元数据可以承载该行为,则不要通过共享代码分散新的特定于目标的分支。
绝不能
不要从项目模式路径推断全局路径。当描述符元数据可以拥有目标的全局路径时,不要在共享清理或参考代码中对目标的全局路径进行硬编码。不要停留在“文件生成”处;如果适用,还必须检查全局导入、引用重写和陈旧清理。如果只有一部分功能在本机工作,请勿默默地将目标标记为全局支持。