@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,252 @@
1
+
2
+ workflow:
3
+ id: code.docs_update
4
+ version: 1
5
+ description: "Update or generate project documentation: analyze code → plan docs → write/update docs → optional validation → review → manual gate → notify."
6
+ author: "ergon-flow"
7
+ tags: ["docs", "documentation", "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 documentation updates (e.g., docs/update-architecture)."
22
+
23
+ objective:
24
+ type: string
25
+ description: "Goal of the documentation update (e.g., update architecture docs, add API documentation)."
26
+
27
+ constraints:
28
+ type: string
29
+ description: "Documentation constraints or style guidelines."
30
+ default: "Follow existing documentation style and structure. Prefer concise and accurate explanations."
31
+
32
+ focus_paths:
33
+ type: array
34
+ description: "Optional documentation paths to focus on (e.g., docs/, README.md)."
35
+ default: []
36
+
37
+ validation_command:
38
+ type: string
39
+ description: "Optional command to validate documentation (lint, build docs, etc.)."
40
+ default: ""
41
+
42
+ notify:
43
+ type: object
44
+ description: "Notification backend configuration."
45
+ default:
46
+ channel: "stdout" # stdout|webhook|openclaw
47
+ target: ""
48
+ message_prefix: "[ergon-flow]"
49
+
50
+ steps:
51
+
52
+ - id: repo.prepare
53
+ kind: exec
54
+ name: "Prepare repository"
55
+ description: "Checkout base branch and create documentation update branch."
56
+ command: |
57
+ set -euo pipefail
58
+ cd "{{ inputs.repo_path }}"
59
+ git fetch --all --prune
60
+ git checkout "{{ inputs.base_branch }}"
61
+ git pull --ff-only
62
+ git checkout -B "{{ inputs.new_branch }}"
63
+
64
+ - id: analyze
65
+ kind: agent
66
+ name: "Analyze documentation and codebase"
67
+ provider: openrouter
68
+ model: deepseek/deepseek-v3.2
69
+ output:
70
+ name: analysis
71
+ type: analysis
72
+ prompt: |
73
+ You are a documentation architect.
74
+
75
+ Objective:
76
+ {{ inputs.objective }}
77
+
78
+ Constraints:
79
+ {{ inputs.constraints }}
80
+
81
+ Focus paths:
82
+ {{ inputs.focus_paths }}
83
+
84
+ Analyze the repository documentation and determine:
85
+
86
+ - documentation gaps
87
+ - outdated sections
88
+ - missing explanations
89
+ - sections needing improvement
90
+
91
+ Produce structured JSON with keys:
92
+
93
+ - summary
94
+ - gaps
95
+ - outdated_sections
96
+ - proposed_updates
97
+
98
+ - id: plan
99
+ kind: agent
100
+ name: "Plan documentation changes"
101
+ provider: openrouter
102
+ model: moonshotai/kimi-k2.5
103
+ output:
104
+ name: plan
105
+ type: plan
106
+ prompt: |
107
+ Create a documentation update plan.
108
+
109
+ Objective:
110
+ {{ inputs.objective }}
111
+
112
+ Analysis:
113
+ {{ artifacts.analysis }}
114
+
115
+ Constraints:
116
+ {{ inputs.constraints }}
117
+
118
+ Produce structured JSON with:
119
+
120
+ - documentation_strategy
121
+ - files_to_create
122
+ - files_to_update
123
+ - sections_to_modify
124
+ - writing_guidelines
125
+
126
+ - id: generate
127
+ kind: agent
128
+ name: "Generate documentation updates"
129
+ provider: claude-code
130
+ output:
131
+ name: generate
132
+ type: text
133
+ prompt: |
134
+ You are a senior technical writer.
135
+
136
+ Objective:
137
+ {{ inputs.objective }}
138
+
139
+ Documentation plan:
140
+ {{ artifacts.plan }}
141
+
142
+ Constraints:
143
+ {{ inputs.constraints }}
144
+
145
+ Generate a unified diff patch that updates the documentation accordingly.
146
+
147
+ Requirements:
148
+
149
+ - Output ONLY a git-compatible unified diff
150
+ - Maintain documentation consistency
151
+ - Avoid unnecessary changes
152
+
153
+ - id: patch.apply
154
+ kind: exec
155
+ name: "Apply documentation patch"
156
+ command: |
157
+ set -euo pipefail
158
+ cd "{{ inputs.repo_path }}"
159
+ mkdir -p .ergon
160
+ cat > .ergon/docs.patch <<'PATCH'
161
+ {{ artifacts.generate }}
162
+ PATCH
163
+ git apply --index .ergon/docs.patch
164
+
165
+ - id: validate.should
166
+ kind: condition
167
+ name: "Should validate docs?"
168
+ expression: "{{ inputs.validation_command }}"
169
+
170
+ - id: docs.validate
171
+ kind: exec
172
+ name: "Validate documentation"
173
+ depends_on: [validate.should]
174
+ command: |
175
+ set -euo pipefail
176
+ cd "{{ inputs.repo_path }}"
177
+ {{ inputs.validation_command }}
178
+
179
+ - id: review
180
+ kind: agent
181
+ name: "Review documentation changes"
182
+ provider: openrouter
183
+ model: moonshotai/kimi-k2.5
184
+ output:
185
+ name: review
186
+ type: json
187
+ prompt: |
188
+ You are reviewing documentation updates.
189
+
190
+ Objective:
191
+ {{ inputs.objective }}
192
+
193
+ Documentation plan:
194
+ {{ artifacts.plan }}
195
+
196
+ Patch:
197
+ {{ artifacts.generate }}
198
+
199
+ Validation output:
200
+ {{ artifacts.docs.validate.stdout }}
201
+
202
+ Produce structured JSON with keys:
203
+
204
+ - summary
205
+ - quality_assessment
206
+ - improvements
207
+ - pr_title
208
+ - pr_body
209
+
210
+ - id: gate
211
+ kind: manual
212
+ name: "Manual review gate"
213
+ message: |
214
+ Documentation update ready.
215
+
216
+ Suggested PR title:
217
+ {{ artifacts.review.pr_title }}
218
+
219
+ Suggested PR body:
220
+ {{ artifacts.review.pr_body }}
221
+
222
+ Branch:
223
+ {{ inputs.new_branch }}
224
+
225
+ Base branch:
226
+ {{ inputs.base_branch }}
227
+
228
+ Review and merge if acceptable.
229
+
230
+ - id: notify
231
+ kind: notify
232
+ name: "Notify completion"
233
+ channel: "{{ inputs.notify.channel }}"
234
+ target: "{{ inputs.notify.target }}"
235
+ message: |
236
+ {{ inputs.notify.message_prefix }} Workflow completed: code.docs_update
237
+
238
+ Repo: {{ inputs.repo_path }}
239
+ Branch: {{ inputs.new_branch }}
240
+
241
+ Objective:
242
+ {{ inputs.objective }}
243
+
244
+ Summary:
245
+ {{ artifacts.review.summary }}
246
+
247
+ outputs:
248
+ plan: artifacts.plan
249
+ patch: artifacts.generate
250
+ review: artifacts.review
251
+ branch: inputs.new_branch
252
+ base_branch: inputs.base_branch
@@ -0,0 +1,264 @@
1
+
2
+ workflow:
3
+ id: code.hotfix
4
+ version: 1
5
+ description: "Apply a targeted hotfix: analyze failure → design minimal fix → generate patch → tests → review → manual gate → notify."
6
+ author: "ergon-flow"
7
+ tags: ["code", "hotfix", "bugfix", "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 or release branch)."
17
+ default: "main"
18
+
19
+ new_branch:
20
+ type: string
21
+ description: "Branch to create for the hotfix (e.g., hotfix/null-pointer-crash)."
22
+
23
+ issue:
24
+ type: string
25
+ description: "Description of the bug, failure, or incident being fixed."
26
+
27
+ context:
28
+ type: string
29
+ description: "Additional context such as stack traces, logs, or reproduction steps."
30
+ default: ""
31
+
32
+ constraints:
33
+ type: string
34
+ description: "Constraints for the fix (e.g., minimal change, no API changes, backport safe)."
35
+ default: "Implement the smallest safe fix. Avoid refactors or unrelated changes."
36
+
37
+ focus_paths:
38
+ type: array
39
+ description: "Optional list of paths where the issue likely exists."
40
+ default: []
41
+
42
+ test_command:
43
+ type: string
44
+ description: "Command to run tests (empty means skip tests step)."
45
+ default: ""
46
+
47
+ notify:
48
+ type: object
49
+ description: "Notification backend configuration."
50
+ default:
51
+ channel: "stdout" # stdout|webhook|openclaw
52
+ target: ""
53
+ message_prefix: "[ergon-flow]"
54
+
55
+ steps:
56
+
57
+ - id: repo.prepare
58
+ kind: exec
59
+ name: "Prepare repository"
60
+ description: "Checkout base branch and create hotfix branch."
61
+ command: |
62
+ set -euo pipefail
63
+ cd "{{ inputs.repo_path }}"
64
+ git fetch --all --prune
65
+ git checkout "{{ inputs.base_branch }}"
66
+ git pull --ff-only
67
+ git checkout -B "{{ inputs.new_branch }}"
68
+
69
+ - id: analyze
70
+ kind: agent
71
+ name: "Analyze bug and code"
72
+ provider: openrouter
73
+ model: deepseek/deepseek-v3.2
74
+ output:
75
+ name: analysis
76
+ type: analysis
77
+ prompt: |
78
+ You are investigating a production bug.
79
+
80
+ Issue description:
81
+ {{ inputs.issue }}
82
+
83
+ Context (logs, stack traces, reproduction):
84
+ {{ inputs.context }}
85
+
86
+ Constraints:
87
+ {{ inputs.constraints }}
88
+
89
+ Focus paths:
90
+ {{ inputs.focus_paths }}
91
+
92
+ Determine:
93
+
94
+ - likely root cause
95
+ - affected components
96
+ - minimal safe fix strategy
97
+ - files likely involved
98
+
99
+ Produce structured JSON with keys:
100
+
101
+ - root_cause
102
+ - affected_components
103
+ - fix_strategy
104
+ - files
105
+ - risks
106
+
107
+ - id: design
108
+ kind: agent
109
+ name: "Design minimal fix"
110
+ provider: openrouter
111
+ model: moonshotai/kimi-k2.5
112
+ output:
113
+ name: design
114
+ type: plan
115
+ prompt: |
116
+ You are designing a minimal hotfix.
117
+
118
+ Issue:
119
+ {{ inputs.issue }}
120
+
121
+ Analysis:
122
+ {{ artifacts.analysis }}
123
+
124
+ Constraints:
125
+ {{ inputs.constraints }}
126
+
127
+ Produce structured JSON with:
128
+
129
+ - fix_summary
130
+ - changes
131
+ - files_to_modify
132
+ - verification_steps
133
+
134
+ Ensure the fix is minimal and safe for production.
135
+
136
+ - id: patch
137
+ kind: agent
138
+ name: "Generate hotfix patch"
139
+ provider: codex
140
+ output:
141
+ name: patch
142
+ type: text
143
+ prompt: |
144
+ You are a coding agent generating a minimal bugfix.
145
+
146
+ Issue:
147
+ {{ inputs.issue }}
148
+
149
+ Fix design:
150
+ {{ artifacts.design }}
151
+
152
+ Constraints:
153
+ {{ inputs.constraints }}
154
+
155
+ Generate a unified diff patch compatible with `git apply`.
156
+
157
+ Rules:
158
+
159
+ - Output ONLY the patch
160
+ - Keep the change minimal
161
+ - Avoid unrelated refactors
162
+
163
+ - id: patch.apply
164
+ kind: exec
165
+ name: "Apply patch"
166
+ command: |
167
+ set -euo pipefail
168
+ cd "{{ inputs.repo_path }}"
169
+ mkdir -p .ergon
170
+ cat > .ergon/hotfix.patch <<'PATCH'
171
+ {{ artifacts.patch }}
172
+ PATCH
173
+ git apply --index .ergon/hotfix.patch
174
+
175
+ - id: tests.should
176
+ kind: condition
177
+ name: "Should run tests?"
178
+ expression: "{{ inputs.test_command }}"
179
+
180
+ - id: tests.exec
181
+ kind: exec
182
+ name: "Run tests"
183
+ depends_on: [tests.should]
184
+ command: |
185
+ set -euo pipefail
186
+ cd "{{ inputs.repo_path }}"
187
+ {{ inputs.test_command }}
188
+
189
+ - id: review
190
+ kind: agent
191
+ name: "Review hotfix"
192
+ provider: claude-code
193
+ output:
194
+ name: review
195
+ type: json
196
+ prompt: |
197
+ You are reviewing a production hotfix.
198
+
199
+ Issue:
200
+ {{ inputs.issue }}
201
+
202
+ Analysis:
203
+ {{ artifacts.analysis }}
204
+
205
+ Fix design:
206
+ {{ artifacts.design }}
207
+
208
+ Patch:
209
+ {{ artifacts.patch }}
210
+
211
+ Test results:
212
+ {{ artifacts.tests.exec.stdout }}
213
+
214
+ Produce structured JSON with:
215
+
216
+ - summary
217
+ - risk_assessment
218
+ - follow_up_actions
219
+ - pr_title
220
+ - pr_body
221
+
222
+ - id: gate
223
+ kind: manual
224
+ name: "Manual review gate"
225
+ message: |
226
+ Hotfix branch ready for review.
227
+
228
+ Suggested PR title:
229
+ {{ artifacts.review.pr_title }}
230
+
231
+ Suggested PR body:
232
+ {{ artifacts.review.pr_body }}
233
+
234
+ Branch:
235
+ {{ inputs.new_branch }}
236
+
237
+ Base branch:
238
+ {{ inputs.base_branch }}
239
+
240
+ Review carefully before merging.
241
+
242
+ - id: notify
243
+ kind: notify
244
+ name: "Notify completion"
245
+ channel: "{{ inputs.notify.channel }}"
246
+ target: "{{ inputs.notify.target }}"
247
+ message: |
248
+ {{ inputs.notify.message_prefix }} Workflow completed: code.hotfix
249
+
250
+ Repo: {{ inputs.repo_path }}
251
+ Branch: {{ inputs.new_branch }}
252
+
253
+ Issue:
254
+ {{ inputs.issue }}
255
+
256
+ Summary:
257
+ {{ artifacts.review.summary }}
258
+
259
+ outputs:
260
+ design: artifacts.design
261
+ patch: artifacts.patch
262
+ review: artifacts.review
263
+ branch: inputs.new_branch
264
+ base_branch: inputs.base_branch