@vitest-agent/mcp 1.0.1 → 1.1.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 (223) hide show
  1. package/bin/vitest-agent-mcp.js +1 -17
  2. package/index.d.ts +322 -313
  3. package/index.js +2 -4
  4. package/middleware/idempotency.js +1 -1
  5. package/package.json +2 -2
  6. package/{public/patterns → patterns}/_meta.json +1 -1
  7. package/{public/patterns → patterns}/operating-vitest-agent-as-an-agent.md +17 -8
  8. package/{public/patterns → patterns}/running-tests-via-mcp.md +45 -0
  9. package/resources/index.js +1 -1
  10. package/resources/manifest-schema.js +1 -1
  11. package/tools/acceptance-metrics.js +1 -1
  12. package/tools/cache-health.js +1 -1
  13. package/tools/commit-changes.js +1 -1
  14. package/tools/configure.js +1 -1
  15. package/tools/coverage.js +1 -1
  16. package/tools/errors.js +1 -1
  17. package/tools/failure-signature-get.js +1 -1
  18. package/tools/file-coverage.js +1 -1
  19. package/tools/history.js +1 -1
  20. package/tools/inventory.js +1 -1
  21. package/tools/overview.js +1 -1
  22. package/tools/run-tests.js +15 -3
  23. package/tools/settings-list.js +1 -1
  24. package/tools/status.js +1 -1
  25. package/tools/tdd-artifact.js +1 -1
  26. package/tools/tdd-task.js +1 -1
  27. package/tools/test.js +1 -1
  28. package/tools/trends.js +1 -1
  29. package/tools/turn-search.js +1 -1
  30. /package/{public/patterns → patterns}/authoring-a-custom-vitest-agent-reporter.md +0 -0
  31. /package/{public/patterns → patterns}/known-issues-and-caveats.md +0 -0
  32. /package/{public/patterns → patterns}/silencing-leaking-output-in-tests.md +0 -0
  33. /package/{public/patterns → patterns}/testing-effect-schema-definitions.md +0 -0
  34. /package/{public/patterns → patterns}/testing-effect-services-with-mock-layers.md +0 -0
  35. /package/{public/vendor → vendor}/vitest-docs/ATTRIBUTION.md +0 -0
  36. /package/{public/vendor → vendor}/vitest-docs/api/advanced/artifacts.md +0 -0
  37. /package/{public/vendor → vendor}/vitest-docs/api/advanced/metadata.md +0 -0
  38. /package/{public/vendor → vendor}/vitest-docs/api/advanced/plugin.md +0 -0
  39. /package/{public/vendor → vendor}/vitest-docs/api/advanced/reporters.md +0 -0
  40. /package/{public/vendor → vendor}/vitest-docs/api/advanced/runner.md +0 -0
  41. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-case.md +0 -0
  42. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-collection.md +0 -0
  43. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-module.md +0 -0
  44. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-project.md +0 -0
  45. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-specification.md +0 -0
  46. /package/{public/vendor → vendor}/vitest-docs/api/advanced/test-suite.md +0 -0
  47. /package/{public/vendor → vendor}/vitest-docs/api/advanced/vitest.md +0 -0
  48. /package/{public/vendor → vendor}/vitest-docs/api/assert-type.md +0 -0
  49. /package/{public/vendor → vendor}/vitest-docs/api/assert.md +0 -0
  50. /package/{public/vendor → vendor}/vitest-docs/api/browser/assertions.md +0 -0
  51. /package/{public/vendor → vendor}/vitest-docs/api/browser/commands.md +0 -0
  52. /package/{public/vendor → vendor}/vitest-docs/api/browser/context.md +0 -0
  53. /package/{public/vendor → vendor}/vitest-docs/api/browser/interactivity.md +0 -0
  54. /package/{public/vendor → vendor}/vitest-docs/api/browser/locators.md +0 -0
  55. /package/{public/vendor → vendor}/vitest-docs/api/browser/react.md +0 -0
  56. /package/{public/vendor → vendor}/vitest-docs/api/browser/svelte.md +0 -0
  57. /package/{public/vendor → vendor}/vitest-docs/api/browser/vue.md +0 -0
  58. /package/{public/vendor → vendor}/vitest-docs/api/describe.md +0 -0
  59. /package/{public/vendor → vendor}/vitest-docs/api/expect-typeof.md +0 -0
  60. /package/{public/vendor → vendor}/vitest-docs/api/expect.md +0 -0
  61. /package/{public/vendor → vendor}/vitest-docs/api/hooks.md +0 -0
  62. /package/{public/vendor → vendor}/vitest-docs/api/mock.md +0 -0
  63. /package/{public/vendor → vendor}/vitest-docs/api/test.md +0 -0
  64. /package/{public/vendor → vendor}/vitest-docs/api/vi.md +0 -0
  65. /package/{public/vendor → vendor}/vitest-docs/config/alias.md +0 -0
  66. /package/{public/vendor → vendor}/vitest-docs/config/allowonly.md +0 -0
  67. /package/{public/vendor → vendor}/vitest-docs/config/api.md +0 -0
  68. /package/{public/vendor → vendor}/vitest-docs/config/attachmentsdir.md +0 -0
  69. /package/{public/vendor → vendor}/vitest-docs/config/bail.md +0 -0
  70. /package/{public/vendor → vendor}/vitest-docs/config/benchmark.md +0 -0
  71. /package/{public/vendor → vendor}/vitest-docs/config/browser/api.md +0 -0
  72. /package/{public/vendor → vendor}/vitest-docs/config/browser/commands.md +0 -0
  73. /package/{public/vendor → vendor}/vitest-docs/config/browser/connecttimeout.md +0 -0
  74. /package/{public/vendor → vendor}/vitest-docs/config/browser/detailspanelposition.md +0 -0
  75. /package/{public/vendor → vendor}/vitest-docs/config/browser/enabled.md +0 -0
  76. /package/{public/vendor → vendor}/vitest-docs/config/browser/expect.md +0 -0
  77. /package/{public/vendor → vendor}/vitest-docs/config/browser/headless.md +0 -0
  78. /package/{public/vendor → vendor}/vitest-docs/config/browser/instances.md +0 -0
  79. /package/{public/vendor → vendor}/vitest-docs/config/browser/isolate.md +0 -0
  80. /package/{public/vendor → vendor}/vitest-docs/config/browser/locators.md +0 -0
  81. /package/{public/vendor → vendor}/vitest-docs/config/browser/orchestratorscripts.md +0 -0
  82. /package/{public/vendor → vendor}/vitest-docs/config/browser/playwright.md +0 -0
  83. /package/{public/vendor → vendor}/vitest-docs/config/browser/preview.md +0 -0
  84. /package/{public/vendor → vendor}/vitest-docs/config/browser/provider.md +0 -0
  85. /package/{public/vendor → vendor}/vitest-docs/config/browser/screenshotdirectory.md +0 -0
  86. /package/{public/vendor → vendor}/vitest-docs/config/browser/screenshotfailures.md +0 -0
  87. /package/{public/vendor → vendor}/vitest-docs/config/browser/testerhtmlpath.md +0 -0
  88. /package/{public/vendor → vendor}/vitest-docs/config/browser/trace.md +0 -0
  89. /package/{public/vendor → vendor}/vitest-docs/config/browser/trackunhandlederrors.md +0 -0
  90. /package/{public/vendor → vendor}/vitest-docs/config/browser/ui.md +0 -0
  91. /package/{public/vendor → vendor}/vitest-docs/config/browser/viewport.md +0 -0
  92. /package/{public/vendor → vendor}/vitest-docs/config/browser/webdriverio.md +0 -0
  93. /package/{public/vendor → vendor}/vitest-docs/config/cache.md +0 -0
  94. /package/{public/vendor → vendor}/vitest-docs/config/chaiconfig.md +0 -0
  95. /package/{public/vendor → vendor}/vitest-docs/config/clearmocks.md +0 -0
  96. /package/{public/vendor → vendor}/vitest-docs/config/coverage.md +0 -0
  97. /package/{public/vendor → vendor}/vitest-docs/config/css.md +0 -0
  98. /package/{public/vendor → vendor}/vitest-docs/config/dangerouslyignoreunhandlederrors.md +0 -0
  99. /package/{public/vendor → vendor}/vitest-docs/config/deps.md +0 -0
  100. /package/{public/vendor → vendor}/vitest-docs/config/detectasyncleaks.md +0 -0
  101. /package/{public/vendor → vendor}/vitest-docs/config/diff.md +0 -0
  102. /package/{public/vendor → vendor}/vitest-docs/config/dir.md +0 -0
  103. /package/{public/vendor → vendor}/vitest-docs/config/disableconsoleintercept.md +0 -0
  104. /package/{public/vendor → vendor}/vitest-docs/config/env.md +0 -0
  105. /package/{public/vendor → vendor}/vitest-docs/config/environment.md +0 -0
  106. /package/{public/vendor → vendor}/vitest-docs/config/environmentoptions.md +0 -0
  107. /package/{public/vendor → vendor}/vitest-docs/config/exclude.md +0 -0
  108. /package/{public/vendor → vendor}/vitest-docs/config/execargv.md +0 -0
  109. /package/{public/vendor → vendor}/vitest-docs/config/expandsnapshotdiff.md +0 -0
  110. /package/{public/vendor → vendor}/vitest-docs/config/expect.md +0 -0
  111. /package/{public/vendor → vendor}/vitest-docs/config/experimental.md +0 -0
  112. /package/{public/vendor → vendor}/vitest-docs/config/faketimers.md +0 -0
  113. /package/{public/vendor → vendor}/vitest-docs/config/fileparallelism.md +0 -0
  114. /package/{public/vendor → vendor}/vitest-docs/config/forcereruntriggers.md +0 -0
  115. /package/{public/vendor → vendor}/vitest-docs/config/globals.md +0 -0
  116. /package/{public/vendor → vendor}/vitest-docs/config/globalsetup.md +0 -0
  117. /package/{public/vendor → vendor}/vitest-docs/config/hideskippedtests.md +0 -0
  118. /package/{public/vendor → vendor}/vitest-docs/config/hooktimeout.md +0 -0
  119. /package/{public/vendor → vendor}/vitest-docs/config/include-source.md +0 -0
  120. /package/{public/vendor → vendor}/vitest-docs/config/include.md +0 -0
  121. /package/{public/vendor → vendor}/vitest-docs/config/includetasklocation.md +0 -0
  122. /package/{public/vendor → vendor}/vitest-docs/config/index.md +0 -0
  123. /package/{public/vendor → vendor}/vitest-docs/config/isolate.md +0 -0
  124. /package/{public/vendor → vendor}/vitest-docs/config/logheapusage.md +0 -0
  125. /package/{public/vendor → vendor}/vitest-docs/config/maxconcurrency.md +0 -0
  126. /package/{public/vendor → vendor}/vitest-docs/config/maxworkers.md +0 -0
  127. /package/{public/vendor → vendor}/vitest-docs/config/mockreset.md +0 -0
  128. /package/{public/vendor → vendor}/vitest-docs/config/mode.md +0 -0
  129. /package/{public/vendor → vendor}/vitest-docs/config/name.md +0 -0
  130. /package/{public/vendor → vendor}/vitest-docs/config/onconsolelog.md +0 -0
  131. /package/{public/vendor → vendor}/vitest-docs/config/onstacktrace.md +0 -0
  132. /package/{public/vendor → vendor}/vitest-docs/config/onunhandlederror.md +0 -0
  133. /package/{public/vendor → vendor}/vitest-docs/config/open.md +0 -0
  134. /package/{public/vendor → vendor}/vitest-docs/config/outputfile.md +0 -0
  135. /package/{public/vendor → vendor}/vitest-docs/config/passwithnotests.md +0 -0
  136. /package/{public/vendor → vendor}/vitest-docs/config/pool.md +0 -0
  137. /package/{public/vendor → vendor}/vitest-docs/config/printconsoletrace.md +0 -0
  138. /package/{public/vendor → vendor}/vitest-docs/config/projects.md +0 -0
  139. /package/{public/vendor → vendor}/vitest-docs/config/provide.md +0 -0
  140. /package/{public/vendor → vendor}/vitest-docs/config/reporters.md +0 -0
  141. /package/{public/vendor → vendor}/vitest-docs/config/resolvesnapshotpath.md +0 -0
  142. /package/{public/vendor → vendor}/vitest-docs/config/restoremocks.md +0 -0
  143. /package/{public/vendor → vendor}/vitest-docs/config/retry.md +0 -0
  144. /package/{public/vendor → vendor}/vitest-docs/config/root.md +0 -0
  145. /package/{public/vendor → vendor}/vitest-docs/config/runner.md +0 -0
  146. /package/{public/vendor → vendor}/vitest-docs/config/sequence.md +0 -0
  147. /package/{public/vendor → vendor}/vitest-docs/config/server.md +0 -0
  148. /package/{public/vendor → vendor}/vitest-docs/config/setupfiles.md +0 -0
  149. /package/{public/vendor → vendor}/vitest-docs/config/silent.md +0 -0
  150. /package/{public/vendor → vendor}/vitest-docs/config/slowtestthreshold.md +0 -0
  151. /package/{public/vendor → vendor}/vitest-docs/config/snapshotenvironment.md +0 -0
  152. /package/{public/vendor → vendor}/vitest-docs/config/snapshotformat.md +0 -0
  153. /package/{public/vendor → vendor}/vitest-docs/config/snapshotserializers.md +0 -0
  154. /package/{public/vendor → vendor}/vitest-docs/config/stricttags.md +0 -0
  155. /package/{public/vendor → vendor}/vitest-docs/config/tags.md +0 -0
  156. /package/{public/vendor → vendor}/vitest-docs/config/teardowntimeout.md +0 -0
  157. /package/{public/vendor → vendor}/vitest-docs/config/testnamepattern.md +0 -0
  158. /package/{public/vendor → vendor}/vitest-docs/config/testtimeout.md +0 -0
  159. /package/{public/vendor → vendor}/vitest-docs/config/typecheck.md +0 -0
  160. /package/{public/vendor → vendor}/vitest-docs/config/ui.md +0 -0
  161. /package/{public/vendor → vendor}/vitest-docs/config/unstubenvs.md +0 -0
  162. /package/{public/vendor → vendor}/vitest-docs/config/unstubglobals.md +0 -0
  163. /package/{public/vendor → vendor}/vitest-docs/config/update.md +0 -0
  164. /package/{public/vendor → vendor}/vitest-docs/config/vmmemorylimit.md +0 -0
  165. /package/{public/vendor → vendor}/vitest-docs/config/watch.md +0 -0
  166. /package/{public/vendor → vendor}/vitest-docs/config/watchtriggerpatterns.md +0 -0
  167. /package/{public/vendor → vendor}/vitest-docs/guide/advanced/index.md +0 -0
  168. /package/{public/vendor → vendor}/vitest-docs/guide/advanced/pool.md +0 -0
  169. /package/{public/vendor → vendor}/vitest-docs/guide/advanced/reporters.md +0 -0
  170. /package/{public/vendor → vendor}/vitest-docs/guide/advanced/tests.md +0 -0
  171. /package/{public/vendor → vendor}/vitest-docs/guide/browser/aria-snapshots.md +0 -0
  172. /package/{public/vendor → vendor}/vitest-docs/guide/browser/component-testing.md +0 -0
  173. /package/{public/vendor → vendor}/vitest-docs/guide/browser/index.md +0 -0
  174. /package/{public/vendor → vendor}/vitest-docs/guide/browser/multiple-setups.md +0 -0
  175. /package/{public/vendor → vendor}/vitest-docs/guide/browser/trace-view.md +0 -0
  176. /package/{public/vendor → vendor}/vitest-docs/guide/browser/visual-regression-testing.md +0 -0
  177. /package/{public/vendor → vendor}/vitest-docs/guide/cli-generated.md +0 -0
  178. /package/{public/vendor → vendor}/vitest-docs/guide/cli.md +0 -0
  179. /package/{public/vendor → vendor}/vitest-docs/guide/common-errors.md +0 -0
  180. /package/{public/vendor → vendor}/vitest-docs/guide/coverage.md +0 -0
  181. /package/{public/vendor → vendor}/vitest-docs/guide/debugging.md +0 -0
  182. /package/{public/vendor → vendor}/vitest-docs/guide/environment.md +0 -0
  183. /package/{public/vendor → vendor}/vitest-docs/guide/extending-matchers.md +0 -0
  184. /package/{public/vendor → vendor}/vitest-docs/guide/features.md +0 -0
  185. /package/{public/vendor → vendor}/vitest-docs/guide/filtering.md +0 -0
  186. /package/{public/vendor → vendor}/vitest-docs/guide/ide.md +0 -0
  187. /package/{public/vendor → vendor}/vitest-docs/guide/improving-performance.md +0 -0
  188. /package/{public/vendor → vendor}/vitest-docs/guide/in-source.md +0 -0
  189. /package/{public/vendor → vendor}/vitest-docs/guide/index.md +0 -0
  190. /package/{public/vendor → vendor}/vitest-docs/guide/learn/async.md +0 -0
  191. /package/{public/vendor → vendor}/vitest-docs/guide/learn/debugging-tests.md +0 -0
  192. /package/{public/vendor → vendor}/vitest-docs/guide/learn/matchers.md +0 -0
  193. /package/{public/vendor → vendor}/vitest-docs/guide/learn/mock-functions.md +0 -0
  194. /package/{public/vendor → vendor}/vitest-docs/guide/learn/setup-teardown.md +0 -0
  195. /package/{public/vendor → vendor}/vitest-docs/guide/learn/snapshots.md +0 -0
  196. /package/{public/vendor → vendor}/vitest-docs/guide/learn/testing-in-practice.md +0 -0
  197. /package/{public/vendor → vendor}/vitest-docs/guide/learn/writing-tests-with-ai.md +0 -0
  198. /package/{public/vendor → vendor}/vitest-docs/guide/learn/writing-tests.md +0 -0
  199. /package/{public/vendor → vendor}/vitest-docs/guide/lifecycle.md +0 -0
  200. /package/{public/vendor → vendor}/vitest-docs/guide/migration.md +0 -0
  201. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/classes.md +0 -0
  202. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/dates.md +0 -0
  203. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/file-system.md +0 -0
  204. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/functions.md +0 -0
  205. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/globals.md +0 -0
  206. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/modules.md +0 -0
  207. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/requests.md +0 -0
  208. /package/{public/vendor → vendor}/vitest-docs/guide/mocking/timers.md +0 -0
  209. /package/{public/vendor → vendor}/vitest-docs/guide/mocking.md +0 -0
  210. /package/{public/vendor → vendor}/vitest-docs/guide/open-telemetry.md +0 -0
  211. /package/{public/vendor → vendor}/vitest-docs/guide/parallelism.md +0 -0
  212. /package/{public/vendor → vendor}/vitest-docs/guide/profiling-test-performance.md +0 -0
  213. /package/{public/vendor → vendor}/vitest-docs/guide/projects.md +0 -0
  214. /package/{public/vendor → vendor}/vitest-docs/guide/recipes.md +0 -0
  215. /package/{public/vendor → vendor}/vitest-docs/guide/reporters.md +0 -0
  216. /package/{public/vendor → vendor}/vitest-docs/guide/snapshot.md +0 -0
  217. /package/{public/vendor → vendor}/vitest-docs/guide/test-annotations.md +0 -0
  218. /package/{public/vendor → vendor}/vitest-docs/guide/test-context.md +0 -0
  219. /package/{public/vendor → vendor}/vitest-docs/guide/test-tags.md +0 -0
  220. /package/{public/vendor → vendor}/vitest-docs/guide/testing-types.md +0 -0
  221. /package/{public/vendor → vendor}/vitest-docs/guide/ui.md +0 -0
  222. /package/{public/vendor → vendor}/vitest-docs/guide/using-plugins.md +0 -0
  223. /package/{public/vendor → vendor}/vitest-docs/manifest.json +0 -0
