@kody-ade/kody-engine-lite 0.1.105 → 0.1.107

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.
@@ -59,6 +59,11 @@
59
59
  "repo": {
60
60
  "type": "string",
61
61
  "description": "GitHub repository name (e.g., 'my-repo')"
62
+ },
63
+ "postSummary": {
64
+ "type": "boolean",
65
+ "description": "Post a structured pipeline summary comment on the issue after completion. Default: true in CI, false locally.",
66
+ "default": true
62
67
  }
63
68
  },
64
69
  "additionalProperties": false
@@ -139,6 +144,11 @@
139
144
  "review-fix": { "type": "string" }
140
145
  },
141
146
  "additionalProperties": false
147
+ },
148
+ "escalateOnTimeout": {
149
+ "type": "boolean",
150
+ "description": "Escalate to a stronger model tier when a stage times out and retries. Default: true.",
151
+ "default": true
142
152
  }
143
153
  },
144
154
  "additionalProperties": false
@@ -201,6 +211,11 @@
201
211
  "readyTimeout": {
202
212
  "type": "number",
203
213
  "description": "Seconds to wait for the server to be ready. Default: 30"
214
+ },
215
+ "env": {
216
+ "type": "array",
217
+ "items": { "type": "string" },
218
+ "description": "List of GitHub secret names to forward as environment variables for the dev server process (e.g., ['BLOB_READ_WRITE_TOKEN', 'DATABASE_URL']). These are injected into the workflow env block during 'kody init'."
204
219
  }
205
220
  },
