preflight-mcp 0.1.6 → 0.1.7

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.
@@ -7,7 +7,7 @@ function nowIso() {
7
7
  }
8
8
  function githubHeaders(cfg) {
9
9
  const headers = {
10
- 'User-Agent': 'preflight-mcp/0.1.6',
10
+ 'User-Agent': 'preflight-mcp/0.1.7',
11
11
  Accept: 'application/vnd.github+json',
12
12
  };
13
13
  if (cfg.githubToken) {
@@ -15,6 +15,7 @@ import { analyzeBundleStatic } from './analysis.js';
15
15
  import { autoDetectTags, generateDisplayName, generateDescription } from './tagging.js';
16
16
  import { bundleCreationLimiter } from '../core/concurrency-limiter.js';
17
17
  import { getProgressTracker, calcPercent } from '../jobs/progressTracker.js';
18
+ import { BundleNotFoundError } from '../errors.js';
18
19
  const DEDUP_INDEX_FILE = '.preflight-dedup-index.json';
19
20
  function sha256Hex(text) {
20
21
  return crypto.createHash('sha256').update(text, 'utf8').digest('hex');
@@ -425,7 +426,7 @@ async function validateBundleCompleteness(bundleRoot) {
425
426
  export async function assertBundleComplete(cfg, bundleId) {
426
427
  const storageDir = await findBundleStorageDir(cfg.storageDirs, bundleId);
427
428
  if (!storageDir) {
428
- throw new Error(`Bundle not found: ${bundleId}`);
429
+ throw new BundleNotFoundError(bundleId);
429
430
  }
430
431
  const bundleRoot = getBundlePaths(storageDir, bundleId).rootDir;
431
432
  const { isValid, missingComponents } = await validateBundleCompleteness(bundleRoot);
@@ -1316,7 +1317,7 @@ export async function repairBundle(cfg, bundleId, options) {
1316
1317
  const rebuildOverviewOpt = options?.rebuildOverview ?? true;
1317
1318
  const storageDir = await findBundleStorageDir(cfg.storageDirs, bundleId);
1318
1319
  if (!storageDir) {
1319
- throw new Error(`Bundle not found: ${bundleId}`);
1320
+ throw new BundleNotFoundError(bundleId);
1320
1321
  }
1321
1322
  const paths = getBundlePaths(storageDir, bundleId);
1322
1323
  const before = await validateBundleCompleteness(paths.rootDir);
@@ -20,7 +20,7 @@ export async function connectContext7(cfg) {
20
20
  maxRetries: 1,
21
21
  },
22
22
  });
23
- const client = new Client({ name: 'preflight-context7', version: '0.1.6' });
23
+ const client = new Client({ name: 'preflight-context7', version: '0.1.7' });
24
24
  await client.connect(transport);
25
25
  return {
26
26
  client,
package/dist/errors.js CHANGED
@@ -31,12 +31,23 @@ export class PreflightError extends Error {
31
31
  };
32
32
  }
33
33
  }
34
+ /**
35
+ * Check if a string looks like a valid UUID v4.
36
+ */
37
+ function isUuidFormat(id) {
38
+ return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(id);
39
+ }
34
40
  /**
35
41
  * Error thrown when a bundle is not found.
36
42
  */
37
43
  export class BundleNotFoundError extends PreflightError {
38
44
  constructor(bundleId) {
39
- super(`Bundle not found: ${bundleId}`, 'BUNDLE_NOT_FOUND', {
45
+ const hint = isUuidFormat(bundleId)
46
+ ? '\nUse preflight_list_bundles to see available bundles.'
47
+ : `\nHint: bundleId must be a UUID (e.g., 025c6dcb-1234-5678-9abc-def012345678).\n` +
48
+ ` "${bundleId}" looks like a displayName, not a bundleId.\n` +
49
+ ` Use preflight_list_bundles to find the correct bundleId.`;
50
+ super(`Bundle not found: ${bundleId}${hint}`, 'BUNDLE_NOT_FOUND', {
40
51
  context: { bundleId },
41
52
  });
42
53
  this.name = 'BundleNotFoundError';
package/dist/server.js CHANGED
@@ -8,6 +8,7 @@ import { getProgressTracker } from './jobs/progressTracker.js';
8
8
  import { readManifest } from './bundle/manifest.js';
9
9
  import { safeJoin, toBundleFileUri } from './mcp/uris.js';
10
10
  import { wrapPreflightError } from './mcp/errorKinds.js';
11
+ import { BundleNotFoundError } from './errors.js';
11
12
  import { searchIndex } from './search/sqliteFts.js';
12
13
  import { logger } from './logging/logger.js';
13
14
  import { runSearchByTags } from './tools/searchByTags.js';
@@ -99,7 +100,7 @@ export async function startServer() {
99
100
  startHttpServer(cfg);
100
101
  const server = new McpServer({
101
102
  name: 'preflight-mcp',
102
- version: '0.1.6',
103
+ version: '0.1.7',
103
104
  description: 'Create evidence-based preflight bundles for repositories (docs + code) with SQLite FTS search.',
104
105
  }, {
105
106
  capabilities: {
@@ -280,7 +281,7 @@ export async function startServer() {
280
281
  try {
281
282
  const storageDir = await findBundleStorageDir(cfg.storageDirs, args.bundleId);
282
283
  if (!storageDir) {
283
- throw new Error(`Bundle not found: ${args.bundleId}`);
284
+ throw new BundleNotFoundError(args.bundleId);
284
285
  }
285
286
  const paths = getBundlePathsForId(storageDir, args.bundleId);
286
287
  const bundleRoot = paths.rootDir;
@@ -364,7 +365,7 @@ export async function startServer() {
364
365
  try {
365
366
  const deleted = await clearBundleMulti(cfg.storageDirs, args.bundleId);
366
367
  if (!deleted) {
367
- throw new Error(`Bundle not found: ${args.bundleId}`);
368
+ throw new BundleNotFoundError(args.bundleId);
368
369
  }
369
370
  server.sendResourceListChanged();
370
371
  const out = { deleted: true, bundleId: args.bundleId };
@@ -594,7 +595,7 @@ export async function startServer() {
594
595
  try {
595
596
  const storageDir = await findBundleStorageDir(cfg.storageDirs, args.bundleId);
596
597
  if (!storageDir) {
597
- throw new Error(`Bundle not found: ${args.bundleId}`);
598
+ throw new BundleNotFoundError(args.bundleId);
598
599
  }
599
600
  // checkOnly mode: just check for updates without applying
600
601
  if (args.checkOnly) {
@@ -759,7 +760,7 @@ export async function startServer() {
759
760
  // Resolve bundle location across storageDirs (more robust than a single effectiveDir).
760
761
  const storageDir = await findBundleStorageDir(cfg.storageDirs, args.bundleId);
761
762
  if (!storageDir) {
762
- throw new Error(`Bundle not found: ${args.bundleId}`);
763
+ throw new BundleNotFoundError(args.bundleId);
763
764
  }
764
765
  if (args.ensureFresh) {
765
766
  throw new Error('ensureFresh is deprecated and not supported in this tool. This tool is strictly read-only. ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "preflight-mcp",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "MCP server that creates evidence-based preflight bundles for GitHub repositories and library docs.",
5
5
  "type": "module",
6
6
  "license": "MIT",