Skip to content

Commit c398521

Browse files
docs: agent-first README rewrite, stale docs cleanup
- README.md rewritten: relay auth as default (no GCP needed), agent-first quick start, all 18+ services, DOCX editing, safety flags, skills/plugin auto-installed by install.sh, gog companion mentioned - INSTALL.md rewritten: relay auth default, BYO GCP as optional advanced, removed OpenClaw/build-internal/build-automagik/baked-in references - docs/auth.md restructured: relay auth opens the doc, BYO GCP moved to advanced section - docs/headless-auth.md: fix broken link to deleted infrastructure.md - Deleted stale internal docs: deployment.md, infrastructure.md - Deleted orphaned skills/workit/ (canonical is plugins/workit/skills/)
1 parent 3c09c98 commit c398521

34 files changed

Lines changed: 490 additions & 2225 deletions

INSTALL.md

Lines changed: 84 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# workit — Installation Guide
22

3-
> Give your OpenClaw agent full access to Google Workspace (Gmail, Calendar, Drive, Docs, Sheets, Contacts, Tasks, and more) via CLI.
3+
> Give your agent full access to Google Workspace (Gmail, Calendar, Drive, Docs, Sheets, Contacts, Tasks, and more) via CLI.
4+
5+
---
46

57
## 1. Quick Install (Recommended)
68

@@ -47,172 +49,126 @@ wk update
4749

4850
---
4951

50-
## 2. Configure Credentials
51-
52-
**Option A: Pre-built binary (recommended for internal use)**
53-
54-
If the binary was built with `make build-internal`, it already has OAuth credentials baked in. Skip to step 3.
52+
## 2. What Gets Installed
5553

56-
**Option B: Environment variables**
57-
58-
```bash
59-
export WK_CLIENT_ID="your-client-id"
60-
export WK_CLIENT_SECRET="your-client-secret"
61-
export WK_CALLBACK_SERVER="https://auth.example.com"
62-
```
54+
The installer places the following on your system:
6355

64-
**Option C: Credentials file (standard workit way)**
56+
| Path | Description |
57+
|------|-------------|
58+
| `~/.local/bin/wk` | The `wk` CLI binary |
59+
| `~/.local/bin/gog` | The `gog` companion binary |
60+
| `~/.workit/plugin/` | Plugin directory containing 28 skills |
61+
| `~/.claude/plugins/workit` | Symlink registering the plugin with Claude Code |
6562

66-
```bash
67-
wk auth credentials ~/path/to/client_secret.json
68-
```
63+
The Claude Code symlink means Claude Code automatically picks up the `wk` skills — no manual configuration required.
6964

7065
---
7166

72-
## 3. Authenticate a Google Account
67+
## 3. Authentication
7368

74-
### For agents (headless — no browser needed):
69+
Authentication uses the **Automagik relay** at `auth.automagik.dev`. No GCP project setup is needed by default.
7570

76-
```bash
77-
# Start headless auth flow
78-
wk auth add you@gmail.com --headless --services=user
79-
80-
# Output:
81-
# Visit this URL to authorize:
82-
# https://accounts.google.com/o/oauth2/v2/auth?...
83-
# Waiting for authorization...
84-
```
85-
86-
The agent sends this URL to the user (via WhatsApp, Telegram, etc). User taps the link on their phone, logs in, and the CLI automatically picks up the token.
87-
88-
### For interactive use (has browser):
71+
### Interactive (default)
8972

9073
```bash
91-
wk auth add you@gmail.com --services=user
92-
# Opens browser, complete login, done.
74+
wk auth manage
9375
```
9476

95-
---
96-
97-
## 4. Set Up Keyring (Headless Environments)
77+
This opens a browser-based flow. Log in with your Google account and the token is stored locally.
9878

99-
On servers without a desktop keychain:
79+
### Headless (agents and servers without a browser)
10080

10181
```bash
102-
# Use file-based keyring
103-
wk auth keyring file
104-
105-
# Set password via env (for non-interactive use)
106-
export WK_KEYRING_PASSWORD="your-secure-password"
82+
wk auth add user@example.com --headless --no-input
10783
```
10884

109-
---
85+
The command prints an authorization URL. Send that URL to the user (via chat, email, etc.). When they complete the login in their browser, the CLI automatically receives the token.
11086

111-
## 5. Verify It Works
87+
### Check Auth Status
11288

11389
```bash
114-
# Check auth status
115-
wk auth list --check
90+
# Show auth state for all accounts
91+
wk auth status
11692

117-
# Test some commands
118-
wk gmail labels list --account you@gmail.com
119-
wk drive list --account you@gmail.com
120-
wk calendar events list --account you@gmail.com
93+
# List authenticated accounts
94+
wk auth list
12195
```
12296

