ai-devkit 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/dist/cli.js +8 -0
  2. package/dist/cli.js.map +1 -1
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +1 -1
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/memory.d.ts +3 -0
  7. package/dist/commands/memory.d.ts.map +1 -0
  8. package/dist/commands/memory.js +53 -0
  9. package/dist/commands/memory.js.map +1 -0
  10. package/dist/commands/setup.d.ts +6 -0
  11. package/dist/commands/setup.d.ts.map +1 -0
  12. package/dist/commands/setup.js +112 -0
  13. package/dist/commands/setup.js.map +1 -0
  14. package/dist/lib/EnvironmentSelector.d.ts +1 -0
  15. package/dist/lib/EnvironmentSelector.d.ts.map +1 -1
  16. package/dist/lib/EnvironmentSelector.js +28 -0
  17. package/dist/lib/EnvironmentSelector.js.map +1 -1
  18. package/dist/lib/TemplateManager.d.ts +14 -0
  19. package/dist/lib/TemplateManager.d.ts.map +1 -1
  20. package/dist/lib/TemplateManager.js +74 -3
  21. package/dist/lib/TemplateManager.js.map +1 -1
  22. package/{templates/commands/capture-knowledge.toml → dist/templates/commands/capture-knowledge.md} +10 -4
  23. package/{templates/commands/check-implementation.toml → dist/templates/commands/check-implementation.md} +9 -0
  24. package/{templates/commands/code-review.toml → dist/templates/commands/code-review.md} +11 -4
  25. package/{templates/commands/debug.toml → dist/templates/commands/debug.md} +11 -5
  26. package/{templates/commands/execute-plan.toml → dist/templates/commands/execute-plan.md} +11 -5
  27. package/{templates/commands/new-requirement.toml → dist/templates/commands/new-requirement.md} +11 -4
  28. package/dist/templates/commands/remember.md +27 -0
  29. package/dist/templates/commands/review-design.md +21 -0
  30. package/dist/templates/commands/review-requirements.md +19 -0
  31. package/dist/templates/commands/simplify-implementation.md +153 -0
  32. package/{templates/commands/update-planning.toml → dist/templates/commands/update-planning.md} +11 -4
  33. package/{templates/commands/writing-test.toml → dist/templates/commands/writing-test.md} +10 -3
  34. package/dist/templates/env/base.md +51 -0
  35. package/dist/templates/phases/deployment.md +72 -0
  36. package/dist/templates/phases/design.md +60 -0
  37. package/dist/templates/phases/implementation.md +65 -0
  38. package/dist/templates/phases/monitoring.md +80 -0
  39. package/dist/templates/phases/planning.md +60 -0
  40. package/dist/templates/phases/requirements.md +51 -0
  41. package/dist/templates/phases/testing.md +81 -0
  42. package/dist/templates/templates/commands/capture-knowledge.md +55 -0
  43. package/dist/templates/templates/commands/check-implementation.md +30 -0
  44. package/dist/templates/templates/commands/code-review.md +90 -0
  45. package/dist/templates/templates/commands/debug.md +54 -0
  46. package/dist/templates/templates/commands/execute-plan.md +80 -0
  47. package/dist/templates/templates/commands/new-requirement.md +136 -0
  48. package/dist/templates/templates/commands/remember.md +27 -0
  49. package/dist/templates/templates/commands/review-design.md +21 -0
  50. package/dist/templates/templates/commands/review-requirements.md +19 -0
  51. package/dist/templates/templates/commands/simplify-implementation.md +153 -0
  52. package/dist/templates/templates/commands/update-planning.md +70 -0
  53. package/dist/templates/templates/commands/writing-test.md +53 -0
  54. package/dist/templates/templates/env/base.md +51 -0
  55. package/dist/templates/templates/phases/deployment.md +72 -0
  56. package/dist/templates/templates/phases/design.md +60 -0
  57. package/dist/templates/templates/phases/implementation.md +65 -0
  58. package/dist/templates/templates/phases/monitoring.md +80 -0
  59. package/dist/templates/templates/phases/planning.md +60 -0
  60. package/dist/templates/templates/phases/requirements.md +51 -0
  61. package/dist/templates/templates/phases/testing.md +81 -0
  62. package/dist/types.d.ts +2 -1
  63. package/dist/types.d.ts.map +1 -1
  64. package/dist/types.js.map +1 -1
  65. package/dist/util/env.d.ts +2 -0
  66. package/dist/util/env.d.ts.map +1 -1
  67. package/dist/util/env.js +18 -1
  68. package/dist/util/env.js.map +1 -1
  69. package/package.json +5 -2
  70. package/project.json +29 -0
  71. package/templates/commands/capture-knowledge.md +9 -0
  72. package/templates/commands/check-implementation.md +9 -0
  73. package/templates/commands/code-review.md +9 -0
  74. package/templates/commands/debug.md +9 -0
  75. package/templates/commands/execute-plan.md +9 -0
  76. package/templates/commands/new-requirement.md +9 -0
  77. package/templates/commands/remember.md +27 -0
  78. package/templates/commands/review-design.md +10 -0
  79. package/templates/commands/review-requirements.md +10 -0
  80. package/templates/commands/simplify-implementation.md +153 -0
  81. package/templates/commands/update-planning.md +9 -0
  82. package/templates/commands/writing-test.md +9 -0
  83. package/CHANGELOG.md +0 -87
  84. package/README.md +0 -297
  85. package/dist/__tests__/lib/Config.test.d.ts +0 -2
  86. package/dist/__tests__/lib/Config.test.d.ts.map +0 -1
  87. package/dist/__tests__/lib/Config.test.js +0 -281
  88. package/dist/__tests__/lib/Config.test.js.map +0 -1
  89. package/dist/__tests__/lib/EnvironmentSelector.test.d.ts +0 -2
  90. package/dist/__tests__/lib/EnvironmentSelector.test.d.ts.map +0 -1
  91. package/dist/__tests__/lib/EnvironmentSelector.test.js +0 -117
  92. package/dist/__tests__/lib/EnvironmentSelector.test.js.map +0 -1
  93. package/dist/__tests__/lib/PhaseSelector.test.d.ts +0 -2
  94. package/dist/__tests__/lib/PhaseSelector.test.d.ts.map +0 -1
  95. package/dist/__tests__/lib/PhaseSelector.test.js +0 -77
  96. package/dist/__tests__/lib/PhaseSelector.test.js.map +0 -1
  97. package/dist/__tests__/lib/TemplateManager.test.d.ts +0 -2
  98. package/dist/__tests__/lib/TemplateManager.test.d.ts.map +0 -1
  99. package/dist/__tests__/lib/TemplateManager.test.js +0 -351
  100. package/dist/__tests__/lib/TemplateManager.test.js.map +0 -1
  101. package/dist/__tests__/util/env.test.d.ts +0 -2
  102. package/dist/__tests__/util/env.test.d.ts.map +0 -1
  103. package/dist/__tests__/util/env.test.js +0 -166
  104. package/dist/__tests__/util/env.test.js.map +0 -1
  105. package/templates/commands/review-design.toml +0 -13
  106. package/templates/commands/review-requirements.toml +0 -11
  107. package/web/.nojekyll +0 -2
  108. package/web/CNAME +0 -1
  109. package/web/README.md +0 -100
  110. package/web/app/favicon.ico +0 -0
  111. package/web/app/globals.css +0 -122
  112. package/web/app/layout.tsx +0 -106
  113. package/web/app/page.tsx +0 -119
  114. package/web/app/roadmap/page.tsx +0 -150
  115. package/web/app/robots.ts +0 -16
  116. package/web/app/sitemap.ts +0 -46
  117. package/web/app/vision/page.tsx +0 -49
  118. package/web/components/Footer.tsx +0 -81
  119. package/web/components/GitHubButton.tsx +0 -49
  120. package/web/components/GitHubStars.tsx +0 -27
  121. package/web/components/Header.tsx +0 -108
  122. package/web/components/MarkdownContent.tsx +0 -35
  123. package/web/components/SkipToContent.tsx +0 -11
  124. package/web/content/pages/vision.md +0 -44
  125. package/web/content/roadmap/1-web.md +0 -9
  126. package/web/content/roadmap/2-integrations.md +0 -7
  127. package/web/content/roadmap/3-cli-enhancements.md +0 -8
  128. package/web/content/roadmap/4-local-memory.md +0 -8
  129. package/web/eslint.config.mjs +0 -18
  130. package/web/lib/GitHubContext.tsx +0 -57
  131. package/web/lib/content/loader.ts +0 -152
  132. package/web/lib/content/types.ts +0 -37
  133. package/web/lib/utils.ts +0 -12
  134. package/web/next.config.ts +0 -11
  135. package/web/package-lock.json +0 -8837
  136. package/web/package.json +0 -34
  137. package/web/postcss.config.mjs +0 -7
  138. package/web/public/file.svg +0 -1
  139. package/web/public/globe.svg +0 -1
  140. package/web/public/next.svg +0 -1
  141. package/web/public/vercel.svg +0 -1
  142. package/web/public/window.svg +0 -1
