Fix plugin script path resolution (#535)

Makes plugin instructions execute the installed plugin copy, safely quotes paths containing spaces, removes the broad Node pre-approval, and ships guarded generated plugin output.\n\nAI-assisted maintainer conflict resolution, review, and validation by Codex under maintainer direction.
This commit is contained in:
Abdul Wahab
2026-08-31 20:16:04 -04:00
committed by GitHub
parent 0bc8643b51
commit bfafc7dbcb
18 changed files with 551 additions and 50 deletions
+21
View File
@@ -25,6 +25,12 @@ import { hooksJsonFor, buildClaudePluginHooksManifest } from './lib/transformers
import { createAllZips, createProviderZip } from './lib/zip.js';
import { collectPluginVersions } from './lib/validate-plugin-versions.js';
import { collectPluginManifestFindings } from './lib/validate-plugin-manifest.js';
import {
rewritePluginMarkdownTree,
rewritePluginAgentMarkdown,
verifyPluginSkillRewrite,
verifyPluginAgentRewrite,
} from './lib/plugin-paths.js';
import { stageOpenAIPlugin } from './lib/openai-plugin.js';
import { ANTIPATTERNS } from '../cli/engine/registry/antipatterns.mjs';
// Sub-page generation is now handled by Astro content collections.
@@ -751,6 +757,21 @@ async function build() {
copyDirSync(claudeAgentsSrc, pluginAgentsDir);
}
// The claude-code output resolves {{scripts_path}} to a project-relative
// path. Inside the plugin cache that path points into the user's project,
// so a dual install silently runs the project's older skill copy (issue
// #523). Rewrite the copied markdown to the skill-base-dir form.
rewritePluginMarkdownTree(pluginSkillsDir);
// Agents get the plugin-root variable, not the skill-base-dir token:
// a spawned agent never loads SKILL.md, so the token is undefined there.
rewritePluginMarkdownTree(pluginAgentsDir, rewritePluginAgentMarkdown);
verifyPluginSkillRewrite(path.join(pluginSkillsDir, 'impeccable', 'SKILL.md'));
if (fs.existsSync(pluginAgentsDir)) {
for (const agentFile of fs.readdirSync(pluginAgentsDir)) {
if (agentFile.endsWith('.md')) verifyPluginAgentRewrite(path.join(pluginAgentsDir, agentFile));
}
}
// Ship the design detector as a plugin-packaged hook. Claude Code and
// Grok Build both auto-discover `hooks/hooks.json` at the plugin root
// (Grok aliases CLAUDE_PLUGIN_ROOT → GROK_PLUGIN_ROOT), so marketplace /