@relipa/ai-flow-kit 0.0.9 → 0.1.0-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.
@@ -1,9 +1,9 @@
1
- {
2
- "mcpServers": {
3
- "figma": {
4
- "command": "npx",
5
- "args": ["-y", "@figma/mcp-server"],
6
- "env": {}
7
- }
8
- }
9
- }
1
+ {
2
+ "mcpServers": {
3
+ "figma": {
4
+ "command": "npx",
5
+ "args": ["-y", "@figma/mcp-server"],
6
+ "env": {}
7
+ }
8
+ }
9
+ }
@@ -1,51 +1,51 @@
1
- # Project Conventions (Override Skill Defaults)
2
-
3
- > **MANDATORY:** These rules override ANY upstream skill default (including `writing-plans`, `generate-spec`, and all superpowers skills).
4
- > Read this file before writing any output file during the Gate Workflow.
5
-
6
- ---
7
-
8
- ## Plan Output Paths
9
-
10
- | Output | Path | Note |
11
- |--------|------|------|
12
- | Requirement doc | `plan/[ticket-id]/requirement.md` | Gate 1 output |
13
- | Implementation plan | `plan/[ticket-id]/plan.md` | Gate 2 output — **NOT** `docs/superpowers/plans/` |
14
- | Summary | `plan/[ticket-id]/summary.md` | Gate 4 output |
15
-
16
- > **Override:** The `writing-plans` skill defaults to `docs/superpowers/plans/<filename>.md`.
17
- > In this project, **always save plans to `plan/[ticket-id]/plan.md` instead.**
18
- >
19
- > The `[ticket-id]` comes from `.aiflow/context/current.json`.
20
- > If no ticket context exists, use a descriptive slug: `plan/<feature-name>/plan.md`.
21
-
22
- ---
23
-
24
- ## Execution Handoff Message
25
-
26
- When `writing-plans` skill says to announce the saved path, use the **actual path**:
27
-
28
- ```
29
- Plan complete and saved to `plan/[ticket-id]/plan.md`. Two execution options: ...
30
- ```
31
-
32
- Do NOT copy the hardcoded path from the skill template (`docs/superpowers/plans/`).
33
-
34
- ---
35
-
36
- ## Checklist Before Writing Any File
37
-
38
- Before saving any plan, requirement, or summary file, verify:
39
-
40
- - [ ] Output path follows the table above — NOT the skill's default path
41
- - [ ] `[ticket-id]` is read from `.aiflow/context/current.json`
42
- - [ ] Directory `plan/[ticket-id]/` exists or will be created
43
- - [ ] Announced path in the handoff message matches the actual saved path
44
-
45
- ---
46
-
47
- ## Other Conventions
48
-
49
- - **Review checklist:** `custom/rules/review-checklist.md`
50
- - **Code style:** `custom/rules/code-style.md`
51
- - **Naming:** `custom/rules/naming.md`
1
+ # Project Conventions (Override Skill Defaults)
2
+
3
+ > **MANDATORY:** These rules override ANY upstream skill default (including `writing-plans`, `generate-spec`, and all superpowers skills).
4
+ > Read this file before writing any output file during the Gate Workflow.
5
+
6
+ ---
7
+
8
+ ## Plan Output Paths
9
+
10
+ | Output | Path | Note |
11
+ |--------|------|------|
12
+ | Requirement doc | `plan/[ticket-id]/requirement.md` | Gate 1 output |
13
+ | Implementation plan | `plan/[ticket-id]/plan.md` | Gate 2 output — **NOT** `docs/superpowers/plans/` |
14
+ | Summary | `plan/[ticket-id]/summary.md` | Gate 4 output |
15
+
16
+ > **Override:** The `writing-plans` skill defaults to `docs/superpowers/plans/<filename>.md`.
17
+ > In this project, **always save plans to `plan/[ticket-id]/plan.md` instead.**
18
+ >
19
+ > The `[ticket-id]` comes from `.aiflow/context/current.json`.
20
+ > If no ticket context exists, use a descriptive slug: `plan/<feature-name>/plan.md`.
21
+
22
+ ---
23
+
24
+ ## Execution Handoff Message
25
+
26
+ When `writing-plans` skill says to announce the saved path, use the **actual path**:
27
+
28
+ ```
29
+ Plan complete and saved to `plan/[ticket-id]/plan.md`. Two execution options: ...
30
+ ```
31
+
32
+ Do NOT copy the hardcoded path from the skill template (`docs/superpowers/plans/`).
33
+
34
+ ---
35
+
36
+ ## Checklist Before Writing Any File
37
+
38
+ Before saving any plan, requirement, or summary file, verify:
39
+
40
+ - [ ] Output path follows the table above — NOT the skill's default path
41
+ - [ ] `[ticket-id]` is read from `.aiflow/context/current.json`
42
+ - [ ] Directory `plan/[ticket-id]/` exists or will be created
43
+ - [ ] Announced path in the handoff message matches the actual saved path
44
+
45
+ ---
46
+
47
+ ## Other Conventions
48
+
49
+ - **Review checklist:** `custom/rules/review-checklist.md`
50
+ - **Code style:** `custom/rules/code-style.md`
51
+ - **Naming:** `custom/rules/naming.md`
@@ -35,6 +35,11 @@ When creating `plan/[ticket-id]/summary.md` during Gate 1:
35
35
  - Keep `summary.md` concise. Only include short bullet points tracking Gates.
