@chat-js/cli 0.1.1 → 0.1.3

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.
@@ -8,6 +8,7 @@ import { config } from "@/lib/config";
8
8
  function GoogleIcon({ className }: { className?: string }) {
9
9
  return (
10
10
  <svg className={className} viewBox="0 0 24 24">
11
+ <title>Google</title>
11
12
  <path
12
13
  d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z"
13
14
  fill="#4285F4"
@@ -31,6 +32,7 @@ function GoogleIcon({ className }: { className?: string }) {
31
32
  function VercelIcon({ className }: { className?: string }) {
32
33
  return (
33
34
  <svg className={className} fill="currentColor" viewBox="0 0 24 24">
35
+ <title>Vercel</title>
34
36
  <path d="M12 1L24 22H0L12 1z" />
35
37
  </svg>
36
38
  );
@@ -1,7 +1,6 @@
1
1
  "use client";
2
2
  import type { UseChatHelpers } from "@ai-sdk/react";
3
3
  import { useChatActions, type useChatStoreApi } from "@ai-sdk-tools/store";
4
- import { cn } from "@/lib/utils";
5
4
  import { ArrowUp, Square } from "lucide-react";
6
5
  import {
7
6
  AnimatePresence,
@@ -28,6 +27,7 @@ import {
28
27
  } from "@/components/ui/tooltip";
29
28
  import type { ChatMessage } from "@/lib/ai/types";
30
29
  import type { ArtifactKind } from "@/lib/artifacts/artifact-kind";
30
+ import { cn } from "@/lib/utils";
31
31
  import { useChatInput } from "@/providers/chat-input-provider";
32
32
  import { artifactDefinitions } from "./artifact-panel";
33
33
  import type {
@@ -263,7 +263,6 @@ export const authenticationConfigSchema = z
263
263
  });
264
264
 
265
265
  export const configSchema = z.object({
266
- githubUrl: z.url().default("https://github.com/your-username/your-repo"),
267
266
  appPrefix: z.string().default("chatjs"),
268
267
  appName: z.string().default("My AI Chat"),
269
268
  appTitle: z
@@ -0,0 +1,118 @@
1
+ import { z } from "zod";
2
+
3
+ /**
4
+ * Server environment variable schemas with descriptions.
5
+ *
6
+ * Descriptions are the single source of truth used by:
7
+ * - The CLI env checklist (derived at build time)
8
+ * - The .env.example comments
9
+ *
10
+ * Exported separately from `env.ts` so the CLI can import
11
+ * without triggering `createEnv` runtime validation.
12
+ */
13
+ export const serverEnvSchema = {
14
+ // Required core
15
+ DATABASE_URL: z.string().min(1).describe("Postgres connection string"),
16
+ AUTH_SECRET: z
17
+ .string()
18
+ .min(1)
19
+ .describe("NextAuth.js secret for signing session tokens"),
20
+
21
+ // Optional blob storage (enable in chat.config.ts)
22
+ BLOB_READ_WRITE_TOKEN: z
23
+ .string()
24
+ .optional()
25
+ .describe("Vercel Blob storage token for file uploads"),
26
+
27
+ // Authentication providers (enable in chat.config.ts)
28
+ AUTH_GOOGLE_ID: z.string().optional().describe("Google OAuth client ID"),
29
+ AUTH_GOOGLE_SECRET: z
30
+ .string()
31
+ .optional()
32
+ .describe("Google OAuth client secret"),
33
+ AUTH_GITHUB_ID: z.string().optional().describe("GitHub OAuth app client ID"),
34
+ AUTH_GITHUB_SECRET: z
35
+ .string()
36
+ .optional()
37
+ .describe("GitHub OAuth app client secret"),
38
+ VERCEL_APP_CLIENT_ID: z
39
+ .string()
40
+ .optional()
41
+ .describe("Vercel OAuth integration client ID"),
42
+ VERCEL_APP_CLIENT_SECRET: z
43
+ .string()
44
+ .optional()
45
+ .describe("Vercel OAuth integration client secret"),
46
+
47
+ // AI Gateway keys (one required depending on config.models.gateway)
48
+ AI_GATEWAY_API_KEY: z
49
+ .string()
50
+ .optional()
51
+ .describe("Vercel AI Gateway API key"),
52
+ VERCEL_OIDC_TOKEN: z
53
+ .string()
54
+ .optional()
55
+ .describe("Vercel OIDC token (auto-set on Vercel deployments)"),
56
+ OPENROUTER_API_KEY: z.string().optional().describe("OpenRouter API key"),
57
+ OPENAI_COMPATIBLE_BASE_URL: z
58
+ .string()
59
+ .url()
60
+ .optional()
61
+ .describe("Base URL for OpenAI-compatible provider"),
62
+ OPENAI_COMPATIBLE_API_KEY: z
63
+ .string()
64
+ .optional()
65
+ .describe("API key for OpenAI-compatible provider"),
66
+ OPENAI_API_KEY: z.string().optional().describe("OpenAI API key"),
67
+
68
+ // Optional cleanup cron job secret
69
+ CRON_SECRET: z
70
+ .string()
71
+ .optional()
72
+ .describe("Secret for cleanup cron job endpoint"),
73
+
74
+ // Optional features (enable in chat.config.ts)
75
+ REDIS_URL: z.string().optional().describe("Redis URL for resumable streams"),
76
+ TAVILY_API_KEY: z
77
+ .string()
78
+ .optional()
79
+ .describe("Tavily API key for web search"),
80
+ EXA_API_KEY: z.string().optional().describe("Exa API key for web search"),
81
+ FIRECRAWL_API_KEY: z
82
+ .string()
83
+ .optional()
84
+ .describe("Firecrawl API key for web search and URL retrieval"),
85
+ MCP_ENCRYPTION_KEY: z
86
+ .union([z.string().length(44), z.literal("")])
87
+ .optional()
88
+ .describe("Encryption key for MCP server credentials (base64, 44 chars)"),
89
+
90
+ // Sandbox (for non-Vercel deployments)
91
+ VERCEL_TEAM_ID: z
92
+ .string()
93
+ .optional()
94
+ .describe("Vercel team ID for sandbox (non-Vercel deployments)"),
95
+ VERCEL_PROJECT_ID: z
96
+ .string()
97
+ .optional()
98
+ .describe("Vercel project ID for sandbox (non-Vercel deployments)"),
99
+ VERCEL_TOKEN: z
100
+ .string()
101
+ .optional()
102
+ .describe("Vercel API token for sandbox (non-Vercel deployments)"),
103
+ VERCEL_SANDBOX_RUNTIME: z
104
+ .string()
105
+ .optional()
106
+ .describe("Vercel sandbox runtime identifier"),
107
+
108
+ // App URL (for non-Vercel deployments) - full URL including https://
109
+ APP_URL: z
110
+ .url()
111
+ .optional()
112
+ .describe(
113
+ "App URL for non-Vercel deployments (full URL including https://)"
114
+ ),
115
+
116
+ // Vercel platform (auto-set by Vercel)
117
+ VERCEL_URL: z.string().optional().describe("Auto-set by Vercel platform"),
118
+ };
@@ -1,55 +1,8 @@
1
1
  import { createEnv } from "@t3-oss/env-nextjs";
2
- import { z } from "zod";
2
+ import { serverEnvSchema } from "./env-schema";
3
3
 
4
4
  export const env = createEnv({
5
- server: {
6
- // Required core
7
- DATABASE_URL: z.string().min(1),
8
- AUTH_SECRET: z.string().min(1),
9
-
10
- // Optional blob storage (enable in chat.config.ts)
11
- BLOB_READ_WRITE_TOKEN: z.string().optional(),
12
-
13
- // Authentication providers (enable in chat.config.ts)
14
- AUTH_GOOGLE_ID: z.string().optional(),
15
- AUTH_GOOGLE_SECRET: z.string().optional(),
16
- AUTH_GITHUB_ID: z.string().optional(),
17
- AUTH_GITHUB_SECRET: z.string().optional(),
18
- VERCEL_APP_CLIENT_ID: z.string().optional(),
19
- VERCEL_APP_CLIENT_SECRET: z.string().optional(),
20
-
21
- // AI Gateway keys (one required depending on config.models.gateway)
22
- AI_GATEWAY_API_KEY: z.string().optional(),
23
- VERCEL_OIDC_TOKEN: z.string().optional(),
24
- OPENROUTER_API_KEY: z.string().optional(),
25
- OPENAI_COMPATIBLE_BASE_URL: z.string().url().optional(),
26
- OPENAI_COMPATIBLE_API_KEY: z.string().optional(),
27
- OPENAI_API_KEY: z.string().optional(),
28
-
29
- // Optional cleanup cron job secret
30
- CRON_SECRET: z.string().optional(),
31
-
32
- // Optional features (enable in chat.config.ts)
33
- REDIS_URL: z.string().optional(),
34
- TAVILY_API_KEY: z.string().optional(),
35
- EXA_API_KEY: z.string().optional(),
36
- FIRECRAWL_API_KEY: z.string().optional(),
37
- MCP_ENCRYPTION_KEY: z
38
- .union([z.string().length(44), z.literal("")])
39
- .optional(),
40
-
41
- // Sandbox (for non-Vercel deployments)
42
- VERCEL_TEAM_ID: z.string().optional(),
43
- VERCEL_PROJECT_ID: z.string().optional(),
44
- VERCEL_TOKEN: z.string().optional(),
45
- VERCEL_SANDBOX_RUNTIME: z.string().optional(),
46
-
47
- // App URL (for non-Vercel deployments) - full URL including https://
48
- APP_URL: z.string().url().optional(),
49
-
50
- // Vercel platform (auto-set by Vercel)
51
- VERCEL_URL: z.string().optional(),
52
- },
5
+ server: serverEnvSchema,
53
6
  client: {},
54
7
  experimental__runtimeEnv: {},
55
8
  });
@@ -114,7 +114,7 @@
114
114
  "date-fns": "^4.1.0",
115
115
  "diff": "^8.0.2",
116
116
  "dotenv": "^17.2.3",
117
- "drizzle-orm": "^0.34.0",
117
+ "drizzle-orm": "^0.45.1",
118
118
  "echarts-for-react": "^3.0.2",
119
119
  "fast-deep-equal": "^3.1.3",
120
120
  "js-tiktoken": "^1.0.19",
@@ -155,22 +155,27 @@
155
155
  "zustand": "^5.0.6"
156
156
  },
157
157
  "overrides": {
158
- "commander": "^14.0.0"
158
+ "commander": "^14.0.0",
159
+ "evalite": {
160
+ "ai": "$ai",
161
+ "better-sqlite3": "$better-sqlite3"
162
+ }
159
163
  },
160
164
  "devDependencies": {
165
+ "@biomejs/biome": "^2.2.4",
161
166
  "@playwright/test": "^1.50.1",
162
- "@tailwindcss/postcss": "^4.1.12",
167
+ "@tailwindcss/postcss": "^4.1.12",
163
168
  "@tailwindcss/typography": "^0.5.19",
164
169
  "@types/node": "^22.8.6",
165
170
  "@types/papaparse": "^5.3.15",
166
171
  "@types/react": "19.2.7",
167
172
  "@types/react-dom": "19.2.3",
168
173
  "better-sqlite3": "^12.4.1",
169
- "drizzle-kit": "^0.25.0",
174
+ "drizzle-kit": "^0.31.9",
170
175
  "evalite": "1.0.0-beta.8",
171
176
  "pino-pretty": "^13.1.1",
172
177
  "postcss": "^8",
173
- "tailwindcss": "^4.1.12",
178
+ "tailwindcss": "^4.1.12",
174
179
  "tsx": "^4.19.1",
175
180
  "tw-animate-css": "^1.3.7",
176
181
  "typescript": "5.8.3",
@@ -40,16 +40,14 @@ function validateFeatures(env: NodeJS.ProcessEnv): ValidationError[] {
40
40
  errors.push(gatewayError);
41
41
  }
42
42
 
43
- const featureEntries = Object.entries(featureEnvRequirements) as Array<
44
- [
45
- keyof typeof featureEnvRequirements,
46
- NonNullable<
47
- (typeof featureEnvRequirements)[keyof typeof featureEnvRequirements]
48
- >,
49
- ]
50
- >;
43
+ const featureEntries = Object.entries(featureEnvRequirements) as [
44
+ keyof typeof featureEnvRequirements,
45
+ NonNullable<
46
+ (typeof featureEnvRequirements)[keyof typeof featureEnvRequirements]
47
+ >,
48
+ ][];
51
49
  for (const [feature, requirement] of featureEntries) {
52
- if (!requirement || !config.features[feature]) {
50
+ if (!(requirement && config.features[feature])) {
53
51
  continue;
54
52
  }
55
53
  const missing = getMissingRequirement(requirement, env);
@@ -77,7 +75,10 @@ function validateAuthentication(env: NodeJS.ProcessEnv): ValidationError[] {
77
75
  const requirement = authEnvRequirements[provider];
78
76
  const missing = getMissingRequirement(requirement, env);
79
77
  if (missing) {
80
- errors.push({ feature: `authentication.${provider}`, missing: [missing] });
78
+ errors.push({
79
+ feature: `authentication.${provider}`,
80
+ missing: [missing],
81
+ });
81
82
  }
82
83
  }
83
84