feat(M3): Shared-source generator for agent variants
This commit is contained in:
@@ -47,13 +47,20 @@ const SKIP_PATHS = new Set([
|
||||
"pi-package",
|
||||
]);
|
||||
|
||||
// Also skip any _source/ subdirectory within skills — canonical source files
|
||||
// use relative paths calibrated to the generated location (one level shallower).
|
||||
const SKIP_SEGMENT = "_source";
|
||||
|
||||
function shouldSkip(absPath) {
|
||||
const rel = path.relative(REPO_ROOT, absPath);
|
||||
for (const skip of SKIP_PATHS) {
|
||||
if (rel === skip || rel.startsWith(skip + path.sep)) return true;
|
||||
}
|
||||
const parts = rel.split(path.sep);
|
||||
return parts.includes("node_modules");
|
||||
if (parts.includes("node_modules")) return true;
|
||||
// Skip canonical _source/ directories (links calibrated to generated location)
|
||||
if (parts.includes(SKIP_SEGMENT)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function collectMarkdownFiles(dir) {
|
||||
|
||||
@@ -279,7 +279,7 @@ async function findClaudeCodeSuperpowersPluginRoots(homeDir) {
|
||||
|
||||
async function findCursorSuperpowersPluginRoots(homeDir) {
|
||||
const pluginRoot = path.join(homeDir, ".cursor", "plugins", "cache", "cursor-public", "superpowers");
|
||||
let entries = [];
|
||||
let entries;
|
||||
try {
|
||||
entries = await readdir(pluginRoot, { withFileTypes: true });
|
||||
} catch (error) {
|
||||
@@ -598,7 +598,10 @@ export async function executeOperation(op) {
|
||||
if (op.action === "unsupported" || op.status === "skipped") return { ...op, status: "skipped" };
|
||||
if (op.kind === "package-skill") return { ...op, status: "included" };
|
||||
if (op.kind === "sync-pi-package") {
|
||||
runCommand(path.join(op.repoRoot, "scripts", "sync-pi-package-skills.sh"), [], { cwd: op.repoRoot });
|
||||
// Use the canonical generator (pnpm run sync:pi / node scripts/generate-skills.mjs).
|
||||
// The legacy sync-pi-package-skills.sh is retired in M3; it bypassed the
|
||||
// generator and copied skills/*/pi into pi-package directly, corrupting manifests.
|
||||
runCommand(process.execPath, [path.join(op.repoRoot, "scripts", "generate-skills.mjs")], { cwd: op.repoRoot });
|
||||
return { ...op, status: "ok" };
|
||||
}
|
||||
if (op.kind === "pi-package") {
|
||||
|
||||
Reference in New Issue
Block a user