36
36
  - Do not write verbose implementation details in `summary.md` at Gate 1.
37
37
 
38
+ 0. **Pre-flight — Sync with remote** (before reading any source file):
39
+ - Run `git status --porcelain` to check for uncommitted changes.
40
+ - Working tree clean → run `git pull --ff-only` to fetch the latest code.
41
+ - Uncommitted changes detected → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
42
+ - `git pull --ff-only` fails (branch diverged from remote) → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Then continue with local state.
38
43
  1. Read `.aiflow/context/current.json` — ticket title, description, acceptance criteria
39
44
  2. Identify **directly affected files** from ticket text and file names only.
40
45
  DO NOT trace data flow or read unrelated source files.
@@ -77,15 +82,28 @@ When creating `plan/[ticket-id]/summary.md` during Gate 1:
77
82
 
78
83
  ### Step 1: Load Ticket & Read Source Code
79
84
 
85
+ 0. **Pre-flight — Sync with remote** (run BEFORE reading any source file):
86
+ - Run `git status --porcelain` first. Empty output = clean working tree.
87
+ - Clean working tree → run `git pull --ff-only` to pull the latest code from remote. This guarantees the analysis is based on current source, not stale local state.
88
+ - Uncommitted changes → SKIP pull and notify DEV: `⚠️ Uncommitted changes detected — skipping git pull. Analysing local state.`
89
+ - `git pull --ff-only` fails because the branch has diverged → notify DEV: `⚠️ Local branch diverged from remote — skipping pull. Resolve manually before next ticket.` Continue with local state.
90
+ - Repo has no remote tracking branch (detached HEAD or local-only branch) → skip silently and proceed.
80
91
  1. Read `.aiflow/context/current.json` — ticket info from Backlog/Jira
