Skip to content

feat(fmodata): add fmodata CLI binary#136

Merged
eluce2 merged 2 commits intomainfrom
feat/fmodata-cli-v2
Mar 14, 2026
Merged

feat(fmodata): add fmodata CLI binary#136
eluce2 merged 2 commits intomainfrom
feat/fmodata-cli-v2

Conversation

@eluce2
Copy link
Copy Markdown
Collaborator

@eluce2 eluce2 commented Mar 14, 2026

feat(fmodata): add fmodata CLI binary

Adds a non-interactive CLI (fmodata) to the @proofkit/fmodata package,
making every OData operation available from the shell for use in scripts,
CI pipelines, and one-off database tasks.

  • New fmodata binary entry in package.json → dist/cli/index.js

  • tsdown.config.ts for bundling the CLI separately from the library

  • Build script updated: tsc && vite build && tsdown && publint --strict

  • query list/insert/update/delete — CRUD via raw OData requests with
    --top, --skip, --select, --where, --order-by options

  • script run <name> — execute FileMaker scripts with optional --param

  • webhook list/get/add/remove — full webhook lifecycle management

  • metadata get/tables — retrieve OData metadata (JSON or XML)

  • schema list-tables/create-table/add-fields — DDL operations with a
    --confirm flag; without it the command is a safe dry-run

  • All commands accept --server, --database, --username, --password,
    --api-key flags with automatic env var fallbacks
    (FM_SERVER, FM_DATABASE, FM_USERNAME, FM_PASSWORD, OTTO_API_KEY)

  • API key takes precedence over username/password when both are set

  • JSON by default; --table flag renders results as ASCII table via cli-table3

  • Errors go to stderr; non-zero exit code on failure

  • tests/cli/unit/ — connection env-var resolution and output formatting

  • tests/cli/commands/ — per-command happy-path and error tests

  • tests/cli/integration/ — verifies built binary and --help output

  • tests/cli/e2e/ excluded from default runs; run with test:cli:e2e

  • New apps/docs/content/docs/fmodata/cli.mdx with full command reference,
    connection options table, CI integration examples, and dry-run guidance

  • Added to fmodata nav under a new ---CLI--- section

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

refactor(fmodata/cli): rename --table→--pretty, --table-name→--table

  • Global output flag renamed from --table to --pretty to avoid ambiguity
  • Table name option on query/webhook/schema commands simplified from
    --table-name back to --table (no longer conflicts with output flag)
  • OutputOptions interface updated: table → pretty
  • All command handlers and tests updated accordingly
  • Docs updated to reflect new flag names

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

docs(fmodata/cli): add AI agent usage section

Covers three integration patterns:

  • Claude Code: running fmodata commands directly in a conversation
  • MCP Tool Server: wrapping CLI commands as MCP tools with zod schemas
  • Giving an agent context: schema description prompt snippet

Also includes a safety callout recommending read-only vs write vs schema
permission tiers, with a note that --confirm is the natural enforcement
point for schema operations.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

refactor(fmodata/cli): rename query command group to records

query implied read-only; records better reflects that the command
group covers the full CRUD lifecycle (list, insert, update, delete).

  • src/cli/commands/query.ts: makeQueryCommand → makeRecordsCommand,
    Command("query") → Command("records")
  • src/cli/index.ts: updated import and registration
  • tests/cli/integration/binary.test.ts: updated --help assertion
  • docs/fmodata/cli.mdx: all usage examples updated to records *

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

fix(fmodata/cli): improve query string encoding and error handling

  • Updated buildQueryString to encode query parameters for safety.
  • Enhanced error handling in makeRecordsCommand to use braces for clarity.
  • Added cli-table3 dependency to package.json for table formatting.

These changes ensure that query parameters are properly encoded and improve the readability of error handling in the CLI commands.

docs(fmodata/cli): clarify authentication and query encoding details

  • Updated authentication notes to specify that if an API key is present, missing FM_PASSWORD does not block authentication.
  • Added information on URL-encoding for query option values in the CLI documentation.

These changes enhance the clarity of authentication behavior and query handling in the CLI documentation.

fix(docs): correct query deleterecords delete in CLI docs

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Loading
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