@kody-ade/kody-engine-lite 0.1.55 → 0.1.56

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 (74) hide show
  1. package/dist/agent-runner.d.ts +4 -0
  2. package/dist/agent-runner.js +122 -0
  3. package/dist/bin/cli.js +422 -477
  4. package/dist/ci/parse-inputs.d.ts +6 -0
  5. package/dist/ci/parse-inputs.js +76 -0
  6. package/dist/ci/parse-safety.d.ts +6 -0
  7. package/dist/ci/parse-safety.js +22 -0
  8. package/dist/cli/args.d.ts +13 -0
  9. package/dist/cli/args.js +42 -0
  10. package/dist/cli/litellm.d.ts +2 -0
  11. package/dist/cli/litellm.js +85 -0
  12. package/dist/cli/task-resolution.d.ts +2 -0
  13. package/dist/cli/task-resolution.js +41 -0
  14. package/dist/config.d.ts +49 -0
  15. package/dist/config.js +72 -0
  16. package/dist/context.d.ts +4 -0
  17. package/dist/context.js +83 -0
  18. package/dist/definitions.d.ts +3 -0
  19. package/dist/definitions.js +59 -0
  20. package/dist/entry.d.ts +1 -0
  21. package/dist/entry.js +236 -0
  22. package/dist/git-utils.d.ts +13 -0
  23. package/dist/git-utils.js +174 -0
  24. package/dist/github-api.d.ts +14 -0
  25. package/dist/github-api.js +114 -0
  26. package/dist/kody-utils.d.ts +1 -0
  27. package/dist/kody-utils.js +9 -0
  28. package/dist/learning/auto-learn.d.ts +2 -0
  29. package/dist/learning/auto-learn.js +169 -0
  30. package/dist/logger.d.ts +14 -0
  31. package/dist/logger.js +51 -0
  32. package/dist/memory.d.ts +1 -0
  33. package/dist/memory.js +20 -0
  34. package/dist/observer.d.ts +9 -0
  35. package/dist/observer.js +80 -0
  36. package/dist/pipeline/complexity.d.ts +3 -0
  37. package/dist/pipeline/complexity.js +12 -0
  38. package/dist/pipeline/executor-registry.d.ts +3 -0
  39. package/dist/pipeline/executor-registry.js +20 -0
  40. package/dist/pipeline/hooks.d.ts +17 -0
  41. package/dist/pipeline/hooks.js +110 -0
  42. package/dist/pipeline/questions.d.ts +2 -0
  43. package/dist/pipeline/questions.js +44 -0
  44. package/dist/pipeline/runner-selection.d.ts +2 -0
  45. package/dist/pipeline/runner-selection.js +13 -0
  46. package/dist/pipeline/state.d.ts +4 -0
  47. package/dist/pipeline/state.js +37 -0
  48. package/dist/pipeline.d.ts +3 -0
  49. package/dist/pipeline.js +213 -0
  50. package/dist/preflight.d.ts +1 -0
  51. package/dist/preflight.js +69 -0
  52. package/dist/retrospective.d.ts +26 -0
  53. package/dist/retrospective.js +211 -0
  54. package/dist/stages/agent.d.ts +2 -0
  55. package/dist/stages/agent.js +94 -0
  56. package/dist/stages/gate.d.ts +2 -0
  57. package/dist/stages/gate.js +32 -0
  58. package/dist/stages/review.d.ts +2 -0
  59. package/dist/stages/review.js +32 -0
  60. package/dist/stages/ship.d.ts +3 -0
  61. package/dist/stages/ship.js +154 -0
  62. package/dist/stages/verify.d.ts +2 -0
  63. package/dist/stages/verify.js +94 -0
  64. package/dist/types.d.ts +61 -0
  65. package/dist/types.js +1 -0
  66. package/dist/validators.d.ts +8 -0
  67. package/dist/validators.js +42 -0
  68. package/dist/verify-runner.d.ts +11 -0
  69. package/dist/verify-runner.js +110 -0
  70. package/kody.config.schema.json +2 -2
  71. package/package.json +1 -1
  72. package/prompts/autofix.md +9 -27
  73. package/prompts/review.md +16 -83
  74. package/templates/kody.yml +29 -19
