@prover-coder-ai/docker-git 1.0.22 → 1.0.24

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 (76) hide show
  1. package/README.md +3 -0
  2. package/dist/src/docker-git/main.js +5 -2
  3. package/dist/src/docker-git/main.js.map +1 -1
  4. package/package.json +5 -1
  5. package/.jscpd.json +0 -16
  6. package/.package.json.release.bak +0 -110
  7. package/CHANGELOG.md +0 -133
  8. package/biome.json +0 -34
  9. package/eslint.config.mts +0 -305
  10. package/eslint.effect-ts-check.config.mjs +0 -220
  11. package/linter.config.json +0 -33
  12. package/src/app/main.ts +0 -18
  13. package/src/app/program.ts +0 -75
  14. package/src/docker-git/cli/input.ts +0 -29
  15. package/src/docker-git/cli/parser-apply.ts +0 -28
  16. package/src/docker-git/cli/parser-attach.ts +0 -22
  17. package/src/docker-git/cli/parser-auth.ts +0 -154
  18. package/src/docker-git/cli/parser-clone.ts +0 -50
  19. package/src/docker-git/cli/parser-create.ts +0 -3
  20. package/src/docker-git/cli/parser-mcp-playwright.ts +0 -24
  21. package/src/docker-git/cli/parser-options.ts +0 -211
  22. package/src/docker-git/cli/parser-panes.ts +0 -22
  23. package/src/docker-git/cli/parser-scrap.ts +0 -106
  24. package/src/docker-git/cli/parser-sessions.ts +0 -101
  25. package/src/docker-git/cli/parser-shared.ts +0 -51
  26. package/src/docker-git/cli/parser-state.ts +0 -86
  27. package/src/docker-git/cli/parser.ts +0 -82
  28. package/src/docker-git/cli/read-command.ts +0 -26
  29. package/src/docker-git/cli/usage.ts +0 -129
  30. package/src/docker-git/main.ts +0 -18
  31. package/src/docker-git/menu-actions.ts +0 -273
  32. package/src/docker-git/menu-auth-data.ts +0 -184
  33. package/src/docker-git/menu-auth-helpers.ts +0 -30
  34. package/src/docker-git/menu-auth.ts +0 -311
  35. package/src/docker-git/menu-buffer-input.ts +0 -18
  36. package/src/docker-git/menu-create.ts +0 -310
  37. package/src/docker-git/menu-input-handler.ts +0 -183
  38. package/src/docker-git/menu-input-utils.ts +0 -85
  39. package/src/docker-git/menu-input.ts +0 -2
  40. package/src/docker-git/menu-labeled-env.ts +0 -37
  41. package/src/docker-git/menu-menu.ts +0 -58
  42. package/src/docker-git/menu-project-auth-claude.ts +0 -70
  43. package/src/docker-git/menu-project-auth-data.ts +0 -292
  44. package/src/docker-git/menu-project-auth.ts +0 -271
  45. package/src/docker-git/menu-render-auth.ts +0 -65
  46. package/src/docker-git/menu-render-common.ts +0 -67
  47. package/src/docker-git/menu-render-layout.ts +0 -30
  48. package/src/docker-git/menu-render-project-auth.ts +0 -70
  49. package/src/docker-git/menu-render-select.ts +0 -250
  50. package/src/docker-git/menu-render.ts +0 -292
  51. package/src/docker-git/menu-select-actions.ts +0 -150
  52. package/src/docker-git/menu-select-connect.ts +0 -27
  53. package/src/docker-git/menu-select-load.ts +0 -33
  54. package/src/docker-git/menu-select-order.ts +0 -37
  55. package/src/docker-git/menu-select-runtime.ts +0 -143
  56. package/src/docker-git/menu-select-view.ts +0 -25
  57. package/src/docker-git/menu-select.ts +0 -145
  58. package/src/docker-git/menu-shared.ts +0 -256
  59. package/src/docker-git/menu-startup.ts +0 -83
  60. package/src/docker-git/menu-types.ts +0 -170
  61. package/src/docker-git/menu.ts +0 -303
  62. package/src/docker-git/program.ts +0 -154
  63. package/src/docker-git/tmux.ts +0 -292
  64. package/tests/app/main.test.ts +0 -65
  65. package/tests/docker-git/entrypoint-auth.test.ts +0 -40
  66. package/tests/docker-git/fixtures/project-item.ts +0 -24
  67. package/tests/docker-git/menu-select-connect.test.ts +0 -55
  68. package/tests/docker-git/menu-select-order.test.ts +0 -84
  69. package/tests/docker-git/menu-startup.test.ts +0 -51
  70. package/tests/docker-git/parser-network-options.test.ts +0 -47
  71. package/tests/docker-git/parser.test.ts +0 -340
  72. package/tsconfig.build.json +0 -8
  73. package/tsconfig.json +0 -20
  74. package/vite.config.ts +0 -32
  75. package/vite.docker-git.config.ts +0 -34
  76. package/vitest.config.ts +0 -85
