@codapult/cli 0.16.2 → 0.17.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 +2 -2
- package/dist/commands/config-show.js +0 -10
- package/dist/commands/setup.js +85 -23
- package/dist/mcp/prompts.js +4 -1
- package/dist/mcp/resources.js +1 -1
- package/dist/mcp/tools/plugins.js +1 -1
- package/dist/mcp/tools/project.js +1 -1
- package/dist/mcp/tools/project.test.js +2 -2
- package/dist/utils/config-report.d.ts +0 -6
- package/dist/utils/config-report.js +0 -20
- package/dist/utils/config-report.test.js +0 -2
- package/dist/utils/env-config.d.ts +6 -1
- package/dist/utils/env-config.js +39 -1
- package/dist/utils/git.d.ts +1 -1
- package/dist/utils/git.js +1 -1
- package/dist/utils/git.test.js +1 -1
- package/dist/utils/manifest.test.js +3 -3
- package/dist/utils/patchers.test.js +4 -4
- package/package.json +1 -1
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
|
|
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`');
|
package/dist/commands/setup.js
CHANGED
|
@@ -26,6 +26,11 @@ const BUILT_IN_PRESETS = {
|
|
|
26
26
|
ssoProvider: 'none',
|
|
27
27
|
enableAuth: false,
|
|
28
28
|
enableAI: false,
|
|
29
|
+
enableAiChat: false,
|
|
30
|
+
enableRAG: false,
|
|
31
|
+
enableAgents: false,
|
|
32
|
+
enableBatch: false,
|
|
33
|
+
enablePlayground: false,
|
|
29
34
|
enableTeams: false,
|
|
30
35
|
enableConnect: false,
|
|
31
36
|
enableSSO: false,
|
|
@@ -34,7 +39,6 @@ const BUILT_IN_PRESETS = {
|
|
|
34
39
|
enableReferrals: false,
|
|
35
40
|
enableAnalytics: false,
|
|
36
41
|
enableExperiments: false,
|
|
37
|
-
enableRAG: false,
|
|
38
42
|
enableEventStore: false,
|
|
39
43
|
enableOtel: false,
|
|
40
44
|
enableDripCampaigns: false,
|
|
@@ -68,6 +72,11 @@ const DEFAULT_CONFIG = {
|
|
|
68
72
|
jobProvider: 'memory',
|
|
69
73
|
enableAuth: true,
|
|
70
74
|
enableAI: true,
|
|
75
|
+
enableAiChat: true,
|
|
76
|
+
enableRAG: false,
|
|
77
|
+
enableAgents: true,
|
|
78
|
+
enableBatch: true,
|
|
79
|
+
enablePlayground: true,
|
|
71
80
|
enableBlog: true,
|
|
72
81
|
enableTeams: true,
|
|
73
82
|
enableWaitlist: true,
|
|
@@ -87,7 +96,6 @@ const DEFAULT_CONFIG = {
|
|
|
87
96
|
enableReferrals: true,
|
|
88
97
|
enableAnalytics: true,
|
|
89
98
|
enableChangelog: true,
|
|
90
|
-
enableRAG: true,
|
|
91
99
|
enableWebhooks: true,
|
|
92
100
|
enableAuditLog: true,
|
|
93
101
|
enableReports: true,
|
|
@@ -133,6 +141,13 @@ function resolvePreset(raw) {
|
|
|
133
141
|
if (config.authProvider === 'none') {
|
|
134
142
|
config.enableAuth = false;
|
|
135
143
|
}
|
|
144
|
+
if (!config.enableAI) {
|
|
145
|
+
config.enableAiChat = false;
|
|
146
|
+
config.enableRAG = false;
|
|
147
|
+
config.enableAgents = false;
|
|
148
|
+
config.enableBatch = false;
|
|
149
|
+
config.enablePlayground = false;
|
|
150
|
+
}
|
|
136
151
|
return config;
|
|
137
152
|
}
|
|
138
153
|
// All app-router paths are under `src/app/[locale]/...` (next-intl).
|
|
@@ -148,6 +163,7 @@ const MODULE_REMOVALS = [
|
|
|
148
163
|
`${APP}/(protected)/(dashboard)`,
|
|
149
164
|
`${APP}/(protected)/(admin)`,
|
|
150
165
|
'src/app/api/auth',
|
|
166
|
+
'src/lib/auth/index.test.ts',
|
|
151
167
|
'src/lib/auth/adapters',
|
|
152
168
|
'src/lib/auth/client-adapter.test.ts',
|
|
153
169
|
'src/components/auth/AuthForm.tsx',
|
|
@@ -165,13 +181,62 @@ const MODULE_REMOVALS = [
|
|
|
165
181
|
{
|
|
166
182
|
key: 'enableAI',
|
|
167
183
|
paths: [
|
|
168
|
-
`${APP}/(protected)/(dashboard)/dashboard/ai
|
|
169
|
-
'src/app/api/chat',
|
|
184
|
+
`${APP}/(protected)/(dashboard)/dashboard/ai`,
|
|
170
185
|
'src/components/ai',
|
|
186
|
+
'src/hooks/ai',
|
|
171
187
|
'src/lib/ai',
|
|
188
|
+
'src/app/api/ai',
|
|
172
189
|
],
|
|
173
190
|
label: 'AI Chat',
|
|
174
191
|
},
|
|
192
|
+
{
|
|
193
|
+
key: 'enableAiChat',
|
|
194
|
+
paths: [
|
|
195
|
+
`${APP}/(protected)/(dashboard)/dashboard/ai/chat`,
|
|
196
|
+
'src/components/ai/ChatUI.tsx',
|
|
197
|
+
'src/app/api/ai/chat',
|
|
198
|
+
],
|
|
199
|
+
label: 'AI Chat',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
key: 'enableRAG',
|
|
203
|
+
paths: [
|
|
204
|
+
'src/lib/ai/chunker.ts',
|
|
205
|
+
'src/lib/ai/chunker.test.ts',
|
|
206
|
+
'src/lib/ai/embeddings',
|
|
207
|
+
'src/lib/ai/vector-store',
|
|
208
|
+
'src/lib/ai/rag.ts',
|
|
209
|
+
'src/app/api/ai/index',
|
|
210
|
+
'src/app/api/ai/search',
|
|
211
|
+
],
|
|
212
|
+
label: 'RAG Pipeline',
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
key: 'enableAgents',
|
|
216
|
+
paths: [
|
|
217
|
+
`${APP}/(protected)/(dashboard)/dashboard/ai/agents`,
|
|
218
|
+
'src/components/ai/AgentBuilder.tsx',
|
|
219
|
+
'src/components/ai/AgentSelector.tsx',
|
|
220
|
+
],
|
|
221
|
+
label: 'AI Agents',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
key: 'enableBatch',
|
|
225
|
+
paths: [
|
|
226
|
+
`${APP}/(protected)/(dashboard)/dashboard/ai/batch`,
|
|
227
|
+
'src/components/ai/BatchJobManager.tsx',
|
|
228
|
+
],
|
|
229
|
+
label: 'AI Batch',
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
key: 'enablePlayground',
|
|
233
|
+
paths: [
|
|
234
|
+
`${APP}/(protected)/(dashboard)/dashboard/ai/playground`,
|
|
235
|
+
'src/components/ai/AIPlayground.tsx',
|
|
236
|
+
'src/components/ai/PlaygroundComparison.tsx',
|
|
237
|
+
],
|
|
238
|
+
label: 'AI Playground',
|
|
239
|
+
},
|
|
175
240
|
{
|
|
176
241
|
key: 'enableBlog',
|
|
177
242
|
paths: [
|
|
@@ -201,8 +266,6 @@ const MODULE_REMOVALS = [
|
|
|
201
266
|
'src/lib/actions/organizations.test.ts',
|
|
202
267
|
'src/lib/payments/seats.ts',
|
|
203
268
|
'src/lib/payments/seats.test.ts',
|
|
204
|
-
'src/lib/guards.ts',
|
|
205
|
-
'src/lib/guards.test.ts',
|
|
206
269
|
'src/app/api/scim',
|
|
207
270
|
],
|
|
208
271
|
label: 'Teams',
|
|
@@ -361,18 +424,6 @@ const MODULE_REMOVALS = [
|
|
|
361
424
|
],
|
|
362
425
|
label: 'Built-in Analytics',
|
|
363
426
|
},
|
|
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
427
|
{
|
|
377
428
|
key: 'enableWebhooks',
|
|
378
429
|
paths: [
|
|
@@ -450,7 +501,7 @@ const MODULE_REMOVALS = [
|
|
|
450
501
|
// everything else is removed from disk by `removeModules`.
|
|
451
502
|
//
|
|
452
503
|
// Install-time-only features (no runtime ENABLE_* — file removal only):
|
|
453
|
-
// enableGraphQL, enableEventStore, enableOtel,
|
|
504
|
+
// enableGraphQL, enableEventStore, enableOtel, enableConnect.
|
|
454
505
|
// These are infrastructure-flavoured and either always-on or only meaningful
|
|
455
506
|
// at build-time, so they don't expose a user-facing env toggle.
|
|
456
507
|
const FEATURE_ENV_VARS = {
|
|
@@ -461,7 +512,12 @@ const FEATURE_ENV_VARS = {
|
|
|
461
512
|
enableWaitlist: 'ENABLE_WAITLIST',
|
|
462
513
|
enableFeatureRequests: 'ENABLE_FEATURE_REQUESTS',
|
|
463
514
|
enableCompare: 'ENABLE_COMPARE',
|
|
464
|
-
enableAI: '
|
|
515
|
+
enableAI: 'ENABLE_AI_CORE',
|
|
516
|
+
enableAiChat: 'ENABLE_AI_CHAT',
|
|
517
|
+
enableRAG: 'ENABLE_AI_RAG',
|
|
518
|
+
enableAgents: 'ENABLE_AI_AGENTS',
|
|
519
|
+
enableBatch: 'ENABLE_AI_BATCH',
|
|
520
|
+
enablePlayground: 'ENABLE_AI_PLAYGROUND',
|
|
465
521
|
enableTeams: 'ENABLE_TEAMS',
|
|
466
522
|
enableReferrals: 'ENABLE_REFERRALS',
|
|
467
523
|
enableAnalytics: 'ENABLE_ANALYTICS',
|
|
@@ -490,8 +546,10 @@ const PRUNE_MARKER_FILES = [
|
|
|
490
546
|
'src/lib/actions/admin.ts',
|
|
491
547
|
'src/lib/actions/impersonation.ts',
|
|
492
548
|
'src/lib/scheduled-reports/index.ts',
|
|
549
|
+
'src/lib/guards.ts',
|
|
550
|
+
'src/lib/guards.test.ts',
|
|
493
551
|
'src/config/marketing.test.ts',
|
|
494
|
-
'src/config/
|
|
552
|
+
'src/config/env-schema.ts',
|
|
495
553
|
'src/instrumentation.ts',
|
|
496
554
|
];
|
|
497
555
|
function generateEnvFile(root, config) {
|
|
@@ -689,7 +747,12 @@ async function interactiveSetup() {
|
|
|
689
747
|
]),
|
|
690
748
|
enableAuth: authEnabled,
|
|
691
749
|
enableSSO: ssoEnabled,
|
|
692
|
-
enableAI: emptyLine() && (await confirm(iface, 'Enable AI
|
|
750
|
+
enableAI: emptyLine() && (await confirm(iface, 'Enable AI core and chat module?')),
|
|
751
|
+
enableAiChat: await confirm(iface, 'Enable AI Chat?', true),
|
|
752
|
+
enableRAG: await confirm(iface, 'Enable RAG pipeline (vector search)?', false),
|
|
753
|
+
enableAgents: await confirm(iface, 'Enable AI agents and tools?', true),
|
|
754
|
+
enableBatch: await confirm(iface, 'Enable AI batch processing?', true),
|
|
755
|
+
enablePlayground: await confirm(iface, 'Enable AI playground?', true),
|
|
693
756
|
enableBlog: await confirm(iface, 'Enable Blog module?'),
|
|
694
757
|
enableTeams: authEnabled && (await confirm(iface, 'Enable Teams/Organizations?')),
|
|
695
758
|
enableWaitlist: await confirm(iface, 'Enable Waitlist page?'),
|
|
@@ -708,7 +771,6 @@ async function interactiveSetup() {
|
|
|
708
771
|
enableReferrals: authEnabled && (await confirm(iface, 'Enable referral program?')),
|
|
709
772
|
enableAnalytics: await confirm(iface, 'Enable built-in analytics?'),
|
|
710
773
|
enableChangelog: await confirm(iface, 'Enable Changelog page?'),
|
|
711
|
-
enableRAG: await confirm(iface, 'Enable RAG pipeline (vector search)?'),
|
|
712
774
|
enableWebhooks: authEnabled && (await confirm(iface, 'Enable outgoing webhooks?')),
|
|
713
775
|
enableAuditLog: authEnabled && (await confirm(iface, 'Enable audit log / activity feed?')),
|
|
714
776
|
enableReports: authEnabled && (await confirm(iface, 'Enable scheduled email reports?')),
|
package/dist/mcp/prompts.js
CHANGED
|
@@ -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:
|
|
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:
|
package/dist/mcp/resources.js
CHANGED
|
@@ -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
|
|
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. "
|
|
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,
|
|
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(['
|
|
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(['
|
|
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. */
|
package/dist/utils/env-config.js
CHANGED
|
@@ -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) {
|
package/dist/utils/git.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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;
|
package/dist/utils/git.test.js
CHANGED
|
@@ -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-
|
|
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-
|
|
33
|
+
return path === '/codapult-plugin-crm/codapult-plugin.json';
|
|
34
34
|
});
|
|
35
35
|
mockedRead.mockReturnValue(validManifest);
|
|
36
|
-
const result = resolveManifest(ROOT, '
|
|
36
|
+
const result = resolveManifest(ROOT, 'crm');
|
|
37
37
|
expect(result).not.toBeNull();
|
|
38
|
-
expect(result.pluginDir).toContain('codapult-plugin-
|
|
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', '
|
|
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 './
|
|
286
|
+
expect(written).toContain("import './analytics';");
|
|
287
287
|
expect(written).toContain("import './crm';");
|
|
288
288
|
expect(written).not.toContain('index');
|
|
289
|
-
//
|
|
290
|
-
expect(written.indexOf('
|
|
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.
|
|
3
|
+
"version": "0.17.1",
|
|
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",
|