Skip to content

Migrate to extension-sdk v2 + polish#1

Open
0xdeafcafe wants to merge 1 commit into
masterfrom
feat/sdk-v2
Open

Migrate to extension-sdk v2 + polish#1
0xdeafcafe wants to merge 1 commit into
masterfrom
feat/sdk-v2

Conversation

@0xdeafcafe

Copy link
Copy Markdown
Member

Companion to the Realtime-values v2 redesign in getbeak/beak#673. Brings the template up to the v2 SDK and modernises the tooling so anyone forking from it gets a working, current scaffold.

What this changes

  • @getbeak/types-variables@getbeak/extension-sdk. Single-variable default export replaced with defineExtension({ variables: [defineVariable(...)] }) — one package can contribute many variables, and the template now shows that shape.
  • getValueresolve returning { kind: 'text', text }. The example variable still computes square roots; the body is just a couple of lines.
  • beakApiextCtxextCtx.parseValueSections replaces the old global.
  • Inline JSDoc at the top of src/index.ts walks new authors through every relevant piece — id, the ResolvedValue shape, extCtx, ctx, the sink-coercion model, and the editor block. The file alone is enough to copy and modify.

Polish

  • package.json gains a description, keywords, repository, build / lint / format / check scripts, and a beak.apiVersion: 2 manifest.
  • tsconfig strictened (noUnusedLocals, isolatedModules, noEmit, moduleResolution: Bundler).
  • esbuild: target=es2022, platform=neutral, format=cjs, no --minify.
  • Biome config matching Beak's house style.
  • README rewritten with quickstart, the v2 contract in one sentence, sandbox model, and links to the SDK migration guide + sibling lorem-swiftsum extension.
  • GitHub Actions CI on every push/PR.
  • .editorconfig, tidier .gitignore, yarn.lock removed (pnpm by default; yarn/npm still work).

Test plan

  • CI on this PR turns green.
  • pnpm install && pnpm build produces dist/index.js from the example.
  • A fresh fork has a working scaffold without any further setup.
  • Inline JSDoc surfaces the right pointers for someone replacing the example variable.

Beak's realtime-values system jumped to apiVersion 2 — single `resolve`
returning a typed `ResolvedValue`, no more `getValue` + parallel
`getAssetRef`. This template now declares `apiVersion: 2`, uses
`defineExtension` + `defineVariable`, and shows the new contract.

What changed:

- Imports `@getbeak/extension-sdk` instead of the deprecated
  `@getbeak/types-variables`.
- Single-variable default export replaced with
  `defineExtension({ variables: [...] })` — one package can contribute
  multiple variables, and we want the template to show that shape.
- `getValue(ctx, payload, depth)` → `resolve(extCtx, ctx, payload)`
  returning `{ kind: 'text', text }`. `extCtx.parseValueSections`
  replaces the old `beakApi` global.
- Inline JSDoc walks the reader through every relevant piece of the
  contract — `id`, `resolve`'s ResolvedValue shape, `extCtx`, `ctx`,
  the sink-coercion model, and the editor block — so this file alone
  is enough to copy and modify.

Polish:

- package.json gains a description, keywords, repository, scripts
  (typecheck, lint, format, check), and a `beak.apiVersion: 2`
  manifest field.
- Major bump to 2.0.0 (template's own version, distinct from the
  apiVersion).
- tsconfig.json strictened: `noUnusedLocals`, `noImplicitAny`,
  `isolatedModules`, `noEmit`, `moduleResolution: Bundler`.
- esbuild: target=es2022, platform=neutral (the isolate isn't Node),
  format=cjs, no more `--minify` (debugging in the sandbox is easier
  with readable source).
- Biome config matching the Beak monorepo's house style.
- README rewritten to walk a new author through (a) the quickstart, (b)
  the v2 contract in one sentence, (c) the sandbox model. Links the
  SDK migration guide and the sibling lorem-swiftsum extension.
- GitHub Actions CI runs lint + typecheck + build on every push/PR.
- .editorconfig + tidier .gitignore.
- yarn.lock removed; pnpm is the new default but the build works under
  yarn / npm too.
Copilot AI review requested due to automatic review settings June 8, 2026 14:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Beak variable extension template to the v2 @getbeak/extension-sdk API and refreshes the repo tooling (TypeScript, Biome, esbuild, CI) so forks start from a modern scaffold.

Changes:

  • Migrate the example variable implementation to defineExtension({ variables: [...] }) and the v2 resolve(extCtx, ctx, payload) contract.
  • Modernize developer tooling (Biome config, stricter TS config, updated build scripts).
  • Add GitHub Actions CI and refresh template documentation.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
yarn.lock Removes Yarn v1 lockfile from the template.
tsconfig.json Tightens TS compiler options and switches to ESNext + Bundler resolution.
src/index.ts Rewrites the example variable to the v2 extension-sdk API and adds inline JSDoc guidance.
README.md Replaces README with v2-focused quickstart and contract overview.
package.json Updates metadata, adds scripts, switches dev deps to v2 extension-sdk + Biome.
biome.json Adds Biome configuration aligned to the intended formatting/lint rules.
.gitignore Expands ignores for Yarn/PNP-related artifacts and adds lockfile commentary.
.github/workflows/ci.yml Adds CI workflow for lint/typecheck/build.
.editorconfig Adds editor settings for indentation/line endings across file types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml

on:
push:
branches: [master]
Comment thread .github/workflows/ci.yml
node-version: 22
cache: pnpm

- run: pnpm install --frozen-lockfile
Comment thread package.json
"dist"
],
"scripts": {
"build": "pnpm clean && pnpm typecheck && esbuild src/index.ts --outfile=dist/index.js --bundle --target=es2022 --format=cjs --platform=neutral --main-fields=main",
Comment thread package.json
],
"scripts": {
"build": "pnpm clean && pnpm typecheck && esbuild src/index.ts --outfile=dist/index.js --bundle --target=es2022 --format=cjs --platform=neutral --main-fields=main",
"clean": "rm -rf dist",
Comment thread .editorconfig
insert_final_newline = true
trim_trailing_whitespace = true

[*.{json,yml,yaml,md}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants