golem-cc 3.0.0 → 3.0.2

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.
@@ -194,10 +194,16 @@ function gitOpts() {
194
194
  }
195
195
 
196
196
  export function gitSnapshot() {
197
- return execSync('git rev-parse HEAD', gitOpts()).toString().trim();
197
+ try {
198
+ return execSync('git rev-parse HEAD', gitOpts()).toString().trim();
199
+ } catch {
200
+ // No commits yet (empty repo) — nothing to snapshot
201
+ return null;
202
+ }
198
203
  }
199
204
 
200
205
  export function gitRestore(sha) {
206
+ if (!sha) return;
201
207
  execSync('git checkout .', gitOpts());
202
208
  execSync('git clean -fd', gitOpts());
203
209
  execSync(`git reset --hard ${sha}`, gitOpts());
package/README.md CHANGED
@@ -6,12 +6,31 @@ Golem provides structured workflows for speccing, planning, building, reviewing,
6
6
 
7
7
  ## Installation
8
8
 
9
+ ### Global install (recommended)
10
+
11
+ Install once per machine to get the `golem` command everywhere:
12
+
13
+ ```bash
14
+ pnpm install -g golem-cc
15
+ ```
16
+
17
+ Then in any golem project you can run `golem build`, `golem status`, etc. directly.
18
+
19
+ To update:
20
+
21
+ ```bash
22
+ pnpm install -g golem-cc@latest
23
+ ```
24
+
25
+ ### Project setup
26
+
27
+ Run once per project to scaffold `.golem/` and slash commands:
28
+
9
29
  ```bash
10
- # Install into an existing project
11
30
  pnpm dlx golem-cc
12
31
 
13
32
  # Or with npx
14
- npx golem-cc
33
+ golem-cc
15
34
  ```
16
35
 
17
36
  This copies `.golem/` and `.claude/commands/golem/` into your project, detects your framework (Nuxt/Next), and generates `AGENTS.md` with your test/build/lint commands.
@@ -19,7 +38,7 @@ This copies `.golem/` and `.claude/commands/golem/` into your project, detects y
19
38
  After installing, configure for your project:
20
39
 
21
40
  ```bash
22
- npx golem init
41
+ golem init
23
42
  ```
24
43
 
25
44
  ## Prerequisites
@@ -41,7 +60,7 @@ The typical golem workflow:
41
60
  ```
42
61
  1. /golem:spec → Build specs through guided conversation
43
62
  2. /golem:plan → Generate staged implementation plan
44
- 3. npx golem build → Autonomous build loop with TUI
63
+ 3. golem build → Autonomous build loop with TUI
45
64
  4. /golem:review → Parallel code review (6 agents)
46
65
  5. /golem:security → Security scan before shipping
47
66
  ```
@@ -68,16 +87,16 @@ Reads all specs, analyzes the codebase, and generates `.golem/IMPLEMENTATION_PLA
68
87
 
69
88
  ```bash
70
89
  # Full autonomous build loop with TUI
71
- npx golem build
90
+ golem build
72
91
 
73
92
  # Limit to N iterations
74
- npx golem build --iterations 3
93
+ golem build --iterations 3
75
94
 
76
95
  # Preview next task without executing
77
- npx golem build --dry-run
96
+ golem build --dry-run
78
97
 
79
98
  # Skip simplification pass
80
- npx golem build --no-simplify
99
+ golem build --no-simplify
81
100
  ```
82
101
 
83
102
  The build loop reads the implementation plan, finds the next incomplete task, spawns Claude with a focused prompt, streams output through a full-screen TUI with progress bar and usage sparklines, then commits on success.
@@ -94,21 +113,21 @@ Spawns 6 parallel review agents (security, logic, style, tests, architecture, de
94
113
 
95
114
  ```bash
96
115
  # Default scan (gitleaks + semgrep + pnpm audit + env checks)
97
- npx golem security
116
+ golem security
98
117
 
99
118
  # Full scan (adds git history, trivy, outdated deps, file perms, headers)
100
- npx golem security --full
119
+ golem security --full
101
120
 
102
121
  # Auto-install missing security tools
103
- npx golem security --fix
122
+ golem security --fix
104
123
 
105
124
  # Install pre-commit hook for gitleaks
106
- npx golem security --pre-commit
125
+ golem security --pre-commit
107
126
  ```
108
127
 
109
128
  ## Commands
110
129
 
111
- ### Terminal (npx golem)
130
+ ### Terminal
112
131
 
113
132
  | Command | Description |
114
133
  |---------|-------------|
@@ -156,8 +175,8 @@ Configuration lives in `.golem/config.json`:
156
175
  | `simplifyOnBuild` | `true` | Run simplifier after building |
157
176
 
158
177
  ```bash
159
- npx golem config set model sonnet
160
- npx golem config set autoCommit false
178
+ golem config set model sonnet
179
+ golem config set autoCommit false
161
180
  ```
162
181
 
163
182
  ## Project Structure
@@ -192,17 +211,17 @@ npx golem config set autoCommit false
192
211
  Run the doctor to check your setup:
193
212
 
194
213
  ```bash
195
- npx golem doctor
214
+ golem doctor
196
215
 
197
216
  # Auto-fix common issues
198
- npx golem doctor --fix
217
+ golem doctor --fix
199
218
  ```
200
219
 
201
220
  Common issues:
202
221
  - **Claude CLI not found** — Install from https://docs.anthropic.com/en/docs/claude-code
203
222
  - **No implementation plan** — Run `/golem:plan` in Claude Code first
204
223
  - **Empty specs directory** — Run `/golem:spec` in Claude Code first
205
- - **Security tools missing** — Run `npx golem security --fix` to auto-install
224
+ - **Security tools missing** — Run `golem security --fix` to auto-install
206
225
 
207
226
  ## License
208
227
 
@@ -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 { execFileSync } from 'node:child_process';
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
- const golemPath = join(currentDir, '.golem', 'bin', 'golem.mjs');
11
- if (existsSync(golemPath)) {
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 result = findGolemProject(process.cwd());
20
+ const projectRoot = findGolemProject(process.cwd());
20
21
 
21
- if (!result) {
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
- try {
33
- execFileSync('node', [golemPath, ...process.argv.slice(2)], { stdio: 'inherit' });
34
- } catch (error) {
35
- process.exit(error.status ?? 1);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "golem-cc",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Project-scoped autonomous coding agent framework for Claude Code CLI",
5
5
  "type": "module",
6
6
  "bin": {