package/prompts/review.md CHANGED
@@ -5,10 +5,9 @@ mode: primary
5
5
  tools: [read, glob, grep, bash]
6
6
  ---
7
7
 
8
- You are a code review agent following the Superpowers Structured Review methodology.
8
+ You are a code review agent. Review all changes made for the task described below.
9
9
 
10
10
  Use Bash to run `git diff` to see what changed. Use Read to examine modified files in full context.
11
- When the diff introduces new enum values, status strings, or type constants — use Grep to trace ALL consumers outside the diff.
12
11
 
13
12
  CRITICAL: You MUST output a structured review in the EXACT format below. Do NOT output conversational text, status updates, or summaries. Your entire output must be the structured review markdown.
14
13
 
@@ -22,94 +21,28 @@ Output markdown with this EXACT structure:
22
21
  ## Findings
23
22
 
24
23
  ### Critical
24
+ <Security vulnerabilities, data loss risks, crashes, broken authentication>
25
25
  <If none: "None.">
26
26
 
27
27
  ### Major
28
+ <Logic errors, missing edge cases, broken tests, significant performance issues, missing error handling>
28
29
  <If none: "None.">
29
30
 
30
31
  ### Minor
32
+ <Style issues, naming improvements, readability, trivial performance, minor refactoring opportunities>
31
33
  <If none: "None.">
32
34
 
