@anatolykoptev/krolik-cli 0.1.0 → 0.1.3

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
@@ -1,479 +1,168 @@
1
- # KROLIK CLI
2
-
3
- [![CI](https://github.com/anatolykoptev/krolik-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/anatolykoptev/krolik-cli/actions/workflows/ci.yml)
4
- [![codecov](https://codecov.io/gh/anatolykoptev/krolik-cli/branch/main/graph/badge.svg)](https://codecov.io/gh/anatolykoptev/krolik-cli)
5
- [![npm version](https://badge.fury.io/js/%40anatolykoptev%2Fkrolik-cli.svg)](https://badge.fury.io/js/%40anatolykoptev%2Fkrolik-cli)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1
+ <div align="center">
7
2
 
8
3
  ```
9
- (\(\
10
- (-.-)
11
- o_(")(")
12
- ```
13
-
14
- Fast AI-assisted development toolkit for TypeScript projects.
15
-
16
- ## Features
17
-
18
- - **Project Status** — Quick diagnostics (git, types, lint, TODOs)
19
- - **Code Quality** — Analyze code for SRP, complexity, type-safety, lint issues
20
- - **Auto-Fix** — Automatically fix code issues (Biome + TypeScript + custom)
21
- - **Code Review** — AI-assisted review of changes
22
- - **Schema Analysis** — Prisma schema documentation
23
- - **Routes Analysis** — tRPC routes documentation
24
- - **Issue Parser** — GitHub issue parsing for AI context
25
- - **Context Generator** — Generate AI context for tasks
26
- - **Code Generation** — Hooks, schemas, tests, barrels, docs
27
- - **Security Audit** — Check for vulnerabilities
28
- - **MCP Server** — Claude Code integration
29
- - **Plugin Setup** — Install Claude Code plugins (claude-mem, etc.)
30
-
31
- ## Installation
32
-
33
- ```bash
34
- # Global install
35
- npm install -g krolik-cli
36
-
37
- # Or as a dev dependency
38
- pnpm add -D krolik-cli
39
- ```
40
-
41
- ## Quick Start
42
-
43
- ```bash
44
- # Initialize config
45
- krolik init
46
-
47
- # Quick project status
48
- krolik status
49
-
50
- # Status without slow checks
51
- krolik status --fast
52
-
53
- # Review current branch changes
54
- krolik review
55
-
56
- # Analyze Prisma schema
57
- krolik schema --save
58
-
59
- # Analyze tRPC routes
60
- krolik routes --save
61
-
62
- # Parse GitHub issue
63
- krolik issue 123
64
-
65
- # Generate code
66
- krolik codegen hooks
67
- krolik codegen schemas
68
- krolik codegen tests
69
-
70
- # Code quality analysis
71
- krolik quality
72
- krolik quality --ai # AI-friendly XML output
73
-
74
- # Auto-fix issues
75
- krolik fix # Full pipeline
76
- krolik fix --dry-run # Preview changes
77
-
78
- # Security audit
79
- krolik security
80
-
81
- # Start MCP server
82
- krolik mcp
83
-
84
- # Install Claude Code plugins (claude-mem, etc.)
85
- krolik setup
4
+ (\(\
5
+ (-.-)
6
+ o_(")(")
86
7
  ```
87
8
 
88
- ## Configuration
89
-
90
- Create `krolik.config.ts` or `krolik.yaml` in your project root.
91
-
92
- ### TypeScript Config
9
+ ### AI-First Development Toolkit for TypeScript
93
10
 
94
- ```typescript
95
- import { defineConfig } from 'krolik-cli';
96
-
97
- export default defineConfig({
98
- name: 'my-project',
99
- paths: {
100
- web: 'apps/web',
101
- api: 'packages/api',
102
- db: 'packages/db',
103
- },
104
- features: {
105
- prisma: true,
106
- trpc: true,
107
- nextjs: true,
108
- },
109
- prisma: {
110
- schemaDir: 'packages/db/prisma/schema',
111
- },
112
- trpc: {
113
- routersDir: 'packages/api/src/routers',
114
- },
115
- // Custom domains for context generation
116
- domains: {
117
- crm: {
118
- keywords: ['customer', 'lead', 'contact'],
119
- approach: ['Check CRM module', 'Review customer schema'],
120
- },
121
- },
122
- });
123
- ```
11
+ [![CI](https://github.com/anatolykoptev/krolik-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/anatolykoptev/krolik-cli/actions/workflows/ci.yml)
12
+ [![npm version](https://img.shields.io/npm/v/@anatolykoptev/krolik-cli.svg?style=flat&colorA=18181B&colorB=28CF8D)](https://www.npmjs.com/package/@anatolykoptev/krolik-cli)
13
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat&colorA=18181B&colorB=28CF8D)](https://opensource.org/licenses/MIT)
124
14
 
125
- ### YAML Config
126
-
127
- ```yaml
128
- # krolik.yaml
129
- name: my-project
130
-
131
- paths:
132
- web: apps/web
133
- api: packages/api
134
- db: packages/db
135
-
136
- features:
137
- prisma: true
138
- trpc: true
139
- nextjs: true
140
-
141
- prisma:
142
- schemaDir: packages/db/prisma/schema
143
-
144
- trpc:
145
- routersDir: packages/api/src/routers
146
-
147
- # Custom domains for context generation
148
- domains:
149
- crm:
150
- keywords:
151
- - customer
152
- - lead
153
- - contact
154
- approach:
155
- - Check CRM module
156
- - Review customer schema
157
- ```
15
+ [Get Started](#installation) · [Commands](#commands) · [MCP Server](#mcp-server)
158
16
 
159
- ## Auto-Detection
17
+ </div>
160
18
 
161
- Krolik automatically detects:
19
+ ---
162
20
 
163
- - **Monorepo** — pnpm-workspace.yaml, npm/yarn workspaces
164
- - **Prisma** — @prisma/client dependency, schema location
165
- - **tRPC** — @trpc/server dependency, routers location
166
- - **Next.js** — next dependency
167
- - **TypeScript** — typescript dependency, tsconfig.json
21
+ ## Why Krolik?
168
22
 
169
- ## Commands Reference
23
+ AI assistants spend most of their time gathering context. Every session starts with "let me search the codebase..." followed by dozens of file reads.
170
24
 
171
- ### Global Options
25
+ **Krolik gives AI everything it needs in 1-2 seconds.**
172
26
 
173
27
  ```bash
174
- krolik [command] [options]
175
- -V, --version Output version number
176
- -c, --config <path> Path to config file
177
- --project-root <path> Project root directory
178
- --cwd <path> Alias for --project-root
179
- -t, --text Human-readable text output (default: AI-friendly XML)
180
- --json Output as JSON
181
- -v, --verbose Verbose output
182
- --no-color Disable colored output
28
+ npm i -g @anatolykoptev/krolik-cli
183
29
  ```
184
30
 
185
31
  ---
186
32
 
187
- ### `krolik status`
188
-
189
- Quick project diagnostics: git, typecheck, lint, TODOs.
190
-
191
- ```bash
192
- krolik status # Full diagnostics
193
- krolik status --fast # Skip slow checks (typecheck, lint)
194
- krolik status --report # Generate AI-REPORT.md with code quality analysis
195
- ```
196
-
197
- ---
33
+ ## Commands
198
34
 
199
- ### `krolik fix`
35
+ ### `krolik context` — Stop Searching, Start Coding
200
36
 
201
- Auto-fix code quality issues. **Replaces deprecated `quality` command.**
37
+ One command replaces 10+ manual searches. AI gets complete project context instantly.
202
38
 
203
39
  ```bash
204
- # Analysis modes
205
- krolik fix --analyze-only # Analyze only (no fixes)
206
- krolik fix --dry-run # Show what would be fixed
207
- krolik fix --dry-run --diff # Show unified diff preview
208
-
209
- # Execution
210
- krolik fix # Apply all safe fixes
211
- krolik fix --yes # Auto-confirm all fixes
212
- krolik fix --path <path> # Fix specific directory
213
- krolik fix --limit <n> # Max fixes to apply
214
- krolik fix --backup # Create backup before fixing
215
-
216
- # Fix scope
217
- krolik fix --trivial # Only trivial (console, debugger)
218
- krolik fix --safe # Trivial + safe (excludes risky)
219
- krolik fix --all # Include risky fixers (requires confirmation)
220
-
221
- # Tool selection
222
- krolik fix --biome # Run Biome auto-fix (default)
223
- krolik fix --biome-only # Only Biome, skip custom
224
- krolik fix --no-biome # Skip Biome
225
- krolik fix --typecheck # Run TypeScript check (default)
226
- krolik fix --typecheck-only # Only TypeScript check
227
- krolik fix --no-typecheck # Skip TypeScript check
228
-
229
- # Category filtering
230
- krolik fix --category lint # Only lint issues
231
- krolik fix --category type-safety # Only type-safety issues
232
- krolik fix --category complexity # Only complexity issues
233
-
234
- # Individual fixers
235
- krolik fix --fix-console # Fix console.log
236
- krolik fix --fix-debugger # Fix debugger statements
237
- krolik fix --fix-alert # Fix alert() calls
238
- krolik fix --fix-ts-ignore # Fix @ts-ignore
239
- krolik fix --fix-any # Fix `any` types
240
- krolik fix --fix-complexity # Fix high complexity
241
- krolik fix --fix-long-functions # Fix long functions
242
- krolik fix --fix-magic-numbers # Fix magic numbers
243
- krolik fix --fix-urls # Fix hardcoded URLs
244
- krolik fix --fix-srp # Fix SRP violations
245
-
246
- # Disable fixers
247
- krolik fix --no-console # Skip console fixes
248
- krolik fix --no-debugger # Skip debugger fixes
249
- krolik fix --no-any # Skip any type fixes
250
-
251
- # Reports
252
- krolik fix --list-fixers # List all available fixers
253
- # For AI reports use: krolik status --report
40
+ krolik context --feature auth # Everything about auth feature
41
+ krolik context --issue 42 # Context from GitHub issue
42
+ krolik context --quick # Fast mode for simple tasks
254
43
  ```
255
44
 
256
- **Fix Categories:**
257
- - `lint` — console, debugger, alert statements
258
- - `type-safety` — any, @ts-ignore, eval, loose equality
259
- - `complexity` — high cyclomatic complexity, long functions
260
- - `hardcoded` — magic numbers, hardcoded URLs
261
- - `srp` — single responsibility violations
45
+ **What it collects**: git state, database schema, API routes, project structure, types, past decisions, library docs.
262
46
 
263
47
  ---
264
48
 
265
- ### `krolik context`
49
+ ### `krolik mem` — Remember Across Sessions
266
50
 
267
- Generate AI-friendly context for tasks.
51
+ AI forgets everything between sessions. Krolik remembers.
268
52
 
269
53
  ```bash
270
- krolik context --feature <name> # Context for feature (e.g., "booking", "crm")
271
- krolik context --issue <number> # Context from GitHub issue
272
- krolik context --file <path> # Context for specific file
273
- krolik context --include-code # Include Zod schemas and code snippets
274
- krolik context --domain-history # Include git history for domain files
275
- krolik context --show-deps # Show domain dependencies
276
- krolik context --full # Enable all enrichment options
54
+ krolik mem save --type decision --title "Use tRPC" --description "Type-safe API"
55
+ krolik mem search --query "authentication"
56
+ krolik mem recent --limit 5
277
57
  ```
278
58
 
279
- ---
280
-
281
- ### `krolik review`
59
+ **Memory types**: decisions, patterns, bugfixes, observations, features.
282
60
 
283
- AI-assisted code review.
284
-
285
- ```bash
286
- krolik review # Review current branch vs main
287
- krolik review --staged # Review staged changes only
288
- krolik review --pr <number> # Review specific PR
289
- ```
61
+ Memories are automatically included in context — AI sees what was decided before.
290
62
 
291
63
  ---
292
64
 
293
- ### `krolik schema`
65
+ ### `krolik audit` — Find All Quality Issues
294
66
 
295
- Analyze Prisma schema.
67
+ Analyzes entire codebase and creates a prioritized report.
296
68
 
297
69
  ```bash
298
- krolik schema # Print to stdout (AI-friendly XML)
299
- krolik schema --save # Save to SCHEMA.md
300
- krolik schema --json # JSON output
70
+ krolik audit
301
71
  ```
302
72
 
303
- ---
304
-
305
- ### `krolik routes`
306
-
307
- Analyze tRPC routes.
308
-
309
- ```bash
310
- krolik routes # Print to stdout (AI-friendly XML)
311
- krolik routes --save # Save to ROUTES.md
312
- krolik routes --json # JSON output
313
- ```
73
+ **Output**: `.krolik/AI-REPORT.md` with issues ranked by severity, files with most problems, and quick wins that can be auto-fixed.
314
74
 
315
75
  ---
316
76
 
317
- ### `krolik issue [number]`
77
+ ### `krolik fix` — Auto-Fix Quality Issues
318
78
 
319
- Parse GitHub issue for AI context.
79
+ Fixes what can be fixed automatically. Shows what needs manual attention.
320
80
 
321
81
  ```bash
322
- krolik issue 123 # Parse issue by number
323
- krolik issue --url <url> # Parse issue by URL
82
+ krolik fix --dry-run # Preview changes
83
+ krolik fix # Apply safe fixes
84
+ krolik fix --all # Include risky fixes
324
85
  ```
325
86
 
326
- ---
327
-
328
- ### `krolik codegen <target>`
329
-
330
- Generate code artifacts.
331
-
332
- ```bash
333
- krolik codegen hooks # Generate React hooks
334
- krolik codegen schemas # Generate Zod schemas
335
- krolik codegen tests # Generate test files
336
- krolik codegen barrels # Generate index.ts exports
337
- krolik codegen docs # Generate documentation
338
-
339
- # Options
340
- krolik codegen <target> --path <path> # Target path
341
- krolik codegen <target> --dry-run # Preview without changes
342
- krolik codegen <target> --force # Overwrite existing files
343
- ```
87
+ **What it fixes**: console.log, debugger, any types, @ts-ignore, magic numbers, complexity issues, and more.
344
88
 
345
89
  ---
346
90
 
347
- ### `krolik refine`
91
+ ### `krolik refactor` — Find Duplicates
348
92
 
349
- Analyze and reorganize lib/ structure to @namespace pattern.
93
+ Finds duplicate functions and types across the codebase.
350
94
 
351
95
  ```bash
352
- krolik refine # Analyze lib/ structure
353
- krolik refine --lib-path <path> # Custom lib directory
354
- krolik refine --dry-run # Preview changes
355
- krolik refine --apply # Apply migration (move dirs, update imports)
356
- krolik refine --generate-config # Generate ai-config.ts
96
+ krolik refactor # Find duplicates
97
+ krolik refactor --apply # Apply suggested migrations
357
98
  ```
358
99
 
359
- ---
360
-
361
- ### `krolik security`
362
-
363
- Run security audit.
364
-
365
- ```bash
366
- krolik security # Audit dependencies
367
- krolik security --fix # Attempt to fix vulnerabilities
368
- ```
100
+ **Output**: List of duplicates with locations, suggested consolidation points, migration plan.
369
101
 
370
102
  ---
371
103
 
372
- ### `krolik mcp`
104
+ ### `krolik agent` — Run Specialized AI Agents
373
105
 
374
- Start MCP server for Claude Code integration (stdio transport).
106
+ Run expert agents for specific tasks: security audit, performance review, architecture analysis.
375
107
 
376
108
  ```bash
377
- krolik mcp # Start MCP server
109
+ krolik agent --list # Available agents
110
+ krolik agent security-auditor # Run specific agent
111
+ krolik agent --orchestrate --task "review" # Multi-agent mode
378
112
  ```
379
113
 
380
- **Setup in Claude Code:**
381
-
382
- ```bash
383
- claude mcp add krolik -- npx krolik mcp
384
- ```
114
+ **12 categories**: security, performance, architecture, quality, debugging, docs, frontend, backend, database, devops, testing, other.
385
115
 
386
- Or add to `.claude/settings.json`:
387
-
388
- ```json
389
- {
390
- "mcpServers": {
391
- "krolik": {
392
- "command": "npx",
393
- "args": ["krolik", "mcp"],
394
- "cwd": "/path/to/your/project"
395
- }
396
- }
397
- }
398
- ```
116
+ ---
399
117
 
400
- **Available MCP Tools:**
118
+ ### Other Commands
401
119
 
402
- | Tool | Description |
403
- |------|-------------|
404
- | `krolik_status` | Project diagnostics (git, typecheck, lint, TODOs) |
405
- | `krolik_context` | AI context generation for features/issues |
406
- | `krolik_schema` | Prisma schema analysis |
407
- | `krolik_routes` | tRPC routes analysis |
408
- | `krolik_review` | Code review for changes |
409
- | `krolik_issue` | GitHub issue parsing |
120
+ | Command | What it does |
121
+ |---------|--------------|
122
+ | `krolik status` | Quick health check: git, types, lint, TODOs |
123
+ | `krolik schema` | Database schema as structured docs |
124
+ | `krolik routes` | API routes as structured docs |
125
+ | `krolik review` | Code review for current changes |
126
+ | `krolik docs` | Search library documentation |
410
127
 
411
128
  ---
412
129
 
413
- ### `krolik setup`
130
+ ## MCP Server
414
131
 
415
- Install recommended Claude Code plugins.
132
+ Native integration with Claude Code via [Model Context Protocol](https://modelcontextprotocol.io).
416
133
 
417
134
  ```bash
418
- krolik setup # Install all recommended plugins
419
- krolik setup --list # List available plugins
420
- krolik setup --mem # Install only claude-mem
421
- krolik setup --dry-run # Preview without installing
422
- krolik setup --force # Reinstall even if already installed
135
+ claude mcp add krolik -- npx @anatolykoptev/krolik-cli mcp
423
136
  ```
424
137
 
425
- **Available Plugins:**
426
-
427
- | Plugin | Description |
428
- |--------|-------------|
429
- | `claude-mem` | Persistent memory for Claude Code sessions — saves context across sessions, semantic search over history |
430
-
431
- **What `krolik setup` does:**
432
-
433
- 1. Clones plugin from GitHub
434
- 2. Installs dependencies (`npm install`)
435
- 3. Builds the plugin (`npm run build`)
436
- 4. Registers in Claude Code (`~/.claude/plugins/`)
437
- 5. Creates data directories
438
-
439
- **After installation:**
440
-
441
- - Restart Claude Code to activate plugins
442
- - Web UI available at http://localhost:37777 (for claude-mem)
443
- - Context automatically injected at session start
444
- - Search with natural language: "What did we do yesterday?"
138
+ All commands available as tools. Claude can use them directly during conversation.
445
139
 
446
140
  ---
447
141
 
448
- ### `krolik init`
449
-
450
- Initialize krolik.config.ts in project root.
451
-
452
- ```bash
453
- krolik init # Interactive config setup
454
- ```
142
+ ## Configuration
455
143
 
456
- ## Environment Variables
144
+ Works out of the box for most projects. Customize if needed:
457
145
 
458
- | Variable | Description | Default |
459
- |----------|-------------|---------|
460
- | `KROLIK_CONFIG` | Config file path | Auto-detected |
461
- | `KROLIK_PROJECT_ROOT` | Project root | Current directory |
462
- | `KROLIK_LOG_LEVEL` | Log level (debug/info/warn/error) | info |
146
+ ```typescript
147
+ // krolik.config.ts
148
+ import { defineConfig } from '@anatolykoptev/krolik-cli';
463
149
 
464
- ## Programmatic Usage
150
+ export default defineConfig({
151
+ name: 'my-project',
152
+ paths: {
153
+ web: 'apps/web',
154
+ api: 'packages/api',
155
+ },
156
+ });
157
+ ```
465
158
 
466
- ```typescript
467
- import { loadConfig, createLogger, runStatus } from 'krolik-cli';
159
+ ---
468
160
 
469
- async function main() {
470
- const config = await loadConfig();
471
- const logger = createLogger();
161
+ ## Requirements
472
162
 
473
- await runStatus({ config, logger, options: { fast: true } });
474
- }
475
- ```
163
+ - Node.js >= 20.0.0
164
+ - TypeScript >= 5.0.0
476
165
 
477
166
  ## License
478
167
 
479
- MIT
168
+ [MIT](LICENSE) © Anatoly Koptev