package/index.js CHANGED
@@ -7,13 +7,11 @@ import { startMcpServer } from "./server.js";
7
7
  /**
8
8
  * The version of this package, inlined at build time from
9
9
  * package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
10
- * Compared against CURRENT_SDK_VERSION at MCP bin init to surface
11
- * partially-upgraded installs as a single stderr warning. See the root
12
- * CLAUDE.md "Cross-package version drift" section.
10
+ * Exported for version introspection by downstream tooling.
13
11
  *
14
12
  * @public
15
13
  */
16
- const CURRENT_MCP_VERSION = "1.0.1";
14
+ const CURRENT_MCP_VERSION = "1.1.0";
17
15
 
18
16
  //#endregion
19
17
  export { CURRENT_MCP_VERSION, McpLive, appRouter, createCallerFactory, createCurrentSessionIdRef, createSessionContextRef, startMcpServer };
@@ -125,4 +125,4 @@ const idempotent = middleware(async (opts) => {
125
125
  const idempotentProcedure = publicProcedure.use(idempotent);
126
126
 
127
127
  //#endregion
128
- export { idempotentProcedure };
128
+ export { idempotencyKeys, idempotentProcedure };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/mcp",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol server for vitest-agent. Exposes 53 tools for agent access to test data, TDD lifecycle, and session management.",
6
6
  "keywords": [
@@ -45,7 +45,7 @@
45
45
  "@effect/sql-sqlite-node": "^0.52.0",
46
46
  "@modelcontextprotocol/sdk": "^1.29.0",
47
47
  "@trpc/server": "^11.18.0",
48
- "@vitest-agent/sdk": "1.0.1",
48
+ "@vitest-agent/sdk": "1.1.0",
49
49
  "effect": "^3.21.4",
50
50
  "zod": "^4.4.3"
51
51
  },
@@ -57,7 +57,7 @@
57
57
  {
58
58
  "slug": "operating-vitest-agent-as-an-agent",
59
59
  "title": "Operating vitest-agent as an Agent",
60
- "summary": "Read first: the front-loaded facts an agent needs (no run_tests filter param, coverage-in-subset behavior, console output is config-driven not env-driven, attribution is auto-recovered) with links to the deeper patterns.",
60
+ "summary": "Read first: the front-loaded facts an agent needs (no run_tests filter param, coverage-in-subset behavior, consoleLeaks signal in run_tests output, VITEST_AGENT_CONSOLE CLI escape hatch, attribution is auto-recovered) with links to the deeper patterns.",
61
61
  "annotations": {
62
62
  "audience": ["assistant"],
63
63
  "priority": 0.95
@@ -19,11 +19,14 @@ trial-and-error, then points you at the deeper patterns.
19
19
  — global thresholds applied to partial coverage. There is no per-run
20
20
  coverage toggle in `run_tests`; it inherits your `vitest.config`. For
21
21
  isolated inspection use the CLI: `vitest run <file> --coverage.enabled=false`.
22
- 4. **You cannot see stray `console.log` through `run_tests`** it null-routes
23
- Vitest's stdout. Console behavior is configured via the plugin's `console`
24
- matrix (e.g. `console: { agent: "passthrough" }`), **not** environment
25
- variables. To see intercepted output, run Vitest directly with
26
- `--disableConsoleIntercept` (a native Vitest flag).
22
+ 4. **Stray `console.*` is surfaced by `run_tests` as a signal, not raw logs.**
23
+ The `ok` result's `report.consoleLeaks` field lists writes by file with
24
+ counts, optional per-test attribution, and a truncated sample. `run_tests`
25
+ still null-routes Vitest's stdout; the signal captures what was printed
26
+ without forwarding raw log lines into agent context. To see the raw output
27
+ for a flagged file, run Vitest on the CLI:
28
+ `VITEST_AGENT_CONSOLE=passthrough pnpm test`. Details at
29
+ `vitest-agent://patterns/running-tests-via-mcp`.
27
30
  5. **Session attribution is recovered for you.** The SessionStart hook writes
28
31
  the `VITEST_AGENT_*` identity into the environment and the SDK recovers it —
29
32
  you never set those vars by hand. The only behavioral knobs are
@@ -38,9 +41,15 @@ trial-and-error, then points you at the deeper patterns.
38
41
  You do not configure vitest-agent through environment variables. The
39
42
  `VITEST_AGENT_*` vars (chat id, conversation id, agent ids, project dir,
40
43
  sidecar bin) are attribution plumbing written by the Claude Code plugin's
41
- SessionStart hook and recovered automatically. The only vars you might set for
42
- diagnostics are `VITEST_REPORTER_LOG_LEVEL` / `VITEST_REPORTER_LOG_FILE` (a
43
- diagnostic log file, separate from the console reporter) and `NO_COLOR`.
44
+ SessionStart hook and recovered automatically. The vars you might set:
45
+
46
+ - `VITEST_REPORTER_LOG_LEVEL` / `VITEST_REPORTER_LOG_FILE` diagnostic
47
+ logger (separate from the console reporter).
48
+ - `NO_COLOR` — disables ANSI color in rendered output.
49
+ - `VITEST_AGENT_CONSOLE=passthrough` — overrides the resolved console mode
50
+ for the active executor on a CLI `vitest` run. Useful when investigating
51
+ files flagged by `report.consoleLeaks`. Invalid-for-slot values warn to
52
+ stderr and are ignored.
44
53
 
45
54
  ## Where to go next
46
55
 
@@ -51,6 +51,51 @@ This is expected: your global coverage thresholds are applied to a partial run,
51
51
  vitest run path/to/one.test.ts --coverage.enabled=false
52
52
  ```
53
53
 
54
+ ## Stray console output — `report.consoleLeaks`
55
+
56
+ When the run produces stray `console.*` output, the `report` object on an
57
+ `"ok"` result carries an optional `consoleLeaks` field. It is omitted
58
+ entirely when the run produced no user console output.
59
+
60
+ Shape:
61
+
62
+ - `total` — total stray console writes across the run
63
+ - `byFile` — one entry per file that produced writes:
64
+ - `file` — the test file path
65
+ - `stdout` — writes to stdout-class streams (`log`, `info`, `debug`)
66
+ - `stderr` — writes to stderr-class streams (`error`, `warn`)
67
+ - `tests` (optional) — test names where writes were attributed
68
+ - `sample` (optional) — truncated excerpt of the first write in this file
69
+ - `truncated` (optional) — `true` when `byFile` was capped
70
+
71
+ Use `byFile[].file` to locate which files to investigate and `sample` to
72
+ find the call site, without dumping full log content into agent context.
73
+ The markdown summary line also surfaces the leak count inline (e.g.
74
+ `⚠ 3 stray console writes across 2 files (see consoleLeaks)`).
75
+
76
+ ### Console-output visibility by surface
77
+
78
+ | Surface | Sees stray `console.*` | Per-test attribution |
79
+ | --- | --- | --- |
80
+ | `run_tests` (MCP) | yes — `consoleLeaks` signal (counts + sample) | per file, per test where resolvable |
81
+ | Human at a TTY | yes — Vitest's own `stdout \|` / `stderr \|` lines | yes (TTY only) |
82
+ | Piped shell (default) | no — agent-shaped summary suppresses it | n/a |
83
+ | Piped shell + `VITEST_AGENT_CONSOLE=passthrough` | yes — raw passthrough | no (raw, unlabeled) |
84
+
85
+ ### `VITEST_AGENT_CONSOLE` — CLI escape hatch
86
+
87
+ To see raw console output for a file that `consoleLeaks` flagged, run
88
+ Vitest directly on the CLI with the override set:
89
+
90
+ ```bash
91
+ VITEST_AGENT_CONSOLE=passthrough pnpm test
92
+ ```
93
+
94
+ This overrides the plugin's resolved console mode to `passthrough` for
95
+ the active executor — Vitest's own reporters emit console output
96
+ unfiltered. An invalid value for the current executor slot warns to
97
+ stderr and is ignored.
98
+
54
99
  ## See also
55
100
 
56
101
  - `vitest-agent://patterns/operating-vitest-agent-as-an-agent` — the orientation index
@@ -163,4 +163,4 @@ function registerAllResources(server) {
163
163
  }
164
164
 
165
165
  //#endregion
166
- export { registerAllResources };
166
+ export { registerAllResources, resolveContentRoots };
@@ -43,4 +43,4 @@ const PatternsManifest = Schema.Struct({ patterns: Schema.Array(PatternEntry) })
43
43
  const decodePatternsManifest = Schema.decodeUnknown(PatternsManifest);
44
44
 
45
45
  //#endregion
46
- export { decodePatternsManifest, decodeUpstreamManifest };
46
+ export { ManifestPage, PatternEntry, PatternsManifest, ResourceAnnotations, UpstreamManifest, decodePatternsManifest, decodeUpstreamManifest };
@@ -72,4 +72,4 @@ const acceptanceMetrics = publicProcedure.input(Schema.standardSchemaV1(Schema.S
72
72
  })));
73
73
 
74
74
  //#endregion
75
- export { AcceptanceMetricsAsMarkdown, AcceptanceMetricsResult, acceptanceMetrics };
75
+ export { AcceptanceMetricsAsMarkdown, AcceptanceMetricsResult, acceptanceMetrics, formatAcceptanceMetricsMarkdown };
@@ -80,4 +80,4 @@ const cacheHealth = publicProcedure.query(async ({ ctx }) => ctx.runtime.runProm
80
80
  })));
