opencode-swarm-plugin 0.45.4 → 0.45.6
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/bin/swarm.ts +22 -8
- package/dist/bin/swarm.js +43 -48
- package/dist/examples/plugin-wrapper-template.ts +2993 -0
- package/dist/index.d.ts +8 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -37
- package/dist/logger.d.ts +12 -8
- package/dist/logger.d.ts.map +1 -1
- package/dist/plugin.js +28 -37
- package/dist/skills.d.ts +10 -10
- package/dist/skills.d.ts.map +1 -1
- package/dist/swarm-prompts.js +8 -8
- package/package.json +1 -1
- /package/examples/{skills → skill}/hive-workflow/SKILL.md +0 -0
- /package/examples/{skills → skill}/skill-creator/SKILL.md +0 -0
- /package/examples/{skills → skill}/swarm-coordination/SKILL.md +0 -0
package/bin/swarm.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
mkdirSync,
|
|
21
21
|
readFileSync,
|
|
22
22
|
readdirSync,
|
|
23
|
+
renameSync,
|
|
23
24
|
rmSync,
|
|
24
25
|
statSync,
|
|
25
26
|
writeFileSync,
|
|
@@ -1512,7 +1513,8 @@ async function doctor() {
|
|
|
1512
1513
|
}
|
|
1513
1514
|
|
|
1514
1515
|
// Project skills (check current directory)
|
|
1515
|
-
|
|
1516
|
+
// OpenCode uses singular "skill", Claude uses plural "skills"
|
|
1517
|
+
const projectSkillsDirs = [".opencode/skill", ".claude/skills", "skill"];
|
|
1516
1518
|
for (const dir of projectSkillsDirs) {
|
|
1517
1519
|
if (existsSync(dir)) {
|
|
1518
1520
|
try {
|
|
@@ -2107,9 +2109,21 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
2107
2109
|
// Track file operation statistics
|
|
2108
2110
|
const stats: FileStats = { created: 0, updated: 0, unchanged: 0 };
|
|
2109
2111
|
|
|
2112
|
+
// Migrate legacy "skills" → "skill" for OpenCode compatibility
|
|
2113
|
+
const legacySkillsDir = join(configDir, "skills");
|
|
2114
|
+
const skillsDir = join(configDir, "skill");
|
|
2115
|
+
if (existsSync(legacySkillsDir) && !existsSync(skillsDir)) {
|
|
2116
|
+
p.log.step("Migrating skills directory...");
|
|
2117
|
+
try {
|
|
2118
|
+
renameSync(legacySkillsDir, skillsDir);
|
|
2119
|
+
p.log.message(dim(` Renamed: ${legacySkillsDir} → ${skillsDir}`));
|
|
2120
|
+
} catch (err) {
|
|
2121
|
+
p.log.warn(`Could not migrate skills directory: ${err}`);
|
|
2122
|
+
}
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2110
2125
|
// Create directories if needed
|
|
2111
2126
|
p.log.step("Creating configuration directories...");
|
|
2112
|
-
const skillsDir = join(configDir, "skills");
|
|
2113
2127
|
for (const dir of [pluginDir, commandDir, agentDir, swarmAgentDir, skillsDir]) {
|
|
2114
2128
|
mkdirWithStatus(dir);
|
|
2115
2129
|
}
|
|
@@ -2145,7 +2159,7 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
2145
2159
|
}
|
|
2146
2160
|
}
|
|
2147
2161
|
|
|
2148
|
-
// If the user keeps their skills in ~/.config/opencode/
|
|
2162
|
+
// If the user keeps their skills in ~/.config/opencode/skill, offer to sync the bundled set
|
|
2149
2163
|
if (bundledSkills.length > 0) {
|
|
2150
2164
|
const globalSkills = listDirectoryNames(skillsDir);
|
|
2151
2165
|
const managedBundled = globalSkills.filter((name) =>
|
|
@@ -2361,12 +2375,12 @@ async function init() {
|
|
|
2361
2375
|
|
|
2362
2376
|
// Offer to create project skills directory
|
|
2363
2377
|
const createSkillsDir = await p.confirm({
|
|
2364
|
-
message: "Create project skills directory (.opencode/
|
|
2378
|
+
message: "Create project skills directory (.opencode/skill/)?",
|
|
2365
2379
|
initialValue: false,
|
|
2366
2380
|
});
|
|
2367
2381
|
|
|
2368
2382
|
if (!p.isCancel(createSkillsDir) && createSkillsDir) {
|
|
2369
|
-
const skillsPath = ".opencode/
|
|
2383
|
+
const skillsPath = ".opencode/skill";
|
|
2370
2384
|
if (!existsSync(skillsPath)) {
|
|
2371
2385
|
mkdirSync(skillsPath, { recursive: true });
|
|
2372
2386
|
p.log.success("Created " + skillsPath + "/");
|
|
@@ -2470,9 +2484,9 @@ function config() {
|
|
|
2470
2484
|
|
|
2471
2485
|
// Project skills locations
|
|
2472
2486
|
console.log(` 📁 Project skills locations ${dim("(checked in order)")}`);
|
|
2473
|
-
console.log(` ${dim(".opencode/
|
|
2474
|
-
console.log(` ${dim(".claude/skills/")}`);
|
|
2475
|
-
console.log(` ${dim("
|
|
2487
|
+
console.log(` ${dim(".opencode/skill/")}`);
|
|
2488
|
+
console.log(` ${dim(".claude/skills/")}`); // Claude uses plural
|
|
2489
|
+
console.log(` ${dim("skill/")}`);
|
|
2476
2490
|
console.log();
|
|
2477
2491
|
|
|
2478
2492
|
// Bundled skills info
|
package/dist/bin/swarm.js
CHANGED
|
@@ -27101,7 +27101,7 @@ function validateSkillMetadata2(raw, filePath) {
|
|
|
27101
27101
|
}
|
|
27102
27102
|
function getGlobalSkillsDir2() {
|
|
27103
27103
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
27104
|
-
return join17(home, ".config", "opencode", "
|
|
27104
|
+
return join17(home, ".config", "opencode", "skill");
|
|
27105
27105
|
}
|
|
27106
27106
|
function getClaudeGlobalSkillsDir2() {
|
|
27107
27107
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
@@ -27434,15 +27434,15 @@ async function findRelevantSkills2(taskDescription) {
|
|
|
27434
27434
|
}
|
|
27435
27435
|
return relevant;
|
|
27436
27436
|
}
|
|
27437
|
-
var import_gray_matter2, skillsProjectDirectory2, skillsCache2 = null, PROJECT_SKILL_DIRECTORIES2, skills_list2, skills_use2, skills_execute2, skills_read2, DEFAULT_SKILLS_DIR2 = ".opencode/
|
|
27437
|
+
var import_gray_matter2, skillsProjectDirectory2, skillsCache2 = null, PROJECT_SKILL_DIRECTORIES2, skills_list2, skills_use2, skills_execute2, skills_read2, DEFAULT_SKILLS_DIR2 = ".opencode/skill", skills_create2, skills_update2, skills_delete2, skills_add_script2, skills_init2, skillsTools2;
|
|
27438
27438
|
var init_skills2 = __esm(() => {
|
|
27439
27439
|
init_dist2();
|
|
27440
27440
|
import_gray_matter2 = __toESM(require_gray_matter2(), 1);
|
|
27441
27441
|
skillsProjectDirectory2 = process.cwd();
|
|
27442
27442
|
PROJECT_SKILL_DIRECTORIES2 = [
|
|
27443
|
-
".opencode/
|
|
27443
|
+
".opencode/skill",
|
|
27444
27444
|
".claude/skills",
|
|
27445
|
-
"
|
|
27445
|
+
"skill"
|
|
27446
27446
|
];
|
|
27447
27447
|
skills_list2 = tool3({
|
|
27448
27448
|
description: `[DEPRECATED] List all available skills in the project.
|
|
@@ -27498,7 +27498,7 @@ If the skill has scripts, you can run them with skills_execute.`,
|
|
|
27498
27498
|
return `Skill '${args2.name}' not found. Available skills: ${names || "none"}`;
|
|
27499
27499
|
}
|
|
27500
27500
|
let skillSource = "project";
|
|
27501
|
-
if (skill.path.includes(".config/opencode/
|
|
27501
|
+
if (skill.path.includes(".config/opencode/skill") || skill.path.includes(".claude/skills")) {
|
|
27502
27502
|
skillSource = "global";
|
|
27503
27503
|
} else if (skill.path.includes("global-skills")) {
|
|
27504
27504
|
skillSource = "bundled";
|
|
@@ -27649,12 +27649,12 @@ Good skills have:
|
|
|
27649
27649
|
tags: tool3.schema.array(tool3.schema.string()).optional().describe("Tags for categorization (e.g., ['testing', 'frontend'])"),
|
|
27650
27650
|
tools: tool3.schema.array(tool3.schema.string()).optional().describe("Tools this skill commonly uses"),
|
|
27651
27651
|
directory: tool3.schema.enum([
|
|
27652
|
-
".opencode/
|
|
27652
|
+
".opencode/skill",
|
|
27653
27653
|
".claude/skills",
|
|
27654
|
-
"
|
|
27654
|
+
"skill",
|
|
27655
27655
|
"global",
|
|
27656
27656
|
"global-claude"
|
|
27657
|
-
]).optional().describe("Where to create the skill (default: .opencode/
|
|
27657
|
+
]).optional().describe("Where to create the skill (default: .opencode/skill). Use 'global' for ~/.config/opencode/skill/, 'global-claude' for ~/.claude/skills/")
|
|
27658
27658
|
},
|
|
27659
27659
|
async execute(args2) {
|
|
27660
27660
|
const existing = await getSkill2(args2.name);
|
|
@@ -39996,6 +39996,7 @@ import {
|
|
|
39996
39996
|
mkdirSync as mkdirSync11,
|
|
39997
39997
|
readFileSync as readFileSync13,
|
|
39998
39998
|
readdirSync,
|
|
39999
|
+
renameSync,
|
|
39999
40000
|
rmSync,
|
|
40000
40001
|
statSync,
|
|
40001
40002
|
writeFileSync as writeFileSync7
|
|
@@ -72365,7 +72366,7 @@ function validateSkillMetadata(raw, filePath) {
|
|
|
72365
72366
|
}
|
|
72366
72367
|
function getGlobalSkillsDir() {
|
|
72367
72368
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
72368
|
-
return join32(home, ".config", "opencode", "
|
|
72369
|
+
return join32(home, ".config", "opencode", "skill");
|
|
72369
72370
|
}
|
|
72370
72371
|
function getClaudeGlobalSkillsDir() {
|
|
72371
72372
|
const home = process.env.HOME || process.env.USERPROFILE || "~";
|
|
@@ -72706,7 +72707,7 @@ var skills_list;
|
|
|
72706
72707
|
var skills_use;
|
|
72707
72708
|
var skills_execute;
|
|
72708
72709
|
var skills_read;
|
|
72709
|
-
var DEFAULT_SKILLS_DIR = ".opencode/
|
|
72710
|
+
var DEFAULT_SKILLS_DIR = ".opencode/skill";
|
|
72710
72711
|
var skills_create;
|
|
72711
72712
|
var skills_update;
|
|
72712
72713
|
var skills_delete;
|
|
@@ -72718,9 +72719,9 @@ var init_skills = __esm3(() => {
|
|
|
72718
72719
|
import_gray_matter = __toESM2(require_gray_matter(), 1);
|
|
72719
72720
|
skillsProjectDirectory = process.cwd();
|
|
72720
72721
|
PROJECT_SKILL_DIRECTORIES = [
|
|
72721
|
-
".opencode/
|
|
72722
|
+
".opencode/skill",
|
|
72722
72723
|
".claude/skills",
|
|
72723
|
-
"
|
|
72724
|
+
"skill"
|
|
72724
72725
|
];
|
|
72725
72726
|
skills_list = tool2({
|
|
72726
72727
|
description: `[DEPRECATED] List all available skills in the project.
|
|
@@ -72776,7 +72777,7 @@ If the skill has scripts, you can run them with skills_execute.`,
|
|
|
72776
72777
|
return `Skill '${args.name}' not found. Available skills: ${names || "none"}`;
|
|
72777
72778
|
}
|
|
72778
72779
|
let skillSource = "project";
|
|
72779
|
-
if (skill.path.includes(".config/opencode/
|
|
72780
|
+
if (skill.path.includes(".config/opencode/skill") || skill.path.includes(".claude/skills")) {
|
|
72780
72781
|
skillSource = "global";
|
|
72781
72782
|
} else if (skill.path.includes("global-skills")) {
|
|
72782
72783
|
skillSource = "bundled";
|
|
@@ -72927,12 +72928,12 @@ Good skills have:
|
|
|
72927
72928
|
tags: tool2.schema.array(tool2.schema.string()).optional().describe("Tags for categorization (e.g., ['testing', 'frontend'])"),
|
|
72928
72929
|
tools: tool2.schema.array(tool2.schema.string()).optional().describe("Tools this skill commonly uses"),
|
|
72929
72930
|
directory: tool2.schema.enum([
|
|
72930
|
-
".opencode/
|
|
72931
|
+
".opencode/skill",
|
|
72931
72932
|
".claude/skills",
|
|
72932
|
-
"
|
|
72933
|
+
"skill",
|
|
72933
72934
|
"global",
|
|
72934
72935
|
"global-claude"
|
|
72935
|
-
]).optional().describe("Where to create the skill (default: .opencode/
|
|
72936
|
+
]).optional().describe("Where to create the skill (default: .opencode/skill). Use 'global' for ~/.config/opencode/skill/, 'global-claude' for ~/.claude/skills/")
|
|
72936
72937
|
},
|
|
72937
72938
|
async execute(args) {
|
|
72938
72939
|
const existing = await getSkill(args.name);
|
|
@@ -121615,40 +121616,24 @@ function ensureLogDir(logDir) {
|
|
|
121615
121616
|
mkdirSync10(logDir, { recursive: true });
|
|
121616
121617
|
}
|
|
121617
121618
|
}
|
|
121618
|
-
function createTransport(filename, logDir) {
|
|
121619
|
-
const isPretty = process.env.SWARM_LOG_PRETTY === "1";
|
|
121620
|
-
if (isPretty) {
|
|
121621
|
-
return {
|
|
121622
|
-
target: "pino-pretty",
|
|
121623
|
-
options: {
|
|
121624
|
-
colorize: true,
|
|
121625
|
-
translateTime: "HH:MM:ss",
|
|
121626
|
-
ignore: "pid,hostname"
|
|
121627
|
-
}
|
|
121628
|
-
};
|
|
121629
|
-
}
|
|
121630
|
-
return {
|
|
121631
|
-
target: "pino-roll",
|
|
121632
|
-
options: {
|
|
121633
|
-
file: join23(logDir, filename),
|
|
121634
|
-
frequency: "daily",
|
|
121635
|
-
extension: "log",
|
|
121636
|
-
limit: { count: 14 },
|
|
121637
|
-
mkdir: true
|
|
121638
|
-
}
|
|
121639
|
-
};
|
|
121640
|
-
}
|
|
121641
121619
|
var loggerCache = new Map;
|
|
121642
121620
|
function getLogger(logDir = DEFAULT_LOG_DIR) {
|
|
121643
121621
|
const cacheKey = `swarm:${logDir}`;
|
|
121644
121622
|
if (loggerCache.has(cacheKey)) {
|
|
121645
121623
|
return loggerCache.get(cacheKey);
|
|
121646
121624
|
}
|
|
121647
|
-
|
|
121648
|
-
const logger = import_pino.default({
|
|
121625
|
+
const baseConfig = {
|
|
121649
121626
|
level: process.env.LOG_LEVEL || "info",
|
|
121650
121627
|
timestamp: import_pino.default.stdTimeFunctions.isoTime
|
|
121651
|
-
}
|
|
121628
|
+
};
|
|
121629
|
+
let logger;
|
|
121630
|
+
if (process.env.SWARM_LOG_FILE === "1") {
|
|
121631
|
+
ensureLogDir(logDir);
|
|
121632
|
+
const logPath = join23(logDir, "swarm.log");
|
|
121633
|
+
logger = import_pino.default(baseConfig, import_pino.default.destination({ dest: logPath, sync: false }));
|
|
121634
|
+
} else {
|
|
121635
|
+
logger = import_pino.default(baseConfig);
|
|
121636
|
+
}
|
|
121652
121637
|
loggerCache.set(cacheKey, logger);
|
|
121653
121638
|
return logger;
|
|
121654
121639
|
}
|
|
@@ -122896,7 +122881,7 @@ async function doctor() {
|
|
|
122896
122881
|
M2.warn("Could not read bundled skills");
|
|
122897
122882
|
}
|
|
122898
122883
|
}
|
|
122899
|
-
const projectSkillsDirs = [".opencode/
|
|
122884
|
+
const projectSkillsDirs = [".opencode/skill", ".claude/skills", "skill"];
|
|
122900
122885
|
for (const dir of projectSkillsDirs) {
|
|
122901
122886
|
if (existsSync17(dir)) {
|
|
122902
122887
|
try {
|
|
@@ -123382,8 +123367,18 @@ async function setup(forceReinstall = false, nonInteractive = false) {
|
|
|
123382
123367
|
M2.message(dim(` Lite: ${liteModel}`));
|
|
123383
123368
|
M2.step("Setting up OpenCode integration...");
|
|
123384
123369
|
const stats = { created: 0, updated: 0, unchanged: 0 };
|
|
123370
|
+
const legacySkillsDir = join25(configDir, "skills");
|
|
123371
|
+
const skillsDir = join25(configDir, "skill");
|
|
123372
|
+
if (existsSync17(legacySkillsDir) && !existsSync17(skillsDir)) {
|
|
123373
|
+
M2.step("Migrating skills directory...");
|
|
123374
|
+
try {
|
|
123375
|
+
renameSync(legacySkillsDir, skillsDir);
|
|
123376
|
+
M2.message(dim(` Renamed: ${legacySkillsDir} \u2192 ${skillsDir}`));
|
|
123377
|
+
} catch (err) {
|
|
123378
|
+
M2.warn(`Could not migrate skills directory: ${err}`);
|
|
123379
|
+
}
|
|
123380
|
+
}
|
|
123385
123381
|
M2.step("Creating configuration directories...");
|
|
123386
|
-
const skillsDir = join25(configDir, "skills");
|
|
123387
123382
|
for (const dir of [pluginDir, commandDir, agentDir, swarmAgentDir, skillsDir]) {
|
|
123388
123383
|
mkdirWithStatus(dir);
|
|
123389
123384
|
}
|
|
@@ -123570,11 +123565,11 @@ async function init() {
|
|
|
123570
123565
|
}
|
|
123571
123566
|
}
|
|
123572
123567
|
const createSkillsDir = await ye({
|
|
123573
|
-
message: "Create project skills directory (.opencode/
|
|
123568
|
+
message: "Create project skills directory (.opencode/skill/)?",
|
|
123574
123569
|
initialValue: false
|
|
123575
123570
|
});
|
|
123576
123571
|
if (!pD(createSkillsDir) && createSkillsDir) {
|
|
123577
|
-
const skillsPath = ".opencode/
|
|
123572
|
+
const skillsPath = ".opencode/skill";
|
|
123578
123573
|
if (!existsSync17(skillsPath)) {
|
|
123579
123574
|
mkdirSync11(skillsPath, { recursive: true });
|
|
123580
123575
|
M2.success("Created " + skillsPath + "/");
|
|
@@ -123653,9 +123648,9 @@ function config4() {
|
|
|
123653
123648
|
}
|
|
123654
123649
|
console.log();
|
|
123655
123650
|
console.log(` \uD83D\uDCC1 Project skills locations ${dim("(checked in order)")}`);
|
|
123656
|
-
console.log(` ${dim(".opencode/
|
|
123651
|
+
console.log(` ${dim(".opencode/skill/")}`);
|
|
123657
123652
|
console.log(` ${dim(".claude/skills/")}`);
|
|
123658
|
-
console.log(` ${dim("
|
|
123653
|
+
console.log(` ${dim("skill/")}`);
|
|
123659
123654
|
console.log();
|
|
123660
123655
|
const bundledSkillsPath = join25(__dirname2, "..", "global-skills");
|
|
123661
123656
|
if (existsSync17(bundledSkillsPath)) {
|