Repository navigation
Expand file tree
/
Copy pathvite.config.ts
More file actions
129 lines (125 loc) · 4.44 KB
/
Copy pathvite.config.ts
File metadata and controls
129 lines (125 loc) · 4.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { recommended } from "@effect/tsgo/oxlint-presets";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vite-plus";
import { configDefaults } from "vite-plus/test/config";
const ignoredPaths = [
"dist/**",
"**/dist/**",
"node_modules/**",
"**/node_modules/**",
".pnpm-store/**",
".zed/**",
".vercel/**",
"**/.vercel/**",
// Generated by @tanstack/router-plugin; regenerated on dev/build.
"**/routeTree.gen.ts",
];
const aliases = [
// `@codeworksh/plugin` is the published plugin SDK; in this repo it resolves to source,
// so a change to the contract is visible to the harness and the example plugins at once.
{
find: /^@codeworksh\/plugin$/,
replacement: fileURLToPath(new URL("./packages/plugin/src/index.ts", import.meta.url)),
},
{
find: /^@codeworksh\/plugin\/(.*)$/,
replacement: fileURLToPath(new URL("./packages/plugin/src/$1.ts", import.meta.url)),
},
{
find: "@codeworksh/harness/effect",
replacement: fileURLToPath(new URL("./packages/harness/src/effect.ts", import.meta.url)),
},
{
find: "@codeworksh/harness/sandbox",
replacement: fileURLToPath(new URL("./packages/harness/src/sandbox.ts", import.meta.url)),
},
{
find: "@codeworksh/aikit/failure",
replacement: fileURLToPath(new URL("./packages/aikit/src/llm/failure.ts", import.meta.url)),
},
{
find: "@codeworksh/aikit/modelgen",
replacement: fileURLToPath(new URL("./packages/aikit/src/modelgen.ts", import.meta.url)),
},
{
find: /^@codeworksh\/aikit\/(oauth\/.+)$/,
replacement: fileURLToPath(new URL("./packages/aikit/src/$1.ts", import.meta.url)),
},
{ find: "@codeworksh/aikit", replacement: fileURLToPath(new URL("./packages/aikit/src/index.ts", import.meta.url)) },
{
find: "@codeworksh/harness",
replacement: fileURLToPath(new URL("./packages/harness/src/index.ts", import.meta.url)),
},
{
find: "@codeworksh/tui",
replacement: fileURLToPath(new URL("./packages/tui/src/index.ts", import.meta.url)),
},
];
// Packages written against Effect. Kept as a list so lint overrides and the
// Effect rule set stay in one place as more Effect packages land.
const effectPackages = ["packages/harness/src/**/*.ts", "packages/plugin/src/**/*.ts", "packages/codework/src/**/*.ts"];
const effectRules = {
...recommended.rules,
// These packages have explicit Node host/provider boundaries; their Effect
// language-service policy permits these imports for the same reason.
"effecttsgo/node-builtin-import": "off",
// These APIs intentionally return fresh streams/layers or perform setup when
// called. Treating every zero-argument constructor as redundant is incorrect.
"effecttsgo/lazy-effect": "off",
} as const;
export default defineConfig({
resolve: {
alias: aliases,
},
run: {
tasks: {
// Uncached tasks see the whole environment, which these need (npm OIDC in CI, git signing).
bump: { command: "node scripts/bump.mjs", cache: false },
release: { command: "node scripts/release.mjs", cache: false },
// CI's check gate. Type-aware lint, like each package's typecheck, resolves aikit through
// its generated declarations, so they are built first.
verify: {
command: [
"vp check packages scripts .github infra",
"vp run --filter './packages/*' --concurrency-limit 2 typecheck",
],
dependsOn: ["@codeworksh/aikit#build"],
cache: false,
},
},
},
test: {
include: ["packages/**/*.test.ts"],
exclude:
process.env.CODEWORK_SANDBOX_E2E_REQUIRED === "1"
? configDefaults.exclude
: [...configDefaults.exclude, "packages/**/*.e2e.test.ts"],
},
lint: {
// Effect rules from @effect/tsgo, scoped to the Effect codebases here -- aikit
// is plain TypeScript and would drown in false positives. Overrides cannot
// `extends`, so the preset's plugins/rules are spread in directly. These need Oxlint's
// type-aware mode, which the patched oxlint-tsgolint binary provides (`prepare`).
overrides: [
{
files: effectPackages,
...(recommended.plugins && { plugins: recommended.plugins }),
rules: effectRules,
},
],
ignorePatterns: ignoredPaths,
options: {
typeAware: true,
typeCheck: true,
},
},
fmt: {
// A file snapshot is the exact bytes a test wrote, and the bundled model catalog the exact
// bytes `aikit modelgen --baseline` wrote; reformatting either would make it drift.
ignorePatterns: [...ignoredPaths, "**/__artifacts__/**", "packages/aikit/src/model/baseline.json"],
printWidth: 120,
useTabs: true,
tabWidth: 3,
sortPackageJson: true,
},
});