kata-context 0.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.
- package/.claude/settings.json +6 -0
- package/.github/dependabot.yml +13 -0
- package/.github/workflows/release.yml +68 -0
- package/.planning/PROJECT.md +103 -0
- package/.planning/REQUIREMENTS.md +61 -0
- package/.planning/ROADMAP.md +59 -0
- package/.planning/STATE.md +45 -0
- package/.planning/config.json +20 -0
- package/.planning/phases/01-foundation/01-01-PLAN.md +158 -0
- package/.planning/phases/01-foundation/01-01-SUMMARY.md +123 -0
- package/.planning/phases/01-foundation/01-02-PLAN.md +262 -0
- package/.planning/phases/01-foundation/01-02-SUMMARY.md +153 -0
- package/.planning/phases/01-foundation/01-RESEARCH.md +380 -0
- package/.planning/phases/01-foundation/01-foundation-VERIFICATION.md +232 -0
- package/.planning/research/ARCHITECTURE.md +601 -0
- package/.planning/research/FEATURES.md +242 -0
- package/.planning/research/PITFALLS.md +436 -0
- package/.planning/research/STACK.md +299 -0
- package/.planning/research/SUMMARY.md +409 -0
- package/README.md +82 -0
- package/biome.json +42 -0
- package/package.json +28 -0
- package/scripts/rescue-main.sh +79 -0
- package/src/index.ts +6 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +14 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Technology Stack
|
|
2
|
+
|
|
3
|
+
**Project:** Kata Context - Context Policy Engine for AI Agents
|
|
4
|
+
**Researched:** 2026-01-29
|
|
5
|
+
**Overall Confidence:** HIGH
|
|
6
|
+
|
|
7
|
+
## Recommended Stack
|
|
8
|
+
|
|
9
|
+
### Runtime & Platform
|
|
10
|
+
|
|
11
|
+
| Technology | Version | Purpose | Rationale |
|
|
12
|
+
|------------|---------|---------|-----------|
|
|
13
|
+
| Node.js | 24.x | Runtime | Current LTS (Krypton), default on Vercel, native TypeScript type stripping support |
|
|
14
|
+
| Vercel Functions | - | Serverless compute | Fluid Compute for efficient concurrency, native TypeScript support, zero config deployment |
|
|
15
|
+
| TypeScript | 5.9.x | Type safety | Latest stable, includes `verbatimModuleSyntax` and `erasableSyntaxOnly` for Node.js native TS support |
|
|
16
|
+
|
|
17
|
+
**Node.js 24.x Rationale:**
|
|
18
|
+
- Vercel default as of January 2026
|
|
19
|
+
- Active LTS through April 2028
|
|
20
|
+
- Native TypeScript type stripping (no flags needed)
|
|
21
|
+
- Full ESM support without experimental flags
|
|
22
|
+
|
|
23
|
+
### Package Manager
|
|
24
|
+
|
|
25
|
+
| Technology | Version | Purpose | Rationale |
|
|
26
|
+
|------------|---------|---------|-----------|
|
|
27
|
+
| pnpm | 10.x | Package management | 70% disk savings vs npm, strict dependency isolation, Vercel auto-detects via pnpm-lock.yaml |
|
|
28
|
+
|
|
29
|
+
**Why pnpm over alternatives:**
|
|
30
|
+
|
|
31
|
+
| Alternative | Why Not |
|
|
32
|
+
|-------------|---------|
|
|
33
|
+
| npm | Slower installs, no content-addressable storage, phantom dependency issues |
|
|
34
|
+
| yarn | Similar features to pnpm but less mature monorepo support, declining mindshare |
|
|
35
|
+
| bun | Fast but package manager is secondary feature; some ecosystem compatibility gaps; better for runtime than just packages |
|
|
36
|
+
|
|
37
|
+
**pnpm Detection:**
|
|
38
|
+
Vercel automatically uses `pnpm install` when `pnpm-lock.yaml` is present. No additional configuration needed.
|
|
39
|
+
|
|
40
|
+
### Linting & Formatting
|
|
41
|
+
|
|
42
|
+
| Technology | Version | Purpose | Rationale |
|
|
43
|
+
|------------|---------|---------|-----------|
|
|
44
|
+
| Biome | 2.3.x | Linting + formatting | 20-35x faster than ESLint+Prettier, single config file, 427 rules, native TypeScript |
|
|
45
|
+
|
|
46
|
+
**Why Biome over ESLint + Prettier:**
|
|
47
|
+
- **Performance:** Formats 100k+ line codebase in under 1 second vs 10-20 seconds
|
|
48
|
+
- **Simplicity:** One dependency, one config file (`biome.json`) vs 6+ packages and multiple configs
|
|
49
|
+
- **TypeScript-first:** Native support, no plugins needed
|
|
50
|
+
- **97% Prettier compatibility:** Consistent formatting with industry standard
|
|
51
|
+
|
|
52
|
+
**When ESLint might still be needed:**
|
|
53
|
+
- Custom enterprise compliance rules not available in Biome
|
|
54
|
+
- Legacy projects with extensive custom ESLint plugins
|
|
55
|
+
- This project: Not applicable - new project, Biome sufficient
|
|
56
|
+
|
|
57
|
+
**Configuration:**
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"$schema": "https://biomejs.dev/schemas/2.3.13/schema.json",
|
|
61
|
+
"organizeImports": { "enabled": true },
|
|
62
|
+
"linter": {
|
|
63
|
+
"enabled": true,
|
|
64
|
+
"rules": { "recommended": true }
|
|
65
|
+
},
|
|
66
|
+
"formatter": {
|
|
67
|
+
"enabled": true,
|
|
68
|
+
"indentStyle": "space",
|
|
69
|
+
"indentWidth": 2
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Testing Framework
|
|
75
|
+
|
|
76
|
+
| Technology | Version | Purpose | Rationale |
|
|
77
|
+
|------------|---------|---------|-----------|
|
|
78
|
+
| Vitest | 4.x | Unit & integration testing | 10-20x faster than Jest, native ESM/TypeScript, Jest-compatible API |
|
|
79
|
+
|
|
80
|
+
**Why Vitest over Jest:**
|
|
81
|
+
- **Performance:** Tests run in 1-2 seconds vs 15-20 seconds for equivalent Jest suites
|
|
82
|
+
- **TypeScript:** Native support, no ts-jest configuration needed
|
|
83
|
+
- **ESM:** First-class support, no experimental flags
|
|
84
|
+
- **Migration path:** 95% Jest API compatibility - can use existing Jest knowledge
|
|
85
|
+
|
|
86
|
+
**When Jest might still be needed:**
|
|
87
|
+
- React Native projects (Jest is mandatory)
|
|
88
|
+
- Existing large Jest test suites where migration cost exceeds benefit
|
|
89
|
+
- This project: Not applicable - greenfield, Vitest is correct choice
|
|
90
|
+
|
|
91
|
+
### TypeScript Execution (Development)
|
|
92
|
+
|
|
93
|
+
| Technology | Version | Purpose | Rationale |
|
|
94
|
+
|------------|---------|---------|-----------|
|
|
95
|
+
| tsx | 4.x | Development TypeScript execution | 20-30x faster than ts-node, native ESM support, sensible defaults |
|
|
96
|
+
|
|
97
|
+
**Why tsx over alternatives:**
|
|
98
|
+
|
|
99
|
+
| Alternative | Why Not |
|
|
100
|
+
|-------------|---------|
|
|
101
|
+
| ts-node | Slow startup, complex ESM configuration, requires peer dependencies |
|
|
102
|
+
| Native Node.js (--experimental-strip-types) | Requires Node.js 23.6+ flags for advanced features; tsx more mature for development |
|
|
103
|
+
| Bun | Good but adds runtime complexity; tsx is lighter for just TS execution |
|
|
104
|
+
|
|
105
|
+
**Note:** tsx is for development execution only. Vercel handles TypeScript compilation for production deployment automatically.
|
|
106
|
+
|
|
107
|
+
### Build Tooling
|
|
108
|
+
|
|
109
|
+
| Technology | Version | Purpose | Rationale |
|
|
110
|
+
|------------|---------|---------|-----------|
|
|
111
|
+
| tsc | (via TypeScript) | Type checking & declaration generation | Official compiler, required for .d.ts output |
|
|
112
|
+
| Vercel Build | - | Production bundling | Zero-config, optimized for Vercel Functions |
|
|
113
|
+
|
|
114
|
+
**Build Strategy:**
|
|
115
|
+
1. **Type checking:** `tsc --noEmit` - validates types without emitting
|
|
116
|
+
2. **Linting:** `biome check .` - fast lint + format check
|
|
117
|
+
3. **Tests:** `vitest run` - fast test execution
|
|
118
|
+
4. **Deployment:** Vercel handles bundling automatically
|
|
119
|
+
|
|
120
|
+
**What NOT to add:**
|
|
121
|
+
- **esbuild/swc/tsup for bundling:** Vercel bundles functions automatically
|
|
122
|
+
- **Webpack/Rollup:** Overkill for serverless functions, adds complexity
|
|
123
|
+
- **Babel:** TypeScript and Vercel handle transpilation
|
|
124
|
+
|
|
125
|
+
## TypeScript Configuration
|
|
126
|
+
|
|
127
|
+
Recommended `tsconfig.json` for Vercel serverless:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
132
|
+
"compilerOptions": {
|
|
133
|
+
"target": "ES2024",
|
|
134
|
+
"module": "NodeNext",
|
|
135
|
+
"moduleResolution": "NodeNext",
|
|
136
|
+
"lib": ["ES2024"],
|
|
137
|
+
"strict": true,
|
|
138
|
+
"esModuleInterop": true,
|
|
139
|
+
"skipLibCheck": true,
|
|
140
|
+
"forceConsistentCasingInFileNames": true,
|
|
141
|
+
"isolatedModules": true,
|
|
142
|
+
"verbatimModuleSyntax": true,
|
|
143
|
+
"noEmit": true,
|
|
144
|
+
"declaration": true,
|
|
145
|
+
"declarationMap": true,
|
|
146
|
+
"sourceMap": true,
|
|
147
|
+
"outDir": "./dist",
|
|
148
|
+
"rootDir": "./src",
|
|
149
|
+
"types": ["node"]
|
|
150
|
+
},
|
|
151
|
+
"include": ["src/**/*.ts"],
|
|
152
|
+
"exclude": ["node_modules", "dist"]
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Key settings explained:**
|
|
157
|
+
- `module: "NodeNext"` - Node.js ESM with package.json `type` field support
|
|
158
|
+
- `verbatimModuleSyntax: true` - Prevents import/export ambiguity
|
|
159
|
+
- `isolatedModules: true` - Ensures compatibility with single-file transpilers
|
|
160
|
+
- `noEmit: true` - Type check only; Vercel handles compilation
|
|
161
|
+
- `target: "ES2024"` - Node.js 24 supports ES2024 fully
|
|
162
|
+
|
|
163
|
+
**package.json essentials:**
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"type": "module",
|
|
167
|
+
"engines": {
|
|
168
|
+
"node": "24.x"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Supporting Libraries
|
|
174
|
+
|
|
175
|
+
| Library | Version | Purpose | When to Add |
|
|
176
|
+
|---------|---------|---------|-------------|
|
|
177
|
+
| @vercel/node | latest | Vercel Function types | Optional - Web standard types preferred |
|
|
178
|
+
| zod | 3.x | Runtime validation | Schema validation for API inputs |
|
|
179
|
+
| drizzle-orm | latest | Database ORM | When connecting to Neon Postgres |
|
|
180
|
+
| @neondatabase/serverless | latest | Neon connection | Serverless-optimized Postgres driver |
|
|
181
|
+
|
|
182
|
+
**Note:** These are listed for awareness. Add when the specific feature is implemented, not upfront.
|
|
183
|
+
|
|
184
|
+
## Installation
|
|
185
|
+
|
|
186
|
+
### Initial Setup
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# Initialize with pnpm
|
|
190
|
+
pnpm init
|
|
191
|
+
|
|
192
|
+
# Core dependencies
|
|
193
|
+
pnpm add typescript
|
|
194
|
+
|
|
195
|
+
# Development dependencies
|
|
196
|
+
pnpm add -D @types/node vitest tsx biome
|
|
197
|
+
|
|
198
|
+
# Vercel CLI (optional, for local development)
|
|
199
|
+
pnpm add -D vercel
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Scripts (package.json)
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"scripts": {
|
|
207
|
+
"dev": "vercel dev",
|
|
208
|
+
"build": "tsc --noEmit",
|
|
209
|
+
"test": "vitest",
|
|
210
|
+
"test:run": "vitest run",
|
|
211
|
+
"lint": "biome check .",
|
|
212
|
+
"lint:fix": "biome check --write .",
|
|
213
|
+
"format": "biome format --write .",
|
|
214
|
+
"typecheck": "tsc --noEmit"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## What NOT to Include
|
|
220
|
+
|
|
221
|
+
| Technology | Why Avoid |
|
|
222
|
+
|------------|-----------|
|
|
223
|
+
| Jest | Slower, requires configuration for TypeScript/ESM |
|
|
224
|
+
| ESLint + Prettier | Slower, more dependencies, more configuration |
|
|
225
|
+
| ts-node | Slow, complex ESM setup |
|
|
226
|
+
| Webpack/Rollup/esbuild | Vercel handles bundling |
|
|
227
|
+
| Babel | TypeScript and Vercel handle transpilation |
|
|
228
|
+
| nodemon | tsx has built-in watch mode |
|
|
229
|
+
| husky + lint-staged | Add later if needed; not essential for v0.1.0 |
|
|
230
|
+
|
|
231
|
+
## Vercel-Specific Considerations
|
|
232
|
+
|
|
233
|
+
### Function Configuration
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
// api/example.ts
|
|
237
|
+
export const config = {
|
|
238
|
+
runtime: 'nodejs', // Use Node.js runtime (not Edge)
|
|
239
|
+
regions: ['iad1'], // Washington D.C. - close to typical database locations
|
|
240
|
+
maxDuration: 30, // Seconds (Pro plan allows up to 300)
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Project Configuration (vercel.json or vercel.ts)
|
|
245
|
+
|
|
246
|
+
For this project, start with `vercel.json`:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"functions": {
|
|
251
|
+
"api/**/*.ts": {
|
|
252
|
+
"memory": 1024,
|
|
253
|
+
"maxDuration": 30
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Consider migrating to `vercel.ts` when dynamic configuration is needed.
|
|
260
|
+
|
|
261
|
+
### Fluid Compute
|
|
262
|
+
|
|
263
|
+
Vercel Functions use Fluid Compute by default:
|
|
264
|
+
- Multiple invocations share instances
|
|
265
|
+
- Reduced cold starts
|
|
266
|
+
- Better concurrency for I/O-bound operations (database queries, LLM calls)
|
|
267
|
+
|
|
268
|
+
No configuration needed - this is automatic.
|
|
269
|
+
|
|
270
|
+
## Sources
|
|
271
|
+
|
|
272
|
+
### Package Managers
|
|
273
|
+
- [pnpm vs npm vs yarn vs Bun: The 2026 Package Manager Showdown](https://dev.to/pockit_tools/pnpm-vs-npm-vs-yarn-vs-bun-the-2026-package-manager-showdown-51dc)
|
|
274
|
+
- [pnpm Official Site](https://pnpm.io/) - Version 10.28.2
|
|
275
|
+
|
|
276
|
+
### Linting & Formatting
|
|
277
|
+
- [Biome Official Site](https://biomejs.dev/) - Version 2.3.13
|
|
278
|
+
- [Biome: The ESLint and Prettier Killer? Complete Migration Guide for 2026](https://dev.to/pockit_tools/biome-the-eslint-and-prettier-killer-complete-migration-guide-for-2026-27m)
|
|
279
|
+
- [Biome vs ESLint: Comparing JavaScript Linters](https://betterstack.com/community/guides/scaling-nodejs/biome-eslint/)
|
|
280
|
+
|
|
281
|
+
### Testing
|
|
282
|
+
- [Vitest Official Site](https://vitest.dev/) - Version 4.0.18
|
|
283
|
+
- [Vitest vs Jest 30: Why 2026 is the Year of Browser-Native Testing](https://dev.to/dataformathub/vitest-vs-jest-30-why-2026-is-the-year-of-browser-native-testing-2fgb)
|
|
284
|
+
- [Jest vs Vitest: Choosing the Right Testing Framework](https://medium.com/on-tech-by-leighton/jest-vs-vitest-choosing-the-right-testing-framework-for-your-typescript-projects-07f23c4aa76c)
|
|
285
|
+
|
|
286
|
+
### TypeScript
|
|
287
|
+
- [TypeScript 5.9 Documentation](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-9.html)
|
|
288
|
+
- [A Modern Node.js + TypeScript Setup for 2025](https://dev.to/woovi/a-modern-nodejs-typescript-setup-for-2025-nlk)
|
|
289
|
+
- [TSX vs ts-node: The Definitive TypeScript Runtime Comparison](https://betterstack.com/community/guides/scaling-nodejs/tsx-vs-ts-node/)
|
|
290
|
+
|
|
291
|
+
### Vercel
|
|
292
|
+
- [Vercel Functions Documentation](https://vercel.com/docs/functions)
|
|
293
|
+
- [Vercel Node.js Runtime](https://vercel.com/docs/functions/runtimes/node-js)
|
|
294
|
+
- [Supported Node.js Versions](https://vercel.com/docs/functions/runtimes/node-js/node-js-versions) - Default: Node.js 24.x
|
|
295
|
+
- [Programmatic Configuration with vercel.ts](https://vercel.com/docs/project-configuration/vercel-ts)
|
|
296
|
+
|
|
297
|
+
### Node.js
|
|
298
|
+
- [Node.js Releases](https://nodejs.org/en/about/previous-releases) - Node.js 24.13.0 LTS
|
|
299
|
+
- [Node.js endoflife.date](https://endoflife.date/nodejs)
|