@relipa/ai-flow-kit 0.0.6 → 0.0.7-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -16
- package/bin/aiflow.js +65 -2
- package/custom/mcp-presets/gitnexus.json +8 -0
- package/custom/skills/generate-spec/SKILL.md +7 -0
- package/custom/skills/impact-analysis/SKILL.md +10 -0
- package/custom/skills/investigate-bug/SKILL.md +17 -0
- package/custom/skills/read-study-requirement/SKILL.md +11 -0
- package/custom/skills/review-plan/SKILL.md +15 -0
- package/custom/templates/php-plain.md +261 -0
- package/docs/common/AIFLOW.md +17 -6
- package/docs/common/CHANGELOG.md +63 -5
- package/docs/common/QUICK_START.md +33 -13
- package/docs/common/cli-reference.md +23 -0
- package/package.json +2 -7
- package/scripts/checkpoint.js +46 -0
- package/scripts/doctor.js +111 -8
- package/scripts/gitnexus-worker.js +94 -0
- package/scripts/guide.js +42 -51
- package/scripts/hooks/session-start.js +35 -5
- package/scripts/hooks/session-stop.js +55 -0
- package/scripts/init.js +299 -19
- package/scripts/prompt.js +2 -2
- package/scripts/remove.js +54 -0
- package/scripts/task.js +101 -0
- package/scripts/update.js +14 -4
- package/scripts/use.js +78 -6
- package/upstream/.claude-plugin/marketplace.json +4 -4
- package/upstream/.claude-plugin/plugin.json +2 -4
- package/upstream/.cursor-plugin/plugin.json +2 -4
- package/upstream/docs/plans/2025-11-22-opencode-support-design.md +1 -1
- package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +2 -2
- package/upstream/docs/testing.md +2 -2
- package/upstream/skills/subagent-driven-development/SKILL.md +5 -6
- package/upstream/skills/subagent-driven-development/implementer-prompt.md +2 -3
- package/upstream/skills/systematic-debugging/CREATION-LOG.md +1 -1
- package/upstream/skills/systematic-debugging/root-cause-tracing.md +1 -1
- package/upstream/skills/tdd-lean/SKILL.md +127 -0
- package/upstream/skills/using-git-worktrees/SKILL.md +4 -5
- package/upstream/skills/writing-plans/SKILL.md +3 -9
- package/upstream/tests/brainstorm-server/package-lock.json +36 -0
package/docs/common/AIFLOW.md
CHANGED
|
@@ -28,7 +28,7 @@ PM writes ticket on Backlog/Jira
|
|
|
28
28
|
▼
|
|
29
29
|
⛩️ GATE 3 — Code Generation (TDD) [AI]
|
|
30
30
|
AI writes tests first → implement → tests pass
|
|
31
|
-
|
|
31
|
+
Verify implementation works
|
|
32
32
|
│ Code done
|
|
33
33
|
▼
|
|
34
34
|
⛩️ GATE 4 — AI Self-Review [AI + DEV]
|
|
@@ -65,6 +65,10 @@ AI Flow Kit allows you to manage multiple tasks in the same repository without l
|
|
|
65
65
|
- **`aiflow task pause`**: Save current context and gate progress to `.aiflow/tasks/<taskId>/`.
|
|
66
66
|
- **`aiflow task switch <id>`**: Pause current task and switch to another.
|
|
67
67
|
- **`aiflow task resume <id>`**: Restore context and gate state. AI auto-resumes from the correct gate.
|
|
68
|
+
- **`aiflow task next`**: Approve the current gate, generate `task-summary.md`, clear active context, and prepare the task for a fresh session (Recommended to avoid context pollution).
|
|
69
|
+
|
|
70
|
+
### Pro-Tip: Fresh Session Workflow
|
|
71
|
+
For the best AI performance, run `aiflow task next` after every gate approval, then open a **new chatbox** and type "continue". This clears out long chat history that might confuse the AI.
|
|
68
72
|
|
|
69
73
|
---
|
|
70
74
|
|
|
@@ -182,7 +186,7 @@ Summary:
|
|
|
182
186
|
1. Read the approved requirement document
|
|
183
187
|
2. **Invoke** `superpowers:writing-plans` → create detailed implementation plan
|
|
184
188
|
3. Break down into TDD tasks: test first → implement → verify
|
|
185
|
-
4. Define
|
|
189
|
+
4. Define verification strategy (evidence before claims)
|
|
186
190
|
5. Present plan and wait for APPROVED
|
|
187
191
|
|
|
188
192
|
**Implementation Plan Structure:**
|
|
@@ -193,7 +197,6 @@ Summary:
|
|
|
193
197
|
│ ├── Task 2: Implement [component]
|
|
194
198
|
│ ├── Task 3: Write test for [next scenario]
|
|
195
199
|
│ └── ...
|
|
196
|
-
├── Commit Strategy
|
|
197
200
|
└── Test Commands
|
|
198
201
|
```
|
|
199
202
|
|
|
@@ -202,7 +205,7 @@ Summary:
|
|
|
202
205
|
```
|
|
203
206
|
⏸️ GATE 2: IMPLEMENTATION PLAN READY
|
|
204
207
|
|
|
205
|
-
Tasks: [N] |
|
|
208
|
+
Tasks: [N] | Verification: [N] | Test-first tasks: [N]
|
|
206
209
|
|
|
207
210
|
→ Type APPROVED to start coding
|
|
208
211
|
→ Or provide feedback to adjust
|
|
@@ -227,7 +230,7 @@ Tasks: [N] | Commits: [N] | Test-first tasks: [N]
|
|
|
227
230
|
2. `superpowers:test-driven-development` — write tests FIRST
|
|
228
231
|
3. Run tests → confirm FAIL
|
|
229
232
|
4. Implement code → tests PASS
|
|
230
|
-
5.
|
|
233
|
+
5. Verify implementation works
|
|
231
234
|
|
|
232
235
|
#### Bug fix task (extra):
|
|
233
236
|
1. `superpowers:systematic-debugging` — trace root cause, NO guessing
|
|
@@ -238,10 +241,16 @@ Tasks: [N] | Commits: [N] | Test-first tasks: [N]
|
|
|
238
241
|
1. Ensure tests cover current behavior
|
|
239
242
|
2. Refactor in small steps — keep tests green continuously
|
|
240
243
|
|
|
244
|
+
**Fast Mode (tdd-lean):**
|
|
245
|
+
In fast mode, AI uses the `tdd-lean` skill instead of per-test TDD to save massive token costs:
|
|
246
|
+
1. **Batch Red:** Write ALL tests at once. Run once. (Confirm all fail).
|
|
247
|
+
2. **Batch Green:** Implement ALL code at once. Run once. (Confirm all pass).
|
|
248
|
+
3. **Discipline:** After every run, discard full stack traces and keep ONLY the summary line.
|
|
249
|
+
|
|
241
250
|
**Gate 3 Output:**
|
|
242
251
|
- Code implementation finished
|
|
243
252
|
- All tests PASS
|
|
244
|
-
-
|
|
253
|
+
- Verified (evidence provided)
|
|
245
254
|
|
|
246
255
|
---
|
|
247
256
|
|
|
@@ -496,6 +505,8 @@ A: Yes. Use `aiflow task pause` to save your current progress, then `aiflow use
|
|
|
496
505
|
|
|
497
506
|
**Q: If I resume a task, will Claude know which gate to start at?**
|
|
498
507
|
A: Yes. The SessionStart hook reads `.aiflow/tasks/<taskId>/task-state.json` and injects gate-aware instructions. If Gate 1 was already approved, Claude will skip to Gate 2, and so on.
|
|
508
|
+
**Q: Can I resume a Gate 3 (Code Generation) task in a new chatbox?**
|
|
509
|
+
A: Yes. Gate 3 progress is saved via `[x]` checkboxes in `plan/[id]/plan.md`. If you open a new chatbox and say "continue", the AI will automatically skip completed tasks and pick up exactly where it left off.
|
|
499
510
|
|
|
500
511
|
**Q: How does AI estimate effort?**
|
|
501
512
|
A: AI analyzes the scope of changes (files affected, complexity, test requirements) and categorizes: S (< 1h), M (1-4h), L (4-8h), XL (8h+, should split).
|
package/docs/common/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,56 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to
|
|
3
|
+
All notable changes to **ai-flow-kit** will be documented in this file.
|
|
4
4
|
|
|
5
5
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
6
|
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.0.7] - 2026-05-08
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`aiflow use --file` enhancements**:
|
|
15
|
+
- Automatic `taskId` generation from filename (up to 5 words).
|
|
16
|
+
- Full filename used as task `title`.
|
|
17
|
+
- Interactive `taskType` selection prompt during file loading for better context.
|
|
18
|
+
- **`documentation` task type** — Added support for documentation-specific tasks in `aiflow use` and task detection.
|
|
19
|
+
- **Automatic `task-summary.md` generation** — `aiflow task next` now generates a cumulative progress report in `plan/[ticket-id]/task-summary.md` at each gate finish.
|
|
20
|
+
- **Session Continuity Instructions** — Added explicit instructions on how to switch to a fresh chat session and resume tasks (including Gate 3 sub-tasks) to both CLI output and AI skill prompts.
|
|
21
|
+
- **NestJS framework support** — Added `nestjs` to the framework selector (`aiflow init`), language rule mapping (`javascript`), and AI instruction template (`custom/templates/nestjs.md`).
|
|
22
|
+
- **PHP Plain (no framework) support** — Added `php-plain` as a new framework option with a dedicated AI system prompt template covering strict types, PSR-12, PDO prepared statements, security best practices, Repository/Service/Controller layering, and PHPUnit testing.
|
|
23
|
+
- **`investigate-bug` skill: NestJS and PHP plain data flows** — Added framework-specific data flow traces for NestJS (`Controller → Service → Repository → DB`) and PHP Plain (`index.php → Controller → Service → Repository/PDO → DB`).
|
|
24
|
+
- **Intelligent AI Instruction Synchronization** — Marker-based (`<!-- aiflow-kit-start -->`) block updates for `CLAUDE.md`, `GEMINI.md`, and `.cursorrules`.
|
|
25
|
+
- **Interactive Instruction Safety** — Granular confirmation prompts for all instruction file modifications (update block, overwrite, or create new).
|
|
26
|
+
- **Automated Repository Hygiene** — Generated files and folders (`.aiflow/`, `plan/`, `.claude/`, `.rules/`, `.mcp.json`, and instruction files) are now automatically managed in `.gitignore`.
|
|
27
|
+
- **`aiflow sync-skills` command** — Lightweight command to synchronize Skill Registry and Instruction files without a full version upgrade.
|
|
28
|
+
- **Enhanced `aiflow guide --flow`** — Now dynamically displays the `## Workflow Overview` section directly from `AIFLOW.md` for up-to-date documentation.
|
|
29
|
+
- **Token savings dashboard in `aiflow doctor`** — new "Token savings" section shows RTK status and estimated 60–90% reduction on bash outputs.
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- **Robust Gate Detection** — Refactored `detectCurrentGate` to prioritize `task-state.json` as the source of truth for task progress.
|
|
34
|
+
- **`aiflow gate approved` CLI output** — Now prints a session-refresh tip to help users maintain clean AI contexts.
|
|
35
|
+
- **`aiflow update` efficiency** — Now automatically performs skill and instruction synchronization even if the version is unchanged (removes the need for `--force`).
|
|
36
|
+
- **Safety First Development** — Removed all automatic `git commit` instructions from AI skills (`subagent-driven-development`, `using-git-worktrees`, `writing-plans`) to ensure developer-led commit management.
|
|
37
|
+
- **Localized CLI** — All interactive prompts and confirmation messages translated to English for consistency.
|
|
38
|
+
- **`aiflow init` RTK entry** — flag description updated to clarify RTK saves bash output tokens (60–90%).
|
|
39
|
+
- **`aiflow doctor`** — RTK section merged into new "Token savings" section.
|
|
40
|
+
- **README.md / QUICK_START.md** — Updated to reflect `sync-skills` and improved update flow.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- **NestJS auto-detection** — `@nestjs/core` in `package.json` was incorrectly detected as `nodejs-express`; now correctly resolves to `nestjs`.
|
|
45
|
+
- **PHP project auto-detection** — Projects with `composer.json` but no Laravel dependency now correctly auto-detect as `php-plain` instead of being skipped.
|
|
46
|
+
- Fixed `.github/copilot-instructions.md` not being included in automated `.gitignore` rules.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
10
50
|
## [0.0.6] - 2026-04-29
|
|
11
51
|
|
|
12
52
|
### Added
|
|
53
|
+
|
|
13
54
|
- **Global Fast Mode (Default)** — Optimize AI efficiency by prioritizing speed and minimizing token usage.
|
|
14
55
|
- Gate 1: Fast track scan with max 1 clarifying question.
|
|
15
56
|
- Gate 3: Disable subagents by default; implement all tasks in a single session.
|
|
@@ -25,6 +66,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
25
66
|
- **Spring Boot code examples extracted** — Java code examples moved to separate files to reduce `CLAUDE.md` size.
|
|
26
67
|
|
|
27
68
|
### Changed
|
|
69
|
+
|
|
28
70
|
- **Default mode** for all new tasks is now `fast` instead of `auto`.
|
|
29
71
|
- **`aiflow init` improvements** — Supports multi-select framework and protects existing instruction files from being overwritten.
|
|
30
72
|
- **CLAUDE.md Optimization** — Reduced Spring Boot template size by ~70%, saving ~3-5k tokens per session.
|
|
@@ -32,18 +74,20 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
32
74
|
- **Automatic Task Pausing** — When loading a new ticket, the current task is automatically paused and its state is saved.
|
|
33
75
|
|
|
34
76
|
### Fixed
|
|
35
|
-
- Broken 404 documentation links on the npmjs.com page.
|
|
36
77
|
|
|
78
|
+
- Broken 404 documentation links on the npmjs.com page.
|
|
37
79
|
|
|
38
80
|
---
|
|
39
81
|
|
|
40
82
|
## [0.0.4-beta.5] - 2026-04-21
|
|
41
83
|
|
|
42
84
|
### Added
|
|
85
|
+
|
|
43
86
|
- Created a dedicated `docs/` folder to house all developer-facing documentation.
|
|
44
87
|
- Integrated AI Skill Registry into all tool templates (Claude, Cursor, Gemini, Copilot) for better skill discovery.
|
|
45
88
|
|
|
46
89
|
### Changed
|
|
90
|
+
|
|
47
91
|
- Moved `README.md`, `QUICK_START.md`, `AIFLOW.md`, `CHANGELOG.md`, and `IMPLEMENTATION_SUMMARY.md` into the `docs/` directory.
|
|
48
92
|
- Updated `package.json` to exclude internal-only files (`CONTRIBUTING.md`, `plan.md`) from the NPM package distribution.
|
|
49
93
|
- Updated `scripts/init.js` to source documentation from the new `docs/` location.
|
|
@@ -54,11 +98,13 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
54
98
|
## [0.0.5-beta.0] - 2026-04-23
|
|
55
99
|
|
|
56
100
|
### Added
|
|
101
|
+
|
|
57
102
|
- **`aiflow gate <n> <action>` command** — Called automatically by AI during gate transitions. Supports `start` and `approved` actions for gates 1-5. Options: `--ticket <id>`, `--ai-tool <tool>`.
|
|
58
103
|
- **Telemetry gate logging** — Gate workflow templates now emit `aiflow gate N start/approved --ticket [id]` telemetry calls at each gate transition for usage metrics.
|
|
59
104
|
- **`aiflow telemetry flush` command** — Force-sends buffered telemetry events immediately.
|
|
60
105
|
|
|
61
106
|
### Changed
|
|
107
|
+
|
|
62
108
|
- **`aiflow init` safe overwrite flow** — When a project already has `CLAUDE.md`, `GEMINI.md`, `.cursorrules`, etc., `aiflow init` now prompts before overwriting:
|
|
63
109
|
- **No (default):** keeps existing file untouched; saves the aiflow template to `.aiflow/reference/<file>` for manual comparison/merge.
|
|
64
110
|
- **Yes:** backs up the existing file to `.aiflow/backup/<file>` before overwriting — nothing is permanently lost.
|
|
@@ -73,7 +119,8 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
73
119
|
## [0.0.5] - 2026-04-23
|
|
74
120
|
|
|
75
121
|
### Added
|
|
76
|
-
|
|
122
|
+
|
|
123
|
+
- **Telemetry System (MVP)**: Added anonymous usage tracking to measure command metrics and user adoption.
|
|
77
124
|
- `aiflow telemetry enable/disable/status` commands to easily opt-in or opt-out.
|
|
78
125
|
- Automatically captures environment metadata and Git email via `git config --global user.email`.
|
|
79
126
|
- Secure payload signing natively using Node `crypto` HMAC-SHA256 to ensure data authenticity.
|
|
@@ -81,6 +128,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
81
128
|
- Support tracking for multiple AI platforms including Cursor and Gemini via Command Execution events and the new Telemetry SDK.
|
|
82
129
|
|
|
83
130
|
### Security
|
|
131
|
+
|
|
84
132
|
- **Strict Privacy**: Explicitly removed all prompt content and chat history tracking to ensure 100% confidentiality of company code and PII.
|
|
85
133
|
|
|
86
134
|
---
|
|
@@ -88,14 +136,18 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
88
136
|
## [Unreleased]
|
|
89
137
|
|
|
90
138
|
## [0.0.3-beta.0] - 2026-04-13
|
|
139
|
+
|
|
91
140
|
### Security
|
|
141
|
+
|
|
92
142
|
- Removed internal GitLab repository links and tracking information.
|
|
93
143
|
- Cleaned `.npmrc` configuration.
|
|
94
144
|
- Added helper scripts for beta and stable releases.
|
|
95
145
|
|
|
96
146
|
## [0.0.2] - 2026-04-13
|
|
147
|
+
|
|
97
148
|
### Changed
|
|
98
|
-
|
|
149
|
+
|
|
150
|
+
- Updated package name in documentation and configuration.
|
|
99
151
|
- Fixed installation guides in README and QUICK_START.
|
|
100
152
|
|
|
101
153
|
## [0.0.1] - 2026-04-13 — Initial Release
|
|
@@ -103,6 +155,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
103
155
|
### Added
|
|
104
156
|
|
|
105
157
|
#### CLI (`aiflow`)
|
|
158
|
+
|
|
106
159
|
- `aiflow init` — scaffold AI workflow config into any project
|
|
107
160
|
(supports `--framework` spring-boot/reactjs, `--adapter` jira/backlog)
|
|
108
161
|
- `aiflow use <skill>` — activate a custom skill in the current project
|
|
@@ -113,6 +166,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
113
166
|
- `aiflow --version` — print installed version
|
|
114
167
|
|
|
115
168
|
#### 5-Gate AI Workflow
|
|
169
|
+
|
|
116
170
|
- **Gate 1 — AI Analyze Requirement**: Auto-starts when a ticket context exists
|
|
117
171
|
in `.aiflow/context/current.json`; outputs `plan/[ticket-id]/requirement.md`
|
|
118
172
|
- **Gate 2 — Implementation Plan**: TDD plan generation, gated by `APPROVED`
|
|
@@ -121,6 +175,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
121
175
|
- **Gate 5 — Peer Review & PR**: Guided PR creation via `requesting-code-review` skill
|
|
122
176
|
|
|
123
177
|
#### Custom Skills (7 skills)
|
|
178
|
+
|
|
124
179
|
- `read-study-requirement` — Gate 1 requirement analysis with clarifying Q&A loop
|
|
125
180
|
- `generate-spec` — Gate 2 TDD implementation spec generator
|
|
126
181
|
- `impact-analysis` — breaking-change and dependency impact assessment
|
|
@@ -130,17 +185,20 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
130
185
|
- `figma-to-component` — Figma design → UI component code generator
|
|
131
186
|
|
|
132
187
|
#### Multi-AI Support
|
|
188
|
+
|
|
133
189
|
- **Claude Code** integration via `CLAUDE.md` + `.claude/` directory structure
|
|
134
190
|
- **Gemini CLI** integration via `GEMINI.md`
|
|
135
191
|
- **GitHub Copilot** integration via agents config
|
|
136
192
|
- Superpowers skill library bundled as `upstream/` (pinned to v5.0.5)
|
|
137
193
|
|
|
138
194
|
#### Project Templates
|
|
195
|
+
|
|
139
196
|
- `AIFLOW.md` — team workflow reference document
|
|
140
197
|
- `QUICK_START.md` — 5-minute setup guide
|
|
141
198
|
- `.aiflowrc.json.example` — configuration file reference
|
|
142
199
|
|
|
143
200
|
### Architecture Notes
|
|
201
|
+
|
|
144
202
|
- Stateless per-ticket design — no persistent memory across sessions (planned: v0.1.x)
|
|
145
203
|
- Manual skill sync model via `aiflow use` (managed `aiflow skill` CLI planned: v0.1.x)
|
|
146
204
|
- Spring Boot (Java 17+) used as the reference framework in `CLAUDE.md` coding rules
|
|
@@ -150,7 +208,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
150
208
|
## How to upgrade
|
|
151
209
|
|
|
152
210
|
```bash
|
|
153
|
-
npm install -g
|
|
211
|
+
npm install -g ai-flow-kit@latest
|
|
154
212
|
aiflow --version
|
|
155
213
|
```
|
|
156
214
|
|
|
@@ -7,17 +7,16 @@
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
npm install -g @relipa/ai-flow-kit
|
|
10
|
+
npm install -g ai-flow-kit
|
|
12
11
|
|
|
13
12
|
# Beta version (recommend for newest features)
|
|
14
|
-
npm install -g
|
|
13
|
+
npm install -g ai-flow-kit@beta
|
|
15
14
|
|
|
16
15
|
# Verification
|
|
17
16
|
aiflow --version
|
|
18
17
|
|
|
19
18
|
# Uninstall
|
|
20
|
-
npm uninstall -g
|
|
19
|
+
npm uninstall -g ai-flow-kit
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
---
|
|
@@ -146,7 +145,7 @@ APPROVED
|
|
|
146
145
|
|
|
147
146
|
AI outputs:
|
|
148
147
|
- TDD task breakdown (test first → implement → verify)
|
|
149
|
-
-
|
|
148
|
+
- Verification strategy (evidence before claims)
|
|
150
149
|
- Test commands
|
|
151
150
|
|
|
152
151
|
**Your action:**
|
|
@@ -166,7 +165,7 @@ APPROVED
|
|
|
166
165
|
|
|
167
166
|
- Writes tests FIRST → runs → confirms FAIL
|
|
168
167
|
- Implements code → tests PASS
|
|
169
|
-
-
|
|
168
|
+
- Verifies implementation works
|
|
170
169
|
|
|
171
170
|
**Your action:** Monitor. No action needed unless AI asks a question.
|
|
172
171
|
|
|
@@ -217,9 +216,9 @@ Ask a teammate to review. They can use `superpowers:receiving-code-review` skill
|
|
|
217
216
|
|
|
218
217
|
After peer reviewer approves → merge → task complete.
|
|
219
218
|
|
|
220
|
-
### Step 9: Task Management
|
|
219
|
+
### Step 9: Task Management & Session Continuity
|
|
221
220
|
|
|
222
|
-
|
|
221
|
+
Manage multiple tasks and ensure clean transitions between gates to prevent "context pollution" in long AI sessions.
|
|
223
222
|
|
|
224
223
|
```bash
|
|
225
224
|
# Pause current task (saves gate progress)
|
|
@@ -230,8 +229,26 @@ aiflow task list
|
|
|
230
229
|
|
|
231
230
|
# Resume a previously paused task
|
|
232
231
|
aiflow task resume PROJ-33
|
|
232
|
+
|
|
233
|
+
# Approve gate and prepare for fresh session (Recommended)
|
|
234
|
+
aiflow task next
|
|
233
235
|
```
|
|
234
236
|
|
|
237
|
+
#### Best Practice: Refreshing Sessions
|
|
238
|
+
To keep the AI focused and avoid context pollution (where the AI gets confused by long chat history), it is recommended to start a **fresh chat session** after completing each gate.
|
|
239
|
+
|
|
240
|
+
1. Run `aiflow task next` in your terminal to approve the current gate.
|
|
241
|
+
2. Open a **NEW chatbox** (Claude UI, Cursor, etc.).
|
|
242
|
+
3. Run `aiflow task resume [ticket-id]` (if not already active).
|
|
243
|
+
4. Type **"continue"** — the AI will read the latest state and start the next gate with a clean slate.
|
|
244
|
+
|
|
245
|
+
#### Resuming Gate 3 (Code Generation)
|
|
246
|
+
If you need to switch chatboxes in the middle of a complex coding task (Gate 3):
|
|
247
|
+
- Gate 3 progress is saved via `[x]` checkboxes in the plan file (`plan/[id]/plan.md`).
|
|
248
|
+
- Simply open a new chatbox, run `aiflow task resume`, and tell the AI to **"continue executing the plan"**.
|
|
249
|
+
- The AI will automatically skip finished tasks and pick up exactly where you left off.
|
|
250
|
+
|
|
251
|
+
|
|
235
252
|
---
|
|
236
253
|
|
|
237
254
|
## Workflow Summary Diagram
|
|
@@ -256,7 +273,7 @@ Developer AI Peer
|
|
|
256
273
|
│ "APPROVED" ──────────────────►│ │
|
|
257
274
|
│ │ │
|
|
258
275
|
│ GATE 3 │ Write tests → implement │
|
|
259
|
-
│ (monitor) │
|
|
276
|
+
│ (monitor) │ Verify implementation works │
|
|
260
277
|
│ │ │
|
|
261
278
|
│ ─── GATE 4 ──────────────────►│ │
|
|
262
279
|
│ │ Self-review + summary │
|
|
@@ -317,10 +334,13 @@ claude # AI auto-starts: map dependencies → ass
|
|
|
317
334
|
```bash
|
|
318
335
|
# Setup
|
|
319
336
|
aiflow init --framework nestjs --adapter backlog
|
|
320
|
-
aiflow init --framework spring-boot --with-rtk
|
|
321
|
-
aiflow init --
|
|
337
|
+
aiflow init --framework spring-boot --with-rtk # RTK: bash output compression (60–90%)
|
|
338
|
+
# aiflow init --framework spring-boot --with-gitnexus # GitNexus: waits for index to complete
|
|
339
|
+
# aiflow init --framework spring-boot --with-gitnexus --no-wait # GitNexus: index in background
|
|
340
|
+
aiflow init --no-rtk # skip RTK setup
|
|
322
341
|
aiflow doctor # health check
|
|
323
342
|
aiflow guide # multi-tool guide
|
|
343
|
+
aiflow sync-skills # manually sync AI instruction files
|
|
324
344
|
|
|
325
345
|
# Per task
|
|
326
346
|
aiflow use PROJ-33 # load context (Fast Mode, default)
|
|
@@ -366,7 +386,7 @@ aiflow guide --commands # command reference
|
|
|
366
386
|
aiflow remove # remove from project
|
|
367
387
|
aiflow remove --global # uninstall globally (npm uninstall -g)
|
|
368
388
|
aiflow remove --version 1.0.0 # remove cached version from .aiflow/
|
|
369
|
-
npm uninstall -g
|
|
389
|
+
npm uninstall -g ai-flow-kit # standard npm uninstall
|
|
370
390
|
```
|
|
371
391
|
|
|
372
392
|
---
|
|
@@ -405,7 +425,7 @@ aiflow guide
|
|
|
405
425
|
|
|
406
426
|
**`aiflow` not found:**
|
|
407
427
|
```bash
|
|
408
|
-
npm install -g
|
|
428
|
+
npm install -g ai-flow-kit
|
|
409
429
|
```
|
|
410
430
|
|
|
411
431
|
**Incorrect credentials:**
|
|
@@ -399,6 +399,29 @@ You can switch back with: aiflow use 1.0.0
|
|
|
399
399
|
✨ Update completed!
|
|
400
400
|
```
|
|
401
401
|
|
|
402
|
+
## sync-skills
|
|
403
|
+
|
|
404
|
+
Manually synchronize AI Instruction files with local custom skills.
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Sync AI Instruction files
|
|
408
|
+
aiflow sync-skills
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**What it does:**
|
|
412
|
+
1. Reads all active local skills and upstream skills
|
|
413
|
+
2. Generates the updated AI Skill Registry table
|
|
414
|
+
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
|
|
415
|
+
4. If no marker blocks are found, it asks for confirmation to overwrite with the correct structure
|
|
416
|
+
|
|
417
|
+
**Example:**
|
|
418
|
+
```bash
|
|
419
|
+
$ aiflow sync-skills
|
|
420
|
+
⟳ Syncing AI Instruction files...
|
|
421
|
+
✓ Updated AI Flow block in CLAUDE.md
|
|
422
|
+
✨ Sync completed!
|
|
423
|
+
```
|
|
424
|
+
|
|
402
425
|
## doctor
|
|
403
426
|
|
|
404
427
|
Health check for your setup.
|
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relipa/ai-flow-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7-beta.1",
|
|
4
4
|
"description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
|
|
5
|
-
"author": "
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "https://gitlab.relipa.vn/ai/ai-flow-kit.git"
|
|
9
|
-
},
|
|
10
|
-
"homepage": "https://gitlab.relipa.vn/ai/ai-flow-kit#readme",
|
|
5
|
+
"author": "Example Team",
|
|
11
6
|
"publishConfig": {
|
|
12
7
|
"access": "public",
|
|
13
8
|
"registry": "https://registry.npmjs.com/"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
|
|
5
|
+
const PROJECT_DIR = process.cwd();
|
|
6
|
+
const AIFLOW_DIR = path.join(PROJECT_DIR, '.aiflow');
|
|
7
|
+
const CONTEXT_FILE = path.join(AIFLOW_DIR, 'context', 'current.json');
|
|
8
|
+
|
|
9
|
+
const GATE_LABELS = { 1: 'Analyze', 2: 'Plan', 3: 'Code', 4: 'Review', 5: 'PR' };
|
|
10
|
+
|
|
11
|
+
module.exports = async function checkpoint(options = {}) {
|
|
12
|
+
const { gate, step, tokens, ticket: ticketOpt } = options;
|
|
13
|
+
|
|
14
|
+
if (!gate || !step || tokens === undefined) {
|
|
15
|
+
console.log(chalk.yellow('Usage: aiflow checkpoint --gate <N> --step <name> --tokens <N>'));
|
|
16
|
+
console.log(chalk.gray(' Example: aiflow checkpoint --gate 3 --step "tests-written" --tokens 3200'));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Resolve ticket ID
|
|
21
|
+
let ticketId = ticketOpt;
|
|
22
|
+
if (!ticketId) {
|
|
23
|
+
const ctx = await fs.readJson(CONTEXT_FILE).catch(() => null);
|
|
24
|
+
ticketId = ctx && ctx.taskId ? ctx.taskId : 'unknown';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const taskDir = path.join(AIFLOW_DIR, 'tasks', ticketId);
|
|
28
|
+
await fs.ensureDir(taskDir);
|
|
29
|
+
|
|
30
|
+
const checkpointPath = path.join(taskDir, 'checkpoints.json');
|
|
31
|
+
const existing = (await fs.pathExists(checkpointPath))
|
|
32
|
+
? await fs.readJson(checkpointPath).catch(() => ({ checkpoints: [] }))
|
|
33
|
+
: { checkpoints: [] };
|
|
34
|
+
|
|
35
|
+
const entry = {
|
|
36
|
+
gate: parseInt(gate),
|
|
37
|
+
step,
|
|
38
|
+
tokens: parseInt(tokens),
|
|
39
|
+
timestamp: new Date().toISOString(),
|
|
40
|
+
};
|
|
41
|
+
existing.checkpoints.push(entry);
|
|
42
|
+
await fs.writeJson(checkpointPath, existing, { spaces: 2 });
|
|
43
|
+
|
|
44
|
+
const label = GATE_LABELS[parseInt(gate)] || `Gate ${gate}`;
|
|
45
|
+
console.log(chalk.green(`✓ Checkpoint: Gate ${gate} (${label}) — ${step} — ~${parseInt(tokens).toLocaleString()} tokens`));
|
|
46
|
+
};
|
package/scripts/doctor.js
CHANGED
|
@@ -1,15 +1,71 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const chalk = require('chalk');
|
|
4
|
-
const { detectRtk, isRtkHookConfigured } = require('./init');
|
|
4
|
+
const { detectRtk, isRtkHookConfigured, isGitNexusConfigured } = require('./init');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function formatAgo(isoString) {
|
|
7
|
+
const ms = Date.now() - new Date(isoString).getTime();
|
|
8
|
+
const mins = Math.floor(ms / 60000);
|
|
9
|
+
if (mins < 1) return 'just now';
|
|
10
|
+
if (mins < 60) return `${mins}m ago`;
|
|
11
|
+
const hrs = Math.floor(mins / 60);
|
|
12
|
+
if (hrs < 24) return `${hrs}h ago`;
|
|
13
|
+
return `${Math.floor(hrs / 24)}d ago`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function showTokenBreakdown(ticketId) {
|
|
17
|
+
const tasksDir = path.join(process.cwd(), '.aiflow', 'tasks');
|
|
18
|
+
const checkpointsFile = path.join(tasksDir, ticketId, 'checkpoints.json');
|
|
19
|
+
if (!(await fs.pathExists(checkpointsFile))) return;
|
|
20
|
+
|
|
21
|
+
const data = await fs.readJson(checkpointsFile).catch(() => ({ checkpoints: [] }));
|
|
22
|
+
if (!data.checkpoints || data.checkpoints.length === 0) return;
|
|
23
|
+
|
|
24
|
+
// Aggregate tokens per gate (taking the max/latest)
|
|
25
|
+
const gateTokens = {};
|
|
26
|
+
for (const cp of data.checkpoints) {
|
|
27
|
+
if (!gateTokens[cp.gate] || cp.tokens > gateTokens[cp.gate]) {
|
|
28
|
+
gateTokens[cp.gate] = cp.tokens;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const GATE_LABELS = { 1: 'Analyze', 2: 'Plan', 3: 'Code', 4: 'Review', 5: 'PR' };
|
|
33
|
+
const gates = Object.keys(gateTokens).sort();
|
|
34
|
+
const total = gates.reduce((sum, g) => sum + gateTokens[g], 0);
|
|
35
|
+
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log(chalk.bold(`Token usage for task ${ticketId}:`));
|
|
38
|
+
for (const g of gates) {
|
|
39
|
+
const label = GATE_LABELS[parseInt(g)] || `Gate ${g}`;
|
|
40
|
+
const t = gateTokens[g];
|
|
41
|
+
const bar = '█'.repeat(Math.round((t / total) * 20)).padEnd(20, '░');
|
|
42
|
+
const pct = Math.round((t / total) * 100);
|
|
43
|
+
console.log(` Gate ${g} ${label.padEnd(8)} ~${t.toLocaleString().padStart(6)} ${chalk.gray(bar)} ${pct}%`);
|
|
44
|
+
}
|
|
45
|
+
console.log(` Total estimated: ~${total.toLocaleString()} tokens`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = async function doctor(options = {}) {
|
|
7
49
|
const projectDir = process.cwd();
|
|
8
50
|
const errors = [];
|
|
9
51
|
const warnings = [];
|
|
10
52
|
|
|
11
53
|
console.log(chalk.blue('Running health check for AI Flow Kit...\n'));
|
|
12
54
|
|
|
55
|
+
// ── Token breakdown ────────────────────────────────────────
|
|
56
|
+
let ticketId = options.ticket;
|
|
57
|
+
if (!ticketId) {
|
|
58
|
+
const contextFile = path.join(projectDir, '.aiflow', 'context', 'current.json');
|
|
59
|
+
if (await fs.pathExists(contextFile)) {
|
|
60
|
+
const ctx = await fs.readJson(contextFile).catch(() => ({}));
|
|
61
|
+
ticketId = ctx.taskId;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (ticketId) {
|
|
66
|
+
await showTokenBreakdown(ticketId);
|
|
67
|
+
}
|
|
68
|
+
|
|
13
69
|
// ── Core setup ─────────────────────────────────────────────
|
|
14
70
|
if (!(await fs.pathExists(path.join(projectDir, '.claude', 'skills')))) {
|
|
15
71
|
errors.push('Missing `.claude/skills` directory. Did you run `aiflow init`?');
|
|
@@ -55,20 +111,67 @@ module.exports = async function doctor() {
|
|
|
55
111
|
warnings.push('Missing .claude/settings.json — run `aiflow init`.');
|
|
56
112
|
}
|
|
57
113
|
|
|
58
|
-
// ──
|
|
114
|
+
// ── Token savings tools ────────────────────────────────────
|
|
59
115
|
console.log('');
|
|
116
|
+
console.log(chalk.bold('Token savings:'));
|
|
117
|
+
|
|
118
|
+
// RTK
|
|
60
119
|
const rtk = await detectRtk();
|
|
61
120
|
if (rtk.installed) {
|
|
62
121
|
const hookOk = await isRtkHookConfigured(projectDir);
|
|
63
122
|
if (hookOk) {
|
|
64
|
-
console.log(chalk.green(
|
|
123
|
+
console.log(chalk.green(` ✓ RTK (${rtk.version}) — bash output compression active`));
|
|
124
|
+
console.log(chalk.gray(' Estimated: 60–90% reduction on bash command outputs (test runs, git, npm...)'));
|
|
65
125
|
} else {
|
|
66
|
-
console.log(chalk.
|
|
67
|
-
warnings.push('RTK
|
|
126
|
+
console.log(chalk.yellow(` ⚠ RTK installed (${rtk.version}) but hook not configured`));
|
|
127
|
+
warnings.push('RTK hook not configured. Run `aiflow init` to enable token compression.');
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
console.log(chalk.gray(' ○ RTK not installed — bash output compression inactive'));
|
|
131
|
+
console.log(chalk.gray(' Install: cargo install rtk | Enable: aiflow init --with-rtk'));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// GitNexus
|
|
135
|
+
const gnConfigured = await isGitNexusConfigured(projectDir);
|
|
136
|
+
const gnStatusPath = path.join(projectDir, '.aiflow', 'gitnexus-status.json');
|
|
137
|
+
if (gnConfigured) {
|
|
138
|
+
let statusLine = chalk.green(' ✓ GitNexus MCP configured');
|
|
139
|
+
try {
|
|
140
|
+
if (await fs.pathExists(gnStatusPath)) {
|
|
141
|
+
const gn = await fs.readJson(gnStatusPath);
|
|
142
|
+
const GITNEXUS_STALE_MS = 3 * 60 * 60 * 1000; // 3 hours
|
|
143
|
+
if (gn.status === 'done') {
|
|
144
|
+
const ago = gn.completedAt
|
|
145
|
+
? chalk.gray(` — indexed ${formatAgo(gn.completedAt)}`)
|
|
146
|
+
: '';
|
|
147
|
+
statusLine = chalk.green(` ✓ GitNexus MCP configured — index ready${ago}`);
|
|
148
|
+
console.log(statusLine);
|
|
149
|
+
console.log(chalk.gray(' Estimated: ~50% fewer tokens at Gate 1 (context queries vs file reads)'));
|
|
150
|
+
console.log(chalk.gray(' Estimated: ~70% fewer tokens at Gate 4 (impact() vs grep codebase)'));
|
|
151
|
+
} else if (gn.status === 'running') {
|
|
152
|
+
const age = Date.now() - new Date(gn.startedAt).getTime();
|
|
153
|
+
if (age > GITNEXUS_STALE_MS) {
|
|
154
|
+
console.log(chalk.red(' ✗ GitNexus MCP configured — indexing timed out (stale)'));
|
|
155
|
+
console.log(chalk.gray(` Started ${formatAgo(gn.startedAt)} but never finished. Process may have crashed.`));
|
|
156
|
+
// console.log(chalk.gray(' Retry: aiflow init --with-gitnexus --wait | Log: .aiflow/gitnexus-analyze.log'));
|
|
157
|
+
} else {
|
|
158
|
+
console.log(chalk.yellow(' ⟳ GitNexus MCP configured — indexing in progress...'));
|
|
159
|
+
console.log(chalk.gray(' Log: .aiflow/gitnexus-analyze.log'));
|
|
160
|
+
}
|
|
161
|
+
} else if (gn.status === 'error') {
|
|
162
|
+
console.log(chalk.red(' ✗ GitNexus MCP configured — last index failed'));
|
|
163
|
+
console.log(chalk.gray(' Retry: npx gitnexus analyze | Log: .aiflow/gitnexus-analyze.log'));
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
console.log(chalk.yellow(' ⚠ GitNexus MCP configured but not yet indexed'));
|
|
167
|
+
console.log(chalk.gray(' Run: npx gitnexus analyze'));
|
|
168
|
+
}
|
|
169
|
+
} catch (_) {
|
|
170
|
+
console.log(statusLine);
|
|
68
171
|
}
|
|
69
172
|
} else {
|
|
70
|
-
console.log(chalk.gray('○
|
|
71
|
-
console.log(chalk.gray('
|
|
173
|
+
console.log(chalk.gray(' ○ GitNexus not configured — code intelligence inactive'));
|
|
174
|
+
// console.log(chalk.gray(' Enable: aiflow init --with-gitnexus'));
|
|
72
175
|
}
|
|
73
176
|
|
|
74
177
|
// ── Summary ────────────────────────────────────────────────
|