@codapult/cli 0.6.0 → 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 +47 -0
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -158,6 +158,11 @@ const MODULE_REMOVALS = [
|
|
|
158
158
|
'src/components/auth',
|
|
159
159
|
'src/components/dashboard',
|
|
160
160
|
'src/components/admin',
|
|
161
|
+
'src/app/api/admin',
|
|
162
|
+
'src/lib/actions/admin.ts',
|
|
163
|
+
'src/lib/actions/admin.test.ts',
|
|
164
|
+
'src/lib/actions/impersonation.ts',
|
|
165
|
+
'src/lib/actions/impersonation.test.ts',
|
|
161
166
|
'src/components/ImpersonationBanner.tsx',
|
|
162
167
|
],
|
|
163
168
|
label: 'Authentication & Dashboard',
|
|
@@ -172,6 +177,7 @@ const MODULE_REMOVALS = [
|
|
|
172
177
|
paths: [
|
|
173
178
|
`${APP}/(marketing)/blog`,
|
|
174
179
|
'src/components/blog',
|
|
180
|
+
'src/components/seo/BlogPostJsonLd.tsx',
|
|
175
181
|
'src/lib/blog',
|
|
176
182
|
'content/blog',
|
|
177
183
|
'src/app/rss.xml',
|
|
@@ -188,6 +194,12 @@ const MODULE_REMOVALS = [
|
|
|
188
194
|
'src/components/dashboard/AcceptInvitationButton.tsx',
|
|
189
195
|
'src/lib/db/organizations.ts',
|
|
190
196
|
'src/lib/actions/organizations.ts',
|
|
197
|
+
'src/lib/actions/organizations.test.ts',
|
|
198
|
+
'src/lib/payments/seats.ts',
|
|
199
|
+
'src/lib/payments/seats.test.ts',
|
|
200
|
+
'src/lib/guards.ts',
|
|
201
|
+
'src/lib/guards.test.ts',
|
|
202
|
+
'src/app/api/scim',
|
|
191
203
|
],
|
|
192
204
|
label: 'Teams',
|
|
193
205
|
},
|
|
@@ -223,6 +235,7 @@ const MODULE_REMOVALS = [
|
|
|
223
235
|
`${APP}/(marketing)/docs/api`,
|
|
224
236
|
'src/lib/api-docs.ts',
|
|
225
237
|
'src/lib/openapi.ts',
|
|
238
|
+
'src/app/api/openapi',
|
|
226
239
|
'src/components/docs/ApiReference.tsx',
|
|
227
240
|
],
|
|
228
241
|
label: 'API Docs',
|
|
@@ -442,6 +455,12 @@ const FEATURE_ENV_VARS = {
|
|
|
442
455
|
enableTwoFactor: 'ENABLE_TWO_FACTOR',
|
|
443
456
|
enablePlugins: 'ENABLE_PLUGINS',
|
|
444
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
|
+
];
|
|
445
464
|
function generateEnvFile(root, config) {
|
|
446
465
|
const envExamplePath = join(root, ENV_EXAMPLE_FILE_NAME);
|
|
447
466
|
const envLocalPath = join(root, ENV_FILE_NAME);
|
|
@@ -505,6 +524,33 @@ function generateMcpConfig(root) {
|
|
|
505
524
|
writeFileSync(mcpPath, JSON.stringify(config, null, 2) + '\n', 'utf-8');
|
|
506
525
|
success('Created .cursor/mcp.json — Codapult MCP server configured for Cursor');
|
|
507
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
|
+
}
|
|
508
554
|
function removeModules(root, config) {
|
|
509
555
|
for (const removal of MODULE_REMOVALS) {
|
|
510
556
|
if (config[removal.key])
|
|
@@ -529,6 +575,7 @@ function removeModules(root, config) {
|
|
|
529
575
|
dim(` no matching files found (expected ${missing.length} path(s))`);
|
|
530
576
|
}
|
|
531
577
|
}
|
|
578
|
+
pruneMarkedBlocksInFiles(root, config);
|
|
532
579
|
}
|
|
533
580
|
async function interactiveSetup() {
|
|
534
581
|
const iface = rl();
|