bopodev 0.1.12 → 0.1.14
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/LICENSE +1 -1
- package/dist/index.js +41 -14
- package/package.json +1 -1
package/LICENSE
CHANGED
package/dist/index.js
CHANGED
|
@@ -110,6 +110,13 @@ async function runDoctorChecks(options) {
|
|
|
110
110
|
ok: codex.available && codex.exitCode === 0,
|
|
111
111
|
details: codex.available && codex.exitCode === 0 ? `Command '${codexCommand}' is available` : codex.error ?? `Command '${codexCommand}' exited with ${String(codex.exitCode)}`
|
|
112
112
|
});
|
|
113
|
+
const openCodeCommand = process.env.BOPO_OPENCODE_COMMAND?.trim() || "opencode";
|
|
114
|
+
const openCode = await checkRuntimeCommandHealth(openCodeCommand, options?.workspaceRoot);
|
|
115
|
+
checks.push({
|
|
116
|
+
label: "OpenCode runtime",
|
|
117
|
+
ok: openCode.available && openCode.exitCode === 0,
|
|
118
|
+
details: openCode.available && openCode.exitCode === 0 ? `Command '${openCodeCommand}' is available` : openCode.error ?? `Command '${openCodeCommand}' exited with ${String(openCode.exitCode)}`
|
|
119
|
+
});
|
|
113
120
|
const instanceRoot = resolveInstanceRoot();
|
|
114
121
|
const storageRoot = join2(instanceRoot, "data", "storage");
|
|
115
122
|
const workspaceRoot = join2(instanceRoot, "workspaces");
|
|
@@ -298,6 +305,13 @@ var DEFAULT_COMPANY_NAME_ENV = "BOPO_DEFAULT_COMPANY_NAME";
|
|
|
298
305
|
var DEFAULT_COMPANY_ID_ENV = "BOPO_DEFAULT_COMPANY_ID";
|
|
299
306
|
var DEFAULT_PUBLIC_COMPANY_ID_ENV = "NEXT_PUBLIC_DEFAULT_COMPANY_ID";
|
|
300
307
|
var DEFAULT_AGENT_PROVIDER_ENV = "BOPO_DEFAULT_AGENT_PROVIDER";
|
|
308
|
+
var DEFAULT_ENV_TEMPLATE = "NEXT_PUBLIC_API_URL=http://localhost:4020\n";
|
|
309
|
+
var CLI_ONBOARD_VISIBLE_PROVIDERS = [
|
|
310
|
+
{ value: "codex", label: "Codex" },
|
|
311
|
+
{ value: "claude_code", label: "Claude Code" },
|
|
312
|
+
{ value: "gemini_cli", label: "Gemini" },
|
|
313
|
+
{ value: "opencode", label: "OpenCode" }
|
|
314
|
+
];
|
|
301
315
|
var defaultDeps = {
|
|
302
316
|
installDependencies: async (workspaceRoot) => {
|
|
303
317
|
const code = await runCommandStreaming("pnpm", ["install"], { cwd: workspaceRoot });
|
|
@@ -351,12 +365,7 @@ var defaultDeps = {
|
|
|
351
365
|
const answer = await select({
|
|
352
366
|
message: "Primary agent framework",
|
|
353
367
|
initialValue: "codex",
|
|
354
|
-
options:
|
|
355
|
-
{ value: "codex", label: "Codex" },
|
|
356
|
-
{ value: "claude_code", label: "Claude Code" },
|
|
357
|
-
{ value: "opencode", label: "OpenCode" },
|
|
358
|
-
{ value: "shell", label: "Shell Runtime" }
|
|
359
|
-
]
|
|
368
|
+
options: CLI_ONBOARD_VISIBLE_PROVIDERS
|
|
360
369
|
});
|
|
361
370
|
if (isCancel(answer)) {
|
|
362
371
|
throw new Error("Onboarding cancelled.");
|
|
@@ -399,8 +408,15 @@ async function runOnboardFlow(options, deps = defaultDeps) {
|
|
|
399
408
|
}
|
|
400
409
|
const envSpin = spinner();
|
|
401
410
|
envSpin.start("Ensuring .env exists");
|
|
402
|
-
const
|
|
403
|
-
|
|
411
|
+
const envResult = await ensureEnvFile(workspaceRoot);
|
|
412
|
+
const envCreated = envResult.created;
|
|
413
|
+
if (!envResult.created) {
|
|
414
|
+
envSpin.stop(".env already present");
|
|
415
|
+
} else if (envResult.source === "example") {
|
|
416
|
+
envSpin.stop("Created .env from .env.example");
|
|
417
|
+
} else {
|
|
418
|
+
envSpin.stop("Created .env with defaults (.env.example not found)");
|
|
419
|
+
}
|
|
404
420
|
const envPath = join3(workspaceRoot, ".env");
|
|
405
421
|
dotenv.config({ path: envPath });
|
|
406
422
|
const envValues = await readEnvValues(envPath);
|
|
@@ -493,14 +509,16 @@ async function ensureEnvFile(workspaceRoot) {
|
|
|
493
509
|
const envExamplePath = join3(workspaceRoot, ".env.example");
|
|
494
510
|
const envExists = await fileExists2(envPath);
|
|
495
511
|
if (envExists) {
|
|
496
|
-
return false;
|
|
512
|
+
return { created: false, source: null };
|
|
497
513
|
}
|
|
498
514
|
const envExampleExists = await fileExists2(envExamplePath);
|
|
499
|
-
if (
|
|
500
|
-
|
|
515
|
+
if (envExampleExists) {
|
|
516
|
+
await copyFile(envExamplePath, envPath);
|
|
517
|
+
return { created: true, source: "example" };
|
|
501
518
|
}
|
|
502
|
-
await
|
|
503
|
-
|
|
519
|
+
await writeFile(envPath, DEFAULT_ENV_TEMPLATE, "utf8");
|
|
520
|
+
log.warn("Missing .env.example in workspace root. Created .env with built-in defaults.");
|
|
521
|
+
return { created: true, source: "default" };
|
|
504
522
|
}
|
|
505
523
|
async function readEnvValues(envPath) {
|
|
506
524
|
const envContent = await readFile(envPath, "utf8");
|
|
@@ -547,7 +565,7 @@ function parseSeedResult(stdout) {
|
|
|
547
565
|
};
|
|
548
566
|
}
|
|
549
567
|
function parseAgentProvider(value) {
|
|
550
|
-
if (value === "codex" || value === "claude_code" || value === "opencode" || value === "shell") {
|
|
568
|
+
if (value === "codex" || value === "claude_code" || value === "gemini_cli" || value === "opencode" || value === "openai_api" || value === "anthropic_api" || value === "shell") {
|
|
551
569
|
return value;
|
|
552
570
|
}
|
|
553
571
|
return null;
|
|
@@ -559,9 +577,18 @@ function formatAgentProvider(provider) {
|
|
|
559
577
|
if (provider === "claude_code") {
|
|
560
578
|
return "Claude Code";
|
|
561
579
|
}
|
|
580
|
+
if (provider === "gemini_cli") {
|
|
581
|
+
return "Gemini";
|
|
582
|
+
}
|
|
562
583
|
if (provider === "opencode") {
|
|
563
584
|
return "OpenCode";
|
|
564
585
|
}
|
|
586
|
+
if (provider === "openai_api") {
|
|
587
|
+
return "OpenAI API (direct)";
|
|
588
|
+
}
|
|
589
|
+
if (provider === "anthropic_api") {
|
|
590
|
+
return "Anthropic API (direct)";
|
|
591
|
+
}
|
|
565
592
|
return "Shell Runtime";
|
|
566
593
|
}
|
|
567
594
|
async function fileExists2(path) {
|