@relipa/ai-flow-kit 0.0.4 → 0.0.5-beta.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 (41) hide show
  1. package/{docs/README.md → README.md} +25 -18
  2. package/bin/aiflow.js +77 -7
  3. package/custom/skills/{validate-ticket → read-study-requirement}/SKILL.md +27 -17
  4. package/custom/skills/review-plan/SKILL.md +1 -1
  5. package/custom/templates/shared/gate-workflow.md +88 -75
  6. package/custom/templates/tools/claude.md +1 -1
  7. package/custom/templates/tools/copilot.md +1 -1
  8. package/custom/templates/tools/cursor.md +1 -1
  9. package/custom/templates/tools/gemini.md +1 -1
  10. package/custom/templates/tools/generic.md +1 -1
  11. package/docs/{AIFLOW.md → common/AIFLOW.md} +462 -458
  12. package/docs/{CHANGELOG.md → common/CHANGELOG.md} +132 -100
  13. package/docs/{cli-reference.md → common/cli-reference.md} +98 -28
  14. package/docs/{troubleshooting.md → common/troubleshooting.md} +15 -0
  15. package/docs/project/ARCHITECTURE.md +28 -0
  16. package/package.json +7 -5
  17. package/scripts/context.js +1 -1
  18. package/scripts/guide.js +16 -0
  19. package/scripts/hooks/session-start.js +145 -141
  20. package/scripts/init.js +168 -44
  21. package/scripts/prompt.js +431 -402
  22. package/scripts/telemetry/cli.js +243 -0
  23. package/scripts/telemetry/config.js +91 -0
  24. package/scripts/telemetry/crypto.js +20 -0
  25. package/scripts/telemetry/flush.js +162 -0
  26. package/scripts/telemetry/record.js +138 -0
  27. package/scripts/use.js +74 -31
  28. package/upstream/skills/using-superpowers/SKILL.md +14 -0
  29. package/docs/IMPLEMENTATION_SUMMARY.md +0 -330
  30. package/docs/architecture.md +0 -394
  31. package/docs/developer-overview.md +0 -126
  32. package/upstream/tests/brainstorm-server/package-lock.json +0 -36
  33. /package/docs/{QUICK_START.md → common/QUICK_START.md} +0 -0
  34. /package/docs/{ai-integration.md → common/ai-integration.md} +0 -0
  35. /package/docs/{configuration.md → common/configuration.md} +0 -0
  36. /package/docs/{getting-started.md → common/getting-started.md} +0 -0
  37. /package/docs/{workflows → common/workflows}/bug-fix.md +0 -0
  38. /package/docs/{workflows → common/workflows}/feature.md +0 -0
  39. /package/docs/{workflows → common/workflows}/impact-analysis.md +0 -0
  40. /package/docs/{workflows → common/workflows}/investigation.md +0 -0
  41. /package/docs/{workflows → common/workflows}/refactor.md +0 -0
