@dzhechkov/keysarium 1.0.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 (84) hide show
  1. package/README.md +289 -0
  2. package/bin/cli.js +5 -0
  3. package/package.json +43 -0
  4. package/src/cli.js +157 -0
  5. package/src/commands/doctor.js +469 -0
  6. package/src/commands/init.js +171 -0
  7. package/src/commands/list.js +147 -0
  8. package/src/commands/remove.js +197 -0
  9. package/src/commands/update.js +191 -0
  10. package/src/utils.js +274 -0
  11. package/templates/.claude/agents/cjm-variant-worker.md +60 -0
  12. package/templates/.claude/agents/discovery-worker.md +45 -0
  13. package/templates/.claude/agents/parallel-research-orchestrator.md +70 -0
  14. package/templates/.claude/agents/presentation-worker.md +55 -0
  15. package/templates/.claude/agents/research-worker.md +43 -0
  16. package/templates/.claude/commands/architecture-phase.md +37 -0
  17. package/templates/.claude/commands/casarium.md +163 -0
  18. package/templates/.claude/commands/cjm-prototype.md +42 -0
  19. package/templates/.claude/commands/discovery.md +34 -0
  20. package/templates/.claude/commands/explore-case.md +22 -0
  21. package/templates/.claude/commands/harvest.md +67 -0
  22. package/templates/.claude/commands/new-research.md +69 -0
  23. package/templates/.claude/commands/parallel-research.md +45 -0
  24. package/templates/.claude/commands/presentation.md +49 -0
  25. package/templates/.claude/commands/research.md +32 -0
  26. package/templates/.claude/commands/solve.md +36 -0
  27. package/templates/.claude/rules/agent-swarm.md +31 -0
  28. package/templates/.claude/rules/anti-patterns.md +19 -0
  29. package/templates/.claude/rules/checkpoint-protocol.md +23 -0
  30. package/templates/.claude/rules/domain-specific.md +32 -0
  31. package/templates/.claude/rules/file-conventions.md +38 -0
  32. package/templates/.claude/rules/modular-reuse.md +35 -0
  33. package/templates/.claude/rules/research-quality.md +20 -0
  34. package/templates/.claude/settings.json +37 -0
  35. package/templates/.claude/skills/explore/SKILL.md +215 -0
  36. package/templates/.claude/skills/explore/references/questioning-techniques.md +151 -0
  37. package/templates/.claude/skills/explore/references/task-brief-templates.md +355 -0
  38. package/templates/.claude/skills/frontend-design/LICENSE.txt +177 -0
  39. package/templates/.claude/skills/frontend-design/SKILL.md +42 -0
  40. package/templates/.claude/skills/goap-research-ed25519/SKILL.md +415 -0
  41. package/templates/.claude/skills/goap-research-ed25519/references/ed25519-verification.md +658 -0
  42. package/templates/.claude/skills/goap-research-ed25519/references/research-actions.md +544 -0
  43. package/templates/.claude/skills/goap-research-ed25519/references/source-evaluation.md +560 -0
  44. package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +662 -0
  45. package/templates/.claude/skills/goap-research-ed25519/scripts/goap_planner.py +720 -0
  46. package/templates/.claude/skills/presentation-storyteller/SKILL.md +371 -0
  47. package/templates/.claude/skills/presentation-storyteller/references/example-presentation.md +273 -0
  48. package/templates/.claude/skills/presentation-storyteller/references/slide-types.md +426 -0
  49. package/templates/.claude/skills/presentation-storyteller/references/sources-index-template.md +213 -0
  50. package/templates/.claude/skills/presentation-storyteller/references/speaker-script-patterns.md +324 -0
  51. package/templates/.claude/skills/presentation-storyteller/references/storytelling-frameworks.md +270 -0
  52. package/templates/.claude/skills/problem-solver-enhanced/SKILL.md +562 -0
  53. package/templates/.claude/skills/reverse-engineering-unicorn/SKILL.md +194 -0
  54. package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-cjm-example.md +100 -0
  55. package/templates/.claude/skills/reverse-engineering-unicorn/examples/noom-module1-example.md +88 -0
  56. package/templates/.claude/skills/reverse-engineering-unicorn/modules/01-intelligence.md +328 -0
  57. package/templates/.claude/skills/reverse-engineering-unicorn/modules/02-product-customers.md +221 -0
  58. package/templates/.claude/skills/reverse-engineering-unicorn/modules/025-cjm-prototype.md +206 -0
  59. package/templates/.claude/skills/reverse-engineering-unicorn/modules/03-market-competition.md +402 -0
  60. package/templates/.claude/skills/reverse-engineering-unicorn/modules/04-business-finance.md +287 -0
  61. package/templates/.claude/skills/reverse-engineering-unicorn/modules/05-growth-engine.md +290 -0
  62. package/templates/.claude/skills/reverse-engineering-unicorn/modules/06-playbook-synthesis.md +286 -0
  63. package/templates/.claude/skills/reverse-engineering-unicorn/references/blue-ocean-canvas.md +39 -0
  64. package/templates/.claude/skills/reverse-engineering-unicorn/references/industry-benchmarks.md +67 -0
  65. package/templates/.claude/skills/reverse-engineering-unicorn/references/jtbd-canvas.md +48 -0
  66. package/templates/CLAUDE.md +185 -0
  67. package/templates/TOOLKIT_HARVEST.md +29 -0
  68. package/templates/docs/keysarium/01-deployment-guide.md +768 -0
  69. package/templates/docs/keysarium/02-admin-guide.md +1170 -0
  70. package/templates/docs/keysarium/03-user-guide.md +884 -0
  71. package/templates/docs/keysarium/04-infrastructure-requirements.md +967 -0
  72. package/templates/docs/keysarium/05-architecture.md +706 -0
  73. package/templates/docs/keysarium/06-user-flows.md +925 -0
  74. package/templates/docs/skills-bto/01-deployment-guide.md +828 -0
  75. package/templates/docs/skills-bto/02-admin-guide.md +1052 -0
  76. package/templates/docs/skills-bto/03-user-guide.md +960 -0
  77. package/templates/docs/skills-bto/04-infrastructure-requirements.md +610 -0
  78. package/templates/docs/skills-bto/05-architecture.md +1112 -0
  79. package/templates/docs/skills-bto/06-user-flows.md +977 -0
  80. package/templates/lib/agent-patterns.md +115 -0
  81. package/templates/lib/domain-templates.md +172 -0
  82. package/templates/lib/phase-utils.md +107 -0
  83. package/templates/lib/skill-loader.md +78 -0
  84. package/templates/researches/.gitkeep +0 -0
package/README.md ADDED
@@ -0,0 +1,289 @@
1
+ # @dzhechko/keysarium
2
+
3
+ **AI Case Research Toolkit for Claude Code**
4
+
5
+ Full 7-phase pipeline for AI case studies, hackathons, and casariums. Provides skills, commands, rules, agent templates, and hooks for [Claude Code](https://docs.anthropic.com/en/docs/claude-code).
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # One-command install via npx (no global install needed)
13
+ npx @dzhechko/keysarium
14
+
15
+ # Or install globally
16
+ npm install -g @dzhechko/keysarium
17
+ keysarium init
18
+
19
+ # Or without npm (standalone)
20
+ curl -fsSL https://raw.githubusercontent.com/dzhechko/product-keysarium-2026/main/packages/dz-keysarium/install.sh | bash
21
+ ```
22
+
23
+ After installation, open Claude Code in your project directory and start using slash commands right away.
24
+
25
+ ---
26
+
27
+ ## What You Get
28
+
29
+ | Component | Count | Description |
30
+ |-----------|-------|-------------|
31
+ | **Skills** | 6 | `explore`, `frontend-design`, `goap-research`, `presentation-storyteller`, `problem-solver`, `reverse-engineering` |
32
+ | **Commands** | 11 | `/casarium`, `/new-research`, `/parallel-research`, `/discovery`, `/explore-case`, `/research`, `/cjm-prototype`, `/solve`, `/architecture-phase`, `/presentation`, `/harvest` |
33
+ | **Rules** | 7 | `research-quality`, `checkpoint-protocol`, `agent-swarm`, `domain-specific`, `anti-patterns`, `file-conventions`, `modular-reuse` |
34
+ | **Agent Templates** | 5 | `discovery-worker`, `research-worker`, `cjm-variant-worker`, `presentation-worker`, `parallel-research-orchestrator` |
35
+ | **Hooks** | 3 | PreToolUse validation, PostToolUse notifications, audit logging |
36
+ | **Library** | 4 | `phase-utils`, `agent-patterns`, `skill-loader`, `domain-templates` |
37
+ | **Documentation** | 6 | Deployment, admin, user guide, infrastructure, architecture, flows |
38
+
39
+ Everything is installed into your project's `.claude/` directory and works natively with Claude Code.
40
+
41
+ ---
42
+
43
+ ## 7-Phase Pipeline
44
+
45
+ ```
46
+ Phase 0 Phase 1 Phase 2 Phase 2.5 Phase 3 Phase 4 Phase 5
47
+ DISCOVERY EXPLORE RESEARCH CJM PROTO SOLVE ARCHITECTURE PRESENTATION
48
+ 15% 5% 15% 10% 15% 15% 20%
49
+ ```
50
+
51
+ | Phase | Command | What It Does |
52
+ |-------|---------|--------------|
53
+ | **Phase 0 -- Discovery** | `/discovery` | Deep-dive into the product/company: JTBD analysis, competitor landscape, ROI estimation. Powered by the `reverse-engineering` skill. |
54
+ | **Phase 1 -- Explore** | `/explore-case` | Adaptive clarification of the case brief. Asks the right questions, structures ambiguity into actionable scope. |
55
+ | **Phase 2 -- Research** | `/research` | Paranoid-mode research: analogues, technologies, regulations. Every claim must have a verifiable source. |
56
+ | **Phase 2.5 -- CJM Prototype** | `/cjm-prototype` | Customer Journey Map prototyping with multiple variants. Generates a working React prototype. **Mandatory -- never skip this phase.** |
57
+ | **Phase 3 -- Solve** | `/solve` | Solution strategy using TRIZ + Game Theory. Produces process diagrams (as-is / to-be). |
58
+ | **Phase 4 -- Architecture** | `/architecture-phase` | Technical architecture: C4 diagrams, sequence flows, component design, integration plan. |
59
+ | **Phase 5 -- Presentation** | `/presentation` | Storytelling-driven presentation, speaker script, Q&A preparation, and executive summary. |
60
+
61
+ Each phase produces concrete artifacts (Markdown documents, Mermaid diagrams, JSX prototypes) stored in `researches/<case-slug>/`.
62
+
63
+ ---
64
+
65
+ ## CLI Commands
66
+
67
+ ```bash
68
+ npx @dzhechko/keysarium # Full install (interactive, same as init)
69
+ npx @dzhechko/keysarium init # Install all components
70
+ npx @dzhechko/keysarium init --minimal # Only .claude/ (no docs, no lib)
71
+ npx @dzhechko/keysarium init --with-docs # Include documentation
72
+ npx @dzhechko/keysarium init --force # Overwrite existing files
73
+ npx @dzhechko/keysarium init --dry-run # Preview without making changes
74
+ npx @dzhechko/keysarium update # Update to latest version
75
+ npx @dzhechko/keysarium remove # Clean uninstall
76
+ npx @dzhechko/keysarium list # Show installed components
77
+ npx @dzhechko/keysarium doctor # Health check
78
+ ```
79
+
80
+ Flags can be combined:
81
+
82
+ ```bash
83
+ npx @dzhechko/keysarium init --minimal --force --dry-run
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Usage After Install
89
+
90
+ ### Full Pipeline
91
+
92
+ ```bash
93
+ # Open Claude Code in your project
94
+ claude
95
+
96
+ # Start a full case study (runs all 7 phases with checkpoints)
97
+ /casarium Analyze how AI can automate customer support in banking
98
+ ```
99
+
100
+ ### Individual Phases
101
+
102
+ ```bash
103
+ # Product discovery
104
+ /discovery Analyze Tinkoff Bank
105
+
106
+ # Case exploration
107
+ /explore-case banking customer support automation
108
+
109
+ # Research phase
110
+ /research AI-powered document processing in insurance
111
+
112
+ # CJM prototyping
113
+ /cjm-prototype mobile banking onboarding flow
114
+
115
+ # Solution design
116
+ /solve reduce customer churn using predictive analytics
117
+ ```
118
+
119
+ ### Multi-Case Research
120
+
121
+ ```bash
122
+ # Run multiple cases in parallel
123
+ /parallel-research banking automation | retail personalization | healthcare triage
124
+
125
+ # Create a new isolated research
126
+ /new-research smart-warehouse-logistics
127
+
128
+ # Extract learnings after a project
129
+ /harvest researches/bank_kc_automation/
130
+ /harvest all
131
+ ```
132
+
133
+ ### Example: Russian-Language Case (bilingual support)
134
+
135
+ ```bash
136
+ /casarium Как AI может автоматизировать процесс обработки обращений клиентов в банке, сократив время ответа с 4 часов до 15 минут?
137
+ ```
138
+
139
+ The toolkit processes cases in any language and adapts domain rules accordingly.
140
+
141
+ ---
142
+
143
+ ## Domain Support
144
+
145
+ The toolkit automatically detects the domain from the case description and applies domain-specific rules:
146
+
147
+ ### Banking / FinTech
148
+ - On-premise LLM deployment (GigaChat, YandexGPT, open-source models)
149
+ - Regulatory compliance: FZ-152, Central Bank requirements, FSTEC
150
+ - Human-in-the-Loop mandatory for decision-making
151
+ - Data never leaves the security perimeter
152
+ - Visual palette: Blue / Navy / Silver
153
+
154
+ ### Retail / E-commerce
155
+ - Latency budget: < 200ms for real-time recommendations
156
+ - A/B testing as primary validation method
157
+ - Personalization vs. privacy balance (GDPR / FZ-152)
158
+ - Seasonality and cold-start handling
159
+ - Visual palette: Amber / Orange
160
+
161
+ ### Enterprise / B2B
162
+ - Change management strategy (people resist AI)
163
+ - Legacy system integration planning
164
+ - SLA and fault tolerance definitions
165
+ - ROI expressed in FTE / hours saved
166
+ - Visual palette: Teal / Indigo
167
+
168
+ ### Healthcare
169
+ - HITL mandatory for all clinical decisions
170
+ - Medical device regulations (FZ-323)
171
+ - AI explainability requirements
172
+ - Patient data isolation (FZ-152 + medical specifics)
173
+
174
+ ---
175
+
176
+ ## Agent Swarm
177
+
178
+ The toolkit leverages Claude Code's agent capabilities for parallel execution, significantly reducing research time:
179
+
180
+ | Phase | Parallel Agents | Tasks |
181
+ |-------|-----------------|-------|
182
+ | **Phase 0** | 2 agents | JTBD analysis \|\| Competitors + ROI |
183
+ | **Phase 2** | 3 agents | Analogues \|\| Technologies \|\| Regulations |
184
+ | **Phase 2.5** | 3 agents | CJM Variant A \|\| Variant B+C \|\| Trend Research D |
185
+ | **Phase 5** | 3 agents | Presentation \|\| Speaker Script \|\| Q&A + Executive Summary |
186
+
187
+ Cross-case parallelism is also supported:
188
+
189
+ ```bash
190
+ # Runs Phase 0 for up to 4 cases simultaneously
191
+ /parallel-research case1 | case2 | case3 | case4
192
+ ```
193
+
194
+ Each research is fully isolated in its own `researches/<slug>/` directory.
195
+
196
+ ---
197
+
198
+ ## Research Artifacts
199
+
200
+ Every completed research produces a structured set of files:
201
+
202
+ ```
203
+ researches/<case-slug>/
204
+ ├── 00_product_discovery.md # Phase 0 output
205
+ ├── 01_case_brief.md # Phase 1 output
206
+ ├── 02_research_findings.md # Phase 2 output
207
+ ├── 02.5_trend_brief.md # Phase 2.5 output
208
+ ├── 03_solution_strategy.md # Phase 3 output
209
+ ├── 04_architecture.md # Phase 4 output
210
+ ├── 05_presentation_content.md # Phase 5 output
211
+ ├── 06_speaker_script.md # Phase 5 output
212
+ ├── 07_qa_preparation.md # Phase 5 output
213
+ ├── 08_executive_summary.md # Phase 5 output (mandatory)
214
+ ├── prototype/
215
+ │ └── cjm-prototype.jsx # Phase 2.5 React prototype
216
+ ├── diagrams/
217
+ │ ├── architecture-c4.mermaid
218
+ │ ├── sequence-main-flow.mermaid
219
+ │ ├── process-as-is.mermaid
220
+ │ └── process-to-be.mermaid
221
+ └── README.md
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Extending the Toolkit
227
+
228
+ ### Add a Custom Skill
229
+
230
+ Create a new directory under `.claude/skills/`:
231
+
232
+ ```
233
+ .claude/skills/my-custom-skill/
234
+ ├── SKILL.md # Skill instructions (loaded by phases)
235
+ └── examples/ # Reference materials (optional)
236
+ ```
237
+
238
+ ### Add a Custom Command
239
+
240
+ Create a new file under `.claude/commands/`:
241
+
242
+ ```
243
+ .claude/commands/my-command.md
244
+ ```
245
+
246
+ Commands follow a standard pattern: load required skills, execute logic, produce artifacts, display a checkpoint.
247
+
248
+ ### Add a Custom Rule
249
+
250
+ Create a new file under `.claude/rules/`:
251
+
252
+ ```
253
+ .claude/rules/my-rule.md
254
+ ```
255
+
256
+ Rules are automatically loaded by Claude Code and enforced across all phases.
257
+
258
+ ### Knowledge Harvesting
259
+
260
+ After completing research, extract reusable patterns:
261
+
262
+ ```bash
263
+ /harvest researches/<slug>/ # Harvest from one research
264
+ /harvest all # Harvest from all researches
265
+ ```
266
+
267
+ The harvester reviews completed projects, identifies universal patterns, decontextualizes them, and updates `TOOLKIT_HARVEST.md`.
268
+
269
+ ---
270
+
271
+ ## Requirements
272
+
273
+ - **Claude Code CLI** -- installed and configured ([installation guide](https://docs.anthropic.com/en/docs/claude-code))
274
+ - **Node.js >= 16.0.0** -- required for the npm install method
275
+ - **Git** -- required for the standalone install method
276
+
277
+ ---
278
+
279
+ ## License
280
+
281
+ [MIT](https://opensource.org/licenses/MIT)
282
+
283
+ ---
284
+
285
+ ## Links
286
+
287
+ - **GitHub:** [https://github.com/dzhechko/product-keysarium-2026](https://github.com/dzhechko/product-keysarium-2026)
288
+ - **Issues:** [https://github.com/dzhechko/product-keysarium-2026/issues](https://github.com/dzhechko/product-keysarium-2026/issues)
289
+ - **npm:** [https://www.npmjs.com/package/@dzhechko/keysarium](https://www.npmjs.com/package/@dzhechko/keysarium)
package/bin/cli.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ require('../src/cli.js');
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@dzhechkov/keysarium",
3
+ "version": "1.0.0",
4
+ "description": "AI Case Research Toolkit for Claude Code — full 7-phase pipeline for AI case studies, hackathons, and casariums",
5
+ "main": "src/cli.js",
6
+ "bin": {
7
+ "keysarium": "./bin/cli.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "src/",
12
+ "templates/"
13
+ ],
14
+ "scripts": {
15
+ "test": "node bin/cli.js doctor",
16
+ "prepublishOnly": "node scripts/sync-templates.js"
17
+ },
18
+ "keywords": [
19
+ "claude",
20
+ "claude-code",
21
+ "ai",
22
+ "research",
23
+ "casarium",
24
+ "hackathon",
25
+ "skills",
26
+ "pipeline",
27
+ "keysarium",
28
+ "product-research"
29
+ ],
30
+ "author": "dzhechko",
31
+ "license": "MIT",
32
+ "engines": {
33
+ "node": ">=16.0.0"
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/dzhechko/product-keysarium-2026"
38
+ },
39
+ "homepage": "https://github.com/dzhechko/product-keysarium-2026#readme",
40
+ "bugs": {
41
+ "url": "https://github.com/dzhechko/product-keysarium-2026/issues"
42
+ }
43
+ }
package/src/cli.js ADDED
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ const path = require('path');
4
+ const { bold, cyan, dim, green, yellow, red, info, error } = require('./utils');
5
+
6
+ // ---------------------------------------------------------------------------
7
+ // Banner
8
+ // ---------------------------------------------------------------------------
9
+ function showBanner() {
10
+ console.log('');
11
+ console.log(cyan('╔══════════════════════════════════════════════════════╗'));
12
+ console.log(cyan('║') + bold(' \uD83D\uDD2C DZ-KEYSARIUM — AI Research Toolkit ') + cyan('║'));
13
+ console.log(cyan('║') + ' Full 7-phase pipeline for Claude Code ' + cyan('║'));
14
+ console.log(cyan('╚══════════════════════════════════════════════════════╝'));
15
+ console.log('');
16
+ }
17
+
18
+ // ---------------------------------------------------------------------------
19
+ // Version
20
+ // ---------------------------------------------------------------------------
21
+ function getVersion() {
22
+ const pkg = require('../package.json');
23
+ return pkg.version;
24
+ }
25
+
26
+ // ---------------------------------------------------------------------------
27
+ // Help
28
+ // ---------------------------------------------------------------------------
29
+ function showHelp() {
30
+ console.log(bold('Usage:') + ' npx @dzhechko/keysarium ' + cyan('<command>') + dim(' [options]'));
31
+ console.log('');
32
+ console.log(bold('Commands:'));
33
+ console.log(' ' + green('init') + ' Install toolkit into current project ' + dim('(default)'));
34
+ console.log(' ' + green('update') + ' Update toolkit to latest version');
35
+ console.log(' ' + green('remove') + ' Remove toolkit from project');
36
+ console.log(' ' + green('list') + ' List installed components');
37
+ console.log(' ' + green('doctor') + ' Check installation health');
38
+ console.log('');
39
+ console.log(bold('Options:'));
40
+ console.log(' ' + yellow('--minimal') + ' Install only .claude/ directory (skills, commands, rules)');
41
+ console.log(' ' + yellow('--force') + ' Overwrite existing files without prompting');
42
+ console.log(' ' + yellow('--with-docs') + ' Include docs/ directory');
43
+ console.log(' ' + yellow('--dry-run') + ' Show what would be done without making changes');
44
+ console.log(' ' + yellow('--help, -h') + ' Show this help message');
45
+ console.log(' ' + yellow('--version, -v') + ' Show version number');
46
+ console.log('');
47
+ console.log(bold('Examples:'));
48
+ console.log(dim(' $ ') + 'npx @dzhechko/keysarium init');
49
+ console.log(dim(' $ ') + 'npx @dzhechko/keysarium init --minimal --force');
50
+ console.log(dim(' $ ') + 'npx @dzhechko/keysarium update --dry-run');
51
+ console.log(dim(' $ ') + 'npx @dzhechko/keysarium doctor');
52
+ console.log('');
53
+ }
54
+
55
+ // ---------------------------------------------------------------------------
56
+ // Parse arguments
57
+ // ---------------------------------------------------------------------------
58
+ function parseArgs(argv) {
59
+ const args = argv.slice(2);
60
+
61
+ const flags = {
62
+ minimal: false,
63
+ force: false,
64
+ withDocs: false,
65
+ dryRun: false,
66
+ targetDir: process.cwd(),
67
+ };
68
+
69
+ let command = null;
70
+
71
+ for (const arg of args) {
72
+ switch (arg) {
73
+ case '--minimal':
74
+ flags.minimal = true;
75
+ break;
76
+ case '--force':
77
+ flags.force = true;
78
+ break;
79
+ case '--with-docs':
80
+ flags.withDocs = true;
81
+ break;
82
+ case '--dry-run':
83
+ flags.dryRun = true;
84
+ break;
85
+ case '--help':
86
+ case '-h':
87
+ command = 'help';
88
+ break;
89
+ case '--version':
90
+ case '-v':
91
+ command = 'version';
92
+ break;
93
+ default:
94
+ if (!arg.startsWith('-') && command === null) {
95
+ command = arg;
96
+ }
97
+ break;
98
+ }
99
+ }
100
+
101
+ return { command, flags };
102
+ }
103
+
104
+ // ---------------------------------------------------------------------------
105
+ // Main
106
+ // ---------------------------------------------------------------------------
107
+ function main() {
108
+ const { command, flags } = parseArgs(process.argv);
109
+
110
+ // Handle version early (no banner)
111
+ if (command === 'version') {
112
+ console.log(getVersion());
113
+ return;
114
+ }
115
+
116
+ showBanner();
117
+
118
+ // Handle help early
119
+ if (command === 'help') {
120
+ showHelp();
121
+ return;
122
+ }
123
+
124
+ // Route to command handlers
125
+ const resolvedCommand = command || 'init';
126
+
127
+ switch (resolvedCommand) {
128
+ case 'init':
129
+ require('./commands/init')(flags);
130
+ break;
131
+
132
+ case 'update':
133
+ require('./commands/update')(flags);
134
+ break;
135
+
136
+ case 'remove':
137
+ require('./commands/remove')(flags);
138
+ break;
139
+
140
+ case 'list':
141
+ require('./commands/list')(flags);
142
+ break;
143
+
144
+ case 'doctor':
145
+ require('./commands/doctor')(flags);
146
+ break;
147
+
148
+ default:
149
+ error(`Unknown command: "${resolvedCommand}"`);
150
+ console.log('');
151
+ showHelp();
152
+ process.exitCode = 1;
153
+ break;
154
+ }
155
+ }
156
+
157
+ main();