@kody-ade/kody-engine-lite 0.1.35 → 0.1.37

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 (2) hide show
  1. package/dist/bin/cli.js +55 -36
  2. package/package.json +1 -1
package/dist/bin/cli.js CHANGED
@@ -414,6 +414,14 @@ function getIssue(issueNumber) {
414
414
  return null;
415
415
  }
416
416
  }
417
+ function getIssueLabels(issueNumber) {
418
+ try {
419
+ const output = gh(["issue", "view", String(issueNumber), "--json", "labels", "--jq", ".labels[].name"]);
420
+ return output.split("\n").filter(Boolean);
421
+ } catch {
422
+ return [];
423
+ }
424
+ }
417
425
  function setLabel(issueNumber, label) {
418
426
  try {
419
427
  gh(["issue", "edit", String(issueNumber), "--add-label", label]);
@@ -2549,24 +2557,32 @@ function resolveTaskAction(issueNumber, existingTaskId, existingState) {
2549
2557
  }
2550
2558
  function resolveForIssue(issueNumber, projectDir) {
2551
2559
  const existingTaskId = findLatestTaskForIssue(issueNumber, projectDir);
2552
- if (!existingTaskId) {
2553
- return resolveTaskAction(issueNumber, null, null);
2560
+ if (existingTaskId) {
2561
+ const statusPath = path17.join(projectDir, ".tasks", existingTaskId, "status.json");
2562
+ let existingState = null;
2563
+ if (fs18.existsSync(statusPath)) {
2564
+ try {
2565
+ existingState = JSON.parse(fs18.readFileSync(statusPath, "utf-8"));
2566
+ } catch {
2567
+ }
2568
+ }
2569
+ return resolveTaskAction(issueNumber, existingTaskId, existingState);
2554
2570
  }
2555
- const statusPath = path17.join(projectDir, ".tasks", existingTaskId, "status.json");
2556
- let existingState = null;
2557
- if (fs18.existsSync(statusPath)) {
2558
- try {
2559
- existingState = JSON.parse(fs18.readFileSync(statusPath, "utf-8"));
2560
- } catch {
2571
+ try {
2572
+ const labels = getIssueLabels(issueNumber);
2573
+ if (labels.includes("kody:done")) {
2574
+ return { action: "already-completed", taskId: `${issueNumber}-unknown` };
2561
2575
  }
2576
+ } catch {
2562
2577
  }
2563
- return resolveTaskAction(issueNumber, existingTaskId, existingState);
2578
+ return resolveTaskAction(issueNumber, null, null);
2564
2579
  }
2565
2580
  var STAGE_ORDER;
2566
2581
  var init_task_state = __esm({
2567
2582
  "src/cli/task-state.ts"() {
2568
2583
  "use strict";
2569
2584
  init_task_resolution();
2585
+ init_github_api();
2570
2586
  STAGE_ORDER = ["taskify", "plan", "build", "verify", "review", "review-fix", "ship"];
2571
2587
  }
2572
2588
  });
@@ -2587,37 +2603,40 @@ async function main() {
2587
2603
  setGhCwd(projectDir);
2588
2604
  logger.info(`Working directory: ${projectDir}`);
2589
2605
  }
2590
- let taskId = input.taskId;
2591
- if (!taskId) {
2592
- if (input.issueNumber) {
2593
- const taskAction = resolveForIssue(input.issueNumber, projectDir);
2594
- logger.info(`Task action: ${taskAction.action}`);
2595
- if (taskAction.action === "already-completed") {
2596
- logger.info(`Issue #${input.issueNumber} already completed (task ${taskAction.taskId})`);
2597
- if (!input.local) {
2598
- try {
2599
- postComment(input.issueNumber, `\u2705 Issue #${input.issueNumber} already completed (task \`${taskAction.taskId}\`)`);
2600
- } catch {
2601
- }
2606
+ if (input.issueNumber) {
2607
+ const taskAction = resolveForIssue(input.issueNumber, projectDir);
2608
+ logger.info(`Task action: ${taskAction.action}`);
2609
+ if (taskAction.action === "already-completed") {
2610
+ logger.info(`Issue #${input.issueNumber} already completed (task ${taskAction.taskId})`);
2611
+ if (!input.local) {
2612
+ try {
2613
+ postComment(input.issueNumber, `\u2705 Issue #${input.issueNumber} already completed (task \`${taskAction.taskId}\`)`);
2614
+ } catch {
2602
2615
  }
2603
- process.exit(0);
2604
2616
  }
2605
- if (taskAction.action === "already-running") {
2606
- logger.info(`Issue #${input.issueNumber} already running (task ${taskAction.taskId})`);
2607
- if (!input.local) {
2608
- try {
2609
- postComment(input.issueNumber, `\u23F3 Pipeline already running for issue #${input.issueNumber} (task \`${taskAction.taskId}\`)`);
2610
- } catch {
2611
- }
2617
+ process.exit(0);
2618
+ }
2619
+ if (taskAction.action === "already-running") {
2620
+ logger.info(`Issue #${input.issueNumber} already running (task ${taskAction.taskId})`);
2621
+ if (!input.local) {
2622
+ try {
2623
+ postComment(input.issueNumber, `\u23F3 Pipeline already running for issue #${input.issueNumber} (task \`${taskAction.taskId}\`)`);
2624
+ } catch {
2612
2625
  }
2613
- process.exit(0);
2614
- }
2615
- taskId = taskAction.taskId;
2616
- if (taskAction.action === "resume") {
2617
- input.fromStage = taskAction.fromStage;
2618
- input.command = "rerun";
2619
- logger.info(`Resuming task ${taskId} from ${taskAction.fromStage}`);
2620
2626
  }
2627
+ process.exit(0);
2628
+ }
2629
+ if (taskAction.action === "resume") {
2630
+ input.taskId = taskAction.taskId;
2631
+ input.fromStage = taskAction.fromStage;
2632
+ input.command = "rerun";
2633
+ logger.info(`Resuming task ${taskAction.taskId} from ${taskAction.fromStage}`);
2634
+ }
2635
+ }
2636
+ let taskId = input.taskId;
2637
+ if (!taskId) {
2638
+ if (input.issueNumber) {
2639
+ taskId = `${input.issueNumber}-${generateTaskId()}`;
2621
2640
  } else if (input.command === "run" && input.task) {
2622
2641
  taskId = generateTaskId();
2623
2642
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine-lite",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "Autonomous SDLC pipeline: Kody orchestration + Claude Code + LiteLLM",
5
5
  "license": "MIT",
6
6
  "type": "module",