@codapult/cli 0.16.2 → 0.17.0

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 CHANGED
@@ -147,8 +147,8 @@ Resources are read-only project files or computed context that MCP clients can l
147
147
  | Resource | URI | Description |
148
148
  | ----------------------- | ------------------------------ | --------------------------------------------------------------------------------- |
149
149
  | `codapult_schema` | `codapult://schema` | Active Drizzle schema selected by the database provider. |
150
- | `codapult_app_config` | `codapult://config/app` | Application identity, brand, and AI configuration. |
151
- | `codapult_env_config` | `codapult://config/env` | Typed environment access, feature flags, providers, and checkout resolution. |
150
+ | `codapult_app_config` | `codapult://config/app` | Application identity, brand, and company configuration. |
151
+ | `codapult_env_config` | `codapult://config/env` | Typed environment access, AI feature flags, providers, and checkout resolution. |
152
152
  | `codapult_agents_md` | `codapult://agents` | Project structure, conventions, and AI-agent rules from `AGENTS.md`. |
153
153
  | `codapult_env_example` | `codapult://env-example` | Environment variable template with descriptions and defaults. |
154
154
  | `codapult_validation` | `codapult://validation` | Project Zod validation schemas. |
@@ -42,16 +42,6 @@ export function configShowCommand(options = {}) {
42
42
  if (githubUrl)
43
43
  label(' GitHub', githubUrl);
44
44
  console.log();
45
- info('AI');
46
- const { defaultModel, ragEnabled, ragMaxChunks, ragMinScore } = appConfig.ai;
47
- if (defaultModel)
48
- label(' Default model', defaultModel);
49
- if (ragEnabled != null)
50
- label(' RAG', ragEnabled ? 'enabled' : 'disabled');
51
- if (ragMaxChunks)
52
- label(' RAG max chunks', ragMaxChunks);
53
- if (ragMinScore)
54
- label(' RAG min score', ragMinScore);
55
45
  }
