mozaic-mcp-server 1.1.2 → 2.0.1
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/INSTALLATION.md +48 -14
- package/README.md +28 -14
- package/bin/install.js +560 -0
- package/dist/__tests__/skills-scripts.test.d.ts +2 -0
- package/dist/__tests__/skills-scripts.test.d.ts.map +1 -0
- package/dist/__tests__/skills-scripts.test.js +404 -0
- package/dist/__tests__/skills-scripts.test.js.map +1 -0
- package/package.json +13 -8
- package/skills/mozaic-css-utilities/scripts/get-utility.sh +3 -4
- package/skills/mozaic-css-utilities/scripts/list-utilities.sh +1 -1
- package/skills/mozaic-design-tokens/scripts/get-tokens.sh +9 -1
- package/skills/mozaic-design-tokens/scripts/search-docs.sh +2 -2
- package/skills/mozaic-icons/scripts/get-icon.sh +2 -2
- package/skills/mozaic-icons/scripts/search-icons.sh +7 -14
- package/skills/mozaic-react-builder/scripts/generate-component.sh +24 -13
- package/skills/mozaic-react-builder/scripts/get-component.sh +11 -30
- package/skills/mozaic-react-builder/scripts/get-install-info.sh +1 -1
- package/skills/mozaic-react-builder/scripts/list-components.sh +1 -1
- package/skills/mozaic-vue-builder/scripts/generate-component.sh +25 -14
- package/skills/mozaic-vue-builder/scripts/get-component.sh +14 -37
- package/skills/mozaic-vue-builder/scripts/get-install-info.sh +1 -1
- package/skills/mozaic-vue-builder/scripts/list-components.sh +1 -1
- package/data/mozaic.db-shm +0 -0
- package/data/mozaic.db-wal +0 -0
package/bin/install.js
ADDED
|
@@ -0,0 +1,560 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import prompts from 'prompts';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { existsSync, mkdirSync, cpSync, rmSync, readFileSync, writeFileSync } from 'fs';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import { join, dirname } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
|
+
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
|
|
14
|
+
// Paths
|
|
15
|
+
const PROJECT_DIR = join(__dirname, '..');
|
|
16
|
+
const SKILLS_DEST = join(homedir(), '.claude', 'skills');
|
|
17
|
+
const SKILLS_SOURCE = join(PROJECT_DIR, 'skills');
|
|
18
|
+
const DB_SOURCE = join(PROJECT_DIR, 'data', 'mozaic.db');
|
|
19
|
+
const DB_DEST = join(homedir(), '.claude', 'mozaic.db');
|
|
20
|
+
const MCP_CONFIG_DIR = join(homedir(), 'Library', 'Application Support', 'Claude');
|
|
21
|
+
const MCP_CONFIG_FILE = join(MCP_CONFIG_DIR, 'claude_desktop_config.json');
|
|
22
|
+
|
|
23
|
+
const SKILLS = [
|
|
24
|
+
'mozaic-vue-builder',
|
|
25
|
+
'mozaic-react-builder',
|
|
26
|
+
'mozaic-design-tokens',
|
|
27
|
+
'mozaic-css-utilities',
|
|
28
|
+
'mozaic-icons'
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const COLORS = {
|
|
32
|
+
reset: '\x1b[0m',
|
|
33
|
+
bright: '\x1b[1m',
|
|
34
|
+
dim: '\x1b[2m',
|
|
35
|
+
white: '\x1b[97m',
|
|
36
|
+
green: '\x1b[32m',
|
|
37
|
+
blue: '\x1b[34m',
|
|
38
|
+
yellow: '\x1b[33m',
|
|
39
|
+
red: '\x1b[31m',
|
|
40
|
+
cyan: '\x1b[36m',
|
|
41
|
+
magenta: '\x1b[35m'
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
function log(message, color = 'reset') {
|
|
45
|
+
console.log(`${COLORS[color]}${message}${COLORS.reset}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function printLogo() {
|
|
49
|
+
const logo = [
|
|
50
|
+
' ███╗ ███╗ ██████╗ ███████╗ █████╗ ██╗ ██████╗',
|
|
51
|
+
' ████╗ ████║██╔═══██╗╚══███╔╝██╔══██╗██║██╔════╝',
|
|
52
|
+
' ██╔████╔██║██║ ██║ ███╔╝ ███████║██║██║ ',
|
|
53
|
+
' ██║╚██╔╝██║██║ ██║ ███╔╝ ██╔══██║██║██║ ',
|
|
54
|
+
' ██║ ╚═╝ ██║╚██████╔╝███████╗██║ ██║██║╚██████╗',
|
|
55
|
+
' ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝'
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
console.log('');
|
|
59
|
+
logo.forEach(line => log(line, 'white'));
|
|
60
|
+
log(' Mozaic Design System Installer by ADEO', 'dim');
|
|
61
|
+
console.log('');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function checkStatus() {
|
|
65
|
+
const status = {
|
|
66
|
+
skills: {},
|
|
67
|
+
mcp: false,
|
|
68
|
+
database: existsSync(DB_DEST)
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
for (const skill of SKILLS) {
|
|
72
|
+
status.skills[skill] = existsSync(join(SKILLS_DEST, skill));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (existsSync(MCP_CONFIG_FILE)) {
|
|
76
|
+
try {
|
|
77
|
+
const config = JSON.parse(readFileSync(MCP_CONFIG_FILE, 'utf-8'));
|
|
78
|
+
status.mcp = config.mcpServers && config.mcpServers.mozaic;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
status.mcp = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return status;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function installDatabase() {
|
|
88
|
+
if (!existsSync(DB_SOURCE)) {
|
|
89
|
+
log(' ❌ Database not found', 'red');
|
|
90
|
+
log(' Run: pnpm build', 'yellow');
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const claudeDir = join(homedir(), '.claude');
|
|
95
|
+
if (!existsSync(claudeDir)) {
|
|
96
|
+
mkdirSync(claudeDir, { recursive: true });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
if (existsSync(DB_DEST)) {
|
|
101
|
+
log(' 🔄 Updating database...', 'yellow');
|
|
102
|
+
} else {
|
|
103
|
+
log(' 💾 Installing database...', 'green');
|
|
104
|
+
}
|
|
105
|
+
cpSync(DB_SOURCE, DB_DEST);
|
|
106
|
+
return true;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function uninstallDatabase() {
|
|
114
|
+
if (existsSync(DB_DEST)) {
|
|
115
|
+
try {
|
|
116
|
+
log(' 🗑️ Removing database...', 'yellow');
|
|
117
|
+
rmSync(DB_DEST, { force: true });
|
|
118
|
+
return true;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function installSkill(skill) {
|
|
128
|
+
const source = join(SKILLS_SOURCE, skill);
|
|
129
|
+
const dest = join(SKILLS_DEST, skill);
|
|
130
|
+
|
|
131
|
+
if (!existsSync(source)) {
|
|
132
|
+
log(` ⚠️ Skipping ${skill} (not found)`, 'yellow');
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (!existsSync(SKILLS_DEST)) {
|
|
137
|
+
mkdirSync(SKILLS_DEST, { recursive: true });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
if (existsSync(dest)) {
|
|
142
|
+
log(` 🔄 Updating: ${skill}`, 'yellow');
|
|
143
|
+
rmSync(dest, { recursive: true, force: true });
|
|
144
|
+
} else {
|
|
145
|
+
log(` ✨ Installing: ${skill}`, 'green');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
cpSync(source, dest, { recursive: true });
|
|
149
|
+
return true;
|
|
150
|
+
} catch (error) {
|
|
151
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function uninstallSkill(skill) {
|
|
157
|
+
const dest = join(SKILLS_DEST, skill);
|
|
158
|
+
|
|
159
|
+
if (existsSync(dest)) {
|
|
160
|
+
try {
|
|
161
|
+
log(` 🗑️ Removing: ${skill}`, 'yellow');
|
|
162
|
+
rmSync(dest, { recursive: true, force: true });
|
|
163
|
+
return true;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function installMCP() {
|
|
173
|
+
const distPath = join(PROJECT_DIR, 'dist', 'index.js');
|
|
174
|
+
|
|
175
|
+
if (!existsSync(distPath)) {
|
|
176
|
+
log(' ❌ dist/index.js not found', 'red');
|
|
177
|
+
log(' Run: pnpm build', 'yellow');
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!existsSync(MCP_CONFIG_DIR)) {
|
|
182
|
+
mkdirSync(MCP_CONFIG_DIR, { recursive: true });
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
try {
|
|
186
|
+
let config = {};
|
|
187
|
+
|
|
188
|
+
if (existsSync(MCP_CONFIG_FILE)) {
|
|
189
|
+
try {
|
|
190
|
+
config = JSON.parse(readFileSync(MCP_CONFIG_FILE, 'utf-8'));
|
|
191
|
+
} catch (error) {
|
|
192
|
+
log(' ⚠️ Creating new config', 'yellow');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (!config.mcpServers) {
|
|
197
|
+
config.mcpServers = {};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const wasInstalled = !!config.mcpServers.mozaic;
|
|
201
|
+
config.mcpServers.mozaic = {
|
|
202
|
+
command: 'node',
|
|
203
|
+
args: [distPath]
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
writeFileSync(MCP_CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
207
|
+
|
|
208
|
+
if (wasInstalled) {
|
|
209
|
+
log(' 🔄 Updating: MCP Server', 'yellow');
|
|
210
|
+
} else {
|
|
211
|
+
log(' ✨ Installing: MCP Server', 'green');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return true;
|
|
215
|
+
} catch (error) {
|
|
216
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function uninstallMCP() {
|
|
222
|
+
if (!existsSync(MCP_CONFIG_FILE)) {
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
try {
|
|
227
|
+
const config = JSON.parse(readFileSync(MCP_CONFIG_FILE, 'utf-8'));
|
|
228
|
+
|
|
229
|
+
if (config.mcpServers && config.mcpServers.mozaic) {
|
|
230
|
+
delete config.mcpServers.mozaic;
|
|
231
|
+
writeFileSync(MCP_CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
232
|
+
log(' 🗑️ Removing: MCP Server', 'yellow');
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return true;
|
|
236
|
+
} catch (error) {
|
|
237
|
+
log(` ❌ Failed: ${error.message}`, 'red');
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function printSuccess(installed, uninstalled) {
|
|
243
|
+
console.log('');
|
|
244
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'green');
|
|
245
|
+
log('║ ✨ Operation Complete! ✨ ║', 'bright');
|
|
246
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'green');
|
|
247
|
+
console.log('');
|
|
248
|
+
|
|
249
|
+
if (installed > 0 || uninstalled > 0) {
|
|
250
|
+
log('┌─────────────────────────────────────────────────────────┐', 'cyan');
|
|
251
|
+
log('│ Summary │', 'cyan');
|
|
252
|
+
log('├─────────────────────────────────────────────────────────┤', 'cyan');
|
|
253
|
+
if (installed > 0) {
|
|
254
|
+
log(`│ ✅ Installed: ${installed} component(s)`.padEnd(58) + '│', 'green');
|
|
255
|
+
}
|
|
256
|
+
if (uninstalled > 0) {
|
|
257
|
+
log(`│ 🗑️ Removed: ${uninstalled} component(s)`.padEnd(59) + '│', 'yellow');
|
|
258
|
+
}
|
|
259
|
+
log('└─────────────────────────────────────────────────────────┘', 'cyan');
|
|
260
|
+
console.log('');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Commands
|
|
265
|
+
const program = new Command();
|
|
266
|
+
|
|
267
|
+
program
|
|
268
|
+
.name('adeo-mozaic-install-tools')
|
|
269
|
+
.description('Mozaic Design System installer for Claude Code & Claude Desktop\n Run without arguments for interactive mode')
|
|
270
|
+
.version('2.0.1')
|
|
271
|
+
.hook('preAction', () => {
|
|
272
|
+
printLogo();
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
program
|
|
276
|
+
.command('list')
|
|
277
|
+
.alias('status')
|
|
278
|
+
.description('Show installation status')
|
|
279
|
+
.action(() => {
|
|
280
|
+
const status = checkStatus();
|
|
281
|
+
|
|
282
|
+
log('┌─────────────────────────────────────────────────────────┐', 'cyan');
|
|
283
|
+
log('│ 📦 Installation Status │', 'cyan');
|
|
284
|
+
log('├─────────────────────────────────────────────────────────┤', 'cyan');
|
|
285
|
+
|
|
286
|
+
// Skills
|
|
287
|
+
const installedSkills = SKILLS.filter(s => status.skills[s]);
|
|
288
|
+
if (installedSkills.length > 0) {
|
|
289
|
+
log('│ │', 'cyan');
|
|
290
|
+
log('│ Skills: │', 'bright');
|
|
291
|
+
installedSkills.forEach(skill => {
|
|
292
|
+
log(`│ ✓ ${skill}`.padEnd(58) + '│', 'green');
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// MCP
|
|
297
|
+
if (status.mcp) {
|
|
298
|
+
log('│ │', 'cyan');
|
|
299
|
+
log('│ MCP Server: │', 'bright');
|
|
300
|
+
log('│ ✓ Configured in Claude Desktop'.padEnd(58) + '│', 'green');
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Database
|
|
304
|
+
if (status.database) {
|
|
305
|
+
log('│ │', 'cyan');
|
|
306
|
+
log('│ Database: │', 'bright');
|
|
307
|
+
log('│ ✓ ~/.claude/mozaic.db'.padEnd(58) + '│', 'green');
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (installedSkills.length === 0 && !status.mcp && !status.database) {
|
|
311
|
+
log('│ │', 'cyan');
|
|
312
|
+
log('│ Nothing installed │', 'yellow');
|
|
313
|
+
log('│ │', 'cyan');
|
|
314
|
+
log('│ Run: adeo-mozaic-install-tools all │', 'dim');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
log('│ │', 'cyan');
|
|
318
|
+
log('└─────────────────────────────────────────────────────────┘', 'cyan');
|
|
319
|
+
console.log('');
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
program
|
|
323
|
+
.command('skills')
|
|
324
|
+
.description('Install all Claude Code skills')
|
|
325
|
+
.action(() => {
|
|
326
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'cyan');
|
|
327
|
+
log('║ ⚙️ Installing Skills... ║', 'bright');
|
|
328
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'cyan');
|
|
329
|
+
console.log('');
|
|
330
|
+
|
|
331
|
+
let installed = 0;
|
|
332
|
+
|
|
333
|
+
if (installDatabase()) installed++;
|
|
334
|
+
|
|
335
|
+
for (const skill of SKILLS) {
|
|
336
|
+
if (installSkill(skill)) installed++;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
printSuccess(installed, 0);
|
|
340
|
+
|
|
341
|
+
log('💡 Skills are now available in Claude Code!', 'bright');
|
|
342
|
+
log(' They activate automatically based on context.', 'cyan');
|
|
343
|
+
console.log('');
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
program
|
|
347
|
+
.command('mcp')
|
|
348
|
+
.description('Install MCP server for Claude Desktop')
|
|
349
|
+
.action(() => {
|
|
350
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'cyan');
|
|
351
|
+
log('║ ⚙️ Installing MCP Server... ║', 'bright');
|
|
352
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'cyan');
|
|
353
|
+
console.log('');
|
|
354
|
+
|
|
355
|
+
const installed = installMCP() ? 1 : 0;
|
|
356
|
+
|
|
357
|
+
printSuccess(installed, 0);
|
|
358
|
+
|
|
359
|
+
if (installed > 0) {
|
|
360
|
+
log('┌─────────────────────────────────────────────────────────┐', 'yellow');
|
|
361
|
+
log('│ ⚠️ Next Steps │', 'yellow');
|
|
362
|
+
log('├─────────────────────────────────────────────────────────┤', 'yellow');
|
|
363
|
+
log('│ │', 'yellow');
|
|
364
|
+
log('│ 1. Restart Claude Desktop │', 'cyan');
|
|
365
|
+
log('│ 2. Mozaic MCP server will be available │', 'cyan');
|
|
366
|
+
log('│ │', 'yellow');
|
|
367
|
+
log('└─────────────────────────────────────────────────────────┘', 'yellow');
|
|
368
|
+
console.log('');
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
program
|
|
373
|
+
.command('all')
|
|
374
|
+
.description('Install everything (skills + MCP server)')
|
|
375
|
+
.action(() => {
|
|
376
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'cyan');
|
|
377
|
+
log('║ ⚙️ Installing All Components... ║', 'bright');
|
|
378
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'cyan');
|
|
379
|
+
console.log('');
|
|
380
|
+
|
|
381
|
+
let installed = 0;
|
|
382
|
+
|
|
383
|
+
if (installDatabase()) installed++;
|
|
384
|
+
|
|
385
|
+
for (const skill of SKILLS) {
|
|
386
|
+
if (installSkill(skill)) installed++;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
if (installMCP()) installed++;
|
|
390
|
+
|
|
391
|
+
printSuccess(installed, 0);
|
|
392
|
+
|
|
393
|
+
log('💡 All components installed!', 'bright');
|
|
394
|
+
log(' • Skills are available in Claude Code', 'cyan');
|
|
395
|
+
log(' • Restart Claude Desktop to use MCP server', 'cyan');
|
|
396
|
+
console.log('');
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
program
|
|
400
|
+
.command('remove')
|
|
401
|
+
.argument('<component>', 'Component to remove: skills, mcp, or all')
|
|
402
|
+
.description('Remove installed components')
|
|
403
|
+
.action((component) => {
|
|
404
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'cyan');
|
|
405
|
+
log('║ 🗑️ Removing Components... ║', 'bright');
|
|
406
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'cyan');
|
|
407
|
+
console.log('');
|
|
408
|
+
|
|
409
|
+
let uninstalled = 0;
|
|
410
|
+
|
|
411
|
+
if (component === 'skills' || component === 'all') {
|
|
412
|
+
for (const skill of SKILLS) {
|
|
413
|
+
if (uninstallSkill(skill)) uninstalled++;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (uninstallDatabase()) uninstalled++;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
if (component === 'mcp' || component === 'all') {
|
|
420
|
+
if (uninstallMCP()) uninstalled++;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (component !== 'skills' && component !== 'mcp' && component !== 'all') {
|
|
424
|
+
log(` ❌ Unknown component: ${component}`, 'red');
|
|
425
|
+
log(' Valid options: skills, mcp, all', 'yellow');
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
printSuccess(0, uninstalled);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
// Check if no command was provided - run interactive mode
|
|
433
|
+
const args = process.argv.slice(2);
|
|
434
|
+
const commands = ['list', 'status', 'skills', 'mcp', 'all', 'remove'];
|
|
435
|
+
const isCommand = args.length > 0 && (commands.includes(args[0]) || args[0].startsWith('-'));
|
|
436
|
+
const isInteractive = args.length === 0 || args[0] === 'select';
|
|
437
|
+
|
|
438
|
+
async function runInteractive() {
|
|
439
|
+
// Run interactive mode
|
|
440
|
+
printLogo();
|
|
441
|
+
|
|
442
|
+
const status = checkStatus();
|
|
443
|
+
|
|
444
|
+
console.log('');
|
|
445
|
+
log('┌─────────────────────────────────────────────────────────┐', 'cyan');
|
|
446
|
+
log('│ 📦 Select components to install/manage │', 'cyan');
|
|
447
|
+
log('└─────────────────────────────────────────────────────────┘', 'cyan');
|
|
448
|
+
console.log('');
|
|
449
|
+
log(' ↑/↓ Navigate Space Select/Deselect Enter Confirm', 'dim');
|
|
450
|
+
console.log('');
|
|
451
|
+
|
|
452
|
+
// Create choices
|
|
453
|
+
const choices = [
|
|
454
|
+
...SKILLS.map(skill => {
|
|
455
|
+
const isInstalled = status.skills[skill];
|
|
456
|
+
const descriptions = {
|
|
457
|
+
'mozaic-vue-builder': 'Vue 3 component generator',
|
|
458
|
+
'mozaic-react-builder': 'React/TSX component generator',
|
|
459
|
+
'mozaic-design-tokens': 'Design tokens & styling',
|
|
460
|
+
'mozaic-css-utilities': 'CSS utilities & layouts',
|
|
461
|
+
'mozaic-icons': 'Icon search & integration'
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
return {
|
|
465
|
+
title: `${isInstalled ? '✓' : '○'} ${skill}`,
|
|
466
|
+
value: skill,
|
|
467
|
+
selected: isInstalled,
|
|
468
|
+
description: `${descriptions[skill]} - ${isInstalled ? 'installed' : 'not installed'}`
|
|
469
|
+
};
|
|
470
|
+
}),
|
|
471
|
+
{
|
|
472
|
+
title: `${status.mcp ? '✓' : '○'} MCP Server (Claude Desktop)`,
|
|
473
|
+
value: 'mcp-server',
|
|
474
|
+
selected: status.mcp,
|
|
475
|
+
description: `Model Context Protocol server - ${status.mcp ? 'installed' : 'not installed'}`
|
|
476
|
+
}
|
|
477
|
+
];
|
|
478
|
+
|
|
479
|
+
const response = await prompts({
|
|
480
|
+
type: 'multiselect',
|
|
481
|
+
name: 'components',
|
|
482
|
+
message: 'Select components to install',
|
|
483
|
+
choices: choices,
|
|
484
|
+
hint: '- Space to select. Return to submit',
|
|
485
|
+
instructions: false
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
if (!response.components) {
|
|
489
|
+
console.log('');
|
|
490
|
+
log('❌ Cancelled', 'red');
|
|
491
|
+
console.log('');
|
|
492
|
+
process.exit(0);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
console.log('');
|
|
496
|
+
log('╔═══════════════════════════════════════════════════════════╗', 'cyan');
|
|
497
|
+
log('║ ⚙️ Processing... ║', 'bright');
|
|
498
|
+
log('╚═══════════════════════════════════════════════════════════╝', 'cyan');
|
|
499
|
+
console.log('');
|
|
500
|
+
|
|
501
|
+
const selected = response.components || [];
|
|
502
|
+
const selectedSkills = selected.filter(item => item !== 'mcp-server');
|
|
503
|
+
const installMCPServer = selected.includes('mcp-server');
|
|
504
|
+
|
|
505
|
+
let installed = 0;
|
|
506
|
+
let uninstalled = 0;
|
|
507
|
+
|
|
508
|
+
// Handle database
|
|
509
|
+
if (selectedSkills.length > 0) {
|
|
510
|
+
if (installDatabase()) installed++;
|
|
511
|
+
} else if (Object.values(status.skills).every(s => !s)) {
|
|
512
|
+
if (uninstallDatabase()) uninstalled++;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Install/uninstall skills
|
|
516
|
+
for (const skill of SKILLS) {
|
|
517
|
+
const shouldInstall = selectedSkills.includes(skill);
|
|
518
|
+
const isInstalled = status.skills[skill];
|
|
519
|
+
|
|
520
|
+
if (shouldInstall && !isInstalled) {
|
|
521
|
+
if (installSkill(skill)) installed++;
|
|
522
|
+
} else if (!shouldInstall && isInstalled) {
|
|
523
|
+
if (uninstallSkill(skill)) uninstalled++;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Handle MCP
|
|
528
|
+
if (installMCPServer && !status.mcp) {
|
|
529
|
+
if (installMCP()) installed++;
|
|
530
|
+
} else if (!installMCPServer && status.mcp) {
|
|
531
|
+
if (uninstallMCP()) uninstalled++;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
printSuccess(installed, uninstalled);
|
|
535
|
+
|
|
536
|
+
if (installMCPServer && !status.mcp) {
|
|
537
|
+
log('┌─────────────────────────────────────────────────────────┐', 'yellow');
|
|
538
|
+
log('│ ⚠️ Next Steps │', 'yellow');
|
|
539
|
+
log('├─────────────────────────────────────────────────────────┤', 'yellow');
|
|
540
|
+
log('│ │', 'yellow');
|
|
541
|
+
log('│ 1. Restart Claude Desktop │', 'cyan');
|
|
542
|
+
log('│ 2. Mozaic MCP server will be available │', 'cyan');
|
|
543
|
+
log('│ │', 'yellow');
|
|
544
|
+
log('└─────────────────────────────────────────────────────────┘', 'yellow');
|
|
545
|
+
console.log('');
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
if (isInteractive) {
|
|
550
|
+
runInteractive().catch(error => {
|
|
551
|
+
console.error('');
|
|
552
|
+
log('❌ Error:', 'red');
|
|
553
|
+
log(error.message, 'red');
|
|
554
|
+
console.error('');
|
|
555
|
+
process.exit(1);
|
|
556
|
+
});
|
|
557
|
+
} else {
|
|
558
|
+
// Parse commander commands
|
|
559
|
+
program.parse();
|
|
560
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills-scripts.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/skills-scripts.test.ts"],"names":[],"mappings":""}
|