golem-cc 0.2.8 → 1.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.
Files changed (54) hide show
  1. package/.env.example +17 -0
  2. package/.github/workflows/publish.yml +42 -0
  3. package/.golem/IMPLEMENTATION_PLAN.md +59 -0
  4. package/README.md +141 -239
  5. package/bin/golem +680 -1695
  6. package/bin/install.sh +69 -0
  7. package/commands/golem/build.md +46 -21
  8. package/commands/golem/config.md +55 -0
  9. package/commands/golem/doctor.md +137 -0
  10. package/commands/golem/help.md +49 -38
  11. package/commands/golem/plan.md +58 -27
  12. package/commands/golem/simplify.md +38 -75
  13. package/commands/golem/spec.md +72 -49
  14. package/commands/golem/status.md +39 -68
  15. package/dist/api/freshworks.d.ts +61 -0
  16. package/dist/api/freshworks.d.ts.map +1 -0
  17. package/dist/api/freshworks.js +119 -0
  18. package/dist/api/freshworks.js.map +1 -0
  19. package/dist/api/gitea.d.ts +96 -0
  20. package/dist/api/gitea.d.ts.map +1 -0
  21. package/dist/api/gitea.js +154 -0
  22. package/dist/api/gitea.js.map +1 -0
  23. package/dist/cli/index.d.ts +9 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +352 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/sync/ticket-sync.d.ts +53 -0
  28. package/dist/sync/ticket-sync.d.ts.map +1 -0
  29. package/dist/sync/ticket-sync.js +226 -0
  30. package/dist/sync/ticket-sync.js.map +1 -0
  31. package/dist/types.d.ts +125 -0
  32. package/dist/types.d.ts.map +1 -0
  33. package/dist/types.js +5 -0
  34. package/dist/types.js.map +1 -0
  35. package/dist/worktree/manager.d.ts +54 -0
  36. package/dist/worktree/manager.d.ts.map +1 -0
  37. package/dist/worktree/manager.js +190 -0
  38. package/dist/worktree/manager.js.map +1 -0
  39. package/docs/FRESHSERVICE_SETUP.md +338 -0
  40. package/docs/HANDOFF.md +241 -0
  41. package/golem/agents/code-simplifier.md +51 -83
  42. package/golem/agents/spec-builder.md +61 -124
  43. package/golem/prompts/PROMPT_build.md +25 -5
  44. package/golem/prompts/PROMPT_plan.md +82 -34
  45. package/package.json +30 -24
  46. package/src/api/freshworks.ts +167 -0
  47. package/src/api/gitea.ts +215 -0
  48. package/src/cli/index.ts +370 -0
  49. package/src/sync/ticket-sync.ts +303 -0
  50. package/src/types.ts +152 -0
  51. package/src/worktree/manager.ts +236 -0
  52. package/tsconfig.json +18 -0
  53. package/bin/install.cjs +0 -449
  54. package/bin/render-md.cjs +0 -50
