This page provides a technical guide for installing and initializing Comet. It covers the installation lifecycle, the interactive comet init process, and the underlying logic for platform detection, directory creation, and CodeGraph integration.
Comet is distributed as an npm package. It can be installed globally or as a project dependency.
The package defines a postinstall script in package.json package-lock.json10 This script typically executes a setup hint to guide the user toward the comet init command.
The package exposes a comet binary package-lock.json17 and includes several asset directories required for initialization:
dist/: Compiled TypeScript source.assets/: Contains the skills/ (English) and skills-zh/ (Chinese) templates for AI platforms.assets/manifest.json: Drives the deployment of skill files, rules, and hooks assets/manifest.json1-41Sources: package-lock.json7-18 assets/manifest.json1-41
comet init)The initCommand function is the core logic for the comet init CLI command src/commands/init.ts202-211 It performs platform detection, prompts for user configuration, and deploys the necessary skill files and working directories.
When executed, the command displays the COMET_BANNER, a stylized ASCII art header src/commands/init.ts49-57 It then resolves the target project path and identifies the execution environment src/commands/init.ts203-210
Comet automatically scans the project environment to detect supported AI coding platforms (e.g., Cursor, Windsurf, Trae, Cline). This is handled by detectPlatforms(), which checks for specific detectionPaths (like .cursorrules or .clinerules) or existing skill directories src/core/detect.ts93-115
If not run with the --yes flag, the CLI initiates an interactive sequence using @inquirer/prompts:
| Step | Logic | Code Entity |
|---|---|---|
| Scope Selection | Choose between project (local) or global (user home directory). | selectScope src/commands/init.ts59-70 |
| Language Selection | Choose between English (en) or Chinese (zh). | selectLanguage src/commands/init.ts72-81 |
| Platform Selection | Toggle detected platforms or manually select others from the PLATFORMS registry. | selectPlatforms src/commands/init.ts83-96 |
Comet installs four primary components per platform:
SKILL.md files) src/commands/init.ts7-9The resolveAction function determines whether to overwrite, skip, or install based on existing files and CLI flags (--overwrite, --skip-existing) src/commands/init.ts141-150 If multiple components exist on one platform, promptBulkOverwriteChoice allows the user to batch these decisions src/commands/init.ts111-123
Sources: src/commands/init.ts1-150 src/core/detect.ts93-115
The following diagram illustrates how the initCommand coordinates various core modules to transform user input into a deployed environment.
Sources: src/commands/init.ts202-211 src/core/detect.ts93-115 src/core/skills.ts10-12
When scope is set to project, Comet initializes a set of working directories to manage the lifecycle of changes. The createWorkingDirs function ensures these exist and initializes a default .comet/config.yaml test/ts/init.test.ts67-70
docs/superpowers/specs/: Stores OpenSpec change files and design documents src/commands/init.ts193docs/superpowers/plans/: Stores implementation plans and task lists src/commands/init.ts193.comet/config.yaml: Local configuration, including context_compression: off by default test/ts/init.test.ts63-74The following diagram maps the logical components mentioned in this guide to their specific implementation entities.
Sources: src/commands/init.ts38-47 src/core/detect.ts17-19 src/core/detect.ts93-115 test/ts/init.test.ts14-61
After a successful init, the CLI provides immediate "Next Steps" via displaySummary, introducing the primary entry points for the workflow src/commands/init.ts152-200:
/comet "your idea" — Start a new change with the full five-phase workflow src/commands/init.ts197/comet-hotfix — Quick bug fix, bypassing the brainstorming/design phase src/commands/init.ts198/comet-tweak — Small change, bypassing brainstorming and detailed planning src/commands/init.ts199Sources: src/commands/init.ts196-199
Refresh this wiki
This wiki was recently refreshed. Please wait 7 days to refresh again.