@@ -1,340 +0,0 @@
1
- import { describe, expect, it } from "@effect/vitest"
2
- import { Effect, Either } from "effect"
3
-
4
- import { type Command, defaultTemplateConfig } from "@effect-template/lib/core/domain"
5
- import { expandContainerHome } from "@effect-template/lib/usecases/scrap-path"
6
- import { parseArgs } from "../../src/docker-git/cli/parser.js"
7
-
8
- type CreateCommand = Extract<Command, { _tag: "Create" }>
9
-
10
- const expectParseErrorTag = (
11
- args: ReadonlyArray<string>,
12
- expectedTag: string
13
- ) =>
14
- Effect.sync(() => {
15
- const parsed = parseArgs(args)
16
- Either.match(parsed, {
17
- onLeft: (error) => {
18
- expect(error._tag).toBe(expectedTag)
19
- },
20
- onRight: () => {
21
- throw new Error("expected parse error")
22
- }
23
- })
24
- })
25
-
26
- const parseOrThrow = (args: ReadonlyArray<string>): Command => {
27
- const parsed = parseArgs(args)
28
- return Either.match(parsed, {
29
- onLeft: (error) => {
30
- throw new Error(`unexpected error ${error._tag}`)
31
- },
32
- onRight: (command) => command
33
- })
34
- }
35
-
36
- type ProjectDirRunUpCommand = Extract<Command, { readonly projectDir: string; readonly runUp: boolean }>
37
-
38
- const expectProjectDirRunUpCommand = (
39
- args: ReadonlyArray<string>,
40
- expectedTag: ProjectDirRunUpCommand["_tag"],
41
- expectedProjectDir: string,
42
- expectedRunUp: boolean
43
- ) =>
44
- Effect.sync(() => {
45
- const command = parseOrThrow(args)
46
- if (command._tag !== expectedTag) {
47
- throw new Error(`expected ${expectedTag} command`)
48
- }
49
- if (!("projectDir" in command) || !("runUp" in command)) {
50
- throw new Error("expected command with projectDir and runUp")
51
- }
52
- expect(command.projectDir).toBe(expectedProjectDir)
53
- expect(command.runUp).toBe(expectedRunUp)
54
- })
55
-
56
- const expectCreateCommand = (
57
- args: ReadonlyArray<string>,
58
- onRight: (command: CreateCommand) => void
59
- ) =>
60
- Effect.sync(() => {
61
- const command = parseOrThrow(args)
62
- if (command._tag !== "Create") {
63
- throw new Error("expected Create command")
64
- }
65
- onRight(command)
66
- })
67
-
68
- const expectCreateDefaults = (command: CreateCommand) => {
69
- expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
70
- expect(command.config.repoRef).toBe(defaultTemplateConfig.repoRef)
71
- expect(command.outDir).toBe(".docker-git/org/repo")
72
- expect(command.runUp).toBe(true)
73
- expect(command.forceEnv).toBe(false)
74
- expect(command.config.dockerNetworkMode).toBe("shared")
75
- expect(command.config.dockerSharedNetworkName).toBe("docker-git-shared")
76
- }
77
-
78
- const expandDefaultTargetDir = (path: string): string => expandContainerHome(defaultTemplateConfig.sshUser, path)
79
-
80
- describe("parseArgs", () => {
81
- it.effect("parses create command with defaults", () =>
82
- expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git"], (command) => {
83
- expectCreateDefaults(command)
84
- expect(command.openSsh).toBe(false)
85
- expect(command.waitForClone).toBe(false)
86
- expect(command.config.containerName).toBe("dg-repo")
87
- expect(command.config.serviceName).toBe("dg-repo")
88
- expect(command.config.volumeName).toBe("dg-repo-home")
89
- expect(command.config.sshPort).toBe(defaultTemplateConfig.sshPort)
90
- }))
91
-
92
- it.effect("parses create command with issue url into isolated defaults", () =>
93
- expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo/issues/9"], (command) => {
94
- expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
95
- expect(command.config.repoRef).toBe("issue-9")
96
- expect(command.outDir).toBe(".docker-git/org/repo/issue-9")
97
- expect(command.openSsh).toBe(false)
98
- expect(command.waitForClone).toBe(false)
99
- expect(command.config.containerName).toBe("dg-repo-issue-9")
100
- expect(command.config.serviceName).toBe("dg-repo-issue-9")
101
- expect(command.config.volumeName).toBe("dg-repo-issue-9-home")
102
- }))
103
-
104
- it.effect("parses create command without repo url into empty workspace defaults", () =>
105
- expectCreateCommand(["create"], (command) => {
106
- expect(command.config.repoUrl).toBe("")
107
- expect(command.config.repoRef).toBe(defaultTemplateConfig.repoRef)
108
- expect(command.outDir).toBe(".docker-git/app")
109
- expect(command.openSsh).toBe(false)
110
- expect(command.waitForClone).toBe(false)
111
- expect(command.config.containerName).toBe("dg-app")
112
- expect(command.config.serviceName).toBe("dg-app")
113
- expect(command.config.volumeName).toBe("dg-app-home")
114
- expect(command.config.targetDir).toBe(expandDefaultTargetDir(defaultTemplateConfig.targetDir))
115
- }))
116
-
117
- it.effect("fails clone when repo url is missing", () => expectParseErrorTag(["clone"], "MissingRequiredOption"))
118
-
119
- it.effect("parses clone command with positional repo url", () =>
120
- expectCreateCommand(["clone", "https://github.com/org/repo.git"], (command) => {
121
- expectCreateDefaults(command)
122
- expect(command.openSsh).toBe(true)
123
- expect(command.waitForClone).toBe(true)
124
- expect(command.config.targetDir).toBe(
125
- expandDefaultTargetDir("~/workspaces/org/repo")
126
- )
127
- }))
128
-
129
- it.effect("parses clone branch alias", () =>
130
- expectCreateCommand(["clone", "https://github.com/org/repo.git", "--branch", "feature-x"], (command) => {
131
- expect(command.config.repoRef).toBe("feature-x")
132
- }))
133
-
134
- it.effect("supports disabling SSH auto-open for clone", () =>
135
- expectCreateCommand(["clone", "https://github.com/org/repo.git", "--no-ssh"], (command) => {
136
- expect(command.openSsh).toBe(false)
137
- }))
138
-
139
- it.effect("parses clone git token label from inline option and normalizes it", () =>
140
- expectCreateCommand(["clone", "https://github.com/org/repo.git", "--git-token=#agiens"], (command) => {
141
- expect(command.config.gitTokenLabel).toBe("AGIENS")
142
- }))
143
-
144
- it.effect("parses clone codex/claude token labels from inline options and normalizes them", () =>
145
- expectCreateCommand(
146
- [
147
- "clone",
148
- "https://github.com/org/repo.git",
149
- "--codex-token= Team A ",
150
- "--claude-token=---AGIENS:::Claude---"
151
- ],
152
- (command) => {
153
- expect(command.config.codexAuthLabel).toBe("team-a")
154
- expect(command.config.claudeAuthLabel).toBe("agiens-claude")
155
- }
156
- ))
157
-
158
- it.effect("supports enabling SSH auto-open for create", () =>
159
- expectCreateCommand(["create", "--repo-url", "https://github.com/org/repo.git", "--ssh"], (command) => {
160
- expect(command.openSsh).toBe(true)
161
- }))
162
-
163
- it.effect("parses force-env flag for clone", () =>
164
- expectCreateCommand(["clone", "https://github.com/org/repo.git", "--force-env"], (command) => {
165
- expect(command.force).toBe(false)
166
- expect(command.forceEnv).toBe(true)
167
- }))
168
-
169
- it.effect("supports force + force-env together", () =>
170
- expectCreateCommand(["clone", "https://github.com/org/repo.git", "--force", "--force-env"], (command) => {
171
- expect(command.force).toBe(true)
172
- expect(command.forceEnv).toBe(true)
173
- }))
174
-
175
- it.effect("parses GitHub tree url as repo + ref", () =>
176
- expectCreateCommand(["clone", "https://github.com/agiens/crm/tree/vova-fork"], (command) => {
177
- expect(command.config.repoUrl).toBe("https://github.com/agiens/crm.git")
178
- expect(command.config.repoRef).toBe("vova-fork")
179
- expect(command.outDir).toBe(".docker-git/agiens/crm")
180
- expect(command.config.targetDir).toBe(
181
- expandDefaultTargetDir("~/workspaces/agiens/crm")
182
- )
183
- }))
184
-
185
- it.effect("parses GitHub issue url as isolated project + issue branch", () =>
186
- expectCreateCommand(["clone", "https://github.com/org/repo/issues/5"], (command) => {
187
- expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
188
- expect(command.config.repoRef).toBe("issue-5")
189
- expect(command.outDir).toBe(".docker-git/org/repo/issue-5")
190
- expect(command.config.targetDir).toBe(
191
- expandDefaultTargetDir("~/workspaces/org/repo/issue-5")
192
- )
193
- expect(command.config.containerName).toBe("dg-repo-issue-5")
194
- expect(command.config.serviceName).toBe("dg-repo-issue-5")
195
- expect(command.config.volumeName).toBe("dg-repo-issue-5-home")
196
- }))
197
-
198
- it.effect("parses GitHub PR url as isolated project", () =>
199
- expectCreateCommand(["clone", "https://github.com/org/repo/pull/42"], (command) => {
200
- expect(command.config.repoUrl).toBe("https://github.com/org/repo.git")
201
- expect(command.config.repoRef).toBe("refs/pull/42/head")
202
- expect(command.outDir).toBe(".docker-git/org/repo/pr-42")
203
- expect(command.config.targetDir).toBe(
204
- expandDefaultTargetDir("~/workspaces/org/repo/pr-42")
205
- )
206
- expect(command.config.containerName).toBe("dg-repo-pr-42")
207
- expect(command.config.serviceName).toBe("dg-repo-pr-42")
208
- expect(command.config.volumeName).toBe("dg-repo-pr-42-home")
209
- }))
210
-
211
- it.effect("parses attach with GitHub issue url into issue workspace", () =>
212
- Effect.sync(() => {
213
- const command = parseOrThrow(["attach", "https://github.com/org/repo/issues/7"])
214
- if (command._tag !== "Attach") {
215
- throw new Error("expected Attach command")
216
- }
217
- expect(command.projectDir).toBe(".docker-git/org/repo/issue-7")
218
- }))
219
-
220
- it.effect("parses mcp-playwright command in current directory", () =>
221
- expectProjectDirRunUpCommand(["mcp-playwright"], "McpPlaywrightUp", ".", true))
222
-
223
- it.effect("parses mcp-playwright command with --no-up", () =>
224
- expectProjectDirRunUpCommand(["mcp-playwright", "--no-up"], "McpPlaywrightUp", ".", false))
225
-
226
- it.effect("parses mcp-playwright with positional repo url into project dir", () =>
227
- Effect.sync(() => {
228
- const command = parseOrThrow(["mcp-playwright", "https://github.com/org/repo.git"])
229
- if (command._tag !== "McpPlaywrightUp") {
230
- throw new Error("expected McpPlaywrightUp command")
231
- }
232
- expect(command.projectDir).toBe(".docker-git/org/repo")
233
- }))
234
-
235
- it.effect("parses apply command in current directory", () =>
236
- expectProjectDirRunUpCommand(["apply"], "Apply", ".", true))
237
-
238
- it.effect("parses apply command with --no-up", () =>
239
- expectProjectDirRunUpCommand(["apply", "--no-up"], "Apply", ".", false))
240
-
241
- it.effect("parses apply with positional repo url into project dir", () =>
242
- Effect.sync(() => {
243
- const command = parseOrThrow(["apply", "https://github.com/org/repo.git"])
244
- if (command._tag !== "Apply") {
245
- throw new Error("expected Apply command")
246
- }
247
- expect(command.projectDir).toBe(".docker-git/org/repo")
248
- }))
249
-
250
- it.effect("parses apply token and mcp overrides", () =>
251
- Effect.sync(() => {
252
- const command = parseOrThrow([
253
- "apply",
254
- "--git-token=agien_main",
255
- "--codex-token=Team A",
256
- "--claude-token=Team B",
257
- "--mcp-playwright",
258
- "--no-up"
259
- ])
260
- if (command._tag !== "Apply") {
261
- throw new Error("expected Apply command")
262
- }
263
- expect(command.runUp).toBe(false)
264
- expect(command.gitTokenLabel).toBe("agien_main")
265
- expect(command.codexTokenLabel).toBe("Team A")
266
- expect(command.claudeTokenLabel).toBe("Team B")
267
- expect(command.enableMcpPlaywright).toBe(true)
268
- }))
269
-
270
- it.effect("parses down-all command", () =>
271
- Effect.sync(() => {
272
- const command = parseOrThrow(["down-all"])
273
- expect(command._tag).toBe("DownAll")
274
- }))
275
-
276
- it.effect("parses state path command", () =>
277
- Effect.sync(() => {
278
- const command = parseOrThrow(["state", "path"])
279
- expect(command._tag).toBe("StatePath")
280
- }))
281
-
282
- it.effect("parses state init command", () =>
283
- Effect.sync(() => {
284
- const command = parseOrThrow(["state", "init", "--repo-url", "https://github.com/org/state.git"])
285
- if (command._tag !== "StateInit") {
286
- throw new Error("expected StateInit command")
287
- }
288
- expect(command.repoUrl).toBe("https://github.com/org/state.git")
289
- expect(command.repoRef).toBe("main")
290
- }))
291
-
292
- it.effect("parses state commit command", () =>
293
- Effect.sync(() => {
294
- const command = parseOrThrow(["state", "commit", "-m", "sync state"])
295
- if (command._tag !== "StateCommit") {
296
- throw new Error("expected StateCommit command")
297
- }
298
- expect(command.message).toBe("sync state")
299
- }))
300
-
301
- it.effect("parses state sync command", () =>
302
- Effect.sync(() => {
303
- const command = parseOrThrow(["state", "sync", "-m", "sync state"])
304
- if (command._tag !== "StateSync") {
305
- throw new Error("expected StateSync command")
306
- }
307
- expect(command.message).toBe("sync state")
308
- }))
309
-
310
- it.effect("parses scrap export with defaults", () =>
311
- Effect.sync(() => {
312
- const command = parseOrThrow(["scrap", "export"])
313
- if (command._tag !== "ScrapExport") {
314
- throw new Error("expected ScrapExport command")
315
- }
316
- expect(command.projectDir).toBe(".")
317
- expect(command.archivePath).toBe(".orch/scrap/session")
318
- }))
319
-
320
- it.effect("fails scrap import without archive", () =>
321
- expectParseErrorTag(["scrap", "import"], "MissingRequiredOption"))
322
-
323
- it.effect("parses scrap import wipe defaults", () =>
324
- Effect.sync(() => {
325
- const command = parseOrThrow(["scrap", "import", "--archive", "workspace.tar.gz"])
326
- if (command._tag !== "ScrapImport") {
327
- throw new Error("expected ScrapImport command")
328
- }
329
- expect(command.wipe).toBe(true)
330
- }))
331
-
332
- it.effect("parses scrap import --no-wipe", () =>
333
- Effect.sync(() => {
334
- const command = parseOrThrow(["scrap", "import", "--archive", "workspace.tar.gz", "--no-wipe"])
335
- if (command._tag !== "ScrapImport") {
336
- throw new Error("expected ScrapImport command")
337
- }
338
- expect(command.wipe).toBe(false)
339
- }))
340
- })
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "types": []
5
- },
6
- "include": ["src/**/*"],
7
- "exclude": ["dist", "node_modules", "tests/**/*", "vite.config.ts", "vitest.config.ts"]
8
- }
package/tsconfig.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": ".",
5
- "outDir": "dist",
6
- "types": ["vitest"],
7
- "jsx": "react-jsx",
8
- "baseUrl": ".",
9
- "paths": {
10
- "@/*": ["src/*"]
11
- }
12
- },
13
- "include": [
14
- "src/**/*",
15
- "tests/**/*",
16
- "vite.config.ts",
17
- "vitest.config.ts"
18
- ],
19
- "exclude": ["dist", "node_modules"]
20
- }
package/vite.config.ts DELETED
@@ -1,32 +0,0 @@
1
- import path from "node:path"
2
- import { fileURLToPath } from "node:url"
3
- import { defineConfig } from "vite"
4
- import tsconfigPaths from "vite-tsconfig-paths"
5
-
6
- const __filename = fileURLToPath(import.meta.url)
7
- const __dirname = path.dirname(__filename)
8
-
9
- export default defineConfig({
10
- plugins: [tsconfigPaths()],
11
- publicDir: false,
12
- resolve: {
13
- alias: {
14
- "@": path.resolve(__dirname, "src")
15
- }
16
- },
17
- build: {
18
- target: "node20",
19
- outDir: "dist",
20
- sourcemap: true,
21
- ssr: "src/app/main.ts",
22
- rollupOptions: {
23
- output: {
24
- format: "es",
25
- entryFileNames: "main.js"
26
- }
27
- }
28
- },
29
- ssr: {
30
- target: "node"
31
- }
32
- })
@@ -1,34 +0,0 @@
1
- import path from "node:path"
2
- import { fileURLToPath } from "node:url"
3
- import { defineConfig } from "vite"
4
- import tsconfigPaths from "vite-tsconfig-paths"
5
-
6
- const __filename = fileURLToPath(import.meta.url)
7
- const __dirname = path.dirname(__filename)
8
-
9
- export default defineConfig({
10
- plugins: [tsconfigPaths()],
11
- publicDir: false,
12
- resolve: {
13
- alias: {
14
- "@": path.resolve(__dirname, "src"),
15
- "@effect-template/lib": path.resolve(__dirname, "../lib/src")
16
- }
17
- },
18
- build: {
19
- target: "node20",
20
- outDir: "dist",
21
- sourcemap: true,
22
- ssr: "src/docker-git/main.ts",
23
- rollupOptions: {
24
- output: {
25
- format: "es",
26
- entryFileNames: "src/docker-git/main.js",
27
- inlineDynamicImports: true
28
- }
29
- }
30
- },
31
- ssr: {
32
- target: "node"
33
- }
34
- })
package/vitest.config.ts DELETED
@@ -1,85 +0,0 @@
1
- // CHANGE: Migrate from Jest to Vitest with mathematical equivalence
2
- // WHY: Faster execution, native ESM, Effect integration via @effect/vitest
3
- // QUOTE(ТЗ): "Проект использует Effect + функциональную парадигму"
4
- // REF: Migration from jest.config.mjs
5
- // PURITY: SHELL (configuration only)
6
- // INVARIANT: ∀ test: behavior_jest ≡ behavior_vitest
7
- // EFFECT: Effect<TestReport, never, TestEnvironment>
8
- // COMPLEXITY: O(n) test execution where n = |test_files|
9
-
10
- import path from "node:path"
11
- import { fileURLToPath } from "node:url"
12
- import tsconfigPaths from "vite-tsconfig-paths"
13
- import { defineConfig } from "vitest/config"
14
-
15
- const __filename = fileURLToPath(import.meta.url)
16
- const __dirname = path.dirname(__filename)
17
-
18
- export default defineConfig({
19
- plugins: [tsconfigPaths()], // Resolves @/* paths from tsconfig
20
- test: {
21
- // CHANGE: Native ESM support without experimental flags
22
- // WHY: Vitest designed for ESM, no need for --experimental-vm-modules
23
- // INVARIANT: Deterministic test execution without side effects
24
- globals: false, // IMPORTANT: Use explicit imports for type safety
25
- environment: "node",
26
-
27
- // CHANGE: Match Jest's test file patterns
28
- // INVARIANT: Same test discovery as Jest
29
- include: ["tests/**/*.{test,spec}.ts"],
30
- exclude: ["node_modules", "dist", "dist-test"],
31
-
32
- // CHANGE: Coverage with 100% threshold for CORE (same as Jest)
33
- // WHY: CORE must maintain mathematical guarantees via complete coverage
34
- // INVARIANT: coverage_vitest ≥ coverage_jest ∧ ∀ f ∈ CORE: coverage(f) = 100%
35
- coverage: {
36
- provider: "v8", // Faster than babel (istanbul), native V8 coverage
37
- reporter: ["text", "json", "html"],
38
- include: ["src/**/*.ts"],
39
- exclude: [
40
- "src/**/*.test.ts",
41
- "src/**/*.spec.ts",
42
- "src/**/__tests__/**",
43
- "scripts/**/*.ts"
44
- ],
45
- // CHANGE: Maintain exact same thresholds as Jest
46
- // WHY: Enforce 100% coverage for CORE, 10% minimum for SHELL
47
- // INVARIANT: ∀ f ∈ src/core/**/*.ts: all_metrics(f) = 100%
48
- // NOTE: Vitest v8 provider collects coverage for all matched files by default
49
- thresholds: {
50
- "src/core/**/*.ts": {
51
- branches: 100,
52
- functions: 100,
53
- lines: 100,
54
- statements: 100
55
- },
56
- global: {
57
- branches: 10,
58
- functions: 10,
59
- lines: 10,
60
- statements: 10
61
- }
62
- }
63
- },
64
-
65
- // CHANGE: Faster test execution via thread pooling
66
- // WHY: Vitest uses worker threads by default (faster than Jest's processes)
67
- // COMPLEXITY: O(n/k) where n = tests, k = worker_count
68
- // NOTE: Vitest runs tests in parallel by default, no additional config needed
69
-
70
- // CHANGE: Clear mocks between tests (Jest equivalence)
71
- // WHY: Prevent test contamination, ensure test independence
72
- // INVARIANT: ∀ test_i, test_j: independent(test_i, test_j) ⇒ no_shared_state
73
- clearMocks: true,
74
- mockReset: true,
75
- restoreMocks: true
76
- // CHANGE: Disable globals to enforce explicit imports
77
- // WHY: Type safety, explicit dependencies, functional purity
78
- // NOTE: Tests must import { describe, it, expect } from "vitest"
79
- },
80
- resolve: {
81
- alias: {
82
- "@": path.resolve(__dirname, "src")
83
- }
84
- }
85
- })