@kody-ade/kody-engine-lite 0.1.13 → 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/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();
|