golem-cc 2.1.2 → 3.0.0
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/.claude/commands/golem/build.md +18 -0
- package/.claude/commands/golem/config.md +39 -0
- package/.claude/commands/golem/continue.md +73 -0
- package/.claude/commands/golem/doctor.md +46 -0
- package/.claude/commands/golem/document.md +138 -0
- package/.claude/commands/golem/help.md +58 -0
- package/.claude/commands/golem/pause.md +130 -0
- package/.claude/commands/golem/plan.md +111 -0
- package/.claude/commands/golem/review.md +166 -0
- package/.claude/commands/golem/security.md +186 -0
- package/.claude/commands/golem/simplify.md +76 -0
- package/.claude/commands/golem/spec.md +105 -0
- package/.claude/commands/golem/status.md +33 -0
- package/.golem/agents/code-simplifier.md +54 -0
- package/.golem/agents/review-architecture.md +59 -0
- package/.golem/agents/review-logic.md +50 -0
- package/.golem/agents/review-security.md +50 -0
- package/.golem/agents/review-style.md +48 -0
- package/.golem/agents/review-tests.md +48 -0
- package/.golem/agents/spec-builder.md +60 -0
- package/.golem/bin/golem.mjs +270 -0
- package/.golem/lib/build.mjs +557 -0
- package/.golem/lib/claude.mjs +95 -0
- package/.golem/lib/config.mjs +421 -0
- package/.golem/lib/display.mjs +191 -0
- package/.golem/lib/doctor.mjs +197 -0
- package/.golem/lib/document.mjs +792 -0
- package/.golem/lib/gates.mjs +78 -0
- package/.golem/lib/init.mjs +166 -0
- package/.golem/lib/output.mjs +40 -0
- package/.golem/lib/ratelimit.mjs +86 -0
- package/.golem/lib/security.mjs +603 -0
- package/.golem/lib/simplify.mjs +101 -0
- package/.golem/lib/tui.mjs +368 -0
- package/.golem/lib/usage.mjs +119 -0
- package/.golem/lib/worktree.mjs +509 -0
- package/.golem/prompts/build.md +23 -0
- package/.golem/prompts/document-inline.md +66 -0
- package/.golem/prompts/document-markdown.md +80 -0
- package/.golem/prompts/simplify.md +35 -0
- package/README.md +141 -142
- package/bin/golem-shim.mjs +36 -0
- package/bin/install.mjs +193 -0
- package/package.json +27 -32
- package/.env.example +0 -17
- package/bin/golem +0 -1040
- package/commands/golem/build.md +0 -235
- package/commands/golem/config.md +0 -55
- package/commands/golem/doctor.md +0 -137
- package/commands/golem/help.md +0 -212
- package/commands/golem/plan.md +0 -214
- package/commands/golem/review.md +0 -376
- package/commands/golem/security.md +0 -204
- package/commands/golem/simplify.md +0 -94
- package/commands/golem/spec.md +0 -226
- package/commands/golem/status.md +0 -60
- package/dist/api/freshworks.d.ts +0 -61
- package/dist/api/freshworks.d.ts.map +0 -1
- package/dist/api/freshworks.js +0 -119
- package/dist/api/freshworks.js.map +0 -1
- package/dist/api/gitea.d.ts +0 -96
- package/dist/api/gitea.d.ts.map +0 -1
- package/dist/api/gitea.js +0 -154
- package/dist/api/gitea.js.map +0 -1
- package/dist/cli/index.d.ts +0 -9
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -352
- package/dist/cli/index.js.map +0 -1
- package/dist/sync/ticket-sync.d.ts +0 -53
- package/dist/sync/ticket-sync.d.ts.map +0 -1
- package/dist/sync/ticket-sync.js +0 -226
- package/dist/sync/ticket-sync.js.map +0 -1
- package/dist/types.d.ts +0 -125
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/dist/worktree/manager.d.ts +0 -54
- package/dist/worktree/manager.d.ts.map +0 -1
- package/dist/worktree/manager.js +0 -190
- package/dist/worktree/manager.js.map +0 -1
- package/golem/agents/code-simplifier.md +0 -81
- package/golem/agents/spec-builder.md +0 -90
- package/golem/prompts/PROMPT_build.md +0 -71
- package/golem/prompts/PROMPT_plan.md +0 -102
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { access, readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
import { header, success, fail, warn, info } from './output.mjs';
|
|
5
|
+
|
|
6
|
+
const INSTALL_CMDS = {
|
|
7
|
+
gitleaks: 'brew install gitleaks',
|
|
8
|
+
semgrep: 'brew install semgrep',
|
|
9
|
+
trivy: 'brew install trivy',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
async function fileExists(path) {
|
|
13
|
+
try {
|
|
14
|
+
await access(path);
|
|
15
|
+
return true;
|
|
16
|
+
} catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function runCmd(cmd) {
|
|
22
|
+
try {
|
|
23
|
+
return execSync(cmd, { stdio: 'pipe', encoding: 'utf-8' }).trim();
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function fixEnvGitignore(cwd) {
|
|
30
|
+
const giPath = join(cwd, '.gitignore');
|
|
31
|
+
try {
|
|
32
|
+
const content = await readFile(giPath, 'utf-8');
|
|
33
|
+
if (!content.split('\n').some(l => l.trim() === '.env' || l.trim() === '.env*')) {
|
|
34
|
+
await writeFile(giPath, content.trimEnd() + '\n.env\n');
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
await writeFile(giPath, '.env\n');
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function fixMissingDirs(cwd) {
|
|
45
|
+
const dirs = ['.golem', '.golem/specs', '.golem/prompts', '.golem/agents', '.golem/lib', '.golem/bin'];
|
|
46
|
+
let fixed = 0;
|
|
47
|
+
for (const dir of dirs) {
|
|
48
|
+
const full = join(cwd, dir);
|
|
49
|
+
if (!await fileExists(full)) {
|
|
50
|
+
await mkdir(full, { recursive: true });
|
|
51
|
+
fixed++;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return fixed;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function fixSlashCommands(cwd) {
|
|
58
|
+
const dir = join(cwd, '.claude/commands/golem');
|
|
59
|
+
if (await fileExists(dir)) return false;
|
|
60
|
+
await mkdir(dir, { recursive: true });
|
|
61
|
+
const stubs = ['spec', 'plan', 'build', 'review', 'security', 'simplify', 'status', 'doctor', 'config', 'help'];
|
|
62
|
+
for (const name of stubs) {
|
|
63
|
+
const file = join(dir, `${name}.md`);
|
|
64
|
+
if (!await fileExists(file)) {
|
|
65
|
+
await writeFile(file, `Run \`npx golem ${name}\` or see \`npx golem help\`.\n`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function runDoctor(opts = {}) {
|
|
72
|
+
const fixing = !!opts.fix;
|
|
73
|
+
header('Golem Doctor');
|
|
74
|
+
if (fixing) info('Running with --fix: will attempt to repair issues');
|
|
75
|
+
|
|
76
|
+
const results = [];
|
|
77
|
+
const cwd = process.cwd();
|
|
78
|
+
|
|
79
|
+
// --- Project checks ---
|
|
80
|
+
console.log();
|
|
81
|
+
info('Project checks:');
|
|
82
|
+
|
|
83
|
+
// .golem/ directory
|
|
84
|
+
let golemDir = await fileExists(join(cwd, '.golem'));
|
|
85
|
+
if (!golemDir && fixing) {
|
|
86
|
+
const n = await fixMissingDirs(cwd);
|
|
87
|
+
if (n > 0) { success('Created missing .golem/ directories'); golemDir = true; }
|
|
88
|
+
}
|
|
89
|
+
results.push(['.golem/ directory', golemDir]);
|
|
90
|
+
golemDir ? success('.golem/ exists') : fail('.golem/ missing');
|
|
91
|
+
|
|
92
|
+
// AGENTS.md
|
|
93
|
+
const agents = await fileExists(join(cwd, '.golem/AGENTS.md'));
|
|
94
|
+
results.push(['AGENTS.md', agents]);
|
|
95
|
+
agents ? success('AGENTS.md exists') : fail('AGENTS.md missing');
|
|
96
|
+
|
|
97
|
+
// Slash commands
|
|
98
|
+
let slashCmds = await fileExists(join(cwd, '.claude/commands/golem'));
|
|
99
|
+
if (!slashCmds && fixing) {
|
|
100
|
+
if (await fixSlashCommands(cwd)) { success('Generated slash command stubs'); slashCmds = true; }
|
|
101
|
+
}
|
|
102
|
+
results.push(['Slash commands', slashCmds]);
|
|
103
|
+
slashCmds ? success('Slash commands present') : warn('Slash commands not installed');
|
|
104
|
+
|
|
105
|
+
// .env in .gitignore
|
|
106
|
+
let envIgnored = false;
|
|
107
|
+
try {
|
|
108
|
+
const gi = await readFile(join(cwd, '.gitignore'), 'utf-8');
|
|
109
|
+
envIgnored = gi.split('\n').some(l => l.trim() === '.env' || l.trim() === '.env*');
|
|
110
|
+
} catch { /* no gitignore */ }
|
|
111
|
+
if (!envIgnored && fixing) {
|
|
112
|
+
if (await fixEnvGitignore(cwd)) { success('Added .env to .gitignore'); envIgnored = true; }
|
|
113
|
+
}
|
|
114
|
+
results.push(['.env in .gitignore', envIgnored]);
|
|
115
|
+
envIgnored ? success('.env is gitignored') : fail('.env NOT in .gitignore');
|
|
116
|
+
|
|
117
|
+
// Specs
|
|
118
|
+
const specs = await fileExists(join(cwd, '.golem/specs'));
|
|
119
|
+
results.push(['Specs directory', specs]);
|
|
120
|
+
specs ? success('Specs exist') : warn('No specs found');
|
|
121
|
+
|
|
122
|
+
// Plan
|
|
123
|
+
const plan = await fileExists(join(cwd, '.golem/IMPLEMENTATION_PLAN.md'));
|
|
124
|
+
results.push(['Implementation plan', plan]);
|
|
125
|
+
plan ? success('Plan exists') : warn('No plan found');
|
|
126
|
+
|
|
127
|
+
// --- User checks ---
|
|
128
|
+
console.log();
|
|
129
|
+
info('User checks:');
|
|
130
|
+
|
|
131
|
+
const claudeVersion = runCmd('claude --version');
|
|
132
|
+
results.push(['Claude CLI', !!claudeVersion]);
|
|
133
|
+
claudeVersion ? success(`Claude CLI: ${claudeVersion}`) : fail('Claude CLI not found');
|
|
134
|
+
|
|
135
|
+
const nodeVersion = runCmd('node --version');
|
|
136
|
+
const nodeOk = nodeVersion && parseInt(nodeVersion.replace('v', '')) >= 18;
|
|
137
|
+
results.push(['Node.js >= 18', nodeOk]);
|
|
138
|
+
nodeOk ? success(`Node.js: ${nodeVersion}`) : fail(`Node.js: ${nodeVersion || 'not found'} (need >= 18)`);
|
|
139
|
+
|
|
140
|
+
const gitUser = runCmd('git config user.name');
|
|
141
|
+
const gitEmail = runCmd('git config user.email');
|
|
142
|
+
const gitOk = !!(gitUser && gitEmail);
|
|
143
|
+
results.push(['Git configured', gitOk]);
|
|
144
|
+
gitOk ? success(`Git: ${gitUser} <${gitEmail}>`) : warn('Git user not configured');
|
|
145
|
+
|
|
146
|
+
// Old installations
|
|
147
|
+
const oldGolem = await fileExists(join(process.env.HOME || '~', '.golem'));
|
|
148
|
+
if (oldGolem) warn('Old ~/.golem/ installation detected — consider removing');
|
|
149
|
+
|
|
150
|
+
// --- Security tools ---
|
|
151
|
+
console.log();
|
|
152
|
+
info('Security tools:');
|
|
153
|
+
|
|
154
|
+
for (const tool of ['gitleaks', 'semgrep', 'trivy']) {
|
|
155
|
+
const toolPath = runCmd(`which ${tool}`);
|
|
156
|
+
results.push([tool, !!toolPath]);
|
|
157
|
+
if (toolPath) {
|
|
158
|
+
success(`${tool}: ${toolPath}`);
|
|
159
|
+
} else {
|
|
160
|
+
warn(`${tool}: not installed — ${INSTALL_CMDS[tool]}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// --- Test commands ---
|
|
165
|
+
console.log();
|
|
166
|
+
info('Test commands:');
|
|
167
|
+
try {
|
|
168
|
+
const agentsContent = await readFile(join(cwd, '.golem/AGENTS.md'), 'utf-8');
|
|
169
|
+
const testMatch = agentsContent.match(/```bash\n(.*?)\n```/s);
|
|
170
|
+
if (testMatch) {
|
|
171
|
+
const testCmd = testMatch[1].trim();
|
|
172
|
+
if (testCmd && !testCmd.startsWith('#')) {
|
|
173
|
+
const testResult = runCmd(testCmd);
|
|
174
|
+
results.push(['Test command', testResult !== null]);
|
|
175
|
+
testResult !== null ? success(`Test: \`${testCmd}\` works`) : fail(`Test: \`${testCmd}\` failed`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch {
|
|
179
|
+
warn('Could not validate test commands');
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// --- Summary ---
|
|
183
|
+
console.log();
|
|
184
|
+
const passed = results.filter(([, v]) => v).length;
|
|
185
|
+
const total = results.length;
|
|
186
|
+
if (passed === total) {
|
|
187
|
+
success(`All ${total} checks passed`);
|
|
188
|
+
} else {
|
|
189
|
+
warn(`${passed}/${total} checks passed`);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (opts.json) {
|
|
193
|
+
console.log(JSON.stringify(Object.fromEntries(results)));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return { passed, total, results: Object.fromEntries(results) };
|
|
197
|
+
}
|