preflight-mcp 0.1.0 → 0.1.2

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.
@@ -0,0 +1,80 @@
1
+ import { classifyPreflightErrorKind, wrapPreflightError } from '../mcp/errorKinds.js';
2
+ export async function runSearchByTags(params) {
3
+ const maxWarnings = params.maxWarnings ?? 20;
4
+ const warnings = [];
5
+ let warningsTruncated = false;
6
+ const pushWarning = (bundleId, err) => {
7
+ if (warnings.length >= maxWarnings) {
8
+ warningsTruncated = true;
9
+ return;
10
+ }
11
+ warnings.push({
12
+ bundleId,
13
+ kind: classifyPreflightErrorKind(err),
14
+ message: wrapPreflightError(err).message,
15
+ });
16
+ };
17
+ // Filter bundles by tags if specified.
18
+ const targetBundleIds = [];
19
+ const manifestCache = new Map();
20
+ for (const bundleId of params.bundleIds) {
21
+ if (!params.tags || params.tags.length === 0) {
22
+ targetBundleIds.push(bundleId);
23
+ continue;
24
+ }
25
+ try {
26
+ const manifest = await params.readManifestForBundleId(bundleId);
27
+ manifestCache.set(bundleId, manifest);
28
+ const tags = manifest.tags ?? [];
29
+ if (params.tags.some((t) => tags.includes(t))) {
30
+ targetBundleIds.push(bundleId);
31
+ }
32
+ }
33
+ catch (err) {
34
+ pushWarning(bundleId, err);
35
+ // Skip bundle if we can't read tags.
36
+ }
37
+ }
38
+ const hits = [];
39
+ for (const bundleId of targetBundleIds) {
40
+ let manifest = manifestCache.get(bundleId);
41
+ if (!manifest) {
42
+ try {
43
+ manifest = await params.readManifestForBundleId(bundleId);
44
+ manifestCache.set(bundleId, manifest);
45
+ }
46
+ catch (err) {
47
+ pushWarning(bundleId, err);
48
+ continue;
49
+ }
50
+ }
51
+ try {
52
+ const bundleHits = params.searchIndexForBundleId(bundleId, params.query, params.scope, params.limit);
53
+ for (const hit of bundleHits) {
54
+ hits.push({
55
+ bundleId,
56
+ bundleName: manifest.displayName,
57
+ kind: hit.kind,
58
+ repo: hit.repo,
59
+ path: hit.path,
60
+ lineNo: hit.lineNo,
61
+ snippet: hit.snippet,
62
+ uri: params.toUri(bundleId, hit.path),
63
+ });
64
+ if (hits.length >= params.limit)
65
+ break;
66
+ }
67
+ }
68
+ catch (err) {
69
+ pushWarning(bundleId, err);
70
+ }
71
+ if (hits.length >= params.limit)
72
+ break;
73
+ }
74
+ return {
75
+ totalBundlesSearched: targetBundleIds.length,
76
+ hits: hits.slice(0, params.limit),
77
+ warnings: warnings.length ? warnings : undefined,
78
+ warningsTruncated: warningsTruncated ? true : undefined,
79
+ };
80
+ }
package/package.json CHANGED
@@ -1,9 +1,32 @@
1
1
  {
2
2
  "name": "preflight-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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",
7
+ "author": "preflight-mcp contributors",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/jonnyhoo/preflight-mcp.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/jonnyhoo/preflight-mcp/issues"
14
+ },
15
+ "homepage": "https://github.com/jonnyhoo/preflight-mcp#readme",
16
+ "keywords": [
17
+ "mcp",
18
+ "model-context-protocol",
19
+ "ai",
20
+ "llm",
21
+ "github",
22
+ "repository",
23
+ "documentation",
24
+ "search",
25
+ "fts5",
26
+ "sqlite",
27
+ "claude",
28
+ "agents"
29
+ ],
7
30
  "bin": {
8
31
  "preflight-mcp": "dist/index.js"
9
32
  },
@@ -25,6 +48,7 @@
25
48
  },
26
49
  "dependencies": {
27
50
  "@modelcontextprotocol/sdk": "^1.25.1",
51
+ "adm-zip": "^0.5.16",
28
52
  "better-sqlite3": "^12.5.0",
29
53
  "ignore": "^7.0.5",
30
54
  "node-cron": "^4.2.1",
@@ -32,6 +56,7 @@
32
56
  },
33
57
  "devDependencies": {
34
58
  "@jest/globals": "^30.2.0",
59
+ "@types/adm-zip": "^0.5.7",
35
60
  "@types/better-sqlite3": "^7.6.13",
36
61
  "@types/jest": "^30.0.0",
37
62
  "@types/node": "^25.0.3",