Skip to content

Commit 73b33f8

Browse files
aaronbrezelclaude
andcommitted
docs: update CLAUDE.md to reflect PR #26/#27 changes
- Client module graph: add types.ts, recipes.ts, expand panels and components lists with all new files from the panel-router and recipe-panels PRs - server/utils.ts: add findOrCreateColumn and writeColumn to description - TypeScript Configuration: add jest.config.cjs single-tsconfig note explaining the ts-jest ConfigSet caching bug workaround - Coverage section: fix stale sidebar-entry.ts description (old exported functions no longer exist; file is now fully excluded from collection) - Remove stale reference to sidebar-entry-testing-design.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b36772b commit 73b33f8

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

CLAUDE.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,29 @@ src/server/index.ts (entry point — menu, 4 tool orchestrators, UI han
8888
├── src/server/api.ts (callGeminiAPI, buildGeminiPayload — pure HTTP adapter via UrlFetchApp)
8989
├── src/server/drive.ts (extractTextUniversal, fetchAndEncodeFile, checkDriveService)
9090
├── src/server/dialog.ts (HTML_TEMPLATE string for AI mode selection modal)
91-
├── src/server/utils.ts (extractId, isValidDriveLink, createSeededRandom, getAllFilesRecursive, sampleRows, truncateText)
91+
├── src/server/utils.ts (extractId, isValidDriveLink, createSeededRandom, getAllFilesRecursive, sampleRows, truncateText, findOrCreateColumn, writeColumn)
9292
├── src/server/customFunctions.ts (SSI — Sheets custom function; TOOL_REGISTRY for named tool declarations)
9393
└── src/shared/types.ts (shared interfaces: AppConfig, AIMode, ColumnMap, GeminiRequest, etc.)
9494
```
9595

9696
**Client:**
9797
```
98-
src/client/sidebar-entry.ts (thin init — creates Router, registers panels, calls router.start())
98+
src/client/sidebar-entry.ts (thin init — instantiates all panels, creates Router, calls router.start("tool-list"))
9999
└── src/client/router.ts (Router class — push/pop navigation stack)
100100
└── src/client/services.ts (GAS boundary — wraps google.script.run as Promises, header cache)
101-
└── src/client/panels/ (panel classes — mount/unmount lifecycle)
102-
└── src/client/components/ (reusable UI components — TagList, SingleTagList, RowRange, LockableField)
101+
└── src/client/types.ts (PanelId, Panel<P,S>, NavigationContext, RecipeDefinition interfaces)
102+
└── src/client/recipes.ts (RECIPES registry — RecipeDefinition[] for all standard recipes)
103+
└── src/client/panels/
104+
│ ├── tool-list.ts (ToolListPanel — entry screen, dispatches to tool or recipes)
105+
│ ├── configure-ai-run.ts (ConfigureAIRunPanel — column mapping, row range, AI run)
106+
│ ├── recipes-list.ts (RecipesListPanel — browsable list of recipes)
107+
│ └── recipe.ts (RecipePanel — generic panel driven by RecipeParams; prep → cook flow)
108+
└── src/client/components/ (reusable UI components)
109+
├── tag-list.ts (TagList — multi-select tag chips)
110+
├── single-tag-list.ts (SingleTagList — exclusive-select tag chips)
111+
├── row-range.ts (RowRange — start/end row inputs)
112+
├── lockable-field.ts (LockableField — value + lock/unlock toggle; optional onUnlock callback)
113+
└── recipe-prep-cook.ts (RecipePrepCook — 4-state machine: idle/prepping/prep-complete/cooking)
103114
└── src/shared/types.ts
104115
105116
src/client/google.d.ts (compile-time type stub for google.script.run — uses declare global{} pattern)
@@ -116,10 +127,12 @@ Only `index.ts` should reference Google Apps Script UI services (SpreadsheetApp,
116127
Two tsconfigs for two build environments:
117128

118129
- **`tsconfig.json`** — server build. Targets ES2019, no DOM lib, excludes `src/client/`.
119-
- **`tsconfig.client.json`** — client build and client tests. Extends base, adds `"lib": ["ES2019", "DOM"]`, sets `rootDir: "."` (covers both `src/` and `__tests__/`). Includes precise file patterns: `src/client/**/*.ts`, `src/shared/**/*.ts`, and the three client-side test files.
130+
- **`tsconfig.client.json`** — client build and client tests. Extends base, adds `"lib": ["ES2019", "DOM"]`, sets `rootDir: "."` (covers both `src/` and `__tests__/`). Includes precise file patterns: `src/client/**/*.ts`, `src/shared/**/*.ts`, and the client-side test files.
120131

121132
`npm run typecheck` runs both: `tsc --noEmit && tsc -p tsconfig.client.json --noEmit`.
122133

134+
**Jest transform:** `jest.config.cjs` uses a single transform rule — `tsconfig.client.json` for all `.ts` files. This avoids a ts-jest static `_cachedConfigSets` bug where multiple transformer instances sharing one Jest worker (common on CI with few CPUs) would reuse the first-cached ConfigSet regardless of per-transform tsconfig options, causing client files to compile without DOM types. Server code compiles cleanly under `tsconfig.client.json` since it never references DOM globals.
135+
123136
**Note on types:** `tsconfig.client.json` uses `"types": ["google-apps-script", "jest"]` — do **not** add `"node"` here, as it causes `MimeType` collisions with the google-apps-script types. When a file needs Node.js types (e.g. `readFileSync`), use a triple-slash directive at the top of that file: `/// <reference types="node" />`.
124137

125138
### Testing
@@ -155,11 +168,11 @@ The `__tests__/helpers/` directory is excluded from test discovery via `testPath
155168

156169
**Coverage:** Run `npm run test:coverage` to collect coverage and enforce per-file thresholds. Coverage is opt-in — the pre-commit hook runs `jest --bail` without `--coverage`.
157170

158-
Two boundary files are excluded from high thresholds:
159-
- `src/server/index.ts`excluded from coverage collection entirely. The four tool orchestrators are deeply coupled to SpreadsheetApp UI globals and are not unit-tested.
160-
- `src/client/sidebar-entry.ts`included in collection with lower per-file thresholds. The four exported functions (`showAIPanel`, `hideAIPanel`, `dispatchTool`, `runAI`) are fully tested. `init()` and its inner `addEventListener` arrow functions run at module load time before `beforeEach` sets up the DOM, so they are never invoked.
171+
Two files are excluded from coverage collection entirely:
172+
- `src/server/index.ts`the four tool orchestrators are deeply coupled to SpreadsheetApp UI globals and are not unit-tested.
173+
- `src/client/sidebar-entry.ts`contains only `init()`, which is called immediately at module load time (before `beforeEach` can set up the DOM) and has no exports to test in isolation.
161174

162-
See `docs/plans/2026-02-18-testing-coverage-design.md` and `docs/plans/2026-02-24-sidebar-entry-testing-design.md` for full rationale.
175+
See `docs/plans/2026-02-18-testing-coverage-design.md` for full rationale.
163176

164177
**CI:** `.github/workflows/lint-typecheck-format-test.yml` runs on push to `main` and PRs targeting `main`: lint → typecheck → format check → test with coverage.
165178

0 commit comments

Comments
 (0)