|
| 1 | +# CLAUDE.md - Launchpad Project Rules |
| 2 | + |
| 3 | +This file contains specific rules and guidelines for working with the Launchpad project in Claude Code. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Launchpad is a modern dependency manager for both system and project environments. It's like Homebrew but faster, with intelligent environment isolation and project-aware dependency management. Built on TypeScript with Bun runtime. |
| 8 | + |
| 9 | +**Core Technologies:** |
| 10 | + |
| 11 | +- TypeScript with strict typing |
| 12 | +- Bun runtime and package manager |
| 13 | +- pkgx ecosystem integration via ts-pkgx |
| 14 | +- CAC for CLI framework |
| 15 | +- Cross-platform (macOS, Linux, Windows) |
| 16 | + |
| 17 | +## Project Structure |
| 18 | + |
| 19 | +``` |
| 20 | +launchpad/ |
| 21 | +├── packages/ |
| 22 | +│ ├── launchpad/ # Main package |
| 23 | +│ │ ├── src/ # Core source code |
| 24 | +│ │ │ ├── commands/ # CLI command implementations |
| 25 | +│ │ │ ├── services/ # Service management |
| 26 | +│ │ │ ├── cli/ # CLI parsing and routing |
| 27 | +│ │ │ ├── dev/ # Development utilities |
| 28 | +│ │ │ └── *.ts # Core modules (install, config, types, etc.) |
| 29 | +│ │ ├── bin/cli.ts # CLI entry point |
| 30 | +│ │ └── package.json # Package configuration |
| 31 | +│ └── action/ # GitHub Action package |
| 32 | +├── docs/ # Documentation |
| 33 | +├── scripts/ # Build and utility scripts |
| 34 | +└── launchpad.config.ts # Project configuration |
| 35 | +``` |
| 36 | + |
| 37 | +## Development Guidelines |
| 38 | + |
| 39 | +### Code Style & Patterns |
| 40 | + |
| 41 | +1. **TypeScript Standards:** |
| 42 | + - Use strict TypeScript with full type safety |
| 43 | + - Leverage ts-pkgx types for package management |
| 44 | + - Export types alongside implementations |
| 45 | + - Use interface/type definitions from `src/types.ts` |
| 46 | + |
| 47 | +2. **Architecture Patterns:** |
| 48 | + - Commands follow the pattern: `src/commands/<command>.ts` |
| 49 | + - Each command exports a default function that handles the operation |
| 50 | + - Services are organized in `src/services/` with clear separation of concerns |
| 51 | + - Configuration is centralized in `src/config.ts` |
| 52 | + |
| 53 | +3. **CLI Structure:** |
| 54 | + - Main CLI entry point: `packages/launchpad/bin/cli.ts` |
| 55 | + - Uses CAC framework for command parsing |
| 56 | + - Command resolution happens via `src/commands/index.ts` |
| 57 | + - All commands support `--verbose`, `--dry-run` where applicable |
| 58 | + |
| 59 | +### Key Modules & Their Purpose |
| 60 | + |
| 61 | +- `src/install.ts` - Package installation logic |
| 62 | +- `src/uninstall.ts` - Package removal logic |
| 63 | +- `src/config.ts` - Configuration management |
| 64 | +- `src/types.ts` - Type definitions (extends ts-pkgx types) |
| 65 | +- `src/services/` - Service management (PostgreSQL, Redis, etc.) |
| 66 | +- `src/dev/` - Development environment management |
| 67 | +- `src/commands/` - CLI command implementations |
| 68 | + |
| 69 | +### Important Configuration Files |
| 70 | + |
| 71 | +- `launchpad.config.ts` - Project-level configuration with typed dependencies |
| 72 | +- `packages/launchpad/package.json` - Package metadata and scripts |
| 73 | +- Root `package.json` - Monorepo workspace configuration |
| 74 | + |
| 75 | +## Development Commands |
| 76 | + |
| 77 | +```bash |
| 78 | +# Build the project |
| 79 | +bun run build |
| 80 | + |
| 81 | +# Run tests |
| 82 | +bun test |
| 83 | + |
| 84 | +# Lint code |
| 85 | +bun run lint |
| 86 | +bun run lint:fix |
| 87 | + |
| 88 | +# Type checking |
| 89 | +bun run typecheck |
| 90 | + |
| 91 | +# Development docs |
| 92 | +bun run dev:docs |
| 93 | + |
| 94 | +# Generate changelog |
| 95 | +bun run changelog |
| 96 | +``` |
| 97 | + |
| 98 | +## Key Features to Understand |
| 99 | + |
| 100 | +1. **Dual Installation Mode:** |
| 101 | + - System-wide: `/usr/local` (default) or `~/.local` |
| 102 | + - Project-specific: Automatic environment isolation |
| 103 | + |
| 104 | +2. **Service Management:** |
| 105 | + - 30+ pre-configured services (PostgreSQL, Redis, etc.) |
| 106 | + - Cross-platform service control (launchd/systemd) |
| 107 | + - Auto-configuration with sane defaults |
| 108 | + |
| 109 | +3. **Environment Management:** |
| 110 | + - Automatic project detection via dependency files |
| 111 | + - Human-readable environment identifiers |
| 112 | + - Seamless environment switching on `cd` |
| 113 | + |
| 114 | +4. **Package Resolution:** |
| 115 | + - Leverages pkgx ecosystem via ts-pkgx |
| 116 | + - Full type safety for package names and versions |
| 117 | + - Intelligent dependency resolution |
| 118 | + |
| 119 | +## Common Development Tasks |
| 120 | + |
| 121 | +### Adding New Commands |
| 122 | + |
| 123 | +1. Create command file in `src/commands/<name>.ts` |
| 124 | +2. Export default function with command logic |
| 125 | +3. Add command to `src/commands/index.ts` resolution map |
| 126 | +4. Update CLI definitions in `bin/cli.ts` |
| 127 | +5. Add corresponding types to `src/types.ts` if needed |
| 128 | + |
| 129 | +### Adding New Services |
| 130 | + |
| 131 | +1. Add service definition to `src/services/definitions.ts` |
| 132 | +2. Update service management logic in `src/services/manager.ts` |
| 133 | +3. Add platform-specific configurations if needed |
| 134 | +4. Update documentation and examples |
| 135 | + |
| 136 | +### Configuration Changes |
| 137 | + |
| 138 | +1. Update `LaunchpadConfig` interface in `src/types.ts` |
| 139 | +2. Update default config in `src/config.ts` |
| 140 | +3. Update example `launchpad.config.ts` if needed |
| 141 | +4. Document new options in README |
| 142 | + |
| 143 | +## Testing & Quality |
| 144 | + |
| 145 | +- Use `bun test` for running tests |
| 146 | +- All code should pass `bun run lint` and `bun run typecheck` |
| 147 | +- Test both system-wide and project-specific installation modes |
| 148 | +- Verify cross-platform compatibility where applicable |
| 149 | + |
| 150 | +## Dependencies & Ecosystem |
| 151 | + |
| 152 | +- **ts-pkgx**: Provides typed package definitions and ecosystem integration |
| 153 | +- **CAC**: CLI argument parsing framework |
| 154 | +- **bunfig**: Configuration management utilities |
| 155 | +- Built for Bun runtime but Node.js compatible |
| 156 | + |
| 157 | +## Special Considerations |
| 158 | + |
| 159 | +1. **Cross-platform Compatibility:** Code must work on macOS, Linux, and Windows |
| 160 | +2. **Permission Handling:** Smart handling of system vs user installations |
| 161 | +3. **Environment Isolation:** Never pollute global environment unintentionally |
| 162 | +4. **Performance:** Leverage Bun's speed advantages where possible |
| 163 | +5. **Type Safety:** Full TypeScript compliance with ts-pkgx integration |
| 164 | + |
| 165 | +## Integration Points |
| 166 | + |
| 167 | +- **GitHub Actions:** `packages/action/` provides CI/CD integration |
| 168 | +- **Shell Integration:** Automatic PATH management and environment switching |
| 169 | +- **pkgx Ecosystem:** Full compatibility with pkgx package registry |
| 170 | +- **Service Orchestration:** Native integration with system service managers |
| 171 | + |
| 172 | +When working on this project, always consider the dual nature of system-wide and project-specific dependency management, maintain cross-platform compatibility, and leverage the strong typing provided by ts-pkgx for package management operations. |
0 commit comments