@vitest-agent/cli 4.1.17 → 4.1.18

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/commands/agent.js CHANGED
@@ -1,25 +1,24 @@
1
- import { failureCode } from "../lib/failure-code.js";
2
- import { currentCwd } from "./flag-defaults.js";
3
- import { recordCommand } from "./record.js";
4
- import { triageCommand } from "./triage.js";
5
- import { wrapupCommand } from "./wrapup.js";
6
- import * as NodeServices from "@effect/platform-node/NodeServices";
7
- import { CliExit } from "@effected/cli-kit";
8
- import { SidecarPlatformLive, endAgentEffect, registerAgentEffect, resolveHookPaths, resolveProjectKeyFromCwdEffect } from "@vitest-agent/engine";
9
- import { Effect, Option } from "effect";
10
- import { Argument, Command, Flag } from "effect/cli";
11
1
  import { existsSync, readFileSync } from "node:fs";
12
2
  import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
3
+ import * as NodeServices from "@effect/platform-node/NodeServices";
4
+ import { CliExit, CliFormat } from "@effected/cli-kit";
13
5
  import { WorkspaceDiscoveryError, WorkspacePatternError, findWorkspaceRootSync, getWorkspacePackagesSync } from "@effected/workspaces";
14
6
  import { nodeSyncOps } from "@effected/workspaces/node-sync";
7
+ import { SidecarPlatformLive, endAgentEffect, registerAgentEffect, resolveHookPaths, resolveProjectKeyFromCwdEffect } from "@vitest-agent/engine";
15
8
  import { VITEST_CONFIG_FILES, classifyTestPath, detectNonDefaultDiscoverStrategy, findOwningWorkspace } from "@vitest-agent/sdk";
16
9
  import { injectEnv } from "@vitest-agent/sdk/dispatch";
17
10
  import { resolveSidecarBinaryPath } from "@vitest-agent/sidecar";
11
+ import { Clock, Console, Effect, Option } from "effect";
12
+ import { Argument, Command, Flag } from "effect/cli";
13
+ import { ProjectDir } from "../layers/project-data.js";
14
+ import { failureCode } from "../lib/failure-code.js";
15
+ import { currentCwd } from "./flag-defaults.js";
16
+ import { recordCommand } from "./record.js";
17
+ import { triageCommand } from "./triage.js";
18
+ import { wrapupCommand } from "./wrapup.js";
18
19
 
19
20
  // src/commands/agent.ts
