@kody-ade/kody-engine-lite 0.1.4 → 0.1.6
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 +51 -2
- package/package.json +1 -1
- package/templates/kody.yml +70 -6
package/dist/bin/cli.js
CHANGED
|
@@ -1534,8 +1534,17 @@ var init_entry = __esm({
|
|
|
1534
1534
|
init_github_api();
|
|
1535
1535
|
init_logger();
|
|
1536
1536
|
isCI2 = !!process.env.GITHUB_ACTIONS;
|
|
1537
|
-
main().catch((err) => {
|
|
1538
|
-
|
|
1537
|
+
main().catch(async (err) => {
|
|
1538
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1539
|
+
console.error(msg);
|
|
1540
|
+
const issueStr = process.argv.find((_, i, a) => a[i - 1] === "--issue-number") ?? process.env.ISSUE_NUMBER;
|
|
1541
|
+
const isLocal = process.argv.includes("--local") || !process.env.GITHUB_ACTIONS;
|
|
1542
|
+
if (issueStr && !isLocal) {
|
|
1543
|
+
try {
|
|
1544
|
+
postComment(parseInt(issueStr, 10), `\u274C Pipeline crashed: ${msg.slice(0, 200)}`);
|
|
1545
|
+
} catch {
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1539
1548
|
process.exit(1);
|
|
1540
1549
|
});
|
|
1541
1550
|
}
|
|
@@ -1783,6 +1792,46 @@ function initCommand(opts) {
|
|
|
1783
1792
|
console.log(` \u2717 ${c.name} \u2014 ${c.fix}`);
|
|
1784
1793
|
}
|
|
1785
1794
|
}
|
|
1795
|
+
const labels = [
|
|
1796
|
+
{ name: "kody:planning", color: "c5def5", description: "Kody is analyzing and planning" },
|
|
1797
|
+
{ name: "kody:building", color: "0e8a16", description: "Kody is building code" },
|
|
1798
|
+
{ name: "kody:review", color: "fbca04", description: "Kody is reviewing code" },
|
|
1799
|
+
{ name: "kody:done", color: "0e8a16", description: "Kody completed successfully" },
|
|
1800
|
+
{ name: "kody:failed", color: "d93f0b", description: "Kody pipeline failed" }
|
|
1801
|
+
];
|
|
1802
|
+
console.log("\n\u2500\u2500 Labels \u2500\u2500");
|
|
1803
|
+
for (const label of labels) {
|
|
1804
|
+
try {
|
|
1805
|
+
execFileSync7("gh", [
|
|
1806
|
+
"label",
|
|
1807
|
+
"create",
|
|
1808
|
+
label.name,
|
|
1809
|
+
"--repo",
|
|
1810
|
+
repoSlug,
|
|
1811
|
+
"--color",
|
|
1812
|
+
label.color,
|
|
1813
|
+
"--description",
|
|
1814
|
+
label.description,
|
|
1815
|
+
"--force"
|
|
1816
|
+
], {
|
|
1817
|
+
encoding: "utf-8",
|
|
1818
|
+
timeout: 1e4,
|
|
1819
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1820
|
+
});
|
|
1821
|
+
console.log(` \u2713 ${label.name}`);
|
|
1822
|
+
} catch {
|
|
1823
|
+
try {
|
|
1824
|
+
execFileSync7("gh", ["label", "list", "--repo", repoSlug, "--search", label.name], {
|
|
1825
|
+
encoding: "utf-8",
|
|
1826
|
+
timeout: 1e4,
|
|
1827
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1828
|
+
});
|
|
1829
|
+
console.log(` \u25CB ${label.name} (exists)`);
|
|
1830
|
+
} catch {
|
|
1831
|
+
console.log(` \u2717 ${label.name} \u2014 failed to create`);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1786
1835
|
}
|
|
1787
1836
|
console.log("\n\u2500\u2500 Config \u2500\u2500");
|
|
1788
1837
|
if (fs7.existsSync(configDest)) {
|
package/package.json
CHANGED
package/templates/kody.yml
CHANGED
|
@@ -28,6 +28,10 @@ on:
|
|
|
28
28
|
pull_request_review:
|
|
29
29
|
types: [submitted]
|
|
30
30
|
|
|
31
|
+
push:
|
|
32
|
+
branches: [main, dev]
|
|
33
|
+
paths: ["src/**", "kody.config.json", "package.json"]
|
|
34
|
+
|
|
31
35
|
concurrency:
|
|
32
36
|
group: kody-${{ github.event.inputs.task_id || github.event.issue.number || github.event.pull_request.number || github.sha }}
|
|
33
37
|
cancel-in-progress: false
|
|
@@ -120,10 +124,20 @@ jobs:
|
|
|
120
124
|
runs-on: ubuntu-latest
|
|
121
125
|
timeout-minutes: 120
|
|
122
126
|
steps:
|
|
127
|
+
- name: Generate App token
|
|
128
|
+
id: app-token
|
|
129
|
+
if: vars.KODY_APP_ID != ''
|
|
130
|
+
uses: actions/create-github-app-token@v1
|
|
131
|
+
with:
|
|
132
|
+
app-id: ${{ vars.KODY_APP_ID }}
|
|
133
|
+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
134
|
+
repositories: ${{ github.event.repository.name }}
|
|
135
|
+
|
|
123
136
|
- uses: actions/checkout@v4
|
|
124
137
|
with:
|
|
125
138
|
fetch-depth: 0
|
|
126
139
|
persist-credentials: true
|
|
140
|
+
token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
|
|
127
141
|
|
|
128
142
|
- uses: pnpm/action-setup@v4
|
|
129
143
|
with:
|
|
@@ -149,24 +163,42 @@ jobs:
|
|
|
149
163
|
- name: Run Kody pipeline
|
|
150
164
|
env:
|
|
151
165
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
152
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
166
|
+
GH_TOKEN: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }}
|
|
153
167
|
TASK_ID: ${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}
|
|
154
168
|
MODE: ${{ github.event.inputs.mode || needs.parse.outputs.mode || 'full' }}
|
|
155
169
|
FROM_STAGE: ${{ github.event.inputs.from_stage || needs.parse.outputs.from_stage }}
|
|
156
170
|
ISSUE_NUMBER: ${{ github.event.inputs.issue_number || needs.parse.outputs.issue_number }}
|
|
157
171
|
FEEDBACK: ${{ github.event.inputs.feedback || needs.parse.outputs.feedback }}
|
|
158
172
|
DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }}
|
|
173
|
+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
|
159
174
|
run: kody-engine-lite run --task-id "$TASK_ID" --issue-number "$ISSUE_NUMBER"
|
|
160
175
|
|
|
161
176
|
- name: Pipeline summary
|
|
162
177
|
if: always()
|
|
163
178
|
run: |
|
|
164
179
|
TASK_ID="${{ github.event.inputs.task_id || needs.parse.outputs.task_id }}"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
180
|
+
STATUS_FILE=".tasks/${TASK_ID}/status.json"
|
|
181
|
+
if [ -f "$STATUS_FILE" ]; then
|
|
182
|
+
STATE=$(jq -r '.state' "$STATUS_FILE")
|
|
183
|
+
ICON="❌"
|
|
184
|
+
[ "$STATE" = "completed" ] && ICON="✅"
|
|
185
|
+
echo "## ${ICON} Kody Pipeline: \`${TASK_ID}\`" >> $GITHUB_STEP_SUMMARY
|
|
186
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
187
|
+
echo "**Status:** ${STATE}" >> $GITHUB_STEP_SUMMARY
|
|
188
|
+
echo "" >> $GITHUB_STEP_SUMMARY
|
|
189
|
+
echo "| Stage | State |" >> $GITHUB_STEP_SUMMARY
|
|
190
|
+
echo "|-------|-------|" >> $GITHUB_STEP_SUMMARY
|
|
191
|
+
for stage in taskify plan build verify review review-fix ship; do
|
|
192
|
+
SSTATE=$(jq -r ".stages[\"$stage\"].state // \"—\"" "$STATUS_FILE")
|
|
193
|
+
case "$SSTATE" in
|
|
194
|
+
completed) SICON="✅" ;;
|
|
195
|
+
failed) SICON="❌" ;;
|
|
196
|
+
timeout) SICON="⏱" ;;
|
|
197
|
+
running) SICON="▶️" ;;
|
|
198
|
+
*) SICON="○" ;;
|
|
199
|
+
esac
|
|
200
|
+
echo "| ${stage} | ${SICON} ${SSTATE} |" >> $GITHUB_STEP_SUMMARY
|
|
201
|
+
done
|
|
170
202
|
fi
|
|
171
203
|
|
|
172
204
|
- name: Upload artifacts
|
|
@@ -213,3 +245,35 @@ jobs:
|
|
|
213
245
|
body: `❌ Pipeline failed. [View logs](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`
|
|
214
246
|
});
|
|
215
247
|
}
|
|
248
|
+
|
|
249
|
+
# ─── Smoke Test (push trigger) ──────────────────────────────────────────────
|
|
250
|
+
smoke-test:
|
|
251
|
+
if: github.event_name == 'push'
|
|
252
|
+
runs-on: ubuntu-latest
|
|
253
|
+
timeout-minutes: 10
|
|
254
|
+
steps:
|
|
255
|
+
- uses: actions/checkout@v4
|
|
256
|
+
- uses: pnpm/action-setup@v4
|
|
257
|
+
with:
|
|
258
|
+
version: latest
|
|
259
|
+
- uses: actions/setup-node@v4
|
|
260
|
+
with:
|
|
261
|
+
node-version: 22
|
|
262
|
+
cache: pnpm
|
|
263
|
+
- run: pnpm install --frozen-lockfile
|
|
264
|
+
- name: Install Kody Engine
|
|
265
|
+
run: npm install -g @kody-ade/kody-engine-lite
|
|
266
|
+
- name: Typecheck
|
|
267
|
+
run: pnpm tsc --noEmit
|
|
268
|
+
- name: CLI loads
|
|
269
|
+
run: kody-engine-lite --help
|
|
270
|
+
- name: Dry run
|
|
271
|
+
run: |
|
|
272
|
+
mkdir -p .tasks/smoke-test
|
|
273
|
+
echo "Smoke test task" > .tasks/smoke-test/task.md
|
|
274
|
+
kody-engine-lite run --task-id smoke-test --dry-run || true
|
|
275
|
+
if [ -f ".tasks/smoke-test/status.json" ]; then
|
|
276
|
+
echo "✓ status.json created"
|
|
277
|
+
cat .tasks/smoke-test/status.json
|
|
278
|
+
fi
|
|
279
|
+
rm -rf .tasks/smoke-test
|