package/CHANGELOG.md DELETED
@@ -1,87 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## Unreleased
9
-
10
- - Fixed Gemini CLI integration https://github.com/codeaholicguy/ai-devkit/issues/3
11
- - Added test for TemplateManager.ts
12
- - Fixed Github Copilot integration https://github.com/codeaholicguy/ai-devkit/issues/4
13
-
14
- ## [0.4.0] - 2025-10-31
15
-
16
- ### Added
17
- - **Multi-Environment Setup** - Support for 10 AI development environments
18
- - Interactive environment selection with multi-choice prompts
19
- - Support for Cursor, Claude Code, GitHub Copilot, Google Gemini, OpenAI Codex, Windsurf, KiloCode, AMP, OpenCode, and Roo Code
20
- - Unified template structure with AGENTS.md files for all environments
21
- - Environment-specific command directories and configuration files
22
- - Override protection with confirmation prompts for existing environments
23
- - Config persistence storing selected environments array
24
-
25
- ### Changed
26
- - **Breaking Changes** - Removed legacy single-environment support for cleaner API
27
- - Renamed `EnvironmentId` to `EnvironmentCode` throughout codebase
28
- - Removed legacy `Environment` type union (cursor | claude | both)
29
- - Updated config schema to use `environments: EnvironmentCode[]`
30
- - All environments now use standardized AGENTS.md context files
31
-
32
- ### Technical Improvements
33
- - **Testing Infrastructure** - Complete test suite implementation
34
- - **Architecture** - Modular design improvements
35
-
36
- ## [0.3.0] - 2025-10-15
37
-
38
- ### Added
39
- - `/debug` - Structured assistant for clarifying issues, analyzing options, and agreeing on a fix plan before coding
40
- - `/capture-knowledge` - Analyze and explain how code works from any entry point
41
- - Supports file, folder, function, and API endpoint analysis
42
- - Recursive dependency analysis with configurable depth (max: 3)
43
- - Automatic generation of mermaid diagrams (flowcharts, sequence, architecture, class diagrams)
44
- - Knowledge capture documentation saved to `docs/ai/implementation/knowledge-{feature-name}.md`
45
- - Visual dependency tree and component relationship mapping
46
- - Includes error handling, performance considerations, and improvement suggestions
47
-
48
- ## [0.2.0] - 2025-10-14
49
-
50
- ### Added
51
- - Eight slash commands for Cursor and Claude Code:
52
- - `/new-requirement` - Complete guided workflow from requirements to PR/MR creation
53
- - `/code-review` - Structured local code reviews
54
- - `/execute-plan` - Walk feature plans task-by-task
55
- - `/writing-test` - Generate tests with guidance for 100% coverage
56
- - `/update-planning` - Reconcile progress with planning docs
57
- - `/check-implementation` - Compare implementation with design
58
- - `/review-design` - Review system design and architecture
59
- - `/review-requirements` - Review and summarize requirements
60
- - Claude workspace configuration file (`CLAUDE.md`)
61
- - Cursor rules file (`ai-devkit.md`)
62
- - Design documentation requirements for mermaid diagrams (architecture and data flow)
63
-
64
- ## [0.1.0] - 2025-10-14
65
-
66
- ### Added
67
- - Initial release of AI DevKit CLI
68
- - Interactive `init` command for project initialization
69
- - Support for Cursor and Claude Code environments
70
- - Seven phase templates: requirements, design, planning, implementation, testing, deployment, monitoring
71
- - `phase` command for adding individual phases
72
- - Configuration management with `.ai-devkit.json`
73
- - Template overwrite prompts for existing files
74
- - Comprehensive documentation and README
75
- - TypeScript support with full type definitions
76
- - Cursor rules in `.cursor/rules/` directory
77
- - Cursor slash commands as individual Markdown files in `.cursor/commands/`
78
- - Claude Code workspace configuration in `CLAUDE.md`
79
-
80
- ### Features
81
- - Interactive prompts with Inquirer
82
- - Flag-based overrides for automation
83
- - Markdown templates with YAML frontmatter
84
- - Cursor rules and slash commands generation
85
- - Claude Code workspace configuration
86
- - State tracking for initialized phases
87
-
package/README.md DELETED
@@ -1,297 +0,0 @@
1
- # AI DevKit
2
-
3
- A CLI toolkit for AI-assisted software development with structured phase templates and environment setup for Cursor and Claude Code.
4
-
5
- [![npm version](https://img.shields.io/npm/v/ai-devkit.svg)](https://www.npmjs.com/package/ai-devkit)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
-
8
- ## Features
9
-
10
- - 🎯 **Phase-based Development**: Structured templates for each stage of the software development lifecycle
11
- - 🤖 **AI Environment Setup**: Automatic configuration for Cursor and Claude Code
12
- - 📝 **Customizable Templates**: Markdown-based templates with YAML frontmatter
13
- - 🚀 **Interactive CLI**: User-friendly prompts with flag override support
14
- - ⚙️ **State Management**: Tracks initialized phases and configuration
15
-
16
- ## Installation
17
-
18
- ```bash
19
- # Using npx (no installation needed)
20
- npx ai-devkit init
21
-
22
- # Or install globally
23
- npm install -g ai-devkit
24
- ```
25
-
26
- ## Quick Start
27
-
28
- Initialize AI DevKit in your project:
29
-
30
- ```bash
31
- # Interactive mode (recommended)
32
- ai-devkit init
33
-
34
- # With flags
35
- ai-devkit init --environment cursor --all
36
-
37
- # Initialize specific phases
38
- ai-devkit init --phases requirements,design,planning
39
- ```
40
-
41
- This will:
42
- 1. Create a `.ai-devkit.json` configuration file
43
- 2. Set up your AI development environment (Cursor/Claude Code)
44
- 3. Generate phase templates in `docs/ai/`
45
-
46
- Detailed user guide can be found [here](https://ai-devkit.com/docs/).
47
-
48
- ## Available Phases
49
-
50
- - **Requirements**: Problem understanding, requirements gathering, and success criteria
51
- - **Design**: System architecture, data models, and technical design (include mermaid diagrams for architecture/data flow)
52
- - **Planning**: Task breakdown, milestones, and project timeline
53
- - **Implementation**: Technical implementation notes and code guidelines
54
- - **Testing**: Testing strategy, test cases, and quality assurance
55
- - **Deployment**: Deployment process, infrastructure, and release procedures
56
- - **Monitoring**: Monitoring strategy, metrics, alerts, and observability
57
-
58
- ## Commands
59
-
60
- ### `ai-devkit init`
61
-
62
- Initialize AI DevKit in your project.
63
-
64
- **Options:**
65
- - `-e, --environment <env>`: Specify environment (cursor|claude|both)
66
- - `-a, --all`: Initialize all phases at once
67
- - `-p, --phases <phases>`: Comma-separated list of specific phases
68
-
69
- **Examples:**
70
- ```bash
71
- # Interactive mode
72
- ai-devkit init
73
-
74
- # Initialize for Cursor with all phases
75
- ai-devkit init --environment cursor --all
76
-
77
- # Initialize specific phases
78
- ai-devkit init --phases requirements,design,implementation
79
- ```
80
-
81
- ### `ai-devkit phase [name]`
82
-
83
- Add or update a specific phase template.
84
-
85
- **Examples:**
86
- ```bash
87
- # Interactive selection
88
- ai-devkit phase
89
-
90
- # Add specific phase
91
- ai-devkit phase requirements
92
- ai-devkit phase testing
93
- ```
94
-
95
- ## Generated Structure
96
-
97
- After initialization, your project will have:
98
-
99
- ```
100
- your-project/
101
- ├── .ai-devkit.json # Configuration and state
102
- ├── docs/
103
- │ └── ai/
104
- │ ├── requirements/
105
- │ │ └── README.md
106
- │ ├── design/
107
- │ │ └── README.md
108
- │ ├── planning/
109
- │ │ └── README.md
110
- │ ├── implementation/
111
- │ │ └── README.md
112
- │ ├── testing/
113
- │ │ └── README.md
114
- │ ├── deployment/
115
- │ │ └── README.md
116
- │ └── monitoring/
117
- │ └── README.md
118
- └── [Environment-specific files]
119
- ```
120
-
121
- Supported Tools & Agents:
122
- | Agent | Support | Notes |
123
- |-----------------------------------------------------------|---------|---------------------------------------------------|
124
- | [Claude Code](https://www.anthropic.com/claude-code) | ✅ | |
125
- | [GitHub Copilot](https://code.visualstudio.com/) | ✅ | VSCode only |
126
- | [Gemini CLI](https://github.com/google-gemini/gemini-cli) | ✅ | |
127
- | [Cursor](https://cursor.sh/) | ✅ | |
128
- | [opencode](https://opencode.ai/) | 🚧 | Testing |
129
- | [Windsurf](https://windsurf.com/) | 🚧 | Testing |
130
- | [Kilo Code](https://github.com/Kilo-Org/kilocode) | 🚧 | Testing |
131
- | [Roo Code](https://roocode.com/) | 🚧 | Testing |
132
- | [Codex CLI](https://github.com/openai/codex) | 🚧 | Testing |
133
- | [Amp](https://ampcode.com/) | 🚧 | Testing |
134
-
135
- Templates are designed to provide structure while remaining concise and AI-friendly.
136
-
137
- ## Environment Setup
138
-
139
- ### Cursor
140
-
141
- Generated files:
142
- - `.cursor/rules/`: Project-specific rules as Markdown files (per [Cursor documentation](https://cursor.com/docs/context/rules))
143
- - `.cursor/commands/`: Custom slash commands as Markdown files (per [Cursor documentation](https://cursor.com/docs/agent/chat/commands))
144
-
145
- Available slash commands:
146
- - `/new-requirement`: Complete workflow for adding a new feature from requirements to PR
147
- - `/code-review`: Structured local code review against design docs before pushing changes
148
- - `/execute-plan`: Walk a feature plan task-by-task with interactive prompts
149
- - `/writing-test`: Write unit/integration tests targeting 100% coverage
150
- - `/update-planning`: Update planning and task breakdown
151
- - `/check-implementation`: Compare implementation with design
152
- - `/review-design`: Review system design and architecture
153
- - `/review-requirements`: Review and summarize requirements
154
-
155
- Each command is stored as a plain Markdown file in `.cursor/commands/` and will automatically appear when you type `/` in Cursor's chat input.
156
-
157
- ### Claude Code
158
-
159
- Generated files:
160
- - `.claude/CLAUDE.md`: Workspace configuration and guidelines
161
- - `.claude/commands/`: Custom commands as Markdown files
162
-
163
- Available commands:
164
- - `new-requirement` - Complete workflow for adding a new feature from requirements to PR
165
- - `code-review` - Structured local code review against design docs before pushing changes
166
- - `execute-plan` - Walk a feature plan task-by-task with interactive prompts
167
- - `writing-test` - Write unit/integration tests targeting 100% coverage
168
- - `update-planning` - Update planning and task breakdown
169
- - `check-implementation` - Compare implementation with design
170
- - `review-design` - Review system design and architecture
171
- - `review-requirements` - Review and summarize requirements
172
- - `capture-knowledge` - Analyze and explain code with recursive dependency analysis and Mermaid diagrams
173
-
174
- Commands can be referenced in Claude Code chats to guide AI assistance through your development phases.
175
-
176
- ## Workflow Examples
177
-
178
- ### Initial Project Setup
179
-
180
- 1. **Initialize your project:**
181
- ```bash
182
- ai-devkit init
183
- ```
184
-
185
- 2. **Start with requirements:**
186
- - Fill out `docs/ai/requirements/README.md`
187
- - Use your AI assistant to help clarify and document requirements
188
-
189
- 3. **Design your system:**
190
- - Complete `docs/ai/design/README.md` and feature-specific files
191
- - Include mermaid diagrams for architecture, component interactions, and data flow
192
- - Reference requirements when making design decisions
193
-
194
- 4. **Plan your work:**
195
- - Break down tasks in `docs/ai/planning/README.md`
196
- - Estimate and prioritize
197
-
198
- 5. **Implement with guidance:**
199
- - Follow patterns in `docs/ai/implementation/README.md`
200
- - Keep implementation notes updated
201
-
202
- 6. **Test thoroughly:**
203
- - Use `docs/ai/testing/README.md` as your testing guide
204
- - Document test cases and results
205
-
206
- 7. **Deploy confidently:**
207
- - Follow deployment procedures in `docs/ai/deployment/README.md`
208
-
209
- 8. **Monitor and iterate:**
210
- - Set up monitoring per `docs/ai/monitoring/README.md`
211
-
212
- ## Use Cases
213
-
214
- - **New Projects**: Scaffold complete development documentation
215
- - **Existing Projects**: Add structured documentation gradually
216
- - **Team Collaboration**: Share common development practices
217
- - **AI Pair Programming**: Provide context for AI assistants
218
- - **Knowledge Management**: Document decisions and patterns
219
-
220
- ## Best Practices
221
-
222
- 1. **Keep templates updated**: As your project evolves, update phase documentation
223
- 2. **Reference across phases**: Link requirements to design, design to implementation
224
- 3. **Use with AI assistants**: Templates are designed to work well with AI code assistants
225
- 4. **Customize for your needs**: Templates are starting points, not rigid requirements
226
- 5. **Track decisions**: Document architectural decisions and their rationale
227
-
228
- ## Configuration File
229
-
230
- The `.ai-devkit.json` file tracks your setup:
231
-
232
- ```json
233
- {
234
- "version": "0.2.0",
235
- "environment": "cursor",
236
- "initializedPhases": ["requirements", "design", "planning"],
237
- "createdAt": "2025-10-14T...",
238
- "updatedAt": "2025-10-14T..."
239
- }
240
- ```
241
-
242
- ## Development
243
-
244
- To work on ai-devkit itself:
245
-
246
- ```bash
247
- # Clone the repository
248
- git clone <repository-url>
249
- cd ai-devkit
250
-
251
- # Install dependencies
252
- npm install
253
-
254
- # Run in development mode
255
- npm run dev init
256
-
257
- # Build
258
- npm run build
259
-
260
- # Test locally
261
- npm link
262
- ai-devkit init
263
- ```
264
-
265
- > **Note:** `ai-devkit init` now ensures the current directory is a git repository. If git is available and the repo isn't initialized, it will run `git init` automatically.
266
-
267
- ## Contributing
268
-
269
- Contributions are welcome! Please feel free to submit issues and pull requests.
270
-
271
- ## License
272
-
273
- MIT
274
-
275
- ---
276
-
277
- **Happy building with AI! 🚀**
278
-
279
- ## Quick Reference
280
-
281
- | Task | Command |
282
- |------|---------|
283
- | Initialize everything | `npx ai-devkit init --all` |
284
- | Initialize for Cursor | `npx ai-devkit init --environment cursor` |
285
- | Add specific phases | `npx ai-devkit init --phases requirements,design` |
286
- | Add one phase later | `npx ai-devkit phase testing` |
287
- | Guided feature workflow | `/new-requirement` (Cursor & Claude) |
288
- | Execute feature plan | `/execute-plan` (Cursor & Claude) |
289
- | Generate tests | `/writing-test` (Cursor & Claude) |
290
- | Local code review | `/code-review` (Cursor & Claude) |
291
- | Help | `npx ai-devkit --help` |
292
-
293
- | Quick links | Description |
294
- |-------------|-------------|
295
- | [CHANGELOG.md](CHANGELOG.md) | Recent changes and release notes |
296
- | [templates/](templates/) | Phase and environment templates |
297
-
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Config.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/lib/Config.test.ts"],"names":[],"mappings":""}
@@ -1,281 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- const fs = __importStar(require("fs-extra"));
37
- const path = __importStar(require("path"));
38
- const Config_1 = require("../../lib/Config");
39
- jest.mock('fs-extra');
40
- jest.mock('path');
41
- jest.mock('../../../package.json', () => ({
42
- version: '1.0.0'
43
- }));
44
- describe('ConfigManager', () => {
45
- let configManager;
46
- let mockFs;
47
- let mockPath;
48
- beforeEach(() => {
49
- configManager = new Config_1.ConfigManager('/test/dir');
50
- mockFs = fs;
51
- mockPath = path;
52
- mockPath.join.mockImplementation((...args) => args.join('/'));
53
- });
54
- afterEach(() => {
55
- jest.clearAllMocks();
56
- });
57
- describe('constructor', () => {
58
- it('should set correct config path', () => {
59
- expect(mockPath.join).toHaveBeenCalledWith('/test/dir', '.ai-devkit.json');
60
- });
61
- it('should use current directory as default', () => {
62
- const defaultConfig = new Config_1.ConfigManager();
63
- expect(mockPath.join).toHaveBeenCalledWith(process.cwd(), '.ai-devkit.json');
64
- });
65
- });
66
- describe('exists', () => {
67
- it('should return true when config file exists', async () => {
68
- mockFs.pathExists.mockResolvedValue(true);
69
- const result = await configManager.exists();
70
- expect(result).toBe(true);
71
- expect(mockFs.pathExists).toHaveBeenCalledWith('/test/dir/.ai-devkit.json');
72
- });
73
- it('should return false when config file does not exist', async () => {
74
- mockFs.pathExists.mockResolvedValue(false);
75
- const result = await configManager.exists();
76
- expect(result).toBe(false);
77
- });
78
- });
79
- describe('read', () => {
80
- it('should return parsed config when file exists', async () => {
81
- const mockConfig = {
82
- version: '1.0.0',
83
- environments: ['cursor'],
84
- initializedPhases: ['requirements'],
85
- createdAt: '2024-01-01T00:00:00.000Z',
86
- updatedAt: '2024-01-01T00:00:00.000Z'
87
- };
88
- mockFs.pathExists.mockResolvedValue(true);
89
- mockFs.readJson.mockResolvedValue(mockConfig);
90
- const result = await configManager.read();
91
- expect(result).toEqual(mockConfig);
92
- expect(mockFs.readJson).toHaveBeenCalledWith('/test/dir/.ai-devkit.json');
93
- });
94
- it('should return null when file does not exist', async () => {
95
- mockFs.pathExists.mockResolvedValue(false);
96
- const result = await configManager.read();
97
- expect(result).toBeNull();
98
- expect(mockFs.readJson).not.toHaveBeenCalled();
99
- });
100
- });
101
- describe('create', () => {
102
- it('should create config with default values', async () => {
103
- const expectedConfig = {
104
- version: '1.0.0',
105
- environments: [],
106
- initializedPhases: [],
107
- createdAt: expect.any(String),
108
- updatedAt: expect.any(String)
109
- };
110
- mockFs.writeJson.mockResolvedValue(undefined);
111
- const result = await configManager.create();
112
- expect(result).toEqual(expectedConfig);
113
- expect(mockFs.writeJson).toHaveBeenCalledWith('/test/dir/.ai-devkit.json', expectedConfig, { spaces: 2 });
114
- });
115
- });
116
- describe('update', () => {
117
- it('should update existing config and set updatedAt', async () => {
118
- const existingConfig = {
119
- version: '1.0.0',
120
- environments: ['cursor'],
121
- initializedPhases: [],
122
- createdAt: '2024-01-01T00:00:00.000Z',
123
- updatedAt: '2024-01-01T00:00:00.000Z'
124
- };
125
- const updates = { environments: ['cursor', 'claude'] };
126
- mockFs.pathExists.mockResolvedValue(true);
127
- mockFs.readJson.mockResolvedValue(existingConfig);
128
- mockFs.writeJson.mockResolvedValue(undefined);
129
- const result = await configManager.update(updates);
130
- expect(result.environments).toEqual(['cursor', 'claude']);
131
- expect(result.updatedAt).not.toBe(existingConfig.updatedAt);
132
- expect(result.createdAt).toBe(existingConfig.createdAt);
133
- });
134
- it('should throw error when config file not found', async () => {
135
- mockFs.readJson.mockResolvedValue(null);
136
- await expect(configManager.update({})).rejects.toThrow('Config file not found. Run ai-devkit init first.');
137
- });
138
- });
139
- describe('addPhase', () => {
140
- it('should add new phase to initializedPhases', async () => {
141
- const config = {
142
- version: '1.0.0',
143
- environments: [],
144
- initializedPhases: ['requirements'],
145
- createdAt: '2024-01-01T00:00:00.000Z',
146
- updatedAt: '2024-01-01T00:00:00.000Z'
147
- };
148
- mockFs.pathExists.mockResolvedValue(true);
149
- mockFs.readJson.mockResolvedValue(config);
150
- mockFs.writeJson.mockResolvedValue(undefined);
151
- const result = await configManager.addPhase('design');
152
- expect(result.initializedPhases).toEqual(['requirements', 'design']);
153
- });
154
- it('should not add duplicate phase', async () => {
155
- const config = {
156
- version: '1.0.0',
157
- environments: [],
158
- initializedPhases: ['requirements'],
159
- createdAt: '2024-01-01T00:00:00.000Z',
160
- updatedAt: '2024-01-01T00:00:00.000Z'
161
- };
162
- mockFs.pathExists.mockResolvedValue(true);
163
- mockFs.readJson.mockResolvedValue(config);
164
- const result = await configManager.addPhase('requirements');
165
- expect(result.initializedPhases).toEqual(['requirements']);
166
- expect(mockFs.writeJson).not.toHaveBeenCalled();
167
- });
168
- });
169
- describe('hasPhase', () => {
170
- it('should return true when phase exists', async () => {
171
- const config = {
172
- version: '1.0.0',
173
- environments: [],
174
- initializedPhases: ['requirements', 'design'],
175
- createdAt: '2024-01-01T00:00:00.000Z',
176
- updatedAt: '2024-01-01T00:00:00.000Z'
177
- };
178
- mockFs.pathExists.mockResolvedValue(true);
179
- mockFs.readJson.mockResolvedValue(config);
180
- const result = await configManager.hasPhase('design');
181
- expect(result).toBe(true);
182
- });
183
- it('should return false when phase does not exist', async () => {
184
- const config = {
185
- version: '1.0.0',
186
- environments: [],
187
- initializedPhases: ['requirements'],
188
- createdAt: '2024-01-01T00:00:00.000Z',
189
- updatedAt: '2024-01-01T00:00:00.000Z'
190
- };
191
- mockFs.pathExists.mockResolvedValue(true);
192
- mockFs.readJson.mockResolvedValue(config);
193
- const result = await configManager.hasPhase('design');
194
- expect(result).toBe(false);
195
- });
196
- it('should return false when config does not exist', async () => {
197
- mockFs.pathExists.mockResolvedValue(false);
198
- const result = await configManager.hasPhase('requirements');
199
- expect(result).toBe(false);
200
- });
201
- });
202
- describe('getEnvironments', () => {
203
- it('should return environments array when config exists', async () => {
204
- const config = {
205
- version: '1.0.0',
206
- environments: ['cursor', 'claude'],
207
- initializedPhases: [],
208
- createdAt: '2024-01-01T00:00:00.000Z',
209
- updatedAt: '2024-01-01T00:00:00.000Z'
210
- };
211
- mockFs.pathExists.mockResolvedValue(true);
212
- mockFs.readJson.mockResolvedValue(config);
213
- const result = await configManager.getEnvironments();
214
- expect(result).toEqual(['cursor', 'claude']);
215
- });
216
- it('should return empty array when config does not exist', async () => {
217
- mockFs.pathExists.mockResolvedValue(false);
218
- const result = await configManager.getEnvironments();
219
- expect(result).toEqual([]);
220
- });
221
- it('should return empty array when environments field is missing', async () => {
222
- const config = {
223
- version: '1.0.0',
224
- environments: [],
225
- initializedPhases: [],
226
- createdAt: '2024-01-01T00:00:00.000Z',
227
- updatedAt: '2024-01-01T00:00:00.000Z'
228
- };
229
- mockFs.pathExists.mockResolvedValue(true);
230
- mockFs.readJson.mockResolvedValue(config);
231
- const result = await configManager.getEnvironments();
232
- expect(result).toEqual([]);
233
- });
234
- });
235
- describe('setEnvironments', () => {
236
- it('should update environments and return config', async () => {
237
- const config = {
238
- version: '1.0.0',
239
- environments: ['cursor'],
240
- initializedPhases: [],
241
- createdAt: '2024-01-01T00:00:00.000Z',
242
- updatedAt: '2024-01-01T00:00:00.000Z'
243
- };
244
- mockFs.pathExists.mockResolvedValue(true);
245
- mockFs.readJson.mockResolvedValue(config);
246
- mockFs.writeJson.mockResolvedValue(undefined);
247
- const result = await configManager.setEnvironments(['cursor', 'claude']);
248
- expect(result.environments).toEqual(['cursor', 'claude']);
249
- expect(mockFs.writeJson).toHaveBeenCalled();
250
- });
251
- });
252
- describe('hasEnvironment', () => {
253
- it('should return true when environment exists', async () => {
254
- const config = {
255
- version: '1.0.0',
256
- environments: ['cursor', 'claude'],
257
- initializedPhases: [],
258
- createdAt: '2024-01-01T00:00:00.000Z',
259
- updatedAt: '2024-01-01T00:00:00.000Z'
260
- };
261
- mockFs.pathExists.mockResolvedValue(true);
262
- mockFs.readJson.mockResolvedValue(config);
263
- const result = await configManager.hasEnvironment('claude');
264
- expect(result).toBe(true);
265
- });
266
- it('should return false when environment does not exist', async () => {
267
- const config = {
268
- version: '1.0.0',
269
- environments: ['cursor'],
270
- initializedPhases: [],
271
- createdAt: '2024-01-01T00:00:00.000Z',
272
- updatedAt: '2024-01-01T00:00:00.000Z'
273
- };
274
- mockFs.pathExists.mockResolvedValue(true);
275
- mockFs.readJson.mockResolvedValue(config);
276
- const result = await configManager.hasEnvironment('claude');
277
- expect(result).toBe(false);
278
- });
279
- });
280
- });
281
- //# sourceMappingURL=Config.test.js.map