@jaguilar87/gaia-ops 2.5.5 → 2.5.8

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.
@@ -3,27 +3,62 @@
3
3
  /**
4
4
  * @jaguilar87/gaia-ops - Cleanup script
5
5
  *
6
- * Runs automatically on npm uninstall (preuninstall hook)
7
- *
8
6
  * Purpose:
9
7
  * - Remove CLAUDE.md
10
8
  * - Remove settings.json
11
9
  * - Remove all symlinks (agents, tools, hooks, commands, config, templates, speckit, CHANGELOG.md)
12
10
  * - Preserve project-specific data (logs, tests, project-context, session, metrics)
13
11
  *
14
- * Usage: Automatic (npm preuninstall hook)
12
+ * Usage:
13
+ * Manual: npx gaia-cleanup
14
+ * Automatic: Runs via preuninstall hook when uninstalling from npm registry
15
+ *
16
+ * IMPORTANT FOR LOCAL DEVELOPMENT:
17
+ * When testing with local installs (npm install ./gaia-ops), the preuninstall hook
18
+ * will NOT execute automatically due to npm's file: protocol behavior.
19
+ * You must run 'npx gaia-cleanup' manually before uninstalling:
20
+ *
21
+ * npx gaia-cleanup && npm uninstall @jaguilar87/gaia-ops
22
+ *
23
+ * When installed from npm registry, cleanup happens automatically on uninstall.
15
24
  */
16
25
 
17
- import { fileURLToPath } from 'url';
18
- import { dirname, join } from 'path';
26
+ import { join, dirname, resolve } from 'path';
19
27
  import fs from 'fs/promises';
20
28
  import { existsSync } from 'fs';
21
29
  import chalk from 'chalk';
22
30
  import ora from 'ora';
23
31
 
24
- const __filename = fileURLToPath(import.meta.url);
25
- const __dirname = dirname(__filename);
26
- const CWD = process.env.INIT_CWD || process.cwd();
32
+ /**
33
+ * Find the project root directory by looking for .claude/ directory
34
+ * Searches upward from the current working directory
35
+ */
36
+ function findProjectRoot() {
37
+ // First try INIT_CWD (available during npm install/uninstall)
38
+ if (process.env.INIT_CWD) {
39
+ const claudeDir = join(process.env.INIT_CWD, '.claude');
40
+ if (existsSync(claudeDir)) {
41
+ return process.env.INIT_CWD;
42
+ }
43
+ }
44
+
45
+ // Search upward from current directory
46
+ let currentDir = process.cwd();
47
+ const root = resolve('/');
48
+
49
+ while (currentDir !== root) {
50
+ const claudeDir = join(currentDir, '.claude');
51
+ if (existsSync(claudeDir)) {
52
+ return currentDir;
53
+ }
54
+ currentDir = dirname(currentDir);
55
+ }
56
+
57
+ // Fallback to current directory
58
+ return process.env.INIT_CWD || process.cwd();
59
+ }
60
+
61
+ const CWD = findProjectRoot();
27
62
 
28
63
  /**
29
64
  * Remove CLAUDE.md if it exists
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@jaguilar87/gaia-ops",
3
- "version": "2.5.5",
3
+ "version": "2.5.8",
4
4
  "description": "Multi-agent orchestration system for Claude Code - DevOps automation toolkit",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "gaia-init": "bin/gaia-init.js",
9
- "gaia-cleanup": "bin/cleanup-claude-install.js"
9
+ "gaia-cleanup": "bin/gaia-cleanup.js"
10
10
  },
11
11
  "keywords": [
12
12
  "claude-code",
@@ -61,9 +61,9 @@
61
61
  },
62
62
  "_postinstall_note": "⚠️ postinstall hook overwrites CLAUDE.md and settings.json from templates on every npm install/update",
63
63
  "dependencies": {
64
- "prompts": "^2.4.2",
65
64
  "chalk": "^5.3.0",
66
65
  "ora": "^7.0.1",
66
+ "prompts": "^2.4.2",
67
67
  "yargs": "^17.7.2"
68
68
  },
69
69
  "devDependencies": {