zapdev 1.14.0 → 1.15.0
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 +18 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1854,7 +1854,7 @@ function _getBuiltinFlags(long, short, userNames, userAliases) {
|
|
|
1854
1854
|
// package.json
|
|
1855
1855
|
var package_default = {
|
|
1856
1856
|
name: "zapdev",
|
|
1857
|
-
version: "1.
|
|
1857
|
+
version: "1.15.0",
|
|
1858
1858
|
description: "Fast, performant and lightweight git chores and dev tools using your terminal and an OpenAI-compatible LLM endpoint.",
|
|
1859
1859
|
type: "module",
|
|
1860
1860
|
bin: {
|
|
@@ -2586,30 +2586,44 @@ import { styleText as styleText3 } from "node:util";
|
|
|
2586
2586
|
async function runGitTask(label, operation, successMessage, run) {
|
|
2587
2587
|
const title = `${label}: ${operation}`;
|
|
2588
2588
|
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
2589
|
+
const loader = interactive ? spinner({ withGuide: false }) : void 0;
|
|
2590
|
+
const startLoading = () => {
|
|
2591
|
+
if (!loader) return;
|
|
2592
|
+
const wasRaw = Boolean(process.stdin.isRaw);
|
|
2593
|
+
loader.start(title);
|
|
2594
|
+
process.stdin.setRawMode?.(wasRaw);
|
|
2595
|
+
process.stdin.pause();
|
|
2596
|
+
};
|
|
2589
2597
|
let task;
|
|
2590
2598
|
const onOutput = (chunk, stream) => {
|
|
2591
2599
|
if (!interactive) {
|
|
2592
2600
|
process[stream].write(chunk);
|
|
2593
2601
|
return;
|
|
2594
2602
|
}
|
|
2595
|
-
task
|
|
2603
|
+
if (!task) loader?.clear();
|
|
2604
|
+
task ??= taskLog({ title: `${title}: running\u2026`, limit: 10, retainLog: true });
|
|
2596
2605
|
task.message(chunk, { raw: true });
|
|
2597
2606
|
};
|
|
2598
2607
|
const onHook = (event) => {
|
|
2608
|
+
loader?.clear();
|
|
2599
2609
|
const hook = `${label}: ${event.name}`;
|
|
2600
|
-
const message = event.phase === "start" ? hook : `${hook}: ${event.exitCode === 0 ? "completed" : `failed (exit ${event.exitCode})`}`;
|
|
2610
|
+
const message = event.phase === "start" ? `${hook}: running\u2026` : `${hook}: ${event.exitCode === 0 ? "completed" : `failed (exit ${event.exitCode})`}`;
|
|
2601
2611
|
if (task) task.message(message);
|
|
2602
2612
|
else if (event.phase === "start") log.step(styleText3("bold", message));
|
|
2603
2613
|
else if (event.exitCode === 0) log.success(message);
|
|
2604
2614
|
else log.error(message);
|
|
2615
|
+
if (event.phase === "exit" && !task) startLoading();
|
|
2605
2616
|
};
|
|
2606
|
-
log.info(title);
|
|
2617
|
+
if (!interactive) log.info(title);
|
|
2618
|
+
startLoading();
|
|
2607
2619
|
try {
|
|
2608
2620
|
await run(onHook, onOutput);
|
|
2621
|
+
loader?.clear();
|
|
2609
2622
|
if (task) task.success(successMessage, { showLog: true });
|
|
2610
2623
|
else log.success(successMessage);
|
|
2611
2624
|
return true;
|
|
2612
2625
|
} catch (error) {
|
|
2626
|
+
loader?.clear();
|
|
2613
2627
|
const message = `${label}: ${operation} failed${error instanceof GitOutputError ? "" : `: ${errorMessage(error)}`}`;
|
|
2614
2628
|
if (task) task.error(message);
|
|
2615
2629
|
else if (!(error instanceof GitOutputError && error.hookFailureReported)) log.error(message);
|