@forloop-cc/forloop-opencode-plugin-planner 2.2.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +225 -0
  2. package/CODE_OF_CONDUCT.md +77 -0
  3. package/CONTRIBUTING.md +176 -0
  4. package/LICENSE +21 -0
  5. package/README.md +211 -0
  6. package/SECURITY.md +69 -0
  7. package/docs/CONFIGURATION.md +283 -0
  8. package/docs/DEVELOPER-VS-USER.md +129 -0
  9. package/docs/IMPROVED-AUTHENTICATION.md +317 -0
  10. package/docs/INSTALLATION-SCRIPTS.md +304 -0
  11. package/docs/PLANNER-AGENT-IMPROVEMENTS.md +88 -0
  12. package/docs/PLUGIN-ARCHITECTURE.md +308 -0
  13. package/docs/QUICKSTART-NON-DEV.md +94 -0
  14. package/docs/README-FOR-HUMANS-AND-AI.md +109 -0
  15. package/docs/README.md +70 -0
  16. package/docs/SKILLS-GAP-ANALYSIS.md +157 -0
  17. package/docs/USER-INTERACTION-MODEL.md +106 -0
  18. package/docs/file-management/2026-04-12-forloop-aivy-documents-sync.md +395 -0
  19. package/docs/file-management/FILE_UPLOAD_ENHANCEMENT.md +431 -0
  20. package/docs/file-management/FILE_UPLOAD_FLOW.md +300 -0
  21. package/docs/images/forloop-opencode-flow.png +0 -0
  22. package/docs/images/forloop-opencode-header.png +0 -0
  23. package/docs/superpowers/plans/2026-05-03-sprint-isolated-directory-structure.md +1450 -0
  24. package/docs/superpowers/plans/2026-05-29-install-system.md +850 -0
  25. package/docs/superpowers/specs/2026-05-03-sprint-isolated-directory-structure-design.md +149 -0
  26. package/docs/superpowers/specs/2026-05-19-opencode-message-recording-design.md +468 -0
  27. package/docs/superpowers/specs/2026-05-29-install-system-design.md +135 -0
  28. package/install.sh +317 -0
  29. package/package.json +87 -0
  30. package/plugins/capabilities/api-client.ts +556 -0
  31. package/plugins/capabilities/auth.ts +120 -0
  32. package/plugins/capabilities/config.ts +195 -0
  33. package/plugins/capabilities/context-resolver.ts +106 -0
  34. package/plugins/capabilities/token-storage.ts +98 -0
  35. package/plugins/forloop-plugin.ts +186 -0
  36. package/plugins/hooks/message-recorder.ts +258 -0
  37. package/plugins/hooks/shell-env.ts +62 -0
  38. package/plugins/tools/agent-sprint-tools.ts +100 -0
  39. package/plugins/tools/agent-suggestion-tools.ts +275 -0
  40. package/plugins/tools/agent-tools.ts +114 -0
  41. package/plugins/tools/ai-trigger-tools.ts +79 -0
  42. package/plugins/tools/developer-status-tool.ts +97 -0
  43. package/plugins/tools/file-tools.ts +240 -0
  44. package/plugins/tools/folder-tools.ts +75 -0
  45. package/plugins/tools/organization-tools.ts +213 -0
  46. package/plugins/tools/schedule-tools.ts +173 -0
  47. package/plugins/tools/sprint-tools.ts +287 -0
  48. package/plugins/tools/story-tools.ts +320 -0
  49. package/plugins/tools/sync-tools.ts +509 -0
  50. package/plugins/tools/template-tools.ts +170 -0
  51. package/plugins/tools/user-tools.ts +146 -0
  52. package/scripts/migrate-tokens.js +90 -0
  53. package/scripts/use-prod.sh +11 -0
  54. package/tsconfig.json +17 -0
  55. package/update.sh +172 -0
