@claushaas/ergon-cli 0.1.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.
Files changed (72) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +20 -0
  3. package/dist/commands/approve.d.ts +14 -0
  4. package/dist/commands/approve.d.ts.map +1 -0
  5. package/dist/commands/approve.js +60 -0
  6. package/dist/commands/approve.js.map +1 -0
  7. package/dist/commands/cancel.d.ts +7 -0
  8. package/dist/commands/cancel.d.ts.map +1 -0
  9. package/dist/commands/cancel.js +27 -0
  10. package/dist/commands/cancel.js.map +1 -0
  11. package/dist/commands/init.d.ts +10 -0
  12. package/dist/commands/init.d.ts.map +1 -0
  13. package/dist/commands/init.js +16 -0
  14. package/dist/commands/init.js.map +1 -0
  15. package/dist/commands/library.d.ts +7 -0
  16. package/dist/commands/library.d.ts.map +1 -0
  17. package/dist/commands/library.js +12 -0
  18. package/dist/commands/library.js.map +1 -0
  19. package/dist/commands/run.d.ts +18 -0
  20. package/dist/commands/run.d.ts.map +1 -0
  21. package/dist/commands/run.js +82 -0
  22. package/dist/commands/run.js.map +1 -0
  23. package/dist/commands/template.d.ts +13 -0
  24. package/dist/commands/template.d.ts.map +1 -0
  25. package/dist/commands/template.js +42 -0
  26. package/dist/commands/template.js.map +1 -0
  27. package/dist/commands/worker.d.ts +15 -0
  28. package/dist/commands/worker.d.ts.map +1 -0
  29. package/dist/commands/worker.js +108 -0
  30. package/dist/commands/worker.js.map +1 -0
  31. package/dist/commands/workflow.d.ts +8 -0
  32. package/dist/commands/workflow.d.ts.map +1 -0
  33. package/dist/commands/workflow.js +34 -0
  34. package/dist/commands/workflow.js.map +1 -0
  35. package/dist/config/index.d.ts +17 -0
  36. package/dist/config/index.d.ts.map +1 -0
  37. package/dist/config/index.js +76 -0
  38. package/dist/config/index.js.map +1 -0
  39. package/dist/help.d.ts +3 -0
  40. package/dist/help.d.ts.map +1 -0
  41. package/dist/help.js +45 -0
  42. package/dist/help.js.map +1 -0
  43. package/dist/library/agents/coder.yaml +27 -0
  44. package/dist/library/agents/pr-writer.yaml +28 -0
  45. package/dist/library/agents/repo-analyzer.yaml +31 -0
  46. package/dist/library/agents/repo-planner.yaml +35 -0
  47. package/dist/library/schemas/agent.analysis.v1.json +51 -0
  48. package/dist/library/schemas/agent.patch.v1.json +57 -0
  49. package/dist/library/schemas/agent.plan.v1.json +71 -0
  50. package/dist/library/schemas/agent.pr.v1.json +54 -0
  51. package/dist/library/workflows/code.bump_deps.yaml +268 -0
  52. package/dist/library/workflows/code.codegen.yaml +256 -0
  53. package/dist/library/workflows/code.docs_update.yaml +252 -0
  54. package/dist/library/workflows/code.hotfix.yaml +264 -0
  55. package/dist/library/workflows/code.refactor.yaml +256 -0
  56. package/dist/main.d.ts +3 -0
  57. package/dist/main.d.ts.map +1 -0
  58. package/dist/main.js +86 -0
  59. package/dist/main.js.map +1 -0
  60. package/dist/output/format.d.ts +2 -0
  61. package/dist/output/format.d.ts.map +1 -0
  62. package/dist/output/format.js +4 -0
  63. package/dist/output/format.js.map +1 -0
  64. package/dist/project.d.ts +42 -0
  65. package/dist/project.d.ts.map +1 -0
  66. package/dist/project.js +229 -0
  67. package/dist/project.js.map +1 -0
  68. package/dist/utils.d.ts +7 -0
  69. package/dist/utils.d.ts.map +1 -0
  70. package/dist/utils.js +39 -0
  71. package/dist/utils.js.map +1 -0
  72. package/package.json +47 -0