@@ -1,394 +0,0 @@
1
- # AI Flow Kit Architecture
2
-
3
- This document explains how AI Flow Kit works and how to customize it for your team.
4
-
5
- ## System Overview
6
-
7
- ```
8
- ┌─────────────────────────────────────────────────────────┐
9
- │ Developer │
10
- │ (runs aiflow commands) │
11
- └────────────────────┬────────────────────────────────────┘
12
-
13
- ┌────────────▼──────────────┐
14
- │ CLI (bin/aiflow.js) │
15
- │ ├─ init │
16
- │ ├─ use (load context) │
17
- │ ├─ prompt (generate) │
18
- │ ├─ detect (task type) │
19
- │ ├─ update │
20
- │ ├─ doctor │
21
- │ └─ validate │
22
- └────────────────┬──────────┘
23
-
24
- ┌────────────────┼──────────────────┐
25
- │ │ │
26
- ┌────▼────┐ ┌──────▼──────┐ ┌───────▼──────┐
27
- │ Scripts │ │ Adapters │ │ Config │
28
- │ ├─ init │ │ ├─ jira │ │ (.aiflowrc) │
29
- │ ├─ use │ │ ├─ backlog │ └──────────────┘
30
- │ ├─ detect
31
- │ ├─ context
32
- │ └─ validate
33
- └────┬────┘ │ └─ sheets │
34
- │ └─────┬──────┘
35
- │ │
36
- ┌────┴──────┬──────┴───┐
37
- │ │ │
38
- ┌──▼──┐ ┌──────▼──┐ ┌───▼────┐
39
- │.claude │.rules │ │.aiflow │
40
- │ │ │ │(state) │
41
- │├─skills │├─code │ └─────────┘
42
- │├─context ││ style│
43
- │└─prompts │├─naming│
44
- │ │└─review│
45
- └──────────└────────┘
46
-
47
-
48
- ┌─────┴──────┐
49
- │ Upstream │
50
- │ (obra.dev) │
51
- │ Skills │
52
- │ & Prompts │
53
- └────────────┘
54
- ```
55
-
56
- ## Key Components
57
-
58
- ### 1. CLI (bin/aiflow.js)
59
-
60
- Entry point for all user commands. Routes to appropriate script.
61
-
62
- **Commands:**
63
- - `init` — Initialize project with skills and templates
64
- - `use` — Load context from ticket or file
65
- - `prompt` — Generate AI prompt with context
66
- - `detect` — Auto-detect task type from description
67
- - `update` — Update to latest version
68
- - `doctor` — Health check
69
- - `validate` — Validate AI output quality
70
-
71
- ### 2. Configuration System
72
-
73
- Three levels of configuration:
74
-
75
- **Global** (`~/.claude/ai-flow-kit.json`)
76
- ```json
77
- {
78
- "defaultModel": "claude-opus-4-6",
79
- "globalSkills": ["investigate-bug"]
80
- }
81
- ```
82
-
83
- **Project** (`.aiflowrc.json`)
84
- ```json
85
- {
86
- "team": "engineering",
87
- "adapters": ["jira"],
88
- "frameworks": ["laravel"],
89
- "autoDetectTasks": true
90
- }
91
- ```
92
-
93
- **Local** (`.aiflow/state.json`)
94
- ```json
95
- {
96
- "current_version": "1.0.0",
97
- "current_context": "JIRA-123"
98
- }
99
- ```
100
-
101
- ### 3. Skill System
102
-
103
- Skills are step-by-step instructions for AI workflows.
104
-
105
- **Upstream skills** (from obra/superpowers):
106
- - `brainstorming` — Explore ideas
107
- - `writing-plans` — Create implementation plans
108
- - `executing-plans` — Execute plans with checkpoints
109
- - `systematic-debugging` — Debug issues methodically
110
- - `test-driven-development` — TDD workflow
111
- - etc.
112
-
113
- **Custom skills** (in `custom/skills/`):
114
- - `investigate-bug` — Trace bugs through data flow
115
- - `impact-analysis` — Assess change scope
116
- - `generate-spec` — Create feature specifications
117
- - etc.
118
-
119
- Skills are merged during `aiflow init` and `aiflow update`.
120
-
121
- ### 4. Task Detection
122
-
123
- Auto-classifies what the developer is doing:
124
-
125
- ```
126
- Input: "Payment integration broken in checkout"
127
-
128
- Analysis:
129
- - Contains: "broken" (bug indicator)
130
- - Location: "checkout" (specific area)
131
- - Type: Bug fix
132
-
133
- Output: "investigate-bug" skill
134
- ```
135
-
136
- **Detection rules** (in `scripts/detect.js`):
137
- - Keywords: "bug", "error", "broken", "crash" → bug fix
138
- - Keywords: "add", "create", "build", "new" → feature
139
- - Keywords: "improve", "optimize", "refactor" → refactor
140
- - Keywords: "analyze", "investigate", "understand" → investigation
141
-
142
- ### 5. Context System
143
-
144
- Stores task information for AI reference.
145
-
146
- **Structure:**
147
- ```
148
- .claude/context/
149
- ├── current.json # Current task
150
- ├── history/
151
- │ ├── JIRA-123.json
152
- │ ├── JIRA-124.json
153
- │ └── ...
154
- └── templates/
155
- ├── bug-fix.json
156
- ├── feature.json
157
- └── ...
158
- ```
159
-
160
- **Content:**
161
- ```json
162
- {
163
- "taskId": "JIRA-123",
164
- "taskType": "bug-fix",
165
- "title": "Payment processing fails",
166
- "description": "Users see error...",
167
- "acceptanceCriteria": ["...", "..."],
168
- "context": {
169
- "files": ["src/Payment.php"],
170
- "services": ["PaymentService"],
171
- "models": ["Transaction"],
172
- "relatedTickets": ["JIRA-120", "JIRA-121"]
173
- },
174
- "metadata": {
175
- "created": "2024-04-03T10:00:00Z",
176
- "loadedFrom": "jira",
177
- "adapter": "jira"
178
- }
179
- }
180
- ```
181
-
182
- ### 6. MCP Adapter System
183
-
184
- Integrates with external tools (Jira, Backlog, etc).
185
-
186
- **How it works:**
187
- 1. User runs: `aiflow use JIRA-123`
188
- 2. CLI checks MCP config for `jira` server
189
- 3. Calls Jira API via MCP to fetch issue
190
- 4. Parses and stores in `context/current.json`
191
- 5. Generates prompt with context
192
-
193
- **Adapters:**
194
- ```json
195
- custom/mcp-presets/jira.json
196
- {
197
- "mcpServers": {
198
- "jira": {
199
- "command": "npx",
200
- "args": ["@modelcontextprotocol/server-jira"],
201
- "env": {
202
- "JIRA_API_TOKEN": "{{API_TOKEN}}",
203
- "JIRA_EMAIL": "{{EMAIL}}",
204
- "JIRA_DOMAIN": "{{DOMAIN}}"
205
- }
206
- }
207
- }
208
- }
209
- ```
210
-
211
- ### 7. Template System
212
-
213
- Pre-made structures for different task types and frameworks.
214
-
215
- **Prompt Templates** (`custom/prompts/`):
216
- - `bug-fix.md` — Template for bug fixing workflow
217
- - `feature.md` — Template for feature building
218
- - `investigation.md` — Template for code investigation
219
- - etc.
220
-
221
- **Framework Templates** (`custom/templates/`):
222
- - `laravel.md` — Laravel-specific rules and patterns
223
- - `nextjs.md` — Next.js specific rules
224
- - etc.
225
-
226
- ## Data Flow Examples
227
-
228
- ### Example 1: Load and Prompt
229
-
230
- ```
231
- aiflow use JIRA-123
232
-
233
- [Load from MCP Adapter]
234
- - Fetch issue from Jira
235
- - Parse description, criteria
236
- - Save to .aiflow/context/current.json
237
-
238
- aiflow prompt bug-fix
239
-
240
- [Generate Prompt]
241
- - Read context from current.json
242
- - Load bug-fix template
243
- - Load laravel rules
244
- - Merge all content
245
- - Print to console (copy to Claude)
246
-
247
- Developer copies → Claude Code
248
-
249
- Claude runs appropriate skill (auto-detected)
250
- ```
251
-
252
- ### Example 2: Auto-Detection
253
-
254
- ```
255
- Prompt: "We have users reporting that orders aren't saved"
256
-
257
- aiflow detect "We have users reporting that orders aren't saved"
258
-
259
- [Analysis]
260
- Keywords: "orders aren't saved" (bug pattern)
261
- Type: Bug fix
262
- Confidence: 95%
263
-
264
- Output: Use "investigate-bug" skill
265
-
266
- Claude will follow:
267
- 1. Understand context
268
- 2. Trace data flow
269
- 3. Check git history
270
- 4. Propose solution
271
- ```
272
-
273
- ## Folder Structure
274
-
275
- ```
276
- ai-flow-kit/
277
- ├── bin/
278
- │ └── aiflow.js # CLI entry point
279
-
280
- ├── scripts/ # Core functionality
281
- │ ├── init.js # Initialize project
282
- │ ├── update.js # Update version
283
- │ ├── use.js # Load context
284
- │ ├── detect.js # Detect task type
285
- │ ├── doctor.js # Health check
286
- │ ├── validate.js # Validate output
287
- │ ├── context.js # Context management
288
- │ ├── config.js # Config loader
289
- │ └── memory.js # Memory system
290
-
291
- ├── custom/ # Team customizations
292
- │ ├── skills/ # Custom skills
293
- │ │ ├── investigate-bug/
294
- │ │ ├── impact-analysis/
295
- │ │ ├── report-customer/
296
- │ │ └── generate-spec/
297
- │ ├── rules/ # Team standards
298
- │ │ ├── code-style.md
299
- │ │ ├── naming.md
300
- │ │ └── review-checklist.md
301
- │ ├── templates/ # Framework rules
302
- │ │ ├── laravel.md
303
- │ │ ├── nextjs.md
304
- │ │ └── vue-nuxt.md
305
- │ ├── prompts/ # Task templates
306
- │ │ ├── bug-fix.md
307
- │ │ ├── feature.md
308
- │ │ ├── investigation.md
309
- │ │ └── refactor.md
310
- │ └── mcp-presets/ # MCP configs
311
- │ ├── jira.json
312
- │ ├── backlog.json
313
- │ └── google-sheets.json
314
-
315
- ├── upstream/ # Original obra/superpowers
316
- │ ├── skills/
317
- │ ├── agents/
318
- │ └── commands/
319
-
320
- ├── docs/ # Documentation
321
- │ ├── architecture.md # This file
322
- │ ├── getting-started.md
323
- │ ├── configuration.md
324
- │ ├── cli-reference.md
325
- │ ├── workflows/
326
- │ │ ├── bug-fix.md
327
- │ │ ├── feature.md
328
- │ │ ├── investigation.md
329
- │ │ └── refactor.md
330
- │ └── troubleshooting.md
331
-
332
- ├── docs/ # Documentation
333
- ├── package.json
334
- └── index.js
335
- ```
336
-
337
- ## Customization Points
338
-
339
- ### Add a Custom Skill
340
-
341
- 1. Create `custom/skills/my-skill/SKILL.md`
342
- 2. Follow skill format (see technical documentation)
343
- 3. Run `aiflow update` to activate
344
- 4. Skill appears in `.claude/skills/`
345
-
346
- ### Add a Rule
347
-
348
- 1. Create `custom/rules/my-rule.md`
349
- 2. Describe the rule with examples
350
- 3. Run `aiflow update`
351
- 4. Rule appears in prompts via `aiflow prompt`
352
-
353
- ### Add a Task Type
354
-
355
- 1. Create `custom/prompts/my-task.md`
356
- 2. Design template structure
357
- 3. Run `aiflow update`
358
- 4. Use with `aiflow prompt my-task`
359
-
360
- ### Add Framework Support
361
-
362
- 1. Create `custom/templates/my-framework.md`
363
- 2. Define framework-specific rules
364
- 3. Users can: `aiflow init --framework my-framework`
365
-
366
- ## Extension Points
367
-
368
- The system is designed to extend:
369
-
370
- - **Custom skills:** Add domain-specific workflows
371
- - **Rules:** Add team standards and best practices
372
- - **Adapters:** Connect to more tools (Linear, GitHub, etc)
373
- - **Validators:** Check output quality
374
- - **Plugins:** Custom commands and functionality
375
-
376
- See technical documentation for details.
377
-
378
- ## Best Practices
379
-
380
- 1. **Keep upstream separate** — Don't modify `upstream/`. Copy to `custom/` if needed.
381
-
382
- 2. **Version your customizations** — Track `custom/` in git, not `upstream/`.
383
-
384
- 3. **Document team rules** — Add to `custom/rules/`. Make them explicit.
385
-
386
- 4. **Use configuration** — Store team settings in `.aiflowrc.json`.
387
-
388
- 5. **Test before sharing** — Use `aiflow doctor` and test each contribution.
389
-
390
- 6. **Share with team** — Version control makes updates easy: `git pull && aiflow update`.
391
-
392
- ---
393
-
394
- **Understanding the architecture helps you customize AI Flow Kit for your team's needs!**
@@ -1,126 +0,0 @@
1
- # AI Flow Kit — Developer Rollout Guide
2
-
3
- Welcome to the **AI Flow Kit**! This guide is designed to get you up and running with our standardized AI development workflow.
4
-
5
- ## 1. What is AI Flow Kit?
6
-
7
- It's a "Zero-Config" framework for AI-assisted development. It automatically:
8
- - Pulls ticket context (requirements, comments) from Backlog/Jira.
9
- - Orchestrates a **5-Gate Workflow** (Analyze → Plan → Code → Review → PR).
10
- - Enforces team coding standards and architecture rules.
11
- - Synchronizes state across different AI tools (Claude, Cursor, Gemini).
12
-
13
- ---
14
-
15
- ## 2. Prerequisites
16
-
17
- Before starting, ensure you have:
18
- 1. **Node.js** (v18 or higher).
19
- 2. **AI Tool(s)**:
20
- - **Claude Code CLI** (Recommended for analysis and heavy tasks).
21
- - **Cursor AI** (Recommended for coding and UI work).
22
- - **Gemini CLI** or **GitHub Copilot** (Alternative options).
23
-
24
- ---
25
-
26
- ## 3. Installation
27
-
28
- Run this command to install the CLI tool globally:
29
-
30
- ```bash
31
- # Stable version
32
- npm install -g @relipa/ai-flow-kit
33
-
34
- # Beta version (recommend for newest features)
35
- npm install -g @relipa/ai-flow-kit@beta
36
-
37
- # Verification
38
- aiflow --version
39
-
40
- # Uninstall
41
- npm uninstall -g @relipa/ai-flow-kit
42
-
43
- ---
44
-
45
- ## 4. First-time Setup
46
-
47
- In your project root, run:
48
-
49
- ```bash
50
- aiflow init --framework [your-framework] --adapter [backlog/jira]
51
- ```
52
- *Example: `aiflow init --framework nestjs --adapter backlog`*
53
-
54
- **What this does:**
55
- 1. Verifies your API keys.
56
- 2. Creates instruction files: `CLAUDE.md`, `.cursorrules`, `GEMINI.md`.
57
- 3. Installs "Superpowers" skills.
58
-
59
- ---
60
-
61
- ## 5. Daily Task Workflow (The 5 Gates)
62
-
63
- ### Step 1: Start a Task
64
- Load the ticket context from your issue tracker:
65
- ```bash
66
- aiflow use PROJ-33
67
- ```
68
-
69
- ### Step 2: Open your AI Tool
70
- - **Claude Code**: Type `claude`. The AI will automatically start **Gate 1**.
71
- - **Cursor**: Just start chatting with Cursor. It will detect the active ticket and start analyzing.
72
-
73
- ### Step 3: Follow the Gates
74
- The AI *must* pass each gate in order. You act as the **Reviewer**.
75
-
76
- 1. **⛩️ Gate 1: Requirement Analysis**
77
- - AI reads code + ticket.
78
- - AI outputs `plan/PROJ-33/requirement.md`.
79
- - **Your Action**: Read the doc. If OK, type `APPROVED`.
80
-
81
- 2. **⛩️ Gate 2: Implementation Plan**
82
- - AI creates a step-by-step TDD plan.
83
- - **Your Action**: Type `APPROVED` to start coding.
84
-
85
- 3. **⛩️ Gate 3: Coding (TDD)**
86
- - AI writes tests first, then code.
87
- - **Your Action**: Monitor.
88
-
89
- 4. **⛩️ Gate 4: Self-Review**
90
- - AI verifies tests and checks a review-checklist.
91
- - **Your Action**: Review the final diff. If OK, type `APPROVED`.
92
-
93
- 5. **⛩️ Gate 5: Pull Request**
94
- - AI helps you write a detailed PR description.
95
- - **Your Action**: Create the PR and ask for a peer review.
96
-
97
- ---
98
-
99
- ## 6. Switching AI Tools Mid-Task
100
-
101
- You can switch tools at any time because the "brain" (the State) is stored in your project files.
102
-
103
- **Example Scenario:**
104
- 1. Use **Claude Code CLI** for **Gate 1** (Analysis) because it's great at exploring many files.
105
- 2. Once you type `APPROVED`, close Claude.
106
- 3. Open **Cursor** for **Gate 3** (Coding) to take advantage of its excellent editor integration. Cursor will see you've already finished the analysis and will continue from the plan.
107
-
108
- ---
109
-
110
- ## 7. Best Practices
111
-
112
- - **One question at a time**: If the AI asks 5 questions, answer them one by one or ignore the irrelevant ones.
113
- - **Small commits**: Let the AI commit frequently (default behavior).
114
- - **Be the Pilot**: The AI is your co-pilot. If its solution looks over-engineered, tell it: *"Simplify this by using [X] pattern"*.
115
-
116
- ---
117
-
118
- ## 8. Troubleshooting
119
-
120
- - **AI is stuck**: Type `reset context` or use `aiflow doctor` to check setup.
121
- - **Credentials fail**: Re-run `aiflow init --adapter backlog` to update keys.
122
- - **Rules not followed**: Remind the AI: *"Follow the rules in CLAUDE.md"*.
123
-
124
- ---
125
-
126
- **Happy Coding!** สำหรับรายละเอียดเชิงลึก โปรดดู [AIFLOW.md](../AIFLOW.md).
@@ -1,36 +0,0 @@
1
- {
2
- "name": "brainstorm-server-tests",
3
- "version": "1.0.0",
4
- "lockfileVersion": 3,
5
- "requires": true,
6
- "packages": {
7
- "": {
8
- "name": "brainstorm-server-tests",
9
- "version": "1.0.0",
10
- "dependencies": {
11
- "ws": "^8.19.0"
12
- }
13
- },
14
- "node_modules/ws": {
15
- "version": "8.19.0",
16
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
17
- "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
18
- "license": "MIT",
19
- "engines": {
20
- "node": ">=10.0.0"
21
- },
22
- "peerDependencies": {
23
- "bufferutil": "^4.0.1",
24
- "utf-8-validate": ">=5.0.2"
25
- },
26
- "peerDependenciesMeta": {
27
- "bufferutil": {
28
- "optional": true
29
- },
30
- "utf-8-validate": {
31
- "optional": true
32
- }
33
- }
34
- }
35
- }
36
- }
File without changes
File without changes
File without changes