ninekit-cli 0.0.0-dev.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Duy Nguyen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,696 @@
1
+ # NineKit Config UI
2
+
3
+ Command-line tool and web dashboard for managing NineKit projects.
4
+
5
+ **Version**: 1.17.0
6
+
7
+ ## Overview
8
+
9
+ NineKit Config UI (`nk`) provides both CLI and web dashboard for managing NineKit projects. It is built with Bun, TypeScript, and React for development, while the published CLI runs on plain Node.js so end users do not need Bun installed.
10
+
11
+ **Key Features:**
12
+ - **CLI Commands (16)**: new, init, config, projects, setup, skills, agents, commands, migrate, doctor, versions, update, uninstall, watch, content, easter-egg
13
+ - **Web Dashboard**: Interactive React UI via `nk config ui` for configuration and project management
14
+ - **Hook Diagnostics Dashboard**: Inspect recent Claude hook activity and failures from `nk config` across global and project scopes
15
+ - **Projects Registry**: Centralized registry at `~/.ninekit/projects.json` with file locking
16
+ - **Skill Installation**: Install NineKit skills to other coding agents (Cursor, Codex, etc.)
17
+ - **Multi-tier Authentication**: gh CLI → env vars → keychain → prompt fallback
18
+ - **Smart Merging**: Conflict detection with user customization preservation
19
+ - **Skills Migration**: Auto-detects and migrates skills structure changes
20
+ - **Offline Installation**: From local archives or directories
21
+ - **Security**: Path traversal protection, symlink validation, UNC path protection
22
+ - **Cross-Platform**: macOS, Linux, Windows with platform-specific optimizations
23
+ - **Update Notifications**: Intelligent 7-day cache for version checks
24
+
25
+ ## Documentation
26
+
27
+ Comprehensive documentation in `/docs`:
28
+
29
+ - **[Codebase Summary](./docs/codebase-summary.md)** - Overview, structure, key components
30
+ - **[Project Overview & PDR](./docs/project-overview-pdr.md)** - Requirements, features, roadmap
31
+ - **[System Architecture](./docs/system-architecture.md)** - Architecture diagrams, data flow
32
+ - **[Reconciliation Architecture](./docs/reconciliation-architecture.md)** - `nk migrate` RECONCILE → EXECUTE → REPORT design
33
+ - **[Code Standards](./docs/code-standards.md)** - Coding conventions, best practices
34
+ - **[Project Roadmap](./docs/project-roadmap.md)** - Release timeline, feature status
35
+ - **[Deployment Guide](./docs/deployment-guide.md)** - Release procedures
36
+ - **[nk watch](./docs/nk-watch.md)** - GitHub issue monitoring daemon
37
+ - **[nk content](./docs/nk-content.md)** - Automated content generation from git activity
38
+
39
+ ## Prerequisites
40
+
41
+ Before using NineKit CLI, you need to:
42
+
43
+ 1. **Purchase a NineKit Starter Kit** from [NineKit.cc](https://ninekit.chiendt.io.vn)
44
+ 2. **Get Repository Access**: After purchase, you'll receive access to the private GitHub repository containing your kit
45
+ 3. **Create a GitHub Personal Access Token** (PAT) with `repo` scope to download releases
46
+
47
+ Without a purchased kit and repository access, the CLI will not be able to download any project templates.
48
+
49
+ ## Installation
50
+
51
+ The NineKit CLI is published on npm at [npmjs.com/package/ninekit-cli](https://www.npmjs.com/package/ninekit-cli).
52
+
53
+ End-user runtime note: global installs from `npm`, `pnpm`, `yarn`, or `bun` all execute the packaged Node.js CLI. Bun is optional for users and only needed for local NineKit CLI development workflows.
54
+
55
+ ### Using npm (Recommended)
56
+
57
+ ```bash
58
+ npm install -g ninekit-cli
59
+ ```
60
+
61
+ ### Using Bun
62
+
63
+ ```bash
64
+ bun add -g ninekit-cli
65
+ ```
66
+
67
+ ### Using Yarn
68
+
69
+ ```bash
70
+ yarn global add ninekit-cli
71
+ ```
72
+
73
+ ### Using pnpm
74
+
75
+ ```bash
76
+ pnpm add -g ninekit-cli
77
+ ```
78
+
79
+ After installation, verify it's working:
80
+
81
+ ```bash
82
+ nk --version
83
+ ```
84
+
85
+ ## Usage
86
+
87
+ ### Discoverability Quick Start
88
+
89
+ ```bash
90
+ # Top-level command discovery
91
+ nk --help
92
+
93
+ # Open config dashboard immediately
94
+ nk config
95
+
96
+ # Expose the dashboard intentionally to your LAN/Tailscale
97
+ nk config --host 0.0.0.0 --no-open
98
+
99
+ # Command-level help (recommended)
100
+ nk config --help
101
+ nk skills --help
102
+ nk agents --help
103
+ nk commands --help
104
+ nk migrate --help
105
+ ```
106
+
107
+ ### Config Dashboard Access
108
+
109
+ By default, `nk config` binds the dashboard to `127.0.0.1` for local-only access.
110
+
111
+ Use `--host` when you intentionally want remote access from another device on the same trusted network:
112
+
113
+ ```bash
114
+ # Bind to all interfaces
115
+ nk config --host 0.0.0.0 --no-open
116
+
117
+ # Bind to a specific interface or hostname
118
+ nk config --host 100.88.12.4 --no-open
119
+ nk config --host dashboard.local --no-open
120
+ ```
121
+
122
+ The dashboard still enforces same-origin browser access. Remote access works when you open the UI from the same host/origin that reaches the server, instead of relying on a hardcoded IP allowlist.
123
+
124
+ ### Create New Project
125
+
126
+ ```bash
127
+ # Interactive mode
128
+ nk new
129
+
130
+ # With options
131
+ nk new --dir my-project --kit engineer
132
+
133
+ # Show beta versions
134
+ nk new --beta
135
+
136
+ # With exclude patterns
137
+ nk new --exclude "*.log" --exclude "temp/**"
138
+
139
+ # Optional packages (OpenCode, Gemini)
140
+ nk new --opencode --gemini
141
+
142
+ # Install skills dependencies (Python, Node packages, system tools)
143
+ nk new --install-skills
144
+
145
+ # Command prefix (/nk: namespace to avoid conflicts)
146
+ nk new --prefix
147
+
148
+ # Offline installation (from local archive or directory)
149
+ nk new --archive ~/downloads/engineer-v1.16.0.zip
150
+ nk new --kit-path ~/extracted-kit/
151
+
152
+ # Direct repo downloads are also supported
153
+ nk new --archive ~/downloads/ninekit-engineer-main.zip
154
+ nk new --kit-path ~/downloads/ninekit-engineer-main/
155
+ ```
156
+
157
+ **Flags:**
158
+ - `--install-skills`: Auto-install Python packages, system tools (FFmpeg, ImageMagick), Node.js packages
159
+ - `--prefix`: Move commands to /nk: namespace (/plan → /nk:plan)
160
+ - `--beta`: Show pre-release versions in selection
161
+ - `--opencode/--gemini`: Install optional packages
162
+ - `--archive <path>`: Use local archive (zip/tar.gz) instead of downloading
163
+ - `--kit-path <path>`: Use local kit directory instead of downloading
164
+
165
+ `--archive` and `--kit-path` both accept direct repo downloads with a single wrapper directory, including GitHub "Download ZIP" archives and extracted repo folders that still contain `ninekit-engineer-main/` or similar at the top level.
166
+
167
+ ### Initialize or Update Project
168
+
169
+ **Note:** Run from project root.
170
+
171
+ ```bash
172
+ # Interactive mode
173
+ nk init
174
+
175
+ # Non-interactive mode with sensible defaults
176
+ nk init --yes
177
+ nk init -y
178
+
179
+ # Combine with other flags
180
+ nk init -g --kit engineer -y
181
+
182
+ # With options
183
+ nk init --kit engineer --beta
184
+
185
+ # Global mode (platform-specific paths)
186
+ nk init --global
187
+
188
+ # Fresh installation (⚠️ DESTRUCTIVE - removes ALL customizations)
189
+ nk init --fresh
190
+
191
+ # With exclude patterns and prefix
192
+ nk init --exclude "*.local" --prefix
193
+
194
+ # Offline installation (from local archive or directory)
195
+ nk init --archive ~/downloads/engineer-v1.16.0.zip
196
+ nk init --kit-path ~/extracted-kit/
197
+
198
+ # Direct repo downloads are also supported
199
+ nk init --archive ~/downloads/ninekit-engineer-main.zip
200
+ nk init --kit-path ~/downloads/ninekit-engineer-main/
201
+ ```
202
+
203
+ **Flags:**
204
+ - `--yes/-y`: Non-interactive mode with sensible defaults (skip all prompts)
205
+ - `--global/-g`: Use platform-specific config (macOS/Linux: ~/.claude, Windows: %USERPROFILE%\.claude)
206
+ - `--fresh`: Clean reinstall, removes .claude directory (requires "yes" confirmation)
207
+ - `--beta`: Show pre-release versions
208
+ - `--prefix`: Apply /nk: namespace to commands
209
+ - `--archive <path>`: Use local archive (zip/tar.gz) instead of downloading
210
+ - `--kit-path <path>`: Use local kit directory instead of downloading
211
+
212
+ `--archive` and `--kit-path` both accept direct repo downloads with a single wrapper directory, including GitHub "Download ZIP" archives and extracted repo folders that still contain `ninekit-engineer-main/` or similar at the top level.
213
+
214
+ **Default Behavior with `-y` Flag:**
215
+
216
+ | Prompt | Default |
217
+ |--------|---------|
218
+ | Select NineKit | engineer (first option) |
219
+ | Target directory | Current directory (`.`) |
220
+ | Version selection | Latest stable release |
221
+ | Google Gemini setup | Skip |
222
+ | Other optional features | Skip |
223
+
224
+ ### Update CLI
225
+
226
+ Keep the NineKit CLI up to date:
227
+
228
+ ```bash
229
+ # Check for CLI updates
230
+ nk update --check
231
+
232
+ # Update to latest version
233
+ nk update
234
+
235
+ # Update to specific version
236
+ nk update --version 1.17.0
237
+
238
+ # Update to beta / skip confirmation
239
+ nk update --beta
240
+ nk update --yes
241
+ ```
242
+
243
+ The CLI notifies you when updates are available via `nk --version`.
244
+
245
+ **Skills Migration:**
246
+ - Auto-detects structure changes (flat → categorized)
247
+ - Preserves customizations (SHA-256 hashing)
248
+ - Creates backup before migration
249
+ - Rollback on failure
250
+
251
+ ### List Available Versions
252
+
253
+ ```bash
254
+ # Show all available versions for all kits
255
+ nk versions
256
+
257
+ # Filter by specific kit
258
+ nk versions --kit engineer
259
+ nk versions --kit marketing
260
+
261
+ # Show more versions (default: 30)
262
+ nk versions --limit 50
263
+
264
+ # Include prereleases and drafts
265
+ nk versions --all
266
+ ```
267
+
268
+ ### Diagnostics & Doctor
269
+
270
+ ```bash
271
+ # Full health check (default)
272
+ nk doctor
273
+
274
+ # Verbose mode with execution timing and command details
275
+ nk doctor --verbose
276
+
277
+ # Generate shareable diagnostic report (prompts for gist upload)
278
+ nk doctor --report
279
+
280
+ # Auto-fix all fixable issues
281
+ nk doctor --fix
282
+
283
+ # CI mode: no prompts, exit 1 on failures
284
+ nk doctor --check-only
285
+
286
+ # Machine-readable JSON output
287
+ nk doctor --json
288
+
289
+ # Combine flags
290
+ nk doctor --verbose --check-only --json
291
+ nk doctor --verbose --fix
292
+ ```
293
+
294
+ **Health Checks:**
295
+ - **System**: Node.js, npm, Python, pip, Claude CLI, git, gh CLI
296
+ - **NineKit**: Global/project installation, versions, skills, skill listing budget, duplicate skill inventory
297
+ - **Auth**: GitHub CLI authentication, repository access
298
+ - **Project**: package.json, node_modules, lock files
299
+ - **Modules**: Dynamic skill dependency resolution
300
+
301
+ **Auto-Fix Capabilities:**
302
+ | Issue | Fix Action |
303
+ |-------|------------|
304
+ | Missing dependencies | Install via package manager |
305
+ | Missing gh auth | Run `gh auth login` |
306
+ | Corrupted node_modules | Reinstall dependencies |
307
+ | Missing global install | Run `nk init --global` |
308
+ | Missing skill deps | Install in skill directory |
309
+ | Missing/low Engineer skill listing budget | Ensure computed `skillListingBudgetFraction` and a valid NineKit-recommended `skillListingMaxDescChars` ceiling in project settings |
310
+
311
+ `nk doctor` never writes `skillOverrides`, hides skills, or deletes duplicate skills automatically. It reports existing `skillOverrides` and inventory issues so all active project/global skills can stay user-invocable while listing pressure is managed through 200k-context-floor project settings and bounded descriptions.
312
+
313
+ **Exit Codes:**
314
+ - `0`: All checks pass or issues fixed
315
+ - `1`: Failures detected (only with `--check-only`)
316
+
317
+ > **Note:** `nk diagnose` is deprecated. Use `nk doctor` instead.
318
+
319
+ ### Uninstall
320
+
321
+ Remove NineKit installations from your system:
322
+
323
+ ```bash
324
+ nk uninstall # Interactive mode - prompts for scope and confirmation
325
+ nk uninstall --local # Uninstall only local installation (current project)
326
+ nk uninstall --global # Uninstall only global installation (~/.claude/)
327
+ nk uninstall -g --kit marketing # Remove only global Marketing kit
328
+ nk uninstall -l -y # Local only, skip confirmation
329
+ nk uninstall -g -y # Global only, skip confirmation
330
+ nk uninstall --yes # Non-interactive - skip confirmation (for scripts)
331
+ ```
332
+
333
+ **Scope Selection:**
334
+ - When both local and global installations exist, you'll be prompted to choose:
335
+ - **Local only**: Remove from current project (`.claude/`)
336
+ - **Global only**: Remove from user directory (`~/.claude/`)
337
+ - **Both**: Remove all NineKit installations
338
+ - When multiple kits are installed in the selected scope, interactive uninstall prompts for:
339
+ - **Marketing kit only** or **Engineer kit only**: Remove one kit and preserve the other
340
+ - **All NineKit kits**: Remove the full selected installation scope
341
+ - Use `--local` or `--global` flags to skip the prompt
342
+ - Use `--kit engineer` or `--kit marketing` to skip the kit prompt
343
+
344
+ **What it does:**
345
+ - Detects local `.claude` directory in current project
346
+ - Detects global `~/.claude` NineKit installation
347
+ - Shows paths before deletion
348
+ - Requires confirmation (unless `--yes` flag)
349
+ - Removes NineKit subdirectories (`commands/`, `agents/`, `skills/`, `workflows/`, `hooks/`, `metadata.json`)
350
+ - **Preserves user configs** like `settings.json`, `settings.local.json`, and `CLAUDE.md`
351
+
352
+ **Note:** Only removes valid NineKit installations (with metadata.json). Regular `.claude` directories from Claude Desktop are not affected.
353
+
354
+ ### Watch GitHub Issues (`nk watch`)
355
+
356
+ Autonomous daemon that monitors GitHub issues, analyzes them with Claude, generates plans, and creates PRs.
357
+
358
+ ```bash
359
+ # Start watching (single repo)
360
+ nk watch
361
+
362
+ # Dry-run mode (no posts/PRs)
363
+ nk watch --dry-run
364
+
365
+ # Custom poll interval (ms)
366
+ nk watch --interval 60000
367
+
368
+ # Force restart (clear state)
369
+ nk watch --force
370
+
371
+ # Verbose logging
372
+ nk watch --verbose
373
+ ```
374
+
375
+ **Features:** issue lifecycle management (10 statuses), Claude-powered brainstorming/planning, automatic PR creation, rate limiting (persisted across restarts), maintainer reply filtering, processedIssues TTL, optional git worktree isolation per issue, multi-repo support, graceful shutdown.
376
+
377
+ **Config:** `.nk.json` under `watch` key. See [docs/nk-watch.md](./docs/nk-watch.md) for full configuration reference.
378
+
379
+ ### Content Generation (`nk content`)
380
+
381
+ Daemon that scans git activity (commits, PRs, tags), generates social media content with Claude, and publishes to X/Twitter and Facebook.
382
+
383
+ ```bash
384
+ # Interactive setup wizard
385
+ nk content setup
386
+
387
+ # Start daemon
388
+ nk content start
389
+
390
+ # Check status
391
+ nk content status
392
+
393
+ # View logs
394
+ nk content logs
395
+
396
+ # Queue manual content
397
+ nk content queue
398
+
399
+ # Review workflow
400
+ nk content approve <id>
401
+ nk content reject <id>
402
+
403
+ # Dry-run / verbose
404
+ nk content start --dry-run
405
+ nk content start --verbose
406
+ ```
407
+
408
+ **Features:** 11-phase pipeline (scan → filter → classify → context → create → validate → review → photo → publish → engage → analyze), noise filtering, context caching (24h TTL), content validation, photo generation, 3 review modes (auto/manual/hybrid), quiet hours scheduling, engagement tracking, SQLite database, platform-specific adapters.
409
+
410
+ **Config:** `.nk.json` under `content` key. See [docs/nk-content.md](./docs/nk-content.md) for full configuration reference.
411
+
412
+ ### Other Commands
413
+
414
+ ```bash
415
+ # Show CLI version (shows local + global kit versions)
416
+ nk --version
417
+
418
+ # Show help
419
+ nk --help
420
+ nk -h
421
+
422
+ # Command-specific help
423
+ nk new --help
424
+ nk init --help
425
+ nk config --help
426
+ nk skills --help
427
+ nk versions --help
428
+ ```
429
+
430
+ ### Debugging
431
+
432
+ ```bash
433
+ nk new --verbose # Enable verbose logging
434
+ nk new --verbose --log-file debug.log # Save to file
435
+ NINEKIT_VERBOSE=1 nk new # Via environment variable
436
+ ```
437
+
438
+ ### Cache Configuration
439
+
440
+ Release data is cached locally to improve performance. You can configure the cache TTL:
441
+
442
+ ```bash
443
+ # Set custom cache TTL (in seconds, default: 3600 = 1 hour)
444
+ NK_CACHE_TTL=7200 nk versions # Cache for 2 hours
445
+ NK_CACHE_TTL=0 nk versions # Disable caching (always fetch fresh)
446
+
447
+ # Permanent configuration (add to ~/.bashrc or ~/.zshrc)
448
+ export NK_CACHE_TTL=1800 # 30 minutes
449
+ ```
450
+
451
+ **Cache Location:** `~/.ninekit/cache/releases/`
452
+
453
+ ### Update Notifications
454
+
455
+ The `nk --version` command checks for newer versions of your installed NineKit and displays a notification if an update is available. The check is cached for 7 days to minimize API calls.
456
+
457
+ **Disable Update Notifications:**
458
+ ```bash
459
+ # Set environment variable to disable
460
+ NO_UPDATE_NOTIFIER=1 nk --version
461
+
462
+ # Windows (permanent)
463
+ [System.Environment]::SetEnvironmentVariable("NO_UPDATE_NOTIFIER", "1", [System.EnvironmentVariableTarget]::User)
464
+
465
+ # macOS/Linux (add to ~/.bashrc or ~/.zshrc)
466
+ export NO_UPDATE_NOTIFIER=1
467
+ ```
468
+
469
+ **Cache Location:** `~/.ninekit/cache/version-check.json` (Windows: `%USERPROFILE%\.ninekit\cache\`)
470
+
471
+ ## Authentication
472
+
473
+ The CLI requires GitHub authentication to download releases from private repositories.
474
+
475
+ ### Authentication Flow
476
+
477
+ ```
478
+ ┌─────────────────────────────────────────────────┐
479
+ │ Multi-Tier Authentication │
480
+ │ │
481
+ │ 1. GitHub CLI (gh auth token) │
482
+ │ ↓ (if not available) │
483
+ │ 2. Environment Variables (GITHUB_TOKEN) │
484
+ │ ↓ (if not set) │
485
+ │ 3. Config File (~/.ninekit/config.json) │
486
+ │ ↓ (if not found) │
487
+ │ 4. OS Keychain (secure storage) │
488
+ │ ↓ (if not stored) │
489
+ │ 5. User Prompt (with save option) │
490
+ └─────────────────────────────────────────────────┘
491
+ ```
492
+
493
+ ### Quick Setup
494
+
495
+ **Step 1: Install GitHub CLI**
496
+ ```bash
497
+ # Windows
498
+ winget install GitHub.cli
499
+
500
+ # macOS
501
+ brew install gh
502
+
503
+ # Linux
504
+ sudo apt install gh
505
+ ```
506
+
507
+ **Step 2: Authenticate with GitHub CLI**
508
+ ```bash
509
+ gh auth login
510
+ ```
511
+
512
+ When prompted, follow these steps:
513
+ 1. Select **GitHub.com**
514
+ 2. Select **HTTPS** (or SSH if preferred)
515
+ 3. Authenticate Git? → **Yes**
516
+ 4. Select **Login with a web browser** (⚠️ recommended)
517
+ 5. Copy the one-time code shown
518
+ 6. Press Enter to open browser and paste the code
519
+ 7. Authorize GitHub CLI
520
+
521
+ > **⚠️ Important**: Select "Login with a web browser" - do NOT use "Paste an authentication token" as PAT authentication is no longer supported for accessing private repositories.
522
+
523
+ ## Troubleshooting
524
+
525
+ Run the doctor command to diagnose issues:
526
+
527
+ ```bash
528
+ # Interactive diagnostics
529
+ nk doctor
530
+
531
+ # Generate report for support
532
+ nk doctor --report
533
+
534
+ # CI/automation
535
+ nk doctor --check-only --json
536
+
537
+ # Verbose logging
538
+ nk new --verbose
539
+ nk init --verbose
540
+ ```
541
+
542
+ **Common Issues:**
543
+ - **"Access denied"**: Run `nk doctor` to check auth, use `--fix` to auto-repair
544
+ - **"Authentication failed"**: Run `nk doctor --fix` to re-authenticate, or manually run `gh auth login` (select 'Login with a web browser')
545
+ - **"GitHub CLI not authenticated"**: Run `gh auth login` and select 'Login with a web browser' (NOT 'Paste token')
546
+ - **Module errors**: Run `nk doctor --fix` to reinstall skill dependencies
547
+ - **Need help**: Run `nk doctor --report` and share the gist URL
548
+
549
+ ## Available Kits
550
+
551
+ NineKit offers premium starter kits available for purchase at [NineKit.cc](https://ninekit.chiendt.io.vn):
552
+
553
+ - **engineer**: NineKit Engineer - Engineering toolkit for building with Claude (v1.0.0+)
554
+ - **marketing**: NineKit Marketing - Content automation toolkit (v1.0.0 available)
555
+
556
+ Each kit provides a comprehensive project template with best practices, tooling, and workflows optimized for Claude Code development.
557
+
558
+ ## Configuration
559
+
560
+ Configuration is stored in `~/.ninekit/config.json`:
561
+
562
+ ```json
563
+ {
564
+ "github": {
565
+ "token": "stored_in_keychain"
566
+ },
567
+ "defaults": {
568
+ "kit": "engineer",
569
+ "dir": "."
570
+ }
571
+ }
572
+ ```
573
+
574
+ ## Protected Files
575
+
576
+ The following file patterns are protected and will not be overwritten during updates:
577
+
578
+ - `.env`, `.env.local`, `.env.*.local`
579
+ - `*.key`, `*.pem`, `*.p12`
580
+ - `node_modules/**`, `.git/**`
581
+ - `dist/**`, `build/**`
582
+
583
+ ## Excluding Files
584
+
585
+ Use `--exclude` flag with glob patterns to skip files:
586
+
587
+ ```bash
588
+ nk new --exclude "*.log" --exclude "temp/**"
589
+ nk update --exclude "node_modules/**" --exclude "dist/**"
590
+ ```
591
+
592
+ **Patterns:** `*` (any chars), `**` (recursive), `?` (single char), `[abc]`, `{a,b}`
593
+ **Restrictions:** No absolute paths, no path traversal (..), 1-500 chars
594
+ **Note:** User patterns are ADDED to default protected patterns
595
+
596
+ ### Custom .claude Files & Skills Migration
597
+
598
+ **Custom File Preservation:**
599
+ The CLI automatically preserves your custom `.claude/` files during updates:
600
+
601
+ - Custom slash commands
602
+ - Personal workflows
603
+ - Project-specific configurations
604
+ - Any other custom files in `.claude/` directory
605
+
606
+ **Skills Directory Migration:**
607
+ Automatic migration when structure changes (flat → categorized):
608
+
609
+ - **Detection**: Manifest-based + heuristic fallback
610
+ - **Customizations**: SHA-256 hash comparison detects modifications
611
+ - **Safety**: Backup before migration, rollback on failure
612
+ - **Preservation**: All customizations preserved during migration
613
+ - **Interactive**: Prompts for confirmation (can skip in CI/CD)
614
+
615
+ **Example Migration:**
616
+ ```
617
+ Before (flat):
618
+ .claude/skills/
619
+ ├── gemini-vision/
620
+ ├── postgresql-psql/
621
+ └── cloudflare-dns/
622
+
623
+ After (categorized):
624
+ .claude/skills/
625
+ ├── ai-multimodal/
626
+ │ └── gemini-vision/
627
+ ├── databases/
628
+ │ └── postgresql-psql/
629
+ └── devops/
630
+ └── cloudflare-dns/
631
+ ```
632
+
633
+ Customizations in any skill are detected and preserved automatically.
634
+
635
+ ## Development
636
+
637
+ See [Development Guide](./docs/codebase-summary.md) for:
638
+ - Project structure (modular domain-driven architecture)
639
+ - Build & compilation (`bun run build`, `bun run compile`)
640
+ - Testing & type checking
641
+ - Code standards & linting
642
+
643
+ **Architecture Highlights:**
644
+ - **Modular design**: 122 focused modules (target: <100 lines each)
645
+ - **Facade pattern**: Each domain exposes public API via facade
646
+ - **Phase handlers**: Complex commands use orchestrator + phase handlers
647
+ - **Self-documenting names**: kebab-case file names describe purpose
648
+
649
+ **Quick Start:**
650
+ ```bash
651
+ bun install
652
+ bun run dev new --kit engineer
653
+ bun test
654
+ # Optional: run expensive CLI integration tests explicitly
655
+ bun run test:integration
656
+ ```
657
+
658
+ ## E2E Tests
659
+
660
+ Playwright E2E tests cover the `nk migrate` dashboard (3 scenarios). Tests run against the local dev server and use API mocking — no real filesystem state is modified.
661
+
662
+ **Prerequisites:** Node 18+ or Bun 1.0+, Chromium (installed automatically).
663
+
664
+ ```bash
665
+ # One-time browser setup (if not already installed)
666
+ ./node_modules/.bin/playwright install chromium
667
+
668
+ # Run all E2E specs
669
+ bun run test:e2e
670
+
671
+ # Interactive UI mode (watch + trace viewer)
672
+ bun run test:e2e:ui
673
+ ```
674
+
675
+ Note: The dev server starts automatically via `bun run dashboard:dev`. CI wiring is a separate follow-up (local-only for now).
676
+
677
+ ## FAQ
678
+
679
+ **Q: Do I need GitHub CLI?**
680
+ A: Yes, GitHub CLI is required. NineKit uses it exclusively for authentication with private repositories.
681
+
682
+ **Q: How do I authenticate?**
683
+ A: Run `gh auth login`, select 'Login with a web browser', complete OAuth in browser. Do NOT use 'Paste an authentication token'.
684
+
685
+ **Q: "Access denied" error?**
686
+ A: Accept GitHub repo invitation, re-run `gh auth login` with web browser login, wait 2-5min for permissions.
687
+
688
+ **Q: "GitHub CLI not authenticated" error?**
689
+ A: Run `gh auth login` and select 'Login with a web browser' (NOT 'Paste token'). PAT authentication is no longer supported.
690
+
691
+ **Q: Is my token secure?**
692
+ A: Yes. GitHub CLI manages tokens securely via OAuth, stored encrypted in OS keychain.
693
+
694
+ ## License
695
+
696
+ MIT