81
81
 
82
82
  //#endregion
83
- export { CacheHealthAsMarkdown, CacheHealthResult, cacheHealth };
83
+ export { CacheHealthAsMarkdown, CacheHealthResult, cacheHealth, formatCacheHealthMarkdown };
@@ -61,4 +61,4 @@ const commitChanges = publicProcedure.input(Schema.standardSchemaV1(Schema.Struc
61
61
  })));
62
62
 
63
63
  //#endregion
64
- export { CommitChangesAsMarkdown, CommitChangesResult, commitChanges };
64
+ export { CommitChangesAsMarkdown, CommitChangesResult, commitChanges, formatCommitChangesMarkdown };
@@ -104,4 +104,4 @@ const configure = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
104
104
  })));
105
105
 
106
106
  //#endregion
107
- export { ConfigureAsMarkdown, ConfigureResult, configure };
107
+ export { ConfigureAsMarkdown, ConfigureResult, configure, formatConfigureMarkdown };
package/tools/coverage.js CHANGED
@@ -73,4 +73,4 @@ const testCoverage = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
73
73
  })));
74
74
 
75
75
  //#endregion
76
- export { TestCoverageAsMarkdown, TestCoverageResult, testCoverage };
76
+ export { TestCoverageAsMarkdown, TestCoverageResult, formatTestCoverageMarkdown, testCoverage };
package/tools/errors.js CHANGED
@@ -148,4 +148,4 @@ const testErrors = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
148
148
  })));
