@1medium/cli 1.10.0 → 1.11.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +64 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1medium/cli",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "CLI and MCP server for 1Medium AI task management",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/index.js CHANGED
@@ -927,6 +927,14 @@ scriptCmd
927
927
  if (event.Script) {
928
928
  console.log(chalk.gray(` Script: ${event.Script.name} (${event.Script.id})`));
929
929
  }
930
+ if (event.lastRunAt) {
931
+ const runColor = event.lastRunStatus === "success" ? chalk.green : chalk.red;
932
+ const duration = event.lastRunDurationMs != null ? ` (${event.lastRunDurationMs}ms)` : "";
933
+ console.log(` Last run: ${runColor(event.lastRunStatus)}${duration} at ${event.lastRunAt}`);
934
+ if (event.lastRunStatus === "failure" && event.lastRunError) {
935
+ console.log(chalk.red(` Error: ${event.lastRunError}`));
936
+ }
937
+ }
930
938
  }
931
939
  }
932
940
  console.log("");
@@ -975,6 +983,62 @@ scriptCmd
975
983
  }
976
984
  });
977
985
 
986
+ scriptCmd
987
+ .command("logs <event-id>")
988
+ .description("View execution logs for a script event")
989
+ .option("-j, --json", "Output as JSON")
990
+ .action(async (eventId, options) => {
991
+ try {
992
+ const data = await api.getScriptEvent(eventId);
993
+ const event = data.scriptEvent || data;
994
+
995
+ if (options.json) {
996
+ console.log(JSON.stringify({
997
+ id: event.id,
998
+ title: event.title,
999
+ status: event.status,
1000
+ lastRunAt: event.lastRunAt,
1001
+ lastRunStatus: event.lastRunStatus,
1002
+ lastRunDurationMs: event.lastRunDurationMs,
1003
+ lastRunError: event.lastRunError,
1004
+ lastRunLogs: event.lastRunLogs,
1005
+ }, null, 2));
1006
+ } else {
1007
+ console.log(chalk.bold(`\nScript Event: ${event.title}`));
1008
+ console.log(chalk.gray(` ID: ${event.id} Status: ${event.status}`));
1009
+
1010
+ if (!event.lastRunAt) {
1011
+ console.log(chalk.gray("\n No execution history yet.\n"));
1012
+ } else {
1013
+ const runColor = event.lastRunStatus === "success" ? chalk.green : chalk.red;
1014
+ const duration = event.lastRunDurationMs != null ? ` in ${event.lastRunDurationMs}ms` : "";
1015
+ console.log(`\n Last run: ${runColor(event.lastRunStatus)}${duration}`);
1016
+ console.log(chalk.gray(` Ran at: ${event.lastRunAt}`));
1017
+
1018
+ if (event.lastRunError) {
1019
+ console.log(chalk.red(`\n Error:\n ${event.lastRunError}`));
1020
+ }
1021
+
1022
+ if (event.lastRunLogs) {
1023
+ console.log(chalk.bold("\n Logs:"));
1024
+ console.log(
1025
+ event.lastRunLogs
1026
+ .split("\n")
1027
+ .map((line) => ` ${line}`)
1028
+ .join("\n")
1029
+ );
1030
+ } else {
1031
+ console.log(chalk.gray("\n No log output."));
1032
+ }
1033
+ console.log("");
1034
+ }
1035
+ }
1036
+ } catch (error) {
1037
+ console.error(chalk.red(`Error: ${error.message}`));
1038
+ process.exit(1);
1039
+ }
1040
+ });
1041
+
978
1042
  // ============================================================================
979
1043
  // Secret Commands
980
1044
  // ============================================================================