feat: add regolith onboard CLI wizard with daemon installation
Some checks failed
Update token count / update-tokens (push) Has been cancelled

- Interactive setup wizard: deps check, env config, WhatsApp auth, daemon install, health check
- CLI entry point via yargs with bin registration (regolith onboard)
- Flags: --install-daemon, --non-interactive, --pairing-code, --json, --skip-*
- launchd (macOS) and systemd (Linux) service installation
- Refactored whatsapp-auth.ts to export authenticate() for programmatic use
- 72 tests across 6 test files
- Updated README.md and CLAUDE.md with onboard CLI docs
This commit is contained in:
2026-02-19 14:05:18 -05:00
parent 6c1c908fce
commit 4b2b22d044
20 changed files with 2981 additions and 164 deletions

View File

@@ -27,8 +27,39 @@ The core philosophy remains the same: small enough to understand, secure by cont
git clone http://10.0.0.59:3051/tanmay/Regolith.git
cd Regolith/nanoclaw
npm install
npm run build
regolith onboard
```
The onboard wizard walks you through everything: dependency checks, `.env` configuration, WhatsApp authentication, and optional daemon installation.
To install as a background service in one shot:
```bash
regolith onboard --install-daemon
```
For non-interactive setup (CI/scripting):
```bash
regolith onboard --non-interactive --install-daemon
```
### Onboard CLI Flags
| Flag | Description |
|------|-------------|
| `--install-daemon` | Install as launchd (macOS) or systemd (Linux) service |
| `--non-interactive` | Run without prompts, use defaults |
| `--pairing-code` | Use pairing code instead of QR for WhatsApp |
| `--json` | Output JSON summary instead of text |
| `--skip-deps` | Skip dependency checks |
| `--skip-env` | Skip .env configuration |
| `--skip-whatsapp` | Skip WhatsApp authentication |
| `--skip-health` | Skip health check |
### Manual Setup
If you prefer to configure manually instead of using the wizard:
Configure your `.env`:
```bash
# WhatsApp (enabled by default)
@@ -38,7 +69,10 @@ ASSISTANT_NAME=Andy
DISCORD_BOT_TOKEN=your-discord-bot-token
DISCORD_ONLY=false # set to true to disable WhatsApp
# OpenCode runtime (optional)
# Agent backend: "container" (Claude Agent SDK) or "opencode"
AGENT_BACKEND=container
# OpenCode runtime (optional, used when AGENT_BACKEND=opencode)
OPENCODE_MODE=cli # or "sdk"
OPENCODE_MODEL=claude # model name
OPENCODE_TIMEOUT=120 # seconds
@@ -72,6 +106,9 @@ The `findChannel(channels, jid)` function resolves which channel owns a given JI
| File | Purpose |
|------|---------|
| `src/cli/index.ts` | CLI entry point (`regolith onboard`) |
| `src/cli/wizard-runner.ts` | Onboard wizard step orchestrator |
| `src/cli/steps/*.ts` | Individual wizard steps (deps, env, whatsapp, daemon, health) |
| `src/index.ts` | Orchestrator: multi-channel setup, state, message loop, agent invocation |
| `src/channels/whatsapp.ts` | WhatsApp connection, auth, send/receive |
| `src/channels/discord.ts` | Discord bot connection, mention handling, attachment tagging |