CSV AI Analyzer — a Next.js app for analyzing CSV and Excel (.xlsx) files with AI. The core logic lives in the standalone npm package csv-charts-ai in packages/csv-charts-ai/.
pnpm dev # Start dev server (Turbopack)
pnpm build # Production build (Next.js)
pnpm lint # Run ESLint
pnpm lint:fix # Auto-fix lint + prettier issues
pnpm typecheck # TypeScript type checking (tsc --noEmit)
# Package (csv-charts-ai)
cd packages/csv-charts-ai
pnpm build # Build package with tsup
pnpm test # Run vitest tests (173 tests)
pnpm test:watch # Run tests in watch modeAlways run before committing to catch issues early:
pnpm lint # Must pass with 0 errors
pnpm build # Must compile successfully (includes TypeScript check)The project uses prettier via eslint (prettier/prettier rule). Use pnpm lint:fix to auto-format.
- App: Next.js 16 (App Router) in
src/ - Package (
csv-charts-ai): The "brain" of the project — bundles core deps (ai,zod,read-excel-file) and provides a pluggable provider registry (registerProvider/fromSDK) so consumers install only the AI SDKs they need (@ai-sdk/openai,@ai-sdk/anthropic, etc.) as optional peer deps. Chart components use a pluggable icon system (ChartIconProvider) — nolucide-reactdependency. Onlyreactandrechartsremain as optional peer deps (for chart components). - State: React local state + page-level props drilling + external store for AI chat (
src/lib/chat-store.ts) - File parsing: App uses PapaParse for CSV (
src/lib/csv-parser.ts) and delegates to the package for XLSX. The package has its own zero-dep CSV parser. - AI service:
src/lib/ai-service.tsregisters AI providers (openai,anthropic,google,mistral) at import time, then bridges app settings to the package'screateAppModel(). All AI logic is delegated to the package. - Fullscreen:
FullscreenCarduses CSSposition: fixed(not portals) to preserve child component state - Styling: TailwindCSS v4, CSS variable-based theming (dark/light/auto), glass-morphism design
- Theming:
src/lib/theme.tsxprovidesThemeProviderwith localStorage persistence (csv-ai-analyzer:theme; the oldercsv-ai-themekey and cookie are migrated once) + system preference detection. Anti-flash script inlayout.tsxapplies the theme class before first paint.
- All components are client-side (
"use client") - CSV and XLSX both produce the same
CSVDatatype (structurally identical to the package'sTabularData) — the rest of the app is format-agnostic - The
csv-charts-aipackage is the central library: AI functions, model resolution, CSV diff, data summary, chart components all live there - App-specific concerns (settings storage, PapaParse parsing, chat state, UI components) stay in
src/lib/ - Shared origin: GitHub Pages serves the app from
maxgfr.github.io, an origin shared with every other project page of the account (one localStorage quota, one IndexedDB namespace, one cookie jar). Every storage name starts withcsv-ai-analyzer(csv-ai-analyzer:settings,csv-ai-analyzer-secrets,csv-ai-analyzer:theme); settings under the oldercsv-ai-settings/csv-ai-secretsnames are moved once, then erased. No cookies are written. llm-connect 1.x does not report a refused write, sosaveApiSettingsreads the settings back and the dialog warns when they only last for the page - Delimiter/encoding settings only apply to CSV files; XLSX files are parsed automatically
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in node_modules/next/dist/docs/ (resolved from this file's directory; in monorepos the next package may not be visible from the repo root) before writing any code. Heed deprecation notices.
This block is written and re-added by next dev — verify at node_modules/next/dist/server/lib/generate-agent-files.js. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.