149
149
 
150
150
  //#endregion
151
- export { TestErrorsAsMarkdown, TestErrorsResult, testErrors };
151
+ export { TestErrorRow, TestErrorsAsMarkdown, TestErrorsResult, formatTestErrorsMarkdown, testErrors };
@@ -70,4 +70,4 @@ const failureSignatureGet = publicProcedure.input(Schema.standardSchemaV1(Schema
70
70
  })));
71
71
 
72
72
  //#endregion
73
- export { FailureSignatureGetAsMarkdown, FailureSignatureGetResult, failureSignatureGet };
73
+ export { FailureSignatureGetAsMarkdown, FailureSignatureGetResult, failureSignatureGet, formatFailureSignatureMarkdown };
@@ -103,4 +103,4 @@ const fileCoverage = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
103
103
  })));
104
104
 
105
105
  //#endregion
106
- export { FileCoverageAsMarkdown, FileCoverageResult, fileCoverage };
106
+ export { FileCoverageAsMarkdown, FileCoverageResult, fileCoverage, formatFileCoverageMarkdown };
package/tools/history.js CHANGED
@@ -118,4 +118,4 @@ const testHistory = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct(
118
118
  })));
119
119
 
120
120
  //#endregion
121
- export { TestHistoryAsMarkdown, TestHistoryResult, testHistory };
121
+ export { TestHistoryAsMarkdown, TestHistoryResult, formatTestHistoryMarkdown, testHistory };
@@ -374,4 +374,4 @@ const inventory = publicProcedure.input(Schema.standardSchemaV1(InventoryInput))
374
374
  });
