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.
@@ -0,0 +1,262 @@
1
+ ---
2
+ phase: 01-foundation
3
+ plan: 02
4
+ type: execute
5
+ wave: 2
6
+ depends_on: ["01-01"]
7
+ files_modified:
8
+ - tsconfig.json
9
+ - biome.json
10
+ - vitest.config.ts
11
+ - src/index.ts
12
+ autonomous: true
13
+
14
+ must_haves:
15
+ truths:
16
+ - "pnpm build compiles TypeScript without errors"
17
+ - "pnpm lint runs Biome linter on TypeScript files"
18
+ - "pnpm format runs Biome formatter"
19
+ - "pnpm test runs Vitest (passes with no tests)"
20
+ artifacts:
21
+ - path: "tsconfig.json"
22
+ provides: "TypeScript compiler configuration"
23
+ contains: "NodeNext"
24
+ - path: "biome.json"
25
+ provides: "Biome linter and formatter configuration"
26
+ contains: "biomejs.dev"
27
+ - path: "vitest.config.ts"
28
+ provides: "Vitest test runner configuration"
29
+ contains: "defineConfig"
30
+ - path: "src/index.ts"
31
+ provides: "Entry point placeholder for build verification"
32
+ min_lines: 1
33
+ - path: "dist/index.js"
34
+ provides: "Compiled JavaScript output"
35
+ min_lines: 1
36
+ key_links:
37
+ - from: "tsconfig.json"
38
+ to: "dist/"
39
+ via: "tsc compilation"
40
+ pattern: "outDir.*dist"
41
+ - from: "package.json scripts.lint"
42
+ to: "biome.json"
43
+ via: "biome lint command"
44
+ pattern: "biome lint"
45
+ - from: "vitest.config.ts"
46
+ to: "src/**/*.test.ts"
47
+ via: "test include pattern"
48
+ pattern: "include.*test\\.ts"
49
+ ---
50
+
51
+ <objective>
52
+ Configure TypeScript, Biome, and Vitest tooling with proper configuration files.
53
+
54
+ Purpose: Enable the core developer workflow (build, lint, format, test) that all future development depends on.
55
+ Output: Working toolchain where all pnpm scripts execute successfully.
56
+ </objective>
57
+
58
+ <context>
59
+ @.planning/PROJECT.md
60
+ @.planning/ROADMAP.md
61
+ @.planning/phases/01-foundation/01-RESEARCH.md
62
+ @.planning/phases/01-foundation/01-01-SUMMARY.md
63
+ </context>
64
+
65
+ <tasks>
66
+
67
+ <task type="auto">
68
+ <name>Task 1: Configure TypeScript with NodeNext</name>
69
+ <files>tsconfig.json, src/index.ts</files>
70
+ <action>
71
+ 1. Create tsconfig.json with NodeNext configuration:
72
+
73
+ ```json
74
+ {
75
+ "compilerOptions": {
76
+ "target": "ES2023",
77
+ "module": "NodeNext",
78
+ "moduleResolution": "NodeNext",
79
+ "strict": true,
80
+ "esModuleInterop": true,
81
+ "skipLibCheck": true,
82
+ "outDir": "dist",
83
+ "rootDir": "src",
84
+ "declaration": true,
85
+ "declarationMap": true,
86
+ "sourceMap": true,
87
+ "noUncheckedIndexedAccess": true,
88
+ "isolatedModules": true,
89
+ "verbatimModuleSyntax": true
90
+ },
91
+ "include": ["src"],
92
+ "exclude": ["node_modules", "dist"]
93
+ }
94
+ ```
95
+
96
+ 2. Create src/index.ts as a placeholder:
97
+
98
+ ```typescript
99
+ /**
100
+ * Kata Context - Context policy engine for AI agents
101
+ * @packageDocumentation
102
+ */
103
+
104
+ export const VERSION = "0.1.0";
105
+ ```
106
+
107
+ CRITICAL: module and moduleResolution MUST both be "NodeNext" (not "node" or "bundler").
108
+ CRITICAL: strict MUST be true (requirement INIT-01).
109
+ </action>
110
+ <verify>
111
+ - `pnpm build` completes without errors
112
+ - `ls dist/index.js dist/index.d.ts` both exist
113
+ - `grep "NodeNext" tsconfig.json` returns matches
114
+ - `grep '"strict": true' tsconfig.json` returns match
115
+ </verify>
116
+ <done>
117
+ - tsconfig.json exists with strict: true and NodeNext resolution
118
+ - src/index.ts exists with placeholder export
119
+ - dist/index.js generated by build
120
+ </done>
121
+ </task>
122
+
123
+ <task type="auto">
124
+ <name>Task 2: Configure Biome for linting and formatting</name>
125
+ <files>biome.json</files>
126
+ <action>
127
+ Create biome.json with recommended configuration:
128
+
129
+ ```json
130
+ {
131
+ "$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
132
+ "vcs": {
133
+ "enabled": true,
134
+ "clientKind": "git",
135
+ "useIgnoreFile": true,
136
+ "defaultBranch": "main"
137
+ },
138
+ "files": {
139
+ "ignoreUnknown": true
140
+ },
141
+ "formatter": {
142
+ "enabled": true,
143
+ "indentStyle": "space",
144
+ "indentWidth": 2,
145
+ "lineWidth": 100,
146
+ "lineEnding": "lf"
147
+ },
148
+ "linter": {
149
+ "enabled": true,
150
+ "rules": {
151
+ "recommended": true
152
+ }
153
+ },
154
+ "organizeImports": {
155
+ "enabled": true
156
+ },
157
+ "javascript": {
158
+ "formatter": {
159
+ "quoteStyle": "double",
160
+ "semicolons": "always",
161
+ "trailingCommas": "all"
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ This configures:
168
+ - Git integration (respects .gitignore)
169
+ - 2-space indentation with LF line endings
170
+ - Double quotes and semicolons (consistent style)
171
+ - Trailing commas (cleaner git diffs)
172
+ - All recommended lint rules enabled
173
+ </action>
174
+ <verify>
175
+ - `pnpm lint` runs without errors (may show 0 issues or info about files)
176
+ - `pnpm format` runs without errors
177
+ - `pnpm check` runs without errors
178
+ </verify>
179
+ <done>
180
+ - biome.json exists with linter and formatter enabled
181
+ - pnpm lint, format, and check commands all work
182
+ </done>
183
+ </task>
184
+
185
+ <task type="auto">
186
+ <name>Task 3: Configure Vitest for testing</name>
187
+ <files>vitest.config.ts</files>
188
+ <action>
189
+ Create vitest.config.ts:
190
+
191
+ ```typescript
192
+ import { defineConfig } from "vitest/config";
193
+
194
+ export default defineConfig({
195
+ test: {
196
+ globals: true,
197
+ environment: "node",
198
+ include: ["src/**/*.test.ts"],
199
+ coverage: {
200
+ provider: "v8",
201
+ reporter: ["text", "json", "html"],
202
+ },
203
+ },
204
+ });
205
+ ```
206
+
207
+ This configures:
208
+ - Global test functions (describe, it, expect without imports)
209
+ - Node environment (not jsdom - avoids compatibility issues)
210
+ - Test files pattern: src/**/*.test.ts
211
+ - V8 coverage provider (native, fast)
212
+
213
+ NOTE: Do NOT add jsdom or browser environment - Phase 1 is server-side only.
214
+ </action>
215
+ <verify>
216
+ - `pnpm test` runs (should pass with "no test files found" or similar - that's OK)
217
+ - `cat vitest.config.ts | grep "defineConfig"` returns match
218
+ </verify>
219
+ <done>
220
+ - vitest.config.ts exists
221
+ - pnpm test executes Vitest (even with no test files)
222
+ </done>
223
+ </task>
224
+
225
+ </tasks>
226
+
227
+ <verification>
228
+ Run full verification of all Phase 1 requirements:
229
+
230
+ ```bash
231
+ # INIT-01: TypeScript with strict and NodeNext
232
+ grep '"strict": true' tsconfig.json && grep '"moduleResolution": "NodeNext"' tsconfig.json
233
+
234
+ # INIT-02: pnpm with lockfile (verified in Plan 01)
235
+ ls pnpm-lock.yaml
236
+
237
+ # INIT-03: All scripts present
238
+ cat package.json | grep -E '"dev"|"build"|"test"|"lint"|"format"'
239
+
240
+ # TOOL-01: Biome linting and formatting
241
+ pnpm lint && pnpm format
242
+
243
+ # TOOL-02: Vitest testing
244
+ pnpm test
245
+
246
+ # Build verification
247
+ pnpm build && ls dist/index.js
248
+ ```
249
+ </verification>
250
+
251
+ <success_criteria>
252
+ 1. `pnpm build` compiles src/index.ts to dist/index.js without errors
253
+ 2. `pnpm lint` runs Biome linter successfully
254
+ 3. `pnpm format` runs Biome formatter successfully
255
+ 4. `pnpm test` runs Vitest (passes even with no test files)
256
+ 5. tsconfig.json has strict: true and moduleResolution: NodeNext
257
+ 6. All Phase 1 requirements (INIT-01, INIT-02, INIT-03, TOOL-01, TOOL-02) satisfied
258
+ </success_criteria>
259
+
260
+ <output>
261
+ After completion, create `.planning/phases/01-foundation/01-02-SUMMARY.md`
262
+ </output>
@@ -0,0 +1,153 @@
1
+ ---
2
+ phase: 01-foundation
3
+ plan: 02
4
+ subsystem: build-tooling
5
+ tags: [typescript, biome, vitest, tsconfig, linting, testing]
6
+
7
+ dependency-graph:
8
+ requires:
9
+ - 01-01 (package.json, dependencies)
10
+ provides:
11
+ - TypeScript compilation with NodeNext
12
+ - Biome linting and formatting
13
+ - Vitest test runner
14
+ - src/index.ts entry point
15
+ - dist/ output directory
16
+ affects:
17
+ - All future TypeScript development
18
+ - 02-01-PLAN.md (CI pipeline uses these commands)
19
+
20
+ tech-stack:
21
+ added: []
22
+ patterns:
23
+ - NodeNext module resolution
24
+ - Strict TypeScript
25
+ - Biome 2.x configuration schema (assist.actions.source.organizeImports)
26
+ - Vitest passWithNoTests for CI compatibility
27
+
28
+ key-files:
29
+ created:
30
+ - tsconfig.json
31
+ - biome.json
32
+ - vitest.config.ts
33
+ - src/index.ts
34
+ modified: []
35
+
36
+ decisions:
37
+ - id: biome-2-organize-imports
38
+ choice: "Use assist.actions.source.organizeImports instead of organizeImports"
39
+ rationale: "Biome 2.x moved organize imports to assist section; old schema key invalid"
40
+ - id: biome-ignore-claude
41
+ choice: "Exclude .claude directory with includes pattern"
42
+ rationale: "Claude Code hooks directory contains external JS files that fail lint"
43
+ - id: vitest-pass-no-tests
44
+ choice: "Enable passWithNoTests option"
45
+ rationale: "Clean CI builds when no test files exist yet"
46
+
47
+ metrics:
48
+ duration: ~3 minutes
49
+ completed: 2026-01-29
50
+ ---
51
+
52
+ # Phase 01 Plan 02: Configure TypeScript, Biome, and Vitest Summary
53
+
54
+ **One-liner:** TypeScript 5.9 with strict/NodeNext, Biome 2.3 linting with double-quote style, Vitest 4 configured for src/**/*.test.ts.
55
+
56
+ ## What Was Done
57
+
58
+ ### Task 1: Configure TypeScript with NodeNext
59
+ - Created tsconfig.json with strict mode and NodeNext module resolution
60
+ - Configured declaration files and source maps
61
+ - Added noUncheckedIndexedAccess, isolatedModules, verbatimModuleSyntax
62
+ - Created src/index.ts placeholder with VERSION export
63
+ - Verified `pnpm build` produces dist/index.js and dist/index.d.ts
64
+ - **Commit:** `0102315`
65
+
66
+ ### Task 2: Configure Biome for linting and formatting
67
+ - Created biome.json with Biome 2.3.11 schema
68
+ - Configured 2-space indentation, 100 character line width, LF endings
69
+ - Enabled recommended lint rules
70
+ - Set JavaScript formatter: double quotes, semicolons, trailing commas
71
+ - Configured organize imports via assist.actions (Biome 2.x schema change)
72
+ - Added .claude directory exclusion pattern
73
+ - **Commit:** `4a573d1`
74
+
75
+ ### Task 3: Configure Vitest for testing
76
+ - Created vitest.config.ts with defineConfig
77
+ - Set globals: true for describe/it/expect without imports
78
+ - Configured node environment (not jsdom - server-side only)
79
+ - Added V8 coverage provider
80
+ - Enabled passWithNoTests for CI compatibility
81
+ - **Commit:** `dfec890`
82
+
83
+ ## Deviations from Plan
84
+
85
+ ### Auto-fixed Issues
86
+
87
+ **1. [Rule 3 - Blocking] Biome 2.x organizeImports schema change**
88
+ - **Found during:** Task 2
89
+ - **Issue:** Plan specified `organizeImports` key which is invalid in Biome 2.x
90
+ - **Fix:** Moved to `assist.actions.source.organizeImports` per Biome 2.x schema
91
+ - **Files modified:** biome.json
92
+ - **Commit:** `4a573d1`
93
+
94
+ **2. [Rule 3 - Blocking] Biome 2.x ignore pattern syntax**
95
+ - **Found during:** Task 2
96
+ - **Issue:** Biome 2.x uses `includes` with negation patterns instead of `ignore`
97
+ - **Fix:** Changed to `"includes": ["**", "!.claude"]` per Biome's self-fix
98
+ - **Files modified:** biome.json
99
+ - **Commit:** `4a573d1`
100
+
101
+ **3. [Rule 3 - Blocking] .claude directory lint failures**
102
+ - **Found during:** Task 2
103
+ - **Issue:** .claude/hooks/kata-statusline.js contains lint errors but is external code
104
+ - **Fix:** Added exclusion pattern to not lint .claude directory
105
+ - **Files modified:** biome.json
106
+ - **Commit:** `4a573d1`
107
+
108
+ ## Verification Results
109
+
110
+ All verification commands passed:
111
+
112
+ | Check | Command | Result |
113
+ |-------|---------|--------|
114
+ | INIT-01 strict | `grep '"strict": true' tsconfig.json` | PASS |
115
+ | INIT-01 NodeNext | `grep '"moduleResolution": "NodeNext"' tsconfig.json` | PASS |
116
+ | INIT-02 lockfile | `ls pnpm-lock.yaml` | PASS |
117
+ | INIT-03 scripts | `grep -E '"dev"\|"build"\|"test"\|"lint"\|"format"' package.json` | PASS |
118
+ | TOOL-01 lint | `pnpm lint` | PASS |
119
+ | TOOL-01 format | `pnpm format` | PASS |
120
+ | TOOL-02 test | `pnpm test` | PASS |
121
+ | Build | `pnpm build && ls dist/index.js` | PASS |
122
+
123
+ ## Success Criteria Status
124
+
125
+ | Criterion | Status |
126
+ |-----------|--------|
127
+ | `pnpm build` compiles without errors | PASS |
128
+ | `pnpm lint` runs Biome linter | PASS |
129
+ | `pnpm format` runs Biome formatter | PASS |
130
+ | `pnpm test` runs Vitest (passes with no tests) | PASS |
131
+ | tsconfig.json has strict: true | PASS |
132
+ | tsconfig.json has moduleResolution: NodeNext | PASS |
133
+ | All Phase 1 requirements satisfied | PASS |
134
+
135
+ ## Next Phase Readiness
136
+
137
+ Phase 1 is now complete. Phase 2 can proceed:
138
+ - All required pnpm scripts work (lint, format, test, build)
139
+ - TypeScript compiles correctly to dist/
140
+ - CI can run `pnpm lint && pnpm test && pnpm build`
141
+
142
+ No blockers for Phase 2: Automation and Deployment.
143
+
144
+ ## Artifacts
145
+
146
+ | Path | Purpose | Lines |
147
+ |------|---------|-------|
148
+ | tsconfig.json | TypeScript compiler configuration | 19 |
149
+ | biome.json | Biome linter and formatter config | 42 |
150
+ | vitest.config.ts | Vitest test runner config | 14 |
151
+ | src/index.ts | Entry point placeholder | 6 |
152
+ | dist/index.js | Compiled JavaScript output | ~10 |
153
+ | dist/index.d.ts | TypeScript declarations | ~3 |