20
- const writeStdout = (line) => Effect.sync(() => {
21
- process.stdout.write(`${line}\n`);
22
- });
21
+ const writeStdout = (line) => Console.log(line);
23
22
  /**
24
23
  * Runs a hook step, turning any cause into the sidecar family's stderr line
25
24
  * plus a recorded exit code. `CliExit.reportCause` SUCCEEDS on purpose: a
@@ -47,12 +46,13 @@ const registerAgentSubcommand = Command.make("register-agent", {
47
46
  projectKeyOverride: projectKeyOverrideOpt
48
47
  }, (opts) => Effect.gen(function* () {
49
48
  const projectKey = Option.isSome(opts.projectKeyOverride) ? opts.projectKeyOverride.value : yield* resolveProjectKeyFromCwdEffect(opts.cwd);
49
+ const { env } = yield* ProjectDir;
50
50
  const pathsOpt = yield* orReportCause(resolveHookPaths({
51
- env: process.env,
51
+ env,
52
52
  projectKey
53
53
  }));
54
54
  if (Option.isNone(pathsOpt)) return;
55
- const sidecar = SidecarPlatformLive(pathsOpt.value, process.env);
55
+ const sidecar = SidecarPlatformLive(pathsOpt.value, env);
56
56
  const program = registerAgentEffect({
57
57
  hostSessionId: opts.hostSessionId,
58
58
  transcriptPath: opts.transcriptPath,
@@ -66,13 +66,13 @@ const registerAgentSubcommand = Command.make("register-agent", {
66
66
  const resultOpt = yield* orReportCause(program.pipe(Effect.provide(sidecar, { local: true })));
67
67
  if (Option.isNone(resultOpt)) return;
68
68
  const result = resultOpt.value;
69
- yield* writeStdout(JSON.stringify({
69
+ yield* CliFormat.printJson({
70
70
  agentId: result.agentId,
71
71
  conversationId: result.conversationId,
72
72
  mainAgentId: result.mainAgentId,
73
73
  idempotencyKey: result.idempotencyKey,
74
74
  idempotencyHit: result.idempotencyHit
75
- }));
75
+ }, { indent: 0 });
76
76
  }).pipe(Effect.provide(NodeServices.layer))).pipe(Command.withDescription("Register an agent invocation in the per-project store and the per-client session map"));
77
77
  const agentIdOpt = Flag.String("agent-id").pipe(Flag.withDescription("The agent_id (UUID) returned by an earlier register-agent call"));
78
78
  const endedAtOpt = Flag.optional(Flag.Int("ended-at"));
@@ -87,13 +87,14 @@ const endAgentSubcommand = Command.make("end-agent", {
87
87
  projectKeyOverride: endProjectKeyOverrideOpt
88
88
  }, (opts) => Effect.gen(function* () {
89
89
  const projectKey = Option.isSome(opts.projectKeyOverride) ? opts.projectKeyOverride.value : yield* resolveProjectKeyFromCwdEffect(opts.cwd);
90
+ const { env } = yield* ProjectDir;
90
91
  const pathsOpt = yield* orReportCause(resolveHookPaths({
91
- env: process.env,
92
+ env,
92
93
  projectKey
93
94
  }));
94
95
  if (Option.isNone(pathsOpt)) return;
95
- const sidecar = SidecarPlatformLive(pathsOpt.value, process.env);
96
- const endedAt = Option.isSome(opts.endedAt) ? opts.endedAt.value : Math.floor(Date.now() / 1e3);
96
+ const sidecar = SidecarPlatformLive(pathsOpt.value, env);
97
+ const endedAt = Option.isSome(opts.endedAt) ? opts.endedAt.value : Math.floor((yield* Clock.currentTimeMillis) / 1e3);
97
98
  yield* orReportCause(endAgentEffect({
98
99
  agentId: opts.agentId,
99
100
  endedAt,
@@ -105,15 +106,12 @@ const cwdInjectOpt = Flag.String("cwd").pipe(Flag.withDefault(currentCwd), Flag.
105
106
  const injectEnvSubcommand = Command.make("inject-env", {
106
107
  command: commandOpt,
107
108
  cwd: cwdInjectOpt
108
- }, (opts) => Effect.sync(() => {
109
- const out = injectEnv({
110
- command: opts.command,
111
- cwd: opts.cwd,
112
- env: process.env,
113
- readFile: (path) => readFileSync(path, "utf-8")
114
- });
115
- process.stdout.write(`${out}\n`);
116
- })).pipe(Command.withDescription("Rewrite a Bash command to prepend VITEST_AGENT_* env vars when it invokes Vitest"));
109
+ }, (opts) => Effect.sync(() => injectEnv({
110
+ command: opts.command,
111
+ cwd: opts.cwd,
112
+ env: process.env,
113
+ readFile: (path) => readFileSync(path, "utf-8")
114
+ })).pipe(Effect.flatMap(writeStdout))).pipe(Command.withDescription("Rewrite a Bash command to prepend VITEST_AGENT_* env vars when it invokes Vitest"));
117
115
  const sidecarPathSubcommand = Command.make("sidecar-path", {}, () => Effect.gen(function* () {
118
116
  const path = resolveSidecarBinaryPath();
119
117
  if (path === null) return yield* CliExit.set(1);
@@ -192,10 +190,10 @@ function checkTestPath(path, from) {
192
190
  return classifyTestPath(packages, absolute);
193
191
  }
194
192
  const checkTestPathSubcommand = Command.make("check-test-path", { path: testPathArg }, (opts) => Effect.gen(function* () {
195
- const from = process.env.VITEST_AGENT_PROJECT_DIR ?? process.cwd();
193
+ const { dir: from } = yield* ProjectDir;
196
194
  const classification = yield* Effect.sync(() => checkTestPath(opts.path, from));
197
195
  if (classification === null) return yield* CliExit.set(1);
198
- yield* writeStdout(JSON.stringify(classification));
196
+ yield* CliFormat.printJson(classification, { indent: 0 });
199
197
  })).pipe(Command.withDescription("Classify a test file path as valid, excluded, or invalid for Vitest discovery"));
200
198
  const agentParent = Command.make("agent").pipe(Command.withDescription("Commands intended for agents and hook scripts — humans typically don't invoke these directly."));
201
199
  const agentCommand = agentParent.pipe(Command.withSubcommands([
package/commands/db.js CHANGED
@@ -1,18 +1,18 @@
1
- import { ProjectDataLive, ProjectDir } from "../layers/project-data.js";
2
- import { formatDbQuery } from "../lib/format-db-query.js";
1
+ import { layer } from "@effect/sql-sqlite-node/SqliteClient";
3
2
  import { Cancelled, CliExit, CliInteractive, Fmt } from "@effected/cli-kit";
4
3
  import { ConfigLive, DataStore, VitestAgentConfigFile, resolveDataPath } from "@vitest-agent/engine";
4
+ import { RunRetentionPolicy, VitestAgentConfig } from "@vitest-agent/sdk";
5
5
  import { Console, Effect, FileSystem, Layer, Option, Schema } from "effect";
6
6
  import { Argument, Command, Flag, Prompt } from "effect/cli";
7
- import { RunRetentionPolicy, VitestAgentConfig } from "@vitest-agent/sdk";
8
- import { layer } from "@effect/sql-sqlite-node/SqliteClient";
9
7
  import { SqlClient } from "effect/sql/SqlClient";
8
+ import { ProjectDataLive, ProjectDir } from "../layers/project-data.js";
9
+ import { formatDbQuery } from "../lib/format-db-query.js";
10
10
 
11
11
  // src/commands/db.ts
12
12
  const pathCommand = Command.make("path", {}, () => Effect.gen(function* () {
13
13
  const { dir } = yield* ProjectDir;
14
14
  const dbPath = yield* resolveDataPath(dir);
15
- yield* Effect.sync(() => process.stdout.write(`${dbPath}\n`));
15
+ yield* Console.log(dbPath);
16
16
  })).pipe(Command.withDescription("Print the resolved database path"));
17
17
  const keepRecentOption = Flag.withDefault(Flag.Int("keep-recent"), 30).pipe(Flag.withDescription("Number of most-recent sessions to keep in full"));
18
18
  /** A whole number of runs or days, at least one — the same bound the `[retention]` table enforces. */
@@ -51,26 +51,26 @@ const pruneCommand = Command.make("prune", {
51
51
  const sql = yield* SqlClient;
52
52
  const configFile = yield* VitestAgentConfigFile;
53
53
  const sessions = yield* store.pruneSessions(keepRecent);
54
- yield* Effect.sync(() => process.stdout.write(`Pruned ${sessions.prunedTurns} turn row(s) across ${sessions.affectedSessions} session(s); session rows retained.\n`));
54
+ yield* Console.log(`Pruned ${sessions.prunedTurns} turn row(s) across ${sessions.affectedSessions} session(s); session rows retained.`);
55
55
  const config = yield* configFile.loadOrDefault(new VitestAgentConfig({}));
56
56
  const policy = resolveRunRetention(RunRetentionPolicy.fromConfig(config), keepRuns, maxAgeDays);
57
57
  if (Option.isNone(policy)) {
58
- yield* Effect.sync(() => process.stdout.write("Run retention is disabled ([retention] enabled = false); no runs pruned.\n"));
58
+ yield* Console.log("Run retention is disabled ([retention] enabled = false); no runs pruned.");
59
59
  return;
60
60
  }
61
61
  const runs = yield* store.pruneRuns(policy.value);
62
62
  yield* sql`PRAGMA wal_checkpoint(TRUNCATE)`;
63
63
  const age = policy.value.maxAgeDays === void 0 ? "" : `, none older than ${policy.value.maxAgeDays} day(s)`;
64
- yield* Effect.sync(() => process.stdout.write(`Pruned ${runs.prunedRuns} run(s) and ${runs.prunedFiles} orphaned file row(s); kept the newest ${policy.value.keepRuns} run(s) per project${age}.\n`));
64
+ yield* Console.log(`Pruned ${runs.prunedRuns} run(s) and ${runs.prunedFiles} orphaned file row(s); kept the newest ${policy.value.keepRuns} run(s) per project${age}.`);
65
65
  })).pipe(Command.withDescription("Drop old sessions' turn history (keeps the last N in full) and apply the run-retention policy to test runs"), Command.provide(Layer.mergeAll(ProjectDataLive, ProjectConfigLive)));