81
- 2. Read `CLAUDE.md` understand project architecture, tech stack, conventions
82
- 3. Read related source files trace data flow, identify patterns, dependencies
92
+ 2. **Supplementary Context:** If `current.json` has a `supplementaryContext[]` array, read each item and integrate it as supporting context for your analysis. Items may be:
93
+ - `[ticket]` linked tickets (related features, dependencies, parent tickets)
94
+ - `[comment]` — specific comments from PM/QA/stakeholders
95
+ - `[file]` — architecture docs, business logic specs, API references
96
+ - `[text]` — any other supplementary information
97
+
98
+ If you encounter a backlog/jira URL in the ticket description that is **not** already in `supplementaryContext[]`, run `ak fetch-links <url>` and use the JSON output in your analysis without saving.
99
+ 3. Read `CLAUDE.md` — understand project architecture, tech stack, conventions
100
+ 4. Read related source files — trace data flow, identify patterns, dependencies
83
101
  - **If GitNexus MCP is available** (`.mcp.json` has `gitnexus` entry): invoke GitNexus MCP tools instead of reading files directly — one call returns full context without multi-file exploration:
84
102
  - `gitnexus: context("ClassName")` → 360° view of a symbol (dependencies, callers, methods)
85
103
  - `gitnexus: query("keyword or description")` → hybrid search across codebase
86
104
  - Saves ~50% of token cost at this step vs reading files manually
87
105
  - **If task is a Bug Fix:** Invoke `superpowers:systematic-debugging` to trace root cause before proposing fixes.
88
- 4. Read ticket comments — additional context from PM/team
106
+ 5. Read ticket comments — additional context from PM/team
89
107
 
90
108
  Do this investigation **before** asking any questions. Come prepared.
91
109
 
@@ -310,6 +328,7 @@ Please review the requirement document.
310
328
  - ❌ **DO NOT** proceed past Step 2 if design is not confirmed by developer
311
329
  - ❌ **DO NOT** write code at any point in this skill
312
330
  - ❌ **DO NOT** skip impact analysis and effort estimate
331
+ - ✅ **MUST** run `git status` + `git pull --ff-only` (Pre-flight) before reading source code, when working tree is clean
313
332
  - ✅ **MUST** read source code before Q&A begins
314
333
  - ✅ **MUST** save `plan/[ticket-id]/requirement.md`
315
334
  - ✅ **MUST** display Gate 1 prompt and wait for `APPROVED`
