@codapult/cli 0.9.5 → 0.10.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.
@@ -3,23 +3,7 @@ import { resolve, relative, join } from 'node:path';
3
3
  import { createInterface } from 'node:readline';
4
4
  import { findProjectRoot } from '../utils/project.js';
5
5
  import { ENV_EXAMPLE_FILE_NAME, ENV_FILE_NAME, } from '../utils/project-env.js';
6
- import { heading, success, fail, info, dim } from '../utils/ui.js';
7
- const rl = () => createInterface({ input: process.stdin, output: process.stdout });
8
- function ask(iface, question, defaultValue) {
9
- const suffix = defaultValue ? ` (${defaultValue})` : '';
10
- return new Promise((res) => {
11
- iface.question(` ${question}${suffix}: `, (answer) => {
12
- res(answer.trim() || defaultValue || '');
13
- });
14
- });
15
- }
16
- async function confirmPrompt(iface, question, defaultYes = true) {
17
- const hint = defaultYes ? 'Y/n' : 'y/N';
18
- const answer = await ask(iface, `${question} [${hint}]`);
19
- if (!answer)
20
- return defaultYes;
21
- return answer.toLowerCase().startsWith('y');
22
- }
6
+ import { heading, success, fail, info, dim, ask, confirm } from '../utils/ui.js';
23
7
  async function selectPrompt(iface, question, options) {
24
8
  console.log(`\n ${question}`);
25
9
  options.forEach((opt, i) => console.log(` ${i + 1}. ${opt}`));
@@ -31,8 +15,7 @@ async function selectPrompt(iface, question, options) {
31
15
  // Built-in presets for non-interactive (CI/CD) setup via --preset flag.
32
16
  // ---------------------------------------------------------------------------
33
17
  const BUILT_IN_PRESETS = {
34
- // Showcase / marketing-only site: navbar shows only Pricing, Plugins, Docs.
35
- // `enableHelpCenter` stays true (powers /docs).
18
+ // Showcase / marketing-only site.
36
19
  marketing: {
37
20
  authProvider: 'none',
38
21
  enableAuth: false,
@@ -51,17 +34,19 @@ const BUILT_IN_PRESETS = {
51
34
  enableDripCampaigns: false,
52
35
  enableApiDocs: false,
53
36
  enableChangelog: false,
54
- enableBlog: true,
55
37
  enableWaitlist: false,
56
38
  enableFeatureRequests: false,
57
- enableCompare: true,
58
39
  enableWebhooks: false,
59
40
  enableAuditLog: false,
60
41
  enableReports: false,
61
42
  enableBranding: false,
62
43
  enableTwoFactor: false,
63
- // Plugins page stays in marketing navbar by default — preset keeps the
64
- // feature on. Override with `marketing;enablePlugins=false` to drop it.
44
+ enableGraphQL: false,
45
+ enableHelpCenter: true,
46
+ enableBlog: true,
47
+ enablePlugins: true,
48
+ enableCompare: true,
49
+ removeUnusedCode: true,
65
50
  },
66
51
  demo: {
67
52
  authProvider: 'better-auth',
@@ -102,6 +87,7 @@ const DEFAULT_CONFIG = {
102
87
  enableBranding: true,
103
88
  enableTwoFactor: true,
104
89
  enablePlugins: true,
90
+ removeUnusedCode: false,
105
91
  };
106
92
  function parsePresetValue(raw) {
107
93
  const parts = raw
@@ -476,6 +462,8 @@ const FEATURE_ENV_VARS = {
476
462
  enableTwoFactor: 'ENABLE_TWO_FACTOR',
477
463
  enablePlugins: 'ENABLE_PLUGINS',
478
464
  };
465
+ // codapult:prune:start {key}
466
+ // codapult:prune:end {key}
479
467
  const PRUNE_MARKER_FILES = [
480
468
  'src/app/sitemap.ts',
481
469
  'src/app/sitemap.test.ts',
@@ -601,63 +589,57 @@ function removeModules(root, config) {
601
589
  pruneMarkedBlocksInFiles(root, config);
602
590
  }
603
591
  async function interactiveSetup() {
604
- const iface = rl();
592
+ const iface = createInterface({ input: process.stdin, output: process.stdout });
605
593
  heading('Codapult Setup');
606
594
  info('This wizard will configure your project.\n');
607
- const authProvider = (await selectPrompt(iface, 'Auth provider:', [
595
+ const appName = await ask(iface, 'App name', 'Codapult');
596
+ const appUrl = await ask(iface, 'App URL', 'http://localhost:3000');
597
+ const authProvider = await selectPrompt(iface, 'Auth provider:', [
608
598
  'better-auth',
609
599
  'kinde',
610
600
  'none',
611
- ]));
601
+ ]);
612
602
  const authEnabled = authProvider !== 'none';
613
603
  const config = {
614
- appName: await ask(iface, 'App name', 'Codapult'),
615
- appUrl: await ask(iface, 'App URL', 'http://localhost:3000'),
604
+ appName,
605
+ appUrl,
616
606
  authProvider,
617
- paymentProvider: (await selectPrompt(iface, 'Payment provider:', [
618
- 'stripe',
619
- 'lemonsqueezy',
620
- ])),
621
- storageProvider: (await selectPrompt(iface, 'Storage provider:', [
622
- 'local',
623
- 's3',
624
- ])),
625
- jobProvider: (await selectPrompt(iface, 'Background jobs:', [
607
+ paymentProvider: await selectPrompt(iface, 'Payment provider:', ['stripe', 'lemonsqueezy']),
608
+ storageProvider: await selectPrompt(iface, 'Storage provider:', ['local', 's3']),
609
+ jobProvider: await selectPrompt(iface, 'Background jobs:', [
626
610
  'memory',
627
611
  'bullmq',
628
- ])),
612
+ ]),
629
613
  enableAuth: authEnabled,
630
- enableAI: await confirmPrompt(iface, 'Enable AI Chat module?'),
631
- enableBlog: await confirmPrompt(iface, 'Enable Blog module?'),
632
- enableTeams: authEnabled && (await confirmPrompt(iface, 'Enable Teams/Organizations?')),
633
- enableWaitlist: await confirmPrompt(iface, 'Enable Waitlist page?'),
634
- enableGraphQL: await confirmPrompt(iface, 'Enable GraphQL API layer?'),
635
- enableSSO: authEnabled && (await confirmPrompt(iface, 'Enable Enterprise SSO (SAML)?')),
636
- enableApiDocs: await confirmPrompt(iface, 'Enable interactive API docs?'),
637
- enableHelpCenter: await confirmPrompt(iface, 'Enable Documentation module?'),
638
- enableExperiments: await confirmPrompt(iface, 'Enable A/B Testing?'),
639
- enableFeatureRequests: await confirmPrompt(iface, 'Enable Feature Request board?'),
640
- enableCompare: false,
641
- enableConnect: authEnabled && (await confirmPrompt(iface, 'Enable Stripe Connect (marketplace)?')),
642
- enableEventStore: await confirmPrompt(iface, 'Enable Event Store (event sourcing)?'),
643
- enableOtel: await confirmPrompt(iface, 'Enable OpenTelemetry tracing?'),
644
- enableDripCampaigns: await confirmPrompt(iface, 'Enable email drip campaigns?'),
645
- enableOnboarding: authEnabled && (await confirmPrompt(iface, 'Enable in-app onboarding tours?')),
646
- enableWorkflows: authEnabled && (await confirmPrompt(iface, 'Enable workflow automation?')),
647
- enableReferrals: authEnabled && (await confirmPrompt(iface, 'Enable referral program?')),
648
- enableAnalytics: await confirmPrompt(iface, 'Enable built-in analytics?'),
649
- enableChangelog: await confirmPrompt(iface, 'Enable Changelog page?'),
650
- enableRAG: await confirmPrompt(iface, 'Enable RAG pipeline (vector search)?'),
651
- enableWebhooks: authEnabled && (await confirmPrompt(iface, 'Enable outgoing webhooks?')),
652
- enableAuditLog: authEnabled && (await confirmPrompt(iface, 'Enable audit log / activity feed?')),
653
- enableReports: authEnabled && (await confirmPrompt(iface, 'Enable scheduled email reports?')),
654
- enableBranding: authEnabled && (await confirmPrompt(iface, 'Enable per-org branding (white-label)?')),
655
- enableTwoFactor: authEnabled && (await confirmPrompt(iface, 'Enable two-factor authentication (TOTP)?')),
656
- enablePlugins: await confirmPrompt(iface, 'Enable plugin marketplace (/plugins)?'),
614
+ enableAI: await confirm(iface, '\nEnable AI Chat module?'),
615
+ enableBlog: await confirm(iface, 'Enable Blog module?'),
616
+ enableTeams: authEnabled && (await confirm(iface, 'Enable Teams/Organizations?')),
617
+ enableWaitlist: await confirm(iface, 'Enable Waitlist page?'),
618
+ enableGraphQL: await confirm(iface, 'Enable GraphQL API layer?'),
619
+ enableSSO: authEnabled && (await confirm(iface, 'Enable Enterprise SSO (SAML)?')),
620
+ enableApiDocs: await confirm(iface, 'Enable interactive API docs?'),
621
+ enableHelpCenter: await confirm(iface, 'Enable Documentation module?'),
622
+ enableExperiments: await confirm(iface, 'Enable A/B Testing?'),
623
+ enableFeatureRequests: await confirm(iface, 'Enable Feature Request board?'),
624
+ enableCompare: await confirm(iface, 'Enable competitor comparison pages (/compare)?', false),
625
+ enableConnect: authEnabled && (await confirm(iface, 'Enable Stripe Connect (marketplace)?')),
626
+ enableEventStore: await confirm(iface, 'Enable Event Store (event sourcing)?'),
627
+ enableOtel: await confirm(iface, 'Enable OpenTelemetry tracing?'),
628
+ enableDripCampaigns: await confirm(iface, 'Enable email drip campaigns?'),
629
+ enableOnboarding: authEnabled && (await confirm(iface, 'Enable in-app onboarding tours?')),
630
+ enableWorkflows: authEnabled && (await confirm(iface, 'Enable workflow automation?')),
631
+ enableReferrals: authEnabled && (await confirm(iface, 'Enable referral program?')),
632
+ enableAnalytics: await confirm(iface, 'Enable built-in analytics?'),
633
+ enableChangelog: await confirm(iface, 'Enable Changelog page?'),
634
+ enableRAG: await confirm(iface, 'Enable RAG pipeline (vector search)?'),
635
+ enableWebhooks: authEnabled && (await confirm(iface, 'Enable outgoing webhooks?')),
636
+ enableAuditLog: authEnabled && (await confirm(iface, 'Enable audit log / activity feed?')),
637
+ enableReports: authEnabled && (await confirm(iface, 'Enable scheduled email reports?')),
638
+ enableBranding: authEnabled && (await confirm(iface, 'Enable per-org branding (white-label)?')),
639
+ enableTwoFactor: authEnabled && (await confirm(iface, 'Enable two-factor authentication (TOTP)?')),
640
+ enablePlugins: await confirm(iface, 'Enable plugin marketplace (/plugins)?'),
641
+ removeUnusedCode: await confirm(iface, '\nRemove unused module code?', false),
657
642
  };
658
- if (await confirmPrompt(iface, 'Remove unused module code?', false)) {
659
- return config;
660
- }
661
643
  iface.close();
662
644
  return config;
663
645
  }
@@ -684,8 +666,10 @@ export async function setupCommand(options) {
684
666
  else {
685
667
  generateEnvFile(root, config);
686
668
  }
687
- heading('Removing unused modules');
688
- removeModules(root, config);
669
+ if (config.removeUnusedCode) {
670
+ heading('Removing unused modules');
671
+ removeModules(root, config);
672
+ }
689
673
  heading('Setting up MCP integration');
690
674
  generateMcpConfig(root);
691
675
  heading('Done!');
@@ -1,3 +1,4 @@
1
+ import { createInterface } from 'node:readline';
1
2
  export declare const symbols: {
2
3
  readonly check: string;
3
4
  readonly cross: string;
@@ -14,5 +15,6 @@ export declare function info(text: string): void;
14
15
  export declare function dim(text: string): void;
15
16
  export declare function label(key: string, value: string): void;
16
17
  export declare function table(rows: [string, string, string?][]): void;
17
- /** Prompt yes/no. Returns default when stdin is not a TTY (piped / CI). */
18
+ export declare function ask(iface: ReturnType<typeof createInterface>, question: string, defaultValue?: string): Promise<string>;
18
19
  export declare function confirm(question: string, defaultYes?: boolean): Promise<boolean>;
20
+ export declare function confirm(iface: ReturnType<typeof createInterface>, question: string, defaultYes?: boolean): Promise<boolean>;
package/dist/utils/ui.js CHANGED
@@ -40,21 +40,26 @@ export function table(rows) {
40
40
  console.log(` ${key.padEnd(maxKey)} ${value.padEnd(maxVal)} ${statusStr}`);
41
41
  }
42
42
  }
43
+ export function ask(iface, question, defaultValue) {
44
+ const suffix = defaultValue ? ` (${defaultValue})` : '';
45
+ return new Promise((res) => {
46
+ iface.question(` ${question}${suffix}: `, (answer) => {
47
+ res(answer.trim() || defaultValue || '');
48
+ });
49
+ });
50
+ }
43
51
  /** Prompt yes/no. Returns default when stdin is not a TTY (piped / CI). */
44
- export function confirm(question, defaultYes = true) {
52
+ export async function confirm(ifaceOrQuestion, questionOrDefault, defaultYes_) {
53
+ const defaultYes = (typeof questionOrDefault !== 'string' ? questionOrDefault : defaultYes_) ?? true;
45
54
  if (!process.stdin.isTTY) {
46
55
  return Promise.resolve(defaultYes);
47
56
  }
48
- const rl = createInterface({ input: process.stdin, output: process.stdout });
57
+ const [rl, question, closeRl] = typeof ifaceOrQuestion === 'string'
58
+ ? [createInterface({ input: process.stdin, output: process.stdout }), ifaceOrQuestion, true]
59
+ : [ifaceOrQuestion, String(questionOrDefault), false];
49
60
  const hint = defaultYes ? 'Y/n' : 'y/N';
50
- return new Promise((resolve) => {
51
- rl.question(` ${question} [${hint}]: `, (answer) => {
52
- rl.close();
53
- if (!answer.trim()) {
54
- resolve(defaultYes);
55
- return;
56
- }
57
- resolve(answer.trim().toLowerCase().startsWith('y'));
58
- });
59
- });
61
+ const answer = await ask(rl, `${question} [${hint}]`);
62
+ if (closeRl)
63
+ rl.close();
64
+ return !answer ? defaultYes : answer.toLowerCase().startsWith('y');
60
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codapult/cli",
3
- "version": "0.9.5",
3
+ "version": "0.10.1",
4
4
  "description": "Codapult CLI — manage, update, and diagnose your Codapult SaaS project",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@11.6.0",