@codapult/cli 0.22.0 → 0.23.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/dist/index.js CHANGED
@@ -37,6 +37,7 @@ program
37
37
  .description('interactive project setup wizard (or non-interactive with --preset)')
38
38
  .option('--preset <value>', 'apply a preset non-interactively (name, key=value pairs, or both)')
39
39
  .option('--no-env-file', `do not create ${ENV_FILE_NAME}; read env vars from process.env instead`)
40
+ // .option('--clean-prune-markers', 'remove prune marker comments after processing them')
40
41
  .action(setupCommand);
41
42
  const recipe = program
42
43
  .commandsGroup('Project')
@@ -53,7 +53,7 @@ Codapult conventions:
53
53
  - Database: Drizzle ORM, snake_case tables/columns, text PKs, integer timestamps
54
54
  - Class merging: use \`cn()\` from \`@/lib/utils\`
55
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
56
+ - RAG: use the adapter pattern for embeddings/vector storage; it is opt-in via env.features.aiRag, requires env.features.ai, and all indexed data must be scoped to the active organization
57
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
58
  - AI defaults come from env (AI_DEFAULT_MODEL, AI_DEFAULT_TEMPERATURE, AI_DEFAULT_MAX_TOKENS, AI_DEFAULT_TOP_P, AI_MAX_RETRIES)
59
59
  - Org quotas: enforce via checkOrgQuota() for AI and API routes${projectContext}
@@ -4,7 +4,7 @@ import { checkProjectRoot, readProjectFile } from '../utils/project.js';
4
4
  import { ENV_EXAMPLE_FILE_NAME, loadProjectEnv } from '../utils/project-env.js';
5
5
  import { getAdapters } from '../utils/env-config.js';
6
6
  function getSchemaPath(root) {
7
- const provider = getAdapters(loadProjectEnv(root).content).database;
7
+ const provider = getAdapters(loadProjectEnv(root).content, root).database;
8
8
  return provider === 'postgres' ? 'src/lib/db/schema-pg.ts' : 'src/lib/db/schema.ts';
9
9
  }
10
10
  export function registerResources(server) {
@@ -12,7 +12,10 @@ import { compareSchemaFiles } from '../../utils/schema-parity.js';
12
12
  import { diffSchemaWithLiveDatabase, inspectLiveDatabase } from '../../utils/live-db-diff.js';
13
13
  function getDatabaseContext(root, envSource) {
14
14
  const envContent = loadProjectEnv(root, getProjectEnvOptions(envSource)).content;
15
- const provider = getAdapters(envContent).database;
15
+ const provider = getAdapters(envContent, root).database;
16
+ if (provider !== 'turso' && provider !== 'postgres') {
17
+ throw new Error(`Unsupported database provider: ${provider}`);
18
+ }
16
19
  return {
17
20
  provider,
18
21
  schemaPath: provider === 'postgres' ? 'src/lib/db/schema-pg.ts' : 'src/lib/db/schema.ts',
@@ -167,9 +170,7 @@ export function registerDbTools(server) {
167
170
  },
168
171
  }, ({ env_source }) => {
169
172
  const root = checkProjectRoot('throw');
170
- const envContent = loadProjectEnv(root, getProjectEnvOptions(env_source)).content;
171
- const provider = getAdapters(envContent).database;
172
- const schemaPath = provider === 'postgres' ? 'src/lib/db/schema-pg.ts' : 'src/lib/db/schema.ts';
173
+ const { provider, schemaPath } = getDatabaseContext(root, env_source);
173
174
  const schemaContent = readProjectFile(root, schemaPath) ?? '';
174
175
  const tables = parseSchema(schemaContent);
175
176
  let sqliteMigrations = 0;
@@ -3,7 +3,7 @@ import { resolve } from 'node:path';
3
3
  import { z } from 'zod';
4
4
  import { checkProjectRoot, readProjectFile } from '../../utils/project.js';
5
5
  import { ENV_EXAMPLE_FILE_NAME, ENV_FILE_NAME, getProjectEnvOptions, loadProjectEnv, } from '../../utils/project-env.js';
6
- import { findProviderIssues, getAdapters, getAuthMethods, getFeatures, getOauthProviders, readEnv, } from '../../utils/env-config.js';
6
+ import { findEnvIssues, getAdapters, getAuthMethods, getFeatures, getOauthProviders, getProjectEnvValue, } from '../../utils/env-config.js';
7
7
  import { envSourceSchema } from './schemas.js';
8
8
  export function parseEnvFile(content) {
9
9
  const entries = [];
@@ -40,19 +40,19 @@ function maskValue(value) {
40
40
  return value.slice(0, 4) + '****';
41
41
  }
42
42
  const ENV_KEY_REGEX = /^[A-Z][A-Z0-9_]*$/;
43
- function getEffectiveConfig(content) {
43
+ function getEffectiveConfig(content, root) {
44
44
  return {
45
- appMode: readEnv(content, 'APP_MODE', 'full'),
46
- adapters: getAdapters(content),
47
- authMethods: getAuthMethods(content),
48
- oauthProviders: getOauthProviders(content),
49
- features: getFeatures(content),
45
+ appMode: getProjectEnvValue(content, root, 'APP_MODE'),
46
+ adapters: getAdapters(content, root),
47
+ authMethods: getAuthMethods(content, root),
48
+ oauthProviders: getOauthProviders(content, root),
49
+ features: getFeatures(content, root),
50
50
  };
51
51
  }
52
52
  export function registerEnvTools(server) {
53
53
  server.registerTool('codapult_env_check', {
54
54
  title: 'Check Environment',
55
- description: `Validate ${ENV_FILE_NAME} against ${ENV_EXAMPLE_FILE_NAME} without exposing secret values`,
55
+ description: `Validate ${ENV_FILE_NAME} against the Codapult project schema and ${ENV_EXAMPLE_FILE_NAME} without exposing secret values`,
56
56
  inputSchema: { env_source: envSourceSchema.optional() },
57
57
  }, ({ env_source }) => {
58
58
  const root = checkProjectRoot('throw');
@@ -69,18 +69,20 @@ export function registerEnvTools(server) {
69
69
  .filter((entry) => !example.some((candidate) => candidate.key === entry.key))
70
70
  .map((entry) => entry.key);
71
71
  const envContent = loadProjectEnv(root, getProjectEnvOptions(env_source)).content;
72
- const providerIssues = findProviderIssues(envContent);
72
+ const validationIssues = findEnvIssues(envContent, root);
73
73
  return {
74
74
  content: [
75
75
  {
76
76
  type: 'text',
77
77
  text: JSON.stringify({
78
- valid: providerIssues.every((issue) => issue.severity !== 'error'),
78
+ valid: validationIssues.every((issue) => issue.severity !== 'error') &&
79
+ missing.length === 0 &&
80
+ unconfigured.length === 0,
79
81
  missing,
80
82
  unconfigured,
81
83
  extra,
82
- providerIssues,
83
- effective: getEffectiveConfig(envContent),
84
+ validationIssues,
85
+ effective: getEffectiveConfig(envContent, root),
84
86
  }, null, 2),
85
87
  },
86
88
  ],
@@ -183,7 +185,7 @@ export function registerEnvTools(server) {
183
185
  variables,
184
186
  missing,
185
187
  unconfigured,
186
- effective: getEffectiveConfig(localContent),
188
+ effective: getEffectiveConfig(localContent, root),
187
189
  ...(show_secrets
188
190
  ? {
189
191
  warning: 'SECURITY WARNING: sensitive values are shown in plain text to the MCP client and may be included in the AI context.',
@@ -41,17 +41,21 @@ export function registerProjectTools(server) {
41
41
  catch {
42
42
  /* not a git repo */
43
43
  }
44
- const features = getFeatures(envContent);
44
+ const features = getFeatures(envContent, root);
45
45
  const result = {
46
46
  name: pkg.name,
47
47
  version: pkg.version,
48
- adapters: getAdapters(envContent),
49
- authMethods: getAuthMethods(envContent),
50
- oauthProviders: getOauthProviders(envContent),
48
+ adapters: getAdapters(envContent, root),
49
+ authMethods: getAuthMethods(envContent, root),
50
+ oauthProviders: getOauthProviders(envContent, root),
51
51
  plugins,
52
52
  features: {
53
- enabled: Object.keys(features).filter((k) => features[k]),
54
- disabled: Object.keys(features).filter((k) => !features[k]),
53
+ enabled: Object.entries(features)
54
+ .filter(([, enabled]) => enabled)
55
+ .map(([key]) => key),
56
+ disabled: Object.entries(features)
57
+ .filter(([, enabled]) => !enabled)
58
+ .map(([key]) => key),
55
59
  },
56
60
  git: { branch: gitBranch, dirty: gitDirty },
57
61
  };
@@ -103,8 +107,8 @@ export function registerProjectTools(server) {
103
107
  const files = ['AGENTS.md', '.env.example', 'src/config/app.ts', 'src/config/env.ts'];
104
108
  const existingFiles = files.filter((file) => existsSync(resolve(root, file)));
105
109
  const envContent = loadProjectEnv(root).content;
106
- const adapters = getAdapters(envContent);
107
- const features = getFeatures(envContent);
110
+ const adapters = getAdapters(envContent, root);
111
+ const features = getFeatures(envContent, root);
108
112
  const configDir = resolve(root, 'src/config');
109
113
  const configFiles = existsSync(configDir)
110
114
  ? readdirSync(configDir)
@@ -129,7 +133,9 @@ export function registerProjectTools(server) {
129
133
  existingFiles,
130
134
  configFiles,
131
135
  adapters,
132
- enabledFeatures: Object.keys(features).filter((key) => features[key]),
136
+ enabledFeatures: Object.entries(features)
137
+ .filter(([, enabled]) => enabled)
138
+ .map(([key]) => key),
133
139
  appConfig: collectAppConfigSummary(root),
134
140
  }, null, 2),
135
141
  },
@@ -2,9 +2,9 @@ export interface EnvSchemaCompatibility {
2
2
  status: 'ok' | 'warn' | 'fail';
3
3
  schemaPath: string;
4
4
  schemaKeys: string[];
5
- expectedKeys: string[];
6
- schemaOnly: string[];
7
- mirrorOnly: string[];
5
+ exampleKeys: string[];
6
+ missingFromExample: string[];
7
+ missingFromSchema: string[];
8
8
  message: string;
9
9
  }
10
10
  export declare function checkEnvSchemaCompatibility(root: string): EnvSchemaCompatibility;
@@ -1,52 +1,43 @@
1
- import { existsSync } from 'node:fs';
2
- import { resolve } from 'node:path';
3
1
  import { readProjectFile } from './project.js';
4
- import { extractEnvSchemaKeys } from './env-schema-parser.js';
5
- import { ENV_SCHEMA_KEYS } from './env-config.js';
2
+ import { getProjectEnvSchemaKeys } from './project-env-schema.js';
6
3
  export function checkEnvSchemaCompatibility(root) {
7
4
  const schemaPath = 'src/config/env-schema.ts';
8
- const absolutePath = resolve(root, schemaPath);
9
- if (!existsSync(absolutePath)) {
10
- return {
11
- status: 'fail',
12
- schemaPath,
13
- schemaKeys: [],
14
- expectedKeys: [...ENV_SCHEMA_KEYS],
15
- schemaOnly: [],
16
- mirrorOnly: [...ENV_SCHEMA_KEYS],
17
- message: 'Environment schema is missing',
18
- };
19
- }
20
- const content = readProjectFile(root, schemaPath) ?? '';
21
5
  let schemaKeys;
22
6
  try {
23
- schemaKeys = extractEnvSchemaKeys(content);
7
+ schemaKeys = getProjectEnvSchemaKeys(root);
24
8
  }
25
9
  catch (error) {
26
10
  return {
27
11
  status: 'fail',
28
12
  schemaPath,
29
13
  schemaKeys: [],
30
- expectedKeys: [...ENV_SCHEMA_KEYS],
31
- schemaOnly: [],
32
- mirrorOnly: [...ENV_SCHEMA_KEYS],
33
- message: `Could not parse environment schema: ${String(error)}`,
14
+ exampleKeys: [],
15
+ missingFromExample: [],
16
+ missingFromSchema: [],
17
+ message: `Could not load environment schema: ${String(error)}`,
34
18
  };
35
19
  }
36
- const actual = new Set(schemaKeys);
37
- const expected = new Set(ENV_SCHEMA_KEYS);
38
- const schemaOnly = schemaKeys.filter((key) => !expected.has(key));
39
- const mirrorOnly = ENV_SCHEMA_KEYS.filter((key) => !actual.has(key));
40
- const drift = schemaOnly.length > 0 || mirrorOnly.length > 0;
20
+ const exampleContent = readProjectFile(root, '.env.example') ?? '';
21
+ const expectedKeys = [
22
+ ...new Set(exampleContent
23
+ .split(/\r?\n/)
24
+ .map((line) => /^\s*(?:export\s+)?([A-Z][A-Z0-9_]*)\s*=/.exec(line)?.[1])
25
+ .filter((key) => key !== undefined)),
26
+ ];
27
+ const schema = new Set(schemaKeys);
28
+ const expected = new Set(expectedKeys);
29
+ const missingFromExample = schemaKeys.filter((key) => !expected.has(key));
30
+ const missingFromSchema = expectedKeys.filter((key) => !schema.has(key));
31
+ const drift = missingFromExample.length > 0 || missingFromSchema.length > 0;
41
32
  return {
42
33
  status: drift ? 'warn' : 'ok',
43
34
  schemaPath,
44
35
  schemaKeys,
45
- expectedKeys: [...ENV_SCHEMA_KEYS],
46
- schemaOnly,
47
- mirrorOnly,
36
+ exampleKeys: expectedKeys,
37
+ missingFromExample,
38
+ missingFromSchema,
48
39
  message: drift
49
- ? `Environment schema drift detected (${schemaOnly.length} added, ${mirrorOnly.length} missing)`
50
- : `Environment schema is compatible (${schemaKeys.length} variables)`,
40
+ ? `Environment schema and .env.example differ (${missingFromExample.length} missing from the example, ${missingFromSchema.length} missing from the schema)`
41
+ : `Environment schema matches .env.example (${schemaKeys.length} variables)`,
51
42
  };
52
43
  }
@@ -1,103 +1,44 @@
1
- /**
2
- * Shared, read-only mirror of `src/config/env.ts` from the host project.
3
- *
4
- * Keep this file in sync with the host's `env.features`, `env.auth`,
5
- * provider enums, and the `superRefine` validation in
6
- * `codapult/src/config/env.ts` and `codapult/src/config/env-schema.ts`.
7
- * The CLI cannot import from the host project, so this module centralises
8
- * the provider/feature shape that several commands share regardless of whether
9
- * env values come from `.env.local` or `process.env`.
10
- */
11
- export type DbProvider = 'turso' | 'postgres';
12
- export type AuthProvider = 'better-auth' | 'kinde' | 'none';
13
- export type PaymentProvider = 'stripe' | 'lemonsqueezy' | 'polar';
14
- export type SSOProvider = 'jackson' | 'none';
15
- export type StorageProvider = 'local' | 's3' | 'r2';
16
- export type JobProvider = 'memory' | 'bullmq' | 'none';
17
- export type NotificationTransport = 'poll' | 'sse' | 'ws';
18
- export type EmbeddingProvider = 'openai' | 'ollama';
19
- export type VectorStoreProvider = 'sqlite' | 'memory';
20
- export type SupportProvider = 'crisp' | 'intercom' | 'none';
21
- /** Feature toggle key → ENABLE_* env var. Order = display order. */
22
- export declare const FEATURE_ENV: {
23
- readonly apiDocs: 'ENABLE_API_DOCS';
24
- readonly helpCenter: 'ENABLE_HELP_CENTER';
25
- readonly blog: 'ENABLE_BLOG';
26
- readonly waitlist: 'ENABLE_WAITLIST';
27
- readonly featureRequests: 'ENABLE_FEATURE_REQUESTS';
28
- readonly changelog: 'ENABLE_CHANGELOG';
29
- readonly aiCore: 'ENABLE_AI_CORE';
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';
35
- readonly teams: 'ENABLE_TEAMS';
36
- readonly referrals: 'ENABLE_REFERRALS';
37
- readonly promotions: 'ENABLE_PROMOTIONS';
38
- readonly analytics: 'ENABLE_ANALYTICS';
39
- readonly workflows: 'ENABLE_WORKFLOWS';
40
- readonly webhooks: 'ENABLE_WEBHOOKS';
41
- readonly auditLog: 'ENABLE_AUDIT_LOG';
42
- readonly reports: 'ENABLE_REPORTS';
43
- readonly onboarding: 'ENABLE_ONBOARDING';
44
- readonly branding: 'ENABLE_BRANDING';
45
- readonly experiments: 'ENABLE_EXPERIMENTS';
46
- readonly dripCampaigns: 'ENABLE_DRIP_CAMPAIGNS';
47
- readonly plugins: 'ENABLE_PLUGINS';
48
- readonly compare: 'ENABLE_COMPARE';
49
- };
50
- /**
51
- * Snapshot of the host env-schema contract. The compatibility check compares
52
- * this explicit contract with `src/config/env-schema.ts`; adding a variable to
53
- * the template therefore produces an actionable doctor warning until the CLI
54
- * mirror is reviewed.
55
- */
56
- 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_PROMOTIONS" | "ENABLE_REFERRALS" | "ENABLE_REPORTS" | "ENABLE_TEAMS" | "ENABLE_WAITLIST" | "ENABLE_WEBHOOKS" | "ENABLE_WORKFLOWS")[]];
57
- /** Auth-gated features: when AUTH_PROVIDER=none, these are forced off. */
58
- export declare const AUTH_GATED_FEATURES: ReadonlySet<string>;
59
- /** OAuth provider → [client id env, client secret env]. Mirrors oauth-providers.ts. */
60
- export declare const OAUTH_CREDENTIAL_KEYS: Readonly<Record<string, [string, string]>>;
1
+ /** Stable CLI presentation order; env variable names still come from the app schema. */
2
+ declare const FEATURE_DISPLAY_ORDER: readonly ['apiDocs', 'docs', 'blog', 'waitlist', 'featureRequests', 'changelog', 'ai', 'aiChat', 'aiRag', 'aiAgents', 'aiBatch', 'aiPlayground', 'teams', 'referrals', 'promotions', 'analytics', 'workflows', 'webhooks', 'auditLog', 'reports', 'onboarding', 'branding', 'experiments', 'dripCampaigns', 'plugins', 'compare', 'seo', 'graphql', 'connect', 'eventStore', 'otel'];
3
+ /** Feature identifiers exposed by the app's ENABLE_* environment variables. */
4
+ export type FeatureKey = (typeof FEATURE_DISPLAY_ORDER)[number] | 'twoFactor';
5
+ export declare function getFeatureEnv(root: string, options?: {
6
+ includeAuthMethods?: boolean;
7
+ }): Record<string, string>;
61
8
  /** Read a single var from raw .env content. Returns undefined if missing or empty. */
62
9
  export declare function readEnvVar(envContent: string, key: string): string | undefined;
63
- /** Same as `readEnvVar` but with a typed fallback. */
64
- export declare function readEnv<T extends string>(envContent: string, key: string, fallback: T): T;
10
+ /** Read a value after applying the project schema's transforms and defaults. */
11
+ export declare function getProjectEnvValue(envContent: string, root: string, key: string): string;
65
12
  export interface Adapters {
66
- database: DbProvider;
67
- auth: AuthProvider;
68
- sso: SSOProvider;
69
- payments: PaymentProvider;
70
- storage: StorageProvider;
71
- jobs: JobProvider;
72
- notifications: NotificationTransport;
73
- embedding: EmbeddingProvider;
74
- vectorStore: VectorStoreProvider;
75
- support: SupportProvider;
13
+ database: string;
14
+ auth: string;
15
+ sso: string;
16
+ payments: string;
17
+ storage: string;
18
+ jobs: string;
19
+ notifications: string;
20
+ embedding: string;
21
+ vectorStore: string;
22
+ support: string;
76
23
  }
77
- /** Resolve all adapters from .env content, applying the same defaults as `env.*`. */
78
- export declare function getAdapters(envContent: string): Adapters;
79
- /**
80
- * Compute the effective set of feature toggles from .env content.
81
- * Mirrors `env.features` in `codapult/src/config/env.ts`:
82
- * - default `true` for every ENABLE_* (unset → enabled);
83
- * - explicit "false" disables;
84
- * - `auth` derived from AUTH_PROVIDER !== 'none';
85
- * - auth-gated features forced off when AUTH_PROVIDER=none.
86
- */
87
- export declare function getFeatures(envContent: string): Record<string, boolean>;
88
- /** Auth-method toggles that live in env (not in app.ts). */
24
+ export declare function getAdapters(envContent: string, root: string): Adapters;
25
+ type Features = Record<string, boolean>;
26
+ /** Resolve feature toggles with schema defaults and CLI-specific dependencies. */
27
+ export declare function getFeatures(envContent: string, root: string): Features;
28
+ /** Auth-method toggles that live in the environment schema. */
89
29
  export interface AuthMethods {
90
30
  twoFactor: boolean;
91
31
  magicLink: boolean;
92
32
  passkeys: boolean;
93
33
  }
94
- export declare function getAuthMethods(envContent: string): AuthMethods;
95
- /** OAuth providers that have both client id + secret configured in .env. */
96
- export declare function getOauthProviders(envContent: string): string[];
97
- /** Provider-conditional env var requirements (mirrors `superRefine`). */
34
+ export declare function getAuthMethods(envContent: string, root: string): AuthMethods;
35
+ /** OAuth providers are derived from matching credential keys in the schema. */
36
+ export declare function getOauthProviders(envContent: string, root: string): string[];
37
+ /** Schema validation issues exposed by env check and project health. */
98
38
  export interface EnvIssue {
99
39
  key: string;
100
40
  message: string;
101
41
  severity: 'error' | 'warn';
102
42
  }
103
- export declare function findProviderIssues(envContent: string): EnvIssue[];
43
+ export declare function findEnvIssues(envContent: string, projectRoot: string): EnvIssue[];
44
+ export {};