@@ -17,13 +17,14 @@ You have superpowers. When a ticket context exists in `.aiflow/context/current.j
17
17
 
18
18
  AI actively reads ticket + source code to understand the requirement:
19
19
  1. Read `.aiflow/context/current.json` — ticket info
20
- 2. Read source codearchitecture, related files, data flow
21
- 3. If anything is unclear ask ONE question at a time, wait for reply
22
- 4. Output `plan/[ticket-id]/requirement.md` with:
20
+ 2. **Pre-flight: sync with remote** run `git status --porcelain`; if working tree is clean, run `git pull --ff-only` to pull the latest source from remote. Skip the pull (with a `⚠️` notice to DEV) if there are uncommitted changes, the branch has diverged, or no remote tracking branch exists.
21
+ 3. Read source codearchitecture, related files, data flow
22
+ 4. If anything is unclear — ask ONE question at a time, wait for reply
23
+ 5. Output `plan/[ticket-id]/requirement.md` with:
23
24
  - Requirements summary, source code analysis
24
25
  - Proposed solution and approach
25
26
  - Impact analysis, effort estimate, testing plan
26
- 5. Display "GATE 1: Requirement doc ready" → wait for **APPROVED**
27
+ 6. Display "GATE 1: Requirement doc ready" → wait for **APPROVED**
27
28
 
28
29
  > **Tip:** If auto-start doesn't trigger, the developer can start this gate by typing: **"start"**, **"Gate 1"** or **"Analyze ticket"**.
29
30
 
@@ -1,22 +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".
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.
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,36 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.1.0] - 2026-05-28
11
+
12
+ ### Added
13
+
14
+ - **Multi-target `ak use`** — `ak use` now accepts variadic targets so multiple sources can be loaded in a single call. The first target becomes the primary context (drives Gate 1); the rest are appended to `current.json` as `supplementaryContext[]`. Targets can be ticket IDs, Backlog/Jira URLs, or local files.
15
+ ```bash
16
+ ak use PROJ-33 PROJ-10 docs/arch.md
17
+ # PROJ-33 = primary, PROJ-10 + docs/arch.md = supplementary
18
+ ```
19
+ Backward compatible: `ak use PROJ-33` (single target) behaves exactly as before.
20
+ - **Auto link resolution** — When the primary ticket's description contains Backlog/Jira URLs, `ak use` now auto-fetches them and appends to `supplementaryContext[]`. AI no longer misses linked context. Capped at **5 auto-resolved links per `use`** to keep loads fast; per-link errors are caught and logged without aborting the command.
21
+ - **Comment-aware link resolution** — Comment URLs are resolved to that **single comment** instead of fetching the whole ticket. Recognised patterns:
22
+ - Backlog: `https://*.backlog.com/view/PROJ-10#comment-456`
23
+ - Jira: `https://*.atlassian.net/browse/PROJ-10?focusedCommentId=456`
24
+ - **`ak fetch-links <url>` command** — Standalone command that fetches a single Backlog/Jira URL and prints a `SupplementaryContext` JSON object to stdout. Used by the `read-study-requirement` skill at runtime when AI encounters a link in the ticket description that wasn't already resolved at `use` time.
25
+ ```bash
26
+ ak fetch-links "https://company.backlog.com/view/PROJ-10#comment-456"
27
+ ```
28
+ - **`supplementaryContext[]` schema in `current.json`** — New top-level array; each item has shape `{ sourceType: 'ticket'|'comment'|'file'|'text', sourceUrl?, sourcePath?, ticketId?, commentId?, title?, description?, content?, author?, date? }`. Persisted across sessions and consumed by the SessionStart hook.
29
+ - **SessionStart hook renders supplementary block** — `scripts/hooks/session-start.js` now emits a `**Supplementary Context (N source(s)):**` section in the AI context prompt, one line per item, content truncated at 1000 chars to keep token cost bounded.
30
+ - **`read-study-requirement` skill integrates supplementary context** — Gate 1 instruction file (custom + installed `.claude/skills/`) now has an explicit step to read `supplementaryContext[]` and use `ak fetch-links` for any unresolved links found while analysing the ticket.
31
+ - **`scripts/link-resolver.js` module** — New CommonJS module that owns all URL classification and HTTPS fetching for Backlog/Jira. Exports: `classifyLink`, `scanLinks`, `fetchBacklogTicket`, `fetchBacklogComment`, `fetchJiraTicket`, `fetchJiraComment`, `fetchLink`, `resolveLinks`. Accepts credentials as parameters to keep `use.js` free of circular imports.
32
+ - **Jest test suite** — Added Jest 30 as a dev dependency with `testMatch: ["<rootDir>/tests/**/*.test.js"]` to scope discovery to project tests (skips `upstream/tests/`). Suite includes `tests/smoke.test.js` and 20 unit tests in `tests/link-resolver.test.js` covering URL classification, scan, dedup, per-adapter fetch paths, and `resolveLinks` error isolation.
33
+
34
+ ### Changed
35
+
36
+ - **`use.js` exports as named const** — `module.exports` shifted from anonymous function to `useCommand` with a `loadCredentials` property attached, so other modules (CLI `fetch-links` handler) can reuse credential loading without re-implementing it. External call shape (`useCommand(targets, options)`) unchanged for backward compatibility.
37
+
38
+ ---
39
+
10
40
  ## [0.0.9] - 2026-05-25
11
41
 
12
42
  ### Added
@@ -76,6 +76,10 @@ aiflow use https://mycompany.backlog.com/view/PROJ-33
76
76
  # Load newest 5 comments
77
77
  aiflow use PROJ-33 --clast 5
78
78
 
79
+ # Multi-target — primary ticket + supplementary sources (v0.1.0+)
80
+ aiflow use PROJ-33 PROJ-10 docs/arch.md
81
+ # PROJ-33 drives Gate 1; PROJ-10 + docs/arch.md become supplementary context
82
+
79
83
  # Manual input (no Backlog/Jira)
