faf-mcp 2.1.0 → 2.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/CLAUDE.md +1 -1
  3. package/README.md +14 -13
  4. package/dist/src/faf-core/commands/auto.d.ts +2 -2
  5. package/dist/src/faf-core/commands/auto.js.map +1 -1
  6. package/dist/src/faf-core/commands/innit.d.ts +2 -2
  7. package/dist/src/faf-core/commands/innit.js.map +1 -1
  8. package/dist/src/faf-core/commands/score.d.ts +1 -1
  9. package/dist/src/faf-core/commands/score.js.map +1 -1
  10. package/dist/src/faf-core/compiler/faf-compiler.js +65 -6
  11. package/dist/src/faf-core/compiler/faf-compiler.js.map +1 -1
  12. package/dist/src/faf-core/generators/faf-generator-championship.js.map +1 -1
  13. package/dist/src/handlers/championship-tools.d.ts +1 -1
  14. package/dist/src/handlers/cloud-handler.js +1 -1
  15. package/dist/src/handlers/cloud-handler.js.map +1 -1
  16. package/dist/src/handlers/fileHandler.d.ts +1 -1
  17. package/dist/src/handlers/resources.d.ts +1 -1
  18. package/dist/src/handlers/tool-registry.d.ts +2 -2
  19. package/dist/src/handlers/tools.d.ts +1 -1
  20. package/dist/src/handlers/tools.js +106 -125
  21. package/dist/src/handlers/tools.js.map +1 -1
  22. package/dist/src/server.d.ts +5 -0
  23. package/dist/src/server.js +16 -2
  24. package/dist/src/server.js.map +1 -1
  25. package/dist/src/types/mcp-tools.d.ts +2 -2
  26. package/dist/src/utils/cli-detector.d.ts +1 -4
  27. package/dist/src/utils/cli-detector.js +19 -2
  28. package/dist/src/utils/cli-detector.js.map +1 -1
  29. package/dist/src/utils/faf-cli-bridge.d.ts +47 -0
  30. package/dist/src/utils/faf-cli-bridge.js +101 -0
  31. package/dist/src/utils/faf-cli-bridge.js.map +1 -0
  32. package/package.json +4 -7
@@ -0,0 +1,47 @@
1
+ /**
2
+ * faf-cli bridge — single re-export point for faf-cli's typed public API.
3
+ *
4
+ * Why this file exists (three coupled problems):
5
+ * 1. faf-cli 6.7.1's `exports` map sets a `bun` condition pointing at a
6
+ * non-shipped `src/index.ts`. Bun's resolver always picks the `bun`
7
+ * condition first (verified: `--conditions=node` ADDS to the set,
8
+ * doesn't replace), so `from 'faf-cli'` blows up at module-load in
9
+ * bun-test. Subpath imports (`faf-cli/dist/index.js`) are ALSO blocked
10
+ * because faf-cli's exports map only exports `.`.
11
+ * 2. Static relative paths don't survive tsc compilation: a literal
12
+ * `../../node_modules/...` written in `src/utils/` resolves to the
13
+ * wrong place when the compiled file lands at `dist/src/utils/` (one
14
+ * level deeper, so the relative escape comes up short).
15
+ * 3. faf-cli's dist is ESM (`"type": "module"`). Node 18 rejects sync
16
+ * `require()` of ESM (`ERR_REQUIRE_ESM`); Node 20 allows it. faf-mcp
17
+ * supports Node 18+ per `engines`, so we must use dynamic `import()`.
18
+ *
19
+ * How this bridge works:
20
+ * At runtime, walk upward from `__dirname` (which is `src/utils/` when
21
+ * bun loads TS source and `dist/src/utils/` when Node loads compiled
22
+ * CJS) until we find `node_modules/faf-cli/dist/index.js`. Then load it
23
+ * via dynamic `import()` of an absolute `file://` URL — which:
24
+ * - bypasses the exports map (no package specifier, no condition picked)
25
+ * - handles ESM-from-CJS correctly on Node 18+ AND in bun
26
+ * - resolves the same module regardless of source-vs-compiled __dirname
27
+ *
28
+ * The type info comes via `import type` — purely compile-time, esbuild
29
+ * strips it at load time, so the `bun` condition never fires for types.
30
+ *
31
+ * Export shape: `fafCli` is a Promise<typeof FafCli>. Consumers
32
+ * destructure with `const { ... } = await fafCli` inside async handlers.
33
+ * Module evaluation is one-shot — the Promise is created at module load
34
+ * and cached forever.
35
+ *
36
+ * This is intentionally a TEMPORARY workaround tied to faf-cli's bun
37
+ * exports bug. Once faf-cli ships `src/` OR drops the `bun` condition,
38
+ * this whole file becomes `export * from 'faf-cli'` and consumers go
39
+ * back to bare specifiers. Tracked alongside the AERO test's matching
40
+ * workaround comment in tests/wjttc-bun.test.ts.
41
+ *
42
+ * Doctrine: silent-drift = fail = forbidden. The bridge is loud and
43
+ * localized — one file, fully commented — not scattered ts-ignores or
44
+ * silent type-casts.
45
+ */
46
+ import type * as FafCli from 'faf-cli';
47
+ export declare const fafCli: Promise<typeof FafCli>;
@@ -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.2",
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",
@@ -105,20 +105,17 @@
105
105
  "cors": "^2.8.5",
106
106
  "express": "^4.21.0",
107
107
  "faf-cli": "^6.7.1",
108
+ "faf-scoring-kernel": "^2.0.3",
108
109
  "yaml": "^2.4.1"
109
110
  },
110
111
  "devDependencies": {
111
- "@jest/globals": "^30.1.2",
112
112
  "@types/cors": "^2.8.19",
113
113
  "@types/express": "^5.0.3",
114
- "@types/jest": "^30.0.0",
115
114
  "@types/jsonwebtoken": "^9.0.5",
116
115
  "@types/node": "^20.11.0",
117
116
  "@typescript-eslint/eslint-plugin": "^7.0.0",
118
117
  "@typescript-eslint/parser": "^7.0.0",
119
118
  "eslint": "^8.56.0",
120
- "jest": "^30.2.0",
121
- "ts-jest": "^29.1.0",
122
119
  "ts-node": "^10.9.2",
123
120
  "typescript": "^5.9.3"
124
121
  }