marketing-agent-team 1.0.2 → 1.0.3

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 (2) hide show
  1. package/install.js +43 -6
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -33,6 +33,39 @@ function log(message, color = 'reset') {
33
33
  console.log(`${colors[color]}${message}${colors.reset}`);
34
34
  }
35
35
 
36
+ // Find the actual project root (handles npm install context)
37
+ function getProjectRoot() {
38
+ let currentDir = PROJECT_ROOT;
39
+
40
+ // If we're in node_modules, traverse up to find the project root
41
+ while (currentDir !== path.parse(currentDir).root) {
42
+ // Check if we're in a node_modules directory
43
+ if (path.basename(currentDir) === 'node_modules') {
44
+ currentDir = path.dirname(currentDir);
45
+ continue;
46
+ }
47
+
48
+ // Check if this looks like a project root (has package.json)
49
+ const pkgJsonPath = path.join(currentDir, 'package.json');
50
+ if (fs.existsSync(pkgJsonPath)) {
51
+ // Make sure we're not inside another package's node_modules
52
+ const parentDir = path.dirname(currentDir);
53
+ const parentNodeModules = path.join(parentDir, 'node_modules');
54
+ if (!currentDir.startsWith(parentNodeModules)) {
55
+ return currentDir;
56
+ }
57
+ }
58
+
59
+ currentDir = path.dirname(currentDir);
60
+ }
61
+
62
+ // Fallback to current directory
63
+ return PROJECT_ROOT;
64
+ }
65
+
66
+ // Get project root once at startup
67
+ const PROJECT_ROOT = getProjectRoot();
68
+
36
69
  function banner() {
37
70
  console.log('');
38
71
  log('╔════════════════════════════════════════════════════════════════╗', 'cyan');
@@ -52,12 +85,12 @@ async function installBMAD() {
52
85
  log(' Cloning BMAD repository...', 'cyan');
53
86
  execSync('git clone --depth 1 https://github.com/bmad-code-org/BMAD-METHOD.git _bmad-temp', {
54
87
  stdio: 'inherit',
55
- cwd: process.cwd()
88
+ cwd: PROJECT_ROOT
56
89
  });
57
90
 
58
91
  // Move contents to _bmad
59
- const tempDir = path.join(process.cwd(), '_bmad-temp');
60
- const bmadDir = path.join(process.cwd(), '_bmad');
92
+ const tempDir = path.join(PROJECT_ROOT, '_bmad-temp');
93
+ const bmadDir = path.join(PROJECT_ROOT, '_bmad');
61
94
 
62
95
  // Create _bmad directory
63
96
  if (!fs.existsSync(bmadDir)) {
@@ -99,7 +132,7 @@ async function installBMAD() {
99
132
  async function checkBMAD() {
100
133
  log('📋 Checking BMAD installation...', 'yellow');
101
134
 
102
- const bmadPath = path.join(process.cwd(), '_bmad');
135
+ const bmadPath = path.join(PROJECT_ROOT, '_bmad');
103
136
  if (!fs.existsSync(bmadPath)) {
104
137
  log('⚠️ BMAD structure not found in current directory!', 'yellow');
105
138
  log(' This module requires BMAD to be installed.', 'yellow');
@@ -125,7 +158,7 @@ async function copyModule() {
125
158
  log('📦 Copying module files to _bmad/marketing-agent-team/...', 'yellow');
126
159
 
127
160
  const sourceDir = __dirname;
128
- const targetDir = path.join(process.cwd(), '_bmad', 'marketing-agent-team');
161
+ const targetDir = path.join(PROJECT_ROOT, '_bmad', 'marketing-agent-team');
129
162
 
130
163
  // Create target directory
131
164
  if (!fs.existsSync(targetDir)) {
@@ -200,7 +233,7 @@ async function runCustomInstaller() {
200
233
 
201
234
  // Simulate installation options
202
235
  const options = {
203
- projectRoot: process.cwd(),
236
+ projectRoot: PROJECT_ROOT,
204
237
  config: {}, // Will be populated by interactive prompts
205
238
  installedIDEs: [],
206
239
  logger: {
@@ -257,6 +290,10 @@ async function main() {
257
290
  log('Welcome to Marketing Agent Team!', 'green');
258
291
  console.log('');
259
292
 
293
+ // Debug: Show where we're installing
294
+ log(`📂 Installing to: ${PROJECT_ROOT}`, 'cyan');
295
+ console.log('');
296
+
260
297
  // Check BMAD (will auto-install if missing)
261
298
  const hasBMAD = await checkBMAD();
262
299
  if (!hasBMAD) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marketing-agent-team",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Your Complete AI-Powered Marketing Team - 7 specialized agents for brand strategy, content creation, and performance analytics",
5
5
  "main": "index.js",
6
6
  "bin": {