weishu d057daabfe chore: migrate cli distribution from npm to bun executable
Migrate HAPI CLI from npm-based distribution to Bun single-executable format:
- Remove npm bin wrappers (bin/happy.mjs, bin/happy-mcp.mjs)
- Simplify package.json: remove npm publish config (exports, main, module, types, files, publishConfig)
- Update bin entry to point to TypeScript source (src/index.ts)
- Migrate shebang from Node to Bun (#!/usr/bin/env bun)
- Simplify build scripts: remove npm-specific steps (pkgroll, prepublishOnly, release-it)
- Update spawnHappyCLI to support compiled binaries and development TypeScript mode
- Update daemon/doctor diagnostics for new process detection logic
- Production: use `bun build --compile` for single-executable releases
- Development: run TypeScript directly via `bun src/index.ts` or `tsx src/index.ts`
2025-12-22 16:44:20 +08:00
2025-12-16 15:03:50 +08:00

hapi

HAPI means "哈皮," a Chinese transliteration of happy, great credit to the original Happy project.

Run Claude Code / Codex / Coding Agent sessions locally and control them remotely through a Web / PWA / Telegram mini App.

Quickstart (single executable)

  1. Download the prebuilt hapi binary for your platform and put it on your PATH.

  2. Start the server on a machine you control:

export CLI_API_TOKEN="shared-secret"
export WEBAPP_URL="https://your-domain.example"   # required for Telegram Mini App
export TELEGRAM_BOT_TOKEN="..."
export ALLOWED_CHAT_IDS="12345678"

hapi server

If you only want the web app + CLI, you can skip TELEGRAM_BOT_TOKEN and ALLOWED_CHAT_IDS. To enable Telegram later, set TELEGRAM_BOT_TOKEN and WEBAPP_URL, start the server, send /start to the bot to get your chat ID, set ALLOWED_CHAT_IDS, and restart the server.

  1. If the server has no public IP, expose it over HTTPS:
  1. Run the CLI on the machine where you want sessions:
# If the server is not on localhost:3006
export HAPI_BOT_URL="https://your-domain.example"

hapi

The CLI will prompt for CLI_API_TOKEN and save it locally.

  1. Open the UI:
  • In Telegram, run /app in the bot chat.
  • In a browser, open WEBAPP_URL and log in with CLI_API_TOKEN.

CLI config file

You can store the token in ~/.hapi/settings.json instead of an env var. Environment variables take priority over the file.

Example:

{
    "cliApiToken": "shared-secret"
}

Requirements

  • Claude CLI installed and logged in (claude on PATH).
  • A Telegram bot token from @BotFather (for Mini App access).
  • Bun if building from source.

Build from source

bun install
bun run build

Build a single binary with embedded web assets:

bun run build:single-exe

Build CLI-only binaries:

bun run build:cli:exe
bun run build:cli:exe:all

Docs

  • cli/README.md - CLI usage and config
  • server/README.md - server setup and architecture
  • web/README.md - web app behavior and dev workflow
S
Description
GitHub 镜像: wu736139669/hapi(每日自动同步)
Readme AGPL-3.0
103 MiB
Languages
TypeScript 99.5%
CSS 0.2%
JavaScript 0.2%
HTML 0.1%