feat(architecture): [EoS/claude] drive claude through the imperative adapter + descriptor-driven hostBehaviors (#2086)
Fold Claude Code's install/uninstall onto the Embeddable Orchestration System
(ADR-1239 Phase D). claude is GSD's tier-1 reference host, but its install path
was still driven by 13 hardcoded `runtime === 'claude'` string-equality branches
scattered across bin/install.js rather than the public Host-Integration Interface.
- Route install()/uninstall() through `createImperativeAdapter({runtime})` — the
adapter delegates to the SAME installRuntimeArtifacts/uninstallRuntimeArtifacts
engine calls, so output is byte-identical (proven pre/post, both scopes).
- Replace all 13 `runtime === 'claude'` / `runtime !== 'claude'` branches with
descriptor-driven `runtime.hostBehaviors` lookups on capabilities/claude/
capability.json (attributionSource, authorsCanonicalWorkflow, localInstallStyle,
permissionsSchema, settingsFileByScope, sourceMarkerFile, agentFrontmatterExtensions,
ownsClaudePaths, nativeModelAliases, skillsGlobalOnboarding). Behavior is
identical; the brittle string-equality coupling (the add-a-host tax) is gone.
- Single-source the scattered literal 'claude' defaults/rosters behind DEFAULT_RUNTIME.
- Extend golden-install-parity to assert the claude LOCAL legacy layout is
byte-identical too (AC1 "both scopes"); exclude the platform-varying
settings.local.json (same reason settings.json is excluded).
- New tests/claude-imperative-reference.test.cjs: adapter kind, programmatic-cli
profile, fail-closed negotiation on a corrupted/partial descriptor, and an AC2
source guard that no `runtime === 'claude'` branch remains.
No user-visible install-output change (internal architecture only).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,9 @@ const PKG_VERSION = require('../package.json').version;
|
||||
// (install-minimal-hooks, sh-hook-paths, codex-config, etc.). Matched by basename.
|
||||
// settings.json = Claude/Antigravity/Augment/etc. hook surface; hooks.json =
|
||||
// Codex/Cursor hook surface — both embed the platform-varying node-runner command.
|
||||
const HOOK_CONFIG_FILES = new Set(['settings.json', 'hooks.json']);
|
||||
// settings.local.json = Claude LOCAL hook surface (#338): same platform-varying
|
||||
// node-runner command as settings.json, so excluded for the same reason (#2086).
|
||||
const HOOK_CONFIG_FILES = new Set(['settings.json', 'settings.local.json', 'hooks.json']);
|
||||
|
||||
// Path prefixes excluded from the parity manifest. `gsd-core/bin/lib/` holds the
|
||||
// tsc-built runtime artifacts (compiled from src/*.cts) that the install COPIES
|
||||
@@ -194,3 +196,53 @@ for (const runtime of runtimes) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// #2086 (EoS/claude): claude is the reference host and the ONLY runtime with a
|
||||
// distinct LOCAL "legacy flat-commands" layout (commands/gsd-*.md + agents/gsd-*.md).
|
||||
// The loop above asserts the GLOBAL skills layout; this asserts the LOCAL
|
||||
// commands/agents layout is byte-identical too, so folding claude's
|
||||
// `runtime === 'claude'` branches into descriptor-driven hostBehaviors cannot
|
||||
// silently change the local install output (AC1: "both scopes"). NOTE: the
|
||||
// settings.local.json ROUTING itself is excluded here (platform-varying node-runner
|
||||
// path) — that dimension is covered directly by install.test.cjs's #338 suite.
|
||||
test('golden parity — claude (local legacy layout)', async (t) => {
|
||||
if (process.platform === 'win32') {
|
||||
t.skip('install output is platform-specific on Windows (backslash paths); parity is asserted on macOS + Linux');
|
||||
return;
|
||||
}
|
||||
const { configDir, root } = runMinimalInstall({ runtime: 'claude', scope: 'local' });
|
||||
let actual;
|
||||
try {
|
||||
actual = buildParityManifest(configDir, root);
|
||||
} finally {
|
||||
cleanup(root);
|
||||
}
|
||||
|
||||
const fixturePath = path.join(FIXTURE_DIR, 'claude-local.json');
|
||||
|
||||
if (UPDATE) {
|
||||
fs.writeFileSync(fixturePath, JSON.stringify(actual, null, 2) + '\n', 'utf8');
|
||||
process.stdout.write(` [UPDATE] claude-local: wrote ${Object.keys(actual).length} file hashes → ${fixturePath}\n`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(fixturePath)) {
|
||||
assert.fail(
|
||||
`Golden fixture missing for claude-local: ${fixturePath}\n` +
|
||||
'Run UPDATE_GOLDEN=1 node --test tests/golden-install-parity.test.cjs to capture.',
|
||||
);
|
||||
}
|
||||
|
||||
const golden = JSON.parse(fs.readFileSync(fixturePath, 'utf8'));
|
||||
const added = Object.keys(actual).filter(k => !(k in golden));
|
||||
const removed = Object.keys(golden).filter(k => !(k in actual));
|
||||
const changed = Object.keys(actual).filter(k => k in golden && actual[k] !== golden[k]);
|
||||
if (added.length || removed.length || changed.length) {
|
||||
const lines = ['Parity mismatch for claude-local:'];
|
||||
if (added.length) lines.push(` added (${added.length}): ${added.join(', ')}`);
|
||||
if (removed.length) lines.push(` removed (${removed.length}): ${removed.join(', ')}`);
|
||||
if (changed.length) lines.push(` changed (${changed.length}): ${changed.join(', ')}`);
|
||||
lines.push('Run UPDATE_GOLDEN=1 to recapture if the change is intentional.');
|
||||
assert.deepEqual(actual, golden, lines.join('\n'));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user