@kynver-app/runtime 0.1.9 → 0.1.10
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/cli.js +6 -6
- package/dist/cli.js.map +3 -3
- package/dist/index.js +6 -6
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import { mkdirSync as mkdirSync5 } from "node:fs";
|
|
5
|
-
import path14 from "node:path";
|
|
4
|
+
import { mkdirSync as mkdirSync5, realpathSync } from "node:fs";
|
|
6
5
|
import { fileURLToPath } from "node:url";
|
|
7
6
|
|
|
8
7
|
// src/config.ts
|
|
@@ -381,12 +380,12 @@ var DEFAULT_CRITICAL_FREE_BYTES = 15 * 1024 * 1024 * 1024;
|
|
|
381
380
|
var DEFAULT_MAX_USED_PERCENT = 80;
|
|
382
381
|
var DEFAULT_HARD_MAX_USED_PERCENT = 90;
|
|
383
382
|
function observeRunnerDiskGate(input = {}) {
|
|
384
|
-
const
|
|
383
|
+
const path14 = input.diskPath?.trim() || "/";
|
|
385
384
|
const warnBelowBytes = input.diskFreeWarnBytes ?? DEFAULT_WARN_FREE_BYTES;
|
|
386
385
|
const criticalBelowBytes = input.diskFreeCriticalBytes ?? DEFAULT_CRITICAL_FREE_BYTES;
|
|
387
386
|
const maxUsedPercent = input.diskMaxUsedPercent ?? DEFAULT_MAX_USED_PERCENT;
|
|
388
387
|
const hardMaxUsedPercent = input.diskHardMaxUsedPercent ?? DEFAULT_HARD_MAX_USED_PERCENT;
|
|
389
|
-
const stats = statfsSync(
|
|
388
|
+
const stats = statfsSync(path14);
|
|
390
389
|
const freeBytes = Number(stats.bavail) * Number(stats.bsize);
|
|
391
390
|
const totalBytes = Number(stats.blocks) * Number(stats.bsize);
|
|
392
391
|
const usedPercent = totalBytes > 0 ? (totalBytes - freeBytes) / totalBytes * 100 : 100;
|
|
@@ -406,7 +405,7 @@ function observeRunnerDiskGate(input = {}) {
|
|
|
406
405
|
}
|
|
407
406
|
return {
|
|
408
407
|
ok,
|
|
409
|
-
path:
|
|
408
|
+
path: path14,
|
|
410
409
|
freeBytes,
|
|
411
410
|
totalBytes,
|
|
412
411
|
usedPercent,
|
|
@@ -1829,6 +1828,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
1829
1828
|
} else {
|
|
1830
1829
|
rest = argv;
|
|
1831
1830
|
}
|
|
1831
|
+
if (action && isHelpFlag(action) || rest.some(isHelpFlag)) return usage(0);
|
|
1832
1832
|
const args = parseArgs(rest);
|
|
1833
1833
|
const { runsDir, worktreesDir } = getPaths();
|
|
1834
1834
|
mkdirSync5(runsDir, { recursive: true });
|
|
@@ -1851,7 +1851,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
1851
1851
|
if (scope === "worker" && action === "complete") return void await completeWorker(args);
|
|
1852
1852
|
unknownCommand(scope, action);
|
|
1853
1853
|
}
|
|
1854
|
-
var isCliEntry = process.argv[1] &&
|
|
1854
|
+
var isCliEntry = process.argv[1] && realpathSync.native(process.argv[1]) === realpathSync.native(fileURLToPath(import.meta.url));
|
|
1855
1855
|
if (isCliEntry) {
|
|
1856
1856
|
void main().catch((error) => {
|
|
1857
1857
|
console.error(error);
|