faf-mcp 2.1.0 → 2.1.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.
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ /**
3
+ * faf-cli bridge — single re-export point for faf-cli's typed public API.
4
+ *
5
+ * Why this file exists (three coupled problems):
6
+ * 1. faf-cli 6.7.1's `exports` map sets a `bun` condition pointing at a
7
+ * non-shipped `src/index.ts`. Bun's resolver always picks the `bun`
8
+ * condition first (verified: `--conditions=node` ADDS to the set,
9
+ * doesn't replace), so `from 'faf-cli'` blows up at module-load in
10
+ * bun-test. Subpath imports (`faf-cli/dist/index.js`) are ALSO blocked
11
+ * because faf-cli's exports map only exports `.`.
12
+ * 2. Static relative paths don't survive tsc compilation: a literal
13
+ * `../../node_modules/...` written in `src/utils/` resolves to the
14
+ * wrong place when the compiled file lands at `dist/src/utils/` (one
15
+ * level deeper, so the relative escape comes up short).
16
+ * 3. faf-cli's dist is ESM (`"type": "module"`). Node 18 rejects sync
17
+ * `require()` of ESM (`ERR_REQUIRE_ESM`); Node 20 allows it. faf-mcp
18
+ * supports Node 18+ per `engines`, so we must use dynamic `import()`.
19
+ *
20
+ * How this bridge works:
21
+ * At runtime, walk upward from `__dirname` (which is `src/utils/` when
22
+ * bun loads TS source and `dist/src/utils/` when Node loads compiled
23
+ * CJS) until we find `node_modules/faf-cli/dist/index.js`. Then load it
24
+ * via dynamic `import()` of an absolute `file://` URL — which:
25
+ * - bypasses the exports map (no package specifier, no condition picked)
26
+ * - handles ESM-from-CJS correctly on Node 18+ AND in bun
27
+ * - resolves the same module regardless of source-vs-compiled __dirname
28
+ *
29
+ * The type info comes via `import type` — purely compile-time, esbuild
30
+ * strips it at load time, so the `bun` condition never fires for types.
31
+ *
32
+ * Export shape: `fafCli` is a Promise<typeof FafCli>. Consumers
33
+ * destructure with `const { ... } = await fafCli` inside async handlers.
34
+ * Module evaluation is one-shot — the Promise is created at module load
35
+ * and cached forever.
36
+ *
37
+ * This is intentionally a TEMPORARY workaround tied to faf-cli's bun
38
+ * exports bug. Once faf-cli ships `src/` OR drops the `bun` condition,
39
+ * this whole file becomes `export * from 'faf-cli'` and consumers go
40
+ * back to bare specifiers. Tracked alongside the AERO test's matching
41
+ * workaround comment in tests/wjttc-bun.test.ts.
42
+ *
43
+ * Doctrine: silent-drift = fail = forbidden. The bridge is loud and
44
+ * localized — one file, fully commented — not scattered ts-ignores or
45
+ * silent type-casts.
46
+ */
47
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
48
+ if (k2 === undefined) k2 = k;
49
+ var desc = Object.getOwnPropertyDescriptor(m, k);
50
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
51
+ desc = { enumerable: true, get: function() { return m[k]; } };
52
+ }
53
+ Object.defineProperty(o, k2, desc);
54
+ }) : (function(o, m, k, k2) {
55
+ if (k2 === undefined) k2 = k;
56
+ o[k2] = m[k];
57
+ }));
58
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
59
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
60
+ }) : function(o, v) {
61
+ o["default"] = v;
62
+ });
63
+ var __importStar = (this && this.__importStar) || (function () {
64
+ var ownKeys = function(o) {
65
+ ownKeys = Object.getOwnPropertyNames || function (o) {
66
+ var ar = [];
67
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
68
+ return ar;
69
+ };
70
+ return ownKeys(o);
71
+ };
72
+ return function (mod) {
73
+ if (mod && mod.__esModule) return mod;
74
+ var result = {};
75
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
76
+ __setModuleDefault(result, mod);
77
+ return result;
78
+ };
79
+ })();
80
+ Object.defineProperty(exports, "__esModule", { value: true });
81
+ exports.fafCli = void 0;
82
+ const path = __importStar(require("path"));
83
+ const fs = __importStar(require("fs"));
84
+ const url_1 = require("url");
85
+ function findFafCliDist(startDir) {
86
+ let dir = startDir;
87
+ while (dir !== path.dirname(dir)) {
88
+ const candidate = path.join(dir, 'node_modules', 'faf-cli', 'dist', 'index.js');
89
+ if (fs.existsSync(candidate))
90
+ return candidate;
91
+ dir = path.dirname(dir);
92
+ }
93
+ throw new Error(`faf-cli/dist/index.js not found in any ancestor node_modules of ${startDir}. ` +
94
+ `faf-mcp requires faf-cli as a direct dependency — check installation.`);
95
+ }
96
+ // Cached promise — module evaluation happens once.
97
+ exports.fafCli = (async () => {
98
+ const distPath = findFafCliDist(__dirname);
99
+ return (await import((0, url_1.pathToFileURL)(distPath).href));
100
+ })();
101
+ //# sourceMappingURL=faf-cli-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faf-cli-bridge.js","sourceRoot":"","sources":["../../../src/utils/faf-cli-bridge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,uCAAyB;AACzB,6BAAoC;AAGpC,SAAS,cAAc,CAAC,QAAgB;IACtC,IAAI,GAAG,GAAG,QAAQ,CAAC;IACnB,OAAO,GAAG,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QAChF,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/C,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IACD,MAAM,IAAI,KAAK,CACb,mEAAmE,QAAQ,IAAI;QAC7E,uEAAuE,CAC1E,CAAC;AACJ,CAAC;AAED,mDAAmD;AACtC,QAAA,MAAM,GAA2B,CAAC,KAAK,IAAI,EAAE;IACxD,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,MAAM,CAAC,IAAA,mBAAa,EAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAkB,CAAC;AACvE,CAAC,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "faf-mcp",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "mcpName": "io.github.Wolfe-Jam/faf-mcp",
5
5
  "description": "Persistent Project Context for Cursor, IDEs and VS Code. IANA-registered .faf format, 25 MCP tools, 309 tests.",