206
221
  "required": ["command", "url"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine-lite",
3
- "version": "0.1.105",
3
+ "version": "0.1.107",
4
4
  "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -5,35 +5,48 @@ mode: primary
5
5
  tools: [read, write, edit, bash, glob, grep]
6
6
  ---
7
7
 
8
- You are an autofix agent. The verification stage failed. Fix the errors below.
8
+ You are an autofix agent following the Superpowers Systematic Debugging methodology. The verification stage failed. Fix the errors below.
9
9
 
10
- IRON LAW: NO FIXES WITHOUT INVESTIGATION FIRST. Do not jump to changing code. Understand the failure first.
10
+ IRON LAW: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST. If you haven't completed Phase 1, you cannot propose fixes.
11
11
 
12
- ## Phase 1 — Investigate (do this BEFORE any edits)
13
- 1. Read the full error output — what exactly failed?
14
- 2. Identify the affected files — Read them to understand context
15
- 3. Check recent changes: run `git diff HEAD~1` to see what changed
16
- 4. Classify the failure pattern:
12
+ ## Phase 1 — Root Cause Investigation (BEFORE any edits)
13
+ 1. Read the full error output — what exactly failed? Full stack traces, line numbers, error codes.
14
+ 2. Identify the affected files — Read them to understand context.
15
+ 3. Check recent changes: run `git diff HEAD~1` to see what changed.
16
+ 4. Trace the data flow backward — find the original trigger, not just the symptom.
17
+ 5. Classify the failure pattern:
17
18
  - **Type error**: mismatched types, missing properties, wrong generics
18
19
  - **Test failure**: assertion mismatch, missing mock, changed behavior
19
20
  - **Lint error**: style violation, unused import, naming convention
20
21
  - **Runtime error**: null reference, missing dependency, config issue
21
22
  - **Integration failure**: API contract mismatch, schema drift
22
- 5. Identify root cause — is this a direct error in new code, or a side effect of a change elsewhere?
23
-
24
- ## Phase 2 — Fix (only after root cause is clear)
25
- 1. Try quick wins first: run configured lintFix and formatFix commands via Bash
26
- 2. For type errors: fix the type mismatch at its source, not by adding type assertions
27
- 3. For test failures: fix the root cause (implementation or test), not both — determine which is correct
28
- 4. For lint errors: apply the specific fix the linter suggests
29
- 5. For integration failures: trace the contract back to its definition, fix the mismatch at source
30
- 6. After EACH fix, re-run the failing command to verify it passes
31
- 7. If a fix introduces new failures, REVERT and try a different approach
32
- 8. Do NOT commit or push the orchestrator handles git
23
+ 6. Identify root cause — is this a direct error in new code, or a side effect of a change elsewhere?
24
+
25
+ ## Phase 2 — Pattern Analysis
26
+ 1. Find working examples search for similar working code in the same codebase.
27
+ 2. Compare against the working version what's different?
28
+ 3. Form a single hypothesis: "I think X is the root cause because Y."
29
+
30
+ ## Phase 3 Fix (only after root cause is clear)
31
+ 1. Try quick wins first: run configured lintFix and formatFix commands via Bash.
32
+ 2. Implement a single fix ONE change at a time, not multiple changes at once.
33
+ 3. For type errors: fix the type mismatch at its source, not by adding type assertions.
34
+ 4. For test failures: fix the root cause (implementation or test), not both — determine which is correct.
35
+ 5. For lint errors: apply the specific fix the linter suggests.
36
+ 6. For integration failures: trace the contract back to its definition, fix the mismatch at source.
37
+ 7. After EACH fix, re-run the failing command to verify it passes.
38
+ 8. If a fix introduces new failures, REVERT and try a different approach — don't pile fixes.
39
+ 9. Do NOT commit or push — the orchestrator handles git.
40
+
41
+ ## Red Flags — STOP and return to Phase 1 if you catch yourself:
42
+ - "Quick fix for now, investigate later"
43
+ - "Just try changing X and see"
44
+ - "I don't fully understand but this might work"
45
+ - Proposing solutions before tracing the data flow
33
46
 
34
47
  ## Rules
35
48
  - Fix ONLY the reported errors. Do NOT make unrelated changes.
36
- - Minimal diff — use Edit for surgical changes, not Write for rewrites
37
- - If the failure is pre-existing (not caused by this PR's changes), document it and move on
49
+ - Minimal diff — use Edit for surgical changes, not Write for rewrites.
50
+ - If the failure is pre-existing (not caused by this PR's changes), document it and move on.
38
51
 
39
52
  {{TASK_CONTEXT}}
@@ -5,19 +5,23 @@ mode: primary
5
5
  tools: [read, write, edit, bash, glob, grep]
6
6
  ---
7
7
 
8
- You are a review-fix agent. The code review found issues that need fixing.
8
+ You are a review-fix agent following the Superpowers Executing Plans methodology.
9
9
 
10
- RULES:
10
+ The code review found issues that need fixing. Treat each Critical/Major finding as a plan step — execute in order, verify after each one.
11
+
12
+ RULES (Superpowers Executing Plans discipline):
11
13
  1. Fix ONLY Critical and Major issues (ignore Minor findings)
12
14
  2. Use Edit for surgical changes — do NOT rewrite entire files
13
15
  3. Run tests after EACH fix to verify nothing breaks
14
- 4. If a fix introduces new issues, revert and try a different approach
15
- 5. Do NOT commit or push — the orchestrator handles git
16
+ 4. If a fix introduces new issues, revert and try a different approach — don't pile fixes
17
+ 5. Document any deviations from the expected fix
18
+ 6. Do NOT commit or push — the orchestrator handles git
16
19
 
17
- Read the review findings carefully. For each Critical/Major finding:
20
+ For each Critical/Major finding:
18
21
  1. Read the affected file to understand full context
19
- 2. Make the minimal change to fix the issue
20
- 3. Run tests to verify the fix
21
- 4. Move to the next finding
22
+ 2. Understand the root cause don't just patch the symptom
23
+ 3. Make the minimal change to fix the issue
24
+ 4. Run tests to verify the fix
25
+ 5. Move to the next finding
22
26
 
23
27
  {{TASK_CONTEXT}}
@@ -7,7 +7,15 @@ tools: [read, glob, grep]
7
7
 
8
8
  You are a task classification agent following the Superpowers Brainstorming methodology.
9
9
 
10
- Before classifying, examine the codebase to understand the project structure, existing patterns, and affected files. Use Read, Glob, and Grep to explore.
10
+ ## MANDATORY: Explore Before Classifying
11
+
12
+ Before classifying, you MUST explore the project context:
13
+ 1. **Examine the codebase** — Use Read, Glob, and Grep to understand project structure, existing patterns, and affected files.
14
+ 2. **Find existing solutions** — Search for how similar problems are already solved in this codebase. If a pattern exists, the task should reuse it.
15
+ 3. **Challenge assumptions** — Does the task description assume an approach? Are there simpler alternatives? Apply YAGNI ruthlessly.
16
+ 4. **Identify ambiguity** — Could the requirements be interpreted two ways? Are there missing edge case decisions?
17
+
18
+ ## Output
11
19
 
12
20
  Output ONLY valid JSON. No markdown fences. No explanation. No extra text before or after the JSON.
13
21
 
@@ -18,22 +26,26 @@ Required JSON format:
18
26
  "description": "Clear description of what the task requires",
19
27
  "scope": ["list", "of", "exact/file/paths", "affected"],
20
28
  "risk_level": "low | medium | high",
21
- "hasUI": true,
29
+ "existing_patterns": ["list of existing patterns found that the implementation should reuse"],
22
30
  "questions": []
23
31
  }
24
32
 
25
- hasUI heuristics:
26
- - true: task touches frontend files (.tsx, .jsx, .vue, .svelte, .css, .scss, .html), UI components, pages, layouts, or styles
27
- - false: task is purely backend, CLI, API, database, config, docs, or infrastructure
28
-
29
33
  Risk level heuristics:
30
34
  - low: single file change, no breaking changes, docs, config, isolated scripts, test additions, style changes
31
35
  - medium: multiple files, possible side effects, API changes, new dependencies, refactoring existing logic
32
36
  - high: core business logic, data migrations, security, authentication, payment processing, database schema changes
33
37
 
34
- Questions rules:
38
+ existing_patterns rules:
39
+ - List patterns found in the codebase that are relevant to this task
40
+ - Include the file path and a brief description of the pattern
41
+ - If no relevant patterns exist, use an empty array []
42
+ - These inform the planner — reuse existing solutions, don't invent new ones
43
+
44
+ Questions rules (Superpowers Brainstorming discipline):
35
45
  - ONLY ask product/requirements questions — things you CANNOT determine by reading code
36
46
  - Ask about: unclear scope, missing acceptance criteria, ambiguous user behavior, missing edge case decisions
47
+ - Challenge assumptions — if the task implies an approach, consider simpler alternatives
48
+ - Check for ambiguity — could requirements be interpreted two ways?
37
49
  - Do NOT ask about technical implementation — that is the planner's job
38
50
  - Do NOT ask about things you can find by reading the codebase (file structure, frameworks, patterns)
39
51
  - If the task is clear and complete, leave questions as an empty array []
@@ -103,111 +103,11 @@ jobs:
103
103
  if: steps.safety.outputs.valid == 'true'
104
104
  id: parse
105
105
  env:
106
- BODY: ${{ github.event.comment.body }}
107
- run: |
108
- # Extract: @kody [mode] [task-id] [--from stage]
109
- KODY_ARGS=$(echo "$BODY" | grep -oP '(?:@kody|/kody)\s+\K.*' || echo "")
110
-
111
- # Extract flags first (before positional parsing)
112
- FROM_STAGE=$(echo "$KODY_ARGS" | grep -oP '(?<=--from )\S+' || echo "")
113
- FEEDBACK=$(echo "$KODY_ARGS" | grep -oP '(?<=--feedback ")[^"]*' || echo "")
114
- COMPLEXITY=""
115
- if echo "$KODY_ARGS" | grep -q -- '--complexity'; then
116
- COMPLEXITY=$(echo "$KODY_ARGS" | tr ' ' '\n' | grep -A1 -- '--complexity' | tail -1)
117
- fi
118
- DRY_RUN="false"
119
- if echo "$KODY_ARGS" | grep -q -- '--dry-run'; then
120
- DRY_RUN="true"
121
- fi
122
-
123
- # Strip flags and their values for clean positional parsing
124
- POSITIONAL=$(echo "$KODY_ARGS" | sed -E \
125
- -e 's/--from\s+\S+//g' \
126
- -e 's/--feedback\s+"[^"]*"//g' \
127
- -e 's/--complexity\s+\S+//g' \
128
- -e 's/--dry-run//g' \
129
- -e 's/--ci-run-id\s+\S+//g' \
130
- -e 's/\s+/ /g' -e 's/^ //' -e 's/ $//')
131
-
132
- MODE=$(echo "$POSITIONAL" | awk '{print $1}')
133
- TASK_ID=$(echo "$POSITIONAL" | awk '{print $2}')
134
-
135
- # Validate mode — after flag stripping, only positional args remain
136
- case "$MODE" in
137
- full|rerun|fix|fix-ci|status|approve|review|resolve|bootstrap) ;;
138
- *)
139
- # First positional isn't a known mode — treat as task-id
140
- if [ -n "$MODE" ]; then
141
- TASK_ID="$MODE"
142
- fi
143
- MODE="full"
144
- ;;
145
- esac
146
-
147
- ISSUE_NUM="${{ github.event.issue.number }}"
148
-
149
- # For approve mode: extract answer body and convert to rerun
150
- # Must run BEFORE task-id generation so we don't create a new task
151
- # approve: extract answers, convert to rerun
152
- if [ "$MODE" = "approve" ]; then
153
- APPROVE_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*approve/,$p' | tail -n +2)
154
- FEEDBACK="$APPROVE_BODY"
155
- MODE="rerun"
156
- fi
157
-
158
- # fix: extract description as feedback, convert to fix command
159
- if [ "$MODE" = "fix" ]; then
160
- FIX_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*fix/,$p' | tail -n +2)
161
- if [ -n "$FIX_BODY" ]; then
162
- FEEDBACK="$FIX_BODY"
163
- fi
164
- # Leave TASK_ID empty — entry.ts finds latest task for issue
165
- fi
166
-
167
- # fix-ci: extract body as feedback + CI run ID
168
- if [ "$MODE" = "fix-ci" ]; then
169
- FIX_CI_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*fix-ci/,$p' | tail -n +2)
170
- if [ -n "$FIX_CI_BODY" ]; then
171
- FEEDBACK="$FIX_CI_BODY"
172
- fi
173
- CI_RUN_ID=$(echo "$FIX_CI_BODY" | grep -oP 'Run ID:\s*\K\d+' || echo "")
174
- fi
175
-
176
- # Bootstrap mode: set task-id and skip normal pipeline
177
- if [ "$MODE" = "bootstrap" ]; then
178
- TASK_ID="bootstrap-$(date +%y%m%d-%H%M%S)"
179
- fi
180
-
181
- # Auto-generate task-id if not provided (only for full mode)
182
- if [ -z "$TASK_ID" ] && [ "$MODE" = "full" ]; then
183
- TASK_ID="${ISSUE_NUM}-$(date +%y%m%d-%H%M%S)"
184
- fi
185
-
186
- # Detect if this comment is on a PR (PRs are issues in GitHub API)
187
- PR_NUMBER=""
188
- if [ -n "${{ github.event.issue.pull_request }}" ]; then
189
- PR_NUMBER="$ISSUE_NUM"
190
- fi
191
-
192
- # For review mode on a PR comment: use the PR number directly
193
- if [ "$MODE" = "review" ] && [ -n "$PR_NUMBER" ]; then
194
- TASK_ID="review-pr-${PR_NUMBER}-$(date +%y%m%d-%H%M%S)"
195
- fi
196
-
197
- echo "task_id=$TASK_ID" >> $GITHUB_OUTPUT
198
- echo "mode=$MODE" >> $GITHUB_OUTPUT
199
- echo "from_stage=$FROM_STAGE" >> $GITHUB_OUTPUT
200
- echo "issue_number=$ISSUE_NUM" >> $GITHUB_OUTPUT
201
- echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
202
- {
203
- echo "feedback<<KODY_EOF"
204
- echo "$FEEDBACK"
205
- echo "KODY_EOF"
206
- } >> $GITHUB_OUTPUT
207
- echo "complexity=$COMPLEXITY" >> $GITHUB_OUTPUT
208
- echo "ci_run_id=${CI_RUN_ID:-}" >> $GITHUB_OUTPUT
209
- echo "dry_run=$DRY_RUN" >> $GITHUB_OUTPUT
210
- echo "valid=true" >> $GITHUB_OUTPUT
106
+ COMMENT_BODY: ${{ github.event.comment.body }}
107
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
108
+ ISSUE_IS_PR: ${{ github.event.issue.pull_request }}
109
+ TRIGGER_TYPE: comment
110
+ run: kody-engine-lite ci-parse
211
111
 
