shipdeck
Version:
Ship MVPs in 48 hours. Fix bugs in 30 seconds. The command deck for developers who ship.
128 lines (107 loc) ⢠3.86 kB
JavaScript
#!/usr/bin/env node
/**
* Shipdeck CLI
* Ship MVPs in 48 hours. Fix bugs in 30 seconds.
*
* This is the main entry point for the Shipdeck CLI when installed via npm.
* For detailed documentation, visit https://shipdeck.ai
*/
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const os = require('os');
// ASCII banner for first run
const BANNER = `
_____ __ _ __ __
/ ___// /_ (_)___ ____/ /__ _____/ /__
\\__ \\/ __ \\/ / __ \\/ __ / _ \\/ ___/ //_/
___/ / / / / / /_/ / /_/ / __/ /__/ ,<
/____/_/ /_/_/ .___/\\__,_/\\___/\\___/_/|_|
/_/
ā Command Your Ship ā
`;
// Check if this is the first run
const configDir = path.join(os.homedir(), '.shipdeck');
const firstRunFile = path.join(configDir, '.first_run_complete');
if (!fs.existsSync(firstRunFile)) {
console.log(BANNER);
console.log('Welcome to Shipdeck! Setting up your command deck...\n');
// Create config directory
if (!fs.existsSync(configDir)) {
fs.mkdirSync(configDir, { recursive: true });
}
// Mark first run as complete
fs.writeFileSync(firstRunFile, new Date().toISOString());
console.log('ā
Shipdeck is ready!');
console.log('š Documentation: https://shipdeck.ai/docs');
console.log('š¬ Discord: https://discord.gg/shipdeck');
console.log('\nTry these commands:');
console.log(' shipdeck help - Show all available commands');
console.log(' ai-fix - Fix the last error instantly');
console.log(' git-commit-ai - Generate perfect commit messages\n');
}
// Main CLI logic
const command = process.argv[2];
// Handle version flags
if (command === 'version' || command === '--version' || command === '-v') {
const pkg = require('./package.json');
console.log(`Shipdeck v${pkg.version}`);
process.exit(0);
}
// Handle help flags
if (!command || command === 'help' || command === '--help' || command === '-h') {
console.log(`
ā Shipdeck CLI - Ship MVPs in 48 hours
Commands:
shipdeck help Show this help message
shipdeck version Show version information
shipdeck init Initialize Shipdeck in current project
shipdeck new [name] Create a new project from template
shipdeck ultimate Access Claude Code Ultimate agents ā”
AI Commands:
ai-fix Fix the last error automatically
git-commit-ai Generate commit message from staged changes
Options:
--version, -v Show version information
--help, -h Show this help message
For more information, visit https://shipdeck.ai
`);
process.exit(0);
}
if (command === 'init') {
console.log('ā Initializing Shipdeck in current project...');
// Future: Add project initialization logic
console.log('ā
Shipdeck initialized!');
process.exit(0);
}
if (command === 'new') {
const projectName = process.argv[3];
if (!projectName) {
console.error('ā Please provide a project name: shipdeck new [name]');
process.exit(1);
}
console.log(`š Creating new project: ${projectName}`);
// Future: Add project scaffolding logic
console.log(`ā
Project ${projectName} created!`);
process.exit(0);
}
if (command === 'ultimate') {
const UltimateManager = require('./lib/ultimate/index');
const manager = new UltimateManager();
// Handle async commands properly
(async () => {
try {
await manager.handleCommand(process.argv.slice(3));
process.exit(0);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}
})();
// Don't exit immediately for async commands
return;
}
// Unknown command
console.error(`ā Unknown command: ${command}`);
console.log('Run "shipdeck help" for available commands');
process.exit(1);