66
66
  const yesOption = Flag.Boolean("yes").pipe(Flag.withDefault(false), Flag.withDescription("Skip the interactive confirmation prompt"));
67
67
  const resetCommand = Command.make("reset", { yes: yesOption }, ({ yes }) => Effect.gen(function* () {
68
- const agentId = process.env.VITEST_AGENT_AGENT_ID;
68
+ const { dir, env } = yield* ProjectDir;
69
+ const agentId = env.VITEST_AGENT_AGENT_ID;
69
70
  if (agentId !== void 0 && agentId.length > 0) {
70
71
  yield* Console.error("db reset is human-only; use db prune or run from a human terminal");
71
72
  return yield* CliExit.set(4);
72
73
  }
73
- const { dir } = yield* ProjectDir;
74
74
  const dbPath = yield* resolveDataPath(dir);
75
75
  if (!yes && !(yield* CliInteractive)) {
76
76
  yield* Console.error("db reset requires --yes when the run is not interactive (stdout or stdin is not a TTY, or the audience is not human)");
@@ -98,24 +98,18 @@ const queryCommand = Command.make("query", {
98
98
  format: queryFormatOption
99
99
  }, ({ sql, format }) => Effect.gen(function* () {
100
100
  if (sql.trim().length === 0) {
101
- yield* Effect.sync(() => {
102
- process.stderr.write("db query: missing sql\n");
103
- });
101
+ yield* Console.error("db query: missing sql");
104
102
  return yield* CliExit.set(2);
105
103
  }
106
104
  const { dir } = yield* ProjectDir;
107
105
  const dbPath = yield* resolveDataPath(dir);
108
106
  yield* Effect.gen(function* () {
109
107
  const rows = yield* (yield* SqlClient).unsafe(sql);
110
- yield* Effect.sync(() => {
111
- process.stdout.write(`${formatDbQuery(rows, format)}\n`);
112
- });
108
+ yield* Console.log(formatDbQuery(rows, format));
113
109
  }).pipe(Effect.provide(layer({
114
110
  filename: dbPath,
115
111
  readonly: true
116
- })), Effect.catch((error) => Effect.sync(() => {
117
- process.stderr.write(`db query: ${Fmt.errorText(error)}\n`);
118
- }).pipe(Effect.andThen(CliExit.set(3)))));
112
+ })), Effect.catch((error) => Console.error(`db query: ${Fmt.errorText(error)}`).pipe(Effect.andThen(CliExit.set(3)))));
119
113
  })).pipe(Command.withDescription("Run a read-only SQL query against the database"));
120
114
  const dbParent = Command.make("db").pipe(Command.withDescription("Manage the vitest-agent database"));
