@kody-ade/kody-engine-lite 0.1.12 → 0.1.14
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 +27 -2
- package/package.json +1 -1
- package/templates/kody.yml +12 -3
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
3
9
|
var __esm = (fn, res) => function __init() {
|
|
4
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
11
|
};
|
|
@@ -1715,9 +1721,28 @@ function parseArgs() {
|
|
|
1715
1721
|
function findLatestTaskForIssue(issueNumber, projectDir) {
|
|
1716
1722
|
const tasksDir = path5.join(projectDir, ".tasks");
|
|
1717
1723
|
if (!fs6.existsSync(tasksDir)) return null;
|
|
1724
|
+
const allDirs = fs6.readdirSync(tasksDir).sort().reverse();
|
|
1718
1725
|
const prefix = `${issueNumber}-`;
|
|
1719
|
-
const
|
|
1720
|
-
|
|
1726
|
+
const direct = allDirs.find((d) => d.startsWith(prefix));
|
|
1727
|
+
if (direct) return direct;
|
|
1728
|
+
try {
|
|
1729
|
+
const { execFileSync: execFileSync8 } = __require("child_process");
|
|
1730
|
+
const branch = execFileSync8("git", ["branch", "--show-current"], {
|
|
1731
|
+
encoding: "utf-8",
|
|
1732
|
+
cwd: projectDir,
|
|
1733
|
+
timeout: 5e3,
|
|
1734
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
1735
|
+
}).trim();
|
|
1736
|
+
const branchIssueMatch = branch.match(/^(\d+)-/);
|
|
1737
|
+
if (branchIssueMatch) {
|
|
1738
|
+
const branchIssueNum = branchIssueMatch[1];
|
|
1739
|
+
const branchPrefix = `${branchIssueNum}-`;
|
|
1740
|
+
const fromBranch = allDirs.find((d) => d.startsWith(branchPrefix));
|
|
1741
|
+
if (fromBranch) return fromBranch;
|
|
1742
|
+
}
|
|
1743
|
+
} catch {
|
|
1744
|
+
}
|
|
1745
|
+
return allDirs[0] ?? null;
|
|
1721
1746
|
}
|
|
1722
1747
|
function generateTaskId() {
|
|
1723
1748
|
const now = /* @__PURE__ */ new Date();
|
package/package.json
CHANGED
package/templates/kody.yml
CHANGED
|
@@ -117,15 +117,24 @@ jobs:
|
|
|
117
117
|
|
|
118
118
|
# For approve mode: extract answer body and convert to rerun
|
|
119
119
|
# Must run BEFORE task-id generation so we don't create a new task
|
|
120
|
+
# approve: extract answers, convert to rerun
|
|
120
121
|
if [ "$MODE" = "approve" ]; then
|
|
121
122
|
APPROVE_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*approve/,$p' | tail -n +2)
|
|
122
123
|
FEEDBACK="$APPROVE_BODY"
|
|
123
124
|
MODE="rerun"
|
|
124
|
-
# Leave TASK_ID empty — entry.ts findLatestTaskForIssue will find the paused task
|
|
125
125
|
fi
|
|
126
126
|
|
|
127
|
-
#
|
|
128
|
-
if [
|
|
127
|
+
# fix: extract description as feedback, convert to fix command
|
|
128
|
+
if [ "$MODE" = "fix" ]; then
|
|
129
|
+
FIX_BODY=$(echo "$BODY" | sed -n '/\(@kody\|\/kody\)\s*fix/,$p' | tail -n +2)
|
|
130
|
+
if [ -n "$FIX_BODY" ]; then
|
|
131
|
+
FEEDBACK="$FIX_BODY"
|
|
132
|
+
fi
|
|
133
|
+
# Leave TASK_ID empty — entry.ts finds latest task for issue
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
# Auto-generate task-id if not provided (only for full mode)
|
|
137
|
+
if [ -z "$TASK_ID" ] && [ "$MODE" = "full" ]; then
|
|
129
138
|
TASK_ID="${ISSUE_NUM}-$(date +%y%m%d-%H%M%S)"
|
|
130
139
|
fi
|
|
131
140
|
|