@codapult/cli 0.6.1 → 0.7.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/dist/commands/setup.js +43 -8
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -153,8 +153,8 @@ const MODULE_REMOVALS = [
|
|
|
153
153
|
`${APP}/admin`,
|
|
154
154
|
`${APP}/invite`,
|
|
155
155
|
'src/app/api/auth',
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
'src/lib/auth/better-auth.ts',
|
|
157
|
+
'src/lib/auth/kinde.ts',
|
|
158
158
|
'src/components/auth',
|
|
159
159
|
'src/components/dashboard',
|
|
160
160
|
'src/components/admin',
|
|
@@ -177,7 +177,8 @@ const MODULE_REMOVALS = [
|
|
|
177
177
|
paths: [
|
|
178
178
|
`${APP}/(marketing)/blog`,
|
|
179
179
|
'src/components/blog',
|
|
180
|
-
|
|
180
|
+
'src/components/seo/BlogPostJsonLd.tsx',
|
|
181
|
+
'src/lib/blog',
|
|
181
182
|
'content/blog',
|
|
182
183
|
'src/app/rss.xml',
|
|
183
184
|
],
|
|
@@ -293,12 +294,12 @@ const MODULE_REMOVALS = [
|
|
|
293
294
|
paths: ['src/lib/event-store', 'src/app/api/admin/events'],
|
|
294
295
|
label: 'Event Store',
|
|
295
296
|
},
|
|
296
|
-
|
|
297
|
+
{ key: 'enableOtel', paths: ['src/lib/telemetry'], label: 'OpenTelemetry' },
|
|
297
298
|
{
|
|
298
299
|
key: 'enableDripCampaigns',
|
|
299
300
|
paths: [
|
|
300
301
|
`${APP}/admin/drip-campaigns`,
|
|
301
|
-
|
|
302
|
+
'src/lib/drip-campaigns',
|
|
302
303
|
'src/app/api/admin/drip-campaigns',
|
|
303
304
|
'src/components/admin/DripCampaignManager.tsx',
|
|
304
305
|
],
|
|
@@ -351,7 +352,7 @@ const MODULE_REMOVALS = [
|
|
|
351
352
|
'src/lib/ai/chunker.ts',
|
|
352
353
|
'src/lib/ai/embeddings.ts',
|
|
353
354
|
'src/lib/ai/vector-store.ts',
|
|
354
|
-
|
|
355
|
+
'src/lib/ai/rag.ts',
|
|
355
356
|
'src/app/api/ai',
|
|
356
357
|
],
|
|
357
358
|
label: 'RAG Pipeline',
|
|
@@ -362,7 +363,7 @@ const MODULE_REMOVALS = [
|
|
|
362
363
|
`${APP}/(dashboard)/dashboard/webhooks`,
|
|
363
364
|
`${APP}/admin/webhooks`,
|
|
364
365
|
'src/app/api/webhooks',
|
|
365
|
-
|
|
366
|
+
'src/lib/outgoing-webhooks',
|
|
366
367
|
'src/lib/webhook-log.ts',
|
|
367
368
|
'src/lib/webhook-log.test.ts',
|
|
368
369
|
'src/components/dashboard/OutgoingWebhooks.tsx',
|
|
@@ -385,7 +386,7 @@ const MODULE_REMOVALS = [
|
|
|
385
386
|
paths: [
|
|
386
387
|
`${APP}/(dashboard)/dashboard/reports`,
|
|
387
388
|
'src/app/api/reports',
|
|
388
|
-
|
|
389
|
+
'src/lib/scheduled-reports',
|
|
389
390
|
'src/components/dashboard/ReportSchedules.tsx',
|
|
390
391
|
],
|
|
391
392
|
label: 'Scheduled Reports',
|
|
@@ -454,6 +455,12 @@ const FEATURE_ENV_VARS = {
|
|
|
454
455
|
enableTwoFactor: 'ENABLE_TWO_FACTOR',
|
|
455
456
|
enablePlugins: 'ENABLE_PLUGINS',
|
|
456
457
|
};
|
|
458
|
+
const PRUNE_MARKER_FILES = [
|
|
459
|
+
'src/app/sitemap.ts',
|
|
460
|
+
'src/lib/auth/index.ts',
|
|
461
|
+
'src/lib/jobs/definitions.ts',
|
|
462
|
+
'src/instrumentation.ts',
|
|
463
|
+
];
|
|
457
464
|
function generateEnvFile(root, config) {
|
|
458
465
|
const envExamplePath = join(root, ENV_EXAMPLE_FILE_NAME);
|
|
459
466
|
const envLocalPath = join(root, ENV_FILE_NAME);
|
|
@@ -517,6 +524,33 @@ function generateMcpConfig(root) {
|
|
|
517
524
|
writeFileSync(mcpPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
518
525
|
success('Created .cursor/mcp.json — Codapult MCP server configured for Cursor');
|
|
519
526
|
}
|
|
527
|
+
function pruneMarkedBlocks(content, disabledKeys) {
|
|
528
|
+
let next = content;
|
|
529
|
+
for (const key of disabledKeys) {
|
|
530
|
+
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
531
|
+
const pattern = new RegExp(`^[ \\t]*\\/\\/\\s*codapult:prune:start\\s+${escapedKey}\\s*\\n[\\s\\S]*?^[ \\t]*\\/\\/\\s*codapult:prune:end\\s+${escapedKey}[ \\t]*\\n?`, 'gm');
|
|
532
|
+
next = next.replace(pattern, '');
|
|
533
|
+
}
|
|
534
|
+
return next;
|
|
535
|
+
// return next.replace(/\n{3,}/g, '\n\n');
|
|
536
|
+
}
|
|
537
|
+
function pruneMarkedBlocksInFiles(root, config) {
|
|
538
|
+
const disabledKeys = Object.keys(config).filter((key) => key.startsWith('enable') && config[key] === false);
|
|
539
|
+
if (disabledKeys.length === 0)
|
|
540
|
+
return;
|
|
541
|
+
dim(`Pruning files...`);
|
|
542
|
+
for (const relativePath of PRUNE_MARKER_FILES) {
|
|
543
|
+
const fullPath = resolve(root, relativePath);
|
|
544
|
+
if (!existsSync(fullPath))
|
|
545
|
+
continue;
|
|
546
|
+
const original = readFileSync(fullPath, 'utf-8');
|
|
547
|
+
const pruned = pruneMarkedBlocks(original, disabledKeys);
|
|
548
|
+
if (pruned !== original) {
|
|
549
|
+
writeFileSync(fullPath, pruned, 'utf-8');
|
|
550
|
+
dim(` patched ${relativePath}`);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
520
554
|
function removeModules(root, config) {
|
|
521
555
|
for (const removal of MODULE_REMOVALS) {
|
|
522
556
|
if (config[removal.key])
|
|
@@ -541,6 +575,7 @@ function removeModules(root, config) {
|
|
|
541
575
|
dim(` no matching files found (expected ${missing.length} path(s))`);
|
|
542
576
|
}
|
|
543
577
|
}
|
|
578
|
+
pruneMarkedBlocksInFiles(root, config);
|
|
544
579
|
}
|
|
545
580
|
async function interactiveSetup() {
|
|
546
581
|
const iface = rl();
|