prjct-cli 0.4.3 → 0.4.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.
- package/CHANGELOG.md +79 -2
- package/core/command-installer.js +115 -2
- package/core/editors-config.js +18 -0
- package/package.json +3 -1
- package/scripts/post-install.js +59 -3
- package/scripts/preuninstall.js +94 -0
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
15
15
|
- Cross-platform file operations
|
|
16
16
|
- Windows Terminal integration
|
|
17
17
|
|
|
18
|
+
## [0.4.4] - 2025-10-02
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **Automatic Editor Command Updates** - Commands auto-update when npm package is updated
|
|
22
|
+
- New `core/editors-config.js` tracks which editors user has installed commands to
|
|
23
|
+
- Stores editor selections in `~/.prjct-cli/config/installed-editors.json`
|
|
24
|
+
- Post-install hook (`scripts/post-install.js`) auto-updates commands after `npm update -g prjct-cli`
|
|
25
|
+
- **Auto-installation on first install** - Detects AI editors and installs commands automatically
|
|
26
|
+
- Ensures version consistency across all configured editors (Claude, Cursor, Windsurf, Codex)
|
|
27
|
+
- No manual reinstallation needed - updates happen automatically
|
|
28
|
+
- Respects user's original editor choices from initial setup
|
|
29
|
+
|
|
30
|
+
- **Automatic Cleanup on Uninstall** - Clean uninstallation removes all traces
|
|
31
|
+
- New `scripts/preuninstall.js` runs before `npm uninstall -g prjct-cli`
|
|
32
|
+
- Automatically removes commands from all tracked editors
|
|
33
|
+
- Deletes tracking configuration from `~/.prjct-cli/config/`
|
|
34
|
+
- Added `uninstallFromEditor()` and `uninstallFromAll()` methods to command installer
|
|
35
|
+
- Added `deleteConfig()` method to editors config
|
|
36
|
+
- Prevents orphaned commands when package is uninstalled
|
|
37
|
+
- Clean exit even if cleanup fails (doesn't block uninstall)
|
|
38
|
+
|
|
39
|
+
- **Automatic Data Migration** - Seamless upgrade from v0.1.0 to v0.4.4
|
|
40
|
+
- Post-install hook automatically detects legacy `.prjct/` projects
|
|
41
|
+
- Migrates data from local structure to new global architecture (`~/.prjct-cli/projects/{id}/`)
|
|
42
|
+
- Scans common project directories (Projects, Documents, Developer, Code, etc.)
|
|
43
|
+
- Preserves all project data during migration (now, next, shipped, ideas, memory)
|
|
44
|
+
- Cleans up legacy directories while keeping config for compatibility
|
|
45
|
+
- No user intervention required - migration happens automatically on update
|
|
46
|
+
- Uses existing battle-tested `core/migrator.js` system
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
- **Improved Command Tracking** - Always track editor installations for better update management
|
|
50
|
+
- Modified `installToSelected()` to always save editor config (removed `!forceUpdate` restriction)
|
|
51
|
+
- Ensures tracking happens even during force updates
|
|
52
|
+
- Enables reliable auto-updates across all configured editors
|
|
53
|
+
|
|
54
|
+
### Technical Details
|
|
55
|
+
- **Post-Install Hook**: Runs after `npm install -g prjct-cli` or `npm update -g prjct-cli`
|
|
56
|
+
- First install: Auto-detects editors and installs commands
|
|
57
|
+
- Updates: Checks version change and auto-updates commands in tracked editors
|
|
58
|
+
- **Migration**: Automatically detects and migrates legacy projects from v0.1.0
|
|
59
|
+
- Silent operation with debug mode via `DEBUG=1` environment variable
|
|
60
|
+
- **Pre-Uninstall Hook**: Runs before `npm uninstall -g prjct-cli`
|
|
61
|
+
- Reads tracking config to find all installed editors
|
|
62
|
+
- Removes command directories from each editor
|
|
63
|
+
- Cleans up tracking configuration
|
|
64
|
+
- Fails gracefully to not block uninstall
|
|
65
|
+
- **Migration System**: Automatic upgrade path from v0.1.0 to v0.4.4
|
|
66
|
+
- Scans common project directories (fast, non-intrusive)
|
|
67
|
+
- Migrates local `.prjct/` to global `~/.prjct-cli/projects/{id}/`
|
|
68
|
+
- Preserves all data: core, progress, planning, analysis, memory layers
|
|
69
|
+
- Cleans legacy directories while keeping compatibility config
|
|
70
|
+
- Zero data loss, seamless upgrade experience
|
|
71
|
+
|
|
18
72
|
## [0.4.3] - 2025-10-02
|
|
19
73
|
|
|
20
74
|
### Added
|
|
@@ -22,10 +76,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
22
76
|
- New `core/editors-config.js` tracks which editors user has installed commands to
|
|
23
77
|
- Stores editor selections in `~/.prjct-cli/config/installed-editors.json`
|
|
24
78
|
- Post-install hook (`scripts/post-install.js`) auto-updates commands after `npm update -g prjct-cli`
|
|
79
|
+
- **Auto-installation on first install** - Detects AI editors and installs commands automatically
|
|
25
80
|
- Ensures version consistency across all configured editors (Claude, Cursor, Windsurf, Codex)
|
|
26
81
|
- No manual reinstallation needed - updates happen automatically
|
|
27
82
|
- Respects user's original editor choices from initial setup
|
|
28
83
|
|
|
84
|
+
- **Automatic Cleanup on Uninstall** - Clean uninstallation removes all traces
|
|
85
|
+
- New `scripts/preuninstall.js` runs before `npm uninstall -g prjct-cli`
|
|
86
|
+
- Automatically removes commands from all tracked editors
|
|
87
|
+
- Deletes tracking configuration from `~/.prjct-cli/config/`
|
|
88
|
+
- Added `uninstallFromEditor()` and `uninstallFromAll()` methods to command installer
|
|
89
|
+
- Added `deleteConfig()` method to editors config
|
|
90
|
+
- Prevents orphaned commands when package is uninstalled
|
|
91
|
+
- Clean exit even if cleanup fails (doesn't block uninstall)
|
|
92
|
+
|
|
29
93
|
- **GitHub Packages Support** - Dual registry publication for better reliability
|
|
30
94
|
- Package now published to both npm and GitHub Packages automatically
|
|
31
95
|
- GitHub Actions workflow updated to publish to both registries in parallel
|
|
@@ -40,9 +104,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
40
104
|
- Alternative: GitHub Packages (for advanced users or npm fallback)
|
|
41
105
|
- Clear instructions for both installation methods
|
|
42
106
|
|
|
107
|
+
- **Command Installer Improvements**
|
|
108
|
+
- `installToSelected()` now always saves editor config (removed force-update restriction)
|
|
109
|
+
- Better tracking ensures updates work correctly even for force updates
|
|
110
|
+
- Improved error handling and reporting
|
|
111
|
+
|
|
43
112
|
### Technical Details
|
|
44
|
-
- **Editor Tracking**: Configuration saved after successful command
|
|
45
|
-
- **Post-Install Hook**:
|
|
113
|
+
- **Editor Tracking**: Configuration saved after all successful command installations
|
|
114
|
+
- **Post-Install Hook**:
|
|
115
|
+
- Runs only for global installations, skips for local/dev installs
|
|
116
|
+
- Auto-detects and installs to all AI editors on first install
|
|
117
|
+
- Auto-updates commands when version changes
|
|
118
|
+
- **Pre-Uninstall Hook**:
|
|
119
|
+
- Runs only for global uninstallations
|
|
120
|
+
- Removes slash commands from `~/.claude/`, `~/.cursor/`, `~/.windsurf/`
|
|
121
|
+
- Removes AGENTS.md from `~/.codex/` if present
|
|
122
|
+
- Deletes tracking configuration
|
|
46
123
|
- **Version Detection**: Compares current version with last installed version
|
|
47
124
|
- **Force Update**: Automatically updates commands when version changes
|
|
48
125
|
- **Parallel Publication**: npm and GitHub Packages jobs run simultaneously for faster releases
|
|
@@ -444,8 +444,8 @@ For detailed implementation, see prjct-cli documentation.
|
|
|
444
444
|
const totalUpdated = Object.values(results)
|
|
445
445
|
.reduce((sum, r) => sum + (r.updated || 0), 0)
|
|
446
446
|
|
|
447
|
-
//
|
|
448
|
-
if (
|
|
447
|
+
// Always save editor selections to config for tracking updates
|
|
448
|
+
if (successfulEditors.length > 0) {
|
|
449
449
|
await this.saveEditorConfig(successfulEditors)
|
|
450
450
|
}
|
|
451
451
|
|
|
@@ -807,6 +807,119 @@ This command uses the global prjct architecture:
|
|
|
807
807
|
|
|
808
808
|
return results
|
|
809
809
|
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Uninstall commands from a specific editor
|
|
813
|
+
* @param {string} editorKey - Editor identifier (claude, cursor, codex, windsurf)
|
|
814
|
+
* @returns {Promise<Object>} Uninstallation result
|
|
815
|
+
*/
|
|
816
|
+
async uninstallFromEditor(editorKey) {
|
|
817
|
+
const editor = this.editors[editorKey]
|
|
818
|
+
|
|
819
|
+
if (!editor) {
|
|
820
|
+
return { success: false, editor: editorKey, message: `Unknown editor: ${editorKey}` }
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
try {
|
|
824
|
+
switch (editor.format) {
|
|
825
|
+
case 'slash-commands':
|
|
826
|
+
// Remove the /p commands directory
|
|
827
|
+
await fs.rm(editor.commandsPath, { recursive: true, force: true })
|
|
828
|
+
return {
|
|
829
|
+
success: true,
|
|
830
|
+
editor: editor.name,
|
|
831
|
+
path: editor.commandsPath,
|
|
832
|
+
message: `Removed slash commands from ${editor.name}`,
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
case 'agents-md':
|
|
836
|
+
// Remove AGENTS.md if it exists
|
|
837
|
+
const exists = await this.fileExists(editor.commandsPath)
|
|
838
|
+
if (exists) {
|
|
839
|
+
await fs.unlink(editor.commandsPath)
|
|
840
|
+
}
|
|
841
|
+
return {
|
|
842
|
+
success: true,
|
|
843
|
+
editor: editor.name,
|
|
844
|
+
path: editor.commandsPath,
|
|
845
|
+
message: `Removed AGENTS.md from ${editor.name}`,
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
case 'workflows':
|
|
849
|
+
// Remove all p_*.md workflow files
|
|
850
|
+
try {
|
|
851
|
+
const files = await fs.readdir(editor.commandsPath)
|
|
852
|
+
const prjctWorkflows = files.filter(f => f.startsWith('p_') && f.endsWith('.md'))
|
|
853
|
+
|
|
854
|
+
for (const file of prjctWorkflows) {
|
|
855
|
+
await fs.unlink(path.join(editor.commandsPath, file))
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
return {
|
|
859
|
+
success: true,
|
|
860
|
+
editor: editor.name,
|
|
861
|
+
path: editor.commandsPath,
|
|
862
|
+
removed: prjctWorkflows.length,
|
|
863
|
+
message: `Removed ${prjctWorkflows.length} workflows from ${editor.name}`,
|
|
864
|
+
}
|
|
865
|
+
} catch (error) {
|
|
866
|
+
// Directory might not exist, that's ok
|
|
867
|
+
return {
|
|
868
|
+
success: true,
|
|
869
|
+
editor: editor.name,
|
|
870
|
+
message: `No workflows found in ${editor.name}`,
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
default:
|
|
875
|
+
return {
|
|
876
|
+
success: false,
|
|
877
|
+
editor: editor.name,
|
|
878
|
+
message: `Unknown format: ${editor.format}`,
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
} catch (error) {
|
|
882
|
+
return {
|
|
883
|
+
success: false,
|
|
884
|
+
editor: editor.name,
|
|
885
|
+
message: `Uninstall failed: ${error.message}`,
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Uninstall commands from all tracked editors
|
|
892
|
+
* @returns {Promise<Object>} Uninstallation results
|
|
893
|
+
*/
|
|
894
|
+
async uninstallFromAll() {
|
|
895
|
+
const editorsConfig = require('./editors-config')
|
|
896
|
+
const trackedEditors = await editorsConfig.getTrackedEditors()
|
|
897
|
+
|
|
898
|
+
if (trackedEditors.length === 0) {
|
|
899
|
+
return {
|
|
900
|
+
success: true,
|
|
901
|
+
message: 'No editors tracked, nothing to uninstall',
|
|
902
|
+
results: {},
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
const results = {}
|
|
907
|
+
const successfulEditors = []
|
|
908
|
+
|
|
909
|
+
for (const editorKey of trackedEditors) {
|
|
910
|
+
results[editorKey] = await this.uninstallFromEditor(editorKey)
|
|
911
|
+
if (results[editorKey].success) {
|
|
912
|
+
successfulEditors.push(this.editors[editorKey]?.name || editorKey)
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
return {
|
|
917
|
+
success: true,
|
|
918
|
+
editors: successfulEditors,
|
|
919
|
+
totalRemoved: successfulEditors.length,
|
|
920
|
+
results,
|
|
921
|
+
}
|
|
922
|
+
}
|
|
810
923
|
}
|
|
811
924
|
|
|
812
925
|
module.exports = new CommandInstaller()
|
package/core/editors-config.js
CHANGED
|
@@ -155,6 +155,24 @@ class EditorsConfig {
|
|
|
155
155
|
return false
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Delete configuration file
|
|
161
|
+
* Used during uninstallation to clean up tracking data
|
|
162
|
+
* @returns {Promise<boolean>} Success status
|
|
163
|
+
*/
|
|
164
|
+
async deleteConfig() {
|
|
165
|
+
try {
|
|
166
|
+
const exists = await this.configExists()
|
|
167
|
+
if (exists) {
|
|
168
|
+
await fs.unlink(this.configFile)
|
|
169
|
+
}
|
|
170
|
+
return true
|
|
171
|
+
} catch (error) {
|
|
172
|
+
console.error('[editors-config] Error deleting config:', error.message)
|
|
173
|
+
return false
|
|
174
|
+
}
|
|
175
|
+
}
|
|
158
176
|
}
|
|
159
177
|
|
|
160
178
|
module.exports = new EditorsConfig()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prjct-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "AI-integrated project management for indie hackers - works with Claude Code, Cursor, and Warp",
|
|
5
5
|
"main": "core/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
14
|
"postinstall": "node scripts/post-install.js",
|
|
15
|
+
"preuninstall": "node scripts/preuninstall.js",
|
|
15
16
|
"install-global": "./scripts/install.sh",
|
|
16
17
|
"test": "echo 'No tests configured'",
|
|
17
18
|
"lint": "eslint \"**/*.js\" --ignore-pattern \"node_modules/**\" --ignore-pattern \"website/**\"",
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
"scripts/install.sh",
|
|
70
71
|
"scripts/verify-installation.sh",
|
|
71
72
|
"scripts/post-install.js",
|
|
73
|
+
"scripts/preuninstall.js",
|
|
72
74
|
"LICENSE",
|
|
73
75
|
"README.md",
|
|
74
76
|
"CHANGELOG.md",
|
package/scripts/post-install.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 3. If config exists and version changed, force-update commands in tracked editors
|
|
13
13
|
* 4. Update version in config
|
|
14
14
|
*
|
|
15
|
-
* @version 0.4.
|
|
15
|
+
* @version 0.4.4
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const path = require('path')
|
|
@@ -34,8 +34,36 @@ async function main() {
|
|
|
34
34
|
const configExists = await editorsConfig.configExists()
|
|
35
35
|
|
|
36
36
|
if (!configExists) {
|
|
37
|
-
// First-time install
|
|
38
|
-
|
|
37
|
+
// First-time install - auto-detect and install to all editors
|
|
38
|
+
console.log(chalk.cyan('\n🔍 First-time installation detected...\n'))
|
|
39
|
+
|
|
40
|
+
// Load command installer
|
|
41
|
+
const commandInstaller = require('../core/command-installer')
|
|
42
|
+
|
|
43
|
+
// Detect available editors
|
|
44
|
+
const detected = await commandInstaller.detectEditors()
|
|
45
|
+
const detectedEditors = Object.entries(detected)
|
|
46
|
+
.filter(([_, info]) => info.detected)
|
|
47
|
+
.map(([key, _]) => key)
|
|
48
|
+
|
|
49
|
+
if (detectedEditors.length === 0) {
|
|
50
|
+
// No editors detected, user will install manually later
|
|
51
|
+
console.log(chalk.yellow('ℹ️ No AI editors detected'))
|
|
52
|
+
console.log(chalk.gray(' Run `prjct install` when you set up Claude Code, Cursor, or Windsurf\n'))
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.log(chalk.cyan(`📦 Installing commands to: ${detectedEditors.map(k => commandInstaller.editors[k]?.name || k).join(', ')}\n`))
|
|
57
|
+
|
|
58
|
+
// Install to all detected editors
|
|
59
|
+
const results = await commandInstaller.installToAll(false)
|
|
60
|
+
|
|
61
|
+
if (results.success) {
|
|
62
|
+
console.log(chalk.green(`✅ Commands installed in: ${results.editors.join(', ')}`))
|
|
63
|
+
console.log(chalk.gray(` Commands installed: ${results.totalInstalled}`))
|
|
64
|
+
console.log(chalk.cyan(`\n✨ prjct-cli ${currentVersion} is ready!\n`))
|
|
65
|
+
}
|
|
66
|
+
|
|
39
67
|
return
|
|
40
68
|
}
|
|
41
69
|
|
|
@@ -78,6 +106,34 @@ async function main() {
|
|
|
78
106
|
// Update version in config
|
|
79
107
|
await editorsConfig.updateVersion(currentVersion)
|
|
80
108
|
|
|
109
|
+
// Auto-migrate legacy projects (v0.1.0 → v0.4.4)
|
|
110
|
+
try {
|
|
111
|
+
console.log(chalk.cyan('\n🔍 Checking for legacy projects to migrate...\n'))
|
|
112
|
+
|
|
113
|
+
const migrator = require('../core/migrator')
|
|
114
|
+
|
|
115
|
+
// Quick scan of common directories (not entire home directory)
|
|
116
|
+
const summary = await migrator.migrateAll({
|
|
117
|
+
deepScan: false, // Only scan common dirs (fast)
|
|
118
|
+
removeLegacy: false, // Keep legacy dirs for safety
|
|
119
|
+
cleanupLegacy: true, // Remove old dirs but keep config
|
|
120
|
+
dryRun: false, // Actually perform migration
|
|
121
|
+
interactive: false // No user prompts during npm install
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
if (summary.successfullyMigrated > 0) {
|
|
125
|
+
console.log(chalk.green(`✅ Migrated ${summary.successfullyMigrated} legacy project(s) to new structure`))
|
|
126
|
+
console.log(chalk.gray(` Data location: ~/.prjct-cli/projects/`))
|
|
127
|
+
} else if (summary.totalFound > 0 && summary.alreadyMigrated === summary.totalFound) {
|
|
128
|
+
console.log(chalk.gray('ℹ️ All projects already using new structure'))
|
|
129
|
+
}
|
|
130
|
+
} catch (migrationError) {
|
|
131
|
+
// Don't block install if migration fails
|
|
132
|
+
if (process.env.DEBUG) {
|
|
133
|
+
console.error(chalk.yellow('[post-install] Migration warning:'), migrationError.message)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
81
137
|
console.log(chalk.cyan(`\n✨ prjct-cli ${currentVersion} is ready!\n`))
|
|
82
138
|
|
|
83
139
|
} catch (error) {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-Uninstall Script
|
|
5
|
+
*
|
|
6
|
+
* Runs automatically BEFORE `npm uninstall -g prjct-cli`.
|
|
7
|
+
* Cleans up slash commands from all tracked AI editors.
|
|
8
|
+
*
|
|
9
|
+
* Flow:
|
|
10
|
+
* 1. Check if running as global uninstall
|
|
11
|
+
* 2. Read tracked editors from ~/.prjct-cli/config/installed-editors.json
|
|
12
|
+
* 3. Remove all prjct commands from tracked editors
|
|
13
|
+
* 4. Delete tracking configuration
|
|
14
|
+
* 5. Clean exit (don't block uninstall)
|
|
15
|
+
*
|
|
16
|
+
* @version 0.4.4
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const chalk = require('chalk')
|
|
20
|
+
const { execSync } = require('child_process')
|
|
21
|
+
const path = require('path')
|
|
22
|
+
|
|
23
|
+
async function main() {
|
|
24
|
+
try {
|
|
25
|
+
// Check if this is a global uninstallation
|
|
26
|
+
const isGlobal = await checkIfGlobalInstall()
|
|
27
|
+
|
|
28
|
+
if (!isGlobal) {
|
|
29
|
+
// Skip cleanup for local/dev uninstalls
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Load editors config
|
|
34
|
+
const editorsConfig = require('../core/editors-config')
|
|
35
|
+
const configExists = await editorsConfig.configExists()
|
|
36
|
+
|
|
37
|
+
if (!configExists) {
|
|
38
|
+
// No config, nothing to clean up
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log(chalk.cyan('\n🧹 Cleaning up prjct commands from AI editors...\n'))
|
|
43
|
+
|
|
44
|
+
// Load command installer
|
|
45
|
+
const commandInstaller = require('../core/command-installer')
|
|
46
|
+
|
|
47
|
+
// Uninstall from all tracked editors
|
|
48
|
+
const results = await commandInstaller.uninstallFromAll()
|
|
49
|
+
|
|
50
|
+
if (results.success && results.editors.length > 0) {
|
|
51
|
+
console.log(chalk.green(`✅ Removed from: ${results.editors.join(', ')}`))
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Delete tracking config
|
|
55
|
+
await editorsConfig.deleteConfig()
|
|
56
|
+
|
|
57
|
+
console.log(chalk.green('\n✨ prjct-cli uninstalled cleanly\n'))
|
|
58
|
+
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// Silently fail - don't block npm uninstall
|
|
61
|
+
// Only log if explicitly debugging
|
|
62
|
+
if (process.env.DEBUG) {
|
|
63
|
+
console.error(chalk.red('[preuninstall] Error:'), error.message)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Check if package is being uninstalled globally
|
|
70
|
+
* @returns {Promise<boolean>} True if global uninstall
|
|
71
|
+
*/
|
|
72
|
+
async function checkIfGlobalInstall() {
|
|
73
|
+
try {
|
|
74
|
+
// Get npm global root directory
|
|
75
|
+
const globalRoot = execSync('npm root -g', { encoding: 'utf-8' }).trim()
|
|
76
|
+
|
|
77
|
+
// Get current package directory
|
|
78
|
+
const currentDir = path.resolve(__dirname, '..')
|
|
79
|
+
|
|
80
|
+
// Check if current directory is under global node_modules
|
|
81
|
+
return currentDir.startsWith(globalRoot)
|
|
82
|
+
} catch {
|
|
83
|
+
return false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Run main function
|
|
88
|
+
main().catch(error => {
|
|
89
|
+
// Silently fail - don't block npm uninstall
|
|
90
|
+
if (process.env.DEBUG) {
|
|
91
|
+
console.error('[preuninstall] Fatal error:', error)
|
|
92
|
+
}
|
|
93
|
+
process.exit(0) // Exit with success to not block npm uninstall
|
|
94
|
+
})
|