spec-runner 1.0.0-alpha.1 → 1.0.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.
- package/bin/spec-runner.js +14 -5
- package/package.json +1 -1
package/bin/spec-runner.js
CHANGED
|
@@ -94,12 +94,13 @@ async function prompt(questions) {
|
|
|
94
94
|
const answers = {};
|
|
95
95
|
for (const q of questions) {
|
|
96
96
|
if (q.type === 'select') {
|
|
97
|
-
const choices = q.choices.map((c, i) => ` ${i + 1}) ${c}`).join('\n');
|
|
97
|
+
const choices = q.choices.map((c, i) => ` ${i + 1}) ${(c && c.name) != null ? c.name : c}`).join('\n');
|
|
98
98
|
const answer = await new Promise(resolve => {
|
|
99
99
|
rl.question(`${q.message}\n${choices}\n番号を入力: `, resolve);
|
|
100
100
|
});
|
|
101
101
|
const idx = parseInt(answer, 10) - 1;
|
|
102
|
-
|
|
102
|
+
const chosen = q.choices[idx] || q.choices[0];
|
|
103
|
+
answers[q.name] = (chosen && chosen.value != null) ? chosen.value : chosen;
|
|
103
104
|
} else if (q.type === 'multiselect') {
|
|
104
105
|
const choiceList = q.choices.map((c, i) => ` ${i + 1}) ${c.name || c}`).join('\n');
|
|
105
106
|
const answer = await new Promise(resolve => {
|
|
@@ -201,9 +202,9 @@ async function main() {
|
|
|
201
202
|
log('');
|
|
202
203
|
answers = await prompt([
|
|
203
204
|
{
|
|
204
|
-
type: '
|
|
205
|
+
type: 'select',
|
|
205
206
|
name: 'tools',
|
|
206
|
-
message: 'どの AI
|
|
207
|
+
message: 'どの AI ツール用の設定をインストールしますか?(矢印で移動・Enter で確定)',
|
|
207
208
|
choices: [
|
|
208
209
|
{ name: 'Claude Code', value: 'claude' },
|
|
209
210
|
{ name: 'Cursor', value: 'cursor' },
|
|
@@ -240,7 +241,15 @@ async function main() {
|
|
|
240
241
|
tdd: true,
|
|
241
242
|
};
|
|
242
243
|
|
|
243
|
-
|
|
244
|
+
// Select は単一値で返るので配列に統一。name で返る場合もあるので value に正規化
|
|
245
|
+
const toolValueMap = { 'claude code': 'claude', 'cursor': 'cursor', 'github copilot': 'copilot' };
|
|
246
|
+
const raw = answers.tools;
|
|
247
|
+
const toolsArr = Array.isArray(raw) ? raw : (raw ? [raw] : []);
|
|
248
|
+
answers.tools = toolsArr.map((t) => {
|
|
249
|
+
const s = (typeof t === 'string' ? t : '').toLowerCase();
|
|
250
|
+
return toolValueMap[s] || s || null;
|
|
251
|
+
}).filter(Boolean);
|
|
252
|
+
if (answers.tools.length === 0) {
|
|
244
253
|
answers.tools = ['claude', 'cursor', 'copilot'];
|
|
245
254
|
}
|
|
246
255
|
|