Skip to content

Commit ed542ad

Browse files
authored
Merge pull request #56 from sampleXbro/develop
Develop
2 parents 68faffd + 69f0d02 commit ed542ad

690 files changed

Lines changed: 143437 additions & 182 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agentsmesh/.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Auto-generated. DO NOT EDIT MANUALLY.
22
# Tracks the state of all config files for team conflict resolution.
33

4-
generated_at: 2026-05-08T14:56:34.513Z
4+
generated_at: 2026-05-09T14:39:23.798Z
55
generated_by: serhii
6-
lib_version: 0.15.0
6+
lib_version: 0.16.0
77
checksums:
88
agents/code-debugger.md: sha256:33452bf839256a119a602cd10d085bff3cdb8f537ded76e60053bb9d8e5d33bc
99
agents/code-documenter.md: sha256:89b4ebd27718bcd50a7283c95ea1ff9cad153b1112cf695f9f1fc22d90ec85ec
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: add-agent-target
3+
description: Use when adding support for a new AI agent target to agentsmesh. Covers official format research, canonical mapping, importer/generator/linter work, realistic fixtures, unit/integration/e2e coverage, matrix/docs updates, and final verification. Includes both project and global mode from day one.
4+
---
5+
6+
## Purpose
7+
8+
# Add Agent Target
9+
10+
Use this skill when the task is to add a brand-new supported agent target to this repository (built-in) or as an external plugin package.
11+
12+
**Primary reference**: `docs/add-new-target-playbook.md` is the step-by-step workflow (phases 1–9, file templates, verification gates). Open it first and follow it. This skill file is the contract — the non-negotiable rules, touchpoints, and completion bar. The playbook is how; this file is what and why.
13+
14+
**Companion skill**: `add-global-mode-target` — use only when extending global-mode support into an existing target that was built before global was a first-class contract. For new targets, global mode is part of this skill (scaffold wires it automatically).
15+
16+
## When To Use
17+
18+
- The task is to add a tool not currently in `src/targets/catalog/target-ids.ts`
19+
- Scope covers both `project` and `global` modes unless the target has no meaningful global surface
20+
- Delivery is either built-in (in this repo) or external plugin (standalone npm package)
21+
22+
## Do Not Use This Skill For
23+
24+
- Extending global-mode coverage on an existing target — use `add-global-mode-target`
25+
- Changing capability levels for an existing target — update the target's descriptor directly
26+
- Plugin feature work that doesn't add a new target id
27+
28+
## Non-Negotiable Rules
29+
30+
### MUST
31+
32+
- Search the internet for the target's current official file structure, config files, and example content before changing code.
33+
- Prefer official docs and other primary sources. Use vendor examples or source code only when official docs are incomplete, and call that out explicitly.
34+
- Separate the target product from the current assistant runtime before making format decisions. Do not confuse a generated target like `codex-cli` with Codex desktop/chat, or local CLI MCP config with app-managed connectors.
35+
- Capture the target's real capability map for every canonical feature: rules, additionalRules, commands, agents, skills, mcp, hooks, ignore, permissions.
36+
- When a feature is `none` but `skills` is `native` or `embedded`, evaluate whether `supportsConversion` should project that feature as skills. If the target reads skill bundles, commands and agents with no native surface should be projected as skills via `supportsConversion: { commands: true, agents: true }` and registered in `src/config/core/conversions.ts` with `DEFAULT_*_TO_SKILLS`. Do not add lint warnings for features that are projected as skills — only warn for features that are truly dropped.
37+
- Start from `agentsmesh target scaffold <id>` when building a built-in target. Do not hand-write the 10 skeleton files the scaffold produces.
38+
- Write failing tests first for every new behavior. Do not implement first and backfill later.
39+
- Add unit, integration, and e2e coverage for the complete import and generate flow, including global scope when applicable.
40+
- Add rich and realistic fixtures for the new target. Fixtures must resemble real projects, not toy placeholders.
41+
- Cover all edge cases for the new target, including legacy paths, fallbacks, malformed files, partial support, and unsupported features.
42+
- Wire descriptor capabilities for both project and global scope. New targets must include global mode unless the target has no global config surface at all, and that absence must be documented.
43+
- Update every affected command surface and user-facing document so the new target is discoverable and accurately described.
44+
- Update the compatibility matrix to reflect native, embedded, partial, or unsupported features. The matrix auto-builds from descriptor capabilities; `pnpm matrix:verify` must pass.
45+
- Update init detection and import empty-state messaging for the new target when native files exist.
46+
- Reuse existing capability-focused tests where possible; extend them instead of duplicating assertions across multiple files.
47+
- Preserve the canonical `.agentsmesh/` contract. If the target cannot represent a feature natively, model that explicitly instead of inventing fake native output.
48+
- Ensure every internal file link or reference inside generated or imported Markdown artifacts is convertible through the shared reference-rewrite pipeline, just like the existing targets. Do not ship a new target unless canonical `.agentsmesh/` references round-trip cleanly across that target's Markdown surfaces.
49+
- Run the full verification stack, including the packaging gates (`pnpm attw`, `pnpm publint`, `pnpm consumer-smoke`), before claiming completion.
50+
- Run the `post-feature-qa` skill before marking the task done.
51+
52+
### MUST NOT
53+
54+
- Do not infer the target format from old fixtures, README text, or memory alone.
55+
- Do not add placeholder fixtures with `SYNTHETIC` markers or obviously fake content.
56+
- Do not add shallow smoke tests as a substitute for feature coverage.
57+
- Do not silently skip unsupported features; document and test the chosen behavior.
58+
- Do not leave commands, schema enums, init detection, matrix output, or docs partially updated.
59+
- Do not hardcode target-specific branches in shared code when a descriptor field can carry the behavior.
60+
61+
## Workflow (detailed in `docs/add-new-target-playbook.md`)
62+
63+
1. **Research** — §1 of the playbook. Answer every research-checklist item from primary sources before writing code.
64+
2. **Scaffold** — §2 of the playbook. Run `pnpm exec agentsmesh target scaffold <id>`, then register the id in the three catalog files listed there.
65+
3. **Constants and capabilities** — §3. Fill in paths and capability levels for both project and global scope.
66+
4. **Conversion eligibility** — For each feature marked `none` in capabilities, check if the target supports skills (`native` or `embedded`). If so, add `supportsConversion` to the descriptor for those features, register defaults in `src/config/core/conversions.ts`, and omit lint warnings for those features (they become `embedded` via skill projection). Only emit lint warnings for features that are truly dropped with no fallback.
67+
5. **Tests first** — §4. Add realistic fixtures under `tests/e2e/fixtures/<id>-project/` and write failing unit/integration/e2e tests.
68+
5. **Implement generators, importers, and reference maps** — §5. Feature-by-feature, using existing targets as reference implementations.
69+
6. **Global mode** — §6. Fill in `descriptor.global`, `rewriteGeneratedPath`, and any `skillMirror` or `sharedArtifacts` needs.
70+
7. **Plugin packaging** — §7. Only if shipping as an external plugin rather than a built-in.
71+
8. **Matrix and docs** — §8. Run `pnpm schemas:generate && pnpm matrix:generate` and update `website/src/content/docs/reference/supported-tools.mdx`.
72+
9. **Verification** — §9. Run the full stack (see below). All must pass.
73+
74+
Refer to `./references/target-addition-checklist.md` for the concrete audit list of touchpoints, tests, fixtures, and edge cases.
75+
76+
## Required Verification
77+
78+
Before claiming completion, every command must pass:
79+
80+
- `pnpm typecheck`
81+
- `pnpm lint`
82+
- `pnpm test`
83+
- `pnpm test:e2e`
84+
- `pnpm matrix:verify`
85+
- `pnpm publint`
86+
- `pnpm attw`
87+
- `pnpm consumer-smoke`
88+
89+
If a narrower command is useful during iteration, run it first, but do not skip the full stack at the end.
90+
91+
## Completion Standard
92+
93+
The task is not done until all of the following are true:
94+
95+
- The target appears in `agentsmesh matrix` CLI output and passes `pnpm matrix:verify`.
96+
- Import and generate behavior are both covered for every supported feature, in both project and global scope where applicable.
97+
- Unsupported or lossy features are documented in `website/src/content/docs/reference/supported-tools.mdx` and tested.
98+
- Fixtures under `tests/e2e/fixtures/<id>-project/` are rich enough to exercise real parsing branches (rules, skills, MCP, hooks, ignore as applicable).
99+
- Round-trip import → generate preserves content byte-for-byte where the format permits.
100+
- README matrix and website supported-tools page are in sync.
101+
- All verification commands listed above pass.
102+
- `post-feature-qa` skill has been applied and any gaps closed.
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Target Addition Checklist
2+
3+
Concrete audit list for adding a built-in agent target. For the step-by-step workflow, see `docs/add-new-target-playbook.md`.
4+
5+
## Research (non-skippable)
6+
7+
Every item must have a primary-source link before coding starts:
8+
9+
- Official docs URL for the tool
10+
- Exact product surface being implemented (CLI vs desktop vs chat — often different config systems)
11+
- Project-scope config directory and root-instruction file
12+
- Global-scope config directory and root-instruction file
13+
- File formats for each supported feature (Markdown + frontmatter, YAML, TOML, JSON)
14+
- Frontmatter keys and schema per feature
15+
- Legacy or fallback paths still in use
16+
- Capability map — for each canonical feature, one of: `native`, `embedded`, `partial`, `none`
17+
- Conversion eligibility — for each `none` feature, can it be projected as a skill? (see below)
18+
- MCP scope (project file, user-home config, app-managed connector, unsupported)
19+
20+
## Code Touchpoints
21+
22+
Registration (must edit these three files for a built-in target):
23+
24+
- `src/targets/catalog/target-ids.ts` — add the new id to `TARGET_IDS`
25+
- `src/targets/catalog/builtin-targets.ts` — import the descriptor and add to `BUILTIN_TARGETS`
26+
- `src/core/reference/import-maps/index.ts` — re-export the new target's import-paths helper
27+
28+
Target implementation (scaffold produces these; fill in):
29+
30+
- `src/targets/<id>/constants.ts` — project and global path constants
31+
- `src/targets/<id>/index.ts` — the `TargetDescriptor` (capabilities, layouts, detection paths)
32+
- `src/targets/<id>/generator.ts` — feature generators (`generateRules` minimum)
33+
- `src/targets/<id>/importer.ts``importFrom` implementation
34+
- `src/targets/<id>/linter.ts` — rule linter (often thin wrapper over shared `validateRules`)
35+
- `src/targets/<id>/lint.ts` — per-feature lint hooks (commands, mcp, permissions, hooks, ignore)
36+
- `src/core/reference/import-maps/<id>.ts` — canonical ↔ target reference path map
37+
38+
Conversion eligibility (when `commands` or `agents` is `none` but `skills` is `native` or `embedded`):
39+
40+
- `src/targets/<id>/index.ts` — add `supportsConversion: { commands: true, agents: true }` (only the features that are `none`)
41+
- `src/config/core/conversions.ts` — add the target to `DEFAULT_COMMANDS_TO_SKILLS` and/or `DEFAULT_AGENTS_TO_SKILLS` with `true`
42+
- Do NOT add lint warnings for converted features — they are projected as skills, not dropped
43+
- Only add lint warnings for features that are truly unsupported (no native support AND no skill fallback, e.g. hooks, permissions, MCP when project-only)
44+
45+
Shared code to audit, not usually modify:
46+
47+
- `src/config/core/schema.ts` — target id validation runs off `TARGET_IDS`, no edits needed
48+
- `src/cli/help-data.ts` — only if the target introduces new flags; avoid if possible
49+
- `src/core/matrix/data.ts` — auto-derived from descriptor capabilities, no edits needed
50+
- `src/core/generate/collision.ts` — only if declaring `sharedArtifacts`
51+
52+
## Documentation Touchpoints
53+
54+
- `README.md` — matrix tables update automatically via `pnpm matrix:generate`
55+
- `website/src/content/docs/reference/supported-tools.mdx` — single docs page for per-target detail (paths, native vs embedded, limitations). Update this manually.
56+
- `docs/prd-v2-complete.md` — only if the architecture contract changes
57+
- No other docs pages should need edits per repo rules
58+
59+
## Unit Tests
60+
61+
- `tests/unit/targets/<id>/generator.test.ts`
62+
- `tests/unit/targets/<id>/importer.test.ts`
63+
- `tests/unit/targets/<id>/global-layout.test.ts` (when the target supports global mode)
64+
- `tests/unit/targets/<id>/<feature>-helpers.test.ts` (only if the target has complex helpers)
65+
- Shared tests (`tests/unit/core/engine.test.ts`, `tests/unit/core/matrix/*.test.ts`) only when behavior there changes
66+
67+
Assertions must be strict: exact paths, exact counts, exact referenced sets. No `some(...)`, no `toBeGreaterThan(0)` on lengths, no prefix-only matching.
68+
69+
## Integration Tests
70+
71+
- `tests/integration/generate.integration.test.ts` — when CLI generate wiring is affected
72+
- `tests/integration/import.integration.test.ts` — when CLI import wiring is affected
73+
- `tests/integration/init.integration.test.ts` — when init detection changes
74+
75+
## E2E Tests
76+
77+
- `tests/e2e/generate-capabilities.e2e.test.ts` — add a describe block for the new target
78+
- `tests/e2e/import-capabilities.e2e.test.ts` — add import round-trip cases
79+
- `tests/e2e/full-sync.e2e.test.ts` — when the target supports import
80+
- `tests/e2e/<id>-format-roundtrip.e2e.test.ts` — only for complex targets with non-trivial format handling (see `claude-code-format-roundtrip.e2e.test.ts` as reference)
81+
- Global coverage — add to existing global roundtrip suites rather than creating new isolated files
82+
83+
## Fixture Requirements
84+
85+
Create `tests/e2e/fixtures/<id>-project/` with realistic content:
86+
87+
- Target's root instructions file (with real prose, not a placeholder)
88+
- Scoped rules or equivalent (with frontmatter, globs, trigger markers as applicable)
89+
- Commands or workflows if supported
90+
- Agents if supported
91+
- Skills with at least one supporting file (`references/`, `scripts/`, or `template.*`)
92+
- Settings, MCP, hooks, ignore files as applicable
93+
- Legacy/fallback variant in a separate fixture if the target has path precedence rules
94+
95+
Reference fixtures for comparison:
96+
97+
- `tests/e2e/fixtures/kiro-project/` — 10 files, rules + skills + MCP (mid-complexity)
98+
- `tests/e2e/fixtures/claude-code-project/` — 14 files, full feature set (high-complexity)
99+
100+
## Edge Cases To Cover
101+
102+
- Missing config produces the correct empty-state message from `emptyImportMessage`
103+
- Legacy path fallback (when the target has one)
104+
- Precedence when both legacy and current formats exist
105+
- Malformed JSON/TOML/frontmatter (importer must not crash)
106+
- Partial feature translation (document lossy behavior in tests)
107+
- Existing settings merge preservation (when generator writes into a shared settings file)
108+
- Rich skill directories with nested supporting files
109+
- `--targets <id>` filtering
110+
- Full round-trip import → generate when the target supports import
111+
- Global-scope variants for every project-scope test, when the target supports global
112+
113+
## Global Mode (new targets must include from day one)
114+
115+
- `descriptor.global` filled in with paths and managed outputs
116+
- `descriptor.global.rewriteGeneratedPath` transforms project paths to global
117+
- `descriptor.globalCapabilities` set only if different from project scope
118+
- `descriptor.globalDetectionPaths` populated
119+
- Optional: `descriptor.globalSupport.skillMirror` for targets that read skills from a mirror path
120+
- Optional: `descriptor.sharedArtifacts` when the target shares a global path with another target
121+
- Tests: `global-layout.test.ts` asserts descriptor shape; existing global roundtrip suites exercise the runtime behavior
122+
123+
If the target genuinely has no global surface (e.g. a project-only tool), document the decision in `supported-tools.mdx` and omit `descriptor.global` entirely.
124+
125+
## Plugin Path Alternative
126+
127+
If the target is niche or the maintainer prefers independent release, ship as a plugin instead. See `docs/add-new-target-playbook.md` §7 for the standalone npm package layout. The descriptor contract is identical; only the packaging and registration differ.
128+
129+
## Verification Gates
130+
131+
Before marking complete, every command must exit 0:
132+
133+
- `pnpm typecheck`
134+
- `pnpm lint`
135+
- `pnpm test`
136+
- `pnpm test:e2e`
137+
- `pnpm matrix:verify`
138+
- `pnpm publint`
139+
- `pnpm attw`
140+
- `pnpm consumer-smoke`
141+
142+
## Review Questions
143+
144+
- Did you search the internet first, using official docs only?
145+
- Did you start from `agentsmesh target scaffold <id>`, or did you hand-write the skeleton?
146+
- Did you write failing tests first?
147+
- Did you add rich fixtures instead of placeholders?
148+
- Did you register the id in all three catalog files (`target-ids.ts`, `builtin-targets.ts`, `import-maps/index.ts`)?
149+
- Did you include global mode, or document the decision to omit it?
150+
- Did you check conversion eligibility for `none` features — could commands/agents be projected as skills instead of dropped?
151+
- Did you update `supported-tools.mdx` with per-target detail?
152+
- Did every verification command pass?

0 commit comments

Comments
 (0)