@relipa/ai-flow-kit 0.1.0-beta.0 → 0.1.1-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.
Files changed (236) hide show
  1. package/README.md +497 -497
  2. package/bin/aiflow.js +525 -525
  3. package/bin/ak.js +0 -0
  4. package/custom/mcp-presets/README.md +0 -0
  5. package/custom/mcp-presets/backlog.json +0 -0
  6. package/custom/mcp-presets/figma-desktop.json +0 -0
  7. package/custom/mcp-presets/figma.json +0 -0
  8. package/custom/mcp-presets/gitnexus.json +0 -0
  9. package/custom/mcp-presets/google-sheets.json +0 -0
  10. package/custom/mcp-presets/jira.json +0 -0
  11. package/custom/prompts/bug-fix.md +0 -0
  12. package/custom/prompts/feature.md +0 -0
  13. package/custom/prompts/investigation.md +0 -0
  14. package/custom/rules/code-style.md +0 -0
  15. package/custom/rules/java/code-style.md +0 -0
  16. package/custom/rules/java/naming.md +0 -0
  17. package/custom/rules/java/review-checklist.md +0 -0
  18. package/custom/rules/java/spring-boot-examples.md +0 -0
  19. package/custom/rules/javascript/code-style.md +0 -0
  20. package/custom/rules/javascript/naming.md +0 -0
  21. package/custom/rules/naming.md +0 -0
  22. package/custom/rules/php/code-style.md +0 -0
  23. package/custom/rules/php/naming.md +0 -0
  24. package/custom/rules/project-conventions.md +0 -0
  25. package/custom/rules/review-checklist.md +0 -0
  26. package/custom/skills/figma-to-component/SKILL.md +294 -207
  27. package/custom/skills/generate-spec/SKILL.md +0 -0
  28. package/custom/skills/impact-analysis/SKILL.md +0 -0
  29. package/custom/skills/investigate-bug/SKILL.md +0 -0
  30. package/custom/skills/read-study-requirement/SKILL.md +334 -334
  31. package/custom/skills/report-customer/SKILL.md +0 -0
  32. package/custom/skills/review-plan/SKILL.md +0 -0
  33. package/custom/templates/laravel.md +0 -0
  34. package/custom/templates/nestjs.md +0 -0
  35. package/custom/templates/nextjs.md +0 -0
  36. package/custom/templates/nodejs-express.md +0 -0
  37. package/custom/templates/php-plain.md +0 -0
  38. package/custom/templates/php.md +0 -0
  39. package/custom/templates/python-django.md +0 -0
  40. package/custom/templates/python-fastapi.md +0 -0
  41. package/custom/templates/python.md +0 -0
  42. package/custom/templates/reactjs.md +0 -0
  43. package/custom/templates/shared/gate-workflow.md +91 -91
  44. package/custom/templates/spring-boot.md +0 -0
  45. package/custom/templates/tools/claude.md +0 -0
  46. package/custom/templates/tools/copilot.md +0 -0
  47. package/custom/templates/tools/cursor.md +0 -0
  48. package/custom/templates/tools/gemini.md +0 -0
  49. package/custom/templates/tools/generic.md +0 -0
  50. package/custom/templates/vue-nuxt.md +0 -0
  51. package/docs/common/AIFLOW.md +0 -0
  52. package/docs/common/CHANGELOG.md +334 -334
  53. package/docs/common/QUICK_START.md +537 -537
  54. package/docs/common/ai-integration.md +0 -0
  55. package/docs/common/cli-reference.md +657 -657
  56. package/docs/common/configuration.md +0 -0
  57. package/docs/common/getting-started.md +0 -0
  58. package/docs/common/troubleshooting.md +0 -0
  59. package/docs/common/workflows/bug-fix.md +0 -0
  60. package/docs/common/workflows/feature.md +0 -0
  61. package/docs/common/workflows/figma.md +0 -0
  62. package/docs/common/workflows/impact-analysis.md +0 -0
  63. package/docs/common/workflows/investigation.md +0 -0
  64. package/docs/common/workflows/refactor.md +0 -0
  65. package/docs/project/ARCHITECTURE.md +0 -0
  66. package/index.js +0 -0
  67. package/package.json +68 -67
  68. package/scripts/checkpoint.js +0 -0
  69. package/scripts/config.js +0 -0
  70. package/scripts/context.js +0 -0
  71. package/scripts/create-score-excel.js +0 -0
  72. package/scripts/detect.js +0 -0
  73. package/scripts/doctor.js +26 -0
  74. package/scripts/gitnexus-worker.js +0 -0
  75. package/scripts/guide.js +314 -314
  76. package/scripts/hooks/block-git-write.js +0 -0
  77. package/scripts/hooks/session-start.js +315 -315
  78. package/scripts/hooks/session-stop.js +0 -0
  79. package/scripts/init.js +0 -0
  80. package/scripts/link-resolver.js +0 -0
  81. package/scripts/memory.js +0 -0
  82. package/scripts/prompt.js +95 -9
  83. package/scripts/remove.js +0 -0
  84. package/scripts/score_members.js +320 -0
  85. package/scripts/task.js +0 -0
  86. package/scripts/telemetry/cli.js +0 -0
  87. package/scripts/telemetry/config.js +0 -0
  88. package/scripts/telemetry/crypto.js +0 -0
  89. package/scripts/telemetry/flush.js +0 -0
  90. package/scripts/telemetry/record.js +0 -0
  91. package/scripts/update.js +0 -0
  92. package/scripts/use.js +1162 -1162
  93. package/scripts/validate.js +0 -0
  94. package/upstream/.claude-plugin/marketplace.json +0 -0
  95. package/upstream/.claude-plugin/plugin.json +0 -0
  96. package/upstream/.codex/INSTALL.md +0 -0
  97. package/upstream/.cursor-plugin/plugin.json +0 -0
  98. package/upstream/.gitattributes +0 -0
  99. package/upstream/.github/FUNDING.yml +0 -0
  100. package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  101. package/upstream/.github/ISSUE_TEMPLATE/config.yml +0 -0
  102. package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  103. package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +0 -0
  104. package/upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  105. package/upstream/.opencode/INSTALL.md +0 -0
  106. package/upstream/.opencode/plugins/superpowers.js +0 -0
  107. package/upstream/.version-bump.json +0 -0
  108. package/upstream/AGENTS.md +0 -0
  109. package/upstream/CHANGELOG.md +0 -0
  110. package/upstream/CLAUDE.md +0 -0
  111. package/upstream/CODE_OF_CONDUCT.md +0 -0
  112. package/upstream/GEMINI.md +0 -0
  113. package/upstream/LICENSE +0 -0
  114. package/upstream/README.md +0 -0
  115. package/upstream/RELEASE-NOTES.md +0 -0
  116. package/upstream/agents/code-reviewer.md +0 -0
  117. package/upstream/commands/brainstorm.md +0 -0
  118. package/upstream/commands/execute-plan.md +0 -0
  119. package/upstream/commands/write-plan.md +0 -0
  120. package/upstream/docs/README.codex.md +0 -0
  121. package/upstream/docs/README.opencode.md +0 -0
  122. package/upstream/docs/plans/2025-11-22-opencode-support-design.md +0 -0
  123. package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +0 -0
  124. package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +0 -0
  125. package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +0 -0
  126. package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +0 -0
  127. package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +0 -0
  128. package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +0 -0
  129. package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +0 -0
  130. package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +0 -0
  131. package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +0 -0
  132. package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +0 -0
  133. package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +0 -0
  134. package/upstream/docs/testing.md +0 -0
  135. package/upstream/docs/windows/polyglot-hooks.md +0 -0
  136. package/upstream/gemini-extension.json +0 -0
  137. package/upstream/hooks/hooks-cursor.json +0 -0
  138. package/upstream/hooks/hooks.json +0 -0
  139. package/upstream/hooks/run-hook.cmd +0 -0
  140. package/upstream/hooks/session-start +0 -0
  141. package/upstream/package.json +0 -0
  142. package/upstream/scripts/bump-version.sh +0 -0
  143. package/upstream/skills/brainstorming/SKILL.md +0 -0
  144. package/upstream/skills/brainstorming/scripts/frame-template.html +0 -0
  145. package/upstream/skills/brainstorming/scripts/helper.js +0 -0
  146. package/upstream/skills/brainstorming/scripts/server.cjs +0 -0
  147. package/upstream/skills/brainstorming/scripts/start-server.sh +0 -0
  148. package/upstream/skills/brainstorming/scripts/stop-server.sh +0 -0
  149. package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
  150. package/upstream/skills/brainstorming/visual-companion.md +0 -0
  151. package/upstream/skills/dispatching-parallel-agents/SKILL.md +0 -0
  152. package/upstream/skills/executing-plans/SKILL.md +0 -0
  153. package/upstream/skills/finishing-a-development-branch/SKILL.md +0 -0
  154. package/upstream/skills/receiving-code-review/SKILL.md +0 -0
  155. package/upstream/skills/requesting-code-review/SKILL.md +0 -0
  156. package/upstream/skills/requesting-code-review/code-reviewer.md +0 -0
  157. package/upstream/skills/subagent-driven-development/SKILL.md +0 -0
  158. package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
  159. package/upstream/skills/subagent-driven-development/implementer-prompt.md +0 -0
  160. package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -0
  161. package/upstream/skills/systematic-debugging/CREATION-LOG.md +0 -0
  162. package/upstream/skills/systematic-debugging/SKILL.md +0 -0
  163. package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +0 -0
  164. package/upstream/skills/systematic-debugging/condition-based-waiting.md +0 -0
  165. package/upstream/skills/systematic-debugging/defense-in-depth.md +0 -0
  166. package/upstream/skills/systematic-debugging/find-polluter.sh +0 -0
  167. package/upstream/skills/systematic-debugging/root-cause-tracing.md +0 -0
  168. package/upstream/skills/systematic-debugging/test-academic.md +0 -0
  169. package/upstream/skills/systematic-debugging/test-pressure-1.md +0 -0
  170. package/upstream/skills/systematic-debugging/test-pressure-2.md +0 -0
  171. package/upstream/skills/systematic-debugging/test-pressure-3.md +0 -0
  172. package/upstream/skills/tdd-lean/SKILL.md +0 -0
  173. package/upstream/skills/test-driven-development/SKILL.md +0 -0
  174. package/upstream/skills/test-driven-development/testing-anti-patterns.md +0 -0
  175. package/upstream/skills/using-git-worktrees/SKILL.md +0 -0
  176. package/upstream/skills/using-superpowers/SKILL.md +0 -0
  177. package/upstream/skills/using-superpowers/references/codex-tools.md +0 -0
  178. package/upstream/skills/using-superpowers/references/copilot-tools.md +0 -0
  179. package/upstream/skills/using-superpowers/references/gemini-tools.md +0 -0
  180. package/upstream/skills/verification-before-completion/SKILL.md +0 -0
  181. package/upstream/skills/writing-plans/SKILL.md +0 -0
  182. package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +0 -0
  183. package/upstream/skills/writing-skills/SKILL.md +0 -0
  184. package/upstream/skills/writing-skills/anthropic-best-practices.md +0 -0
  185. package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -0
  186. package/upstream/skills/writing-skills/graphviz-conventions.dot +0 -0
  187. package/upstream/skills/writing-skills/persuasion-principles.md +0 -0
  188. package/upstream/skills/writing-skills/render-graphs.js +0 -0
  189. package/upstream/skills/writing-skills/testing-skills-with-subagents.md +0 -0
  190. package/upstream/tests/brainstorm-server/package-lock.json +0 -0
  191. package/upstream/tests/brainstorm-server/package.json +0 -0
  192. package/upstream/tests/brainstorm-server/server.test.js +0 -0
  193. package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +0 -0
  194. package/upstream/tests/brainstorm-server/ws-protocol.test.js +0 -0
  195. package/upstream/tests/claude-code/README.md +0 -0
  196. package/upstream/tests/claude-code/analyze-token-usage.py +0 -0
  197. package/upstream/tests/claude-code/run-skill-tests.sh +0 -0
  198. package/upstream/tests/claude-code/test-document-review-system.sh +0 -0
  199. package/upstream/tests/claude-code/test-helpers.sh +0 -0
  200. package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +0 -0
  201. package/upstream/tests/claude-code/test-subagent-driven-development.sh +0 -0
  202. package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +0 -0
  203. package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +0 -0
  204. package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +0 -0
  205. package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +0 -0
  206. package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +0 -0
  207. package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +0 -0
  208. package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +0 -0
  209. package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +0 -0
  210. package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +0 -0
  211. package/upstream/tests/explicit-skill-requests/run-all.sh +0 -0
  212. package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +0 -0
  213. package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +0 -0
  214. package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +0 -0
  215. package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +0 -0
  216. package/upstream/tests/explicit-skill-requests/run-test.sh +0 -0
  217. package/upstream/tests/opencode/run-tests.sh +0 -0
  218. package/upstream/tests/opencode/setup.sh +0 -0
  219. package/upstream/tests/opencode/test-plugin-loading.sh +0 -0
  220. package/upstream/tests/opencode/test-priority.sh +0 -0
  221. package/upstream/tests/opencode/test-tools.sh +0 -0
  222. package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +0 -0
  223. package/upstream/tests/skill-triggering/prompts/executing-plans.txt +0 -0
  224. package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +0 -0
  225. package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +0 -0
  226. package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +0 -0
  227. package/upstream/tests/skill-triggering/prompts/writing-plans.txt +0 -0
  228. package/upstream/tests/skill-triggering/run-all.sh +0 -0
  229. package/upstream/tests/skill-triggering/run-test.sh +0 -0
  230. package/upstream/tests/subagent-driven-dev/go-fractals/design.md +0 -0
  231. package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +0 -0
  232. package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +0 -0
  233. package/upstream/tests/subagent-driven-dev/run-test.sh +0 -0
  234. package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +0 -0
  235. package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +0 -0
  236. package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +0 -0
