brainiac-basecamp 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e3c426c0dc0b73e9addf70df378a26ac9d60bb08b00c7ed9cce2f99014d0284e
4
+ data.tar.gz: b1c4810e7141e32f45a0010e1b200b0f37912e477d4648fa5353dfbef3980f2f
5
+ SHA512:
6
+ metadata.gz: 35b654d7e4a7248a4eb05f17ccc0e8e90d7b9ab5736669bb9a55189f760dc5646f139856f6b3214a045dba85f4edca3069d0076633e6235931df1155de7a26a2
7
+ data.tar.gz: eedcd8be6c31168cffa6bf4a2460aa6f9ce280878fde13dc27395d57695580060d67f37386532cdb7cec109c77e13f3163fe973286363c40de5014248f94732b
data/README.md ADDED
@@ -0,0 +1,322 @@
1
+ # brainiac-basecamp
2
+
3
+ Basecamp epic orchestration plugin for [Brainiac](https://github.com/stowzilla/brainiac). Manages high-level epics in Basecamp while agents execute individual tasks via Fizzy cards — with dependency tracking, sequential dispatch, review gates, and bidirectional status sync.
4
+
5
+ ## How It Works
6
+
7
+ 1. Create a Basecamp **todolist** with the `Epic:` prefix
8
+ 2. Add todos to it — each one references a Fizzy card with a clickable link in the description
9
+ 3. Assign any todo in the list to your bot account
10
+ 4. The plugin receives the webhook, reads the todolist, builds the dependency graph, and starts orchestrating
11
+ 5. Unblocked Fizzy cards are assigned to agents automatically
12
+ 6. As cards complete (and optionally pass review), the plugin marks Basecamp todos done and dispatches the next wave
13
+ 7. When all tasks finish, a summary message is posted and the epic is marked complete
14
+
15
+ ## Epic Format (Option C: Todolist + Rich Descriptions)
16
+
17
+ Create a Basecamp todolist:
18
+
19
+ ```
20
+ Todolist: "Epic: Build Authentication System"
21
+
22
+ Todos:
23
+ □ "#1234 — Set up auth models"
24
+ Description: Fizzy: <link to #1234>
25
+ Depends on: none
26
+
27
+ □ "#1235 — Add API endpoints"
28
+ Description: Fizzy: <link to #1235>
29
+ Depends on: #1234
30
+
31
+ □ "#1236 — Frontend login form"
32
+ Description: Fizzy: <link to #1236>
33
+ Depends on: #1234, #1235
34
+ ```
35
+
36
+ Each todo's description contains:
37
+ - A **clickable link** to the Fizzy card (`<a href="https://app.fizzy.do/org/cards/1234">#1234</a>`)
38
+ - **Dependencies** in `[depends:1234,1235]` or `Depends on: #1234, #1235` format
39
+ - Optionally, the assigned **agent** name
40
+
41
+ The plugin auto-generates these descriptions via `Epic.build_todo_description`.
42
+
43
+ ## Review Gate
44
+
45
+ Two modes (configured via `brainiac basecamp set review-gate`):
46
+
47
+ | Mode | Behavior |
48
+ |------|----------|
49
+ | `on_complete` (default) | Advance to next task as soon as agent finishes |
50
+ | `on_pr_merge` | Wait for PR merge before marking task done and unblocking dependents |
51
+
52
+ The `on_pr_merge` mode hooks into `:pr_merged` events from brainiac-github. This gives you a full review cycle between each epic task.
53
+
54
+ ## Prerequisites
55
+
56
+ - [Basecamp CLI](https://github.com/basecamp/basecamp-cli) installed and authenticated
57
+ - A Basecamp bot user account (for webhook-triggered orchestration)
58
+ - brainiac-fizzy plugin (cards already exist in Fizzy)
59
+ - brainiac-github plugin (optional, for `on_pr_merge` review gate)
60
+
61
+ ## Getting Started
62
+
63
+ ### Step 1: Install the Basecamp CLI
64
+
65
+ ```bash
66
+ curl -fsSL https://basecamp.com/install-cli | bash
67
+ ```
68
+
69
+ Verify it's installed:
70
+
71
+ ```bash
72
+ basecamp --version
73
+ ```
74
+
75
+ ### Step 2: Authenticate with Basecamp
76
+
77
+ ```bash
78
+ basecamp auth login
79
+ ```
80
+
81
+ This opens your browser for OAuth. Once authenticated, verify:
82
+
83
+ ```bash
84
+ basecamp auth status
85
+ ```
86
+
87
+ ### Step 3: Create a Bot Account in Basecamp
88
+
89
+ Go to your Basecamp account → Adminland → People → Invite people.
90
+
91
+ Create a new user account for the bot (e.g. "Galen Bot" or "Brainiac Andy"). This account will be the one that receives epic assignments.
92
+
93
+ Once created, find the bot's **person ID**:
94
+
95
+ ```bash
96
+ basecamp people list --jq '.data[] | select(.name | contains("Galen")) | {id, name}'
97
+ ```
98
+
99
+ Note the `id` value — you'll need it in Step 6.
100
+
101
+ ### Step 4: Install the Plugin
102
+
103
+ ```bash
104
+ brainiac install basecamp --path /home/andy/Code/brainiac-basecamp
105
+ ```
106
+
107
+ ### Step 5: Run Setup
108
+
109
+ ```bash
110
+ brainiac basecamp setup
111
+ ```
112
+
113
+ This checks prerequisites and creates `~/.brainiac/basecamp.json`.
114
+
115
+ ### Step 6: Configure the Plugin
116
+
117
+ ```bash
118
+ # Set your Fizzy org slug (used to build clickable card URLs in Basecamp)
119
+ brainiac basecamp set fizzy-account-id 6098707
120
+
121
+ # Register your bot account (name it anything, use the person ID from Step 3)
122
+ brainiac basecamp bot add andy-server <person-id-from-step-3> Galen
123
+
124
+ # Map your Brainiac project(s) to Basecamp project IDs
125
+ # Find your Basecamp project ID:
126
+ basecamp projects list --jq '.data[] | {id, name}'
127
+ # Then map it:
128
+ brainiac basecamp projects map stowzilla <basecamp-project-id>
129
+
130
+ # Optionally enable the review gate (waits for PR merge between tasks)
131
+ brainiac basecamp set review-gate on_pr_merge
132
+ ```
133
+
134
+ Verify your config:
135
+
136
+ ```bash
137
+ brainiac basecamp config
138
+ ```
139
+
140
+ ### Step 7: Register the Webhook
141
+
142
+ Point Basecamp at your brainiac server's ngrok URL:
143
+
144
+ ```bash
145
+ basecamp webhooks create "https://your-ngrok.ngrok-free.app/basecamp" \
146
+ --types "Todo,Todolist" --in <basecamp-project-id>
147
+ ```
148
+
149
+ Replace `your-ngrok.ngrok-free.app` with your actual ngrok domain.
150
+
151
+ ### Step 8: Restart Brainiac
152
+
153
+ ```bash
154
+ brainiac restart
155
+ ```
156
+
157
+ Verify the plugin loaded:
158
+
159
+ ```bash
160
+ brainiac plugins
161
+ curl http://localhost:4567/api/basecamp
162
+ ```
163
+
164
+ ### Step 9: Create Your First Epic
165
+
166
+ In Basecamp, create a new todolist with the `Epic:` prefix:
167
+
168
+ **Todolist title:** `Epic: My First Feature`
169
+
170
+ Add todos to it. Each todo title should reference a Fizzy card number:
171
+
172
+ ```
173
+ #1234 — Build the API endpoint
174
+ #1235 — Add frontend form
175
+ #1236 — Write integration tests [depends:1234,1235]
176
+ ```
177
+
178
+ Optionally, add rich text descriptions with clickable Fizzy links:
179
+
180
+ ```html
181
+ <a href="https://app.fizzy.do/stowzilla/cards/1234">Fizzy #1234</a>
182
+ Depends on: none
183
+ ```
184
+
185
+ ### Step 10: Start the Epic
186
+
187
+ Assign any todo in the epic todolist to your bot account (the one from Step 3).
188
+
189
+ The webhook fires → brainiac-basecamp reads the todolist → builds the dependency graph → assigns the first unblocked Fizzy card to your agent.
190
+
191
+ Watch it go:
192
+
193
+ ```bash
194
+ brainiac basecamp epics
195
+ curl http://localhost:4567/api/basecamp/epics
196
+ ```
197
+
198
+ ## Configuration
199
+
200
+ `~/.brainiac/basecamp.json`:
201
+
202
+ ```json
203
+ {
204
+ "bot_accounts": {
205
+ "andy-server": {
206
+ "person_id": "12345",
207
+ "default_agent": "Galen"
208
+ }
209
+ },
210
+ "project_mappings": {
211
+ "marketplace": {
212
+ "basecamp_project_id": "67890"
213
+ }
214
+ },
215
+ "epic_prefix": "Epic:",
216
+ "fizzy_account_id": "6098707",
217
+ "review_gate": "on_pr_merge",
218
+ "notifications": {
219
+ "epic_started": true,
220
+ "task_dispatched": true,
221
+ "task_completed": true,
222
+ "epic_completed": true
223
+ }
224
+ }
225
+ ```
226
+
227
+ ## CLI Commands
228
+
229
+ ```bash
230
+ brainiac basecamp setup # Interactive setup
231
+ brainiac basecamp config # Show config
232
+ brainiac basecamp status # Plugin health check
233
+ brainiac basecamp epics # List active epics
234
+ brainiac basecamp epics --all # Include completed
235
+ brainiac basecamp bot add <name> <id> <agent> # Add bot account
236
+ brainiac basecamp bot list # List bot accounts
237
+ brainiac basecamp projects map <key> <bc-id> # Map project
238
+ brainiac basecamp projects list # List mappings
239
+ brainiac basecamp set fizzy-account-id <id> # Set Fizzy account ID for URLs
240
+ brainiac basecamp set review-gate <mode> # on_complete or on_pr_merge
241
+ brainiac basecamp set epic-prefix <prefix> # Epic detection prefix
242
+ ```
243
+
244
+ ## API Endpoints
245
+
246
+ ```bash
247
+ # Status
248
+ curl http://localhost:4567/api/basecamp
249
+
250
+ # List epics
251
+ curl http://localhost:4567/api/basecamp/epics
252
+ curl "http://localhost:4567/api/basecamp/epics?status=all"
253
+
254
+ # Specific epic with dependency graph
255
+ curl http://localhost:4567/api/basecamp/epics/epic-123
256
+
257
+ # Manually start an epic (for testing)
258
+ curl -X POST http://localhost:4567/api/basecamp/epics \
259
+ -H "Content-Type: application/json" \
260
+ -d '{"todolist_id":"123","project_id":"456","agent":"Galen","title":"Epic: Test"}'
261
+
262
+ # Pause/resume
263
+ curl -X POST http://localhost:4567/api/basecamp/epics/epic-123/pause
264
+ curl -X POST http://localhost:4567/api/basecamp/epics/epic-123/resume
265
+ ```
266
+
267
+ ## Architecture
268
+
269
+ ### Hooks
270
+
271
+ | Hook | What It Does |
272
+ |------|-------------|
273
+ | `:agent_completed` | Advances epic when Fizzy card completes (respects review gate) |
274
+ | `:pr_merged` | Advances epic if review gate = `on_pr_merge` |
275
+ | `:build_brain_context` | Injects epic context into agent prompts |
276
+
277
+ ### Orchestration Flow
278
+
279
+ ```
280
+ Webhook (todo_assignment_changed)
281
+ → Is parent todolist an epic? (Epic: prefix)
282
+ → Is assigned person a bot account?
283
+ → Start orchestration:
284
+ 1. Read all todos in todolist
285
+ 2. Parse card refs + dependencies from titles/descriptions
286
+ 3. Build dependency graph
287
+ 4. Dispatch unblocked Fizzy cards (assign via fizzy CLI)
288
+ 5. Wait for :agent_completed / :pr_merged
289
+ 6. Mark Basecamp todo complete
290
+ 7. Re-evaluate graph → dispatch next
291
+ 8. Repeat until all done
292
+ 9. Post summary message, emit notification
293
+ ```
294
+
295
+ ### Dual-Server Pattern
296
+
297
+ Both brainiac servers receive the same Basecamp webhook. Only the server whose bot account person ID matches an `added_person_id` in the webhook will start orchestration. Same pattern as Fizzy's `local` flag.
298
+
299
+ ## Dependency Tracking
300
+
301
+ Dependencies are declared in todo titles or descriptions:
302
+
303
+ **In title:** `#1236 — Frontend [depends:1234,1235]`
304
+
305
+ **In description (rich text):**
306
+ ```html
307
+ <div>
308
+ <strong>Fizzy:</strong> <a href="https://app.fizzy.do/stowzilla/cards/1236">#1236</a><br>
309
+ <strong>Depends on:</strong> #1234, #1235<br>
310
+ </div>
311
+ ```
312
+
313
+ The orchestrator:
314
+ 1. Parses all todos to build a directed acyclic graph
315
+ 2. Identifies tasks with no unmet dependencies (unblocked)
316
+ 3. Assigns unblocked Fizzy cards to agents
317
+ 4. On completion, re-evaluates the graph for newly unblocked tasks
318
+ 5. Supports mid-epic changes — re-reads the todolist on each cycle
319
+
320
+ ## License
321
+
322
+ MIT