prjct-cli 0.8.2 → 0.8.4

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.
@@ -460,12 +460,12 @@ const COMMANDS = [
460
460
  category: 'setup',
461
461
  description: 'Reconfigure editor installations',
462
462
  usage: {
463
- claude: null,
463
+ claude: '/p:setup',
464
464
  terminal: 'prjct setup [--force] [--editor <name>]',
465
465
  },
466
466
  params: '[--force] [--editor <name>]',
467
467
  implemented: true,
468
- hasTemplate: false,
468
+ hasTemplate: true,
469
469
  icon: 'Settings',
470
470
  requiresInit: false,
471
471
  blockingRules: null,
@@ -475,12 +475,12 @@ const COMMANDS = [
475
475
  category: 'setup',
476
476
  description: 'Migrate all legacy projects',
477
477
  usage: {
478
- claude: null,
478
+ claude: '/p:migrate-all',
479
479
  terminal: 'prjct migrate-all [--deep-scan] [--remove-legacy] [--dry-run]',
480
480
  },
481
481
  params: '[--deep-scan] [--remove-legacy] [--dry-run]',
482
482
  implemented: true,
483
- hasTemplate: false,
483
+ hasTemplate: true,
484
484
  icon: 'Database',
485
485
  requiresInit: false,
486
486
  blockingRules: null,
@@ -210,10 +210,9 @@ class CommandInstaller {
210
210
 
211
211
  /**
212
212
  * Install to all detected editors (alias for installCommands)
213
- * @param {boolean} interactive - Whether to show interactive prompts
214
213
  * @returns {Promise<Object>} Installation results
215
214
  */
216
- async installToAll(interactive = false) {
215
+ async installToAll() {
217
216
  return await this.installCommands()
218
217
  }
219
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Built for Claude - Ship fast, track progress, stay focused. Developer momentum tool for indie hackers.",
5
5
  "main": "core/index.js",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "postinstall": "node scripts/postinstall.js",
15
+ "update-commands": "node -e \"const installer = require('./core/infrastructure/command-installer'); installer.syncCommands().then(r => console.log('Commands updated:', r)).catch(e => console.error('Error:', e.message))\"",
15
16
  "install-global": "./scripts/install.sh",
16
17
  "update": "./scripts/update.sh",
17
18
  "test": "vitest run --workspace=vitest.workspace.js",
@@ -6,16 +6,19 @@
6
6
  * Runs automatically after npm install -g prjct-cli
7
7
  *
8
8
  * 1. Detects if global install
9
- * 2. Installs/syncs commands to ~/.claude/commands/p/
10
- * 3. Installs/updates global config to ~/.claude/CLAUDE.md
11
- * 4. Migrates legacy projects automatically
12
- * 5. Shows beautiful ASCII art
9
+ * 2. Installs Claude Code CLI if not found (automatic)
10
+ * 3. Installs/syncs commands to ~/.claude/commands/p/
11
+ * 4. Installs/updates global config to ~/.claude/CLAUDE.md
12
+ * 5. Migrates all legacy projects automatically
13
+ * 6. Shows success message with results
13
14
  *
14
- * @version 0.8.2
15
+ * ZERO MANUAL STEPS - Everything is automatic
16
+ *
17
+ * @version 0.8.4
15
18
  */
16
19
 
17
- const fs = require('fs')
18
20
  const path = require('path')
21
+ const { execSync } = require('child_process')
19
22
  const installer = require('../core/infrastructure/command-installer')
20
23
  const migrator = require('../core/infrastructure/migrator')
21
24
  const { VERSION } = require('../core/utils/version')
@@ -43,83 +46,65 @@ async function main() {
43
46
 
44
47
  console.log('')
45
48
  console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
46
- console.log(`${BOLD}${CYAN}🚀 Setting up prjct-cli...${NC}`)
49
+ console.log(`${BOLD}${CYAN}🚀 Setting up prjct-cli v${VERSION}${NC}`)
47
50
  console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
48
51
  console.log('')
49
52
 
50
- // Step 1: Detect Claude Code
51
- console.log(`${BOLD}[1/5]${NC} Detecting Claude Code...`)
53
+ const results = {
54
+ claudeInstalled: false,
55
+ commandsAdded: 0,
56
+ commandsUpdated: 0,
57
+ configAction: null,
58
+ projectsMigrated: 0
59
+ }
60
+
61
+ // Step 1: Ensure Claude Code CLI is installed
62
+ const hasClaude = await hasClaudeCodeCLI()
63
+
64
+ if (!hasClaude) {
65
+ const installed = await installClaudeCode()
66
+ if (installed) {
67
+ results.claudeInstalled = true
68
+ } else {
69
+ // Cannot continue without Claude Code
70
+ showFailureMessage()
71
+ return
72
+ }
73
+ }
74
+
75
+ // Step 2: Detect Claude directory (for commands)
52
76
  const claudeDetected = await installer.detectClaude()
53
77
 
54
- if (!claudeDetected) {
55
- console.log(`${YELLOW}⚠️ Claude Code not detected${NC}`)
56
- console.log(`${DIM}Install Claude Code from: https://claude.ai/code${NC}`)
57
- console.log(`${DIM}Then run: prjct setup${NC}`)
58
- console.log('')
59
- } else {
60
- console.log(`${GREEN}✓${NC} Claude Code found`)
61
- console.log('')
62
-
63
- // Step 2: Install/sync commands
64
- console.log(`${BOLD}[2/5]${NC} Installing commands to ~/.claude...`)
78
+ if (claudeDetected) {
79
+ // Step 3: Sync commands
65
80
  const syncResult = await installer.syncCommands()
66
81
 
67
82
  if (syncResult.success) {
68
- const { added, updated, removed } = syncResult
69
- const changes = []
70
- if (added > 0) changes.push(`${added} nuevos`)
71
- if (updated > 0) changes.push(`${updated} actualizados`)
72
- if (removed > 0) changes.push(`${removed} eliminados`)
73
-
74
- if (changes.length > 0) {
75
- console.log(`${GREEN}✓${NC} ${changes.join(', ')}`)
76
- } else {
77
- console.log(`${GREEN}✓${NC} All commands up to date`)
78
- }
79
- } else {
80
- console.log(`${YELLOW}⚠️ ${syncResult.error}${NC}`)
83
+ results.commandsAdded = syncResult.added
84
+ results.commandsUpdated = syncResult.updated
81
85
  }
82
- console.log('')
83
86
 
84
- // Step 3: Install global configuration
85
- console.log(`${BOLD}[3/5]${NC} Installing global configuration...`)
87
+ // Step 4: Install global configuration
86
88
  const configResult = await installer.installGlobalConfig()
87
89
 
88
90
  if (configResult.success) {
89
- if (configResult.action === 'created') {
90
- console.log(`${GREEN}✓${NC} Created ~/.claude/CLAUDE.md`)
91
- } else if (configResult.action === 'updated') {
92
- console.log(`${GREEN}✓${NC} Updated ~/.claude/CLAUDE.md`)
93
- } else if (configResult.action === 'appended') {
94
- console.log(`${GREEN}✓${NC} Added prjct config to ~/.claude/CLAUDE.md`)
95
- }
96
- } else {
97
- console.log(`${YELLOW}⚠️ ${configResult.error}${NC}`)
91
+ results.configAction = configResult.action
98
92
  }
99
- console.log('')
100
- }
101
93
 
102
- // Step 4: Migrate legacy projects
103
- console.log(`${BOLD}[4/5]${NC} Checking for legacy projects...`)
104
- const migrationResult = await migrator.migrateAll({
105
- deepScan: false, // Only search common directories
106
- cleanupLegacy: true, // Remove legacy directories, keep config
107
- dryRun: false
108
- })
109
-
110
- if (migrationResult.successfullyMigrated > 0) {
111
- console.log(`${GREEN}✓${NC} ${migrationResult.successfullyMigrated} projects migrated to global storage`)
112
- } else if (migrationResult.totalFound === 0) {
113
- console.log(`${DIM}No legacy projects found${NC}`)
114
- } else {
115
- console.log(`${DIM}All projects already migrated${NC}`)
94
+ // Step 5: Migrate legacy projects automatically
95
+ const migrationResult = await migrator.migrateAll({
96
+ deepScan: false,
97
+ cleanupLegacy: true,
98
+ dryRun: false
99
+ })
100
+
101
+ if (migrationResult.successfullyMigrated > 0) {
102
+ results.projectsMigrated = migrationResult.successfullyMigrated
103
+ }
116
104
  }
117
- console.log('')
118
105
 
119
- // Step 5: Show ASCII art and quick start
120
- console.log(`${BOLD}[5/5]${NC} Installation complete!`)
121
- console.log('')
122
- showAsciiArt()
106
+ // Show final success message
107
+ showSuccessMessage(results)
123
108
 
124
109
  } catch (error) {
125
110
  console.error(`${YELLOW}⚠️ Post-install error: ${error.message}${NC}`)
@@ -153,9 +138,42 @@ async function detectGlobalInstall() {
153
138
  }
154
139
 
155
140
  /**
156
- * Show beautiful ASCII art with quick start
141
+ * Check if Claude Code CLI is installed
142
+ */
143
+ async function hasClaudeCodeCLI() {
144
+ try {
145
+ execSync('which claude', { stdio: 'ignore' })
146
+ return true
147
+ } catch {
148
+ return false
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Install Claude Code CLI
154
+ */
155
+ async function installClaudeCode() {
156
+ try {
157
+ console.log(`${YELLOW}📦 Claude Code not found. Installing...${NC}`)
158
+ console.log('')
159
+ execSync('npm install -g @anthropic-ai/claude-code', { stdio: 'inherit' })
160
+ console.log('')
161
+ console.log(`${GREEN}✓${NC} Claude Code installed successfully`)
162
+ console.log('')
163
+ return true
164
+ } catch (error) {
165
+ console.log(`${YELLOW}⚠️ Failed to install Claude Code: ${error.message}${NC}`)
166
+ console.log(`${DIM}Please install manually: npm install -g @anthropic-ai/claude-code${NC}`)
167
+ console.log('')
168
+ return false
169
+ }
170
+ }
171
+
172
+ /**
173
+ * Show success message with results
157
174
  */
158
- function showAsciiArt() {
175
+ function showSuccessMessage(results) {
176
+ console.log('')
159
177
  console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
160
178
  console.log('')
161
179
  console.log(` ${BOLD}${CYAN}██████╗ ██████╗ ██╗ ██████╗████████╗${NC}`)
@@ -165,32 +183,69 @@ function showAsciiArt() {
165
183
  console.log(` ${BOLD}${CYAN}██║ ██║ ██║╚█████╔╝╚██████╗ ██║${NC}`)
166
184
  console.log(` ${BOLD}${CYAN}╚═╝ ╚═╝ ╚═╝ ╚════╝ ╚═════╝ ╚═╝${NC}`)
167
185
  console.log('')
168
- console.log(` ${BOLD}${CYAN}prjct${NC}${MAGENTA}/${NC}${GREEN}cli${NC} ${DIM}${WHITE}v${VERSION} installed${NC}`)
186
+ console.log(` ${BOLD}${GREEN}v${VERSION} READY!${NC}`)
169
187
  console.log('')
170
- console.log(` ${YELLOW}⚡${NC} Ship faster with zero friction`)
171
- console.log(` ${GREEN}📝${NC} From idea to technical tasks in minutes`)
172
- console.log(` ${CYAN}🤖${NC} Perfect context for AI agents`)
188
+ console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
189
+ console.log('')
190
+
191
+ // Show what was done
192
+ if (results.claudeInstalled) {
193
+ console.log(` ${GREEN}✓${NC} Claude Code CLI installed`)
194
+ } else {
195
+ console.log(` ${GREEN}✓${NC} Claude Code CLI found`)
196
+ }
197
+
198
+ const totalCommands = results.commandsAdded + results.commandsUpdated
199
+ if (totalCommands > 0) {
200
+ const parts = []
201
+ if (results.commandsAdded > 0) parts.push(`${results.commandsAdded} new`)
202
+ if (results.commandsUpdated > 0) parts.push(`${results.commandsUpdated} updated`)
203
+ console.log(` ${GREEN}✓${NC} Commands synced (${parts.join(', ')})`)
204
+ } else {
205
+ console.log(` ${GREEN}✓${NC} Commands up to date`)
206
+ }
207
+
208
+ if (results.configAction === 'created') {
209
+ console.log(` ${GREEN}✓${NC} Global config created`)
210
+ } else if (results.configAction === 'updated') {
211
+ console.log(` ${GREEN}✓${NC} Global config updated`)
212
+ } else if (results.configAction === 'appended') {
213
+ console.log(` ${GREEN}✓${NC} Global config merged`)
214
+ }
215
+
216
+ if (results.projectsMigrated > 0) {
217
+ console.log(` ${GREEN}✓${NC} ${results.projectsMigrated} projects migrated to global storage`)
218
+ }
219
+
173
220
  console.log('')
174
221
  console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
175
222
  console.log('')
176
- console.log(`${BOLD}${CYAN}🚀 Quick Start${NC}`)
177
- console.log(`${DIM}─────────────────────────────────────────────────${NC}`)
223
+ console.log(`${BOLD}Next steps:${NC}`)
224
+ console.log(` ${DIM}cd your-project${NC}`)
225
+ console.log(` ${GREEN}/p:init${NC}`)
226
+ console.log('')
227
+ console.log(`${BOLD}${MAGENTA}Happy shipping! 🚀${NC}`)
228
+ console.log('')
229
+ }
230
+
231
+ /**
232
+ * Show failure message
233
+ */
234
+ function showFailureMessage() {
178
235
  console.log('')
179
- console.log(` ${BOLD}1.${NC} Initialize your project:`)
180
- console.log(` ${GREEN}cd your-project && prjct init${NC}`)
236
+ console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
181
237
  console.log('')
182
- console.log(` ${BOLD}2.${NC} Set your current focus:`)
183
- console.log(` ${GREEN}prjct now "build auth"${NC}`)
238
+ console.log(`${YELLOW}⚠️ Setup incomplete${NC}`)
184
239
  console.log('')
185
- console.log(` ${BOLD}3.${NC} Ship & celebrate:`)
186
- console.log(` ${GREEN}prjct ship "user login"${NC}`)
240
+ console.log(`Claude Code is required for prjct-cli.`)
187
241
  console.log('')
188
- console.log(`${DIM}─────────────────────────────────────────────────${NC}`)
242
+ console.log(`Please install manually:`)
243
+ console.log(` ${GREEN}npm install -g @anthropic-ai/claude-code${NC}`)
189
244
  console.log('')
190
- console.log(` ${DIM}Documentation:${NC} ${CYAN}https://prjct.app${NC}`)
191
- console.log(` ${DIM}Report issues:${NC} ${CYAN}https://github.com/jlopezlira/prjct-cli/issues${NC}`)
245
+ console.log(`Then run:`)
246
+ console.log(` ${GREEN}prjct setup${NC}`)
192
247
  console.log('')
193
- console.log(`${BOLD}${MAGENTA}Happy shipping! 🚀${NC}`)
248
+ console.log(`${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}`)
194
249
  console.log('')
195
250
  }
196
251
 
@@ -0,0 +1,120 @@
1
+ # /p:migrate-all - Migrate All Legacy Projects
2
+
3
+ Migrates all legacy prjct projects to the new global storage architecture.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /p:migrate-all [--deep-scan] [--remove-legacy] [--dry-run]
9
+ ```
10
+
11
+ ## What This Command Does
12
+
13
+ 1. **Scans Global Storage**
14
+ - Reads all project IDs from `~/.prjct-cli/projects/`
15
+ - Retrieves project paths from `project.json` files
16
+
17
+ 2. **Detects Legacy Structure**
18
+ - Checks each project for old `.prjct/` directory structure
19
+ - Identifies projects that need migration
20
+
21
+ 3. **Migrates Each Project**
22
+ - Moves data from local `.prjct/` to global `~/.prjct-cli/projects/{id}/`
23
+ - Creates new minimal local config (`.prjct/prjct.config.json`)
24
+ - Preserves all project data and history
25
+
26
+ 4. **Cleanup (Optional)**
27
+ - Removes legacy `.prjct/` directories (with `--remove-legacy`)
28
+ - Keeps only the new minimal config file
29
+
30
+ 5. **Reports Summary**
31
+ - Shows migrated, skipped, and failed projects
32
+ - Lists detailed errors for any failures
33
+
34
+ ## Options
35
+
36
+ - `--deep-scan`: Scan entire file system (slow but thorough)
37
+ - `--remove-legacy`: Delete old `.prjct/` directories after successful migration
38
+ - `--dry-run`: Show what would be migrated without making changes
39
+
40
+ ## When to Use
41
+
42
+ - **After major version updates**: When architecture changes
43
+ - **Upgrading from v0.7.x to v0.8.x**: New global storage system
44
+ - **Consolidating projects**: Moving all projects to global storage
45
+ - **Troubleshooting**: If projects aren't working after update
46
+
47
+ ## Migration Process
48
+
49
+ ### Before (Legacy Structure)
50
+ ```
51
+ your-project/
52
+ .prjct/
53
+ core/
54
+ planning/
55
+ progress/
56
+ memory/
57
+ analysis/
58
+ prjct.config.json # Full config
59
+ ```
60
+
61
+ ### After (Global Storage)
62
+ ```
63
+ your-project/
64
+ .prjct/
65
+ prjct.config.json # Minimal (projectId + dataPath only)
66
+
67
+ ~/.prjct-cli/projects/3a5667a5dedb/
68
+ core/
69
+ planning/
70
+ progress/
71
+ memory/
72
+ analysis/
73
+ agents/
74
+ project.json # System config (authors, version, etc.)
75
+ ```
76
+
77
+ ## Output Example
78
+
79
+ ```
80
+ 🔄 Scanning for legacy prjct projects...
81
+
82
+ 📁 Found 3 projects in global storage
83
+
84
+ 🔄 Migrating: /Users/jj/Apps/my-app
85
+ ✅ Migrated successfully
86
+
87
+ 🔄 Migrating: /Users/jj/Apps/other-project
88
+ ⏭️ Already migrated
89
+
90
+ 📊 Migration Summary:
91
+ ✅ Migrated: 1
92
+ ⏭️ Skipped: 1
93
+ ❌ Failed: 0
94
+ ```
95
+
96
+ ## Error Handling
97
+
98
+ - **No global storage**: Creates directory structure
99
+ - **Missing project paths**: Skips projects with invalid paths
100
+ - **Permission errors**: Reports which projects couldn't be migrated
101
+ - **Already migrated**: Safely skips without changes
102
+
103
+ ## Safety
104
+
105
+ - **Idempotent**: Safe to run multiple times
106
+ - **Non-destructive**: Original files only removed with `--remove-legacy`
107
+ - **Dry run available**: Test migration with `--dry-run` first
108
+ - **Automatic backup**: Legacy data preserved until explicitly removed
109
+
110
+ ## Requirements
111
+
112
+ - Write permissions to `~/.prjct-cli/` and project directories
113
+ - Projects must have valid global config in `project.json`
114
+
115
+ ## Notes
116
+
117
+ - This command does NOT require an initialized prjct project
118
+ - Migration is automatic on install (but manual execution is safer)
119
+ - Always test with `--dry-run` first for large migrations
120
+ - Can be safely interrupted and resumed
@@ -0,0 +1,74 @@
1
+ # /p:setup - Reconfigure prjct-cli Installation
2
+
3
+ Reconfigures prjct-cli installation for Claude Code and Claude Desktop.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /p:setup [--force]
9
+ ```
10
+
11
+ ## What This Command Does
12
+
13
+ 1. **Detects Claude Installation**
14
+ - Checks if `~/.claude/` directory exists
15
+ - Verifies Claude Code or Claude Desktop is installed
16
+
17
+ 2. **Syncs Commands to Claude**
18
+ - Updates all `/p:*` commands in `~/.claude/commands/p/`
19
+ - Adds new commands from latest version
20
+ - Updates existing commands with latest templates
21
+ - Removes orphaned/deprecated commands
22
+
23
+ 3. **Installs/Updates Global Configuration**
24
+ - Creates or updates `~/.claude/CLAUDE.md`
25
+ - Adds prjct-specific instructions for Claude
26
+ - Preserves existing user configuration
27
+
28
+ 4. **Reports Results**
29
+ - Shows commands added, updated, removed
30
+ - Displays any errors encountered
31
+ - Confirms successful installation
32
+
33
+ ## Options
34
+
35
+ - `--force`: Remove existing installation and reinstall from scratch
36
+
37
+ ## When to Use
38
+
39
+ - **After updating prjct-cli**: `npm update -g prjct-cli && /p:setup`
40
+ - **Commands not working**: If `/p:*` commands aren't recognized
41
+ - **Fresh installation**: After installing on a new machine
42
+ - **Troubleshooting**: When encountering command-related issues
43
+
44
+ ## Requirements
45
+
46
+ - Claude Code or Claude Desktop must be installed
47
+ - Write permissions to `~/.claude/` directory
48
+
49
+ ## Output Example
50
+
51
+ ```
52
+ 🔧 Reconfiguring prjct...
53
+
54
+ 📦 Installing /p:* commands...
55
+ ✓ 3 nuevos, 12 actualizados, 1 eliminado
56
+
57
+ 📝 Installing global configuration...
58
+ ✓ Updated ~/.claude/CLAUDE.md
59
+
60
+ ✅ Setup complete!
61
+ ```
62
+
63
+ ## Error Handling
64
+
65
+ - **Claude not detected**: Shows installation URLs for Claude Code/Desktop
66
+ - **Permission errors**: Reports which files couldn't be written
67
+ - **Template errors**: Lists which commands failed to install
68
+
69
+ ## Notes
70
+
71
+ - This command does NOT migrate projects (use `/p:migrate-all` for that)
72
+ - This command does NOT require an initialized prjct project
73
+ - Safe to run multiple times (idempotent)
74
+ - Will not overwrite user customizations in `~/.claude/CLAUDE.md`