@useatlas/create 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +231 -0
- package/index.ts +829 -0
- package/package.json +38 -0
- package/templates/docker/.env.example +67 -0
- package/templates/docker/Dockerfile +52 -0
- package/templates/docker/bin/__tests__/benchmark.test.ts +598 -0
- package/templates/docker/bin/__tests__/duckdb-ingest.test.ts +171 -0
- package/templates/docker/bin/__tests__/eval.test.ts +434 -0
- package/templates/docker/bin/__tests__/matview-partition.test.ts +615 -0
- package/templates/docker/bin/__tests__/multi-source.test.ts +113 -0
- package/templates/docker/bin/__tests__/plugin-cli.test.ts +322 -0
- package/templates/docker/bin/__tests__/profiler-heuristics.test.ts +608 -0
- package/templates/docker/bin/__tests__/query.test.ts +240 -0
- package/templates/docker/bin/__tests__/schema-drift.test.ts +542 -0
- package/templates/docker/bin/__tests__/view-yaml-generation.test.ts +146 -0
- package/templates/docker/bin/atlas.ts +5044 -0
- package/templates/docker/bin/benchmark.ts +695 -0
- package/templates/docker/bin/enrich.ts +559 -0
- package/templates/docker/bin/eval.ts +770 -0
- package/templates/docker/bin/smoke.ts +438 -0
- package/templates/docker/data/.gitkeep +0 -0
- package/templates/docker/data/cybersec.sql +1961 -0
- package/templates/docker/data/demo-semantic/catalog.yml +40 -0
- package/templates/docker/data/demo-semantic/entities/accounts.yml +170 -0
- package/templates/docker/data/demo-semantic/entities/companies.yml +207 -0
- package/templates/docker/data/demo-semantic/entities/people.yml +145 -0
- package/templates/docker/data/demo-semantic/glossary.yml +22 -0
- package/templates/docker/data/demo-semantic/metrics/accounts.yml +38 -0
- package/templates/docker/data/demo-semantic/metrics/companies.yml +89 -0
- package/templates/docker/data/demo.sql +373 -0
- package/templates/docker/data/ecommerce.sql +1690 -0
- package/templates/docker/data/init-demo-db.sql +8 -0
- package/templates/docker/docker-compose.yml +34 -0
- package/templates/docker/docs/deploy.md +390 -0
- package/templates/docker/eslint.config.mjs +18 -0
- package/templates/docker/gitignore +5 -0
- package/templates/docker/next.config.ts +9 -0
- package/templates/docker/package.json +59 -0
- package/templates/docker/postcss.config.mjs +8 -0
- package/templates/docker/public/.gitkeep +0 -0
- package/templates/docker/public/favicon.svg +4 -0
- package/templates/docker/railway.json +13 -0
- package/templates/docker/render.yaml +34 -0
- package/templates/docker/semantic/catalog.yml +5 -0
- package/templates/docker/semantic/entities/.gitkeep +0 -0
- package/templates/docker/semantic/glossary.yml +6 -0
- package/templates/docker/semantic/metrics/.gitkeep +0 -0
- package/templates/docker/sidecar/Dockerfile +28 -0
- package/templates/docker/sidecar/railway.json +14 -0
- package/templates/docker/sidecar/server.ts +188 -0
- package/templates/docker/src/api/__tests__/actions.test.ts +683 -0
- package/templates/docker/src/api/__tests__/admin.test.ts +820 -0
- package/templates/docker/src/api/__tests__/auth.test.ts +165 -0
- package/templates/docker/src/api/__tests__/chat.test.ts +376 -0
- package/templates/docker/src/api/__tests__/conversations.test.ts +555 -0
- package/templates/docker/src/api/__tests__/cors.test.ts +135 -0
- package/templates/docker/src/api/__tests__/health-plugin.test.ts +169 -0
- package/templates/docker/src/api/__tests__/health.test.ts +261 -0
- package/templates/docker/src/api/__tests__/query.test.ts +891 -0
- package/templates/docker/src/api/__tests__/scheduled-tasks.test.ts +601 -0
- package/templates/docker/src/api/__tests__/slack.test.ts +847 -0
- package/templates/docker/src/api/index.ts +117 -0
- package/templates/docker/src/api/routes/actions.ts +274 -0
- package/templates/docker/src/api/routes/admin.ts +757 -0
- package/templates/docker/src/api/routes/auth.ts +48 -0
- package/templates/docker/src/api/routes/chat.ts +465 -0
- package/templates/docker/src/api/routes/conversations.ts +266 -0
- package/templates/docker/src/api/routes/health.ts +287 -0
- package/templates/docker/src/api/routes/openapi.ts +390 -0
- package/templates/docker/src/api/routes/query.ts +318 -0
- package/templates/docker/src/api/routes/scheduled-tasks.ts +467 -0
- package/templates/docker/src/api/routes/slack.ts +611 -0
- package/templates/docker/src/api/server.ts +226 -0
- package/templates/docker/src/app/api/[...route]/route.ts +33 -0
- package/templates/docker/src/app/error.tsx +24 -0
- package/templates/docker/src/app/globals.css +126 -0
- package/templates/docker/src/app/layout.tsx +19 -0
- package/templates/docker/src/app/page.tsx +14 -0
- package/templates/docker/src/global.d.ts +1 -0
- package/templates/docker/src/lib/__tests__/agent-cache.test.ts +437 -0
- package/templates/docker/src/lib/__tests__/agent-dialect.test.ts +114 -0
- package/templates/docker/src/lib/__tests__/agent-health-annotations.test.ts +164 -0
- package/templates/docker/src/lib/__tests__/agent-integration.test.ts +514 -0
- package/templates/docker/src/lib/__tests__/config-actions.test.ts +166 -0
- package/templates/docker/src/lib/__tests__/config.test.ts +1063 -0
- package/templates/docker/src/lib/__tests__/conversations.test.ts +589 -0
- package/templates/docker/src/lib/__tests__/errors.test.ts +256 -0
- package/templates/docker/src/lib/__tests__/logger.test.ts +200 -0
- package/templates/docker/src/lib/__tests__/providers.test.ts +99 -0
- package/templates/docker/src/lib/__tests__/rls.test.ts +435 -0
- package/templates/docker/src/lib/__tests__/scheduled-task-types.test.ts +124 -0
- package/templates/docker/src/lib/__tests__/scheduled-tasks.test.ts +550 -0
- package/templates/docker/src/lib/__tests__/semantic-index.test.ts +547 -0
- package/templates/docker/src/lib/__tests__/semantic-multisource.test.ts +544 -0
- package/templates/docker/src/lib/__tests__/semantic.test.ts +363 -0
- package/templates/docker/src/lib/__tests__/startup-actions.test.ts +452 -0
- package/templates/docker/src/lib/__tests__/startup.test.ts +465 -0
- package/templates/docker/src/lib/__tests__/tracing.test.ts +28 -0
- package/templates/docker/src/lib/action-types.ts +95 -0
- package/templates/docker/src/lib/agent-query.ts +178 -0
- package/templates/docker/src/lib/agent.ts +505 -0
- package/templates/docker/src/lib/api-url.ts +2 -0
- package/templates/docker/src/lib/auth/__tests__/audit.test.ts +418 -0
- package/templates/docker/src/lib/auth/__tests__/byot-integration.test.ts +222 -0
- package/templates/docker/src/lib/auth/__tests__/byot.test.ts +366 -0
- package/templates/docker/src/lib/auth/__tests__/detect.test.ts +190 -0
- package/templates/docker/src/lib/auth/__tests__/managed.test.ts +173 -0
- package/templates/docker/src/lib/auth/__tests__/middleware.test.ts +456 -0
- package/templates/docker/src/lib/auth/__tests__/migrate.test.ts +201 -0
- package/templates/docker/src/lib/auth/__tests__/permissions.test.ts +225 -0
- package/templates/docker/src/lib/auth/__tests__/server.test.ts +34 -0
- package/templates/docker/src/lib/auth/__tests__/simple-key.test.ts +176 -0
- package/templates/docker/src/lib/auth/__tests__/types.test.ts +44 -0
- package/templates/docker/src/lib/auth/audit.ts +89 -0
- package/templates/docker/src/lib/auth/byot.ts +158 -0
- package/templates/docker/src/lib/auth/client.ts +35 -0
- package/templates/docker/src/lib/auth/detect.ts +83 -0
- package/templates/docker/src/lib/auth/managed.ts +73 -0
- package/templates/docker/src/lib/auth/middleware.ts +208 -0
- package/templates/docker/src/lib/auth/migrate.ts +111 -0
- package/templates/docker/src/lib/auth/permissions.ts +156 -0
- package/templates/docker/src/lib/auth/server.ts +142 -0
- package/templates/docker/src/lib/auth/simple-key.ts +92 -0
- package/templates/docker/src/lib/auth/types.ts +49 -0
- package/templates/docker/src/lib/config.ts +704 -0
- package/templates/docker/src/lib/conversation-types.ts +29 -0
- package/templates/docker/src/lib/conversations.ts +270 -0
- package/templates/docker/src/lib/db/__tests__/connection.test.ts +69 -0
- package/templates/docker/src/lib/db/__tests__/duckdb.test.ts +141 -0
- package/templates/docker/src/lib/db/__tests__/internal.test.ts +387 -0
- package/templates/docker/src/lib/db/__tests__/registry-health.test.ts +207 -0
- package/templates/docker/src/lib/db/__tests__/registry-pool-limits.test.ts +156 -0
- package/templates/docker/src/lib/db/__tests__/registry.test.ts +595 -0
- package/templates/docker/src/lib/db/__tests__/salesforce.test.ts +339 -0
- package/templates/docker/src/lib/db/__tests__/snowflake.test.ts +217 -0
- package/templates/docker/src/lib/db/__tests__/source-rate-limit.test.ts +130 -0
- package/templates/docker/src/lib/db/connection.ts +753 -0
- package/templates/docker/src/lib/db/duckdb.ts +122 -0
- package/templates/docker/src/lib/db/internal.ts +273 -0
- package/templates/docker/src/lib/db/salesforce.ts +342 -0
- package/templates/docker/src/lib/db/source-rate-limit.ts +191 -0
- package/templates/docker/src/lib/errors.ts +154 -0
- package/templates/docker/src/lib/logger.ts +98 -0
- package/templates/docker/src/lib/plugins/__tests__/hooks-integration.test.ts +202 -0
- package/templates/docker/src/lib/plugins/__tests__/hooks.test.ts +529 -0
- package/templates/docker/src/lib/plugins/__tests__/migrate.test.ts +521 -0
- package/templates/docker/src/lib/plugins/__tests__/registry.test.ts +346 -0
- package/templates/docker/src/lib/plugins/__tests__/tools.test.ts +49 -0
- package/templates/docker/src/lib/plugins/__tests__/wiring.test.ts +585 -0
- package/templates/docker/src/lib/plugins/hooks.ts +162 -0
- package/templates/docker/src/lib/plugins/index.ts +9 -0
- package/templates/docker/src/lib/plugins/migrate.ts +309 -0
- package/templates/docker/src/lib/plugins/registry.ts +231 -0
- package/templates/docker/src/lib/plugins/tools.ts +39 -0
- package/templates/docker/src/lib/plugins/wiring.ts +291 -0
- package/templates/docker/src/lib/providers.ts +102 -0
- package/templates/docker/src/lib/rls.ts +321 -0
- package/templates/docker/src/lib/scheduled-task-types.ts +132 -0
- package/templates/docker/src/lib/scheduled-tasks.ts +475 -0
- package/templates/docker/src/lib/scheduler/__tests__/delivery.test.ts +192 -0
- package/templates/docker/src/lib/scheduler/__tests__/engine.test.ts +248 -0
- package/templates/docker/src/lib/scheduler/__tests__/format-email.test.ts +96 -0
- package/templates/docker/src/lib/scheduler/__tests__/format-slack.test.ts +78 -0
- package/templates/docker/src/lib/scheduler/__tests__/format-webhook.test.ts +78 -0
- package/templates/docker/src/lib/scheduler/delivery.ts +248 -0
- package/templates/docker/src/lib/scheduler/engine.ts +317 -0
- package/templates/docker/src/lib/scheduler/executor.ts +73 -0
- package/templates/docker/src/lib/scheduler/format-email.ts +109 -0
- package/templates/docker/src/lib/scheduler/format-slack.ts +35 -0
- package/templates/docker/src/lib/scheduler/format-webhook.ts +37 -0
- package/templates/docker/src/lib/scheduler/index.ts +7 -0
- package/templates/docker/src/lib/security.ts +11 -0
- package/templates/docker/src/lib/semantic-index.ts +503 -0
- package/templates/docker/src/lib/semantic.ts +387 -0
- package/templates/docker/src/lib/sidecar-types.ts +16 -0
- package/templates/docker/src/lib/slack/__tests__/api.test.ts +160 -0
- package/templates/docker/src/lib/slack/__tests__/format.test.ts +237 -0
- package/templates/docker/src/lib/slack/__tests__/store.test.ts +188 -0
- package/templates/docker/src/lib/slack/__tests__/threads.test.ts +112 -0
- package/templates/docker/src/lib/slack/__tests__/verify.test.ts +111 -0
- package/templates/docker/src/lib/slack/api.ts +102 -0
- package/templates/docker/src/lib/slack/format.ts +209 -0
- package/templates/docker/src/lib/slack/store.ts +107 -0
- package/templates/docker/src/lib/slack/threads.ts +64 -0
- package/templates/docker/src/lib/slack/verify.ts +71 -0
- package/templates/docker/src/lib/startup.ts +730 -0
- package/templates/docker/src/lib/tools/__tests__/action-permissions.test.ts +594 -0
- package/templates/docker/src/lib/tools/__tests__/custom-validation.test.ts +238 -0
- package/templates/docker/src/lib/tools/__tests__/explore-backend.test.ts +267 -0
- package/templates/docker/src/lib/tools/__tests__/explore-nsjail.test.ts +492 -0
- package/templates/docker/src/lib/tools/__tests__/explore-plugin.test.ts +374 -0
- package/templates/docker/src/lib/tools/__tests__/explore-sdk-compat.test.ts +82 -0
- package/templates/docker/src/lib/tools/__tests__/explore-sidecar.test.ts +208 -0
- package/templates/docker/src/lib/tools/__tests__/registry-actions.test.ts +144 -0
- package/templates/docker/src/lib/tools/__tests__/registry.test.ts +235 -0
- package/templates/docker/src/lib/tools/__tests__/salesforce-tool.test.ts +154 -0
- package/templates/docker/src/lib/tools/__tests__/soql-validation.test.ts +303 -0
- package/templates/docker/src/lib/tools/__tests__/sql-audit.test.ts +225 -0
- package/templates/docker/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +98 -0
- package/templates/docker/src/lib/tools/__tests__/sql-duckdb.test.ts +233 -0
- package/templates/docker/src/lib/tools/__tests__/sql-ratelimit.test.ts +225 -0
- package/templates/docker/src/lib/tools/__tests__/sql.test.ts +1012 -0
- package/templates/docker/src/lib/tools/actions/__tests__/audit.test.ts +211 -0
- package/templates/docker/src/lib/tools/actions/__tests__/email.test.ts +378 -0
- package/templates/docker/src/lib/tools/actions/__tests__/handler.test.ts +681 -0
- package/templates/docker/src/lib/tools/actions/__tests__/jira.test.ts +427 -0
- package/templates/docker/src/lib/tools/actions/audit.ts +47 -0
- package/templates/docker/src/lib/tools/actions/email.ts +191 -0
- package/templates/docker/src/lib/tools/actions/handler.ts +591 -0
- package/templates/docker/src/lib/tools/actions/index.ts +23 -0
- package/templates/docker/src/lib/tools/actions/jira.ts +220 -0
- package/templates/docker/src/lib/tools/explore-nsjail.ts +343 -0
- package/templates/docker/src/lib/tools/explore-sandbox.ts +264 -0
- package/templates/docker/src/lib/tools/explore-sidecar.ts +163 -0
- package/templates/docker/src/lib/tools/explore.ts +379 -0
- package/templates/docker/src/lib/tools/registry.ts +221 -0
- package/templates/docker/src/lib/tools/salesforce.ts +138 -0
- package/templates/docker/src/lib/tools/soql-validation.ts +172 -0
- package/templates/docker/src/lib/tools/sql.ts +680 -0
- package/templates/docker/src/lib/tracing.ts +40 -0
- package/templates/docker/src/lib/utils.ts +6 -0
- package/templates/docker/src/test-setup.ts +38 -0
- package/templates/docker/src/types/vercel-sandbox.d.ts +54 -0
- package/templates/docker/src/ui/components/actions/action-approval-card.tsx +295 -0
- package/templates/docker/src/ui/components/actions/action-status-badge.tsx +50 -0
- package/templates/docker/src/ui/components/admin/admin-layout.tsx +26 -0
- package/templates/docker/src/ui/components/admin/admin-sidebar.tsx +96 -0
- package/templates/docker/src/ui/components/admin/empty-state.tsx +24 -0
- package/templates/docker/src/ui/components/admin/entity-detail.tsx +233 -0
- package/templates/docker/src/ui/components/admin/entity-list.tsx +96 -0
- package/templates/docker/src/ui/components/admin/error-banner.tsx +22 -0
- package/templates/docker/src/ui/components/admin/feature-disabled.tsx +44 -0
- package/templates/docker/src/ui/components/admin/health-badge.tsx +30 -0
- package/templates/docker/src/ui/components/admin/loading-state.tsx +14 -0
- package/templates/docker/src/ui/components/admin/stat-card.tsx +32 -0
- package/templates/docker/src/ui/components/atlas-chat.tsx +370 -0
- package/templates/docker/src/ui/components/chart/chart-detection.ts +261 -0
- package/templates/docker/src/ui/components/chart/result-chart.tsx +375 -0
- package/templates/docker/src/ui/components/chat/api-key-bar.tsx +66 -0
- package/templates/docker/src/ui/components/chat/copy-button.tsx +25 -0
- package/templates/docker/src/ui/components/chat/data-table.tsx +102 -0
- package/templates/docker/src/ui/components/chat/error-banner.tsx +32 -0
- package/templates/docker/src/ui/components/chat/explore-card.tsx +41 -0
- package/templates/docker/src/ui/components/chat/loading-card.tsx +10 -0
- package/templates/docker/src/ui/components/chat/managed-auth-card.tsx +116 -0
- package/templates/docker/src/ui/components/chat/markdown.tsx +72 -0
- package/templates/docker/src/ui/components/chat/sql-block.tsx +30 -0
- package/templates/docker/src/ui/components/chat/sql-result-card.tsx +144 -0
- package/templates/docker/src/ui/components/chat/starter-prompts.ts +6 -0
- package/templates/docker/src/ui/components/chat/tool-part.tsx +40 -0
- package/templates/docker/src/ui/components/chat/typing-indicator.tsx +19 -0
- package/templates/docker/src/ui/components/conversations/conversation-item.tsx +120 -0
- package/templates/docker/src/ui/components/conversations/conversation-list.tsx +66 -0
- package/templates/docker/src/ui/components/conversations/conversation-sidebar.tsx +78 -0
- package/templates/docker/src/ui/components/conversations/delete-confirmation.tsx +27 -0
- package/templates/docker/src/ui/context.tsx +78 -0
- package/templates/docker/src/ui/hooks/use-admin-fetch.ts +104 -0
- package/templates/docker/src/ui/hooks/use-conversations.ts +184 -0
- package/templates/docker/src/ui/hooks/use-dark-mode.ts +17 -0
- package/templates/docker/src/ui/lib/action-types.ts +63 -0
- package/templates/docker/src/ui/lib/helpers.ts +104 -0
- package/templates/docker/src/ui/lib/types.ts +145 -0
- package/templates/docker/tsconfig.json +41 -0
- package/templates/docker/vercel.json +3 -0
- package/templates/nextjs-standalone/.env.example +68 -0
- package/templates/nextjs-standalone/bin/__tests__/benchmark.test.ts +598 -0
- package/templates/nextjs-standalone/bin/__tests__/duckdb-ingest.test.ts +171 -0
- package/templates/nextjs-standalone/bin/__tests__/eval.test.ts +434 -0
- package/templates/nextjs-standalone/bin/__tests__/matview-partition.test.ts +615 -0
- package/templates/nextjs-standalone/bin/__tests__/multi-source.test.ts +113 -0
- package/templates/nextjs-standalone/bin/__tests__/plugin-cli.test.ts +322 -0
- package/templates/nextjs-standalone/bin/__tests__/profiler-heuristics.test.ts +608 -0
- package/templates/nextjs-standalone/bin/__tests__/query.test.ts +240 -0
- package/templates/nextjs-standalone/bin/__tests__/schema-drift.test.ts +542 -0
- package/templates/nextjs-standalone/bin/__tests__/view-yaml-generation.test.ts +146 -0
- package/templates/nextjs-standalone/bin/atlas.ts +5044 -0
- package/templates/nextjs-standalone/bin/benchmark.ts +695 -0
- package/templates/nextjs-standalone/bin/enrich.ts +559 -0
- package/templates/nextjs-standalone/bin/eval.ts +770 -0
- package/templates/nextjs-standalone/bin/smoke.ts +438 -0
- package/templates/nextjs-standalone/data/.gitkeep +0 -0
- package/templates/nextjs-standalone/data/cybersec.sql +1961 -0
- package/templates/nextjs-standalone/data/demo-semantic/catalog.yml +40 -0
- package/templates/nextjs-standalone/data/demo-semantic/entities/accounts.yml +170 -0
- package/templates/nextjs-standalone/data/demo-semantic/entities/companies.yml +207 -0
- package/templates/nextjs-standalone/data/demo-semantic/entities/people.yml +145 -0
- package/templates/nextjs-standalone/data/demo-semantic/glossary.yml +22 -0
- package/templates/nextjs-standalone/data/demo-semantic/metrics/accounts.yml +38 -0
- package/templates/nextjs-standalone/data/demo-semantic/metrics/companies.yml +89 -0
- package/templates/nextjs-standalone/data/demo.sql +373 -0
- package/templates/nextjs-standalone/data/ecommerce.sql +1690 -0
- package/templates/nextjs-standalone/data/init-demo-db.sql +8 -0
- package/templates/nextjs-standalone/docs/deploy.md +390 -0
- package/templates/nextjs-standalone/eslint.config.mjs +18 -0
- package/templates/nextjs-standalone/gitignore +5 -0
- package/templates/nextjs-standalone/next.config.ts +10 -0
- package/templates/nextjs-standalone/package.json +63 -0
- package/templates/nextjs-standalone/postcss.config.mjs +8 -0
- package/templates/nextjs-standalone/semantic/catalog.yml +5 -0
- package/templates/nextjs-standalone/semantic/entities/.gitkeep +0 -0
- package/templates/nextjs-standalone/semantic/glossary.yml +6 -0
- package/templates/nextjs-standalone/semantic/metrics/.gitkeep +0 -0
- package/templates/nextjs-standalone/src/api/__tests__/actions.test.ts +683 -0
- package/templates/nextjs-standalone/src/api/__tests__/admin.test.ts +820 -0
- package/templates/nextjs-standalone/src/api/__tests__/auth.test.ts +165 -0
- package/templates/nextjs-standalone/src/api/__tests__/chat.test.ts +376 -0
- package/templates/nextjs-standalone/src/api/__tests__/conversations.test.ts +555 -0
- package/templates/nextjs-standalone/src/api/__tests__/cors.test.ts +135 -0
- package/templates/nextjs-standalone/src/api/__tests__/health-plugin.test.ts +169 -0
- package/templates/nextjs-standalone/src/api/__tests__/health.test.ts +261 -0
- package/templates/nextjs-standalone/src/api/__tests__/query.test.ts +891 -0
- package/templates/nextjs-standalone/src/api/__tests__/scheduled-tasks.test.ts +601 -0
- package/templates/nextjs-standalone/src/api/__tests__/slack.test.ts +847 -0
- package/templates/nextjs-standalone/src/api/index.ts +117 -0
- package/templates/nextjs-standalone/src/api/routes/actions.ts +274 -0
- package/templates/nextjs-standalone/src/api/routes/admin.ts +757 -0
- package/templates/nextjs-standalone/src/api/routes/auth.ts +48 -0
- package/templates/nextjs-standalone/src/api/routes/chat.ts +465 -0
- package/templates/nextjs-standalone/src/api/routes/conversations.ts +266 -0
- package/templates/nextjs-standalone/src/api/routes/health.ts +287 -0
- package/templates/nextjs-standalone/src/api/routes/openapi.ts +390 -0
- package/templates/nextjs-standalone/src/api/routes/query.ts +318 -0
- package/templates/nextjs-standalone/src/api/routes/scheduled-tasks.ts +467 -0
- package/templates/nextjs-standalone/src/api/routes/slack.ts +611 -0
- package/templates/nextjs-standalone/src/api/server.ts +226 -0
- package/templates/nextjs-standalone/src/app/api/[...route]/route.ts +33 -0
- package/templates/nextjs-standalone/src/app/error.tsx +24 -0
- package/templates/nextjs-standalone/src/app/global-error.tsx +68 -0
- package/templates/nextjs-standalone/src/app/globals.css +126 -0
- package/templates/nextjs-standalone/src/app/layout.tsx +19 -0
- package/templates/nextjs-standalone/src/app/page.tsx +14 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-cache.test.ts +437 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-dialect.test.ts +114 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-health-annotations.test.ts +164 -0
- package/templates/nextjs-standalone/src/lib/__tests__/agent-integration.test.ts +514 -0
- package/templates/nextjs-standalone/src/lib/__tests__/config-actions.test.ts +166 -0
- package/templates/nextjs-standalone/src/lib/__tests__/config.test.ts +1063 -0
- package/templates/nextjs-standalone/src/lib/__tests__/conversations.test.ts +589 -0
- package/templates/nextjs-standalone/src/lib/__tests__/errors.test.ts +256 -0
- package/templates/nextjs-standalone/src/lib/__tests__/logger.test.ts +200 -0
- package/templates/nextjs-standalone/src/lib/__tests__/providers.test.ts +99 -0
- package/templates/nextjs-standalone/src/lib/__tests__/rls.test.ts +435 -0
- package/templates/nextjs-standalone/src/lib/__tests__/scheduled-task-types.test.ts +124 -0
- package/templates/nextjs-standalone/src/lib/__tests__/scheduled-tasks.test.ts +550 -0
- package/templates/nextjs-standalone/src/lib/__tests__/semantic-index.test.ts +547 -0
- package/templates/nextjs-standalone/src/lib/__tests__/semantic-multisource.test.ts +544 -0
- package/templates/nextjs-standalone/src/lib/__tests__/semantic.test.ts +363 -0
- package/templates/nextjs-standalone/src/lib/__tests__/startup-actions.test.ts +452 -0
- package/templates/nextjs-standalone/src/lib/__tests__/startup.test.ts +465 -0
- package/templates/nextjs-standalone/src/lib/__tests__/tracing.test.ts +28 -0
- package/templates/nextjs-standalone/src/lib/action-types.ts +95 -0
- package/templates/nextjs-standalone/src/lib/agent-query.ts +178 -0
- package/templates/nextjs-standalone/src/lib/agent.ts +505 -0
- package/templates/nextjs-standalone/src/lib/api-url.ts +3 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/audit.test.ts +418 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/byot-integration.test.ts +222 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/byot.test.ts +366 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/detect.test.ts +190 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/managed.test.ts +173 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/middleware.test.ts +456 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/migrate.test.ts +201 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/permissions.test.ts +225 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/server.test.ts +34 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/simple-key.test.ts +176 -0
- package/templates/nextjs-standalone/src/lib/auth/__tests__/types.test.ts +44 -0
- package/templates/nextjs-standalone/src/lib/auth/audit.ts +89 -0
- package/templates/nextjs-standalone/src/lib/auth/byot.ts +158 -0
- package/templates/nextjs-standalone/src/lib/auth/client.ts +23 -0
- package/templates/nextjs-standalone/src/lib/auth/detect.ts +83 -0
- package/templates/nextjs-standalone/src/lib/auth/managed.ts +73 -0
- package/templates/nextjs-standalone/src/lib/auth/middleware.ts +208 -0
- package/templates/nextjs-standalone/src/lib/auth/migrate.ts +111 -0
- package/templates/nextjs-standalone/src/lib/auth/permissions.ts +156 -0
- package/templates/nextjs-standalone/src/lib/auth/server.ts +142 -0
- package/templates/nextjs-standalone/src/lib/auth/simple-key.ts +92 -0
- package/templates/nextjs-standalone/src/lib/auth/types.ts +49 -0
- package/templates/nextjs-standalone/src/lib/config.ts +704 -0
- package/templates/nextjs-standalone/src/lib/conversation-types.ts +29 -0
- package/templates/nextjs-standalone/src/lib/conversations.ts +270 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/connection.test.ts +69 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/duckdb.test.ts +141 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/internal.test.ts +387 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-health.test.ts +207 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry-pool-limits.test.ts +156 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/registry.test.ts +595 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/salesforce.test.ts +339 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/snowflake.test.ts +217 -0
- package/templates/nextjs-standalone/src/lib/db/__tests__/source-rate-limit.test.ts +130 -0
- package/templates/nextjs-standalone/src/lib/db/connection.ts +753 -0
- package/templates/nextjs-standalone/src/lib/db/duckdb.ts +122 -0
- package/templates/nextjs-standalone/src/lib/db/internal.ts +273 -0
- package/templates/nextjs-standalone/src/lib/db/salesforce.ts +342 -0
- package/templates/nextjs-standalone/src/lib/db/source-rate-limit.ts +191 -0
- package/templates/nextjs-standalone/src/lib/errors.ts +154 -0
- package/templates/nextjs-standalone/src/lib/logger.ts +98 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks-integration.test.ts +202 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/hooks.test.ts +529 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/migrate.test.ts +521 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/registry.test.ts +346 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/tools.test.ts +49 -0
- package/templates/nextjs-standalone/src/lib/plugins/__tests__/wiring.test.ts +585 -0
- package/templates/nextjs-standalone/src/lib/plugins/hooks.ts +162 -0
- package/templates/nextjs-standalone/src/lib/plugins/index.ts +9 -0
- package/templates/nextjs-standalone/src/lib/plugins/migrate.ts +309 -0
- package/templates/nextjs-standalone/src/lib/plugins/registry.ts +231 -0
- package/templates/nextjs-standalone/src/lib/plugins/tools.ts +39 -0
- package/templates/nextjs-standalone/src/lib/plugins/wiring.ts +291 -0
- package/templates/nextjs-standalone/src/lib/providers.ts +102 -0
- package/templates/nextjs-standalone/src/lib/rls.ts +321 -0
- package/templates/nextjs-standalone/src/lib/scheduled-task-types.ts +132 -0
- package/templates/nextjs-standalone/src/lib/scheduled-tasks.ts +475 -0
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/delivery.test.ts +192 -0
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/engine.test.ts +248 -0
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-email.test.ts +96 -0
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-slack.test.ts +78 -0
- package/templates/nextjs-standalone/src/lib/scheduler/__tests__/format-webhook.test.ts +78 -0
- package/templates/nextjs-standalone/src/lib/scheduler/delivery.ts +248 -0
- package/templates/nextjs-standalone/src/lib/scheduler/engine.ts +317 -0
- package/templates/nextjs-standalone/src/lib/scheduler/executor.ts +73 -0
- package/templates/nextjs-standalone/src/lib/scheduler/format-email.ts +109 -0
- package/templates/nextjs-standalone/src/lib/scheduler/format-slack.ts +35 -0
- package/templates/nextjs-standalone/src/lib/scheduler/format-webhook.ts +37 -0
- package/templates/nextjs-standalone/src/lib/scheduler/index.ts +7 -0
- package/templates/nextjs-standalone/src/lib/security.ts +11 -0
- package/templates/nextjs-standalone/src/lib/semantic-index.ts +503 -0
- package/templates/nextjs-standalone/src/lib/semantic.ts +387 -0
- package/templates/nextjs-standalone/src/lib/sidecar-types.ts +16 -0
- package/templates/nextjs-standalone/src/lib/slack/__tests__/api.test.ts +160 -0
- package/templates/nextjs-standalone/src/lib/slack/__tests__/format.test.ts +237 -0
- package/templates/nextjs-standalone/src/lib/slack/__tests__/store.test.ts +188 -0
- package/templates/nextjs-standalone/src/lib/slack/__tests__/threads.test.ts +112 -0
- package/templates/nextjs-standalone/src/lib/slack/__tests__/verify.test.ts +111 -0
- package/templates/nextjs-standalone/src/lib/slack/api.ts +102 -0
- package/templates/nextjs-standalone/src/lib/slack/format.ts +209 -0
- package/templates/nextjs-standalone/src/lib/slack/store.ts +107 -0
- package/templates/nextjs-standalone/src/lib/slack/threads.ts +64 -0
- package/templates/nextjs-standalone/src/lib/slack/verify.ts +71 -0
- package/templates/nextjs-standalone/src/lib/startup.ts +730 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/action-permissions.test.ts +594 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/custom-validation.test.ts +238 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-backend.test.ts +267 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-nsjail.test.ts +492 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-plugin.test.ts +374 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sdk-compat.test.ts +82 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/explore-sidecar.test.ts +208 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry-actions.test.ts +144 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/registry.test.ts +235 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/salesforce-tool.test.ts +154 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/soql-validation.test.ts +303 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-audit.test.ts +225 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-connection-whitelist.test.ts +98 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-duckdb.test.ts +233 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql-ratelimit.test.ts +225 -0
- package/templates/nextjs-standalone/src/lib/tools/__tests__/sql.test.ts +1012 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/audit.test.ts +211 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/email.test.ts +378 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/handler.test.ts +681 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/__tests__/jira.test.ts +427 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/audit.ts +47 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/email.ts +191 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/handler.ts +591 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/index.ts +23 -0
- package/templates/nextjs-standalone/src/lib/tools/actions/jira.ts +220 -0
- package/templates/nextjs-standalone/src/lib/tools/explore-nsjail.ts +343 -0
- package/templates/nextjs-standalone/src/lib/tools/explore-sandbox.ts +264 -0
- package/templates/nextjs-standalone/src/lib/tools/explore-sidecar.ts +163 -0
- package/templates/nextjs-standalone/src/lib/tools/explore.ts +379 -0
- package/templates/nextjs-standalone/src/lib/tools/registry.ts +221 -0
- package/templates/nextjs-standalone/src/lib/tools/salesforce.ts +138 -0
- package/templates/nextjs-standalone/src/lib/tools/soql-validation.ts +172 -0
- package/templates/nextjs-standalone/src/lib/tools/sql.ts +680 -0
- package/templates/nextjs-standalone/src/lib/tracing.ts +40 -0
- package/templates/nextjs-standalone/src/lib/utils.ts +6 -0
- package/templates/nextjs-standalone/src/test-setup.ts +38 -0
- package/templates/nextjs-standalone/src/ui/components/actions/action-approval-card.tsx +295 -0
- package/templates/nextjs-standalone/src/ui/components/actions/action-status-badge.tsx +50 -0
- package/templates/nextjs-standalone/src/ui/components/admin/admin-layout.tsx +26 -0
- package/templates/nextjs-standalone/src/ui/components/admin/admin-sidebar.tsx +96 -0
- package/templates/nextjs-standalone/src/ui/components/admin/empty-state.tsx +24 -0
- package/templates/nextjs-standalone/src/ui/components/admin/entity-detail.tsx +233 -0
- package/templates/nextjs-standalone/src/ui/components/admin/entity-list.tsx +96 -0
- package/templates/nextjs-standalone/src/ui/components/admin/error-banner.tsx +22 -0
- package/templates/nextjs-standalone/src/ui/components/admin/feature-disabled.tsx +44 -0
- package/templates/nextjs-standalone/src/ui/components/admin/health-badge.tsx +30 -0
- package/templates/nextjs-standalone/src/ui/components/admin/loading-state.tsx +14 -0
- package/templates/nextjs-standalone/src/ui/components/admin/stat-card.tsx +32 -0
- package/templates/nextjs-standalone/src/ui/components/atlas-chat.tsx +370 -0
- package/templates/nextjs-standalone/src/ui/components/chart/chart-detection.ts +261 -0
- package/templates/nextjs-standalone/src/ui/components/chart/result-chart.tsx +375 -0
- package/templates/nextjs-standalone/src/ui/components/chat/api-key-bar.tsx +66 -0
- package/templates/nextjs-standalone/src/ui/components/chat/copy-button.tsx +25 -0
- package/templates/nextjs-standalone/src/ui/components/chat/data-table.tsx +102 -0
- package/templates/nextjs-standalone/src/ui/components/chat/error-banner.tsx +32 -0
- package/templates/nextjs-standalone/src/ui/components/chat/explore-card.tsx +41 -0
- package/templates/nextjs-standalone/src/ui/components/chat/loading-card.tsx +10 -0
- package/templates/nextjs-standalone/src/ui/components/chat/managed-auth-card.tsx +116 -0
- package/templates/nextjs-standalone/src/ui/components/chat/markdown.tsx +72 -0
- package/templates/nextjs-standalone/src/ui/components/chat/sql-block.tsx +30 -0
- package/templates/nextjs-standalone/src/ui/components/chat/sql-result-card.tsx +144 -0
- package/templates/nextjs-standalone/src/ui/components/chat/starter-prompts.ts +6 -0
- package/templates/nextjs-standalone/src/ui/components/chat/tool-part.tsx +40 -0
- package/templates/nextjs-standalone/src/ui/components/chat/typing-indicator.tsx +19 -0
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-item.tsx +120 -0
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-list.tsx +66 -0
- package/templates/nextjs-standalone/src/ui/components/conversations/conversation-sidebar.tsx +78 -0
- package/templates/nextjs-standalone/src/ui/components/conversations/delete-confirmation.tsx +27 -0
- package/templates/nextjs-standalone/src/ui/context.tsx +78 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-admin-fetch.ts +104 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-conversations.ts +184 -0
- package/templates/nextjs-standalone/src/ui/hooks/use-dark-mode.ts +17 -0
- package/templates/nextjs-standalone/src/ui/lib/action-types.ts +63 -0
- package/templates/nextjs-standalone/src/ui/lib/helpers.ts +104 -0
- package/templates/nextjs-standalone/src/ui/lib/types.ts +145 -0
- package/templates/nextjs-standalone/tsconfig.json +32 -0
- package/templates/nextjs-standalone/vercel.json +4 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* E2E smoke test runner for Atlas deployments.
|
|
3
|
+
*
|
|
4
|
+
* Pure HTTP client — no DB drivers, no server imports. Uses fetch()
|
|
5
|
+
* against health and query endpoints to verify the full stack works.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* bun run atlas -- smoke
|
|
9
|
+
* bun run atlas -- smoke --target https://demo.useatlas.dev
|
|
10
|
+
* bun run atlas -- smoke --target http://localhost:3001 --api-key sk-...
|
|
11
|
+
* bun run atlas -- smoke --json
|
|
12
|
+
* bun run atlas -- smoke --verbose --timeout 60000
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { getFlag } from "./atlas";
|
|
16
|
+
|
|
17
|
+
// --- Types ---
|
|
18
|
+
|
|
19
|
+
type CheckStatus = "PASS" | "FAIL" | "SKIP";
|
|
20
|
+
|
|
21
|
+
interface CheckResult {
|
|
22
|
+
name: string;
|
|
23
|
+
phase: string;
|
|
24
|
+
status: CheckStatus;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
detail?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface HealthResponse {
|
|
31
|
+
status: string;
|
|
32
|
+
checks: {
|
|
33
|
+
datasource: { status: string; latencyMs?: number; error?: string };
|
|
34
|
+
provider: { status: string; provider: string; model: string; error?: string };
|
|
35
|
+
semanticLayer: { status: string; entityCount: number; error?: string };
|
|
36
|
+
explore: { backend: string; isolated: boolean };
|
|
37
|
+
auth: { mode: string; enabled: boolean };
|
|
38
|
+
slack: { enabled: boolean; mode: string };
|
|
39
|
+
};
|
|
40
|
+
sources?: Record<string, { status: string; latencyMs?: number; dbType: string }>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface QueryResponse {
|
|
44
|
+
answer: string;
|
|
45
|
+
sql: string[];
|
|
46
|
+
data: { columns: string[]; rows: Record<string, unknown>[] }[];
|
|
47
|
+
steps: number;
|
|
48
|
+
usage: { totalTokens: number };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// --- HTTP helpers ---
|
|
52
|
+
|
|
53
|
+
async function httpGet(
|
|
54
|
+
url: string,
|
|
55
|
+
headers: Record<string, string>,
|
|
56
|
+
timeoutMs: number,
|
|
57
|
+
): Promise<{ status: number; body: unknown; durationMs: number }> {
|
|
58
|
+
const start = performance.now();
|
|
59
|
+
const controller = new AbortController();
|
|
60
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
61
|
+
try {
|
|
62
|
+
const res = await fetch(url, { headers, signal: controller.signal });
|
|
63
|
+
const body = await res.json();
|
|
64
|
+
return { status: res.status, body, durationMs: Math.round(performance.now() - start) };
|
|
65
|
+
} finally {
|
|
66
|
+
clearTimeout(timer);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async function httpPost(
|
|
71
|
+
url: string,
|
|
72
|
+
payload: unknown,
|
|
73
|
+
headers: Record<string, string>,
|
|
74
|
+
timeoutMs: number,
|
|
75
|
+
): Promise<{ status: number; body: unknown; durationMs: number }> {
|
|
76
|
+
const start = performance.now();
|
|
77
|
+
const controller = new AbortController();
|
|
78
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
79
|
+
try {
|
|
80
|
+
const res = await fetch(url, {
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: { "Content-Type": "application/json", ...headers },
|
|
83
|
+
body: JSON.stringify(payload),
|
|
84
|
+
signal: controller.signal,
|
|
85
|
+
});
|
|
86
|
+
const body = await res.json();
|
|
87
|
+
return { status: res.status, body, durationMs: Math.round(performance.now() - start) };
|
|
88
|
+
} finally {
|
|
89
|
+
clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// --- Output helpers ---
|
|
94
|
+
|
|
95
|
+
const RESET = "\x1b[0m";
|
|
96
|
+
const GREEN = "\x1b[32m";
|
|
97
|
+
const RED = "\x1b[31m";
|
|
98
|
+
const YELLOW = "\x1b[33m";
|
|
99
|
+
const DIM = "\x1b[2m";
|
|
100
|
+
const BOLD = "\x1b[1m";
|
|
101
|
+
|
|
102
|
+
function statusColor(status: CheckStatus): string {
|
|
103
|
+
if (status === "PASS") return GREEN;
|
|
104
|
+
if (status === "FAIL") return RED;
|
|
105
|
+
return YELLOW;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function printCheck(result: CheckResult, verbose: boolean): void {
|
|
109
|
+
const color = statusColor(result.status);
|
|
110
|
+
const tag = `${color}${result.status.padEnd(4)}${RESET}`;
|
|
111
|
+
const detail = result.detail ? `${DIM} (${result.detail})${RESET}` : "";
|
|
112
|
+
console.log(` ${tag} ${result.name}${detail}`);
|
|
113
|
+
if (result.error && (verbose || result.status === "FAIL")) {
|
|
114
|
+
console.log(` ${DIM}${result.error}${RESET}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function printResults(results: CheckResult[], target: string, hasAuth: boolean, totalMs: number): void {
|
|
119
|
+
const passed = results.filter((r) => r.status === "PASS").length;
|
|
120
|
+
const failed = results.filter((r) => r.status === "FAIL").length;
|
|
121
|
+
const skipped = results.filter((r) => r.status === "SKIP").length;
|
|
122
|
+
|
|
123
|
+
console.log("");
|
|
124
|
+
const failColor = failed > 0 ? RED : GREEN;
|
|
125
|
+
console.log(
|
|
126
|
+
`${BOLD}Results:${RESET} ${GREEN}${passed} passed${RESET}, ${failColor}${failed} failed${RESET}, ${YELLOW}${skipped} skipped${RESET} ${DIM}(${(totalMs / 1000).toFixed(1)}s total)${RESET}`,
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function printJsonResults(results: CheckResult[], target: string, totalMs: number): void {
|
|
131
|
+
console.log(JSON.stringify({
|
|
132
|
+
target,
|
|
133
|
+
totalMs,
|
|
134
|
+
summary: {
|
|
135
|
+
passed: results.filter((r) => r.status === "PASS").length,
|
|
136
|
+
failed: results.filter((r) => r.status === "FAIL").length,
|
|
137
|
+
skipped: results.filter((r) => r.status === "SKIP").length,
|
|
138
|
+
},
|
|
139
|
+
checks: results,
|
|
140
|
+
}, null, 2));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// --- Check executor ---
|
|
144
|
+
|
|
145
|
+
async function runCheck(
|
|
146
|
+
name: string,
|
|
147
|
+
phase: string,
|
|
148
|
+
fn: () => Promise<{ detail?: string }>,
|
|
149
|
+
): Promise<CheckResult> {
|
|
150
|
+
const start = performance.now();
|
|
151
|
+
try {
|
|
152
|
+
const { detail } = await fn();
|
|
153
|
+
return { name, phase, status: "PASS", durationMs: Math.round(performance.now() - start), detail };
|
|
154
|
+
} catch (err) {
|
|
155
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
156
|
+
if (message.startsWith("SKIP:")) {
|
|
157
|
+
return { name, phase, status: "SKIP", durationMs: Math.round(performance.now() - start), detail: message.slice(5).trim() };
|
|
158
|
+
}
|
|
159
|
+
return { name, phase, status: "FAIL", durationMs: Math.round(performance.now() - start), error: message };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// --- Phase runners ---
|
|
164
|
+
|
|
165
|
+
async function checkConnectivity(
|
|
166
|
+
target: string,
|
|
167
|
+
headers: Record<string, string>,
|
|
168
|
+
timeoutMs: number,
|
|
169
|
+
): Promise<{ result: CheckResult; health: HealthResponse | null }> {
|
|
170
|
+
let lastError = "";
|
|
171
|
+
let health: HealthResponse | null = null;
|
|
172
|
+
|
|
173
|
+
const result = await runCheck("Health endpoint reachable", "Connectivity", async () => {
|
|
174
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
175
|
+
try {
|
|
176
|
+
const res = await httpGet(`${target}/api/health`, headers, timeoutMs);
|
|
177
|
+
if (res.status === 200 || res.status === 503) {
|
|
178
|
+
health = res.body as HealthResponse;
|
|
179
|
+
return { detail: `${res.durationMs}ms` };
|
|
180
|
+
}
|
|
181
|
+
lastError = `HTTP ${res.status}`;
|
|
182
|
+
} catch (err) {
|
|
183
|
+
lastError = err instanceof Error ? err.message : String(err);
|
|
184
|
+
}
|
|
185
|
+
if (attempt < 3) await new Promise((r) => setTimeout(r, 2000));
|
|
186
|
+
}
|
|
187
|
+
throw new Error(`Failed after 3 attempts: ${lastError}`);
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
return { result, health };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function checkSubsystems(health: HealthResponse): CheckResult[] {
|
|
194
|
+
const results: CheckResult[] = [];
|
|
195
|
+
|
|
196
|
+
// Datasource
|
|
197
|
+
results.push((() => {
|
|
198
|
+
const ds = health.checks.datasource;
|
|
199
|
+
if (ds.status === "ok") {
|
|
200
|
+
return { name: "Datasource connected", phase: "Subsystems", status: "PASS" as const, durationMs: 0, detail: ds.latencyMs ? `${ds.latencyMs}ms latency` : undefined };
|
|
201
|
+
}
|
|
202
|
+
if (ds.status === "not_configured") {
|
|
203
|
+
return { name: "Datasource connected", phase: "Subsystems", status: "SKIP" as const, durationMs: 0, detail: "not configured" };
|
|
204
|
+
}
|
|
205
|
+
return { name: "Datasource connected", phase: "Subsystems", status: "FAIL" as const, durationMs: 0, error: ds.error ?? "unhealthy" };
|
|
206
|
+
})());
|
|
207
|
+
|
|
208
|
+
// Provider
|
|
209
|
+
results.push((() => {
|
|
210
|
+
const p = health.checks.provider;
|
|
211
|
+
if (p.status === "ok") {
|
|
212
|
+
return { name: "LLM provider configured", phase: "Subsystems", status: "PASS" as const, durationMs: 0, detail: `${p.provider} / ${p.model}` };
|
|
213
|
+
}
|
|
214
|
+
return { name: "LLM provider configured", phase: "Subsystems", status: "FAIL" as const, durationMs: 0, error: p.error ?? "not configured" };
|
|
215
|
+
})());
|
|
216
|
+
|
|
217
|
+
// Semantic layer
|
|
218
|
+
results.push((() => {
|
|
219
|
+
const sl = health.checks.semanticLayer;
|
|
220
|
+
if (sl.status === "ok" && sl.entityCount > 0) {
|
|
221
|
+
return { name: "Semantic layer loaded", phase: "Subsystems", status: "PASS" as const, durationMs: 0, detail: `${sl.entityCount} entities` };
|
|
222
|
+
}
|
|
223
|
+
if (sl.status === "ok" && sl.entityCount === 0) {
|
|
224
|
+
return { name: "Semantic layer loaded", phase: "Subsystems", status: "FAIL" as const, durationMs: 0, error: "0 entities found" };
|
|
225
|
+
}
|
|
226
|
+
return { name: "Semantic layer loaded", phase: "Subsystems", status: "FAIL" as const, durationMs: 0, error: sl.error ?? "unavailable" };
|
|
227
|
+
})());
|
|
228
|
+
|
|
229
|
+
// Explore backend
|
|
230
|
+
results.push({
|
|
231
|
+
name: "Explore backend available",
|
|
232
|
+
phase: "Subsystems",
|
|
233
|
+
status: "PASS",
|
|
234
|
+
durationMs: 0,
|
|
235
|
+
detail: health.checks.explore.backend,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
return results;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function checkSimpleQuery(
|
|
242
|
+
target: string,
|
|
243
|
+
headers: Record<string, string>,
|
|
244
|
+
timeoutMs: number,
|
|
245
|
+
providerOk: boolean,
|
|
246
|
+
): Promise<CheckResult> {
|
|
247
|
+
return runCheck("Agent returned valid results", "Simple Query", async () => {
|
|
248
|
+
if (!providerOk) throw new Error("SKIP: Provider unhealthy");
|
|
249
|
+
|
|
250
|
+
const res = await httpPost(
|
|
251
|
+
`${target}/api/v1/query`,
|
|
252
|
+
{ question: "How many rows are in the largest table?" },
|
|
253
|
+
headers,
|
|
254
|
+
timeoutMs,
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
if (res.status !== 200) {
|
|
258
|
+
const errBody = res.body as { error?: string; message?: string };
|
|
259
|
+
throw new Error(`HTTP ${res.status}: ${errBody.message ?? errBody.error ?? "unknown error"}`);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const data = res.body as QueryResponse;
|
|
263
|
+
if (!data.sql || data.sql.length === 0) throw new Error("No SQL generated");
|
|
264
|
+
if (!data.answer) throw new Error("No answer returned");
|
|
265
|
+
|
|
266
|
+
return { detail: `${res.durationMs}ms, ${data.steps} steps, ${data.usage.totalTokens} tokens` };
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
async function checkMultiStepQuery(
|
|
271
|
+
target: string,
|
|
272
|
+
headers: Record<string, string>,
|
|
273
|
+
timeoutMs: number,
|
|
274
|
+
providerOk: boolean,
|
|
275
|
+
): Promise<CheckResult> {
|
|
276
|
+
return runCheck("Agent used multiple steps", "Multi-Step Query", async () => {
|
|
277
|
+
if (!providerOk) throw new Error("SKIP: Provider unhealthy");
|
|
278
|
+
|
|
279
|
+
const res = await httpPost(
|
|
280
|
+
`${target}/api/v1/query`,
|
|
281
|
+
{ question: "What are the top 3 values in the most common text column?" },
|
|
282
|
+
headers,
|
|
283
|
+
timeoutMs,
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
if (res.status !== 200) {
|
|
287
|
+
const errBody = res.body as { error?: string; message?: string };
|
|
288
|
+
throw new Error(`HTTP ${res.status}: ${errBody.message ?? errBody.error ?? "unknown error"}`);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const data = res.body as QueryResponse;
|
|
292
|
+
if (data.steps < 2) throw new Error(`Expected >= 2 steps, got ${data.steps}`);
|
|
293
|
+
|
|
294
|
+
return { detail: `${res.durationMs}ms, ${data.steps} steps, ${data.usage.totalTokens} tokens` };
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function checkIntegrations(health: HealthResponse): CheckResult[] {
|
|
299
|
+
const results: CheckResult[] = [];
|
|
300
|
+
|
|
301
|
+
// Slack
|
|
302
|
+
results.push((() => {
|
|
303
|
+
if (health.checks.slack.mode === "disabled") {
|
|
304
|
+
return { name: "Slack configured", phase: "Integrations", status: "SKIP" as const, durationMs: 0, detail: "not configured" };
|
|
305
|
+
}
|
|
306
|
+
return { name: "Slack configured", phase: "Integrations", status: "PASS" as const, durationMs: 0, detail: health.checks.slack.mode };
|
|
307
|
+
})());
|
|
308
|
+
|
|
309
|
+
// Datasource health
|
|
310
|
+
results.push((() => {
|
|
311
|
+
if (!health.sources || Object.keys(health.sources).length === 0) {
|
|
312
|
+
return { name: "All datasources healthy", phase: "Integrations", status: "SKIP" as const, durationMs: 0, detail: "no sources registered" };
|
|
313
|
+
}
|
|
314
|
+
const sourceCount = Object.keys(health.sources).length;
|
|
315
|
+
const unhealthy = Object.entries(health.sources).filter(([, s]) => s.status === "unhealthy");
|
|
316
|
+
if (unhealthy.length > 0) {
|
|
317
|
+
return { name: "All datasources healthy", phase: "Integrations", status: "FAIL" as const, durationMs: 0, error: `${unhealthy.length}/${sourceCount} unhealthy: ${unhealthy.map(([id]) => id).join(", ")}` };
|
|
318
|
+
}
|
|
319
|
+
return { name: "All datasources healthy", phase: "Integrations", status: "PASS" as const, durationMs: 0, detail: `${sourceCount} source${sourceCount === 1 ? "" : "s"}` };
|
|
320
|
+
})());
|
|
321
|
+
|
|
322
|
+
return results;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
async function checkErrorHandling(
|
|
326
|
+
target: string,
|
|
327
|
+
headers: Record<string, string>,
|
|
328
|
+
timeoutMs: number,
|
|
329
|
+
): Promise<CheckResult> {
|
|
330
|
+
return runCheck("Empty query returns 422", "Error Handling", async () => {
|
|
331
|
+
const res = await httpPost(
|
|
332
|
+
`${target}/api/v1/query`,
|
|
333
|
+
{ question: "" },
|
|
334
|
+
headers,
|
|
335
|
+
timeoutMs,
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
if (res.status === 422) {
|
|
339
|
+
return { detail: `${res.durationMs}ms` };
|
|
340
|
+
}
|
|
341
|
+
if (res.status >= 500) {
|
|
342
|
+
throw new Error(`Expected 422, got ${res.status} (server error — not a structured response)`);
|
|
343
|
+
}
|
|
344
|
+
// 400 is also acceptable for validation errors
|
|
345
|
+
if (res.status === 400) {
|
|
346
|
+
return { detail: `${res.durationMs}ms, HTTP 400` };
|
|
347
|
+
}
|
|
348
|
+
throw new Error(`Expected 422, got HTTP ${res.status}`);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// --- Main entry point ---
|
|
353
|
+
|
|
354
|
+
export async function handleSmoke(args: string[]): Promise<void> {
|
|
355
|
+
const target = (getFlag(args, "--target") ?? process.env.ATLAS_API_URL ?? "http://localhost:3001").replace(/\/$/, "");
|
|
356
|
+
const apiKey = getFlag(args, "--api-key") ?? process.env.ATLAS_API_KEY;
|
|
357
|
+
const timeoutMs = parseInt(getFlag(args, "--timeout") ?? "30000", 10);
|
|
358
|
+
const verbose = args.includes("--verbose");
|
|
359
|
+
const jsonOutput = args.includes("--json");
|
|
360
|
+
|
|
361
|
+
const headers: Record<string, string> = {};
|
|
362
|
+
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
|
|
363
|
+
|
|
364
|
+
if (!jsonOutput) {
|
|
365
|
+
console.log(`\n${BOLD}Atlas Smoke Test${RESET}`);
|
|
366
|
+
console.log("================");
|
|
367
|
+
console.log(`Target: ${target}`);
|
|
368
|
+
console.log(`Auth: ${apiKey ? "API key (set)" : "none"}`);
|
|
369
|
+
console.log(`Timeout: ${timeoutMs}ms`);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const allResults: CheckResult[] = [];
|
|
373
|
+
const totalStart = performance.now();
|
|
374
|
+
|
|
375
|
+
// Phase 1: Connectivity
|
|
376
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 1: Connectivity${RESET}`);
|
|
377
|
+
const { result: connectResult, health } = await checkConnectivity(target, headers, timeoutMs);
|
|
378
|
+
allResults.push(connectResult);
|
|
379
|
+
if (!jsonOutput) printCheck(connectResult, verbose);
|
|
380
|
+
|
|
381
|
+
if (!health) {
|
|
382
|
+
// Can't proceed without health data
|
|
383
|
+
if (!jsonOutput) {
|
|
384
|
+
printResults(allResults, target, !!apiKey, performance.now() - totalStart);
|
|
385
|
+
} else {
|
|
386
|
+
printJsonResults(allResults, target, performance.now() - totalStart);
|
|
387
|
+
}
|
|
388
|
+
process.exit(1);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// Phase 2: Subsystems
|
|
392
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 2: Subsystems${RESET}`);
|
|
393
|
+
const subsystemResults = checkSubsystems(health);
|
|
394
|
+
allResults.push(...subsystemResults);
|
|
395
|
+
if (!jsonOutput) {
|
|
396
|
+
for (const r of subsystemResults) printCheck(r, verbose);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const providerOk = health.checks.provider.status === "ok";
|
|
400
|
+
const dsOk = health.checks.datasource.status === "ok";
|
|
401
|
+
|
|
402
|
+
// Phase 3: Simple Query
|
|
403
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 3: Simple Query${RESET}`);
|
|
404
|
+
const simpleResult = await checkSimpleQuery(target, headers, timeoutMs, providerOk && dsOk);
|
|
405
|
+
allResults.push(simpleResult);
|
|
406
|
+
if (!jsonOutput) printCheck(simpleResult, verbose);
|
|
407
|
+
|
|
408
|
+
// Phase 4: Multi-Step Query
|
|
409
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 4: Multi-Step Query${RESET}`);
|
|
410
|
+
const multiResult = await checkMultiStepQuery(target, headers, timeoutMs, providerOk && dsOk);
|
|
411
|
+
allResults.push(multiResult);
|
|
412
|
+
if (!jsonOutput) printCheck(multiResult, verbose);
|
|
413
|
+
|
|
414
|
+
// Phase 5: Integrations
|
|
415
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 5: Integrations${RESET}`);
|
|
416
|
+
const integrationResults = checkIntegrations(health);
|
|
417
|
+
allResults.push(...integrationResults);
|
|
418
|
+
if (!jsonOutput) {
|
|
419
|
+
for (const r of integrationResults) printCheck(r, verbose);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Phase 6: Error Handling
|
|
423
|
+
if (!jsonOutput) console.log(`\n${BOLD}Phase 6: Error Handling${RESET}`);
|
|
424
|
+
const errorResult = await checkErrorHandling(target, headers, timeoutMs);
|
|
425
|
+
allResults.push(errorResult);
|
|
426
|
+
if (!jsonOutput) printCheck(errorResult, verbose);
|
|
427
|
+
|
|
428
|
+
// Summary
|
|
429
|
+
const totalMs = performance.now() - totalStart;
|
|
430
|
+
if (jsonOutput) {
|
|
431
|
+
printJsonResults(allResults, target, totalMs);
|
|
432
|
+
} else {
|
|
433
|
+
printResults(allResults, target, !!apiKey, totalMs);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
const hasFailed = allResults.some((r) => r.status === "FAIL");
|
|
437
|
+
process.exit(hasFailed ? 1 : 0);
|
|
438
|
+
}
|
|
File without changes
|