@arthai/agents 1.0.3 → 1.0.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/VERSION +1 -1
- package/bin/cli.js +77 -21
- package/dist/plugins/canvas/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/compass/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/counsel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/cruise/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/forge/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/prime/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/prism/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/scalpel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/sentinel/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/shield/.claude-plugin/plugin.json +1 -1
- package/dist/plugins/spark/.claude-plugin/plugin.json +1 -1
- package/package.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.0.
|
|
1
|
+
1.0.4
|
package/bin/cli.js
CHANGED
|
@@ -94,7 +94,13 @@ function handleInstall(rawArgs) {
|
|
|
94
94
|
process.exit(1);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const
|
|
97
|
+
const claudeDir = path.join(targetDir, '.claude');
|
|
98
|
+
const skillsDir = path.join(claudeDir, 'skills');
|
|
99
|
+
const agentsDir = path.join(claudeDir, 'agents');
|
|
100
|
+
|
|
101
|
+
let totalCommands = 0;
|
|
102
|
+
let totalAgents = 0;
|
|
103
|
+
let totalHooks = 0;
|
|
98
104
|
|
|
99
105
|
for (const name of resolved) {
|
|
100
106
|
// Defense-in-depth: verify the resolved path stays inside PLUGINS_DIR
|
|
@@ -107,11 +113,13 @@ function handleInstall(rawArgs) {
|
|
|
107
113
|
console.error(`Plugin '${name}' not found in dist/plugins/. Run compiler.sh first.`);
|
|
108
114
|
process.exit(1);
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
const counts = installBundle(pluginDir, claudeDir, skillsDir, agentsDir, name);
|
|
117
|
+
totalCommands += counts.commands;
|
|
118
|
+
totalAgents += counts.agents;
|
|
119
|
+
totalHooks += counts.hooks;
|
|
112
120
|
}
|
|
113
121
|
|
|
114
|
-
console.log(`\nDone. ${resolved.length}
|
|
122
|
+
console.log(`\nDone. ${resolved.length} bundle(s) installed: ${totalCommands} skills, ${totalAgents} agents, ${totalHooks} hooks`);
|
|
115
123
|
}
|
|
116
124
|
|
|
117
125
|
// ── list ──────────────────────────────────────────────────────────────────────
|
|
@@ -257,28 +265,76 @@ function resolveDependencies(names) {
|
|
|
257
265
|
return resolved;
|
|
258
266
|
}
|
|
259
267
|
|
|
260
|
-
function
|
|
261
|
-
const
|
|
268
|
+
function installBundle(pluginDir, claudeDir, skillsDir, agentsDir, name) {
|
|
269
|
+
const counts = { commands: 0, agents: 0, hooks: 0 };
|
|
270
|
+
|
|
271
|
+
// 1. Copy commands/ → .claude/skills/<name>/SKILL.md (each .md becomes a skill dir)
|
|
272
|
+
const commandsDir = path.join(pluginDir, 'commands');
|
|
273
|
+
if (fs.existsSync(commandsDir)) {
|
|
274
|
+
for (const file of fs.readdirSync(commandsDir)) {
|
|
275
|
+
if (!file.endsWith('.md')) continue;
|
|
276
|
+
const skillName = file.replace('.md', '');
|
|
277
|
+
const destDir = path.join(skillsDir, skillName);
|
|
278
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
279
|
+
fs.copyFileSync(path.join(commandsDir, file), path.join(destDir, 'SKILL.md'));
|
|
280
|
+
counts.commands++;
|
|
281
|
+
}
|
|
282
|
+
console.log(` ${name}: ${counts.commands} skills → ${skillsDir}`);
|
|
283
|
+
}
|
|
262
284
|
|
|
263
|
-
//
|
|
264
|
-
|
|
265
|
-
|
|
285
|
+
// 2. Copy agents/ → .claude/agents/
|
|
286
|
+
const srcAgents = path.join(pluginDir, 'agents');
|
|
287
|
+
if (fs.existsSync(srcAgents)) {
|
|
288
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
289
|
+
for (const file of fs.readdirSync(srcAgents)) {
|
|
290
|
+
if (!file.endsWith('.md')) continue;
|
|
291
|
+
fs.copyFileSync(path.join(srcAgents, file), path.join(agentsDir, file));
|
|
292
|
+
counts.agents++;
|
|
293
|
+
}
|
|
294
|
+
console.log(` ${name}: ${counts.agents} agents → ${agentsDir}`);
|
|
266
295
|
}
|
|
267
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
268
296
|
|
|
269
|
-
//
|
|
270
|
-
|
|
297
|
+
// 3. Merge hooks into .claude/settings.json
|
|
298
|
+
const hooksJson = path.join(pluginDir, 'hooks', 'hooks.json');
|
|
299
|
+
if (fs.existsSync(hooksJson)) {
|
|
300
|
+
const pluginHooks = JSON.parse(fs.readFileSync(hooksJson, 'utf8'));
|
|
301
|
+
const settingsPath = path.join(claudeDir, 'settings.json');
|
|
302
|
+
let settings = {};
|
|
303
|
+
if (fs.existsSync(settingsPath)) {
|
|
304
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) { settings = {}; }
|
|
305
|
+
}
|
|
306
|
+
if (!settings.hooks) settings.hooks = {};
|
|
307
|
+
|
|
308
|
+
// Copy hook scripts to .claude/hooks/
|
|
309
|
+
const hooksDir = path.join(claudeDir, 'hooks');
|
|
310
|
+
fs.mkdirSync(hooksDir, { recursive: true });
|
|
311
|
+
const srcHooksDir = path.join(pluginDir, 'hooks');
|
|
312
|
+
for (const file of fs.readdirSync(srcHooksDir)) {
|
|
313
|
+
if (!file.endsWith('.sh')) continue;
|
|
314
|
+
const dest = path.join(hooksDir, file);
|
|
315
|
+
fs.copyFileSync(path.join(srcHooksDir, file), dest);
|
|
316
|
+
fs.chmodSync(dest, 0o755);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Merge hook entries (rewrite CLAUDE_PLUGIN_ROOT to project hooks path)
|
|
320
|
+
const hookData = pluginHooks.hooks || pluginHooks;
|
|
321
|
+
for (const [event, entries] of Object.entries(hookData)) {
|
|
322
|
+
if (!settings.hooks[event]) settings.hooks[event] = [];
|
|
323
|
+
for (const entry of entries) {
|
|
324
|
+
// Rewrite command paths from ${CLAUDE_PLUGIN_ROOT} to $CLAUDE_PROJECT_DIR/.claude
|
|
325
|
+
const rewritten = JSON.parse(
|
|
326
|
+
JSON.stringify(entry).replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, '$CLAUDE_PROJECT_DIR/.claude')
|
|
327
|
+
);
|
|
328
|
+
settings.hooks[event].push(rewritten);
|
|
329
|
+
counts.hooks++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
271
332
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const settingsPath = path.join(projectDir, 'settings.local.json');
|
|
275
|
-
let settings = {};
|
|
276
|
-
if (fs.existsSync(settingsPath)) {
|
|
277
|
-
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) { settings = {}; }
|
|
333
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
334
|
+
console.log(` ${name}: ${counts.hooks} hook entries merged into settings.json`);
|
|
278
335
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
336
|
+
|
|
337
|
+
return counts;
|
|
282
338
|
}
|
|
283
339
|
|
|
284
340
|
function copyDirRecursive(src, dest) {
|