@kody-ade/kody-engine-lite 0.1.0

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/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@kody-ade/kody-engine-lite",
3
+ "version": "0.1.0",
4
+ "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "kody-engine-lite": "./dist/bin/cli.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "prompts",
13
+ "templates"
14
+ ],
15
+ "scripts": {
16
+ "kody": "tsx src/entry.ts",
17
+ "build": "tsup",
18
+ "test": "vitest run",
19
+ "typecheck": "tsc --noEmit",
20
+ "prepublishOnly": "pnpm build"
21
+ },
22
+ "dependencies": {
23
+ "dotenv": "^16.4.7"
24
+ },
25
+ "devDependencies": {
26
+ "@types/node": "^22.5.4",
27
+ "tsup": "^8.5.1",
28
+ "tsx": "^4.21.0",
29
+ "typescript": "~5.7.0",
30
+ "vitest": "^4.1.1"
31
+ },
32
+ "engines": {
33
+ "node": ">=22"
34
+ }
35
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: autofix
3
+ description: Fix verification errors (typecheck, lint, test failures)
4
+ mode: primary
5
+ tools: [read, write, edit, bash, glob, grep]
6
+ ---
7
+
8
+ You are an autofix agent. The verification stage failed. Fix the errors below.
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
16
+ 6. After EACH fix, re-run the failing command to verify it passes
17
+ 7. Do NOT commit or push — the orchestrator handles git
18
+
19
+ Do NOT make unrelated changes. Fix ONLY the reported errors.
20
+
21
+ {{TASK_CONTEXT}}
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: build
3
+ description: Implement code changes following Superpowers Executing Plans methodology
4
+ mode: primary
5
+ tools: [read, write, edit, bash, glob, grep]
6
+ ---
7
+
8
+ You are a code implementation agent following the Superpowers Executing Plans methodology.
9
+
10
+ CRITICAL RULES:
11
+ 1. Follow the plan EXACTLY — step by step, in order. Do not skip or reorder steps.
12
+ 2. Read existing code BEFORE modifying (use Read tool first, always).
13
+ 3. Verify each step after completion (use Bash to run tests/typecheck).
14
+ 4. Write COMPLETE, working code — no stubs, no TODOs, no placeholders.
15
+ 5. Do NOT commit or push — the orchestrator handles git.
16
+ 6. If the plan says to write tests first, write tests first.
17
+ 7. Document any deviations from the plan (if absolutely necessary).
18
+
19
+ Implementation discipline:
20
+ - Use Edit for surgical changes to existing files (prefer over Write for modifications)
21
+ - Use Write only for new files
22
+ - Run `pnpm test` after each logical group of changes
23
+ - Run `pnpm tsc --noEmit` periodically to catch type errors early
24
+ - If a test fails after your change, fix it immediately — don't continue
25
+
26
+ {{TASK_CONTEXT}}
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: plan
3
+ description: Create a step-by-step implementation plan following Superpowers Writing Plans methodology
4
+ mode: primary
5
+ tools: [read, glob, grep]
6
+ ---
7
+
8
+ You are a planning agent following the Superpowers Writing Plans methodology.
9
+
10
+ Before planning, examine the codebase to understand existing code structure, patterns, and conventions. Use Read, Glob, and Grep.
11
+
12
+ Output a markdown plan with numbered steps:
13
+
14
+ ## Step N: <short description>
15
+ **File:** <exact file path>
16
+ **Change:** <precisely what to do>
17
+ **Why:** <rationale>
18
+ **Verify:** <command to run to confirm this step works>
19
+
20
+ Superpowers Writing Plans rules:
21
+ 1. TDD ordering — write tests BEFORE implementation
22
+ 2. Each step completable in 2-5 minutes (bite-sized)
23
+ 3. Exact file paths — not "the test file" but "src/utils/foo.test.ts"
24
+ 4. Include COMPLETE code for new files (not snippets or pseudocode)
25
+ 5. Include verification step for each task (e.g., "Run `pnpm test` to confirm")
26
+ 6. Order for incremental building — each step builds on the previous
27
+ 7. If modifying existing code, show the exact function/line to change
28
+ 8. Keep it simple — avoid unnecessary abstractions (YAGNI)
29
+
30
+ {{TASK_CONTEXT}}
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: review-fix
3
+ description: Fix Critical and Major issues found during code review
4
+ mode: primary
5
+ tools: [read, write, edit, bash, glob, grep]
6
+ ---
7
+
8
+ You are a review-fix agent. The code review found issues that need fixing.
9
+
10
+ RULES:
11
+ 1. Fix ONLY Critical and Major issues (ignore Minor findings)
12
+ 2. Use Edit for surgical changes — do NOT rewrite entire files
13
+ 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
+
17
+ Read the review findings carefully. For each Critical/Major finding:
18
+ 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
+
23
+ {{TASK_CONTEXT}}
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: review
3
+ description: Review code changes for correctness, security, and quality
4
+ mode: primary
5
+ tools: [read, glob, grep, bash]
6
+ ---
7
+
8
+ You are a code review agent. Review all changes made for the task described below.
9
+
10
+ Use Bash to run `git diff` to see what changed. Use Read to examine modified files in full context.
11
+
12
+ Output markdown with this EXACT structure:
13
+
14
+ ## Verdict: PASS | FAIL
15
+
16
+ ## Summary
17
+ <1-2 sentence summary of what was changed and why>
18
+
19
+ ## Findings
20
+
21
+ ### Critical
22
+ <Security vulnerabilities, data loss risks, crashes, broken authentication>
23
+ <If none: "None.">
24
+
25
+ ### Major
26
+ <Logic errors, missing edge cases, broken tests, significant performance issues, missing error handling>
27
+ <If none: "None.">
28
+
29
+ ### Minor
30
+ <Style issues, naming improvements, readability, trivial performance, minor refactoring opportunities>
31
+ <If none: "None.">
32
+
33
+ Severity definitions:
34
+ - **Critical**: Security vulnerability, data loss, application crash, broken authentication, injection risk. MUST fix before merge.
35
+ - **Major**: Logic error, missing edge case, broken test, significant performance issue, missing input validation. SHOULD fix before merge.
36
+ - **Minor**: Style issue, naming improvement, readability, micro-optimization. NICE to fix, not blocking.
37
+
38
+ Review checklist:
39
+ - [ ] Does the code match the plan?
40
+ - [ ] Are edge cases handled?
41
+ - [ ] Are there security concerns?
42
+ - [ ] Are tests adequate?
43
+ - [ ] Is error handling proper?
44
+ - [ ] Are there any hardcoded values that should be configurable?
45
+
46
+ {{TASK_CONTEXT}}
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: taskify
3
+ description: Classify and structure a task from free-text description
4
+ mode: primary
5
+ tools: [read, glob, grep]
6
+ ---
7
+
8
+ You are a task classification agent following the Superpowers Brainstorming methodology.
9
+
10
+ Before classifying, examine the codebase to understand the project structure, existing patterns, and affected files. Use Read, Glob, and Grep to explore.
11
+
12
+ Output ONLY valid JSON. No markdown fences. No explanation. No extra text before or after the JSON.
13
+
14
+ Required JSON format:
15
+ {
16
+ "task_type": "feature | bugfix | refactor | docs | chore",
17
+ "title": "Brief title, max 72 characters",
18
+ "description": "Clear description of what the task requires",
19
+ "scope": ["list", "of", "exact/file/paths", "affected"],
20
+ "risk_level": "low | medium | high"
21
+ }
22
+
23
+ Risk level heuristics:
24
+ - low: single file change, no breaking changes, docs, config, isolated scripts, test additions, style changes
25
+ - medium: multiple files, possible side effects, API changes, new dependencies, refactoring existing logic
26
+ - high: core business logic, data migrations, security, authentication, payment processing, database schema changes
27
+
28
+ Guidelines:
29
+ - scope must contain exact file paths (use Glob to discover them)
30
+ - title must be actionable ("Add X", "Fix Y", "Refactor Z")
31
+ - description should capture the intent, not just restate the title
32
+
33
+ {{TASK_CONTEXT}}
@@ -0,0 +1,213 @@
1
+ name: kody
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ task_id:
7
+ required: true
8
+ type: string
9
+ mode:
10
+ type: string
11
+ default: "full"
12
+ from_stage:
13
+ type: string
14
+ default: ""
15
+ issue_number:
16
+ type: string
17
+ default: ""
18
+ feedback:
19
+ type: string
20
+ default: ""
21
+ dry_run:
22
+ type: boolean
23
+ default: false
24
+
25
+ issue_comment:
26
+ types: [created]
27
+
28
+ pull_request_review:
29
+ types: [submitted]
30
+
31
+ concurrency:
32
+ group: kody-${{ github.event.inputs.task_id || github.event.issue.number || github.event.pull_request.number || github.sha }}
33
+ cancel-in-progress: false
34
+
35
+ permissions:
36
+ issues: write
37
+ pull-requests: write
38
+ contents: write
39
+
40
+ jobs:
41
+ # ─── Parse (issue_comment trigger only) ──────────────────────────────────────
42
+ parse:
43
+ if: >-
44
+ github.event_name == 'issue_comment' &&
45
+ (contains(github.event.comment.body, '@kody') || contains(github.event.comment.body, '/kody'))
46
+ runs-on: ubuntu-latest
47
+ timeout-minutes: 5
48
+ outputs:
49
+ task_id: ${{ steps.parse.outputs.task_id }}
50
+ mode: ${{ steps.parse.outputs.mode }}
51
+ from_stage: ${{ steps.parse.outputs.from_stage }}
52
+ issue_number: ${{ steps.parse.outputs.issue_number }}
53
+ feedback: ${{ steps.parse.outputs.feedback }}
54
+ valid: ${{ steps.parse.outputs.valid }}
55
+ steps:
56
+ - uses: actions/setup-node@v4
57
+ with:
58
+ node-version: 22
59
+
60
+ - name: Install Kody Engine
61
+ run: npm install -g @kody-ade/kody-engine-lite
62
+
63
+ - name: Validate author
64
+ id: safety
65
+ run: |
66
+ ALLOWED="COLLABORATOR MEMBER OWNER"
67
+ ASSOC="${{ github.event.comment.author_association }}"
68
+ if echo "$ALLOWED" | grep -qw "$ASSOC"; then
69
+ echo "valid=true" >> $GITHUB_OUTPUT
70
+ else
71
+ echo "valid=false" >> $GITHUB_OUTPUT
72
+ echo "reason=Author association '$ASSOC' not allowed" >> $GITHUB_OUTPUT
73
+ fi
74
+
75
+ - name: Add reaction
76
+ if: steps.safety.outputs.valid == 'true'
77
+ uses: actions/github-script@v7
78
+ continue-on-error: true
79
+ with:
80
+ script: |
81
+ await github.rest.reactions.createForIssueComment({
82
+ owner: context.repo.owner,
83
+ repo: context.repo.repo,
84
+ comment_id: context.payload.comment.id,
85
+ content: 'eyes'
86
+ })
87
+
88
+ - name: Parse inputs
89
+ if: steps.safety.outputs.valid == 'true'
90
+ id: parse
91
+ run: |
92
+ BODY="${{ github.event.comment.body }}"
93
+ # Extract: @kody [mode] [task-id] [--from stage]
94
+ KODY_ARGS=$(echo "$BODY" | grep -oP '(?:@kody|/kody)\s+\K.*' || echo "")
95
+ MODE=$(echo "$KODY_ARGS" | awk '{print $1}')
96
+ TASK_ID=$(echo "$KODY_ARGS" | awk '{print $2}')
97
+ FROM_STAGE=$(echo "$KODY_ARGS" | grep -oP '(?<=--from )\S+' || echo "")
98
+ FEEDBACK=$(echo "$KODY_ARGS" | grep -oP '(?<=--feedback ")[^"]*' || echo "")
99
+
100
+ # Validate mode
101
+ case "$MODE" in
102
+ full|rerun|status) ;;
103
+ *) MODE="full"; TASK_ID="$MODE" ;;
104
+ esac
105
+
106
+ echo "task_id=$TASK_ID" >> $GITHUB_OUTPUT
107
+ echo "mode=$MODE" >> $GITHUB_OUTPUT
108
+ echo "from_stage=$FROM_STAGE" >> $GITHUB_OUTPUT
109
+ echo "issue_number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
110
+ echo "feedback=$FEEDBACK" >> $GITHUB_OUTPUT
111
+ echo "valid=$([ -n "$TASK_ID" ] && echo true || echo false)" >> $GITHUB_OUTPUT
112
+
113
+ # ─── Orchestrate ─────────────────────────────────────────────────────────────
114
+ orchestrate:
115
+ if: >-
116
+ github.event_name == 'workflow_dispatch' ||
117
+ (needs.parse.result == 'success' && needs.parse.outputs.valid == 'true') ||
118
+ (github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested')
119
+ needs: [parse]
120
+ runs-on: ubuntu-latest
121
+ timeout-minutes: 120
122
+ steps:
123
+ - uses: actions/checkout@v4
124
+ with:
125
+ fetch-depth: 0
126
+ persist-credentials: true
127
+
128
+ - uses: pnpm/action-setup@v4
129
+ - uses: actions/setup-node@v4
130
+ with:
131
+ node-version: 22
132
+ cache: pnpm
133
+
134
+ - run: pnpm install --frozen-lockfile
135
+
136
+ - name: Install Kody Engine
137
+ run: npm install -g @kody-ade/kody-engine-lite
138
+
139
+ - name: Install Claude Code CLI
140
+ run: npm install -g @anthropic-ai/claude-code
141
+
142
+ - name: Configure git
143
+ run: |
144
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
145
+ git config user.name "github-actions[bot]"
146
+
147
+ - name: Run Kody pipeline
148
+ env:
149
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
150
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151
+ TASK_ID: ${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
152
+ MODE: ${{ github.event.inputs.mode || needs.parse.outputs.mode || 'full' }}
153
+ FROM_STAGE: ${{ github.event.inputs.from_stage || needs.parse.outputs.from_stage }}
154
+ ISSUE_NUMBER: ${{ github.event.inputs.issue_number || needs.parse.outputs.issue_number }}
155
+ FEEDBACK: ${{ github.event.inputs.feedback || needs.parse.outputs.feedback }}
156
+ DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
157
+ run: kody-engine-lite
158
+
159
+ - name: Pipeline summary
160
+ if: always()
161
+ run: |
162
+ TASK_ID="${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}"
163
+ if [ -f ".tasks/${TASK_ID}/status.json" ]; then
164
+ echo "## Pipeline Status" >> $GITHUB_STEP_SUMMARY
165
+ echo '```json' >> $GITHUB_STEP_SUMMARY
166
+ cat ".tasks/${TASK_ID}/status.json" >> $GITHUB_STEP_SUMMARY
167
+ echo '```' >> $GITHUB_STEP_SUMMARY
168
+ fi
169
+
170
+ - name: Upload artifacts
171
+ if: always()
172
+ uses: actions/upload-artifact@v4
173
+ with:
174
+ name: kody-tasks-${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
175
+ path: .tasks/
176
+ retention-days: 7
177
+
178
+ # ─── Error Notifications ─────────────────────────────────────────────────────
179
+ notify-parse-error:
180
+ if: >-
181
+ github.event_name == 'issue_comment' &&
182
+ needs.parse.outputs.valid != 'true' &&
183
+ (contains(github.event.comment.body, '@kody') || contains(github.event.comment.body, '/kody'))
184
+ needs: [parse]
185
+ runs-on: ubuntu-latest
186
+ steps:
187
+ - uses: actions/github-script@v7
188
+ with:
189
+ script: |
190
+ await github.rest.issues.createComment({
191
+ owner: context.repo.owner,
192
+ repo: context.repo.repo,
193
+ issue_number: context.issue.number,
194
+ body: '❌ Failed to parse command.\n\nUsage: `@kody [full|rerun|status] <task-id> [--from <stage>] [--feedback "<text>"]`'
195
+ })
196
+
197
+ notify-orchestrate-error:
198
+ if: failure() && needs.orchestrate.result == 'failure'
199
+ needs: [orchestrate]
200
+ runs-on: ubuntu-latest
201
+ steps:
202
+ - uses: actions/github-script@v7
203
+ with:
204
+ script: |
205
+ const issueNumber = Number('${{ github.event.inputs.issue_number || needs.parse.outputs.issue_number || 0 }}');
206
+ if (issueNumber > 0) {
207
+ await github.rest.issues.createComment({
208
+ owner: context.repo.owner,
209
+ repo: context.repo.repo,
210
+ issue_number: issueNumber,
211
+ body: `❌ Pipeline failed. [View logs](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`
212
+ });
213
+ }