job-forge 2.14.40 → 2.14.41
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/bin/geometra-mcp-launcher.mjs +54 -2
- package/docs/SETUP.md +11 -1
- package/modes/reference-portals.md +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
|
-
import { existsSync } from 'node:fs';
|
|
5
|
-
import { dirname, resolve } from 'node:path';
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
+
import { dirname, join, resolve } from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
|
|
8
8
|
const DEFAULT_FALLBACK_PACKAGE = '@geometra/mcp@1.61.3';
|
|
@@ -22,6 +22,46 @@ function resolveExplicitPath(rawPath) {
|
|
|
22
22
|
return resolvedPath;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function readJsonFile(filePath) {
|
|
26
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function readProjectPathFromPackageJson(projectDir) {
|
|
30
|
+
const packagePath = join(projectDir, 'package.json');
|
|
31
|
+
if (!existsSync(packagePath)) return null;
|
|
32
|
+
const pkg = readJsonFile(packagePath);
|
|
33
|
+
const rawPath = pkg?.jobForge?.geometraMcpPath;
|
|
34
|
+
return normalizeEnv(rawPath);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function readProjectPathFromOpencodeConfig(projectDir) {
|
|
38
|
+
const configPath = join(projectDir, 'opencode.json');
|
|
39
|
+
if (!existsSync(configPath)) return null;
|
|
40
|
+
const config = readJsonFile(configPath);
|
|
41
|
+
const rawPath = config?.mcp?.geometra?.environment?.JOB_FORGE_GEOMETRA_MCP_PATH;
|
|
42
|
+
return normalizeEnv(rawPath);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function resolveProjectConfiguredPath(projectDir) {
|
|
46
|
+
const packagePath = readProjectPathFromPackageJson(projectDir);
|
|
47
|
+
if (packagePath) {
|
|
48
|
+
return {
|
|
49
|
+
source: 'project-package-json',
|
|
50
|
+
resolvedPath: resolve(projectDir, packagePath),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const opencodePath = readProjectPathFromOpencodeConfig(projectDir);
|
|
55
|
+
if (opencodePath) {
|
|
56
|
+
return {
|
|
57
|
+
source: 'project-opencode-json',
|
|
58
|
+
resolvedPath: resolve(projectDir, opencodePath),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
25
65
|
export function resolveGeometraMcpLaunchTarget() {
|
|
26
66
|
const explicitPath = normalizeEnv(process.env.JOB_FORGE_GEOMETRA_MCP_PATH);
|
|
27
67
|
if (explicitPath) {
|
|
@@ -34,6 +74,18 @@ export function resolveGeometraMcpLaunchTarget() {
|
|
|
34
74
|
};
|
|
35
75
|
}
|
|
36
76
|
|
|
77
|
+
const projectDir = process.env.JOB_FORGE_PROJECT || process.cwd();
|
|
78
|
+
const projectConfigured = resolveProjectConfiguredPath(projectDir);
|
|
79
|
+
if (projectConfigured) {
|
|
80
|
+
const resolvedPath = resolveExplicitPath(projectConfigured.resolvedPath);
|
|
81
|
+
return {
|
|
82
|
+
source: projectConfigured.source,
|
|
83
|
+
command: process.execPath,
|
|
84
|
+
args: [resolvedPath],
|
|
85
|
+
resolvedPath,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
37
89
|
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
|
38
90
|
const siblingRepoPath = resolve(scriptDir, '../../geometra/mcp/dist/index.js');
|
|
39
91
|
if (existsSync(siblingRepoPath)) {
|
package/docs/SETUP.md
CHANGED
|
@@ -214,7 +214,17 @@ Use it to identify which sessions or models are consuming the most tokens. The `
|
|
|
214
214
|
`sync-check` requires `cv.md` and `config/profile.yml` with the fields checked in `cv-sync-check.mjs`. Until you finish the profile and CV steps, that is normal.
|
|
215
215
|
|
|
216
216
|
**PDF generation fails**
|
|
217
|
-
The scaffolded `opencode.json` already registers Geometra MCP; if it's not running, check `opencode mcp list` and verify the scaffolded config under the `mcp.geometra` key — its `command` MUST be `["npx", "--no-install", "job-forge", "mcp:geometra"]`, `enabled: true`, and its `environment` should include `GEOMETRA_STEALTH=1` (or equivalently `GEOMETRA_BROWSER=stealth`) so proxy-backed portal sessions default to CloakBrowser's patched Chromium. `job-forge mcp:geometra`
|
|
217
|
+
The scaffolded `opencode.json` already registers Geometra MCP; if it's not running, check `opencode mcp list` and verify the scaffolded config under the `mcp.geometra` key — its `command` MUST be `["npx", "--no-install", "job-forge", "mcp:geometra"]`, `enabled: true`, and its `environment` should include `GEOMETRA_STEALTH=1` (or equivalently `GEOMETRA_BROWSER=stealth`) so proxy-backed portal sessions default to CloakBrowser's patched Chromium. `job-forge mcp:geometra` resolves Geometra in this order: `JOB_FORGE_GEOMETRA_MCP_PATH`, then a consumer-project override from `package.json -> jobForge.geometraMcpPath`, then `opencode.json -> mcp.geometra.environment.JOB_FORGE_GEOMETRA_MCP_PATH`, then a sibling `../geometra/mcp/dist/index.js` checkout for local JobForge development, and finally the pinned npm package. Geometra manages Chromium via its built-in proxy. JobForge still passes `stealth: true` for portal sessions explicitly; the env block keeps the default aligned for auto-spawned sessions and local debugging. For standalone CLI usage (outside opencode), `generate-pdf.mjs` also works with standalone Playwright/Chromium — install with `npx playwright install chromium`.
|
|
218
|
+
|
|
219
|
+
For consumer projects that should always use a local Geometra checkout across Opencode, Codex, Cursor, and Claude, prefer a local `package.json` override instead of editing symlinked MCP configs:
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"jobForge": {
|
|
224
|
+
"geometraMcpPath": "/absolute/path/to/geometra/mcp/dist/index.js"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
218
228
|
|
|
219
229
|
**Symlinks are missing or pointing to a stale path**
|
|
220
230
|
Run `npx job-forge sync` (or `npm run sync`) to recreate them. This happens if you move the project directory after installing, or if `postinstall` didn't run (rare — check `npm install` output for errors).
|
|
@@ -139,6 +139,6 @@ The Geometra MCP partitions its reusable-proxy pool by proxy identity and browse
|
|
|
139
139
|
}
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
`job-forge mcp:geometra` resolves Geometra in this order: `JOB_FORGE_GEOMETRA_MCP_PATH`
|
|
142
|
+
`job-forge mcp:geometra` resolves Geometra in this order: `JOB_FORGE_GEOMETRA_MCP_PATH`, then `package.json -> jobForge.geometraMcpPath`, then `opencode.json -> mcp.geometra.environment.JOB_FORGE_GEOMETRA_MCP_PATH`, then a sibling local `../geometra/mcp/dist/index.js` checkout for maintainers working across both repos, then the pinned npm fallback.
|
|
143
143
|
|
|
144
144
|
To check or modify MCP settings, edit `opencode.json` in the project root.
|