@@ -1,657 +1,657 @@
1
- # CLI Reference
2
-
3
- Complete reference for all `ak` / `aiflow` commands.
4
-
5
- > **Short alias:** `ak` is the preferred short form of `aiflow`. Every command also has a short alias shown in the format `command|alias`.
6
-
7
- ## Commands Overview
8
-
9
- ```bash
10
- ak --help # Show all commands
11
- ak <command> --help # Show command help
12
- ak <alias> --help # Also works with aliases
13
- ```
14
-
15
- ### Quick Alias Reference
16
-
17
- | Full command | Short | Full command | Short |
18
- |---|---|---|---|
19
- | `ak init` | `ak i` | `ak use` | `ak u` |
20
- | `ak prompt` | `ak p` | `ak detect` | `ak d` |
21
- | `ak task` | `ak t` | `ak context` | `ak ctx` |
22
- | `ak checkpoint` | `ak cp` | `ak validate` | `ak vl` |
23
- | `ak memory` | `ak mem` | `ak guide` | `ak g` |
24
- | `ak remove` | `ak rm` | `ak update` | `ak up` |
25
- | `ak sync-skills` | `ak sync` | `ak doctor` | `ak dr` |
26
- | `ak telemetry` | `ak tel` | | |
27
-
28
- | `task` sub-command | Short | `memory` sub-command | Short |
29
- |---|---|---|---|
30
- | `ak t status` | `ak t st` | `ak mem save` | `ak mem s` |
31
- | `ak t list` | `ak t ls` | `ak mem get` | `ak mem g` |
32
- | `ak t pause` | `ak t p` | `ak mem list` | `ak mem ls` |
33
- | `ak t switch` | `ak t sw` | `ak mem search` | `ak mem sr` |
34
- | `ak t resume` | `ak t r` | `ak mem delete` | `ak mem d` |
35
- | `ak t reset` | `ak t rst` | `ak mem clear` | `ak mem cl` |
36
- | `ak t remove` | `ak t rm` | | |
37
- | `ak t next` | `ak t n` | | |
38
-
39
- ## init
40
-
41
- Initialize AI Flow Kit in your project.
42
-
43
- ```bash
44
- ak init # basic initialization
45
- ak init -f laravel # with framework (--framework)
46
- ak init -a jira # with adapter (--adapter)
47
- ak init -f laravel -a jira # full setup
48
- ak init -f spring-boot --with-rtk # enable RTK compression
49
- ak init --no-rtk # skip RTK setup
50
- ```
51
-
52
- **Options:**
53
- - `-f, --framework <types>` (alias: `--fw`) — Framework templates, comma-separated (e.g. `spring-boot,reactjs`)
54
- - `-a, --adapter <types>` — MCP adapters (jira, backlog, google-sheets)
55
- - `-e, --env <types>` — AI tools to configure (cursor, gemini, copilot, generic). Default excludes `generic`.
56
- - `--with-rtk` — Force enable RTK token compression hook
57
- - `--no-rtk` — Skip RTK setup even if RTK is detected
58
-
59
- **What it does:**
60
- 1. Creates `.claude/skills/` with all available skills
61
- 2. Creates `.rules/` with team rules (including `java/spring-boot-examples.md` for Spring Boot projects)
62
- 3. Creates `.aiflow/` with version tracking
63
- 4. Sets up framework instruction file (`CLAUDE.md`, `.cursorrules`, etc.):
64
- - **File already exists** → saves aiflow template to `.aiflow/reference/<file>` for comparison. Your existing file is untouched — you own it.
65
- - **File does not exist** → creates it in the project root.
66
- 5. Optionally configures MCP adapter
67
-
68
- > **Note:** `CLAUDE.md` and other AI instruction files are project files — commit them to your repo. Run `aiflow init` once to generate them, then maintain them yourself. On subsequent `aiflow init` runs they will not be overwritten.
69
-
70
- **Example:**
71
- ```bash
72
- $ aiflow init --framework laravel --adapter jira
73
- Initializing ai-flow-kit (v1.0.0)...
74
- ✓ Copied skills to .claude/skills
75
- ✓ Copied rules to .rules
76
- ✓ Set up CLAUDE.md for framework: laravel
77
- ✓ Updated MCP configuration for jira
78
-
79
- ✨ Initialized AI Flow Kit successfully!
80
- ```
81
-
82
- ## use
83
-
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
-
86
- ```bash
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+)
90
- ak use BACKLOG-456 -F # fast mode (--fast)
91
- ak use BACKLOG-456 -U # full mode (--full)
92
- ak use -m # manual entry (--manual)
93
- ak use -f path/to/context.json # load from file (--file)
94
- ak use BACKLOG-456 -c # load with all comments (--coms)
95
- ak use BACKLOG-456 --clast 5 # last 5 comments
96
- ak use BACKLOG-456 --cid 42 # specific comment
97
- ak use 1.0.0 # switch between versions
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
-
103
- **Options:**
104
- - `-m, --manual` — Manual context entry
105
- - `-f, --file <path>` — Load from file (JSON or plain text)
106
- - `-s, --save <name>` — Save as named context
107
- - `-c, --coms` — Load all comments (alias for `--with-comments`)
108
- - `--with-comments` — Include all ticket comments
109
- - `--cid <id>` — Load a specific comment by ID
110
- - `--clast <n>` — Only fetch last N comments
111
- - `--cfrom <id>` — Fetch comments from ID N onward
112
- - `--cto <id>` — Fetch comments up to ID N
113
- - `-F, --fast` — Fast mode: AI skips Q&A, lite 3-section requirement doc (< 5 min Gate 1)
114
- - `-U, --full` — Full mode: force complete Gate 1 analysis with Q&A
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
-
135
- **What it does:**
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
141
-
142
- **Example:**
143
- ```bash
144
- $ aiflow use JIRA-123
145
- Fetching context from Jira...
146
- ✓ Title: Fix payment processing error
147
- ✓ Description: 2000+ words pulled
148
- ✓ Acceptance criteria: 3 items
149
- ✓ Saved to .aiflow/context/current.json
150
-
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
157
- ```
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
-
183
- ## task (alias: `t`)
184
-
185
- Manage multiple tasks — pause, switch, and resume while preserving gate progress.
186
-
187
- ```bash
188
- ak t st # show active + pending (task status)
189
- ak t ls # list all saved tasks (task list)
190
- ak t p # pause current task (task pause)
191
- ak t p -n "waiting for API spec from PM" # pause with note (--note)
192
- ak t sw PROJ-99 # switch to another task (task switch)
193
- ak t r PROJ-33 # resume a paused task (task resume)
194
- ak t rst PROJ-33 # reset to Gate 1 (task reset)
195
- ak t rm PROJ-33 # delete all task data (task remove)
196
- ak t n # approve gate & prep next session (task next)
197
- ak t n -t PROJ-33 # specify ticket (--ticket)
198
- ```
199
-
200
- **Sub-commands (with aliases):**
201
- - `status|st` — Show active task and all pending tasks
202
- - `list|ls` — List all saved tasks with gate state
203
- - `pause|p [-n <text>]` — Save current progress and clear active task
204
- - `switch|sw <ticket-id>` — Pause current task + load/switch to another
205
- - `resume|r <ticket-id>` — Restore a paused task as active
206
- - `reset|rst <ticket-id>` — Reset gate progress to Gate 1; prompts to optionally delete `plan/<id>/` files
207
- - `remove|rm <ticket-id>` — Permanently delete all saved data for the task
208
- - `next|n [-t <id>]` — Approve current gate and prepare next session
209
-
210
- **What it does:**
211
- 1. Saves a snapshot of the current context (`current.json`) to `.aiflow/tasks/<taskId>/context.json`
212
- 2. Detects current gate from `plan/` artifacts (`requirement.md`, `plan.md`, `summary.md`)
213
- 3. Writes `.aiflow/tasks/<taskId>/task-state.json` with status, gate, and approvals
214
- 4. On resume: restores context as `current.json` and sets status back to `active`
215
- 5. The **SessionStart hook** reads `task-state.json` on next `claude` launch and injects gate-aware instructions — Claude resumes from the correct gate instead of restarting Gate 1
216
-
217
- **Gate detection from `plan/` files:**
218
- | File present | Inferred gate |
219
- |---|---|
220
- | (none) | Gate 1 |
221
- | `plan/<id>/requirement.md` | Gate 2 |
222
- | `plan/<id>/plan.md` | Gate 3 |
223
- | `plan/<id>/summary.md` | Gate 5 |
224
-
225
- **Example workflow:**
226
- ```bash
227
- # Mid-task on PROJ-33 (Gate 2 in progress)...
228
- aiflow task pause --note "waiting for DB schema confirmation"
229
- # ✓ Task PROJ-33 paused at Gate 2.
230
-
231
- aiflow use PROJ-99 # load urgent task
232
- claude # AI auto-starts Gate 1 for PROJ-99
233
-
234
- # Back to PROJ-33
235
- aiflow task resume PROJ-33
236
- # ✓ Resumed task: PROJ-33
237
- # Gate: 2 (Implementation Plan)
238
-
239
- claude # AI resumes from Gate 2 — no restart
240
- ```
241
-
242
- **Reset workflow** — run a task from scratch after deleting generated code:
243
- ```bash
244
- aiflow task reset PROJ-33
245
- # Reset task: PROJ-33
246
- # • .aiflow/tasks/PROJ-33/task-state.json (Gate 3 → 1, approvals cleared)
247
- # ? Also delete 2 plan file(s) in plan/PROJ-33/? › No
248
- # ? Proceed with reset? › Yes
249
- # ✓ Task PROJ-33 reset to Gate 1.
250
-
251
- claude # AI auto-starts Gate 1 as if the task is brand new
252
- ```
253
-
254
- **Remove workflow** — permanently clean up a cancelled task:
255
- ```bash
256
- aiflow task remove PROJ-33
257
- # Remove task: PROJ-33
258
- # • .aiflow/tasks/PROJ-33/ (context snapshot + gate state)
259
- # • .aiflow/context/current.json (this is the active task)
260
- # • plan/PROJ-33/ (2 files):
261
- # - plan/PROJ-33/requirement.md
262
- # - plan/PROJ-33/plan.md
263
- # ? This cannot be undone. Proceed? › No
264
- ```
265
-
266
- ---
267
-
268
- ## prompt (alias: `p`)
269
-
270
- Generate an AI prompt with context, rules, and template.
271
-
272
- ```bash
273
- ak p bug-fix # generate bug fix prompt
274
- ak p feature # generate feature prompt
275
- ak p investigation # generate investigation prompt
276
- ak p refactor # generate refactor prompt
277
- ak p impact # generate impact analysis prompt
278
- ak p -l # list all prompt types (--list)
279
- ak p bug-fix -o p.md # save to file (--output)
280
- ak p bug-fix -L vietnamese # Vietnamese language (--lang)
281
- ak p bug-fix -d comprehensive # comprehensive detail (--detail)
282
- ```
283
-
284
- **Options:**
285
- - `<type>` — Prompt type (bug-fix, feature, investigation, refactor, impact, docs)
286
- - `-l, --list` — List available prompt types
287
- - `-o, --output <file>` — Save to file instead of printing
288
- - `-L, --lang <lang>` — Language (english, vietnamese)
289
- - `-d, --detail <level>` — Detail level (minimal, standard, comprehensive)
290
-
291
- **What it does:**
292
- 1. Loads current context (from `aiflow use`)
293
- 2. Loads prompt template for the type
294
- 3. Loads framework rules
295
- 4. Loads team rules and best practices
296
- 5. Merges everything into a complete prompt
297
- 6. Prints to console (or saves/copies)
298
-
299
- **Example:**
300
- ```bash
301
- $ aiflow prompt bug-fix
302
- ═══════════════════════════════════════════════════════════════
303
- BUG FIX INVESTIGATION PROMPT
304
- ═══════════════════════════════════════════════════════════════
305
-
306
- ## Context
307
- Title: Payment processing fails on checkout
308
- Description: Users report seeing payment error when... [2000+ words]
309
-
310
- ## Framework Rules (Laravel)
311
- - Use Laravel's built-in tools...
312
- - Keep Controllers thin...
313
-
314
- ## Team Rules
315
- - Use strict typing...
316
- - Follow PSR-12 styling...
317
-
318
- ## Task
319
- Investigate the bug following this process:
320
- 1. Understand the error context...
321
- [Complete prompt ready to copy to Claude]
322
- ```
323
-
324
- ## detect (alias: `d`)
325
-
326
- Auto-detect task type from a description.
327
-
328
- ```bash
329
- ak d "Payment integration is broken" # detect from description
330
- ak d # detect from current context
331
- ak d "Add new feature" -v # show confidence (--verbose)
332
- ak d "description" -t 90 # set threshold (--threshold)
333
- ```
334
-
335
- **Options:**
336
- - `<description>` — Description to analyze
337
- - `-v, --verbose` — Show detection reasoning
338
- - `-t, --threshold <number>` — Confidence threshold (0-100)
339
-
340
- **What it does:**
341
- 1. Analyzes description for keywords
342
- 2. Classifies as bug-fix, feature, refactor, investigation, etc
343
- 3. Shows confidence score
344
- 4. Suggests appropriate skill
345
-
346
- **Example:**
347
- ```bash
348
- $ aiflow detect "Users can't save their orders"
349
- 🐛 Bug Fix (98% confidence)
350
-
351
- Detected keywords:
352
- - "can't save" → bug pattern
353
- - Specific area → likely regression
354
-
355
- Suggested skill: investigate-bug
356
-
357
- Next: aiflow prompt bug-fix
358
- ```
359
-
360
- ## context (alias: `ctx`)
361
-
362
- Manage task contexts (save, load, list, delete).
363
-
364
- ```bash
365
- ak ctx list # list saved contexts
366
- ak ctx -s "checkout-fix" # save current context (--save)
367
- ak ctx -l "checkout-fix" # load saved context (--load)
368
- ak ctx -d "checkout-fix" # delete saved context (--delete)
369
- ak ctx clear # clear all contexts
370
- ak ctx show # show current context
371
- ```
372
-
373
- **Options:**
374
- - `-s, --save <name>` — Save current context
375
- - `-l, --load <name>` — Load saved context
376
- - `-d, --delete <name>` — Delete saved context
377
- - `--clear` — Clear all contexts
378
- - `--show` — Show current context details
379
-
380
- **What it does:**
381
- 1. Lists, saves, loads, or deletes contexts
382
- 2. Manages context history in `.aiflow/context/history/`
383
- 3. Makes it easy to switch between tasks
384
-
385
- **Example:**
386
- ```bash
387
- $ aiflow context --list
388
- Saved contexts:
389
- 1. checkout-fix (saved 2 hours ago)
390
- 2. payment-integration (saved yesterday)
391
- 3. user-auth-bug (saved 3 days ago)
392
-
393
- $ aiflow context --load checkout-fix
394
- ✓ Loaded: checkout-fix
395
- ✓ Ready to prompt!
396
- ```
397
-
398
- ## update (alias: `up`)
399
-
400
- Update to the latest version.
401
-
402
- ```bash
403
- ak up # update to latest
404
- ak up -f # force update (--force)
405
- ```
406
-
407
- **Options:**
408
- - `-f, --force` — Force update even if already latest
409
-
410
- **What it does:**
411
- 1. Checks for newer version
412
- 2. Downloads assets (skills, rules, templates)
413
- 3. Updates `.claude/` and `.rules/`
414
- 4. Optionally deletes old version
415
- 5. Updates state tracking
416
-
417
- **Example:**
418
- ```bash
419
- $ aiflow update
420
- Updating from v1.0.0 to v1.1.0...
421
- ✓ Downloaded skills for v1.1.0
422
- ✓ Downloaded rules for v1.1.0
423
-
424
- Keep old version (v1.0.0)? (y/n) y
425
- ✓ Kept v1.0.0
426
-
427
- You can switch back with: aiflow use 1.0.0
428
-
429
- ✨ Update completed!
430
- ```
431
-
432
- ## sync-skills (alias: `sync`)
433
-
434
- Manually synchronize AI Instruction files with local custom skills.
435
-
436
- ```bash
437
- ak sync # sync AI Instruction files
438
- ```
439
-
440
- **What it does:**
441
- 1. Reads all active local skills and upstream skills
442
- 2. Generates the updated AI Skill Registry table
443
- 3. Safely updates the AI Instruction blocks (`<!-- aiflow-kit-start -->`) in your project's `CLAUDE.md`, `GEMINI.md`, or `.cursorrules` without wiping your custom rules
444
- 4. If no marker blocks are found, it asks for confirmation to overwrite with the correct structure
445
-
446
- **Example:**
447
- ```bash
448
- $ aiflow sync-skills
449
- ⟳ Syncing AI Instruction files...
450
- ✓ Updated AI Flow block in CLAUDE.md
451
- ✨ Sync completed!
452
- ```
453
-
454
- ## doctor (alias: `dr`)
455
-
456
- Health check for your setup.
457
-
458
- ```bash
459
- ak dr # run health check
460
- ak dr -v # verbose output (--verbose)
461
- ak dr -t PROJ-33 # token breakdown for ticket (--ticket)
462
- ```
463
-
464
- **Options:**
465
- - `-t, --ticket <id>` — Show token breakdown for specific ticket
466
- - `-v, --verbose` — Show detailed checks
467
-
468
- **What it does:**
469
- 1. Checks for required directories
470
- 2. Validates configuration files
471
- 3. Checks MCP adapter setup
472
- 4. Verifies framework template
473
- 5. Reports issues and fixes
474
-
475
- **Example:**
476
- ```bash
477
- $ aiflow doctor
478
- Running health check for AI Flow Kit...
479
-
480
- ✓ .claude/skills exists
481
- ✓ .rules exists
482
- ✓ CLAUDE.md exists
483
- ✓ Version tracking active (v1.0.0)
484
- ✓ Jira adapter configured
485
- ✓ Laravel framework template loaded
486
-
487
- ✨ Everything looks healthy! You are ready to fly.
488
- ```
489
-
490
- ## validate (alias: `vl`)
491
-
492
- Validate AI output against team rules and quality standards.
493
-
494
- ```bash
495
- ak vl output.php # validate a file
496
- ak vl output.php -r strict # strict rule set (--ruleset)
497
- ak vl output.php -v # detailed report (--verbose)
498
- ak vl output.php -x # auto-fix trailing whitespace (--fix)
499
- ```
500
-
501
- **Options:**
502
- - `<file>` — File to validate
503
- - `-r, --ruleset <set>` — Rule set (default, strict, lenient)
504
- - `-v, --verbose` — Detailed report
505
- - `-x, --fix` — Auto-fix trailing whitespace
506
-
507
- **What it does:**
508
- 1. Loads validation rules from `custom/rules/`
509
- 2. Checks code style, naming, security, etc
510
- 3. Reports violations
511
- 4. Optionally suggests fixes
512
-
513
- **Example:**
514
- ```bash
515
- $ aiflow validate src/Payment.php
516
- Validating against ruleset: default
517
-
518
- ✓ Code style: OK
519
- ⚠ Naming: Variable $p should be $payment
520
- ✓ Security: OK
521
- ✗ Testing: Missing test file
522
-
523
- Issues found: 2 warnings, 1 error
524
- Suggestions: Add test case, rename variable
525
- ```
526
-
527
- ## telemetry (alias: `tel`)
528
-
529
- Manage usage telemetry.
530
-
531
- ```bash
532
- ak tel status # view status, buffer size, last flush
533
- ak tel enable # interactive setup (URL, secret, email)
534
- ak tel disable # disable tracking (config retained)
535
- ak tel flush # force-send buffered events now
536
- ```
537
-
538
- **Sub-commands:**
539
- - `status` — View current status, buffer size, last flush time
540
- - `enable` — Interactive setup (Apps Script URL, team secret, email)
541
- - `disable` — Disable tracking; configuration is retained
542
- - `flush` — Force-send all buffered events immediately
543
-
544
- ---
545
-
546
- ## memory (alias: `mem`)
547
-
548
- Manage team knowledge and context memory.
549
-
550
- ```bash
551
- ak mem s "payment-flow" "Process: 1. Validate, 2. Call Stripe, 3. Update DB" # save
552
- ak mem g "payment-flow" # retrieve (memory get)
553
- ak mem ls # list all (memory list)
554
- ak mem sr "validation" # search (memory search)
555
- ak mem d "old-memory" # delete (memory delete)
556
- ak mem cl # clear all (memory clear)
557
- ```
558
-
559
- **Sub-commands (with aliases):**
560
- - `save|s <key> <value>` — Save a note
561
- - `get|g <key>` — Read a note
562
- - `list|ls` — List all notes
563
- - `search|sr <query>` — Search notes
564
- - `delete|d <key>` — Delete a note
565
- - `clear|cl` — Clear all notes
566
-
567
- **What it does:**
568
- 1. Stores team knowledge in `.aiflow/memory/`
569
- 2. Makes knowledge discoverable across the team
570
-
571
- **Example:**
572
- ```bash
573
- $ aiflow memory save "payment-flow" "Process: 1. Validate amount, 2. Call Stripe API, 3. Update DB"
574
- ✓ Saved: payment-flow
575
-
576
- $ aiflow memory search "payment"
577
- Found 3 memories matching "payment":
578
- 1. payment-flow
579
- 2. payment-error-handling
580
- 3. payment-tests
581
- ```
582
-
583
- ## guide (alias: `g`)
584
-
585
- Show quickstart guide.
586
-
587
- ```bash
588
- ak g # full guide
589
- ak g -f # architecture & flow only (--flow)
590
- ak g -c # command reference only (--commands)
591
- ```
592
-
593
- **Options:**
594
- - `-f, --flow` — Show architecture & flow diagram only
595
- - `-c, --commands` — Show command reference only
596
-
597
- ---
598
-
599
- ## gate (AI workflow logging)
600
-
601
- Called automatically by AI during gate workflow — not intended for manual use.
602
-
603
- ```bash
604
- # Log gate N started
605
- aiflow gate <n> start --ticket <id>
606
-
607
- # Log gate N approved
608
- aiflow gate <n> approved --ticket <id>
609
- ```
610
-
611
- **Arguments:**
612
- - `<n>` — Gate number (1-5)
613
- - `<action>` — `start` or `approved`
614
-
615
- **Options:**
616
- - `--ticket <id>` — Ticket ID associated with the gate transition
617
- - `--ai-tool <tool>` — AI tool that triggered the gate (e.g. claude, cursor, gemini)
618
-
619
- ---
620
-
621
- ## remove (alias: `rm`)
622
-
623
- Remove ai-flow-kit from project, a cached version, or uninstall globally.
624
-
625
- ```bash
626
- ak rm # remove from project
627
- ak rm -g # uninstall globally (--global)
628
- ak rm --version 1.0.0 # remove cached version from .aiflow/
629
- ```
630
-
631
- **Options:**
632
- - `--version <ver>` — Remove a specific cached version from `.aiflow/versions/`
633
- - `-g, --global` — Uninstall the global npm package (removes `aiflow` command)
634
-
635
- ---
636
-
637
- ## Global Options
638
-
639
- These work with any command:
640
-
641
- ```bash
642
- ak --version # Show installed version (-v, -V)
643
- ak <command> --help # Show help for a command (-h)
644
- ```
645
-
646
- ## Exit Codes
647
-
648
- - `0` — Success
649
- - `1` — General error
650
- - `2` — Command not found
651
- - `3` — Invalid arguments
652
- - `4` — Configuration error
653
- - `5` — MCP adapter error
654
-
655
- ---
656
-
657
- See [Getting Started](./getting-started.md) for tutorials and [Configuration](./configuration.md) for detailed options.
1
+ # CLI Reference
2
+
3
+ Complete reference for all `ak` / `aiflow` commands.
4
+
5
+ > **Short alias:** `ak` is the preferred short form of `aiflow`. Every command also has a short alias shown in the format `command|alias`.
6
+
7
+ ## Commands Overview
8
+
9
+ ```bash
10
+ ak --help # Show all commands
11
+ ak <command> --help # Show command help
12
+ ak <alias> --help # Also works with aliases
13
+ ```
14
+
15
+ ### Quick Alias Reference
16
+
17
+ | Full command | Short | Full command | Short |
18
+ |---|---|---|---|
19
+ | `ak init` | `ak i` | `ak use` | `ak u` |
20
+ | `ak prompt` | `ak p` | `ak detect` | `ak d` |
21
+ | `ak task` | `ak t` | `ak context` | `ak ctx` |
22
+ | `ak checkpoint` | `ak cp` | `ak validate` | `ak vl` |
23
+ | `ak memory` | `ak mem` | `ak guide` | `ak g` |
24
+ | `ak remove` | `ak rm` | `ak update` | `ak up` |
25
+ | `ak sync-skills` | `ak sync` | `ak doctor` | `ak dr` |
26
+ | `ak telemetry` | `ak tel` | | |
27
+
28
+ | `task` sub-command | Short | `memory` sub-command | Short |
29
+ |---|---|---|---|
30
+ | `ak t status` | `ak t st` | `ak mem save` | `ak mem s` |
31
+ | `ak t list` | `ak t ls` | `ak mem get` | `ak mem g` |
32
+ | `ak t pause` | `ak t p` | `ak mem list` | `ak mem ls` |
33
+ | `ak t switch` | `ak t sw` | `ak mem search` | `ak mem sr` |
34
+ | `ak t resume` | `ak t r` | `ak mem delete` | `ak mem d` |
35
+ | `ak t reset` | `ak t rst` | `ak mem clear` | `ak mem cl` |
36
+ | `ak t remove` | `ak t rm` | | |
37
+ | `ak t next` | `ak t n` | | |
38
+
39
+ ## init
40
+
41
+ Initialize AI Flow Kit in your project.
42
+
43
+ ```bash
44
+ ak init # basic initialization
45
+ ak init -f laravel # with framework (--framework)
46
+ ak init -a jira # with adapter (--adapter)
47
+ ak init -f laravel -a jira # full setup
48
+ ak init -f spring-boot --with-rtk # enable RTK compression
49
+ ak init --no-rtk # skip RTK setup
50
+ ```
51
+
52
+ **Options:**
53
+ - `-f, --framework <types>` (alias: `--fw`) — Framework templates, comma-separated (e.g. `spring-boot,reactjs`)
54
+ - `-a, --adapter <types>` — MCP adapters (jira, backlog, google-sheets)
55
+ - `-e, --env <types>` — AI tools to configure (cursor, gemini, copilot, generic). Default excludes `generic`.
56
+ - `--with-rtk` — Force enable RTK token compression hook
57
+ - `--no-rtk` — Skip RTK setup even if RTK is detected
58
+
59
+ **What it does:**
60
+ 1. Creates `.claude/skills/` with all available skills
61
+ 2. Creates `.rules/` with team rules (including `java/spring-boot-examples.md` for Spring Boot projects)
62
+ 3. Creates `.aiflow/` with version tracking
63
+ 4. Sets up framework instruction file (`CLAUDE.md`, `.cursorrules`, etc.):
64
+ - **File already exists** → saves aiflow template to `.aiflow/reference/<file>` for comparison. Your existing file is untouched — you own it.
65
+ - **File does not exist** → creates it in the project root.
66
+ 5. Optionally configures MCP adapter
67
+
68
+ > **Note:** `CLAUDE.md` and other AI instruction files are project files — commit them to your repo. Run `aiflow init` once to generate them, then maintain them yourself. On subsequent `aiflow init` runs they will not be overwritten.
69
+
70
+ **Example:**
71
+ ```bash
72
+ $ aiflow init --framework laravel --adapter jira
73
+ Initializing ai-flow-kit (v1.0.0)...
74
+ ✓ Copied skills to .claude/skills
75
+ ✓ Copied rules to .rules
76
+ ✓ Set up CLAUDE.md for framework: laravel
77
+ ✓ Updated MCP configuration for jira
78
+
79
+ ✨ Initialized AI Flow Kit successfully!
80
+ ```
81
+
82
+ ## use
83
+
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
+
86
+ ```bash
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+)
90
+ ak use BACKLOG-456 -F # fast mode (--fast)
91
+ ak use BACKLOG-456 -U # full mode (--full)
92
+ ak use -m # manual entry (--manual)
93
+ ak use -f path/to/context.json # load from file (--file)
94
+ ak use BACKLOG-456 -c # load with all comments (--coms)
95
+ ak use BACKLOG-456 --clast 5 # last 5 comments
96
+ ak use BACKLOG-456 --cid 42 # specific comment
97
+ ak use 1.0.0 # switch between versions
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
+
103
+ **Options:**
104
+ - `-m, --manual` — Manual context entry
105
+ - `-f, --file <path>` — Load from file (JSON or plain text)
106
+ - `-s, --save <name>` — Save as named context
107
+ - `-c, --coms` — Load all comments (alias for `--with-comments`)
108
+ - `--with-comments` — Include all ticket comments
109
+ - `--cid <id>` — Load a specific comment by ID
110
+ - `--clast <n>` — Only fetch last N comments
111
+ - `--cfrom <id>` — Fetch comments from ID N onward
112
+ - `--cto <id>` — Fetch comments up to ID N
113
+ - `-F, --fast` — Fast mode: AI skips Q&A, lite 3-section requirement doc (< 5 min Gate 1)
114
+ - `-U, --full` — Full mode: force complete Gate 1 analysis with Q&A
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
+
135
+ **What it does:**
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
141
+
142
+ **Example:**
143
+ ```bash
144
+ $ aiflow use JIRA-123
145
+ Fetching context from Jira...
146
+ ✓ Title: Fix payment processing error
147
+ ✓ Description: 2000+ words pulled
148
+ ✓ Acceptance criteria: 3 items
149
+ ✓ Saved to .aiflow/context/current.json
150
+
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
157
+ ```
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
+
183
+ ## task (alias: `t`)
184
+
185
+ Manage multiple tasks — pause, switch, and resume while preserving gate progress.
186
+
187
+ ```bash
188
+ ak t st # show active + pending (task status)
189
+ ak t ls # list all saved tasks (task list)
190
+ ak t p # pause current task (task pause)
191
+ ak t p -n "waiting for API spec from PM" # pause with note (--note)
192
+ ak t sw PROJ-99 # switch to another task (task switch)
193
+ ak t r PROJ-33 # resume a paused task (task resume)
194
+ ak t rst PROJ-33 # reset to Gate 1 (task reset)
195
+ ak t rm PROJ-33 # delete all task data (task remove)
196
+ ak t n # approve gate & prep next session (task next)
197
+ ak t n -t PROJ-33 # specify ticket (--ticket)
198
+ ```
199
+
200
+ **Sub-commands (with aliases):**
201
+ - `status|st` — Show active task and all pending tasks
202
+ - `list|ls` — List all saved tasks with gate state
203
+ - `pause|p [-n <text>]` — Save current progress and clear active task
204
+ - `switch|sw <ticket-id>` — Pause current task + load/switch to another
205
+ - `resume|r <ticket-id>` — Restore a paused task as active
206
+ - `reset|rst <ticket-id>` — Reset gate progress to Gate 1; prompts to optionally delete `plan/<id>/` files
207
+ - `remove|rm <ticket-id>` — Permanently delete all saved data for the task
208
+ - `next|n [-t <id>]` — Approve current gate and prepare next session
209
+
210
+ **What it does:**
211
+ 1. Saves a snapshot of the current context (`current.json`) to `.aiflow/tasks/<taskId>/context.json`
212
+ 2. Detects current gate from `plan/` artifacts (`requirement.md`, `plan.md`, `summary.md`)
213
+ 3. Writes `.aiflow/tasks/<taskId>/task-state.json` with status, gate, and approvals
214
+ 4. On resume: restores context as `current.json` and sets status back to `active`
215
+ 5. The **SessionStart hook** reads `task-state.json` on next `claude` launch and injects gate-aware instructions — Claude resumes from the correct gate instead of restarting Gate 1
216
+
217
+ **Gate detection from `plan/` files:**
218
+ | File present | Inferred gate |
219
+ |---|---|
220
+ | (none) | Gate 1 |
221
+ | `plan/<id>/requirement.md` | Gate 2 |
222
+ | `plan/<id>/plan.md` | Gate 3 |
223
+ | `plan/<id>/summary.md` | Gate 5 |
224
+
225
+ **Example workflow:**
226
+ ```bash
227
+ # Mid-task on PROJ-33 (Gate 2 in progress)...
228
+ aiflow task pause --note "waiting for DB schema confirmation"
229
+ # ✓ Task PROJ-33 paused at Gate 2.
230
+
231
+ aiflow use PROJ-99 # load urgent task
232
+ claude # AI auto-starts Gate 1 for PROJ-99
233
+
234
+ # Back to PROJ-33
235
+ aiflow task resume PROJ-33
236
+ # ✓ Resumed task: PROJ-33
237
+ # Gate: 2 (Implementation Plan)
238
+
239
+ claude # AI resumes from Gate 2 — no restart
240
+ ```
241
+
242
+ **Reset workflow** — run a task from scratch after deleting generated code:
243
+ ```bash
244
+ aiflow task reset PROJ-33
245
+ # Reset task: PROJ-33
246
+ # • .aiflow/tasks/PROJ-33/task-state.json (Gate 3 → 1, approvals cleared)
247
+ # ? Also delete 2 plan file(s) in plan/PROJ-33/? › No
248
+ # ? Proceed with reset? › Yes
249
+ # ✓ Task PROJ-33 reset to Gate 1.
250
+
251
+ claude # AI auto-starts Gate 1 as if the task is brand new
252
+ ```
253
+
254
+ **Remove workflow** — permanently clean up a cancelled task:
255
+ ```bash
256
+ aiflow task remove PROJ-33
257
+ # Remove task: PROJ-33
258
+ # • .aiflow/tasks/PROJ-33/ (context snapshot + gate state)
259
+ # • .aiflow/context/current.json (this is the active task)
260
+ # • plan/PROJ-33/ (2 files):
261
+ # - plan/PROJ-33/requirement.md
262
+ # - plan/PROJ-33/plan.md
263
+ # ? This cannot be undone. Proceed? › No
264
+ ```
265
+
266
+ ---
267
+
268
+ ## prompt (alias: `p`)
269
+
270
+ Generate an AI prompt with context, rules, and template.
271
+
272
+ ```bash
273
+ ak p bug-fix # generate bug fix prompt
274
+ ak p feature # generate feature prompt
275
+ ak p investigation # generate investigation prompt
276
+ ak p refactor # generate refactor prompt
277
+ ak p impact # generate impact analysis prompt
278
+ ak p -l # list all prompt types (--list)
279
+ ak p bug-fix -o p.md # save to file (--output)
280
+ ak p bug-fix -L vietnamese # Vietnamese language (--lang)
281
+ ak p bug-fix -d comprehensive # comprehensive detail (--detail)
282
+ ```
283
+
284
+ **Options:**
285
+ - `<type>` — Prompt type (bug-fix, feature, investigation, refactor, impact, docs)
286
+ - `-l, --list` — List available prompt types
287
+ - `-o, --output <file>` — Save to file instead of printing
288
+ - `-L, --lang <lang>` — Language (english, vietnamese)
289
+ - `-d, --detail <level>` — Detail level (minimal, standard, comprehensive)
290
+
291
+ **What it does:**
292
+ 1. Loads current context (from `aiflow use`)
293
+ 2. Loads prompt template for the type
294
+ 3. Loads framework rules
295
+ 4. Loads team rules and best practices
296
+ 5. Merges everything into a complete prompt
297
+ 6. Prints to console (or saves/copies)
298
+
299
+ **Example:**
300
+ ```bash
301
+ $ aiflow prompt bug-fix
302
+ ═══════════════════════════════════════════════════════════════
303
+ BUG FIX INVESTIGATION PROMPT
304
+ ═══════════════════════════════════════════════════════════════
305
+
306
+ ## Context
307
+ Title: Payment processing fails on checkout
308
+ Description: Users report seeing payment error when... [2000+ words]
309
+
310
+ ## Framework Rules (Laravel)
311
+ - Use Laravel's built-in tools...
312
+ - Keep Controllers thin...
313
+
314
+ ## Team Rules
315
+ - Use strict typing...
316
+ - Follow PSR-12 styling...
317
+
318
+ ## Task
319
+ Investigate the bug following this process:
320
+ 1. Understand the error context...
321
+ [Complete prompt ready to copy to Claude]
322
+ ```
323
+
324
+ ## detect (alias: `d`)
325
+
326
+ Auto-detect task type from a description.
327
+
328
+ ```bash
329
+ ak d "Payment integration is broken" # detect from description
330
+ ak d # detect from current context
331
+ ak d "Add new feature" -v # show confidence (--verbose)
332
+ ak d "description" -t 90 # set threshold (--threshold)
333
+ ```
334
+
335
+ **Options:**
336
+ - `<description>` — Description to analyze
337
+ - `-v, --verbose` — Show detection reasoning
338
+ - `-t, --threshold <number>` — Confidence threshold (0-100)
339
+
340
+ **What it does:**
341
+ 1. Analyzes description for keywords
342
+ 2. Classifies as bug-fix, feature, refactor, investigation, etc
343
+ 3. Shows confidence score
344
+ 4. Suggests appropriate skill
345
+
346
+ **Example:**
347
+ ```bash
348
+ $ aiflow detect "Users can't save their orders"
349
+ 🐛 Bug Fix (98% confidence)
350
+
351
+ Detected keywords:
352
+ - "can't save" → bug pattern
353
+ - Specific area → likely regression
354
+
355
+ Suggested skill: investigate-bug
356
+
357
+ Next: aiflow prompt bug-fix
358
+ ```
359
+
360
+ ## context (alias: `ctx`)
361
+
362
+ Manage task contexts (save, load, list, delete).
363
+
364
+ ```bash
365
+ ak ctx list # list saved contexts
366
+ ak ctx -s "checkout-fix" # save current context (--save)
367
+ ak ctx -l "checkout-fix" # load saved context (--load)
368
+ ak ctx -d "checkout-fix" # delete saved context (--delete)
369
+ ak ctx clear # clear all contexts
370
+ ak ctx show # show current context
371
+ ```
372
+
373
+ **Options:**
374
+ - `-s, --save <name>` — Save current context
375
+ - `-l, --load <name>` — Load saved context
376
+ - `-d, --delete <name>` — Delete saved context
377
+ - `--clear` — Clear all contexts
378
+ - `--show` — Show current context details
379
+
380
+ **What it does:**
381
+ 1. Lists, saves, loads, or deletes contexts
382
+ 2. Manages context history in `.aiflow/context/history/`
383
+ 3. Makes it easy to switch between tasks
384
+
385
+ **Example:**
386
+ ```bash
387
+ $ aiflow context --list
388
+ Saved contexts:
389
+ 1. checkout-fix (saved 2 hours ago)
390
+ 2. payment-integration (saved yesterday)
391
+ 3. user-auth-bug (saved 3 days ago)
392
+
393
+ $ aiflow context --load checkout-fix
394
+ ✓ Loaded: checkout-fix
395
+ ✓ Ready to prompt!
396
+ ```
397
+
398
+ ## update (alias: `up`)
399
+
400
+ Update to the latest version.
401
+
402
+ ```bash
403
+ ak up # update to latest
404
+ ak up -f # force update (--force)
405
+ ```
406
+
407
+ **Options:**
408
+ - `-f, --force` — Force update even if already latest
409
+
410
+ **What it does:**
411
+ 1. Checks for newer version
412
+ 2. Downloads assets (skills, rules, templates)
413
+ 3. Updates `.claude/` and `.rules/`
414
+ 4. Optionally deletes old version
415
+ 5. Updates state tracking
416
+
417
+ **Example:**
418
+ ```bash
419
+ $ aiflow update
420
+ Updating from v1.0.0 to v1.1.0...
421
+ ✓ Downloaded skills for v1.1.0
422
+ ✓ Downloaded rules for v1.1.0
423
+
424
+ Keep old version (v1.0.0)? (y/n) y
425
+ ✓ Kept v1.0.0
426
+
427
+ You can switch back with: aiflow use 1.0.0
428
+
429
+ ✨ Update completed!
430
+ ```
431
+
432
+ ## sync-skills (alias: `sync`)
433
+
434
+ Manually synchronize AI Instruction files with local custom skills.
435
+
436
+ ```bash
437
+ ak sync # sync AI Instruction files
438
+ ```
439
+
440
+ **What it does:**
441
+ 1. Reads all active local skills and upstream skills
442
+ 2. Generates the updated AI Skill Registry table
443
+ 3. Safely updates the AI Instruction blocks (`<!-- aiflow-kit-start -->`) in your project's `CLAUDE.md`, `GEMINI.md`, or `.cursorrules` without wiping your custom rules
444
+ 4. If no marker blocks are found, it asks for confirmation to overwrite with the correct structure
445
+
446
+ **Example:**
447
+ ```bash
448
+ $ aiflow sync-skills
449
+ ⟳ Syncing AI Instruction files...
450
+ ✓ Updated AI Flow block in CLAUDE.md
451
+ ✨ Sync completed!
452
+ ```
453
+
454
+ ## doctor (alias: `dr`)
455
+
456
+ Health check for your setup.
457
+
458
+ ```bash
459
+ ak dr # run health check
460
+ ak dr -v # verbose output (--verbose)
461
+ ak dr -t PROJ-33 # token breakdown for ticket (--ticket)
462
+ ```
463
+
464
+ **Options:**
465
+ - `-t, --ticket <id>` — Show token breakdown for specific ticket
466
+ - `-v, --verbose` — Show detailed checks
467
+
468
+ **What it does:**
469
+ 1. Checks for required directories
470
+ 2. Validates configuration files
471
+ 3. Checks MCP adapter setup
472
+ 4. Verifies framework template
473
+ 5. Reports issues and fixes
474
+
475
+ **Example:**
476
+ ```bash
477
+ $ aiflow doctor
478
+ Running health check for AI Flow Kit...
479
+
480
+ ✓ .claude/skills exists
481
+ ✓ .rules exists
482
+ ✓ CLAUDE.md exists
483
+ ✓ Version tracking active (v1.0.0)
484
+ ✓ Jira adapter configured
485
+ ✓ Laravel framework template loaded
486
+
487
+ ✨ Everything looks healthy! You are ready to fly.
488
+ ```
489
+
490
+ ## validate (alias: `vl`)
491
+
492
+ Validate AI output against team rules and quality standards.
493
+
494
+ ```bash
495
+ ak vl output.php # validate a file
496
+ ak vl output.php -r strict # strict rule set (--ruleset)
497
+ ak vl output.php -v # detailed report (--verbose)
498
+ ak vl output.php -x # auto-fix trailing whitespace (--fix)
499
+ ```
500
+
501
+ **Options:**
502
+ - `<file>` — File to validate
503
+ - `-r, --ruleset <set>` — Rule set (default, strict, lenient)
504
+ - `-v, --verbose` — Detailed report
505
+ - `-x, --fix` — Auto-fix trailing whitespace
506
+
507
+ **What it does:**
508
+ 1. Loads validation rules from `custom/rules/`
509
+ 2. Checks code style, naming, security, etc
510
+ 3. Reports violations
511
+ 4. Optionally suggests fixes
512
+
513
+ **Example:**
514
+ ```bash
515
+ $ aiflow validate src/Payment.php
516
+ Validating against ruleset: default
517
+
518
+ ✓ Code style: OK
519
+ ⚠ Naming: Variable $p should be $payment
520
+ ✓ Security: OK
521
+ ✗ Testing: Missing test file
522
+
523
+ Issues found: 2 warnings, 1 error
524
+ Suggestions: Add test case, rename variable
525
+ ```
526
+
527
+ ## telemetry (alias: `tel`)
528
+
529
+ Manage usage telemetry.
530
+
531
+ ```bash
532
+ ak tel status # view status, buffer size, last flush
533
+ ak tel enable # interactive setup (URL, secret, email)
534
+ ak tel disable # disable tracking (config retained)
535
+ ak tel flush # force-send buffered events now
536
+ ```
537
+
538
+ **Sub-commands:**
539
+ - `status` — View current status, buffer size, last flush time
540
+ - `enable` — Interactive setup (Apps Script URL, team secret, email)
541
+ - `disable` — Disable tracking; configuration is retained
542
+ - `flush` — Force-send all buffered events immediately
543
+
544
+ ---
545
+
546
+ ## memory (alias: `mem`)
547
+
548
+ Manage team knowledge and context memory.
549
+
550
+ ```bash
551
+ ak mem s "payment-flow" "Process: 1. Validate, 2. Call Stripe, 3. Update DB" # save
552
+ ak mem g "payment-flow" # retrieve (memory get)
553
+ ak mem ls # list all (memory list)
554
+ ak mem sr "validation" # search (memory search)
555
+ ak mem d "old-memory" # delete (memory delete)
556
+ ak mem cl # clear all (memory clear)
557
+ ```
558
+
559
+ **Sub-commands (with aliases):**
560
+ - `save|s <key> <value>` — Save a note
561
+ - `get|g <key>` — Read a note
562
+ - `list|ls` — List all notes
563
+ - `search|sr <query>` — Search notes
564
+ - `delete|d <key>` — Delete a note
565
+ - `clear|cl` — Clear all notes
566
+
567
+ **What it does:**
568
+ 1. Stores team knowledge in `.aiflow/memory/`
569
+ 2. Makes knowledge discoverable across the team
570
+
571
+ **Example:**
572
+ ```bash
573
+ $ aiflow memory save "payment-flow" "Process: 1. Validate amount, 2. Call Stripe API, 3. Update DB"
574
+ ✓ Saved: payment-flow
575
+
576
+ $ aiflow memory search "payment"
577
+ Found 3 memories matching "payment":
578
+ 1. payment-flow
579
+ 2. payment-error-handling
580
+ 3. payment-tests
581
+ ```
582
+
583
+ ## guide (alias: `g`)
584
+
585
+ Show quickstart guide.
586
+
587
+ ```bash
588
+ ak g # full guide
589
+ ak g -f # architecture & flow only (--flow)
590
+ ak g -c # command reference only (--commands)
591
+ ```
592
+
593
+ **Options:**
594
+ - `-f, --flow` — Show architecture & flow diagram only
595
+ - `-c, --commands` — Show command reference only
596
+
597
+ ---
598
+
599
+ ## gate (AI workflow logging)
600
+
601
+ Called automatically by AI during gate workflow — not intended for manual use.
602
+
603
+ ```bash
604
+ # Log gate N started
605
+ aiflow gate <n> start --ticket <id>
606
+
607
+ # Log gate N approved
608
+ aiflow gate <n> approved --ticket <id>
609
+ ```
610
+
611
+ **Arguments:**
612
+ - `<n>` — Gate number (1-5)
613
+ - `<action>` — `start` or `approved`
614
+
615
+ **Options:**
616
+ - `--ticket <id>` — Ticket ID associated with the gate transition
617
+ - `--ai-tool <tool>` — AI tool that triggered the gate (e.g. claude, cursor, gemini)
618
+
619
+ ---
620
+
621
+ ## remove (alias: `rm`)
622
+
623
+ Remove ai-flow-kit from project, a cached version, or uninstall globally.
624
+
625
+ ```bash
626
+ ak rm # remove from project
627
+ ak rm -g # uninstall globally (--global)
628
+ ak rm --version 1.0.0 # remove cached version from .aiflow/
629
+ ```
630
+
631
+ **Options:**
632
+ - `--version <ver>` — Remove a specific cached version from `.aiflow/versions/`
633
+ - `-g, --global` — Uninstall the global npm package (removes `aiflow` command)
634
+
635
+ ---
636
+
637
+ ## Global Options
638
+
639
+ These work with any command:
640
+
641
+ ```bash
642
+ ak --version # Show installed version (-v, -V)
643
+ ak <command> --help # Show help for a command (-h)
644
+ ```
645
+
646
+ ## Exit Codes
647
+
648
+ - `0` — Success
649
+ - `1` — General error
650
+ - `2` — Command not found
651
+ - `3` — Invalid arguments
652
+ - `4` — Configuration error
653
+ - `5` — MCP adapter error
654
+
655
+ ---
656
+
657
+ See [Getting Started](./getting-started.md) for tutorials and [Configuration](./configuration.md) for detailed options.