80
84
  aiflow use --manual
81
85
 
@@ -83,6 +87,8 @@ aiflow use --manual
83
87
  aiflow use --file task-description.txt
84
88
  ```
85
89
 
90
+ > **Auto Link Resolution (v0.1.0+):** Backlog/Jira URLs in the primary ticket's description are auto-fetched and added to `supplementaryContext[]`. Comment links (`#comment-456`, `?focusedCommentId=456`) fetch **only that comment**. AI integrates these supplementary sources in Gate 1 analysis automatically.
91
+
86
92
  Output:
87
93
  ```
88
94
  ✓ Context loaded
@@ -410,12 +416,14 @@ ak sync # sync aiflow instruction files
410
416
 
411
417
  # Per task
412
418
  ak use PROJ-33 # load context (Fast Mode, default) — alias: ak u PROJ-33
419
+ ak use PROJ-33 PROJ-10 docs/arch.md # multi-target: primary + supplementary (v0.1.0+)
413
420
  ak use PROJ-33 -F # Fast Mode explicit (--fast)
414
421
  ak use PROJ-33 -U # Full Mode (--full)
415
422
  ak use -f task.md # load from local file (--file)
416
423
  ak use PROJ-33 -c # load with all comments (--coms)
417
424
  ak use PROJ-33 --clast 5 # newest 5 comments
418
425
  ak use -m # manual input (--manual)
426
+ ak fetch-links "<backlog-or-jira-url>" # fetch single link → JSON (used by AI runtime, v0.1.0+)
419
427
  ak p bug-fix # generate prompt (ak prompt)
420
428
  ak p feature -o p.md # save prompt to file (--output)
421
429
  ak p -L vietnamese # Vietnamese prompt (--lang)
@@ -81,11 +81,12 @@ Initializing ai-flow-kit (v1.0.0)...
81
81
 
82
82
  ## use
83
83
 
84
- Load context from a ticket, file, or manual entry.
84
+ Load context from one or more tickets, files, or manual entry. **Accepts variadic targets** (v0.1.0+) — the first target is the primary context (drives Gate 1); any additional targets are appended as `supplementaryContext[]`.
85
85
 
86
86
  ```bash
87
- ak use JIRA-123 # load from Jira
88
- ak use BACKLOG-456 # load from Backlog
87
+ ak use JIRA-123 # single target — load from Jira
88
+ ak use BACKLOG-456 # single target — load from Backlog
89
+ ak use PROJ-33 PROJ-10 docs/arch.md # multi-target — primary + supplementary (v0.1.0+)
89
90
  ak use BACKLOG-456 -F # fast mode (--fast)
90
91
  ak use BACKLOG-456 -U # full mode (--full)
91
92
  ak use -m # manual entry (--manual)
@@ -96,8 +97,10 @@ ak use BACKLOG-456 --cid 42 # specific comment
96
97
  ak use 1.0.0 # switch between versions