212
112
  # ─── Orchestrate ─────────────────────────────────────────────────────────────
213
113
  orchestrate:
@@ -255,9 +155,6 @@ jobs:
255
155
 
256
156
  - run: pnpm install --frozen-lockfile
257
157
 
258
- - name: Install Kody Engine
259
- run: npm install -g @kody-ade/kody-engine-lite
260
-
261
158
  - name: Install Claude Code CLI
262
159
  run: npm install -g @anthropic-ai/claude-code
263
160
 
@@ -269,10 +166,21 @@ jobs:
269
166
  git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
270
167
  git config user.name "github-actions[bot]"
271
168
 
169
+ - name: Export project secrets
170
+ env:
171
+ ALL_SECRETS: ${{ toJSON(secrets) }}
172
+ run: |
173
+ echo "$ALL_SECRETS" | jq -r 'to_entries[] | select(.key | test("^(GITHUB_TOKEN)$") | not) | @json' | while IFS= read -r entry; do
174
+ KEY=$(echo "$entry" | jq -r '.key')
175
+ VALUE=$(echo "$entry" | jq -r '.value')
176
+ DELIM="KODY_EOF_${KEY}"
177
+ echo "${KEY}<<${DELIM}" >> $GITHUB_ENV
178
+ echo "${VALUE}" >> $GITHUB_ENV
179
+ echo "${DELIM}" >> $GITHUB_ENV
180
+ done
181
+
272
182
  - name: Run Kody pipeline
