Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

kiira.config.ts

146 lines6.0 KB

1import { defineConfig } from 'kiira-core'
2​
3export default defineConfig({
4 // skills/** are the repo-level discovery skills; packages/*/skills are the
5 // per-package skills that ship in each npm package. The READMEs ship in
6 // each npm package too, and npm shows them on the package page.
7 include: [
8 'docs/**/*.md',
9 'skills/**/*.md',
10 'packages/*/skills/**/*.md',
11 'README.md',
12 'packages/*/README.md',
13 ],
14 tsconfig: 'tsconfig.docs.json',
15 exclude: [
16 // docs/reference/** is auto-generated by TypeDoc (`pnpm generate-docs`);
17 // hand-fixing those snippets would be overwritten on regeneration.
18 'docs/reference/**',
19 // @tanstack/ai-angular is an ng-packagr bundle: its published entries
20 // are dist/types/*.d.ts, which kiira's dist->src heuristic can't map back
21 // to a source file (unlike every other package's dist/esm/index.d.ts ->
22 // src/index.ts). So these docs only resolve against the built package,
23 // which isn't available during a source-based docs check. Excluded until
24 // ai-angular exposes a source-resolvable entry.
25 'docs/api/ai-angular.md',
26 'docs/ui/angular.md',
27 'packages/ai-angular/README.md',
28 // docs/superpowers/** are internal planning/spec artifacts (design docs and
29 // implementation plans), not published, curated examples. Their snippets are
30 // illustrative pseudo-code, not meant to compile against package source.
31 'docs/superpowers/**',
32 ],
33 defaultValidate: 'type',
34 languages: ['ts', 'tsx', 'js', 'jsx'],
35 // Third-party packages the docs import but the workspace doesn't depend on.
36 // kiira installs these into an isolated cache (node_modules/.kiira) and
37 // type-checks against them, so snippets that show real integrations (Vercel
38 // AI SDK migration, community adapters, redis/pino/otel/express/hono, other
39 // schema libs) are validated instead of `ignore`d.
40 externalPackages: {
41 // Vercel AI SDK (comparison is v7; migration "before" fences stay on
42 // APIs that v7 still exports, including deprecated aliases)
43 ai: '^7.0.0',
44 '@ai-sdk/openai': '^4.0.0',
45 '@ai-sdk/anthropic': '^4.0.0',
46 '@ai-sdk/google': '^4.0.0',
47 '@ai-sdk/react': '^4.0.0',
48 // Provider SDKs / schema libraries shown in examples
49 openai: '^6.0.0',
50 arktype: '^2.0.0',
51 valibot: '^1.0.0',
52 '@valibot/to-json-schema': '^1.0.0',
53 '@modelcontextprotocol/sdk': '^1.29.0',
54 // Server / infra libraries used by real integration examples.
55 // (express is intentionally NOT declared here: it's already a transitive
56 // dependency in the workspace node_modules without its @types, which
57 // shadows any cache copy — so those two express snippets stay `ignore`d.)
58 hono: '^4.0.0',
59 '@hono/node-server': '^2.0.0',
60 redis: '^6.0.0',
61 ioredis: '^5.0.0',
62 pino: '^10.0.0',
63 '@opentelemetry/api': '^1.9.0',
64 // Community adapters (each documented page imports its published package)
65 '@cloudflare/tanstack-ai': '^0.1.0',
66 '@cloudflare/workers-types': '^4.20260317.1',
67 '@decartai/tanstack-ai-adapter': '^0.0.2',
68 '@mynthio/tanstack-ai-adapter': '^0.0.14',
69 '@cencori/ai-sdk': '^0.4.0',
70 '@soniox/tanstack-ai-adapter': '^0.1.2',
71 '@upstash/agentkit-tanstack-ai': '^0.1.1',
72 '@upstash/blob': '^0.0.8',
73 '@fal-ai/client': '1.11.0-alpha.5',
74 // Octane is a peer of @tanstack/ai-octane, not a root workspace dep.
75 octane: '^0.1.17',
76 // Remix 3 is a peer of @tanstack/ai-remix, not a root workspace dep.
77 remix: '^3.0.0-rc.1',
78 // TextPart highlighter examples. Not a workspace dependency.
79 // Subpath exports are mapped in tsconfig.docs.json because kiira
80 // does not read package.json exports.
81 '@tanstack/highlight': '^0.1.0',
82 // remix/ui re-exports this. Kiira's paths["*"] does not read the
83 // package.json exports field, so the jsx-runtime file must exist on disk.
84 '@remix-run/ui': '^0.8.0',
85 },
86 overrides: [
87 // React (and anything not overridden below) uses the automatic JSX
88 // runtime so snippets don't need an explicit `import React`.
89 // noImplicitReturns is off: doc snippets routinely show callbacks that
90 // return on some branches and fall through on others (e.g. a middleware
91 // hook that returns a decision or continues), which is valid and shouldn't
92 // force an explicit return type or trailing `return`.
93 {
94 include: [
95 'docs/**/*.md',
96 'skills/**/*.md',
97 'packages/*/skills/**/*.md',
98 'README.md',
99 'packages/*/README.md',
100 ],
101 jsx: 'react-jsx',
102 jsxImportSource: 'react',
103 noImplicitReturns: false,
104 },
105 // Solid snippets compile JSX through solid-js.
106 {
107 include: [
108 'docs/api/ai-solid.md',
109 'docs/ui/solid.md',
110 'packages/ai-solid/README.md',
111 ],
112 jsx: 'preserve',
113 jsxImportSource: 'solid-js',
114 },
115 // Preact snippets compile JSX through preact.
116 {
117 include: ['docs/api/ai-preact.md', 'docs/ui/preact.md'],
118 jsx: 'react-jsx',
119 jsxImportSource: 'preact',
120 },
121 // Octane snippets compile JSX through octane. Standard TSX works;
122 // TSRX (`@{`, `@for`) is not TypeScript, so docs use TSX here.
123 // `octane/jsx-runtime` is types-only via package.json exports;
124 // kiira's paths["*"] does not read exports, so `octane/dist` points
125 // at dist/jsx-runtime.d.ts, which exists on disk.
126 {
127 include: [
128 'docs/api/ai-octane.md',
129 'docs/ui/octane.md',
130 'packages/ai-octane/README.md',
131 ],
132 jsx: 'react-jsx',
133 jsxImportSource: 'octane/dist',
134 },
135 // Remix snippets compile JSX through remix/ui. `remix/ui/jsx-runtime`
136 // is types-only via package.json exports; kiira's paths["*"] does not
137 // read exports, so `remix/dist/ui` points at dist/ui/jsx-runtime.d.ts,
138 // which exists on disk. Subpath imports (`remix/ui`, `remix/router`)
139 // are mapped in tsconfig.docs.json for the same reason.
140 {
141 include: ['docs/api/ai-remix.md', 'docs/ui/remix.md'],
142 jsx: 'react-jsx',
143 jsxImportSource: 'remix/dist/ui',
144 },
145 ],
146})