From 958e78dc6e60668c6d5b17543be62742256f8cb9 Mon Sep 17 00:00:00 2001 From: weishu Date: Wed, 24 Dec 2025 19:15:47 +0800 Subject: [PATCH] refactor: rename HAPI_BOT_URL to HAPI_SERVER_URL The project is no longer primarily a bot - it now provides HTTP API, Socket.IO, SSE, and web app backend services. This rename reflects the broader scope of server functionality. Updates references in: - cli/src/configuration.ts (core config) - cli/src/ui/logger.ts (remote logging) - cli/src/ui/doctor.ts (diagnostics) - cli/src/commands/auth.ts (auth status) - cli/src/daemon/daemon.integration.test.ts (test comments) - README.md (quickstart docs) - cli/README.md (CLI docs) - cli/CLAUDE.md (dev docs) --- README.md | 2 +- cli/CLAUDE.md | 2 +- cli/README.md | 2 +- cli/src/commands/auth.ts | 2 +- cli/src/configuration.ts | 4 ++-- cli/src/daemon/daemon.integration.test.ts | 2 +- cli/src/ui/doctor.ts | 4 ++-- cli/src/ui/logger.ts | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 40879539..d47c87d0 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ npx @twsxtd/hapi server ```bash # If the server is not on localhost:3006 -export HAPI_BOT_URL="https://your-domain.example" +export HAPI_SERVER_URL="https://your-domain.example" npx @twsxtd/hapi ``` diff --git a/cli/CLAUDE.md b/cli/CLAUDE.md index bba4bc0b..ca07375b 100644 --- a/cli/CLAUDE.md +++ b/cli/CLAUDE.md @@ -139,7 +139,7 @@ User interface components. hapi daemon start # With custom bot URL (for local development): -HAPI_BOT_URL=http://localhost:3006 CLI_API_TOKEN=your_token hapi daemon start +HAPI_SERVER_URL=http://localhost:3006 CLI_API_TOKEN=your_token hapi daemon start # Stop the daemon: hapi daemon stop diff --git a/cli/README.md b/cli/README.md index 4b572fc5..837e961a 100644 --- a/cli/README.md +++ b/cli/README.md @@ -66,7 +66,7 @@ See `src/configuration.ts` for all options. ### Required - `CLI_API_TOKEN` - Shared secret; must match the server. Can be set via env or `~/.hapi/settings.json` (env wins). -- `HAPI_BOT_URL` - Server base URL (default: http://localhost:3006). +- `HAPI_SERVER_URL` - Server base URL (default: http://localhost:3006). ### Optional diff --git a/cli/src/commands/auth.ts b/cli/src/commands/auth.ts index fb30d369..4be315e2 100644 --- a/cli/src/commands/auth.ts +++ b/cli/src/commands/auth.ts @@ -20,7 +20,7 @@ export async function handleAuthCommand(args: string[]): Promise { const hasToken = Boolean(envToken || settingsToken) const tokenSource = envToken ? 'environment' : (settingsToken ? 'settings file' : 'none') console.log(chalk.bold('\nDirect Connect Status\n')) - console.log(chalk.gray(` HAPI_BOT_URL: ${configuration.serverUrl}`)) + console.log(chalk.gray(` HAPI_SERVER_URL: ${configuration.serverUrl}`)) console.log(chalk.gray(` CLI_API_TOKEN: ${hasToken ? 'set' : 'missing'}`)) console.log(chalk.gray(` Token Source: ${tokenSource}`)) console.log(chalk.gray(` Machine ID: ${settings.machineId ?? 'not set'}`)) diff --git a/cli/src/configuration.ts b/cli/src/configuration.ts index 3d835639..9832852a 100644 --- a/cli/src/configuration.ts +++ b/cli/src/configuration.ts @@ -27,8 +27,8 @@ class Configuration { public readonly isExperimentalEnabled: boolean constructor() { - // Bot server configuration - this.serverUrl = process.env.HAPI_BOT_URL || 'http://localhost:3006' + // Server configuration + this.serverUrl = process.env.HAPI_SERVER_URL || 'http://localhost:3006' this._cliApiToken = process.env.CLI_API_TOKEN || '' // Check if we're running as daemon based on process args diff --git a/cli/src/daemon/daemon.integration.test.ts b/cli/src/daemon/daemon.integration.test.ts index 491e1e38..c3985d11 100644 --- a/cli/src/daemon/daemon.integration.test.ts +++ b/cli/src/daemon/daemon.integration.test.ts @@ -11,7 +11,7 @@ * * The integration test environment uses .env.integration-test which sets: * - HAPI_HOME=~/.hapi-dev-test (DIFFERENT from dev's ~/.hapi-dev!) - * - HAPI_BOT_URL=http://localhost:3006 (local hapi-server) + * - HAPI_SERVER_URL=http://localhost:3006 (local hapi-server) * - CLI_API_TOKEN=... (must match the server) */ diff --git a/cli/src/ui/doctor.ts b/cli/src/ui/doctor.ts index 5bbf28db..315539bf 100644 --- a/cli/src/ui/doctor.ts +++ b/cli/src/ui/doctor.ts @@ -24,7 +24,7 @@ export function getEnvironmentInfo(): Record { return { PWD: process.env.PWD, HAPI_HOME: process.env.HAPI_HOME, - HAPI_BOT_URL: process.env.HAPI_BOT_URL, + HAPI_SERVER_URL: process.env.HAPI_SERVER_URL, HAPI_PROJECT_ROOT: process.env.HAPI_PROJECT_ROOT, CLI_API_TOKEN_SET: Boolean(process.env.CLI_API_TOKEN), DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING: process.env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING, @@ -114,7 +114,7 @@ export async function runDoctorCommand(filter?: 'all' | 'daemon'): Promise console.log(chalk.bold('\nšŸŒ Environment Variables')); const env = getEnvironmentInfo(); console.log(`HAPI_HOME: ${env.HAPI_HOME ? chalk.green(env.HAPI_HOME) : chalk.gray('not set')}`); - console.log(`HAPI_BOT_URL: ${env.HAPI_BOT_URL ? chalk.green(env.HAPI_BOT_URL) : chalk.gray('not set')}`); + console.log(`HAPI_SERVER_URL: ${env.HAPI_SERVER_URL ? chalk.green(env.HAPI_SERVER_URL) : chalk.gray('not set')}`); console.log(`CLI_API_TOKEN: ${env.CLI_API_TOKEN_SET ? chalk.green('set') : chalk.gray('not set')}`); console.log(`DANGEROUSLY_LOG_TO_SERVER: ${env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING ? chalk.yellow('ENABLED') : chalk.gray('not set')}`); console.log(`DEBUG: ${env.DEBUG ? chalk.green(env.DEBUG) : chalk.gray('not set')}`); diff --git a/cli/src/ui/logger.ts b/cli/src/ui/logger.ts index e1cb83bd..fdda3b2f 100644 --- a/cli/src/ui/logger.ts +++ b/cli/src/ui/logger.ts @@ -51,9 +51,9 @@ class Logger { public readonly logFilePath = getSessionLogPath() ) { // Remote logging enabled only when explicitly set with server URL - if (process.env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING - && process.env.HAPI_BOT_URL) { - this.dangerouslyUnencryptedServerLoggingUrl = process.env.HAPI_BOT_URL + if (process.env.DANGEROUSLY_LOG_TO_SERVER_FOR_AI_AUTO_DEBUGGING + && process.env.HAPI_SERVER_URL) { + this.dangerouslyUnencryptedServerLoggingUrl = process.env.HAPI_SERVER_URL console.log(chalk.yellow('[REMOTE LOGGING] Sending logs to server for AI debugging')) } }