121
115
  const dbCommand = dbParent.pipe(Command.withSubcommands([
@@ -1,15 +1,13 @@
1
- import { ProjectDataLive, ProjectDir } from "../layers/project-data.js";
2
- import { formatDoctor } from "../lib/format-doctor.js";
3
1
  import { CliExit, CliFormat } from "@effected/cli-kit";
4
2
  import { DataReader, resolveDataPath } from "@vitest-agent/engine";
5
- import { Effect, Option } from "effect";
3
+ import { Clock, Console, Effect, Option } from "effect";
6
4
  import { Command, Flag } from "effect/cli";
5
+ import { ProjectDataLive, ProjectDir } from "../layers/project-data.js";
6
+ import { formatDoctor } from "../lib/format-doctor.js";
7
7
 
8
8
  // src/commands/doctor.ts
9
9
  const formatOption = Flag.withDefault(Flag.Literals("format", ["markdown", "json"]), "markdown");
10
- const writeOutput = (results, format) => format === "json" ? CliFormat.printJson(results) : Effect.sync(() => {
11
- process.stdout.write(`${formatDoctor(results)}\n`);
12
- });
10
+ const writeOutput = (results, format) => format === "json" ? CliFormat.printJson(results) : Console.log(formatDoctor(results));
13
11
  const doctorCommand = Command.make("doctor", { format: formatOption }, ({ format }) => Effect.gen(function* () {
14
12
  const reader = yield* DataReader;
15
13
  const results = [];
@@ -84,7 +82,7 @@ const doctorCommand = Command.make("doctor", { format: formatOption }, ({ format
84
82
  const timestamps = manifest.projects.map((e) => e.lastRun).filter((t) => t !== null);
85
83
  if (timestamps.length > 0) {
86
84
  const latest = new Date(Math.max(...timestamps.map((t) => new Date(t).getTime())));
87
- const ageMs = Date.now() - latest.getTime();
85
+ const ageMs = (yield* Clock.currentTimeMillis) - latest.getTime();
88
86
  const ageMinutes = Math.floor(ageMs / 6e4);
89
87
  const ageHours = Math.floor(ageMs / 36e5);
90
88
  const ageDays = Math.floor(ageMs / 864e5);
@@ -1,9 +1,9 @@
1
+ import { CliExit, CliFormat, Fmt } from "@effected/cli-kit";
2
+ import { ChangeKind, DataReader, DataStore, dispatchRecordTddArtifactEffect, recordRunWorkspaceChangesEffect, recordSessionEnd, recordSessionStart, recordTurnEffect } from "@vitest-agent/engine";
3
+ import { Effect, Option, Schema } from "effect";
4
+ import { Argument, Command, Flag } from "effect/cli";
1
5
  import { ProjectDataLive } from "../layers/project-data.js";
2
6
  import { nowIso } from "./flag-defaults.js";
3
- import { CliExit, Fmt } from "@effected/cli-kit";
4
- import { DataReader, DataStore, dispatchRecordTddArtifactEffect, recordRunWorkspaceChangesEffect, recordSessionEnd, recordSessionStart, recordTurnEffect } from "@vitest-agent/engine";
5
- import { Effect, Option } from "effect";
6
- import { Argument, Command, Flag } from "effect/cli";
7
7
 
8
8
  // src/commands/record.ts
9
9
  /**
@@ -30,7 +30,7 @@ const turnSubcommand = Command.make("turn", {
30
30
  occurredAt,
31
31
  ...project._tag === "Some" && { project: project.value },
32
32
  cwd: cwd._tag === "Some" ? cwd.value : process.cwd()
33
- }).pipe(Effect.flatMap((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`))), Effect.catch(reportFailure("turn")))).pipe(Command.withDescription("Validate a TurnPayload JSON and write a turn row"));
33
+ }).pipe(Effect.flatMap((result) => CliFormat.printJson(result, { indent: 0 })), Effect.catch(reportFailure("turn")))).pipe(Command.withDescription("Validate a TurnPayload JSON and write a turn row"));
34
34
  const agentKind = Flag.Literals("agent-kind", ["main", "subagent"]).pipe(Flag.withDefault("main"));
35
35
  const agentType = Flag.optional(Flag.String("agent-type"));
36
36
  const parentChatId = Flag.optional(Flag.String("parent-chat-id"));
@@ -54,7 +54,7 @@ const sessionStartSubcommand = Command.make("session-start", {
54
54
  ...opts.parentChatId._tag === "Some" && { parentChatId: opts.parentChatId.value },
55
55
  triageWasNonEmpty: opts.triageWasNonEmpty,
56
56
  startedAt: opts.startedAt
57
- }).pipe(Effect.flatMap((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`))), Effect.catch(reportFailure("session-start")))).pipe(Command.withDescription("Insert a new sessions row"));
57
+ }).pipe(Effect.flatMap((result) => CliFormat.printJson(result, { indent: 0 })), Effect.catch(reportFailure("session-start")))).pipe(Command.withDescription("Insert a new sessions row"));
58
58
  const endedAt = Flag.String("ended-at").pipe(Flag.withDefault(nowIso));
59
59
  const endReason = Flag.optional(Flag.String("end-reason"));
60
60
  const sessionEndSubcommand = Command.make("session-end", {
@@ -65,7 +65,7 @@ const sessionEndSubcommand = Command.make("session-end", {
65
65
  chatId: opts.chatId,
66
66
  endedAt: opts.endedAt,
67
67
  endReason: opts.endReason._tag === "Some" ? opts.endReason.value : null
68
- }).pipe(Effect.flatMap(() => Effect.sync(() => process.stdout.write(`{"ok":true}\n`))), Effect.catch(reportFailure("session-end")))).pipe(Command.withDescription("Update sessions.ended_at + end_reason"));
68
+ }).pipe(Effect.flatMap(() => CliFormat.printJson({ ok: true }, { indent: 0 })), Effect.catch(reportFailure("session-end")))).pipe(Command.withDescription("Update sessions.ended_at + end_reason"));
69
69
  const artifactKindOpt = Flag.Literals("artifact-kind", [
70
70
  "test_written",
71
71
  "test_failed_run",
@@ -113,7 +113,7 @@ const tddArtifactSubcommand = Command.make("tdd-artifact", {
113
113
  recordedAt: opts.recordedAt,
114
114
  suite: opts.suite
115
115
  });
116
- }).pipe(Effect.flatMap((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`))), Effect.catch(reportFailure("tdd-artifact")))).pipe(Command.withDescription("Record a TDD artifact (D7: CLI-only)"));
116
+ }).pipe(Effect.flatMap((result) => CliFormat.printJson(result, { indent: 0 })), Effect.catch(reportFailure("tdd-artifact")))).pipe(Command.withDescription("Record a TDD artifact (D7: CLI-only)"));
117
117
  const testCaseTurnsSubcommand = Command.make("test-case-turns", { chatId }, ({ chatId }) => Effect.gen(function* () {
118
118
  const store = yield* DataStore;
119
119
  const reader = yield* DataReader;
@@ -123,7 +123,7 @@ const testCaseTurnsSubcommand = Command.make("test-case-turns", { chatId }, ({ c
123
123
  updated,
124
124
  latestTestCaseId: Option.getOrNull(latestId)
125
125
  };
126
- }).pipe(Effect.flatMap((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`))), Effect.catch(reportFailure("test-case-turns")))).pipe(Command.withDescription("Backfill test_cases.created_turn_id from file_edits in the current session (BUG-2 fix)"));
126
+ }).pipe(Effect.flatMap((result) => CliFormat.printJson(result, { indent: 0 })), Effect.catch(reportFailure("test-case-turns")))).pipe(Command.withDescription("Backfill test_cases.created_turn_id from file_edits in the current session (BUG-2 fix)"));
127
127
  const invocationMethodOpt = Flag.Literals("invocation-method", [
128
128
  "bash",
129
129
  "mcp",
@@ -145,7 +145,15 @@ const authorOpt = Flag.optional(Flag.String("author"));
145
145
  const committedAtOpt = Flag.optional(Flag.String("committed-at"));
146
146
  const branchOpt = Flag.optional(Flag.String("branch"));
147
147
  const projectOpt = Flag.optional(Flag.String("project"));
148
- const filesArg = Argument.String("files-json").pipe(Argument.withDescription("JSON array of {\"filePath\",\"changeKind\"} objects"));
148
+ /**
149
+ * The changed files, decoded at parse time: a malformed array or an unknown
150
+ * `changeKind` is a usage error before anything reaches the database.
151
+ */
152
+ const ChangedFiles = Schema.fromJsonString(Schema.Array(Schema.Struct({
153
+ filePath: Schema.String,
154
+ changeKind: ChangeKind
155
+ })));
156
+ const filesArg = Argument.String("files-json").pipe(Argument.withSchema(ChangedFiles), Argument.withDescription("JSON array of {\"filePath\",\"changeKind\"} objects"));
149
157
  const runWorkspaceChangesSubcommand = Command.make("run-workspace-changes", {
150
158
  sha: shaOpt,
151
159
  parentSha: parentShaOpt,
@@ -156,10 +164,6 @@ const runWorkspaceChangesSubcommand = Command.make("run-workspace-changes", {
156
164
  project: projectOpt,
157
165
  files: filesArg
158
166
  }, (opts) => Effect.gen(function* () {
159
- const parsed = yield* Effect.try({
160
- try: () => JSON.parse(opts.files),
161
- catch: (e) => /* @__PURE__ */ new Error(`Invalid files-json: ${Fmt.describe(e)}`)
162
- });
163
167
  return yield* recordRunWorkspaceChangesEffect({
164
168
  sha: opts.sha,
165
169
  ...opts.parentSha._tag === "Some" && { parentSha: opts.parentSha.value },
@@ -168,9 +172,9 @@ const runWorkspaceChangesSubcommand = Command.make("run-workspace-changes", {
168
172
  ...opts.committedAt._tag === "Some" && { committedAt: opts.committedAt.value },
169
173
  ...opts.branch._tag === "Some" && { branch: opts.branch.value },
170
174
  ...opts.project._tag === "Some" && { project: opts.project.value },
171
- files: parsed
175
+ files: opts.files
172
176
  });
173
- }).pipe(Effect.flatMap((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`))), Effect.catch(reportFailure("run-workspace-changes")))).pipe(Command.withDescription("Record a commit + its changed files (driven by post-commit hook)"));
177
+ }).pipe(Effect.flatMap((result) => CliFormat.printJson(result, { indent: 0 })), Effect.catch(reportFailure("run-workspace-changes")))).pipe(Command.withDescription("Record a commit + its changed files (driven by post-commit hook)"));
174
178
  const recordCommand = Command.make("record").pipe(Command.withSubcommands([
175
179
  turnSubcommand,
176
180
  sessionStartSubcommand,
@@ -1,8 +1,8 @@
1
- import { ProjectDataLive } from "../layers/project-data.js";
2
1
  import { CliFormat } from "@effected/cli-kit";
3
2
  import { formatTriageEffect } from "@vitest-agent/engine";
4
- import { Effect } from "effect";
3
+ import { Console, Effect } from "effect";
5
4
  import { Command, Flag } from "effect/cli";
5
+ import { ProjectDataLive } from "../layers/project-data.js";
6
6
 
7
7
  // src/commands/triage.ts
8
8
  const formatOption = Flag.withDefault(Flag.Literals("format", [
@@ -26,7 +26,7 @@ const triageCommand = Command.make("triage", {
26
26
  yield* CliFormat.printJson({ triage: md }, { indent: 0 });
27
27
  return;
28
28
  }
29
- yield* Effect.sync(() => process.stdout.write(md.length > 0 ? `${md}\n` : ""));
29
+ if (md.length > 0) yield* Console.log(md);
30
30
  })).pipe(Command.withDescription("Emit the W3 orientation triage brief for SessionStart"), Command.provide(ProjectDataLive));
31
31
 
32
32
  export { triageCommand };
@@ -1,8 +1,8 @@
1
- import { ProjectDataLive } from "../layers/project-data.js";
2
1
  import { CliFormat } from "@effected/cli-kit";
3
2
  import { formatWrapupEffect } from "@vitest-agent/engine";
4
- import { Effect } from "effect";
3
+ import { Console, Effect } from "effect";
5
4
  import { Command, Flag } from "effect/cli";
5
+ import { ProjectDataLive } from "../layers/project-data.js";
6
6
 
7
7
  // src/commands/wrapup.ts
8
8
  const rowIdOption = Flag.optional(Flag.Int("row-id"));
@@ -33,7 +33,7 @@ const wrapupCommand = Command.make("wrapup", {
33
33
  yield* CliFormat.printJson({ wrapup: md }, { indent: 0 });
34
34
  return;
35
35
  }
36
- yield* Effect.sync(() => process.stdout.write(md.length > 0 ? `${md}\n` : ""));
36
+ if (md.length > 0) yield* Console.log(md);
37
37
  })).pipe(Command.withDescription("Emit the W5 wrap-up prompt for a session"), Command.provide(ProjectDataLive));
38
38
 
39
39
  export { wrapupCommand };
package/main.js CHANGED
@@ -1,3 +1,9 @@
1
+ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
2
+ import * as NodeServices from "@effect/platform-node/NodeServices";
3
+ import { CliAudience, CliRuntime } from "@effected/cli-kit";
4
+ import { PathResolutionLive, resolveProjectDir } from "@vitest-agent/engine";
5
+ import { Layer } from "effect";
6
+ import { Command } from "effect/cli";
1
7
  import { agentCommand } from "./commands/agent.js";
2
8
  import { dbCommand } from "./commands/db.js";
3
9
  import { doctorCommand } from "./commands/doctor.js";
@@ -5,12 +11,6 @@ import { ProjectDir } from "./layers/project-data.js";
5
11
  import { renderFailure } from "./lib/render-failure.js";
6
12
  import { plainVersionFormatter } from "./lib/version-formatter.js";
7
13
  import { CURRENT_CLI_VERSION } from "./version.js";
8
- import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
9
- import * as NodeServices from "@effect/platform-node/NodeServices";
10
- import { CliAudience, CliRuntime } from "@effected/cli-kit";
11
- import { PathResolutionLive, resolveProjectDir } from "@vitest-agent/engine";
12
- import { Layer } from "effect";
13
- import { Command } from "effect/cli";
14
14
 
15
15
  // src/main.ts
16
16
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/cli",
3
- "version": "4.1.17",
3
+ "version": "4.1.18",
4
4
  "private": false,
5
5
  "description": "On-demand CLI for vitest-agent. Reads cached test data and reports status, overview, coverage, history, trends, and cache health.",
6
6
  "keywords": [
@@ -43,19 +43,19 @@
43
43
  "vitest-agent": "bin/vitest-agent.js"
44
44
  },
45
45
  "dependencies": {
46
- "@effect/platform-node": "4.1.4",
47
- "@effect/sql-sqlite-node": "4.1.4",
48
- "@effected/cli-kit": "0.30.0",
46
+ "@effect/platform-node": "4.1.5",
47
+ "@effect/sql-sqlite-node": "4.1.5",
48
+ "@effected/cli-kit": "0.30.1",
49
49
  "@effected/config-file": "0.29.0",
50
50
  "@effected/env": "0.12.0",
51
51
  "@effected/glob": "0.23.0",
52
52
  "@effected/kit": "0.14.0",
53
53
  "@effected/walker": "0.30.0",
54
- "@effected/workspaces": "0.48.1",
55
- "@vitest-agent/engine": "3.2.8",
56
- "@vitest-agent/sdk": "9.0.5",
57
- "@vitest-agent/sidecar": "2.2.21",
58
- "effect": "4.1.4"
54
+ "@effected/workspaces": "0.48.2",
55
+ "@vitest-agent/engine": "3.3.0",
56
+ "@vitest-agent/sdk": "9.1.0",
57
+ "@vitest-agent/sidecar": "2.2.22",
58
+ "effect": "4.1.5"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=24.11.0"
package/version.js CHANGED
@@ -7,6 +7,6 @@
7
7
  *
8
8
  * @public
9
9
  */
10
- const CURRENT_CLI_VERSION = "4.1.17";
10
+ const CURRENT_CLI_VERSION = "4.1.18";
11
11
 
12
12
  export { CURRENT_CLI_VERSION };