@vitest-agent/cli 2.2.18 → 3.0.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/bin/vitest-agent.js +4 -24
- package/commands/agent.js +31 -39
- package/commands/db.js +7 -7
- package/commands/doctor.js +2 -2
- package/commands/record.js +36 -40
- package/commands/triage.js +4 -4
- package/commands/wrapup.js +6 -6
- package/index.d.ts +3 -158
- package/index.js +2 -16
- package/main.d.ts +22 -0
- package/main.js +58 -0
- package/package.json +13 -7
- package/version.js +13 -0
- package/layers/CliLive.js +0 -29
- package/layers/SidecarLive.js +0 -33
- package/lib/internal-end-agent.js +0 -27
- package/lib/internal-register-agent.js +0 -81
- package/lib/record-session.js +0 -33
- package/lib/record-tdd-artifact.js +0 -104
- package/lib/record-turn.js +0 -44
- package/lib/record-workspace-changes.js +0 -50
- package/lib/resolve-session-for-recording.js +0 -71
- package/lib/sidecar-paths.js +0 -101
package/lib/sidecar-paths.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { ProjectIdentityNotResolvableError } from "@vitest-agent/sdk";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { mkdirSync } from "node:fs";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
|
|
7
|
-
//#region src/lib/sidecar-paths.ts
|
|
8
|
-
const APP_NAMESPACE = "vitest-agent";
|
|
9
|
-
/**
|
|
10
|
-
* Filename of the per-project test-data SQLite database.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
const DATA_DB_FILENAME = "data.db";
|
|
15
|
-
/**
|
|
16
|
-
* Filename of the per-client session-map SQLite database.
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
const SESSIONS_DB_FILENAME = "sessions.db";
|
|
21
|
-
/**
|
|
22
|
-
* Filename of the global discovery-registry SQLite database.
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
const REGISTRY_DB_FILENAME = "registry.db";
|
|
27
|
-
const resolveXdgDataHome = () => {
|
|
28
|
-
const xdg = process.env.XDG_DATA_HOME;
|
|
29
|
-
if (xdg !== void 0 && xdg.length > 0) return xdg;
|
|
30
|
-
return join(homedir(), ".local", "share");
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Resolve (and create) the per-project data directory for the supplied
|
|
34
|
-
* normalized `projectKey`. Returns the directory; callers join
|
|
35
|
-
* {@link DATA_DB_FILENAME} onto it for the `data.db` path.
|
|
36
|
-
*
|
|
37
|
-
* @param projectKey - normalized project key (e.g. `@org__pkg`)
|
|
38
|
-
* @returns absolute path to the resolved (and created) data directory
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
const resolveProjectDataDir = (projectKey) => {
|
|
42
|
-
const dir = join(resolveXdgDataHome(), APP_NAMESPACE, projectKey);
|
|
43
|
-
mkdirSync(dir, { recursive: true });
|
|
44
|
-
return dir;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Resolve (and create) the directory holding the global `registry.db`.
|
|
48
|
-
* Callers join {@link REGISTRY_DB_FILENAME} onto it.
|
|
49
|
-
*
|
|
50
|
-
* @returns absolute path to the resolved (and created) registry directory
|
|
51
|
-
* @public
|
|
52
|
-
*/
|
|
53
|
-
const resolveRegistryDir = () => {
|
|
54
|
-
const dir = join(resolveXdgDataHome(), APP_NAMESPACE);
|
|
55
|
-
mkdirSync(dir, { recursive: true });
|
|
56
|
-
return dir;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Resolve the per-client `sessions.db` path.
|
|
60
|
-
*
|
|
61
|
-
* Precedence: the `CLAUDE_PLUGIN_DATA` env var, then
|
|
62
|
-
* `VITEST_AGENT_SESSION_MAP_DIR`, then `~/.vitest-agent/`. Fails
|
|
63
|
-
* with `ProjectIdentityNotResolvableError` when no home directory
|
|
64
|
-
* is resolvable.
|
|
65
|
-
*
|
|
66
|
-
* @returns an Effect resolving to the absolute `sessions.db` path
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
const resolveSessionMapPath = () => Effect.sync(() => {
|
|
70
|
-
const claudePluginData = process.env.CLAUDE_PLUGIN_DATA;
|
|
71
|
-
if (claudePluginData !== void 0 && claudePluginData.length > 0) {
|
|
72
|
-
mkdirSync(claudePluginData, { recursive: true });
|
|
73
|
-
return join(claudePluginData, SESSIONS_DB_FILENAME);
|
|
74
|
-
}
|
|
75
|
-
const overrideDir = process.env.VITEST_AGENT_SESSION_MAP_DIR;
|
|
76
|
-
if (overrideDir !== void 0 && overrideDir.length > 0) {
|
|
77
|
-
mkdirSync(overrideDir, { recursive: true });
|
|
78
|
-
return join(overrideDir, SESSIONS_DB_FILENAME);
|
|
79
|
-
}
|
|
80
|
-
const home = process.env.HOME ?? process.env.USERPROFILE;
|
|
81
|
-
if (home === void 0 || home.length === 0) return null;
|
|
82
|
-
const fallbackDir = join(home, ".vitest-agent");
|
|
83
|
-
mkdirSync(fallbackDir, { recursive: true });
|
|
84
|
-
return join(fallbackDir, SESSIONS_DB_FILENAME);
|
|
85
|
-
}).pipe(Effect.flatMap((path) => path !== null ? Effect.succeed(path) : Effect.fail(new ProjectIdentityNotResolvableError({ tried: [
|
|
86
|
-
{
|
|
87
|
-
source: "CLAUDE_PLUGIN_DATA",
|
|
88
|
-
reason: "env var not set"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
source: "VITEST_AGENT_SESSION_MAP_DIR",
|
|
92
|
-
reason: "env var not set"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
source: "HOME",
|
|
96
|
-
reason: "env var not set (USERPROFILE also unset)"
|
|
97
|
-
}
|
|
98
|
-
] }))));
|
|
99
|
-
|
|
100
|
-
//#endregion
|
|
101
|
-
export { DATA_DB_FILENAME, REGISTRY_DB_FILENAME, SESSIONS_DB_FILENAME, resolveProjectDataDir, resolveRegistryDir, resolveSessionMapPath };
|