knit-mcp 0.9.0 → 0.11.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.
- package/README.md +368 -215
- package/dist/cache-3LPETDUT.js +19 -0
- package/dist/{chunk-XFS2XGZI.js → chunk-27TA2ZQZ.js} +24 -0
- package/dist/{chunk-KLNUEE3O.js → chunk-7UFS67HP.js} +9 -1
- package/dist/{chunk-4K4FHOKE.js → chunk-HROSQ5MS.js} +256 -344
- package/dist/{chunk-5NCSZYRJ.js → chunk-LV73YTVN.js} +5 -0
- package/dist/{chunk-B2KZ5UR7.js → chunk-ORKWLA33.js} +1 -1
- package/dist/{chunk-BU3VHX3W.js → chunk-RZOVZYTF.js} +12 -4
- package/dist/{chunk-7PPC6IG6.js → chunk-ST4X7LZT.js} +60 -2
- package/dist/chunk-TWHNYJAJ.js +328 -0
- package/dist/{chunk-FLNV2IQC.js → chunk-VB2TIR6L.js} +2 -2
- package/dist/{chunk-BAUQEFYY.js → chunk-WKQHCLLO.js} +45 -10
- package/dist/cli.js +18 -9
- package/dist/doctor-4DN2P2JR.js +179 -0
- package/dist/{export-I5Y26WUL.js → export-CGSEUYZA.js} +3 -3
- package/dist/{install-agents-D2KJQUH3.js → install-agents-OBDCWCPB.js} +8 -7
- package/dist/{instructions-4FI32YZU.js → instructions-JARSXQPO.js} +1 -1
- package/dist/{integration-scanner-PS47AHGM.js → integration-scanner-LBD2PIZ3.js} +3 -3
- package/dist/{refresh-BXN32CNA.js → refresh-SMJ2NGIW.js} +3 -3
- package/dist/{status-RQWRIM2Y.js → status-VJDB75X2.js} +2 -2
- package/dist/{tools-EISDGPS5.js → tools-MIROTK2A.js} +1146 -91
- package/package.json +2 -1
- package/dist/cache-JSN6ETUF.js +0 -18
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VERSION
|
|
3
|
+
} from "./chunk-UTVFELXS.js";
|
|
4
|
+
import {
|
|
5
|
+
HOOKS_VERSION
|
|
6
|
+
} from "./chunk-HROSQ5MS.js";
|
|
7
|
+
import {
|
|
8
|
+
knowledgebasePath,
|
|
9
|
+
projectDataDir
|
|
10
|
+
} from "./chunk-27TA2ZQZ.js";
|
|
11
|
+
|
|
12
|
+
// src/commands/doctor.ts
|
|
13
|
+
import { existsSync, lstatSync, readFileSync, statSync } from "fs";
|
|
14
|
+
import { homedir } from "os";
|
|
15
|
+
import { join, resolve } from "path";
|
|
16
|
+
function runDoctor(rootPath) {
|
|
17
|
+
const checks = [];
|
|
18
|
+
const claudeJson = join(homedir(), ".claude.json");
|
|
19
|
+
if (existsSync(claudeJson)) {
|
|
20
|
+
try {
|
|
21
|
+
const config = JSON.parse(readFileSync(claudeJson, "utf-8"));
|
|
22
|
+
const hasKnit = Boolean(config.mcpServers?.["knit-brain"]);
|
|
23
|
+
checks.push({
|
|
24
|
+
name: "MCP registered",
|
|
25
|
+
status: hasKnit ? "ok" : "warn",
|
|
26
|
+
detail: hasKnit ? "knit-brain entry present in ~/.claude.json" : "no knit-brain entry \u2014 run `npx knit-mcp setup`"
|
|
27
|
+
});
|
|
28
|
+
} catch (err) {
|
|
29
|
+
checks.push({
|
|
30
|
+
name: "MCP registered",
|
|
31
|
+
status: "warn",
|
|
32
|
+
detail: `~/.claude.json exists but is unreadable: ${err.message}`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
checks.push({
|
|
37
|
+
name: "MCP registered",
|
|
38
|
+
status: "warn",
|
|
39
|
+
detail: "~/.claude.json missing \u2014 run `npx knit-mcp setup`"
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const dataDir = projectDataDir(rootPath);
|
|
43
|
+
if (existsSync(dataDir)) {
|
|
44
|
+
checks.push({ name: "Project data dir", status: "ok", detail: dataDir });
|
|
45
|
+
} else {
|
|
46
|
+
checks.push({
|
|
47
|
+
name: "Project data dir",
|
|
48
|
+
status: "info",
|
|
49
|
+
detail: `${dataDir} \u2014 will be created on first MCP call`
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const settingsPath = join(rootPath, ".claude", "settings.local.json");
|
|
53
|
+
if (existsSync(settingsPath)) {
|
|
54
|
+
try {
|
|
55
|
+
const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
|
|
56
|
+
const projectHV = settings._knitHooks?.version ?? 0;
|
|
57
|
+
if (projectHV === HOOKS_VERSION) {
|
|
58
|
+
checks.push({
|
|
59
|
+
name: "Hooks version",
|
|
60
|
+
status: "ok",
|
|
61
|
+
detail: `project at HOOKS_VERSION ${HOOKS_VERSION} (current)`
|
|
62
|
+
});
|
|
63
|
+
} else if (projectHV < HOOKS_VERSION) {
|
|
64
|
+
checks.push({
|
|
65
|
+
name: "Hooks version",
|
|
66
|
+
status: "warn",
|
|
67
|
+
detail: `project at ${projectHV}, current ${HOOKS_VERSION} \u2014 will auto-upgrade on next MCP call`
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
checks.push({
|
|
71
|
+
name: "Hooks version",
|
|
72
|
+
status: "warn",
|
|
73
|
+
detail: `project at ${projectHV}, code at ${HOOKS_VERSION} \u2014 possible stale install (npm i -g knit-mcp@latest)`
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
checks.push({
|
|
78
|
+
name: "Hooks version",
|
|
79
|
+
status: "warn",
|
|
80
|
+
detail: `settings.local.json unreadable: ${err.message}`
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
checks.push({
|
|
85
|
+
name: "Hooks version",
|
|
86
|
+
status: "info",
|
|
87
|
+
detail: "no settings.local.json yet \u2014 created on first MCP call"
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const kbPath = knowledgebasePath(rootPath);
|
|
91
|
+
if (existsSync(kbPath)) {
|
|
92
|
+
try {
|
|
93
|
+
const kb = JSON.parse(readFileSync(kbPath, "utf-8"));
|
|
94
|
+
const entries = Array.isArray(kb.entries) ? kb.entries.length : 0;
|
|
95
|
+
checks.push({
|
|
96
|
+
name: "Knowledge base",
|
|
97
|
+
status: "ok",
|
|
98
|
+
detail: `${entries} learning(s), schema v${kb.version ?? "?"}`
|
|
99
|
+
});
|
|
100
|
+
} catch (err) {
|
|
101
|
+
checks.push({
|
|
102
|
+
name: "Knowledge base",
|
|
103
|
+
status: "error",
|
|
104
|
+
detail: `unreadable: ${err.message} \u2014 knit will refuse to overwrite, manual repair needed`
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
checks.push({ name: "Knowledge base", status: "info", detail: "no learnings yet (fresh project)" });
|
|
109
|
+
}
|
|
110
|
+
for (const f of ["node_modules", ".knit", "dist"]) {
|
|
111
|
+
const p = join(rootPath, f);
|
|
112
|
+
try {
|
|
113
|
+
const lst = lstatSync(p);
|
|
114
|
+
if (lst.isSymbolicLink()) {
|
|
115
|
+
try {
|
|
116
|
+
statSync(p);
|
|
117
|
+
} catch {
|
|
118
|
+
checks.push({
|
|
119
|
+
name: `Symlink ${f}`,
|
|
120
|
+
status: "error",
|
|
121
|
+
detail: `${p} is a dangling symlink \u2014 delete it (rm ${p}) and reinstall`
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} catch {
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const nodeMajor = parseInt(process.versions.node.split(".")[0], 10);
|
|
129
|
+
if (Number.isFinite(nodeMajor) && nodeMajor < 18) {
|
|
130
|
+
checks.push({
|
|
131
|
+
name: "Node version",
|
|
132
|
+
status: "error",
|
|
133
|
+
detail: `Node ${process.version} \u2014 Knit requires Node 18+. Upgrade your runtime.`
|
|
134
|
+
});
|
|
135
|
+
} else {
|
|
136
|
+
checks.push({
|
|
137
|
+
name: "Node version",
|
|
138
|
+
status: "ok",
|
|
139
|
+
detail: process.version
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
version: VERSION,
|
|
144
|
+
nodeVersion: process.version,
|
|
145
|
+
hooksVersion: HOOKS_VERSION,
|
|
146
|
+
rootPath,
|
|
147
|
+
checks
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async function doctorCommand(directory) {
|
|
151
|
+
const chalk = (await import("chalk")).default;
|
|
152
|
+
const root = resolve(directory);
|
|
153
|
+
const report = runDoctor(root);
|
|
154
|
+
console.log(chalk.bold(`Knit doctor \u2014 install health for ${root}`));
|
|
155
|
+
console.log();
|
|
156
|
+
console.log(` ${chalk.dim("Version:").padEnd(24)} ${report.version}`);
|
|
157
|
+
console.log(` ${chalk.dim("Node:").padEnd(24)} ${report.nodeVersion}`);
|
|
158
|
+
console.log(` ${chalk.dim("HOOKS_VERSION (code):").padEnd(24)} ${report.hooksVersion}`);
|
|
159
|
+
console.log();
|
|
160
|
+
for (const c of report.checks) {
|
|
161
|
+
const icon = c.status === "ok" ? chalk.green("\u2713") : c.status === "warn" ? chalk.yellow("\u26A0") : c.status === "error" ? chalk.red("\u2717") : chalk.gray("\xB7");
|
|
162
|
+
console.log(` ${icon} ${c.name.padEnd(22)} ${chalk.dim(c.detail)}`);
|
|
163
|
+
}
|
|
164
|
+
const errors = report.checks.filter((c) => c.status === "error").length;
|
|
165
|
+
const warnings = report.checks.filter((c) => c.status === "warn").length;
|
|
166
|
+
console.log();
|
|
167
|
+
if (errors > 0) {
|
|
168
|
+
console.log(chalk.red(` ${errors} error(s) \u2014 install is broken. See above.`));
|
|
169
|
+
process.exit(1);
|
|
170
|
+
} else if (warnings > 0) {
|
|
171
|
+
console.log(chalk.yellow(` ${warnings} warning(s) \u2014 install is OK but check items above.`));
|
|
172
|
+
} else {
|
|
173
|
+
console.log(chalk.green(" All checks passed \u2014 install is healthy."));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
doctorCommand,
|
|
178
|
+
runDoctor
|
|
179
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRecentGlobalLearnings
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ORKWLA33.js";
|
|
4
4
|
import {
|
|
5
5
|
loadKnowledgeBase
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WKQHCLLO.js";
|
|
7
7
|
import {
|
|
8
8
|
globalLearningsPath,
|
|
9
9
|
knitRoot
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-27TA2ZQZ.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/export.ts
|
|
13
13
|
import { existsSync, mkdirSync, readdirSync, writeFileSync, statSync } from "fs";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getBrain
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TWHNYJAJ.js";
|
|
4
|
+
import "./chunk-HROSQ5MS.js";
|
|
4
5
|
import {
|
|
5
6
|
installAgentsForProject
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RZOVZYTF.js";
|
|
7
8
|
import "./chunk-MOOVNMIN.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-ST4X7LZT.js";
|
|
9
10
|
import "./chunk-M3YZOJNW.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-VB2TIR6L.js";
|
|
12
|
+
import "./chunk-7UFS67HP.js";
|
|
13
|
+
import "./chunk-WKQHCLLO.js";
|
|
14
|
+
import "./chunk-27TA2ZQZ.js";
|
|
14
15
|
|
|
15
16
|
// src/commands/install-agents.ts
|
|
16
17
|
import { existsSync } from "fs";
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
loadScanResult,
|
|
3
3
|
persistScanResult,
|
|
4
4
|
scanIntegrations
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-VB2TIR6L.js";
|
|
6
|
+
import "./chunk-7UFS67HP.js";
|
|
7
7
|
import {
|
|
8
8
|
projectDataDir
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-27TA2ZQZ.js";
|
|
10
10
|
export {
|
|
11
11
|
loadScanResult,
|
|
12
12
|
persistScanResult,
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
} from "./chunk-MOOVNMIN.js";
|
|
4
4
|
import {
|
|
5
5
|
scanProject
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ST4X7LZT.js";
|
|
7
7
|
import {
|
|
8
8
|
findFalsePositives
|
|
9
9
|
} from "./chunk-M3YZOJNW.js";
|
|
10
10
|
import {
|
|
11
11
|
generateClaudeMd
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7UFS67HP.js";
|
|
13
13
|
import {
|
|
14
14
|
knowledgePath,
|
|
15
15
|
learningsDir,
|
|
16
16
|
projectDataDir
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-27TA2ZQZ.js";
|
|
18
18
|
|
|
19
19
|
// src/commands/refresh.ts
|
|
20
20
|
import { readFileSync, readdirSync, writeFileSync, existsSync } from "fs";
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
getStaleEntries,
|
|
7
7
|
getTopEntries,
|
|
8
8
|
loadKnowledgeBase
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WKQHCLLO.js";
|
|
10
10
|
import {
|
|
11
11
|
knowledgePath,
|
|
12
12
|
knowledgebasePath,
|
|
13
13
|
learningsDir
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-27TA2ZQZ.js";
|
|
15
15
|
|
|
16
16
|
// src/commands/status.ts
|
|
17
17
|
import { existsSync, readFileSync, readdirSync } from "fs";
|