@relipa/ai-flow-kit 0.0.9-beta.1 → 0.0.9

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/README.md CHANGED
@@ -128,6 +128,16 @@ aiflow init --framework spring-boot,reactjs --adapter backlog,jira
128
128
 
129
129
  **Supported Adapters:** `backlog`, `jira`, `google-sheets`, `figma`, `figma-desktop`
130
130
 
131
+ **Figma adapters:**
132
+
133
+ | Adapter | Command | Auth | Requirement |
134
+ |---------|---------|------|-------------|
135
+ | `figma` | `ak init -a figma` | Personal Access Token (`figd_...`) | None — REST API |
136
+ | `figma-desktop` | `ak init -a figma-desktop` | Desktop session (no token needed) | Figma Desktop app installed & open |
137
+
138
+ > The `figma-desktop` adapter uses the official `@figma/mcp-server` package from Figma Inc. and is the recommended option if you already use Figma Desktop.
139
+ > See [Figma workflow guide](docs/common/workflows/figma.md) for usage with the `figma-to-component` skill.
140
+
131
141
  ---
132
142
 
133
143
  ### `aiflow sync-skills`
@@ -29,8 +29,8 @@ AI actively reads ticket + source code to understand the requirement:
29
29
 
30
30
  DO NOT just check format — **understand the content and propose solutions**.
31
31
 
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.
32
+ > **Telemetry:** Run `ak gate 1 start --ticket [ticket-id]` when starting this gate (auto-start or when developer types "start"/"Gate 1"). Run as-is — do NOT append shell redirects like `2>$null` or `>/dev/null`.
33
+ > Run `ak gate 1 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
34
34
 
35
35
  ---
36
36
 
@@ -43,8 +43,8 @@ DO NOT just check format — **understand the content and propose solutions**.
43
43
  - Display: "GATE 2 PAUSED: type APPROVED to start coding".
44
44
  - CODE WILL NOT BE GENERATED until "APPROVED" is received.
45
45
 
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
+ > **Telemetry:** Run `ak gate 2 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
47
+ > Run `ak gate 2 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
48
48
 
49
49
  ---
50
50
 
@@ -57,7 +57,7 @@ Only runs after Gate 2 has been APPROVED.
57
57
  - Write tests FIRST — run to confirm FAIL -> implement -> PASS.
58
58
  - Bug fix EXTRA: `superpowers:systematic-debugging` + `investigate-bug` skill first.
59
59
 
60
- > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate.
60
+ > **Telemetry:** Run `ak gate 3 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
61
61
 
62
62
  ---
63
63
 
@@ -75,8 +75,8 @@ Then: "GATE 4 PAUSED: type APPROVED or BUG: [description]"
75
75
  - Coding bug -> fix -> repeat Gate 4.
76
76
  - Requirement bug -> return to Gate 1.
77
77
 
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
+ > **Telemetry:** Run `ak gate 4 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
79
+ > Run `ak gate 4 approved --ticket [ticket-id]` immediately when APPROVED is received. Run as-is — do NOT append shell redirects.
80
80
 
81
81
  ---
82
82
 
@@ -87,4 +87,4 @@ Only runs after Gate 4 has been APPROVED.
87
87
  **INVOKE:** `superpowers:requesting-code-review`
88
88
  Guide on creating a Pull Request with the ticket link.
89
89
 
90
- > **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate.
90
+ > **Telemetry:** Run `ak gate 5 start --ticket [ticket-id]` when starting this gate. Run as-is — do NOT append shell redirects.
@@ -7,7 +7,7 @@ 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
10
+ ## [0.0.9] - 2026-05-25
11
11
 
12
12
  ### Added
13
13
 
@@ -17,11 +17,24 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
17
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
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
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
+ - **`ak gate N start|approved` auto-syncs task state** — Calling `ak gate 1 start --ticket PROJ-33` now automatically advances `currentGate` in `task-state.json`, removing the need to always call `ak task next` for gate tracking. `approved` records the approval timestamp and advances to the next gate. Uses `Math.max()` guard to never regress gate progress.
21
+ - **Session telemetry enrichment** — `session.start` now captures the active AI model name and user email from config. `session.stop` records model, input/output token counts, and a prompt summary extracted from the session transcript (`transcript_path` in hookData).
22
+ - **`project-conventions.md`** — New mandatory override file at `custom/rules/project-conventions.md`. Enforces that Gate 2 plans are always saved to `plan/[ticket-id]/plan.md` (overriding the skill default `docs/superpowers/plans/`). Includes a checklist and path table for all Gate outputs.
23
+ - **Gate workflow: explicit plan output path** — Gate 2 instruction in `gate-workflow.md` now explicitly states that the plan must be saved to `plan/[ticket-id]/plan.md`, with a note that the `writing-plans` skill default path is overridden.
24
+ - **WSL clipboard support in `ak prompt`** — `ak prompt` now correctly copies output to the Windows clipboard when running inside WSL using `powershell.exe Set-Clipboard`. Previously fell through to `xclip`/`xsel` which are unavailable on WSL without extra setup.
25
+ - **`appscript.js`** — Google Apps Script source for the self-hosted telemetry backend. Receives HMAC-signed events from the `ak` CLI, validates them, and appends rows to Google Sheets.
26
+ - **Telemetry `record()` returns result object** — `record()` now returns `{ok: true}` on success or `{ok: false, reason, error}` on failure, enabling `ak gate` and `ak telemetry log` to display ✓ / ⚠ feedback per event.
27
+ - **`ak init` remembers previous framework selection** — Re-running `ak init` in an already-configured project now pre-selects the previously chosen frameworks (read from `.aiflow/state.json`) instead of falling back to auto-detection. A "Previously selected: ..." hint is shown above the checkbox list.
20
28
 
21
29
  ### Fixed
22
30
 
23
31
  - **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
32
  - **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.
33
+ - **Critical: `currentGate` not advancing after gate transitions** — `task-state.json` was not updating `currentGate` when the AI called `ak gate N start`, so resuming a task always restarted from the wrong gate. Added dedicated `updateTaskGateState()` and fixed `createOrActivateTaskState()` to use `Math.max()`.
34
+ - **Duplicate `session.start` telemetry event** — `session-start.js` was calling `record()` before reading stdin, causing the event to fire twice in some hook configurations. Fixed by moving `record()` inside the `stdin.on('end')` handler.
35
+ - **Short command aliases not resolving for telemetry** — `task` and `memory` subcommand short aliases (`t st`, `t ls`, `mem s`, etc.) were not being resolved before telemetry pre-processing, causing `unknown` in the command column. Fixed alias resolution in the pre-hook telemetry mapping.
36
+ - **`ak telemetry log` silent on failure** — `ak telemetry log --event X` previously swallowed all errors silently (no output). Now shows ✓ on success and ⚠ with reason (`disabled`, `opted-out`, `no-url`) on skip/failure.
37
+ - **Gate telemetry blocked by bash redirect error** — AI was appending `2>$null` (PowerShell syntax) to `ak gate` commands when following "run silently" instructions, causing bash to fail with `/usr/bin/bash: $null: ambiguous redirect`. Added explicit "do NOT append shell redirects" instruction to `gate-workflow.md` for all gate telemetry commands.
25
38
 
26
39
  ---
27
40
 
@@ -352,6 +352,45 @@ aiflow use PROJ-88
352
352
  claude # AI auto-starts: map dependencies → assess risk → output report
353
353
  ```
