This file provides guidance for agents working in this repository.
granola-toolkit is now a multi-surface TypeScript toolkit for working with Granola meetings.
Current first-class surfaces:
- CLI commands for auth, folders, meetings, notes, transcripts, exports, and attach flows
- a browser workspace via
granola web - a full-screen terminal workspace via
granola tui - a dedicated docs app under
docs/
The current implementation lives in:
index.ts: CLI entrypointsrc/cli.ts: command parsing and command dispatchsrc/app/*: shared application core and shared models/statesrc/client/*: auth/session, transport, and Granola API boundariessrc/commands/*: thin command adapterssrc/server/*: local server, attach client, and browser APIsrc/tui/*:pi-tuiworkspacesrc/web/*: browser markup, styling, and client helperssrc/config.ts: config loading from flags, env, and.granola.tomlsrc/api.ts: Supabase token parsing and Granola API fetchingsrc/cache.ts: local Granola cache parsingsrc/prosemirror.ts: ProseMirror to Markdown/plain text conversionsrc/notes.ts: Markdown note generation and note export writessrc/transcripts.ts: transcript formatting and transcript export writessrc/utils.ts: shared path, filename, HTML fallback, and file-write helpersdocs/*: Fumadocs/Next.js docs app
- Default to the Vite+ workflow.
- Use
vp install,vp check,vp test, andvp packas the primary development loop. - Use
npm run docs:devandnpm run docs:checkfor the docs app. - Run the built CLI with
node dist/cli.js ...or the package scripts inpackage.json. - The release path uses GitHub Actions trusted publishing gated by the
productionenvironment; do not reintroduce long-lived npm token secrets unless there is a concrete need. - Do not add
dotenvunless there is a concrete need; the current CLI reads explicit environment variables only.
Preferred commands:
vp install
vp check
vp test
npm run coverage
vp pack
npm run docs:check
node dist/cli.js --help
node dist/cli.js notes --help
node dist/cli.js transcripts --help
npm pack --dry-run
npm run release:patchConfiguration precedence is:
- command-line flags
- environment variables
.granola.toml- platform defaults
Relevant settings:
- Global:
--config,--debug,--supabase - Notes:
--output,--timeout - Transcripts:
--cache,--output
Relevant environment variables:
DEBUG_MODESUPABASE_FILEOUTPUTTIMEOUTCACHE_FILETRANSCRIPT_OUTPUT
- API endpoint:
https://api.granola.ai/v2/get-documents - Request method:
POST - Request body includes:
limit: 100offsetinclude_last_viewed_panel: true
- Required headers currently include:
Authorization: Bearer <token>User-Agent: Granola/5.354.0X-Client-Version: 5.354.0Content-Type: application/jsonAccept: */*
- Content priority for Markdown export is:
notesProseMirrorlast_viewed_panel.contentProseMirrorlast_viewed_panel.original_contentHTML fallback- raw
content
- Cache data comes from a local Granola JSON file, not the API.
- The cache payload may be double-encoded or already an object.
- Transcript speaker mapping is currently:
microphone->You- everything else ->
System
- Add or update tests for parser changes, conversion changes, and export behaviour changes.
- Prefer fixture-like payload coverage for API/cache shapes when fixing real-data issues.
- Keep unit tests in
test/*.test.tsusingvite-plus/test. - When changing CLI or config behaviour, verify
vp check,vp test,npm run coverage,vp pack, andnpm pack --dry-run. - When changing docs, also verify
npm run docs:check.
- Keep the project runtime and tooling Vite+/Node-first unless there is a strong reason not to.
- Prefer extending the current modular layout over collapsing logic back into
src/cli.ts. - Be careful with live-data compatibility:
- Granola payloads can vary between string-encoded and object-encoded JSON fields
- transcript ordering and note content shapes may differ from synthetic test data
- Preserve incremental export behaviour unless you are intentionally changing it.
- Treat a completed TODO item as a release candidate unless there is a clear reason not to ship it yet.
- Any push to
mainwith a package version that is not already on npm becomes a publish candidate automatically. - The GitHub Actions workflow verifies the build, checks whether
package.jsoncontains an unpublished version, and publishes automatically once the versioned release commit hitsmain. - Preferred release flows are:
- merge a PR that already includes the version bump
- run
npm run release:patch|release:minor|release:majoronmain
When finishing a TODO item:
- run
vp check - run
vp test - run
npm run coverage - run
vp pack - run
npm run docs:check - run
npm pack --dry-run - choose a semver bump: minor for backward-compatible feature or architecture work major for breaking changes patch for release-flow, docs, and non-breaking maintenance work
- bump
package.jsonandpackage-lock.json - publish the release
- update
TODO.mdwith the version that shipped the completed item
Local release helper behaviour:
- verifies the git working tree is clean
- verifies you are on
main - verifies the current npm version is already published
- runs
vp check,vp test,npm run coverage,vp pack,npm run docs:check, andnpm pack --dry-run - bumps the package version with
npm version --no-git-tag-version - commits and pushes the release commit
- lets the push-to-
mainworkflow publish automatically
Release workflow behaviour:
- installs dependencies with Vite+ via
setup-vp - installs docs dependencies in
docs/ - runs
vp check,vp test,npm run coverage,vp pack,npm run docs:check, andnpm pack --dry-run - checks npm first and skips publish if that exact version already exists
- publishes with npm trusted publishing and provenance
- tags the published version as
v<version>
Required external setup:
- create a
productionenvironment in GitHub repository Settings -> Environments - keep the workflow filename as
.github/workflows/ci.yml - in npm package settings for
granola-toolkit, add a GitHub Actions trusted publisher with: ownerkkarimirepositorygranola-toolkitworkflow fileci.ymlenvironmentproduction
Open improvement items are tracked in TODO.md. Check that file before making structural changes so new work lines up with current priorities.