@relipa/ai-flow-kit 0.0.8 → 0.0.9-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.
@@ -7,6 +7,7 @@ You have superpowers. When a ticket context exists in `.aiflow/context/current.j
7
7
  - **Consult the "AI Skill Registry"** below to find instructions for each skill (`SKILL.md`).
8
8
  - **AUTO-START Gate 1 immediately** — do NOT wait for the developer to ask.
9
9
  - Read instructions and follow the gate sequence below — NO EXCEPTIONS.
10
+ - **PROJECT CONVENTIONS:** Before writing any output file (plan, requirement, summary), read `custom/rules/project-conventions.md`. These rules override upstream skill defaults.
10
11
 
11
12
  ---
12
13
 
@@ -28,8 +29,8 @@ AI actively reads ticket + source code to understand the requirement:
28
29
 
29
30
  DO NOT just check format — **understand the content and propose solutions**.
30
31
 
31
- > **Telemetry:** Run `aiflow gate 1 start --ticket [ticket-id]` when starting this gate (auto-start or when developer types "start"/"Gate 1").
32
- > Run `aiflow gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received.
32
+ > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting this gate (auto-start or when developer types "start"/"Gate 1").
33
+ > Run `ak gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received.
33
34
 
34
35
  ---
35
36
 
@@ -38,11 +39,12 @@ DO NOT just check format — **understand the content and propose solutions**.
38
39
  **INVOKE:** `generate-spec` skill, then `superpowers:writing-plans`
39
40
 
40
41
  - Create a detailed TDD implementation plan based on the approved requirement.
42
+ - Output `plan/[ticket-id]/plan.md` with the detailed TDD implementation plan.
41
43
  - Display: "GATE 2 PAUSED: type APPROVED to start coding".
42
44
  - CODE WILL NOT BE GENERATED until "APPROVED" is received.
43
45
 
44
- > **Telemetry:** Run `aiflow gate 2 start --ticket [ticket-id]` when starting this gate.
45
- > Run `aiflow gate 2 approved --ticket [ticket-id]` immediately when APPROVED is received.
46
+ > **Telemetry:** Run `ak gate 2 start --ticket [ticket-id]` when starting this gate.
47
+ > Run `ak gate 2 approved --ticket [ticket-id]` immediately when APPROVED is received.
46
48
 
47
49
  ---
48
50
 
@@ -55,7 +57,7 @@ Only runs after Gate 2 has been APPROVED.
55
57
  - Write tests FIRST — run to confirm FAIL -> implement -> PASS.
56
58
  - Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
57
59
 
58
- > **Telemetry:** Run `aiflow gate 3 start --ticket [ticket-id]` when starting this gate.
60
+ > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate.
59
61
 
60
62
  ---
61
63
 
@@ -73,8 +75,8 @@ Then: "GATE 4 PAUSED: type APPROVED or BUG: [description]"
73
75
  - Coding bug -> fix -> repeat Gate 4.
74
76
  - Requirement bug -> return to Gate 1.
75
77
 
76
- > **Telemetry:** Run `aiflow gate 4 start --ticket [ticket-id]` when starting this gate.
77
- > Run `aiflow gate 4 approved --ticket [ticket-id]` immediately when APPROVED is received.
78
+ > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting this gate.
79
+ > Run `ak gate 4 approved --ticket [ticket-id]` immediately when APPROVED is received.
78
80
 
79
81
  ---
80
82
 
@@ -85,4 +87,4 @@ Only runs after Gate 4 has been APPROVED.
85
87
  **INVOKE:** `superpowers:requesting-code-review`
86
88
  Guide on creating a Pull Request with the ticket link.
87
89
 
88
- > **Telemetry:** Run `aiflow gate 5 start --ticket [ticket-id]` when starting this gate.
90
+ > **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate.
@@ -1,12 +1,22 @@
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:** When starting a session, always read `.aiflow/context/current.json` to load ticket context and check the `plan/` directory for existing progress.
6
-
7
- If no instructions are automatically followed, wait for the developer to type **"start"** or **"Gate 1"** to start the analysis.
8
-
9
- ## Interaction Rules:
10
- - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
11
- - **NEVER BATCH QUESTIONS:** Only ask one question per message.
12
- - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
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:** When starting a session, always read `.aiflow/context/current.json` to load ticket context and check the `plan/` directory for existing progress.
6
+
7
+ If no instructions are automatically followed, wait for the developer to type **"start"** or **"Gate 1"** to start the analysis.
8
+
9
+ ## Interaction Rules:
10
+ - **COLLABORATIVE SKILLS:** When a skill (like `read-study-requirement`) says to "ask one question at a time", you MUST stop and wait for the developer's reply before proceeding.
11
+ - **NEVER BATCH QUESTIONS:** Only ask one question per message.
12
+ - **WAIT FOR APPROVAL:** Do not move to the next Gate until you receive "APPROVED".
13
+ - **PROJECT CONVENTIONS:** Before writing any output file (plan, requirement, summary), read `custom/rules/project-conventions.md`. These rules override upstream skill defaults.
14
+
15
+ ## Telemetry Command (detect once, use everywhere)
16
+
17
+ Before the first gate, run this to detect the correct `ak` command for your environment:
18
+ ```bash
19
+ command -v ak >/dev/null 2>&1 && echo "USE: ak" || echo "USE: ak.cmd"
20
+ ```
21
+ Use whichever prints (e.g. `ak` on native Linux/Mac/Windows, `ak.cmd` on WSL without ak installed).
22
+ All `ak gate ...` examples below assume the detected command. Substitute accordingly.
@@ -7,6 +7,24 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.0.9] - 2026-05-21
11
+
12
+ ### Added
13
+
14
+ - **`figma-desktop` adapter** — New MCP preset using the official `@figma/mcp-server` package (Figma Inc.). Requires Figma Desktop app installed and open. No API token needed — authenticates via Desktop session. Run `ak init -a figma-desktop` to set up. See [`custom/mcp-presets/figma-desktop.json`](../../custom/mcp-presets/figma-desktop.json).
15
+ - **Next.js App Router support in `figma-to-component` skill** — Detects App Router projects (via `nextjs-app-router` in `CLAUDE.md` or presence of `app/` directory). Defaults to Server Component (`export default async function`); adds `'use client'` directive only when the design has interactive states (hover, click handlers, form inputs).
16
+ - **Angular support in `figma-to-component` skill** — Detects Angular projects (via `angular` in `CLAUDE.md` or presence of `angular.json`). Generates standalone `@Component` class with `@Input() className` and computed `hostClasses` getter. Uses Tailwind if `tailwind.config.*` exists, otherwise CSS-in-component.
17
+ - **4-tier framework detection in `figma-to-component` skill** — Detection order: (1) `CLAUDE.md` identifier → (2) project file scan (`app/` dir, `angular.json`, `nuxt.config.*`) → (3) fallback to Next.js/React. Previously only supported React and Vue.
18
+ - **Figma workflow guide** — New developer guide at [`docs/common/workflows/figma.md`](figma.md) covering prerequisites (REST API vs Desktop), how to get node URLs, trigger commands, expected output format, review checklist, and troubleshooting table.
19
+ - **MCP presets documentation** — Added full Figma REST API and Figma Desktop sections to [`custom/mcp-presets/README.md`](../../custom/mcp-presets/README.md), including a side-by-side comparison table.
20
+
21
+ ### Fixed
22
+
23
+ - **Critical: `figma-to-component` skill used non-existent tool names** — The skill referenced `figma_get_file_nodes`, `figma_get_file_styles`, `figma_get_file_components`, and `figma_get_image` — none of which exist in `figma-developer-mcp` or any other MCP package, causing the skill to silently fail on every run. Replaced with the correct tools: `get_figma_data(fileKey, nodeId, depth=2)` and `download_figma_images(fileKey, nodes, localPath)`.
24
+ - **Figma API token verification using wrong auth header** — `verifyFigma()` in `scripts/init.js` was sending `Authorization: Bearer <token>`, which is only valid for OAuth tokens. Figma Personal Access Tokens (`figd_...`) require `X-Figma-Token: <token>`. This caused every PAT to be rejected as invalid during `ak init -a figma` even when the token was correct.
25
+
26
+ ---
27
+
10
28
  ## [0.0.8-beta.1] - 2026-05-14
11
29
 
12
30
  ### Fixed
@@ -0,0 +1,105 @@
1
+ # Figma → Component Workflow
2
+
3
+ Generate UI components directly from Figma designs using the `figma-to-component` skill.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ Choose one adapter based on your setup:
10
+
11
+ ### Option A — REST API (recommended, no Desktop required)
12
+
13
+ ```bash
14
+ ak init -a figma
15
+ # Prompts for FIGMA_API_TOKEN
16
+ ```
17
+
18
+ Get your token: [figma.com/settings](https://www.figma.com/settings) → Security → Personal access tokens → Create new token (File content: read).
19
+
20
+ ### Option B — Official Figma MCP (requires Figma Desktop app)
21
+
22
+ ```bash
23
+ ak init -a figma-desktop
24
+ # No token needed — uses Desktop app session
25
+ ```
26
+
27
+ Requirements: Figma Desktop app installed and the target file open before invoking the skill.
28
+
29
+ ---
30
+
31
+ ## Getting a Figma Node URL
32
+
33
+ 1. Open your file in Figma (browser or Desktop)
34
+ 2. Right-click on a frame or component → **Copy link to selection**
35
+ 3. The URL looks like:
36
+ ```
37
+ https://www.figma.com/design/FILEKEY/FileName?node-id=123-456
38
+ ```
39
+ - `FILEKEY` — the file identifier (between `/design/` and the next `/`)
40
+ - `node-id=123-456` — the specific frame or component to generate
41
+
42
+ You can also link to the entire file (no `node-id`) to let the skill list available frames.
43
+
44
+ ---
45
+
46
+ ## Trigger the Skill
47
+
48
+ Paste the Figma URL into Claude Code with a generation request:
49
+
50
+ ```
51
+ Generate component from this Figma frame:
52
+ https://www.figma.com/design/XXXXX/App?node-id=123-456
53
+ ```
54
+
55
+ ```
56
+ Implement the UserCard UI from Figma:
57
+ https://www.figma.com/design/XXXXX/App?node-id=78-910
58
+ ```
59
+
60
+ ```
61
+ Read Figma and generate component following my project conventions:
62
+ https://www.figma.com/design/XXXXX/App?node-id=42-0
63
+ ```
64
+
65
+ ---
66
+
67
+ ## What to Expect
68
+
69
+ The skill outputs in this order:
70
+
71
+ 1. **Design Summary** — layout structure, color palette, typography scale used in the design
72
+ 2. **Component file** — complete code for your detected framework (React, Next.js App Router, Vue 3, or Angular)
73
+ 3. **Usage example** — how to import and use the component
74
+ 4. **Notes** — anything that couldn't be mapped 1:1 from Figma (custom fonts, unsupported effects, etc.)
75
+
76
+ **Framework auto-detection order:**
77
+ 1. Read `CLAUDE.md` for framework identifier (`nextjs-app-router`, `reactjs`, `vue-nuxt`, `angular`)
78
+ 2. Scan project files (`app/` dir → App Router, `angular.json` → Angular, `nuxt.config.*` → Vue)
79
+ 3. Fallback → Next.js / React
80
+
81
+ ---
82
+
83
+ ## Review Checklist
84
+
85
+ After the component is generated, verify:
86
+
87
+ - [ ] Layout matches Figma (flex direction, alignment, gap)
88
+ - [ ] Colors are correct (Tailwind class or arbitrary value)
89
+ - [ ] Typography matches (size, weight, line-height)
90
+ - [ ] Spacing correct (padding, margin, gap)
91
+ - [ ] Interactive states handled (`'use client'` in App Router, variants in React/Vue/Angular)
92
+ - [ ] Images use correct component (`next/image` for Next.js, `<img>` for others)
93
+ - [ ] `className` / `class` prop exposed for external overrides
94
+
95
+ ---
96
+
97
+ ## Troubleshooting
98
+
99
+ | Problem | Fix |
100
+ |---|---|
101
+ | `get_figma_data` tool not found | Run `ak init -a figma` to configure the MCP |
102
+ | "Invalid API token" | Token expired — create a new one at figma.com/settings |
103
+ | Wrong node generated | Check the `node-id` in the URL matches your selection in Figma |
104
+ | Figma Desktop MCP not responding | Ensure Figma Desktop app is open with the file loaded |
105
+ | Component uses wrong framework | Add framework to `CLAUDE.md` (e.g. `nextjs-app-router`) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relipa/ai-flow-kit",
3
- "version": "0.0.8",
3
+ "version": "0.0.9-beta.1",
4
4
  "description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
5
5
  "author": "Example Team",
6
6
  "publishConfig": {
@@ -1,52 +1,52 @@
1
- #!/usr/bin/env node
2
- /**
3
- * PreToolUse hook for ai-flow-kit
4
- *
5
- * Hard-blocks AI from running git-write operations (commit/add/push/tag) via the
6
- * Bash tool. The developer always controls commits manually in their own terminal.
7
- *
8
- * Stdin payload (from Claude Code):
9
- * { tool_name: "Bash", tool_input: { command: "..." }, ... }
10
- *
11
- * Exit codes:
12
- * 0 — allow (stdout empty)
13
- * 2 — block (stderr message is fed back to Claude as feedback)
14
- *
15
- * Override (for the kit's own maintenance scripts):
16
- * export AIFLOW_ALLOW_GIT_WRITE=1
17
- */
18
-
19
- let raw = '';
20
- process.stdin.setEncoding('utf-8');
21
- process.stdin.on('data', (chunk) => { raw += chunk; });
22
- process.stdin.on('end', () => {
23
- try {
24
- if (process.env.AIFLOW_ALLOW_GIT_WRITE === '1') process.exit(0);
25
-
26
- const payload = raw ? JSON.parse(raw) : {};
27
- if (payload.tool_name !== 'Bash') process.exit(0);
28
-
29
- const command = (payload.tool_input && payload.tool_input.command) || '';
30
- if (!command) process.exit(0);
31
-
32
- // Match `git <subcommand>` where subcommand is a write operation.
33
- // Tolerates leading args (e.g. `git -C path commit`, `git --no-pager add`).
34
- // Captures occurrences inside compound shells: `&&`, `||`, `;`, `|`, `$(...)`, backticks, newline.
35
- const BLOCK_RE = /(^|[\s;&|`(){}])git(\s+-[^\s]+)*\s+(commit|add|push|tag|reset|rebase|revert|cherry-pick|am|merge)\b/i;
36
- const match = command.match(BLOCK_RE);
37
- if (!match) process.exit(0);
38
-
39
- const verb = match[3].toLowerCase();
40
- process.stderr.write(
41
- `[aiflow] BLOCKED: \`git ${verb}\` is not allowed for AI.\n` +
42
- `Reason: ai-flow-kit forbids AI-driven commits/pushes. The developer manages git state manually.\n` +
43
- `If this is a legitimate maintenance task (running the kit's own CI), set AIFLOW_ALLOW_GIT_WRITE=1 in the environment.\n` +
44
- `Otherwise, finish the task without committing; the developer will run \`git ${verb}\` themselves at Gate 5.\n`
45
- );
46
- process.exit(2);
47
- } catch (err) {
48
- // On parsing error, fail open (don't block) but log to stderr for visibility.
49
- process.stderr.write(`[aiflow] block-git-write hook error: ${err.message}\n`);
50
- process.exit(0);
51
- }
52
- });
1
+ #!/usr/bin/env node
2
+ /**
3
+ * PreToolUse hook for ai-flow-kit
4
+ *
5
+ * Hard-blocks AI from running git-write operations (commit/add/push/tag) via the
6
+ * Bash tool. The developer always controls commits manually in their own terminal.
7
+ *
8
+ * Stdin payload (from Claude Code):
9
+ * { tool_name: "Bash", tool_input: { command: "..." }, ... }
10
+ *
11
+ * Exit codes:
12
+ * 0 — allow (stdout empty)
13
+ * 2 — block (stderr message is fed back to Claude as feedback)
14
+ *
15
+ * Override (for the kit's own maintenance scripts):
16
+ * export AIFLOW_ALLOW_GIT_WRITE=1
17
+ */
18
+
19
+ let raw = '';
20
+ process.stdin.setEncoding('utf-8');
21
+ process.stdin.on('data', (chunk) => { raw += chunk; });
22
+ process.stdin.on('end', () => {
23
+ try {
24
+ if (process.env.AIFLOW_ALLOW_GIT_WRITE === '1') process.exit(0);
25
+
26
+ const payload = raw ? JSON.parse(raw) : {};
27
+ if (payload.tool_name !== 'Bash') process.exit(0);
28
+
29
+ const command = (payload.tool_input && payload.tool_input.command) || '';
30
+ if (!command) process.exit(0);
31
+
32
+ // Match `git <subcommand>` where subcommand is a write operation.
33
+ // Tolerates leading args (e.g. `git -C path commit`, `git --no-pager add`).
34
+ // Captures occurrences inside compound shells: `&&`, `||`, `;`, `|`, `$(...)`, backticks, newline.
35
+ const BLOCK_RE = /(^|[\s;&|`(){}])git(\s+-[^\s]+)*\s+(commit|add|push|tag|reset|rebase|revert|cherry-pick|am|merge)\b/i;
36
+ const match = command.match(BLOCK_RE);
37
+ if (!match) process.exit(0);
38
+
39
+ const verb = match[3].toLowerCase();
40
+ process.stderr.write(
41
+ `[aiflow] BLOCKED: \`git ${verb}\` is not allowed for AI.\n` +
42
+ `Reason: ai-flow-kit forbids AI-driven commits/pushes. The developer manages git state manually.\n` +
43
+ `If this is a legitimate maintenance task (running the kit's own CI), set AIFLOW_ALLOW_GIT_WRITE=1 in the environment.\n` +
44
+ `Otherwise, finish the task without committing; the developer will run \`git ${verb}\` themselves at Gate 5.\n`
45
+ );
46
+ process.exit(2);
47
+ } catch (err) {
48
+ // On parsing error, fail open (don't block) but log to stderr for visibility.
49
+ process.stderr.write(`[aiflow] block-git-write hook error: ${err.message}\n`);
50
+ process.exit(0);
51
+ }
52
+ });