Skip to content

Commit e6889d0

Browse files
committed
update fmodata skill
1 parent 6d0ac63 commit e6889d0

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

.changeset/quick-lions-pull.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@proofkit/fmodata": patch
3+
"@proofkit/fmdapi": patch
4+
"@proofkit/typegen": patch
5+
"@proofkit/webviewer": patch
6+
---
7+
8+
Update skill content

packages/fmodata/skills/typegen-fmodata/SKILL.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ sources:
2828
## Prerequisites
2929

3030
- **FileMaker Server 22.0.4+** accessible via port 443
31-
- **OttoFMS 4.11+** installed on the FM server (optional, only for API key auth)
31+
- **OttoFMS 4.11+** installed on the FM server (only required for API key auth)
3232
- **FileMaker account** with the `fmodata` extended privilege enabled
3333
- **OData API enabled** on the FileMaker server
3434

@@ -47,9 +47,9 @@ npm add @proofkit/fmodata
4747
FM_SERVER=https://your-server.com # must start with https://
4848
FM_DATABASE=MyFile.fmp12 # must end with .fmp12
4949

50-
# API key auth (OttoFMS 4.11+, recommended)
50+
# Option A: API key auth (requires OttoFMS 4.11+)
5151
OTTO_API_KEY=dk_123456...789
52-
# OR username/password
52+
# Option B: username/password auth
5353
FM_USERNAME=admin
5454
FM_PASSWORD=password
5555
```
@@ -68,7 +68,6 @@ This creates `proofkit-typegen-config.jsonc`. Configure for OData mode:
6868
"config": {
6969
"type": "fmodata",
7070
"path": "schema/odata",
71-
"reduceMetadata": true,
7271
"tables": [
7372
{
7473
"tableName": "Customers",
@@ -95,6 +94,7 @@ Add a convenience script to `package.json`:
9594
{
9695
"scripts": {
9796
"typegen": "npx @proofkit/typegen@beta"
97+
"typegen:ui": "npm run tyepgen ui"
9898
}
9999
}
100100
```
@@ -252,24 +252,33 @@ The `config` key can be an array mixing `fmdapi` and `fmodata` entries, each wit
252252

253253
## Common Mistakes
254254

255-
### CRITICAL: Manually adding fields or inventing entity IDs
255+
### CRITICAL: Inventing entity IDs or guessing field names
256256

257257
Wrong:
258258
```ts
259-
// Agent adds a field it thinks exists in FileMaker
259+
// Agent adds a field with a guessed entity ID
260260
const contacts = fmTableOccurrence("contacts", {
261261
...existingFields,
262262
newField: textField().entityId("FMFID:99"), // guessed ID — will silently fail
263263
});
264264
```
265265

266-
Correct:
266+
Entity IDs (`FMFID`/`FMTID`) are opaque and MUST come from FileMaker metadata via typegen. Guessed entity IDs cause silent query failures — wrong data or empty results with no error.
267+
268+
To add new fields, use the fmodata CLI to discover real field names programmatically, then add them to the `tables[].fields` array in `proofkit-typegen-config.jsonc`, and re-run typegen to generate the correct definitions with entity IDs:
269+
267270
```bash
268-
# Re-run typegen to pick up new fields from FileMaker
271+
# 1. Discover available fields via the CLI
272+
npx @proofkit/fmodata@beta metadata fields --table <TableName>
273+
# Add --details for field types, nullability, etc.
274+
275+
# 2. Edit proofkit-typegen-config.jsonc to include the new field(s)
276+
277+
# 3. Re-run typegen to regenerate schemas with correct entity IDs
269278
npx @proofkit/typegen@beta
270279
```
271280

272-
Field definitions and entity IDs (`FMFID`/`FMTID`) must come from FileMaker metadata via typegen. Guessed entity IDs cause silent query failures — wrong data or empty results with no error.
281+
Never manually edit entity IDs or field definitions in generated files — always re-run typegen after config changes.
273282

274283
Source: packages/typegen/src/fmodata/typegen.ts
275284

@@ -346,19 +355,20 @@ Without `"type": "fmodata"`, the config defaults to `"fmdapi"` and expects a `la
346355

347356
Source: packages/typegen/src/types.ts:238-243
348357

349-
### HIGH: Not running typegen after FileMaker schema changes
358+
### HIGH: Not running typegen after FileMaker schema changes or config edits
350359

351360
Wrong:
352361
```ts
353362
// Manually editing a generated file to add a new field
363+
// OR editing proofkit-typegen-config.jsonc without re-running typegen
354364
```
355365

356366
Correct:
357367
```bash
358368
npx @proofkit/typegen@beta
359369
```
360370

361-
After changing table schemas in FileMaker, re-run typegen to regenerate types. The generated schemas are the source of truth for field names, types, and entity IDs.
371+
After changing table schemas in FileMaker or editing `proofkit-typegen-config.jsonc`, re-run typegen to regenerate types. The generated schemas are the source of truth for field names, types, and entity IDs.
362372

363373
Source: packages/typegen/src/fmodata/typegen.ts
364374

0 commit comments

Comments
 (0)