@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 CHANGED
@@ -1 +1 @@
1
- 1.0.3
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 pluginsTargetDir = path.join(targetDir, '.claude', 'plugins');
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
- copyPlugin(pluginDir, pluginsTargetDir, name);
111
- console.log(` Installed: ${name} → ${path.join(pluginsTargetDir, name)}`);
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} plugin(s) installed to ${pluginsTargetDir}`);
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 copyPlugin(sourceDir, targetPluginsDir, name) {
261
- const dest = path.join(targetPluginsDir, name);
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
- // Remove existing
264
- if (fs.existsSync(dest)) {
265
- fs.rmSync(dest, { recursive: true });
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
- // Recursive copy
270
- copyDirRecursive(sourceDir, dest);
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
- // Register plugin in .claude/settings.local.json so Claude Code discovers it
273
- const projectDir = path.resolve(targetPluginsDir, '..'); // .claude/
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
- if (!settings.enabledPlugins) settings.enabledPlugins = {};
280
- settings.enabledPlugins[`${name}@local`] = true;
281
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
336
+
337
+ return counts;
282
338
  }
283
339
 
284
340
  function copyDirRecursive(src, dest) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "canvas",
3
3
  "description": "Design-driven development — adversarial design critique + frontend",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "compass",
3
3
  "description": "Product strategy — PM, GTM, user research, content strategy",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "counsel",
3
3
  "description": "AI consulting toolkit — client discovery, proposals, deliverables",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cruise",
3
3
  "description": "Autopilot mode — autonomous task execution (requires forge+scalpel+sentinel)",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "forge",
3
3
  "description": "Full development workflow — plan, build, test, ship",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prime",
3
3
  "description": "Everything — all agents, skills, and hooks in one plugin",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prism",
3
3
  "description": "Deep QA — multi-agent testing, baseline tracking, incident analysis",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "scalpel",
3
3
  "description": "Surgical bug fixing — targeted fixes, CI repair, issue triage",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sentinel",
3
3
  "description": "Operations and reliability — SRE, incidents, deploy monitoring",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shield",
3
3
  "description": "Safety guardrails — bash guards, edit protection, session bootstrap",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "spark",
3
3
  "description": "Project setup and onboarding — calibrate, scan, bootstrap",
4
- "version": "1.0.3",
4
+ "version": "1.0.4",
5
5
  "author": {
6
6
  "name": "Arth AI"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arthai/agents",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "AI-powered development toolkit for Claude Code — agents, skills, and hooks",
5
5
  "bin": {
6
6
  "arthai": "bin/cli.js"