@relipa/ai-flow-kit 0.0.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/AIFLOW.md +432 -0
- package/CHANGELOG.md +78 -0
- package/CONTRIBUTING.md +351 -0
- package/IMPLEMENTATION_SUMMARY.md +348 -0
- package/QUICK_START.md +392 -0
- package/README.md +323 -0
- package/bin/aiflow.js +178 -0
- package/custom/mcp-presets/README.md +138 -0
- package/custom/mcp-presets/backlog.json +15 -0
- package/custom/mcp-presets/figma.json +15 -0
- package/custom/mcp-presets/google-sheets.json +14 -0
- package/custom/mcp-presets/jira.json +16 -0
- package/custom/prompts/bug-fix.md +149 -0
- package/custom/prompts/feature.md +190 -0
- package/custom/prompts/investigation.md +164 -0
- package/custom/rules/code-style.md +7 -0
- package/custom/rules/java/code-style.md +11 -0
- package/custom/rules/java/naming.md +17 -0
- package/custom/rules/java/review-checklist.md +36 -0
- package/custom/rules/javascript/code-style.md +12 -0
- package/custom/rules/javascript/naming.md +14 -0
- package/custom/rules/naming.md +9 -0
- package/custom/rules/php/code-style.md +10 -0
- package/custom/rules/php/naming.md +15 -0
- package/custom/rules/review-checklist.md +9 -0
- package/custom/skills/figma-to-component/SKILL.md +207 -0
- package/custom/skills/generate-spec/SKILL.md +97 -0
- package/custom/skills/impact-analysis/SKILL.md +94 -0
- package/custom/skills/investigate-bug/SKILL.md +93 -0
- package/custom/skills/report-customer/SKILL.md +95 -0
- package/custom/skills/review-plan/SKILL.md +158 -0
- package/custom/skills/validate-ticket/SKILL.md +240 -0
- package/custom/templates/laravel.md +90 -0
- package/custom/templates/nextjs.md +89 -0
- package/custom/templates/reactjs.md +567 -0
- package/custom/templates/spring-boot.md +598 -0
- package/custom/templates/vue-nuxt.md +89 -0
- package/docs/architecture.md +395 -0
- package/docs/cli-reference.md +438 -0
- package/docs/configuration.md +412 -0
- package/docs/getting-started.md +248 -0
- package/docs/troubleshooting.md +587 -0
- package/docs/workflows/bug-fix.md +126 -0
- package/docs/workflows/feature.md +123 -0
- package/docs/workflows/impact-analysis.md +13 -0
- package/docs/workflows/investigation.md +13 -0
- package/docs/workflows/refactor.md +13 -0
- package/index.js +27 -0
- package/package.json +70 -0
- package/scripts/config.js +317 -0
- package/scripts/context.js +117 -0
- package/scripts/detect.js +239 -0
- package/scripts/doctor.js +48 -0
- package/scripts/guide.js +282 -0
- package/scripts/hooks/session-start.js +140 -0
- package/scripts/init.js +453 -0
- package/scripts/memory.js +247 -0
- package/scripts/prompt.js +392 -0
- package/scripts/remove.js +170 -0
- package/scripts/update.js +111 -0
- package/scripts/use.js +570 -0
- package/scripts/validate.js +303 -0
- package/upstream/.claude-plugin/marketplace.json +20 -0
- package/upstream/.claude-plugin/plugin.json +20 -0
- package/upstream/.codex/INSTALL.md +67 -0
- package/upstream/.cursor-plugin/plugin.json +25 -0
- package/upstream/.gitattributes +18 -0
- package/upstream/.github/FUNDING.yml +3 -0
- package/upstream/.github/ISSUE_TEMPLATE/bug_report.md +52 -0
- package/upstream/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/upstream/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
- package/upstream/.github/ISSUE_TEMPLATE/platform_support.md +23 -0
- package/upstream/.github/PULL_REQUEST_TEMPLATE.md +87 -0
- package/upstream/.opencode/INSTALL.md +83 -0
- package/upstream/.opencode/plugins/superpowers.js +112 -0
- package/upstream/.version-bump.json +19 -0
- package/upstream/AGENTS.md +1 -0
- package/upstream/CHANGELOG.md +13 -0
- package/upstream/CLAUDE.md +85 -0
- package/upstream/CODE_OF_CONDUCT.md +128 -0
- package/upstream/GEMINI.md +2 -0
- package/upstream/LICENSE +21 -0
- package/upstream/README.md +190 -0
- package/upstream/RELEASE-NOTES.md +1096 -0
- package/upstream/agents/code-reviewer.md +48 -0
- package/upstream/commands/brainstorm.md +5 -0
- package/upstream/commands/execute-plan.md +5 -0
- package/upstream/commands/write-plan.md +5 -0
- package/upstream/docs/README.codex.md +126 -0
- package/upstream/docs/README.opencode.md +130 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-design.md +294 -0
- package/upstream/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
- package/upstream/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +711 -0
- package/upstream/docs/plans/2026-01-17-visual-brainstorming.md +571 -0
- package/upstream/docs/superpowers/plans/2026-01-22-document-review-system.md +301 -0
- package/upstream/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +523 -0
- package/upstream/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +479 -0
- package/upstream/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +564 -0
- package/upstream/docs/superpowers/specs/2026-01-22-document-review-system-design.md +136 -0
- package/upstream/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +162 -0
- package/upstream/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +118 -0
- package/upstream/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +244 -0
- package/upstream/docs/testing.md +303 -0
- package/upstream/docs/windows/polyglot-hooks.md +212 -0
- package/upstream/gemini-extension.json +6 -0
- package/upstream/hooks/hooks-cursor.json +10 -0
- package/upstream/hooks/hooks.json +16 -0
- package/upstream/hooks/run-hook.cmd +46 -0
- package/upstream/hooks/session-start +57 -0
- package/upstream/package.json +6 -0
- package/upstream/scripts/bump-version.sh +220 -0
- package/upstream/skills/brainstorming/SKILL.md +164 -0
- package/upstream/skills/brainstorming/scripts/frame-template.html +214 -0
- package/upstream/skills/brainstorming/scripts/helper.js +88 -0
- package/upstream/skills/brainstorming/scripts/server.cjs +354 -0
- package/upstream/skills/brainstorming/scripts/start-server.sh +148 -0
- package/upstream/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/upstream/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/upstream/skills/brainstorming/visual-companion.md +287 -0
- package/upstream/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/upstream/skills/executing-plans/SKILL.md +70 -0
- package/upstream/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/upstream/skills/receiving-code-review/SKILL.md +213 -0
- package/upstream/skills/requesting-code-review/SKILL.md +105 -0
- package/upstream/skills/requesting-code-review/code-reviewer.md +146 -0
- package/upstream/skills/subagent-driven-development/SKILL.md +277 -0
- package/upstream/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/upstream/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/upstream/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/upstream/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/upstream/skills/systematic-debugging/SKILL.md +296 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/upstream/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/upstream/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/upstream/skills/systematic-debugging/find-polluter.sh +63 -0
- package/upstream/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/upstream/skills/systematic-debugging/test-academic.md +14 -0
- package/upstream/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/upstream/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/upstream/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/upstream/skills/test-driven-development/SKILL.md +371 -0
- package/upstream/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/upstream/skills/using-git-worktrees/SKILL.md +218 -0
- package/upstream/skills/using-superpowers/SKILL.md +117 -0
- package/upstream/skills/using-superpowers/references/codex-tools.md +100 -0
- package/upstream/skills/using-superpowers/references/copilot-tools.md +52 -0
- package/upstream/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/upstream/skills/verification-before-completion/SKILL.md +139 -0
- package/upstream/skills/writing-plans/SKILL.md +152 -0
- package/upstream/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/upstream/skills/writing-skills/SKILL.md +655 -0
- package/upstream/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/upstream/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/upstream/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/upstream/skills/writing-skills/persuasion-principles.md +187 -0
- package/upstream/skills/writing-skills/render-graphs.js +168 -0
- package/upstream/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/upstream/tests/brainstorm-server/package-lock.json +36 -0
- package/upstream/tests/brainstorm-server/package.json +10 -0
- package/upstream/tests/brainstorm-server/server.test.js +427 -0
- package/upstream/tests/brainstorm-server/windows-lifecycle.test.sh +351 -0
- package/upstream/tests/brainstorm-server/ws-protocol.test.js +392 -0
- package/upstream/tests/claude-code/README.md +158 -0
- package/upstream/tests/claude-code/analyze-token-usage.py +168 -0
- package/upstream/tests/claude-code/run-skill-tests.sh +187 -0
- package/upstream/tests/claude-code/test-document-review-system.sh +177 -0
- package/upstream/tests/claude-code/test-helpers.sh +202 -0
- package/upstream/tests/claude-code/test-subagent-driven-development-integration.sh +314 -0
- package/upstream/tests/claude-code/test-subagent-driven-development.sh +165 -0
- package/upstream/tests/explicit-skill-requests/prompts/action-oriented.txt +3 -0
- package/upstream/tests/explicit-skill-requests/prompts/after-planning-flow.txt +17 -0
- package/upstream/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +11 -0
- package/upstream/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +8 -0
- package/upstream/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +3 -0
- package/upstream/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +1 -0
- package/upstream/tests/explicit-skill-requests/prompts/skip-formalities.txt +3 -0
- package/upstream/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +1 -0
- package/upstream/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +1 -0
- package/upstream/tests/explicit-skill-requests/run-all.sh +70 -0
- package/upstream/tests/explicit-skill-requests/run-claude-describes-sdd.sh +100 -0
- package/upstream/tests/explicit-skill-requests/run-extended-multiturn-test.sh +113 -0
- package/upstream/tests/explicit-skill-requests/run-haiku-test.sh +144 -0
- package/upstream/tests/explicit-skill-requests/run-multiturn-test.sh +143 -0
- package/upstream/tests/explicit-skill-requests/run-test.sh +136 -0
- package/upstream/tests/opencode/run-tests.sh +163 -0
- package/upstream/tests/opencode/setup.sh +88 -0
- package/upstream/tests/opencode/test-plugin-loading.sh +82 -0
- package/upstream/tests/opencode/test-priority.sh +198 -0
- package/upstream/tests/opencode/test-tools.sh +104 -0
- package/upstream/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +8 -0
- package/upstream/tests/skill-triggering/prompts/executing-plans.txt +1 -0
- package/upstream/tests/skill-triggering/prompts/requesting-code-review.txt +3 -0
- package/upstream/tests/skill-triggering/prompts/systematic-debugging.txt +11 -0
- package/upstream/tests/skill-triggering/prompts/test-driven-development.txt +7 -0
- package/upstream/tests/skill-triggering/prompts/writing-plans.txt +10 -0
- package/upstream/tests/skill-triggering/run-all.sh +60 -0
- package/upstream/tests/skill-triggering/run-test.sh +88 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/design.md +81 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/plan.md +172 -0
- package/upstream/tests/subagent-driven-dev/go-fractals/scaffold.sh +45 -0
- package/upstream/tests/subagent-driven-dev/run-test.sh +106 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/design.md +70 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/plan.md +222 -0
- package/upstream/tests/subagent-driven-dev/svelte-todo/scaffold.sh +46 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Feature Development Workflow
|
|
2
|
+
|
|
3
|
+
> See the full workflow at [AIFLOW.md](../../AIFLOW.md)
|
|
4
|
+
> **Gates must pass in order: 1 → 2 → 3 → 4 → 5**
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Step 1: Load ticket & AI analyzes (Gate 1)
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
aiflow use PROJ-33 # from Backlog/Jira
|
|
12
|
+
claude # AI auto-starts Gate 1
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
AI will **automatically**:
|
|
16
|
+
1. Load ticket info from Backlog/Jira
|
|
17
|
+
2. Read source code — understand architecture, related files, patterns
|
|
18
|
+
3. Ask clarifying questions if anything is unclear (one at a time)
|
|
19
|
+
4. Output `plan/[ticket-id]/requirement.md` containing:
|
|
20
|
+
- Requirements summary (AI's understanding)
|
|
21
|
+
- Source code analysis (related files, data flow)
|
|
22
|
+
- **Proposed solution** with options and recommendation
|
|
23
|
+
- **Impact analysis** — affected areas, risks
|
|
24
|
+
- **Effort estimate** (S/M/L/XL)
|
|
25
|
+
- Testing plan
|
|
26
|
+
|
|
27
|
+
**PM needs to prepare on the ticket:**
|
|
28
|
+
```markdown
|
|
29
|
+
## Description
|
|
30
|
+
Clear business requirement. Who uses it, and for what purpose.
|
|
31
|
+
|
|
32
|
+
## Acceptance Criteria
|
|
33
|
+
- [ ] [Condition for completion 1]
|
|
34
|
+
- [ ] [Condition for completion 2]
|
|
35
|
+
|
|
36
|
+
## Mockup / Wireframe
|
|
37
|
+
[Link or UI description]
|
|
38
|
+
|
|
39
|
+
## Context
|
|
40
|
+
Constraints, business rules specially requiring attention.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**If ticket content is unclear:** AI will ask questions based on source code analysis — not just checking format.
|
|
44
|
+
|
|
45
|
+
**When satisfied with the requirement document, type:**
|
|
46
|
+
```
|
|
47
|
+
APPROVED
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Step 2: Review Implementation Plan (Gate 2)
|
|
53
|
+
|
|
54
|
+
AI generates a detailed implementation plan:
|
|
55
|
+
- TDD task breakdown (test first → implement → verify)
|
|
56
|
+
- Commit strategy (small, focused commits)
|
|
57
|
+
- Test commands
|
|
58
|
+
|
|
59
|
+
**When agreed, type:**
|
|
60
|
+
```
|
|
61
|
+
APPROVED
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**CODE WILL NOT BE GENERATED BEFORE RECEIVING "APPROVED".**
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 3: AI Generate Code (Gate 3)
|
|
69
|
+
|
|
70
|
+
AI performs automatically:
|
|
71
|
+
1. Complex feature (3+ files): `superpowers:subagent-driven-development`
|
|
72
|
+
2. Write tests FIRST → run → confirm FAIL
|
|
73
|
+
3. Implement → tests PASS
|
|
74
|
+
4. Commit each small step
|
|
75
|
+
|
|
76
|
+
Developer doesn't need to do anything at this step — just monitor.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 4: Review Summary (Gate 4)
|
|
81
|
+
|
|
82
|
+
AI runs:
|
|
83
|
+
1. `superpowers:verification-before-completion` — all tests PASS
|
|
84
|
+
2. `impact-analysis` — no breaking changes outside of scope
|
|
85
|
+
3. Review checklist — all items ticked
|
|
86
|
+
4. Create `plan/[ticket-id]/summary.md`
|
|
87
|
+
|
|
88
|
+
AI displays summary and waits for developer review.
|
|
89
|
+
|
|
90
|
+
**If OK, type:**
|
|
91
|
+
```
|
|
92
|
+
APPROVED
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**If there are bugs, type:**
|
|
96
|
+
```
|
|
97
|
+
BUG: [specific description]
|
|
98
|
+
```
|
|
99
|
+
- Coding bug → AI fixes → repeat Gate 4
|
|
100
|
+
- Requirement bug → AI returns to Gate 1, update requirement doc
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Step 5: Peer Review & PR (Gate 5)
|
|
105
|
+
|
|
106
|
+
AI invokes `superpowers:requesting-code-review` and guides PR creation.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git push origin feature/PROJ-33-feature-name
|
|
110
|
+
# Create PR with full description following the template in AIFLOW.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Peer reviewer uses the `superpowers:receiving-code-review` skill during review.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Completion Checklist
|
|
118
|
+
|
|
119
|
+
- [ ] Gate 1 APPROVED — requirement doc with solution, impact, estimate
|
|
120
|
+
- [ ] Gate 2 APPROVED — implementation plan confirmed by developer
|
|
121
|
+
- [ ] Gate 3 done — code + tests are green
|
|
122
|
+
- [ ] Gate 4 APPROVED — summary + checklist complete
|
|
123
|
+
- [ ] Gate 5 done — PR is peer-reviewed and merged
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Impact Analysis Workflow
|
|
2
|
+
|
|
3
|
+
> See the full workflow at [AIFLOW.md](../../AIFLOW.md)
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
aiflow use PROJ-33
|
|
9
|
+
aiflow prompt impact-analysis
|
|
10
|
+
claude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See the details of each Gate in AIFLOW.md — Section "Workflow by Task Type".
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Investigation Workflow
|
|
2
|
+
|
|
3
|
+
> See the full workflow at [AIFLOW.md](../../AIFLOW.md)
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
aiflow use PROJ-33
|
|
9
|
+
aiflow prompt investigation
|
|
10
|
+
claude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See the details of each Gate in AIFLOW.md — Section "Workflow by Task Type".
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Refactor Workflow
|
|
2
|
+
|
|
3
|
+
> See the full workflow at [AIFLOW.md](../../AIFLOW.md)
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
aiflow use PROJ-33
|
|
9
|
+
aiflow prompt refactor
|
|
10
|
+
claude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
See the details of each Gate in AIFLOW.md — Section "Workflow by Task Type".
|
package/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// AI Flow Kit - Main Entry Point
|
|
2
|
+
// Exports core utilities for programmatic use
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
// Configuration
|
|
6
|
+
ConfigManager: require('./scripts/config'),
|
|
7
|
+
|
|
8
|
+
// Task Detection
|
|
9
|
+
TaskDetector: require('./scripts/detect'),
|
|
10
|
+
|
|
11
|
+
// Commands (as modules)
|
|
12
|
+
init: require('./scripts/init'),
|
|
13
|
+
update: require('./scripts/update'),
|
|
14
|
+
doctor: require('./scripts/doctor'),
|
|
15
|
+
use: require('./scripts/use'),
|
|
16
|
+
context: require('./scripts/context'),
|
|
17
|
+
prompt: require('./scripts/prompt'),
|
|
18
|
+
remove: require('./scripts/remove'),
|
|
19
|
+
guide: require('./scripts/guide'),
|
|
20
|
+
|
|
21
|
+
// Utilities
|
|
22
|
+
validate: require('./scripts/validate'),
|
|
23
|
+
memory: require('./scripts/memory'),
|
|
24
|
+
|
|
25
|
+
// Version
|
|
26
|
+
version: require('./package.json').version
|
|
27
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@relipa/ai-flow-kit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "All-in-one AI Flow Kit for team development with Claude AI - skills, templates, and MCP adapters",
|
|
5
|
+
"author": "Relipa AI Team",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"registry": "https://registry.npmjs.com/"
|
|
9
|
+
},
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"type": "commonjs",
|
|
12
|
+
"main": "index.js",
|
|
13
|
+
"bin": {
|
|
14
|
+
"aiflow": "./bin/aiflow.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin",
|
|
18
|
+
"custom",
|
|
19
|
+
"scripts",
|
|
20
|
+
"upstream",
|
|
21
|
+
"docs",
|
|
22
|
+
"package.json",
|
|
23
|
+
"index.js",
|
|
24
|
+
"README.md",
|
|
25
|
+
"QUICK_START.md",
|
|
26
|
+
"AIFLOW.md",
|
|
27
|
+
"CONTRIBUTING.md",
|
|
28
|
+
"IMPLEMENTATION_SUMMARY.md",
|
|
29
|
+
"CHANGELOG.md"
|
|
30
|
+
],
|
|
31
|
+
"keywords": [
|
|
32
|
+
"ai",
|
|
33
|
+
"claude",
|
|
34
|
+
"development",
|
|
35
|
+
"workflow",
|
|
36
|
+
"superpowers",
|
|
37
|
+
"mcp",
|
|
38
|
+
"team",
|
|
39
|
+
"productivity"
|
|
40
|
+
],
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://gitlab.relipa.vn/ai/ai-flow-kit"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://gitlab.relipa.vn/ai/ai-flow-kit/-/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://gitlab.relipa.vn/ai/ai-flow-kit",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=14.0.0",
|
|
51
|
+
"npm": ">=6.0.0"
|
|
52
|
+
},
|
|
53
|
+
"scripts": {
|
|
54
|
+
"aiflow": "node bin/aiflow.js",
|
|
55
|
+
"test": "echo \"Add tests in future\" && exit 0",
|
|
56
|
+
"lint": "echo \"Add linting in future\" && exit 0",
|
|
57
|
+
"docs": "echo \"Documentation available in ./docs\"",
|
|
58
|
+
"publish": "npm publish"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@inquirer/prompts": "^8.3.2",
|
|
62
|
+
"chalk": "^4.1.2",
|
|
63
|
+
"commander": "^14.0.3",
|
|
64
|
+
"fs-extra": "^11.3.4",
|
|
65
|
+
"semver": "^7.7.4"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"typescript": "^6.0.2"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
class ConfigManager {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.globalConfigPath = path.join(
|
|
7
|
+
process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,
|
|
8
|
+
'.claude',
|
|
9
|
+
'ai-flow-kit.json'
|
|
10
|
+
);
|
|
11
|
+
this.projectConfigPath = path.join(process.cwd(), '.aiflowrc.json');
|
|
12
|
+
this.cache = {};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Load configuration with proper priority:
|
|
17
|
+
* 1. Environment variables
|
|
18
|
+
* 2. CLI flags
|
|
19
|
+
* 3. Project config (.aiflowrc.json)
|
|
20
|
+
* 4. Global config
|
|
21
|
+
* 5. Defaults
|
|
22
|
+
*/
|
|
23
|
+
async load(cliFlags = {}) {
|
|
24
|
+
const defaults = this.getDefaults();
|
|
25
|
+
const globalConfig = await this.loadFile(this.globalConfigPath) || {};
|
|
26
|
+
const projectConfig = await this.loadFile(this.projectConfigPath) || {};
|
|
27
|
+
const envConfig = this.loadFromEnv();
|
|
28
|
+
|
|
29
|
+
// Merge with proper precedence
|
|
30
|
+
this.cache = {
|
|
31
|
+
...defaults,
|
|
32
|
+
...globalConfig,
|
|
33
|
+
...projectConfig,
|
|
34
|
+
...envConfig,
|
|
35
|
+
...cliFlags
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return this.cache;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get configuration value with nested path support
|
|
43
|
+
* e.g., get('mcp.timeout') → 30000
|
|
44
|
+
*/
|
|
45
|
+
get(path, defaultValue = null) {
|
|
46
|
+
const parts = path.split('.');
|
|
47
|
+
let value = this.cache;
|
|
48
|
+
|
|
49
|
+
for (const part of parts) {
|
|
50
|
+
if (value && typeof value === 'object' && part in value) {
|
|
51
|
+
value = value[part];
|
|
52
|
+
} else {
|
|
53
|
+
return defaultValue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Load environment variables with AIFLOW_ prefix
|
|
62
|
+
*/
|
|
63
|
+
loadFromEnv() {
|
|
64
|
+
const envConfig = {};
|
|
65
|
+
|
|
66
|
+
// Map environment variables to config
|
|
67
|
+
const envMap = {
|
|
68
|
+
'AIFLOW_TEAM': 'team',
|
|
69
|
+
'AIFLOW_MODEL': 'defaultModel',
|
|
70
|
+
'AIFLOW_ADAPTERS': 'adapters',
|
|
71
|
+
'AIFLOW_FRAMEWORKS': 'frameworks',
|
|
72
|
+
'AIFLOW_AUTO_DETECT': 'autoDetectTasks',
|
|
73
|
+
'AIFLOW_STRICT_MODE': 'strictMode',
|
|
74
|
+
'AIFLOW_DEBUG': 'debug',
|
|
75
|
+
'AIFLOW_VERBOSE': 'verbose'
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
for (const [envKey, configKey] of Object.entries(envMap)) {
|
|
79
|
+
if (process.env[envKey]) {
|
|
80
|
+
const value = process.env[envKey];
|
|
81
|
+
// Parse comma-separated lists
|
|
82
|
+
if (configKey === 'adapters' || configKey === 'frameworks') {
|
|
83
|
+
envConfig[configKey] = value.split(',').map(s => s.trim());
|
|
84
|
+
}
|
|
85
|
+
// Parse booleans
|
|
86
|
+
else if (value === 'true' || value === 'false') {
|
|
87
|
+
envConfig[configKey] = value === 'true';
|
|
88
|
+
}
|
|
89
|
+
// Parse numbers
|
|
90
|
+
else if (!isNaN(value)) {
|
|
91
|
+
envConfig[configKey] = parseInt(value);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
envConfig[configKey] = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return envConfig;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Load configuration from file
|
|
104
|
+
*/
|
|
105
|
+
async loadFile(filePath) {
|
|
106
|
+
try {
|
|
107
|
+
if (await fs.pathExists(filePath)) {
|
|
108
|
+
return await fs.readJson(filePath);
|
|
109
|
+
}
|
|
110
|
+
} catch (err) {
|
|
111
|
+
console.warn(`Warning: Could not load config from ${filePath}`);
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Save project configuration
|
|
118
|
+
*/
|
|
119
|
+
async saveProject(config) {
|
|
120
|
+
await fs.ensureDir(path.dirname(this.projectConfigPath));
|
|
121
|
+
await fs.writeJson(this.projectConfigPath, config, { spaces: 2 });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Save global configuration
|
|
126
|
+
*/
|
|
127
|
+
async saveGlobal(config) {
|
|
128
|
+
await fs.ensureDir(path.dirname(this.globalConfigPath));
|
|
129
|
+
await fs.writeJson(this.globalConfigPath, config, { spaces: 2 });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Default configuration
|
|
134
|
+
*/
|
|
135
|
+
getDefaults() {
|
|
136
|
+
return {
|
|
137
|
+
team: 'default-team',
|
|
138
|
+
description: 'Default team configuration',
|
|
139
|
+
adapters: [],
|
|
140
|
+
frameworks: [],
|
|
141
|
+
customSkills: [],
|
|
142
|
+
defaultModel: 'claude-opus-4-6',
|
|
143
|
+
autoDetectTasks: true,
|
|
144
|
+
strictMode: false,
|
|
145
|
+
contextTemplate: 'standard',
|
|
146
|
+
debug: false,
|
|
147
|
+
verbose: false,
|
|
148
|
+
|
|
149
|
+
// MCP Configuration
|
|
150
|
+
mcp: {
|
|
151
|
+
timeout: 30000,
|
|
152
|
+
retries: 3,
|
|
153
|
+
fallback: 'manual'
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
// Context Configuration
|
|
157
|
+
context: {
|
|
158
|
+
includeGitHistory: true,
|
|
159
|
+
includeFileTree: true,
|
|
160
|
+
maxFileSize: 1000000,
|
|
161
|
+
cacheContexts: true,
|
|
162
|
+
cacheTTL: 86400
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
// Prompting Configuration
|
|
166
|
+
prompting: {
|
|
167
|
+
language: 'english',
|
|
168
|
+
detail: 'comprehensive',
|
|
169
|
+
examples: true,
|
|
170
|
+
bestPractices: true,
|
|
171
|
+
warningLevel: 'medium'
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
// Validation Configuration
|
|
175
|
+
validation: {
|
|
176
|
+
enabled: true,
|
|
177
|
+
ruleSet: 'default',
|
|
178
|
+
autoFix: false,
|
|
179
|
+
reportLevel: 'warning'
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
// Task Detection
|
|
183
|
+
detection: {
|
|
184
|
+
confidence_threshold: 0.8,
|
|
185
|
+
fallback: 'ask',
|
|
186
|
+
debug: false
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
// Memory System
|
|
190
|
+
memory: {
|
|
191
|
+
enabled: true,
|
|
192
|
+
autoLoadRelevant: true,
|
|
193
|
+
maxMemorySize: 1000000,
|
|
194
|
+
persistPath: '.aiflow/memory'
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Validate configuration
|
|
201
|
+
*/
|
|
202
|
+
validate(config) {
|
|
203
|
+
const errors = [];
|
|
204
|
+
|
|
205
|
+
if (config.adapters && !Array.isArray(config.adapters)) {
|
|
206
|
+
errors.push('adapters must be an array');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (config.frameworks && !Array.isArray(config.frameworks)) {
|
|
210
|
+
errors.push('frameworks must be an array');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (config.defaultModel && typeof config.defaultModel !== 'string') {
|
|
214
|
+
errors.push('defaultModel must be a string');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (typeof config.autoDetectTasks !== 'boolean') {
|
|
218
|
+
errors.push('autoDetectTasks must be boolean');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (typeof config.strictMode !== 'boolean') {
|
|
222
|
+
errors.push('strictMode must be boolean');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (config.mcp && typeof config.mcp !== 'object') {
|
|
226
|
+
errors.push('mcp must be an object');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
valid: errors.length === 0,
|
|
231
|
+
errors
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get all configured adapters
|
|
237
|
+
*/
|
|
238
|
+
getAdapters() {
|
|
239
|
+
return this.get('adapters', []);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Get all configured frameworks
|
|
244
|
+
*/
|
|
245
|
+
getFrameworks() {
|
|
246
|
+
return this.get('frameworks', []);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Check if adapter is configured
|
|
251
|
+
*/
|
|
252
|
+
hasAdapter(name) {
|
|
253
|
+
return this.getAdapters().includes(name);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Check if framework is configured
|
|
258
|
+
*/
|
|
259
|
+
hasFramework(name) {
|
|
260
|
+
return this.getFrameworks().includes(name);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get configured custom skills
|
|
265
|
+
*/
|
|
266
|
+
getCustomSkills() {
|
|
267
|
+
return this.get('customSkills', []);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Check if in strict mode
|
|
272
|
+
*/
|
|
273
|
+
isStrictMode() {
|
|
274
|
+
return this.get('strictMode', false);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Check if auto-detect is enabled
|
|
279
|
+
*/
|
|
280
|
+
isAutoDetectEnabled() {
|
|
281
|
+
return this.get('autoDetectTasks', true);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Merge custom config with defaults
|
|
286
|
+
*/
|
|
287
|
+
merge(customConfig) {
|
|
288
|
+
return { ...this.getDefaults(), ...customConfig };
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Create template config for getting started
|
|
293
|
+
*/
|
|
294
|
+
getTemplateConfig(framework = 'generic', adapters = []) {
|
|
295
|
+
return {
|
|
296
|
+
team: 'my-team',
|
|
297
|
+
description: `Configuration for team projects`,
|
|
298
|
+
adapters: adapters.length > 0 ? adapters : [],
|
|
299
|
+
frameworks: framework !== 'generic' ? [framework] : [],
|
|
300
|
+
customSkills: ['investigate-bug', 'impact-analysis'],
|
|
301
|
+
defaultModel: 'claude-opus-4-6',
|
|
302
|
+
autoDetectTasks: true,
|
|
303
|
+
strictMode: false,
|
|
304
|
+
contextTemplate: 'standard',
|
|
305
|
+
prompting: {
|
|
306
|
+
language: 'english',
|
|
307
|
+
detail: 'comprehensive'
|
|
308
|
+
},
|
|
309
|
+
validation: {
|
|
310
|
+
enabled: true,
|
|
311
|
+
ruleSet: 'default'
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
module.exports = ConfigManager;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 CONTEXT_DIR = path.join(PROJECT_DIR, '.claude', 'context');
|
|
7
|
+
const HISTORY_DIR = path.join(CONTEXT_DIR, 'history');
|
|
8
|
+
const CURRENT_FILE = path.join(CONTEXT_DIR, 'current.json');
|
|
9
|
+
|
|
10
|
+
// ──────────────────────────────────────────────────────────────
|
|
11
|
+
// Entry point — called from bin/aiflow.js
|
|
12
|
+
// ──────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
module.exports = async function context(action, options = {}) {
|
|
15
|
+
// Normalise: commander passes the positional arg as `action`,
|
|
16
|
+
// but flags like --list/--show may also indicate the action.
|
|
17
|
+
const cmd = action || (options.list ? 'list' : options.show ? 'show' : null);
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
if (cmd === 'list' || options.list) return await listContexts();
|
|
21
|
+
if (cmd === 'show' || options.show) return await showCurrent();
|
|
22
|
+
if (cmd === 'save' || options.save) return await saveCurrent(options.save || cmd);
|
|
23
|
+
if (options.load) return await loadContext(options.load);
|
|
24
|
+
if (options.delete) return await deleteContext(options.delete);
|
|
25
|
+
if (cmd === 'clear' || options.clear) return await clearContexts();
|
|
26
|
+
|
|
27
|
+
console.log(chalk.yellow('Usage: aiflow context <list|show|save <name>|clear>'));
|
|
28
|
+
console.log(chalk.gray(' aiflow context --load <name>'));
|
|
29
|
+
console.log(chalk.gray(' aiflow context --delete <name>'));
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// ──────────────────────────────────────────────────────────────
|
|
36
|
+
// Commands
|
|
37
|
+
// ──────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
async function listContexts() {
|
|
40
|
+
await fs.ensureDir(HISTORY_DIR);
|
|
41
|
+
const files = (await fs.readdir(HISTORY_DIR)).filter(f => f.endsWith('.json'));
|
|
42
|
+
|
|
43
|
+
if (!files.length) {
|
|
44
|
+
console.log(chalk.gray('No saved contexts.'));
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(chalk.cyan('\nSaved contexts:\n'));
|
|
49
|
+
for (const file of files) {
|
|
50
|
+
const name = file.replace(/\.json$/, '');
|
|
51
|
+
const ctx = await fs.readJson(path.join(HISTORY_DIR, file)).catch(() => ({}));
|
|
52
|
+
const label = ctx.title ? ctx.title.substring(0, 60) : '(no title)';
|
|
53
|
+
console.log(` ${chalk.white(name.padEnd(20))} ${chalk.gray(label)}`);
|
|
54
|
+
}
|
|
55
|
+
console.log();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function showCurrent() {
|
|
59
|
+
if (!(await fs.pathExists(CURRENT_FILE))) {
|
|
60
|
+
console.log(chalk.yellow('No current context. Run `aiflow use <ticket>` first.'));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const ctx = await fs.readJson(CURRENT_FILE);
|
|
64
|
+
console.log(chalk.cyan('\nCurrent context:\n'));
|
|
65
|
+
console.log(JSON.stringify(ctx, null, 2));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function saveCurrent(name) {
|
|
69
|
+
if (!name || name === 'save') {
|
|
70
|
+
console.log(chalk.red('Provide a name: aiflow context save <name>'));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (!(await fs.pathExists(CURRENT_FILE))) {
|
|
74
|
+
console.log(chalk.yellow('No current context to save. Run `aiflow use <ticket>` first.'));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await fs.ensureDir(HISTORY_DIR);
|
|
78
|
+
const dest = path.join(HISTORY_DIR, `${sanitize(name)}.json`);
|
|
79
|
+
await fs.copy(CURRENT_FILE, dest);
|
|
80
|
+
console.log(chalk.green(`✓ Context saved as: ${name}`));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function loadContext(name) {
|
|
84
|
+
await fs.ensureDir(HISTORY_DIR);
|
|
85
|
+
const src = path.join(HISTORY_DIR, `${sanitize(name)}.json`);
|
|
86
|
+
if (!(await fs.pathExists(src))) {
|
|
87
|
+
console.log(chalk.red(`Context not found: ${name}`));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
await fs.ensureDir(CONTEXT_DIR);
|
|
91
|
+
await fs.copy(src, CURRENT_FILE, { overwrite: true });
|
|
92
|
+
console.log(chalk.green(`✓ Loaded context: ${name}`));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function deleteContext(name) {
|
|
96
|
+
const target = path.join(HISTORY_DIR, `${sanitize(name)}.json`);
|
|
97
|
+
if (!(await fs.pathExists(target))) {
|
|
98
|
+
console.log(chalk.yellow(`Context not found: ${name}`));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
await fs.remove(target);
|
|
102
|
+
console.log(chalk.green(`✓ Deleted context: ${name}`));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function clearContexts() {
|
|
106
|
+
await fs.ensureDir(HISTORY_DIR);
|
|
107
|
+
await fs.emptyDir(HISTORY_DIR);
|
|
108
|
+
console.log(chalk.green('✓ Cleared all saved contexts.'));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ──────────────────────────────────────────────────────────────
|
|
112
|
+
// Helpers
|
|
113
|
+
// ──────────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
function sanitize(name) {
|
|
116
|
+
return name.toLowerCase().replace(/[^\w-]/g, '-').replace(/-+/g, '-').substring(0, 60);
|
|
117
|
+
}
|