prjct-cli 0.5.1 → 0.7.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.
- package/CHANGELOG.md +220 -7
- package/CLAUDE.md +476 -55
- package/README.md +48 -55
- package/bin/prjct +170 -225
- package/core/agentic/command-executor.js +113 -0
- package/core/agentic/context-builder.js +85 -0
- package/core/agentic/prompt-builder.js +86 -0
- package/core/agentic/template-loader.js +104 -0
- package/core/agentic/tool-registry.js +117 -0
- package/core/command-registry.js +597 -0
- package/core/commands.js +2046 -2028
- package/core/domain/agent-generator.js +118 -0
- package/core/domain/analyzer.js +211 -0
- package/core/domain/architect-session.js +300 -0
- package/core/{agents → infrastructure/agents}/claude-agent.js +16 -13
- package/core/{author-detector.js → infrastructure/author-detector.js} +3 -1
- package/core/{capability-installer.js → infrastructure/capability-installer.js} +3 -6
- package/core/{command-installer.js → infrastructure/command-installer.js} +4 -2
- package/core/{config-manager.js → infrastructure/config-manager.js} +4 -4
- package/core/{editors-config.js → infrastructure/editors-config.js} +2 -10
- package/core/{migrator.js → infrastructure/migrator.js} +34 -19
- package/core/{path-manager.js → infrastructure/path-manager.js} +20 -44
- package/core/{session-manager.js → infrastructure/session-manager.js} +45 -105
- package/core/{update-checker.js → infrastructure/update-checker.js} +67 -67
- package/core/{animations-simple.js → utils/animations.js} +3 -23
- package/core/utils/date-helper.js +238 -0
- package/core/utils/file-helper.js +327 -0
- package/core/utils/jsonl-helper.js +206 -0
- package/core/{project-capabilities.js → utils/project-capabilities.js} +21 -22
- package/core/utils/session-helper.js +277 -0
- package/core/{version.js → utils/version.js} +1 -1
- package/package.json +5 -12
- package/templates/agents/AGENTS.md +151 -99
- package/templates/analysis/analyze.md +84 -0
- package/templates/commands/analyze.md +37 -233
- package/templates/commands/bug.md +79 -0
- package/templates/commands/build.md +44 -0
- package/templates/commands/cleanup.md +24 -84
- package/templates/commands/design.md +20 -95
- package/templates/commands/done.md +17 -180
- package/templates/commands/feature.md +113 -0
- package/templates/commands/fix.md +58 -66
- package/templates/commands/git.md +35 -57
- package/templates/commands/help.md +18 -52
- package/templates/commands/idea.md +18 -34
- package/templates/commands/init.md +65 -257
- package/templates/commands/next.md +20 -60
- package/templates/commands/now.md +21 -23
- package/templates/commands/progress.md +40 -73
- package/templates/commands/recap.md +52 -75
- package/templates/commands/roadmap.md +30 -85
- package/templates/commands/ship.md +93 -126
- package/templates/commands/status.md +42 -0
- package/templates/commands/sync.md +19 -205
- package/templates/commands/task.md +19 -79
- package/templates/commands/test.md +25 -71
- package/templates/commands/workflow.md +20 -210
- package/core/agent-generator.js +0 -516
- package/core/analyzer.js +0 -600
- package/core/animations.js +0 -277
- package/core/git-integration.js +0 -401
- package/core/workflow-engine.js +0 -213
- package/core/workflow-prompts.js +0 -192
- package/core/workflow-rules.js +0 -147
- package/scripts/post-install.js +0 -121
- package/scripts/preuninstall.js +0 -94
- package/scripts/verify-installation.sh +0 -158
- package/templates/agents/be.template.md +0 -42
- package/templates/agents/data.template.md +0 -41
- package/templates/agents/devops.template.md +0 -41
- package/templates/agents/fe.template.md +0 -42
- package/templates/agents/mobile.template.md +0 -41
- package/templates/agents/pm.template.md +0 -84
- package/templates/agents/qa.template.md +0 -54
- package/templates/agents/scribe.template.md +0 -95
- package/templates/agents/security.template.md +0 -41
- package/templates/agents/ux.template.md +0 -49
- package/templates/commands/context.md +0 -105
- package/templates/commands/stuck.md +0 -48
- package/templates/examples/natural-language-examples.md +0 -532
- /package/core/{agent-detector.js → infrastructure/agent-detector.js} +0 -0
package/README.md
CHANGED
|
@@ -84,6 +84,7 @@ prjct install --force
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
**Installation Location:**
|
|
87
|
+
|
|
87
88
|
- **Claude Code & Claude Desktop**: `~/.claude/commands/p/`
|
|
88
89
|
|
|
89
90
|
All 18 slash commands (`/p:*`) are automatically installed to Claude Code and Claude Desktop.
|
|
@@ -91,6 +92,7 @@ All 18 slash commands (`/p:*`) are automatically installed to Claude Code and Cl
|
|
|
91
92
|
### Version Management
|
|
92
93
|
|
|
93
94
|
The installer automatically:
|
|
95
|
+
|
|
94
96
|
- **Detects existing installations** and checks for updates
|
|
95
97
|
- **Compares versions** between local and remote
|
|
96
98
|
- **Prompts for updates** when newer versions are available
|
|
@@ -119,27 +121,6 @@ cd prjct-cli
|
|
|
119
121
|
- ✅ **Auto-detects your environment** (Claude or Terminal fallback)
|
|
120
122
|
- ✅ **Configures shell** (bash/zsh) automatically
|
|
121
123
|
|
|
122
|
-
## 🗑️ Uninstallation
|
|
123
|
-
|
|
124
|
-
To completely remove prjct-cli from your system:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
cd ~/.prjct-cli
|
|
128
|
-
./uninstall.sh
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
The uninstaller will:
|
|
132
|
-
|
|
133
|
-
- **Safely remove** all prjct-cli components
|
|
134
|
-
- **Offer options** for your project data:
|
|
135
|
-
- Keep all `.prjct/` directories (recommended)
|
|
136
|
-
- Back up before removal
|
|
137
|
-
- Permanently delete (requires confirmation)
|
|
138
|
-
- **Clean up** shell configuration and paths
|
|
139
|
-
- **Remove** Claude Code commands
|
|
140
|
-
|
|
141
|
-
> ⚠️ **WARNING**: Uninstallation is irreversible. The script will ask for confirmation before removing anything.
|
|
142
|
-
|
|
143
124
|
## 💬 p. Trigger - Zero Memorization
|
|
144
125
|
|
|
145
126
|
**You don't need to memorize commands.** Just use the `p.` prefix and talk naturally!
|
|
@@ -158,6 +139,7 @@ Instead of: Just say:
|
|
|
158
139
|
```
|
|
159
140
|
|
|
160
141
|
**How it works:**
|
|
142
|
+
|
|
161
143
|
- Simple `p.` prefix signals prjct context
|
|
162
144
|
- Works in English, Spanish, German, French - any language
|
|
163
145
|
- System detects intent and executes the right command
|
|
@@ -173,12 +155,14 @@ Instead of: Just say:
|
|
|
173
155
|
**prjct-cli helps you ship products fast.** Built for creators and small teams who prefer coding over meetings.
|
|
174
156
|
|
|
175
157
|
**What it does:**
|
|
158
|
+
|
|
176
159
|
- ✅ Track what you're working on
|
|
177
160
|
- ✅ See what you've shipped
|
|
178
161
|
- ✅ Stay focused on one thing
|
|
179
162
|
- ✅ No meetings needed
|
|
180
163
|
|
|
181
164
|
**What it doesn't do:**
|
|
165
|
+
|
|
182
166
|
- ❌ Not like Jira or ClickUp
|
|
183
167
|
- ❌ No sprint planning
|
|
184
168
|
- ❌ No story points
|
|
@@ -198,7 +182,7 @@ No planning sessions. No standups. No retrospectives. Just **ship fast, track pr
|
|
|
198
182
|
|
|
199
183
|
**Who uses this:**
|
|
200
184
|
|
|
201
|
-
- 🎯 **Solo creators** - Build products without
|
|
185
|
+
- 🎯 **Solo creators** - Build products without meetings or BS overhead
|
|
202
186
|
- 👥 **Small teams** (2-5 people) - Coordinate without meetings
|
|
203
187
|
- 🚀 **Product builders** - Ship features fast
|
|
204
188
|
- 💪 **Makers** - Focus on building, not planning
|
|
@@ -210,27 +194,32 @@ No planning sessions. No standups. No retrospectives. Just **ship fast, track pr
|
|
|
210
194
|
By focusing exclusively on Claude Code and Claude Desktop, we can build features that would be impossible with multi-platform support:
|
|
211
195
|
|
|
212
196
|
**🤖 Smart AI Helpers**
|
|
197
|
+
|
|
213
198
|
- Get help from specialized AI assistants (for frontend, backend, UX, security, etc.)
|
|
214
199
|
- They activate automatically when you need them
|
|
215
200
|
- Works with Claude's AI system
|
|
216
201
|
|
|
217
202
|
**🔗 AI Tools Built-In**
|
|
203
|
+
|
|
218
204
|
- Context7 - Gets documentation for any library automatically
|
|
219
205
|
- Sequential - Helps solve complex problems
|
|
220
206
|
- Magic - Creates UI components for you
|
|
221
207
|
- Playwright - Tests your app in a real browser
|
|
222
208
|
|
|
223
209
|
**✅ Code Change Verification**
|
|
210
|
+
|
|
224
211
|
- Checks your actual code changes
|
|
225
212
|
- Makes sure you actually completed what you said
|
|
226
213
|
- No fake progress
|
|
227
214
|
|
|
228
215
|
**💬 Talk Naturally**
|
|
216
|
+
|
|
229
217
|
- Just describe what you want to do
|
|
230
218
|
- Works in any language
|
|
231
219
|
- No commands to memorize
|
|
232
220
|
|
|
233
221
|
**Why it works better:**
|
|
222
|
+
|
|
234
223
|
- ⚡ **Simpler code** - Faster to add features and fix bugs
|
|
235
224
|
- 🎯 **Built for Claude** - Uses Claude's special features
|
|
236
225
|
- 💯 **Everything tested** - We only support what actually works
|
|
@@ -278,35 +267,43 @@ prjct recap # Show progress
|
|
|
278
267
|
## 🎯 Quick Command Guide
|
|
279
268
|
|
|
280
269
|
**New idea or feature:**
|
|
270
|
+
|
|
281
271
|
- `/p:idea "add dark mode"` - Quick capture
|
|
282
272
|
- `/p:now "implement dark mode"` - Start working now
|
|
283
273
|
|
|
284
274
|
**Finished working:**
|
|
275
|
+
|
|
285
276
|
- `/p:done` - Mark complete, clear focus
|
|
286
277
|
- `/p:ship "feature name"` - Celebrate important milestones
|
|
287
278
|
|
|
288
279
|
**Lost context:**
|
|
280
|
+
|
|
289
281
|
- `/p:recap` - Complete overview
|
|
290
282
|
- `/p:next` - View task queue
|
|
291
283
|
|
|
292
284
|
**Need help:**
|
|
285
|
+
|
|
293
286
|
- `/p:stuck "error description"` - Get contextual solutions
|
|
294
287
|
- `/p:fix "error message"` - Auto-diagnosis
|
|
295
288
|
|
|
296
289
|
**Track progress:**
|
|
290
|
+
|
|
297
291
|
- `/p:progress week` - Weekly metrics
|
|
298
292
|
- `/p:context` - Project info
|
|
299
293
|
|
|
300
294
|
**Code quality:**
|
|
295
|
+
|
|
301
296
|
- `/p:cleanup` - Basic cleanup
|
|
302
297
|
- `/p:cleanup --type code` - Remove dead code, unused imports
|
|
303
298
|
- `/p:design "component" --type architecture` - Design before coding
|
|
304
299
|
|
|
305
300
|
**Version control:**
|
|
301
|
+
|
|
306
302
|
- `/p:git` - Smart commit
|
|
307
303
|
- `/p:git push` - Commit + push
|
|
308
304
|
|
|
309
305
|
**After cloning/pulling:**
|
|
306
|
+
|
|
310
307
|
- `/p:analyze` - Auto-analyze codebase
|
|
311
308
|
- `/p:analyze --sync` - Sync with implemented features
|
|
312
309
|
|
|
@@ -316,41 +313,41 @@ prjct recap # Show progress
|
|
|
316
313
|
|
|
317
314
|
### Core Commands (Essential) 🎯
|
|
318
315
|
|
|
319
|
-
| Command | When to use?
|
|
320
|
-
| ------------------- |
|
|
321
|
-
| `/p:init` | Starting a new project
|
|
322
|
-
| `/p:now [task]` | To set your current focus
|
|
323
|
-
| `/p:done` | When finishing current task
|
|
324
|
-
| `/p:ship <feature>` | When completing something big
|
|
325
|
-
| `/p:recap` | To see complete overview
|
|
316
|
+
| Command | When to use? | What does it do? | Example Output |
|
|
317
|
+
| ------------------- | ----------------------------- | ------------------------------------ | ----------------------------------------- |
|
|
318
|
+
| `/p:init` | Starting a new project | Creates complete `.prjct/` structure | `✅ Project initialized!` |
|
|
319
|
+
| `/p:now [task]` | To set your current focus | Defines ONE single active task | `🎯 Current: implement auth` |
|
|
320
|
+
| `/p:done` | When finishing current task | Marks complete and clears focus | `✅ Task complete! Next: API integration` |
|
|
321
|
+
| `/p:ship <feature>` | When completing something big | Celebrates and records the WIN | `🚀 SHIPPED: User auth! 🎉` |
|
|
322
|
+
| `/p:recap` | To see complete overview | Shows progress and current state | `📊 3 shipped, 1 active, 5 queued` |
|
|
326
323
|
|
|
327
324
|
### Planning Commands 📋
|
|
328
325
|
|
|
329
|
-
| Command | When to use? | What does it do?
|
|
330
|
-
| ------------------- | ----------------------- |
|
|
326
|
+
| Command | When to use? | What does it do? | Example Output |
|
|
327
|
+
| ------------------- | ----------------------- | ---------------------------------- | ------------------------------ |
|
|
331
328
|
| `/p:idea <text>` | When you have an idea | Quick capture without interrupting | `💡 Idea captured!` |
|
|
332
|
-
| `/p:roadmap` | View strategic plan | Shows complete roadmap
|
|
333
|
-
| `/p:roadmap add` | Add new feature | Automatically prioritizes
|
|
334
|
-
| `/p:next` | See what's next | Lists prioritized tasks
|
|
335
|
-
| `/p:task <complex>` | Break down complex task | Divides into manageable subtasks
|
|
329
|
+
| `/p:roadmap` | View strategic plan | Shows complete roadmap | `🚀 Sprint: 23% complete` |
|
|
330
|
+
| `/p:roadmap add` | Add new feature | Automatically prioritizes | `✅ Added: Priority #3` |
|
|
331
|
+
| `/p:next` | See what's next | Lists prioritized tasks | `1. Fix auth bug 2. Add tests` |
|
|
332
|
+
| `/p:task <complex>` | Break down complex task | Divides into manageable subtasks | `📋 Split into 5 subtasks` |
|
|
336
333
|
|
|
337
334
|
### Development Commands 🛠️
|
|
338
335
|
|
|
339
|
-
| Command
|
|
340
|
-
|
|
|
341
|
-
| `/p:analyze`
|
|
342
|
-
| `/p:analyze --sync`
|
|
343
|
-
| `/p:git`
|
|
344
|
-
| `/p:test`
|
|
345
|
-
| `/p:fix <error>`
|
|
336
|
+
| Command | When to use? | What does it do? | Example Output |
|
|
337
|
+
| ------------------- | ------------------------ | ---------------------------------- | ------------------------------------- |
|
|
338
|
+
| `/p:analyze` | Understand project state | Auto-analyze & sync with real code | `🔍 14 commands, 8 features detected` |
|
|
339
|
+
| `/p:analyze --sync` | After git pull or clone | Sync .prjct/ with implemented code | `✅ Synced 5 tasks, 3 features` |
|
|
340
|
+
| `/p:git` | Quick commit | Smart message + commit | `✅ feat: add auth system` |
|
|
341
|
+
| `/p:test` | Run tests | Run + auto-fix simple errors | `✅ 42 passing, 2 fixed` |
|
|
342
|
+
| `/p:fix <error>` | Solve errors | Diagnosis and solutions | `🔧 Solution: check null first` |
|
|
346
343
|
|
|
347
344
|
### Metrics Commands 📊
|
|
348
345
|
|
|
349
|
-
| Command | When to use?
|
|
350
|
-
| ------------------ |
|
|
351
|
-
| `/p:progress` | View productivity
|
|
352
|
-
| `/p:context` | Project info
|
|
353
|
-
| `/p:stuck <issue>` | When you need help
|
|
346
|
+
| Command | When to use? | What does it do? | Example Output |
|
|
347
|
+
| ------------------ | ------------------ | ------------------------- | --------------------------------- |
|
|
348
|
+
| `/p:progress` | View productivity | Weekly metrics | `📈 7 shipped, velocity: 1.4/day` |
|
|
349
|
+
| `/p:context` | Project info | Current state and context | `📚 Sprint 3, Day 12, 67% done` |
|
|
350
|
+
| `/p:stuck <issue>` | When you need help | Contextual solutions | `💡 Try: npm install cors` |
|
|
354
351
|
|
|
355
352
|
## 🔄 Common Workflows
|
|
356
353
|
|
|
@@ -407,14 +404,6 @@ No migration needed. Just `/p:init` and start working.
|
|
|
407
404
|
└── decisions.jsonl # Decision history
|
|
408
405
|
```
|
|
409
406
|
|
|
410
|
-
### Migration from Old Structure
|
|
411
|
-
|
|
412
|
-
If you have an existing flat `.prjct/` structure, run:
|
|
413
|
-
|
|
414
|
-
```bash
|
|
415
|
-
./migrate.sh # Automatic migration to layered structure
|
|
416
|
-
```
|
|
417
|
-
|
|
418
407
|
## 🎨 Philosophy
|
|
419
408
|
|
|
420
409
|
- **Zero friction**: Commands within your existing workflow
|
|
@@ -440,6 +429,7 @@ If you have an existing flat `.prjct/` structure, run:
|
|
|
440
429
|
### What You Get
|
|
441
430
|
|
|
442
431
|
**With Claude Code/Desktop (Recommended):**
|
|
432
|
+
|
|
443
433
|
- ✅ Smart AI helpers for different tasks
|
|
444
434
|
- ✅ AI tools that help you code
|
|
445
435
|
- ✅ Checks your actual code changes
|
|
@@ -448,6 +438,7 @@ If you have an existing flat `.prjct/` structure, run:
|
|
|
448
438
|
- ✅ Everything works
|
|
449
439
|
|
|
450
440
|
**With Terminal/CLI Only:**
|
|
441
|
+
|
|
451
442
|
- ⚠️ Basic commands work (`prjct now`, `prjct done`, etc.)
|
|
452
443
|
- ❌ No AI helpers
|
|
453
444
|
- ❌ No AI tools
|
|
@@ -486,6 +477,7 @@ Starting with v0.5.0, prjct-cli only supports Claude Code and Claude Desktop. Th
|
|
|
486
477
|
**"I prefer Cursor/Windsurf"**
|
|
487
478
|
|
|
488
479
|
We get it! But consider:
|
|
480
|
+
|
|
489
481
|
- **No extra setup** - Works with whatever Claude subscription you have (free tier or Pro)
|
|
490
482
|
- **Better AI** - Latest Claude 3.5 Sonnet (Cursor/Windsurf use older models)
|
|
491
483
|
- **prjct-cli features** - Designed specifically for Claude's capabilities
|
|
@@ -495,6 +487,7 @@ Give Claude Code a try - you might prefer it! And if not, you can stay on v0.4.1
|
|
|
495
487
|
**"This feels limiting"**
|
|
496
488
|
|
|
497
489
|
It's actually the opposite. By specializing, we can:
|
|
490
|
+
|
|
498
491
|
- Build features impossible with multi-platform (agents, MCP, git validation)
|
|
499
492
|
- Ship updates 2x faster (less code to maintain)
|
|
500
493
|
- Deliver higher quality (proper testing of everything we support)
|
package/bin/prjct
CHANGED
|
@@ -1,232 +1,177 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* prjct CLI - 100% Agentic Entry Point
|
|
5
|
+
*
|
|
6
|
+
* Uses command-registry as single source of truth.
|
|
7
|
+
* Zero hardcoded logic - all commands resolved dynamically.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const PrjctCommands = require('../core/commands')
|
|
11
|
+
const registry = require('../core/command-registry')
|
|
4
12
|
|
|
5
13
|
async function main() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
i--; // Step back one since the loop will increment
|
|
84
|
-
designTarget = targetParts.join(' ');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!designTarget) {
|
|
89
|
-
result = {
|
|
90
|
-
success: false,
|
|
91
|
-
message: 'Please specify what to design: prjct design "authentication system"'
|
|
92
|
-
};
|
|
93
|
-
} else {
|
|
94
|
-
result = await commands.design(designTarget, designOptions);
|
|
95
|
-
}
|
|
96
|
-
break;
|
|
97
|
-
case 'migrate-all':
|
|
98
|
-
const migrateOptions = {};
|
|
99
|
-
const migrateArgs = args.slice(1);
|
|
100
|
-
|
|
101
|
-
for (let i = 0; i < migrateArgs.length; i++) {
|
|
102
|
-
if (migrateArgs[i] === '--deep-scan') {
|
|
103
|
-
migrateOptions.deepScan = true;
|
|
104
|
-
} else if (migrateArgs[i] === '--remove-legacy') {
|
|
105
|
-
migrateOptions.removeLegacy = true;
|
|
106
|
-
} else if (migrateArgs[i] === '--dry-run') {
|
|
107
|
-
migrateOptions.dryRun = true;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
result = await commands.migrateAll(migrateOptions);
|
|
112
|
-
break;
|
|
113
|
-
case 'setup':
|
|
114
|
-
const setupOptions = {};
|
|
115
|
-
const setupArgs = args.slice(1);
|
|
116
|
-
|
|
117
|
-
for (let i = 0; i < setupArgs.length; i++) {
|
|
118
|
-
if (setupArgs[i] === '--force') {
|
|
119
|
-
setupOptions.force = true;
|
|
120
|
-
} else if (setupArgs[i] === '--editor') {
|
|
121
|
-
setupOptions.editor = setupArgs[++i];
|
|
122
|
-
} else if (setupArgs[i] === '--create-templates') {
|
|
123
|
-
setupOptions.createTemplates = true;
|
|
124
|
-
} else if (setupArgs[i] === '--no-interactive') {
|
|
125
|
-
setupOptions.interactive = false;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
result = await commands.setup(setupOptions);
|
|
130
|
-
break;
|
|
131
|
-
case 'analyze':
|
|
132
|
-
const analyzeOptions = {};
|
|
133
|
-
const analyzeArgs = args.slice(1);
|
|
134
|
-
|
|
135
|
-
for (let i = 0; i < analyzeArgs.length; i++) {
|
|
136
|
-
if (analyzeArgs[i] === '--sync') {
|
|
137
|
-
analyzeOptions.sync = true;
|
|
138
|
-
} else if (analyzeArgs[i] === '--report-only') {
|
|
139
|
-
analyzeOptions.reportOnly = true;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
result = await commands.analyze(analyzeOptions);
|
|
144
|
-
break;
|
|
145
|
-
case '--version':
|
|
146
|
-
case '-v':
|
|
147
|
-
case 'version':
|
|
148
|
-
const packageJson = require('../package.json');
|
|
149
|
-
result = {
|
|
150
|
-
success: true,
|
|
151
|
-
message: `prjct-cli v${packageJson.version}`
|
|
152
|
-
};
|
|
153
|
-
break;
|
|
154
|
-
case '--help':
|
|
155
|
-
case '-h':
|
|
156
|
-
case 'help':
|
|
157
|
-
case undefined:
|
|
158
|
-
result = {
|
|
159
|
-
success: true,
|
|
160
|
-
message: `Available commands:
|
|
161
|
-
Setup:
|
|
162
|
-
start First-time setup (install commands to editors)
|
|
163
|
-
setup Reconfigure editor installations
|
|
164
|
-
|
|
165
|
-
Core workflow:
|
|
166
|
-
init Initialize prjct in current project
|
|
167
|
-
now [task] Set or show current task
|
|
168
|
-
done Complete current task
|
|
169
|
-
ship <feature> Ship and celebrate a feature
|
|
170
|
-
next Show priority queue
|
|
171
|
-
idea <text> Capture an idea
|
|
172
|
-
recap Show project overview
|
|
173
|
-
progress [period] Show progress metrics
|
|
174
|
-
stuck <issue> Get help with a problem
|
|
175
|
-
context Show project context
|
|
176
|
-
|
|
177
|
-
Advanced:
|
|
178
|
-
cleanup Clean up .prjct structure
|
|
179
|
-
cleanup-advanced Advanced cleanup with options
|
|
180
|
-
design [target] Design system/architecture
|
|
181
|
-
analyze Analyze codebase and sync state
|
|
182
|
-
migrate-all Migrate all legacy projects
|
|
183
|
-
|
|
184
|
-
Setup options:
|
|
185
|
-
--force Force update existing commands
|
|
186
|
-
--editor <name> Install to specific editor (claude|cursor|codex|windsurf)
|
|
187
|
-
--no-interactive Skip interactive selection, install to all
|
|
188
|
-
--create-templates Create templates from existing commands`
|
|
189
|
-
};
|
|
190
|
-
break;
|
|
191
|
-
default:
|
|
192
|
-
result = {
|
|
193
|
-
success: false,
|
|
194
|
-
message: `Unknown command: ${command}
|
|
195
|
-
|
|
196
|
-
Available commands:
|
|
197
|
-
Setup:
|
|
198
|
-
start First-time setup (install commands to editors)
|
|
199
|
-
setup Reconfigure editor installations
|
|
200
|
-
|
|
201
|
-
Core workflow:
|
|
202
|
-
init Initialize prjct in current project
|
|
203
|
-
now [task] Set or show current task
|
|
204
|
-
done Complete current task
|
|
205
|
-
ship <feature> Ship and celebrate a feature
|
|
206
|
-
next Show priority queue
|
|
207
|
-
idea <text> Capture an idea
|
|
208
|
-
recap Show project overview
|
|
209
|
-
progress [period] Show progress metrics
|
|
210
|
-
stuck <issue> Get help with a problem
|
|
211
|
-
context Show project context
|
|
212
|
-
|
|
213
|
-
Advanced:
|
|
214
|
-
cleanup Clean up .prjct structure
|
|
215
|
-
cleanup-advanced Advanced cleanup with options
|
|
216
|
-
design [target] Design system/architecture
|
|
217
|
-
analyze Analyze codebase and sync state
|
|
218
|
-
migrate-all Migrate all legacy projects
|
|
219
|
-
|
|
220
|
-
Setup options:
|
|
221
|
-
--force Force update existing commands
|
|
222
|
-
--editor <name> Install to specific editor (claude|cursor|codex|windsurf)
|
|
223
|
-
--no-interactive Skip interactive selection, install to all
|
|
224
|
-
--create-templates Create templates from existing commands`
|
|
225
|
-
};
|
|
14
|
+
const [commandName, ...rawArgs] = process.argv.slice(2)
|
|
15
|
+
|
|
16
|
+
// === SPECIAL COMMANDS (version, help) ===
|
|
17
|
+
|
|
18
|
+
if (['-v', '--version', 'version'].includes(commandName)) {
|
|
19
|
+
const packageJson = require('../package.json')
|
|
20
|
+
console.log(`prjct-cli v${packageJson.version}`)
|
|
21
|
+
process.exit(0)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (['-h', '--help', 'help', undefined].includes(commandName)) {
|
|
25
|
+
displayHelp()
|
|
26
|
+
process.exit(0)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// === DYNAMIC COMMAND EXECUTION ===
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// 1. Find command in registry
|
|
33
|
+
const cmd = registry.getByName(commandName)
|
|
34
|
+
|
|
35
|
+
if (!cmd) {
|
|
36
|
+
console.error(`Unknown command: ${commandName}`)
|
|
37
|
+
console.error(`\nUse 'prjct --help' to see available commands.`)
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 2. Check if deprecated (before checking implemented)
|
|
42
|
+
if (cmd.deprecated) {
|
|
43
|
+
console.error(`Command '${commandName}' is deprecated.`)
|
|
44
|
+
if (cmd.replacedBy) {
|
|
45
|
+
console.error(`Use 'prjct ${cmd.replacedBy}' instead.`)
|
|
46
|
+
}
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 3. Check if implemented
|
|
51
|
+
if (!cmd.implemented) {
|
|
52
|
+
console.error(`Command '${commandName}' exists but is not yet implemented.`)
|
|
53
|
+
console.error(`Check the roadmap or contribute: https://github.com/jlopezlira/prjct-cli`)
|
|
54
|
+
console.error(`\nUse 'prjct --help' to see available commands.`)
|
|
55
|
+
process.exit(1)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 4. Parse arguments based on command definition
|
|
59
|
+
const { parsedArgs, options } = parseCommandArgs(cmd, rawArgs)
|
|
60
|
+
|
|
61
|
+
// 5. Instantiate commands handler
|
|
62
|
+
const commands = new PrjctCommands()
|
|
63
|
+
|
|
64
|
+
// 6. Execute command
|
|
65
|
+
let result
|
|
66
|
+
|
|
67
|
+
// Commands with special option handling
|
|
68
|
+
if (commandName === 'design') {
|
|
69
|
+
const target = parsedArgs.join(' ')
|
|
70
|
+
result = await commands.design(target, options)
|
|
71
|
+
} else if (commandName === 'analyze') {
|
|
72
|
+
result = await commands.analyze(options)
|
|
73
|
+
} else if (commandName === 'cleanup') {
|
|
74
|
+
result = await commands.cleanup(options)
|
|
75
|
+
} else if (commandName === 'progress') {
|
|
76
|
+
const period = parsedArgs[0] || 'week'
|
|
77
|
+
result = await commands.progress(period)
|
|
78
|
+
} else if (commandName === 'build') {
|
|
79
|
+
const taskOrNumber = parsedArgs.join(' ')
|
|
80
|
+
result = await commands.build(taskOrNumber)
|
|
81
|
+
} else {
|
|
82
|
+
// Standard commands (most common case)
|
|
83
|
+
const param = parsedArgs.join(' ') || null
|
|
84
|
+
result = await commands[commandName](param)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 7. Display result
|
|
88
|
+
if (result && result.message) {
|
|
89
|
+
console.log(result.message)
|
|
226
90
|
}
|
|
227
91
|
|
|
228
|
-
|
|
229
|
-
|
|
92
|
+
process.exit(result && result.success ? 0 : 1)
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error('Error:', error.message)
|
|
95
|
+
if (process.env.DEBUG) {
|
|
96
|
+
console.error(error.stack)
|
|
97
|
+
}
|
|
98
|
+
process.exit(1)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Parse command arguments dynamically
|
|
104
|
+
*/
|
|
105
|
+
function parseCommandArgs(cmd, rawArgs) {
|
|
106
|
+
const parsedArgs = []
|
|
107
|
+
const options = {}
|
|
108
|
+
|
|
109
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
110
|
+
const arg = rawArgs[i]
|
|
111
|
+
|
|
112
|
+
if (arg.startsWith('--')) {
|
|
113
|
+
// Handle flags
|
|
114
|
+
const flagName = arg.slice(2)
|
|
115
|
+
|
|
116
|
+
// Check if next arg is a value (doesn't start with --)
|
|
117
|
+
if (i + 1 < rawArgs.length && !rawArgs[i + 1].startsWith('--')) {
|
|
118
|
+
options[flagName] = rawArgs[++i]
|
|
119
|
+
} else {
|
|
120
|
+
options[flagName] = true
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
parsedArgs.push(arg)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return { parsedArgs, options }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Display help using registry
|
|
132
|
+
*/
|
|
133
|
+
function displayHelp() {
|
|
134
|
+
const categories = registry.getCategories()
|
|
135
|
+
const categorizedCommands = {}
|
|
136
|
+
|
|
137
|
+
// Group commands by category (exclude deprecated)
|
|
138
|
+
registry.getTerminalCommands().forEach((cmd) => {
|
|
139
|
+
if (cmd.deprecated) return
|
|
140
|
+
|
|
141
|
+
if (!categorizedCommands[cmd.category]) {
|
|
142
|
+
categorizedCommands[cmd.category] = []
|
|
143
|
+
}
|
|
144
|
+
categorizedCommands[cmd.category].push(cmd)
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
console.log('prjct - Developer momentum tool for solo builders')
|
|
148
|
+
console.log('\nAvailable commands:\n')
|
|
149
|
+
|
|
150
|
+
// Display commands by category
|
|
151
|
+
Object.entries(categorizedCommands).forEach(([categoryKey, cmds]) => {
|
|
152
|
+
const categoryInfo = categories[categoryKey]
|
|
153
|
+
console.log(` ${categoryInfo.title}:`)
|
|
154
|
+
|
|
155
|
+
cmds.forEach((cmd) => {
|
|
156
|
+
const params = cmd.params ? ` ${cmd.params}` : ''
|
|
157
|
+
const spacing = ' '.repeat(Math.max(20 - cmd.name.length - params.length, 1))
|
|
158
|
+
const impl = cmd.implemented ? '' : ' (not implemented)'
|
|
159
|
+
console.log(` ${cmd.name}${params}${spacing}${cmd.description}${impl}`)
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
console.log('')
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
const stats = registry.getStats()
|
|
166
|
+
console.log(`Total: ${stats.implemented} implemented / ${stats.total} commands`)
|
|
167
|
+
console.log('\nFor more info: https://prjct.app')
|
|
230
168
|
}
|
|
231
169
|
|
|
232
|
-
|
|
170
|
+
// Run CLI
|
|
171
|
+
main().catch((error) => {
|
|
172
|
+
console.error('Fatal error:', error.message)
|
|
173
|
+
if (process.env.DEBUG) {
|
|
174
|
+
console.error(error.stack)
|
|
175
|
+
}
|
|
176
|
+
process.exit(1)
|
|
177
|
+
})
|