Skip to content

Add ProofKit token passthrough to typegen#270

Merged
eluce2 merged 1 commit into
mainfrom
codex/add-proofkit-token-passthrough
May 18, 2026
Merged

Add ProofKit token passthrough to typegen#270
eluce2 merged 1 commit into
mainfrom
codex/add-proofkit-token-passthrough

Conversation

@eluce2
Copy link
Copy Markdown
Collaborator

@eluce2 eluce2 commented May 18, 2026

Summary

  • Add --proofkit-token to the typegen CLI and thread it through runtime codegen
  • Honor FM_MCP_SESSION_ID as a fallback token source
  • Send X-ProofKit-Session on FM MCP metadata requests when a token is present
  • Keep token out of generated config and generated output
  • Add coverage for env fallback, flag precedence, header emission, and token redaction

Testing

  • pnpm --filter @proofkit/typegen test -- tests/typegen.test.ts
  • pnpm --filter @proofkit/typegen typecheck
  • pnpm run ci

Summary by CodeRabbit

  • New Features

    • CLI now includes a --proofkit-token argument to pass ProofKit tokens during code generation.
  • Tests

    • Added test coverage for ProofKit token handling in code generation workflows.
  • Style

    • Reformatted logging output in server route handler.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
proofkit-docs Ready Ready Preview, Comment May 18, 2026 2:30pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

🦋 Changeset detected

Latest commit: 8f78104

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@proofkit/typegen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 18, 2026

Open in StackBlitz

@proofkit/better-auth

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/better-auth@270

@proofkit/cli

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/cli@270

create-proofkit

pnpm add https://pkg.pr.new/proofsh/proofkit/create-proofkit@270

@proofkit/fmdapi

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/fmdapi@270

@proofkit/fmodata

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/fmodata@270

@proofkit/typegen

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/typegen@270

@proofkit/webviewer

pnpm add https://pkg.pr.new/proofsh/proofkit/@proofkit/webviewer@270

commit: 8f78104

@eluce2 eluce2 marked this pull request as ready for review May 18, 2026 15:13
@eluce2 eluce2 merged commit d398c35 into main May 18, 2026
19 of 20 checks passed
@eluce2 eluce2 deleted the codex/add-proofkit-token-passthrough branch May 18, 2026 15:13
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 913f7612-8668-4d68-94a4-4bd024982ce6

📥 Commits

Reviewing files that changed from the base of the PR and between 72f393f and 8f78104.

📒 Files selected for processing (5)
  • .changeset/typegen-proofkit-token.md
  • packages/typegen/src/cli.ts
  • packages/typegen/src/server/app.ts
  • packages/typegen/src/typegen.ts
  • packages/typegen/tests/typegen.test.ts

📝 Walkthrough

Walkthrough

This PR adds transient ProofKit token passthrough support to the typegen CLI. Users can now provide a token via --proofkit-token that flows through typegen's core generation logic into FM MCP request headers and session ID computation, with precedence over environment variables.

Changes

ProofKit Token Passthrough Support

Layer / File(s) Summary
CLI token option and wiring
packages/typegen/src/cli.ts, .changeset/typegen-proofkit-token.md
ConfigArgs and runCodegen signature accept optional proofkitToken; generate command adds --proofkit-token <token> option and threads it through to generateTypedClients. Release notes document the new transient token passthrough feature.
Typegen token threading and FM MCP integration
packages/typegen/src/typegen.ts
generateTypedClients and generateTypedClientsSingle accept proofkitToken in options. Token is resolved from option or FM_MCP_SESSION_ID environment variable and used to set X-ProofKit-Session header in the connectedFiles auto-discovery request. Token source is prioritized in getFmMcpSessionId computation.
Token passthrough test coverage
packages/typegen/tests/typegen.test.ts
Test lifecycle now preserves and restores FM_MCP_SESSION_ID environment variable. New tests verify that FM_MCP_SESSION_ID is passed via X-ProofKit-Session header without embedding the token in generated client code, and that proofkitToken option takes precedence when both are provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • proofsh/proofkit#267: Modifies FM MCP session/token handling in @proofkit/typegen, directly overlapping with this PR's token passthrough and session ID precedence logic.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/add-proofkit-token-passthrough

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant