@donebear/cli 0.1.0
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/AGENTS.md +49 -0
- package/README.md +197 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +3676 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +46 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +263 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @donebear/cli
|
|
2
|
+
|
|
3
|
+
Done Bear command-line interface for OAuth auth, workspace management, and task workflows.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
Run from repo root:
|
|
8
|
+
|
|
9
|
+
- `npm run build --workspace=packages/donebear-cli` — build with tsdown
|
|
10
|
+
- `npm run dev --workspace=packages/donebear-cli` — watch build
|
|
11
|
+
- `npm run lint --workspace=packages/donebear-cli` — lint with Biome
|
|
12
|
+
- `npm run check-types --workspace=packages/donebear-cli` — TypeScript check
|
|
13
|
+
- `npm run test --workspace=packages/donebear-cli` — Vitest tests
|
|
14
|
+
- `npm exec -- ultracite fix` — format/autofix before commit
|
|
15
|
+
|
|
16
|
+
Run CLI locally from repo root:
|
|
17
|
+
|
|
18
|
+
- `npm exec --workspace=packages/donebear-cli donebear -- --help`
|
|
19
|
+
|
|
20
|
+
## Architecture
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
src/
|
|
24
|
+
cli.ts # Commander entrypoint + global flags
|
|
25
|
+
runtime.ts # context parsing + error handling
|
|
26
|
+
command-context.ts # auth/API/context resolution for commands
|
|
27
|
+
commands/
|
|
28
|
+
auth.ts # auth login/status/logout (default command shows status)
|
|
29
|
+
whoami.ts # current user output
|
|
30
|
+
workspace.ts # workspace list/current/use/clear/create/join (default lists)
|
|
31
|
+
task.ts # task list/show/add/edit/done/reopen/archive/unarchive (default lists open tasks)
|
|
32
|
+
manage-api.ts # typed manage-api HTTP helpers
|
|
33
|
+
workspace-context.ts # workspace slug validation + default resolution
|
|
34
|
+
task-defaults.ts # task view-to-start field mapping
|
|
35
|
+
context-store.ts # local context cache (workspace + clientId)
|
|
36
|
+
auth-session.ts # token precedence + refresh behavior
|
|
37
|
+
supabase.ts # Supabase config + auth client helpers
|
|
38
|
+
oauth-callback.ts # loopback callback server for OAuth
|
|
39
|
+
storage.ts # stored auth session persistence
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Gotchas
|
|
43
|
+
|
|
44
|
+
- OAuth callback defaults to `http://127.0.0.1:8787/auth/callback`; it must be allow-listed in Supabase redirect URLs.
|
|
45
|
+
- Token precedence is `--token` > `DONEBEAR_TOKEN` > stored auth session.
|
|
46
|
+
- API URL precedence is `--api-url` > `DONEBEAR_API_URL` > `NEXT_PUBLIC_RESERVE_MANAGE_API` > `http://127.0.0.1:3001`.
|
|
47
|
+
- Local auth/context files are unencrypted and stored in the OS config dir (`DONEBEAR_CONFIG_DIR` can override).
|
|
48
|
+
- `task` commands accept ID prefixes; prefix resolution is workspace-scoped and may be ambiguous without `--workspace`.
|
|
49
|
+
- Use `--json` for scripts/automation and keep human-readable output as default.
|
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# @donebear/cli
|
|
2
|
+
|
|
3
|
+
Done Bear CLI for OAuth auth, workspace selection, and task workflows against `manage-api`.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
1. Install workspace dependencies from repo root:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Build the CLI package:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build --workspace=packages/donebear-cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Set required environment variables:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
export DONEBEAR_SUPABASE_URL="https://<project-ref>.supabase.co"
|
|
23
|
+
export DONEBEAR_SUPABASE_PUBLISHABLE_KEY="<publishable-or-anon-key>"
|
|
24
|
+
export DONEBEAR_API_URL="http://127.0.0.1:3001"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
4. Define a local runner command:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
CLI="npm exec --workspace=packages/donebear-cli donebear --"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
5. Authenticate and run the core task flow:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
$CLI auth login
|
|
37
|
+
$CLI workspace list
|
|
38
|
+
$CLI workspace use <workspace-id-or-slug>
|
|
39
|
+
$CLI task add "Ship donebear CLI" --when today
|
|
40
|
+
$CLI task list --state open
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## OAuth setup
|
|
44
|
+
|
|
45
|
+
The default callback URL is:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
http://127.0.0.1:8787/auth/callback
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Add that URL to Supabase Auth allowed redirect URLs.
|
|
52
|
+
|
|
53
|
+
Login options:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
$CLI auth login --provider google
|
|
57
|
+
$CLI auth login --provider github --port 8787 --timeout 180
|
|
58
|
+
$CLI auth login --no-open
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Check and clear auth:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
$CLI auth status
|
|
65
|
+
$CLI whoami
|
|
66
|
+
$CLI auth logout
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Core task flows
|
|
70
|
+
|
|
71
|
+
Capture:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
$CLI task add "Draft release notes" --when inbox
|
|
75
|
+
$CLI task add "Pay invoice" --when today --deadline 2026-03-05
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Review:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
$CLI task list --state open --limit 50
|
|
82
|
+
$CLI task list --state all --search invoice
|
|
83
|
+
$CLI task show <task-id-or-prefix>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Triage/edit:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
$CLI task edit <id> --title "Pay vendor invoice"
|
|
90
|
+
$CLI task edit <id> --notes "Waiting for approval" --when upcoming
|
|
91
|
+
$CLI task edit <id> --clear-deadline
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Complete and clean up:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
$CLI task done <id>
|
|
98
|
+
$CLI task reopen <id>
|
|
99
|
+
$CLI task archive <id>
|
|
100
|
+
$CLI task unarchive <id>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Workspace:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
$CLI workspace create "Personal" --slug personal --no-use
|
|
107
|
+
$CLI workspace join <invite-code>
|
|
108
|
+
$CLI workspace clear
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Notes:
|
|
112
|
+
- `task show|done|reopen|archive|unarchive|edit` accept a full task ID or unique ID prefix.
|
|
113
|
+
- Prefix resolution uses your selected workspace, or `--workspace` if provided.
|
|
114
|
+
- `task list` paginates through GraphQL results, so it is not capped at 100 tasks.
|
|
115
|
+
- `donebear auth`, `donebear workspace`, and `donebear task` run sensible defaults (status, list workspaces, list open tasks).
|
|
116
|
+
|
|
117
|
+
## Command reference
|
|
118
|
+
|
|
119
|
+
Global options:
|
|
120
|
+
- `--json` machine-readable output
|
|
121
|
+
- `--token <token>` explicit bearer token
|
|
122
|
+
- `--api-url <url>` manage-api base URL
|
|
123
|
+
- `--debug` include stack traces in failures
|
|
124
|
+
- `--no-color` disable ANSI color
|
|
125
|
+
|
|
126
|
+
Root commands:
|
|
127
|
+
- `auth` (default: status) + login/status/logout
|
|
128
|
+
- `workspace` (default: list) + list/current/use/clear/create/join
|
|
129
|
+
- `task` (default: list open) + list/show/add/edit/done/reopen/archive/unarchive
|
|
130
|
+
- `whoami` print current authenticated user (`me` alias)
|
|
131
|
+
|
|
132
|
+
Run `donebear <command> --help` for aliases and short flags.
|
|
133
|
+
|
|
134
|
+
## JSON and automation
|
|
135
|
+
|
|
136
|
+
Example: pick current workspace id:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
$CLI workspace current --json | jq -r '.workspace.id'
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Example: list open task titles:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
$CLI task list --state open --json | jq -r '.tasks[].title'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Auth token precedence:
|
|
149
|
+
1. `--token <token>`
|
|
150
|
+
2. `DONEBEAR_TOKEN`
|
|
151
|
+
3. stored session (`auth login`)
|
|
152
|
+
|
|
153
|
+
## Environment variables
|
|
154
|
+
|
|
155
|
+
| Variable | Purpose | Default / fallback |
|
|
156
|
+
| --- | --- | --- |
|
|
157
|
+
| `DONEBEAR_SUPABASE_URL` | Supabase project URL for OAuth | fallback: `NEXT_PUBLIC_SUPABASE_URL`, `SUPABASE_URL` |
|
|
158
|
+
| `DONEBEAR_SUPABASE_PUBLISHABLE_KEY` | Supabase publishable/anon key | fallback: `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY`, `SUPABASE_ANON_KEY` |
|
|
159
|
+
| `DONEBEAR_API_URL` | manage-api base URL | fallback: `NEXT_PUBLIC_RESERVE_MANAGE_API`, default `http://127.0.0.1:3001` |
|
|
160
|
+
| `DONEBEAR_TOKEN` | non-interactive bearer token | none |
|
|
161
|
+
| `DONEBEAR_CONFIG_DIR` | override local config/cache directory | OS config dir + `/donebear` |
|
|
162
|
+
| `DONEBEAR_DEBUG` | enable debug logging (`1`) | disabled |
|
|
163
|
+
|
|
164
|
+
## Exit codes
|
|
165
|
+
|
|
166
|
+
| Code | Meaning |
|
|
167
|
+
| --- | --- |
|
|
168
|
+
| `0` | Success |
|
|
169
|
+
| `1` | General error |
|
|
170
|
+
| `2` | Cancelled or timeout |
|
|
171
|
+
| `4` | Authentication required |
|
|
172
|
+
|
|
173
|
+
## Troubleshooting
|
|
174
|
+
|
|
175
|
+
| Symptom | Cause | Fix |
|
|
176
|
+
| --- | --- | --- |
|
|
177
|
+
| `Not authenticated. Run donebear auth login.` | Missing or expired token | Run `$CLI auth login`, or pass `--token` |
|
|
178
|
+
| OAuth times out waiting for callback | Callback URL/port mismatch or blocked browser redirect | Verify Supabase redirect URL and retry with `--port` or `--no-open` |
|
|
179
|
+
| `No default workspace selected.` | Multiple workspaces and none selected | Run `$CLI workspace use <id-or-slug>` |
|
|
180
|
+
| `Task prefix "..." is ambiguous` | Prefix matches multiple tasks | Use full task ID from `task list` |
|
|
181
|
+
|
|
182
|
+
## Development
|
|
183
|
+
|
|
184
|
+
From repo root:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm run lint --workspace=packages/donebear-cli
|
|
188
|
+
npm run check-types --workspace=packages/donebear-cli
|
|
189
|
+
npm run test --workspace=packages/donebear-cli
|
|
190
|
+
npm run build --workspace=packages/donebear-cli
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Package-local start command:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm run start --workspace=packages/donebear-cli
|
|
197
|
+
```
|
package/dist/cli.d.mts
ADDED