375
375
 
376
376
  //#endregion
377
- export { InventoryAsMarkdown, InventoryResult, inventory };
377
+ export { InventoryAsMarkdown, InventoryResult, formatInventoryMarkdown, inventory };
package/tools/overview.js CHANGED
@@ -89,4 +89,4 @@ const testOverview = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
89
89
  })));
90
90
 
91
91
  //#endregion
92
- export { TestOverviewAsMarkdown, TestOverviewResult, testOverview };
92
+ export { TestOverviewAsMarkdown, TestOverviewResult, formatTestOverviewMarkdown, testOverview };
@@ -1,5 +1,5 @@
1
1
  import { publicProcedure } from "../context.js";
2
- import { AgentReport, DataReader, DataStore, buildAgentReport } from "@vitest-agent/sdk";
2
+ import { AgentReport, DataReader, DataStore, buildAgentReport, buildConsoleLeaks, collectConsoleLeakEntries } from "@vitest-agent/sdk";
3
3
  import { Effect, ParseResult, Schema } from "effect";
4
4
  import { AsyncLocalStorage } from "node:async_hooks";
5
5
  import { Writable } from "node:stream";
@@ -209,6 +209,13 @@ function formatReportMarkdown(report, classifications) {
209
209
  if (summary.skipped > 0) headlineParts.push(`${summary.skipped} skipped`);
210
210
  lines.push(`## ${status} Vitest -- ${headlineParts.join(", ")} (${summary.duration}ms)`);
211
211
  if (report.project) lines.push(`\nProject: ${report.project}`);
212
+ if (report.consoleLeaks !== void 0) {
213
+ const cl = report.consoleLeaks;
214
+ const writes = `${cl.total} stray console write${cl.total === 1 ? "" : "s"}`;
215
+ const plural = cl.byFile.length !== 1 || cl.truncated === true;
216
+ const files = `${cl.byFile.length}${cl.truncated === true ? "+" : ""} file${plural ? "s" : ""}`;
217
+ lines.push(`\n⚠ ${writes} across ${files} (see consoleLeaks)`);
218
+ }
212
219
  for (const mod of report.failed) {
213
220
  lines.push(`\n### \u274C \`${mod.file}\``);
214
221
  if (mod.errors) for (const err of mod.errors) {
@@ -313,7 +320,12 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
313
320
  resolvedExpression
314
321
  }
315
322
  };
316
- const report = buildAgentReport(testModules, unhandledErrors, unhandledErrors.length > 0 || result.testModules.some((m) => m.state() === "failed") ? "failed" : "passed", { omitPassingTests: true });
323
+ const baseReport = buildAgentReport(testModules, unhandledErrors, unhandledErrors.length > 0 || result.testModules.some((m) => m.state() === "failed") ? "failed" : "passed", { omitPassingTests: true });
324
+ const leaks = buildConsoleLeaks(collectConsoleLeakEntries(localVitest.state.getFiles()));
325
+ const report = leaks !== void 0 ? {
326
+ ...baseReport,
327
+ consoleLeaks: leaks
328
+ } : baseReport;
317
329
  let classifications;
318
330
  try {
319
331
  classifications = await ctx.runtime.runPromise(Effect.gen(function* () {
@@ -356,4 +368,4 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
356
368
  }));
357
369
 
358
370
  //#endregion
359
- export { RunTestsAsMarkdown, RunTestsResult, runTests };
371
+ export { RunTestsAsMarkdown, RunTestsResult, coerceErrors, composeTagExpression, formatNoMatchMarkdown, formatReportMarkdown, formatRunTestsMarkdown, runTests, sanitizeTestArgs, withStdioCaptured };
@@ -45,4 +45,4 @@ const settingsList = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct
45
45
  })));
