ma-agents 1.1.1 → 1.2.0

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.
Files changed (2) hide show
  1. package/bin/cli.js +135 -65
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -5,27 +5,30 @@ const chalk = require('chalk');
5
5
  const path = require('path');
6
6
  const { installSkill, listSkills, listAgents } = require('../lib/installer');
7
7
 
8
- const VERSION = require('../package.json').version;
8
+ const PKG = require('../package.json');
9
+ const NAME = PKG.name;
10
+ const VERSION = PKG.version;
9
11
 
10
12
  function showHelp() {
11
13
  console.log(`
12
- ${chalk.bold.cyan('AI Agent Skills')} ${chalk.gray(`v${VERSION}`)}
14
+ ${chalk.bold.cyan(NAME)} ${chalk.gray(`v${VERSION}`)}
13
15
 
14
16
  ${chalk.bold('Usage:')}
15
- ${chalk.cyan('npx ai-agent-skills')} Interactive mode
16
- ${chalk.cyan('npx ai-agent-skills install')} <skill> <agents...> Install a skill
17
- ${chalk.cyan('npx ai-agent-skills list')} List available skills
18
- ${chalk.cyan('npx ai-agent-skills agents')} List supported agents
19
- ${chalk.cyan('npx ai-agent-skills help')} Show this help
17
+ ${chalk.cyan(`npx ${NAME}`)} Interactive wizard
18
+ ${chalk.cyan(`npx ${NAME} install`)} Interactive install wizard
19
+ ${chalk.cyan(`npx ${NAME} install`)} <skill> <agents...> Install directly
20
+ ${chalk.cyan(`npx ${NAME} list`)} List available skills
21
+ ${chalk.cyan(`npx ${NAME} agents`)} List supported agents
22
+ ${chalk.cyan(`npx ${NAME} help`)} Show this help
20
23
 
21
24
  ${chalk.bold('Install options:')}
22
25
  ${chalk.cyan('--path <dir>')} Custom installation directory
23
26
 
24
27
  ${chalk.bold('Examples:')}
25
- npx ai-agent-skills install code-review claude-code
26
- npx ai-agent-skills install test-generator claude-code cline cursor
27
- npx ai-agent-skills install skill-creator claude-code --path ./my-skills
28
- npx ai-agent-skills list
28
+ npx ${NAME} install
29
+ npx ${NAME} install code-review claude-code
30
+ npx ${NAME} install test-generator claude-code cline cursor
31
+ npx ${NAME} install skill-creator claude-code --path ./my-skills
29
32
  `);
30
33
  }
31
34
 
@@ -47,6 +50,116 @@ function showAgents() {
47
50
  console.log('');
48
51
  }
49
52
 
