Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/clear-lions-think.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@proofkit/webviewer": patch
---

Document the `proofkit add addon webviewer` command in the WebViewer skill and setup docs.
Document the `proofkit add addon webviewer` command in the Web Viewer skill and setup docs.
2 changes: 1 addition & 1 deletion .changeset/cli-webviewer-scaffold-fm-mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@proofkit/webviewer": patch
---

- cli: Revamp the WebViewer Vite template and harden `proofkit init` (ignore hidden files, improve non-interactive prompts, stop generating Cursor rules).
- cli: Revamp the Web Viewer Vite template and harden `proofkit init` (ignore hidden files, improve non-interactive prompts, stop generating Cursor rules).
- cli: Install typegen skills locally when scaffolding projects.
- typegen: Add optional `fmMcp` config for using an FM MCP proxy during metadata fetching.
- fmdapi/fmodata/webviewer: Add initial Codex skills for client and integration workflows.
2 changes: 1 addition & 1 deletion .changeset/tiny-clouds-wave.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"@proofkit/cli": patch
---

Make scaffolded WebViewer upload scripts use `deploy_html` as the canonical FileMaker script, with bridge-first and FMP URL fallback deployment.
Make scaffolded Web Viewer upload scripts use `deploy_html` as the canonical FileMaker script, with bridge-first and FMP URL fallback deployment.
2 changes: 1 addition & 1 deletion .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ packages/
├── fmdapi/ # FileMaker Data API client (REST)
├── fmodata/ # FileMaker OData API client with Drizzle-like ORM
├── typegen/ # TypeScript type generator from FM layouts (CLI + Web UI)
├── webviewer/ # FileMaker WebViewer utilities
├── webviewer/ # FileMaker Web Viewer utilities
├── cli/ # Interactive CLI for scaffolding projects
├── better-auth/ # Better Auth adapter for FileMaker
├── registry/ # Types and templates registry
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,8 @@ packages/typegen/schema/metadata.xml
# FM ADD-ON BUILD ARTIFACTS
fm-addon/stage/

# Internal planning docs (not for publication)
apps/docs/v2-plans/

# Prevent accidentally committing files with absolute paths
Users/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This monorepo includes the following core packages:

