feat(#2873): detect cross-scope shadowing and reach the local spec tree
4a - the detection floor. A shadowed install now reports which triggers are shadowed and which scope wins, at install time and through a new W028 /gsd-health diagnostic. Exit codes are untouched: a shadowed install is a warning, not a failure. Only triggers whose stem exists at BOTH scopes are reported, so a global full profile beside a local core profile no longer names local artifacts the user does not have. 4b - spec-root reachability, claude runtime and global scope only. The winning global skill stops carrying a static workflow @-include and instead resolves its spec at runtime: prefer the project-local copy, fall back to the global one, stop if neither exists. Every other @-include stays static, and the local emission is byte-identical. It runs after the staged-skills rewrite pass, whose claude branch would otherwise mangle the literal tilde path into an undocumented $HOME form. Also fixed inline: readInstallManifest classified a top-level JSON array as an installed v1 manifest, because typeof [] is object. Refs #2873
This commit is contained in:
@@ -246,7 +246,14 @@ function normalizeManifestVersion(raw: unknown): number {
|
||||
|
||||
function readInstallManifest(configDir: string): InstallManifest {
|
||||
const manifest = readJsonIfPresent(path.join(configDir, MANIFEST_NAME), null);
|
||||
if (!manifest || typeof manifest !== 'object') {
|
||||
// `typeof [] === 'object'` in JS, so a bare `typeof !== 'object'` guard lets
|
||||
// a top-level JSON array (valid JSON, but not the manifest's documented
|
||||
// object shape) fall through to the field reads below — `m.manifestVersion`
|
||||
// reads `undefined` off an array, which `normalizeManifestVersion` then
|
||||
// reports as `1` (a v1 manifest), misclassifying "not an object" as
|
||||
// "installed". `Array.isArray` closes that gap explicitly rather than
|
||||
// relying on the object-shape checks below to catch it incidentally.
|
||||
if (!manifest || typeof manifest !== 'object' || Array.isArray(manifest)) {
|
||||
return {
|
||||
version: null,
|
||||
timestamp: null,
|
||||
|
||||
Reference in New Issue
Block a user