6
6
  "icon": "./assets/icons/faf-icon-256.png",
@@ -16,8 +16,8 @@
16
16
  "dev": "ts-node src/server.ts",
17
17
  "dev:stdio": "ts-node src/cli.ts --transport stdio",
18
18
  "dev:http": "ts-node src/cli.ts --transport http-sse --port 3001",
19
- "test": "jest",
20
- "test:performance": "jest tests/performance.test.ts",
19
+ "test": "bun test --isolate --timeout=120000 --path-ignore-patterns=\"**/performance.test.ts\"",
20
+ "test:performance": "bun test tests/performance.test.ts",
21
21
  "test:mcp": "mcp-inspector stdio ts-node src/cli.ts",
22
22
  "lint": "eslint src/**/*.ts",
23
23
  "lint:fix": "eslint src/**/*.ts --fix",
@@ -108,17 +108,13 @@
108
108
  "yaml": "^2.4.1"
109
109
  },
110
110
  "devDependencies": {
111
- "@jest/globals": "^30.1.2",
112
111
  "@types/cors": "^2.8.19",
113
112
  "@types/express": "^5.0.3",
114
- "@types/jest": "^30.0.0",
115
113
  "@types/jsonwebtoken": "^9.0.5",
116
114
  "@types/node": "^20.11.0",
117
115
  "@typescript-eslint/eslint-plugin": "^7.0.0",
118
116
  "@typescript-eslint/parser": "^7.0.0",
119
117
  "eslint": "^8.56.0",
120
- "jest": "^30.2.0",
121
- "ts-jest": "^29.1.0",
122
118
  "ts-node": "^10.9.2",
123
119
  "typescript": "^5.9.3"
124
120
  }