preflight-mcp 0.1.2 → 0.1.4

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/config.js CHANGED
@@ -7,16 +7,35 @@ function envNumber(name, fallback) {
7
7
  const n = Number(raw);
8
8
  return Number.isFinite(n) && n > 0 ? n : fallback;
9
9
  }
10
+ function envBoolean(name, fallback) {
11
+ const raw = process.env[name];
12
+ if (!raw)
13
+ return fallback;
14
+ const v = raw.trim().toLowerCase();
15
+ if (v === '1' || v === 'true' || v === 'yes' || v === 'y' || v === 'on')
16
+ return true;
17
+ if (v === '0' || v === 'false' || v === 'no' || v === 'n' || v === 'off')
18
+ return false;
19
+ return fallback;
20
+ }
21
+ function parseAstEngine(raw) {
22
+ const v = (raw ?? '').trim().toLowerCase();
23
+ if (v === 'native')
24
+ return 'native';
25
+ return 'wasm';
26
+ }
10
27
  function parseAnalysisMode(raw) {
11
28
  const v = (raw ?? '').trim().toLowerCase();
12
29
  if (v === 'none')
13
30
  return 'none';
14
31
  if (v === 'quick')
15
32
  return 'quick';
16
- // Back-compat: deep used to exist; treat it as quick (but never run LLM).
33
+ if (v === 'full')
34
+ return 'full'; // Phase 2 module analysis
35
+ // Back-compat: deep used to exist; treat it as full (for better analysis).
17
36
  if (v === 'deep')
18
- return 'quick';
19
- return 'quick';
37
+ return 'full';
38
+ return 'full'; // Default to full for better analysis
20
39
  }
21
40
  /**
22
41
  * Parse storage directories from environment.
@@ -43,6 +62,9 @@ export function getConfig() {
43
62
  const storageDir = storageDirs[0]; // Primary for new bundles (always at least one from default)
44
63
  const tmpDir = process.env.PREFLIGHT_TMP_DIR ?? path.join(os.tmpdir(), 'preflight-mcp');
45
64
  const analysisMode = parseAnalysisMode(process.env.PREFLIGHT_ANALYSIS_MODE);
65
+ const httpEnabled = envBoolean('PREFLIGHT_HTTP_ENABLED', true);
66
+ const httpHost = (process.env.PREFLIGHT_HTTP_HOST ?? '127.0.0.1').trim() || '127.0.0.1';
67
+ const httpPort = envNumber('PREFLIGHT_HTTP_PORT', 37123);
46
68
  return {
47
69
  storageDir,
48
70
  storageDirs,
@@ -54,6 +76,10 @@ export function getConfig() {
54
76
  maxFileBytes: envNumber('PREFLIGHT_MAX_FILE_BYTES', 512 * 1024),
55
77
  maxTotalBytes: envNumber('PREFLIGHT_MAX_TOTAL_BYTES', 50 * 1024 * 1024),
56
78
  analysisMode,
79
+ astEngine: parseAstEngine(process.env.PREFLIGHT_AST_ENGINE),
80
+ httpEnabled,
81
+ httpHost,
82
+ httpPort,
57
83
  // Tuning parameters with defaults (can be overridden via env vars)
58
84
  maxContext7Libraries: envNumber('PREFLIGHT_MAX_CONTEXT7_LIBRARIES', 20),
59
85
  maxContext7Topics: envNumber('PREFLIGHT_MAX_CONTEXT7_TOPICS', 10),
@@ -62,5 +88,6 @@ export function getConfig() {
62
88
  defaultMaxAgeHours: envNumber('PREFLIGHT_DEFAULT_MAX_AGE_HOURS', 24),
63
89
  maxSearchLimit: envNumber('PREFLIGHT_MAX_SEARCH_LIMIT', 200),
64
90
  defaultSearchLimit: envNumber('PREFLIGHT_DEFAULT_SEARCH_LIMIT', 30),
91
+ inProgressLockTimeoutMs: envNumber('PREFLIGHT_IN_PROGRESS_LOCK_TIMEOUT_MS', 30 * 60_000),
65
92
  };
66
93
  }
@@ -1,5 +1,6 @@
1
1
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
2
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
3
+ import { logger } from '../logging/logger.js';
3
4
  export async function connectContext7(cfg) {
4
5
  const url = new URL(cfg.context7McpUrl);
5
6
  const headers = {};
@@ -19,12 +20,14 @@ export async function connectContext7(cfg) {
19
20
  maxRetries: 1,
20
21
  },
21
22
  });
22
- const client = new Client({ name: 'preflight-context7', version: '0.1.1' });
23
+ const client = new Client({ name: 'preflight-context7', version: '0.1.3' });
23
24
  await client.connect(transport);
24
25
  return {
25
26
  client,
26
27
  close: async () => {
27
- await client.close().catch(() => undefined);
28
+ await client.close().catch((err) => {
29
+ logger.debug('Context7 client close failed (non-critical)', err instanceof Error ? err : undefined);
30
+ });
28
31
  },
29
32
  };
30
33
  }