@openbuilder/cli 0.31.11
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/README.md +1053 -0
- package/bin/openbuilder.js +31 -0
- package/dist/chunks/Banner-D4tqKfzA.js +113 -0
- package/dist/chunks/Banner-D4tqKfzA.js.map +1 -0
- package/dist/chunks/auto-update-Dj3lWPWO.js +350 -0
- package/dist/chunks/auto-update-Dj3lWPWO.js.map +1 -0
- package/dist/chunks/build-D0qYqIq0.js +116 -0
- package/dist/chunks/build-D0qYqIq0.js.map +1 -0
- package/dist/chunks/cleanup-qVTsA3tk.js +141 -0
- package/dist/chunks/cleanup-qVTsA3tk.js.map +1 -0
- package/dist/chunks/cli-error-BjQwvWtK.js +140 -0
- package/dist/chunks/cli-error-BjQwvWtK.js.map +1 -0
- package/dist/chunks/config-BGP1jZJ4.js +167 -0
- package/dist/chunks/config-BGP1jZJ4.js.map +1 -0
- package/dist/chunks/config-manager-BkbjtN-H.js +133 -0
- package/dist/chunks/config-manager-BkbjtN-H.js.map +1 -0
- package/dist/chunks/database-BvAbD4sP.js +68 -0
- package/dist/chunks/database-BvAbD4sP.js.map +1 -0
- package/dist/chunks/database-setup-BYjIRAmT.js +253 -0
- package/dist/chunks/database-setup-BYjIRAmT.js.map +1 -0
- package/dist/chunks/exports-ij9sv4UM.js +7793 -0
- package/dist/chunks/exports-ij9sv4UM.js.map +1 -0
- package/dist/chunks/init-CZoN6soU.js +468 -0
- package/dist/chunks/init-CZoN6soU.js.map +1 -0
- package/dist/chunks/init-tui-BNzk_7Yx.js +1127 -0
- package/dist/chunks/init-tui-BNzk_7Yx.js.map +1 -0
- package/dist/chunks/logger-ZpJi7chw.js +38 -0
- package/dist/chunks/logger-ZpJi7chw.js.map +1 -0
- package/dist/chunks/main-tui-Cq1hLCx-.js +644 -0
- package/dist/chunks/main-tui-Cq1hLCx-.js.map +1 -0
- package/dist/chunks/manager-CvGX9qqe.js +1161 -0
- package/dist/chunks/manager-CvGX9qqe.js.map +1 -0
- package/dist/chunks/port-allocator-BRFzgH9b.js +749 -0
- package/dist/chunks/port-allocator-BRFzgH9b.js.map +1 -0
- package/dist/chunks/process-killer-CaUL7Kpl.js +87 -0
- package/dist/chunks/process-killer-CaUL7Kpl.js.map +1 -0
- package/dist/chunks/prompts-1QbE_bRr.js +128 -0
- package/dist/chunks/prompts-1QbE_bRr.js.map +1 -0
- package/dist/chunks/repo-cloner-CpOQjFSo.js +219 -0
- package/dist/chunks/repo-cloner-CpOQjFSo.js.map +1 -0
- package/dist/chunks/repo-detector-B_oj696o.js +66 -0
- package/dist/chunks/repo-detector-B_oj696o.js.map +1 -0
- package/dist/chunks/run-D23hg4xy.js +630 -0
- package/dist/chunks/run-D23hg4xy.js.map +1 -0
- package/dist/chunks/runner-logger-instance-nDWv2h2T.js +899 -0
- package/dist/chunks/runner-logger-instance-nDWv2h2T.js.map +1 -0
- package/dist/chunks/spinner-BJL9zWAJ.js +53 -0
- package/dist/chunks/spinner-BJL9zWAJ.js.map +1 -0
- package/dist/chunks/start-BygPCbvw.js +1708 -0
- package/dist/chunks/start-BygPCbvw.js.map +1 -0
- package/dist/chunks/start-traditional-uoLZXdxm.js +255 -0
- package/dist/chunks/start-traditional-uoLZXdxm.js.map +1 -0
- package/dist/chunks/status-cS8YwtUx.js +97 -0
- package/dist/chunks/status-cS8YwtUx.js.map +1 -0
- package/dist/chunks/theme-DhorI2Hb.js +44 -0
- package/dist/chunks/theme-DhorI2Hb.js.map +1 -0
- package/dist/chunks/upgrade-CT6w0lKp.js +323 -0
- package/dist/chunks/upgrade-CT6w0lKp.js.map +1 -0
- package/dist/chunks/useBuildState-CdBSu9y_.js +331 -0
- package/dist/chunks/useBuildState-CdBSu9y_.js.map +1 -0
- package/dist/cli/index.js +694 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.js +14358 -0
- package/dist/index.js.map +1 -0
- package/dist/instrument.js +64226 -0
- package/dist/instrument.js.map +1 -0
- package/dist/templates.json +295 -0
- package/package.json +98 -0
- package/scripts/install-vendor-deps.js +34 -0
- package/scripts/install-vendor.js +167 -0
- package/scripts/prepare-release.js +71 -0
- package/templates/config.template.json +18 -0
- package/templates.json +295 -0
- package/vendor/ai-sdk-provider-claude-code-LOCAL.tgz +0 -0
- package/vendor/sentry-core-LOCAL.tgz +0 -0
- package/vendor/sentry-nextjs-LOCAL.tgz +0 -0
- package/vendor/sentry-node-LOCAL.tgz +0 -0
- package/vendor/sentry-node-core-LOCAL.tgz +0 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
// OpenBuilder CLI - Built with Rollup
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import { mkdir } from 'node:fs/promises';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { l as logger } from './logger-ZpJi7chw.js';
|
|
7
|
+
import { s as spinner } from './spinner-BJL9zWAJ.js';
|
|
8
|
+
import 'chalk';
|
|
9
|
+
import 'ora';
|
|
10
|
+
|
|
11
|
+
const DEFAULT_REPO_URL = 'https://github.com/codyde/openbuilder.git';
|
|
12
|
+
const DEFAULT_CLONE_PATH = join(process.cwd(), 'openbuilder'); // Current directory + /openbuilder
|
|
13
|
+
/**
|
|
14
|
+
* Clone the OpenBuilder repository
|
|
15
|
+
*/
|
|
16
|
+
async function cloneRepository(options = {}) {
|
|
17
|
+
const repoUrl = options.repoUrl || DEFAULT_REPO_URL;
|
|
18
|
+
const targetPath = options.targetPath || DEFAULT_CLONE_PATH;
|
|
19
|
+
const branch = options.branch || 'main';
|
|
20
|
+
const silent = options.silent || false;
|
|
21
|
+
if (!silent) {
|
|
22
|
+
logger.info(`Repository: ${repoUrl}`);
|
|
23
|
+
logger.info(`Target: ${targetPath}`);
|
|
24
|
+
logger.info(`Branch: ${branch}`);
|
|
25
|
+
logger.log('');
|
|
26
|
+
}
|
|
27
|
+
// Check if target already exists (should be handled by caller)
|
|
28
|
+
if (existsSync(targetPath) && !silent) {
|
|
29
|
+
logger.warn(`Directory already exists: ${targetPath}`);
|
|
30
|
+
logger.warn('This should have been handled by init command');
|
|
31
|
+
// Continue anyway - caller should have cleaned it up
|
|
32
|
+
}
|
|
33
|
+
// Create parent directory if needed
|
|
34
|
+
const parentPath = join(targetPath, '..');
|
|
35
|
+
if (!existsSync(parentPath)) {
|
|
36
|
+
await mkdir(parentPath, { recursive: true });
|
|
37
|
+
}
|
|
38
|
+
if (!silent) {
|
|
39
|
+
spinner.start('Cloning repository...');
|
|
40
|
+
}
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const proc = spawn('git', [
|
|
43
|
+
'clone',
|
|
44
|
+
'--branch', branch,
|
|
45
|
+
'--single-branch',
|
|
46
|
+
'--depth', '1',
|
|
47
|
+
'--progress',
|
|
48
|
+
repoUrl,
|
|
49
|
+
targetPath,
|
|
50
|
+
], {
|
|
51
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
52
|
+
});
|
|
53
|
+
let stderrOutput = '';
|
|
54
|
+
proc.stderr?.on('data', (data) => {
|
|
55
|
+
stderrOutput += data.toString();
|
|
56
|
+
});
|
|
57
|
+
proc.on('close', (code) => {
|
|
58
|
+
if (code === 0) {
|
|
59
|
+
if (!silent) {
|
|
60
|
+
spinner.succeed('Repository cloned successfully');
|
|
61
|
+
}
|
|
62
|
+
resolve(targetPath);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
if (!silent) {
|
|
66
|
+
spinner.fail('Failed to clone repository');
|
|
67
|
+
// Show the actual git error message
|
|
68
|
+
if (stderrOutput) {
|
|
69
|
+
logger.error('Git error:');
|
|
70
|
+
logger.log(stderrOutput.trim());
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
reject(new Error(`git clone failed with code ${code}: ${stderrOutput.trim()}`));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
proc.on('error', (error) => {
|
|
77
|
+
if (!silent) {
|
|
78
|
+
spinner.fail('Failed to clone repository');
|
|
79
|
+
logger.error(error.message);
|
|
80
|
+
}
|
|
81
|
+
reject(error);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Install dependencies in the cloned repository
|
|
87
|
+
*/
|
|
88
|
+
async function installDependencies(repoPath, silent = false) {
|
|
89
|
+
const { spawn } = await import('child_process');
|
|
90
|
+
if (!silent) {
|
|
91
|
+
spinner.start('Installing dependencies (this may take a few minutes)...');
|
|
92
|
+
}
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const proc = spawn('pnpm', ['install'], {
|
|
95
|
+
cwd: repoPath,
|
|
96
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
97
|
+
shell: true,
|
|
98
|
+
});
|
|
99
|
+
let hasError = false;
|
|
100
|
+
let stderrBuffer = '';
|
|
101
|
+
let stdoutBuffer = '';
|
|
102
|
+
proc.stdout?.on('data', (data) => {
|
|
103
|
+
stdoutBuffer += data.toString();
|
|
104
|
+
});
|
|
105
|
+
proc.stderr?.on('data', (data) => {
|
|
106
|
+
const text = data.toString();
|
|
107
|
+
stderrBuffer += text;
|
|
108
|
+
// Show critical errors immediately (only if not silent)
|
|
109
|
+
if (!silent && (text.includes('ERR!') || text.includes('ERROR') || text.includes('ELIFECYCLE'))) {
|
|
110
|
+
hasError = true;
|
|
111
|
+
spinner.stop();
|
|
112
|
+
logger.error(text.trim());
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
proc.on('exit', (code) => {
|
|
116
|
+
if (code === 0 && !hasError) {
|
|
117
|
+
if (!silent) {
|
|
118
|
+
spinner.succeed('Dependencies installed');
|
|
119
|
+
}
|
|
120
|
+
resolve();
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
if (!silent) {
|
|
124
|
+
spinner.fail('Failed to install dependencies');
|
|
125
|
+
// Show full output on failure
|
|
126
|
+
logger.log('');
|
|
127
|
+
logger.error('Installation failed. Full output:');
|
|
128
|
+
logger.log('');
|
|
129
|
+
if (stderrBuffer) {
|
|
130
|
+
logger.error('STDERR:');
|
|
131
|
+
logger.log(stderrBuffer);
|
|
132
|
+
}
|
|
133
|
+
if (stdoutBuffer) {
|
|
134
|
+
logger.log('STDOUT:');
|
|
135
|
+
logger.log(stdoutBuffer);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
reject(new Error(`pnpm install exited with code ${code}`));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
proc.on('error', (error) => {
|
|
142
|
+
if (!silent) {
|
|
143
|
+
spinner.fail('Failed to install dependencies');
|
|
144
|
+
logger.error(`Process error: ${error.message}`);
|
|
145
|
+
}
|
|
146
|
+
reject(error);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Build agent-core package (required before running apps)
|
|
152
|
+
*/
|
|
153
|
+
async function buildAgentCore(repoPath, silent = false) {
|
|
154
|
+
const { spawn } = await import('child_process');
|
|
155
|
+
if (!silent) {
|
|
156
|
+
spinner.start('Building agent-core package...');
|
|
157
|
+
}
|
|
158
|
+
return new Promise((resolve, reject) => {
|
|
159
|
+
const proc = spawn('pnpm', ['--filter', '@openbuilder/agent-core', 'build'], {
|
|
160
|
+
cwd: repoPath,
|
|
161
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
162
|
+
shell: true,
|
|
163
|
+
});
|
|
164
|
+
let hasError = false;
|
|
165
|
+
let errorOutput = '';
|
|
166
|
+
proc.stderr?.on('data', (data) => {
|
|
167
|
+
const text = data.toString();
|
|
168
|
+
// Capture errors but don't spam the console
|
|
169
|
+
if (text.includes('ERR!') || text.includes('ERROR')) {
|
|
170
|
+
hasError = true;
|
|
171
|
+
errorOutput += text;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
proc.on('exit', (code) => {
|
|
175
|
+
if (code === 0 && !hasError) {
|
|
176
|
+
if (!silent) {
|
|
177
|
+
spinner.succeed('agent-core package built');
|
|
178
|
+
}
|
|
179
|
+
resolve();
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
if (!silent) {
|
|
183
|
+
spinner.fail('Failed to build agent-core package');
|
|
184
|
+
if (errorOutput) {
|
|
185
|
+
logger.error(errorOutput.trim());
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
reject(new Error(`agent-core build exited with code ${code}`));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
proc.on('error', (error) => {
|
|
192
|
+
if (!silent) {
|
|
193
|
+
spinner.fail('Failed to build agent-core package');
|
|
194
|
+
}
|
|
195
|
+
reject(error);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Check if pnpm is installed
|
|
201
|
+
*/
|
|
202
|
+
async function isPnpmInstalled() {
|
|
203
|
+
const { spawn } = await import('child_process');
|
|
204
|
+
return new Promise((resolve) => {
|
|
205
|
+
const proc = spawn('pnpm', ['--version'], {
|
|
206
|
+
stdio: 'ignore',
|
|
207
|
+
shell: true,
|
|
208
|
+
});
|
|
209
|
+
proc.on('exit', (code) => {
|
|
210
|
+
resolve(code === 0);
|
|
211
|
+
});
|
|
212
|
+
proc.on('error', () => {
|
|
213
|
+
resolve(false);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { buildAgentCore, cloneRepository, installDependencies, isPnpmInstalled };
|
|
219
|
+
//# sourceMappingURL=repo-cloner-CpOQjFSo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-cloner-CpOQjFSo.js","sources":["../../src/cli/utils/repo-cloner.ts"],"sourcesContent":["import { spawn } from 'node:child_process';\nimport { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { logger } from './logger.js';\nimport { spinner } from './spinner.js';\n\nconst DEFAULT_REPO_URL = 'https://github.com/codyde/openbuilder.git';\nconst DEFAULT_CLONE_PATH = join(process.cwd(), 'openbuilder'); // Current directory + /openbuilder\n\nexport interface CloneOptions {\n repoUrl?: string;\n targetPath?: string;\n branch?: string;\n silent?: boolean; // Suppress all console output (for TUI mode)\n}\n\n/**\n * Clone the OpenBuilder repository\n */\nexport async function cloneRepository(options: CloneOptions = {}): Promise<string> {\n const repoUrl = options.repoUrl || DEFAULT_REPO_URL;\n const targetPath = options.targetPath || DEFAULT_CLONE_PATH;\n const branch = options.branch || 'main';\n const silent = options.silent || false;\n\n if (!silent) {\n logger.info(`Repository: ${repoUrl}`);\n logger.info(`Target: ${targetPath}`);\n logger.info(`Branch: ${branch}`);\n logger.log('');\n }\n\n // Check if target already exists (should be handled by caller)\n if (existsSync(targetPath) && !silent) {\n logger.warn(`Directory already exists: ${targetPath}`);\n logger.warn('This should have been handled by init command');\n // Continue anyway - caller should have cleaned it up\n }\n\n // Create parent directory if needed\n const parentPath = join(targetPath, '..');\n if (!existsSync(parentPath)) {\n await mkdir(parentPath, { recursive: true });\n }\n\n if (!silent) {\n spinner.start('Cloning repository...');\n }\n\n return new Promise((resolve, reject) => {\n const proc = spawn('git', [\n 'clone',\n '--branch', branch,\n '--single-branch', \n '--depth', '1',\n '--progress',\n repoUrl,\n targetPath,\n ], {\n stdio: ['ignore', 'pipe', 'pipe'],\n });\n\n let stderrOutput = '';\n\n proc.stderr?.on('data', (data) => {\n stderrOutput += data.toString();\n });\n\n proc.on('close', (code) => {\n if (code === 0) {\n if (!silent) {\n spinner.succeed('Repository cloned successfully');\n }\n resolve(targetPath);\n } else {\n if (!silent) {\n spinner.fail('Failed to clone repository');\n // Show the actual git error message\n if (stderrOutput) {\n logger.error('Git error:');\n logger.log(stderrOutput.trim());\n }\n }\n reject(new Error(`git clone failed with code ${code}: ${stderrOutput.trim()}`));\n }\n });\n\n proc.on('error', (error) => {\n if (!silent) {\n spinner.fail('Failed to clone repository');\n logger.error(error.message);\n }\n reject(error);\n });\n });\n}\n\n/**\n * Install dependencies in the cloned repository\n */\nexport async function installDependencies(repoPath: string, silent: boolean = false): Promise<void> {\n const { spawn } = await import('child_process');\n\n if (!silent) {\n spinner.start('Installing dependencies (this may take a few minutes)...');\n }\n\n return new Promise((resolve, reject) => {\n const proc = spawn('pnpm', ['install'], {\n cwd: repoPath,\n stdio: ['ignore', 'pipe', 'pipe'],\n shell: true,\n });\n\n let hasError = false;\n let stderrBuffer = '';\n let stdoutBuffer = '';\n\n proc.stdout?.on('data', (data) => {\n stdoutBuffer += data.toString();\n });\n\n proc.stderr?.on('data', (data) => {\n const text = data.toString();\n stderrBuffer += text;\n\n // Show critical errors immediately (only if not silent)\n if (!silent && (text.includes('ERR!') || text.includes('ERROR') || text.includes('ELIFECYCLE'))) {\n hasError = true;\n spinner.stop();\n logger.error(text.trim());\n }\n });\n\n proc.on('exit', (code) => {\n if (code === 0 && !hasError) {\n if (!silent) {\n spinner.succeed('Dependencies installed');\n }\n resolve();\n } else {\n if (!silent) {\n spinner.fail('Failed to install dependencies');\n\n // Show full output on failure\n logger.log('');\n logger.error('Installation failed. Full output:');\n logger.log('');\n\n if (stderrBuffer) {\n logger.error('STDERR:');\n logger.log(stderrBuffer);\n }\n\n if (stdoutBuffer) {\n logger.log('STDOUT:');\n logger.log(stdoutBuffer);\n }\n }\n\n reject(new Error(`pnpm install exited with code ${code}`));\n }\n });\n\n proc.on('error', (error) => {\n if (!silent) {\n spinner.fail('Failed to install dependencies');\n logger.error(`Process error: ${error.message}`);\n }\n reject(error);\n });\n });\n}\n\n/**\n * Build agent-core package (required before running apps)\n */\nexport async function buildAgentCore(repoPath: string, silent: boolean = false): Promise<void> {\n const { spawn } = await import('child_process');\n\n if (!silent) {\n spinner.start('Building agent-core package...');\n }\n\n return new Promise((resolve, reject) => {\n const proc = spawn('pnpm', ['--filter', '@openbuilder/agent-core', 'build'], {\n cwd: repoPath,\n stdio: ['ignore', 'pipe', 'pipe'],\n shell: true,\n });\n\n let hasError = false;\n let errorOutput = '';\n\n proc.stderr?.on('data', (data) => {\n const text = data.toString();\n // Capture errors but don't spam the console\n if (text.includes('ERR!') || text.includes('ERROR')) {\n hasError = true;\n errorOutput += text;\n }\n });\n\n proc.on('exit', (code) => {\n if (code === 0 && !hasError) {\n if (!silent) {\n spinner.succeed('agent-core package built');\n }\n resolve();\n } else {\n if (!silent) {\n spinner.fail('Failed to build agent-core package');\n if (errorOutput) {\n logger.error(errorOutput.trim());\n }\n }\n reject(new Error(`agent-core build exited with code ${code}`));\n }\n });\n\n proc.on('error', (error) => {\n if (!silent) {\n spinner.fail('Failed to build agent-core package');\n }\n reject(error);\n });\n });\n}\n\n/**\n * Check if pnpm is installed\n */\nexport async function isPnpmInstalled(): Promise<boolean> {\n const { spawn } = await import('child_process');\n\n return new Promise((resolve) => {\n const proc = spawn('pnpm', ['--version'], {\n stdio: 'ignore',\n shell: true,\n });\n\n proc.on('exit', (code) => {\n resolve(code === 0);\n });\n\n proc.on('error', () => {\n resolve(false);\n });\n });\n}\n"],"names":[],"mappings":";;;;;;;;;;AAOA,MAAM,gBAAgB,GAAG,2CAA2C;AACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,aAAa,CAAC,CAAC;AAS9D;;AAEG;AACI,eAAe,eAAe,CAAC,UAAwB,EAAE,EAAA;AAC9D,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB;AACnD,IAAA,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,kBAAkB;AAC3D,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM;AACvC,IAAA,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK;IAEtC,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,CAAC,IAAI,CAAC,eAAe,OAAO,CAAA,CAAE,CAAC;AACrC,QAAA,MAAM,CAAC,IAAI,CAAC,WAAW,UAAU,CAAA,CAAE,CAAC;AACpC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AO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE;AACxC,YAAA,KAAK,EAAE,QAAQ;AACf,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA,CAAC;QAEF,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,KAAI;AACvB,YAAA,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;AACrB,QAAA,CAAC,CAAC;AAEF,QAAA,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAK;YACpB,OAAO,CAAC,KAAK,CAAC;AAChB,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// OpenBuilder CLI - Built with Rollup
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if current directory or a given path contains the OpenBuilder monorepo
|
|
8
|
+
*/
|
|
9
|
+
async function isOpenBuilderRepo(path = process.cwd()) {
|
|
10
|
+
try {
|
|
11
|
+
// Check for key indicators
|
|
12
|
+
const packageJsonPath = join(path, 'package.json');
|
|
13
|
+
const runnerPath = join(path, 'apps/runner');
|
|
14
|
+
const openbuilderPath = join(path, 'apps/openbuilder');
|
|
15
|
+
// Must have package.json
|
|
16
|
+
if (!existsSync(packageJsonPath)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
// Must have the core app directories
|
|
20
|
+
if (!existsSync(runnerPath) || !existsSync(openbuilderPath)) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
// Verify package.json has correct name
|
|
24
|
+
const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
|
|
25
|
+
if (packageJson.name !== 'openbuilder-monorepo') {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Find the OpenBuilder monorepo root from current location
|
|
36
|
+
* Searches up the directory tree
|
|
37
|
+
*/
|
|
38
|
+
async function findMonorepoRoot(startPath = process.cwd()) {
|
|
39
|
+
let currentPath = startPath;
|
|
40
|
+
const root = '/';
|
|
41
|
+
while (currentPath !== root) {
|
|
42
|
+
if (await isOpenBuilderRepo(currentPath)) {
|
|
43
|
+
return currentPath;
|
|
44
|
+
}
|
|
45
|
+
// Move up one directory
|
|
46
|
+
const parentPath = join(currentPath, '..');
|
|
47
|
+
if (parentPath === currentPath) {
|
|
48
|
+
break; // Reached root
|
|
49
|
+
}
|
|
50
|
+
currentPath = parentPath;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Check if we're inside the monorepo (current dir or any parent)
|
|
56
|
+
*/
|
|
57
|
+
async function isInsideMonorepo() {
|
|
58
|
+
const root = await findMonorepoRoot();
|
|
59
|
+
return {
|
|
60
|
+
inside: root !== null,
|
|
61
|
+
root: root || undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { isInsideMonorepo as i };
|
|
66
|
+
//# sourceMappingURL=repo-detector-B_oj696o.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo-detector-B_oj696o.js","sources":["../../src/cli/utils/repo-detector.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Check if current directory or a given path contains the OpenBuilder monorepo\n */\nexport async function isOpenBuilderRepo(path: string = process.cwd()): Promise<boolean> {\n try {\n // Check for key indicators\n const packageJsonPath = join(path, 'package.json');\n const runnerPath = join(path, 'apps/runner');\n const openbuilderPath = join(path, 'apps/openbuilder');\n\n // Must have package.json\n if (!existsSync(packageJsonPath)) {\n return false;\n }\n\n // Must have the core app directories\n if (!existsSync(runnerPath) || !existsSync(openbuilderPath)) {\n return false;\n }\n\n // Verify package.json has correct name\n const packageJson = JSON.parse(await readFile(packageJsonPath, 'utf-8'));\n if (packageJson.name !== 'openbuilder-monorepo') {\n return false;\n }\n\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Find the OpenBuilder monorepo root from current location\n * Searches up the directory tree\n */\nexport async function findMonorepoRoot(startPath: string = process.cwd()): Promise<string | null> {\n let currentPath = startPath;\n const root = '/';\n\n while (currentPath !== root) {\n if (await isOpenBuilderRepo(currentPath)) {\n return currentPath;\n }\n\n // Move up one directory\n const parentPath = join(currentPath, '..');\n if (parentPath === currentPath) {\n break; // Reached root\n }\n currentPath = parentPath;\n }\n\n return null;\n}\n\n/**\n * Check if we're inside the monorepo (current dir or any parent)\n */\nexport async function isInsideMonorepo(): Promise<{ inside: boolean; root?: string }> {\n const root = await findMonorepoRoot();\n return {\n inside: root !== null,\n root: root || undefined,\n };\n}\n"],"names":[],"mappings":";;;;;AAIA;;AAEG;AACI,eAAe,iBAAiB,CAAC,IAAA,GAAe,OAAO,CAAC,GAAG,EAAE,EAAA;AAClE,IAAA,IAAI;;QAEF,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;QAClD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QAC5C,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC;;AAGtD,QAAA,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAChC,YAAA,OAAO,KAAK;QACd;;AAGA,QAAA,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;AAC3D,YAAA,OAAO,KAAK;QACd;;AAGA,QAAA,MAAM,WAAW,GAAG,IAAI,CAAC,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