@kody-ade/kody-engine-lite 0.1.1 → 0.1.2
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 +28 -2
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -575,6 +575,21 @@ function gh(args2, options) {
|
|
|
575
575
|
stdio: options?.input ? ["pipe", "pipe", "pipe"] : ["inherit", "pipe", "pipe"]
|
|
576
576
|
}).trim();
|
|
577
577
|
}
|
|
578
|
+
function getIssue(issueNumber) {
|
|
579
|
+
try {
|
|
580
|
+
const output = gh([
|
|
581
|
+
"issue",
|
|
582
|
+
"view",
|
|
583
|
+
String(issueNumber),
|
|
584
|
+
"--json",
|
|
585
|
+
"body,title"
|
|
586
|
+
]);
|
|
587
|
+
return JSON.parse(output);
|
|
588
|
+
} catch (err) {
|
|
589
|
+
logger.error(` Failed to get issue #${issueNumber}: ${err}`);
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
578
593
|
function setLabel(issueNumber, label) {
|
|
579
594
|
try {
|
|
580
595
|
gh(["issue", "edit", String(issueNumber), "--add-label", label]);
|
|
@@ -1411,10 +1426,21 @@ async function main() {
|
|
|
1411
1426
|
if (input.task) {
|
|
1412
1427
|
fs6.writeFileSync(path5.join(taskDir, "task.md"), input.task);
|
|
1413
1428
|
}
|
|
1429
|
+
const taskMdPath = path5.join(taskDir, "task.md");
|
|
1430
|
+
if (!fs6.existsSync(taskMdPath) && input.issueNumber) {
|
|
1431
|
+
logger.info(`Fetching issue #${input.issueNumber} body as task...`);
|
|
1432
|
+
const issue = getIssue(input.issueNumber);
|
|
1433
|
+
if (issue) {
|
|
1434
|
+
const taskContent = `# ${issue.title}
|
|
1435
|
+
|
|
1436
|
+
${issue.body ?? ""}`;
|
|
1437
|
+
fs6.writeFileSync(taskMdPath, taskContent);
|
|
1438
|
+
logger.info(` Task loaded from issue #${input.issueNumber}: ${issue.title}`);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1414
1441
|
if (input.command === "run") {
|
|
1415
|
-
const taskMdPath = path5.join(taskDir, "task.md");
|
|
1416
1442
|
if (!fs6.existsSync(taskMdPath)) {
|
|
1417
|
-
console.error("No task.md found. Provide --task or ensure .tasks/<id>/task.md exists.");
|
|
1443
|
+
console.error("No task.md found. Provide --task, --issue-number, or ensure .tasks/<id>/task.md exists.");
|
|
1418
1444
|
process.exit(1);
|
|
1419
1445
|
}
|
|
1420
1446
|
}
|