@datatamer.ai/agentdev 1.0.1

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 ADDED
@@ -0,0 +1,283 @@
1
+ # AgentDev CLI
2
+
3
+ Distributed agent client for processing GitHub tickets autonomously. Agents poll a central server for work, claim tickets from a GitHub Projects board, execute them using Claude Code, and report results back.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ cd packages/agentdev-client
9
+ npm install
10
+ npm link # Makes `agentdev` available globally
11
+ ```
12
+
13
+ **Prerequisites:** Node.js >= 18, Claude Code CLI (`claude`) installed and authenticated.
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ # 1. Register with the AgentDev platform
19
+ agentdev register -u https://agentdev.datatamer.ai
20
+
21
+ # 2. Start processing tickets (cron mode, 1-minute interval)
22
+ agentdev cron --interval 1
23
+
24
+ # 3. Or run as a continuous daemon
25
+ agentdev start
26
+ ```
27
+
28
+ ## Architecture
29
+
30
+ ```
31
+ ┌─────────────────────────────────────────────────────────┐
32
+ │ AgentDev WebUI (agentdev-webui/) │
33
+ │ ├── GitHub Projects board integration │
34
+ │ ├── SSE real-time ticket/log streaming │
35
+ │ └── REST API for agent communication │
36
+ └────────────────────┬────────────────────────────────────┘
37
+ │ HTTP (heartbeat, claim, logs, complete)
38
+ ┌────────────────────▼────────────────────────────────────┐
39
+ │ AgentDev Client (packages/agentdev-client/) │
40
+ │ ├── Polls server for tickets to claim │
41
+ │ ├── Spawns Claude Code with auto-ticket-workflow skill │
42
+ │ ├── Streams logs back to server in real-time │
43
+ │ ├── Polls GitHub comments for live instruction updates │
44
+ │ └── Reports completion status │
45
+ └────────────────────┬────────────────────────────────────┘
46
+ │ spawns
47
+ ┌────────────────────▼────────────────────────────────────┐
48
+ │ Claude Code CLI │
49
+ │ ├── Reads ticket from GitHub │
50
+ │ ├── Creates OpenSpec, implements, tests, deploys │
51
+ │ └── Moves ticket through board columns │
52
+ └─────────────────────────────────────────────────────────┘
53
+ ```
54
+
55
+ ## Commands
56
+
57
+ ### `agentdev register`
58
+
59
+ Register this machine as an agent with the AgentDev platform.
60
+
61
+ ```bash
62
+ agentdev register [-u, --url <url>] [-n, --name <name>]
63
+ ```
64
+
65
+ | Option | Default | Description |
66
+ |--------|---------|-------------|
67
+ | `-u, --url` | `https://agentdev.datatamer.ai` | WebUI server URL |
68
+ | `-n, --name` | system hostname | Agent display name |
69
+
70
+ Performs OAuth device flow authentication, saves agent token and GitHub project board configuration to `~/.config/agentdev/config.json`.
71
+
72
+ ### `agentdev start`
73
+
74
+ Run as a continuous daemon that polls for work every 10 seconds.
75
+
76
+ ```bash
77
+ agentdev start [-c, --concurrent <number>]
78
+ ```
79
+
80
+ | Option | Default | Description |
81
+ |--------|---------|-------------|
82
+ | `-c, --concurrent` | `1` | Max concurrent tickets (currently sequential) |
83
+
84
+ On startup, scans the GitHub Projects board for leftover tickets (In Progress, test status) and resumes them before polling the server for new work.
85
+
86
+ ### `agentdev cron`
87
+
88
+ Run in batch mode — process all available tickets per cycle, then sleep.
89
+
90
+ ```bash
91
+ agentdev cron [-i, --interval <minutes>] [-m, --max-tickets <number>]
92
+ ```
93
+
94
+ | Option | Default | Description |
95
+ |--------|---------|-------------|
96
+ | `-i, --interval` | `5` | Minutes between polling cycles |
97
+ | `-m, --max-tickets` | `10` | Max tickets to process per cycle |
98
+
99
+ Same leftover-ticket scan as `start` on startup. Preferred mode for running as a background process:
100
+
101
+ ```bash
102
+ # Start as background process
103
+ nohup agentdev cron --interval 1 > /tmp/agentdev-cron.log 2>&1 &
104
+
105
+ # Monitor logs
106
+ tail -f /tmp/agentdev-cron.log
107
+ ```
108
+
109
+ ### `agentdev status`
110
+
111
+ Show agent registration status and configuration.
112
+
113
+ ```bash
114
+ agentdev status
115
+ ```
116
+
117
+ ### `agentdev config`
118
+
119
+ Read or write configuration values.
120
+
121
+ ```bash
122
+ agentdev config get # Show all config
123
+ agentdev config get <key> # Show specific key
124
+ agentdev config set <key> <value>
125
+ ```
126
+
127
+ Config is stored at `~/.config/agentdev/config.json`. Keys include:
128
+
129
+ | Key | Description |
130
+ |-----|-------------|
131
+ | `api_url` | AgentDev server URL |
132
+ | `agent_token` | Auth token (set by register) |
133
+ | `agent_id` | Agent identifier (set by register) |
134
+ | `agent_name` | Display name |
135
+ | `github_org` | GitHub organization (`data-tamer`) |
136
+ | `project_id` | GitHub Projects v2 node ID |
137
+ | `project_number` | GitHub Projects board number |
138
+ | `status_field_id` | Projects status field ID |
139
+ | `status_options` | Map of status column option IDs (`TODO`, `IN_PROGRESS`, `TEST`, `DONE`) |
140
+
141
+ ### `agentdev ticket create`
142
+
143
+ Create a GitHub issue and add it to the project board as Todo.
144
+
145
+ ```bash
146
+ agentdev ticket create -R <repo> --title <title> [--body <body>] [--body-file <file>] [--no-claude] [--json]
147
+ ```
148
+
149
+ | Option | Default | Description |
150
+ |--------|---------|-------------|
151
+ | `-R, --repo` | required | Repository name (under the configured org) |
152
+ | `--title` | required | Issue title |
153
+ | `--body` | `""` | Issue body text |
154
+ | `--body-file` | — | Read body from file |
155
+ | `--claude` | `true` | Append `@claude` tag to body |
156
+ | `--no-claude` | — | Do not append `@claude` tag |
157
+ | `--json` | — | Output as JSON |
158
+
159
+ The `@claude` tag in the issue body is what triggers the agent to pick up the ticket.
160
+
161
+ ### `agentdev gh`
162
+
163
+ GitHub CLI compatible commands. Drop-in replacement for `gh` so agent skills can use `agentdev gh` without requiring a separate `gh` installation.
164
+
165
+ ```bash
166
+ # Issues
167
+ agentdev gh issue view <number> -R <owner/repo> [--json <fields>]
168
+ agentdev gh issue create -R <owner/repo> --title <title> [--body <body>]
169
+ agentdev gh issue comment <number> -R <owner/repo> --body <body>
170
+ agentdev gh issue reopen <number> -R <owner/repo>
171
+
172
+ # Pull Requests
173
+ agentdev gh pr create -R <owner/repo> --title <title> --head <branch> --base <branch> [--body <body>]
174
+ agentdev gh pr view <number> -R <owner/repo> [--json <fields>]
175
+ agentdev gh pr merge <number> -R <owner/repo> [--squash | --merge | --rebase]
176
+
177
+ # Project Board
178
+ agentdev gh project item-edit --id <id> --project-id <pid> --field-id <fid> --single-select-option-id <oid>
179
+
180
+ # Workflow Runs
181
+ agentdev gh run view <ref> -R <owner/repo> # View CI status for a commit/branch
182
+ agentdev gh run watch <ref> -R <owner/repo> # Poll until CI completes
183
+
184
+ # API (raw)
185
+ agentdev gh api graphql -f query='...'
186
+ agentdev gh api rest <path> [-X <method>] [--input <file>]
187
+ ```
188
+
189
+ All `gh` commands require `GH_TOKEN` environment variable (automatically set from server OAuth tokens when running via `start`/`cron`).
190
+
191
+ ### `agentdev openspec`
192
+
193
+ Wraps the `@fission-ai/openspec` CLI. Available subcommands:
194
+
195
+ ```bash
196
+ agentdev openspec init [--tools <tools>] [--force]
197
+ agentdev openspec list [--specs] [--sort <order>] [--json]
198
+ agentdev openspec show [item] [--type <type>] [--json] [--deltas-only] [--requirements]
199
+ agentdev openspec validate [item] [--all] [--changes] [--specs] [--strict] [--json]
200
+ agentdev openspec status [--change <name>] [--json]
201
+ agentdev openspec instructions <artifact> [--change <name>] [--json]
202
+ agentdev openspec archive [change] [-y] [--skip-specs]
203
+ agentdev openspec run [args...] # Catch-all for any openspec subcommand
204
+ ```
205
+
206
+ Resolves the `openspec` binary from agentdev's own `node_modules`, falling back to a global install.
207
+
208
+ ### `agentdev onboard`
209
+
210
+ Interactive repo discovery and environment skill generation. Scans a workspace for git repos, detects languages/frameworks/databases, and generates Claude Code skill files.
211
+
212
+ ```bash
213
+ agentdev onboard [-w, --workspace <path>] [--no-claude] [--force]
214
+ ```
215
+
216
+ | Option | Default | Description |
217
+ |--------|---------|-------------|
218
+ | `-w, --workspace` | `cwd` | Workspace root to scan |
219
+ | `--no-claude` | — | Use template generation instead of Claude |
220
+ | `--force` | — | Overwrite existing skills |
221
+
222
+ Generates `.claude/commands/env-<name>.md` skill files and `.claude/repo-spec.json` per repo.
223
+
224
+ ### `agentdev render`
225
+
226
+ Render Remotion video compositions. Self-contained — uses Remotion from agentdev's own `node_modules`, no need for the target project to have Remotion installed.
227
+
228
+ ```bash
229
+ agentdev render <name> [--output <path>]
230
+ ```
231
+
232
+ | Argument | Composition ID | Output |
233
+ |----------|---------------|--------|
234
+ | `chat` | `ChatWithData` | `public/videos/chat-with-data.mp4` |
235
+ | `topics` | `OrganizeTopics` | `public/videos/organize-topics.mp4` |
236
+ | `artifacts` | `ManageArtifacts` | `public/videos/manage-artifacts.mp4` |
237
+ | `all` | all three above | sequentially |
238
+
239
+ | Option | Description |
240
+ |--------|-------------|
241
+ | `--output <path>` | Override output path (single composition only, not with `all`) |
242
+
243
+ **Convention:** Run from the project root that contains `remotion/index.ts` as the entry point and `public/` for static assets. Outputs default to `public/videos/`.
244
+
245
+ ```bash
246
+ cd /path/to/datatamer.ai/app
247
+ agentdev render chat # Render single composition
248
+ agentdev render all # Render all three
249
+ agentdev render chat --output /tmp/test.mp4 # Custom output path
250
+ ```
251
+
252
+ ## Ticket Execution Flow
253
+
254
+ When a ticket is claimed (via `start` or `cron`), the executor:
255
+
256
+ 1. **Configures environment** — sets `GH_TOKEN`, `TICKET_NUMBER`, `REPO`, `AGENT_ID`, `COMMENT_SIGNAL_FILE`
257
+ 2. **Loads the workflow skill** — reads `skills/auto-ticket-workflow.md` and injects it into the Claude prompt
258
+ 3. **Spawns Claude Code** — runs `claude -p --dangerously-skip-permissions --output-format stream-json --verbose` with the full prompt
259
+ 4. **Streams logs** — tails the output file, parses stream-json, uploads log batches to the server every 2 seconds
260
+ 5. **Polls for stop signals** — checks the server every 5 seconds for user-requested stops
261
+ 6. **Polls GitHub comments** — every 10 seconds, writes new comments to a signal file so Claude can read mid-execution instruction updates
262
+ 7. **Reports completion** — sends success/failure status to the server
263
+
264
+ ## Server API Endpoints
265
+
266
+ The agent client communicates with the AgentDev WebUI server:
267
+
268
+ | Method | Endpoint | Purpose |
269
+ |--------|----------|---------|
270
+ | `POST` | `/api/agent/heartbeat` | Send agent status (idle/busy) every 30s |
271
+ | `GET` | `/api/agent/oauth` | Fetch GitHub OAuth tokens |
272
+ | `GET` | `/api/agent/work` | Claim next available ticket |
273
+ | `POST` | `/api/agent/logs` | Upload log batch |
274
+ | `POST` | `/api/agent/complete` | Mark ticket as done |
275
+ | `POST` | `/api/agent/ensure-ticket` | Upsert ticket in DB (for leftover resumption) |
276
+ | `GET` | `/api/agent/should-stop` | Check if stop was requested |
277
+
278
+ ## Environment Variables
279
+
280
+ | Variable | Description | Default |
281
+ |----------|-------------|---------|
282
+ | `CLAUDE_BIN` | Path to Claude Code CLI binary | `claude` |
283
+ | `GH_TOKEN` | GitHub token (auto-configured from server OAuth) | — |