@kody-ade/kody-engine-lite 0.1.10 → 0.1.12

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
@@ -1078,31 +1078,35 @@ function buildPrBody(ctx) {
1078
1078
  const raw = fs4.readFileSync(taskJsonPath, "utf-8");
1079
1079
  const cleaned = raw.replace(/^```json\s*\n?/m, "").replace(/\n?```\s*$/m, "");
1080
1080
  const task = JSON.parse(cleaned);
1081
- sections.push(`## Summary`);
1082
- sections.push(`**Type:** ${task.task_type ?? "unknown"} | **Risk:** ${task.risk_level ?? "unknown"}`);
1083
- if (task.description) sections.push(`
1081
+ if (task.description) {
1082
+ sections.push(`## What
1083
+
1084
1084
  ${task.description}`);
1085
- if (task.scope?.length) sections.push(`
1086
- **Scope:** ${task.scope.join(", ")}`);
1087
- } catch {
1088
- }
1089
- }
1090
- const planPath = path4.join(ctx.taskDir, "plan.md");
1091
- if (fs4.existsSync(planPath)) {
1092
- const plan = fs4.readFileSync(planPath, "utf-8").trim();
1093
- if (plan) {
1094
- const truncated = plan.length > 500 ? plan.slice(0, 500) + "\n..." : plan;
1095
- sections.push(`
1096
- ## Plan
1097
- <details><summary>Implementation plan</summary>
1085
+ }
1086
+ if (task.scope?.length) {
1087
+ sections.push(`
1088
+ ## Scope
1098
1089
 
1099
- ${truncated}
1100
- </details>`);
1090
+ ${task.scope.map((s) => `- \`${s}\``).join("\n")}`);
1091
+ }
1092
+ sections.push(`
1093
+ **Type:** ${task.task_type ?? "unknown"} | **Risk:** ${task.risk_level ?? "unknown"}`);
1094
+ } catch {
1101
1095
  }
1102
1096
  }
1103
1097
  const reviewPath = path4.join(ctx.taskDir, "review.md");
1104
1098
  if (fs4.existsSync(reviewPath)) {
1105
1099
  const review = fs4.readFileSync(reviewPath, "utf-8");
1100
+ const summaryMatch = review.match(/## Summary\s*\n([\s\S]*?)(?=\n## |\n*$)/);
1101
+ if (summaryMatch) {
1102
+ const summary = summaryMatch[1].trim();
1103
+ if (summary) {
1104
+ sections.push(`
1105
+ ## Changes
1106
+
1107
+ ${summary}`);
1108
+ }
1109
+ }
1106
1110
  const verdictMatch = review.match(/## Verdict:\s*(PASS|FAIL)/i);
1107
1111
  if (verdictMatch) {
1108
1112
  sections.push(`
@@ -1114,6 +1118,18 @@ ${truncated}
1114
1118
  const verify = fs4.readFileSync(verifyPath, "utf-8");
1115
1119
  if (/PASS/i.test(verify)) sections.push(`**Verify:** \u2705 typecheck + tests + lint passed`);
1116
1120
  }
1121
+ const planPath = path4.join(ctx.taskDir, "plan.md");
1122
+ if (fs4.existsSync(planPath)) {
1123
+ const plan = fs4.readFileSync(planPath, "utf-8").trim();
1124
+ if (plan) {
1125
+ const truncated = plan.length > 800 ? plan.slice(0, 800) + "\n..." : plan;
1126
+ sections.push(`
1127
+ <details><summary>\u{1F4CB} Implementation plan</summary>
1128
+
1129
+ ${truncated}
1130
+ </details>`);
1131
+ }
1132
+ }
1117
1133
  if (ctx.input.issueNumber) {
1118
1134
  sections.push(`
1119
1135
  Closes #${ctx.input.issueNumber}`);
@@ -1154,12 +1170,33 @@ function executeShipStage(ctx, _def) {
1154
1170
  } catch {
1155
1171
  }
1156
1172
  }
1157
- const taskMdPath = path4.join(ctx.taskDir, "task.md");
1158
1173
  let title = "Update";
1159
- if (fs4.existsSync(taskMdPath)) {
1160
- const content = fs4.readFileSync(taskMdPath, "utf-8");
1161
- const lines = content.split("\n").filter((l) => l.trim() && !l.startsWith("#"));
1162
- title = (lines[0] ?? "Update").slice(0, 72);
1174
+ const TYPE_PREFIX = {
1175
+ feature: "feat",
1176
+ bugfix: "fix",
1177
+ refactor: "refactor",
1178
+ docs: "docs",
1179
+ chore: "chore"
1180
+ };
1181
+ const taskJsonPath = path4.join(ctx.taskDir, "task.json");
1182
+ if (fs4.existsSync(taskJsonPath)) {
1183
+ try {
1184
+ const raw = fs4.readFileSync(taskJsonPath, "utf-8");
1185
+ const cleaned = raw.replace(/^```json\s*\n?/m, "").replace(/\n?```\s*$/m, "");
1186
+ const task = JSON.parse(cleaned);
1187
+ const prefix = TYPE_PREFIX[task.task_type] ?? "chore";
1188
+ const taskTitle = task.title ?? "Update";
1189
+ title = `${prefix}: ${taskTitle}`.slice(0, 72);
1190
+ } catch {
1191
+ }
1192
+ }
1193
+ if (title === "Update") {
1194
+ const taskMdPath = path4.join(ctx.taskDir, "task.md");
1195
+ if (fs4.existsSync(taskMdPath)) {
1196
+ const content = fs4.readFileSync(taskMdPath, "utf-8");
1197
+ const firstLine = content.split("\n").find((l) => l.trim() && !l.startsWith("#") && !l.startsWith("*"));
1198
+ if (firstLine) title = `chore: ${firstLine.trim()}`.slice(0, 72);
1199
+ }
1163
1200
  }
1164
1201
  const body = buildPrBody(ctx);
1165
1202
  const pr = createPR(head, base, title, body);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine-lite",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -113,19 +113,20 @@ jobs:
113
113
  ;;
114
114
  esac
115
115
 
116
- # Auto-generate task-id if not provided
117
116
  ISSUE_NUM="${{ github.event.issue.number }}"
118
- if [ -z "$TASK_ID" ]; then
119
- TASK_ID="${ISSUE_NUM}-$(date +%y%m%d-%H%M%S)"
120
- fi
121
117
 
122
118
  # For approve mode: extract answer body and convert to rerun
119
+ # Must run BEFORE task-id generation so we don't create a new task
123
120
  if [ "$MODE" = "approve" ]; then
124
- # Everything after @kody approve [task-id] is the feedback
125
121
  APPROVE_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*approve/,$p' | tail -n +2)
126
122
  FEEDBACK="$APPROVE_BODY"
127
123
  MODE="rerun"
128
- # FROM_STAGE will be determined by entry.ts from paused state
124
+ # Leave TASK_ID empty entry.ts findLatestTaskForIssue will find the paused task
125
+ fi
126
+
127
+ # Auto-generate task-id if not provided (only for non-rerun modes)
128
+ if [ -z "$TASK_ID" ] && [ "$MODE" != "rerun" ]; then
129
+ TASK_ID="${ISSUE_NUM}-$(date +%y%m%d-%H%M%S)"
129
130
  fi
130
131
 
131
132
  echo "task_id=$TASK_ID" >> $GITHUB_OUTPUT
@@ -200,7 +201,8 @@ jobs:
200
201
  CMD="run"
201
202
  [ "$MODE" = "rerun" ] && CMD="rerun"
202
203
  [ "$MODE" = "fix" ] && CMD="fix"
203
- ARGS="--task-id $TASK_ID --issue-number $ISSUE_NUMBER"
204
+ ARGS="--issue-number $ISSUE_NUMBER"
205
+ [ -n "$TASK_ID" ] && ARGS="$ARGS --task-id $TASK_ID"
204
206
  [ -n "$FROM_STAGE" ] && ARGS="$ARGS --from $FROM_STAGE"
205
207
  [ -n "$FEEDBACK" ] && ARGS="$ARGS --feedback \"$FEEDBACK\""
206
208
  [ "$DRY_RUN" = "true" ] && ARGS="$ARGS --dry-run"