@mikulgohil/ai-kit 1.9.0 → 1.11.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 CHANGED
@@ -123,13 +123,17 @@ Structured AI workflows applied automatically — the AI recognizes what you're
123
123
 
124
124
  ### Automated Quality Hooks
125
125
 
126
- | Profile | What Runs Automatically |
126
+ | Hook | What It Does |
127
127
  |---|---|
128
- | **Minimal** | Auto-format + git push safety |
129
- | **Standard** | + TypeScript type-check + console.log warnings + mistakes auto-capture + bundle impact warning |
130
- | **Strict** | + ESLint check + stop-time console.log audit + pre-commit AI review + bundle impact warning |
128
+ | **Session Init** | Echoes project stack, package manager, available scripts, and last scan date at every session start — the AI has full context from the first prompt |
129
+ | **Auto-format** | Formats files on edit via Prettier or Biome |
130
+ | **TypeScript check** | Catches type errors after every edit (standard + strict) |
131
+ | **Console.log warning** | Catches debug statements before commit (standard + strict) |
132
+ | **Mistakes auto-capture** | Logs build/lint failures to `docs/mistakes-log.md` automatically (standard + strict) |
133
+ | **Pre-commit review** | Checks for `any` types, console.logs, and TODOs without tickets in staged files (strict) |
134
+ | **Context re-echo** | After context compaction in long sessions, re-echoes tech stack (standard + strict) |
131
135
 
132
- **Mistakes auto-capture** When a build/lint command fails, the hook logs the error to `docs/mistakes-log.md` with timestamp and error preview. The mistakes log builds itself over time.
136
+ Three strictness profiles: **Minimal** (format + git safety), **Standard** (+ typecheck + warnings + mistakes), **Strict** (+ ESLint + pre-commit review).
133
137
 
134
138
  <br />
135
139
 
@@ -180,7 +184,9 @@ Period summaries, budget progress with alerts, per-project cost breakdown, week-
180
184
  | Command | Description |
181
185
  |---|---|
182
186
  | `ai-kit init [path]` | Scan project and generate all configs |
183
- | `ai-kit update [path]` | Re-scan and update generated files (safe merge) |
187
+ | `ai-kit update [path]` | Re-scan and update generated files (safe merge, auto-backup) |
188
+ | `ai-kit migrate [path]` | Adopt ai-kit in a project with existing CLAUDE.md — preserves custom rules |
189
+ | `ai-kit rollback [path]` | Restore configs from a previous backup created by `update` |
184
190
  | `ai-kit reset [path]` | Remove all AI Kit generated files |
185
191
  | `ai-kit health [path]` | One-glance A-F project health dashboard |
186
192
  | `ai-kit audit [path]` | Security and configuration health audit |
@@ -299,7 +305,25 @@ When your project evolves:
299
305
  npx @mikulgohil/ai-kit update