56
46
  else {
57
47
  dim('src/config/app.ts not found — run `codapult setup`');
@@ -26,6 +26,9 @@ const BUILT_IN_PRESETS = {
26
26
  ssoProvider: 'none',
27
27
  enableAuth: false,
28
28
  enableAI: false,
29
+ enableAgents: false,
30
+ enableBatch: false,
31
+ enablePlayground: false,
29
32
  enableTeams: false,
30
33
  enableConnect: false,
31
34
  enableSSO: false,
@@ -68,6 +71,9 @@ const DEFAULT_CONFIG = {
68
71
  jobProvider: 'memory',
69
72
  enableAuth: true,
70
73
  enableAI: true,
74
+ enableAgents: true,
75
+ enableBatch: true,
76
+ enablePlayground: true,
71
77
  enableBlog: true,
72
78
  enableTeams: true,
73
79
  enableWaitlist: true,
@@ -87,7 +93,7 @@ const DEFAULT_CONFIG = {
87
93
  enableReferrals: true,
88
94
  enableAnalytics: true,
89
95
  enableChangelog: true,
90
- enableRAG: true,
96
+ enableRAG: false,
91
97
  enableWebhooks: true,
92
98
  enableAuditLog: true,
93
99
  enableReports: true,
@@ -133,6 +139,12 @@ function resolvePreset(raw) {
133
139
  if (config.authProvider === 'none') {
134
140
  config.enableAuth = false;
135
141
  }
142
+ if (!config.enableAI) {
143
+ config.enableRAG = false;
144
+ config.enableAgents = false;
145
+ config.enableBatch = false;
146
+ config.enablePlayground = false;
147
+ }
136
148
  return config;
137
149
  }
138
150
  // All app-router paths are under `src/app/[locale]/...` (next-intl).
@@ -165,13 +177,40 @@ const MODULE_REMOVALS = [
165
177
  {
166
178
  key: 'enableAI',
167
179
  paths: [
168
- `${APP}/(protected)/(dashboard)/dashboard/ai-chat`,
169
- 'src/app/api/chat',
180
+ `${APP}/(protected)/(dashboard)/dashboard/ai`,
170
181
  'src/components/ai',
182
+ 'src/hooks/ai',
171
183
  'src/lib/ai',
184
+ 'src/app/api/ai',
172
185
  ],
173
186
  label: 'AI Chat',
174
187
  },
188
+ {
189
+ key: 'enableAgents',
190
+ paths: [
191
+ `${APP}/(protected)/(dashboard)/dashboard/ai/agents`,
192
+ 'src/components/ai/AgentBuilder.tsx',
193
+ 'src/components/ai/AgentSelector.tsx',
194
+ ],
195
+ label: 'AI Agents',
196
+ },
197
+ {
198
+ key: 'enableBatch',
199
+ paths: [
200
+ `${APP}/(protected)/(dashboard)/dashboard/ai/batch`,
201
+ 'src/components/ai/BatchJobManager.tsx',
202
+ ],
203
+ label: 'AI Batch',
204
+ },
205
+ {
206
+ key: 'enablePlayground',
207
+ paths: [
208
+ `${APP}/(protected)/(dashboard)/dashboard/ai/playground`,
209
+ 'src/components/ai/AIPlayground.tsx',
210
+ 'src/components/ai/PlaygroundComparison.tsx',
211
+ ],
212
+ label: 'AI Playground',
213
+ },
175
214
  {
176
215
  key: 'enableBlog',
177
216
  paths: [
@@ -361,18 +400,6 @@ const MODULE_REMOVALS = [
361
400
  ],
362
401
  label: 'Built-in Analytics',
363
402
  },
364
- {
365
- key: 'enableRAG',
366
- paths: [
367
- 'src/lib/ai/chunker.ts',
368
- 'src/lib/ai/chunker.test.ts',
369
- 'src/lib/ai/embeddings',
370
- 'src/lib/ai/vector-store',
371
- 'src/lib/ai/rag.ts',
372
- 'src/app/api/ai',
373
- ],
374
- label: 'RAG Pipeline',
375
- },
376
403
  {
377
404
  key: 'enableWebhooks',
378
405
  paths: [
@@ -450,7 +477,7 @@ const MODULE_REMOVALS = [
450
477
  // everything else is removed from disk by `removeModules`.
451
478
  //
452
479
  // Install-time-only features (no runtime ENABLE_* — file removal only):
453
- // enableGraphQL, enableEventStore, enableOtel, enableRAG, enableConnect.
480
+ // enableGraphQL, enableEventStore, enableOtel, enableConnect.
454
481
  // These are infrastructure-flavoured and either always-on or only meaningful
455
482
  // at build-time, so they don't expose a user-facing env toggle.
456
483
  const FEATURE_ENV_VARS = {
@@ -461,7 +488,11 @@ const FEATURE_ENV_VARS = {
461
488
  enableWaitlist: 'ENABLE_WAITLIST',
462
489
  enableFeatureRequests: 'ENABLE_FEATURE_REQUESTS',
463
490
  enableCompare: 'ENABLE_COMPARE',
464
- enableAI: 'ENABLE_AI_CHAT',
491
+ enableAI: 'ENABLE_AI_CORE',
492
+ enableRAG: 'ENABLE_AI_RAG',
493
+ enableAgents: 'ENABLE_AI_AGENTS',
494
+ enableBatch: 'ENABLE_AI_BATCH',
495
+ enablePlayground: 'ENABLE_AI_PLAYGROUND',
465
496
  enableTeams: 'ENABLE_TEAMS',
466
497
  enableReferrals: 'ENABLE_REFERRALS',
467
498
  enableAnalytics: 'ENABLE_ANALYTICS',
@@ -510,10 +541,17 @@ function generateEnvFile(root, config) {
510
541
  JOB_PROVIDER: config.jobProvider,
511
542
  };
512
543
  for (const [cliKey, envVar] of Object.entries(FEATURE_ENV_VARS)) {
513
- if (config[cliKey] === false) {
544
+ const key = cliKey;
545
+ const enabled = config[key];
546
+ if (!enabled)
514
547
  replacements[envVar] = 'false';
515
- }
548
+ if (key === 'enableRAG' && enabled)
549
+ replacements[envVar] = 'true';
516
550
  }
551
+ // The setup command treats AI as a product bundle. Keep chat enabled by
552
+ // default for that bundle, while allowing users to disable it manually
553
+ // after setup without disabling the shared AI core.
554
+ replacements.ENABLE_AI_CHAT = config.enableAI ? 'true' : 'false';
517
555
  for (const [key, value] of Object.entries(replacements)) {
518
556
  const regex = new RegExp(`^${key}=.*$`, 'm');
519
557
  if (regex.test(content)) {
@@ -689,7 +727,7 @@ async function interactiveSetup() {
689
727
  ]),
690
728
  enableAuth: authEnabled,
691
729
  enableSSO: ssoEnabled,
692
- enableAI: emptyLine() && (await confirm(iface, 'Enable AI Chat module?')),
730
+ enableAI: emptyLine() && (await confirm(iface, 'Enable AI core and chat module?')),
693
731
  enableBlog: await confirm(iface, 'Enable Blog module?'),
694
732
  enableTeams: authEnabled && (await confirm(iface, 'Enable Teams/Organizations?')),
695
733
  enableWaitlist: await confirm(iface, 'Enable Waitlist page?'),
@@ -708,7 +746,10 @@ async function interactiveSetup() {
708
746
  enableReferrals: authEnabled && (await confirm(iface, 'Enable referral program?')),
709
747
  enableAnalytics: await confirm(iface, 'Enable built-in analytics?'),
710
748
  enableChangelog: await confirm(iface, 'Enable Changelog page?'),
711
- enableRAG: await confirm(iface, 'Enable RAG pipeline (vector search)?'),
749
+ enableRAG: await confirm(iface, 'Enable RAG pipeline (vector search)?', false),
750
+ enableAgents: await confirm(iface, 'Enable AI agents and tools?', true),
751
+ enableBatch: await confirm(iface, 'Enable AI batch processing?', true),
752
+ enablePlayground: await confirm(iface, 'Enable AI playground?', true),
712
753
  enableWebhooks: authEnabled && (await confirm(iface, 'Enable outgoing webhooks?')),
713
754
  enableAuditLog: authEnabled && (await confirm(iface, 'Enable audit log / activity feed?')),
714
755
  enableReports: authEnabled && (await confirm(iface, 'Enable scheduled email reports?')),
@@ -52,7 +52,10 @@ Codapult conventions:
52
52
  - Error responses: always \`{ error: string }\`, never expose stack traces
53
53
  - Database: Drizzle ORM, snake_case tables/columns, text PKs, integer timestamps
54
54
  - Class merging: use \`cn()\` from \`@/lib/utils\`
55
- - AI: embedding/vector store use adapter pattern, RAG config from appConfig.ai
55
+ - AI: use the shared /api/ai gateway for chat, agents, tools, guardrails, metering, and streaming
56
+ - RAG: use the adapter pattern for embeddings/vector storage; it is opt-in via env.features.aiRag, requires env.features.aiCore, and all indexed data must be scoped to the active organization
57
+ - RAG indexing/search limits come from env (AI_RAG_MAX_DOCUMENT_SIZE, AI_RAG_MAX_BATCH_DOCUMENTS, AI_RAG_MAX_CHUNKS_PER_QUERY, AI_RAG_MIN_SCORE)
58
+ - AI defaults come from env (AI_DEFAULT_MODEL, AI_DEFAULT_TEMPERATURE, AI_DEFAULT_MAX_TOKENS, AI_DEFAULT_TOP_P, AI_MAX_RETRIES)
56
59
  - Org quotas: enforce via checkOrgQuota() for AI and API routes${projectContext}
57
60
 
58
61
  Code to review:
@@ -25,7 +25,7 @@ export function registerResources(server) {
25
25
  });
26
26
  server.registerResource('codapult_app_config', 'codapult://config/app', {
27
27
  title: 'App Configuration',
28
- description: `Application config (src/config/app.ts) — brand, AI, company. Feature toggles and auth methods live in src/config/env.ts — see codapult://config/env.`,
28
+ description: `Application config (src/config/app.ts) — brand and company. AI runtime settings, feature toggles, and auth methods live in src/config/env.ts — see codapult://config/env.`,
29
29
  mimeType: 'text/plain',
30
30
  }, () => {
31
31
  const content = readProjectFile(getRoot(), 'src/config/app.ts') ?? 'Config file not found';
@@ -47,7 +47,7 @@ export function registerPluginTools(server) {
47
47
  title: 'Add Plugin',
48
48
  description: 'Install a Codapult plugin by name. Patches schema, config, pages, and env automatically.',
49
49
  inputSchema: {
50
- name: z.string().describe('Plugin name (e.g. "ai-kit", "video-player")'),
50
+ name: z.string().describe('Plugin name (e.g. "crm", "video-player")'),
51
51
  env_source: envSourceSchema.optional(),
52
52
  dry_run: z
53
53
  .boolean()
@@ -64,7 +64,7 @@ export function registerProjectTools(server) {
64
64
  });
65
65
  server.registerTool('codapult_project_config', {
66
66
  title: 'Project Config',
67
- description: 'Read the app configuration from src/config/app.ts (brand, ai, company)',
67
+ description: 'Read the app configuration from src/config/app.ts (brand, company)',
68
68
  }, () => {
69
69
  const root = getRoot();
70
70
  const content = readProjectFile(root, 'src/config/app.ts') ?? 'Config file not found';
@@ -77,7 +77,7 @@ describe('registerProjectTools', () => {
77
77
  ].join('\n'),
78
78
  });
79
79
  mockedExists.mockReturnValue(true);
80
- mockedReaddir.mockReturnValue(['ai-kit.ts', 'crm.ts', 'index.ts']);
80
+ mockedReaddir.mockReturnValue(['analytics.ts', 'crm.ts', 'index.ts']);
81
81
  mockedExec.mockImplementation((cmd) => {
82
82
  if (cmd.includes('branch'))
83
83
  return Buffer.from('main');
@@ -96,7 +96,7 @@ describe('registerProjectTools', () => {
96
96
  expect(parsed.adapters.embedding).toBe('openai');
97
97
  expect(parsed.adapters.vectorStore).toBe('sqlite');
98
98
  expect(parsed.oauthProviders).toEqual(['google']);
99
- expect(parsed.plugins).toEqual(['ai-kit', 'crm']);
99
+ expect(parsed.plugins).toEqual(['analytics', 'crm']);
100
100
  expect(parsed.features.enabled).toContain('aiChat');
101
101
  expect(parsed.features.enabled).toContain('blog');
102
102
  expect(parsed.features.disabled).toContain('teams');
@@ -1,12 +1,6 @@
1
1
  export interface AppConfigSummary {
2
2
  brand: Record<string, string>;
3
3
  company: Record<string, string>;
4
- ai: {
5
- defaultModel?: string;
6
- ragEnabled?: boolean;
7
- ragMaxChunks?: string;
8
- ragMinScore?: string;
9
- };
10
4
  }
11
5
  /** Read the stable, displayable subset of app.ts for both CLI and MCP clients. */
12
6
  export declare function collectAppConfigSummary(root: string): AppConfigSummary | undefined;
@@ -3,13 +3,6 @@ function stringField(content, field) {
3
3
  const quotes = '[\'"` ]'.replace(' ', '');
4
4
  return new RegExp('\\b' + field + '\\s*:\\s*' + quotes + '([^\'"`]+)' + quotes).exec(content)?.[1];
5
5
  }
6
- function numberField(content, field) {
7
- return new RegExp(`\\b${field}\\s*:\\s*([\\d.]+)`).exec(content)?.[1];
8
- }
9
- function booleanField(content, field) {
10
- const value = new RegExp(`\\b${field}\\s*:\\s*(true|false)`).exec(content)?.[1];
11
- return value === undefined ? undefined : value === 'true';
12
- }
13
6
  function strings(content, fields) {
14
7
  return Object.fromEntries(fields.flatMap((field) => {
15
8
  const value = stringField(content, field);
@@ -21,21 +14,8 @@ export function collectAppConfigSummary(root) {
21
14
  const content = readProjectFile(root, 'src/config/app.ts');
22
15
  if (!content)
23
16
  return undefined;
24
- const ai = { defaultModel: stringField(content, 'defaultModel') };
25
- const ragEnabled = booleanField(content, 'ragEnabled');
26
- const ragMaxChunks = numberField(content, 'ragMaxChunks');
27
- const ragMinScore = numberField(content, 'ragMinScore');
28
- if (ai.defaultModel === undefined)
29
- delete ai.defaultModel;
30
- if (ragEnabled !== undefined)
31
- ai.ragEnabled = ragEnabled;
32
- if (ragMaxChunks !== undefined)
33
- ai.ragMaxChunks = ragMaxChunks;
34
- if (ragMinScore !== undefined)
35
- ai.ragMinScore = ragMinScore;
36
17
  return {
37
18
  brand: strings(content, ['name', 'description', 'logo', 'favicon']),
38
19
  company: strings(content, ['contactEmail', 'githubUrl']),
39
- ai,
40
20
  };
41
21
  }
@@ -8,13 +8,11 @@ describe('collectAppConfigSummary', () => {
8
8
  export const appConfig = {
9
9
  brand: { name: 'Codapult', description: 'Starter', logo: '/logo.svg' },
10
10
  company: { contactEmail: 'hello@example.com', githubUrl: 'https://github.com/codapult' },
11
- ai: { defaultModel: 'gpt-5', ragEnabled: true, ragMaxChunks: 12, ragMinScore: 0.4 },
12
11
  };
13
12
  `);
14
13
  expect(collectAppConfigSummary('/project')).toEqual({
15
14
  brand: { name: 'Codapult', description: 'Starter', logo: '/logo.svg' },
16
15
  company: { contactEmail: 'hello@example.com', githubUrl: 'https://github.com/codapult' },
17
- ai: { defaultModel: 'gpt-5', ragEnabled: true, ragMaxChunks: '12', ragMinScore: '0.4' },
18
16
  });
19
17
  });
20
18
  });
@@ -26,7 +26,12 @@ export declare const FEATURE_ENV: {
26
26
  readonly waitlist: 'ENABLE_WAITLIST';
27
27
  readonly featureRequests: 'ENABLE_FEATURE_REQUESTS';
28
28
  readonly changelog: 'ENABLE_CHANGELOG';
29
+ readonly aiCore: 'ENABLE_AI_CORE';
29
30
  readonly aiChat: 'ENABLE_AI_CHAT';
31
+ readonly aiRag: 'ENABLE_AI_RAG';
32
+ readonly aiAgents: 'ENABLE_AI_AGENTS';
33
+ readonly aiBatch: 'ENABLE_AI_BATCH';
34
+ readonly aiPlayground: 'ENABLE_AI_PLAYGROUND';
30
35
  readonly teams: 'ENABLE_TEAMS';
31
36
  readonly referrals: 'ENABLE_REFERRALS';
32
37
  readonly analytics: 'ENABLE_ANALYTICS';
@@ -47,7 +52,7 @@ export declare const FEATURE_ENV: {
47
52
  * the template therefore produces an actionable doctor warning until the CLI
48
53
  * mirror is reviewed.
49
54
  */
50
- export declare const ENV_SCHEMA_KEYS: readonly ["NEXT_PUBLIC_APP_URL", "NEXT_PUBLIC_APP_NAME", "APP_MODE", "DEMO_URL", "LOG_LEVEL", "DB_PROVIDER", "AUTH_PROVIDER", "PAYMENT_PROVIDER", "STORAGE_PROVIDER", "JOB_PROVIDER", "SSO_PROVIDER", "NOTIFICATION_TRANSPORT", "EMBEDDING_PROVIDER", "VECTOR_STORE_PROVIDER", "SUPPORT_PROVIDER", "TURSO_DATABASE_URL", "TURSO_AUTH_TOKEN", "DATABASE_URL", "ENABLE_TWO_FACTOR", "AUTH_MAGIC_LINK", "AUTH_PASSKEYS", "BETTER_AUTH_SECRET", "BETTER_AUTH_URL", "KINDE_CLIENT_ID", "KINDE_CLIENT_SECRET", "KINDE_ISSUER_URL", "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", "GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET", "APPLE_CLIENT_ID", "APPLE_CLIENT_SECRET", "DISCORD_CLIENT_ID", "DISCORD_CLIENT_SECRET", "TWITTER_CLIENT_ID", "TWITTER_CLIENT_SECRET", "MICROSOFT_CLIENT_ID", "MICROSOFT_CLIENT_SECRET", "STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "STRIPE_CONNECT_FEE_PERCENT", "STRIPE_CONNECT_ONBOARDING_RETURN_URL", "STRIPE_CONNECT_ONBOARDING_REFRESH_URL", "LEMONSQUEEZY_API_KEY", "LEMONSQUEEZY_STORE_ID", "LEMONSQUEEZY_WEBHOOK_SECRET", "POLAR_ACCESS_TOKEN", "POLAR_WEBHOOK_SECRET", "S3_BUCKET", "S3_REGION", "S3_ENDPOINT", "S3_ACCESS_KEY_ID", "S3_SECRET_ACCESS_KEY", "S3_PUBLIC_URL", "JOB_QUEUE_NAME", "REDIS_URL", "CODAPULT_WORKER_MODE", "CODAPULT_DISABLE_IN_PROCESS_JOBS", "CUSTOM_DOMAIN_CNAME_TARGET", "REFERRAL_REWARD_AMOUNT", "REFERRAL_REWARD_TYPE", "SSO_PRODUCT", "SSO_DB_ENGINE", "SSO_DB_TYPE", "SSO_DB_URL", "NOTIFICATION_WS_URL", "NOTIFICATION_WS_PORT", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OLLAMA_BASE_URL", "OLLAMA_EMBEDDING_MODEL", "RESEND_API_KEY", "EMAIL_FROM", "CRISP_WEBSITE_ID", "INTERCOM_APP_ID", "DEFAULT_MONTHLY_CREDITS", "OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_SERVICE_NAME", "OTEL_TRACES_SAMPLE_RATE", "OTEL_EXPORTER_OTLP_HEADERS", "POSTHOG_TOKEN", "POSTHOG_HOST", "POSTHOG_UI_HOST", ...("ENABLE_AI_CHAT" | "ENABLE_ANALYTICS" | "ENABLE_API_DOCS" | "ENABLE_AUDIT_LOG" | "ENABLE_BLOG" | "ENABLE_BRANDING" | "ENABLE_CHANGELOG" | "ENABLE_COMPARE" | "ENABLE_DRIP_CAMPAIGNS" | "ENABLE_EXPERIMENTS" | "ENABLE_FEATURE_REQUESTS" | "ENABLE_HELP_CENTER" | "ENABLE_ONBOARDING" | "ENABLE_PLUGINS" | "ENABLE_REFERRALS" | "ENABLE_REPORTS" | "ENABLE_TEAMS" | "ENABLE_WAITLIST" | "ENABLE_WEBHOOKS" | "ENABLE_WORKFLOWS")[]];
55
+ export declare const ENV_SCHEMA_KEYS: readonly ["NEXT_PUBLIC_APP_URL", "NEXT_PUBLIC_APP_NAME", "APP_MODE", "DEMO_URL", "LOG_LEVEL", "DB_PROVIDER", "AUTH_PROVIDER", "PAYMENT_PROVIDER", "STORAGE_PROVIDER", "JOB_PROVIDER", "SSO_PROVIDER", "NOTIFICATION_TRANSPORT", "EMBEDDING_PROVIDER", "VECTOR_STORE_PROVIDER", "SUPPORT_PROVIDER", "TURSO_DATABASE_URL", "TURSO_AUTH_TOKEN", "DATABASE_URL", "ENABLE_TWO_FACTOR", "AUTH_MAGIC_LINK", "AUTH_PASSKEYS", "BETTER_AUTH_SECRET", "BETTER_AUTH_URL", "KINDE_CLIENT_ID", "KINDE_CLIENT_SECRET", "KINDE_ISSUER_URL", "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", "GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET", "APPLE_CLIENT_ID", "APPLE_CLIENT_SECRET", "DISCORD_CLIENT_ID", "DISCORD_CLIENT_SECRET", "TWITTER_CLIENT_ID", "TWITTER_CLIENT_SECRET", "MICROSOFT_CLIENT_ID", "MICROSOFT_CLIENT_SECRET", "STRIPE_SECRET_KEY", "STRIPE_WEBHOOK_SECRET", "STRIPE_CONNECT_FEE_PERCENT", "STRIPE_CONNECT_ONBOARDING_RETURN_URL", "STRIPE_CONNECT_ONBOARDING_REFRESH_URL", "LEMONSQUEEZY_API_KEY", "LEMONSQUEEZY_STORE_ID", "LEMONSQUEEZY_WEBHOOK_SECRET", "POLAR_ACCESS_TOKEN", "POLAR_WEBHOOK_SECRET", "S3_BUCKET", "S3_REGION", "S3_ENDPOINT", "S3_ACCESS_KEY_ID", "S3_SECRET_ACCESS_KEY", "S3_PUBLIC_URL", "JOB_QUEUE_NAME", "REDIS_URL", "CODAPULT_WORKER_MODE", "CODAPULT_DISABLE_IN_PROCESS_JOBS", "CUSTOM_DOMAIN_CNAME_TARGET", "REFERRAL_REWARD_AMOUNT", "REFERRAL_REWARD_TYPE", "SSO_PRODUCT", "SSO_DB_ENGINE", "SSO_DB_TYPE", "SSO_DB_URL", "NOTIFICATION_WS_URL", "NOTIFICATION_WS_PORT", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "GOOGLE_GENERATIVE_AI_API_KEY", "GROQ_API_KEY", "TOGETHER_AI_API_KEY", "CUSTOM_AI_BASE_URL", "CUSTOM_AI_API_KEY", "SERPER_API_KEY", "TAVILY_API_KEY", "AI_DEFAULT_MODEL", "AI_ALLOWED_MODELS", "AI_FALLBACK_CHAIN", "AI_MAX_RETRIES", "AI_DEFAULT_TEMPERATURE", "AI_DEFAULT_MAX_TOKENS", "AI_DEFAULT_TOP_P", "AI_DAILY_BUDGET_USD", "AI_MONTHLY_BUDGET_USD", "AI_HTTP_ALLOWLIST", "AI_RAG_MAX_DOCUMENT_SIZE", "AI_RAG_MAX_BATCH_DOCUMENTS", "AI_RAG_MAX_CHUNKS_PER_QUERY", "AI_RAG_MIN_SCORE", "OLLAMA_BASE_URL", "OLLAMA_EMBEDDING_MODEL", "RESEND_API_KEY", "EMAIL_FROM", "CRISP_WEBSITE_ID", "INTERCOM_APP_ID", "DEFAULT_MONTHLY_CREDITS", "OTEL_EXPORTER_OTLP_ENDPOINT", "OTEL_SERVICE_NAME", "OTEL_TRACES_SAMPLE_RATE", "OTEL_EXPORTER_OTLP_HEADERS", "POSTHOG_TOKEN", "POSTHOG_HOST", "POSTHOG_UI_HOST", ...("ENABLE_AI_AGENTS" | "ENABLE_AI_BATCH" | "ENABLE_AI_CHAT" | "ENABLE_AI_CORE" | "ENABLE_AI_PLAYGROUND" | "ENABLE_AI_RAG" | "ENABLE_ANALYTICS" | "ENABLE_API_DOCS" | "ENABLE_AUDIT_LOG" | "ENABLE_BLOG" | "ENABLE_BRANDING" | "ENABLE_CHANGELOG" | "ENABLE_COMPARE" | "ENABLE_DRIP_CAMPAIGNS" | "ENABLE_EXPERIMENTS" | "ENABLE_FEATURE_REQUESTS" | "ENABLE_HELP_CENTER" | "ENABLE_ONBOARDING" | "ENABLE_PLUGINS" | "ENABLE_REFERRALS" | "ENABLE_REPORTS" | "ENABLE_TEAMS" | "ENABLE_WAITLIST" | "ENABLE_WEBHOOKS" | "ENABLE_WORKFLOWS")[]];
51
56
  /** Auth-gated features: when AUTH_PROVIDER=none, these are forced off. */
52
57
  export declare const AUTH_GATED_FEATURES: ReadonlySet<string>;
53
58
  /** OAuth provider → [client id env, client secret env]. Mirrors oauth-providers.ts. */
@@ -16,7 +16,12 @@ export const FEATURE_ENV = {
16
16
  waitlist: 'ENABLE_WAITLIST',
17
17
  featureRequests: 'ENABLE_FEATURE_REQUESTS',
18
18
  changelog: 'ENABLE_CHANGELOG',
19
+ aiCore: 'ENABLE_AI_CORE',
19
20
  aiChat: 'ENABLE_AI_CHAT',
21
+ aiRag: 'ENABLE_AI_RAG',
22
+ aiAgents: 'ENABLE_AI_AGENTS',
23
+ aiBatch: 'ENABLE_AI_BATCH',
24
+ aiPlayground: 'ENABLE_AI_PLAYGROUND',
20
25
  teams: 'ENABLE_TEAMS',
21
26
  referrals: 'ENABLE_REFERRALS',
22
27
  analytics: 'ENABLE_ANALYTICS',
@@ -107,6 +112,27 @@ export const ENV_SCHEMA_KEYS = [
107
112
  'NOTIFICATION_WS_PORT',
108
113
  'OPENAI_API_KEY',
109
114
  'ANTHROPIC_API_KEY',
115
+ 'GOOGLE_GENERATIVE_AI_API_KEY',
116
+ 'GROQ_API_KEY',
117
+ 'TOGETHER_AI_API_KEY',
118
+ 'CUSTOM_AI_BASE_URL',
119
+ 'CUSTOM_AI_API_KEY',
120
+ 'SERPER_API_KEY',
121
+ 'TAVILY_API_KEY',
122
+ 'AI_DEFAULT_MODEL',
123
+ 'AI_ALLOWED_MODELS',
124
+ 'AI_FALLBACK_CHAIN',
125
+ 'AI_MAX_RETRIES',
126
+ 'AI_DEFAULT_TEMPERATURE',
127
+ 'AI_DEFAULT_MAX_TOKENS',
128
+ 'AI_DEFAULT_TOP_P',
129
+ 'AI_DAILY_BUDGET_USD',
130
+ 'AI_MONTHLY_BUDGET_USD',
131
+ 'AI_HTTP_ALLOWLIST',
132
+ 'AI_RAG_MAX_DOCUMENT_SIZE',
133
+ 'AI_RAG_MAX_BATCH_DOCUMENTS',
134
+ 'AI_RAG_MAX_CHUNKS_PER_QUERY',
135
+ 'AI_RAG_MIN_SCORE',
110
136
  'OLLAMA_BASE_URL',
111
137
  'OLLAMA_EMBEDDING_MODEL',
112
138
  'RESEND_API_KEY',
@@ -129,6 +155,11 @@ export const AUTH_GATED_FEATURES = new Set([
129
155
  'featureRequests',
130
156
  'changelog',
131
157
  'aiChat',
158
+ 'aiCore',
159
+ 'aiRag',
160
+ 'aiAgents',
161
+ 'aiBatch',
162
+ 'aiPlayground',
132
163
  'teams',
133
164
  'referrals',
134
165
  ]);
@@ -183,10 +214,17 @@ export function getFeatures(envContent) {
183
214
  const features = { auth: authEnabled };
184
215
  for (const [key, envVar] of Object.entries(FEATURE_ENV)) {
185
216
  const raw = readEnvVar(envContent, envVar);
186
- const defaultEnabled = key === 'compare' ? appMode === 'landing' : true;
217
+ const defaultEnabled = key === 'compare' ? appMode === 'landing' : key === 'aiRag' ? false : true;
187
218
  const enabled = raw == null ? defaultEnabled : raw !== 'false';
188
219
  features[key] = enabled && (!AUTH_GATED_FEATURES.has(key) || authEnabled);
189
220
  }
221
+ if (!features.aiCore) {
222
+ features.aiChat = false;
223
+ features.aiRag = false;
224
+ features.aiAgents = false;
225
+ features.aiBatch = false;
226
+ features.aiPlayground = false;
227
+ }
190
228
  return features;
191
229
  }
192
230
  export function getAuthMethods(envContent) {
@@ -7,7 +7,7 @@ export declare function getCacheDir(projectRoot: string): string;
7
7
  *
8
8
  * Examples:
9
9
  * git@github.com:org/codapult-plugin-onboarding.git → codapult-plugin-onboarding
10
- * https://github.com/org/codapult-plugin-ai-kit → codapult-plugin-ai-kit
10
+ * https://github.com/org/codapult-plugin-crm → codapult-plugin-crm
11
11
  */
12
12
  export declare function dirNameFromGitUrl(url: string): string;
13
13
  /**
package/dist/utils/git.js CHANGED
@@ -10,7 +10,7 @@ export function getCacheDir(projectRoot) {
10
10
  *
11
11
  * Examples:
12
12
  * git@github.com:org/codapult-plugin-onboarding.git → codapult-plugin-onboarding
13
- * https://github.com/org/codapult-plugin-ai-kit → codapult-plugin-ai-kit
13
+ * https://github.com/org/codapult-plugin-crm → codapult-plugin-crm
14
14
  */
15
15
  export function dirNameFromGitUrl(url) {
16
16
  const last = url.split('/').pop() ?? url;
@@ -19,7 +19,7 @@ describe('dirNameFromGitUrl', () => {
19
19
  expect(dirNameFromGitUrl('git@github.com:org/codapult-plugin-onboarding.git')).toBe('codapult-plugin-onboarding');
20
20
  });
21
21
  it('extracts name from HTTPS URL without .git suffix', () => {
22
- expect(dirNameFromGitUrl('https://github.com/org/codapult-plugin-ai-kit')).toBe('codapult-plugin-ai-kit');
22
+ expect(dirNameFromGitUrl('https://github.com/org/codapult-plugin-crm')).toBe('codapult-plugin-crm');
23
23
  });
24
24
  it('handles URL with trailing slash', () => {
25
25
  expect(dirNameFromGitUrl('https://github.com/org/my-plugin.git')).toBe('my-plugin');
@@ -30,12 +30,12 @@ describe('resolveManifest', () => {
30
30
  it('resolves manifest from sibling dir with codapult-plugin- prefix', () => {
31
31
  mockedExists.mockImplementation((p) => {
32
32
  const path = p;
33
- return path === '/codapult-plugin-ai-kit/codapult-plugin.json';
33
+ return path === '/codapult-plugin-crm/codapult-plugin.json';
34
34
  });
35
35
  mockedRead.mockReturnValue(validManifest);
36
- const result = resolveManifest(ROOT, 'ai-kit');
36
+ const result = resolveManifest(ROOT, 'crm');
37
37
  expect(result).not.toBeNull();
38
- expect(result.pluginDir).toContain('codapult-plugin-ai-kit');
38
+ expect(result.pluginDir).toContain('codapult-plugin-crm');
39
39
  });
40
40
  it('resolves manifest from sibling dir with codapult- prefix', () => {
41
41
  mockedExists.mockImplementation((p) => {
@@ -280,14 +280,14 @@ describe('patchNextConfig', () => {
280
280
  describe('regenerateBarrel', () => {
281
281
  it('generates barrel with sorted imports', () => {
282
282
  mockedExists.mockReturnValue(true);
283
- mockedReaddir.mockReturnValue(['crm.ts', 'ai-kit.ts', 'index.ts']);
283
+ mockedReaddir.mockReturnValue(['crm.ts', 'analytics.ts', 'index.ts']);
284
284
  regenerateBarrel(ROOT);
285
285
  const written = mockedWrite.mock.calls[0][1];
286
- expect(written).toContain("import './ai-kit';");
286
+ expect(written).toContain("import './analytics';");
287
287
  expect(written).toContain("import './crm';");
288
288
  expect(written).not.toContain('index');
289
- // ai-kit should come before crm (sorted)
290
- expect(written.indexOf('ai-kit')).toBeLessThan(written.indexOf('crm'));
289
+ // analytics should come before crm (sorted)
290
+ expect(written.indexOf('analytics')).toBeLessThan(written.indexOf('crm'));
291
291
  });
292
292
  it('does nothing when plugins dir does not exist', () => {
293
293
  mockedExists.mockReturnValue(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codapult/cli",
3
- "version": "0.16.2",
3
+ "version": "0.17.0",
4
4
  "description": "Codapult CLI — manage, update, and diagnose your Codapult SaaS project",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@11.22.0+sha512.1ff870c4c6133dfd88fb2afc46dd13d47f09c9794b438c6fdb47ca98caf3bc16381ee0be93a091b8e3824cf01f889f46d7d9e20910fb0be1ab0fb5baa80dd621",