diff --git a/src/parsers/claude.ts b/src/parsers/claude.ts index e989c269b..b82c0721a 100644 --- a/src/parsers/claude.ts +++ b/src/parsers/claude.ts @@ -18,6 +18,9 @@ export async function loadClaudePlugin(inputPath: string): Promise const manifestPath = path.join(root, PLUGIN_MANIFEST) const manifest = await readJson(manifestPath) + // New Feature: Validate that the manifest components actually exist on disk + await validatePluginStructure(root, manifest) + const agents = await loadAgents(resolveComponentDirs(root, "agents", manifest.agents)) const commands = await loadCommands(resolveComponentDirs(root, "commands", manifest.commands)) const skills = await loadSkills(resolveComponentDirs(root, "skills", manifest.skills)) @@ -36,6 +39,29 @@ export async function loadClaudePlugin(inputPath: string): Promise } } +/** + * New Helper: Validates that directories declared in the manifest exist. + * Logs a warning for missing components to assist in debugging. + */ +async function validatePluginStructure(root: string, manifest: ClaudeManifest): Promise { + const componentsToCheck: Array<{ name: string; declared: any }> = [ + { name: "agents", declared: manifest.agents }, + { name: "commands", declared: manifest.commands }, + { name: "skills", declared: manifest.skills }, + ] + + for (const { name, declared } of componentsToCheck) { + if (declared) { + const dirPath = path.join(root, name) + const exists = await pathExists(dirPath) + if (!exists) { + console.warn(`[Claude Plugin Warning]: "${name}" is defined in manifest but directory missing at: ${dirPath}`) + } + } + } +} +} + async function resolveClaudeRoot(inputPath: string): Promise { const absolute = path.resolve(inputPath) const manifestAtPath = path.join(absolute, PLUGIN_MANIFEST)