multi-agents-cli 1.1.68 → 1.1.69
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/lib/ui.js +22 -24
- package/lib/validate.js +5 -2
- package/package.json +1 -1
package/lib/ui.js
CHANGED
|
@@ -130,34 +130,33 @@ const NONE_LABEL = '→ None of these - I\'ll specify my own';
|
|
|
130
130
|
const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, isOptional) => {
|
|
131
131
|
const _res = await prompts({ type: 'text', name: 'value', message: 'Type your own value:' }, { onCancel: () => process.exit(0) });
|
|
132
132
|
const typed = (_res.value || '').trim();
|
|
133
|
-
if (!typed) return isOptional ? null :
|
|
133
|
+
if (!typed) return isOptional ? null : handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional);
|
|
134
|
+
|
|
135
|
+
// Fuzzy match first - before registry check
|
|
136
|
+
const matches = fuzzyMatchFramework(typed);
|
|
137
|
+
if (matches.length > 0) {
|
|
138
|
+
const didYouMeanOpts = [
|
|
139
|
+
...matches.map(m => `→ ${m.label || m}`),
|
|
140
|
+
`→ Type a different value`,
|
|
141
|
+
];
|
|
142
|
+
const choice = await arrowSelect(`"${typed}" couldn't be verified. Did you mean:`, didYouMeanOpts.map(o => ({ label: o })));
|
|
143
|
+
if (choice < matches.length) return matches[choice]; // returns full framework object
|
|
144
|
+
return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional);
|
|
145
|
+
}
|
|
134
146
|
|
|
135
|
-
// Live registry check
|
|
147
|
+
// Live registry check - only when no fuzzy match
|
|
136
148
|
console.log(dim(' Verifying...'));
|
|
137
149
|
const existence = await checkFrameworkExists(typed);
|
|
138
150
|
|
|
139
151
|
if (!existence.exists) {
|
|
140
|
-
const matches = fuzzyMatchFramework(typed);
|
|
141
152
|
console.log('');
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (choice < matches.length) return matches[choice];
|
|
150
|
-
if (choice === matches.length) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional);
|
|
151
|
-
// Proceed with risks
|
|
152
|
-
} else {
|
|
153
|
-
const riskOpts = [
|
|
154
|
-
`→ Proceed with "${typed}" - I accept the risks`,
|
|
155
|
-
`→ Type a different value`,
|
|
156
|
-
];
|
|
157
|
-
const choice = await arrowSelect(`"${typed}" couldn't be verified.`, riskOpts.map(o => ({ label: o })));
|
|
158
|
-
if (choice === 1) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional);
|
|
159
|
-
}
|
|
160
|
-
// Show risk consequence block before proceeding
|
|
153
|
+
const riskOpts = [
|
|
154
|
+
`→ Proceed with "${typed}" - I accept the risks`,
|
|
155
|
+
`→ Type a different value`,
|
|
156
|
+
];
|
|
157
|
+
const choice = await arrowSelect(`"${typed}" couldn't be verified.`, riskOpts.map(o => ({ label: o })));
|
|
158
|
+
if (choice === 1) return handleFreeText(prompt, items, stepMachine, stepIndex, context, isOptional);
|
|
159
|
+
// Show risk consequence block
|
|
161
160
|
console.log('');
|
|
162
161
|
console.log(` ${yellow('⚠ Proceeding with an unverified framework may result in:')}`);
|
|
163
162
|
console.log(dim(' · Agent spending excessive tokens resolving unknown setup'));
|
|
@@ -173,8 +172,7 @@ const handleFreeText = async (prompt, items, stepMachine, stepIndex, context, is
|
|
|
173
172
|
return typed;
|
|
174
173
|
}
|
|
175
174
|
|
|
176
|
-
// Valid
|
|
177
|
-
const isBackend = context.backendFwObj !== undefined || context.clientFw !== undefined;
|
|
175
|
+
// Valid + verified - check compatibility
|
|
178
176
|
const check = validateCombination(typed, context);
|
|
179
177
|
if (!check.valid) {
|
|
180
178
|
console.log(`
|
package/lib/validate.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const { FRAMEWORK_REGISTRY } = require('./data-config');
|
|
3
|
+
const { FRAMEWORK_REGISTRY, CLIENT_FRAMEWORKS, BACKEND_FRAMEWORKS } = require('./data-config');
|
|
4
|
+
|
|
5
|
+
const ALL_FRAMEWORKS = [...CLIENT_FRAMEWORKS, ...BACKEND_FRAMEWORKS];
|
|
4
6
|
|
|
5
7
|
// ── Compatibility matrix ──────────────────────────────────────────────────────
|
|
6
8
|
|
|
@@ -17,10 +19,11 @@ const MONGO_DBS = ['MongoDB'];
|
|
|
17
19
|
|
|
18
20
|
const fuzzyMatchFramework = (typed) => {
|
|
19
21
|
const lower = typed.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
20
|
-
|
|
22
|
+
const matchedNames = Object.keys(FRAMEWORK_REGISTRY).filter(name => {
|
|
21
23
|
const n = name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
22
24
|
return n.includes(lower) || lower.includes(n) || (lower.length >= 3 && n.startsWith(lower.slice(0, 3)));
|
|
23
25
|
}).slice(0, 3);
|
|
26
|
+
return matchedNames.map(name => ALL_FRAMEWORKS.find(f => f.value === name) || { label: name, value: name });
|
|
24
27
|
};
|
|
25
28
|
|
|
26
29
|
// ── checkFrameworkExists ──────────────────────────────────────────────────────
|
package/package.json
CHANGED