12397
---
12498

125-
## 6. Add to OpenClaw Config
99+
## 4. Advanced: BYO GCP Credentials (Optional)
126100

127-
Add `wk` to your agent's workspace. In your agent's `TOOLS.md`:
101+
> This section is for users who want to use their own Google Cloud OAuth client instead of the Automagik relay. Most users do not need this.
128102
129-
```markdown
130-
## Google Workspace (workit)
103+
### Steps
131104

132-
Access Gmail, Calendar, Drive, Docs, Sheets, Contacts, Tasks via `wk` CLI.
105+
1. Go to [Google Cloud Console](https://console.cloud.google.com/) and create an OAuth 2.0 client ID (Desktop app type).
106+
2. Download the `client_secret_*.json` file.
107+
3. Register it with `wk`:
133108

134-
### Auth
135-
- `wk auth list --check` — Check authenticated accounts
136-
- `wk auth add EMAIL --headless --services=user` — Auth a new account (sends URL for mobile login)
137-
- `wk auth status` — Show current auth state
109+
```bash
110+
wk auth credentials ~/path/to/client_secret.json
111+
```
138112

139-
### Gmail
140-
- `wk gmail search "newer_than:1d" --account EMAIL` — Search recent emails
141-
- `wk gmail send --to X --subject Y --body Z --account EMAIL` — Send email
142-
- `wk gmail labels list --account EMAIL` — List labels
113+
For environments with multiple OAuth clients:
143114

144-
### Calendar
145-
- `wk calendar events list --account EMAIL` — List upcoming events
146-
- `wk calendar events create --title "Meeting" --start "2025-01-15T10:00" --account EMAIL`
115+
```bash
116+
# Register and name a specific client
117+
wk auth credentials ~/path/to/client_secret.json --name my-project
147118

148-
### Drive
149-
- `wk drive list --account EMAIL` — List files
150-
- `wk drive upload FILE --account EMAIL` — Upload a file
151-
- `wk drive download FILE_ID --account EMAIL` — Download a file
152-
- `wk drive search "name contains 'report'" --account EMAIL`
119+
# List registered credential sets
120+
wk auth credentials list
153121

154-
### Drive Sync (bidirectional)
155-
- `wk sync init ~/drive-folder --drive-folder "My Folder" --account EMAIL`
156-
- `wk sync start ~/drive-folder --daemon --account EMAIL`
157-
- `wk sync status`
158-
- `wk sync stop`
122+
# Select which credential set to use
123+
wk auth credentials use my-project
124+
```
159125

160-
### Docs & Sheets
161-
- `wk docs export DOC_ID --format pdf --account EMAIL`
162-
- `wk sheets read SHEET_ID --range "A1:D10" --account EMAIL`
163-
- `wk sheets write SHEET_ID --range "A1" --values '["hello","world"]' --account EMAIL`
126+
After registering credentials, run `wk auth manage` or `wk auth add` as normal.
164127

165-
### Contacts & Tasks
166-
- `wk contacts search "John" --account EMAIL`
167-
- `wk tasks list --account EMAIL`
168-
- `wk tasks add "Buy milk" --account EMAIL`
128+
---
169129

170-
### Tips
171-
- Add `--json` to any command for machine-parseable output
172-
- Use `--account EMAIL` or set `WK_ACCOUNT=EMAIL` globally
173-
- Multiple accounts supported: `wk auth add second@gmail.com`
174-
```
130+
## 5. Keyring Configuration
175131

176-
---
132+
`wk` stores tokens in the system keyring. The default backend is chosen automatically:
133+
134+
| Platform | Default Backend |
135+
|----------|----------------|
136+
| macOS | macOS Keychain |
137+
| Linux (desktop) | GNOME Keyring |
138+
| Windows | Windows Credential Manager |
139+
| Linux (headless) | File backend (see below) |
177140

178-
## 7. Drive Sync Setup (optional)
141+
### File Backend (Headless / Server Environments)
179142

180-
To sync a Google Drive folder to a local directory:
143+
On servers without a desktop keyring, use the file backend:
181144

182145
```bash
183-
# Initialize sync for a folder
184-
wk sync init ~/my-drive --drive-folder "Work Documents" --account you@gmail.com
146+
export WK_KEYRING_BACKEND=file
147+
export WK_KEYRING_PASSWORD="your-secure-passphrase"
148+
```
185149

186-
# Start sync daemon (runs in background)
187-
wk sync start ~/my-drive --daemon --account you@gmail.com
150+
Add these to your shell profile or systemd environment to persist across sessions.
188151

189-
# Check status
190-
wk sync status
152+
### Service Account
191153

