claude-code-checkpoint
Version:
Automatic project snapshots for Claude Code - never lose your work again
94 lines (77 loc) ⢠3.21 kB
JavaScript
import inquirer from 'inquirer';
import chalk from 'chalk';
import ora from 'ora';
import { installCheckpointSystem } from './installer.js';
import { detectOS } from './detector.js';
export async function setupWizard() {
console.log(chalk.cyan.bold('\nš Welcome to Claude Code Checkpoint Setup!\n'));
console.log(chalk.gray('This will install automatic project snapshots for Claude Code.'));
console.log(chalk.gray('Checkpoints are created after every Claude operation that changes files.\n'));
try {
// Step 1: Confirm installation
const { confirmInstall } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirmInstall',
message: 'Install checkpoint system for Claude Code?',
default: true
}
]);
if (!confirmInstall) {
console.log(chalk.yellow('\nInstallation cancelled.'));
return;
}
// Step 2: Configuration options
console.log(chalk.cyan('\nConfiguration options:\n'));
const { enableVoice } = await inquirer.prompt([
{
type: 'confirm',
name: 'enableVoice',
message: 'Enable voice announcements for checkpoint creation? (macOS only)',
default: process.platform === 'darwin'
}
]);
const { maxCheckpoints } = await inquirer.prompt([
{
type: 'number',
name: 'maxCheckpoints',
message: 'Maximum checkpoints to keep per project (0 = unlimited):',
default: 50,
validate: (input) => input >= 0 || 'Please enter a positive number or 0'
}
]);
const { excludePatterns } = await inquirer.prompt([
{
type: 'confirm',
name: 'excludePatterns',
message: 'Use default exclusion patterns? (node_modules, build files, etc.)',
default: true
}
]);
// Step 3: Installation
const spinner = ora('Installing checkpoint system...').start();
const config = {
enableVoice,
maxCheckpoints,
excludePatterns,
os: detectOS()
};
await installCheckpointSystem(config);
spinner.succeed('Checkpoint system installed successfully!');
// Step 4: Show success message and instructions
console.log(chalk.green.bold('\nā
Claude Code Checkpoint is ready!\n'));
console.log(chalk.cyan('šø Automatic checkpoints are now enabled!'));
console.log(chalk.gray(' Snapshots will be created after every Claude operation.\n'));
console.log(chalk.cyan('š ļø Available commands:'));
console.log(chalk.gray(' ⢠') + 'checkpoint list - View all checkpoints');
console.log(chalk.gray(' ⢠') + 'checkpoint restore 5 - Restore to checkpoint #5');
console.log(chalk.gray(' ⢠') + 'checkpoint restore last - Restore to most recent');
console.log(chalk.gray(' ⢠') + 'checkpoint diff 3 5 - Compare checkpoints');
console.log(chalk.gray(' ⢠') + 'checkpoint clear - Remove all checkpoints\n');
console.log(chalk.yellow('š” Try making a change with Claude, then run:'));
console.log(chalk.white.bold(' checkpoint list\n'));
} catch (error) {
console.error(chalk.red('\nā Setup failed:'), error.message);
process.exit(1);
}
}