@relipa/ai-flow-kit 0.1.1 → 0.1.2-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.
- package/README.md +0 -0
- package/bin/aiflow.js +55 -2
- package/bin/ak.js +0 -0
- package/custom/mcp-presets/README.md +204 -237
- package/custom/mcp-presets/backlog.json +0 -0
- package/custom/mcp-presets/figma-desktop.json +0 -0
- package/custom/mcp-presets/figma.json +0 -0
- package/custom/mcp-presets/gitnexus.json +0 -0
- package/custom/mcp-presets/google-sheets.json +0 -0
- package/custom/mcp-presets/jira.json +0 -0
- package/custom/prompts/bug-fix.md +0 -0
- package/custom/prompts/feature.md +0 -0
- package/custom/prompts/investigation.md +0 -0
- package/custom/rules/code-style.md +0 -0
- package/custom/rules/java/code-style.md +0 -0
- package/custom/rules/java/naming.md +0 -0
- package/custom/rules/java/review-checklist.md +0 -0
- package/custom/rules/java/spring-boot-examples.md +0 -0
- package/custom/rules/javascript/code-style.md +0 -0
- package/custom/rules/javascript/naming.md +0 -0
- package/custom/rules/ml-conventions.md +88 -0
- package/custom/rules/ml-review-checklist.md +14 -0
- package/custom/rules/naming.md +0 -0
- package/custom/rules/php/code-style.md +0 -0
- package/custom/rules/php/naming.md +0 -0
- package/custom/rules/project-conventions.md +0 -0
- package/custom/rules/review-checklist.md +0 -0
- package/custom/skills/deploy-model/SKILL.md +90 -0
- package/custom/skills/design-experiment/SKILL.md +88 -0
- package/custom/skills/evaluate-model/SKILL.md +93 -0
- package/custom/skills/explore-data/SKILL.md +87 -0
- package/custom/skills/figma-to-component/SKILL.md +0 -0
- package/custom/skills/frame-ml-problem/SKILL.md +88 -0
- package/custom/skills/generate-spec/SKILL.md +0 -0
- package/custom/skills/impact-analysis/SKILL.md +0 -0
- package/custom/skills/improve-algorithm/SKILL.md +74 -0
- package/custom/skills/investigate-bug/SKILL.md +0 -0
- package/custom/skills/read-study-requirement/SKILL.md +0 -0
- package/custom/skills/report-customer/SKILL.md +0 -0
- package/custom/skills/review-plan/SKILL.md +0 -0
- package/custom/skills/train-model/SKILL.md +78 -0
- package/custom/templates/laravel.md +0 -0
- package/custom/templates/nestjs.md +0 -0
- package/custom/templates/nextjs.md +0 -0
- package/custom/templates/nodejs-express.md +0 -0
- package/custom/templates/php-plain.md +0 -0
- package/custom/templates/php.md +0 -0
- package/custom/templates/python-django.md +0 -0
- package/custom/templates/python-fastapi.md +0 -0
- package/custom/templates/python-ml.md +273 -0
- package/custom/templates/python.md +0 -0
- package/custom/templates/reactjs.md +0 -0
- package/custom/templates/shared/gate-workflow.md +0 -0
- package/custom/templates/shared/ml-gate-workflow.md +103 -0
- package/custom/templates/spring-boot.md +0 -0
- package/custom/templates/tools/claude.md +0 -0
- package/custom/templates/tools/copilot.md +0 -0
- package/custom/templates/tools/cursor.md +0 -0
- package/custom/templates/tools/gemini.md +0 -0
- package/custom/templates/tools/generic.md +0 -0
- package/custom/templates/vue-nuxt.md +0 -0
- package/docs/common/AIFLOW.md +512 -512
- package/docs/common/CHANGELOG.md +0 -0
- package/docs/common/QUICK_START.md +0 -0
- package/docs/common/ai-integration.md +0 -0
- package/docs/common/cli-reference.md +0 -0
- package/docs/common/configuration.md +0 -0
- package/docs/common/getting-started.md +0 -0
- package/docs/common/troubleshooting.md +0 -0
- package/docs/common/workflows/bug-fix.md +0 -0
- package/docs/common/workflows/feature.md +0 -0
- package/docs/common/workflows/figma.md +0 -0
- package/docs/common/workflows/impact-analysis.md +0 -0
- package/docs/common/workflows/investigation.md +0 -0
- package/docs/common/workflows/refactor.md +0 -0
- package/docs/project/ARCHITECTURE.md +0 -0
- package/index.js +0 -0
- package/package.json +1 -1
- package/scripts/checkpoint.js +0 -0
- package/scripts/config.js +0 -0
- package/scripts/context.js +0 -0
- package/scripts/create-score-excel.js +0 -0
- package/scripts/detect.js +239 -239
- package/scripts/doctor.js +192 -218
- package/scripts/gitnexus-worker.js +0 -0
- package/scripts/guide.js +0 -0
- package/scripts/hooks/block-git-write.js +0 -0
- package/scripts/hooks/session-start.js +0 -0
- package/scripts/hooks/session-stop.js +0 -0
- package/scripts/init.js +1112 -1009
- package/scripts/link-resolver.js +0 -0
- package/scripts/memory.js +0 -0
- package/scripts/prompt.js +538 -538
- package/scripts/remove.js +0 -0
- package/scripts/task.js +546 -546
- package/scripts/telemetry/cli.js +0 -0
- package/scripts/telemetry/config.js +0 -0
- package/scripts/telemetry/crypto.js +0 -0
- package/scripts/telemetry/flush.js +0 -0
- package/scripts/telemetry/record.js +0 -0
- package/scripts/update.js +10 -7
- package/scripts/use.js +33 -12
- package/scripts/validate.js +0 -0
- package/upstream/.claude-plugin/marketplace.json +0 -0
- package/upstream/.claude-plugin/plugin.json +0 -0
- package/upstream/.codex/INSTALL.md +0 -0
- package/upstream/.cursor-plugin/plugin.json +0 -0
- package/upstream/.gitattributes +0 -0
- package/upstream/.github/FUNDING.yml +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/config.yml +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +0 -0
- package/upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- package/upstream/.opencode/INSTALL.md +0 -0
- package/upstream/.opencode/plugins/superpowers.js +0 -0
- package/upstream/.version-bump.json +0 -0
- package/upstream/AGENTS.md +0 -0
- package/upstream/CHANGELOG.md +0 -0
- package/upstream/CLAUDE.md +0 -0
- package/upstream/CODE_OF_CONDUCT.md +0 -0
- package/upstream/GEMINI.md +0 -0
- package/upstream/LICENSE +0 -0
- package/upstream/README.md +0 -0
- package/upstream/RELEASE-NOTES.md +0 -0
- package/upstream/agents/code-reviewer.md +0 -0
- package/upstream/commands/brainstorm.md +0 -0
- package/upstream/commands/execute-plan.md +0 -0
- package/upstream/commands/write-plan.md +0 -0
- package/upstream/docs/README.codex.md +0 -0
- package/upstream/docs/README.opencode.md +0 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-design.md +0 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +0 -0
- package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +0 -0
- package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +0 -0
- package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +0 -0
- package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +0 -0
- package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +0 -0
- package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +0 -0
- package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +0 -0
- package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +0 -0
- package/upstream/docs/testing.md +0 -0
- package/upstream/docs/windows/polyglot-hooks.md +0 -0
- package/upstream/gemini-extension.json +0 -0
- package/upstream/hooks/hooks-cursor.json +0 -0
- package/upstream/hooks/hooks.json +0 -0
- package/upstream/hooks/run-hook.cmd +0 -0
- package/upstream/hooks/session-start +0 -0
- package/upstream/package.json +0 -0
- package/upstream/scripts/bump-version.sh +0 -0
- package/upstream/skills/brainstorming/SKILL.md +0 -0
- package/upstream/skills/brainstorming/scripts/frame-template.html +0 -0
- package/upstream/skills/brainstorming/scripts/helper.js +0 -0
- package/upstream/skills/brainstorming/scripts/server.cjs +0 -0
- package/upstream/skills/brainstorming/scripts/start-server.sh +0 -0
- package/upstream/skills/brainstorming/scripts/stop-server.sh +0 -0
- package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +0 -0
- package/upstream/skills/brainstorming/visual-companion.md +0 -0
- package/upstream/skills/dispatching-parallel-agents/SKILL.md +0 -0
- package/upstream/skills/executing-plans/SKILL.md +0 -0
- package/upstream/skills/finishing-a-development-branch/SKILL.md +0 -0
- package/upstream/skills/receiving-code-review/SKILL.md +0 -0
- package/upstream/skills/requesting-code-review/SKILL.md +0 -0
- package/upstream/skills/requesting-code-review/code-reviewer.md +0 -0
- package/upstream/skills/subagent-driven-development/SKILL.md +0 -0
- package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +0 -0
- package/upstream/skills/subagent-driven-development/implementer-prompt.md +0 -0
- package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +0 -0
- package/upstream/skills/systematic-debugging/CREATION-LOG.md +0 -0
- package/upstream/skills/systematic-debugging/SKILL.md +0 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +0 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting.md +0 -0
- package/upstream/skills/systematic-debugging/defense-in-depth.md +0 -0
- package/upstream/skills/systematic-debugging/find-polluter.sh +0 -0
- package/upstream/skills/systematic-debugging/root-cause-tracing.md +0 -0
- package/upstream/skills/systematic-debugging/test-academic.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-1.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-2.md +0 -0
- package/upstream/skills/systematic-debugging/test-pressure-3.md +0 -0
- package/upstream/skills/tdd-lean/SKILL.md +0 -0
- package/upstream/skills/test-driven-development/SKILL.md +0 -0
- package/upstream/skills/test-driven-development/testing-anti-patterns.md +0 -0
- package/upstream/skills/using-git-worktrees/SKILL.md +0 -0
- package/upstream/skills/using-superpowers/SKILL.md +0 -0
- package/upstream/skills/using-superpowers/references/codex-tools.md +0 -0
- package/upstream/skills/using-superpowers/references/copilot-tools.md +0 -0
- package/upstream/skills/using-superpowers/references/gemini-tools.md +0 -0
- package/upstream/skills/verification-before-completion/SKILL.md +0 -0
- package/upstream/skills/writing-plans/SKILL.md +0 -0
- package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +0 -0
- package/upstream/skills/writing-skills/SKILL.md +0 -0
- package/upstream/skills/writing-skills/anthropic-best-practices.md +0 -0
- package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +0 -0
- package/upstream/skills/writing-skills/graphviz-conventions.dot +0 -0
- package/upstream/skills/writing-skills/persuasion-principles.md +0 -0
- package/upstream/skills/writing-skills/render-graphs.js +0 -0
- package/upstream/skills/writing-skills/testing-skills-with-subagents.md +0 -0
- package/upstream/tests/brainstorm-server/package-lock.json +0 -0
- package/upstream/tests/brainstorm-server/package.json +0 -0
- package/upstream/tests/brainstorm-server/server.test.js +0 -0
- package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +0 -0
- package/upstream/tests/brainstorm-server/ws-protocol.test.js +0 -0
- package/upstream/tests/claude-code/README.md +0 -0
- package/upstream/tests/claude-code/analyze-token-usage.py +0 -0
- package/upstream/tests/claude-code/run-skill-tests.sh +0 -0
- package/upstream/tests/claude-code/test-document-review-system.sh +0 -0
- package/upstream/tests/claude-code/test-helpers.sh +0 -0
- package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +0 -0
- package/upstream/tests/claude-code/test-subagent-driven-development.sh +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +0 -0
- package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +0 -0
- package/upstream/tests/explicit-skill-requests/run-all.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +0 -0
- package/upstream/tests/explicit-skill-requests/run-test.sh +0 -0
- package/upstream/tests/opencode/run-tests.sh +0 -0
- package/upstream/tests/opencode/setup.sh +0 -0
- package/upstream/tests/opencode/test-plugin-loading.sh +0 -0
- package/upstream/tests/opencode/test-priority.sh +0 -0
- package/upstream/tests/opencode/test-tools.sh +0 -0
- package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/executing-plans.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +0 -0
- package/upstream/tests/skill-triggering/prompts/writing-plans.txt +0 -0
- package/upstream/tests/skill-triggering/run-all.sh +0 -0
- package/upstream/tests/skill-triggering/run-test.sh +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/design.md +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +0 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +0 -0
- package/upstream/tests/subagent-driven-dev/run-test.sh +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +0 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +0 -0
- package/custom/mcp-presets/playwright.json +0 -11
- package/custom/rules/test-patterns.md +0 -105
- package/custom/skills/automation-testing/SKILL.md +0 -168
- package/custom/skills/automation-testing/templates/BasePage.ts +0 -30
- package/custom/skills/automation-testing/templates/playwright.config.ts +0 -21
- package/custom/skills/automation-testing/templates/repos.json +0 -8
- package/scripts/score_members.js +0 -320
package/scripts/doctor.js
CHANGED
|
@@ -1,218 +1,192 @@
|
|
|
1
|
-
const fs = require('fs-extra');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
if (mins <
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
console.log(chalk.gray(' Run: npx gitnexus analyze'));
|
|
194
|
-
}
|
|
195
|
-
} catch (_) {
|
|
196
|
-
console.log(statusLine);
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
console.log(chalk.gray(' ○ GitNexus not configured — code intelligence inactive'));
|
|
200
|
-
// console.log(chalk.gray(' Enable: aiflow init --with-gitnexus'));
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// ── Summary ────────────────────────────────────────────────
|
|
204
|
-
console.log('');
|
|
205
|
-
if (warnings.length > 0) {
|
|
206
|
-
console.log(chalk.yellow('Warnings:'));
|
|
207
|
-
warnings.forEach(w => console.log(chalk.yellow(` ⚠ ${w}`)));
|
|
208
|
-
console.log('');
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (errors.length > 0) {
|
|
212
|
-
console.log(chalk.red('Issues found:'));
|
|
213
|
-
errors.forEach(e => console.log(chalk.red(` ✗ ${e}`)));
|
|
214
|
-
console.log(chalk.yellow('\nTry running `aiflow init` or `aiflow update` to fix these files.'));
|
|
215
|
-
} else {
|
|
216
|
-
console.log(chalk.green('✨ Everything looks healthy! You are ready to fly.'));
|
|
217
|
-
}
|
|
218
|
-
};
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const { detectRtk, isRtkHookConfigured, isGitNexusConfigured } = require('./init');
|
|
5
|
+
|
|
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 = {}) {
|
|
49
|
+
const projectDir = process.cwd();
|
|
50
|
+
const errors = [];
|
|
51
|
+
const warnings = [];
|
|
52
|
+
|
|
53
|
+
console.log(chalk.blue('Running health check for AI Flow Kit...\n'));
|
|
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
|
+
|
|
69
|
+
// ── Core setup ─────────────────────────────────────────────
|
|
70
|
+
if (!(await fs.pathExists(path.join(projectDir, '.claude', 'skills')))) {
|
|
71
|
+
errors.push('Missing `.claude/skills` directory. Did you run `aiflow init`?');
|
|
72
|
+
} else {
|
|
73
|
+
console.log(chalk.green('✓ .claude/skills exists'));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (!(await fs.pathExists(path.join(projectDir, '.rules')))) {
|
|
77
|
+
errors.push('Missing `.rules` directory.');
|
|
78
|
+
} else {
|
|
79
|
+
console.log(chalk.green('✓ .rules exists'));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!(await fs.pathExists(path.join(projectDir, 'CLAUDE.md')))) {
|
|
83
|
+
errors.push('Missing CLAUDE.md. AI context prompt is not set up.');
|
|
84
|
+
} else {
|
|
85
|
+
console.log(chalk.green('✓ CLAUDE.md exists'));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ── Version tracking ───────────────────────────────────────
|
|
89
|
+
const stateFile = path.join(projectDir, '.aiflow', 'state.json');
|
|
90
|
+
if (!(await fs.pathExists(stateFile))) {
|
|
91
|
+
errors.push('Missing `.aiflow/state.json`. Version tracking is broken.');
|
|
92
|
+
} else {
|
|
93
|
+
const state = await fs.readJson(stateFile);
|
|
94
|
+
console.log(chalk.green(`✓ Version tracking active (v${state.current_version})`));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ── SessionStart hook ──────────────────────────────────────
|
|
98
|
+
const settingsPath = path.join(projectDir, '.claude', 'settings.json');
|
|
99
|
+
if (await fs.pathExists(settingsPath)) {
|
|
100
|
+
const settings = await fs.readJson(settingsPath).catch(() => ({}));
|
|
101
|
+
const hookList = settings?.hooks?.SessionStart || [];
|
|
102
|
+
const hasSessionHook = hookList.some(h =>
|
|
103
|
+
(h.hooks || []).some(e => typeof e.command === 'string' && e.command.includes('session-start'))
|
|
104
|
+
);
|
|
105
|
+
if (hasSessionHook) {
|
|
106
|
+
console.log(chalk.green('✓ SessionStart hook configured'));
|
|
107
|
+
} else {
|
|
108
|
+
warnings.push('SessionStart hook not found in .claude/settings.json — run `aiflow init` to set it up.');
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
warnings.push('Missing .claude/settings.json — run `aiflow init`.');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ── Token savings tools ────────────────────────────────────
|
|
115
|
+
console.log('');
|
|
116
|
+
console.log(chalk.bold('Token savings:'));
|
|
117
|
+
|
|
118
|
+
// RTK
|
|
119
|
+
const rtk = await detectRtk();
|
|
120
|
+
if (rtk.installed) {
|
|
121
|
+
const hookOk = await isRtkHookConfigured(projectDir);
|
|
122
|
+
if (hookOk) {
|
|
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...)'));
|
|
125
|
+
} else {
|
|
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);
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
console.log(chalk.gray(' ○ GitNexus not configured — code intelligence inactive'));
|
|
174
|
+
// console.log(chalk.gray(' Enable: aiflow init --with-gitnexus'));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ── Summary ────────────────────────────────────────────────
|
|
178
|
+
console.log('');
|
|
179
|
+
if (warnings.length > 0) {
|
|
180
|
+
console.log(chalk.yellow('Warnings:'));
|
|
181
|
+
warnings.forEach(w => console.log(chalk.yellow(` ⚠ ${w}`)));
|
|
182
|
+
console.log('');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (errors.length > 0) {
|
|
186
|
+
console.log(chalk.red('Issues found:'));
|
|
187
|
+
errors.forEach(e => console.log(chalk.red(` ✗ ${e}`)));
|
|
188
|
+
console.log(chalk.yellow('\nTry running `aiflow init` or `aiflow update` to fix these files.'));
|
|
189
|
+
} else {
|
|
190
|
+
console.log(chalk.green('✨ Everything looks healthy! You are ready to fly.'));
|
|
191
|
+
}
|
|
192
|
+
};
|
|
File without changes
|
package/scripts/guide.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|