@kody-ade/kody-engine-lite 0.1.52 → 0.1.54

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.
package/dist/bin/cli.js CHANGED
@@ -300,7 +300,7 @@ var init_config = __esm({
300
300
  repo: ""
301
301
  },
302
302
  paths: {
303
- taskDir: ".tasks"
303
+ taskDir: ".kody/tasks"
304
304
  },
305
305
  agent: {
306
306
  runner: "claude-code",
@@ -1601,6 +1601,20 @@ function executeShipStage(ctx, _def) {
1601
1601
  try {
1602
1602
  const head = getCurrentBranch(ctx.projectDir);
1603
1603
  const base = getDefaultBranch(ctx.projectDir);
1604
+ try {
1605
+ execFileSync7("git", ["add", ctx.taskDir], {
1606
+ cwd: ctx.projectDir,
1607
+ env: { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" },
1608
+ stdio: "pipe"
1609
+ });
1610
+ execFileSync7("git", ["commit", "--no-gpg-sign", "-m", `chore: add kody task artifacts [skip ci]`], {
1611
+ cwd: ctx.projectDir,
1612
+ env: { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" },
1613
+ stdio: "pipe"
1614
+ });
1615
+ logger.info(" Committed task artifacts");
1616
+ } catch {
1617
+ }
1604
1618
  pushBranch(ctx.projectDir);
1605
1619
  const config = getProjectConfig();
1606
1620
  let owner = config.github?.owner;
@@ -1698,6 +1712,7 @@ Failed: ${msg}
1698
1712
  var init_ship = __esm({
1699
1713
  "src/stages/ship.ts"() {
1700
1714
  "use strict";
1715
+ init_logger();
1701
1716
  init_git_utils();
1702
1717
  init_github_api();
1703
1718
  init_config();
@@ -2526,7 +2541,7 @@ import * as fs16 from "fs";
2526
2541
  import * as path15 from "path";
2527
2542
  import { execFileSync as execFileSync9 } from "child_process";
2528
2543
  function findLatestTaskForIssue(issueNumber, projectDir) {
2529
- const tasksDir = path15.join(projectDir, ".tasks");
2544
+ const tasksDir = path15.join(projectDir, ".kody", "tasks");
2530
2545
  if (!fs16.existsSync(tasksDir)) return null;
2531
2546
  const allDirs = fs16.readdirSync(tasksDir, { withFileTypes: true }).filter((d) => d.isDirectory()).map((d) => d.name).sort().reverse();
2532
2547
  const prefix = `${issueNumber}-`;
@@ -2587,7 +2602,7 @@ Or comment on the specific PR: \`@kody review\``
2587
2602
  }
2588
2603
  async function runStandaloneReview(input) {
2589
2604
  const taskId = input.taskId ?? `review-${generateTaskId()}`;
2590
- const taskDir = path16.join(input.projectDir, ".tasks", taskId);
2605
+ const taskDir = path16.join(input.projectDir, ".kody", "tasks", taskId);
2591
2606
  fs17.mkdirSync(taskDir, { recursive: true });
2592
2607
  const taskContent = `# ${input.prTitle}
2593
2608
 
@@ -2830,7 +2845,7 @@ function resolveTaskAction(issueNumber, existingTaskId, existingState) {
2830
2845
  function resolveForIssue(issueNumber, projectDir) {
2831
2846
  const existingTaskId = findLatestTaskForIssue(issueNumber, projectDir);
2832
2847
  if (existingTaskId) {
2833
- const statusPath = path18.join(projectDir, ".tasks", existingTaskId, "status.json");
2848
+ const statusPath = path18.join(projectDir, ".kody", "tasks", existingTaskId, "status.json");
2834
2849
  let existingState = null;
2835
2850
  if (fs19.existsSync(statusPath)) {
2836
2851
  try {
@@ -2924,7 +2939,7 @@ async function main() {
2924
2939
  process.exit(1);
2925
2940
  }
2926
2941
  }
2927
- const taskDir = path19.join(projectDir, ".tasks", taskId);
2942
+ const taskDir = path19.join(projectDir, ".kody", "tasks", taskId);
2928
2943
  fs20.mkdirSync(taskDir, { recursive: true });
2929
2944
  if (input.command === "status") {
2930
2945
  printStatus(taskId, taskDir);
@@ -3036,7 +3051,7 @@ ${issue.body ?? ""}`;
3036
3051
  }
3037
3052
  }
3038
3053
  if (!fs20.existsSync(taskMdPath)) {
3039
- console.error("No task.md found. Provide --task, --issue-number, or ensure .tasks/<id>/task.md exists.");
3054
+ console.error("No task.md found. Provide --task, --issue-number, or ensure .kody/tasks/<id>/task.md exists.");
3040
3055
  process.exit(1);
3041
3056
  }
3042
3057
  if (input.command === "fix" && !input.fromStage) {
@@ -3537,7 +3552,7 @@ Given this project context, output ONLY a JSON object with EXACTLY this structur
3537
3552
  },
3538
3553
  "git": { "defaultBranch": "${basic.defaultBranch}" },
3539
3554
  "github": { "owner": "${basic.owner}", "repo": "${basic.repo}" },
3540
- "paths": { "taskDir": ".tasks" },
3555
+ "paths": { "taskDir": ".kody/tasks" },
3541
3556
  "agent": {
3542
3557
  "runner": "${"claude-code"}",
3543
3558
  "defaultRunner": "${"claude"}",
@@ -3595,7 +3610,7 @@ ${context}`;
3595
3610
  config.git.defaultBranch = config.git.defaultBranch || basic.defaultBranch;
3596
3611
  config.github.owner = config.github.owner || basic.owner;
3597
3612
  config.github.repo = config.github.repo || basic.repo;
3598
- config.paths.taskDir = config.paths.taskDir || ".tasks";
3613
+ config.paths.taskDir = config.paths.taskDir || ".kody/tasks";
3599
3614
  config.agent.runner = config.agent.runner || "claude-code";
3600
3615
  config.agent.defaultRunner = config.agent.defaultRunner || "claude";
3601
3616
  if (!config.agent.modelMap) {
@@ -3677,7 +3692,7 @@ function buildFallbackConfig(cwd, basic) {
3677
3692
  },
3678
3693
  git: { defaultBranch: basic.defaultBranch },
3679
3694
  github: { owner: basic.owner, repo: basic.repo },
3680
- paths: { taskDir: ".tasks" },
3695
+ paths: { taskDir: ".kody/tasks" },
3681
3696
  agent: {
3682
3697
  runner: "claude-code",
3683
3698
  defaultRunner: "claude",
@@ -3719,11 +3734,12 @@ function initCommand(opts) {
3719
3734
  const gitignorePath = path20.join(cwd, ".gitignore");
3720
3735
  if (fs21.existsSync(gitignorePath)) {
3721
3736
  const content = fs21.readFileSync(gitignorePath, "utf-8");
3722
- if (!content.includes(".tasks/")) {
3723
- fs21.appendFileSync(gitignorePath, "\n.tasks/\n");
3724
- console.log(" \u2713 .gitignore (added .tasks/)");
3737
+ if (content.includes(".tasks/")) {
3738
+ const updated = content.replace(/\n?\.tasks\/\n?/g, "\n");
3739
+ fs21.writeFileSync(gitignorePath, updated);
3740
+ console.log(" \u2713 .gitignore (removed legacy .tasks/ \u2014 tasks now committed in .kody/tasks/)");
3725
3741
  } else {
3726
- console.log(" \u25CB .gitignore (.tasks/ already present)");
3742
+ console.log(" \u25CB .gitignore (ok)");
3727
3743
  }
3728
3744
  }
3729
3745
  console.log("\n\u2500\u2500 Prerequisites \u2500\u2500");
@@ -82,8 +82,8 @@
82
82
  "properties": {
83
83
  "taskDir": {
84
84
  "type": "string",
85
- "description": "Directory for pipeline artifacts and state (gitignored)",
86
- "default": ".tasks"
85
+ "description": "Directory for pipeline artifacts and state (committed to branch)",
86
+ "default": ".kody/tasks"
87
87
  }
88
88
  },
89
89
  "additionalProperties": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine-lite",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,13 +13,6 @@
13
13
  "templates",
14
14
  "kody.config.schema.json"
15
15
  ],
16
- "scripts": {
17
- "kody": "tsx src/entry.ts",
18
- "build": "tsup",
19
- "test": "vitest run",
20
- "typecheck": "tsc --noEmit",
21
- "prepublishOnly": "pnpm build"
22
- },
23
16
  "dependencies": {
24
17
  "dotenv": "^16.4.7"
25
18
  },
@@ -32,5 +25,11 @@
32
25
  },
33
26
  "engines": {
34
27
  "node": ">=22"
28
+ },
29
+ "scripts": {
30
+ "kody": "tsx src/entry.ts",
31
+ "build": "tsup",
32
+ "test": "vitest run",
33
+ "typecheck": "tsc --noEmit"
35
34
  }
36
- }
35
+ }
@@ -1,21 +1,39 @@
1
1
  ---
2
2
  name: autofix
3
- description: Fix verification errors (typecheck, lint, test failures)
3
+ description: Investigate root cause then fix verification errors (typecheck, lint, test failures)
4
4
  mode: primary
5
5
  tools: [read, write, edit, bash, glob, grep]
6
6
  ---
7
7
 
8
8
  You are an autofix agent. The verification stage failed. Fix the errors below.
9
9
 
10
- STRATEGY (in order):
11
- 1. Try quick wins first: run `pnpm lint:fix` and `pnpm format:fix` via Bash
12
- 2. Read the error output carefully understand WHAT failed and WHY
13
- 3. For type errors: Read the affected file, fix the type mismatch
14
- 4. For test failures: Read both the test and the implementation, fix the root cause
15
- 5. For lint errors: Apply the specific fix the linter suggests
10
+ IRON LAW: NO FIXES WITHOUT INVESTIGATION FIRST. Do not jump to changing code. Understand the failure first.
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:
17
+ - **Type error**: mismatched types, missing properties, wrong generics
18
+ - **Test failure**: assertion mismatch, missing mock, changed behavior
19
+ - **Lint error**: style violation, unused import, naming convention
20
+ - **Runtime error**: null reference, missing dependency, config issue
21
+ - **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
16
30
  6. After EACH fix, re-run the failing command to verify it passes
17
- 7. Do NOT commit or push the orchestrator handles git
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
18
33
 
19
- Do NOT make unrelated changes. Fix ONLY the reported errors.
34
+ ## Rules
35
+ - 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
20
38
 
21
39
  {{TASK_CONTEXT}}
package/prompts/review.md CHANGED
@@ -5,9 +5,10 @@ mode: primary
5
5
  tools: [read, glob, grep, bash]
6
6
  ---
7
7
 
8
- You are a code review agent. Review all changes made for the task described below.
8
+ You are a code review agent following the Superpowers Structured Review methodology.
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.
11
12
 
12
13
  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.
13
14
 
@@ -21,28 +22,94 @@ Output markdown with this EXACT structure:
21
22
  ## Findings
22
23
 
23
24
  ### 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>
29
28
  <If none: "None.">
30
29
 
31
30
  ### Minor
32
- <Style issues, naming improvements, readability, trivial performance, minor refactoring opportunities>
33
31
  <If none: "None.">
34
32
 
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?
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)
47
114
 
48
115
  {{TASK_CONTEXT}}
@@ -253,7 +253,7 @@ jobs:
253
253
  if: always()
254
254
  run: |
255
255
  TASK_ID="${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}"
256
- STATUS_FILE=".tasks/${TASK_ID}/status.json"
256
+ STATUS_FILE=".kody/tasks/${TASK_ID}/status.json"
257
257
  if [ -f "$STATUS_FILE" ]; then
258
258
  STATE=$(jq -r '.state' "$STATUS_FILE")
259
259
  ICON="❌"
@@ -282,7 +282,7 @@ jobs:
282
282
  uses: actions/upload-artifact@v4
283
283
  with:
284
284
  name: kody-tasks-${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
285
- path: .tasks/
285
+ path: .kody/tasks/
286
286
  retention-days: 7
287
287
 
288
288
  # ─── Error Notifications ─────────────────────────────────────────────────────
@@ -345,11 +345,11 @@ jobs:
345
345
  run: kody-engine-lite --help
346
346
  - name: Dry run
347
347
  run: |
348
- mkdir -p .tasks/smoke-test
349
- echo "Smoke test task" > .tasks/smoke-test/task.md
348
+ mkdir -p .kody/tasks/smoke-test
349
+ echo "Smoke test task" > .kody/tasks/smoke-test/task.md
350
350
  kody-engine-lite run --task-id smoke-test --dry-run || true
351
- if [ -f ".tasks/smoke-test/status.json" ]; then
351
+ if [ -f ".kody/tasks/smoke-test/status.json" ]; then
352
352
  echo "✓ status.json created"
353
- cat .tasks/smoke-test/status.json
353
+ cat .kody/tasks/smoke-test/status.json
354
354
  fi
355
- rm -rf .tasks/smoke-test
355
+ rm -rf .kody/tasks/smoke-test