- [`@proofkit/cli`](./packages/cli): Interactive CLI to scaffold and manage TypeScript projects that connect with FileMaker.
- [`@proofkit/fmdapi`](./packages/fmdapi): TypeScript client for the FileMaker Data API. [Docs](https://proofkit.proof.sh/docs/fmdapi)
- [`@proofkit/webviewer`](./packages/webviewer): Utility for interacting with the FileMaker WebViewer. [Docs](https://proofkit.proof.sh/docs/webviewer)
- [`@proofkit/webviewer`](./packages/webviewer): Utility for interacting with the FileMaker Web Viewer. [Docs](https://proofkit.proof.sh/docs/webviewer)
- [`@proofkit/typegen`](./packages/typegen): Generate TypeScript types and validation schemas from FileMaker layouts.
- [`@proofkit/create-proofkit`](./packages/create-proofkit): Alias package for quickly starting new ProofKit projects.

Expand Down
52 changes: 26 additions & 26 deletions _artifacts/domain_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ domains:
slug: 'data-access'
description: 'Querying, creating, updating, and deleting FileMaker records through either API surface'

- name: 'Running in WebViewer'
- name: 'Running in Web Viewer'
slug: 'webviewer'
description: 'Executing JavaScript inside FileMaker WebViewer with script calls and local Data API access'
description: 'Executing JavaScript inside FileMaker Web Viewer with script calls and local Data API access'

- name: 'Authenticating Users'
slug: 'auth'
Expand Down Expand Up @@ -208,20 +208,20 @@ skills:
skills: ['typegen-setup']

- mistake: 'Suggesting OttoFMS/FetchAdapter fallback when FM MCP fails'
mechanism: 'Agent troubleshoots FM MCP connection failure by suggesting standard auth. Developer chose fmMcp because they have no hosted credentials or are working offline. Correct troubleshooting: check daemon health (GET http://127.0.0.1:1365/health), check /connectedFiles, ensure FM file has run "Connect to MCP" script and WebViewer window is open in Browse mode.'
mechanism: 'Agent troubleshoots FM MCP connection failure by suggesting standard auth. Developer chose fmMcp because they have no hosted credentials or are working offline. Correct troubleshooting: check daemon health (GET http://127.0.0.1:1365/health), check /connectedFiles, ensure FM file has run "Connect to MCP" script and Web Viewer window is open in Browse mode.'
source: 'maintainer interview'
priority: HIGH
status: active
skills: ['typegen-setup']

- mistake: 'FM MCP WebViewer window closed or in Layout mode'
mechanism: 'The FM MCP proxy works via a WebViewer window opened by the "Connect to MCP" script in FileMaker. If this window is closed or switched to Layout mode, all proxy requests fail. Error may not be obvious — typegen just fails to connect.'
- mistake: 'FM MCP Web Viewer window closed or in Layout mode'
mechanism: 'The FM MCP proxy works via a Web Viewer window opened by the "Connect to MCP" script in FileMaker. If this window is closed or switched to Layout mode, all proxy requests fail. Error may not be obvious — typegen just fails to connect.'
correct_pattern: |
# Troubleshooting checklist:
# 1. Is the fm-mcp daemon running? GET http://127.0.0.1:1365/health
# 2. Is the file connected? GET http://127.0.0.1:1365/connectedFiles
# 3. If file not listed: open it in FileMaker, run "Connect to MCP" script
# 4. Ensure the WebViewer window stays open in Browse mode (not Layout mode)
# 4. Ensure the Web Viewer window stays open in Browse mode (not Layout mode)
source: 'maintainer interview'
priority: HIGH
status: active
Expand Down Expand Up @@ -514,10 +514,10 @@ skills:
priority: MEDIUM
status: active

- name: 'WebViewer Integration'
- name: 'Web Viewer Integration'
slug: 'webviewer-integration'
domain: 'webviewer'
description: 'Use @proofkit/webviewer to call FileMaker scripts and access Data API from JavaScript running inside a FileMaker WebViewer'
description: 'Use @proofkit/webviewer to call FileMaker scripts and access Data API from JavaScript running inside a FileMaker Web Viewer'
type: core
packages:
- '@proofkit/webviewer'
Expand All @@ -532,17 +532,17 @@ skills:
- 'Browser-only runtime constraint'
tasks:
- 'Call a FileMaker script from JavaScript and get a result back'
- 'Use fmdapi Data API client inside a WebViewer'
- 'Debug WebViewer script communication issues'
- 'Deploy WebViewer code (embedded, hosted, downloaded)'
- 'Use fmdapi Data API client inside a Web Viewer'
- 'Debug Web Viewer script communication issues'
- 'Deploy Web Viewer code (embedded, hosted, downloaded)'
failure_modes:
- mistake: 'Importing @proofkit/webviewer in server-side code'
mechanism: 'The package requires window.FileMaker which only exists inside FM WebViewer. Importing in Node/SSR throws or silently breaks.'
mechanism: 'The package requires window.FileMaker which only exists inside FM Web Viewer. Importing in Node/SSR throws or silently breaks.'
wrong_pattern: |
// In a Next.js API route or server component
import { fmFetch } from "@proofkit/webviewer";
correct_pattern: |
// Only import in client-side code that runs inside FM WebViewer
// Only import in client-side code that runs inside FM Web Viewer
// Use "use client" directive in React, or ensure the code only runs in browser
"use client";
import { fmFetch } from "@proofkit/webviewer";
Expand Down Expand Up @@ -580,25 +580,25 @@ skills:
status: active

- mistake: 'Using executeScript or containerUpload via WebViewerAdapter'
mechanism: 'WebViewerAdapter explicitly throws for executeScript and containerUpload. These are not supported in WebViewer context.'
mechanism: 'WebViewerAdapter explicitly throws for executeScript and containerUpload. These are not supported in Web Viewer context.'
wrong_pattern: |
const client = DataApi({ adapter: new WebViewerAdapter({ scriptName: "DAPI" }), layout: "Contacts" });
await client.executeScript("MyScript"); // throws
correct_pattern: |
// Use callFMScript or fmFetch for script execution in WebViewer
// Use callFMScript or fmFetch for script execution in Web Viewer
import { callFMScript } from "@proofkit/webviewer";
callFMScript("MyScript", { param: "value" });
source: 'source: adapter.ts:133-141'
priority: HIGH
status: active

- mistake: 'Not understanding single-threaded script execution in WebViewer local mode'
mechanism: 'WebViewerAdapter sends queries via FM client script execution which is single-threaded. Rapid concurrent queries (e.g. TanStack Query retries, listAll auto-pagination) cause queuing and beach balls for the user. This is especially problematic when scripts take time to run. Consider server-based OData approach for heavy queries, but note that introduces authentication requirements not normally needed for WebViewer.'
- mistake: 'Not understanding single-threaded script execution in Web Viewer local mode'
mechanism: 'WebViewerAdapter sends queries via FM client script execution which is single-threaded. Rapid concurrent queries (e.g. TanStack Query retries, listAll auto-pagination) cause queuing and beach balls for the user. This is especially problematic when scripts take time to run. Consider server-based OData approach for heavy queries, but note that introduces authentication requirements not normally needed for Web Viewer.'
correct_pattern: |
// Avoid firing many concurrent queries in WebViewer local mode
// Avoid firing many concurrent queries in Web Viewer local mode
// Bad: multiple parallel queries or TanStack Query with aggressive retries
// Good: sequential queries, debounced fetching, or server-based OData for heavy workloads
// If diagnosing slow WebViewer: check if queries are queuing up in FM script engine
// If diagnosing slow Web Viewer: check if queries are queuing up in FM script engine
// Architecture decision: local WebViewerAdapter (simple, no auth, single-threaded)
// vs server OData (fast, concurrent, but requires auth + FM server connection)
source: 'maintainer interview'
Expand Down Expand Up @@ -705,12 +705,12 @@ skills:
- 'First typegen run'
- 'First query with generated client'
- 'Choosing between Data API and OData'
- 'FM MCP mode for local/offline WebViewer development (no credentials needed)'
- 'FM MCP mode for local/offline Web Viewer development (no credentials needed)'
tasks:
- 'Set up a new project with ProofKit'
- 'Connect to FileMaker server for the first time'
- 'Generate types and make first data query'
- 'Set up FM MCP mode for local WebViewer development'
- 'Set up FM MCP mode for local Web Viewer development'
failure_modes:
- mistake: 'Missing fmrest or fmodata privilege on FM account'
mechanism: 'Data API requires fmrest extended privilege. OData requires fmodata privilege. Without these, all API calls return 401/403.'
Expand Down Expand Up @@ -868,10 +868,10 @@ tensions:
description: 'defaultSelect "schema" is performant and safe but only returns fields defined in the TypeScript schema. "all" returns everything but is slower and types are less precise.'
implication: 'An agent might switch to "all" to fix missing data issues without understanding the performance cost, or stick with "schema" without realizing fields are being excluded.'

- name: 'WebViewer local mode vs server-based data access'
- name: 'Web Viewer local mode vs server-based data access'
skills: ['webviewer-integration', 'fmdapi-client', 'fmodata-client']
description: 'WebViewer local mode (WebViewerAdapter) requires no auth and works offline, but uses single-threaded FM script execution — concurrent queries cause beach balls. Server-based OData is fast and concurrent but requires authentication and FM server connectivity. This is a core architecture decision.'
implication: 'An agent might use listAll or TanStack Query with retries in WebViewer local mode, overwhelming the single-threaded FM script engine. Or it might try server patterns inside WebViewer without considering auth requirements.'
description: 'Web Viewer local mode (WebViewerAdapter) requires no auth and works offline, but uses single-threaded FM script execution — concurrent queries cause beach balls. Server-based OData is fast and concurrent but requires authentication and FM server connectivity. This is a core architecture decision.'
implication: 'An agent might use listAll or TanStack Query with retries in Web Viewer local mode, overwhelming the single-threaded FM script engine. Or it might try server patterns inside Web Viewer without considering auth requirements.'

cross_references:
- from: 'typegen-setup'
Expand All @@ -888,7 +888,7 @@ cross_references:
reason: 'Better Auth uses fmodata under the hood. Understanding fmodata connection setup is prerequisite for auth configuration.'
- from: 'webviewer-integration'
to: 'fmdapi-client'
reason: 'WebViewerAdapter implements the fmdapi Adapter interface. Understanding both is needed for Data API access inside WebViewer.'
reason: 'WebViewerAdapter implements the fmdapi Adapter interface. Understanding both is needed for Data API access inside Web Viewer.'
- from: 'getting-started'
to: 'typegen-setup'
reason: 'Getting started flow always involves typegen as the first step after env setup.'
Expand Down Expand Up @@ -923,6 +923,6 @@ gaps:
status: resolved

- skill: 'webviewer-integration'
question: 'What are the most common deployment pitfalls for WebViewer apps?'
question: 'What are the most common deployment pitfalls for Web Viewer apps?'
context: 'Partially resolved: single-threaded script execution bottleneck added. Deployment method tradeoffs covered in docs.'
status: open
12 changes: 6 additions & 6 deletions _artifacts/skill_spec.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# ProofKit — Skill Spec

ProofKit is a monorepo of TypeScript tools for building web applications integrated with Claris FileMaker. It provides API clients for FileMaker's Data API and OData API, a type generator that produces TypeScript types and runtime validators from FileMaker schemas, a WebViewer bridge for running JS inside FileMaker, and a Better Auth adapter for self-hosted authentication backed by FileMaker.
ProofKit is a monorepo of TypeScript tools for building web applications integrated with Claris FileMaker. It provides API clients for FileMaker's Data API and OData API, a type generator that produces TypeScript types and runtime validators from FileMaker schemas, a Web Viewer bridge for running JS inside FileMaker, and a Better Auth adapter for self-hosted authentication backed by FileMaker.

## Domains

| Domain | Description | Skills |
| --- | --- | --- |
| Connecting to FileMaker | Setting up typed connections via Data API or OData, including auth, adapters, and type generation | typegen-setup, getting-started |
| Reading and Writing Data | Querying, creating, updating, and deleting FileMaker records through either API surface | fmdapi-client, fmodata-client, odata-query-optimization |
| Running in WebViewer | Executing JavaScript inside FileMaker WebViewer with script calls and local Data API access | webviewer-integration |
| Running in Web Viewer | Executing JavaScript inside FileMaker Web Viewer with script calls and local Data API access | webviewer-integration |
| Authenticating Users | Self-hosted authentication using Better Auth with FileMaker as the database backend | better-auth-setup |

## Skill Inventory
Expand Down Expand Up @@ -39,7 +39,7 @@ ProofKit is a monorepo of TypeScript tools for building web applications integra
| 8 | Using FmMcpAdapter in production application code | CRITICAL | source | — |
| 9 | Setting standard FM env vars when using fmMcp mode | HIGH | source | — |
| 10 | Suggesting OttoFMS/FetchAdapter fallback when FM MCP fails | HIGH | maintainer | — |
| 11 | FM MCP WebViewer window closed or in Layout mode | HIGH | maintainer | — |
| 11 | FM MCP Web Viewer window closed or in Layout mode | HIGH | maintainer | — |

### fmdapi-client (6 failure modes)

Expand Down Expand Up @@ -74,7 +74,7 @@ ProofKit is a monorepo of TypeScript tools for building web applications integra
| 3 | Calling FM scripts before window.FileMaker is available | HIGH | docs | — |
| 4 | Using executeScript or containerUpload via WebViewerAdapter | HIGH | source | fmdapi-client |
| 5 | Accessing window.FileMaker directly instead of library functions | CRITICAL | maintainer | — |
| 6 | Not understanding single-threaded script execution in WebViewer local mode | HIGH | maintainer | fmodata-client |
| 6 | Not understanding single-threaded script execution in Web Viewer local mode | HIGH | maintainer | fmodata-client |

### better-auth-setup (4 failure modes)

Expand Down Expand Up @@ -110,7 +110,7 @@ ProofKit is a monorepo of TypeScript tools for building web applications integra
| --- | --- | --- |
| Type safety vs rapid prototyping | typegen-setup ↔ fmdapi-client ↔ fmodata-client | Agent might skip typegen to move fast, losing validation and creating schema drift |
| defaultSelect schema safety vs completeness | fmodata-client ↔ odata-query-optimization | Agent switches to "all" to fix missing data without understanding performance cost |
| WebViewer local mode vs server-based data access | webviewer-integration ↔ fmdapi-client ↔ fmodata-client | Agent uses listAll or TanStack Query retries in WebViewer local mode, overwhelming single-threaded FM script engine |
| Web Viewer local mode vs server-based data access | webviewer-integration ↔ fmdapi-client ↔ fmodata-client | Agent uses listAll or TanStack Query retries in Web Viewer local mode, overwhelming single-threaded FM script engine |

## Cross-References

Expand Down Expand Up @@ -141,7 +141,7 @@ ProofKit is a monorepo of TypeScript tools for building web applications integra
| Skill | Question | Status |
| --- | --- | --- |
| getting-started | Recommended path for new-to-JS developers vs experienced developers? | open |
| webviewer-integration | Most common deployment pitfalls for WebViewer apps? | open |
| webviewer-integration | Most common deployment pitfalls for Web Viewer apps? | open |

## Recommended Skill File Structure

Expand Down
6 changes: 3 additions & 3 deletions _artifacts/skill_tree.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ skills:
ENTRY POINT for @proofkit/fmdapi projects. Generate TypeScript types and
Zod validators from FileMaker layouts using @proofkit/typegen. Covers
proofkit-typegen-config.jsonc for Data API mode, npx setup, OttoAdapter
and FetchAdapter env vars, FM MCP mode for local WebViewer development,
and FetchAdapter env vars, FM MCP mode for local Web Viewer development,
generated vs override file structure, Standard Schema validation, and
InferZodPortals.
requires: []
Expand Down Expand Up @@ -117,15 +117,15 @@ skills:
- 'references/filter-operators.md'
- 'references/error-types.md'

- name: 'WebViewer Integration'
- name: 'Web Viewer Integration'
slug: 'webviewer-integration'
type: 'core'
domain: 'webviewer'
path: 'skills/webviewer-integration/SKILL.md'
package: 'packages/webviewer'
description: >
Use @proofkit/webviewer to call FileMaker scripts and access the Data API
from JavaScript running inside a FileMaker WebViewer. Covers fmFetch()
from JavaScript running inside a FileMaker Web Viewer. Covers fmFetch()
(call FM script and await result via callback), callFMScript() (fire-and-forget),
WebViewerAdapter for @proofkit/fmdapi integration, globalSettings.setWebViewerName(),
browser-only runtime constraints, and single-threaded FM script execution
Expand Down
4 changes: 3 additions & 1 deletion apps/docs/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"hooks": "@/hooks"
},
"registries": {
"@reui": "https://reui.io/r/{name}.json"
"@reui": "https://reui.io/r/{name}.json",
"@react-bits": "https://reactbits.dev/r/{name}.json",
"@svgl": "https://svgl.app/r/{name}.json"
}
}
Loading
Loading