46
46
 
47
47
  //#endregion
48
- export { SettingsListAsMarkdown, SettingsListResult, settingsList };
48
+ export { SettingsListAsMarkdown, SettingsListResult, formatSettingsListMarkdown, settingsList };
package/tools/status.js CHANGED
@@ -71,4 +71,4 @@ const testStatus = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
71
71
  })));
72
72
 
73
73
  //#endregion
74
- export { TestStatusAsMarkdown, TestStatusResult, testStatus };
74
+ export { TestStatusAsMarkdown, TestStatusResult, formatTestStatusMarkdown, testStatus };
@@ -98,4 +98,4 @@ const tddArtifactList = publicProcedure.input(Schema.standardSchemaV1(TddArtifac
98
98
  })));
99
99
 
100
100
  //#endregion
101
- export { TddArtifactListAsMarkdown, TddArtifactListResult, tddArtifactList };
101
+ export { TddArtifactListAsMarkdown, TddArtifactListResult, formatTddArtifactListMarkdown, tddArtifactList };
package/tools/tdd-task.js CHANGED
@@ -275,4 +275,4 @@ const tddTask = idempotentProcedure.input(Schema.standardSchemaV1(TddTaskInput))
275
275
  });
276
276
 
277
277
  //#endregion
278
- export { TddTaskAsMarkdown, TddTaskResult, tddTask };
278
+ export { TddTaskAsMarkdown, TddTaskResult, formatTddTaskMarkdown, tddTask };
package/tools/test.js CHANGED
@@ -278,4 +278,4 @@ const test = publicProcedure.input(Schema.standardSchemaV1(TestInput)).query(asy
278
278
  });
279
279
 
280
280
  //#endregion
281
- export { TestAsMarkdown, TestResult, test };
281
+ export { TestAsMarkdown, TestResult, formatTestMarkdown, test };
package/tools/trends.js CHANGED
@@ -109,4 +109,4 @@ const testTrends = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
109
109
  })));
110
110
 
111
111
  //#endregion
112
- export { TestTrendsAsMarkdown, TestTrendsResult, testTrends };
112
+ export { TestTrendsAsMarkdown, TestTrendsResult, formatTestTrendsMarkdown, testTrends };
@@ -57,4 +57,4 @@ const turnSearch = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
57
57
  })));
58
58
 
59
59
  //#endregion
60
- export { TurnSearchAsMarkdown, TurnSearchResult, turnSearch };
60
+ export { TurnSearchAsMarkdown, TurnSearchResult, formatTurnSearchMarkdown, turnSearch };
File without changes