97
98
  ```
98
99
 
100
+ **Arguments:**
101
+ - `[targets...]` — One or more targets. Each target can be a ticket ID (`PROJ-33`), a Backlog/Jira URL, or a local file path. First target = primary; rest = supplementary.
102
+
99
103
  **Options:**
100
- - `<id>` — Ticket ID or version number
101
104
  - `-m, --manual` — Manual context entry
102
105
  - `-f, --file <path>` — Load from file (JSON or plain text)
103
106
  - `-s, --save <name>` — Save as named context
@@ -110,11 +113,31 @@ ak use 1.0.0 # switch between versions
110
113
  - `-F, --fast` — Fast mode: AI skips Q&A, lite 3-section requirement doc (< 5 min Gate 1)
111
114
  - `-U, --full` — Full mode: force complete Gate 1 analysis with Q&A
112
115
 
116
+ **Auto link resolution (v0.1.0+):** When the primary ticket description contains Backlog/Jira URLs, `ak use` auto-fetches them and appends to `supplementaryContext[]`. Comment URLs (`#comment-456` or `?focusedCommentId=456`) resolve to **that single comment only**. Capped at 5 auto-resolved links per `use`; per-link errors are logged without aborting the command.
117
+
118
+ **`supplementaryContext[]` schema** (persisted in `.aiflow/context/current.json`):
119
+
120
+ ```json
121
+ {
122
+ "sourceType": "ticket | comment | file | text",
123
+ "sourceUrl": "https://...",
124
+ "sourcePath": "docs/arch.md",
125
+ "ticketId": "PROJ-10",
126
+ "commentId": "456",
127
+ "title": "...",
128
+ "description": "...",
129
+ "content": "...",
130
+ "author": "...",
131
+ "date": "..."
132
+ }
133
+ ```
134
+
113
135
  **What it does:**
114
- 1. Fetches context from MCP adapter (if applicable)
115
- 2. Parses and validates context
116
- 3. Saves to `.aiflow/context/current.json` (including `mode` field for Gate 1 behaviour)
117
- 4. Updates state tracking
136
+ 1. Loads the first target as primary context (fetches from MCP adapter / file / manual entry)
137
+ 2. Loads each remaining target as a supplementary item
138
+ 3. Scans the primary description for Backlog/Jira URLs and auto-resolves them
139
+ 4. Saves the merged context (including `mode` and `supplementaryContext[]`) to `.aiflow/context/current.json`
140
+ 5. Updates state tracking
118
141
 
119
142
  **Example:**
120
143
  ```bash
@@ -126,8 +149,37 @@ Fetching context from Jira...
126
149
  ✓ Saved to .aiflow/context/current.json
127
150
 
128
151
  Ready to prompt! Run: aiflow prompt bug-fix
152
+
153
+ $ aiflow use PROJ-33 PROJ-10 docs/arch.md
154
+ ✓ Loaded primary: PROJ-33
155
+ ✓ Supplementary: PROJ-10 (ticket), docs/arch.md (file)
156
+ ✓ Auto-resolved 2 link(s) from description
129
157
  ```
130
158
 
159
+ ## fetch-links
160
+
161
+ Fetch a single Backlog/Jira URL and print a `SupplementaryContext` JSON object to stdout. Intended for AI runtime use inside the `read-study-requirement` skill — when AI encounters a link in the ticket description that wasn't already resolved by `ak use`, it can call this command and integrate the JSON output.
162
+
163
+ ```bash
164
+ ak fetch-links "https://company.backlog.com/view/PROJ-10" # full ticket
165
+ ak fetch-links "https://company.backlog.com/view/PROJ-10#comment-456" # single comment
166
+ ak fetch-links "https://company.atlassian.net/browse/PROJ-10" # Jira ticket
167
+ ak fetch-links "https://company.atlassian.net/browse/PROJ-10?focusedCommentId=789" # Jira comment
168
+ ```
169
+
170
+ **Arguments:**
171
+ - `<url>` — Backlog or Jira URL (ticket or comment)
172
+
173
+ **What it does:**
174
+ 1. Loads stored credentials from `.aiflow/credentials.json`
175
+ 2. Classifies the URL (Backlog vs Jira, ticket vs comment)
176
+ 3. Fetches via the appropriate adapter API
177
+ 4. Prints the resulting `SupplementaryContext` JSON to stdout
178
+
179
+ **Exit codes:**
180
+ - `0` — Success, JSON written to stdout
181
+ - `1` — URL not recognised as Backlog/Jira, or fetch failed (error message on stderr)
182
+
131
183
  ## task (alias: `t`)
132
184
 
133
185
  Manage multiple tasks — pause, switch, and resume while preserving gate progress.
@@ -1,105 +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`) |
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`) |