claudeskill-cli 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 (5) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +552 -0
  3. package/bin/cs.js +187 -0
  4. package/dist/index.js +44985 -0
  5. package/package.json +91 -0
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,552 @@
1
+ # ClaudeSkill CLI
2
+
3
+ Command-line tool for bootstrapping and updating ClaudeSkill projects.
4
+
5
+ **Version**: 1.16.0
6
+
7
+ ## Overview
8
+
9
+ ClaudeSkill CLI (`cs`) is a command-line tool for bootstrapping and updating projects from private GitHub releases. Built with Bun and TypeScript, provides fast, secure project setup and maintenance.
10
+
11
+ **Key Features:**
12
+ - Multi-tier GitHub authentication (gh CLI → env vars → keychain → prompt)
13
+ - Streaming downloads with progress tracking and platform optimizations
14
+ - **Offline installation** from local archives or directories
15
+ - Smart file merging with conflict detection
16
+ - Automatic skills directory migration with parallel processing
17
+ - Secure credential storage using OS keychain
18
+ - Beautiful CLI interface with interactive prompts
19
+ - Optional package installation (OpenCode, Gemini)
20
+ - System dependency auto-installation
21
+ - Platform-specific optimizations (macOS native unzip, adaptive concurrency)
22
+ - Intelligent update notifications with 7-day cache
23
+
24
+ ## Documentation
25
+
26
+ Comprehensive documentation in `/docs`:
27
+
28
+ - **[Codebase Summary](./docs/codebase-summary.md)** - Overview, structure, key components
29
+ - **[Project Overview & PDR](./docs/project-overview-pdr.md)** - Requirements, features, roadmap
30
+ - **[System Architecture](./docs/system-architecture.md)** - Architecture diagrams, data flow
31
+ - **[Code Standards](./docs/code-standards.md)** - Coding conventions, best practices
32
+ - **[Project Roadmap](./docs/project-roadmap.md)** - Release timeline, feature status
33
+ - **[Deployment Guide](./docs/deployment-guide.md)** - Release procedures
34
+
35
+ ## Prerequisites
36
+
37
+ Before using ClaudeSkill CLI, you need to:
38
+
39
+ 1. **Purchase a ClaudeSkill Starter Kit** from [ClaudeSkill.cc](https://claudeskill.cc)
40
+ 2. **Get Repository Access**: After purchase, you'll receive access to the private GitHub repository containing your kit
41
+ 3. **Create a GitHub Personal Access Token** (PAT) with `repo` scope to download releases
42
+
43
+ Without a purchased kit and repository access, the CLI will not be able to download any project templates.
44
+
45
+ ## Installation
46
+
47
+ The ClaudeSkill CLI is published on npm at [npmjs.com/package/claudeskill-cli](https://www.npmjs.com/package/claudeskill-cli).
48
+
49
+ ### Using npm (Recommended)
50
+
51
+ ```bash
52
+ npm install -g claudeskill-cli
53
+ ```
54
+
55
+ ### Using Bun
56
+
57
+ ```bash
58
+ bun add -g claudeskill-cli
59
+ ```
60
+
61
+ ### Using Yarn
62
+
63
+ ```bash
64
+ yarn global add claudeskill-cli
65
+ ```
66
+
67
+ ### Using pnpm
68
+
69
+ ```bash
70
+ pnpm add -g claudeskill-cli
71
+ ```
72
+
73
+ After installation, verify it's working:
74
+
75
+ ```bash
76
+ cs --version
77
+ ```
78
+
79
+ ## Usage
80
+
81
+ ### Create New Project
82
+
83
+ ```bash
84
+ # Interactive mode
85
+ cs new
86
+
87
+ # With options
88
+ cs new --dir my-project --kit engineer
89
+
90
+ # Show beta versions
91
+ cs new --beta
92
+
93
+ # With exclude patterns
94
+ cs new --exclude "*.log" --exclude "temp/**"
95
+
96
+ # Optional packages (OpenCode, Gemini)
97
+ cs new --opencode --gemini
98
+
99
+ # Install skills dependencies (Python, Node packages, system tools)
100
+ cs new --install-skills
101
+
102
+ # Command prefix (/cs: namespace to avoid conflicts)
103
+ cs new --prefix
104
+
105
+ # Offline installation (from local archive or directory)
106
+ cs new --archive ~/downloads/engineer-v1.16.0.zip
107
+ cs new --kit-path ~/extracted-kit/
108
+ ```
109
+
110
+ **Flags:**
111
+ - `--install-skills`: Auto-install Python packages, system tools (FFmpeg, ImageMagick), Node.js packages
112
+ - `--prefix`: Move commands to /cs: namespace (/plan → /cs:plan)
113
+ - `--beta`: Show pre-release versions in selection
114
+ - `--opencode/--gemini`: Install optional packages
115
+ - `--archive <path>`: Use local archive (zip/tar.gz) instead of downloading
116
+ - `--kit-path <path>`: Use local kit directory instead of downloading
117
+
118
+ ### Initialize or Update Project
119
+
120
+ **Note:** Run from project root.
121
+
122
+ ```bash
123
+ # Interactive mode
124
+ cs init
125
+
126
+ # Non-interactive mode with sensible defaults
127
+ cs init --yes
128
+ cs init -y
129
+
130
+ # Combine with other flags
131
+ cs init -g --kit engineer -y
132
+
133
+ # With options
134
+ cs init --kit engineer --beta
135
+
136
+ # Global mode (platform-specific paths)
137
+ cs init --global
138
+
139
+ # Fresh installation (⚠️ DESTRUCTIVE - removes ALL customizations)
140
+ cs init --fresh
141
+
142
+ # With exclude patterns and prefix
143
+ cs init --exclude "*.local" --prefix
144
+
145
+ # Offline installation (from local archive or directory)
146
+ cs init --archive ~/downloads/engineer-v1.16.0.zip
147
+ cs init --kit-path ~/extracted-kit/
148
+ ```
149
+
150
+ **Flags:**
151
+ - `--yes/-y`: Non-interactive mode with sensible defaults (skip all prompts)
152
+ - `--global/-g`: Use platform-specific config (macOS/Linux: ~/.claude, Windows: %USERPROFILE%\.claude)
153
+ - `--fresh`: Clean reinstall, removes .claude directory (requires "yes" confirmation)
154
+ - `--beta`: Show pre-release versions
155
+ - `--prefix`: Apply /cs: namespace to commands
156
+ - `--archive <path>`: Use local archive (zip/tar.gz) instead of downloading
157
+ - `--kit-path <path>`: Use local kit directory instead of downloading
158
+
159
+ **Default Behavior with `-y` Flag:**
160
+
161
+ | Prompt | Default |
162
+ |--------|---------|
163
+ | Select ClaudeSkill | engineer (first option) |
164
+ | Target directory | Current directory (`.`) |
165
+ | Version selection | Latest stable release |
166
+ | Google Gemini setup | Skip |
167
+ | Other optional features | Skip |
168
+
169
+ ### Update CLI
170
+
171
+ Keep the ClaudeSkill CLI up to date:
172
+
173
+ ```bash
174
+ # Check for CLI updates
175
+ cs update --check
176
+
177
+ # Update to latest version
178
+ cs update
179
+
180
+ # Update to specific version
181
+ cs update --version 1.17.0
182
+
183
+ # Update to beta / skip confirmation
184
+ cs update --beta
185
+ cs update --yes
186
+ ```
187
+
188
+ The CLI notifies you when updates are available via `cs --version`.
189
+
190
+ **Skills Migration:**
191
+ - Auto-detects structure changes (flat → categorized)
192
+ - Preserves customizations (SHA-256 hashing)
193
+ - Creates backup before migration
194
+ - Rollback on failure
195
+
196
+ ### List Available Versions
197
+
198
+ ```bash
199
+ # Show all available versions for all kits
200
+ cs versions
201
+
202
+ # Filter by specific kit
203
+ cs versions --kit engineer
204
+ cs versions --kit marketing
205
+
206
+ # Show more versions (default: 30)
207
+ cs versions --limit 50
208
+
209
+ # Include prereleases and drafts
210
+ cs versions --all
211
+ ```
212
+
213
+ ### Diagnostics & Doctor
214
+
215
+ ```bash
216
+ # Full health check (default)
217
+ cs doctor
218
+
219
+ # Verbose mode with execution timing and command details
220
+ cs doctor --verbose
221
+
222
+ # Generate shareable diagnostic report (prompts for gist upload)
223
+ cs doctor --report
224
+
225
+ # Auto-fix all fixable issues
226
+ cs doctor --fix
227
+
228
+ # CI mode: no prompts, exit 1 on failures
229
+ cs doctor --check-only
230
+
231
+ # Machine-readable JSON output
232
+ cs doctor --json
233
+
234
+ # Combine flags
235
+ cs doctor --verbose --check-only --json
236
+ cs doctor --verbose --fix
237
+ ```
238
+
239
+ **Health Checks:**
240
+ - **System**: Node.js, npm, Python, pip, Claude CLI, git, gh CLI
241
+ - **ClaudeSkill**: Global/project installation, versions, skills
242
+ - **Auth**: GitHub CLI authentication, repository access
243
+ - **Project**: package.json, node_modules, lock files
244
+ - **Modules**: Dynamic skill dependency resolution
245
+
246
+ **Auto-Fix Capabilities:**
247
+ | Issue | Fix Action |
248
+ |-------|------------|
249
+ | Missing dependencies | Install via package manager |
250
+ | Missing gh auth | Run `gh auth login` |
251
+ | Corrupted node_modules | Reinstall dependencies |
252
+ | Missing global install | Run `cs init --global` |
253
+ | Missing skill deps | Install in skill directory |
254
+
255
+ **Exit Codes:**
256
+ - `0`: All checks pass or issues fixed
257
+ - `1`: Failures detected (only with `--check-only`)
258
+
259
+ > **Note:** `cs diagnose` is deprecated. Use `cs doctor` instead.
260
+
261
+ ### Uninstall
262
+
263
+ Remove ClaudeSkill installations from your system:
264
+
265
+ ```bash
266
+ cs uninstall # Interactive mode - prompts for scope and confirmation
267
+ cs uninstall --local # Uninstall only local installation (current project)
268
+ cs uninstall --global # Uninstall only global installation (~/.claude/)
269
+ cs uninstall -l -y # Local only, skip confirmation
270
+ cs uninstall -g -y # Global only, skip confirmation
271
+ cs uninstall --yes # Non-interactive - skip confirmation (for scripts)
272
+ ```
273
+
274
+ **Scope Selection:**
275
+ - When both local and global installations exist, you'll be prompted to choose:
276
+ - **Local only**: Remove from current project (`.claude/`)
277
+ - **Global only**: Remove from user directory (`~/.claude/`)
278
+ - **Both**: Remove all ClaudeSkill installations
279
+ - Use `--local` or `--global` flags to skip the prompt
280
+
281
+ **What it does:**
282
+ - Detects local `.claude` directory in current project
283
+ - Detects global `~/.claude` ClaudeSkill installation
284
+ - Shows paths before deletion
285
+ - Requires confirmation (unless `--yes` flag)
286
+ - Removes ClaudeSkill subdirectories (`commands/`, `agents/`, `skills/`, `workflows/`, `hooks/`, `metadata.json`)
287
+ - **Preserves user configs** like `settings.json`, `settings.local.json`, and `CLAUDE.md`
288
+
289
+ **Note:** Only removes valid ClaudeSkill installations (with metadata.json). Regular `.claude` directories from Claude Desktop are not affected.
290
+
291
+ ### Other Commands
292
+
293
+ ```bash
294
+ # Show CLI version (shows local + global kit versions)
295
+ cs --version
296
+
297
+ # Show help
298
+ cs --help
299
+ cs -h
300
+
301
+ # Command-specific help
302
+ cs new --help
303
+ cs init --help
304
+ cs versions --help
305
+ ```
306
+
307
+ ### Debugging
308
+
309
+ ```bash
310
+ cs new --verbose # Enable verbose logging
311
+ cs new --verbose --log-file debug.log # Save to file
312
+ CLAUDEKIT_VERBOSE=1 cs new # Via environment variable
313
+ ```
314
+
315
+ ### Cache Configuration
316
+
317
+ Release data is cached locally to improve performance. You can configure the cache TTL:
318
+
319
+ ```bash
320
+ # Set custom cache TTL (in seconds, default: 3600 = 1 hour)
321
+ CK_CACHE_TTL=7200 cs versions # Cache for 2 hours
322
+ CK_CACHE_TTL=0 cs versions # Disable caching (always fetch fresh)
323
+
324
+ # Permanent configuration (add to ~/.bashrc or ~/.zshrc)
325
+ export CK_CACHE_TTL=1800 # 30 minutes
326
+ ```
327
+
328
+ **Cache Location:** `~/.claudeskill/cache/releases/`
329
+
330
+ ### Update Notifications
331
+
332
+ The `cs --version` command checks for newer versions of your installed ClaudeSkill and displays a notification if an update is available. The check is cached for 7 days to minimize API calls.
333
+
334
+ **Disable Update Notifications:**
335
+ ```bash
336
+ # Set environment variable to disable
337
+ NO_UPDATE_NOTIFIER=1 cs --version
338
+
339
+ # Windows (permanent)
340
+ [System.Environment]::SetEnvironmentVariable("NO_UPDATE_NOTIFIER", "1", [System.EnvironmentVariableTarget]::User)
341
+
342
+ # macOS/Linux (add to ~/.bashrc or ~/.zshrc)
343
+ export NO_UPDATE_NOTIFIER=1
344
+ ```
345
+
346
+ **Cache Location:** `~/.claudeskill/cache/version-check.json` (Windows: `%USERPROFILE%\.claudeskill\cache\`)
347
+
348
+ ## Authentication
349
+
350
+ The CLI requires GitHub authentication to download releases from private repositories.
351
+
352
+ ### Authentication Flow
353
+
354
+ ```
355
+ ┌─────────────────────────────────────────────────┐
356
+ │ Multi-Tier Authentication │
357
+ │ │
358
+ │ 1. GitHub CLI (gh auth token) │
359
+ │ ↓ (if not available) │
360
+ │ 2. Environment Variables (GITHUB_TOKEN) │
361
+ │ ↓ (if not set) │
362
+ │ 3. Config File (~/.claudeskill/config.json) │
363
+ │ ↓ (if not found) │
364
+ │ 4. OS Keychain (secure storage) │
365
+ │ ↓ (if not stored) │
366
+ │ 5. User Prompt (with save option) │
367
+ └─────────────────────────────────────────────────┘
368
+ ```
369
+
370
+ ### Quick Setup
371
+
372
+ **Step 1: Install GitHub CLI**
373
+ ```bash
374
+ # Windows
375
+ winget install GitHub.cli
376
+
377
+ # macOS
378
+ brew install gh
379
+
380
+ # Linux
381
+ sudo apt install gh
382
+ ```
383
+
384
+ **Step 2: Authenticate with GitHub CLI**
385
+ ```bash
386
+ gh auth login
387
+ ```
388
+
389
+ When prompted, follow these steps:
390
+ 1. Select **GitHub.com**
391
+ 2. Select **HTTPS** (or SSH if preferred)
392
+ 3. Authenticate Git? → **Yes**
393
+ 4. Select **Login with a web browser** (⚠️ recommended)
394
+ 5. Copy the one-time code shown
395
+ 6. Press Enter to open browser and paste the code
396
+ 7. Authorize GitHub CLI
397
+
398
+ > **⚠️ 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.
399
+
400
+ ## Troubleshooting
401
+
402
+ Run the doctor command to diagnose issues:
403
+
404
+ ```bash
405
+ # Interactive diagnostics
406
+ cs doctor
407
+
408
+ # Generate report for support
409
+ cs doctor --report
410
+
411
+ # CI/automation
412
+ cs doctor --check-only --json
413
+
414
+ # Verbose logging
415
+ cs new --verbose
416
+ cs init --verbose
417
+ ```
418
+
419
+ **Common Issues:**
420
+ - **"Access denied"**: Run `cs doctor` to check auth, use `--fix` to auto-repair
421
+ - **"Authentication failed"**: Run `cs doctor --fix` to re-authenticate, or manually run `gh auth login` (select 'Login with a web browser')
422
+ - **"GitHub CLI not authenticated"**: Run `gh auth login` and select 'Login with a web browser' (NOT 'Paste token')
423
+ - **Module errors**: Run `cs doctor --fix` to reinstall skill dependencies
424
+ - **Need help**: Run `cs doctor --report` and share the gist URL
425
+
426
+ ## Available Kits
427
+
428
+ ClaudeSkill offers premium starter kits available for purchase at [ClaudeSkill.cc](https://claudeskill.cc):
429
+
430
+ - **engineer**: ClaudeSkill Engineer - Engineering toolkit for building with Claude
431
+ - **marketing**: ClaudeSkill Marketing - [Coming Soon]
432
+
433
+ Each kit provides a comprehensive project template with best practices, tooling, and workflows optimized for Claude Code development.
434
+
435
+ ## Configuration
436
+
437
+ Configuration is stored in `~/.claudeskill/config.json`:
438
+
439
+ ```json
440
+ {
441
+ "github": {
442
+ "token": "stored_in_keychain"
443
+ },
444
+ "defaults": {
445
+ "kit": "engineer",
446
+ "dir": "."
447
+ }
448
+ }
449
+ ```
450
+
451
+ ## Protected Files
452
+
453
+ The following file patterns are protected and will not be overwritten during updates:
454
+
455
+ - `.env`, `.env.local`, `.env.*.local`
456
+ - `*.key`, `*.pem`, `*.p12`
457
+ - `node_modules/**`, `.git/**`
458
+ - `dist/**`, `build/**`
459
+
460
+ ## Excluding Files
461
+
462
+ Use `--exclude` flag with glob patterns to skip files:
463
+
464
+ ```bash
465
+ cs new --exclude "*.log" --exclude "temp/**"
466
+ cs update --exclude "node_modules/**" --exclude "dist/**"
467
+ ```
468
+
469
+ **Patterns:** `*` (any chars), `**` (recursive), `?` (single char), `[abc]`, `{a,b}`
470
+ **Restrictions:** No absolute paths, no path traversal (..), 1-500 chars
471
+ **Note:** User patterns are ADDED to default protected patterns
472
+
473
+ ### Custom .claude Files & Skills Migration
474
+
475
+ **Custom File Preservation:**
476
+ The CLI automatically preserves your custom `.claude/` files during updates:
477
+
478
+ - Custom slash commands
479
+ - Personal workflows
480
+ - Project-specific configurations
481
+ - Any other custom files in `.claude/` directory
482
+
483
+ **Skills Directory Migration:**
484
+ Automatic migration when structure changes (flat → categorized):
485
+
486
+ - **Detection**: Manifest-based + heuristic fallback
487
+ - **Customizations**: SHA-256 hash comparison detects modifications
488
+ - **Safety**: Backup before migration, rollback on failure
489
+ - **Preservation**: All customizations preserved during migration
490
+ - **Interactive**: Prompts for confirmation (can skip in CI/CD)
491
+
492
+ **Example Migration:**
493
+ ```
494
+ Before (flat):
495
+ .claude/skills/
496
+ ├── gemini-vision/
497
+ ├── postgresql-psql/
498
+ └── cloudflare-dns/
499
+
500
+ After (categorized):
501
+ .claude/skills/
502
+ ├── ai-multimodal/
503
+ │ └── gemini-vision/
504
+ ├── databases/
505
+ │ └── postgresql-psql/
506
+ └── devops/
507
+ └── cloudflare-dns/
508
+ ```
509
+
510
+ Customizations in any skill are detected and preserved automatically.
511
+
512
+ ## Development
513
+
514
+ See [Development Guide](./docs/codebase-summary.md) for:
515
+ - Project structure (modular domain-driven architecture)
516
+ - Build & compilation (`bun run build`, `bun run compile`)
517
+ - Testing & type checking
518
+ - Code standards & linting
519
+
520
+ **Architecture Highlights:**
521
+ - **Modular design**: 122 focused modules (target: <100 lines each)
522
+ - **Facade pattern**: Each domain exposes public API via facade
523
+ - **Phase handlers**: Complex commands use orchestrator + phase handlers
524
+ - **Self-documenting names**: kebab-case file names describe purpose
525
+
526
+ **Quick Start:**
527
+ ```bash
528
+ bun install
529
+ bun run dev new --kit engineer
530
+ bun test
531
+ ```
532
+
533
+ ## FAQ
534
+
535
+ **Q: Do I need GitHub CLI?**
536
+ A: Yes, GitHub CLI is required. ClaudeSkill uses it exclusively for authentication with private repositories.
537
+
538
+ **Q: How do I authenticate?**
539
+ A: Run `gh auth login`, select 'Login with a web browser', complete OAuth in browser. Do NOT use 'Paste an authentication token'.
540
+
541
+ **Q: "Access denied" error?**
542
+ A: Accept GitHub repo invitation, re-run `gh auth login` with web browser login, wait 2-5min for permissions.
543
+
544
+ **Q: "GitHub CLI not authenticated" error?**
545
+ A: Run `gh auth login` and select 'Login with a web browser' (NOT 'Paste token'). PAT authentication is no longer supported.
546
+
547
+ **Q: Is my token secure?**
548
+ A: Yes. GitHub CLI manages tokens securely via OAuth, stored encrypted in OS keychain.
549
+
550
+ ## License
551
+
552
+ MIT