192-
# Stop sync
193-
wk sync stop
154+
For server-to-server automation without interactive login:
194155

195-
# Add more folders
196-
wk sync init ~/another-folder --drive-folder "Photos" --account you@gmail.com
197-
wk sync start ~/another-folder --daemon --account you@gmail.com
156+
```bash
157+
wk auth service-account set --key /path/to/key.json impersonate@company.com
198158
```
199159

200-
Changes sync bidirectionally:
201-
- Save a local file → uploaded to Drive within seconds
202-
- Edit on Drive web → downloaded locally within 5 seconds
203-
204160
---
205161

206-
## 8. Build from Source (Developer / Contributor)
162+
## 6. Build from Source (Developer / Contributor)
207163

208-
If you want to contribute to workit or build a custom binary, you need Go 1.21+ and the repo cloned locally.
164+
If you want to contribute to workit or build a custom binary, you need Go 1.21+ and GNU Make.
209165

210166
### Requirements
211167

212168
- Go 1.21 or newer — [go.dev/doc/install](https://go.dev/doc/install)
213169
- GNU Make
214170

215-
### Quick Build
171+
### Steps
216172

217173
```bash
218174
git clone https://github.com/automagik-dev/workit.git
@@ -225,66 +181,37 @@ make build
225181

226182
| Target | Description |
227183
|--------|-------------|
228-
| `make build` | Build binary to `bin/wk` (community build, no baked-in credentials) |
229-
| `make build-automagik` | Build with Automagik OAuth credentials (requires internal secrets) |
230-
| `make build-internal` | Build with internal-use baked-in credentials |
231-
| `make tools` | Install dev tools (`gofumpt`, `goimports`, `golangci-lint`) to `.tools/` |
184+
| `make build` | Build binary to `bin/wk` |
232185
| `make test` | Run test suite |
233186
| `make lint` | Run linter |
234187
| `make install` | Install `bin/wk` to `~/.local/bin` |
235188

236-
### Developer Credential Setup
237-
238-
When building from source you need to supply your own OAuth credentials:
239-
240-
```bash
241-
# Option A: Environment variables
242-
export WK_CLIENT_ID="your-client-id"
243-
export WK_CLIENT_SECRET="your-client-secret"
244-
export WK_CALLBACK_SERVER="https://auth.example.com"
245-
246-
# Option B: Credentials file
247-
mkdir -p ~/.config/workit && chmod 700 ~/.config/workit
248-
cat > ~/.config/workit/credentials.env << 'CRED'
249-
WK_CLIENT_ID=your-client-id
250-
WK_CLIENT_SECRET=your-client-secret
251-
WK_CALLBACK_SERVER=https://your-callback-server.example.com
252-
CRED
253-
```
254-
255-
Then build and install:
256-
257-
```bash
258-
make build
259-
make install # copies bin/wk to ~/.local/bin
260-
```
261-
262-
After building, proceed with [Configure Credentials](#2-configure-credentials) above.
189+
After building from source, authenticate using `wk auth manage` or the headless flow described in [Authentication](#3-authentication).
263190

264191
---
265192

266193
## TL;DR for Agents
267194

195+
Copy-paste block to get up and running immediately. Uses relay auth — no GCP setup or credential env vars needed.
196+
268197
```bash
269198
# Install
270199
curl -sSL https://raw.githubusercontent.com/automagik-dev/workit/main/install.sh | sh
271200

272-
# Update
273-
wk update
201+
# Ensure wk is on PATH (add to shell profile if needed)
202+
export PATH="$HOME/.local/bin:$PATH"
274203

275-
# Configure (if not using pre-built binary)
276-
export WK_CLIENT_ID="xxx"
277-
export WK_CLIENT_SECRET="xxx"
278-
export WK_CALLBACK_SERVER="https://auth.example.com"
279-
export WK_KEYRING_BACKEND=file
280-
export WK_KEYRING_PASSWORD="secure-password"
204+
# Check auth status
205+
wk auth status
206+
207+
# Authenticate interactively (opens browser)
208+
wk auth manage
281209

282-
# Auth
283-
wk auth add user@gmail.com --headless --services=user
284-
# → Send the URL to user → they login → done
210+
# Authenticate headlessly (prints URL for user to open)
211+
# wk auth add user@example.com --headless --no-input
285212

286-
# Use
287-
wk gmail search "is:unread" --account user@gmail.com --json
288-
wk drive list --account user@gmail.com --json
289-
wk calendar events list --account user@gmail.com --json
213+
# First queries
214+
wk gmail search "is:unread" --account user@example.com --json
215+
wk drive ls --account user@example.com --json
216+
wk calendar events --account user@example.com --json
290217
```

0 commit comments

Comments
 (0)