Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(cli): reach daemon/docs/version sub-apps, and fix the installer URL
trohitg154b5be0995c
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 797b1fd9..c1aac4ef 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -189,4 +189,4 @@ Full setup and scripts reference: [SETUP.md](docs-internal/SETUP.md) - [SCRIPTS.## Community-Join our [Discord](https://discord.gg/NHUEQVSC) for help, feedback, and updates.+Join our [Discord](https://discord.gg/c9pCJ7d8Ce) for help, feedback, and updates.diff --git a/bin/cli.js b/bin/cli.jsindex 443228e1..76eb579d 100755--- a/bin/cli.js+++ b/bin/cli.js@@ -15,15 +15,22 @@ const COMMANDS = {start: 'Start in production mode',dev: 'Start development server (hot-reload)',serve: 'Serve on a single public port (API + WS + SPA; used by deploy)',+ daemon: 'Run the backend detached (start|stop|status|restart)',deploy: 'Provision a cloud VM running OpenCompany (Terraform)',stop: 'Stop all running services',build: 'Build the project for production',clean: 'Clean build artifacts',+ docs: 'Documentation tooling (docs nodes [--check])',doctor: 'Check system dependencies and project health',help: 'Show this help message',- version: 'Show version number',+ version: 'Show version number (version sync [tag] to sync from a git tag)',};+// Verbs whose Python implementation is a Typer sub-app: they take a sub-verb+// and flags, so every remaining argv entry has to be forwarded rather than+// dropped by the bare ``run(cmd)`` path.+const SUBCOMMAND_VERBS = new Set(['daemon', 'deploy', 'docs', 'version']);+function printHelp() {console.log(`OpenCompany - Workflow Automation Platform@@ -177,20 +184,25 @@ if (USING_LEGACY_ALIAS) {const cmd = process.argv[2] || 'help';+const rest = process.argv.slice(3);+if (cmd === 'help' || cmd === '--help' || cmd === '-h') {printHelp();-} else if (cmd === 'version' || cmd === '--version' || cmd === '-v') {+} else if (cmd === '--version' || cmd === '-v' || (cmd === 'version' && rest.length === 0)) {+ // Bare `version` stays a local, dependency-free print. With a sub-verb+ // (`version sync`) it is the Typer sub-app instead -- previously that+ // silently printed the version and discarded `sync`.console.log(`company v${PKG.version}`);} else if (cmd === 'doctor') {doctor();} else if (cmd === 'start' || cmd === 'dev' || cmd === 'build' || cmd === 'serve') {checkDeps();- run(cmd, process.argv.slice(3));-} else if (cmd === 'deploy') {- // Needs sub-verb + flags forwarded (up/status/destroy --provider ...).- run(cmd, process.argv.slice(3));+ run(cmd, rest);+} else if (SUBCOMMAND_VERBS.has(cmd)) {+ // Sub-app verbs: forward the sub-verb and every flag verbatim.+ run(cmd, rest);} else if (COMMANDS[cmd]) {- run(cmd);+ run(cmd, rest);} else {console.error(`Unknown command: ${cmd}`);printHelp();diff --git a/install.ps1 b/install.ps1index 674aa513..ae46bbe1 100644--- a/install.ps1+++ b/install.ps1@@ -209,8 +209,25 @@ function Main {Write-Host " company start"Write-Host ""Write-Host " Open in browser:"- $appPort = (Select-String -Path ".env.template" -Pattern "^PYTHON_BACKEND_PORT=(\d+)" -ErrorAction SilentlyContinue).Matches.Groups[1].Value- Write-Host " http://localhost:$appPort"+ # .env.template ships inside the installed package. This used to read it+ # from the working directory, which is wherever the user ran the script --+ # so it printed a bare "http://localhost:", and dereferencing .Matches on+ # the null result could fault outright. Resolve through npm's global root.+ $appPort = $null+ $npmRoot = (npm root -g 2>$null | Select-Object -First 1)+ if ($npmRoot) {+ $templatePath = Join-Path $npmRoot "@zeenie-ai/opencompany/.env.template"+ if (Test-Path $templatePath) {+ $match = Select-String -Path $templatePath -Pattern "^PYTHON_BACKEND_PORT=(\d+)" |+ Select-Object -First 1+ if ($match) { $appPort = $match.Matches.Groups[1].Value }+ }+ }+ if ($appPort) {+ Write-Host " http://localhost:$appPort"+ } else {+ Write-Host " the URL printed by 'company start'"+ }Write-Host ""Write-Host " For development from source, install pnpm:"Write-Host " npm install -g pnpm"diff --git a/install.sh b/install.shindex b12c928e..ece26f8c 100755--- a/install.sh+++ b/install.sh@@ -315,8 +315,22 @@ main() {echo " company start"echo ""echo " Open in browser:"- APP_PORT=$(grep -E '^PYTHON_BACKEND_PORT=' .env.template 2>/dev/null | cut -d= -f2)- echo " http://localhost:${APP_PORT}"+ # `.env.template` ships inside the installed package. This used to grep it+ # from the working directory, which for `curl | bash` is wherever the user+ # happened to be -- so the line rendered as a bare "http://localhost:".+ # Resolve through npm's global root instead, and stay silent about the port+ # rather than hardcoding it if that lookup fails.+ APP_PORT=""+ NPM_ROOT="$(npm root -g 2>/dev/null)"+ if [ -n "$NPM_ROOT" ] && [ -f "$NPM_ROOT/@zeenie-ai/opencompany/.env.template" ]; then+ APP_PORT="$(grep -E '^PYTHON_BACKEND_PORT=' "$NPM_ROOT/@zeenie-ai/opencompany/.env.template" \+ | head -1 | cut -d= -f2 | tr -d '[:space:]')"+ fi+ if [ -n "$APP_PORT" ]; then+ echo " http://localhost:${APP_PORT}"+ else+ echo " the URL printed by 'company start'"+ fiecho ""echo " Optional: Enable JS-rendered web scraping:"echo " playwright install chromium"