33
- For each finding use: `file:line` — problem description. Suggested fix.
34
-
35
- ---
36
-
37
- ## Two-Pass Review
38
-
39
- **Pass 1 CRITICAL (must fix before merge):**
40
-
41
- ### SQL & Data Safety
42
- - String interpolation in SQL — use parameterized queries even for `.to_i`/`.to_f` values
43
- - TOCTOU races: check-then-set patterns that should be atomic `WHERE` + update
44
- - Bypassing model validations via direct DB writes (e.g., `update_column`, raw queries)
45
- - N+1 queries: missing eager loading for associations used in loops/views
46
-
47
- ### Race Conditions & Concurrency
48
- - Read-check-write without uniqueness constraint or duplicate key handling
49
- - find-or-create without unique DB index — concurrent calls create duplicates
50
- - Status transitions without atomic `WHERE old_status = ? UPDATE SET new_status`
51
- - Unsafe HTML rendering (`dangerouslySetInnerHTML`, `v-html`, `.html_safe`) on user-controlled data (XSS)
52
-
53
- ### LLM Output Trust Boundary
54
- - LLM-generated values (emails, URLs, names) written to DB without format validation
55
- - Structured tool output accepted without type/shape checks before DB writes
56
- - LLM-generated URLs fetched without allowlist — SSRF risk
57
- - LLM output stored in vector DBs without sanitization — stored prompt injection risk
58
-
59
- ### Shell Injection
60
- - `subprocess.run()` / `os.system()` with `shell=True` AND string interpolation — use argument arrays
61
- - `eval()` / `exec()` on LLM-generated code without sandboxing
62
-
63
- ### Enum & Value Completeness
64
- When the diff introduces a new enum value, status string, tier name, or type constant:
65
- - Trace it through every consumer (READ each file that switches/filters on that value)
66
- - Check allowlists/filter arrays containing sibling values
67
- - Check `case`/`if-elsif` chains — does the new value fall through to a wrong default?
68
-
69
- **Pass 2 — INFORMATIONAL (should review, may auto-fix):**
70
-
71
- ### Conditional Side Effects
72
- - Code paths that branch but forget a side effect on one branch (e.g., promoted but URL only attached conditionally)
73
- - Log messages claiming an action happened when it was conditionally skipped
74
-
75
- ### Test Gaps
76
- - Negative-path tests asserting type/status but not side effects
77
- - Security enforcement features (blocking, rate limiting, auth) without integration tests
78
- - Missing `.expects(:something).never` when a path should NOT call an external service
79
-
80
- ### Dead Code & Consistency
81
- - Variables assigned but never read
82
- - Comments/docstrings describing old behavior after code changed
83
- - Version mismatch between PR title and VERSION/CHANGELOG
84
-
85
- ### Crypto & Entropy
86
- - Truncation instead of hashing — less entropy, easier collisions
87
- - `rand()` / `Math.random()` for security-sensitive values — use crypto-secure alternatives
88
- - Non-constant-time comparisons (`==`) on secrets or tokens — timing attack risk
89
-
90
- ### Performance & Bundle Impact
91
- - Known-heavy dependencies added: moment.js (→ date-fns), full lodash (→ lodash-es), jquery
92
- - Images without `loading="lazy"` or explicit dimensions (CLS)
93
- - `useEffect` fetch waterfalls — combine or parallelize
94
- - Synchronous `<script>` without async/defer
95
-
96
- ### Type Coercion at Boundaries
97
- - Values crossing language/serialization boundaries where type could change (numeric vs string)
98
- - Hash/digest inputs without `.toString()` normalization before serialization
99
-
100
- ---
101
-
102
- ## Severity Definitions
103
-
104
- - **Critical**: Security vulnerability, data loss, application crash, broken authentication, injection risk, race condition. MUST fix before merge.
105
- - **Major**: Logic error, missing edge case, broken test, significant performance issue, missing input validation, enum completeness gap. SHOULD fix before merge.
106
- - **Minor**: Style issue, naming improvement, readability, micro-optimization, stale comments. NICE to fix, not blocking.
107
-
108
- ## Suppressions — do NOT flag these:
109
- - Redundancy that aids readability
110
- - "Add a comment explaining this threshold" — thresholds change, comments rot
111
- - Consistency-only changes with no behavioral impact
112
- - Issues already addressed in the diff you are reviewing — read the FULL diff first
113
- - devDependencies additions (no production impact)
35
+ Severity definitions:
36
+ - **Critical**: Security vulnerability, data loss, application crash, broken authentication, injection risk. MUST fix before merge.
37
+ - **Major**: Logic error, missing edge case, broken test, significant performance issue, missing input validation. SHOULD fix before merge.
38
+ - **Minor**: Style issue, naming improvement, readability, micro-optimization. NICE to fix, not blocking.
39
+
40
+ Review checklist:
41
+ - [ ] Does the code match the plan?
42
+ - [ ] Are edge cases handled?
43
+ - [ ] Are there security concerns?
44
+ - [ ] Are tests adequate?
45
+ - [ ] Is error handling proper?
46
+ - [ ] Are there any hardcoded values that should be configurable?
114
47
 
115
48
  {{TASK_CONTEXT}}
@@ -109,7 +109,7 @@ jobs:
109
109
 
110
110
  # Validate mode
111
111
  case "$MODE" in
112
- full|rerun|fix|status|approve|review) ;;
112
+ full|rerun|fix|status|approve|review|bootstrap) ;;
113
113
  *)
114
114
  # If first arg isn't a mode, it might be a task-id or nothing
115
115
  if [ -n "$MODE" ] && [ "$MODE" != "" ]; then
@@ -139,6 +139,11 @@ jobs:
139
139
  # Leave TASK_ID empty — entry.ts finds latest task for issue
140
140
  fi
141
141
 
142
+ # Bootstrap mode: set task-id and skip normal pipeline
143
+ if [ "$MODE" = "bootstrap" ]; then
144
+ TASK_ID="bootstrap-$(date +%y%m%d-%H%M%S)"
145
+ fi
146
+
142
147
  # Auto-generate task-id if not provided (only for full mode)
143
148
  if [ -z "$TASK_ID" ] && [ "$MODE" = "full" ]; then
144
149
  TASK_ID="${ISSUE_NUM}-$(date +%y%m%d-%H%M%S)"
