oh-aicoding-tool 0.1.9 → 0.1.10
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/cli.js +59 -60
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -209,10 +209,9 @@ async function debugKeys() {
|
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
async function askMultiChoice(
|
|
213
|
-
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
214
|
-
|
|
215
|
-
return await new Promise((resolve) => {
|
|
212
|
+
async function askMultiChoice(title, choices, subtitle) {
|
|
213
|
+
if (process.stdin.isTTY && process.stdout.isTTY) {
|
|
214
|
+
return await new Promise((resolve) => {
|
|
216
215
|
let index = 0;
|
|
217
216
|
let keyBuffer = "";
|
|
218
217
|
const selected = new Set(choices.filter((choice) => choice.selected).map((choice) => choice.value));
|
|
@@ -222,10 +221,9 @@ async function askMultiChoice(rl, title, choices, subtitle) {
|
|
|
222
221
|
stdin.off("data", onData);
|
|
223
222
|
if (stdin.isTTY) stdin.setRawMode(false);
|
|
224
223
|
stdin.pause();
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
224
|
+
clearScreen();
|
|
225
|
+
resolve(value);
|
|
226
|
+
}
|
|
229
227
|
|
|
230
228
|
function toggle() {
|
|
231
229
|
const value = choices[index].value;
|
|
@@ -273,10 +271,12 @@ async function askMultiChoice(rl, title, choices, subtitle) {
|
|
|
273
271
|
renderMultiChoice(title, choices, index, selected, subtitle);
|
|
274
272
|
});
|
|
275
273
|
}
|
|
276
|
-
|
|
277
|
-
choices.forEach((choice, index) => console.log(` ${index + 1}. ${choice.label}`));
|
|
278
|
-
const
|
|
279
|
-
|
|
274
|
+
|
|
275
|
+
choices.forEach((choice, index) => console.log(` ${index + 1}. ${choice.label}`));
|
|
276
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
277
|
+
const answer = await rl.question("Select numbers separated by comma > ");
|
|
278
|
+
rl.close();
|
|
279
|
+
return answer
|
|
280
280
|
.split(/[, ]+/)
|
|
281
281
|
.map((item) => Number.parseInt(item, 10) - 1)
|
|
282
282
|
.filter((index) => Number.isInteger(index) && choices[index])
|
|
@@ -301,54 +301,53 @@ async function askCompanyEmail(rl) {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
|
|
304
|
-
async function interactive() {
|
|
305
|
-
if (!process.stdin.isTTY) {
|
|
306
|
-
printHelp();
|
|
307
|
-
return 0;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
304
|
+
async function interactive() {
|
|
305
|
+
if (!process.stdin.isTTY) {
|
|
306
|
+
printHelp();
|
|
307
|
+
return 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const tools = await askMultiChoice(
|
|
311
|
+
"Select tools to install or configure",
|
|
312
|
+
[
|
|
313
|
+
{ label: "Langfuse tracing", value: "langfuse", selected: true, description: "Configure Claude Code, OpenCode, or Codex tracing." },
|
|
314
|
+
{ label: "Issue report plugin", value: "report", selected: true, description: "Install /report-ai-issue and configure Company email." },
|
|
315
|
+
],
|
|
316
|
+
"Install menu"
|
|
317
|
+
);
|
|
318
|
+
|
|
319
|
+
let reportTarget = "";
|
|
320
|
+
let email = "";
|
|
321
|
+
if (tools.includes("report")) {
|
|
322
|
+
const targets = await askMultiChoice(
|
|
323
|
+
"Select issue report install targets",
|
|
324
|
+
[
|
|
325
|
+
{ label: "OpenCode", value: "opencode", selected: true, description: "Install OpenCode plugin and command." },
|
|
326
|
+
{ label: "Claude Code", value: "claude", selected: false, description: "Install Claude command and hook integration." },
|
|
327
|
+
],
|
|
328
|
+
"Issue report setup"
|
|
329
|
+
);
|
|
330
|
+
reportTarget = targets.length === 2 ? "both" : targets[0] || "";
|
|
331
|
+
if (reportTarget) {
|
|
332
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
333
|
+
try {
|
|
334
|
+
email = await askCompanyEmail(rl);
|
|
335
|
+
} finally {
|
|
336
|
+
rl.close();
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
let code = 0;
|
|
342
|
+
if (tools.includes("langfuse")) code ||= runPackageBin("oh-langfuse", "oh-langfuse", ["setup"]);
|
|
343
|
+
if (tools.includes("report") && reportTarget) {
|
|
344
|
+
const args = ["install", reportTarget];
|
|
345
|
+
if (email) args.push("--email", email);
|
|
346
|
+
else args.push("--skip-email");
|
|
347
|
+
code ||= runPackageBin("oh-aireport", "oh-aireport", args);
|
|
348
|
+
}
|
|
349
|
+
return code;
|
|
350
|
+
}
|
|
352
351
|
|
|
353
352
|
async function main() {
|
|
354
353
|
const argv = process.argv.slice(2);
|