Skip to content

Release v0.2.0: schema-first types, live-verified release gate, 56 AI tools#16

Merged
e-roy merged 13 commits into
mainfrom
update-api-and-tools
May 29, 2026
Merged

Release v0.2.0: schema-first types, live-verified release gate, 56 AI tools#16
e-roy merged 13 commits into
mainfrom
update-api-and-tools

Conversation

@e-roy
Copy link
Copy Markdown
Owner

@e-roy e-roy commented May 29, 2026

First stable 0.2.0 of fmp-node-types, fmp-node-api, and fmp-ai-tools — exits Changesets pre-release mode and promotes the work that's been on the beta npm tag to latest. A plain npm install fmp-node-api finally returns the 0.2 line.

Spans 10 commits and 12 consolidated changesets. Highlights:

What's in 0.2.0

Schema-first types + live-verified release gate

  • fmp-node-types now ships Zod schemas as the source of truth; TypeScript types are z.infer<...> derived.
  • New pnpm test:live validates real FMP responses against the canonical schemas (sequential, throttled, budgeted; supports --category, --endpoint, --include-locked, --fail-on-drift).
  • The live check is wired into pnpm publish-packages as a release gate — schemas that drift from the live API abort the publish. Scheduled weekly drift CI on top of it.

Typed error classification, surfaced through the AI tools

  • APIResponse gains errorType (plan-restricted | rate-limit | auth | not-found | bad-request | network | unknown).
  • Plan-locked endpoints (402/403 or “Exclusive/Special Endpoint”) are reported as plan-restricted instead of a generic failure.
  • Every tool returns { error, type, message, status } on failure instead of null, so agents can explain why a call failed (e.g. "this data requires a higher FMP plan").

Tools refactor (one definition, two providers)

  • Each tool defined once in packages/tools/src/definitions/<category>.ts; Vercel-AI and OpenAI providers are thin adapters that rebuild their public shape.
  • Adding a tool = one defineTool({...}) + one export per provider. Adding a new provider = one adapter + one providers/<name>/index.ts.
  • configureFMPClient({ apiKey, timeout }) + memoized getFMPClient() exported from both entry points.

Expanded coverage

  • New API categories: fmp.analyst (estimates, price targets, grades, grades consensus), fmp.valuation (DCF, ratings snapshot/historical), fmp.technical (SMA/EMA/RSI/…), fmp.search.
  • New endpoints: price history (getHistoricalPrice, getIntraday), news (stock/crypto/forex + by-symbol), screener, symbol search.
  • Latest batch (Starter-verified): financial.getFinancialScores (Altman Z + Piotroski), getKeyMetricsTTM, getFinancialRatiosTTM, getRevenueProductSegmentation, getRevenueGeographicSegmentation; analyst.getGradesConsensus; company.getStockPeers.

Tool count: 49 → 56 (cross-provider consistency-tested).

Docs

  • Extended financial and company pages for the new endpoints.
  • New /docs/api/analyst page + sidebar entry documenting the full analyst category (estimates, both price-target endpoints, grades, grades consensus).

Verification

  • pnpm build && pnpm type-check && pnpm lint:all && pnpm test — green (124 tests across 38 suites; cross-provider consistency at 56).
  • pnpm test:live115/116 PASS, 0 drift against the live Starter-plan API.
    • The 1 failure is a pre-existing 10s client timeout on a slow v4 mapper endpoint (getCikMapperByName), beyond the default 50-call gate budget — does not block publish.

