prjct-cli 0.4.0

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +312 -0
  2. package/CLAUDE.md +300 -0
  3. package/LICENSE +21 -0
  4. package/README.md +424 -0
  5. package/bin/prjct +214 -0
  6. package/core/agent-detector.js +249 -0
  7. package/core/agents/claude-agent.js +250 -0
  8. package/core/agents/codex-agent.js +256 -0
  9. package/core/agents/terminal-agent.js +465 -0
  10. package/core/analyzer.js +596 -0
  11. package/core/animations-simple.js +240 -0
  12. package/core/animations.js +277 -0
  13. package/core/author-detector.js +218 -0
  14. package/core/capability-installer.js +190 -0
  15. package/core/command-installer.js +775 -0
  16. package/core/commands.js +2050 -0
  17. package/core/config-manager.js +335 -0
  18. package/core/migrator.js +784 -0
  19. package/core/path-manager.js +324 -0
  20. package/core/project-capabilities.js +144 -0
  21. package/core/session-manager.js +439 -0
  22. package/core/version.js +107 -0
  23. package/core/workflow-engine.js +213 -0
  24. package/core/workflow-prompts.js +192 -0
  25. package/core/workflow-rules.js +147 -0
  26. package/package.json +80 -0
  27. package/scripts/install.sh +433 -0
  28. package/scripts/verify-installation.sh +158 -0
  29. package/templates/agents/AGENTS.md +164 -0
  30. package/templates/commands/analyze.md +125 -0
  31. package/templates/commands/cleanup.md +102 -0
  32. package/templates/commands/context.md +105 -0
  33. package/templates/commands/design.md +113 -0
  34. package/templates/commands/done.md +44 -0
  35. package/templates/commands/fix.md +87 -0
  36. package/templates/commands/git.md +79 -0
  37. package/templates/commands/help.md +72 -0
  38. package/templates/commands/idea.md +50 -0
  39. package/templates/commands/init.md +237 -0
  40. package/templates/commands/next.md +74 -0
  41. package/templates/commands/now.md +35 -0
  42. package/templates/commands/progress.md +92 -0
  43. package/templates/commands/recap.md +86 -0
  44. package/templates/commands/roadmap.md +107 -0
  45. package/templates/commands/ship.md +41 -0
  46. package/templates/commands/stuck.md +48 -0
  47. package/templates/commands/task.md +97 -0
  48. package/templates/commands/test.md +94 -0
  49. package/templates/commands/workflow.md +224 -0
  50. package/templates/examples/natural-language-examples.md +320 -0
  51. package/templates/mcp-config.json +8 -0
  52. package/templates/workflows/analyze.md +159 -0
  53. package/templates/workflows/cleanup.md +73 -0
  54. package/templates/workflows/context.md +72 -0
  55. package/templates/workflows/design.md +88 -0
  56. package/templates/workflows/done.md +20 -0
  57. package/templates/workflows/fix.md +201 -0
  58. package/templates/workflows/git.md +192 -0
  59. package/templates/workflows/help.md +13 -0
  60. package/templates/workflows/idea.md +22 -0
  61. package/templates/workflows/init.md +80 -0
  62. package/templates/workflows/natural-language-handler.md +183 -0
  63. package/templates/workflows/next.md +44 -0
  64. package/templates/workflows/now.md +19 -0
  65. package/templates/workflows/progress.md +113 -0
  66. package/templates/workflows/recap.md +66 -0
  67. package/templates/workflows/roadmap.md +95 -0
  68. package/templates/workflows/ship.md +18 -0
  69. package/templates/workflows/stuck.md +25 -0
  70. package/templates/workflows/task.md +109 -0
  71. package/templates/workflows/test.md +243 -0