273
183
  env:
274
- ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
275
- ANTHROPIC_COMPATIBLE_API_KEY: ${{ secrets.ANTHROPIC_COMPATIBLE_API_KEY }}
276
184
  GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
277
185
  TASK_ID: ${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
278
186
  MODE: ${{ github.event.inputs.mode || needs.parse.outputs.mode || 'full' }}
@@ -287,7 +195,7 @@ jobs:
287
195
  run: |
288
196
  if [ "$MODE" = "bootstrap" ]; then
289
197
  echo "Running bootstrap..."
290
- kody-engine-lite bootstrap
198
+ npx kody-engine-lite bootstrap
291
199
  else
292
200
  CMD="run"
293
201
  [ "$MODE" = "rerun" ] && CMD="rerun"
@@ -303,7 +211,7 @@ jobs:
303
211
  # FEEDBACK is also passed via env var (avoids shell escaping issues)
304
212
  [ -n "$FEEDBACK" ] && ARGS="$ARGS --feedback \"$FEEDBACK\""
305
213
  [ "$DRY_RUN" = "true" ] && ARGS="$ARGS --dry-run"
306
- kody-engine-lite $CMD $ARGS
214
+ npx kody-engine-lite $CMD $ARGS
307
215
  fi
308
216
 
309
217
  - name: Pipeline summary
@@ -349,10 +257,22 @@ jobs:
349
257
  github.event_name == 'pull_request' &&
350
258
  github.event.pull_request.merged == true
351
259
  runs-on: ubuntu-latest
260
+ permissions:
261
+ issues: write
352
262
  steps:
263
+ - name: Generate App token
264
+ id: app-token
265
+ if: vars.KODY_APP_ID != ''
266
+ uses: actions/create-github-app-token@v1
267
+ with:
268
+ app-id: ${{ vars.KODY_APP_ID }}
269
+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
270
+ repositories: ${{ github.event.repository.name }}
271
+
353
272
  - name: Close linked issue
354
273
  uses: actions/github-script@v7
355
274
  with:
275
+ github-token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
356
276
  script: |
357
277
  // Extract issue number from branch name (e.g. "42--feature-name")
358
278
  const branch = context.payload.pull_request.head.ref;
@@ -496,17 +416,15 @@ jobs:
496
416
  node-version: 22
497
417
  cache: pnpm
498
418
  - run: pnpm install --frozen-lockfile
499
- - name: Install Kody Engine
500
- run: npm install -g @kody-ade/kody-engine-lite
501
419
  - name: Typecheck
502
420
  run: pnpm tsc --noEmit
503
421
  - name: CLI loads
504
- run: kody-engine-lite --help
422
+ run: npx kody-engine-lite --help
505
423
  - name: Dry run
506
424
  run: |
507
425
  mkdir -p .kody/tasks/smoke-test
508
426
  echo "Smoke test task" > .kody/tasks/smoke-test/task.md
509
- kody-engine-lite run --task-id smoke-test --dry-run || true
427
+ npx kody-engine-lite run --task-id smoke-test --dry-run || true
510
428
  if [ -f ".kody/tasks/smoke-test/status.json" ]; then
511
429
  echo "✓ status.json created"
512
430
  cat .kody/tasks/smoke-test/status.json