You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+12-23Lines changed: 12 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,14 +82,12 @@ HtmlService can only serve `.html` files — all JavaScript and CSS must be inli
82
82
4. Emits `dist/Sidebar.html` as an asset
83
83
5. Deletes the intermediate `.js` chunk so clasp never pushes it as a `.gs` file
84
84
85
-
The `src/Sidebar.html` template is also read at test time by `__tests__/helpers/sidebar-fixtures.ts` to keep DOM fixtures structurally in sync with the real template.
└── job-indicator.ts (JobIndicator — renders active/failed jobs to #job-strip; persists across navigation)
132
136
└── src/shared/types.ts
133
137
134
138
src/client/google.d.ts (compile-time type stub for google.script.run — uses declare global{} pattern)
@@ -194,13 +198,6 @@ beforeEach(() => {
194
198
// Then invoke capturedSuccess(...) / capturedFailure(...) to simulate GAS callbacks.
195
199
```
196
200
197
-
**Shared DOM fixtures:**`__tests__/helpers/sidebar-fixtures.ts` exports:
198
-
-`FULL_SIDEBAR_HTML` — the sidebar HTML template read from `src/Sidebar.html` at test time (placeholders stripped), so tests stay structurally in sync with the real template without manual drift.
199
-
-`setupConfigPanel(headers?)` — sets `document.body.innerHTML` and populates all tag containers.
200
-
-`setupWithSelections(opts)` — calls `setupConfigPanel` then pre-selects values via `applyPreset`.
201
-
202
-
The `__tests__/helpers/` directory is excluded from test discovery via `testPathIgnorePatterns` in `jest.config.cjs`.
203
-
204
201
**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`.
205
202
206
203
Two files are excluded from coverage collection entirely:
@@ -213,15 +210,7 @@ See `docs/plans/2026-02-18-testing-coverage-design.md` for full rationale.
213
210
214
211
### Tool 4 — Spreadsheet Column Requirements
215
212
216
-
`runBatchAI` maps column headers by name. The active sheet must contain these exact headers (case-sensitive):
217
-
218
-
| Config key | Column header |
219
-
| --- | --- |
220
-
|`SOURCE_DRIVE`|`source_drive`|
221
-
|`SOURCE_TEXT`|`source_text`|
222
-
|`SYS_PROMPT`|`system_prompt`|
223
-
|`USER_PROMPT`|`user_prompt`|
224
-
|`OUTPUT`|`ai_inference`|
213
+
`runBatchAI` maps column headers by name via `RunConfig` (user-selected in the sidebar — no hardcoded column names). The user selects which columns serve as user prompt inputs, drive file inputs, system prompt, and output. `runBatchAI` calls `resolveColumns` to locate them by header string and `findOrCreateColumn` to create the output column if absent.
225
214
226
215
The Gemini API key must be set as a Script Property (`GEMINI_API_KEY`) in Apps Script > Project Settings > Script Properties before Tool 4 will run.
Feature work happens on branches, merged to `develop` via PR. When ready to ship, `develop` is merged to `main` via a PR containing manual QA instructions — that merge is the release gate.
11
+
12
+
## Adding Features
13
+
14
+
### Adding a new Gemini tool
15
+
16
+
See [Tool System](docs/architecture.md#tool-system) in the architecture docs — it's a three-file change.
17
+
18
+
### Adding a recipe
19
+
20
+
Recipes are defined in `src/client/recipes.ts` as entries in the `RECIPES` array. Each `RecipeDefinition` describes the recipe's display metadata, the form fields shown during prep, and how those fields map to a `RunConfig` passed to Run AI. Adding a recipe is entirely client-side and requires no server changes — it's one of the most accessible contributions to make.
21
+
22
+
### Exposing a new server function
23
+
24
+
See [Build Pipeline](docs/architecture.md#build-pipeline) in the architecture docs — you must both export from `index.ts` and add a footer stub in `rollup.config.js`. If the function is callable from the client, also update `src/client/google.d.ts`.
25
+
26
+
## Testing
27
+
28
+
Tests live in `__tests__/`. Run them with:
29
+
30
+
```bash
31
+
npm test# all tests
32
+
npm run test:watch # watch mode
33
+
npm run test:coverage # with per-file coverage thresholds
34
+
```
35
+
36
+
### Mocking GAS globals
37
+
38
+
Apps Script globals (`UrlFetchApp`, `DriveApp`, `SpreadsheetApp`, etc.) must be set on `globalThis`**before** importing the module under test, because imports execute immediately:
0 commit comments