@1mancompany/onemancompany 0.2.321 → 0.2.341
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 +100 -10
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -222,7 +222,9 @@ ${green("Usage:")}
|
|
|
222
222
|
npx @1mancompany/onemancompany Start (runs in background)
|
|
223
223
|
npx @1mancompany/onemancompany --debug Start with logs (Ctrl+C to stop)
|
|
224
224
|
npx @1mancompany/onemancompany stop Stop background service
|
|
225
|
-
npx @1mancompany/onemancompany init Re-run setup process
|
|
225
|
+
npx @1mancompany/onemancompany init Re-run setup process (interactive)
|
|
226
|
+
npx @1mancompany/onemancompany init --auto Auto-setup from .env (with confirmation)
|
|
227
|
+
npx @1mancompany/onemancompany init --auto -y Full auto, no confirmation prompt
|
|
226
228
|
npx @1mancompany/onemancompany uninstall Stop service and remove installation
|
|
227
229
|
npx @1mancompany/onemancompany --port 8080 Custom port
|
|
228
230
|
npx @1mancompany/onemancompany --dir ./my Custom install directory
|
|
@@ -346,7 +348,9 @@ ${green("What gets installed automatically:")}
|
|
|
346
348
|
? path.join(installDir, ".venv", "Scripts", "python.exe")
|
|
347
349
|
: path.join(installDir, ".venv", "bin", "python");
|
|
348
350
|
if (fs.existsSync(pythonBinCheck)) {
|
|
349
|
-
const
|
|
351
|
+
const onboardArgs = ["-m", "onemancompany.onboard"];
|
|
352
|
+
if (args.includes("--auto")) onboardArgs.push("--auto");
|
|
353
|
+
const initResult = spawnSync(pythonBinCheck, onboardArgs, {
|
|
350
354
|
cwd: installDir,
|
|
351
355
|
stdio: "inherit",
|
|
352
356
|
});
|
|
@@ -381,14 +385,100 @@ ${green("What gets installed automatically:")}
|
|
|
381
385
|
&& fs.existsSync(path.join(installDir, ".onemancompany", "company", "human_resource", "employees"));
|
|
382
386
|
|
|
383
387
|
// Run setup process if needed
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
388
|
+
const isInitCmd = passthrough[0] === "init";
|
|
389
|
+
const isAutoInit = isInitCmd && passthrough.includes("--auto");
|
|
390
|
+
const skipConfirm = isAutoInit && (passthrough.includes("-y") || passthrough.includes("--yes"));
|
|
391
|
+
|
|
392
|
+
if (isInitCmd || !initComplete) {
|
|
393
|
+
if (isAutoInit) {
|
|
394
|
+
// ── Auto-init: read .env, confirm with user, then run ──────────
|
|
395
|
+
const envPath = path.join(installDir, ".env");
|
|
396
|
+
if (!fs.existsSync(envPath)) {
|
|
397
|
+
fail(
|
|
398
|
+
`.env file not found at ${envPath}\n` +
|
|
399
|
+
" Auto-init requires a .env file with your configuration.\n" +
|
|
400
|
+
" Run interactive setup instead: npx @1mancompany/onemancompany init"
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Parse .env to show user what will be used
|
|
405
|
+
const envContent = fs.readFileSync(envPath, "utf-8");
|
|
406
|
+
const envVars = {};
|
|
407
|
+
for (const line of envContent.split("\n")) {
|
|
408
|
+
const trimmed = line.trim();
|
|
409
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
410
|
+
const eq = trimmed.indexOf("=");
|
|
411
|
+
if (eq > 0) envVars[trimmed.slice(0, eq).trim()] = trimmed.slice(eq + 1).trim();
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Check required fields
|
|
415
|
+
const required = [];
|
|
416
|
+
const hasProvider = envVars.OPENROUTER_API_KEY || envVars.ANTHROPIC_API_KEY;
|
|
417
|
+
if (!hasProvider) required.push("OPENROUTER_API_KEY or ANTHROPIC_API_KEY");
|
|
418
|
+
if (!envVars.DEFAULT_LLM_MODEL) required.push("DEFAULT_LLM_MODEL");
|
|
419
|
+
|
|
420
|
+
if (required.length > 0) {
|
|
421
|
+
fail(
|
|
422
|
+
"Missing required fields in .env:\n" +
|
|
423
|
+
required.map(r => ` • ${r}`).join("\n") + "\n\n" +
|
|
424
|
+
"Required .env fields:\n" +
|
|
425
|
+
` ${cyan("OPENROUTER_API_KEY")} or ${cyan("ANTHROPIC_API_KEY")} — LLM provider API key\n` +
|
|
426
|
+
` ${cyan("DEFAULT_LLM_MODEL")} — e.g. anthropic/claude-sonnet-4\n\n` +
|
|
427
|
+
"Optional .env fields:\n" +
|
|
428
|
+
` ${dim("HOST")} — Server host (default: 0.0.0.0)\n` +
|
|
429
|
+
` ${dim("PORT")} — Server port (default: 8000)\n` +
|
|
430
|
+
` ${dim("ANTHROPIC_API_KEY")} — For self-hosted employees (Claude CLI)\n` +
|
|
431
|
+
` ${dim("SKILLSMP_API_KEY")} — FastSkills MCP integration\n` +
|
|
432
|
+
` ${dim("TALENT_MARKET_API_KEY")} — Talent Market for hiring\n`
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Show config summary and ask for confirmation
|
|
437
|
+
const provider = envVars.OPENROUTER_API_KEY ? "openrouter" : "anthropic";
|
|
438
|
+
const apiKey = envVars.OPENROUTER_API_KEY || envVars.ANTHROPIC_API_KEY;
|
|
439
|
+
const maskedKey = apiKey.length > 8 ? apiKey.slice(0, 4) + "..." + apiKey.slice(-4) : "****";
|
|
440
|
+
|
|
441
|
+
console.log();
|
|
442
|
+
console.log(cyan(" Auto-init will configure your company with these settings:"));
|
|
443
|
+
console.log();
|
|
444
|
+
console.log(` ${cyan("Provider:")} ${provider}`);
|
|
445
|
+
console.log(` ${cyan("API Key:")} ${maskedKey}`);
|
|
446
|
+
console.log(` ${cyan("Model:")} ${envVars.DEFAULT_LLM_MODEL || "anthropic/claude-sonnet-4"}`);
|
|
447
|
+
console.log(` ${cyan("Server:")} ${envVars.HOST || "0.0.0.0"}:${envVars.PORT || "8000"}`);
|
|
448
|
+
console.log(` ${cyan("Anthropic:")} ${envVars.ANTHROPIC_API_KEY ? green("✓ configured") : dim("not set")}`);
|
|
449
|
+
console.log(` ${cyan("SkillsMP:")} ${envVars.SKILLSMP_API_KEY ? green("✓ configured") : dim("not set")}`);
|
|
450
|
+
console.log(` ${cyan("Talent Market:")} ${envVars.TALENT_MARKET_API_KEY ? green("✓ configured") : dim("not set")}`);
|
|
451
|
+
console.log();
|
|
452
|
+
|
|
453
|
+
if (skipConfirm) {
|
|
454
|
+
info("Skipping confirmation (-y flag)");
|
|
455
|
+
} else {
|
|
456
|
+
const answer = await ask(" Proceed with auto-init? [y/N] ");
|
|
457
|
+
if (answer !== "y" && answer !== "yes") {
|
|
458
|
+
console.log(" Aborted.");
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
info("Running auto-init from .env...\n");
|
|
464
|
+
const initResult = spawnSync(pythonBin, ["-m", "onemancompany.onboard", "--auto"], {
|
|
465
|
+
cwd: installDir,
|
|
466
|
+
stdio: "inherit",
|
|
467
|
+
});
|
|
468
|
+
if (initResult.status !== 0) fail("Auto-init failed");
|
|
469
|
+
// remove init, --auto, -y/--yes from passthrough
|
|
470
|
+
const initFlags = new Set(["init", "--auto", "-y", "--yes"]);
|
|
471
|
+
while (passthrough.length && initFlags.has(passthrough[0])) passthrough.shift();
|
|
472
|
+
} else {
|
|
473
|
+
// ── Interactive init ───────────────────────────────────────────
|
|
474
|
+
info("Running setup process...\n");
|
|
475
|
+
const initResult = spawnSync(pythonBin, ["-m", "onemancompany.onboard"], {
|
|
476
|
+
cwd: installDir,
|
|
477
|
+
stdio: "inherit",
|
|
478
|
+
});
|
|
479
|
+
if (initResult.status !== 0) fail("Setup wizard failed");
|
|
480
|
+
if (isInitCmd) passthrough.shift();
|
|
481
|
+
}
|
|
392
482
|
}
|
|
393
483
|
|
|
394
484
|
// Start server
|