diff --git a/capabilities/antigravity/capability.json b/capabilities/antigravity/capability.json index 36586138b..6f6e4bf0d 100644 --- a/capabilities/antigravity/capability.json +++ b/capabilities/antigravity/capability.json @@ -34,6 +34,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ], "local": [ @@ -44,6 +52,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ] }, diff --git a/capabilities/augment/capability.json b/capabilities/augment/capability.json index 28f0095c3..d8734da69 100644 --- a/capabilities/augment/capability.json +++ b/capabilities/augment/capability.json @@ -35,6 +35,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ], "local": [ @@ -53,6 +61,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ] }, diff --git a/capabilities/cline/capability.json b/capabilities/cline/capability.json index 1fe0247be..ff256d4f2 100644 --- a/capabilities/cline/capability.json +++ b/capabilities/cline/capability.json @@ -27,6 +27,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToClineSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToClineAgent" } ], "local": [] diff --git a/capabilities/codebuddy/capability.json b/capabilities/codebuddy/capability.json index 987f10305..cfbe6f25d 100644 --- a/capabilities/codebuddy/capability.json +++ b/capabilities/codebuddy/capability.json @@ -35,6 +35,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ], "local": [ @@ -53,6 +61,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ] }, diff --git a/capabilities/copilot/capability.json b/capabilities/copilot/capability.json index b28307ac4..e6384c7e5 100644 --- a/capabilities/copilot/capability.json +++ b/capabilities/copilot/capability.json @@ -28,6 +28,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ], "local": [ @@ -38,6 +46,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ] }, diff --git a/capabilities/cursor/capability.json b/capabilities/cursor/capability.json index 044c46674..128d792dc 100644 --- a/capabilities/cursor/capability.json +++ b/capabilities/cursor/capability.json @@ -35,6 +35,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ], "local": [ @@ -53,6 +61,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ] }, diff --git a/capabilities/trae/capability.json b/capabilities/trae/capability.json index 3cd9f043d..0f93e7482 100644 --- a/capabilities/trae/capability.json +++ b/capabilities/trae/capability.json @@ -27,6 +27,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ], "local": [ @@ -37,6 +45,14 @@ "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ] }, diff --git a/capabilities/windsurf/capability.json b/capabilities/windsurf/capability.json index 3b8d0e86a..cbf221708 100644 --- a/capabilities/windsurf/capability.json +++ b/capabilities/windsurf/capability.json @@ -28,6 +28,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ], "local": [ @@ -38,6 +46,14 @@ "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ] }, diff --git a/gsd-core/bin/lib/capability-registry.cjs b/gsd-core/bin/lib/capability-registry.cjs index 249397540..97565371f 100644 --- a/gsd-core/bin/lib/capability-registry.cjs +++ b/gsd-core/bin/lib/capability-registry.cjs @@ -96,6 +96,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ], "local": [ @@ -106,6 +114,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ] }, @@ -194,6 +210,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ], "local": [ @@ -212,6 +236,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ] }, @@ -321,6 +353,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToClineSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToClineAgent" } ], "local": [] @@ -433,6 +473,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ], "local": [ @@ -451,6 +499,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ] }, @@ -548,6 +604,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ], "local": [ @@ -558,6 +622,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ] }, @@ -608,6 +680,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ], "local": [ @@ -626,6 +706,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ] }, @@ -1840,6 +1928,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ], "local": [ @@ -1850,6 +1946,14 @@ const capabilities = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ] }, @@ -1988,6 +2092,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ], "local": [ @@ -1998,6 +2110,14 @@ const capabilities = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ] }, @@ -2754,6 +2874,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ], "local": [ @@ -2764,6 +2892,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAntigravitySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAntigravityAgent" } ] }, @@ -2815,6 +2951,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ], "local": [ @@ -2833,6 +2977,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToAugmentSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToAugmentAgent" } ] }, @@ -2942,6 +3094,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToClineSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToClineAgent" } ], "local": [] @@ -2993,6 +3153,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ], "local": [ @@ -3011,6 +3179,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCodebuddySkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCodebuddyAgent" } ] }, @@ -3108,6 +3284,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ], "local": [ @@ -3118,6 +3302,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCopilotSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCopilotAgent" } ] }, @@ -3168,6 +3360,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ], "local": [ @@ -3186,6 +3386,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToCursorCommand" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToCursorAgent" } ] }, @@ -3597,6 +3805,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ], "local": [ @@ -3607,6 +3823,14 @@ const runtimes = { "nesting": "nested", "recursive": false, "converter": "convertClaudeCommandToTraeSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToTraeAgent" } ] }, @@ -3650,6 +3874,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ], "local": [ @@ -3660,6 +3892,14 @@ const runtimes = { "nesting": "flat", "recursive": false, "converter": "convertClaudeCommandToWindsurfSkill" + }, + { + "kind": "agents", + "destSubpath": "agents", + "prefix": "gsd-", + "nesting": "flat", + "recursive": false, + "converter": "convertClaudeAgentToWindsurfAgent" } ] }, diff --git a/src/install-profiles.cts b/src/install-profiles.cts index ceaf81868..4d1a929ce 100644 --- a/src/install-profiles.cts +++ b/src/install-profiles.cts @@ -548,12 +548,16 @@ function stageSkillsForRuntimeAsSkills( * * @param srcAgentsDir source agents directory (e.g. agents/) * @param resolvedProfile profile filter from resolveProfile() - * @param converter (content: string) → string pure per-file converter + * @param converter (content: string, isGlobal?: boolean) → string per-file + * converter; scope-aware converters (copilot/antigravity) + * read isGlobal, single-arg converters ignore it (#1173) + * @param isGlobal install scope passed through to the converter */ function stageAgentsForRuntimeWithConverter( srcAgentsDir: string, resolvedProfile: ResolvedProfile, - converter: (content: string) => string, + converter: (content: string, isGlobal?: boolean) => string, + isGlobal = false, ): string { if (!fs.existsSync(srcAgentsDir)) return srcAgentsDir; @@ -571,7 +575,7 @@ function stageAgentsForRuntimeWithConverter( } } const content = fs.readFileSync(path.join(srcAgentsDir, entry.name), 'utf8'); - const converted = converter(content); + const converted = converter(content, isGlobal); fs.writeFileSync(path.join(stageDir, entry.name), converted, 'utf8'); } } catch (err) { diff --git a/src/runtime-artifact-layout.cts b/src/runtime-artifact-layout.cts index 3adb6c43a..f488b10c6 100644 --- a/src/runtime-artifact-layout.cts +++ b/src/runtime-artifact-layout.cts @@ -175,6 +175,16 @@ function agentsKind(destSubpath: string, prefix: string, configDir: string): Art * Agent filenames are preserved verbatim (the prefix is already embedded in the * agent stem — e.g. `gsd-planner.md`). * + * #1173 SCOPE: this wires the per-runtime agent CONVERTER (frontmatter/body + + * isGlobal scope) into the descriptor path. The remaining byte-for-byte parity + * behaviors of the legacy `bin/install.js` agent loop — Copilot's `.agent.md` + * filename rename, the cross-cutting path-prefix rewrite + attribution, and the + * config-reading steps (claude effort, opencode model override) — are NOT applied + * here yet; they are tracked by the ADR-1235 cutover (later steps) and remain + * provided by the legacy loop, which runs after `installRuntimeArtifacts` and is + * authoritative for the real install. So this kind is correct for converter + * coverage but not yet a full standalone replacement for these runtimes. + * * Mirrors the `convertedCommandsKind` pattern (#785). * * @param destSubpath destination subpath within configDir (e.g. 'agents') @@ -187,14 +197,24 @@ function convertedAgentsKind( prefix: string, converterName: string, configDir: string, + scope: 'local' | 'global' = 'global', ): ArtifactKind { return { kind: 'agents', destSubpath, prefix, stage: (resolved) => { - const converter = conversionExports[converterName] as (content: string) => string; - return stageAgentsForRuntimeWithConverter(findAgentsSourceRoot(configDir), resolved, converter); + // isGlobal is threaded so scope-aware agent converters (copilot, antigravity) + // choose global-home vs workspace-relative paths; converters that only take + // (content) ignore the extra positional arg. Mirrors skillsKind's scope + // threading (#1173). + const converter = conversionExports[converterName] as (content: string, isGlobal?: boolean) => string; + return stageAgentsForRuntimeWithConverter( + findAgentsSourceRoot(configDir), + resolved, + converter, + scope === 'global', + ); }, }; } @@ -411,7 +431,7 @@ function dispatchKindEntry(entry: ArtifactKindDescriptor, runtime: string, confi if (converter == null) { return agentsKind(destSubpath, prefix, configDir); } - return convertedAgentsKind(destSubpath, prefix, converter, configDir); + return convertedAgentsKind(destSubpath, prefix, converter, configDir, scope); case 'skills': if (converter == null) { diff --git a/tests/bug-782-cline-skills-emission.test.cjs b/tests/bug-782-cline-skills-emission.test.cjs index 952beb95b..ac910a2d9 100644 --- a/tests/bug-782-cline-skills-emission.test.cjs +++ b/tests/bug-782-cline-skills-emission.test.cjs @@ -630,11 +630,14 @@ describe('resolveRuntimeArtifactLayout — cline scope-aware (Fix 2)', () => { assert.strictEqual(layout.kinds.length, 0, 'cline local must have 0 kinds'); }); - test('cline global: kinds.length === 1 (skills kind)', () => { + test('cline global: kinds.length === 2 (skills + agents)', () => { + // #1173: cline global gained an agents kind (descriptor-driven agent conversion); + // cline local stays empty (0 kinds) — agents was wired for global only. const { resolveRuntimeArtifactLayout } = require('../gsd-core/bin/lib/runtime-artifact-layout.cjs'); const layout = resolveRuntimeArtifactLayout('cline', '/tmp/x', 'global'); - assert.strictEqual(layout.kinds.length, 1, 'cline global must have 1 skills kind'); + assert.strictEqual(layout.kinds.length, 2, 'cline global must have skills + agents kinds'); assert.strictEqual(layout.kinds[0].kind, 'skills'); + assert.strictEqual(layout.kinds[1].kind, 'agents'); }); test('installRuntimeArtifacts cline local: no skills/ dir created', (t) => { diff --git a/tests/enh-789-codebuddy-commands.test.cjs b/tests/enh-789-codebuddy-commands.test.cjs index 56ca77e69..f2bb9c761 100644 --- a/tests/enh-789-codebuddy-commands.test.cjs +++ b/tests/enh-789-codebuddy-commands.test.cjs @@ -53,11 +53,12 @@ const RESOLVED_CORE = resolveProfile({ modes: ['core'], manifest: MANIFEST }); // ─── Layout contract ───────────────────────────────────────────────────────── describe('enh-789 — codebuddy layout has commands + skills kinds', () => { - test('resolveRuntimeArtifactLayout codebuddy returns 2 kinds', () => { + test('resolveRuntimeArtifactLayout codebuddy returns 3 kinds', () => { + // #1173: codebuddy gained an agents kind (descriptor-driven per-runtime agent conversion). const layout = resolveRuntimeArtifactLayout('codebuddy', '/tmp/fake-codebuddy-dir'); - assert.strictEqual(layout.kinds.length, 2, 'codebuddy must have exactly 2 artifact kinds'); + assert.strictEqual(layout.kinds.length, 3, 'codebuddy must have exactly 3 artifact kinds'); const kindNames = layout.kinds.map(k => k.kind).sort(); - assert.deepStrictEqual(kindNames, ['commands', 'skills']); + assert.deepStrictEqual(kindNames, ['agents', 'commands', 'skills']); }); test('codebuddy commands kind targets commands/ with gsd- prefix', () => { diff --git a/tests/enh-790-augment-commands.test.cjs b/tests/enh-790-augment-commands.test.cjs index 95f772000..b2b1d3da9 100644 --- a/tests/enh-790-augment-commands.test.cjs +++ b/tests/enh-790-augment-commands.test.cjs @@ -32,11 +32,12 @@ const RESOLVED_CORE = resolveProfile({ modes: ['core'], manifest: MANIFEST }); // ─── Layout contract ───────────────────────────────────────────────────────── describe('enh-790 — augment layout has commands + skills kinds', () => { - test('resolveRuntimeArtifactLayout augment returns 2 kinds', () => { + test('resolveRuntimeArtifactLayout augment returns 3 kinds', () => { + // #1173: augment gained an agents kind (descriptor-driven per-runtime agent conversion). const layout = resolveRuntimeArtifactLayout('augment', '/tmp/fake-augment-dir'); - assert.strictEqual(layout.kinds.length, 2, 'augment must have exactly 2 artifact kinds'); + assert.strictEqual(layout.kinds.length, 3, 'augment must have exactly 3 artifact kinds'); const kindNames = layout.kinds.map(k => k.kind).sort(); - assert.deepStrictEqual(kindNames, ['commands', 'skills']); + assert.deepStrictEqual(kindNames, ['agents', 'commands', 'skills']); }); test('augment commands kind targets commands/ with gsd- prefix', () => { diff --git a/tests/feat-1173-agent-converters-descriptor.test.cjs b/tests/feat-1173-agent-converters-descriptor.test.cjs index 047a60ecc..011ed2178 100644 --- a/tests/feat-1173-agent-converters-descriptor.test.cjs +++ b/tests/feat-1173-agent-converters-descriptor.test.cjs @@ -298,3 +298,75 @@ describe('feat-1173: real registry claude agents kind has converter=null (backwa assert.strictEqual(agentsEntry.converter, null, 'claude agents entry must have converter=null'); }); }); + +// ─── feat-1173: real-registry wiring for the 8 runtimes ─────────────────────── +// The synthetic-descriptor tests above prove the dispatch SEAM exists. These +// prove the actual deliverable: each of the 8 runtimes' capability.json now +// declares the correct agent converter, the descriptor path APPLIES it (not a +// raw copy), and the install scope is threaded so scope-aware converters +// (copilot/antigravity) choose global- vs workspace-relative paths. These fail +// on pristine `next`, where these runtimes have no agents kind (silent raw copy). +describe('feat-1173: real-registry agent converter wiring (8 runtimes)', () => { + const conv = require(path.join(ROOT, 'gsd-core', 'bin', 'lib', 'runtime-artifact-conversion.cjs')); + const layout = require(path.join(ROOT, 'gsd-core', 'bin', 'lib', 'runtime-artifact-layout.cjs')); + const registry = require(path.join(ROOT, 'gsd-core', 'bin', 'lib', 'capability-registry.cjs')); + + // runtime → its agent converter + the scopes whose descriptor carries an agents kind. + // cline is global-only (its local artifactLayout is empty), so it wires global only. + const WIRED = [ + { runtime: 'copilot', converter: 'convertClaudeAgentToCopilotAgent', scopeAware: true, scopes: ['global', 'local'] }, + { runtime: 'antigravity', converter: 'convertClaudeAgentToAntigravityAgent', scopeAware: true, scopes: ['global', 'local'] }, + { runtime: 'cursor', converter: 'convertClaudeAgentToCursorAgent', scopeAware: false, scopes: ['global', 'local'] }, + { runtime: 'windsurf', converter: 'convertClaudeAgentToWindsurfAgent', scopeAware: false, scopes: ['global', 'local'] }, + { runtime: 'augment', converter: 'convertClaudeAgentToAugmentAgent', scopeAware: false, scopes: ['global', 'local'] }, + { runtime: 'trae', converter: 'convertClaudeAgentToTraeAgent', scopeAware: false, scopes: ['global', 'local'] }, + { runtime: 'codebuddy', converter: 'convertClaudeAgentToCodebuddyAgent', scopeAware: false, scopes: ['global', 'local'] }, + { runtime: 'cline', converter: 'convertClaudeAgentToClineAgent', scopeAware: false, scopes: ['global'] }, + ]; + + for (const { runtime, converter, scopeAware, scopes } of WIRED) { + test(`${runtime}: capability descriptor declares ${converter} for ${scopes.join('+')}`, () => { + const al = registry.runtimes[runtime].runtime.artifactLayout; + for (const scope of scopes) { + const entry = (al[scope] || []).find((e) => e.kind === 'agents'); + assert.ok(entry, `${runtime} ${scope} must declare an agents kind`); + assert.strictEqual(entry.converter, converter, `${runtime} ${scope} agents converter`); + } + if (!scopes.includes('local')) { + assert.ok(!(al.local || []).some((e) => e.kind === 'agents'), + `${runtime} local must NOT declare an agents kind (global-only runtime)`); + } + }); + + test(`${runtime}: descriptor staging applies ${converter} with scope threading`, (t) => { + const fixtureRoot = makeFixtureRoot([{ name: 'gsd-planner.md', content: CLAUDE_AGENT_SOURCE }]); + t.after(() => { cleanup(fixtureRoot); cleanupStagedSkills(); }); + const profile = { name: 'full', skills: '*', agents: new Set() }; + + for (const scope of scopes) { + const lay = layout.resolveRuntimeArtifactLayout(runtime, fixtureRoot, scope); + const agentsKind = lay.kinds.find((k) => k.kind === 'agents'); + assert.ok(agentsKind, `${runtime} ${scope} layout must include an agents kind`); + const stagedDir = agentsKind.stage(profile); + const staged = fs.readFileSync(path.join(stagedDir, 'gsd-planner.md'), 'utf8'); + + // Conversion actually happened (guards against the raw-copy regression). + assert.notStrictEqual(staged, CLAUDE_AGENT_SOURCE, + `${runtime} ${scope}: descriptor must convert, not raw-copy`); + // Routed to the correct converter, with isGlobal threaded from the scope. + const expected = conv[converter](CLAUDE_AGENT_SOURCE, scope === 'global'); + assert.strictEqual(staged, expected, + `${runtime} ${scope}: staged must equal ${converter}(src, isGlobal=${scope === 'global'})`); + } + + // Scope-aware converters must differ by scope — proves the isGlobal thread is + // real (a broken/constant thread would make global and local identical). + if (scopeAware) { + assert.notStrictEqual( + conv[converter](CLAUDE_AGENT_SOURCE, true), + conv[converter](CLAUDE_AGENT_SOURCE, false), + `${runtime}: global vs local conversion must differ (scope threading observable)`); + } + }); + } +}); diff --git a/tests/runtime-artifact-layout-descriptor-drive.test.cjs b/tests/runtime-artifact-layout-descriptor-drive.test.cjs index 0f673d21e..a4fa1a321 100644 --- a/tests/runtime-artifact-layout-descriptor-drive.test.cjs +++ b/tests/runtime-artifact-layout-descriptor-drive.test.cjs @@ -46,6 +46,13 @@ const FAKE_DIR = '/tmp/fake-config-dir-dd'; // 'function' means we assert typeof kind.stage === 'function'. const GOLDEN = { + // #1173: these 8 runtimes (copilot/antigravity/cursor/windsurf/augment/trae/ + // codebuddy/cline) gained an `agents` kind so the descriptor-driven path applies + // their per-runtime agent converter. This INTENTIONALLY extends the layout beyond + // the old switch() (which emitted no agents branch for them — their agents were + // converted only by the legacy bin/install.js loop). Not an equivalence regression + // of the ADR-857 descriptor migration; a sanctioned #1173 (ADR-1235 agent-conversion + // cutover) extension. cline stays global-only (empty local). // ── claude ────────────────────────────────────────────────────────────────── 'claude/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, @@ -61,10 +68,12 @@ const GOLDEN = { 'cursor/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'cursor/local': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── gemini ─────────────────────────────────────────────────────────────────── @@ -89,27 +98,33 @@ const GOLDEN = { // Old switch: no scope branch → local == global. 5b backfill restores this. 'copilot/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'copilot/local': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── antigravity ────────────────────────────────────────────────────────────── // Old switch: no scope branch → local == global. 5b backfill restores this. 'antigravity/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'antigravity/local': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── windsurf ───────────────────────────────────────────────────────────────── // Old switch: no scope branch → local == global. 5b backfill restores this. 'windsurf/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'windsurf/local': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── augment ────────────────────────────────────────────────────────────────── @@ -117,19 +132,23 @@ const GOLDEN = { 'augment/global': [ { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'augment/local': [ { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── trae ───────────────────────────────────────────────────────────────────── // Old switch: no scope branch → local == global. 5b backfill restores this. 'trae/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'trae/local': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── qwen ───────────────────────────────────────────────────────────────────── @@ -155,16 +174,19 @@ const GOLDEN = { 'codebuddy/global': [ { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'codebuddy/local': [ { kind: 'commands', destSubpath: 'commands', prefix: 'gsd-' }, { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], // ── cline ──────────────────────────────────────────────────────────────────── // Old switch: scope='global' → [skills]; scope='local' → []. Matches descriptor. 'cline/global': [ { kind: 'skills', destSubpath: 'skills', prefix: 'gsd-' }, + { kind: 'agents', destSubpath: 'agents', prefix: 'gsd-' }, ], 'cline/local': [], @@ -363,13 +385,16 @@ describe('resolveRuntimeArtifactLayout — scope defaults to global (descriptor- // ── Non-vacuous check: verify at least one multi-kind runtime ───────────────── describe('resolveRuntimeArtifactLayout — multi-kind runtimes non-vacuous (descriptor-driven)', () => { - test('augment global returns 2 kinds (commands + skills)', () => { + test('augment global returns 3 kinds (commands + skills + agents)', () => { + // #1173: augment gained an agents kind (per-runtime converter) after commands+skills. const layout = resolveRuntimeArtifactLayout('augment', FAKE_DIR, 'global'); - assert.strictEqual(layout.kinds.length, 2); + assert.strictEqual(layout.kinds.length, 3); assert.strictEqual(layout.kinds[0].kind, 'commands'); assert.strictEqual(layout.kinds[1].kind, 'skills'); + assert.strictEqual(layout.kinds[2].kind, 'agents'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); assert.strictEqual(typeof layout.kinds[1].stage, 'function'); + assert.strictEqual(typeof layout.kinds[2].stage, 'function'); }); test('kimi global returns skills then kimi-agents', () => { @@ -381,10 +406,12 @@ describe('resolveRuntimeArtifactLayout — multi-kind runtimes non-vacuous (desc assert.strictEqual(layout.kinds[1].prefix, 'gsd'); }); - test('codebuddy global returns commands then skills', () => { + test('codebuddy global returns commands then skills then agents', () => { + // #1173: codebuddy gained an agents kind (per-runtime converter) after commands+skills. const layout = resolveRuntimeArtifactLayout('codebuddy', FAKE_DIR, 'global'); - assert.strictEqual(layout.kinds.length, 2); + assert.strictEqual(layout.kinds.length, 3); assert.strictEqual(layout.kinds[0].kind, 'commands'); assert.strictEqual(layout.kinds[1].kind, 'skills'); + assert.strictEqual(layout.kinds[2].kind, 'agents'); }); }); diff --git a/tests/runtime-artifact-layout.test.cjs b/tests/runtime-artifact-layout.test.cjs index a52aa6768..1b7d05236 100644 --- a/tests/runtime-artifact-layout.test.cjs +++ b/tests/runtime-artifact-layout.test.cjs @@ -65,7 +65,7 @@ describe('resolveRuntimeArtifactLayout — cursor', () => { const layout = resolveRuntimeArtifactLayout('cursor', FAKE_DIR); assert.strictEqual(layout.runtime, 'cursor'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 2); + assert.strictEqual(layout.kinds.length, 3); const skillsKind = layout.kinds.find(k => k.kind === 'skills'); assert.ok(skillsKind, 'must have a skills kind'); @@ -78,6 +78,12 @@ describe('resolveRuntimeArtifactLayout — cursor', () => { assert.strictEqual(commandsKind.destSubpath, 'commands'); assert.strictEqual(commandsKind.prefix, 'gsd-'); assert.strictEqual(typeof commandsKind.stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + const agentsKind = layout.kinds.find(k => k.kind === 'agents'); + assert.ok(agentsKind, 'must have an agents kind (#1173 descriptor-driven agent conversion)'); + assert.strictEqual(agentsKind.destSubpath, 'agents'); + assert.strictEqual(agentsKind.prefix, 'gsd-'); + assert.strictEqual(typeof agentsKind.stage, 'function'); }); }); @@ -112,11 +118,16 @@ describe('resolveRuntimeArtifactLayout — copilot', () => { const layout = resolveRuntimeArtifactLayout('copilot', FAKE_DIR); assert.strictEqual(layout.runtime, 'copilot'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 1); + assert.strictEqual(layout.kinds.length, 2); assert.strictEqual(layout.kinds[0].kind, 'skills'); assert.strictEqual(layout.kinds[0].destSubpath, 'skills'); assert.strictEqual(layout.kinds[0].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[1].kind, 'agents'); + assert.strictEqual(layout.kinds[1].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[1].stage, 'function'); }); }); @@ -125,11 +136,16 @@ describe('resolveRuntimeArtifactLayout — antigravity', () => { const layout = resolveRuntimeArtifactLayout('antigravity', FAKE_DIR); assert.strictEqual(layout.runtime, 'antigravity'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 1); + assert.strictEqual(layout.kinds.length, 2); assert.strictEqual(layout.kinds[0].kind, 'skills'); assert.strictEqual(layout.kinds[0].destSubpath, 'skills'); assert.strictEqual(layout.kinds[0].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[1].kind, 'agents'); + assert.strictEqual(layout.kinds[1].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[1].stage, 'function'); }); }); @@ -138,11 +154,16 @@ describe('resolveRuntimeArtifactLayout — windsurf', () => { const layout = resolveRuntimeArtifactLayout('windsurf', FAKE_DIR); assert.strictEqual(layout.runtime, 'windsurf'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 1); + assert.strictEqual(layout.kinds.length, 2); assert.strictEqual(layout.kinds[0].kind, 'skills'); assert.strictEqual(layout.kinds[0].destSubpath, 'skills'); assert.strictEqual(layout.kinds[0].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[1].kind, 'agents'); + assert.strictEqual(layout.kinds[1].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[1].stage, 'function'); }); }); @@ -151,7 +172,7 @@ describe('resolveRuntimeArtifactLayout — augment', () => { const layout = resolveRuntimeArtifactLayout('augment', FAKE_DIR); assert.strictEqual(layout.runtime, 'augment'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 2); + assert.strictEqual(layout.kinds.length, 3); // commands kind first assert.strictEqual(layout.kinds[0].kind, 'commands'); assert.strictEqual(layout.kinds[0].destSubpath, 'commands'); @@ -162,6 +183,11 @@ describe('resolveRuntimeArtifactLayout — augment', () => { assert.strictEqual(layout.kinds[1].destSubpath, 'skills'); assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[1].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[2].kind, 'agents'); + assert.strictEqual(layout.kinds[2].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[2].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[2].stage, 'function'); }); }); @@ -170,11 +196,16 @@ describe('resolveRuntimeArtifactLayout — trae', () => { const layout = resolveRuntimeArtifactLayout('trae', FAKE_DIR); assert.strictEqual(layout.runtime, 'trae'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 1); + assert.strictEqual(layout.kinds.length, 2); assert.strictEqual(layout.kinds[0].kind, 'skills'); assert.strictEqual(layout.kinds[0].destSubpath, 'skills'); assert.strictEqual(layout.kinds[0].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[1].kind, 'agents'); + assert.strictEqual(layout.kinds[1].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[1].stage, 'function'); }); }); @@ -231,7 +262,7 @@ describe('resolveRuntimeArtifactLayout — codebuddy', () => { const layout = resolveRuntimeArtifactLayout('codebuddy', FAKE_DIR); assert.strictEqual(layout.runtime, 'codebuddy'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 2); + assert.strictEqual(layout.kinds.length, 3); // commands kind first assert.strictEqual(layout.kinds[0].kind, 'commands'); assert.strictEqual(layout.kinds[0].destSubpath, 'commands'); @@ -242,6 +273,11 @@ describe('resolveRuntimeArtifactLayout — codebuddy', () => { assert.strictEqual(layout.kinds[1].destSubpath, 'skills'); assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[1].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[2].kind, 'agents'); + assert.strictEqual(layout.kinds[2].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[2].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[2].stage, 'function'); }); }); @@ -250,11 +286,16 @@ describe('resolveRuntimeArtifactLayout — cline', () => { const layout = resolveRuntimeArtifactLayout('cline', FAKE_DIR, 'global'); assert.strictEqual(layout.runtime, 'cline'); assert.strictEqual(layout.configDir, FAKE_DIR); - assert.strictEqual(layout.kinds.length, 1); + assert.strictEqual(layout.kinds.length, 2); assert.strictEqual(layout.kinds[0].kind, 'skills'); assert.strictEqual(layout.kinds[0].destSubpath, 'skills'); assert.strictEqual(layout.kinds[0].prefix, 'gsd-'); assert.strictEqual(typeof layout.kinds[0].stage, 'function'); + // #1173: agents kind appended (descriptor now applies per-runtime agent conversion). + assert.strictEqual(layout.kinds[1].kind, 'agents'); + assert.strictEqual(layout.kinds[1].destSubpath, 'agents'); + assert.strictEqual(layout.kinds[1].prefix, 'gsd-'); + assert.strictEqual(typeof layout.kinds[1].stage, 'function'); }); test('cline local: no skills kinds (global-only, #782)', () => {