354
354
 
355
+ ### Figma Design → Code
356
+
357
+ Turn a Figma design into a React / Next.js / Vue / Angular component automatically.
358
+
359
+ **Step 1: Set up Figma MCP adapter (one-time)**
360
+
361
+ Choose one option:
362
+
363
+ | Option | Command | Requirement |
364
+ |--------|---------|-------------|
365
+ | Figma Desktop (recommended) | `ak init -a figma-desktop` | Figma Desktop app installed and open |
366
+ | Figma REST API | `ak init -a figma` | Figma Personal Access Token (`figd_...`) |
367
+
368
+ ```bash
369
+ # Option A: Figma Desktop — no API token needed, uses Desktop session
370
+ ak init -a figma-desktop
371
+
372
+ # Option B: Figma REST API — requires Personal Access Token
373
+ ak init -a figma
374
+ # Enter your token when prompted (Settings → Security → Personal access tokens)
375
+ ```
376
+
377
+ **Step 2: Get the Figma node URL**
378
+
379
+ In Figma Desktop or web, right-click the frame/component → **Copy link to selection**.
380
+
381
+ URL format: `https://www.figma.com/design/<fileKey>/...?node-id=<nodeId>`
382
+
383
+ **Step 3: Trigger the skill in Claude**
384
+
385
+ ```
386
+ Generate component from this Figma frame:
387
+ https://www.figma.com/design/abc123/MyDesign?node-id=12:34
388
+ ```
389
+
390
+ Claude uses the `figma-to-component` skill and auto-detects your framework (Next.js App Router, React, Vue, Angular).
391
+
392
+ > Full guide: [docs/common/workflows/figma.md](./workflows/figma.md)
393
+
355
394
  ---
356
395
 
357
396
  ## All Commands
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relipa/ai-flow-kit",
3
- "version": "0.0.9-beta.1",
3
+ "version": "0.0.9",
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": {
package/scripts/init.js CHANGED
@@ -903,9 +903,22 @@ async function init(options) {
903
903
 
904
904
  // ── Auto-detect or prompt for framework if not supplied ──────
905
905
  if (frameworks.length === 0) {
906
+ const stateFilePath = path.join(aiflowDir, 'state.json');
907
+ let previousFrameworks = [];
908
+ if (await fs.pathExists(stateFilePath)) {
909
+ const savedState = await fs.readJson(stateFilePath);
910
+ previousFrameworks = savedState.frameworks || [];
911
+ }
912
+
906
913
  const detected = await detectFramework(projectDir);
907
914
  const hint = chalk.gray(' Space to select/unselect · Enter to confirm · Leave empty to skip');
908
- if (detected) {
915
+ if (previousFrameworks.length > 0) {
916
+ const labels = previousFrameworks
917
+ .map(v => FRAMEWORK_CHOICES.find(c => c.value === v)?.name || v)
918
+ .join(', ');
919
+ console.log(chalk.cyan(`\n Previously selected: ${chalk.bold(labels)}`));
920
+ console.log(hint);
921
+ } else if (detected) {
909
922
  const label = FRAMEWORK_CHOICES.find(c => c.value === detected)?.name || detected;
910
923
  console.log(chalk.cyan(`\n Detected framework: ${chalk.bold(label)}`));
911
924
  console.log(hint);
@@ -917,7 +930,9 @@ async function init(options) {
917
930
  message: 'Select framework(s):',
918
931
  choices: FRAMEWORK_CHOICES.map(c => ({
919
932
  ...c,
920
- checked: c.value === detected,
933
+ checked: previousFrameworks.length > 0
934
+ ? previousFrameworks.includes(c.value)
935
+ : c.value === detected,
921
936
  })),
922
937
  });
923
938
  frameworks = chosen;