@vitest-agent/mcp 1.2.0 → 1.3.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/index.d.ts CHANGED
@@ -652,6 +652,7 @@ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
652
652
  readonly classifications: {
653
653
  readonly [x: string]: string;
654
654
  };
655
+ readonly discoveryLastScannedAt?: string | null | undefined;
655
656
  } | {
656
657
  readonly kind: "timeout";
657
658
  readonly timeoutSeconds: number;
package/index.js CHANGED
@@ -11,7 +11,7 @@ import { startMcpServer } from "./server.js";
11
11
  *
12
12
  * @public
13
13
  */
14
- const CURRENT_MCP_VERSION = "1.2.0";
14
+ const CURRENT_MCP_VERSION = "1.3.0";
15
15
 
16
16
  //#endregion
17
17
  export { CURRENT_MCP_VERSION, McpLive, appRouter, createCallerFactory, createCurrentSessionIdRef, createSessionContextRef, startMcpServer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.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": [
@@ -12,7 +12,8 @@ const RunTestsOk = Schema.Struct({
12
12
  classifications: Schema.Record({
13
13
  key: Schema.String,
14
14
  value: Schema.String
15
- }).annotations({ description: "Per-test classification labels: stable, new-failure, persistent, flaky, recovered." })
15
+ }).annotations({ description: "Per-test classification labels: stable, new-failure, persistent, flaky, recovered." }),
16
+ discoveryLastScannedAt: Schema.optional(Schema.NullOr(Schema.String)).annotations({ description: "ISO timestamp of the most recent real disk scan performed by discoverProjects() in this process (issue #100). `null`/absent means discovery has not scanned disk in this process yet (e.g. a config that doesn't call AgentPlugin.discover()). A stale-looking test count is self-explaining when compared against this value." })
16
17
  }).annotations({ identifier: "RunTestsOk" });
17
18
  const RunTestsTimeout = Schema.Struct({
18
19
  kind: Schema.Literal("timeout"),
@@ -69,6 +70,18 @@ function composeTagExpression(tags) {
69
70
  return parts.join(" and ");
70
71
  }
71
72
  const FORBIDDEN_CHARS = /[;|&`$(){}[\]<>!#]/;
73
+ const DISCOVERY_LAST_SCAN_SYMBOL = Symbol.for("vitest-agent:discovery:last-scan-at");
74
+ /**
75
+ * Reads the ISO timestamp of the most recent real disk scan performed by
76
+ * `discoverProjects()` in this process. `undefined` when discovery hasn't
77
+ * scanned disk in this process yet.
78
+ *
79
+ * @internal
80
+ */
81
+ function readDiscoveryLastScannedAt() {
82
+ const value = globalThis[DISCOVERY_LAST_SCAN_SYMBOL];
83
+ return typeof value === "string" ? value : void 0;
84
+ }
72
85
  const stdoutSinkStorage = new AsyncLocalStorage();
73
86
  const stderrSinkStorage = new AsyncLocalStorage();
74
87
  let _stdioPatched = false;
@@ -350,7 +363,8 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
350
363
  kind: "ok",
351
364
  ...project !== void 0 && { project },
352
365
  report,
353
- classifications: classifications ? Object.fromEntries(classifications) : {}
366
+ classifications: classifications ? Object.fromEntries(classifications) : {},
367
+ discoveryLastScannedAt: readDiscoveryLastScannedAt() ?? null
354
368
  };
355
369
  } catch (err) {
356
370
  if (err instanceof Error && err.message === "VITEST_TIMEOUT") return {
@@ -368,4 +382,4 @@ const runTests = publicProcedure.input(Schema.standardSchemaV1(Schema.Struct({
368
382
  }));
369
383
 
370
384
  //#endregion
371
- export { RunTestsAsMarkdown, RunTestsResult, coerceErrors, composeTagExpression, formatNoMatchMarkdown, formatReportMarkdown, formatRunTestsMarkdown, runTests, sanitizeTestArgs, withStdioCaptured };
385
+ export { RunTestsAsMarkdown, RunTestsResult, coerceErrors, composeTagExpression, formatNoMatchMarkdown, formatReportMarkdown, formatRunTestsMarkdown, readDiscoveryLastScannedAt, runTests, sanitizeTestArgs, withStdioCaptured };