@lumy-pack/syncpoint 0.0.1 → 0.0.2

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 ADDED
@@ -0,0 +1,921 @@
1
+ # Syncpoint
2
+
3
+ > Personal Environment Manager — Config backup/restore and machine provisioning CLI
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@lumy-pack/syncpoint.svg)](https://www.npmjs.com/package/@lumy-pack/syncpoint)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ Syncpoint is a powerful CLI tool for managing your development environment configurations. Backup your dotfiles, restore them on new machines, and provision your system with automated templates—all with built-in safety features and security checks.
9
+
10
+ ## ✨ Features
11
+
12
+ - 🧙 **AI-Powered Wizards** — LLM-assisted config generation and template creation with Claude Code
13
+ - 📦 **Config Backup** — Create compressed archives of your dotfiles and configs with metadata tracking
14
+ - 🔄 **Smart Restore** — Hash-based file comparison with automatic safety backups before overwrite
15
+ - 🚀 **Machine Provisioning** — Template-based system setup with YAML-defined installation steps
16
+ - 🛡️ **Security First** — Sensitive file detection, symlink attack prevention, remote script blocking
17
+ - 📊 **Interactive Management** — Browse backups and templates with a beautiful terminal UI
18
+ - 🎯 **Flexible Patterns** — Glob/regex support, tilde expansion, and customizable filename placeholders
19
+
20
+ ## 📦 Installation
21
+
22
+ **Recommended: Use with npx (no installation required)**
23
+
24
+ ```bash
25
+ npx @lumy-pack/syncpoint <command>
26
+ ```
27
+
28
+ Or install globally if you prefer:
29
+
30
+ ```bash
31
+ # Using npm
32
+ npm install -g @lumy-pack/syncpoint
33
+
34
+ # Using pnpm
35
+ pnpm add -g @lumy-pack/syncpoint
36
+ ```
37
+
38
+ ## 🚀 Quick Start
39
+
40
+ ### Option A: 🧙 AI-Powered Setup (Recommended)
41
+
42
+ The fastest and easiest way to get started. AI automatically generates your configuration file.
43
+
44
+ **Requirements:** [Claude Code CLI](https://claude.ai/code) installed (or use `--print` mode)
45
+
46
+ 1. **Initialize syncpoint**
47
+
48
+ ```bash
49
+ npx @lumy-pack/syncpoint init
50
+ ```
51
+
52
+ 2. **Run AI wizard to generate config**
53
+
54
+ ```bash
55
+ npx @lumy-pack/syncpoint wizard
56
+ ```
57
+
58
+ The wizard will automatically:
59
+ - Scan your home directory for backup targets
60
+ - Generate an optimized config.yml via AI
61
+ - Validate and auto-correct (up to 3 retry attempts)
62
+
63
+ 3. **Create your first backup**
64
+
65
+ ```bash
66
+ npx @lumy-pack/syncpoint backup
67
+ ```
68
+
69
+ 4. **Restore on another machine**
70
+
71
+ ```bash
72
+ npx @lumy-pack/syncpoint restore
73
+ ```
74
+
75
+ **Tip:** If you don't have Claude Code, use `--print` to get the prompt for any LLM:
76
+ ```bash
77
+ npx @lumy-pack/syncpoint wizard --print
78
+ ```
79
+
80
+ ---
81
+
82
+ ### Option B: 📝 Manual Setup
83
+
84
+ If you prefer to manually edit your configuration file, use this approach.
85
+
86
+ 1. **Initialize syncpoint**
87
+
88
+ ```bash
89
+ npx @lumy-pack/syncpoint init
90
+ ```
91
+
92
+ 2. **Edit your configuration**
93
+
94
+ Open `~/.syncpoint/config.yml` and customize your backup targets:
95
+
96
+ ```yaml
97
+ backup:
98
+ targets:
99
+ - ~/.zshrc
100
+ - ~/.gitconfig
101
+ - ~/.ssh/config
102
+ exclude:
103
+ - "**/*.swp"
104
+ filename: "{hostname}_{datetime}"
105
+ ```
106
+
107
+ 3. **Create your first backup**
108
+
109
+ ```bash
110
+ npx @lumy-pack/syncpoint backup
111
+ ```
112
+
113
+ 4. **Restore on another machine**
114
+
115
+ ```bash
116
+ npx @lumy-pack/syncpoint restore
117
+ ```
118
+
119
+ ---
120
+
121
+ ### 🎯 Bonus: Create Provisioning Templates
122
+
123
+ To automate new machine setup:
124
+
125
+ ```bash
126
+ # Generate template with AI wizard
127
+ npx @lumy-pack/syncpoint create-template my-dev-setup
128
+
129
+ # Run provisioning
130
+ npx @lumy-pack/syncpoint provision my-dev-setup
131
+ ```
132
+
133
+ ## 📖 Commands
134
+
135
+ ### `syncpoint init`
136
+
137
+ Initialize the syncpoint directory structure and create default configuration.
138
+
139
+ **What it does:**
140
+ - Creates `~/.syncpoint/` directory structure
141
+ - Sets up subdirectories: `backups/`, `templates/`, `scripts/`, `logs/`
142
+ - Generates default `config.yml`
143
+ - Creates an example provisioning template
144
+
145
+ **Usage:**
146
+
147
+ ```bash
148
+ npx @lumy-pack/syncpoint init
149
+ ```
150
+
151
+ ---
152
+
153
+ ### `syncpoint wizard [options]`
154
+
155
+ Interactive LLM-powered wizard to generate personalized `config.yml` based on your home directory.
156
+
157
+ **What it does:**
158
+ 1. Scans your home directory for common configuration files
159
+ 2. Categorizes files (shell configs, git, SSH, application configs)
160
+ 3. Invokes Claude Code to generate customized backup configuration
161
+ 4. Validates generated config with automatic retry on errors (max 3 attempts)
162
+ 5. Backs up existing config before overwrite (saved as `config.yml.bak`)
163
+ 6. Writes validated configuration to `~/.syncpoint/config.yml`
164
+
165
+ **Options:**
166
+
167
+ | Option | Description |
168
+ |--------|-------------|
169
+ | `-p, --print` | Print prompt for manual LLM usage instead of invoking Claude Code |
170
+
171
+ **Usage:**
172
+
173
+ ```bash
174
+ # Interactive wizard (requires Claude Code CLI)
175
+ npx @lumy-pack/syncpoint wizard
176
+
177
+ # Print prompt for manual use
178
+ npx @lumy-pack/syncpoint wizard --print
179
+ ```
180
+
181
+ **Requirements:**
182
+ - Claude Code CLI must be installed for default mode
183
+ - Use `--print` mode if Claude Code is not available
184
+
185
+ **Validation:**
186
+ - Automatic AJV schema validation
187
+ - Retry loop with error feedback to LLM
188
+ - Session resume preserves conversation context
189
+
190
+ ---
191
+
192
+ ### `syncpoint create-template [name] [options]`
193
+
194
+ Interactive LLM-powered wizard to create custom provisioning templates.
195
+
196
+ **What it does:**
197
+ 1. Guides you through defining provisioning requirements
198
+ 2. Invokes Claude Code to generate template YAML
199
+ 3. Validates template structure with automatic retry (max 3 attempts)
200
+ 4. Writes template to `~/.syncpoint/templates/`
201
+ 5. Prevents overwriting existing templates
202
+
203
+ **Options:**
204
+
205
+ | Option | Description |
206
+ |--------|-------------|
207
+ | `-p, --print` | Print prompt for manual LLM usage instead of invoking Claude Code |
208
+
209
+ **Usage:**
210
+
211
+ ```bash
212
+ # Interactive template creation (requires Claude Code CLI)
213
+ npx @lumy-pack/syncpoint create-template
214
+
215
+ # Create with specific name
216
+ npx @lumy-pack/syncpoint create-template my-dev-setup
217
+
218
+ # Print prompt for manual use
219
+ npx @lumy-pack/syncpoint create-template --print
220
+ ```
221
+
222
+ **Template Fields:**
223
+ - `name` (required) — Template name
224
+ - `description` (optional) — Template description
225
+ - `steps` (required) — Array of provisioning steps
226
+ - `backup` (optional) — Backup name to restore after provisioning
227
+ - `sudo` (optional) — Whether sudo privilege is required
228
+
229
+ **Step Fields:**
230
+ - `name` (required) — Step name
231
+ - `command` (required) — Shell command to execute
232
+ - `description` (optional) — Step description
233
+ - `skip_if` (optional) — Condition to skip step
234
+ - `continue_on_error` (optional) — Continue on failure (default: false)
235
+
236
+ ---
237
+
238
+ ### `syncpoint backup [options]`
239
+
240
+ Create a compressed backup archive of your configuration files.
241
+
242
+ **What it does:**
243
+ 1. Scans configured target files and directories
244
+ 2. Applies glob patterns and exclusions
245
+ 3. Warns about large files (>10MB) and sensitive files (SSH keys, certificates)
246
+ 4. Collects file hashes for comparison
247
+ 5. Optionally includes scripts from `~/.syncpoint/scripts/`
248
+ 6. Creates compressed tar.gz archive with metadata
249
+
250
+ **Options:**
251
+
252
+ | Option | Description |
253
+ |--------|-------------|
254
+ | `--dry-run` | Preview files to be backed up without creating archive |
255
+ | `--tag <name>` | Add custom tag to backup filename |
256
+
257
+ **Usage:**
258
+
259
+ ```bash
260
+ # Create a backup
261
+ npx @lumy-pack/syncpoint backup
262
+
263
+ # Preview backup contents
264
+ npx @lumy-pack/syncpoint backup --dry-run
265
+
266
+ # Create a tagged backup
267
+ npx @lumy-pack/syncpoint backup --tag "before-upgrade"
268
+ ```
269
+
270
+ **Output:**
271
+
272
+ Backups are saved to `~/.syncpoint/backups/` (or custom destination) with filename pattern from config. Example: `macbook-pro_2024-01-15_14-30-00.tar.gz`
273
+
274
+ ---
275
+
276
+ ### `syncpoint restore [filename] [options]`
277
+
278
+ Restore configuration files from a backup archive.
279
+
280
+ **What it does:**
281
+ 1. Lists available backups (if no filename provided)
282
+ 2. Generates restore plan by comparing file hashes:
283
+ - `create` — File doesn't exist locally
284
+ - `skip` — File is identical (same hash)
285
+ - `overwrite` — File has been modified
286
+ 3. Creates automatic safety backup of files to be overwritten (tagged `_pre-restore_`)
287
+ 4. Extracts and restores files to original locations
288
+ 5. Validates symlinks to prevent security attacks
289
+
290
+ **Options:**
291
+
292
+ | Option | Description |
293
+ |--------|-------------|
294
+ | `--dry-run` | Show restore plan without actually restoring |
295
+
296
+ **Usage:**
297
+
298
+ ```bash
299
+ # Interactive: select from available backups
300
+ npx @lumy-pack/syncpoint restore
301
+
302
+ # Restore specific backup
303
+ npx @lumy-pack/syncpoint restore macbook-pro_2024-01-15.tar.gz
304
+
305
+ # Preview restore actions
306
+ npx @lumy-pack/syncpoint restore --dry-run
307
+ ```
308
+
309
+ **Safety Features:**
310
+ - Automatic safety backup before any file is overwritten
311
+ - Hash-based comparison to skip identical files
312
+ - Symlink validation to prevent directory traversal attacks
313
+
314
+ ---
315
+
316
+ ### `syncpoint provision <template> [options]`
317
+
318
+ Run template-based machine provisioning to install software and configure your system.
319
+
320
+ **What it does:**
321
+ 1. Loads template YAML from `~/.syncpoint/templates/`
322
+ 2. Validates template structure and security
323
+ 3. Checks for sudo requirement (prompts if needed)
324
+ 4. Executes steps sequentially with real-time progress
325
+ 5. Evaluates `skip_if` conditions before running steps
326
+ 6. Captures command output and handles errors
327
+ 7. Optionally restores config backup after provisioning
328
+
329
+ **Options:**
330
+
331
+ | Option | Description |
332
+ |--------|-------------|
333
+ | `--dry-run` | Show execution plan without running commands |
334
+ | `--skip-restore` | Skip automatic config restore after provisioning |
335
+
336
+ **Usage:**
337
+
338
+ ```bash
339
+ # Run provisioning template
340
+ npx @lumy-pack/syncpoint provision my-setup
341
+
342
+ # Preview template execution
343
+ npx @lumy-pack/syncpoint provision my-setup --dry-run
344
+
345
+ # Provision without restoring configs
346
+ npx @lumy-pack/syncpoint provision my-setup --skip-restore
347
+ ```
348
+
349
+ **Security:**
350
+ - Blocks dangerous remote script patterns (`curl | bash`, `wget | sh`)
351
+ - Sanitizes error output to mask sensitive paths and credentials
352
+ - Validates all templates against schema
353
+ - 5-minute timeout per step
354
+
355
+ ---
356
+
357
+ ### `syncpoint list [type]`
358
+
359
+ Browse and manage backups and templates interactively.
360
+
361
+ **What it does:**
362
+ - Displays interactive menu to browse backups or templates
363
+ - Shows detailed metadata (size, date, file count, description)
364
+ - Allows safe deletion of backups with confirmation
365
+ - Previews template steps and configuration
366
+
367
+ **Usage:**
368
+
369
+ ```bash
370
+ # Interactive menu
371
+ npx @lumy-pack/syncpoint list
372
+
373
+ # Direct navigation
374
+ npx @lumy-pack/syncpoint list backups
375
+ npx @lumy-pack/syncpoint list templates
376
+ ```
377
+
378
+ **Navigation:**
379
+ - Use arrow keys to select items
380
+ - Press Enter to view details
381
+ - Press ESC to go back
382
+ - Confirm before deletion
383
+
384
+ ---
385
+
386
+ ### `syncpoint status [options]`
387
+
388
+ Show status summary and manage cleanup of `~/.syncpoint/` directory.
389
+
390
+ **What it does:**
391
+ - Scans all subdirectories and calculates statistics
392
+ - Displays file counts and total sizes
393
+ - Shows backup timeline (newest and oldest)
394
+ - Optional cleanup mode with multiple strategies
395
+
396
+ **Options:**
397
+
398
+ | Option | Description |
399
+ |--------|-------------|
400
+ | `--cleanup` | Enter interactive cleanup mode |
401
+
402
+ **Usage:**
403
+
404
+ ```bash
405
+ # Show status summary
406
+ npx @lumy-pack/syncpoint status
407
+
408
+ # Cleanup old backups
409
+ npx @lumy-pack/syncpoint status --cleanup
410
+ ```
411
+
412
+ **Cleanup Strategies:**
413
+ - Keep only 5 most recent backups
414
+ - Remove backups older than 30 days
415
+ - Delete all log files
416
+ - Manual selection for precise control
417
+
418
+ ---
419
+
420
+ ## ⚙️ Configuration
421
+
422
+ Syncpoint uses `~/.syncpoint/config.yml` for configuration.
423
+
424
+ ### Configuration Schema
425
+
426
+ ```yaml
427
+ backup:
428
+ # (Required) List of files/directories to backup
429
+ # Supports three pattern types:
430
+ # - Literal paths: ~/.zshrc, /etc/hosts
431
+ # - Glob patterns: ~/.config/*.conf, **/*.toml
432
+ # - Regex patterns: /\.conf$/, /\.toml$/ (scans ~/ with depth limit 5)
433
+ targets:
434
+ - ~/.zshrc
435
+ - ~/.zprofile
436
+ - ~/.gitconfig
437
+ - ~/.ssh/config
438
+ - ~/.config/**/*.conf
439
+ # Example regex: /\.toml$/ finds all .toml files in home directory
440
+
441
+ # (Required) Patterns to exclude from backup
442
+ # Supports glob and regex patterns
443
+ exclude:
444
+ - "**/*.swp"
445
+ - "**/.DS_Store"
446
+ - "**/node_modules"
447
+ # Example regex: "/\\.bak$/" excludes all .bak files
448
+
449
+ # (Required) Backup filename pattern
450
+ # Available placeholders: {hostname}, {date}, {time}, {datetime}, {tag}
451
+ filename: "{hostname}_{datetime}"
452
+
453
+ # (Optional) Custom backup destination
454
+ # Default: ~/.syncpoint/backups/
455
+ destination: ~/Backups
456
+
457
+ scripts:
458
+ # (Optional) Include ~/.syncpoint/scripts/ in backups
459
+ # Default: true
460
+ includeInBackup: true
461
+ ```
462
+
463
+ ### Filename Placeholders
464
+
465
+ | Placeholder | Example | Description |
466
+ |-------------|---------|-------------|
467
+ | `{hostname}` | `macbook-pro` | System hostname |
468
+ | `{date}` | `2024-01-15` | Current date (YYYY-MM-DD) |
469
+ | `{time}` | `14-30-00` | Current time (HH-MM-SS) |
470
+ | `{datetime}` | `2024-01-15_14-30-00` | Combined date and time |
471
+ | `{tag}` | `before-upgrade` | Custom tag from `--tag` option |
472
+
473
+ ### Pattern Types
474
+
475
+ Syncpoint supports three types of patterns for `targets` and `exclude` fields:
476
+
477
+ #### Literal Paths
478
+
479
+ Direct file or directory paths. Tilde (`~`) is automatically expanded to home directory.
480
+
481
+ **Examples:**
482
+ - `~/.zshrc` — Specific file in home directory
483
+ - `/etc/hosts` — Absolute path
484
+ - `~/.ssh/config` — Nested file
485
+
486
+ #### Glob Patterns
487
+
488
+ Wildcard patterns for matching multiple files. Uses standard glob syntax.
489
+
490
+ **Examples:**
491
+ - `*.conf` — All .conf files in current directory
492
+ - `~/.config/*.yml` — All .yml files in ~/.config/
493
+ - `**/*.toml` — All .toml files recursively
494
+ - `~/.config/**/*.conf` — All .conf files under ~/.config/ recursively
495
+
496
+ **Glob metacharacters:** `*` (any), `?` (single), `{a,b}` (alternatives)
497
+
498
+ #### Regex Patterns
499
+
500
+ Regular expressions for advanced pattern matching. Must be enclosed in forward slashes (`/pattern/`).
501
+
502
+ **Format:** `/pattern/` (e.g., `/\.conf$/`)
503
+
504
+ **Examples:**
505
+ - `/\.conf$/` — Files ending with .conf
506
+ - `/\.toml$/` — Files ending with .toml
507
+ - `/\.(bak|tmp)$/` — Files ending with .bak or .tmp
508
+ - `/^\.config\//` — Files starting with .config/
509
+
510
+ **Limitations:**
511
+ - Regex targets scan home directory (`~/`) only
512
+ - Maximum depth: 5 levels for performance
513
+ - No unescaped forward slashes in pattern body
514
+
515
+ **When to use regex:**
516
+ - Complex extension matching: `/\.(conf|toml|yaml)$/`
517
+ - Pattern-based exclusions: `/\.(bak|tmp|cache)$/`
518
+ - Path prefix/suffix matching
519
+
520
+ ### Example Configuration
521
+
522
+ ```yaml
523
+ backup:
524
+ targets:
525
+ - ~/.zshrc
526
+ - ~/.zprofile
527
+ - ~/.gitconfig
528
+ - ~/.gitignore_global
529
+ - ~/.ssh/config
530
+ - ~/.config/starship.toml
531
+ - ~/Documents/notes
532
+
533
+ exclude:
534
+ - "**/*.swp"
535
+ - "**/*.tmp"
536
+ - "**/.DS_Store"
537
+ - "**/*cache*"
538
+
539
+ filename: "{hostname}_{date}_{tag}"
540
+ destination: ~/Dropbox/backups
541
+
542
+ scripts:
543
+ includeInBackup: true
544
+ ```
545
+
546
+ ---
547
+
548
+ ## 📝 Provisioning Templates
549
+
550
+ Templates are YAML files stored in `~/.syncpoint/templates/` that define automated provisioning steps.
551
+
552
+ ### Template Schema
553
+
554
+ ```yaml
555
+ # (Required) Template name
556
+ name: string
557
+
558
+ # (Optional) Template description
559
+ description: string
560
+
561
+ # (Optional) Backup to restore after provisioning
562
+ backup: string
563
+
564
+ # (Optional) Require sudo privilege
565
+ sudo: boolean
566
+
567
+ # (Required) List of provisioning steps
568
+ steps:
569
+ - name: string # (Required) Step name
570
+ description: string # (Optional) Step description
571
+ command: string # (Required) Shell command to execute
572
+ skip_if: string # (Optional) Skip if this command succeeds
573
+ continue_on_error: boolean # (Optional) Continue on failure (default: false)
574
+ ```
575
+
576
+ ### Example Template
577
+
578
+ Create `~/.syncpoint/templates/dev-setup.yml`:
579
+
580
+ ```yaml
581
+ name: Development Setup
582
+ description: Install development tools and configure environment
583
+ sudo: true
584
+
585
+ steps:
586
+ - name: Update System
587
+ description: Update package manager
588
+ command: apt-get update && apt-get upgrade -y
589
+
590
+ - name: Install Git
591
+ command: apt-get install -y git
592
+ skip_if: which git
593
+
594
+ - name: Install Node.js
595
+ command: curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs
596
+ skip_if: which node
597
+
598
+ - name: Install pnpm
599
+ command: npm install -g pnpm
600
+ skip_if: which pnpm
601
+
602
+ - name: Configure Git
603
+ command: |
604
+ git config --global user.name "Your Name"
605
+ git config --global user.email "your.email@example.com"
606
+ continue_on_error: true
607
+
608
+ - name: Clone Repositories
609
+ description: Clone important repositories
610
+ command: |
611
+ mkdir -p ~/projects
612
+ cd ~/projects
613
+ git clone https://github.com/username/repo.git
614
+ ```
615
+
616
+ ### Running Templates
617
+
618
+ ```bash
619
+ # Preview template execution
620
+ npx @lumy-pack/syncpoint provision dev-setup --dry-run
621
+
622
+ # Run template
623
+ npx @lumy-pack/syncpoint provision dev-setup
624
+
625
+ # Run and skip config restore
626
+ npx @lumy-pack/syncpoint provision dev-setup --skip-restore
627
+ ```
628
+
629
+ ---
630
+
631
+ ## 📁 Directory Structure
632
+
633
+ After initialization, syncpoint creates the following structure:
634
+
635
+ ```
636
+ ~/.syncpoint/
637
+ ├── config.yml # Main configuration file
638
+ ├── backups/ # Backup archives (tar.gz)
639
+ │ ├── host1_2024-01-15.tar.gz
640
+ │ └── host1_2024-01-20.tar.gz
641
+ ├── templates/ # Provisioning templates (YAML)
642
+ │ ├── example.yml
643
+ │ └── dev-setup.yml
644
+ ├── scripts/ # Optional shell scripts to include in backups
645
+ │ └── custom-script.sh
646
+ └── logs/ # Operation logs
647
+ ```
648
+
649
+ ### Backup Archive Contents
650
+
651
+ Each backup archive contains:
652
+ - Your configuration files in their relative paths
653
+ - `_metadata.json` with backup information:
654
+ - File hashes for comparison
655
+ - System information (hostname, platform, architecture)
656
+ - Backup creation timestamp
657
+ - File count and total size
658
+
659
+ ---
660
+
661
+ ## 💡 Examples
662
+
663
+ ### Backup and Restore Workflow
664
+
665
+ **On your current machine:**
666
+
667
+ ```bash
668
+ # Initialize and configure
669
+ npx @lumy-pack/syncpoint init
670
+ vim ~/.syncpoint/config.yml # Edit targets
671
+
672
+ # Create backup
673
+ npx @lumy-pack/syncpoint backup --tag "work-setup"
674
+ ```
675
+
676
+ **On a new machine:**
677
+
678
+ ```bash
679
+ # Initialize (no installation needed with npx!)
680
+ npx @lumy-pack/syncpoint init
681
+
682
+ # Copy backup file to ~/.syncpoint/backups/
683
+ # Or set custom destination in config.yml
684
+
685
+ # Restore
686
+ npx @lumy-pack/syncpoint restore
687
+ # Select your backup from the list
688
+ ```
689
+
690
+ ### Machine Provisioning Workflow
691
+
692
+ **Setup a new development machine:**
693
+
694
+ ```bash
695
+ # Initialize syncpoint
696
+ npx @lumy-pack/syncpoint init
697
+
698
+ # Create provisioning template
699
+ cat > ~/.syncpoint/templates/new-machine.yml << 'EOF'
700
+ name: New Machine Setup
701
+ description: Complete development environment setup
702
+ sudo: true
703
+
704
+ steps:
705
+ - name: Install Homebrew
706
+ command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
707
+ skip_if: which brew
708
+
709
+ - name: Install Core Tools
710
+ command: brew install git vim tmux
711
+
712
+ - name: Install Node.js
713
+ command: brew install node@20
714
+ skip_if: which node
715
+
716
+ - name: Install pnpm
717
+ command: npm install -g pnpm
718
+ skip_if: which pnpm
719
+ EOF
720
+
721
+ # Preview execution
722
+ npx @lumy-pack/syncpoint provision new-machine --dry-run
723
+
724
+ # Run provisioning
725
+ npx @lumy-pack/syncpoint provision new-machine
726
+ ```
727
+
728
+ ### Cleanup Old Backups
729
+
730
+ ```bash
731
+ # Check current status
732
+ npx @lumy-pack/syncpoint status
733
+
734
+ # Interactive cleanup
735
+ npx @lumy-pack/syncpoint status --cleanup
736
+
737
+ # Options:
738
+ # 1. Keep only 5 most recent backups
739
+ # 2. Remove backups older than 30 days
740
+ # 3. Delete all logs
741
+ # 4. Manual selection
742
+ ```
743
+
744
+ ---
745
+
746
+ ## 🛡️ Security Features
747
+
748
+ Syncpoint includes multiple security layers to protect your data and system:
749
+
750
+ ### Backup Security
751
+
752
+ - **Sensitive File Warnings** — Alerts when backing up SSH keys, certificates, or private keys
753
+ - Patterns: `id_rsa`, `id_ed25519`, `*.pem`, `*.key`
754
+ - **Large File Warnings** — Warns about files larger than 10MB
755
+ - **File Hashing** — SHA-256 hashes for reliable file comparison
756
+
757
+ ### Restore Security
758
+
759
+ - **Automatic Safety Backups** — Creates `_pre-restore_` backup before overwriting files
760
+ - **Hash Comparison** — Skips identical files to prevent unnecessary changes
761
+ - **Symlink Validation** — Prevents symlink attacks and directory traversal
762
+ - **Dry-run Mode** — Preview all changes before applying
763
+
764
+ ### Provisioning Security
765
+
766
+ - **Remote Script Blocking** — Blocks dangerous patterns:
767
+ - `curl ... | bash`
768
+ - `wget ... | sh`
769
+ - `curl ... | python`
770
+ - Any pipe to shell execution from remote sources
771
+ - **Error Sanitization** — Masks sensitive information in error output (paths, passwords, tokens)
772
+ - **Template Validation** — JSON Schema validation for all templates
773
+ - **Sudo Handling** — Prompts for elevation only when required
774
+ - **Command Timeout** — 5-minute timeout per step prevents hanging
775
+
776
+ ### General Safety
777
+
778
+ - **Path Validation** — Prevents operations outside allowed directories
779
+ - **Deletion Restrictions** — Only allows deletion within syncpoint directories
780
+ - **Permission Checks** — Validates file permissions before operations
781
+
782
+ ---
783
+
784
+ ## 🔧 Troubleshooting
785
+
786
+ ### Wizard Commands
787
+
788
+ **Claude Code CLI not found**
789
+
790
+ If you see "Claude Code CLI not found" error:
791
+ 1. Install Claude Code CLI: Visit [claude.ai/code](https://claude.ai/code) for installation instructions
792
+ 2. Or use `--print` mode to get the prompt and use it with your preferred LLM
793
+ 3. Verify installation: `claude --version`
794
+
795
+ **Validation errors after LLM generation**
796
+
797
+ The wizard automatically retries up to 3 times when validation fails:
798
+ - Each retry includes error feedback to help the LLM correct the issues
799
+ - If all retries fail, check the validation error messages
800
+ - Common issues:
801
+ - Missing required fields (`backup.targets`, `backup.exclude`, `backup.filename`)
802
+ - Invalid pattern syntax in targets/exclude arrays
803
+ - Empty or malformed YAML structure
804
+
805
+ **Print mode usage**
806
+
807
+ Use `--print` mode when Claude Code is not available:
808
+ ```bash
809
+ # Get the prompt
810
+ npx @lumy-pack/syncpoint wizard --print > prompt.txt
811
+
812
+ # Copy prompt.txt to your LLM
813
+ # Save the YAML response to ~/.syncpoint/config.yml
814
+ ```
815
+
816
+ **Session context lost**
817
+
818
+ The wizard preserves session context across retries using Claude Code's session management. If context is lost:
819
+ - The wizard will start a new session on the next retry
820
+ - Manual intervention may be needed after 3 failed attempts
821
+
822
+ ### General Issues
823
+
824
+ **Permission errors**
825
+
826
+ If you encounter permission errors:
827
+ - Ensure you have write access to `~/.syncpoint/`
828
+ - Check file permissions: `ls -la ~/.syncpoint/`
829
+ - Run with appropriate permissions (avoid unnecessary sudo)
830
+
831
+ **Large file warnings**
832
+
833
+ Files larger than 10MB trigger warnings:
834
+ - Consider excluding large files using `exclude` patterns
835
+ - Review if these files should be in version control instead
836
+ - Compress large files before backing up
837
+
838
+ **Backup restore conflicts**
839
+
840
+ If restore shows many "overwrite" actions:
841
+ - Use `--dry-run` to preview changes first
842
+ - Automatic safety backup is created before overwrite
843
+ - Review the safety backup in `~/.syncpoint/backups/` tagged with `_pre-restore_`
844
+
845
+ ---
846
+
847
+ ## 🔧 Development
848
+
849
+ ### Build and Test
850
+
851
+ ```bash
852
+ # Install dependencies
853
+ pnpm install
854
+
855
+ # Development mode
856
+ pnpm dev
857
+
858
+ # Build
859
+ pnpm build
860
+
861
+ # Run tests
862
+ pnpm test
863
+
864
+ # Run all tests (unit + integration + e2e + docker)
865
+ pnpm test:all
866
+
867
+ # Lint and format
868
+ pnpm lint
869
+ pnpm format
870
+ ```
871
+
872
+ ### Technology Stack
873
+
874
+ - **CLI Framework:** Commander.js
875
+ - **Terminal UI:** Ink + React
876
+ - **Configuration:** YAML parsing
877
+ - **Validation:** AJV (JSON Schema)
878
+ - **File Operations:** fast-glob, tar
879
+ - **Build:** tsup, TypeScript
880
+ - **Testing:** Vitest
881
+
882
+ ### Project Structure
883
+
884
+ ```
885
+ packages/syncpoint/
886
+ ├── src/
887
+ │ ├── cli.ts # CLI entry point
888
+ │ ├── commands/ # Command implementations
889
+ │ ├── core/ # Core logic (backup, restore, provision)
890
+ │ ├── schemas/ # JSON Schema validation
891
+ │ ├── components/ # React/Ink UI components
892
+ │ └── utils/ # Utilities
893
+ ├── assets/
894
+ │ ├── config.default.yml # Default configuration
895
+ │ └── template.example.yml # Example template
896
+ └── tests/
897
+ ├── unit/
898
+ ├── integration/
899
+ ├── e2e/
900
+ └── docker/
901
+ ```
902
+
903
+ ---
904
+
905
+ ## 📄 License
906
+
907
+ MIT © [Vincent K. Kelvin](https://github.com/vincent-kk)
908
+
909
+ ---
910
+
911
+ ## 🤝 Contributing
912
+
913
+ Contributions are welcome! Please feel free to submit a Pull Request.
914
+
915
+ ## 🐛 Issues
916
+
917
+ If you encounter any issues or have questions, please [open an issue](https://github.com/vincent-kk/lumy-pack/issues) on GitHub.
918
+
919
+ ---
920
+
921
+ Made with ❤️ by Vincent K. Kelvin