@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,300 @@
1
+ # File Upload Flow Diagram
2
+
3
+ ## Current Implementation (Enhanced)
4
+
5
+ ```mermaid
6
+ graph TB
7
+ subgraph Plugin
8
+ A[forloopFileUpload<br/>Tool] --> B[API Client<br/>createPresignedUpload]
9
+ B --> C[Server /files/presign]
10
+ C --> D[Generate Upload URL<br/>with folder path]
11
+ D --> E[S3 Presigned URL]
12
+ E --> F[Upload to S3]
13
+ F --> G[API Client<br/>completeUpload]
14
+ G --> H[Server /files/complete]
15
+ H --> I[Create File Record<br/>with folder & storyId]
16
+ I --> J[(Database<br/>canvasFile)]
17
+ end
18
+
19
+ subgraph Parameters
20
+ A1[filePath] --> A
21
+ A2[sprintId] --> A
22
+ A3[description?] --> A
23
+ A4[folder?] --> A
24
+ A5[storyId?] --> A
25
+ end
26
+
27
+ subgraph S3 Structure
28
+ S1[sprint/14/] --> S1A[myfile.md]
29
+ S1 --> S1B[project/]
30
+ S1B --> S1B1[plans/myfile.md]
31
+ S1B --> S1B2[knowledge/myfile.md]
32
+ S1B --> S1B3[tasks/myfile.md]
33
+ end
34
+
35
+ style A4 fill:#90EE90
36
+ style A5 fill:#90EE90
37
+ style S1B fill:#FFE4B5
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Before Enhancement (Original Flow)
43
+
44
+ ```mermaid
45
+ graph TB
46
+ subgraph Old Flow
47
+ A[Upload File] --> B[Server creates key:<br/>sprint/{id}/{file}]
48
+ B --> C[All files in root]
49
+ C --> D[(S3:<br/>sprint/14/file1.md<br/>sprint/14/file2.md<br/>sprint/14/file3.md)]
50
+ end
51
+
52
+ style D fill:#FFB6C1
53
+ ```
54
+
55
+ ---
56
+
57
+ ## After Enhancement (With Folder Support)
58
+
59
+ ```mermaid
60
+ graph TB
61
+ subgraph New Flow
62
+ A[Upload with folder param] --> B{folder provided?}
63
+ B -->|Yes| C[Server creates key:<br/>sprint/{id}/folder/{file}]
64
+ B -->|No| D[Server creates key:<br/>sprint/{id}/{file}]
65
+ C --> E[Files organized in folders]
66
+ D --> E
67
+ E --> F[(S3:<br/>sprint/14/file1.md<br/>sprint/14/project/plans/file2.md<br/>sprint/14/project/knowledge/file3.md)]
68
+ end
69
+
70
+ style C fill:#90EE90
71
+ style E fill:#90EE90
72
+ style F fill:#90EE90
73
+ ```
74
+
75
+ ---
76
+
77
+ ## doc_folder Linking vs S3 Folder Organization
78
+
79
+ ```mermaid
80
+ graph LR
81
+ subgraph S3_Physical["Physical S3 Structure"]
82
+ A[sprint/14/]
83
+ A --> B[project/]
84
+ B --> B1[plans/file.md]
85
+ B --> B2[knowledge/file.md]
86
+ end
87
+
88
+ subgraph Database["Database Linking"]
89
+ C[canvasFile table]
90
+ C --> D[storyId: 101]
91
+ D --> E[Story #101<br/>doc_folder:<br/>'Project Artifacts']
92
+ end
93
+
94
+ subgraph UI["ForLoop UI Display"]
95
+ F[📁 Project Artifacts]
96
+ F --> G[📄 file.md]
97
+ end
98
+
99
+ S3_Physical -.->|folder param| Database
100
+ Database -.->|storyId param| UI
101
+
102
+ style S3_Physical fill:#E0F7FA
103
+ style Database fill:#FFF9C4
104
+ style UI fill:#F3E5F5
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Complete Workflow: .forloop/ Sync
110
+
111
+ ```mermaid
112
+ sequenceDiagram
113
+ participant User as User
114
+ participant Plugin as ForLoop Plugin
115
+ participant S3 as AWS S3
116
+ participant DB as Database
117
+ participant UI as ForLoop UI
118
+
119
+ Note over User,UI: Step 1: Create Plan Document
120
+ User->>Plugin: Create sprint plan
121
+ Plugin->>Plugin: Generate .forloop/plan/plan-14-*.md
122
+ User->>Plugin: forloopFileUpload<br/>--folder project/plans
123
+ Plugin->>S3: Upload to sprint/14/project/plans/
124
+ S3-->>Plugin: Upload Success
125
+ Plugin-->>User: ✅ Plan uploaded to folder
126
+
127
+ Note over User,UI: Step 2: Create Knowledge File
128
+ User->>Plugin: Capture domain knowledge
129
+ Plugin->>Plugin: Generate .forloop/knowledge/knowledge-*.md
130
+ User->>Plugin: forloopFileUpload<br/>--folder project/knowledge
131
+ Plugin->>S3: Upload to sprint/14/project/knowledge/
132
+ S3-->>Plugin: Upload Success
133
+ Plugin-->>User: ✅ Knowledge uploaded to folder
134
+
135
+ Note over User,UI: Step 3: Create Task File
136
+ User->>Plugin: Break plan into tasks
137
+ Plugin->>Plugin: Generate .forloop/task/task-14-*.md
138
+ Plugin->>DB: Create stories in ForLoop
139
+ User->>Plugin: forloopFileUpload<br/>--folder project/tasks
140
+ Plugin->>S3: Upload to sprint/14/project/tasks/
141
+ S3-->>Plugin: Upload Success
142
+ Plugin-->>User: ✅ Tasks uploaded to folder
143
+
144
+ Note over User,UI: Step 4: Create doc_folder (Optional)
145
+ User->>Plugin: forloopDocFolder<br/>--title 'Project Artifacts'
146
+ Plugin->>DB: Create Story #101<br/>(type: doc_folder)
147
+ DB-->>Plugin: Story #101 Created
148
+ Plugin-->>User: ✅ Doc folder created
149
+
150
+ Note over User,UI: Step 5: Link Files to doc_folder (Optional)
151
+ User->>Plugin: forloopFileUpload<br/>--folder project/plans<br/>--storyId 101
152
+ Plugin->>S3: Upload to sprint/14/project/plans/
153
+ Plugin->>DB: Set storyId: 101
154
+ DB-->>Plugin: File record created
155
+ Plugin-->>User: ✅ File linked to folder
156
+
157
+ Note over User,UI: Result
158
+ rect rgb(200, 250, 200)
159
+ Note right of UI: S3 Structure:<br/>sprint/14/<br/>├── project/<br/>│ ├── plans/<br/>│ ├── knowledge/<br/>│ └── tasks/<br/><br/>UI Grouping:<br/>📁 Project Artifacts (Story #101)<br/>└── Linked files
160
+ end
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Parameter Decision Tree
166
+
167
+ ```mermaid
168
+ graph TD
169
+ A[Upload File] --> B{Need S3<br/>folder structure?}
170
+ B -->|No| C{Need UI grouping<br/>in app?}
171
+ B -->|Yes| D[Use: --folder project/plans]
172
+ C -->|No| E[Result: sprint/14/file.md]
173
+ C -->|Yes| F{Have doc_folder<br/>story?}
174
+ D --> G{Also need UI grouping?}
175
+ G -->|No| H[Result: sprint/14/project/plans/file.md]
176
+ G -->|Yes| I[Also use: --storyId 101]
177
+ F -->|No| J[Create doc_folder first]
178
+ F -->|Yes| K[Use: --storyId 101]
179
+ J --> K
180
+ K --> L[Result: sprint/14/file.md<br/>Linked to Story #101]
181
+ I --> M[Result: sprint/14/project/plans/file.md<br/>Linked to Story #101]
182
+
183
+ style D fill:#FFE4B5
184
+ style H fill:#90EE90
185
+ style L fill:#90EE90
186
+ style M fill:#90EE90
187
+ style E fill:#FFB6C1
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Recommended Usage Patterns
193
+
194
+ ### Pattern 1: .forloop/ Artifacts (Primary Use Case)
195
+
196
+ ```
197
+ Use folder organization ONLY:
198
+ ✅ forloopFileUpload --filePath .forloop/plan/plan.md --folder project/plans
199
+ ✅ forloopFileUpload --filePath .forloop/knowledge/auth.md --folder project/knowledge
200
+ ✅ forloopFileUpload --filePath .forloop/task/task.md --folder project/tasks
201
+
202
+ Result: Clean S3 structure, visible in AWS console
203
+ ```
204
+
205
+ ### Pattern 2: User-Visible Folders
206
+
207
+ ```
208
+ Use doc_folder linking ONLY:
209
+ ✅ forloopDocFolder --title 'Specs'
210
+ ✅ forloopFileUpload --filePath api-spec.md --storyId 101
211
+
212
+ Result: Organized in ForLoop UI, S3 remains flat
213
+ ```
214
+
215
+ ### Pattern 3: Combined (Advanced)
216
+
217
+ ```
218
+ Use both for complete organization:
219
+ ✅ forloopFileUpload --folder project/plans --storyId 101
220
+
221
+ Result: S3 folders + UI grouping
222
+ ```
223
+
224
+ ### Pattern 4: Simple Files (Default)
225
+
226
+ ```
227
+ Use no parameters (backward compatible):
228
+ ✅ forloopFileUpload --filePath quick-note.md
229
+
230
+ Result: sprint/14/quick-note.md (root level)
231
+ ```
232
+
233
+ ---
234
+
235
+ ## TypeScript Type Safety
236
+
237
+ ### Plugin Type Definitions
238
+
239
+ ```typescript
240
+ // file-tools.ts
241
+ args: {
242
+ filePath: string; // Required
243
+ sprintId: number; // Required
244
+ description?: string; // Optional
245
+ folder?: string; // Optional - S3 folder path
246
+ storyId?: number; // Optional - Link to story
247
+ }
248
+ ```
249
+
250
+ ### Server Request Body
251
+
252
+ ```typescript
253
+ // uploadController.ts
254
+ interface PresignRequest {
255
+ sprintId: number;
256
+ contentType: string;
257
+ originalName: string;
258
+ folder?: string; // Optional
259
+ }
260
+
261
+ interface CompleteRequest {
262
+ sprintId: number;
263
+ fileName: string;
264
+ originalName: string;
265
+ fileType: string;
266
+ size: number;
267
+ folder?: string; // Optional
268
+ storyId?: number; // Optional
269
+ x?: number;
270
+ y?: number;
271
+ }
272
+ ```
273
+
274
+ ### Frontend Compatibility
275
+
276
+ ```typescript
277
+ // Frontend calls remain unchanged
278
+ // No breaking changes
279
+ await api.post('/files/presign', {
280
+ sprintId,
281
+ contentType: file.type,
282
+ originalName: file.name,
283
+ // folder: undefined (uses default)
284
+ });
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Key Benefits
290
+
291
+ 1. **Organized S3 Structure** - Files grouped in logical folders
292
+ 2. **Backward Compatible** - Existing code works without changes
293
+ 3. **Flexible** - Use folders, doc_folders, or both
294
+ 4. **Type Safe** - Full TypeScript support
295
+ 5. **Future Ready** - Can add more organization features
296
+
297
+ ---
298
+
299
+ **Created:** 2026-04-12
300
+ **Version:** 1.0.0