@vm0/cli 4.5.1 → 4.5.2
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/index.js +22 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -813,35 +813,34 @@ var EventRenderer = class {
|
|
|
813
813
|
return `${(elapsedMs / 1e3).toFixed(1)}s`;
|
|
814
814
|
}
|
|
815
815
|
/**
|
|
816
|
-
* Format timestamp for display
|
|
816
|
+
* Format timestamp for display (without milliseconds, matching metrics format)
|
|
817
817
|
*/
|
|
818
818
|
static formatTimestamp(timestamp) {
|
|
819
|
-
return timestamp.toISOString();
|
|
819
|
+
return timestamp.toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
820
820
|
}
|
|
821
821
|
/**
|
|
822
822
|
* Render a parsed event to console
|
|
823
823
|
*/
|
|
824
824
|
static render(event, options) {
|
|
825
|
-
const timestampPrefix = options?.showTimestamp ?
|
|
826
|
-
const
|
|
825
|
+
const timestampPrefix = options?.showTimestamp ? `[${this.formatTimestamp(event.timestamp)}] ` : "";
|
|
826
|
+
const elapsedSuffix = options?.verbose && options?.previousTimestamp ? " " + chalk3.gray(
|
|
827
827
|
this.formatElapsed(options.previousTimestamp, event.timestamp)
|
|
828
828
|
) : "";
|
|
829
|
-
const prefix = timestampPrefix + elapsedPrefix;
|
|
830
829
|
switch (event.type) {
|
|
831
830
|
case "init":
|
|
832
|
-
this.renderInit(event,
|
|
831
|
+
this.renderInit(event, timestampPrefix, elapsedSuffix);
|
|
833
832
|
break;
|
|
834
833
|
case "text":
|
|
835
|
-
this.renderText(event,
|
|
834
|
+
this.renderText(event, timestampPrefix, elapsedSuffix);
|
|
836
835
|
break;
|
|
837
836
|
case "tool_use":
|
|
838
|
-
this.renderToolUse(event,
|
|
837
|
+
this.renderToolUse(event, timestampPrefix, elapsedSuffix);
|
|
839
838
|
break;
|
|
840
839
|
case "tool_result":
|
|
841
|
-
this.renderToolResult(event,
|
|
840
|
+
this.renderToolResult(event, timestampPrefix, elapsedSuffix);
|
|
842
841
|
break;
|
|
843
842
|
case "result":
|
|
844
|
-
this.renderResult(event,
|
|
843
|
+
this.renderResult(event, timestampPrefix, elapsedSuffix);
|
|
845
844
|
break;
|
|
846
845
|
}
|
|
847
846
|
}
|
|
@@ -888,8 +887,10 @@ var EventRenderer = class {
|
|
|
888
887
|
console.log(chalk3.red("\u2717 Run failed"));
|
|
889
888
|
console.log(` Error: ${chalk3.red(error43 || "Unknown error")}`);
|
|
890
889
|
}
|
|
891
|
-
static renderInit(event, prefix) {
|
|
892
|
-
console.log(
|
|
890
|
+
static renderInit(event, prefix, suffix) {
|
|
891
|
+
console.log(
|
|
892
|
+
prefix + chalk3.cyan("[init]") + suffix + " Starting Claude Code agent"
|
|
893
|
+
);
|
|
893
894
|
console.log(` Session: ${chalk3.gray(String(event.data.sessionId || ""))}`);
|
|
894
895
|
console.log(` Model: ${chalk3.gray(String(event.data.model || ""))}`);
|
|
895
896
|
console.log(
|
|
@@ -898,13 +899,13 @@ var EventRenderer = class {
|
|
|
898
899
|
)}`
|
|
899
900
|
);
|
|
900
901
|
}
|
|
901
|
-
static renderText(event, prefix) {
|
|
902
|
+
static renderText(event, prefix, suffix) {
|
|
902
903
|
const text = String(event.data.text || "");
|
|
903
|
-
console.log(chalk3.blue("[text]") +
|
|
904
|
+
console.log(prefix + chalk3.blue("[text]") + suffix + " " + text);
|
|
904
905
|
}
|
|
905
|
-
static renderToolUse(event, prefix) {
|
|
906
|
+
static renderToolUse(event, prefix, suffix) {
|
|
906
907
|
const tool = String(event.data.tool || "");
|
|
907
|
-
console.log(chalk3.yellow("[tool_use]") +
|
|
908
|
+
console.log(prefix + chalk3.yellow("[tool_use]") + suffix + " " + tool);
|
|
908
909
|
const input = event.data.input;
|
|
909
910
|
if (input && typeof input === "object") {
|
|
910
911
|
for (const [key, value] of Object.entries(input)) {
|
|
@@ -915,19 +916,19 @@ var EventRenderer = class {
|
|
|
915
916
|
}
|
|
916
917
|
}
|
|
917
918
|
}
|
|
918
|
-
static renderToolResult(event, prefix) {
|
|
919
|
+
static renderToolResult(event, prefix, suffix) {
|
|
919
920
|
const isError = Boolean(event.data.isError);
|
|
920
921
|
const status = isError ? "Error" : "Completed";
|
|
921
922
|
const color = isError ? chalk3.red : chalk3.green;
|
|
922
|
-
console.log(color("[tool_result]") +
|
|
923
|
+
console.log(prefix + color("[tool_result]") + suffix + " " + status);
|
|
923
924
|
const result = String(event.data.result || "");
|
|
924
925
|
console.log(` ${chalk3.gray(result)}`);
|
|
925
926
|
}
|
|
926
|
-
static renderResult(event, prefix) {
|
|
927
|
+
static renderResult(event, prefix, suffix) {
|
|
927
928
|
const success2 = Boolean(event.data.success);
|
|
928
929
|
const status = success2 ? "\u2713 completed successfully" : "\u2717 failed";
|
|
929
930
|
const color = success2 ? chalk3.green : chalk3.red;
|
|
930
|
-
console.log(color("[result]") +
|
|
931
|
+
console.log(prefix + color("[result]") + suffix + " " + status);
|
|
931
932
|
const durationMs = Number(event.data.durationMs || 0);
|
|
932
933
|
const durationSec = (durationMs / 1e3).toFixed(1);
|
|
933
934
|
console.log(` Duration: ${chalk3.gray(durationSec + "s")}`);
|
|
@@ -15966,7 +15967,7 @@ function handleError(error43, runId) {
|
|
|
15966
15967
|
|
|
15967
15968
|
// src/index.ts
|
|
15968
15969
|
var program = new Command21();
|
|
15969
|
-
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.
|
|
15970
|
+
program.name("vm0").description("VM0 CLI - A modern build tool").version("4.5.2");
|
|
15970
15971
|
program.command("info").description("Display environment information").action(async () => {
|
|
15971
15972
|
console.log(chalk19.cyan("System Information:"));
|
|
15972
15973
|
console.log(`Node Version: ${process.version}`);
|