@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.
- package/CHANGELOG.md +225 -0
- package/CODE_OF_CONDUCT.md +77 -0
- package/CONTRIBUTING.md +176 -0
- package/LICENSE +21 -0
- package/README.md +211 -0
- package/SECURITY.md +69 -0
- package/docs/CONFIGURATION.md +283 -0
- package/docs/DEVELOPER-VS-USER.md +129 -0
- package/docs/IMPROVED-AUTHENTICATION.md +317 -0
- package/docs/INSTALLATION-SCRIPTS.md +304 -0
- package/docs/PLANNER-AGENT-IMPROVEMENTS.md +88 -0
- package/docs/PLUGIN-ARCHITECTURE.md +308 -0
- package/docs/QUICKSTART-NON-DEV.md +94 -0
- package/docs/README-FOR-HUMANS-AND-AI.md +109 -0
- package/docs/README.md +70 -0
- package/docs/SKILLS-GAP-ANALYSIS.md +157 -0
- package/docs/USER-INTERACTION-MODEL.md +106 -0
- package/docs/file-management/2026-04-12-forloop-aivy-documents-sync.md +395 -0
- package/docs/file-management/FILE_UPLOAD_ENHANCEMENT.md +431 -0
- package/docs/file-management/FILE_UPLOAD_FLOW.md +300 -0
- package/docs/images/forloop-opencode-flow.png +0 -0
- package/docs/images/forloop-opencode-header.png +0 -0
- package/docs/superpowers/plans/2026-05-03-sprint-isolated-directory-structure.md +1450 -0
- package/docs/superpowers/plans/2026-05-29-install-system.md +850 -0
- package/docs/superpowers/specs/2026-05-03-sprint-isolated-directory-structure-design.md +149 -0
- package/docs/superpowers/specs/2026-05-19-opencode-message-recording-design.md +468 -0
- package/docs/superpowers/specs/2026-05-29-install-system-design.md +135 -0
- package/install.sh +317 -0
- package/package.json +87 -0
- package/plugins/capabilities/api-client.ts +556 -0
- package/plugins/capabilities/auth.ts +120 -0
- package/plugins/capabilities/config.ts +195 -0
- package/plugins/capabilities/context-resolver.ts +106 -0
- package/plugins/capabilities/token-storage.ts +98 -0
- package/plugins/forloop-plugin.ts +186 -0
- package/plugins/hooks/message-recorder.ts +258 -0
- package/plugins/hooks/shell-env.ts +62 -0
- package/plugins/tools/agent-sprint-tools.ts +100 -0
- package/plugins/tools/agent-suggestion-tools.ts +275 -0
- package/plugins/tools/agent-tools.ts +114 -0
- package/plugins/tools/ai-trigger-tools.ts +79 -0
- package/plugins/tools/developer-status-tool.ts +97 -0
- package/plugins/tools/file-tools.ts +240 -0
- package/plugins/tools/folder-tools.ts +75 -0
- package/plugins/tools/organization-tools.ts +213 -0
- package/plugins/tools/schedule-tools.ts +173 -0
- package/plugins/tools/sprint-tools.ts +287 -0
- package/plugins/tools/story-tools.ts +320 -0
- package/plugins/tools/sync-tools.ts +509 -0
- package/plugins/tools/template-tools.ts +170 -0
- package/plugins/tools/user-tools.ts +146 -0
- package/scripts/migrate-tokens.js +90 -0
- package/scripts/use-prod.sh +11 -0
- package/tsconfig.json +17 -0
- package/update.sh +172 -0
package/README.md
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="docs/images/forloop-opencode-header.png" alt="ForLoop Plugin for opencode" width="800">
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/forloop-cc/forloop-opencode-plugin-planner/stargazers)
|
|
7
|
+
|
|
8
|
+
**AI-powered sprint planning, story management, and task automation for opencode**
|
|
9
|
+
|
|
10
|
+
[Quick Install](#quick-install) · [How It Works](#how-it-works) · [Capabilities](#capabilities) · [FAQ](#faq)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
## What is This?
|
|
17
|
+
|
|
18
|
+
The **ForLoop Plugin** connects [opencode](https://opencode.ai) AI agents to your [ForLoop](https://forloop.cc) workspace. Describe what you need in plain language — the agent plans, creates stories, estimates effort, and tracks progress automatically. No commands to memorize.
|
|
19
|
+
|
|
20
|
+
***
|
|
21
|
+
|
|
22
|
+
## About ForLoop
|
|
23
|
+
|
|
24
|
+
[ForLoop](https://forloop.cc) is an **AI agent platform** for autonomous development and deployment. Think of it as your team's command center — a shared space where AI agents and humans collaborate on sprints, stories, and shipping code.
|
|
25
|
+
|
|
26
|
+
**Key features:**
|
|
27
|
+
|
|
28
|
+
- **AI Agents as team members** — specialized agents plan, code, review, and deploy. They create real branches, commits, and pull requests.
|
|
29
|
+
- **Sprint boards** — drag-and-drop story management with real-time collaboration, AI estimation, and progress tracking.
|
|
30
|
+
- **Autopilot development** — agents work through your sprint board automatically, with you reviewing and approving at every checkpoint.
|
|
31
|
+
- **Spaces** — shared workspaces with integrated Zoom meetings, AI transcription, and a searchable cross-org knowledge base.
|
|
32
|
+
- **Human-in-the-loop safety** — all AI-proposed changes go through review. Nothing ships without your approval.
|
|
33
|
+
|
|
34
|
+
**This plugin** brings the collaboration features — sprint planning, story management, file uploads, and team coordination — directly into your opencode IDE.
|
|
35
|
+
|
|
36
|
+
***
|
|
37
|
+
|
|
38
|
+
## Quick Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
curl -fsSL https://raw.githubusercontent.com/forloop-cc/forloop-opencode-plugin-planner/main/install.sh | bash
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The installer clones the plugin, installs dependencies, and configures opencode. Works on macOS, Linux, and Windows (Git Bash).
|
|
45
|
+
|
|
46
|
+
**Install options:**
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
curl -fsSL .../install.sh | bash # Interactive (local by default)
|
|
50
|
+
curl -fsSL .../install.sh | bash -s -- -g # Global (~/.config/opencode/)
|
|
51
|
+
curl -fsSL .../install.sh | bash -s -- -g -n # Global via npm package
|
|
52
|
+
```
|
|
53
|
+
opencode downloads and caches the plugin on startup — no manual git clone or npm install needed.
|
|
54
|
+
|
|
55
|
+
**Update later:**
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
curl -fsSL https://raw.githubusercontent.com/forloop-cc/forloop-opencode-plugin-planner/main/update.sh | bash
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Prerequisites
|
|
62
|
+
|
|
63
|
+
- [opencode](https://opencode.ai) CLI installed
|
|
64
|
+
- A [ForLoop](https://forloop.cc) account with an API token ([create one here](https://forloop.cc/profile?tab=api-tokens))
|
|
65
|
+
- Token scopes: `sprint:read`, `sprint:write`, `story:read`, `story:write`, `agent:query`, `profile:read`
|
|
66
|
+
|
|
67
|
+
### Set Your Token
|
|
68
|
+
|
|
69
|
+
**Easiest — ask the agent:**
|
|
70
|
+
```
|
|
71
|
+
"ForLoop Planner, please set my API token"
|
|
72
|
+
```
|
|
73
|
+
The agent will guide you through the setup.
|
|
74
|
+
|
|
75
|
+
**Manual setup:**
|
|
76
|
+
Create `~/.config/forloop/tokens.json`:
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"default": "floop_your_token_here",
|
|
80
|
+
"lastUpdated": "2026-01-01T00:00:00.000Z"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
The token file is stored at `~/.config/forloop/tokens.json` with restricted permissions. Edit or replace it anytime to rotate tokens.
|
|
84
|
+
|
|
85
|
+
***
|
|
86
|
+
|
|
87
|
+
## How It Works
|
|
88
|
+
|
|
89
|
+
<img src="docs/images/forloop-opencode-flow.png" alt="ForLoop Plugin workflow" width="800">
|
|
90
|
+
|
|
91
|
+
1. **You describe** what you need in plain language
|
|
92
|
+
2. **The agent** picks the right skills and tools automatically
|
|
93
|
+
3. **The plugin** connects to your ForLoop workspace via your API token
|
|
94
|
+
4. **Results** flow back — sprints planned, stories created, tasks tracked
|
|
95
|
+
|
|
96
|
+
***
|
|
97
|
+
|
|
98
|
+
## What You Can Ask Agents to Do
|
|
99
|
+
|
|
100
|
+
### Sprint Planning
|
|
101
|
+
|
|
102
|
+
| Agent can... | Try saying... |
|
|
103
|
+
| ------------------------------------------------- | --------------------------------------------------------- |
|
|
104
|
+
| Create and configure sprints with dates and goals | *"Set up sprint 15 starting next Monday, two weeks long"* |
|
|
105
|
+
| Review sprint status and progress | *"How is sprint 14 going? Show me all the stories"* |
|
|
106
|
+
| Update sprint details mid-cycle | *"Extend sprint 14 by one more week"* |
|
|
107
|
+
|
|
108
|
+
### Story Management
|
|
109
|
+
|
|
110
|
+
| Agent can... | Try saying... |
|
|
111
|
+
| ---------------------------------------- | -------------------------------------------------------------------------- |
|
|
112
|
+
| Create stories from scratch or templates | *"Create a story for adding user authentication"* |
|
|
113
|
+
| Break down large stories into tasks | *"Break down story #78 into smaller tasks"* |
|
|
114
|
+
| Update story status, priority, points | *"Mark story #78 as done and estimate the next one at 5 points"* |
|
|
115
|
+
| Create stories from templates | *"Create a basic task for the developer agent to implement the login API"* |
|
|
116
|
+
|
|
117
|
+
### AI-Assisted Planning
|
|
118
|
+
|
|
119
|
+
| Agent can... | Try saying... |
|
|
120
|
+
| --------------------------------------------- | ------------------------------------------------------------- |
|
|
121
|
+
| Get story breakdowns and implementation plans | *"Break down story #78 into subtasks"* |
|
|
122
|
+
| Estimate story point complexity | *"Estimate the points for my login feature"* |
|
|
123
|
+
| Get sprint-level suggestions | *"Suggest how to organize the remaining stories this sprint"* |
|
|
124
|
+
| Review conversation history | *"Show me what we discussed about sprint 14"* |
|
|
125
|
+
|
|
126
|
+
### Files & Documents
|
|
127
|
+
|
|
128
|
+
| Agent can... | Try saying... |
|
|
129
|
+
| ------------------------------ | --------------------------------------------------------- |
|
|
130
|
+
| Upload files to sprint storage | *"Upload requirements.pdf to sprint 14"* |
|
|
131
|
+
| List and manage sprint files | *"Show me all files in sprint 14"* |
|
|
132
|
+
| Create document folders | *"Create a docs folder for sprint 15"* |
|
|
133
|
+
| Download files | *"Get me the download link for the architecture diagram"* |
|
|
134
|
+
|
|
135
|
+
### Teams & Organizations
|
|
136
|
+
|
|
137
|
+
| Agent can... | Try saying... |
|
|
138
|
+
| ---------------------------- | ------------------------------------------------ |
|
|
139
|
+
| View organization membership | *"Show me who's on the Engineering team"* |
|
|
140
|
+
| Check usage quotas | *"How many stories do we have left this month?"* |
|
|
141
|
+
| Manage team settings | *"Create a new organization called Design Team"* |
|
|
142
|
+
|
|
143
|
+
***
|
|
144
|
+
|
|
145
|
+
## Plugin Capabilities
|
|
146
|
+
|
|
147
|
+
The plugin provides these tools to opencode agents. Agents use them automatically — you don't call them directly. For agent definitions and skills, see the [forloop-agents-skills](https://github.com/forloop-cc/forloop-agents-skills) repo.
|
|
148
|
+
|
|
149
|
+
**Sprint Management** — create, update, list, and delete sprints with full metadata\
|
|
150
|
+
**Story Operations** — full CRUD for stories with template support, priority, and points\
|
|
151
|
+
**AI Agent Tools** — story breakdown, point estimation, sprint suggestions, conversation history\
|
|
152
|
+
**File Management** — S3-backed upload, download, listing, and document folders\
|
|
153
|
+
**Organization Management** — teams, membership, and quota tracking\
|
|
154
|
+
**Scheduling** — create and manage sprint meetings with video links
|
|
155
|
+
|
|
156
|
+
***
|
|
157
|
+
|
|
158
|
+
## Agents & Skills
|
|
159
|
+
|
|
160
|
+
Agents and skills are maintained in a separate repo: **[forloop-agents-skills](https://github.com/forloop-cc/forloop-agents-skills)**. The installer (above) sets them up automatically. For manual setup:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
git clone https://github.com/forloop-cc/forloop-agents-skills.git ~/.config/forloop/agents-skills
|
|
164
|
+
ln -sf ~/.config/forloop/agents-skills/agents/*.md ~/.config/opencode/agents/
|
|
165
|
+
ln -sfn ~/.config/forloop/agents-skills/skills/*/ ~/.config/opencode/skills/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The repo includes 2 agents and 15 skills covering sprint planning, story creation, task tracking, file management, and more. See the [repo README](https://github.com/forloop-cc/forloop-agents-skills) for the full list.
|
|
169
|
+
|
|
170
|
+
### Included Agents
|
|
171
|
+
|
|
172
|
+
| Agent | Best for... |
|
|
173
|
+
| ---------------------------------------------- | --------------------------------------------------------------- |
|
|
174
|
+
| **ForLoop Planner** (`@forLoopPlanner`) | Sprint planning, story creation, task breakdown, sprint reviews |
|
|
175
|
+
| **Story Evaluator** (`@forLoopStoryEvaluator`) | Point estimation, complexity analysis |
|
|
176
|
+
|
|
177
|
+
***
|
|
178
|
+
|
|
179
|
+
## FAQ
|
|
180
|
+
|
|
181
|
+
**How do I use this?** Start opencode, switch to the ForLoop Planner agent (TAB), and describe what you need. The agent handles everything.
|
|
182
|
+
|
|
183
|
+
**What's opencode?** A free, open-source AI coding assistant. [Install here](https://opencode.ai).
|
|
184
|
+
|
|
185
|
+
**Do I need to memorize commands?** No. The agents use the tools automatically. Just talk to them.
|
|
186
|
+
|
|
187
|
+
**Where is my token stored?** `~/.config/forloop/tokens.json` with restricted file permissions.
|
|
188
|
+
|
|
189
|
+
**Can I auto-detect my sprint?** Yes — name your git branch `sprint-XXX` or set `FORLOOP_SPRINT_ID=14`.
|
|
190
|
+
|
|
191
|
+
**How do I uninstall?** Remove the plugin entry from your `opencode.json` plugin array. For agents and skills, delete the symlinks from `~/.config/opencode/agents/` and `~/.config/opencode/skills/`.
|
|
192
|
+
|
|
193
|
+
**Does this work on Windows?** Yes — use Git Bash or WSL.
|
|
194
|
+
|
|
195
|
+
***
|
|
196
|
+
|
|
197
|
+
## Contributing
|
|
198
|
+
|
|
199
|
+
Issues and PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
200
|
+
|
|
201
|
+
***
|
|
202
|
+
|
|
203
|
+
## Security
|
|
204
|
+
|
|
205
|
+
See [SECURITY.md](SECURITY.md). Never commit API tokens. Use minimum required scopes.
|
|
206
|
+
|
|
207
|
+
***
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT — see [LICENSE](LICENSE).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | ------------------ |
|
|
7
|
+
| 2.x.x | :white_check_mark: |
|
|
8
|
+
| 1.x.x | :x: |
|
|
9
|
+
|
|
10
|
+
## Reporting a Vulnerability
|
|
11
|
+
|
|
12
|
+
We take the security of the ForLoop Plugin seriously. If you believe you've found a security vulnerability, please follow these steps:
|
|
13
|
+
|
|
14
|
+
### How to Report
|
|
15
|
+
|
|
16
|
+
1. **DO NOT** create a public GitHub issue for security vulnerabilities
|
|
17
|
+
2. Email your findings to: [security@forloop.cc](mailto:security@forloop.cc)
|
|
18
|
+
3. Include the following information:
|
|
19
|
+
- Description of the vulnerability
|
|
20
|
+
- Steps to reproduce the issue
|
|
21
|
+
- Potential impact
|
|
22
|
+
- Suggested fix (if any)
|
|
23
|
+
- Your contact information
|
|
24
|
+
|
|
25
|
+
### What to Expect
|
|
26
|
+
|
|
27
|
+
- **Initial response**: Within 48 hours
|
|
28
|
+
- **Status update**: Within 5 business days
|
|
29
|
+
- **Resolution timeline**: Depends on severity and complexity
|
|
30
|
+
|
|
31
|
+
### Security Best Practices
|
|
32
|
+
|
|
33
|
+
When using the ForLoop Plugin:
|
|
34
|
+
|
|
35
|
+
1. **Token Security**
|
|
36
|
+
- Never commit API tokens to version control
|
|
37
|
+
- Use environment variables or secure token storage
|
|
38
|
+
- Rotate tokens regularly
|
|
39
|
+
- Use minimum required scopes
|
|
40
|
+
|
|
41
|
+
2. **Plugin Updates**
|
|
42
|
+
- Keep the plugin updated to the latest version
|
|
43
|
+
- Review changelog for security fixes
|
|
44
|
+
- Enable automatic updates when possible
|
|
45
|
+
|
|
46
|
+
3. **Access Control**
|
|
47
|
+
- Use organization-level tokens for team projects
|
|
48
|
+
- Limit token permissions to required scopes only
|
|
49
|
+
- Revoke unused or old tokens
|
|
50
|
+
|
|
51
|
+
### Known Security Measures
|
|
52
|
+
|
|
53
|
+
The plugin implements the following security features:
|
|
54
|
+
|
|
55
|
+
- Token storage with restricted file permissions (0o600)
|
|
56
|
+
- API token validation before requests
|
|
57
|
+
- Support for scoped API tokens
|
|
58
|
+
- Secure token exchange for Lambda execution
|
|
59
|
+
- No sensitive data in logs
|
|
60
|
+
|
|
61
|
+
### Security Audit Log
|
|
62
|
+
|
|
63
|
+
Check the [security advisories](https://github.com/forloop-cc/forloop-opencode-plugin/security/advisories) page for past security issues and resolutions.
|
|
64
|
+
|
|
65
|
+
## Responsible Disclosure
|
|
66
|
+
|
|
67
|
+
We appreciate responsible disclosure and will credit reporters (with permission) in our security advisories.
|
|
68
|
+
|
|
69
|
+
Thank you for helping keep the ForLoop Plugin secure!
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# ForLoop Plugin Configuration
|
|
2
|
+
|
|
3
|
+
## Environment Configuration
|
|
4
|
+
|
|
5
|
+
The plugin supports multiple environments, but defaults to **production** so public releases never accidentally connect to dev.
|
|
6
|
+
|
|
7
|
+
### Default Environments
|
|
8
|
+
|
|
9
|
+
| Environment | API URL | Use Case |
|
|
10
|
+
|-------------|---------|----------|
|
|
11
|
+
| **development** | `https://api.dev.forloop.cc` | Internal testing only (explicit opt-in) |
|
|
12
|
+
| **production** | `https://api.forloop.cc` | Production use, npm releases |
|
|
13
|
+
|
|
14
|
+
### Configuration Priority (highest to lowest)
|
|
15
|
+
|
|
16
|
+
1. **Environment Variable** - `FORLOOP_API_URL`
|
|
17
|
+
2. **Environment Selector** - `FORLOOP_ENV=production|development`
|
|
18
|
+
3. **Project Config** - `opencode.json` → `forloop.apiUrl`
|
|
19
|
+
4. **Global Config** - `~/.config/opencode/config.json` → `forloop.apiUrl`
|
|
20
|
+
5. **Default** - `https://api.forloop.cc`
|
|
21
|
+
|
|
22
|
+
### Dev Safety Gate
|
|
23
|
+
|
|
24
|
+
To use the dev API (`api.dev.forloop.cc`), you must explicitly enable it:
|
|
25
|
+
|
|
26
|
+
- `FORLOOP_ALLOW_DEV=true` (recommended)
|
|
27
|
+
- or `opencode.json` / global config `forloop.allowDev: true`
|
|
28
|
+
|
|
29
|
+
If a dev URL is configured without the allow flag, the plugin will fall back to production.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Configuration Methods
|
|
34
|
+
|
|
35
|
+
### Method 1: Environment Variable (Recommended for Development)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Internal dev testing (explicit opt-in)
|
|
39
|
+
export FORLOOP_ALLOW_DEV=true
|
|
40
|
+
export FORLOOP_API_URL=https://api.dev.forloop.cc
|
|
41
|
+
|
|
42
|
+
# Or add to .env file (do not commit)
|
|
43
|
+
cat >> .env << 'EOF'
|
|
44
|
+
FORLOOP_ALLOW_DEV=true
|
|
45
|
+
FORLOOP_API_URL=https://api.dev.forloop.cc
|
|
46
|
+
EOF
|
|
47
|
+
|
|
48
|
+
# Or use opencode with env
|
|
49
|
+
FORLOOP_ALLOW_DEV=true FORLOOP_API_URL=https://api.dev.forloop.cc opencode
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Method 2: opencode.json (Project-specific)
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"$schema": "https://opencode.ai/config.json",
|
|
57
|
+
"plugin": ["forloop@git+https://github.com/forloop-cc/forloop-opencode-plugin.git"],
|
|
58
|
+
"forloop": {
|
|
59
|
+
"apiUrl": "https://api.dev.forloop.cc",
|
|
60
|
+
"allowDev": true,
|
|
61
|
+
"tokenStorage": "global",
|
|
62
|
+
"debug": true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Method 3: Global Config (All Projects)
|
|
68
|
+
|
|
69
|
+
Edit `~/.config/opencode/config.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"forloop": {
|
|
74
|
+
"apiUrl": "https://api.dev.forloop.cc",
|
|
75
|
+
"allowDev": true
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Method 4: Environment Selector (Recommended)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Production (default)
|
|
84
|
+
FORLOOP_ENV=production opencode
|
|
85
|
+
|
|
86
|
+
# Development (internal only; requires allow)
|
|
87
|
+
FORLOOP_ENV=development FORLOOP_ALLOW_DEV=true opencode
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Usage Examples
|
|
93
|
+
|
|
94
|
+
### Development Workflow
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 1. Clone the plugin for local development
|
|
98
|
+
git clone https://github.com/forloop-cc/forloop-opencode-plugin.git
|
|
99
|
+
cd forloop-opencode-plugin
|
|
100
|
+
|
|
101
|
+
# 2. Set development environment
|
|
102
|
+
export FORLOOP_API_URL=https://api.dev.forloop.cc
|
|
103
|
+
export NODE_ENV=development
|
|
104
|
+
|
|
105
|
+
# 3. Use the plugin (it will connect to dev API)
|
|
106
|
+
opencode
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Testing Against Dev Environment
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Quick test without permanent config
|
|
113
|
+
FORLOOP_API_URL=https://api.dev.forloop.cc opencode run "forloopSprintList"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Production Deployment
|
|
117
|
+
|
|
118
|
+
When publishing to npm, the default is production:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"plugin": ["forloop@git+https://github.com/forloop-cc/forloop-opencode-plugin.git"]
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Users will connect to `https://api.forloop.cc` by default.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Debug Mode
|
|
131
|
+
|
|
132
|
+
Enable debug logging to see what's happening:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Via environment variable
|
|
136
|
+
export FORLOOP_DEBUG=true
|
|
137
|
+
|
|
138
|
+
# Or in opencode.json
|
|
139
|
+
{
|
|
140
|
+
"forloop": {
|
|
141
|
+
"debug": true
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
This will log:
|
|
147
|
+
```
|
|
148
|
+
[ForLoop Config] {
|
|
149
|
+
apiUrl: 'https://api.forloop.cc',
|
|
150
|
+
environment: 'production',
|
|
151
|
+
debug: true
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Environment Detection
|
|
158
|
+
|
|
159
|
+
The plugin automatically detects the environment:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// Internal config detection
|
|
163
|
+
if (apiUrl.includes('dev.forloop.cc')) {
|
|
164
|
+
environment = 'development';
|
|
165
|
+
} else if (apiUrl.includes('api.forloop.cc')) {
|
|
166
|
+
environment = 'production';
|
|
167
|
+
} else {
|
|
168
|
+
environment = 'custom';
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
You'll see this in console output:
|
|
173
|
+
```
|
|
174
|
+
[ForLoop] Plugin initialized - development (https://api.dev.forloop.cc)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Quick Reference
|
|
180
|
+
|
|
181
|
+
### Switch to Dev Environment
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
export FORLOOP_ALLOW_DEV=true
|
|
185
|
+
export FORLOOP_API_URL=https://api.dev.forloop.cc
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Switch to Production
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
unset FORLOOP_API_URL # Uses default production
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Check Current Config
|
|
195
|
+
|
|
196
|
+
The plugin logs the environment on startup:
|
|
197
|
+
```
|
|
198
|
+
[ForLoop] Plugin initialized - development (https://api.dev.forloop.cc)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Best Practices
|
|
204
|
+
|
|
205
|
+
### For Development
|
|
206
|
+
- Use `FORLOOP_API_URL` environment variable
|
|
207
|
+
- Enable debug mode for troubleshooting
|
|
208
|
+
- Use dev API (`api.dev.forloop.cc`)
|
|
209
|
+
- Store config in project `.env` (not committed to git)
|
|
210
|
+
|
|
211
|
+
### For Production
|
|
212
|
+
- Use default configuration (no env vars needed)
|
|
213
|
+
- Default API is `api.forloop.cc`
|
|
214
|
+
- Keep debug mode off
|
|
215
|
+
- Document any custom configs for your team
|
|
216
|
+
|
|
217
|
+
### For npm Distribution
|
|
218
|
+
- Default to production in package
|
|
219
|
+
- Allow override via env variables
|
|
220
|
+
- Document all configuration options
|
|
221
|
+
- Provide development setup instructions
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Troubleshooting
|
|
226
|
+
|
|
227
|
+
### Wrong environment showing
|
|
228
|
+
|
|
229
|
+
Check configuration priority:
|
|
230
|
+
```bash
|
|
231
|
+
echo "FORLOOP_API_URL: $FORLOOP_API_URL"
|
|
232
|
+
echo "NODE_ENV: $NODE_ENV"
|
|
233
|
+
cat opencode.json | grep -A5 "forloop"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Can't connect to API
|
|
237
|
+
|
|
238
|
+
Verify the endpoint:
|
|
239
|
+
```bash
|
|
240
|
+
curl -s https://api.dev.forloop.cc/health
|
|
241
|
+
curl -s https://api.forloop.cc/health
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Config not loading
|
|
245
|
+
|
|
246
|
+
Restart opencode after changing config:
|
|
247
|
+
```bash
|
|
248
|
+
# opencode caches plugins, restart to reload
|
|
249
|
+
exit
|
|
250
|
+
opencode
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Advanced: Custom API Endpoint
|
|
256
|
+
|
|
257
|
+
You can point to any API endpoint:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"forloop": {
|
|
262
|
+
"apiUrl": "https://your-custom-api.example.com"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This will be detected as `environment: 'custom'`.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Environment Variables Summary
|
|
272
|
+
|
|
273
|
+
| Variable | Description | Example |
|
|
274
|
+
|----------|-------------|---------|
|
|
275
|
+
| `FORLOOP_API_URL` | Override API endpoint | `https://api.dev.forloop.cc` |
|
|
276
|
+
| `NODE_ENV` | Auto-detect environment | `development` or `production` |
|
|
277
|
+
| `FORLOOP_DEBUG` | Enable debug logging | `true` |
|
|
278
|
+
| `DEV` | Shortcut for dev mode | `true` |
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
**Updated:** 2026-03-23
|
|
283
|
+
**Version:** 2.0.0
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Developer vs User Perspective
|
|
2
|
+
|
|
3
|
+
This document clarifies the difference between **developing** the plugin and **using** the plugin.
|
|
4
|
+
|
|
5
|
+
## Plugin Development (You write TypeScript)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
9
|
+
│ Developer Workspace │
|
|
10
|
+
│ │
|
|
11
|
+
│ plugins/ │
|
|
12
|
+
│ ├── forloop-plugin.ts ← Main entry point │
|
|
13
|
+
│ ├── tools/ │
|
|
14
|
+
│ │ ├── sprint-tools.ts ← You edit these │
|
|
15
|
+
│ │ ├── story-tools.ts ← TypeScript functions │
|
|
16
|
+
│ │ └── agent-tools.ts │
|
|
17
|
+
│ ├── capabilities/ │
|
|
18
|
+
│ │ ├── api-client.ts ← API calls │
|
|
19
|
+
│ │ └── auth.ts ← Authentication │
|
|
20
|
+
│ └── hooks/ │
|
|
21
|
+
│ └── shell-env.ts │
|
|
22
|
+
│ │
|
|
23
|
+
│ Development commands: │
|
|
24
|
+
│ - npm run test:unit # Run tests │
|
|
25
|
+
│ - npm run lint # Check code quality │
|
|
26
|
+
│ - npm run install:local # Install for testing │
|
|
27
|
+
│ - npm publish # Publish to npm │
|
|
28
|
+
└──────────────────────────────────────────────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Plugin Usage (You type commands in chat)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
35
|
+
│ User's opencode Chat │
|
|
36
|
+
│ │
|
|
37
|
+
│ $ opencode │
|
|
38
|
+
│ ───────────────────────────────────────────────────────── │
|
|
39
|
+
│ │
|
|
40
|
+
│ You: forloopSprintList │
|
|
41
|
+
│ └─ Lists all sprints │
|
|
42
|
+
│ │
|
|
43
|
+
│ You: forloopStoryCreate │
|
|
44
|
+
│ --title "As a user, I want to login" │
|
|
45
|
+
│ --sprintId 14 │
|
|
46
|
+
│ └─ Creates a new story │
|
|
47
|
+
│ │
|
|
48
|
+
│ You: forloopAgentBreakdown --storyId 78 │
|
|
49
|
+
│ └─ Gets AI breakdown of story │
|
|
50
|
+
│ │
|
|
51
|
+
│ You never see or touch the TypeScript code! │
|
|
52
|
+
└──────────────────────────────────────────────────────────────┘
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Comparison Table
|
|
56
|
+
|
|
57
|
+
| Aspect | Plugin Developer | Plugin User |
|
|
58
|
+
|--------|-----------------|-------------|
|
|
59
|
+
| **Edit TypeScript files** | ✅ Yes | ❌ No |
|
|
60
|
+
| **Run npm commands** | ✅ Yes | ❌ No |
|
|
61
|
+
| **Use `forloop.*` tools** | ✅ Yes (for testing) | ✅ Yes (main usage) |
|
|
62
|
+
| **Need Node.js installed** | ✅ Yes | ⚠️ Only for opencode |
|
|
63
|
+
| **Need opencode installed** | ✅ Yes | ✅ Yes |
|
|
64
|
+
| **Need ForLoop account** | ✅ Yes | ✅ Yes |
|
|
65
|
+
| **Read this plugin's code** | ✅ Yes | ❌ No |
|
|
66
|
+
|
|
67
|
+
## Installation Paths
|
|
68
|
+
|
|
69
|
+
### Developers (Full Setup)
|
|
70
|
+
```bash
|
|
71
|
+
# Clone repository
|
|
72
|
+
git clone https://github.com/forloop-cc/forloop-opencode-plugin.git
|
|
73
|
+
|
|
74
|
+
# Install dependencies
|
|
75
|
+
cd forloop-opencode-plugin
|
|
76
|
+
npm install
|
|
77
|
+
|
|
78
|
+
# Run tests
|
|
79
|
+
npm test
|
|
80
|
+
|
|
81
|
+
# Install locally for development
|
|
82
|
+
npm run install:local
|
|
83
|
+
|
|
84
|
+
# Test in opencode
|
|
85
|
+
opencode
|
|
86
|
+
> forloopSprintList
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Users (Simple Setup)
|
|
90
|
+
```bash
|
|
91
|
+
# Option 1: One-line install
|
|
92
|
+
curl -fsSL https://raw.githubusercontent.com/forloop-cc/forloop-opencode-plugin/main/install.sh | bash
|
|
93
|
+
|
|
94
|
+
# Option 2: npm
|
|
95
|
+
npm install @forloop/opencode-plugin
|
|
96
|
+
|
|
97
|
+
# Then just use in opencode
|
|
98
|
+
opencode
|
|
99
|
+
> forloopSprintList
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## When Do You Need TypeScript Knowledge?
|
|
103
|
+
|
|
104
|
+
| Scenario | TypeScript Required? |
|
|
105
|
+
|----------|---------------------|
|
|
106
|
+
| Using existing tools | ❌ No |
|
|
107
|
+
| Creating new stories | ❌ No |
|
|
108
|
+
| Managing sprints | ❌ No |
|
|
109
|
+
| Getting AI suggestions | ❌ No |
|
|
110
|
+
| **Adding new tools** | ✅ Yes |
|
|
111
|
+
| **Modifying existing tools** | ✅ Yes |
|
|
112
|
+
| **Contributing to plugin** | ✅ Yes |
|
|
113
|
+
| **Fixing bugs in plugin** | ✅ Yes |
|
|
114
|
+
|
|
115
|
+
## Summary
|
|
116
|
+
|
|
117
|
+
**As a USER:**
|
|
118
|
+
- Think of this like a "skill" or "power-up" for opencode
|
|
119
|
+
- You just use the commands in chat
|
|
120
|
+
- No coding required
|
|
121
|
+
|
|
122
|
+
**As a DEVELOPER:**
|
|
123
|
+
- You're extending opencode's capabilities
|
|
124
|
+
- You write TypeScript that opencode will execute
|
|
125
|
+
- You test, publish, and maintain the plugin
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
**Questions?** See [How Users Interact](USER-INTERACTION-MODEL.md) for more details.
|