300
306
  ```
301
307
 
302
- Only content between `AI-KIT:START/END` markers is refreshed. Your custom rules and manual edits are preserved.
308
+ Every update **automatically backs up** your current configs to `.ai-kit/backups/` before writing. Only content between `AI-KIT:START/END` markers is refreshed your custom rules and manual edits are preserved.
309
+
310
+ If something goes wrong, roll back instantly:
311
+
312
+ ```bash
313
+ npx @mikulgohil/ai-kit rollback # Pick from available backups
314
+ npx @mikulgohil/ai-kit rollback --latest # Restore most recent backup
315
+ ```
316
+
317
+ ### Migrating an Existing Project
318
+
319
+ Already have a hand-written `CLAUDE.md`? Migrate without losing your custom rules:
320
+
321
+ ```bash
322
+ npx @mikulgohil/ai-kit migrate # Interactive — shows preview, asks confirmation
323
+ npx @mikulgohil/ai-kit migrate --dry-run # Preview changes without writing
324
+ ```
325
+
326
+ Your custom sections are placed at the top of the file. AI Kit's generated rules go inside `AI-KIT:START/END` markers below. Future `ai-kit update` only touches the marked section — your rules are preserved forever.
303
327
 
304
328
  ---
305
329
 
@@ -317,7 +341,7 @@ Only content between `AI-KIT:START/END` markers is refreshed. Your custom rules
317
341
 
318
342
  ## Requirements
319
343
 
320
- - Node.js 18+
344
+ - Node.js 20+
321
345
  - A project with `package.json`
322
346
  - Claude Code or Cursor (at least one AI tool)
323
347
 
@@ -330,7 +354,7 @@ Full documentation at **[ai-kit.mikul.me](https://ai-kit.mikul.me)**
330
354
  | Page | What You'll Learn |
331
355
  |---|---|
332
356
  | [Getting Started](https://ai-kit.mikul.me/getting-started) | Step-by-step setup walkthrough |
333
- | [CLI Reference](https://ai-kit.mikul.me/cli-reference) | All 14 commands with examples |
357
+ | [CLI Reference](https://ai-kit.mikul.me/cli-reference) | All 16 commands with examples |
334
358
  | [Skills & Commands](https://ai-kit.mikul.me/slash-commands) | All 48 skills with usage guides |
335
359
  | [What Gets Generated](https://ai-kit.mikul.me/what-gets-generated) | Detailed breakdown of every generated file |
336
360
  | [Hooks](https://ai-kit.mikul.me/hooks) | Hook profiles, mistakes auto-capture |
@@ -2,6 +2,8 @@
2
2
  name: build-resolver
3
3
  description: Build error resolution agent — diagnoses and fixes Next.js, TypeScript, and Sitecore build errors.
4
4
  tools: Read, Edit, Glob, Grep, Bash
5
+ isolation: worktree
6
+ initialPrompt: Run the build command from package.json and diagnose any errors found.
5
7
  ---
6
8
 
7
9
  # Build Error Resolver
@@ -2,6 +2,8 @@
2
2
  name: e2e-runner
3
3
  description: Playwright E2E test agent — generates and runs Playwright tests using Page Object Model for Next.js applications.
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash
5
+ isolation: worktree
6
+ initialPrompt: Analyze existing test coverage and identify critical user flows that need E2E tests.
5
7
  ---
6
8
 
7
9
  # E2E Test Runner
@@ -1,7 +1,9 @@
1
1
  ---
2
2
  name: migration-specialist
3
3
  description: Migration specialist agent — framework upgrades, breaking change detection, codemods, dependency migration, and incremental adoption strategies.
4
- tools: Read, Glob, Grep, Bash
4
+ tools: Read, Edit, Glob, Grep, Bash
5
+ isolation: worktree
6
+ initialPrompt: Audit the current dependency versions and identify available upgrades with breaking changes.
5
7
  ---
6
8
 
7
9
  # Migration Specialist
@@ -2,6 +2,8 @@
2
2
  name: refactor-cleaner
3
3
  description: Dead code cleanup and refactoring agent — finds unused exports, cleans imports, and removes dead code.
4
4
  tools: Read, Edit, Glob, Grep, Bash
5
+ isolation: worktree
6
+ initialPrompt: Scan for dead code and unused exports in this project using Knip or manual analysis.
5
7
  ---
6
8
 
7
9
  # Refactor & Cleanup Agent
@@ -0,0 +1,90 @@
1
+ # Fetch Docs
2
+
3
+ > **Role**: You are a documentation researcher. Your job is to fetch the latest, version-specific documentation for this project's tech stack and summarize it into the conversation context so all subsequent coding is informed by current APIs.
4
+ > **Goal**: Pre-load current documentation for the detected frameworks so the AI doesn't rely on potentially outdated training data.
5
+
6
+ ## Mandatory Steps
7
+
8
+ You MUST follow these steps in order. Do not skip any step.
9
+
10
+ 1. **Detect the Stack** — Read `ai-kit.config.json` (or `package.json` if config doesn't exist) to identify:
11
+ - Framework and version (e.g., Next.js 16.2.2)
12
+ - CMS and version (e.g., Sitecore Content SDK v2.x, Optimizely SaaS)
13
+ - Styling framework (e.g., Tailwind CSS v4)
14
+ - Any other key libraries in dependencies
15
+
16
+ 2. **Fetch Documentation** — For each detected framework, fetch current docs using the best available method:
17
+
18
+ **Next.js**:
19
+ - Primary: Use Context7 MCP → `resolve-library-id` for "next.js" → `query-docs` for the specific topic
20
+ - Fallback: WebFetch `https://nextjs.org/docs/llms-full.txt` (AI-optimized full docs)
21
+ - Focus on: App Router APIs, Server Components, Server Actions, Middleware, ISR, Turbopack (if v16+)
22
+
23
+ **Tailwind CSS**:
24
+ - Primary: Use Context7 MCP → `resolve-library-id` for "tailwindcss" → `query-docs`
25
+ - Focus on: v4 `@theme` syntax (if v4 detected), utility classes, responsive patterns, plugin API
26
+
27
+ **Sitecore XM Cloud / Content SDK**:
28
+ - Primary: Use Context7 MCP → `resolve-library-id` for "sitecore" → `query-docs`
29
+ - Fallback: Check project repo for `LLMs.txt` file
30
+ - Focus on: Component bindings, field helpers, Experience Edge GraphQL, personalization
31
+
32
+ **React**:
33
+ - Primary: Use Context7 MCP → `resolve-library-id` for "react" → `query-docs`
34
+ - Focus on: React 19 APIs (useActionState, use, Server Components), hooks rules
35
+
36
+ **Other libraries** (if specified in $ARGUMENTS):
37
+ - Use Context7 MCP → `resolve-library-id` → `query-docs`
38
+
39
+ 3. **Summarize Key APIs** — For each framework, produce a concise summary:
40
+ - Current stable version
41
+ - Key API changes since the AI's likely training cutoff
42
+ - API signatures for commonly used functions
43
+ - Breaking changes or deprecations to watch for
44
+ - Code examples from the official docs
45
+
46
+ 4. **Report What Was Loaded** — Print a summary table:
47
+
48
+ ## Output Format
49
+
50
+ ```
51
+ ## Documentation Loaded
52
+
53
+ | Framework | Version | Source | Key APIs Fetched |
54
+ |-----------|---------|--------|-----------------|
55
+ | Next.js | 16.2.x | Context7 | App Router, Server Actions, Turbopack |
56
+ | Tailwind | 4.x | Context7 | @theme syntax, utility classes |
57
+ | Sitecore | SDK v2.x | LLMs.txt | Field helpers, Experience Edge |
58
+
59
+ ## Key API Reference
60
+
61
+ ### Next.js 16
62
+ [Concise API reference with signatures and examples]
63
+
64
+ ### Tailwind CSS v4
65
+ [Key patterns and syntax differences from v3]
66
+
67
+ ### Sitecore Content SDK v2.x
68
+ [Component patterns and field helper usage]
69
+
70
+ ## What's New Since Training Cutoff
71
+ [Notable changes the AI might not know about]
72
+ ```
73
+
74
+ ## Rules
75
+
76
+ - ALWAYS check Context7 MCP first — it's the fastest and most reliable source
77
+ - If Context7 is not available, use WebFetch against official docs
78
+ - Keep summaries concise — focus on API signatures and patterns, not tutorials
79
+ - Highlight breaking changes and deprecations prominently
80
+ - If a specific library is passed as $ARGUMENTS, fetch docs for that library too
81
+ - Do NOT skip any detected framework — even if you think you know the APIs
82
+
83
+ ## When to Use This Skill
84
+
85
+ - At the **start of a coding session** — run once to pre-load context
86
+ - Before **major framework upgrades** — fetch docs for both current and target versions
87
+ - When you encounter **unexpected API behavior** — refresh docs for the specific library
88
+ - When working with **niche libraries** (Sitecore, Optimizely) that models know less about
89
+
90
+ Target: $ARGUMENTS