@zhongqian97-code/ecode 0.5.10 → 0.5.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/index.js +26 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2458,6 +2458,7 @@ function parseInterval(input) {
|
|
|
2458
2458
|
const ms = parseInt(normalized, 10) * 1e3;
|
|
2459
2459
|
return ms > 0 && ms >= MIN_INTERVAL_MS ? { intervalMs: ms } : null;
|
|
2460
2460
|
}
|
|
2461
|
+
if (!/^(\d+\s*[smh])+$/i.test(normalized)) return null;
|
|
2461
2462
|
let totalMs = 0;
|
|
2462
2463
|
let matchCount = 0;
|
|
2463
2464
|
TIME_TOKEN_RE.lastIndex = 0;
|
|
@@ -2493,10 +2494,27 @@ async function cmdLoop(args, deps) {
|
|
|
2493
2494
|
const spaceIdx = trimmed.indexOf(" ");
|
|
2494
2495
|
if (spaceIdx !== -1) {
|
|
2495
2496
|
const firstToken = trimmed.slice(0, spaceIdx);
|
|
2496
|
-
const
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2497
|
+
const rest = trimmed.slice(spaceIdx + 1);
|
|
2498
|
+
const parsed1 = parseInterval(firstToken);
|
|
2499
|
+
if (parsed1 !== null) {
|
|
2500
|
+
intervalMs = parsed1.intervalMs;
|
|
2501
|
+
prompt = rest.trim();
|
|
2502
|
+
} else {
|
|
2503
|
+
const secondSpaceIdx = rest.indexOf(" ");
|
|
2504
|
+
if (secondSpaceIdx !== -1) {
|
|
2505
|
+
const twoToken = `${firstToken} ${rest.slice(0, secondSpaceIdx)}`;
|
|
2506
|
+
const parsed2 = parseInterval(twoToken);
|
|
2507
|
+
if (parsed2 !== null) {
|
|
2508
|
+
intervalMs = parsed2.intervalMs;
|
|
2509
|
+
prompt = rest.slice(secondSpaceIdx + 1).trim();
|
|
2510
|
+
}
|
|
2511
|
+
} else {
|
|
2512
|
+
const parsed2 = parseInterval(`${firstToken} ${rest}`);
|
|
2513
|
+
if (parsed2 !== null) {
|
|
2514
|
+
intervalMs = parsed2.intervalMs;
|
|
2515
|
+
prompt = "";
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2500
2518
|
}
|
|
2501
2519
|
} else {
|
|
2502
2520
|
const parsed = parseInterval(trimmed);
|
|
@@ -3616,7 +3634,10 @@ function resolveBuiltinSkillsDir() {
|
|
|
3616
3634
|
for (let i = 0; i < 4; i++) {
|
|
3617
3635
|
const candidate = path9.join(dir, "skills");
|
|
3618
3636
|
if (fs11.existsSync(candidate) && fs11.statSync(candidate).isDirectory()) {
|
|
3619
|
-
|
|
3637
|
+
const hasSkillContent = fs11.readdirSync(candidate).some(
|
|
3638
|
+
(entry) => fs11.existsSync(path9.join(candidate, entry, "SKILL.md"))
|
|
3639
|
+
);
|
|
3640
|
+
if (hasSkillContent) return candidate;
|
|
3620
3641
|
}
|
|
3621
3642
|
const parent = path9.dirname(dir);
|
|
3622
3643
|
if (parent === dir) break;
|