Migration notes for consumers on 0.1.x

  • The package surface is additive. APIResponse.errorType is a new optional field; existing checks against success/data/error keep working.
  • fmp-ai-tools now ships per-provider subpaths: fmp-ai-tools/vercel-ai and fmp-ai-tools/openai. The category groupings and individual tool exports are unchanged.
  • Internal: fmp-node-types now exports Zod schemas alongside types. Existing type imports still work; schemas are additional.
  • Peer SDK floors moved forward: Vercel AI SDK v6 (ai@6, @ai-sdk/*@3), @openai/agents@0.11.5, Zod 4.

e-roy and others added 10 commits May 24, 2026 17:08
…ic mocked tests

fmp-node-types is now schema-first: Zod schemas are canonical and TS types are derived via z.infer (zod runtime dep; ts-to-zod bootstraps generation via gen:schemas). All 16 categories converted, with ~25 corrections to match the live FMP API (string-vs-number, nullable fields, added/removed fields, MarketIndex reshaped to the /quotes/index quote shape, new IntradayPrice).

Add a live-API shape-check tool (packages/api/scripts/live + src/live/validate.ts): validates all ~85 endpoint methods against the canonical schemas, classifying PASS/FAIL/SKIP/DRIFT; sequential with throttle, --max-calls budget, and --sample/--category/--dry-run flags. Run via 'pnpm test:live'. Classifier is unit-tested.

Make the Jest suite fully mocked and deterministic (no network or API key): convert the 15 live endpoint integration tests to mocked unit tests (assert client path/version/params), remove integration.test.ts and utils/test-setup.ts, and drop the test:integration script. api 378 tests + tools 97 run in ~5s.

Add a scheduled GitHub Action (live-check.yml) that runs the live drift check weekly (and on demand), keeping live calls off the PR path while mocked tests gate PRs.

Docs: sync both READMEs and all 15 docs-site category pages to the corrected types; remove examples for non-existent methods (getFederalFundsRate, getSP500, searchCompany, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add APIResponse.errorType (plan-restricted | rate-limit | auth | not-found
| bad-request | network | unknown). The API client now reads FMP's real
error message from the response body and classifies failures via a shared
classifyError(); the live-check tool reuses the same classifier.

AI tools route every result through toToolResponse() and catch thrown
errors via toToolError(), so failures reach the model as a structured
{ error, type, message, status } object instead of null or a raw throw
(e.g. a missing FMP_API_KEY now reports type: auth).

Versions: fmp-node-types/fmp-node-api 0.2.0-beta.1, fmp-ai-tools 0.2.0-beta.4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ified release gate

Add three fmp-node-api categories (live-verified against the stable API):
- analyst: getEstimates, getPriceTargetConsensus, getPriceTargetSummary, getGrades
- valuation: getDiscountedCashFlow, getRatingSnapshot, getHistoricalRating
- technical: getTechnicalIndicator (SMA/EMA/RSI/etc.)

Plus six matching AI tools (count 43 -> 49), client memoization +
configureFMPClient, and price-history/news/screener/search tools from the
prior round. Schemas corrected to the real stable responses (analyst field
names, price-target-summary *Count fields, DCF "Stock Price" key, optional
rating date); getEstimates defaults period.

Process: wire the live API shape-check (test:live) into the release path as a
hard gate -- publish-packages runs it before version/publish, and the CI
publish job runs it as its own step -- so a renamed/removed route can no
longer ship. Always release via pnpm publish-packages.

Versions: fmp-node-types/fmp-node-api 0.2.0-beta.4, fmp-ai-tools 0.2.0-beta.8.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds 7 endpoints (each with a matching AI tool; tool count 49 -> 56), all
live-verified against the FMP Starter plan (test:live PASS, 0 drift):

- fmp.financial: getFinancialScores (Altman Z + Piotroski),
  getKeyMetricsTTM, getFinancialRatiosTTM,
  getRevenueProductSegmentation, getRevenueGeographicSegmentation.
- fmp.analyst: getGradesConsensus (buy/hold/sell counts + label).
- fmp.company: getStockPeers (peers with price + market cap).

Canonical Zod schemas in fmp-node-types (schema-first; full field sets
captured from the live API before writing). New live-check manifest cases.
Tools wired into both Vercel-AI and OpenAI providers; consistency test
bumped to 56. Docs: extended financial + company pages, and added the
first /docs/api/analyst page + sidebar entry (covers the whole analyst
category, not just the new method).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Exits Changesets pre-release mode and consolidates all 12 accumulated
pre-release changesets into the first stable 0.2.0 of fmp-node-types,
fmp-node-api, and fmp-ai-tools.

The 0.2 line bundles: schema-first Zod types with live-API drift checks
as a release gate, typed error classification surfaced through the AI
tools (incl. plan-restricted), the shared-definitions tools refactor
(one definition -> Vercel-AI + OpenAI provider adapters), client config
+ memoization, expanded coverage (search/price history/news/screener
+ analyst/valuation/technical categories), and the latest batch of 7
Starter-verified endpoints (financial scores, TTM key metrics/ratios,
revenue segmentation, grades consensus, stock peers).

Tool count: 56. Live-check: 0 drift across all 116 manifest cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

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

Project Deployment Actions Updated (UTC)
fmp-node-wrapper-docs Ready Ready Preview, Comment May 29, 2026 3:53am

Request Review

…Next CVEs

Bumps the three apps to clear the critical/high Next.js CVEs and modernizes
the rest of the dependency surface.

- apps/docs, both example apps -> Next 16.2.x, React 19.2.x, latest @types.
- apps/docs: eslint-config-next 16; switched lint to flat-config (Next 16
  removed `next lint`). Added eslint.config.mjs using
  eslint-config-next/core-web-vitals.
- apps/docs MDX: Next 16 builds with Turbopack by default, which requires
  serializable loader options. Switched remark-gfm to string-form plugin
  spec (`[['remark-gfm', {}]]`) so @next/mdx serializes cleanly.
- apps/examples/*: migrated Tailwind v3 -> v4. Replaced
  `tailwindcss + autoprefixer` PostCSS plugins with `@tailwindcss/postcss`,
  collapsed the three @tailwind directives to `@import 'tailwindcss';`,
  deleted the empty tailwind.config.js files (v4 auto-detects content
  paths). Dropped `next lint` scripts (examples are demos with no lint
  config; lint:all now skips them cleanly via turbo).
- Bumped apps/examples deps to latest minor: ai 6.0.191, @ai-sdk/openai
  3.0.65, @ai-sdk/react 3.0.193, @openai/agents 0.11.5, zod 4.3.6.
- Root: turbo 2.5.5 -> 2.9.16 (clears the moderate CVE on <=2.9.13).
- Trivial JSX cleanup in docs (unescaped apostrophes; annotated the
  next-themes "mounted" effect for the new react-hooks/set-state-in-effect
  rule).

Verification: build/type-check/lint:all/test all green across the 6 turbo
tasks. pnpm audit: 130 -> 50 vulnerabilities (critical 4 -> 1, high 56 -> 23).

Remaining 1 critical and most high advisories trace through
packages/api > axios@1.10.0 > form-data@4.0.3; bumping axios to >=1.15.0
in packages/api is the fix and is tracked as a separate 0.2.1 patch
release (apps cannot fix a vuln in a workspace-linked published package).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Patch release for fmp-node-api 0.2.1 (axios security floor bump from
^1.6.2 to ^1.13.0, resolves to 1.16.x at install time). Clears three
transitive advisories surfaced by `pnpm audit` against consumers:
  - Critical: form-data unsafe random boundary (GHSA-fjxv-7rqg-78g4)
  - High: axios DoS via missing data-size check (GHSA-4hjh-wcwx-xvwj)
  - Moderate: axios cloud-metadata exfiltration (GHSA-fvcv-3m26-pcqx)

fmp-ai-tools 0.2.1 cascades automatically per Changesets'
updateInternalDependencies=patch setting (workspace dep on fmp-node-api).
fmp-node-types stays at 0.2.0 (no source change).

No runtime API changes; verified via build/type-check/lint:all/test +
test:live (50/50 PASS, 0 drift).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI was failing on test (18.x) because Next 16 (introduced in the apps
dep update) requires Node >=20.9.0, which 18.x can't satisfy. The
fmp-docs build step errored with:

  You are using Node.js 18.20.8.
  For Next.js, Node.js version ">=20.9.0" is required.

Node 18 reached end of life 2025-04 anyway, so dropping it is the right
call independent of Next 16. New matrix: [20.x, 22.x] — current active
LTS line plus the latest LTS.

Root engines bumped to match the binding constraint (Next 16). Published
packages don't have explicit engines and continue to work on older Node
where their runtime deps allow it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@e-roy e-roy merged commit 0fe4530 into main May 29, 2026
5 checks passed
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