golem-cc 3.0.0 → 3.0.1
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/bin/golem-shim.mjs +13 -13
- package/package.json +1 -1
package/bin/golem-shim.mjs
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import {
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
7
|
|
|
6
8
|
// Walk up from cwd to find .golem/bin/golem.mjs
|
|
7
9
|
function findGolemProject(startDir) {
|
|
8
10
|
let currentDir = startDir;
|
|
9
11
|
while (true) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return { projectRoot: currentDir, golemPath };
|
|
12
|
+
if (existsSync(join(currentDir, '.golem', 'bin', 'golem.mjs'))) {
|
|
13
|
+
return currentDir;
|
|
13
14
|
}
|
|
14
15
|
if (currentDir === '/') return null;
|
|
15
16
|
currentDir = dirname(currentDir);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
+
const projectRoot = findGolemProject(process.cwd());
|
|
20
21
|
|
|
21
|
-
if (!
|
|
22
|
+
if (!projectRoot) {
|
|
22
23
|
console.error('No golem project found. Run `pnpm dlx golem-cc` to set one up.');
|
|
23
24
|
process.exit(1);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
const { projectRoot, golemPath } = result;
|
|
27
|
-
|
|
28
27
|
if (process.env.GOLEM_DEBUG === '1') {
|
|
29
28
|
console.log(`[golem-shim] Resolved project root: ${projectRoot}`);
|
|
30
29
|
}
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
// chdir to project root so the CLI resolves config/plans/specs correctly
|
|
32
|
+
process.chdir(projectRoot);
|
|
33
|
+
|
|
34
|
+
// Import the CLI from our own package so dependencies (commander, chalk, ora)
|
|
35
|
+
// resolve from the global install's node_modules, not the project's.
|
|
36
|
+
await import(pathToFileURL(join(__dirname, '..', '.golem', 'bin', 'golem.mjs')).href);
|