@monoes/monomindcli 2.12.0 → 2.14.0
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/.claude/skills/mastermind/SKILL.md +1 -15
- package/README.md +1 -1
- package/dist/src/commands/doctor-mcp-probe.d.ts +48 -0
- package/dist/src/commands/doctor-mcp-probe.d.ts.map +1 -0
- package/dist/src/commands/doctor-mcp-probe.js +205 -0
- package/dist/src/commands/doctor-mcp-probe.js.map +1 -0
- package/dist/src/commands/doctor-monoes-checks.d.ts +1 -0
- package/dist/src/commands/doctor-monoes-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-monoes-checks.js +96 -34
- package/dist/src/commands/doctor-monoes-checks.js.map +1 -1
- package/dist/src/commands/doctor-project-checks.d.ts +31 -1
- package/dist/src/commands/doctor-project-checks.d.ts.map +1 -1
- package/dist/src/commands/doctor-project-checks.js +109 -4
- package/dist/src/commands/doctor-project-checks.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +21 -3
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +29 -0
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +4 -3
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/org-observe.d.ts.map +1 -1
- package/dist/src/commands/org-observe.js +14 -0
- package/dist/src/commands/org-observe.js.map +1 -1
- package/dist/src/commands/org.d.ts.map +1 -1
- package/dist/src/commands/org.js +21 -4
- package/dist/src/commands/org.js.map +1 -1
- package/dist/src/commands/ui.d.ts.map +1 -1
- package/dist/src/commands/ui.js +4 -0
- package/dist/src/commands/ui.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts.map +1 -1
- package/dist/src/init/claudemd-generator.js +2 -1
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/copy-assets.d.ts.map +1 -1
- package/dist/src/init/copy-assets.js +56 -18
- package/dist/src/init/copy-assets.js.map +1 -1
- package/dist/src/init/executor.d.ts.map +1 -1
- package/dist/src/init/executor.js +9 -1
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +3 -3
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/never-commit.d.ts +39 -0
- package/dist/src/init/never-commit.d.ts.map +1 -0
- package/dist/src/init/never-commit.js +15 -0
- package/dist/src/init/never-commit.js.map +1 -0
- package/dist/src/init/shared.d.ts +74 -1
- package/dist/src/init/shared.d.ts.map +1 -1
- package/dist/src/init/shared.js +166 -0
- package/dist/src/init/shared.js.map +1 -1
- package/dist/src/init/types.d.ts +11 -0
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/init/upgrade.d.ts.map +1 -1
- package/dist/src/init/upgrade.js +1 -0
- package/dist/src/init/upgrade.js.map +1 -1
- package/dist/src/init/write-kimicode.d.ts.map +1 -1
- package/dist/src/init/write-kimicode.js +13 -9
- package/dist/src/init/write-kimicode.js.map +1 -1
- package/dist/src/init/write-opencode.d.ts.map +1 -1
- package/dist/src/init/write-opencode.js +44 -2
- package/dist/src/init/write-opencode.js.map +1 -1
- package/dist/src/init/write-runtime-config.d.ts +2 -0
- package/dist/src/init/write-runtime-config.d.ts.map +1 -1
- package/dist/src/init/write-runtime-config.js +65 -38
- package/dist/src/init/write-runtime-config.js.map +1 -1
- package/dist/src/mastermind/manifest-data.d.ts.map +1 -1
- package/dist/src/mastermind/manifest-data.js +14 -0
- package/dist/src/mastermind/manifest-data.js.map +1 -1
- package/dist/src/mcp/monoes-mcp-entry.mjs +86 -0
- package/dist/src/mcp-tools/terminal-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +52 -9
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +84 -3
- package/dist/src/memory/memory-bridge.d.ts.map +1 -1
- package/dist/src/memory/memory-bridge.js +215 -17
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/orgrt/agent-runner.d.ts +38 -0
- package/dist/src/orgrt/agent-runner.d.ts.map +1 -1
- package/dist/src/orgrt/agent-runner.js +47 -0
- package/dist/src/orgrt/agent-runner.js.map +1 -1
- package/dist/src/orgrt/checkpoint.d.ts +12 -1
- package/dist/src/orgrt/checkpoint.d.ts.map +1 -1
- package/dist/src/orgrt/checkpoint.js +15 -6
- package/dist/src/orgrt/checkpoint.js.map +1 -1
- package/dist/src/orgrt/completion-gate.d.ts +74 -0
- package/dist/src/orgrt/completion-gate.d.ts.map +1 -1
- package/dist/src/orgrt/completion-gate.js +45 -0
- package/dist/src/orgrt/completion-gate.js.map +1 -1
- package/dist/src/orgrt/cost-tier.d.ts +144 -0
- package/dist/src/orgrt/cost-tier.d.ts.map +1 -0
- package/dist/src/orgrt/cost-tier.js +183 -0
- package/dist/src/orgrt/cost-tier.js.map +1 -0
- package/dist/src/orgrt/cross-org.d.ts.map +1 -1
- package/dist/src/orgrt/cross-org.js +14 -0
- package/dist/src/orgrt/cross-org.js.map +1 -1
- package/dist/src/orgrt/daemon.d.ts +12 -1
- package/dist/src/orgrt/daemon.d.ts.map +1 -1
- package/dist/src/orgrt/daemon.js +216 -49
- package/dist/src/orgrt/daemon.js.map +1 -1
- package/dist/src/orgrt/decisions.d.ts +14 -2
- package/dist/src/orgrt/decisions.d.ts.map +1 -1
- package/dist/src/orgrt/decisions.js +216 -10
- package/dist/src/orgrt/decisions.js.map +1 -1
- package/dist/src/orgrt/file-roots.d.ts +7 -0
- package/dist/src/orgrt/file-roots.d.ts.map +1 -1
- package/dist/src/orgrt/file-roots.js +38 -1
- package/dist/src/orgrt/file-roots.js.map +1 -1
- package/dist/src/orgrt/forwarder.d.ts.map +1 -1
- package/dist/src/orgrt/forwarder.js +16 -2
- package/dist/src/orgrt/forwarder.js.map +1 -1
- package/dist/src/orgrt/idle-deadline.d.ts +74 -1
- package/dist/src/orgrt/idle-deadline.d.ts.map +1 -1
- package/dist/src/orgrt/idle-deadline.js +52 -2
- package/dist/src/orgrt/idle-deadline.js.map +1 -1
- package/dist/src/orgrt/loadouts.d.ts +38 -0
- package/dist/src/orgrt/loadouts.d.ts.map +1 -0
- package/dist/src/orgrt/loadouts.js +129 -0
- package/dist/src/orgrt/loadouts.js.map +1 -0
- package/dist/src/orgrt/mailbox.d.ts +17 -1
- package/dist/src/orgrt/mailbox.d.ts.map +1 -1
- package/dist/src/orgrt/mailbox.js +50 -3
- package/dist/src/orgrt/mailbox.js.map +1 -1
- package/dist/src/orgrt/policy.d.ts +42 -2
- package/dist/src/orgrt/policy.d.ts.map +1 -1
- package/dist/src/orgrt/policy.js +53 -8
- package/dist/src/orgrt/policy.js.map +1 -1
- package/dist/src/orgrt/prompt-vars.d.ts +11 -0
- package/dist/src/orgrt/prompt-vars.d.ts.map +1 -0
- package/dist/src/orgrt/prompt-vars.js +49 -0
- package/dist/src/orgrt/prompt-vars.js.map +1 -0
- package/dist/src/orgrt/questions.d.ts +22 -1
- package/dist/src/orgrt/questions.d.ts.map +1 -1
- package/dist/src/orgrt/questions.js +24 -3
- package/dist/src/orgrt/questions.js.map +1 -1
- package/dist/src/orgrt/review-packet.d.ts +29 -0
- package/dist/src/orgrt/review-packet.d.ts.map +1 -0
- package/dist/src/orgrt/review-packet.js +67 -0
- package/dist/src/orgrt/review-packet.js.map +1 -0
- package/dist/src/orgrt/role-sandbox.d.ts.map +1 -1
- package/dist/src/orgrt/role-sandbox.js +16 -3
- package/dist/src/orgrt/role-sandbox.js.map +1 -1
- package/dist/src/orgrt/session-ledger.d.ts +61 -0
- package/dist/src/orgrt/session-ledger.d.ts.map +1 -0
- package/dist/src/orgrt/session-ledger.js +113 -0
- package/dist/src/orgrt/session-ledger.js.map +1 -0
- package/dist/src/orgrt/session.d.ts +45 -5
- package/dist/src/orgrt/session.d.ts.map +1 -1
- package/dist/src/orgrt/session.js +384 -27
- package/dist/src/orgrt/session.js.map +1 -1
- package/dist/src/orgrt/task-dag.d.ts +34 -1
- package/dist/src/orgrt/task-dag.d.ts.map +1 -1
- package/dist/src/orgrt/task-dag.js +58 -7
- package/dist/src/orgrt/task-dag.js.map +1 -1
- package/dist/src/orgrt/tool-spill.d.ts +94 -0
- package/dist/src/orgrt/tool-spill.d.ts.map +1 -0
- package/dist/src/orgrt/tool-spill.js +180 -0
- package/dist/src/orgrt/tool-spill.js.map +1 -0
- package/dist/src/orgrt/types.d.ts +138 -0
- package/dist/src/orgrt/types.d.ts.map +1 -1
- package/dist/src/orgrt/types.js +148 -0
- package/dist/src/orgrt/types.js.map +1 -1
- package/dist/src/platform-adapters/renderers/mcp.d.ts +20 -2
- package/dist/src/platform-adapters/renderers/mcp.d.ts.map +1 -1
- package/dist/src/platform-adapters/renderers/mcp.js +25 -5
- package/dist/src/platform-adapters/renderers/mcp.js.map +1 -1
- package/dist/src/platform-adapters/renderers/skills.d.ts +0 -6
- package/dist/src/platform-adapters/renderers/skills.d.ts.map +1 -1
- package/dist/src/platform-adapters/renderers/skills.js +12 -22
- package/dist/src/platform-adapters/renderers/skills.js.map +1 -1
- package/dist/src/protocol-capabilities.d.ts +2 -1
- package/dist/src/protocol-capabilities.d.ts.map +1 -1
- package/dist/src/protocol-capabilities.js +2 -1
- package/dist/src/protocol-capabilities.js.map +1 -1
- package/dist/src/ui/dashboard.html +457 -164
- package/dist/src/ui/org-hil.mjs +276 -0
- package/dist/src/ui/org-runtime.mjs +350 -0
- package/dist/src/ui/orgs.html +22 -4
- package/dist/src/ui/routes-monoes.mjs +28 -3
- package/dist/src/ui/routes-org.mjs +290 -541
- package/dist/src/ui/server.mjs +185 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -18,23 +18,9 @@ Load only the workflow that matches the request:
|
|
|
18
18
|
- `mastermind-memory` for persistent knowledge.
|
|
19
19
|
|
|
20
20
|
**For build/feature work, the gates are mandatory and ordered:** idea → design → plan →
|
|
21
|
-
execute → review.
|
|
22
|
-
`.claude/commands/mastermind-master.md`; consult it before concluding that no workflow applies.
|
|
21
|
+
execute → review.
|
|
23
22
|
|
|
24
23
|
Use Monograph before broad repository search when the platform exposes the
|
|
25
24
|
Monomind MCP server. Without native skills, run
|
|
26
25
|
`monomind mastermind run <skill> --print` and follow the printed procedure.
|
|
27
26
|
Platform tool mappings are in [references/](references/).
|
|
28
|
-
# Mastermind
|
|
29
|
-
|
|
30
|
-
Load only the workflow that matches the current task:
|
|
31
|
-
- `mastermind` — Route a request to the relevant Mastermind workflow.
|
|
32
|
-
- `mastermind-plan` — Write a detailed implementation plan before changing code.
|
|
33
|
-
- `mastermind-review` — Review code, content, strategy, or security work.
|
|
34
|
-
- `mastermind-debug` — Investigate a failure or unexpected behavior before fixing it.
|
|
35
|
-
- `mastermind-research` — Research an open question before making a decision.
|
|
36
|
-
- `mastermind-execute` — Execute a written implementation plan step by step.
|
|
37
|
-
- `mastermind-org` — Create, run, inspect, and manage a Mastermind organization.
|
|
38
|
-
- `mastermind-memory` — Store, retrieve, and maintain persistent organization knowledge.
|
|
39
|
-
|
|
40
|
-
If skills cannot be loaded natively, run `monomind mastermind run <skill> --print`.
|
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ Use `monomind init --target codex` (or `--codex`) to initialize only Codex. See
|
|
|
96
96
|
| Concern | Answer |
|
|
97
97
|
|---|---|
|
|
98
98
|
| **License** | [Apache 2.0](LICENSE) — use it however you want |
|
|
99
|
-
| **Data privacy** | Your code and memory store stay local. Monomind does make
|
|
99
|
+
| **Data privacy** | Your code and memory store stay local. Monomind does make a small number of outbound network calls. See [doc/privacy.md](doc/privacy.md) for the complete list of what's sent, when, and how to opt out of each. |
|
|
100
100
|
| **Dependencies** | Standard npm packages (tree-sitter, better-sqlite3, sql.js, zod). tree-sitter and better-sqlite3 are native (prebuilt) Node addons, not pure JS/WASM — sql.js is WASM. No post-install scripts that download code. |
|
|
101
101
|
| **Permissions** | Registers as an MCP server — Claude Code controls what tools are available and prompts you before executing anything sensitive. |
|
|
102
102
|
| **Source** | Fully open. Read every line at [github.com/monoes/monomind](https://github.com/monoes/monomind). |
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor — MCP server start-up probe (i-312)
|
|
3
|
+
*
|
|
4
|
+
* Runs a configured MCP server exactly as its client would (spawn `command`
|
|
5
|
+
* + `args`, speak newline-delimited JSON-RPC on stdio) and waits for it to
|
|
6
|
+
* answer `initialize`. The incident that motivated this: a `.mcp.json` pinned
|
|
7
|
+
* `npx -y @monoes/monomindcli@2.11.1 mcp start`, which dies immediately with
|
|
8
|
+
* "npm error could not determine executable to run". Every static check
|
|
9
|
+
* passed, Claude Code showed CONNECTION_CLOSED, and the graph tools were
|
|
10
|
+
* silently gone.
|
|
11
|
+
*
|
|
12
|
+
* Three outcomes, deliberately distinct:
|
|
13
|
+
* ok — answered `initialize`
|
|
14
|
+
* failed — exited (or never spawned) before answering; `stderr` says why
|
|
15
|
+
* timeout — still running, still silent. NOT the same as broken: a cold
|
|
16
|
+
* `npx` fetch of this package takes 20-30s on this machine
|
|
17
|
+
* (measured), far beyond any timeout doctor can afford, so the
|
|
18
|
+
* caller reports it as "unknown", never as "cannot start".
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Probe budget. doctor is interactive and runs in CI, so it cannot wait on a
|
|
22
|
+
* package download; a locally-installed server answers in well under a second
|
|
23
|
+
* and the broken `npx` form in the issue fails in ~0.8s once npm has the
|
|
24
|
+
* package cached. 3s covers both with room to spare.
|
|
25
|
+
*/
|
|
26
|
+
export declare const MCP_PROBE_TIMEOUT_MS = 3000;
|
|
27
|
+
export type McpProbeOutcome = 'ok' | 'failed' | 'timeout';
|
|
28
|
+
export interface McpProbeResult {
|
|
29
|
+
outcome: McpProbeOutcome;
|
|
30
|
+
/** Condensed stderr (or the spawn error), '' when the server said nothing. */
|
|
31
|
+
stderr: string;
|
|
32
|
+
exitCode: number | null;
|
|
33
|
+
elapsedMs: number;
|
|
34
|
+
}
|
|
35
|
+
export interface McpProbeOptions {
|
|
36
|
+
command: string;
|
|
37
|
+
args?: string[];
|
|
38
|
+
env?: Record<string, string>;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Condense a server's stderr into one line a doctor result can carry: drop
|
|
44
|
+
* blanks, keep the first few lines (npm puts the real cause first), truncate.
|
|
45
|
+
*/
|
|
46
|
+
export declare function summarizeStderr(raw: string, max?: number): string;
|
|
47
|
+
export declare function probeMcpServer(options: McpProbeOptions): Promise<McpProbeResult>;
|
|
48
|
+
//# sourceMappingURL=doctor-mcp-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-mcp-probe.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor-mcp-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAWzC,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,eAAe,CAAC;IACzB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,SAAM,GAAG,MAAM,CAO9D;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CA6JtF"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Doctor — MCP server start-up probe (i-312)
|
|
3
|
+
*
|
|
4
|
+
* Runs a configured MCP server exactly as its client would (spawn `command`
|
|
5
|
+
* + `args`, speak newline-delimited JSON-RPC on stdio) and waits for it to
|
|
6
|
+
* answer `initialize`. The incident that motivated this: a `.mcp.json` pinned
|
|
7
|
+
* `npx -y @monoes/monomindcli@2.11.1 mcp start`, which dies immediately with
|
|
8
|
+
* "npm error could not determine executable to run". Every static check
|
|
9
|
+
* passed, Claude Code showed CONNECTION_CLOSED, and the graph tools were
|
|
10
|
+
* silently gone.
|
|
11
|
+
*
|
|
12
|
+
* Three outcomes, deliberately distinct:
|
|
13
|
+
* ok — answered `initialize`
|
|
14
|
+
* failed — exited (or never spawned) before answering; `stderr` says why
|
|
15
|
+
* timeout — still running, still silent. NOT the same as broken: a cold
|
|
16
|
+
* `npx` fetch of this package takes 20-30s on this machine
|
|
17
|
+
* (measured), far beyond any timeout doctor can afford, so the
|
|
18
|
+
* caller reports it as "unknown", never as "cannot start".
|
|
19
|
+
*/
|
|
20
|
+
import { spawn } from 'node:child_process';
|
|
21
|
+
/**
|
|
22
|
+
* Probe budget. doctor is interactive and runs in CI, so it cannot wait on a
|
|
23
|
+
* package download; a locally-installed server answers in well under a second
|
|
24
|
+
* and the broken `npx` form in the issue fails in ~0.8s once npm has the
|
|
25
|
+
* package cached. 3s covers both with room to spare.
|
|
26
|
+
*/
|
|
27
|
+
export const MCP_PROBE_TIMEOUT_MS = 3000;
|
|
28
|
+
/** How long a SIGTERM'd server gets to exit before it is SIGKILLed. */
|
|
29
|
+
const TERM_GRACE_MS = 300;
|
|
30
|
+
/** Hard cap on waiting for the kill to land, so the probe itself cannot hang. */
|
|
31
|
+
const KILL_GRACE_MS = 1000;
|
|
32
|
+
/** Cap captured output — a chatty server must not grow doctor's heap. */
|
|
33
|
+
const MAX_CAPTURE_BYTES = 64 * 1024;
|
|
34
|
+
const PROBE_ID = 1;
|
|
35
|
+
/**
|
|
36
|
+
* Condense a server's stderr into one line a doctor result can carry: drop
|
|
37
|
+
* blanks, keep the first few lines (npm puts the real cause first), truncate.
|
|
38
|
+
*/
|
|
39
|
+
export function summarizeStderr(raw, max = 240) {
|
|
40
|
+
const lines = raw
|
|
41
|
+
.split('\n')
|
|
42
|
+
.map((line) => line.trim())
|
|
43
|
+
.filter((line) => line.length > 0);
|
|
44
|
+
const joined = lines.slice(0, 3).join('; ');
|
|
45
|
+
return joined.length > max ? `${joined.slice(0, max)}…` : joined;
|
|
46
|
+
}
|
|
47
|
+
export async function probeMcpServer(options) {
|
|
48
|
+
const { command, args = [], env, cwd, timeoutMs = MCP_PROBE_TIMEOUT_MS } = options;
|
|
49
|
+
const startedAt = Date.now();
|
|
50
|
+
// Own process group on POSIX so the whole tree dies with one signal — an
|
|
51
|
+
// `npx` wrapper that has already forked node would otherwise survive and
|
|
52
|
+
// leak (o-04: processes never reaped). The cost is that a Ctrl-C aimed at
|
|
53
|
+
// doctor no longer reaches the child; the probe kills it on every return
|
|
54
|
+
// path and the window is at most `timeoutMs`.
|
|
55
|
+
const useProcessGroup = process.platform !== 'win32';
|
|
56
|
+
let child;
|
|
57
|
+
try {
|
|
58
|
+
child = spawn(command, args, {
|
|
59
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
60
|
+
env: env ? { ...process.env, ...env } : process.env,
|
|
61
|
+
cwd,
|
|
62
|
+
detached: useProcessGroup,
|
|
63
|
+
windowsHide: true,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
return {
|
|
68
|
+
outcome: 'failed',
|
|
69
|
+
stderr: err instanceof Error ? err.message : String(err),
|
|
70
|
+
exitCode: null,
|
|
71
|
+
elapsedMs: Date.now() - startedAt,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
let exited = false;
|
|
75
|
+
let exitCode = null;
|
|
76
|
+
let stderrRaw = '';
|
|
77
|
+
let stdoutBuf = '';
|
|
78
|
+
let spawnError = '';
|
|
79
|
+
const exitWaiters = [];
|
|
80
|
+
child.on('exit', (code) => {
|
|
81
|
+
exited = true;
|
|
82
|
+
exitCode = code;
|
|
83
|
+
for (const resolve of exitWaiters.splice(0))
|
|
84
|
+
resolve();
|
|
85
|
+
});
|
|
86
|
+
const capture = (current, chunk) => current.length >= MAX_CAPTURE_BYTES
|
|
87
|
+
? current
|
|
88
|
+
: (current + String(chunk)).slice(0, MAX_CAPTURE_BYTES);
|
|
89
|
+
child.stderr?.on('data', (chunk) => {
|
|
90
|
+
stderrRaw = capture(stderrRaw, chunk);
|
|
91
|
+
});
|
|
92
|
+
const outcome = await new Promise((resolve) => {
|
|
93
|
+
let settled = false;
|
|
94
|
+
const settle = (value) => {
|
|
95
|
+
if (settled)
|
|
96
|
+
return;
|
|
97
|
+
settled = true;
|
|
98
|
+
resolve(value);
|
|
99
|
+
};
|
|
100
|
+
const timer = setTimeout(() => settle('timeout'), timeoutMs);
|
|
101
|
+
timer.unref?.();
|
|
102
|
+
const done = (value) => {
|
|
103
|
+
clearTimeout(timer);
|
|
104
|
+
settle(value);
|
|
105
|
+
};
|
|
106
|
+
child.stdout?.on('data', (chunk) => {
|
|
107
|
+
stdoutBuf = capture(stdoutBuf, chunk);
|
|
108
|
+
const lines = stdoutBuf.split('\n');
|
|
109
|
+
stdoutBuf = lines.pop() ?? '';
|
|
110
|
+
for (const line of lines) {
|
|
111
|
+
if (!line.trim())
|
|
112
|
+
continue;
|
|
113
|
+
let message;
|
|
114
|
+
try {
|
|
115
|
+
message = JSON.parse(line);
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
continue; // banner/log noise on stdout — not our answer
|
|
119
|
+
}
|
|
120
|
+
if (message.id !== PROBE_ID)
|
|
121
|
+
continue;
|
|
122
|
+
if ('result' in message)
|
|
123
|
+
return done('ok');
|
|
124
|
+
if ('error' in message)
|
|
125
|
+
return done('failed');
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
child.on('error', (err) => {
|
|
129
|
+
spawnError = err.message;
|
|
130
|
+
done('failed');
|
|
131
|
+
});
|
|
132
|
+
child.on('exit', () => done('failed'));
|
|
133
|
+
try {
|
|
134
|
+
child.stdin?.write(`${JSON.stringify({
|
|
135
|
+
jsonrpc: '2.0',
|
|
136
|
+
id: PROBE_ID,
|
|
137
|
+
method: 'initialize',
|
|
138
|
+
params: {
|
|
139
|
+
protocolVersion: '2024-11-05',
|
|
140
|
+
capabilities: {},
|
|
141
|
+
clientInfo: { name: 'monomind-doctor', version: '1' },
|
|
142
|
+
},
|
|
143
|
+
})}\n`);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// Broken pipe: the server is already gone; the exit/error handler decides.
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
await shutdown();
|
|
150
|
+
return {
|
|
151
|
+
outcome,
|
|
152
|
+
stderr: spawnError || summarizeStderr(stderrRaw),
|
|
153
|
+
exitCode,
|
|
154
|
+
elapsedMs: Date.now() - startedAt,
|
|
155
|
+
};
|
|
156
|
+
function signalTree(signal) {
|
|
157
|
+
if (exited)
|
|
158
|
+
return;
|
|
159
|
+
try {
|
|
160
|
+
if (useProcessGroup && typeof child.pid === 'number')
|
|
161
|
+
process.kill(-child.pid, signal);
|
|
162
|
+
else
|
|
163
|
+
child.kill(signal);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
try {
|
|
167
|
+
child.kill(signal);
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
/* already gone */
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function waitForExit(ms) {
|
|
175
|
+
if (exited)
|
|
176
|
+
return Promise.resolve();
|
|
177
|
+
return new Promise((resolve) => {
|
|
178
|
+
const timer = setTimeout(resolve, ms);
|
|
179
|
+
timer.unref?.();
|
|
180
|
+
exitWaiters.push(() => {
|
|
181
|
+
clearTimeout(timer);
|
|
182
|
+
resolve();
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
async function shutdown() {
|
|
187
|
+
try {
|
|
188
|
+
child.stdin?.end();
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
/* already closed */
|
|
192
|
+
}
|
|
193
|
+
if (exited)
|
|
194
|
+
return;
|
|
195
|
+
signalTree('SIGTERM');
|
|
196
|
+
await waitForExit(TERM_GRACE_MS);
|
|
197
|
+
if (exited)
|
|
198
|
+
return;
|
|
199
|
+
signalTree('SIGKILL');
|
|
200
|
+
// Bounded: if the process is unkillable (uninterruptible sleep), doctor
|
|
201
|
+
// still returns rather than waiting on it forever.
|
|
202
|
+
await waitForExit(KILL_GRACE_MS);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=doctor-mcp-probe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor-mcp-probe.js","sourceRoot":"","sources":["../../../src/commands/doctor-mcp-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAEzC,uEAAuE;AACvE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,iFAAiF;AACjF,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,yEAAyE;AACzE,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AAEpC,MAAM,QAAQ,GAAG,CAAC,CAAC;AAoBnB;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,GAAG,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MAAM,CAAC;YACP,IAAI,CAAC;gBACH,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,CAAC;YAAC,MAAM,CAAC;gBACP,kBAAkB;YACpB,CAAC;QACH,CAAC;IACH,CAAC;IAED,SAAS,WAAW,CAAC,EAAU;QAC7B,IAAI,MAAM;YAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAChB,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE;gBACpB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,KAAK,UAAU,QAAQ;QACrB,IAAI,CAAC;YACH,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,oBAAoB;QACtB,CAAC;QACD,IAAI,MAAM;YAAE,OAAO;QACnB,UAAU,CAAC,SAAS,CAAC,CAAC;QACtB,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;QACjC,IAAI,MAAM;YAAE,OAAO;QACnB,UAAU,CAAC,SAAS,CAAC,CAAC;QACtB,wEAAwE;QACxE,mDAAmD;QACnD,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* issues discovered while installing them via /monoes:install.
|
|
8
8
|
*/
|
|
9
9
|
import type { HealthCheck } from './doctor-env-checks.js';
|
|
10
|
+
export declare const DASHBOARD_TOKEN_BURNED_NOTICE = "the value must be treated as burned \u2014 the historical blob remains in git history even after this file stops being tracked";
|
|
10
11
|
export declare function checkMonoesTools(): Promise<HealthCheck>;
|
|
11
12
|
/**
|
|
12
13
|
* i-066: verifies the monoes.me OAuth token isn't exposed to git — neither
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-monoes-checks.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor-monoes-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor-monoes-checks.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor-monoes-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAqC1D,eAAO,MAAM,6BAA6B,mIACmF,CAAC;AA6I9H,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,WAAW,CAAC,CAuB7D;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,WAAW,CAAC,CA6IrE;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CA8BvD"}
|
|
@@ -27,6 +27,19 @@ import { runCommand } from './doctor-env-checks.js';
|
|
|
27
27
|
// git tracked/ignored status), so it can never truthfully claim that.
|
|
28
28
|
const REVOKE_LINE = 'Treat this token as compromised: revoke it at https://monoes.me (Settings -> Connected apps). If it reached git history, rewriting the file does not remove it.';
|
|
29
29
|
const DISCONNECT_LINE = 'Run `monomind ui`, then monoes.me -> Disconnect -> Connect.';
|
|
30
|
+
// i-052 commit 3 — a dashboard-token leak is a different credential from
|
|
31
|
+
// the monoes.me OAuth token above (REVOKE_LINE/DISCONNECT_LINE do not
|
|
32
|
+
// apply: there is nothing to revoke at monoes.me and no Disconnect flow
|
|
33
|
+
// for it), and its remedy is different in kind: `.gitignore` does nothing
|
|
34
|
+
// for an already-tracked file, so the only real fix is to untrack it.
|
|
35
|
+
// `DASHBOARD_TOKEN_BURNED_NOTICE` is exported so AC-5 clause (d) can assert
|
|
36
|
+
// by identity against the sentence the user actually sees, not a substring
|
|
37
|
+
// guess at it (i-050's AC-3 amendment pattern, applied here per plan §5b).
|
|
38
|
+
// Deliberately duplicated from mcp/monoes-mcp-entry.mjs's identical
|
|
39
|
+
// constant rather than imported — same "two call sites is not a shared
|
|
40
|
+
// abstraction" convention as hasLegacyMonoesBearerEntry() above.
|
|
41
|
+
export const DASHBOARD_TOKEN_BURNED_NOTICE = 'the value must be treated as burned — the historical blob remains in git history even after this file stops being tracked';
|
|
42
|
+
const DASHBOARD_TOKEN_REMEDIATION_LINE = `Untrack it: git rm --cached .monomind/dashboard-token. Then ${DASHBOARD_TOKEN_BURNED_NOTICE}.`;
|
|
30
43
|
/**
|
|
31
44
|
* True if `.mcp.json`'s raw text contains a literal bearer token, checked
|
|
32
45
|
* at the specific path this item's writers ever wrote one
|
|
@@ -200,12 +213,21 @@ export async function checkMonoesTokenExposure() {
|
|
|
200
213
|
// review finding 13, which caught the previous version of this function
|
|
201
214
|
// doing exactly that).
|
|
202
215
|
let hasConnectionFileIssue = false;
|
|
216
|
+
// i-052 commit 3: whether ANY monoes.me-credential issue fired (the mcp
|
|
217
|
+
// bearer token or the connection file) — distinct from
|
|
218
|
+
// hasDashboardTokenIssue below, because the two exposures are different
|
|
219
|
+
// credentials with different remedies (REVOKE_LINE's "revoke at
|
|
220
|
+
// monoes.me" is simply wrong advice for a dashboard-token leak, which
|
|
221
|
+
// has nothing to do with monoes.me).
|
|
222
|
+
let hasMonoesTokenIssue = false;
|
|
223
|
+
let hasDashboardTokenIssue = false;
|
|
203
224
|
const mcpJsonPath = join(cwd, '.mcp.json');
|
|
204
225
|
if (existsSync(mcpJsonPath)) {
|
|
205
226
|
try {
|
|
206
227
|
const raw = readFileSync(mcpJsonPath, 'utf8');
|
|
207
228
|
if (hasLegacyMonoesBearerEntry(raw)) {
|
|
208
229
|
issues.push('.mcp.json contains a literal bearer token');
|
|
230
|
+
hasMonoesTokenIssue = true;
|
|
209
231
|
}
|
|
210
232
|
}
|
|
211
233
|
catch {
|
|
@@ -214,13 +236,18 @@ export async function checkMonoesTokenExposure() {
|
|
|
214
236
|
}
|
|
215
237
|
const connectionRelPath = '.monomind/monoes-connection.json';
|
|
216
238
|
const connectionPath = join(cwd, connectionRelPath);
|
|
217
|
-
|
|
239
|
+
const dashboardTokenRelPath = '.monomind/dashboard-token';
|
|
240
|
+
const dashboardTokenPath = join(cwd, dashboardTokenRelPath);
|
|
241
|
+
if (existsSync(connectionPath) || existsSync(dashboardTokenPath)) {
|
|
218
242
|
// i-066 reviewer finding 5: outside a git work tree, `git check-ignore`
|
|
219
243
|
// and `git ls-files` both exit non-zero for reasons that have nothing
|
|
220
244
|
// to do with exposure (there is no git to leak through at all) — the
|
|
221
245
|
// old code read that as tracked=false, ignored=false and failed a
|
|
222
246
|
// zero-exposure user in a non-git project. Probe for a real work tree
|
|
223
|
-
// first; if there isn't one,
|
|
247
|
+
// first; if there isn't one, neither check below applies. Computed
|
|
248
|
+
// once and shared: it's the same probe regardless of which file it's
|
|
249
|
+
// gating (i-052 commit 3 reuses it for dashboard-token rather than
|
|
250
|
+
// re-running the same command a second time).
|
|
224
251
|
let insideWorkTree = false;
|
|
225
252
|
try {
|
|
226
253
|
await runCommand('git rev-parse --is-inside-work-tree');
|
|
@@ -230,29 +257,53 @@ export async function checkMonoesTokenExposure() {
|
|
|
230
257
|
insideWorkTree = false;
|
|
231
258
|
}
|
|
232
259
|
if (insideWorkTree) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
260
|
+
if (existsSync(connectionPath)) {
|
|
261
|
+
let ignored = false;
|
|
262
|
+
try {
|
|
263
|
+
await runCommand(`git check-ignore "${connectionRelPath}"`);
|
|
264
|
+
ignored = true;
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
ignored = false;
|
|
268
|
+
}
|
|
269
|
+
let tracked = false;
|
|
270
|
+
try {
|
|
271
|
+
await runCommand(`git ls-files --error-unmatch "${connectionRelPath}"`);
|
|
272
|
+
tracked = true;
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
tracked = false;
|
|
276
|
+
}
|
|
277
|
+
if (tracked) {
|
|
278
|
+
issues.push(`${connectionRelPath} is tracked by git — treat the token as compromised`);
|
|
279
|
+
hasConnectionFileIssue = true;
|
|
280
|
+
hasMonoesTokenIssue = true;
|
|
281
|
+
}
|
|
282
|
+
else if (!ignored) {
|
|
283
|
+
issues.push(`${connectionRelPath} exists but is not covered by .gitignore`);
|
|
284
|
+
hasConnectionFileIssue = true;
|
|
285
|
+
hasMonoesTokenIssue = true;
|
|
286
|
+
}
|
|
252
287
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
288
|
+
// i-052 commit 3 — the actual incident's shape: dashboard-token is
|
|
289
|
+
// gitignored by default since commits 1-2, but `.gitignore` does
|
|
290
|
+
// nothing once a path is already tracked. AC-7 (control): a file
|
|
291
|
+
// that exists but is untracked (whether ignored or not — being
|
|
292
|
+
// untracked is what matters here, not the ignore pattern) produces
|
|
293
|
+
// no warning, or this becomes noise that gets ignored.
|
|
294
|
+
if (existsSync(dashboardTokenPath)) {
|
|
295
|
+
let tracked = false;
|
|
296
|
+
try {
|
|
297
|
+
await runCommand(`git ls-files --error-unmatch "${dashboardTokenRelPath}"`);
|
|
298
|
+
tracked = true;
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
tracked = false;
|
|
302
|
+
}
|
|
303
|
+
if (tracked) {
|
|
304
|
+
issues.push(`${dashboardTokenRelPath} is tracked by git`);
|
|
305
|
+
hasDashboardTokenIssue = true;
|
|
306
|
+
}
|
|
256
307
|
}
|
|
257
308
|
}
|
|
258
309
|
}
|
|
@@ -265,19 +316,30 @@ export async function checkMonoesTokenExposure() {
|
|
|
265
316
|
}
|
|
266
317
|
// Fixed literals only, never interpolated — this message can reach a
|
|
267
318
|
// terminal or CI log, so it must never echo a caught error or a token
|
|
268
|
-
// value.
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
//
|
|
273
|
-
//
|
|
274
|
-
//
|
|
275
|
-
//
|
|
276
|
-
|
|
319
|
+
// value. Each remediation line is gated on the exposure it actually
|
|
320
|
+
// applies to (i-052 commit 3: previously REVOKE_LINE was unconditional
|
|
321
|
+
// whenever ANY issue fired — wrong once a dashboard-token-only exposure
|
|
322
|
+
// became possible, since that credential has nothing to do with
|
|
323
|
+
// monoes.me). REVOKE_LINE applies whenever a monoes.me credential issue
|
|
324
|
+
// fired: a literal bearer token in .mcp.json is a real credential
|
|
325
|
+
// exposure independent of whether THIS user ever connected (a
|
|
326
|
+
// teammate's commit, an older install, a pulled branch can all put it
|
|
327
|
+
// there) — a token you didn't create and can't rotate yourself is more
|
|
328
|
+
// urgent to escalate, not less. DISCONNECT_LINE is additive, only when
|
|
329
|
+
// an actual connection file was found and flagged by git — that's the
|
|
330
|
+
// only case where there's a live app connection to disconnect from at
|
|
331
|
+
// all.
|
|
332
|
+
const remediationParts = [];
|
|
333
|
+
if (hasMonoesTokenIssue) {
|
|
334
|
+
remediationParts.push(hasConnectionFileIssue ? `${REVOKE_LINE} ${DISCONNECT_LINE}` : REVOKE_LINE);
|
|
335
|
+
}
|
|
336
|
+
if (hasDashboardTokenIssue) {
|
|
337
|
+
remediationParts.push(DASHBOARD_TOKEN_REMEDIATION_LINE);
|
|
338
|
+
}
|
|
277
339
|
return {
|
|
278
340
|
name: 'monoes Token Exposure',
|
|
279
341
|
status: 'fail',
|
|
280
|
-
message: `${issues.join('; ')}. ${
|
|
342
|
+
message: `${issues.join('; ')}. ${remediationParts.join(' ')}`,
|
|
281
343
|
};
|
|
282
344
|
}
|
|
283
345
|
export async function fixMonoesTools() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-monoes-checks.js","sourceRoot":"","sources":["../../../src/commands/doctor-monoes-checks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOpD,4EAA4E;AAC5E,uEAAuE;AACvE,wEAAwE;AACxE,mEAAmE;AACnE,wEAAwE;AACxE,oEAAoE;AACpE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,mEAAmE;AACnE,uEAAuE;AACvE,wEAAwE;AACxE,sEAAsE;AACtE,MAAM,WAAW,GACf,iKAAiK,CAAC;AACpK,MAAM,eAAe,GAAG,6DAA6D,CAAC;AAEtF;;;;;;;;;;;;;GAaG;AACH,SAAS,0BAA0B,CAAC,GAAW;IAC7C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC;QAChE,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,wCAAwC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,GAAW;IACtC,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,cAAc,GAAG,EAA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CAAC;YACf,KAAK,GAAG,KAAK,CAAC;YACd,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACnE,IAAI,KAAK,YAAY,KAAK;gBAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -5,6 +5,25 @@
|
|
|
5
5
|
import type { HealthCheck } from './doctor-env-checks.js';
|
|
6
6
|
export type { HealthCheck };
|
|
7
7
|
export declare function checkConfigFile(): Promise<HealthCheck>;
|
|
8
|
+
/** o-16 (AC-6): the marker walk that resolves "this project" for the Memory
|
|
9
|
+
* & Knowledge store can silently adopt a wrong ancestor — the incident that
|
|
10
|
+
* motivated this check was a shared scratch parent's bare `.monomind`
|
|
11
|
+
* capturing an unrelated fixture, with no visible symptom until a search
|
|
12
|
+
* came back empty. Disclose the resolved root and why it was chosen, so a
|
|
13
|
+
* user can see which directory their brain is keyed to without reading code
|
|
14
|
+
* or debug logs. Always 'info': the resolution itself is never a health
|
|
15
|
+
* problem, only the failure to see it was.
|
|
16
|
+
*
|
|
17
|
+
* Named/scoped to "Memory Project Root", not a bare "Project Root" (o-16
|
|
18
|
+
* revision 1, reviewer MAJOR 2): `MONOMIND_PROJECT_ROOT` has a SECOND,
|
|
19
|
+
* independent consumer — `mcp-tools/guidance-tools.ts:findProjectRoot()`,
|
|
20
|
+
* which uses a different marker (`.claude`) and can legitimately resolve a
|
|
21
|
+
* different directory (see the divergence explained at
|
|
22
|
+
* `memory-bridge.ts`'s `getProjectRoot()` doc comment). A generic "Project
|
|
23
|
+
* Root" label would claim there is one true answer when this commit is
|
|
24
|
+
* what creates a state where two resolvers can disagree — this check must
|
|
25
|
+
* not be the thing that misleads about that. */
|
|
26
|
+
export declare function checkProjectRoot(): Promise<HealthCheck>;
|
|
8
27
|
export declare function checkMemoryDatabase(): Promise<HealthCheck>;
|
|
9
28
|
/** Memory knowledge graph (cognee port): entities/relations/rules distilled
|
|
10
29
|
* from sessions and org runs. Informational — an empty graph on a fresh
|
|
@@ -16,7 +35,18 @@ export declare function checkMemoryKnowledgeGraph(): Promise<HealthCheck>;
|
|
|
16
35
|
* (search degrades to keyword matching), so surface it here instead. */
|
|
17
36
|
export declare function checkSecondBrainModel(): Promise<HealthCheck>;
|
|
18
37
|
export declare function checkApiKeys(): Promise<HealthCheck>;
|
|
19
|
-
export
|
|
38
|
+
export interface McpCheckOptions {
|
|
39
|
+
/**
|
|
40
|
+
* Actually start the configured monomind server and speak `initialize`
|
|
41
|
+
* (i-312). Off by default: the plain `monomind doctor` run must not spawn a
|
|
42
|
+
* subprocess — with an `npx`-based entry that can mean a package download —
|
|
43
|
+
* on every invocation. `doctor -c mcp` opts in.
|
|
44
|
+
*/
|
|
45
|
+
probe?: boolean;
|
|
46
|
+
/** Probe budget; defaults to MCP_PROBE_TIMEOUT_MS. */
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
}
|
|
49
|
+
export declare function checkMcpServers(options?: McpCheckOptions): Promise<HealthCheck>;
|
|
20
50
|
export declare function checkMonograph(): Promise<HealthCheck>;
|
|
21
51
|
export declare function checkMonographFreshness(): Promise<HealthCheck>;
|
|
22
52
|
export declare function checkMonoesMemory(): Promise<HealthCheck>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor-project-checks.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor-project-checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"doctor-project-checks.d.ts","sourceRoot":"","sources":["../../../src/commands/doctor-project-checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8BH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAS1D,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5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