53
+ async function installWizard(preselectedSkill, preselectedAgents, customPath) {
54
+ const skills = listSkills();
55
+ const agents = listAgents();
56
+
57
+ // Step 1: Select skills (multi-select)
58
+ let selectedSkillIds;
59
+ if (preselectedSkill) {
60
+ selectedSkillIds = [preselectedSkill];
61
+ } else {
62
+ const { skills: chosen } = await prompts({
63
+ type: 'multiselect',
64
+ name: 'skills',
65
+ message: 'Which skills do you want to install?',
66
+ choices: skills.map(s => ({
67
+ title: chalk.white(s.name) + chalk.gray(` - ${s.description}`),
68
+ value: s.id,
69
+ selected: false
70
+ })),
71
+ instructions: chalk.gray(' Use space to select, enter to confirm'),
72
+ min: 1
73
+ });
74
+
75
+ if (!chosen || chosen.length === 0) {
76
+ console.log(chalk.yellow('No skills selected. Exiting.'));
77
+ process.exit(0);
78
+ }
79
+ selectedSkillIds = chosen;
80
+ }
81
+
82
+ // Step 2: Select agents (multi-select)
83
+ let selectedAgentIds;
84
+ if (preselectedAgents && preselectedAgents.length > 0) {
85
+ selectedAgentIds = preselectedAgents;
86
+ } else {
87
+ const { agents: chosen } = await prompts({
88
+ type: 'multiselect',
89
+ name: 'agents',
90
+ message: 'Which coding agents do you want to install to?',
91
+ choices: agents.map(a => ({
92
+ title: chalk.white(a.name) + chalk.gray(` - ${a.description}`),
93
+ value: a.id,
94
+ selected: false
95
+ })),
96
+ instructions: chalk.gray(' Use space to select, enter to confirm'),
97
+ min: 1
98
+ });
99
+
100
+ if (!chosen || chosen.length === 0) {
101
+ console.log(chalk.yellow('No agents selected. Exiting.'));
102
+ process.exit(0);
103
+ }
104
+ selectedAgentIds = chosen;
105
+ }
106
+
107
+ // Step 3: Custom path (optional)
108
+ let installPath = customPath || '';
109
+ if (!installPath) {
110
+ const { pathChoice } = await prompts({
111
+ type: 'select',
112
+ name: 'pathChoice',
113
+ message: 'Installation path:',
114
+ choices: [
115
+ { title: 'Default (agent-specific paths)', value: 'default' },
116
+ { title: 'Custom path...', value: 'custom' }
117
+ ]
118
+ });
119
+
120
+ if (pathChoice === 'custom') {
121
+ const { customDir } = await prompts({
122
+ type: 'text',
123
+ name: 'customDir',
124
+ message: 'Enter installation directory:',
125
+ initial: './skills'
126
+ });
127
+ installPath = customDir || '';
128
+ }
129
+ }
130
+
131
+ // Step 4: Confirm
132
+ console.log('');
133
+ console.log(chalk.bold(' Summary:'));
134
+ console.log(chalk.cyan(' Skills: ') + selectedSkillIds.join(', '));
135
+ console.log(chalk.cyan(' Agents: ') + selectedAgentIds.join(', '));
136
+ console.log(chalk.cyan(' Path: ') + (installPath || 'default'));
137
+ console.log('');
138
+
139
+ const { confirmed } = await prompts({
140
+ type: 'confirm',
141
+ name: 'confirmed',
142
+ message: 'Proceed with installation?',
143
+ initial: true
144
+ });
145
+
146
+ if (!confirmed) {
147
+ console.log(chalk.yellow('Installation cancelled.'));
148
+ process.exit(0);
149
+ }
150
+
151
+ // Step 5: Install each skill
152
+ for (const skillId of selectedSkillIds) {
153
+ try {
154
+ await installSkill(skillId, selectedAgentIds, installPath);
155
+ } catch (error) {
156
+ console.error(chalk.red(`\n Failed to install ${skillId}:`), error.message);
157
+ }
158
+ }
159
+
160
+ console.log(chalk.bold.green('\n Installation complete!\n'));
161
+ }
162
+
50
163
  async function handleInstall(args) {
51
164
  const pathIdx = args.indexOf('--path');
52
165
  let customPath = '';
@@ -60,20 +173,19 @@ async function handleInstall(args) {
60
173
  const skillId = positional[0];
61
174
  const agentIds = positional.slice(1);
62
175
 
176
+ // No args → launch wizard
63
177
  if (!skillId) {
64
- console.error(chalk.red('\nError: No skill specified.'));
65
- console.log(chalk.gray('Usage: npx ai-agent-skills install <skill> <agents...>'));
66
- console.log(chalk.gray('Run "npx ai-agent-skills list" to see available skills.\n'));
67
- process.exit(1);
178
+ await installWizard(null, null, customPath);
179
+ return;
68
180
  }
69
181
 
182
+ // Skill but no agents → wizard with skill preselected
70
183
  if (agentIds.length === 0) {
71
- console.error(chalk.red('\nError: No agents specified.'));
72
- console.log(chalk.gray('Usage: npx ai-agent-skills install <skill> <agents...>'));
73
- console.log(chalk.gray('Run "npx ai-agent-skills agents" to see supported agents.\n'));
74
- process.exit(1);
184
+ await installWizard(skillId, null, customPath);
185
+ return;
75
186
  }
76
187
 
188
+ // Full args → direct install
77
189
  try {
78
190
  await installSkill(skillId, agentIds, customPath);
79
191
  console.log(chalk.bold.green('\n Installation complete!\n'));
@@ -84,14 +196,14 @@ async function handleInstall(args) {
84
196
  }
85
197
 
86
198
  async function interactiveMode() {
87
- console.log(chalk.bold.cyan('\n AI Agent Skills Installer\n'));
199
+ console.log(chalk.bold.cyan(`\n ${NAME} v${VERSION}\n`));
88
200
 
89
201
  const { action } = await prompts({
90
202
  type: 'select',
91
203
  name: 'action',
92
204
  message: 'What would you like to do?',
93
205
  choices: [
94
- { title: 'Install a skill', value: 'install' },
206
+ { title: 'Install skills', value: 'install' },
95
207
  { title: 'List available skills', value: 'list-skills' },
96
208
  { title: 'List supported agents', value: 'list-agents' },
97
209
  { title: 'Exit', value: 'exit' }
@@ -114,49 +226,7 @@ async function interactiveMode() {
114
226
  }
115
227
 
116
228
  if (action === 'install') {
117
- const skills = listSkills();
118
-
119
- const { selectedSkill } = await prompts({
120
- type: 'select',
121
- name: 'selectedSkill',
122
- message: 'Select a skill to install:',
123
- choices: skills.map(s => ({ title: `${s.name} - ${s.description}`, value: s.id }))
124
- });
125
-
126
- if (!selectedSkill) {
127
- console.log(chalk.yellow('No skill selected. Exiting.'));
128
- process.exit(0);
129
- }
130
-
131
- const agents = listAgents();
132
-
133
- const { selectedAgents } = await prompts({
134
- type: 'multiselect',
135
- name: 'selectedAgents',
136
- message: 'Select agents to install this skill for:',
137
- choices: agents.map(a => ({ title: a.name, value: a.id, selected: false })),
138
- min: 1
139
- });
140
-
141
- if (!selectedAgents || selectedAgents.length === 0) {
142
- console.log(chalk.yellow('No agents selected. Exiting.'));
143
- process.exit(0);
144
- }
145
-
146
- const { installPath } = await prompts({
147
- type: 'text',
148
- name: 'installPath',
149
- message: 'Installation path (leave empty for default):',
150
- initial: ''
151
- });
152
-
153
- try {
154
- await installSkill(selectedSkill, selectedAgents, installPath);
155
- console.log(chalk.bold.green('\n Installation complete!\n'));
156
- } catch (error) {
157
- console.error(chalk.red('\n Installation failed:'), error.message);
158
- process.exit(1);
159
- }
229
+ await installWizard();
160
230
  }
161
231
  }
162
232
 
@@ -184,7 +254,7 @@ async function main() {
184
254
  case 'version':
185
255
  case '--version':
186
256
  case '-v':
187
- console.log(`ai-agent-skills v${VERSION}`);
257
+ console.log(`${NAME} v${VERSION}`);
188
258
  break;
189
259
  default:
190
260
  await interactiveMode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ma-agents",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "NPX tool to install skills for AI coding agents (Claude Code, Gemini, Copilot, Kilocode, Cline, Cursor)",
5
5
  "main": "index.js",
6
6
  "bin": {