fix(3663): address CodeRabbit surface/layout follow-ups

This commit is contained in:
Tom Boucher
2026-05-17 01:39:10 -04:00
parent aa73c2d914
commit b8fa89b5b6
4 changed files with 27 additions and 15 deletions

View File

@@ -118,9 +118,9 @@ Valid cluster names: `core_loop`, `audit_review`, `milestone`, `research_ideate`
# Claude Code # Claude Code
RUNTIME_CONFIG_DIR=~/.claude/skills RUNTIME_CONFIG_DIR=~/.claude/skills
# Resolve commandsDir and agentsDir # Artifact destinations are derived from runtime layout
COMMANDS_DIR=~/.claude/commands/gsd # via resolveRuntimeArtifactLayout(runtime, RUNTIME_CONFIG_DIR, scope)
AGENTS_DIR=~/.claude/agents # then applySurface(RUNTIME_CONFIG_DIR, layout, manifest, CLUSTERS)
``` ```
All paths can be overridden by reading the `CLAUDE_CONFIG_DIR` env var if set. All paths can be overridden by reading the `CLAUDE_CONFIG_DIR` env var if set.

View File

@@ -18,7 +18,7 @@ The root problem is the absence of a typed seam for "where does runtime R put ar
- The `kinds` array is empty for runtimes with no GSD surface (a hypothetical future runtime with no integration). The `skills` kind is **absent** for runtimes that don't materialize skill directories (Cline; Gemini today). The `commands` kind is **absent** for runtimes that consume only the skills/agents layout (Claude global, Codex, etc.). - The `kinds` array is empty for runtimes with no GSD surface (a hypothetical future runtime with no integration). The `skills` kind is **absent** for runtimes that don't materialize skill directories (Cline; Gemini today). The `commands` kind is **absent** for runtimes that consume only the skills/agents layout (Claude global, Codex, etc.).
- Per-runtime quirks live in the layout's record fields, not in caller branches: - Per-runtime quirks live in the layout's record fields, not in caller branches:
- **Hermes**: `{ kind: 'skills', destSubpath: 'skills/gsd', prefix: '' }` — preserves the nested namespace from #2841. - **Hermes**: `{ kind: 'skills', destSubpath: 'skills/gsd', prefix: '' }` — preserves the nested namespace from #2841.
- **Cline**: `kinds: [ { kind: 'commands', … } ]` — no skills kind in the array. - **Cline**: `kinds: []` — Cline resolves to zero kinds in Phase 1 (no `commands` kind).
- **Gemini**: `kinds: [ { kind: 'commands', destSubpath: 'commands/gsd', prefix: 'gsd-' } ]` — no agents, no skills. - **Gemini**: `kinds: [ { kind: 'commands', destSubpath: 'commands/gsd', prefix: 'gsd-' } ]` — no agents, no skills.
- `applySurface` migrates from `(runtimeConfigDir, commandsDir, agentsDir, manifest, clusterMap)` to `(runtimeConfigDir, layout, manifest, clusterMap)`. Body collapses to `for (const kind of layout.kinds) _syncGsdDir(kind.stage(resolved), path.join(layout.configDir, kind.destSubpath), kind.kind)`. - `applySurface` migrates from `(runtimeConfigDir, commandsDir, agentsDir, manifest, clusterMap)` to `(runtimeConfigDir, layout, manifest, clusterMap)`. Body collapses to `for (const kind of layout.kinds) _syncGsdDir(kind.stage(resolved), path.join(layout.configDir, kind.destSubpath), kind.kind)`.
- `_findInstallSource` and `_findAgentsSource` in `surface.cjs` are removed. The layout owns source resolution. - `_findInstallSource` and `_findAgentsSource` in `surface.cjs` are removed. The layout owns source resolution.
@@ -140,6 +140,7 @@ function applySurface(runtimeConfigDir, layout, manifest, clusterMap) {
Phase 1 implementation landed on `feat/3663-runtime-artifact-layout-module-phase-1-m`: Phase 1 implementation landed on `feat/3663-runtime-artifact-layout-module-phase-1-m`:
- `get-shit-done/bin/lib/runtime-artifact-layout.cjs` — 15-runtime layout table (grok intentionally excluded), `resolveRuntimeArtifactLayout(runtime, configDir, scope) → Layout`, walk-up `findInstallSourceRoot` helper. - `get-shit-done/bin/lib/runtime-artifact-layout.cjs` — 15-runtime layout table (grok intentionally excluded), `resolveRuntimeArtifactLayout(runtime, configDir, scope) → Layout`, walk-up `findInstallSourceRoot` helper.
- Clarification: in this Phase 1 implementation, **Cline resolves to zero kinds** (`kinds: []`), so it carries no `commands` kind in the layout table.
- `get-shit-done/bin/lib/install-profiles.cjs` — new `stageSkillsForRuntimeAsSkills(srcCommandsDir, resolvedProfile, converter, prefix) → stagedDir` helper. - `get-shit-done/bin/lib/install-profiles.cjs` — new `stageSkillsForRuntimeAsSkills(srcCommandsDir, resolvedProfile, converter, prefix) → stagedDir` helper.
- `get-shit-done/bin/lib/surface.cjs` — `applySurface(runtimeConfigDir, layout, manifest, clusterMap)` signature migration; `_findInstallSource` + `_findAgentsSource` deleted; `_syncGsdDir` extended to handle the `skills` kind via directory iteration. - `get-shit-done/bin/lib/surface.cjs` — `applySurface(runtimeConfigDir, layout, manifest, clusterMap)` signature migration; `_findInstallSource` + `_findAgentsSource` deleted; `_syncGsdDir` extended to handle the `skills` kind via directory iteration.
- Tests: `runtime-artifact-layout-resolve.test.cjs` (16), `runtime-artifact-layout-edge-cases.test.cjs` (10), `runtime-artifact-layout-stage.test.cjs` (5), `install-profiles-stage.test.cjs` (+7 new), `surface-apply.test.cjs` (updated 5 call sites + new skills-kind test). - Tests: `runtime-artifact-layout-resolve.test.cjs` (16), `runtime-artifact-layout-edge-cases.test.cjs` (10), `runtime-artifact-layout-stage.test.cjs` (5), `install-profiles-stage.test.cjs` (+7 new), `surface-apply.test.cjs` (updated 5 call sites + new skills-kind test).

View File

@@ -204,7 +204,10 @@ function resolveSurface(runtimeConfigDir, manifest, clusterMap) {
* @param {Object} [clusterMap] * @param {Object} [clusterMap]
*/ */
function applySurface(runtimeConfigDir, layout, manifest, clusterMap) { function applySurface(runtimeConfigDir, layout, manifest, clusterMap) {
const resolved = resolveSurface(runtimeConfigDir, manifest, clusterMap); if (path.resolve(runtimeConfigDir) !== path.resolve(layout.configDir)) {
throw new TypeError('applySurface runtimeConfigDir must match layout.configDir');
}
const resolved = resolveSurface(layout.configDir, manifest, clusterMap);
for (const kind of layout.kinds) { for (const kind of layout.kinds) {
const staged = kind.stage(resolved); const staged = kind.stage(resolved);
const dest = path.join(layout.configDir, kind.destSubpath); const dest = path.join(layout.configDir, kind.destSubpath);

View File

@@ -46,18 +46,20 @@ describe('applySurface', () => {
}); });
const manifest = loadSkillsManifest(REAL_COMMANDS_DIR); const manifest = loadSkillsManifest(REAL_COMMANDS_DIR);
const layout = resolveRuntimeArtifactLayout('claude', runtimeConfigDir, 'local'); const layout = resolveRuntimeArtifactLayout('claude', runtimeConfigDir, 'local');
applySurface(runtimeConfigDir, layout, manifest, CLUSTERS); const resolved = applySurface(runtimeConfigDir, layout, manifest, CLUSTERS);
const files = fs.readdirSync(commandsDir).filter(f => f.endsWith('.md')); const files = fs.readdirSync(commandsDir).filter(f => f.endsWith('.md'));
// Every file should be a real stem we know about // Every file should be a real stem we know about
for (const file of files) { for (const file of files) {
assert.ok(fs.existsSync(path.join(REAL_COMMANDS_DIR, file)), `unexpected file: ${file}`); assert.ok(fs.existsSync(path.join(REAL_COMMANDS_DIR, file)), `unexpected file: ${file}`);
} }
// At minimum core skills should be present // Core profile should materialize exactly the resolved core command set.
const coreStems = ['new-project', 'discuss-phase', 'plan-phase', 'execute-phase', 'help', 'update']; const expectedCore = [...resolved.skills].map(stem => `${stem}.md`).sort();
for (const stem of coreStems) { assert.deepStrictEqual(
assert.ok(files.includes(`${stem}.md`), `core skill "${stem}" should be in commandsDir`); [...files].sort(),
} expectedCore,
'commandsDir should contain exactly core commands'
);
}); });
test('removes superseded files when profile shrinks', (t) => { test('removes superseded files when profile shrinks', (t) => {
@@ -84,17 +86,23 @@ describe('applySurface', () => {
explicitAdds: [], explicitAdds: [],
explicitRemoves: [], explicitRemoves: [],
}); });
applySurface(runtimeConfigDir, layout, manifest, CLUSTERS); const resolvedCore = applySurface(runtimeConfigDir, layout, manifest, CLUSTERS);
const afterCore = new Set(fs.readdirSync(commandsDir).filter(f => f.endsWith('.md'))); const afterCore = new Set(fs.readdirSync(commandsDir).filter(f => f.endsWith('.md')));
// core should be a subset of standard // core should be a subset of standard
assert.ok(afterCore.size <= afterStandard.size, 'core should have fewer or equal files than standard'); assert.ok(afterCore.size <= afterStandard.size, 'core should have fewer or equal files than standard');
// Files removed should not be in core set // Core profile should materialize exactly the resolved core command set.
const coreStems = new Set(['new-project', 'discuss-phase', 'plan-phase', 'execute-phase', 'help', 'update']); const expectedCore = [...resolvedCore.skills].map(stem => `${stem}.md`).sort();
assert.deepStrictEqual(
[...afterCore].sort(),
expectedCore,
'afterCore should contain exactly core commands'
);
// All files should still map to known real skills.
for (const file of afterCore) { for (const file of afterCore) {
const stem = file.slice(0, -3);
assert.ok( assert.ok(
fs.existsSync(path.join(REAL_COMMANDS_DIR, file)), fs.existsSync(path.join(REAL_COMMANDS_DIR, file)),
`file in commandsDir not a real skill: ${file}` `file in commandsDir not a real skill: ${file}`