@forcefield/mcp-server 0.1.11 → 0.1.13
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/build/{chunk-7CDDYIDW.js → chunk-4J4I75VF.js} +18 -8
- package/build/chunk-4J4I75VF.js.map +1 -0
- package/build/{chunk-K464TYAJ.js → chunk-N46MYH57.js} +1 -10
- package/build/chunk-N46MYH57.js.map +1 -0
- package/build/cli/index.js +5 -17
- package/build/cli/index.js.map +1 -1
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/setup/index.js +1 -1
- package/package.json +1 -1
- package/build/chunk-7CDDYIDW.js.map +0 -1
- package/build/chunk-K464TYAJ.js.map +0 -1
|
@@ -52,7 +52,7 @@ import { fileURLToPath } from "url";
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@forcefield/mcp-server",
|
|
55
|
-
version: "0.1.
|
|
55
|
+
version: "0.1.13",
|
|
56
56
|
description: "AI-powered corporate compliance MCP server",
|
|
57
57
|
license: "UNLICENSED",
|
|
58
58
|
type: "module",
|
|
@@ -154,6 +154,12 @@ function getRegistryUrl() {
|
|
|
154
154
|
const configured = getEnv("FORCEFIELD_NPM_REGISTRY_URL") ?? DEFAULT_NPM_REGISTRY_URL;
|
|
155
155
|
return configured.replace(/\/+$/, "");
|
|
156
156
|
}
|
|
157
|
+
function getProjectNpmCache(projectDir) {
|
|
158
|
+
const explicit = getEnv("FORCEFIELD_SETUP_NPM_CACHE") ?? getEnv("npm_config_cache");
|
|
159
|
+
if (explicit) return explicit;
|
|
160
|
+
if (!projectDir) return void 0;
|
|
161
|
+
return join2(projectDir, ".forcefield", ".npm-cache");
|
|
162
|
+
}
|
|
157
163
|
function getPackageOverride() {
|
|
158
164
|
return getEnv("FORCEFIELD_SETUP_MCP_PACKAGE");
|
|
159
165
|
}
|
|
@@ -256,10 +262,14 @@ async function getMcpLaunchConfig() {
|
|
|
256
262
|
args: ["-y", "-p", packageSpecifier, "forcefield-mcp"]
|
|
257
263
|
};
|
|
258
264
|
}
|
|
259
|
-
function buildMcpEnv(apiKey) {
|
|
265
|
+
function buildMcpEnv(apiKey, projectDir) {
|
|
260
266
|
const env = {
|
|
261
267
|
FORCEFIELD_API_KEY: apiKey
|
|
262
268
|
};
|
|
269
|
+
const npmCache = getProjectNpmCache(projectDir);
|
|
270
|
+
if (npmCache) {
|
|
271
|
+
env.npm_config_cache = npmCache;
|
|
272
|
+
}
|
|
263
273
|
if (!isTruthy(process.env.FORCEFIELD_SETUP_FORWARD_ENV)) {
|
|
264
274
|
return env;
|
|
265
275
|
}
|
|
@@ -289,7 +299,7 @@ var claudeCodeAdapter = {
|
|
|
289
299
|
existingServers.forcefield = {
|
|
290
300
|
command: launch.command,
|
|
291
301
|
args: launch.args,
|
|
292
|
-
env: buildMcpEnv(apiKey)
|
|
302
|
+
env: buildMcpEnv(apiKey, projectDir)
|
|
293
303
|
};
|
|
294
304
|
const nextConfig = {
|
|
295
305
|
...existing,
|
|
@@ -340,7 +350,7 @@ var cursorAdapter = {
|
|
|
340
350
|
existingServers.forcefield = {
|
|
341
351
|
command: launch.command,
|
|
342
352
|
args: launch.args,
|
|
343
|
-
env: buildMcpEnv(apiKey)
|
|
353
|
+
env: buildMcpEnv(apiKey, projectDir)
|
|
344
354
|
};
|
|
345
355
|
const merged = {
|
|
346
356
|
...existing,
|
|
@@ -386,7 +396,7 @@ var codexAdapter = {
|
|
|
386
396
|
await mkdir3(codexDir, { recursive: true });
|
|
387
397
|
const configPath = join5(codexDir, "config.toml");
|
|
388
398
|
const launch = await getMcpLaunchConfig();
|
|
389
|
-
const env = buildMcpEnv(apiKey);
|
|
399
|
+
const env = buildMcpEnv(apiKey, projectDir);
|
|
390
400
|
const forcefieldBlock = buildForcefieldTomlBlock(launch.command, launch.args, env);
|
|
391
401
|
let existing = "";
|
|
392
402
|
try {
|
|
@@ -496,7 +506,7 @@ var windsurfAdapter = {
|
|
|
496
506
|
existingServers.forcefield = {
|
|
497
507
|
command: launch.command,
|
|
498
508
|
args: launch.args,
|
|
499
|
-
env: buildMcpEnv(apiKey)
|
|
509
|
+
env: buildMcpEnv(apiKey, projectDir)
|
|
500
510
|
};
|
|
501
511
|
const merged = {
|
|
502
512
|
...existing,
|
|
@@ -795,7 +805,7 @@ var WORKFLOW_DIR_CANDIDATES = [
|
|
|
795
805
|
join7(__dirname2, "..", "..", "workflows")
|
|
796
806
|
];
|
|
797
807
|
var CONFIG_FILE = ".forcefield.json";
|
|
798
|
-
var VERSION = "0.1.
|
|
808
|
+
var VERSION = "0.1.13";
|
|
799
809
|
var BANNER_TEXT = "Forcefield";
|
|
800
810
|
var BANNER_FONT = "Rowan Cap";
|
|
801
811
|
var BANNER_MIN_COLUMNS = 80;
|
|
@@ -1507,4 +1517,4 @@ export {
|
|
|
1507
1517
|
parseArgs,
|
|
1508
1518
|
runSetupCli
|
|
1509
1519
|
};
|
|
1510
|
-
//# sourceMappingURL=chunk-
|
|
1520
|
+
//# sourceMappingURL=chunk-4J4I75VF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../setup/wizard.ts","../setup/ide-detect.ts","../setup/ide-adapters/claude-code.ts","../setup/ide-adapters/mcp-runtime.ts","../package.json","../setup/ide-adapters/cursor.ts","../setup/ide-adapters/codex.ts","../setup/ide-adapters/windsurf.ts","../setup/ide-adapters/index.ts","../setup/auth.ts","../setup/index.ts"],"sourcesContent":["/**\n * setup/wizard.ts — Interactive setup wizard using @clack/prompts.\n *\n * Orchestrates the full setup flow:\n * 1. Welcome banner\n * 2. Existing setup check\n * 3. IDE detection + selection\n * 4. Mode selection (Core vs Full)\n * 5. Authentication\n * 6. Configure + install\n * 7. Verify + success\n */\n\nimport * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport figlet from 'figlet';\nimport gradient from 'gradient-string';\nimport { readFile, writeFile, access } from 'node:fs/promises';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { Ide, SetupMode, SetupConfig, CliArgs } from './types.js';\nimport { detectIde } from './ide-detect.js';\nimport { getAdapter, IDE_CHOICES } from './ide-adapters/index.js';\nimport {\n authenticateAccountAndCreateApiKey,\n authenticateLocalAndCreateApiKey,\n authenticateWithRetry,\n verifyApiKey,\n} from './auth.js';\nimport { extractExactMcpVersion, isMcpVersionPublished } from './ide-adapters/mcp-runtime.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst WORKFLOW_DIR_CANDIDATES = [\n join(__dirname, '..', 'workflows'),\n join(__dirname, '..', '..', 'workflows'),\n];\nconst CONFIG_FILE = '.forcefield.json';\nconst VERSION = '0.1.13';\nconst BANNER_TEXT = 'Forcefield';\nconst BANNER_FONT = 'Rowan Cap';\nconst BANNER_MIN_COLUMNS = 80;\nconst BANNER_FALLBACK_TEXT = ' Forcefield';\nconst BANNER_SUBTITLE = ' Corporate compliance copilot\\n';\n// rainbow2-like palette cycling red -> violet for the terminal banner\nconst BANNER_GRADIENT_STOPS = ['#ff3b3b', '#ff9f1a', '#ffe74c', '#2ed573', '#1e90ff', '#7d5fff', '#e056fd'];\nconst bannerGradient = gradient(BANNER_GRADIENT_STOPS);\n\nasync function resolveWorkflowsDir(): Promise<string> {\n for (const dir of WORKFLOW_DIR_CANDIDATES) {\n try {\n await access(dir);\n return dir;\n } catch {\n // try next candidate\n }\n }\n throw new Error(\n `Unable to locate workflow templates. Checked: ${WORKFLOW_DIR_CANDIDATES.join(', ')}`,\n );\n}\n\n/**\n * Run the interactive setup wizard.\n */\nexport async function runWizard(projectDir: string, args: CliArgs): Promise<void> {\n // --status: read-only check\n if (args.status) {\n await showStatus(projectDir);\n return;\n }\n\n // --doctor: setup diagnostics\n if (args.doctor) {\n await runDoctor(projectDir, args);\n return;\n }\n\n // Non-interactive mode\n if (args.ide && args.mode && (args.token || args.localAuth || (args.email && args.password))) {\n await runNonInteractive(projectDir, args);\n return;\n }\n\n // Interactive mode\n await runInteractive(projectDir, args);\n}\n\n// === Welcome Banner ===\n\nfunction showBanner(): void {\n const cols = process.stdout.columns || 80;\n\n if (cols >= BANNER_MIN_COLUMNS) {\n try {\n const banner = figlet.textSync(BANNER_TEXT, { font: BANNER_FONT });\n const colored = applyBannerGradient(banner);\n console.log(colored);\n } catch {\n // figlet font not available — use fallback\n console.log(pc.bold(applyBannerGradient(BANNER_FALLBACK_TEXT)));\n }\n } else {\n console.log(pc.bold(applyBannerGradient(BANNER_FALLBACK_TEXT)));\n }\n console.log(pc.dim(BANNER_SUBTITLE));\n}\n\nfunction applyBannerGradient(text: string): string {\n return bannerGradient.multiline(text);\n}\n\n// === Status Check ===\n\nasync function showStatus(projectDir: string): Promise<void> {\n const config = await readConfig(projectDir);\n\n if (!config) {\n console.log(pc.yellow('No Forcefield setup found in this directory.'));\n console.log(`Run ${pc.cyan('forcefield setup')} to get started.`);\n process.exit(1);\n }\n\n console.log(pc.bold('Forcefield Setup Status'));\n console.log(` IDE: ${pc.cyan(config.ide)}`);\n console.log(` Mode: ${pc.cyan(config.mode)}`);\n console.log(` Version: ${pc.cyan(config.version)}`);\n console.log(` Installed: ${pc.dim(config.installed_at)}`);\n}\n\ninterface DoctorCheckResult {\n ok: boolean;\n label: string;\n detail: string;\n}\n\ninterface McpCheckResult {\n ok: boolean;\n filePath: string;\n key?: string;\n supabaseUrl?: string;\n packageSpecifier?: string;\n detail: string;\n}\n\nasync function runDoctor(projectDir: string, args: CliArgs): Promise<void> {\n console.log(pc.bold('Forcefield Setup Doctor'));\n console.log(pc.dim(`Project: ${projectDir}`));\n\n const checks: DoctorCheckResult[] = [];\n const config = await readConfig(projectDir);\n\n if (!config) {\n checks.push({\n ok: false,\n label: 'Setup config',\n detail: `Missing ${CONFIG_FILE}. Run forcefield setup first.`,\n });\n } else {\n checks.push({\n ok: true,\n label: 'Setup config',\n detail: `${config.ide} / ${config.mode} / v${config.version}`,\n });\n\n const mcp = await inspectMcpConfig(projectDir, config.ide);\n checks.push({\n ok: mcp.ok,\n label: 'MCP config',\n detail: `${mcp.filePath} — ${mcp.detail}`,\n });\n\n const packageCheck = await evaluateMcpPackageSpecifier(mcp.packageSpecifier);\n if (packageCheck) {\n checks.push(packageCheck);\n }\n\n if (mcp.key) {\n const verified = await verifyApiKey(mcp.key, {\n localDev: isLocalSetupMode(args),\n supabaseUrl: mcp.supabaseUrl,\n });\n checks.push({\n ok: verified.valid,\n label: 'API key exchange',\n detail: verified.valid\n ? `Key exchange succeeded${mcp.supabaseUrl ? ` (${mcp.supabaseUrl})` : ''}.`\n : (verified.error ?? 'Key exchange failed.'),\n });\n } else {\n checks.push({\n ok: false,\n label: 'API key exchange',\n detail: 'FORCEFIELD_API_KEY not found in MCP config env.',\n });\n }\n }\n\n for (const check of checks) {\n const symbol = check.ok ? pc.green('✓') : pc.red('✗');\n console.log(`${symbol} ${pc.bold(check.label)}: ${check.detail}`);\n }\n\n const failures = checks.filter((check) => !check.ok);\n if (failures.length > 0) {\n console.log('');\n console.log(pc.yellow('Suggested fixes:'));\n console.log(` 1. Re-run ${pc.cyan('forcefield setup')} in this project.`);\n console.log(` 2. Confirm your coding agent shows Forcefield connected (${pc.cyan('/mcp')}).`);\n console.log(` 3. Re-run ${pc.cyan('forcefield doctor')} after setup.`);\n process.exit(1);\n }\n\n console.log('');\n console.log(pc.green('Doctor checks passed. Forcefield should be ready.'));\n}\n\nasync function inspectMcpConfig(projectDir: string, ide: Ide): Promise<McpCheckResult> {\n if (ide === 'claude-code') {\n return inspectJsonMcpConfig(join(projectDir, '.mcp.json'), 'mcpServers');\n }\n\n if (ide === 'cursor') {\n return inspectJsonMcpConfig(join(projectDir, '.cursor', 'mcp.json'), 'mcpServers');\n }\n\n if (ide === 'windsurf') {\n return inspectJsonMcpConfig(join(projectDir, '.windsurf', 'mcp_config.json'), 'mcpServers');\n }\n\n return inspectCodexMcpConfig(join(projectDir, '.codex', 'config.toml'));\n}\n\nasync function inspectJsonMcpConfig(\n filePath: string,\n rootKey: string,\n): Promise<McpCheckResult> {\n let raw = '';\n try {\n raw = await readFile(filePath, 'utf-8');\n } catch {\n return {\n ok: false,\n filePath,\n detail: 'File not found.',\n };\n }\n\n let parsed: Record<string, unknown>;\n try {\n parsed = JSON.parse(raw) as Record<string, unknown>;\n } catch {\n return {\n ok: false,\n filePath,\n detail: 'Invalid JSON.',\n };\n }\n\n const servers =\n typeof parsed[rootKey] === 'object' && parsed[rootKey] != null\n ? (parsed[rootKey] as Record<string, unknown>)\n : null;\n\n if (!servers || typeof servers.forcefield !== 'object' || servers.forcefield == null) {\n return {\n ok: false,\n filePath,\n detail: 'Missing forcefield MCP server entry.',\n };\n }\n\n const ffServer = servers.forcefield as Record<string, unknown>;\n const command = typeof ffServer.command === 'string' ? ffServer.command : '';\n const args = Array.isArray(ffServer.args) ? ffServer.args : [];\n const env = typeof ffServer.env === 'object' && ffServer.env != null\n ? (ffServer.env as Record<string, unknown>)\n : {};\n const key = typeof env.FORCEFIELD_API_KEY === 'string'\n ? env.FORCEFIELD_API_KEY\n : undefined;\n const supabaseUrl = typeof env.SUPABASE_URL === 'string'\n ? env.SUPABASE_URL\n : undefined;\n const packageSpecifier = extractPackageSpecifierFromNpxArgs(args);\n\n if (!command) {\n return {\n ok: false,\n filePath,\n key,\n supabaseUrl,\n packageSpecifier,\n detail: 'forcefield entry missing command.',\n };\n }\n\n return {\n ok: true,\n filePath,\n key,\n supabaseUrl,\n packageSpecifier,\n detail: `Found forcefield entry (command: ${command}${supabaseUrl ? `, supabase: ${supabaseUrl}` : ''}).`,\n };\n}\n\nasync function inspectCodexMcpConfig(filePath: string): Promise<McpCheckResult> {\n let raw = '';\n try {\n raw = await readFile(filePath, 'utf-8');\n } catch {\n return {\n ok: false,\n filePath,\n detail: 'File not found.',\n };\n }\n\n const command = extractTomlValue(raw, /^\\s*command\\s*=\\s*\"([^\"]+)\"/m);\n const key = extractTomlValue(raw, /^\\s*FORCEFIELD_API_KEY\\s*=\\s*\"([^\"]+)\"/m);\n const supabaseUrl = extractTomlValue(raw, /^\\s*SUPABASE_URL\\s*=\\s*\"([^\"]+)\"/m);\n const packageSpecifier = extractTomlValue(\n raw,\n /^\\s*args\\s*=\\s*\\[[^\\]]*(?:\"-p\"|\"--package\")\\s*,\\s*\"([^\"]+)\"[^\\]]*\\]/m,\n );\n const hasServerSection = raw.includes('[mcp_servers.forcefield]');\n\n if (!hasServerSection) {\n return {\n ok: false,\n filePath,\n key,\n supabaseUrl,\n packageSpecifier,\n detail: 'Missing [mcp_servers.forcefield] section.',\n };\n }\n\n if (!command) {\n return {\n ok: false,\n filePath,\n key,\n supabaseUrl,\n packageSpecifier,\n detail: 'forcefield section missing command.',\n };\n }\n\n return {\n ok: true,\n filePath,\n key,\n supabaseUrl,\n packageSpecifier,\n detail: `Found forcefield section (command: ${command}${supabaseUrl ? `, supabase: ${supabaseUrl}` : ''}).`,\n };\n}\n\nfunction extractPackageSpecifierFromNpxArgs(args: unknown[]): string | undefined {\n const stringArgs = args.filter((value): value is string => typeof value === 'string');\n const pkgIndex = stringArgs.findIndex((value) => value === '-p' || value === '--package');\n if (pkgIndex < 0) return undefined;\n const specifier = stringArgs[pkgIndex + 1];\n if (!specifier) return undefined;\n return specifier;\n}\n\nasync function evaluateMcpPackageSpecifier(\n packageSpecifier: string | undefined,\n): Promise<DoctorCheckResult | null> {\n if (!packageSpecifier) return null;\n\n const exactVersion = extractExactMcpVersion(packageSpecifier);\n if (!exactVersion) {\n return {\n ok: true,\n label: 'MCP package version',\n detail: `Using tag-based MCP package specifier (${packageSpecifier}).`,\n };\n }\n\n const published = await isMcpVersionPublished(exactVersion);\n if (published === false) {\n return {\n ok: false,\n label: 'MCP package version',\n detail: `Configured MCP package ${packageSpecifier} is not published. Run forcefield setup to rewrite MCP config to a published version.`,\n };\n }\n\n if (published === true) {\n return {\n ok: true,\n label: 'MCP package version',\n detail: `Published MCP package detected (${packageSpecifier}).`,\n };\n }\n\n return {\n ok: true,\n label: 'MCP package version',\n detail: `Could not verify ${packageSpecifier} publication (registry unreachable).`,\n };\n}\n\nfunction extractTomlValue(content: string, pattern: RegExp): string | undefined {\n const match = content.match(pattern);\n return match?.[1];\n}\n\n// === Non-Interactive Mode ===\n\nasync function runNonInteractive(projectDir: string, args: CliArgs): Promise<void> {\n const ide = args.ide!;\n const mode = args.mode!;\n let apiKey = args.token;\n\n if (args.localAuth) {\n if (!args.email || !args.password) {\n console.error(pc.red('Non-interactive local auth requires --email and --password.'));\n process.exit(1);\n }\n\n const auth = await authenticateLocalAndCreateApiKey(args.email, args.password, {\n label: 'Setup Wizard (Local)',\n });\n apiKey = auth.apiKey;\n console.log(`Created local API key for ${auth.email}.`);\n } else if (!apiKey && args.email && args.password) {\n const auth = await authenticateAccountAndCreateApiKey(args.email, args.password, {\n label: 'Setup Wizard Key',\n localDev: isLocalSetupMode(args),\n });\n apiKey = auth.apiKey;\n console.log(`Created API key for ${auth.email}.`);\n } else if (apiKey) {\n const verified = await authenticateWithRetry(async () => apiKey ?? null, {\n localDev: isLocalSetupMode(args),\n });\n if (!verified.valid) {\n console.error(pc.red(verified.error ?? 'API key validation failed.'));\n process.exit(1);\n }\n apiKey = verified.apiKey;\n }\n\n if (!apiKey) {\n console.error(pc.red('Missing auth input. Pass --token, --local-auth, or --email/--password.'));\n process.exit(1);\n }\n\n console.log(`Setting up Forcefield for ${ide} in ${mode} mode...`);\n\n await configure(projectDir, ide, mode, apiKey);\n\n console.log(pc.green('Setup complete!'));\n for (const line of getPostSetupInstructions(ide, mode, projectDir)) {\n console.log(line);\n }\n}\n\n// === Interactive Mode ===\n\nasync function runInteractive(projectDir: string, preArgs: CliArgs): Promise<void> {\n showBanner();\n\n p.intro(pc.bgCyan(pc.black(' Forcefield Setup ')));\n\n // Step 1: Check existing setup\n const existingConfig = await readConfig(projectDir);\n if (existingConfig) {\n const updateChoice = await p.select({\n message: `Forcefield is already set up (${existingConfig.ide}, ${existingConfig.mode} mode).`,\n options: [\n { value: 'update', label: 'Update existing setup', hint: 'Refresh workflows + auth' },\n { value: 'fresh', label: 'Start fresh', hint: 'Remove existing config and reconfigure' },\n ],\n });\n\n if (p.isCancel(updateChoice)) {\n p.cancel('Setup cancelled.');\n process.exit(0);\n }\n\n if (updateChoice === 'update') {\n // Re-run configure with existing settings\n const apiKey = await promptApiKey();\n if (!apiKey) return;\n await configure(projectDir, existingConfig.ide, existingConfig.mode, apiKey);\n showSuccess(existingConfig.ide, existingConfig.mode, projectDir);\n return;\n }\n // fresh → continue with full wizard\n }\n\n // Step 2: IDE detection + selection\n const ide = preArgs.ide ?? await promptIde(projectDir);\n if (!ide) return;\n\n // Step 3: Mode selection\n const mode = preArgs.mode ?? await promptMode();\n if (!mode) return;\n\n // Step 4: Authentication\n const apiKey = preArgs.token ?? await promptApiKey(preArgs);\n if (!apiKey) return;\n\n // Step 5: Configure + install\n const s = p.spinner();\n s.start('Configuring Forcefield...');\n\n try {\n await configure(projectDir, ide, mode, apiKey);\n s.stop('Configuration complete.');\n } catch (err) {\n s.stop('Configuration failed.');\n p.cancel(err instanceof Error ? err.message : 'Unknown error');\n process.exit(1);\n }\n\n // Step 6: Success\n showSuccess(ide, mode, projectDir);\n}\n\n// === Prompts ===\n\nasync function promptIde(projectDir: string): Promise<Ide | null> {\n const detection = await detectIde(projectDir);\n\n if (detection.detected) {\n const adapter = getAdapter(detection.detected);\n const confirm = await p.confirm({\n message: `Detected ${adapter.name} (${detection.markers[0]!.marker} found). Use ${adapter.name}?`,\n });\n\n if (p.isCancel(confirm)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n if (confirm) return detection.detected;\n }\n\n const choice = await p.select({\n message: 'Which IDE do you use?',\n options: IDE_CHOICES,\n });\n\n if (p.isCancel(choice)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n return choice as Ide;\n}\n\nasync function promptMode(): Promise<SetupMode | null> {\n const choice = await p.select({\n message: 'Installation type:',\n options: [\n { value: 'full' as const, label: 'Full — MCP server + guided workflows', hint: 'Recommended' },\n { value: 'core' as const, label: 'Core — MCP server only', hint: 'Minimal' },\n ],\n });\n\n if (p.isCancel(choice)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n return choice as SetupMode;\n}\n\nasync function promptApiKey(preArgs?: CliArgs): Promise<string | null> {\n if (preArgs?.localAuth) {\n const preEmail = preArgs.email ?? await promptTextValue('Local test email:', 'alice@test.local');\n const prePassword = preArgs.password ?? await promptPasswordValue(\n 'Local test password:',\n 'Confirm local test password:',\n );\n if (!preEmail || !prePassword) return null;\n\n try {\n const result = await authenticateLocalAndCreateApiKey(preEmail, prePassword, {\n label: 'Setup Wizard (Local)',\n });\n p.log.success(`Created local API key for ${result.email}.`);\n return result.apiKey;\n } catch (err) {\n p.log.error(err instanceof Error ? err.message : 'Failed local auth');\n return null;\n }\n }\n\n const localMode = isLocalSetupMode(preArgs);\n const methodOptions = [\n { value: 'account', label: 'Sign in / create account + API key', hint: 'Recommended' },\n { value: 'paste', label: 'Paste existing API key', hint: 'Use an existing ff_live_... key' },\n ];\n\n if (localMode) {\n methodOptions.push({\n value: 'local',\n label: 'Create local account + API key',\n hint: 'For local Supabase testing',\n });\n }\n\n const method = await p.select({\n message: 'How do you want to authenticate?',\n options: methodOptions,\n });\n\n if (p.isCancel(method)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n if (method === 'account') {\n const email = await promptTextValue('Account email:', preArgs?.email ?? 'you@company.com');\n const password = preArgs?.password ?? await promptPasswordValue(\n 'Account password:',\n 'Confirm account password:',\n );\n if (!email || !password) return null;\n\n try {\n const result = await authenticateAccountAndCreateApiKey(email, password, {\n label: 'Setup Wizard Key',\n localDev: localMode,\n });\n p.log.success(`Created API key for ${result.email}.`);\n return result.apiKey;\n } catch (err) {\n p.log.error(err instanceof Error ? err.message : 'Account authentication failed');\n return null;\n }\n }\n\n if (method === 'local') {\n const email = await promptTextValue('Local test email:', 'alice@test.local');\n const password = await promptPasswordValue(\n 'Local test password:',\n 'Confirm local test password:',\n );\n if (!email || !password) return null;\n\n try {\n const result = await authenticateLocalAndCreateApiKey(email, password, {\n label: 'Setup Wizard (Local)',\n });\n p.log.success(`Created local API key for ${result.email}.`);\n return result.apiKey;\n } catch (err) {\n p.log.error(err instanceof Error ? err.message : 'Failed local auth');\n return null;\n }\n }\n\n const auth = await authenticateWithRetry(\n async () => {\n const key = await p.text({\n message: 'Enter your Forcefield API key:',\n placeholder: 'ff_live_...',\n validate: (value) => {\n if (!value) return 'API key is required.';\n if (!value.startsWith('ff_live_')) return 'Key must start with \"ff_live_\".';\n if (value.length < 20) return 'Key seems too short.';\n return undefined;\n },\n });\n\n if (p.isCancel(key)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n return key;\n },\n {\n localDev: localMode,\n },\n );\n\n if (!auth.valid) {\n p.log.error(auth.error ?? 'Authentication failed. Check your credentials and retry.');\n return null;\n }\n\n return auth.apiKey;\n}\n\nfunction isLocalSetupMode(preArgs?: CliArgs): boolean {\n if (preArgs?.localAuth) return true;\n const localValue = process.env.FORCEFIELD_LOCAL_DEV;\n if (localValue) {\n const normalized = localValue.trim().toLowerCase();\n if (['1', 'true', 'yes', 'on'].includes(normalized)) {\n return true;\n }\n }\n\n const supabaseUrl = process.env.SUPABASE_URL;\n if (!supabaseUrl) return false;\n try {\n const parsed = new URL(supabaseUrl);\n return parsed.hostname === '127.0.0.1' || parsed.hostname === 'localhost';\n } catch {\n return false;\n }\n}\n\nasync function promptTextValue(\n message: string,\n placeholder: string,\n): Promise<string | null> {\n const value = await p.text({\n message,\n placeholder,\n validate: (input) => {\n if (!input) return 'This field is required.';\n return undefined;\n },\n });\n\n if (p.isCancel(value)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n return value;\n}\n\nasync function promptPasswordValue(\n message: string,\n confirmMessage?: string,\n): Promise<string | null> {\n const password = await p.password({\n message,\n validate: (input) => {\n if (!input) return 'Password is required.';\n if (input.length < 8) return 'Password must be at least 8 characters.';\n return undefined;\n },\n });\n\n if (p.isCancel(password)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n if (!confirmMessage) {\n return password;\n }\n\n const confirm = await p.password({\n message: confirmMessage,\n validate: (input) => {\n if (!input) return 'Please confirm your password.';\n return undefined;\n },\n });\n\n if (p.isCancel(confirm)) {\n p.cancel('Setup cancelled.');\n return null;\n }\n\n if (password !== confirm) {\n p.log.error('Passwords do not match. Please run setup again.');\n return null;\n }\n\n return password;\n}\n\n// === Configure ===\n\nasync function configure(\n projectDir: string,\n ide: Ide,\n mode: SetupMode,\n apiKey: string,\n): Promise<void> {\n const adapter = getAdapter(ide);\n\n // Configure MCP\n await adapter.configureMcp(projectDir, apiKey);\n\n // Install workflows (full mode only)\n let workflowCount = 0;\n if (mode === 'full') {\n const workflowsDir = await resolveWorkflowsDir();\n workflowCount = await adapter.installWorkflows(projectDir, workflowsDir);\n }\n\n // Write config\n const config: SetupConfig = {\n ide,\n mode,\n installed_at: new Date().toISOString(),\n version: VERSION,\n };\n await writeConfig(projectDir, config);\n\n void workflowCount; // Used in logging below\n}\n\nfunction getPostSetupInstructions(ide: Ide, mode: SetupMode, projectDir: string): string[] {\n const repo = pc.cyan(projectDir);\n const dashboardHint = [\n `Optional beta companion: run ${pc.cyan('forcefield dashboard start')} to scaffold and launch the local dashboard (hosted backend by default).`,\n `If ${pc.cyan('forcefield')} is not installed globally, use ${pc.cyan('npx -y @forcefield/forcefield dashboard start')}. Advanced mode: pass ${pc.cyan('--local')} for local Supabase.`,\n ];\n\n if (mode === 'core') {\n return [\n `Next: open your coding agent in ${repo} and use Forcefield MCP tools directly (e.g. ${pc.cyan('ff_system(action: \"health\")')}).`,\n ...dashboardHint,\n ];\n }\n\n const common = [\n `Next: start your coding agent in ${repo}.`,\n `Then in IDE chat (not terminal), run ${pc.cyan('/ff-onboard')} to set up your company profile and deadlines.`,\n `Optional: run ${pc.cyan('/ff-start')} only if you want a command primer or connection troubleshooting.`,\n `If connection fails, run ${pc.cyan('forcefield doctor')} in terminal for diagnostics.`,\n ...dashboardHint,\n ];\n\n if (ide === 'claude-code') {\n return [\n ...common,\n `If tools are missing, run ${pc.cyan('/mcp')} and confirm ${pc.cyan('forcefield')} is connected.`,\n ];\n }\n\n return common;\n}\n\nfunction showSuccess(ide: Ide, mode: SetupMode, projectDir: string): void {\n const adapter = getAdapter(ide);\n const workflowStatus =\n mode === 'full'\n ? `${pc.green('✓')} Project workflow commands installed`\n : `${pc.yellow('•')} Core mode selected (no slash-command workflows installed)`;\n\n p.note(\n [\n `${pc.green('✓')} MCP server configured`,\n workflowStatus,\n `${pc.green('✓')} IDE: ${adapter.name}`,\n ].join('\\n'),\n 'Setup Complete',\n );\n\n p.outro(getPostSetupInstructions(ide, mode, projectDir).join('\\n'));\n}\n\n// === Config File ===\n\nasync function readConfig(projectDir: string): Promise<SetupConfig | null> {\n const configPath = join(projectDir, CONFIG_FILE);\n try {\n await access(configPath);\n const raw = await readFile(configPath, 'utf-8');\n return JSON.parse(raw) as SetupConfig;\n } catch {\n return null;\n }\n}\n\nasync function writeConfig(projectDir: string, config: SetupConfig): Promise<void> {\n const configPath = join(projectDir, CONFIG_FILE);\n await writeFile(configPath, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n}\n\nexport {\n readConfig,\n writeConfig,\n CONFIG_FILE,\n VERSION,\n BANNER_FONT,\n BANNER_MIN_COLUMNS,\n BANNER_GRADIENT_STOPS,\n showBanner,\n applyBannerGradient,\n getPostSetupInstructions,\n inspectMcpConfig,\n inspectJsonMcpConfig,\n inspectCodexMcpConfig,\n extractPackageSpecifierFromNpxArgs,\n evaluateMcpPackageSpecifier,\n extractTomlValue,\n};\n","/**\n * setup/ide-detect.ts — Auto-detect IDE from project directory markers.\n */\n\nimport { access } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { Ide } from './types.js';\n\ninterface DetectionResult {\n detected: Ide | null;\n markers: Array<{ ide: Ide; marker: string }>;\n}\n\nconst IDE_MARKERS: Array<{ ide: Ide; marker: string; isDir: boolean }> = [\n { ide: 'claude-code', marker: '.claude', isDir: true },\n { ide: 'cursor', marker: '.cursor', isDir: true },\n { ide: 'codex', marker: 'AGENTS.md', isDir: false },\n { ide: 'windsurf', marker: '.windsurfrules', isDir: false },\n];\n\nexport async function detectIde(projectDir: string): Promise<DetectionResult> {\n const found: Array<{ ide: Ide; marker: string }> = [];\n\n for (const { ide, marker } of IDE_MARKERS) {\n const markerPath = join(projectDir, marker);\n try {\n await access(markerPath);\n found.push({ ide, marker });\n } catch {\n // Marker not found — skip\n }\n }\n\n return {\n detected: found.length === 1 ? found[0]!.ide : null,\n markers: found,\n };\n}\n\nexport { IDE_MARKERS };\n","/**\n * IDE adapter for Claude Code.\n * Workflows → .claude/commands/ff-*.md\n * MCP → project-scoped .mcp.json entry\n */\n\nimport { mkdir, readdir, copyFile, rm, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IdeAdapter } from '../types.js';\nimport { buildMcpEnv, getMcpLaunchConfig } from './mcp-runtime.js';\n\nexport const claudeCodeAdapter: IdeAdapter = {\n name: 'Claude Code',\n\n async configureMcp(projectDir: string, apiKey: string): Promise<void> {\n // Ensure Claude config folder exists for slash-command workflows.\n const claudeDir = join(projectDir, '.claude');\n await mkdir(claudeDir, { recursive: true });\n\n // Configure project-scoped MCP entry used by Claude Code.\n const launch = await getMcpLaunchConfig();\n const mcpPath = join(projectDir, '.mcp.json');\n\n let existing: Record<string, unknown> = {};\n try {\n existing = JSON.parse(await readFile(mcpPath, 'utf-8')) as Record<string, unknown>;\n } catch {\n // file missing/invalid: start fresh\n }\n\n const existingServers =\n typeof existing.mcpServers === 'object' && existing.mcpServers != null\n ? (existing.mcpServers as Record<string, unknown>)\n : {};\n\n existingServers.forcefield = {\n command: launch.command,\n args: launch.args,\n env: buildMcpEnv(apiKey, projectDir),\n };\n\n const nextConfig = {\n ...existing,\n mcpServers: existingServers,\n };\n\n await writeFile(mcpPath, JSON.stringify(nextConfig, null, 2) + '\\n', 'utf-8');\n },\n\n async installWorkflows(projectDir: string, workflowsDir: string): Promise<number> {\n const commandsDir = join(projectDir, '.claude', 'commands');\n await mkdir(commandsDir, { recursive: true });\n\n const files = await readdir(workflowsDir);\n const mdFiles = files.filter((f) => f.startsWith('ff-') && f.endsWith('.md'));\n\n for (const file of mdFiles) {\n await copyFile(join(workflowsDir, file), join(commandsDir, file));\n }\n\n return mdFiles.length;\n },\n\n async removeWorkflows(projectDir: string): Promise<void> {\n const commandsDir = join(projectDir, '.claude', 'commands');\n try {\n const files = await readdir(commandsDir);\n for (const file of files) {\n if (file.startsWith('ff-') && file.endsWith('.md')) {\n await rm(join(commandsDir, file));\n }\n }\n } catch {\n // Directory doesn't exist — nothing to remove\n }\n },\n};\n","import { access } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport packageJson from '../../package.json';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst MCP_PACKAGE_NAME = '@forcefield/mcp-server';\nconst DEFAULT_NPM_REGISTRY_URL = 'https://registry.npmjs.org';\nconst NPM_METADATA_TIMEOUT_MS = 2000;\nconst LOCAL_ENTRY_CANDIDATES = [\n join(__dirname, '..', '..', 'build', 'index.js'),\n join(__dirname, '..', '..', 'index.js'),\n];\n\nconst FORWARDED_ENV_KEYS = [\n 'SUPABASE_URL',\n 'SUPABASE_ANON_KEY',\n 'FORCEFIELD_LOCAL_DEV',\n 'FORCEFIELD_DISABLE_GATING',\n 'FORCEFIELD_LOCAL_DATA_FALLBACK',\n] as const;\n\ninterface NpmPackageMetadata {\n versions?: Record<string, unknown>;\n 'dist-tags'?: Record<string, unknown>;\n}\n\nlet metadataCache: { registryUrl: string; promise: Promise<NpmPackageMetadata | null> } | null = null;\n\nexport function resetMcpRuntimeCacheForTests(): void {\n metadataCache = null;\n}\n\nfunction getEnv(name: string): string | undefined {\n const value = process.env[name];\n if (!value) return undefined;\n const trimmed = value.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n}\n\nfunction getLocalPackageVersion(): string | undefined {\n const version =\n typeof packageJson === 'object' && packageJson && 'version' in packageJson\n ? (packageJson.version as string | undefined)\n : undefined;\n return version?.trim() || undefined;\n}\n\nfunction getDefaultDistTag(): string {\n const publishConfig =\n typeof packageJson === 'object' && packageJson && 'publishConfig' in packageJson\n ? (packageJson.publishConfig as Record<string, unknown>)\n : undefined;\n const packageTag =\n publishConfig && typeof publishConfig.tag === 'string'\n ? publishConfig.tag.trim()\n : '';\n return packageTag || 'latest';\n}\n\nfunction getTargetDistTag(): string {\n return getEnv('FORCEFIELD_SETUP_MCP_DIST_TAG') ?? getDefaultDistTag();\n}\n\nfunction getRegistryUrl(): string {\n const configured = getEnv('FORCEFIELD_NPM_REGISTRY_URL') ?? DEFAULT_NPM_REGISTRY_URL;\n return configured.replace(/\\/+$/, '');\n}\n\nfunction getProjectNpmCache(projectDir: string | undefined): string | undefined {\n const explicit =\n getEnv('FORCEFIELD_SETUP_NPM_CACHE')\n ?? getEnv('npm_config_cache');\n if (explicit) return explicit;\n if (!projectDir) return undefined;\n return join(projectDir, '.forcefield', '.npm-cache');\n}\n\nfunction getPackageOverride(): string | undefined {\n return getEnv('FORCEFIELD_SETUP_MCP_PACKAGE');\n}\n\nfunction isExactVersion(value: string): boolean {\n return /^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/.test(value);\n}\n\nexport function extractExactMcpVersion(specifier: string): string | undefined {\n const prefix = `${MCP_PACKAGE_NAME}@`;\n if (!specifier.startsWith(prefix)) return undefined;\n const version = specifier.slice(prefix.length).trim();\n if (!isExactVersion(version)) return undefined;\n return version;\n}\n\nasync function fetchPackageMetadata(registryUrl: string): Promise<NpmPackageMetadata | null> {\n const encodedPackage = encodeURIComponent(MCP_PACKAGE_NAME);\n const endpoint = `${registryUrl}/${encodedPackage}`;\n\n try {\n const response = await fetch(endpoint, {\n headers: {\n Accept: 'application/json',\n },\n signal: AbortSignal.timeout(NPM_METADATA_TIMEOUT_MS),\n });\n\n if (!response.ok) {\n return null;\n }\n\n const payload = await response.json();\n if (!payload || typeof payload !== 'object') {\n return null;\n }\n return payload as NpmPackageMetadata;\n } catch {\n return null;\n }\n}\n\nasync function getPackageMetadata(registryUrl: string): Promise<NpmPackageMetadata | null> {\n if (metadataCache && metadataCache.registryUrl === registryUrl) {\n return metadataCache.promise;\n }\n\n const promise = fetchPackageMetadata(registryUrl);\n metadataCache = { registryUrl, promise };\n return promise;\n}\n\nasync function resolvePackageSpecifier(): Promise<string> {\n const override = getPackageOverride();\n if (override) return override;\n\n const localVersion = getLocalPackageVersion();\n const targetDistTag = getTargetDistTag();\n\n if (isExactVersion(targetDistTag)) {\n return `${MCP_PACKAGE_NAME}@${targetDistTag}`;\n }\n\n const metadata = await getPackageMetadata(getRegistryUrl());\n if (!metadata) {\n return `${MCP_PACKAGE_NAME}@${targetDistTag}`;\n }\n\n if (localVersion && metadata.versions && localVersion in metadata.versions) {\n return `${MCP_PACKAGE_NAME}@${localVersion}`;\n }\n\n const distTags = metadata['dist-tags'];\n const pinnedDistTagVersion =\n distTags && typeof distTags[targetDistTag] === 'string'\n ? String(distTags[targetDistTag]).trim()\n : '';\n\n if (pinnedDistTagVersion) {\n return `${MCP_PACKAGE_NAME}@${pinnedDistTagVersion}`;\n }\n\n return `${MCP_PACKAGE_NAME}@${targetDistTag}`;\n}\n\nexport async function isMcpVersionPublished(version: string): Promise<boolean | null> {\n if (!isExactVersion(version)) return false;\n const metadata = await getPackageMetadata(getRegistryUrl());\n if (!metadata) return null;\n return Boolean(metadata.versions && version in metadata.versions);\n}\n\nfunction isTruthy(value: string | undefined): boolean {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on';\n}\n\nasync function resolveLocalEntry(): Promise<string | null> {\n for (const candidate of LOCAL_ENTRY_CANDIDATES) {\n try {\n await access(candidate);\n return candidate;\n } catch {\n // try next candidate\n }\n }\n return null;\n}\n\nexport async function getMcpLaunchConfig(): Promise<{ command: string; args: string[] }> {\n if (\n isTruthy(process.env.FORCEFIELD_LOCAL_DEV)\n || isTruthy(process.env.FORCEFIELD_SETUP_USE_LOCAL_BUILD)\n ) {\n const localEntry = await resolveLocalEntry();\n if (localEntry) {\n return {\n command: process.execPath,\n args: [localEntry],\n };\n }\n }\n\n const packageSpecifier = await resolvePackageSpecifier();\n return {\n command: 'npx',\n args: ['-y', '-p', packageSpecifier, 'forcefield-mcp'],\n };\n}\n\nexport function buildMcpEnv(apiKey: string, projectDir?: string): Record<string, string> {\n const env: Record<string, string> = {\n FORCEFIELD_API_KEY: apiKey,\n };\n\n const npmCache = getProjectNpmCache(projectDir);\n if (npmCache) {\n env.npm_config_cache = npmCache;\n }\n\n // Default to hosted-first deterministic config.\n // Forwarding setup-shell env into MCP runtime is opt-in to avoid\n // accidentally persisting local/dev flags into project config.\n if (!isTruthy(process.env.FORCEFIELD_SETUP_FORWARD_ENV)) {\n return env;\n }\n\n for (const key of FORWARDED_ENV_KEYS) {\n const value = process.env[key];\n if (value && value.trim().length > 0) {\n env[key] = value;\n }\n }\n\n return env;\n}\n","{\n \"name\": \"@forcefield/mcp-server\",\n \"version\": \"0.1.13\",\n \"description\": \"AI-powered corporate compliance MCP server\",\n \"license\": \"UNLICENSED\",\n \"type\": \"module\",\n \"publishConfig\": {\n \"access\": \"public\",\n \"tag\": \"beta\"\n },\n \"bin\": {\n \"forcefield\": \"build/cli/index.js\",\n \"forcefield-mcp\": \"build/index.js\",\n \"forcefield-setup\": \"build/cli/index.js\"\n },\n \"files\": [\n \"build/\",\n \"workflows/\"\n ],\n \"engines\": {\n \"node\": \">=20.0.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/forcefield-ai/forcefield.git\"\n },\n \"keywords\": [\n \"mcp\",\n \"compliance\",\n \"corporate\",\n \"formation\",\n \"cap-table\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"release:check\": \"node --import tsx scripts/check-release-policy.ts\",\n \"prepublishOnly\": \"npm run release:check && npm run build\",\n \"seed:data\": \"tsx scripts/seed-static-content.ts\",\n \"local:user\": \"tsx scripts/local-user.ts\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"^1.0.1\",\n \"@modelcontextprotocol/sdk\": \"^1.26.0\",\n \"@supabase/supabase-js\": \"^2.97.0\",\n \"exceljs\": \"^4.4.0\",\n \"figlet\": \"^1.10.0\",\n \"gradient-string\": \"^3.0.0\",\n \"html-to-docx\": \"^1.8.0\",\n \"markdown-it\": \"^14.1.1\",\n \"mupdf\": \"^1.27.0\",\n \"officeparser\": \"^5.1.1\",\n \"pdfjs-dist\": \"^4.10.38\",\n \"picocolors\": \"^1.1.1\",\n \"tesseract.js\": \"^5.1.1\",\n \"zod\": \"^4.3.6\"\n },\n \"devDependencies\": {\n \"@forcefield/shared\": \"workspace:*\",\n \"@types/figlet\": \"^1.7.0\",\n \"@types/gradient-string\": \"^1.1.6\",\n \"@types/markdown-it\": \"^14.1.2\"\n }\n}\n","/**\n * IDE adapter for Cursor.\n * Workflows → .cursor/rules/ff-*.md\n * MCP → .cursor/mcp.json\n */\n\nimport { mkdir, readdir, copyFile, rm, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IdeAdapter } from '../types.js';\nimport { buildMcpEnv, getMcpLaunchConfig } from './mcp-runtime.js';\n\ntype CursorMcpConfig = {\n mcpServers?: Record<string, { command: string; args: string[]; env?: Record<string, string> }>;\n};\n\nexport const cursorAdapter: IdeAdapter = {\n name: 'Cursor',\n\n async configureMcp(projectDir: string, apiKey: string): Promise<void> {\n const cursorDir = join(projectDir, '.cursor');\n await mkdir(cursorDir, { recursive: true });\n\n const configPath = join(cursorDir, 'mcp.json');\n const launch = await getMcpLaunchConfig();\n\n let existing: CursorMcpConfig = {};\n try {\n existing = JSON.parse(await readFile(configPath, 'utf-8')) as CursorMcpConfig;\n } catch {\n // file missing/invalid: overwrite with fresh config\n }\n\n const existingServers =\n typeof existing.mcpServers === 'object' && existing.mcpServers != null\n ? existing.mcpServers\n : {};\n\n existingServers.forcefield = {\n command: launch.command,\n args: launch.args,\n env: buildMcpEnv(apiKey, projectDir),\n };\n\n const merged: CursorMcpConfig = {\n ...existing,\n mcpServers: existingServers,\n };\n\n await writeFile(configPath, JSON.stringify(merged, null, 2) + '\\n', 'utf-8');\n },\n\n async installWorkflows(projectDir: string, workflowsDir: string): Promise<number> {\n const rulesDir = join(projectDir, '.cursor', 'rules');\n await mkdir(rulesDir, { recursive: true });\n\n const files = await readdir(workflowsDir);\n const mdFiles = files.filter((f) => f.startsWith('ff-') && f.endsWith('.md'));\n\n for (const file of mdFiles) {\n await copyFile(join(workflowsDir, file), join(rulesDir, file));\n }\n\n return mdFiles.length;\n },\n\n async removeWorkflows(projectDir: string): Promise<void> {\n const rulesDir = join(projectDir, '.cursor', 'rules');\n try {\n const files = await readdir(rulesDir);\n for (const file of files) {\n if (file.startsWith('ff-') && file.endsWith('.md')) {\n await rm(join(rulesDir, file));\n }\n }\n } catch {\n // Directory doesn't exist\n }\n },\n};\n","/**\n * IDE adapter for Codex (OpenAI).\n * Workflows → appended to AGENTS.md with markers\n * MCP → .codex/config.toml or project-level config\n */\n\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IdeAdapter } from '../types.js';\nimport { buildMcpEnv, getMcpLaunchConfig } from './mcp-runtime.js';\n\nconst START_MARKER = '<!-- forcefield:start -->';\nconst END_MARKER = '<!-- forcefield:end -->';\nconst MCP_START_MARKER = '# forcefield:mcp:start';\nconst MCP_END_MARKER = '# forcefield:mcp:end';\n\nexport const codexAdapter: IdeAdapter = {\n name: 'Codex',\n\n async configureMcp(projectDir: string, apiKey: string): Promise<void> {\n const codexDir = join(projectDir, '.codex');\n await mkdir(codexDir, { recursive: true });\n\n const configPath = join(codexDir, 'config.toml');\n const launch = await getMcpLaunchConfig();\n const env = buildMcpEnv(apiKey, projectDir);\n\n const forcefieldBlock = buildForcefieldTomlBlock(launch.command, launch.args, env);\n\n let existing = '';\n try {\n existing = await readFile(configPath, 'utf-8');\n } catch {\n // file missing — create new\n }\n\n const cleaned = removeTomlForcefieldSection(existing).trim();\n const final = cleaned ? `${cleaned}\\n\\n${forcefieldBlock}\\n` : `${forcefieldBlock}\\n`;\n await writeFile(configPath, final, 'utf-8');\n },\n\n async installWorkflows(projectDir: string, workflowsDir: string): Promise<number> {\n const agentsPath = join(projectDir, 'AGENTS.md');\n const { readdir } = await import('node:fs/promises');\n\n // Read all workflow files\n const files = await readdir(workflowsDir);\n const mdFiles = files.filter((f) => f.startsWith('ff-') && f.endsWith('.md'));\n\n const workflowContents: string[] = [];\n for (const file of mdFiles) {\n const content = await readFile(join(workflowsDir, file), 'utf-8');\n workflowContents.push(content);\n }\n\n const forcefieldSection = [\n START_MARKER,\n '',\n '# Forcefield Workflows',\n '',\n 'The following workflows are available for compliance management:',\n '',\n ...workflowContents.map((c) => c + '\\n\\n---\\n'),\n END_MARKER,\n ].join('\\n');\n\n // Read existing AGENTS.md or create new\n let existing = '';\n try {\n existing = await readFile(agentsPath, 'utf-8');\n } catch {\n // File doesn't exist — will create\n }\n\n // Remove existing Forcefield section if present\n const cleaned = removeSection(existing);\n\n // Append new section\n const final = cleaned.trim()\n ? cleaned.trim() + '\\n\\n' + forcefieldSection\n : forcefieldSection;\n\n await writeFile(agentsPath, final, 'utf-8');\n return mdFiles.length;\n },\n\n async removeWorkflows(projectDir: string): Promise<void> {\n const agentsPath = join(projectDir, 'AGENTS.md');\n try {\n const content = await readFile(agentsPath, 'utf-8');\n const cleaned = removeSection(content);\n await writeFile(agentsPath, cleaned, 'utf-8');\n } catch {\n // File doesn't exist — nothing to remove\n }\n },\n};\n\nfunction removeSection(content: string): string {\n const startIdx = content.indexOf(START_MARKER);\n const endIdx = content.indexOf(END_MARKER);\n\n if (startIdx === -1 || endIdx === -1) return content;\n\n const before = content.slice(0, startIdx).trimEnd();\n const after = content.slice(endIdx + END_MARKER.length).trimStart();\n\n return before + (after ? '\\n\\n' + after : '');\n}\n\nfunction removeTomlForcefieldSection(content: string): string {\n const markerStart = content.indexOf(MCP_START_MARKER);\n const markerEnd = content.indexOf(MCP_END_MARKER);\n\n if (markerStart !== -1 && markerEnd !== -1) {\n const before = content.slice(0, markerStart).trimEnd();\n const after = content.slice(markerEnd + MCP_END_MARKER.length).trimStart();\n return before + (after ? '\\n\\n' + after : '');\n }\n\n // Backward-compatible cleanup if a previous config wrote unmanaged sections.\n return content\n .replace(/^\\[mcp_servers\\.forcefield\\]\\n[\\s\\S]*?(?=^\\[|$)/gm, '')\n .replace(/^\\[mcp_servers\\.forcefield\\.env\\]\\n[\\s\\S]*?(?=^\\[|$)/gm, '')\n .trim();\n}\n\nfunction buildForcefieldTomlBlock(\n command: string,\n args: string[],\n env: Record<string, string>,\n): string {\n const envLines = Object.entries(env)\n .map(([key, value]) => `${key} = \"${escapeTomlString(value)}\"`);\n\n return [\n MCP_START_MARKER,\n '[mcp_servers.forcefield]',\n `command = \"${escapeTomlString(command)}\"`,\n `args = [${args.map((arg) => `\"${escapeTomlString(arg)}\"`).join(', ')}]`,\n '[mcp_servers.forcefield.env]',\n ...envLines,\n MCP_END_MARKER,\n ].join('\\n');\n}\n\nfunction escapeTomlString(value: string): string {\n return value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"');\n}\n","/**\n * IDE adapter for Windsurf.\n * Workflows → appended to .windsurfrules with markers\n * MCP → Windsurf MCP config\n */\n\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { IdeAdapter } from '../types.js';\nimport { buildMcpEnv, getMcpLaunchConfig } from './mcp-runtime.js';\n\nconst START_MARKER = '<!-- forcefield:start -->';\nconst END_MARKER = '<!-- forcefield:end -->';\n\nexport const windsurfAdapter: IdeAdapter = {\n name: 'Windsurf',\n\n async configureMcp(projectDir: string, apiKey: string): Promise<void> {\n const configDir = join(projectDir, '.windsurf');\n await mkdir(configDir, { recursive: true });\n\n const configPath = join(configDir, 'mcp_config.json');\n const launch = await getMcpLaunchConfig();\n\n let existing: Record<string, unknown> = {};\n try {\n existing = JSON.parse(await readFile(configPath, 'utf-8')) as Record<string, unknown>;\n } catch {\n // file missing/invalid: start fresh\n }\n\n const existingServers =\n typeof existing.mcpServers === 'object' && existing.mcpServers != null\n ? (existing.mcpServers as Record<string, unknown>)\n : {};\n\n existingServers.forcefield = {\n command: launch.command,\n args: launch.args,\n env: buildMcpEnv(apiKey, projectDir),\n };\n\n const merged = {\n ...existing,\n mcpServers: existingServers,\n };\n\n await writeFile(configPath, JSON.stringify(merged, null, 2) + '\\n', 'utf-8');\n },\n\n async installWorkflows(projectDir: string, workflowsDir: string): Promise<number> {\n const rulesPath = join(projectDir, '.windsurfrules');\n const { readdir } = await import('node:fs/promises');\n\n const files = await readdir(workflowsDir);\n const mdFiles = files.filter((f) => f.startsWith('ff-') && f.endsWith('.md'));\n\n const workflowContents: string[] = [];\n for (const file of mdFiles) {\n const content = await readFile(join(workflowsDir, file), 'utf-8');\n workflowContents.push(content);\n }\n\n const forcefieldSection = [\n START_MARKER,\n '',\n '# Forcefield Workflows',\n '',\n ...workflowContents.map((c) => c + '\\n\\n---\\n'),\n END_MARKER,\n ].join('\\n');\n\n let existing = '';\n try {\n existing = await readFile(rulesPath, 'utf-8');\n } catch {\n // File doesn't exist\n }\n\n const cleaned = removeSection(existing);\n const final = cleaned.trim()\n ? cleaned.trim() + '\\n\\n' + forcefieldSection\n : forcefieldSection;\n\n await writeFile(rulesPath, final, 'utf-8');\n return mdFiles.length;\n },\n\n async removeWorkflows(projectDir: string): Promise<void> {\n const rulesPath = join(projectDir, '.windsurfrules');\n try {\n const content = await readFile(rulesPath, 'utf-8');\n const cleaned = removeSection(content);\n await writeFile(rulesPath, cleaned, 'utf-8');\n } catch {\n // File doesn't exist\n }\n },\n};\n\nfunction removeSection(content: string): string {\n const startIdx = content.indexOf(START_MARKER);\n const endIdx = content.indexOf(END_MARKER);\n\n if (startIdx === -1 || endIdx === -1) return content;\n\n const before = content.slice(0, startIdx).trimEnd();\n const after = content.slice(endIdx + END_MARKER.length).trimStart();\n\n return before + (after ? '\\n\\n' + after : '');\n}\n","/**\n * IDE adapter registry.\n */\n\nimport type { Ide, IdeAdapter } from '../types.js';\nimport { claudeCodeAdapter } from './claude-code.js';\nimport { cursorAdapter } from './cursor.js';\nimport { codexAdapter } from './codex.js';\nimport { windsurfAdapter } from './windsurf.js';\n\nconst adapters: Record<Ide, IdeAdapter> = {\n 'claude-code': claudeCodeAdapter,\n 'cursor': cursorAdapter,\n 'codex': codexAdapter,\n 'windsurf': windsurfAdapter,\n};\n\nexport function getAdapter(ide: Ide): IdeAdapter {\n return adapters[ide];\n}\n\nexport const IDE_CHOICES: Array<{ value: Ide; label: string; hint: string }> = [\n { value: 'claude-code', label: 'Claude Code', hint: '.claude/commands/' },\n { value: 'cursor', label: 'Cursor', hint: '.cursor/rules/' },\n { value: 'codex', label: 'Codex (OpenAI)', hint: 'AGENTS.md' },\n { value: 'windsurf', label: 'Windsurf', hint: '.windsurfrules' },\n];\n","/**\n * setup/auth.ts — Authentication and API key issuance for setup wizard.\n */\n\nimport { createHash, randomBytes } from 'node:crypto';\nimport { createClient } from '@supabase/supabase-js';\nimport {\n LOCAL_SUPABASE_ANON_KEY,\n LOCAL_SUPABASE_SERVICE_ROLE_KEY,\n PRODUCTION_SUPABASE_PUBLISHABLE_KEY,\n PRODUCTION_SUPABASE_URL,\n} from '../src/supabase-defaults.js';\n\nconst API_KEY_PREFIX = 'ff_live_';\nconst MAX_RETRIES = 3;\n\nexport interface AuthResult {\n valid: boolean;\n apiKey: string;\n error?: string;\n}\n\nexport interface LocalAuthResult {\n apiKey: string;\n userId: string;\n email: string;\n}\n\ninterface SetupAuthOptions {\n supabaseUrl?: string;\n anonKey?: string;\n localDev?: boolean;\n}\n\nfunction isTruthy(value: string | undefined): boolean {\n if (!value) return false;\n const normalized = value.trim().toLowerCase();\n return normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on';\n}\n\nfunction getSupabaseUrl(options?: SetupAuthOptions): string {\n return options?.supabaseUrl ?? process.env.SUPABASE_URL ?? PRODUCTION_SUPABASE_URL;\n}\n\nfunction isLocalSupabaseUrl(supabaseUrl: string): boolean {\n try {\n const parsed = new URL(supabaseUrl);\n return parsed.hostname === '127.0.0.1' || parsed.hostname === 'localhost';\n } catch {\n return false;\n }\n}\n\nfunction isLocalMode(options?: SetupAuthOptions): boolean {\n if (options?.localDev !== undefined) return options.localDev;\n if (isTruthy(process.env.FORCEFIELD_LOCAL_DEV)) return true;\n return isLocalSupabaseUrl(getSupabaseUrl(options));\n}\n\nfunction getAnonKey(supabaseUrl: string, options?: SetupAuthOptions): string {\n const explicit = options?.anonKey ?? process.env.SUPABASE_ANON_KEY;\n if (explicit && explicit.trim().length > 0) return explicit;\n\n if (isLocalSupabaseUrl(supabaseUrl)) {\n return LOCAL_SUPABASE_ANON_KEY;\n }\n\n return PRODUCTION_SUPABASE_PUBLISHABLE_KEY;\n}\n\nfunction getServiceRoleKey(supabaseUrl: string): string | null {\n const explicit = process.env.SUPABASE_SERVICE_ROLE_KEY;\n if (explicit && explicit.trim().length > 0) return explicit;\n\n if (isLocalSupabaseUrl(supabaseUrl)) {\n return LOCAL_SUPABASE_SERVICE_ROLE_KEY;\n }\n\n return null;\n}\n\n/**\n * Validate API key format.\n */\nexport function validateApiKeyFormat(key: string): boolean {\n return key.startsWith(API_KEY_PREFIX) && key.length > API_KEY_PREFIX.length + 8;\n}\n\n/**\n * Verify an API key through key-exchange endpoint.\n */\nexport async function verifyApiKey(apiKey: string, options?: SetupAuthOptions): Promise<AuthResult> {\n if (!validateApiKeyFormat(apiKey)) {\n return {\n valid: false,\n apiKey: '',\n error: 'Invalid API key format. Keys must start with \"ff_live_\".',\n };\n }\n\n const supabaseUrl = getSupabaseUrl(options);\n const endpoint = `${supabaseUrl}/functions/v1/key-exchange`;\n\n try {\n const response = await fetch(endpoint, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${apiKey}`,\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n const payload = await response.json().catch(() => ({})) as { error?: string };\n const detail = payload.error ?? 'API key invalid or revoked.';\n return {\n valid: false,\n apiKey: '',\n error: `Authentication failed (${response.status}): ${detail}`,\n };\n }\n\n return { valid: true, apiKey };\n } catch {\n return {\n valid: false,\n apiKey: '',\n error: `Could not reach Forcefield backend at ${supabaseUrl}. Check SUPABASE_URL/network and retry.`,\n };\n }\n}\n\n/**\n * Authenticate with retries.\n */\nexport async function authenticateWithRetry(\n getKey: () => Promise<string | null>,\n options?: SetupAuthOptions,\n): Promise<AuthResult> {\n let lastError: string | undefined;\n\n for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {\n const key = await getKey();\n\n if (!key) {\n return { valid: false, apiKey: '', error: 'No API key provided.' };\n }\n\n const verified = await verifyApiKey(key, options);\n if (verified.valid) {\n return verified;\n }\n\n lastError = verified.error;\n\n if (attempt < MAX_RETRIES) {\n continue;\n }\n }\n\n return {\n valid: false,\n apiKey: '',\n error: lastError ?? `Authentication failed after ${MAX_RETRIES} attempts.`,\n };\n}\n\nfunction generateApiKey(): { plaintext: string; hash: string; prefix: string } {\n const raw = randomBytes(32).toString('hex');\n const plaintext = `${API_KEY_PREFIX}${raw}`;\n const hash = createHash('sha256').update(plaintext).digest('hex');\n const prefix = plaintext.slice(0, 12);\n return { plaintext, hash, prefix };\n}\n\n/**\n * Hosted/local account flow:\n * 1. Sign in (or sign up + sign in)\n * 2. Insert API key under authenticated user\n */\nexport async function authenticateAccountAndCreateApiKey(\n email: string,\n password: string,\n options?: {\n supabaseUrl?: string;\n anonKey?: string;\n label?: string;\n localDev?: boolean;\n },\n): Promise<LocalAuthResult> {\n const supabaseUrl = getSupabaseUrl(options);\n const anonKey = getAnonKey(supabaseUrl, options);\n\n const supabase = createClient(supabaseUrl, anonKey, {\n auth: {\n persistSession: false,\n autoRefreshToken: false,\n },\n });\n\n let signIn = await supabase.auth.signInWithPassword({ email, password });\n\n if (signIn.error || !signIn.data.user) {\n await supabase.auth.signUp({ email, password });\n signIn = await supabase.auth.signInWithPassword({ email, password });\n }\n\n if (signIn.error || !signIn.data.user) {\n const message = signIn.error?.message ?? 'Invalid login credentials';\n if (/email.*not confirmed/i.test(message)) {\n throw new Error(\n 'Authentication failed: Email not confirmed. Confirm the inbox for this account, or disable email confirmation in Supabase Auth settings for beta.',\n );\n }\n throw new Error(`Authentication failed: ${message}`);\n }\n\n const userId = signIn.data.user.id;\n const { plaintext, hash, prefix } = generateApiKey();\n const { error: insertError } = await supabase\n .from('api_keys')\n .insert({\n user_id: userId,\n key_hash: hash,\n key_prefix: prefix,\n label: options?.label ?? 'Setup Wizard Key',\n tier: 'free',\n });\n\n if (insertError) {\n if (isLocalMode(options)) {\n const serviceRoleKey = getServiceRoleKey(supabaseUrl);\n if (serviceRoleKey) {\n return createApiKeyViaServiceRole({\n supabaseUrl,\n serviceRoleKey,\n email,\n password,\n label: options?.label ?? 'Setup Wizard Key',\n });\n }\n }\n\n throw new Error(`Failed to create API key: ${insertError.message}`);\n }\n\n return {\n apiKey: plaintext,\n userId,\n email,\n };\n}\n\n/**\n * Local auth flow preserved for scripted local development.\n */\nexport async function authenticateLocalAndCreateApiKey(\n email: string,\n password: string,\n options?: { supabaseUrl?: string; anonKey?: string; label?: string },\n): Promise<LocalAuthResult> {\n return authenticateAccountAndCreateApiKey(email, password, {\n ...options,\n localDev: true,\n label: options?.label ?? 'Local Setup Key',\n });\n}\n\nasync function createApiKeyViaServiceRole(params: {\n supabaseUrl: string;\n serviceRoleKey: string;\n email: string;\n password: string;\n label: string;\n}): Promise<LocalAuthResult> {\n const admin = createClient(params.supabaseUrl, params.serviceRoleKey, {\n auth: {\n persistSession: false,\n autoRefreshToken: false,\n },\n });\n\n let userId: string | undefined;\n const createUser = await admin.auth.admin.createUser({\n email: params.email,\n password: params.password,\n email_confirm: true,\n });\n\n if (createUser.data.user?.id) {\n userId = createUser.data.user.id;\n } else if (createUser.error) {\n const authDb = createClient(params.supabaseUrl, params.serviceRoleKey, {\n db: { schema: 'auth' },\n auth: {\n persistSession: false,\n autoRefreshToken: false,\n },\n });\n\n const existingUser = await authDb\n .from('users')\n .select('id,email')\n .eq('email', params.email)\n .limit(1)\n .maybeSingle();\n\n if (existingUser.error) {\n throw new Error(`Local login failed: ${createUser.error.message}`);\n }\n userId = existingUser.data?.id;\n }\n\n if (!userId) {\n throw new Error('Local login failed: could not resolve user account');\n }\n\n const { plaintext, hash, prefix } = generateApiKey();\n const { error: insertError } = await admin.from('api_keys').insert({\n user_id: userId,\n key_hash: hash,\n key_prefix: prefix,\n label: params.label,\n tier: 'free',\n });\n\n if (insertError) {\n throw new Error(`Failed to create local API key: ${insertError.message}`);\n }\n\n return {\n apiKey: plaintext,\n userId,\n email: params.email,\n };\n}\n\nexport { API_KEY_PREFIX, MAX_RETRIES };\n","/**\n * Forcefield Setup Wizard — entry point.\n *\n * This is the setup wizard binary (forcefield-setup), usually invoked via\n * `forcefield setup` (or `npx -y @forcefield/forcefield setup`).\n * Parses CLI arguments and launches the interactive wizard.\n */\n\nimport type { CliArgs, Ide, SetupMode } from './types.js';\nimport { runWizard } from './wizard.js';\nimport { pathToFileURL } from 'node:url';\n\nfunction parseArgs(argv: string[]): CliArgs {\n const args: CliArgs = {};\n\n for (let i = 2; i < argv.length; i++) {\n const arg = argv[i]!;\n\n if (arg === '--status') {\n args.status = true;\n } else if (arg === '--doctor') {\n args.doctor = true;\n } else if (arg === '--ide' && argv[i + 1]) {\n const ide = argv[++i]!;\n if (['claude-code', 'cursor', 'codex', 'windsurf'].includes(ide)) {\n args.ide = ide as Ide;\n }\n } else if (arg === '--mode' && argv[i + 1]) {\n const mode = argv[++i]!;\n if (['full', 'core'].includes(mode)) {\n args.mode = mode as SetupMode;\n }\n } else if (arg === '--token' && argv[i + 1]) {\n args.token = argv[++i]!;\n } else if (arg === '--email' && argv[i + 1]) {\n args.email = argv[++i]!;\n } else if (arg === '--password' && argv[i + 1]) {\n args.password = argv[++i]!;\n } else if (arg === '--local-auth') {\n args.localAuth = true;\n }\n }\n\n return args;\n}\n\nasync function main(): Promise<void> {\n const args = parseArgs(process.argv);\n const projectDir = process.cwd();\n\n try {\n await runWizard(projectDir, args);\n } catch (err) {\n console.error('Setup failed:', err instanceof Error ? err.message : err);\n process.exit(1);\n }\n}\n\nexport async function runSetupCli(argv: string[] = process.argv): Promise<void> {\n const originalArgv = process.argv;\n process.argv = argv;\n try {\n await main();\n } finally {\n process.argv = originalArgv;\n }\n}\n\nfunction isExecutedDirectly(metaUrl: string): boolean {\n const entryPath = process.argv[1];\n if (!entryPath) return false;\n return metaUrl === pathToFileURL(entryPath).href;\n}\n\nif (isExecutedDirectly(import.meta.url)) {\n void runSetupCli();\n}\n\nexport { parseArgs };\n"],"mappings":";;;;;;;;;AAaA,YAAY,OAAO;AACnB,OAAO,QAAQ;AACf,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,SAAS,YAAAA,WAAU,aAAAC,YAAW,UAAAC,eAAc;AAC5C,SAAS,QAAAC,OAAM,WAAAC,gBAAe;AAC9B,SAAS,iBAAAC,sBAAqB;;;ACf9B,SAAS,cAAc;AACvB,SAAS,YAAY;AAQrB,IAAM,cAAmE;AAAA,EACvE,EAAE,KAAK,eAAe,QAAQ,WAAW,OAAO,KAAK;AAAA,EACrD,EAAE,KAAK,UAAU,QAAQ,WAAW,OAAO,KAAK;AAAA,EAChD,EAAE,KAAK,SAAS,QAAQ,aAAa,OAAO,MAAM;AAAA,EAClD,EAAE,KAAK,YAAY,QAAQ,kBAAkB,OAAO,MAAM;AAC5D;AAEA,eAAsB,UAAU,YAA8C;AAC5E,QAAM,QAA6C,CAAC;AAEpD,aAAW,EAAE,KAAK,OAAO,KAAK,aAAa;AACzC,UAAM,aAAa,KAAK,YAAY,MAAM;AAC1C,QAAI;AACF,YAAM,OAAO,UAAU;AACvB,YAAM,KAAK,EAAE,KAAK,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AAI,CAAC,GAAG;AAC1C,YAAM,OAAO,KAAK,EAAE,CAAC;AACrB,UAAI,CAAC,QAAQ,MAAM,EAAE,SAAS,IAAI,GAAG;AACnC,aAAK,OAAO;AAAA,MACd;AAAA,IACF,WAAW,QAAQ,aAAa,KAAK,IAAI,CAAC,GAAG;AAC3C,WAAK,QAAQ,KAAK,EAAE,CAAC;AAAA,IACvB,WAAW,QAAQ,aAAa,KAAK,IAAI,CAAC,GAAG;AAC3C,WAAK,QAAQ,KAAK,EAAE,CAAC;AAAA,IACvB,WAAW,QAAQ,gBAAgB,KAAK,IAAI,CAAC,GAAG;AAC9C,WAAK,WAAW,KAAK,EAAE,CAAC;AAAA,IAC1B,WAAW,QAAQ,gBAAgB;AACjC,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AACT;AAEA,eAAe,OAAsB;AACnC,QAAM,OAAO,UAAU,QAAQ,IAAI;AACnC,QAAM,aAAa,QAAQ,IAAI;AAE/B,MAAI;AACF,UAAM,UAAU,YAAY,IAAI;AAAA,EAClC,SAAS,KAAK;AACZ,YAAQ,MAAM,iBAAiB,eAAe,QAAQ,IAAI,UAAU,GAAG;AACvE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;AAEA,eAAsB,YAAY,OAAiB,QAAQ,MAAqB;AAC9E,QAAM,eAAe,QAAQ;AAC7B,UAAQ,OAAO;AACf,MAAI;AACF,UAAM,KAAK;AAAA,EACb,UAAE;AACA,YAAQ,OAAO;AAAA,EACjB;AACF;AAEA,SAAS,mBAAmB,SAA0B;AACpD,QAAM,YAAY,QAAQ,KAAK,CAAC;AAChC,MAAI,CAAC,UAAW,QAAO;AACvB,SAAO,YAAY,cAAc,SAAS,EAAE;AAC9C;AAEA,IAAI,mBAAmB,YAAY,GAAG,GAAG;AACvC,OAAK,YAAY;AACnB;","names":["readFile","writeFile","access","join","dirname","fileURLToPath","join","access","join","join","join","access","join","mkdir","readdir","copyFile","rm","readFile","writeFile","join","join","mkdir","readFile","writeFile","readdir","copyFile","rm","mkdir","readFile","writeFile","join","join","mkdir","readFile","writeFile","readdir","mkdir","readFile","writeFile","join","START_MARKER","END_MARKER","join","mkdir","readFile","writeFile","readdir","removeSection","isTruthy","password","__dirname","dirname","fileURLToPath","join","access","text","readFile","apiKey","confirm","password","writeFile"]}
|
|
@@ -9122,7 +9122,6 @@ function getWorkflowPlaceholder(name) {
|
|
|
9122
9122
|
}
|
|
9123
9123
|
|
|
9124
9124
|
// src/index.ts
|
|
9125
|
-
import { pathToFileURL } from "url";
|
|
9126
9125
|
async function runMcpCli() {
|
|
9127
9126
|
try {
|
|
9128
9127
|
logger.info("Forcefield MCP server starting...");
|
|
@@ -9146,16 +9145,8 @@ async function runMcpCli() {
|
|
|
9146
9145
|
process.exit(1);
|
|
9147
9146
|
}
|
|
9148
9147
|
}
|
|
9149
|
-
function isExecutedDirectly(metaUrl) {
|
|
9150
|
-
const entryPath = process.argv[1];
|
|
9151
|
-
if (!entryPath) return false;
|
|
9152
|
-
return metaUrl === pathToFileURL(entryPath).href;
|
|
9153
|
-
}
|
|
9154
|
-
if (isExecutedDirectly(import.meta.url)) {
|
|
9155
|
-
void runMcpCli();
|
|
9156
|
-
}
|
|
9157
9148
|
|
|
9158
9149
|
export {
|
|
9159
9150
|
runMcpCli
|
|
9160
9151
|
};
|
|
9161
|
-
//# sourceMappingURL=chunk-
|
|
9152
|
+
//# sourceMappingURL=chunk-N46MYH57.js.map
|