@@ -237,23 +242,28 @@ jobs:
237
242
  DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
238
243
  RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
239
244
  run: |
240
- CMD="run"
241
- [ "$MODE" = "rerun" ] && CMD="rerun"
242
- [ "$MODE" = "fix" ] && CMD="fix"
243
- [ "$MODE" = "review" ] && CMD="review"
244
- ARGS="--issue-number $ISSUE_NUMBER"
245
- [ -n "$TASK_ID" ] && ARGS="$ARGS --task-id $TASK_ID"
246
- [ -n "$PR_NUMBER" ] && ARGS="$ARGS --pr-number $PR_NUMBER"
247
- [ -n "$FROM_STAGE" ] && ARGS="$ARGS --from $FROM_STAGE"
248
- [ -n "$FEEDBACK" ] && ARGS="$ARGS --feedback \"$FEEDBACK\""
249
- [ "$DRY_RUN" = "true" ] && ARGS="$ARGS --dry-run"
250
- kody-engine-lite $CMD $ARGS
245
+ if [ "$MODE" = "bootstrap" ]; then
246
+ echo "Running bootstrap..."
247
+ kody-engine-lite bootstrap
248
+ else
249
+ CMD="run"
250
+ [ "$MODE" = "rerun" ] && CMD="rerun"
251
+ [ "$MODE" = "fix" ] && CMD="fix"
252
+ [ "$MODE" = "review" ] && CMD="review"
253
+ ARGS="--issue-number $ISSUE_NUMBER"
254
+ [ -n "$TASK_ID" ] && ARGS="$ARGS --task-id $TASK_ID"
255
+ [ -n "$PR_NUMBER" ] && ARGS="$ARGS --pr-number $PR_NUMBER"
256
+ [ -n "$FROM_STAGE" ] && ARGS="$ARGS --from $FROM_STAGE"
257
+ [ -n "$FEEDBACK" ] && ARGS="$ARGS --feedback \"$FEEDBACK\""
258
+ [ "$DRY_RUN" = "true" ] && ARGS="$ARGS --dry-run"
259
+ kody-engine-lite $CMD $ARGS
260
+ fi
251
261
 
252
262
  - name: Pipeline summary
253
263
  if: always()
254
264
  run: |
255
265
  TASK_ID="${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}"
256
- STATUS_FILE=".kody/tasks/${TASK_ID}/status.json"
266
+ STATUS_FILE=".tasks/${TASK_ID}/status.json"
257
267
  if [ -f "$STATUS_FILE" ]; then
258
268
  STATE=$(jq -r '.state' "$STATUS_FILE")
259
269
  ICON="❌"
@@ -282,7 +292,7 @@ jobs:
282
292
  uses: actions/upload-artifact@v4
283
293
  with:
284
294
  name: kody-tasks-${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
285
- path: .kody/tasks/
295
+ path: .tasks/
286
296
  retention-days: 7
287
297
 
288
298
  # ─── Error Notifications ─────────────────────────────────────────────────────
@@ -345,11 +355,11 @@ jobs:
345
355
  run: kody-engine-lite --help
346
356
  - name: Dry run
347
357
  run: |
348
- mkdir -p .kody/tasks/smoke-test
349
- echo "Smoke test task" > .kody/tasks/smoke-test/task.md
358
+ mkdir -p .tasks/smoke-test
359
+ echo "Smoke test task" > .tasks/smoke-test/task.md
350
360
  kody-engine-lite run --task-id smoke-test --dry-run || true
351
- if [ -f ".kody/tasks/smoke-test/status.json" ]; then
361
+ if [ -f ".tasks/smoke-test/status.json" ]; then
352
362
  echo "✓ status.json created"
353
- cat .kody/tasks/smoke-test/status.json
363
+ cat .tasks/smoke-test/status.json
354
364
  fi
355
- rm -rf .kody/tasks/smoke-test
365
+ rm -rf .tasks/smoke-test