@relipa/ai-flow-kit 0.0.3-beta.3 → 0.0.4-beta.0

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.
@@ -0,0 +1,6 @@
1
+ # GitHub Copilot Custom Instructions
2
+
3
+ You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
+
5
+ > [!IMPORTANT]
6
+ > Always check for context in `.claude/context/current.json` and progress in the `plan/` folder before suggesting changes.
@@ -0,0 +1,6 @@
1
+ # Cursor AI Project Rules
2
+
3
+ You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
+
5
+ > [!IMPORTANT]
6
+ > Always check `.claude/context/current.json` and the `plan/` directory before starting any task to understand current context and progress.
@@ -0,0 +1,6 @@
1
+ # Gemini AI System Instructions
2
+
3
+ You are an expert AI assistant specialized in this project's stack. Follow the Gate Workflow and Team Rules strictly.
4
+
5
+ > [!IMPORTANT]
6
+ > When starting a session, always read `.claude/context/current.json` to load ticket context and check the `plan/` directory for existing progress.
@@ -0,0 +1,10 @@
1
+ # AI System Instructions
2
+
3
+ You are an expert AI assistant. Follow the project's Gate Workflow and Team Rules strictly.
4
+
5
+ ## Context Awareness
6
+ - **Ticket context**: `.claude/context/current.json`
7
+ - **Task progress**: `plan/[ticket-id]/`
8
+ - **Rules**: `.rules/`
9
+
10
+ Follow the gated workflow and rules defined below.
@@ -1,89 +1,14 @@
1
- # Vue/Nuxt.js AI System Prompt
2
-
3
- You are an expert Vue.js & Nuxt 3 developer. Follow these rules.
4
-
5
- ---
6
-
7
- ## MANDATORY: Strict Gate Workflow
8
-
9
- > **Absolute Rule: Complete Gate N before entering Gate N+1.**
10
- > **Do not skip, shorten, or merge Gates.**
11
-
12
- You have superpowers. When a ticket context exists in `.claude/context/current.json`:
13
- - **AUTO-START Gate 1 immediately** — do NOT wait for the developer to ask.
14
- - Read `CLAUDE.md` (this file) and follow the gate sequence below — NO EXCEPTIONS.
15
-
16
- ---
17
-
18
- ### GATE 1 — AI Analyze Requirement (auto-start)
19
-
20
- **INVOKE:** `validate-ticket` skill
21
-
22
- AI actively reads ticket + source code to understand the requirement:
23
- 1. Read `.claude/context/current.json` — ticket info
24
- 2. Read source code — architecture, related files, data flow
25
- 3. If anything is unclear — ask ONE question at a time, wait for reply
26
- 4. Output `plan/[ticket-id]/requirement.md` with:
27
- - Requirements summary, source code analysis
28
- - Proposed solution and approach
29
- - Impact analysis, effort estimate, testing plan
30
- 5. Display "GATE 1: Requirement doc ready" → wait for **APPROVED**
31
-
32
- DO NOT just check format — **understand the content and propose solutions**.
33
-
34
- ---
35
-
36
- ### GATE 2 — Implementation Plan (wait for APPROVED)
37
-
38
- **INVOKE:** `generate-spec` skill, then `superpowers:writing-plans`
39
-
40
- - Create a detailed TDD implementation plan based on the approved requirement.
41
- - Display: "GATE 2 PAUSED: type APPROVED to start coding".
42
- - CODE WILL NOT BE GENERATED until "APPROVED" is received.
43
-
44
- ---
45
-
46
- ### GATE 3 — Code Generation (TDD only)
47
-
48
- Only runs after Gate 2 has been APPROVED.
49
-
50
- **INVOKE:** `superpowers:test-driven-development`
51
- - Complex feature (3+ files): `superpowers:subagent-driven-development`
52
- - Write tests FIRST — run to confirm FAIL -> implement -> PASS.
53
- - Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
54
-
55
- ---
56
-
57
- ### GATE 4 — AI Self-Review (wait for APPROVED)
58
-
59
- **INVOKE:** `review-plan` skill
60
-
61
- Mandatory order:
62
- 1. `superpowers:verification-before-completion` — all tests must PASS
63
- 2. `impact-analysis` skill — check for breaking changes
64
- 3. `custom/rules/review-checklist.md` — tick each item
65
- 4. Create `plan/[ticket-id]/summary.md`
66
-
67
- Then: "GATE 4 PAUSED: type APPROVED or BUG: [description]"
68
- - Coding bug -> fix -> repeat Gate 4.
69
- - Requirement bug -> return to Gate 1.
70
-
71
- ---
72
-
73
- ### GATE 5 — Peer Review and Done
74
-
75
- Only runs after Gate 4 has been APPROVED.
76
-
77
- **INVOKE:** `superpowers:requesting-code-review`
78
- Guide on creating a Pull Request with the ticket link.
79
-
80
- ---
81
-
82
- - Use `<script setup lang="ts">` with Composition API exclusively. Do not use the Options API.
83
- - Use explicit Nuxt auto-imports where appropriate, but maintain clarity on complex utilities.
84
- - For state management, prefer Pinia or native `useState` bindings in Nuxt.
85
- - Use `useFetch` or `useAsyncData` for server-side data fetching. Use `$fetch` for client-side API requests outside component initialization.
86
- - Keep components small and specialized.
87
- - Adhere to the official Vue Style Guide (Priority A and B).
88
-
89
- Ensure code is strictly typed with TypeScript.
1
+ # Vue/Nuxt.js AI System Prompt
2
+
3
+ You are an expert Vue.js & Nuxt 3 developer. Follow these rules.
4
+
5
+ ---
6
+
7
+ - Use `<script setup lang="ts">` with Composition API exclusively. Do not use the Options API.
8
+ - Use explicit Nuxt auto-imports where appropriate, but maintain clarity on complex utilities.
9
+ - For state management, prefer Pinia or native `useState` bindings in Nuxt.
10
+ - Use `useFetch` or `useAsyncData` for server-side data fetching. Use `$fetch` for client-side API requests outside component initialization.
11
+ - Keep components small and specialized.
12
+ - Adhere to the official Vue Style Guide (Priority A and B).
13
+
14
+ Ensure code is strictly typed with TypeScript.
@@ -0,0 +1,53 @@
1
+ # Multi-AI Environment Integration
2
+
3
+ `ai-flow-kit` is designed to be tool-agnostic. While it works best with Claude Code CLI due to deep MCP integration, you can use it with any AI tool.
4
+
5
+ ## Supported Environments
6
+
7
+ | Tool | Instruction File | Support Level | Key Features |
8
+ |------|------------------|---------------|--------------|
9
+ | **Claude Code** | `CLAUDE.md` | Native (Best) | Auto-triggers, full MCP access, session hooks. |
10
+ | **Cursor** | `.cursorrules` | High | Project-wide rules, `@Codebase` context. |
11
+ | **Gemini CLI** | `GEMINI.md` | Medium | System instructions support. |
12
+ | **GitHub Copilot** | `.github/copilot-instructions.md` | Medium | Inline suggestions, custom instructions. |
13
+ | **OpenCode / Generic** | `AI_INSTRUCTIONS.md` | General | Manual context loading. |
14
+
15
+ ---
16
+
17
+ ## Tool-Specific Setup
18
+
19
+ ### 1. Cursor AI
20
+ When you run `aiflow init`, it generates a `.cursorrules` file.
21
+ - Cursor will automatically read this file to understand the **Gate Workflow**.
22
+ - Use `@Codebase` when you need the AI to search across your whole project.
23
+ - **Resumption**: If you start a task in Claude Code and switch to Cursor, Cursor will see the generated `plan/` files and resume from where you left off.
24
+
25
+ ### 2. Gemini CLI
26
+ Pass `GEMINI.md` as system instructions to your Gemini session.
27
+ - **Tip**: Always ensure the AI reads `.claude/context/current.json` first to load the ticket context.
28
+ - Gemini is excellent for large context analysis during Gate 1.
29
+
30
+ ### 3. GitHub Copilot / Codex
31
+ Copilot uses `.github/copilot-instructions.md` to guide its suggestions.
32
+ - This ensures that Copilot's inline completions follow your project's architecture and team rules.
33
+
34
+ ---
35
+
36
+ ## Cross-Tool State Resumption
37
+ The "Secret Sauce" of `ai-flow-kit` is its file-based state management:
38
+
39
+ 1. **Context**: Saved in `.claude/context/current.json`.
40
+ 2. **Progress**: Saved as Markdown docs in `plan/[ticket-id]/`.
41
+ 3. **Rules**: Saved in `.rules/`.
42
+
43
+ Because these are standard files, any AI tool can read them. You can:
44
+ 1. Start **Gate 1** (Analysis) in Claude Code.
45
+ 2. Review and **Approve** the requirement doc.
46
+ 3. Switch to **Cursor** for **Gate 3** (Coding) because you prefer the IDE integrations.
47
+ 4. Switch back to **Claude Code** for **Gate 4** (Self-Review) to use its automated testing power.
48
+
49
+ ---
50
+
51
+ ## Best Practices
52
+ - **Always Approve Docs**: Ensure `requirement.md` and `plan.md` are approved (you can just type "APPROVED" in the chat or edit the file to say so).
53
+ - **Update Status**: If you make progress in a tool that doesn't have hooks, manually update the `summary.md` or the ticket status.
@@ -0,0 +1,122 @@
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
+ npm install -g @relipa/ai-flow-kit
32
+ ```
33
+
34
+ Verify installation:
35
+ ```bash
36
+ aiflow --version
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 4. First-time Setup
42
+
43
+ In your project root, run:
44
+
45
+ ```bash
46
+ aiflow init --framework [your-framework] --adapter [backlog/jira]
47
+ ```
48
+ *Example: `aiflow init --framework nestjs --adapter backlog`*
49
+
50
+ **What this does:**
51
+ 1. Verifies your API keys.
52
+ 2. Creates instruction files: `CLAUDE.md`, `.cursorrules`, `GEMINI.md`.
53
+ 3. Installs "Superpowers" skills.
54
+
55
+ ---
56
+
57
+ ## 5. Daily Task Workflow (The 5 Gates)
58
+
59
+ ### Step 1: Start a Task
60
+ Load the ticket context from your issue tracker:
61
+ ```bash
62
+ aiflow use PROJ-33
63
+ ```
64
+
65
+ ### Step 2: Open your AI Tool
66
+ - **Claude Code**: Type `claude`. The AI will automatically start **Gate 1**.
67
+ - **Cursor**: Just start chatting with Cursor. It will detect the active ticket and start analyzing.
68
+
69
+ ### Step 3: Follow the Gates
70
+ The AI *must* pass each gate in order. You act as the **Reviewer**.
71
+
72
+ 1. **⛩️ Gate 1: Requirement Analysis**
73
+ - AI reads code + ticket.
74
+ - AI outputs `plan/PROJ-33/requirement.md`.
75
+ - **Your Action**: Read the doc. If OK, type `APPROVED`.
76
+
77
+ 2. **⛩️ Gate 2: Implementation Plan**
78
+ - AI creates a step-by-step TDD plan.
79
+ - **Your Action**: Type `APPROVED` to start coding.
80
+
81
+ 3. **⛩️ Gate 3: Coding (TDD)**
82
+ - AI writes tests first, then code.
83
+ - **Your Action**: Monitor.
84
+
85
+ 4. **⛩️ Gate 4: Self-Review**
86
+ - AI verifies tests and checks a review-checklist.
87
+ - **Your Action**: Review the final diff. If OK, type `APPROVED`.
88
+
89
+ 5. **⛩️ Gate 5: Pull Request**
90
+ - AI helps you write a detailed PR description.
91
+ - **Your Action**: Create the PR and ask for a peer review.
92
+
93
+ ---
94
+
95
+ ## 6. Switching AI Tools Mid-Task
96
+
97
+ You can switch tools at any time because the "brain" (the State) is stored in your project files.
98
+
99
+ **Example Scenario:**
100
+ 1. Use **Claude Code CLI** for **Gate 1** (Analysis) because it's great at exploring many files.
101
+ 2. Once you type `APPROVED`, close Claude.
102
+ 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.
103
+
104
+ ---
105
+
106
+ ## 7. Best Practices
107
+
108
+ - **One question at a time**: If the AI asks 5 questions, answer them one by one or ignore the irrelevant ones.
109
+ - **Small commits**: Let the AI commit frequently (default behavior).
110
+ - **Be the Pilot**: The AI is your co-pilot. If its solution looks over-engineered, tell it: *"Simplify this by using [X] pattern"*.
111
+
112
+ ---
113
+
114
+ ## 8. Troubleshooting
115
+
116
+ - **AI is stuck**: Type `reset context` or use `aiflow doctor` to check setup.
117
+ - **Credentials fail**: Re-run `aiflow init --adapter backlog` to update keys.
118
+ - **Rules not followed**: Remind the AI: *"Follow the rules in CLAUDE.md"*.
119
+
120
+ ---
121
+
122
+ **Happy Coding!** สำหรับรายละเอียดเชิงลึก โปรดดู [AIFLOW.md](../AIFLOW.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relipa/ai-flow-kit",
3
- "version": "0.0.3-beta.3",
3
+ "version": "0.0.4-beta.0",
4
4
  "description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
5
5
  "author": "Relipa AI Team",
6
6
  "publishConfig": {
package/scripts/init.js CHANGED
@@ -15,6 +15,14 @@ const FRAMEWORK_LANGUAGE = {
15
15
  'vue-nuxt': 'javascript',
16
16
  };
17
17
 
18
+ const AI_TOOL_FILES = {
19
+ 'claude': 'CLAUDE.md',
20
+ 'cursor': '.cursorrules',
21
+ 'gemini': 'GEMINI.md',
22
+ 'copilot': '.github/copilot-instructions.md',
23
+ 'generic': 'AI_INSTRUCTIONS.md'
24
+ };
25
+
18
26
  async function copyAssetsToVersion(versionDir, framework) {
19
27
  // ── Skills: merge upstream + custom ──────────────────────────────
20
28
  const upstreamSkills = path.join(PKG_DIR, 'upstream', 'skills');
@@ -135,34 +143,62 @@ async function verifySuperpowersSkills(versionDir) {
135
143
  }
136
144
 
137
145
  /**
138
- * Setup CLAUDE.md for a framework.
146
+ * Setup AI instruction files (CLAUDE.md, .cursorrules, etc.) for a framework.
139
147
  * If multi=true (multiple frameworks), append instead of overwrite.
140
148
  */
141
- async function setupFramework(projectDir, framework, multi = false) {
149
+ async function setupFramework(projectDir, framework, multi = false, selectedTools = Object.keys(AI_TOOL_FILES)) {
142
150
  if (!framework) return;
143
- const templatePath = path.join(PKG_DIR, 'custom', 'templates', `${framework}.md`);
144
- if (!(await fs.pathExists(templatePath))) {
151
+ const frameworkTemplatePath = path.join(PKG_DIR, 'custom', 'templates', `${framework}.md`);
152
+ if (!(await fs.pathExists(frameworkTemplatePath))) {
145
153
  console.log(chalk.yellow(`! No template found for framework: ${framework}`));
146
154
  return;
147
155
  }
148
156
 
149
- const claudeMdPath = path.join(projectDir, 'CLAUDE.md');
157
+ const frameworkContent = await fs.readFile(frameworkTemplatePath, 'utf-8');
158
+ const workflowPath = path.join(PKG_DIR, 'custom', 'templates', 'shared', 'gate-workflow.md');
159
+ const workflowContent = (await fs.pathExists(workflowPath))
160
+ ? await fs.readFile(workflowPath, 'utf-8')
161
+ : '';
150
162
 
151
- if (!multi) {
152
- // Single framework → overwrite
153
- await fs.copy(templatePath, claudeMdPath);
154
- } else {
155
- // Multiple frameworks → append with separator
156
- const content = await fs.readFile(templatePath, 'utf-8');
157
- const separator = `\n\n---\n\n`;
158
- if (await fs.pathExists(claudeMdPath)) {
159
- await fs.appendFile(claudeMdPath, separator + content);
163
+ const separator = `\n\n---\n\n`;
164
+
165
+ for (const tool of selectedTools) {
166
+ const targetPath = path.join(projectDir, AI_TOOL_FILES[tool]);
167
+ if (!targetPath) continue;
168
+
169
+ // Ensure subdirectories exist (e.g. .github/)
170
+ await fs.ensureDir(path.dirname(targetPath));
171
+
172
+ let finalContent = '';
173
+
174
+ // 1. Tool Header (e.g. Cursor AI Instructions)
175
+ const toolTemplatePath = path.join(PKG_DIR, 'custom', 'templates', 'tools', `${tool}.md`);
176
+ if (await fs.pathExists(toolTemplatePath)) {
177
+ finalContent += await fs.readFile(toolTemplatePath, 'utf-8') + '\n\n';
178
+ }
179
+
180
+ // 2. Shared Gate Workflow (MANDATORY)
181
+ if (workflowContent) {
182
+ finalContent += workflowContent + '\n\n';
183
+ }
184
+
185
+ // 3. Framework Rules
186
+ finalContent += frameworkContent;
187
+
188
+ if (!multi) {
189
+ // Single framework → overwrite
190
+ await fs.writeFile(targetPath, finalContent);
160
191
  } else {
161
- await fs.writeFile(claudeMdPath, content);
192
+ // Multiple frameworks → append
193
+ if (await fs.pathExists(targetPath)) {
194
+ await fs.appendFile(targetPath, separator + frameworkContent);
195
+ } else {
196
+ await fs.writeFile(targetPath, finalContent);
197
+ }
162
198
  }
163
199
  }
164
200
 
165
- console.log(chalk.green(`✓ CLAUDE.md updated for framework: ${framework}`));
201
+ console.log(chalk.green(`✓ AI instruction files updated for framework: ${framework} (${selectedTools.join(', ')})`));
166
202
  }
167
203
 
168
204
  async function setupAdapter(projectDir, adapter) {
@@ -420,9 +456,10 @@ module.exports = async function init(options) {
420
456
  await verifySuperpowersSkills(versionDir);
421
457
  await updateSymlinks(projectDir, versionDir);
422
458
 
423
- // Setup each framework (CLAUDE.md = last one wins, or merged)
459
+ // Setup each framework
460
+ const selectedTools = options.aiTools || Object.keys(AI_TOOL_FILES);
424
461
  for (const fw of frameworks) {
425
- await setupFramework(projectDir, fw, frameworks.length > 1);
462
+ await setupFramework(projectDir, fw, frameworks.length > 1, selectedTools);
426
463
  }
427
464
 
428
465
  // Setup each adapter
@@ -443,7 +480,8 @@ module.exports = async function init(options) {
443
480
  console.log(chalk.blue('\n' + '─'.repeat(62)));
444
481
  console.log(chalk.bold.white(' Next steps:'));
445
482
  console.log(` ${chalk.green('aiflow use PROJ-33')} ${chalk.gray('← load ticket context')}`);
446
- console.log(` ${chalk.green('claude')} ${chalk.gray('← AI auto-starts analyzing requirement')}`);
483
+ console.log(` ${chalk.green('claude')} ${chalk.gray('← Use Claude Code CLI (recommended)')}`);
484
+ console.log(` ${chalk.green('Cursor / Gemini')} ${chalk.gray('← Instructions loaded in .cursorrules / GEMINI.md')}`);
447
485
  console.log(chalk.blue('─'.repeat(62)));
448
486
  console.log(chalk.gray(` Full guide: ${chalk.green('aiflow guide')} | Command list: ${chalk.green('aiflow guide --commands')}`));
449
487
  console.log(chalk.blue('─'.repeat(62)) + '\n');
package/scripts/prompt.js CHANGED
@@ -278,7 +278,8 @@ module.exports = async function generatePrompt(type, options = {}) {
278
278
  const template = PROMPT_TEMPLATES[resolvedType];
279
279
  const rules = await loadRules();
280
280
 
281
- const prompt = buildPrompt(template, ctx, rules, options);
281
+ const env = options.env || 'claude';
282
+ const prompt = buildPrompt(template, ctx, rules, options, env);
282
283
 
283
284
  if (options.output) {
284
285
  await fs.writeFile(options.output, prompt, 'utf-8');
@@ -309,7 +310,7 @@ async function loadRules() {
309
310
  return parts.join('\n\n');
310
311
  }
311
312
 
312
- function buildPrompt(template, ctx, rules, options) {
313
+ function buildPrompt(template, ctx, rules, options, env = 'claude') {
313
314
  const lang = options.lang || 'english';
314
315
  const detail = options.detail || 'standard';
315
316
 
@@ -388,5 +389,14 @@ function buildPrompt(template, ctx, rules, options) {
388
389
  lines.push('');
389
390
  }
390
391
 
392
+ // ── Tool-specific instructions ───────────────────────────────
393
+ if (env === 'cursor') {
394
+ lines.push('---');
395
+ lines.push('> **Cursor Tip:** You can use `@Codebase` to search for more context if needed.');
396
+ } else if (env === 'gemini') {
397
+ lines.push('---');
398
+ lines.push('> **Gemini Tip:** Use the "Upload Files" or "Attach File" feature to provide source code context.');
399
+ }
400
+
391
401
  return lines.join('\n');
392
402
  }