@gobing-ai/superskill 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +81 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9731,10 +9731,53 @@ var init_adapt_subagent = __esm(() => {
|
|
|
9731
9731
|
});
|
|
9732
9732
|
|
|
9733
9733
|
// ../../packages/core/src/mapper.ts
|
|
9734
|
-
import { existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync2, statSync as statSync2, writeFileSync } from "fs";
|
|
9734
|
+
import { existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync2, rmSync as rmSync2, statSync as statSync2, writeFileSync } from "fs";
|
|
9735
9735
|
import { join as join3 } from "path";
|
|
9736
|
+
function convertClaudeHooksToCanonical(claudeJson) {
|
|
9737
|
+
const claudeHooks = claudeJson.hooks;
|
|
9738
|
+
if (!claudeHooks || typeof claudeHooks !== "object")
|
|
9739
|
+
return claudeJson;
|
|
9740
|
+
const canonical = {};
|
|
9741
|
+
for (const [claudeEvent, matcherEntries] of Object.entries(claudeHooks)) {
|
|
9742
|
+
const canonicalEvent = CLAUDE_TO_CANONICAL_EVENT[claudeEvent] ?? claudeEvent;
|
|
9743
|
+
if (!Array.isArray(matcherEntries))
|
|
9744
|
+
continue;
|
|
9745
|
+
const defs = [];
|
|
9746
|
+
for (const entry of matcherEntries) {
|
|
9747
|
+
if (typeof entry !== "object" || entry === null)
|
|
9748
|
+
continue;
|
|
9749
|
+
const e = entry;
|
|
9750
|
+
const hookList = e.hooks;
|
|
9751
|
+
if (Array.isArray(hookList)) {
|
|
9752
|
+
const matcher = e.matcher;
|
|
9753
|
+
for (const hook of hookList) {
|
|
9754
|
+
if (typeof hook !== "object" || hook === null)
|
|
9755
|
+
continue;
|
|
9756
|
+
const h = hook;
|
|
9757
|
+
const def = { ...h };
|
|
9758
|
+
if (matcher !== undefined && matcher !== "*") {
|
|
9759
|
+
def.matcher = matcher;
|
|
9760
|
+
}
|
|
9761
|
+
defs.push(def);
|
|
9762
|
+
}
|
|
9763
|
+
} else {
|
|
9764
|
+
defs.push({ ...e });
|
|
9765
|
+
}
|
|
9766
|
+
}
|
|
9767
|
+
if (defs.length > 0) {
|
|
9768
|
+
canonical[canonicalEvent] = defs;
|
|
9769
|
+
}
|
|
9770
|
+
}
|
|
9771
|
+
return { hooks: canonical };
|
|
9772
|
+
}
|
|
9773
|
+
function setSkillName(content, newName) {
|
|
9774
|
+
return content.replace(/^name:\s*.+$/m, `name: ${newName}`);
|
|
9775
|
+
}
|
|
9736
9776
|
function mapPluginToRulesync(pluginPath, pluginName, outputDir) {
|
|
9737
9777
|
assertSafePathSegment(pluginName, "plugin name");
|
|
9778
|
+
if (existsSync3(outputDir)) {
|
|
9779
|
+
rmSync2(outputDir, { recursive: true, force: true });
|
|
9780
|
+
}
|
|
9738
9781
|
mkdirSync(outputDir, { recursive: true });
|
|
9739
9782
|
const result = { skills: 0, commands: 0, subagents: 0, hooks: false, mcp: false };
|
|
9740
9783
|
const skillsDir = join3(pluginPath, "skills");
|
|
@@ -9756,9 +9799,11 @@ function mapPluginToRulesync(pluginPath, pluginName, outputDir) {
|
|
|
9756
9799
|
}
|
|
9757
9800
|
if (!skillName || !sourcePath)
|
|
9758
9801
|
continue;
|
|
9759
|
-
const
|
|
9802
|
+
const expectedName = `${pluginName}-${skillName}`;
|
|
9803
|
+
const dir = join3(skillsOut, expectedName);
|
|
9760
9804
|
mkdirSync(dir, { recursive: true });
|
|
9761
|
-
const
|
|
9805
|
+
const rawContent = readFileSync2(sourcePath, "utf-8");
|
|
9806
|
+
const content = rewriteSkillReferences(setSkillName(rawContent, expectedName), pluginName);
|
|
9762
9807
|
writeFileSync(join3(dir, "SKILL.md"), content);
|
|
9763
9808
|
if (sourceDir) {
|
|
9764
9809
|
for (const subdir of ["scripts", "references", "templates", "assets"]) {
|
|
@@ -9807,7 +9852,10 @@ function mapPluginToRulesync(pluginPath, pluginName, outputDir) {
|
|
|
9807
9852
|
const hooksSubdirPath = join3(pluginPath, "hooks", "hooks.json");
|
|
9808
9853
|
const hooksPath = existsSync3(hooksRootPath) ? hooksRootPath : hooksSubdirPath;
|
|
9809
9854
|
if (existsSync3(hooksPath)) {
|
|
9810
|
-
|
|
9855
|
+
const claudeHooks = readJsonObject(hooksPath);
|
|
9856
|
+
const canonical = convertClaudeHooksToCanonical(claudeHooks);
|
|
9857
|
+
writeFileSync(join3(outputDir, "hooks.json"), `${JSON.stringify(canonical, null, 4)}
|
|
9858
|
+
`);
|
|
9811
9859
|
result.hooks = true;
|
|
9812
9860
|
}
|
|
9813
9861
|
const mcpRootPath = join3(pluginPath, "mcp.json");
|
|
@@ -9857,11 +9905,28 @@ function copyAndRewriteDirectory(source, destination, pluginName) {
|
|
|
9857
9905
|
}
|
|
9858
9906
|
}
|
|
9859
9907
|
}
|
|
9908
|
+
var CLAUDE_TO_CANONICAL_EVENT;
|
|
9860
9909
|
var init_mapper = __esm(() => {
|
|
9861
9910
|
init_identity();
|
|
9862
9911
|
init_adapt_command();
|
|
9863
9912
|
init_adapt_subagent();
|
|
9864
9913
|
init_rewrite_references();
|
|
9914
|
+
CLAUDE_TO_CANONICAL_EVENT = {
|
|
9915
|
+
SessionStart: "sessionStart",
|
|
9916
|
+
SessionEnd: "sessionEnd",
|
|
9917
|
+
PreToolUse: "preToolUse",
|
|
9918
|
+
PostToolUse: "postToolUse",
|
|
9919
|
+
PreModelInvocation: "preModelInvocation",
|
|
9920
|
+
PostModelInvocation: "postModelInvocation",
|
|
9921
|
+
BeforeSubmitPrompt: "beforeSubmitPrompt",
|
|
9922
|
+
Stop: "stop",
|
|
9923
|
+
SubagentStop: "subagentStop",
|
|
9924
|
+
PreCompact: "preCompact",
|
|
9925
|
+
Notification: "notification",
|
|
9926
|
+
WorktreeCreate: "worktreeCreate",
|
|
9927
|
+
WorktreeRemove: "worktreeRemove",
|
|
9928
|
+
MessageDisplay: "messageDisplay"
|
|
9929
|
+
};
|
|
9865
9930
|
});
|
|
9866
9931
|
|
|
9867
9932
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
@@ -32451,7 +32516,7 @@ var init_config = __esm(() => {
|
|
|
32451
32516
|
});
|
|
32452
32517
|
|
|
32453
32518
|
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.3.21/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
32454
|
-
import { appendFileSync, cpSync as cpSync2, createWriteStream, existsSync as existsSync9, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync6, renameSync, rmSync as
|
|
32519
|
+
import { appendFileSync, cpSync as cpSync2, createWriteStream, existsSync as existsSync9, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync6, renameSync, rmSync as rmSync3, statSync as statSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
32455
32520
|
import { dirname as dirname5, resolve as resolvePath } from "path";
|
|
32456
32521
|
function createNodeFileSystem(root) {
|
|
32457
32522
|
const projectRoot = root ?? findProjectRoot(process.cwd());
|
|
@@ -32473,7 +32538,7 @@ function createNodeFileSystem(root) {
|
|
|
32473
32538
|
},
|
|
32474
32539
|
readDir: (path) => readdirSync3(path),
|
|
32475
32540
|
deleteFile: (path) => {
|
|
32476
|
-
|
|
32541
|
+
rmSync3(path, { recursive: true, force: true });
|
|
32477
32542
|
},
|
|
32478
32543
|
rename: (src, dest) => {
|
|
32479
32544
|
renameSync(src, dest);
|
|
@@ -40577,14 +40642,14 @@ var init_targets = __esm(() => {
|
|
|
40577
40642
|
];
|
|
40578
40643
|
TARGET_TO_RULESYNC = {
|
|
40579
40644
|
codex: "codexcli",
|
|
40580
|
-
pi: "
|
|
40645
|
+
pi: "codexcli",
|
|
40581
40646
|
opencode: "opencode",
|
|
40582
|
-
"antigravity-cli": "
|
|
40583
|
-
"antigravity-ide": "
|
|
40647
|
+
"antigravity-cli": "codexcli",
|
|
40648
|
+
"antigravity-ide": "codexcli"
|
|
40584
40649
|
};
|
|
40585
40650
|
TARGET_SKILLS_RELDIR = {
|
|
40586
40651
|
codex: ".agents/skills",
|
|
40587
|
-
pi: ".
|
|
40652
|
+
pi: ".agents/skills",
|
|
40588
40653
|
opencode: ".opencode/skills",
|
|
40589
40654
|
"antigravity-cli": ".agents/skills",
|
|
40590
40655
|
"antigravity-ide": ".agents/skills"
|
|
@@ -95277,7 +95342,7 @@ function formatEvaluationReport(report, json3) {
|
|
|
95277
95342
|
// src/operations/evolve.ts
|
|
95278
95343
|
init_src();
|
|
95279
95344
|
init_dist();
|
|
95280
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readFileSync as readFileSync11, rmSync as
|
|
95345
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync7, readFileSync as readFileSync11, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "fs";
|
|
95281
95346
|
import { join as join220 } from "path";
|
|
95282
95347
|
import { createInterface } from "readline";
|
|
95283
95348
|
|
|
@@ -95939,7 +96004,7 @@ function formatAnalyze(name, analysis) {
|
|
|
95939
96004
|
async function persistVersionSnapshot(backupPath, resolvedPath, proposalId) {
|
|
95940
96005
|
const versionPath = `${resolvedPath}.version-${proposalId}`;
|
|
95941
96006
|
await Bun.write(versionPath, Bun.file(backupPath));
|
|
95942
|
-
|
|
96007
|
+
rmSync4(backupPath, { force: true });
|
|
95943
96008
|
return versionPath;
|
|
95944
96009
|
}
|
|
95945
96010
|
async function evolve(type, name, opts) {
|
|
@@ -96773,7 +96838,7 @@ import {
|
|
|
96773
96838
|
mkdirSync as mkdirSync9,
|
|
96774
96839
|
readdirSync as readdirSync4,
|
|
96775
96840
|
readFileSync as readFileSync13,
|
|
96776
|
-
rmSync as
|
|
96841
|
+
rmSync as rmSync5,
|
|
96777
96842
|
statSync as statSync7,
|
|
96778
96843
|
writeFileSync as writeFileSync8
|
|
96779
96844
|
} from "fs";
|
|
@@ -96997,7 +97062,7 @@ async function executeInstall(plugin, targets2, options2, dependencies = {}) {
|
|
|
96997
97062
|
const marketplaceRoot = resolution.marketplaceRoot ?? process.cwd();
|
|
96998
97063
|
const cacheDir = join223(homedir5(), ".claude", "plugins", "cache", marketplaceName);
|
|
96999
97064
|
if (existsSync14(cacheDir))
|
|
97000
|
-
|
|
97065
|
+
rmSync5(cacheDir, { recursive: true, force: true });
|
|
97001
97066
|
await runClaudeInstallImpl(marketplaceRoot, marketplaceName, plugin);
|
|
97002
97067
|
}
|
|
97003
97068
|
}
|
|
@@ -97014,13 +97079,7 @@ async function executeInstall(plugin, targets2, options2, dependencies = {}) {
|
|
|
97014
97079
|
echo(` ${hookResult.message}`);
|
|
97015
97080
|
}
|
|
97016
97081
|
if (target === "omp") {
|
|
97017
|
-
const
|
|
97018
|
-
const dest = join223(outputRoot, ".omp", "agent", "skills");
|
|
97019
|
-
if (options2.verbose)
|
|
97020
|
-
echo(`Copying to omp (via pi rulesync): ${dest}...`);
|
|
97021
|
-
if (!options2.dryRun)
|
|
97022
|
-
copyDirectory(join223(rulesyncSourceRoot(targetInputRoots.get(srcTarget), outputDir), "skills"), dest);
|
|
97023
|
-
const hookResult = emitPiStyleHooks(rulesyncSourceRoot(targetInputRoots.get(srcTarget), outputDir), outputRoot, ".omp", "omp", { dryRun: options2.dryRun, global: options2.global });
|
|
97082
|
+
const hookResult = emitPiStyleHooks(rulesyncSourceRoot(targetInputRoots.get("pi"), outputDir), outputRoot, ".omp", "omp", { dryRun: options2.dryRun, global: options2.global });
|
|
97024
97083
|
hookEmitResults.push(hookResult);
|
|
97025
97084
|
if (options2.verbose)
|
|
97026
97085
|
echo(` ${hookResult.message}`);
|
|
@@ -97108,7 +97167,7 @@ function resolvePluginRoot(plugin, marketplacePath) {
|
|
|
97108
97167
|
function prepareTargetRulesyncInput(sourceRoot, target, pluginName) {
|
|
97109
97168
|
const targetRoot = join223(sourceRoot, ".targets", target);
|
|
97110
97169
|
const targetRulesyncRoot = join223(targetRoot, ".rulesync");
|
|
97111
|
-
|
|
97170
|
+
rmSync5(targetRoot, { recursive: true, force: true });
|
|
97112
97171
|
copyDirectory(sourceRoot, targetRulesyncRoot, { skipDirectoryNames: new Set([".targets"]) });
|
|
97113
97172
|
transformRulesyncMarkdown(targetRulesyncRoot, target, pluginName);
|
|
97114
97173
|
return targetRoot;
|