package/.env.example ADDED
@@ -0,0 +1,17 @@
1
+ # Freshworks/Freshservice
2
+ FRESH_DOMAIN=yourcompany.freshservice.com
3
+ FRESH_API_KEY=your_api_key_here
4
+
5
+ # Gitea (on-prem)
6
+ GITEA_URL=https://dev.pearlriverresort.com
7
+ GITEA_TOKEN=your_token_here
8
+ GITEA_ORG=CRDE
9
+
10
+ # Default repo for issues (can be overridden per-project)
11
+ GITEA_REPO=
12
+
13
+ # Freshservice defaults for ticket creation (get these from your instance)
14
+ FRESH_DEFAULT_GROUP_ID=
15
+ FRESH_DEFAULT_CATEGORY=Applications
16
+ FRESH_SOURCE_ID=
17
+ FRESH_DEFAULT_EMAIL=
@@ -0,0 +1,42 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ id-token: write
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '20'
20
+ registry-url: 'https://registry.npmjs.org'
21
+
22
+ - name: Upgrade npm for OIDC support
23
+ run: npm install -g npm@latest
24
+
25
+ - uses: pnpm/action-setup@v2
26
+ with:
27
+ version: 9
28
+
29
+ - name: Install dependencies
30
+ run: pnpm install
31
+
32
+ - name: Build
33
+ run: pnpm build
34
+
35
+ - name: Sync package.json version from git tag
36
+ run: |
37
+ VERSION=${GITHUB_REF#refs/tags/v}
38
+ echo "Setting version to $VERSION"
39
+ npm version $VERSION --no-git-tag-version --allow-same-version
40
+
41
+ - name: Publish to npm
42
+ run: npm publish --access public --provenance
@@ -0,0 +1,59 @@
1
+ # Implementation Plan
2
+
3
+ Ticket: LOCAL-DEV (no external ticket)
4
+ Generated: 2026-02-04
5
+ Based on: .golem/specs/config-command.md, .golem/specs/doctor-command.md
6
+
7
+ ## Status
8
+ - Stages: 2
9
+ - Completed: 0
10
+ - Current: Stage 1
11
+
12
+ ---
13
+
14
+ ## Stage 1: Config Command
15
+ Commit: feat(cli): add golem config command to display configuration status
16
+
17
+ ### [x] 1.1. Add cmd_config function to bin/golem
18
+ Files: bin/golem
19
+ Notes: Add function that displays GOLEM_HOME, env file locations, and all env vars with appropriate masking for secrets. Use existing color helpers (GREEN for set, YELLOW for unset optional, RED for unset required). Required vars: FRESH_DOMAIN, FRESH_API_KEY, GITEA_URL, GITEA_TOKEN.
20
+ Tests: Run `golem config` and verify output shows env status correctly
21
+
22
+ ### [x] 1.2. Add config to main case statement and help text
23
+ Files: bin/golem
24
+ Notes: Add "config)" case to main(), add to cmd_help() under OTHER section
25
+ Tests: `golem help` shows config command, `golem config` routes correctly
26
+
27
+ ### [x] 1.3. Create /golem:config Claude command
28
+ Files: commands/golem/config.md
29
+ Notes: Follow pattern from status.md - use bash context blocks to read env status, display formatted output
30
+ Tests: Run `/golem:config` in Claude and verify it shows configuration
31
+
32
+ ---
33
+
34
+ ## Stage 2: Doctor Command
35
+ Commit: feat(cli): add golem doctor command to diagnose setup issues
36
+ Depends on: Stage 1
37
+
38
+ ### [x] 2.1. Add cmd_doctor function to bin/golem
39
+ Files: bin/golem
40
+ Notes: Implement environment checks (~/.golem dir, .env file, required vars), dependency checks (node, pnpm, git, golem-api with versions), installation checks (prompts, agents, commands, claude symlink). Track pass/fail count. Support --check-apis flag for optional API tests.
41
+ Tests: Run `golem doctor` and verify all checks run and display correctly
42
+
43
+ ### [x] 2.2. Add doctor to main case statement and help text
44
+ Files: bin/golem
45
+ Notes: Add "doctor)" case to main(), add to cmd_help() under OTHER section
46
+ Tests: `golem help` shows doctor command, `golem doctor` routes correctly
47
+
48
+ ### [x] 2.3. Create /golem:doctor Claude command
49
+ Files: commands/golem/doctor.md
50
+ Notes: Follow same pattern, run diagnostic checks and display results
51
+ Tests: Run `/golem:doctor` in Claude and verify diagnostics display
52
+
53
+ ---
54
+
55
+ ## Notes
56
+
57
+ - No external services needed - all local checks
58
+ - Install script may need re-run after adding new commands to copy them to ~/.golem
59
+ - Exit codes: config always 0 (informational), doctor 0 if all pass / 1 if any fail
package/README.md CHANGED
@@ -1,296 +1,198 @@
1
- ```
2
-
3
- ██████╗ ██████╗ ██╗ ███████╗███╗ ███╗
4
- ██╔════╝ ██╔═══██╗██║ ██╔════╝████╗ ████║
5
- ██║ ███╗██║ ██║██║ █████╗ ██╔████╔██║
6
- ██║ ██║██║ ██║██║ ██╔══╝ ██║╚██╔╝██║
7
- ╚██████╔╝╚██████╔╝███████╗███████╗██║ ╚═╝ ██║
8
- ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝
9
-
10
- ```
1
+ # Golem
11
2
 
12
- > *"Ruby's son is a doctor, and you're letting a computer write your code?"*
3
+ Personal agentic workflow manager. Integrates Freshservice tickets, Gitea issues, and Claude Code for a unified development workflow.
13
4
 
14
- Golem is an autonomous coding loop that implements features while you watch (or grab coffee). Define your specs, kick off the loop, and let it work through your task list—implementing, testing, simplifying, and committing along the way.
5
+ ## Installation
15
6
 
16
- <p align="center">
17
- <img src="demo.gif" alt="golem-cc demo" width="700">
18
- </p>
7
+ ```bash
8
+ # Install globally via npm
9
+ npm install -g golem-cc
19
10
 
20
- ```
21
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
22
- ITERATION 3 │ 9 tasks remaining
23
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
24
-
25
- ▶ Step 1: Implement
26
- ✓ Added user authentication endpoint
27
- ✓ Tests passing (14 passed)
28
- ✓ Committed: feat(auth): add login endpoint
29
-
30
- ▶ Step 2: Simplify
31
- ✓ Flattened nested conditionals
32
- ✓ Tests passing (14 passed)
33
- ✓ Committed: refactor: simplify auth logic
34
-
35
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
36
- ITERATION 4 │ 8 tasks remaining
37
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
11
+ # Or run directly with pnpm
12
+ pnpm dlx golem-cc
38
13
  ```
39
14
 
40
- ## How It Works
15
+ After installing, run the setup:
41
16
 
42
- ```
43
- ┌─────────────────────────────────────────────────────────────────┐
44
- │ YOU │
45
- │ │
46
- │ "I need user auth, a REST API for tasks, and filtering" │
47
- │ │ │
48
- │ ▼ │
49
- │ ┌────────────────────┐ │
50
- │ │ claude │ ← Interactive │
51
- │ │ → /golem:spec │ conversation │
52
- │ └────────────────────┘ │
53
- │ │ │
54
-
55
- │ .golem/specs/*.md │
56
-
57
- ├──────────────────────────────┼──────────────────────────────────┤
58
- GOLEM
59
-
60
-
61
- ┌────────────────┐
62
- golem run plan │ ← Analyzes specs │
63
- └────────────────┘ vs. codebase
64
-
65
-
66
- .golem/IMPLEMENTATION_PLAN.md
67
- │ │
68
-
69
- ┌─────────────────┐
70
- golem run build ← Autonomous loop │
71
- └─────────────────┘
72
-
73
- ┌─────────────────┼─────────────────┐
74
- ▼ ▼ ▼
75
- ┌────────────┐ ┌────────────┐ ┌────────────┐
76
- Implement │ → │ Test │ → │ Simplify │ → Commit │
77
- └────────────┘ └────────────┘ └────────────┘
78
-
79
- └─────────────── Loop ────────────────────────┘
80
-
81
- └─────────────────────────────────────────────────────────────────┘
17
+ ```bash
18
+ # Check your installation
19
+ golem doctor
20
+
21
+ # Configure credentials
22
+ vim ~/.golem/.env
23
+ ```
24
+
25
+ ## Architecture
26
+
27
+ ```
28
+ ┌─────────────────────────────────────────────────────────────────────┐
29
+ GOLEM WORKFLOW
30
+ ├─────────────────────────────────────────────────────────────────────┤
31
+
32
+ │ Freshservice Local State Gitea │
33
+ ┌─────────┐ ┌───────────┐ ┌─────────┐
34
+ INC-123 │◄──────►│.golem/ │◄──────►│ Issue
35
+ Ticket │ │tickets/ │ │ #47 │ │
36
+ └─────────┘ INC-123.yml│ └─────────┘ │
37
+ └───────────┘
38
+
39
+
40
+ ┌───────────┐
41
+ Worktree │ │
42
+ fix/INC- │
43
+ │ 123-slug │
44
+ └───────────┘
45
+
46
+ ┌───────────────┼───────────────┐
47
+ ▼ ▼ ▼
48
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
49
+ │/golem: │/golem: │ │/golem: │ │
50
+ │spec │──►│plan │──►│build
51
+ └──────────┘ └──────────┘ └──────────┘
52
+ │ │
53
+ ▼ ▼ ▼
54
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
55
+ │.golem/ │IMPLEMENT-│ │ wip: │ │
56
+ │ │specs/ │ │ATION_ │ │ commits │──► squash │
57
+ │ │*.md │ │PLAN.md │ └──────────┘ per stage │
58
+ │ └──────────┘ └──────────┘ │
59
+ │ │
60
+ └─────────────────────────────────────────────────────────────────────┘
82
61
  ```
83
62
 
84
- ## Installation
63
+ ## Quick Start
85
64
 
86
- ### Quick Install (curl)
65
+ ### 1. Initialize a project
87
66
 
88
67
  ```bash
89
- curl -fsSL https://raw.githubusercontent.com/daresTheDevil/golem-cc/main/install.sh | bash
68
+ cd your-project
69
+ golem init
90
70
  ```
91
71
 
92
- ### Package Managers
72
+ ### 2. Get a ticket
93
73
 
94
74
  ```bash
95
- # npm
96
- npx golem-cc
97
-
98
- # pnpm
99
- pnpm dlx golem-cc
100
-
101
- # yarn
102
- yarn dlx golem-cc
75
+ # Import existing Freshservice ticket
76
+ golem import INC-1234
103
77
 
104
- # bun
105
- bunx golem-cc
78
+ # Or create new ticket
79
+ golem new "Fix API timeout issue"
106
80
  ```
107
81
 
108
- ### Homebrew (macOS/Linux)
82
+ ### 3. Create worktree
109
83
 
110
84
  ```bash
111
- brew tap daresTheDevil/golem
112
- brew install golem-cc
85
+ golem worktree INC-1234
86
+ cd .golem/worktrees/fix/INC-1234-api-timeout
113
87
  ```
114
88
 
115
- Then reload your shell:
116
- ```bash
117
- source ~/.zshrc # or ~/.bashrc (or ~/.profile for sh)
89
+ ### 4. Define specs (in Claude Code)
90
+
91
+ ```
92
+ /golem:spec
118
93
  ```
119
94
 
120
- ## Quick Start
95
+ Interactive conversation to define requirements, tests, and constraints.
121
96
 
122
- ```bash
123
- # 1. Initialize in your project
124
- cd my-project
125
- golem --init
97
+ ### 5. Create plan (in Claude Code)
126
98
 
127
- # 2. Define what you're building (interactive)
128
- claude
129
- > /golem:spec
130
- > exit
99
+ ```
100
+ /golem:plan
101
+ ```
131
102
 
132
- # 3. Generate the task list
133
- golem run plan
103
+ Generates `.golem/IMPLEMENTATION_PLAN.md` with staged tasks.
134
104
 
135
- # 4. Let it rip
136
- golem run build
137
- ```
105
+ ### 6. Build (CLI loop or Claude Code)
138
106
 
139
- ## The Loop
107
+ ```bash
108
+ # CLI - loops until done
109
+ golem build
140
110
 
141
- Each iteration runs two separate sessions with fresh context:
111
+ # Or in Claude Code - one task at a time
112
+ /golem:build
113
+ ```
142
114
 
143
- **Step 1: Implement**
144
- - Picks the next task from `.golem/IMPLEMENTATION_PLAN.md`
145
- - Implements the feature/fix
146
- - Runs tests until they pass
147
- - Updates the plan
148
- - Commits
115
+ Each task gets a WIP commit. Each stage gets squashed.
149
116
 
150
- **Step 2: Simplify**
151
- - Analyzes the code just written
152
- - Removes AI artifacts (unnecessary comments, dead code)
153
- - Flattens nested logic
154
- - Improves naming
155
- - Runs tests to verify no regressions
156
- - Commits
117
+ ### 7. Create PR
157
118
 
158
- Then it loops. Fresh context each time. No degradation.
119
+ ```bash
120
+ golem pr
121
+ ```
159
122
 
160
123
  ## Commands
161
124
 
162
- ### CLI Commands
125
+ ### Terminal
126
+
163
127
  | Command | Description |
164
128
  |---------|-------------|
165
- | `golem --init` | Initialize golem in current project |
166
- | `golem run plan` | Create implementation plan from specs |
167
- | `golem run build` | Run the autonomous build loop |
168
- | `golem simplify` | Run code simplifier on demand |
169
- | `golem status` | Show progress |
129
+ | `golem new <subject>` | Create new ticket |
130
+ | `golem import <INC-XXX>` | Import Freshservice ticket |
131
+ | `golem list` | List tracked tickets |
132
+ | `golem status [ticket]` | Show ticket or project status |
133
+ | `golem worktree [ticket]` | Create/show worktree |
134
+ | `golem worktrees` | List all worktrees |
135
+ | `golem build` | Run autonomous build loop |
136
+ | `golem plan` | Generate implementation plan |
137
+ | `golem simplify [files]` | Run code simplifier |
138
+ | `golem squash` | Squash stage commits |
139
+ | `golem pr` | Create pull request |
140
+ | `golem sync` | Sync status to Freshservice/Gitea |
141
+ | `golem config` | Show current configuration |
142
+ | `golem doctor` | Diagnose setup issues |
143
+ | `golem init` | Initialize golem in current project |
144
+ | `golem help` | Show help |
145
+
146
+ ### Claude Code
170
147
 
171
- ### Slash Commands (inside Claude)
172
148
  | Command | Description |
173
149
  |---------|-------------|
174
- | `/golem:spec` | Build specs through guided conversation |
175
- | `/golem:plan` | Create implementation plan |
176
- | `/golem:build` | Run build loop (single iteration) |
150
+ | `/golem:spec` | Define specs interactively |
151
+ | `/golem:plan` | Generate implementation plan |
152
+ | `/golem:build` | Run one build iteration |
177
153
  | `/golem:simplify` | Run code simplifier |
178
- | `/golem:status` | Show project status |
179
- | `/golem:help` | Show all commands |
154
+ | `/golem:status` | Show current status |
155
+ | `/golem:config` | Show configuration |
156
+ | `/golem:doctor` | Diagnose setup issues |
157
+ | `/golem:help` | Show help |
180
158
 
181
- ### Options
159
+ ## Configuration
182
160
 
183
- ```bash
184
- golem run build --iterations 10 # Stop after 10 tasks
185
- golem run build --no-simplify # Skip simplification step
186
- ```
161
+ ### Environment Variables
187
162
 
188
- ## Project Structure
163
+ ```bash
164
+ # ~/.golem/.env
189
165
 
190
- After running `golem --init`:
166
+ # Freshservice
167
+ FRESH_DOMAIN=yourcompany.freshservice.com
168
+ FRESH_API_KEY=your_api_key
169
+ FRESH_DEFAULT_GROUP_ID=12345 # Optional
170
+ FRESH_DEFAULT_CATEGORY=Applications # Optional
171
+ FRESH_SOURCE_ID=1002 # Optional
172
+ FRESH_DEFAULT_EMAIL=bot@example.com # Optional
191
173
 
174
+ # Gitea
175
+ GITEA_URL=https://gitea.example.com
176
+ GITEA_TOKEN=your_token
177
+ GITEA_ORG=your-org
178
+ GITEA_REPO=default-repo # Can be overridden per-project
192
179
  ```
193
- my-project/
194
- └── .golem/
195
- ├── prompts/ # Loop instructions (customizable)
196
- │ ├── PROMPT_build.md
197
- │ └── PROMPT_plan.md
198
- ├── agents/ # AI agent definitions
199
- │ ├── spec-builder.md
200
- │ └── code-simplifier.md
201
- ├── specs/ # Your requirements (one file per topic)
202
- │ ├── authentication.md
203
- │ └── task-api.md
204
- ├── AGENTS.md # Test/build/lint commands
205
- └── IMPLEMENTATION_PLAN.md # Generated task list
206
- ```
207
-
208
- ## Writing Specs
209
-
210
- Specs are simple markdown files describing what you want:
211
-
212
- ```markdown
213
- # Authentication
214
-
215
- ## Purpose
216
- User authentication for the API.
217
-
218
- ## Requirements
219
-
220
- ### Must Have
221
- - Email/password registration
222
- - JWT-based sessions with refresh tokens
223
- - Password hashing with bcrypt
224
180
 
225
- ### Should Have
226
- - Password reset via email
181
+ ### Project Structure
227
182
 
228
- ### Must Not
229
- - Store plain text passwords
230
- - Allow unlimited login attempts
231
-
232
- ## Acceptance Criteria
233
- - [ ] POST /auth/register creates user
234
- - [ ] POST /auth/login returns JWT
235
- - [ ] Invalid credentials return 401
236
- - [ ] Tokens expire after 24 hours
237
183
  ```
238
-
239
- ## Backpressure
240
-
241
- The loop uses your test suite as a quality gate. Configure in `.golem/AGENTS.md`:
242
-
243
- ```markdown
244
- # Operational Guide
245
-
246
- ## Commands
247
-
248
- ### Testing
249
- \`\`\`bash
250
- npm test
251
- \`\`\`
252
-
253
- ### Type Checking
254
- \`\`\`bash
255
- npm run typecheck
256
- \`\`\`
257
-
258
- ### Linting
259
- \`\`\`bash
260
- npm run lint
261
- \`\`\`
184
+ .golem/
185
+ ├── tickets/ # Local ticket state (YAML)
186
+ │ └── INC-1234.yaml
187
+ ├── specs/ # Requirement specs
188
+ │ ├── feature.md
189
+ │ └── validation.md
190
+ ├── worktrees/ # Git worktrees per ticket
191
+ │ └── fix/INC-1234-api-timeout/
192
+ ├── AGENTS.md # Operational commands (test/build/lint)
193
+ └── IMPLEMENTATION_PLAN.md # Current task list
262
194
  ```
263
195
 
264
- If tests fail, it fixes and retries. If they pass, it moves on. Your tests are the contract.
265
-
266
- ## Philosophy
267
-
268
- **Fresh context beats accumulated context.** Each iteration starts clean. No confusion from previous work bleeding in.
269
-
270
- **Tests are the spec.** The loop trusts passing tests. Write good tests, get good code.
271
-
272
- **Simplification is not optional.** AI-written code tends toward verbosity. The simplifier pass keeps it clean.
273
-
274
- **You steer via specs, not prompts.** Change what you want by editing `.golem/specs/*.md`, not by micromanaging the AI.
275
-
276
- ## Based On
277
-
278
- - [Ralph Wiggum Playbook](https://claytonfarr.github.io/ralph-playbook/) by Clayton Farr — the autonomous loop methodology
279
- - [Code Simplifier](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/code-simplifier) from Anthropic — the simplification patterns
280
-
281
- ## Requirements
282
-
283
- - Node.js 18+
284
- - [Claude Code](https://claude.ai/code) CLI installed and authenticated
285
-
286
- ## Supported Platforms
287
-
288
- - **macOS** (Intel and Apple Silicon)
289
- - **Linux** (Ubuntu, Debian, Fedora, Arch, Alpine)
290
- - **WSL2** (Windows Subsystem for Linux)
291
-
292
- Shells supported: bash, zsh, sh (POSIX)
293
-
294
196
  ## License
295
197
 
296
198
  MIT