package/README.md ADDED
@@ -0,0 +1,424 @@
1
+ ```
2
+ (ノ◕ヮ◕)ノ*:・゚✧
3
+ ██████╗ ██████╗ ██╗ ██████╗████████╗
4
+ ██╔══██╗██╔══██╗ ██║██╔════╝╚══██╔══╝
5
+ ██████╔╝██████╔╝ ██║██║ ██║
6
+ ██╔═══╝ ██╔══██╗██ ██║██║ ██║
7
+ ██║ ██║ ██║╚█████╔╝╚██████╗ ██║
8
+ ╚═╝ ╚═╝ ╚═╝ ╚════╝ ╚═════╝ ╚═╝
9
+ prjct/cli
10
+ ```
11
+
12
+ **Ship fast, stay focused, no BS.**
13
+
14
+ **AI-integrated project management for indie hackers and small teams** - Ship fast, stay focused, no ceremonies.
15
+
16
+ Works with **Claude Code**, **Cursor AI**, **Codeium**, **OpenAI Codex**, and **Warp Terminal**.
17
+
18
+ [![OpenAI Codex Compatible](https://img.shields.io/badge/OpenAI%20Codex-Compatible-00a67e)](AGENTS.md)
19
+ [![Claude Code Ready](https://img.shields.io/badge/Claude%20Code-Ready-6366f1)](CLAUDE.md)
20
+
21
+ ## 🤖 Intelligent Agent Detection
22
+
23
+ **prjct-cli automatically detects and adapts to your environment** - No configuration needed!
24
+
25
+ The system intelligently identifies whether you're using:
26
+
27
+ - **Claude Code** → Rich markdown, MCP integration, interactive features
28
+ - **OpenAI Codex** → Structured output for sandboxed environments
29
+ - **Terminal/CLI** → ANSI colors, progress spinners, native experience
30
+
31
+ ### How It Works
32
+
33
+ ```javascript
34
+ // Automatic detection strategies:
35
+ 1. Environment Variables (CLAUDE_AGENT, CODEX_AGENT)
36
+ 2. Configuration Files (AGENTS.md, CLAUDE.md)
37
+ 3. Runtime Capabilities (MCP availability)
38
+ 4. Filesystem Characteristics (sandboxed paths)
39
+ ```
40
+
41
+ Each agent gets optimized output:
42
+
43
+ - **Claude**: `✅ **Task complete!** Ready for the next challenge?`
44
+ - **Codex**: `[SUCCESS] Task complete. NEXT: Use /p:next`
45
+ - **Terminal**: `✅ Task complete! → Use prjct next`
46
+
47
+ ## ⚡ Installation
48
+
49
+ Choose the installation method that works best for you:
50
+
51
+ ### npm/Node.js
52
+
53
+ ```bash
54
+ npm install -g @prjct/cli
55
+ ```
56
+
57
+ **Benefits**: Standard npm ecosystem, works everywhere Node.js runs.
58
+
59
+ ### Quick Install Script (Cross-platform)
60
+
61
+ ```bash
62
+ curl -fsSL https://prjct.app/install.sh | bash
63
+ ```
64
+
65
+ **Benefits**: Works on any Unix-like system, automatic platform detection.
66
+
67
+ #### Installation Options
68
+
69
+ ```bash
70
+ # Force reinstall (even if up to date)
71
+ curl -fsSL https://prjct.app/install.sh | bash -s -- --force
72
+
73
+ # Auto-accept all prompts (unattended installation)
74
+ curl -fsSL https://prjct.app/install.sh | bash -s -- -y
75
+
76
+ # Install from development branch
77
+ curl -fsSL https://prjct.app/install.sh | bash -s -- --dev
78
+
79
+ # Show help
80
+ curl -fsSL https://prjct.app/install.sh | bash -s -- --help
81
+ ```
82
+
83
+ > **Note**: For detailed installation instructions, troubleshooting, and platform-specific guidance, see [INSTALL.md](docs/INSTALL.md).
84
+
85
+ ### Editor Command Installation
86
+
87
+ After initial installation, `prjct` can install commands to your AI editors:
88
+
89
+ ```bash
90
+ # Interactive installation (default) - select which editors to use
91
+ prjct install
92
+
93
+ # Non-interactive - install to all detected editors
94
+ prjct install --no-interactive
95
+
96
+ # Install to specific editor only
97
+ prjct install --editor claude
98
+ prjct install --editor cursor
99
+ prjct install --editor codex
100
+ prjct install --editor windsurf
101
+
102
+ # Force update existing commands
103
+ prjct install --force
104
+
105
+ # Create templates from existing commands
106
+ prjct install --create-templates
107
+ ```
108
+
109
+ **Detected Editors:**
110
+ - **Claude Code**: `~/.claude/commands/p/`
111
+ - **Cursor AI**: `~/.cursor/commands/p/`
112
+ - **OpenAI Codex**: `{project}/AGENTS.md`
113
+ - **Windsurf/Codeium**: `{project}/.windsurf/workflows/`
114
+
115
+ The interactive mode (default) will show checkboxes to select which editors to install to, optimizing for your actual workflow.
116
+
117
+ ### Version Management
118
+
119
+ The installer automatically:
120
+ - **Detects existing installations** and checks for updates
121
+ - **Compares versions** between local and remote
122
+ - **Prompts for updates** when newer versions are available
123
+ - **Shows current version** during installation
124
+ - **Supports force reinstall** with `--force` flag
125
+
126
+ ### Manual Installation
127
+
128
+ ```bash
129
+ git clone https://github.com/jlopezlira/prjct-cli
130
+ cd prjct-cli
131
+ ./setup.sh
132
+ ```
133
+
134
+ ### What the Installer Does
135
+
136
+ - ✅ **Installs to** `~/.prjct-cli/`
137
+ - ✅ **Checks prerequisites** (Node.js 18+, Git)
138
+ - ✅ **Detects AI editors** (Claude Code, Cursor, Codeium)
139
+ - ✅ **Installs slash commands** to all detected editors
140
+ - ✅ **Creates global structure** for cross-editor data sharing
141
+ - ✅ **Version management** with automatic update detection
142
+ - ✅ **Configures AI assistant integration** (MCP)
143
+ - ✅ **Sets up the** `prjct` **command**
144
+ - ✅ **Creates project structure** in `.prjct/`
145
+ - ✅ **Auto-detects your environment** (Claude/Codex/Terminal)
146
+ - ✅ **Configures shell** (bash/zsh) automatically
147
+
148
+ ## 🗑️ Uninstallation
149
+
150
+ To completely remove prjct-cli from your system:
151
+
152
+ ```bash
153
+ cd ~/.prjct-cli
154
+ ./uninstall.sh
155
+ ```
156
+
157
+ The uninstaller will:
158
+
159
+ - **Safely remove** all prjct-cli components
160
+ - **Offer options** for your project data:
161
+ - Keep all `.prjct/` directories (recommended)
162
+ - Back up before removal
163
+ - Permanently delete (requires confirmation)
164
+ - **Clean up** shell configuration and paths
165
+ - **Remove** Claude Code commands
166
+
167
+ > ⚠️ **WARNING**: Uninstallation is irreversible. The script will ask for confirmation before removing anything.
168
+
169
+ ## 💬 Talk Naturally - Zero Memorization
170
+
171
+ **You don't need to memorize commands.** Just talk to your AI assistant naturally!
172
+
173
+ The system detects your intent in **English** and **Spanish** and maps it to the right command:
174
+
175
+ ```
176
+ ✨ Natural Language Examples:
177
+
178
+ Instead of: Just say:
179
+ /p:now "implement auth" → "I want to start building the auth system"
180
+ /p:done → "I'm done" or "finished"
181
+ /p:ship "feature" → "ship the authentication"
182
+ /p:stuck "error" → "I'm stuck on this error"
183
+ /p:idea "add feature" → "I have an idea about dark mode"
184
+ ```
185
+
186
+ **How it works:**
187
+ - Type `/p:help` for an interactive guide with natural language options
188
+ - Every command response suggests what to do next
189
+ - System guides you conversationally - no guessing needed
190
+ - Gradually learn commands while talking naturally
191
+
192
+ **Available in:** 🇺🇸 English • 🇪🇸 Spanish
193
+
194
+ ## 📱 Platform Usage
195
+
196
+ ### Claude Code / Cursor AI / Codeium
197
+
198
+ All three editors support the same slash commands through automatic installation:
199
+
200
+ ```
201
+ # Core Commands (or just talk naturally!)
202
+ /p:init # Initialize project
203
+ /p:now "implement auth" # Set current task
204
+ /p:done # Complete task
205
+ /p:ship "authentication" # Ship feature
206
+ /p:recap # Show progress
207
+
208
+ # Power Commands 🚀
209
+ /p:analyze # Auto-analyze codebase
210
+ /p:git # Smart git commit with context
211
+ /p:fix "error msg" # Quick troubleshooting
212
+ /p:test # Run & fix tests
213
+ /p:task "complex feature" # Break down & execute
214
+ /p:roadmap # Strategic planning
215
+ ```
216
+
217
+ **Multi-Editor Workflow**: Switch between Claude Code, Cursor, and Codeium seamlessly - all commands access the same global data in `~/.prjct-cli/projects/`.
218
+
219
+ ### OpenAI Codex / GitHub OpenAI Codex
220
+
221
+ The repository includes `AGENTS.md` for full OpenAI Codex compatibility.
222
+
223
+ ```
224
+ # Codex automatically reads AGENTS.md for guidance
225
+ /p:init # Creates .prjct/ structure
226
+ /p:now "add API endpoint" # Updates current focus
227
+ /p:ship "REST API" # Celebrates shipped feature
228
+ /p:progress week # Shows weekly metrics
229
+ /p:context # Show project context
230
+ /p:recap # Display project overview
231
+ ```
232
+
233
+ > **Setup**: Authorize the Codex GitHub app for your organization, and Codex will automatically detect the AGENTS.md configuration.
234
+
235
+ ### Warp Terminal
236
+
237
+ ```bash
238
+ prjct init # Initialize project
239
+ prjct now "implement auth" # Set current task
240
+ prjct done # Complete task
241
+ prjct ship "authentication" # Ship feature
242
+ prjct recap # Show progress
243
+ ```
244
+
245
+ > Warp AI also understands `/p:` commands in the terminal
246
+
247
+ ## 🎯 Quick Command Guide
248
+
249
+ **New idea or feature:**
250
+ - `/p:idea "add dark mode"` - Quick capture
251
+ - `/p:now "implement dark mode"` - Start working now
252
+
253
+ **Finished working:**
254
+ - `/p:done` - Mark complete, clear focus
255
+ - `/p:ship "feature name"` - Celebrate important milestones
256
+
257
+ **Lost context:**
258
+ - `/p:recap` - Complete overview
259
+ - `/p:next` - View task queue
260
+
261
+ **Need help:**
262
+ - `/p:stuck "error description"` - Get contextual solutions
263
+ - `/p:fix "error message"` - Auto-diagnosis
264
+
265
+ **Track progress:**
266
+ - `/p:progress week` - Weekly metrics
267
+ - `/p:context` - Project info
268
+
269
+ **Code quality:**
270
+ - `/p:cleanup` - Basic cleanup
271
+ - `/p:cleanup --type code` - Remove dead code, unused imports
272
+ - `/p:design "component" --type architecture` - Design before coding
273
+
274
+ **Version control:**
275
+ - `/p:git` - Smart commit
276
+ - `/p:git push` - Commit + push
277
+
278
+ **After cloning/pulling:**
279
+ - `/p:analyze` - Auto-analyze codebase
280
+ - `/p:analyze --sync` - Sync with implemented features
281
+
282
+ > 💡 **Tip:** Visit [prjct.dev/commands](https://prjct.dev/commands) for interactive command guide or [prjct.dev/workflows-guide](https://prjct.dev/workflows-guide) for step-by-step examples
283
+
284
+ ## 📖 Complete Command Reference
285
+
286
+ ### Core Commands (Essential) 🎯
287
+
288
+ | Command | When to use? | What does it do? | Example Output |
289
+ | ------------------- | ------------------------------ | ---------------------------------- | ----------------------------------------- |
290
+ | `/p:init` | Starting a new project | Creates complete `.prjct/` structure | `✅ Project initialized!` |
291
+ | `/p:now [task]` | To set your current focus | Defines ONE single active task | `🎯 Current: implement auth` |
292
+ | `/p:done` | When finishing current task | Marks complete and clears focus | `✅ Task complete! Next: API integration` |
293
+ | `/p:ship <feature>` | When completing something big | Celebrates and records the WIN | `🚀 SHIPPED: User auth! 🎉` |
294
+ | `/p:recap` | To see complete overview | Shows progress and current state | `📊 3 shipped, 1 active, 5 queued` |
295
+
296
+ ### Planning Commands 📋
297
+
298
+ | Command | When to use? | What does it do? | Example Output |
299
+ | ------------------- | ----------------------- | ------------------------------ | ------------------------------ |
300
+ | `/p:idea <text>` | When you have an idea | Quick capture without interrupting | `💡 Idea captured!` |
301
+ | `/p:roadmap` | View strategic plan | Shows complete roadmap | `🚀 Sprint: 23% complete` |
302
+ | `/p:roadmap add` | Add new feature | Automatically prioritizes | `✅ Added: Priority #3` |
303
+ | `/p:next` | See what's next | Lists prioritized tasks | `1. Fix auth bug 2. Add tests` |
304
+ | `/p:task <complex>` | Break down complex task | Divides into manageable subtasks | `📋 Split into 5 subtasks` |
305
+
306
+ ### Development Commands 🛠️
307
+
308
+ | Command | When to use? | What does it do? | Example Output |
309
+ | -------------------- | ------------------------- | ------------------------------------- | ------------------------------------- |
310
+ | `/p:analyze` | Understand project state | Auto-analyze & sync with real code | `🔍 14 commands, 8 features detected` |
311
+ | `/p:analyze --sync` | After git pull or clone | Sync .prjct/ with implemented code | `✅ Synced 5 tasks, 3 features` |
312
+ | `/p:git` | Quick commit | Smart message + commit | `✅ feat: add auth system` |
313
+ | `/p:test` | Run tests | Run + auto-fix simple errors | `✅ 42 passing, 2 fixed` |
314
+ | `/p:fix <error>` | Solve errors | Diagnosis and solutions | `🔧 Solution: check null first` |
315
+
316
+ ### Metrics Commands 📊
317
+
318
+ | Command | When to use? | What does it do? | Example Output |
319
+ | ------------------ | ----------------------- | ----------------------------- | --------------------------------- |
320
+ | `/p:progress` | View productivity | Weekly metrics | `📈 7 shipped, velocity: 1.4/day` |
321
+ | `/p:context` | Project info | Current state and context | `📚 Sprint 3, Day 12, 67% done` |
322
+ | `/p:stuck <issue>` | When you need help | Contextual solutions | `💡 Try: npm install cors` |
323
+
324
+ ## 🔄 Common Workflows
325
+
326
+ **First day:** `/p:init` → `/p:recap` → `/p:now "first task"`
327
+
328
+ **Daily session:** `/p:recap` → Work → `/p:done` → `/p:git` → `/p:progress`
329
+
330
+ **Complex features:** `/p:task "feature"` → Break into subtasks → `/p:now` each → `/p:ship` when complete
331
+
332
+ **Sprint planning:** `/p:roadmap` → Add features → `/p:now` top priority → `/p:ship` → `/p:roadmap next`
333
+
334
+ > 📚 **More workflows:** Visit [prjct.dev/workflows-guide](https://prjct.dev/workflows-guide) for detailed interactive examples
335
+
336
+ ## ❓ FAQ
337
+
338
+ **Can I work on multiple tasks?**
339
+ No, by design. Single-focus philosophy. Use `/p:done` before switching.
340
+
341
+ **Difference between `/p:done` and `/p:ship`?**
342
+ `/p:done` clears focus. `/p:ship` celebrates important features with metrics.
343
+
344
+ **Where is my data stored?**
345
+ Everything is local in `.prjct/` directory. Never leaves your machine.
346
+
347
+ **Does it work with teams?**
348
+ Designed for indie hackers. For teams, each dev has their own `.prjct/` or shares via git.
349
+
350
+ **How do I migrate from Jira/Trello?**
351
+ No migration needed. Just `/p:init` and start working.
352
+
353
+ > 💬 **More questions?** Check [prjct.dev/faq](https://prjct.dev/faq) or [open an issue](https://github.com/jlopezlira/prjct-cli/issues)
354
+
355
+ ## 📂 File Structure
356
+
357
+ ### New Layered Architecture 🏗️
358
+
359
+ ```
360
+ .prjct/
361
+ ├── 🎯 core/ # Current focus & priorities
362
+ │ ├── now.md # Current task
363
+ │ ├── next.md # Priority queue
364
+ │ └── context.md # Project context
365
+ ├── 📈 progress/ # Metrics & achievements
366
+ │ ├── shipped.md # Completed features
367
+ │ └── metrics.md # Velocity & stats
368
+ ├── 💡 planning/ # Ideas & strategy
369
+ │ ├── ideas.md # Brain dump
370
+ │ ├── roadmap.md # Strategic planning
371
+ │ └── tasks/ # Complex task plans
372
+ ├── 🔍 analysis/ # Technical insights
373
+ │ └── repo-summary.md # Auto-generated
374
+ └── 🧠 memory/ # History & learning
375
+ ├── context.jsonl # Activity log
376
+ └── decisions.jsonl # Decision history
377
+ ```
378
+
379
+ ### Migration from Old Structure
380
+
381
+ If you have an existing flat `.prjct/` structure, run:
382
+
383
+ ```bash
384
+ ./migrate.sh # Automatic migration to layered structure
385
+ ```
386
+
387
+ ## 🎨 Philosophy
388
+
389
+ - **Zero friction**: Commands within your existing workflow
390
+ - **Single task focus**: One thing at a time
391
+ - **Celebration built-in**: Every ship is a win
392
+ - **No ceremonies**: No sprints, no story points, no meetings
393
+
394
+ ## 📊 What We Track
395
+
396
+ ✅ **Features shipped** - The only metric that matters
397
+ ✅ **Current focus** - Stay on track
398
+ ✅ **Ideas captured** - Never lose a thought
399
+ ❌ ~~Story points~~ - We ship, not estimate
400
+ ❌ ~~Hours logged~~ - Focus on outcomes
401
+ ❌ ~~Burndown charts~~ - Ship and celebrate
402
+
403
+ ## 🛠️ Requirements
404
+
405
+ - Node.js 18+
406
+ - One of: Claude Code, OpenAI Codex, Cursor, VS Code, or Warp Terminal
407
+
408
+ ### AI Assistant Configuration
409
+
410
+ - **OpenAI Codex**: AGENTS.md file (included)
411
+ - **Claude Code**: CLAUDE.md file (included)
412
+ - **Warp Terminal**: Shell integration (via setup.sh)
413
+
414
+ ## 🤝 Contributing
415
+
416
+ We welcome contributions! See [CONTRIBUTING.md](docs/Developer-Guide/contributing.md).
417
+
418
+ ## 📜 License
419
+
420
+ MIT - Build something amazing!
421
+
422
+ ---
423
+
424
+ **Built for builders who ship, not managers who meet.**
package/bin/prjct ADDED
@@ -0,0 +1,214 @@
1
+ #!/usr/bin/env node
2
+ const commands = require('../core/commands');
3
+ const args = process.argv.slice(2);
4
+
5
+ async function main() {
6
+ const command = args[0];
7
+ const params = args.slice(1).join(' ');
8
+
9
+ let result;
10
+ switch(command) {
11
+ case 'init':
12
+ result = await commands.init();
13
+ break;
14
+ case 'now':
15
+ result = await commands.now(params || null);
16
+ break;
17
+ case 'done':
18
+ result = await commands.done();
19
+ break;
20
+ case 'ship':
21
+ result = await commands.ship(params);
22
+ break;
23
+ case 'next':
24
+ result = await commands.next();
25
+ break;
26
+ case 'idea':
27
+ result = await commands.idea(params);
28
+ break;
29
+ case 'recap':
30
+ result = await commands.recap();
31
+ break;
32
+ case 'progress':
33
+ result = await commands.progress(params || 'week');
34
+ break;
35
+ case 'stuck':
36
+ result = await commands.stuck(params);
37
+ break;
38
+ case 'context':
39
+ result = await commands.context();
40
+ break;
41
+ case 'cleanup':
42
+ result = await commands.cleanup();
43
+ break;
44
+ case 'cleanup-advanced':
45
+ const cleanupOptions = {};
46
+ const cleanupArgs = args.slice(1);
47
+ let cleanupTarget = '.';
48
+
49
+ for (let i = 0; i < cleanupArgs.length; i++) {
50
+ if (cleanupArgs[i] === '--type') {
51
+ cleanupOptions.type = cleanupArgs[++i];
52
+ } else if (cleanupArgs[i] === '--aggressive') {
53
+ cleanupOptions.aggressive = true;
54
+ } else if (cleanupArgs[i] === '--dry-run') {
55
+ cleanupOptions.dryRun = true;
56
+ } else if (!cleanupArgs[i].startsWith('--')) {
57
+ cleanupTarget = cleanupArgs[i];
58
+ }
59
+ }
60
+
61
+ result = await commands.cleanupAdvanced(cleanupTarget, cleanupOptions);
62
+ break;
63
+ case 'design':
64
+ const designOptions = {};
65
+ const designArgs = args.slice(1);
66
+ let designTarget = '';
67
+
68
+ for (let i = 0; i < designArgs.length; i++) {
69
+ if (designArgs[i] === '--type') {
70
+ designOptions.type = designArgs[++i];
71
+ } else if (designArgs[i] === '--format') {
72
+ designOptions.format = designArgs[++i];
73
+ } else if (!designArgs[i].startsWith('--')) {
74
+ // Collect all non-flag arguments as the target
75
+ const targetParts = [];
76
+ while (i < designArgs.length && !designArgs[i].startsWith('--')) {
77
+ targetParts.push(designArgs[i]);
78
+ i++;
79
+ }
80
+ i--; // Step back one since the loop will increment
81
+ designTarget = targetParts.join(' ');
82
+ }
83
+ }
84
+
85
+ if (!designTarget) {
86
+ result = {
87
+ success: false,
88
+ message: 'Please specify what to design: prjct design "authentication system"'
89
+ };
90
+ } else {
91
+ result = await commands.design(designTarget, designOptions);
92
+ }
93
+ break;
94
+ case 'migrate-all':
95
+ const migrateOptions = {};
96
+ const migrateArgs = args.slice(1);
97
+
98
+ for (let i = 0; i < migrateArgs.length; i++) {
99
+ if (migrateArgs[i] === '--deep-scan') {
100
+ migrateOptions.deepScan = true;
101
+ } else if (migrateArgs[i] === '--remove-legacy') {
102
+ migrateOptions.removeLegacy = true;
103
+ } else if (migrateArgs[i] === '--dry-run') {
104
+ migrateOptions.dryRun = true;
105
+ }
106
+ }
107
+
108
+ result = await commands.migrateAll(migrateOptions);
109
+ break;
110
+ case 'install':
111
+ const installOptions = {};
112
+ const installArgs = args.slice(1);
113
+
114
+ for (let i = 0; i < installArgs.length; i++) {
115
+ if (installArgs[i] === '--force') {
116
+ installOptions.force = true;
117
+ } else if (installArgs[i] === '--editor') {
118
+ installOptions.editor = installArgs[++i];
119
+ } else if (installArgs[i] === '--create-templates') {
120
+ installOptions.createTemplates = true;
121
+ } else if (installArgs[i] === '--no-interactive') {
122
+ installOptions.interactive = false;
123
+ }
124
+ }
125
+
126
+ result = await commands.install(installOptions);
127
+ break;
128
+ case 'analyze':
129
+ const analyzeOptions = {};
130
+ const analyzeArgs = args.slice(1);
131
+
132
+ for (let i = 0; i < analyzeArgs.length; i++) {
133
+ if (analyzeArgs[i] === '--sync') {
134
+ analyzeOptions.sync = true;
135
+ } else if (analyzeArgs[i] === '--report-only') {
136
+ analyzeOptions.reportOnly = true;
137
+ }
138
+ }
139
+
140
+ result = await commands.analyze(analyzeOptions);
141
+ break;
142
+ case '--help':
143
+ case '-h':
144
+ case 'help':
145
+ case undefined:
146
+ result = {
147
+ success: true,
148
+ message: `Available commands:
149
+ Core workflow:
150
+ init Initialize prjct in current project
151
+ now [task] Set or show current task
152
+ done Complete current task
153
+ ship <feature> Ship and celebrate a feature
154
+ next Show priority queue
155
+ idea <text> Capture an idea
156
+ recap Show project overview
157
+ progress [period] Show progress metrics
158
+ stuck <issue> Get help with a problem
159
+ context Show project context
160
+
161
+ Advanced:
162
+ cleanup Clean up .prjct structure
163
+ cleanup-advanced Advanced cleanup with options
164
+ design [target] Design system/architecture
165
+ analyze Analyze codebase and sync state
166
+ migrate-all Migrate all legacy projects
167
+ install Install commands to AI editors
168
+
169
+ Install options:
170
+ --force Force update existing commands
171
+ --editor <name> Install to specific editor (claude|cursor|codex|windsurf)
172
+ --no-interactive Skip interactive selection, install to all
173
+ --create-templates Create templates from existing commands`
174
+ };
175
+ break;
176
+ default:
177
+ result = {
178
+ success: false,
179
+ message: `Unknown command: ${command}
180
+
181
+ Available commands:
182
+ Core workflow:
183
+ init Initialize prjct in current project
184
+ now [task] Set or show current task
185
+ done Complete current task
186
+ ship <feature> Ship and celebrate a feature
187
+ next Show priority queue
188
+ idea <text> Capture an idea
189
+ recap Show project overview
190
+ progress [period] Show progress metrics
191
+ stuck <issue> Get help with a problem
192
+ context Show project context
193
+
194
+ Advanced:
195
+ cleanup Clean up .prjct structure
196
+ cleanup-advanced Advanced cleanup with options
197
+ design [target] Design system/architecture
198
+ analyze Analyze codebase and sync state
199
+ migrate-all Migrate all legacy projects
200
+ install Install commands to AI editors
201
+
202
+ Install options:
203
+ --force Force update existing commands
204
+ --editor <name> Install to specific editor (claude|cursor|codex|windsurf)
205
+ --no-interactive Skip interactive selection, install to all
206
+ --create-templates Create templates from existing commands`
207
+ };
208
+ }
209
+
210
+ console.log(result.message);
211
+ process.exit(result.success ? 0 : 1);
212
+ }
213
+
214
+ main().catch(console.error);