Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/parsers/claude.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export async function loadClaudePlugin(inputPath: string): Promise<ClaudePlugin>
const manifestPath = path.join(root, PLUGIN_MANIFEST)
const manifest = await readJson<ClaudeManifest>(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))
Expand All @@ -36,6 +39,29 @@ export async function loadClaudePlugin(inputPath: string): Promise<ClaudePlugin>
}
}

/**
* 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<void> {
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}`)
}
}
}
}
Comment on lines +46 to +62
}
Comment on lines +62 to +63
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove extra closing brace that breaks module parsing

When this parser module is imported, Bun fails to parse it with Unexpected } at this extra brace, so any CLI/test path that loads Claude plugins aborts before running. I checked bun test --filter claude, which fails immediately on this line rather than executing the parser tests.

Useful? React with 👍 / 👎.


async function resolveClaudeRoot(inputPath: string): Promise<string> {
const absolute = path.resolve(inputPath)
const manifestAtPath = path.join(absolute, PLUGIN_MANIFEST)
Expand Down
Loading