@machinemetrics/mm-react-components 1.1.1-1 → 1.1.1-2
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.
|
@@ -19,7 +19,7 @@ From any project (with or without the package installed):
|
|
|
19
19
|
npx @machinemetrics/mm-react-components mm-install-skill
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Run with no arguments to be prompted for **which AI tool** (Cursor, Copilot, Claude, Gemini) and **project vs user** (global) install. With `--target` and `--scope`, it runs non-interactively and defaults to **Cursor** in the **project** (`.cursor/skills/mm-carbide/`):
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
# VS Code / GitHub Copilot (project)
|
|
@@ -15,7 +15,7 @@ This directory contains comprehensive documentation and tools for setting up the
|
|
|
15
15
|
|
|
16
16
|
### Scripts and Tools
|
|
17
17
|
|
|
18
|
-
- **mm-init** – Package bin (run via `npx @machinemetrics/mm-react-components mm-init`). Uses `scripts/init.cjs`; installs the library, adds `/styles` import, creates examples, and optionally
|
|
18
|
+
- **mm-init** – Package bin (run via `npx @machinemetrics/mm-react-components mm-init`). Uses `scripts/init.cjs`; installs the library, adds `/styles` import, creates examples, and optionally runs **mm-install-skill** (which prompts for AI tool and project vs user/global) or runs Chakra migration.
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
21
21
|
|
package/dist/scripts/init.cjs
CHANGED
|
@@ -191,7 +191,7 @@ async function main() {
|
|
|
191
191
|
log('\nDocs: GETTING_STARTED.md, CSS_EXPORTS.md, DEPENDENCIES.md', 'reset');
|
|
192
192
|
log('Repo: https://github.com/machinemetrics/mm-react-components', 'reset');
|
|
193
193
|
|
|
194
|
-
// Offer Carbide AI skill installation
|
|
194
|
+
// Offer Carbide AI skill installation (mm-install-skill will prompt for target/scope)
|
|
195
195
|
log('\nOptional: mm-carbide AI skill for Carbide-styled UI generation.', 'yellow');
|
|
196
196
|
const installSkillAnswer = await askQuestion(
|
|
197
197
|
' Install the Carbide skill for your AI editor? (y/N): ',
|
|
@@ -200,42 +200,14 @@ async function main() {
|
|
|
200
200
|
installSkillAnswer.toLowerCase() === 'y' ||
|
|
201
201
|
installSkillAnswer.toLowerCase() === 'yes'
|
|
202
202
|
) {
|
|
203
|
-
const aiPrompt =
|
|
204
|
-
' Which AI do you use? (1) Cursor (2) VS Code / GitHub Copilot (3) Claude Code (4) Gemini CLI: ';
|
|
205
|
-
const aiAnswer = (await askQuestion(aiPrompt)).trim().toLowerCase();
|
|
206
|
-
const targetMap = {
|
|
207
|
-
'1': 'cursor',
|
|
208
|
-
cursor: 'cursor',
|
|
209
|
-
'2': 'copilot',
|
|
210
|
-
copilot: 'copilot',
|
|
211
|
-
'3': 'claude',
|
|
212
|
-
claude: 'claude',
|
|
213
|
-
'4': 'gemini',
|
|
214
|
-
gemini: 'gemini',
|
|
215
|
-
};
|
|
216
|
-
const target = targetMap[aiAnswer] || 'cursor';
|
|
217
|
-
const scopePrompt =
|
|
218
|
-
' Install for this project only or for your user (all projects)? (1) This project (2) User (global): ';
|
|
219
|
-
const scopeAnswer = (await askQuestion(scopePrompt)).trim().toLowerCase();
|
|
220
|
-
const scopeMap = {
|
|
221
|
-
'1': 'project',
|
|
222
|
-
project: 'project',
|
|
223
|
-
'2': 'user',
|
|
224
|
-
user: 'user',
|
|
225
|
-
global: 'user',
|
|
226
|
-
};
|
|
227
|
-
const scope = scopeMap[scopeAnswer] || 'project';
|
|
228
203
|
const installSkillPath = path.join(__dirname, 'install-skill.cjs');
|
|
229
204
|
if (fs.existsSync(installSkillPath)) {
|
|
230
205
|
try {
|
|
231
|
-
execSync(
|
|
232
|
-
`node "${installSkillPath}" --target=${target} --scope=${scope}`,
|
|
233
|
-
{ stdio: 'inherit' },
|
|
234
|
-
);
|
|
206
|
+
execSync(`node "${installSkillPath}"`, { stdio: 'inherit' });
|
|
235
207
|
} catch (err) {
|
|
236
208
|
log(' Could not run skill installer.', 'yellow');
|
|
237
209
|
log(
|
|
238
|
-
' You can install later: npx @machinemetrics/mm-react-components mm-install-skill --target=<cursor|copilot|claude|gemini> [--scope=project|user]',
|
|
210
|
+
' You can install later: npx @machinemetrics/mm-react-components mm-install-skill [--target=<cursor|copilot|claude|gemini>] [--scope=project|user]',
|
|
239
211
|
'cyan',
|
|
240
212
|
);
|
|
241
213
|
}
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* --scope=<scope> project (default) | user
|
|
13
13
|
* --force overwrite even when version matches
|
|
14
14
|
*
|
|
15
|
+
* If --target or --scope are omitted, the script prompts interactively for
|
|
16
|
+
* which AI tool and project vs user (global) install.
|
|
17
|
+
*
|
|
15
18
|
* Paths by tool (project = cwd, user = home):
|
|
16
19
|
* cursor: .cursor/skills/mm-carbide | ~/.cursor/skills/mm-carbide
|
|
17
20
|
* copilot: .github/skills/mm-carbide | ~/.copilot/skills/mm-carbide (VS Code / GitHub Copilot)
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
const fs = require('fs');
|
|
25
28
|
const path = require('path');
|
|
26
29
|
const os = require('os');
|
|
30
|
+
const readline = require('readline');
|
|
27
31
|
|
|
28
32
|
const { ASCII_LOGO } = require(path.join(__dirname, 'ascii-logo.cjs'));
|
|
29
33
|
|
|
@@ -58,6 +62,19 @@ function parseArg(name) {
|
|
|
58
62
|
return arg ? arg.slice(prefix.length).toLowerCase() : null;
|
|
59
63
|
}
|
|
60
64
|
|
|
65
|
+
function askQuestion(question) {
|
|
66
|
+
const rl = readline.createInterface({
|
|
67
|
+
input: process.stdin,
|
|
68
|
+
output: process.stdout,
|
|
69
|
+
});
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
rl.question(question, (answer) => {
|
|
72
|
+
rl.close();
|
|
73
|
+
resolve(answer);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
61
78
|
function copyRecursive(src, dest) {
|
|
62
79
|
const items = fs.readdirSync(src);
|
|
63
80
|
for (const item of items) {
|
|
@@ -80,25 +97,7 @@ function copyRecursive(src, dest) {
|
|
|
80
97
|
}
|
|
81
98
|
}
|
|
82
99
|
|
|
83
|
-
function
|
|
84
|
-
logLogo();
|
|
85
|
-
|
|
86
|
-
const force = process.argv.includes('--force');
|
|
87
|
-
const target = parseArg('target') || 'cursor';
|
|
88
|
-
const scope = parseArg('scope') || 'project';
|
|
89
|
-
|
|
90
|
-
if (!TARGET_PATHS[target]) {
|
|
91
|
-
log(
|
|
92
|
-
`Unknown --target=${target}. Use: cursor, copilot, claude, gemini.`,
|
|
93
|
-
'red',
|
|
94
|
-
);
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
if (scope !== 'project' && scope !== 'user') {
|
|
98
|
-
log('Unknown --scope. Use: project, user.', 'red');
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
|
|
100
|
+
function performInstall(target, scope, force) {
|
|
102
101
|
const baseDir = scope === 'user' ? os.homedir() : process.cwd();
|
|
103
102
|
const relativePath = TARGET_PATHS[target][scope];
|
|
104
103
|
const destination = path.join(baseDir, ...relativePath.split('/'));
|
|
@@ -168,4 +167,62 @@ function main() {
|
|
|
168
167
|
log('Use when generating UIs with Carbide / mm-react-components.', 'cyan');
|
|
169
168
|
}
|
|
170
169
|
|
|
171
|
-
main()
|
|
170
|
+
async function main() {
|
|
171
|
+
logLogo();
|
|
172
|
+
|
|
173
|
+
const force = process.argv.includes('--force');
|
|
174
|
+
let target = parseArg('target');
|
|
175
|
+
let scope = parseArg('scope');
|
|
176
|
+
|
|
177
|
+
const interactive = target == null || scope == null;
|
|
178
|
+
if (interactive) {
|
|
179
|
+
const targetPrompt =
|
|
180
|
+
'Which AI do you use? (1) Cursor (2) VS Code / GitHub Copilot (3) Claude Code (4) Gemini CLI: ';
|
|
181
|
+
const targetAnswer = (await askQuestion(targetPrompt)).trim().toLowerCase();
|
|
182
|
+
const targetMap = {
|
|
183
|
+
'1': 'cursor',
|
|
184
|
+
cursor: 'cursor',
|
|
185
|
+
'2': 'copilot',
|
|
186
|
+
copilot: 'copilot',
|
|
187
|
+
'3': 'claude',
|
|
188
|
+
claude: 'claude',
|
|
189
|
+
'4': 'gemini',
|
|
190
|
+
gemini: 'gemini',
|
|
191
|
+
};
|
|
192
|
+
target = targetMap[targetAnswer] || 'cursor';
|
|
193
|
+
|
|
194
|
+
const scopePrompt =
|
|
195
|
+
'Install for this project only or for your user (all projects)? (1) This project (2) User (global): ';
|
|
196
|
+
const scopeAnswer = (await askQuestion(scopePrompt)).trim().toLowerCase();
|
|
197
|
+
const scopeMap = {
|
|
198
|
+
'1': 'project',
|
|
199
|
+
project: 'project',
|
|
200
|
+
'2': 'user',
|
|
201
|
+
user: 'user',
|
|
202
|
+
global: 'user',
|
|
203
|
+
};
|
|
204
|
+
scope = scopeMap[scopeAnswer] || 'project';
|
|
205
|
+
} else {
|
|
206
|
+
target = target || 'cursor';
|
|
207
|
+
scope = scope || 'project';
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (!TARGET_PATHS[target]) {
|
|
211
|
+
log(
|
|
212
|
+
`Unknown --target=${target}. Use: cursor, copilot, claude, gemini.`,
|
|
213
|
+
'red',
|
|
214
|
+
);
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
if (scope !== 'project' && scope !== 'user') {
|
|
218
|
+
log('Unknown --scope. Use: project, user.', 'red');
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
performInstall(target, scope, force);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
main().catch((err) => {
|
|
226
|
+
log(`Error: ${err.message}`, 'red');
|
|
227
|
+
process.exit(1);
|
|
228
|
+
});
|