@@ -0,0 +1,431 @@
1
+ # File Upload Enhancement - Implementation Summary
2
+
3
+ ## Changes Made
4
+
5
+ This document summarizes the implementation of S3 folder organization and doc_folder linking for file uploads.
6
+
7
+ ---
8
+
9
+ ## New Parameters Added
10
+
11
+ ### `forloopFileUpload` Tool (Plugin)
12
+
13
+ **File:** `forloop-opencode-plugin-planner/plugins/tools/file-tools.ts`
14
+
15
+ ```typescript
16
+ args: {
17
+ filePath: string; // Local file path (required)
18
+ sprintId: number; // Target sprint (required)
19
+ description?: string; // File description (optional)
20
+ folder?: string; // S3 folder path (NEW - optional)
21
+ storyId?: number; // Link to story (NEW - optional)
22
+ }
23
+ ```
24
+
25
+ ---
26
+
27
+ ### API Client `completeUpload` Method
28
+
29
+ **File:** `forloop-opencode-plugin-planner/plugins/capabilities/api-client.ts`
30
+
31
+ ```typescript
32
+ async completeUpload(data: {
33
+ sprintId: number;
34
+ fileName: string;
35
+ originalName: string;
36
+ fileType: string;
37
+ size: number;
38
+ folder?: string; // NEW - optional
39
+ storyId?: number; // NEW - optional
40
+ x?: number;
41
+ y?: number;
42
+ }): Promise<any>
43
+ ```
44
+
45
+ ---
46
+
47
+ ### Server Controller Endpoints
48
+
49
+ **File:** `server_lambda/src/controllers/uploadController.ts`
50
+
51
+ #### 1. `createPresignedUpload`
52
+ ```typescript
53
+ const { sprintId, contentType, originalName, folder } = req.body;
54
+ const key = folder
55
+ ? `sprint/${sprintId}/${folder}/${fileName}`
56
+ : `sprint/${sprintId}/${fileName}`;
57
+ ```
58
+
59
+ #### 2. `completeUpload`
60
+ ```typescript
61
+ const { sprintId, x, y, storyId, fileName, originalName, fileType, size, folder } = req.body;
62
+ const key = folder
63
+ ? `sprint/${sprintId}/${folder}/${fileName}`
64
+ : `sprint/${sprintId}/${fileName}`;
65
+ ```
66
+
67
+ #### 3. `uploadCanvasFile`
68
+ ```typescript
69
+ const { sprintId, x, y, storyId, folder } = req.body;
70
+ const key = folder
71
+ ? `sprint/${sprintId}/${folder}/${fileName}`
72
+ : `sprint/${sprintId}/${fileName}`;
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Usage Examples
78
+
79
+ ### Example 1: Upload with S3 Folder Organization
80
+
81
+ Upload planning artifacts to organized S3 folders:
82
+
83
+ ```bash
84
+ # Upload sprint plan to project/plans folder
85
+ forloopFileUpload \
86
+ --filePath ~/.forloop/plan/plan-14-20260410-093015.md \
87
+ --sprintId 14 \
88
+ --folder project/plans \
89
+ --description "Sprint 14 plan document"
90
+
91
+ # Upload knowledge to project/knowledge folder
92
+ forloopFileUpload \
93
+ --filePath ~/.forloop/knowledge/knowledge-auth-20260410-093015.md \
94
+ --sprintId 14 \
95
+ --folder project/knowledge \
96
+ --description "Auth system knowledge"
97
+
98
+ # Upload task file to project/tasks folder
99
+ forloopFileUpload \
100
+ --filePath ~/.forloop/task/task-14-20260410-100000.md \
101
+ --sprintId 14 \
102
+ --folder project/tasks \
103
+ --description "Sprint 14 task list"
104
+ ```
105
+
106
+ **Result - S3 Structure:**
107
+ ```
108
+ s3://bucket/sprint/14/
109
+ ├── project/
110
+ │ ├── plans/
111
+ │ │ └── plan-14-20260410-093015.md
112
+ │ ├── knowledge/
113
+ │ │ └── knowledge-auth-20260410-093015.md
114
+ │ └── tasks/
115
+ │ └── task-14-20260410-100000.md
116
+ ```
117
+
118
+ ---
119
+
120
+ ### Example 2: Upload with doc_folder Linking
121
+
122
+ Link files to doc_folder stories for UI organization:
123
+
124
+ ```bash
125
+ # Step 1: Create a doc_folder story
126
+ forloopDocFolder \
127
+ --sprintId 14 \
128
+ --title "Project Artifacts" \
129
+ --description "Planning documents and knowledge" \
130
+ --permissions team
131
+
132
+ # Output:
133
+ # ✅ Document folder created!
134
+ # **#101**: Project Artifacts
135
+ # **Type**: doc_folder
136
+
137
+ # Step 2: Upload file and link to doc_folder (Story #101)
138
+ forloopFileUpload \
139
+ --filePath ~/.forloop/plan/plan-14.md \
140
+ --sprintId 14 \
141
+ --storyId 101 \
142
+ --description "Sprint plan linked to Project Artifacts"
143
+ ```
144
+
145
+ **Result:**
146
+ - **S3 Path:** `s3://bucket/sprint/14/plan-14.md` (root level)
147
+ - **Database:** `{ storyId: 101 }` (linked to "Project Artifacts" folder)
148
+ - **UI:** Shows under "Project Artifacts" folder in ForLoop app
149
+
150
+ ---
151
+
152
+ ### Example 3: Combined Organization (Future Use)
153
+
154
+ Use both S3 folder AND doc_folder linking:
155
+
156
+ ```bash
157
+ # Upload with physical folder + logical grouping
158
+ forloopFileUpload \
159
+ --filePath ~/.forloop/plan/plan-14.md \
160
+ --sprintId 14 \
161
+ --folder project/plans \
162
+ --storyId 101 \
163
+ --description "Plan in S3 folder, linked to UI folder"
164
+ ```
165
+
166
+ **Result:**
167
+ - **S3 Path:** `s3://bucket/sprint/14/project/plans/plan-14.md`
168
+ - **Database:** `{ storyId: 101 }`
169
+ - **UI:** Shows under "Project Artifacts" folder
170
+
171
+ ---
172
+
173
+ ## Backward Compatibility
174
+
175
+ ### ✅ Guaranteed
176
+
177
+ 1. **Optional Parameters:** Both `folder` and `storyId` are optional
178
+ 2. **Default Behavior:** When not provided, files upload to `sprint/{id}/{file}` (current behavior)
179
+ 3. **Frontend Unchanged:** Existing frontend code continues to work without modifications
180
+ 4. **No Breaking Changes:** All existing API contracts remain intact
181
+
182
+ ### Frontend Client Impact
183
+
184
+ **Frontend calls (`client/src/store/sprintStore.ts`):**
185
+ ```typescript
186
+ // presign call - NO changes needed
187
+ await api.post('/files/presign', {
188
+ sprintId,
189
+ contentType: file.type,
190
+ originalName: file.name,
191
+ })
192
+
193
+ // complete call - NO changes needed
194
+ await api.post('/files/complete', {
195
+ sprintId,
196
+ x, y, storyId,
197
+ fileName: presignRes.data.fileName,
198
+ // ...
199
+ })
200
+ ```
201
+
202
+ Server handles missing `folder` parameter:
203
+ ```typescript
204
+ // When folder is undefined, uses default path
205
+ const key = folder
206
+ ? `sprint/${sprintId}/${folder}/${fileName}`
207
+ : `sprint/${sprintId}/${fileName}`; // ← Default (existing)
208
+ ```
209
+
210
+ ---
211
+
212
+ ## File Organization Patterns
213
+
214
+ ### Pattern 1: S3 Folder Only
215
+
216
+ **Use Case:** S3 management, external tool access, backup organization
217
+
218
+ ```bash
219
+ forloopFileUpload \
220
+ --filePath ./plan.md \
221
+ --sprintId 14 \
222
+ --folder project/plans
223
+ ```
224
+
225
+ **S3 Console Shows:**
226
+ ```
227
+ sprint/14/
228
+ └── project/
229
+ └── plans/
230
+ └── user_abc123_plan.md
231
+ ```
232
+
233
+ ---
234
+
235
+ ### Pattern 2: doc_folder Only
236
+
237
+ **Use Case:** In-app UI organization, grouping related files
238
+
239
+ ```bash
240
+ # Create folder
241
+ forloopDocFolder --sprintId 14 --title "Specs"
242
+
243
+ # Upload and link
244
+ forloopFileUpload \
245
+ --filePath ./api-spec.md \
246
+ --sprintId 14 \
247
+ --storyId 102
248
+ ```
249
+
250
+ **ForLoop UI Shows:**
251
+ ```
252
+ 📁 Specs (doc_folder)
253
+ └── 📄 api-spec.md
254
+ ```
255
+
256
+ ---
257
+
258
+ ### Pattern 3: Root Level (Default)
259
+
260
+ **Use Case:** Simple files, no special organization needed
261
+
262
+ ```bash
263
+ forloopFileUpload \
264
+ --filePath ./quick-note.md \
265
+ --sprintId 14 \
266
+ --description "Quick note"
267
+ ```
268
+
269
+ **Result:**
270
+ - **S3:** `s3://bucket/sprint/14/quick-note.md`
271
+ - **UI:** Shows in sprint root files list
272
+
273
+ ---
274
+
275
+ ## Integration with Existing Skills
276
+
277
+ ### Updated Skills Documentation
278
+
279
+ The following skills were updated to include `folder` parameter examples:
280
+
281
+ 1. **file-management/SKILL.md** - Primary documentation
282
+ 2. **knowledge-management/SKILL.md** - Example with `project/knowledge`
283
+ 3. **plan-documentation/SKILL.md** - Example with `project/plans`
284
+ 4. **task-tracking/SKILL.md** - Example with `project/tasks`
285
+
286
+ ### Skill Workflow Integration
287
+
288
+ **Complete Sprint Planning Flow:**
289
+
290
+ ```bash
291
+ # 1. Create doc_folder for organization
292
+ forloopDocFolder \
293
+ --sprintId 14 \
294
+ --title "Sprint 14 Artifacts"
295
+
296
+ # 2. Capture knowledge (knowledge-management skill)
297
+ # → Creates: .forloop/knowledge/knowledge-auth-*.md
298
+ # → Uploads to: project/knowledge/
299
+
300
+ # 3. Create plan (plan-documentation skill)
301
+ # → Creates: .forloop/plan/plan-14-*.md
302
+ # → Uploads to: project/plans/
303
+
304
+ # 4. Create tasks (task-tracking skill)
305
+ # → Creates: .forloop/task/task-14-*.md
306
+ # → Uploads to: project/tasks/
307
+ # → Links stories to sprint
308
+
309
+ # Result: Organized S3 structure with all planning artifacts
310
+ ```
311
+
312
+ ---
313
+
314
+ ## Verification Checklist
315
+
316
+ ### Implementation
317
+
318
+ - ✅ Plugin tool updated with `folder` and `storyId` parameters
319
+ - ✅ API client updated to pass new parameters
320
+ - ✅ Server `createPresignedUpload` handles `folder`
321
+ - ✅ Server `completeUpload` handles `folder` and `storyId`
322
+ - ✅ Server `uploadCanvasFile` handles `folder`
323
+ - ✅ TypeScript compilation passes (both projects)
324
+
325
+ ### Documentation
326
+
327
+ - ✅ file-management skill updated with examples
328
+ - ✅ knowledge-management skill updated
329
+ - ✅ plan-documentation skill updated
330
+ - ✅ task-tracking skill updated
331
+ - ✅ This summary document created
332
+
333
+ ---
334
+
335
+ ## Testing Recommendations
336
+
337
+ ### Manual Test Cases
338
+
339
+ 1. **Upload without folder (backward compatibility)**
340
+ ```bash
341
+ forloopFileUpload --filePath ./test.md --sprintId 14
342
+ # Should upload to: sprint/14/test.md
343
+ ```
344
+
345
+ 2. **Upload with folder**
346
+ ```bash
347
+ forloopFileUpload --filePath ./test.md --sprintId 14 --folder project
348
+ # Should upload to: sprint/14/project/test.md
349
+ ```
350
+
351
+ 3. **Upload with storyId**
352
+ ```bash
353
+ forloopFileUpload --filePath ./test.md --sprintId 14 --storyId 101
354
+ # Should upload to: sprint/14/test.md with storyId: 101
355
+ ```
356
+
357
+ 4. **Upload with folder and storyId**
358
+ ```bash
359
+ forloopFileUpload --filePath ./test.md --sprintId 14 --folder project --storyId 101
360
+ # Should upload to: sprint/14/project/test.md with storyId: 101
361
+ ```
362
+
363
+ 5. **Frontend upload (no changes)**
364
+ ```javascript
365
+ // Existing frontend code should continue to work
366
+ uploadFile(14, file, 100, 200)
367
+ ```
368
+
369
+ ---
370
+
371
+ ## S3 Bucket Structure Examples
372
+
373
+ ### Before (Flat Structure)
374
+ ```
375
+ s3://bucket/sprint/14/
376
+ ├── user_abc123_plan.md
377
+ ├── user_def456_knowledge.md
378
+ └── user_ghi789_task.md
379
+ ```
380
+
381
+ ### After (Organized with Folders)
382
+ ```
383
+ s3://bucket/sprint/14/
384
+ ├── project/
385
+ │ ├── plans/
386
+ │ │ └── user_abc123_plan.md
387
+ │ ├── knowledge/
388
+ │ │ └── user_def456_knowledge.md
389
+ │ └── tasks/
390
+ │ └── user_ghi789_task.md
391
+ └── meetings/
392
+ └── recording_20260410.mp4
393
+ ```
394
+
395
+ ---
396
+
397
+ ## Migration Path
398
+
399
+ ### For Existing Files
400
+
401
+ **No migration needed** - existing files remain at `sprint/{id}/{file}`. New files can use the `folder` parameter for organization.
402
+
403
+ ### For New Projects
404
+
405
+ Recommended folder structure for `.forloop/` artifacts:
406
+
407
+ ```
408
+ S3: sprint/{id}/
409
+ ├── project/
410
+ │ ├── plans/ ← Sprint plan documents
411
+ │ ├── knowledge/ ← Captured knowledge files
412
+ │ └── tasks/ ← Task list files
413
+ └── meetings/
414
+ ├── {meetingId}/ ← Meeting recordings
415
+ │ └── {timestamp}/
416
+ └── summaries/ ← Meeting summaries
417
+ ```
418
+
419
+ ---
420
+
421
+ ## Summary
422
+
423
+ This implementation adds flexible file organization to ForLoop:
424
+
425
+ 1. **Physical S3 folders** via `folder` parameter
426
+ 2. **Logical UI grouping** via `storyId` parameter (linking to doc_folder)
427
+ 3. **Full backward compatibility** - all parameters optional
428
+ 4. **Updated skills** to use organized folder structure
429
+ 5. **No frontend changes required** - existing code continues to work
430
+
431
+ The enhancement enables better organization of `.forloop/` planning artifacts while maintaining complete compatibility with existing frontend clients and workflows.