@@ -0,0 +1,268 @@
1
+
2
+ workflow:
3
+ id: code.bump_deps
4
+ version: 1
5
+ description: "Bump dependencies safely: scan → propose plan → apply updates → tests → review → manual gate → notify."
6
+ author: "ergon-flow"
7
+ tags: ["code", "deps", "maintenance", "pr"]
8
+
9
+ inputs:
10
+ repo_path:
11
+ type: string
12
+ description: "Local filesystem path to the git repository."
13
+
14
+ base_branch:
15
+ type: string
16
+ description: "Branch to start from (e.g., main)."
17
+ default: "main"
18
+
19
+ new_branch:
20
+ type: string
21
+ description: "Branch to create for dependency bumps (e.g., chore/deps-2026-03-05)."
22
+
23
+ ecosystem:
24
+ type: string
25
+ description: "Dependency ecosystem (informational): node|python|rust|go|mixed."
26
+ default: "node"
27
+
28
+ policy:
29
+ type: string
30
+ description: "Update policy and constraints."
31
+ default: "Prefer minor/patch updates. Avoid major updates unless explicitly requested. Keep CI green."
32
+
33
+ include:
34
+ type: array
35
+ description: "Optional list of dependency names to include (empty means all)."
36
+ default: []
37
+
38
+ exclude:
39
+ type: array
40
+ description: "Optional list of dependency names to exclude."
41
+ default: []
42
+
43
+ scan_command:
44
+ type: string
45
+ description: "Command that outputs the current dependency state and/or outdated report."
46
+ default: ""
47
+
48
+ update_command:
49
+ type: string
50
+ description: "Command that performs the dependency update."
51
+ default: ""
52
+
53
+ install_command:
54
+ type: string
55
+ description: "Command to (re)install dependencies after updates (if needed)."
56
+ default: ""
57
+
58
+ test_command:
59
+ type: string
60
+ description: "Command to run tests (empty means skip tests)."
61
+ default: ""
62
+
63
+ notify:
64
+ type: object
65
+ description: "Notification backend config."
66
+ default:
67
+ channel: "stdout" # stdout|webhook|openclaw
68
+ target: ""
69
+ message_prefix: "[ergon-flow]"
70
+
71
+ steps:
72
+
73
+ - id: repo.prepare
74
+ kind: exec
75
+ name: "Prepare repo branch"
76
+ description: "Fetch, checkout base branch, create new branch for dependency bump."
77
+ command: |
78
+ set -euo pipefail
79
+ cd "{{ inputs.repo_path }}"
80
+ git fetch --all --prune
81
+ git checkout "{{ inputs.base_branch }}"
82
+ git pull --ff-only
83
+ git checkout -B "{{ inputs.new_branch }}"
84
+
85
+ - id: scan.should
86
+ kind: condition
87
+ name: "Should scan deps?"
88
+ description: "Skip scan step if scan_command is empty."
89
+ expression: "{{ inputs.scan_command }}"
90
+
91
+ - id: deps.scan
92
+ kind: exec
93
+ name: "Scan dependencies"
94
+ description: "Run a repo-specific command to capture outdated/dependency state."
95
+ depends_on: [scan.should]
96
+ command: |
97
+ set -euo pipefail
98
+ cd "{{ inputs.repo_path }}"
99
+ {{ inputs.scan_command }}
100
+
101
+ - id: plan
102
+ kind: agent
103
+ name: "Propose dependency update plan"
104
+ description: "Decide what to update (based on scan output when available), and produce a safe plan for a single PR."
105
+ provider: openrouter
106
+ model: deepseek/deepseek-v3.2
107
+ output:
108
+ name: plan
109
+ type: plan
110
+ prompt: |
111
+ You are maintaining a production codebase. Propose a dependency update plan.
112
+
113
+ Repository path:
114
+ {{ inputs.repo_path }}
115
+
116
+ Ecosystem:
117
+ {{ inputs.ecosystem }}
118
+
119
+ Policy:
120
+ {{ inputs.policy }}
121
+
122
+ Include (may be empty):
123
+ {{ inputs.include }}
124
+
125
+ Exclude (may be empty):
126
+ {{ inputs.exclude }}
127
+
128
+ Outdated/dependency scan output (may be empty if scan was skipped):
129
+ {{ artifacts.deps.scan.stdout }}
130
+
131
+ Produce structured JSON with keys:
132
+ - summary
133
+ - update_set (array of {name, from, to, reason, risk})
134
+ - commands (object: {update_command, install_command})
135
+ - verification (array of checks)
136
+ - pr_title
137
+ - pr_body
138
+
139
+ Rules:
140
+ - Prefer minor/patch upgrades unless explicitly requested
141
+ - Avoid major bumps unless clearly safe
142
+ - If scan output is missing, infer a conservative plan and ask to provide scan_command
143
+
144
+ - id: update.should
145
+ kind: condition
146
+ name: "Should run update command?"
147
+ description: "Skip update step if update_command is empty."
148
+ expression: "{{ inputs.update_command }}"
149
+
150
+ - id: deps.update
151
+ kind: exec
152
+ name: "Apply dependency updates"
153
+ description: "Run update command and stage changes."
154
+ depends_on: [update.should]
155
+ command: |
156
+ set -euo pipefail
157
+ cd "{{ inputs.repo_path }}"
158
+ {{ inputs.update_command }}
159
+
160
+ - id: install.should
161
+ kind: condition
162
+ name: "Should install after update?"
163
+ description: "Skip install if install_command is empty."
164
+ expression: "{{ inputs.install_command }}"
165
+
166
+ - id: deps.install
167
+ kind: exec
168
+ name: "Install dependencies"
169
+ description: "(Re)install dependencies after updates if needed."
170
+ depends_on: [install.should]
171
+ command: |
172
+ set -euo pipefail
173
+ cd "{{ inputs.repo_path }}"
174
+ {{ inputs.install_command }}
175
+
176
+ - id: tests.should
177
+ kind: condition
178
+ name: "Should run tests?"
179
+ description: "Skip tests if test_command is empty."
180
+ expression: "{{ inputs.test_command }}"
181
+
182
+ - id: tests.exec
183
+ kind: exec
184
+ name: "Run tests"
185
+ description: "Run test suite and capture results."
186
+ depends_on: [tests.should]
187
+ command: |
188
+ set -euo pipefail
189
+ cd "{{ inputs.repo_path }}"
190
+ {{ inputs.test_command }}
191
+
192
+ - id: review
193
+ kind: agent
194
+ name: "Review changes and produce PR text"
195
+ description: "Summarize changes, assess risk, and generate final PR title/body."
196
+ provider: openrouter
197
+ model: moonshotai/kimi-k2.5
198
+ output:
199
+ name: review
200
+ type: json
201
+ prompt: |
202
+ You are a senior maintainer reviewing dependency updates.
203
+
204
+ Planned update set (JSON):
205
+ {{ artifacts.plan }}
206
+
207
+ Scan output (may be empty):
208
+ {{ artifacts.deps.scan.stdout }}
209
+
210
+ Update execution output (may be empty if skipped):
211
+ {{ artifacts.deps.update.stdout }}
212
+
213
+ Install output (may be empty if skipped):
214
+ {{ artifacts.deps.install.stdout }}
215
+
216
+ Test output (may be empty if skipped):
217
+ {{ artifacts.tests.exec.stdout }}
218
+
219
+ Produce structured JSON with keys:
220
+ - summary
221
+ - risk_assessment
222
+ - notes
223
+ - pr_title
224
+ - pr_body
225
+
226
+ - id: gate
227
+ kind: manual
228
+ name: "Manual gate"
229
+ description: "Human verifies PR, merges, and marks workflow complete."
230
+ message: |
231
+ Dependency bump branch is ready.
232
+
233
+ Suggested PR title:
234
+ {{ artifacts.review.pr_title }}
235
+
236
+ Suggested PR body:
237
+ {{ artifacts.review.pr_body }}
238
+
239
+ Repo:
240
+ {{ inputs.repo_path }}
241
+
242
+ Branch:
243
+ {{ inputs.new_branch }} (from {{ inputs.base_branch }})
244
+
245
+ Decision required: approve or reject.
246
+
247
+ - id: notify
248
+ kind: notify
249
+ name: "Notify user"
250
+ description: "Send final notification (stdout/webhook/openclaw)."
251
+ channel: "{{ inputs.notify.channel }}"
252
+ target: "{{ inputs.notify.target }}"
253
+ message: |
254
+ {{ inputs.notify.message_prefix }} Workflow completed: code.bump_deps
255
+
256
+ Repo: {{ inputs.repo_path }}
257
+ Branch: {{ inputs.new_branch }} (from {{ inputs.base_branch }})
258
+
259
+ Next action: open PR / review / merge.
260
+
261
+ Summary:
262
+ {{ artifacts.review.summary }}
263
+
264
+ outputs:
265
+ plan: artifacts.plan
266
+ review: artifacts.review
267
+ branch: inputs.new_branch
268
+ base_branch: inputs.base_branch
@@ -0,0 +1,256 @@
1
+
2
+ workflow:
3
+ id: code.codegen
4
+ version: 1
5
+ description: "Generate new code for a feature using analysis → design → implementation → tests → review → manual gate → notify."
6
+ author: "ergon-flow"
7
+ tags: ["code", "generation", "feature", "pr"]
8
+
9
+ inputs:
10
+ repo_path:
11
+ type: string
12
+ description: "Local filesystem path to the git repository."
13
+
14
+ base_branch:
15
+ type: string
16
+ description: "Branch to start from (e.g., main)."
17
+ default: "main"
18
+
19
+ new_branch:
20
+ type: string
21
+ description: "Branch to create for the feature implementation."
22
+
23
+ feature:
24
+ type: string
25
+ description: "Description of the feature to implement."
26
+
27
+ requirements:
28
+ type: string
29
+ description: "Functional requirements for the feature."
30
+
31
+ constraints:
32
+ type: string
33
+ description: "Architectural or technical constraints."
34
+ default: "Follow existing project conventions and architecture."
35
+
36
+ focus_paths:
37
+ type: array
38
+ description: "Optional paths where new code should be created or modified."
39
+ default: []
40
+
41
+ test_command:
42
+ type: string
43
+ description: "Command to run tests (empty means skip tests step)."
44
+ default: ""
45
+
46
+ notify:
47
+ type: object
48
+ description: "Notification configuration."
49
+ default:
50
+ channel: "stdout" # stdout|webhook|openclaw
51
+ target: ""
52
+ message_prefix: "[ergon-flow]"
53
+
54
+ steps:
55
+
56
+ - id: repo.prepare
57
+ kind: exec
58
+ name: "Prepare repository"
59
+ command: |
60
+ set -euo pipefail
61
+ cd "{{ inputs.repo_path }}"
62
+ git fetch --all --prune
63
+ git checkout "{{ inputs.base_branch }}"
64
+ git pull --ff-only
65
+ git checkout -B "{{ inputs.new_branch }}"
66
+
67
+ - id: analyze
68
+ kind: agent
69
+ name: "Analyze repository"
70
+ provider: openrouter
71
+ model: deepseek/deepseek-v3.2
72
+ output:
73
+ name: analysis
74
+ type: analysis
75
+ prompt: |
76
+ You are an expert software architect.
77
+
78
+ Feature:
79
+ {{ inputs.feature }}
80
+
81
+ Requirements:
82
+ {{ inputs.requirements }}
83
+
84
+ Constraints:
85
+ {{ inputs.constraints }}
86
+
87
+ Focus paths:
88
+ {{ inputs.focus_paths }}
89
+
90
+ Analyze the repository structure and determine the best place to implement the feature.
91
+
92
+ Output structured JSON with:
93
+ - architecture_context
94
+ - affected_modules
95
+ - risks
96
+ - suggested_structure
97
+
98
+ - id: design
99
+ kind: agent
100
+ name: "Design implementation"
101
+ provider: openrouter
102
+ model: moonshotai/kimi-k2.5
103
+ output:
104
+ name: design
105
+ type: plan
106
+ prompt: |
107
+ You are designing a feature implementation.
108
+
109
+ Feature:
110
+ {{ inputs.feature }}
111
+
112
+ Requirements:
113
+ {{ inputs.requirements }}
114
+
115
+ Constraints:
116
+ {{ inputs.constraints }}
117
+
118
+ Repository analysis:
119
+ {{ artifacts.analysis }}
120
+
121
+ Produce structured JSON with:
122
+ - design_summary
123
+ - files_to_create
124
+ - files_to_modify
125
+ - api_interfaces
126
+ - implementation_steps
127
+
128
+ - id: implement
129
+ kind: agent
130
+ name: "Generate code"
131
+ provider: codex
132
+ output:
133
+ name: implement
134
+ type: text
135
+ prompt: |
136
+ You are a coding agent generating a patch.
137
+
138
+ Feature:
139
+ {{ inputs.feature }}
140
+
141
+ Requirements:
142
+ {{ inputs.requirements }}
143
+
144
+ Constraints:
145
+ {{ inputs.constraints }}
146
+
147
+ Design:
148
+ {{ artifacts.design }}
149
+
150
+ Generate a unified diff patch compatible with `git apply`.
151
+
152
+ Output ONLY the diff.
153
+
154
+ - id: patch.apply
155
+ kind: exec
156
+ name: "Apply generated patch"
157
+ command: |
158
+ set -euo pipefail
159
+ cd "{{ inputs.repo_path }}"
160
+ mkdir -p .ergon
161
+ cat > .ergon/codegen.patch <<'PATCH'
162
+ {{ artifacts.implement }}
163
+ PATCH
164
+ git apply --index .ergon/codegen.patch
165
+
166
+ - id: tests.run
167
+ kind: condition
168
+ name: "Should run tests"
169
+ expression: "{{ inputs.test_command }}"
170
+
171
+ - id: tests.exec
172
+ kind: exec
173
+ name: "Execute tests"
174
+ depends_on: [tests.run]
175
+ command: |
176
+ set -euo pipefail
177
+ cd "{{ inputs.repo_path }}"
178
+ {{ inputs.test_command }}
179
+
180
+ - id: review
181
+ kind: agent
182
+ name: "Review generated implementation"
183
+ provider: claude-code
184
+ output:
185
+ name: review
186
+ type: json
187
+ prompt: |
188
+ You are a senior code reviewer.
189
+
190
+ Feature:
191
+ {{ inputs.feature }}
192
+
193
+ Requirements:
194
+ {{ inputs.requirements }}
195
+
196
+ Design:
197
+ {{ artifacts.design }}
198
+
199
+ Patch:
200
+ {{ artifacts.implement }}
201
+
202
+ Test results:
203
+ {{ artifacts.tests.exec.stdout }}
204
+
205
+ Produce structured JSON:
206
+
207
+ - summary
208
+ - risk_assessment
209
+ - issues
210
+ - improvements
211
+ - pr_title
212
+ - pr_body
213
+
214
+ - id: gate
215
+ kind: manual
216
+ name: "Manual review gate"
217
+ message: |
218
+ Feature implementation ready.
219
+
220
+ Suggested PR title:
221
+ {{ artifacts.review.pr_title }}
222
+
223
+ Suggested PR body:
224
+ {{ artifacts.review.pr_body }}
225
+
226
+ Branch:
227
+ {{ inputs.new_branch }}
228
+
229
+ Base:
230
+ {{ inputs.base_branch }}
231
+
232
+ Review and merge if acceptable.
233
+
234
+ - id: notify
235
+ kind: notify
236
+ name: "Notify completion"
237
+ channel: "{{ inputs.notify.channel }}"
238
+ target: "{{ inputs.notify.target }}"
239
+ message: |
240
+ {{ inputs.notify.message_prefix }} Workflow completed: code.codegen
241
+
242
+ Repo: {{ inputs.repo_path }}
243
+ Branch: {{ inputs.new_branch }}
244
+
245
+ Feature:
246
+ {{ inputs.feature }}
247
+
248
+ Summary:
249
+ {{ artifacts.review.summary }}
250
+
251
+ outputs:
252
+ design: artifacts.design
253
+ patch: artifacts.implement
254
+ review: artifacts.review
255
+ branch: inputs.new_branch
256
+ base_branch: inputs.base_branch