colana 1.0.0-beta.9 → 1.0.0-beta.91
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/README.md +47 -219
- package/bin/admin.js +20 -2
- package/bin/colana.js +193 -19
- package/package.json +10 -4
- package/public/app.js +3365 -95
- package/public/index.html +177 -1
- package/public/styles.css +1550 -1
- package/scripts/postinstall.cjs +27 -0
- package/server/agent-control-routes.js +52 -9
- package/server/analytics-routes.js +2 -2
- package/server/auto-installer.js +573 -21
- package/server/auto-resume.js +57 -8
- package/server/blueprint-exporter.js +474 -0
- package/server/blueprint-importer.js +676 -0
- package/server/blueprint-routes.js +557 -0
- package/server/blueprint-store.js +180 -0
- package/server/blueprint-sync.js +674 -0
- package/server/config.js +11 -2
- package/server/db.js +24 -0
- package/server/diagnostics-routes.js +12 -11
- package/server/git-ops.js +110 -0
- package/server/index.js +124 -20
- package/server/license-routes.js +33 -14
- package/server/license.js +316 -11
- package/server/logger.js +25 -1
- package/server/openclaw-config.js +216 -8
- package/server/personal-agent-routes.js +133 -9
- package/server/platform.js +56 -1
- package/server/preflight.js +63 -4
- package/server/pty-manager.js +534 -71
- package/server/server-control-routes.js +42 -4
- package/server/session-routes.js +70 -32
- package/server/settings-routes.js +2 -2
- package/server/settings-store.js +7 -5
- package/server/spawn-env.js +7 -1
- package/server/updater.js +79 -47
- package/server/validation.js +149 -1
- package/server/webhook-routes.js +36 -3
package/README.md
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="https://www.npmjs.com/package/colana"><img src="https://img.shields.io/npm/v/colana.svg" alt="npm version"></a>
|
|
13
13
|
<a href="https://www.npmjs.com/package/colana"><img src="https://img.shields.io/npm/dm/colana.svg" alt="npm downloads"></a>
|
|
14
|
-
<a href="https://github.com/colana-ai/colana/actions"><img src="https://img.shields.io/github/actions/workflow/status/colana-ai/colana/ci.yml?branch=main" alt="CI"></a>
|
|
15
14
|
<img src="https://img.shields.io/node/v/colana.svg" alt="Node.js version">
|
|
16
15
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-proprietary-blue.svg" alt="License"></a>
|
|
17
16
|
</p>
|
|
@@ -33,65 +32,47 @@ The dashboard opens in your browser at `http://localhost:9876`. On first run, a
|
|
|
33
32
|
|
|
34
33
|
## Supported Providers
|
|
35
34
|
|
|
36
|
-
| Provider |
|
|
37
|
-
|
|
38
|
-
| **Claude Code** |
|
|
39
|
-
| **Codex CLI** |
|
|
40
|
-
| **Gemini CLI** |
|
|
41
|
-
| **Copilot CLI** |
|
|
42
|
-
| **Aider** |
|
|
43
|
-
| **OpenClaw** |
|
|
35
|
+
| Provider | Auth | Resume |
|
|
36
|
+
|----------|------|--------|
|
|
37
|
+
| **Claude Code** | Anthropic subscription or API key | Yes |
|
|
38
|
+
| **Codex CLI** | OpenAI API key | Yes |
|
|
39
|
+
| **Gemini CLI** | Free Google account (no API key needed) | Yes |
|
|
40
|
+
| **Copilot CLI** | GitHub Copilot subscription | Yes |
|
|
41
|
+
| **Aider** | LLM API key (OpenAI, Anthropic, etc.) | Yes |
|
|
42
|
+
| **OpenClaw** | User-configured model keys | — |
|
|
44
43
|
|
|
45
|
-
You need at least one provider installed. **Gemini CLI** is recommended for quick start — works with any Google account, no API key needed.
|
|
44
|
+
You need at least one provider installed. **Gemini CLI** is recommended for quick start — works with any Google account, no API key needed. The setup wizard detects and installs missing providers automatically.
|
|
46
45
|
|
|
47
46
|
## Features
|
|
48
47
|
|
|
49
48
|
### Agent Orchestration
|
|
50
49
|
- **Multi-provider dashboard** — run and observe agents across different projects from one screen
|
|
51
|
-
- **Interactive
|
|
52
|
-
- **Real-time streaming** — terminal
|
|
50
|
+
- **Interactive terminals** — full terminal emulation for all 6 providers
|
|
51
|
+
- **Real-time streaming** — instant terminal output, no polling
|
|
53
52
|
- **Split-pane view** — monitor multiple agents side-by-side
|
|
54
|
-
- **Pop-out
|
|
55
|
-
- **Safe Parallel Mode** — automatic
|
|
53
|
+
- **Pop-out windows** — focus on one agent or drag it to a second monitor
|
|
54
|
+
- **Safe Parallel Mode** — automatic isolation when multiple agents work on the same project
|
|
56
55
|
|
|
57
56
|
### Session Management
|
|
58
57
|
- **Universal resume** — resume sessions for all providers with native support
|
|
59
|
-
- **Session history** — search across all projects by
|
|
60
|
-
- **Git checkpoints** — auto-capture
|
|
58
|
+
- **Session history** — search across all projects by title, project, or conversation content
|
|
59
|
+
- **Git checkpoints** — auto-capture state on session start, one-click restore, per-file accept/reject
|
|
61
60
|
- **Git diff preview** — review file changes with "Open in Editor" integration
|
|
62
|
-
- **Session export** — export session logs and conversation history
|
|
63
61
|
- **Auto-resume** — automatically resume interrupted sessions on server restart
|
|
64
62
|
|
|
65
63
|
### Personal Agent
|
|
66
|
-
- **
|
|
67
|
-
- **Chat
|
|
68
|
-
- **
|
|
69
|
-
- **
|
|
70
|
-
- **
|
|
71
|
-
- **Model configuration** — view and switch the Personal Agent's AI model from Settings
|
|
64
|
+
- **Always-on companion** — header strip, notification dropdown, and slide-in panel
|
|
65
|
+
- **Chat and terminal modes** — stream responses or use the full terminal
|
|
66
|
+
- **Proactive notifications** — alerts with category icons and deep links
|
|
67
|
+
- **Integration Hub** — connect 17 tools (GitHub, Google Workspace, Slack, Notion, and more)
|
|
68
|
+
- **Model switching** — change the AI model from Settings
|
|
72
69
|
|
|
73
70
|
### Productivity
|
|
74
|
-
- **Command palette** — `Ctrl+K` fuzzy search
|
|
75
|
-
- **Task templates** — save and reuse common prompts
|
|
71
|
+
- **Command palette** — `Ctrl+K` fuzzy search
|
|
72
|
+
- **Task templates** — save and reuse common prompts
|
|
76
73
|
- **Clipboard snippets** — quick-access code snippets with search
|
|
77
|
-
- **Cost tracking** — per-project token and cost tracking
|
|
78
|
-
- **Context Sync** — automatic multi-agent project context sharing
|
|
79
|
-
|
|
80
|
-
### Setup & Admin
|
|
81
|
-
- **First-run wizard** — 6-step guided setup (scan, select, install, authenticate, done)
|
|
82
|
-
- **Inline authentication** — Claude OAuth, API key inputs, GitHub device-code flow — no terminal needed
|
|
83
|
-
- **Admin panel** — user stats, version/OS breakdown, analytics dashboard
|
|
84
|
-
- **Admin CLI** — `colana admin` for key management and diagnostics
|
|
85
|
-
- **System service** — auto-start on login via `colana service install`
|
|
86
|
-
- **Auto-updates** — automatic update detection with in-app install
|
|
87
|
-
|
|
88
|
-
### Enterprise Quality
|
|
89
|
-
- **4-tier rate limiting** — general, agent, sensitive, and admin tiers
|
|
90
|
-
- **Input validation** — Zod schemas on all POST endpoints
|
|
91
|
-
- **AES-256-GCM encryption** — for stored API keys and tokens
|
|
92
|
-
- **Structured logging** — JSONL server logs with daily rotation
|
|
93
|
-
- **PWA support** — installable as a standalone desktop app
|
|
94
|
-
- **Free tier** — full product, 2 concurrent sessions, no trial, no expiry
|
|
74
|
+
- **Cost tracking** — per-project token and cost tracking
|
|
75
|
+
- **Context Sync** — automatic multi-agent project context sharing
|
|
95
76
|
|
|
96
77
|
## Pricing
|
|
97
78
|
|
|
@@ -99,221 +80,68 @@ You need at least one provider installed. **Gemini CLI** is recommended for quic
|
|
|
99
80
|
|---|---|---|
|
|
100
81
|
| **Price** | $0 forever | $9/mo or $79/yr |
|
|
101
82
|
| **Concurrent sessions** | 2 | Unlimited |
|
|
102
|
-
| **All 6 providers** | Yes | Yes |
|
|
103
83
|
| **All features** | Yes | Yes |
|
|
104
|
-
| **
|
|
84
|
+
| **All 6 providers** | Yes | Yes |
|
|
105
85
|
|
|
106
|
-
No trial. No expiry. Free tier is the full product — only concurrent session count is gated.
|
|
86
|
+
No trial. No expiry. Free tier is the full product — only concurrent session count is gated.
|
|
107
87
|
|
|
108
|
-
Payments handled by [Polar.sh](https://polar.sh) (Merchant of Record
|
|
88
|
+
Payments handled by [Polar.sh](https://polar.sh) (Merchant of Record).
|
|
109
89
|
|
|
110
90
|
## System Requirements
|
|
111
91
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
| **OS** | Linux, macOS, or Windows (WSL2 recommended) |
|
|
116
|
-
| **CPU** | x64 or ARM64 |
|
|
117
|
-
| **RAM** | ~100 MB per concurrent agent |
|
|
118
|
-
| **Disk** | ~50 MB installed + runtime data |
|
|
119
|
-
| **Browser** | Chrome or Edge (desktop) |
|
|
92
|
+
- **Node.js** 18.0.0 or later
|
|
93
|
+
- **OS:** Linux, macOS, or Windows (WSL2 recommended)
|
|
94
|
+
- **Browser:** Chrome or Edge (desktop)
|
|
120
95
|
|
|
121
|
-
## CLI
|
|
96
|
+
## CLI
|
|
122
97
|
|
|
123
98
|
```bash
|
|
124
|
-
colana # Start the dashboard
|
|
99
|
+
colana # Start the dashboard
|
|
125
100
|
colana --version # Show version
|
|
126
|
-
colana
|
|
127
|
-
colana
|
|
128
|
-
colana doctor --verbose # Detailed diagnostics with provider paths
|
|
129
|
-
|
|
130
|
-
colana admin create-key --name "User" --type pro --email user@example.com
|
|
131
|
-
colana admin list-keys [--type <type>] [--status <active|revoked>] [--format table|csv|json]
|
|
132
|
-
colana admin revoke-key --name "User"
|
|
133
|
-
colana admin key-info --name "User"
|
|
134
|
-
colana admin update-key --name "User" [--expires <date>] [--max-machines <n>]
|
|
135
|
-
colana admin staff-keys
|
|
136
|
-
|
|
137
|
-
colana service install # Auto-start on login (systemd / LaunchAgent / Registry)
|
|
138
|
-
colana service uninstall
|
|
139
|
-
colana service status
|
|
140
|
-
colana service logs
|
|
101
|
+
colana doctor # Check system health
|
|
102
|
+
colana service install # Auto-start on login
|
|
141
103
|
```
|
|
142
104
|
|
|
143
|
-
See [docs/CLI.md](docs/CLI.md) for the full CLI reference.
|
|
144
|
-
|
|
145
105
|
## Keyboard Shortcuts
|
|
146
106
|
|
|
147
107
|
| Shortcut | Action |
|
|
148
108
|
|----------|--------|
|
|
149
|
-
| `Ctrl+K` |
|
|
109
|
+
| `Ctrl+K` | Command palette |
|
|
150
110
|
| `Ctrl+B` | Toggle sidebar |
|
|
151
|
-
| `` Ctrl+` `` |
|
|
152
|
-
| `
|
|
153
|
-
| `F11` | Maximize current agent |
|
|
154
|
-
| `Esc` | Exit maximize / close modal |
|
|
155
|
-
|
|
156
|
-
## Environment Variables
|
|
157
|
-
|
|
158
|
-
All optional. Defaults work for local use.
|
|
159
|
-
|
|
160
|
-
| Variable | Default | Description |
|
|
161
|
-
|----------|---------|-------------|
|
|
162
|
-
| `START_PORT` | `9876` | First port to scan |
|
|
163
|
-
| `DATA_DIR` | `./data` | SQLite database + logs directory |
|
|
164
|
-
| `ENCRYPTION_KEY` | auto-generated | AES-256-GCM key for stored secrets |
|
|
165
|
-
| `BIND_ADDRESS` | `127.0.0.1` | Server bind address |
|
|
166
|
-
| `PTY_BUFFER_SIZE` | `262144` | PTY ring buffer in bytes (256 KB) |
|
|
167
|
-
| `SHUTDOWN_TIMEOUT_MS` | `10000` | Graceful shutdown timeout |
|
|
168
|
-
| `FREE_MAX_SESSIONS` | `2` | Free tier concurrent session limit |
|
|
169
|
-
| `LOG_RETENTION_DAYS` | `0` | Log retention in days (0 = keep all) |
|
|
170
|
-
|
|
171
|
-
See [docs/CONFIGURATION.md](docs/CONFIGURATION.md) for all 30+ configuration options.
|
|
172
|
-
|
|
173
|
-
## Tech Stack
|
|
174
|
-
|
|
175
|
-
| Layer | Technology |
|
|
176
|
-
|-------|------------|
|
|
177
|
-
| **Backend** | Node.js + Express + WebSocket (ws) |
|
|
178
|
-
| **Database** | SQLite via sql.js (WASM — zero native compilation) |
|
|
179
|
-
| **Terminal** | node-pty for PTY emulation |
|
|
180
|
-
| **Frontend** | Vanilla HTML / CSS / JS (no build step) |
|
|
181
|
-
| **Validation** | Zod (schema validation on all inputs) |
|
|
182
|
-
| **Rate Limiting** | express-rate-limit (4-tier) |
|
|
183
|
-
| **Encryption** | AES-256-GCM for stored secrets |
|
|
184
|
-
| **Testing** | Vitest (unit) + Playwright (E2E) |
|
|
185
|
-
| **Licensing** | Polar.sh (Merchant of Record) |
|
|
186
|
-
| **Distribution** | npm (global package with prebuilt binaries) |
|
|
187
|
-
|
|
188
|
-
## Project Structure
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
colana/
|
|
192
|
-
├── bin/
|
|
193
|
-
│ ├── colana.js # CLI entry point + first-run wizard + doctor
|
|
194
|
-
│ └── admin.js # Admin CLI (key management, diagnostics)
|
|
195
|
-
├── server/
|
|
196
|
-
│ ├── index.js # Express + WebSocket server entry
|
|
197
|
-
│ ├── config.js # Provider definitions (6 providers), Polar.sh config
|
|
198
|
-
│ ├── db.js # SQLite schema + migration system
|
|
199
|
-
│ ├── agent-manager.js # Agent spawn/stop (headless JSON mode)
|
|
200
|
-
│ ├── pty-manager.js # PTY terminal management + idle cleanup
|
|
201
|
-
│ ├── session-store.js # Session CRUD + log persistence
|
|
202
|
-
│ ├── project-store.js # Project CRUD
|
|
203
|
-
│ ├── settings-store.js # Settings + API key encryption
|
|
204
|
-
│ ├── template-store.js # Task template CRUD
|
|
205
|
-
│ ├── snippet-store.js # Clipboard snippet CRUD
|
|
206
|
-
│ ├── license.js # Polar.sh license validation + cache
|
|
207
|
-
│ ├── key-manager.js # SQLite-stored license key CRUD
|
|
208
|
-
│ ├── admin.js # Admin panel API routes
|
|
209
|
-
│ ├── analytics.js # Anonymous product analytics
|
|
210
|
-
│ ├── validation.js # Zod schemas + validation middleware
|
|
211
|
-
│ ├── logger.js # Structured JSONL logging + rotation
|
|
212
|
-
│ ├── context-sync.js # Multi-agent context sharing (AGENTS.md)
|
|
213
|
-
│ ├── worktree-manager.js # Safe Parallel Mode (git worktree isolation)
|
|
214
|
-
│ ├── integration-hub.js # MCP integration catalog + config
|
|
215
|
-
│ ├── openclaw-config.js # OpenClaw config reader/writer
|
|
216
|
-
│ ├── updater.js # Auto-update checker (npm registry)
|
|
217
|
-
│ ├── port-finder.js # Auto-detect free port
|
|
218
|
-
│ ├── platform.js # Cross-platform utilities
|
|
219
|
-
│ ├── service-manager.js # System service (systemd, LaunchAgent, Registry)
|
|
220
|
-
│ └── ...routes.js # 15+ route modules (sessions, projects, agents, etc.)
|
|
221
|
-
├── public/
|
|
222
|
-
│ ├── index.html # Main dashboard SPA
|
|
223
|
-
│ ├── admin.html # Admin panel
|
|
224
|
-
│ ├── wizard.html # Onboarding wizard
|
|
225
|
-
│ ├── agent.html # Pop-out agent window
|
|
226
|
-
│ ├── agent-split.html # Split-pane agent view
|
|
227
|
-
│ ├── styles.css # Dark theme styling
|
|
228
|
-
│ ├── app.js # Dashboard logic
|
|
229
|
-
│ ├── manifest.json # PWA manifest
|
|
230
|
-
│ ├── service-worker.js # PWA service worker
|
|
231
|
-
│ └── vendor/ # Local vendor libs (marked, highlight.js)
|
|
232
|
-
├── scripts/
|
|
233
|
-
│ ├── build.js # Build pipeline (esbuild + bytenode + obfuscator)
|
|
234
|
-
│ ├── prebuild.js # Compile node-pty for current platform
|
|
235
|
-
│ └── release.sh # Release automation
|
|
236
|
-
├── .github/workflows/
|
|
237
|
-
│ ├── ci.yml # CI: cross-platform test matrix
|
|
238
|
-
│ └── release.yml # Release: prebuild + npm publish
|
|
239
|
-
├── test/
|
|
240
|
-
│ ├── server/ # Vitest unit tests (90+ files)
|
|
241
|
-
│ └── e2e/ # Playwright E2E tests
|
|
242
|
-
├── docs/ # Documentation
|
|
243
|
-
│ ├── CLI.md # CLI reference
|
|
244
|
-
│ ├── PROVIDERS.md # Provider setup guides
|
|
245
|
-
│ ├── CONFIGURATION.md # Configuration reference
|
|
246
|
-
│ ├── TROUBLESHOOTING.md # FAQ and common issues
|
|
247
|
-
│ └── API.md # REST + WebSocket API reference
|
|
248
|
-
└── data/ # Created at runtime
|
|
249
|
-
├── dashboard.db # SQLite database
|
|
250
|
-
├── encryption.key # Auto-generated encryption key
|
|
251
|
-
├── backups/ # Daily database backups
|
|
252
|
-
├── logs/ # Server + agent JSONL logs
|
|
253
|
-
└── worktrees/ # Safe Parallel Mode worktrees
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
## Development
|
|
257
|
-
|
|
258
|
-
```bash
|
|
259
|
-
git clone https://github.com/colana-ai/colana.git
|
|
260
|
-
cd colana
|
|
261
|
-
npm install
|
|
262
|
-
|
|
263
|
-
npm run dev # Start dev server (port 9877, auto-reload)
|
|
264
|
-
npm test # Run unit tests (Vitest)
|
|
265
|
-
npm run test:e2e # Run E2E tests (Playwright)
|
|
266
|
-
npm run test:all # Run both unit and E2E tests
|
|
267
|
-
npm run build # Build dist/ for npm publish
|
|
268
|
-
npm run release # Test + build + publish + tag
|
|
269
|
-
```
|
|
111
|
+
| `` Ctrl+` `` | Personal Agent panel |
|
|
112
|
+
| `F11` | Fullscreen |
|
|
270
113
|
|
|
271
114
|
## FAQ
|
|
272
115
|
|
|
273
116
|
**Do I need API keys for all providers?**
|
|
274
|
-
No. Install only the
|
|
117
|
+
No. Install only the ones you use. Gemini CLI works with just a Google account.
|
|
275
118
|
|
|
276
119
|
**Does co:lana send my code anywhere?**
|
|
277
|
-
No.
|
|
120
|
+
No. Everything runs locally on your machine. Your code never leaves your filesystem.
|
|
278
121
|
|
|
279
122
|
**Can I use co:lana without paying?**
|
|
280
|
-
Yes.
|
|
123
|
+
Yes. Free tier is the full product with no expiry. The only limit is 2 concurrent sessions.
|
|
281
124
|
|
|
282
125
|
**What happens if the server crashes?**
|
|
283
|
-
Sessions are persisted
|
|
126
|
+
Sessions are persisted and auto-resume on restart.
|
|
284
127
|
|
|
285
128
|
**Does it work on Windows?**
|
|
286
|
-
Yes, via WSL2 (recommended). Native Windows
|
|
287
|
-
|
|
288
|
-
**Can multiple users share one instance?**
|
|
289
|
-
co:lana is designed for single-user local use. It binds to `127.0.0.1` by default. For multi-user setups, each user runs their own instance.
|
|
129
|
+
Yes, via WSL2 (recommended). Native Windows is also supported.
|
|
290
130
|
|
|
291
131
|
**How do I update?**
|
|
292
|
-
co:lana checks for updates automatically and shows an in-app banner
|
|
132
|
+
co:lana checks for updates automatically and shows an in-app banner, or run `npm update -g colana`.
|
|
293
133
|
|
|
294
134
|
**Where is my data stored?**
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
## Documentation
|
|
298
|
-
|
|
299
|
-
- [CLI Reference](docs/CLI.md) — all commands, flags, and options
|
|
300
|
-
- [Provider Setup](docs/PROVIDERS.md) — per-provider installation and authentication
|
|
301
|
-
- [Configuration](docs/CONFIGURATION.md) — environment variables and settings
|
|
302
|
-
- [Troubleshooting](docs/TROUBLESHOOTING.md) — common issues and fixes
|
|
303
|
-
- [API Reference](docs/API.md) — REST endpoints and WebSocket protocol
|
|
304
|
-
- [Security Policy](SECURITY.md) — vulnerability reporting
|
|
305
|
-
- [Support](SUPPORT.md) — how to get help
|
|
135
|
+
Locally in the `data/` directory — database, encrypted API keys, and logs.
|
|
306
136
|
|
|
307
137
|
## Support
|
|
308
138
|
|
|
309
|
-
- **Bug reports** — [GitHub Issues](https://github.com/colana-ai/colana/issues/new?template=bug_report.yml)
|
|
310
|
-
- **Feature requests** — [GitHub Issues](https://github.com/colana-ai/colana/issues/new?template=feature_request.yml)
|
|
311
|
-
- **Security** — [security@colana.ai](mailto:security@colana.ai) (see [SECURITY.md](SECURITY.md))
|
|
312
|
-
- **Licensing** — [support@colana.ai](mailto:support@colana.ai) or [Polar.sh dashboard](https://polar.sh)
|
|
313
139
|
- **Website** — [colana.ai](https://colana.ai)
|
|
140
|
+
- **Email** — [support@colana.ai](mailto:support@colana.ai)
|
|
141
|
+
- **Security** — [security@colana.ai](mailto:security@colana.ai)
|
|
314
142
|
|
|
315
143
|
## License
|
|
316
144
|
|
|
317
|
-
Proprietary. See [LICENSE](LICENSE) for terms.
|
|
145
|
+
Proprietary. See [LICENSE](LICENSE) for terms.
|
|
318
146
|
|
|
319
147
|
Copyright (c) 2025-2026 Colana. All rights reserved.
|
package/bin/admin.js
CHANGED
|
@@ -156,12 +156,14 @@ async function createKey(flags) {
|
|
|
156
156
|
console.error(`\n ${icons.fail} ${c.error}ERROR: --name is required.${c.reset}\n`);
|
|
157
157
|
console.error(' Usage: colana admin create-key --name "Sarah" --type staff [--email x] [--expires 2026-12-31]\n');
|
|
158
158
|
process.exit(1);
|
|
159
|
+
return;
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
const validTypes = ['admin', 'staff', 'beta'];
|
|
162
163
|
if (!validTypes.includes(type)) {
|
|
163
164
|
console.error(`\n ${icons.fail} ${c.error}ERROR: Invalid type "${type}". Must be one of: ${validTypes.join(', ')}${c.reset}\n`);
|
|
164
165
|
process.exit(1);
|
|
166
|
+
return;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
// Prefer server API (avoids sql.js in-memory DB conflict)
|
|
@@ -174,6 +176,7 @@ async function createKey(flags) {
|
|
|
174
176
|
} catch (err) {
|
|
175
177
|
console.error(`\n ${icons.fail} ${c.error}${err.message}${c.reset} ${c.muted}(via server)${c.reset}\n`);
|
|
176
178
|
process.exit(1);
|
|
179
|
+
return;
|
|
177
180
|
}
|
|
178
181
|
} else {
|
|
179
182
|
// Fallback: direct DB access (only safe when server is NOT running)
|
|
@@ -184,9 +187,16 @@ async function createKey(flags) {
|
|
|
184
187
|
} catch (err) {
|
|
185
188
|
console.error(`\n ${icons.fail} ${c.error}${err.message}${c.reset}\n`);
|
|
186
189
|
process.exit(1);
|
|
190
|
+
return;
|
|
187
191
|
}
|
|
188
192
|
}
|
|
189
193
|
|
|
194
|
+
if (!result || !result.name) {
|
|
195
|
+
console.error(`\n ${icons.fail} ${c.error}Key generation returned an unexpected response.${c.reset}\n`);
|
|
196
|
+
process.exit(1);
|
|
197
|
+
return; // Guard for test environments where process.exit is mocked
|
|
198
|
+
}
|
|
199
|
+
|
|
190
200
|
console.log('');
|
|
191
201
|
console.log(` ${icons.pass} Key generated successfully!`);
|
|
192
202
|
console.log(` ${c.muted}${'─'.repeat(40)}${c.reset}`);
|
|
@@ -219,6 +229,7 @@ async function listKeysCmd(flags) {
|
|
|
219
229
|
} catch (err) {
|
|
220
230
|
console.error(`\n ${icons.fail} ${c.error}${err.message}${c.reset} ${c.muted}(via server)${c.reset}\n`);
|
|
221
231
|
process.exit(1);
|
|
232
|
+
return;
|
|
222
233
|
}
|
|
223
234
|
} else {
|
|
224
235
|
await ensureDb();
|
|
@@ -226,7 +237,7 @@ async function listKeysCmd(flags) {
|
|
|
226
237
|
result = listKeys(filters);
|
|
227
238
|
}
|
|
228
239
|
|
|
229
|
-
if (!result.keys.length) {
|
|
240
|
+
if (!result || !result.keys || !result.keys.length) {
|
|
230
241
|
console.log('\n No keys found.\n');
|
|
231
242
|
return;
|
|
232
243
|
}
|
|
@@ -257,6 +268,7 @@ async function revokeKeyCmd(positional) {
|
|
|
257
268
|
console.error(`\n ${icons.fail} ${c.error}ERROR: Key ID is required.${c.reset}\n`);
|
|
258
269
|
console.error(' Usage: colana admin revoke-key <id>\n');
|
|
259
270
|
process.exit(1);
|
|
271
|
+
return;
|
|
260
272
|
}
|
|
261
273
|
|
|
262
274
|
// Prefer server API
|
|
@@ -269,6 +281,7 @@ async function revokeKeyCmd(positional) {
|
|
|
269
281
|
} catch (err) {
|
|
270
282
|
console.error(`\n ${icons.fail} ${c.error}${err.message}${c.reset} ${c.muted}(via server)${c.reset}\n`);
|
|
271
283
|
process.exit(1);
|
|
284
|
+
return;
|
|
272
285
|
}
|
|
273
286
|
} else {
|
|
274
287
|
await ensureDb();
|
|
@@ -279,6 +292,7 @@ async function revokeKeyCmd(positional) {
|
|
|
279
292
|
} catch (err) {
|
|
280
293
|
console.error(`\n ${icons.fail} ${c.error}${err.message}${c.reset}\n`);
|
|
281
294
|
process.exit(1);
|
|
295
|
+
return;
|
|
282
296
|
}
|
|
283
297
|
}
|
|
284
298
|
}
|
|
@@ -375,7 +389,11 @@ async function main() {
|
|
|
375
389
|
console.error(` ${icons.fail} Unknown command: ${c.value}${command}${c.reset}`);
|
|
376
390
|
console.error(` ${c.muted}Run "colana admin help" for usage.${c.reset}`);
|
|
377
391
|
process.exit(1);
|
|
392
|
+
return;
|
|
378
393
|
}
|
|
379
394
|
}
|
|
380
395
|
|
|
381
|
-
main()
|
|
396
|
+
main().catch((err) => {
|
|
397
|
+
console.error(` ${icons.fail} ${c.error}${err.message || err}${c.reset}`);
|
|
398
|
+
process.exit(1);
|
|
399
|
+
});
|