bluera-knowledge 0.15.5 → 0.15.7
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-plugin/plugin.json +1 -1
- package/CHANGELOG.md +19 -0
- package/README.md +36 -2
- package/dist/{chunk-DX5I6U5X.js → chunk-3EQRQOXD.js} +111 -31
- package/dist/chunk-3EQRQOXD.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/mcp/bootstrap.js +26 -1
- package/dist/mcp/bootstrap.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-DX5I6U5X.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.15.7](https://github.com/blueraai/bluera-knowledge/compare/v0.15.6...v0.15.7) (2026-01-17)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **deps:** downgrade LanceDB to 0.22.3 for Intel Mac compatibility ([36f8c03](https://github.com/blueraai/bluera-knowledge/commit/36f8c033f3da4587f1abeb1c1fdf44f65dc67da3))
|
|
11
|
+
|
|
12
|
+
## [0.15.6](https://github.com/blueraai/bluera-knowledge/compare/v0.15.4...v0.15.6) (2026-01-17)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **mcp:** add comprehensive logging and /logs command ([bb22114](https://github.com/blueraai/bluera-knowledge/commit/bb221145d28166680d1f75afc2a864350f709cb3))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **mcp:** add cwd to resolve relative paths correctly ([ea8d403](https://github.com/blueraai/bluera-knowledge/commit/ea8d403eddf7713b75dcc44e261c41db11afbc9b))
|
|
23
|
+
|
|
5
24
|
## [0.15.5](https://github.com/blueraai/bluera-knowledge/compare/v0.15.4...v0.15.5) (2026-01-17)
|
|
6
25
|
|
|
7
26
|
|
package/README.md
CHANGED
|
@@ -468,8 +468,9 @@ If the plugin isn't listed, install it:
|
|
|
468
468
|
If the MCP server shows as failed after installation:
|
|
469
469
|
|
|
470
470
|
1. **Restart Claude Code** - MCP servers require a restart to initialize
|
|
471
|
-
2. **Check
|
|
472
|
-
3. **
|
|
471
|
+
2. **Check logs:** Run `/logs errors` to see recent errors or `/logs module bootstrap` for startup logs
|
|
472
|
+
3. **Check status:** Run `/mcp` to see connection status
|
|
473
|
+
4. **Reinstall:** Try `/plugin uninstall bluera-knowledge` then `/plugin install bluera-knowledge@bluera`
|
|
473
474
|
|
|
474
475
|
If the issue persists, check that Claude Code is v2.0.65 or later (earlier versions had MCP loading bugs).
|
|
475
476
|
</details>
|
|
@@ -517,6 +518,7 @@ Large repositories (10,000+ files) take longer to index. If indexing fails:
|
|
|
517
518
|
2. Ensure the source repository/folder is accessible
|
|
518
519
|
3. For repo stores, verify git is installed: `git --version`
|
|
519
520
|
4. Check for network connectivity (for repo stores)
|
|
521
|
+
5. Check logs for errors: `/logs errors` or `/logs search "index"`
|
|
520
522
|
</details>
|
|
521
523
|
|
|
522
524
|
<details>
|
|
@@ -531,6 +533,38 @@ To enable intelligent crawling with `--crawl` and `--extract`:
|
|
|
531
533
|
Simple mode still crawls effectively—it just doesn't use AI to select which pages to crawl or extract specific content.
|
|
532
534
|
</details>
|
|
533
535
|
|
|
536
|
+
<details>
|
|
537
|
+
<summary><b>📋 How to view logs for debugging</b></summary>
|
|
538
|
+
|
|
539
|
+
The plugin logs all MCP server operations to `~/.bluera/bluera-knowledge/logs/app.log`.
|
|
540
|
+
|
|
541
|
+
**View logs using the `/logs` command:**
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
/logs # Watch logs in real-time (tail -f)
|
|
545
|
+
/logs view 50 # View last 50 log entries
|
|
546
|
+
/logs errors # Show only error-level logs
|
|
547
|
+
/logs module mcp-store # Filter by module (mcp-server, mcp-store, mcp-execute, mcp-job, mcp-sync, bootstrap)
|
|
548
|
+
/logs search "pattern" # Search for a pattern
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
**Log modules:**
|
|
552
|
+
- `bootstrap` - MCP server startup and dependency installation
|
|
553
|
+
- `mcp-server` - Core MCP server operations
|
|
554
|
+
- `mcp-store` - Store create/list/delete operations
|
|
555
|
+
- `mcp-search` - Search queries and results
|
|
556
|
+
- `mcp-execute` - Meta-tool command execution
|
|
557
|
+
- `mcp-job` - Background job status
|
|
558
|
+
- `mcp-sync` - Store sync operations
|
|
559
|
+
|
|
560
|
+
**Manual access:**
|
|
561
|
+
```bash
|
|
562
|
+
tail -f ~/.bluera/bluera-knowledge/logs/app.log
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
Logs are JSON formatted (NDJSON) and can be processed with `jq` for pretty-printing.
|
|
566
|
+
</details>
|
|
567
|
+
|
|
534
568
|
---
|
|
535
569
|
|
|
536
570
|
## 🔧 Dependencies
|
|
@@ -697,14 +697,18 @@ var ExecuteArgsSchema = z.object({
|
|
|
697
697
|
});
|
|
698
698
|
|
|
699
699
|
// src/mcp/handlers/job.handler.ts
|
|
700
|
+
var logger = createLogger("mcp-job");
|
|
700
701
|
var handleCheckJobStatus = (args, context) => {
|
|
701
702
|
const validated = CheckJobStatusArgsSchema.parse(args);
|
|
703
|
+
logger.info({ jobId: validated.jobId }, "Check job status started");
|
|
702
704
|
const { options } = context;
|
|
703
705
|
const jobService = new JobService(options.dataDir);
|
|
704
706
|
const job = jobService.getJob(validated.jobId);
|
|
705
707
|
if (!job) {
|
|
708
|
+
logger.warn({ jobId: validated.jobId }, "Job not found");
|
|
706
709
|
throw new Error(`Job not found: ${validated.jobId}`);
|
|
707
710
|
}
|
|
711
|
+
logger.info({ jobId: validated.jobId, status: job.status }, "Check job status completed");
|
|
708
712
|
return Promise.resolve({
|
|
709
713
|
content: [
|
|
710
714
|
{
|
|
@@ -716,6 +720,7 @@ var handleCheckJobStatus = (args, context) => {
|
|
|
716
720
|
};
|
|
717
721
|
var handleListJobs = (args, context) => {
|
|
718
722
|
const validated = ListJobsArgsSchema.parse(args);
|
|
723
|
+
logger.info({ activeOnly: validated.activeOnly, status: validated.status }, "List jobs started");
|
|
719
724
|
const { options } = context;
|
|
720
725
|
const jobService = new JobService(options.dataDir);
|
|
721
726
|
jobService.cleanupStalePendingJobs(2, { markAsFailed: true });
|
|
@@ -727,6 +732,7 @@ var handleListJobs = (args, context) => {
|
|
|
727
732
|
} else {
|
|
728
733
|
jobs = jobService.listJobs();
|
|
729
734
|
}
|
|
735
|
+
logger.info({ count: jobs.length, activeOnly: validated.activeOnly }, "List jobs completed");
|
|
730
736
|
return Promise.resolve({
|
|
731
737
|
content: [
|
|
732
738
|
{
|
|
@@ -738,13 +744,16 @@ var handleListJobs = (args, context) => {
|
|
|
738
744
|
};
|
|
739
745
|
var handleCancelJob = (args, context) => {
|
|
740
746
|
const validated = CancelJobArgsSchema.parse(args);
|
|
747
|
+
logger.info({ jobId: validated.jobId }, "Cancel job started");
|
|
741
748
|
const { options } = context;
|
|
742
749
|
const jobService = new JobService(options.dataDir);
|
|
743
750
|
const result = jobService.cancelJob(validated.jobId);
|
|
744
751
|
if (!result.success) {
|
|
752
|
+
logger.error({ jobId: validated.jobId, error: result.error.message }, "Cancel job failed");
|
|
745
753
|
throw new Error(result.error.message);
|
|
746
754
|
}
|
|
747
755
|
const job = jobService.getJob(validated.jobId);
|
|
756
|
+
logger.info({ jobId: validated.jobId, cancelled: true }, "Cancel job completed");
|
|
748
757
|
return Promise.resolve({
|
|
749
758
|
content: [
|
|
750
759
|
{
|
|
@@ -797,6 +806,7 @@ import { z as z4 } from "zod";
|
|
|
797
806
|
|
|
798
807
|
// src/mcp/commands/registry.ts
|
|
799
808
|
import { z as z3 } from "zod";
|
|
809
|
+
var logger2 = createLogger("mcp-commands");
|
|
800
810
|
var CommandRegistry = class {
|
|
801
811
|
commands = /* @__PURE__ */ new Map();
|
|
802
812
|
/**
|
|
@@ -853,10 +863,12 @@ var commandRegistry = new CommandRegistry();
|
|
|
853
863
|
async function executeCommand(commandName, args, context) {
|
|
854
864
|
const command = commandRegistry.get(commandName);
|
|
855
865
|
if (command === void 0) {
|
|
866
|
+
logger2.warn({ commandName }, "Unknown command requested");
|
|
856
867
|
throw new Error(
|
|
857
868
|
`Unknown command: ${commandName}. Use execute("commands") to list available commands.`
|
|
858
869
|
);
|
|
859
870
|
}
|
|
871
|
+
logger2.debug({ commandName, hasArgs: Object.keys(args).length > 0 }, "Executing command");
|
|
860
872
|
const validatedArgs = command.argsSchema !== void 0 ? command.argsSchema.parse(args) : args;
|
|
861
873
|
return command.handler(validatedArgs, context);
|
|
862
874
|
}
|
|
@@ -949,7 +961,7 @@ import { join } from "path";
|
|
|
949
961
|
import { spawn } from "child_process";
|
|
950
962
|
import path from "path";
|
|
951
963
|
import { fileURLToPath } from "url";
|
|
952
|
-
var
|
|
964
|
+
var logger3 = createLogger("spawn-worker");
|
|
953
965
|
function spawnBackgroundWorker(jobId, dataDir) {
|
|
954
966
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
955
967
|
const currentDir = path.dirname(currentFilePath);
|
|
@@ -962,14 +974,14 @@ function spawnBackgroundWorker(jobId, dataDir) {
|
|
|
962
974
|
const workerScript = path.join(distDir, "workers", "background-worker-cli.js");
|
|
963
975
|
command = process.execPath;
|
|
964
976
|
args = [workerScript, jobId];
|
|
965
|
-
|
|
977
|
+
logger3.debug({ workerScript, distDir, currentFilePath }, "Production worker path");
|
|
966
978
|
} else {
|
|
967
979
|
const workerScript = path.join(currentDir, "background-worker-cli.ts");
|
|
968
980
|
command = "npx";
|
|
969
981
|
args = ["tsx", workerScript, jobId];
|
|
970
|
-
|
|
982
|
+
logger3.debug({ workerScript, currentDir }, "Development worker path");
|
|
971
983
|
}
|
|
972
|
-
|
|
984
|
+
logger3.info({ jobId, command, args, dataDir, isProduction }, "Spawning background worker");
|
|
973
985
|
const worker = spawn(command, args, {
|
|
974
986
|
detached: true,
|
|
975
987
|
// Detach from parent process
|
|
@@ -983,18 +995,21 @@ function spawnBackgroundWorker(jobId, dataDir) {
|
|
|
983
995
|
}
|
|
984
996
|
});
|
|
985
997
|
worker.on("error", (err) => {
|
|
986
|
-
|
|
998
|
+
logger3.error({ jobId, error: err.message }, "Failed to spawn background worker");
|
|
987
999
|
});
|
|
988
|
-
|
|
1000
|
+
logger3.info({ jobId, pid: worker.pid }, "Background worker spawned");
|
|
989
1001
|
worker.unref();
|
|
990
1002
|
}
|
|
991
1003
|
|
|
992
1004
|
// src/mcp/handlers/store.handler.ts
|
|
1005
|
+
var logger4 = createLogger("mcp-store");
|
|
993
1006
|
var handleListStores = async (args, context) => {
|
|
994
1007
|
const validated = ListStoresArgsSchema.parse(args);
|
|
1008
|
+
logger4.info({ type: validated.type }, "List stores started");
|
|
995
1009
|
const { services } = context;
|
|
996
1010
|
const stores = await services.store.list();
|
|
997
1011
|
const filtered = validated.type !== void 0 ? stores.filter((s) => s.type === validated.type) : stores;
|
|
1012
|
+
logger4.info({ count: filtered.length, type: validated.type }, "List stores completed");
|
|
998
1013
|
return {
|
|
999
1014
|
content: [
|
|
1000
1015
|
{
|
|
@@ -1020,11 +1035,14 @@ var handleListStores = async (args, context) => {
|
|
|
1020
1035
|
};
|
|
1021
1036
|
var handleGetStoreInfo = async (args, context) => {
|
|
1022
1037
|
const validated = GetStoreInfoArgsSchema.parse(args);
|
|
1038
|
+
logger4.info({ store: validated.store }, "Get store info started");
|
|
1023
1039
|
const { services } = context;
|
|
1024
1040
|
const store = await services.store.getByIdOrName(createStoreId(validated.store));
|
|
1025
1041
|
if (store === void 0) {
|
|
1042
|
+
logger4.warn({ store: validated.store }, "Store not found");
|
|
1026
1043
|
throw new Error(`Store not found: ${validated.store}`);
|
|
1027
1044
|
}
|
|
1045
|
+
logger4.info({ storeId: store.id, storeName: store.name }, "Get store info completed");
|
|
1028
1046
|
return {
|
|
1029
1047
|
content: [
|
|
1030
1048
|
{
|
|
@@ -1051,6 +1069,10 @@ var handleGetStoreInfo = async (args, context) => {
|
|
|
1051
1069
|
};
|
|
1052
1070
|
var handleCreateStore = async (args, context) => {
|
|
1053
1071
|
const validated = CreateStoreArgsSchema.parse(args);
|
|
1072
|
+
logger4.info(
|
|
1073
|
+
{ name: validated.name, type: validated.type, source: validated.source },
|
|
1074
|
+
"Create store started"
|
|
1075
|
+
);
|
|
1054
1076
|
const { services, options } = context;
|
|
1055
1077
|
const isUrl = validated.source.startsWith("http://") || validated.source.startsWith("https://") || validated.source.startsWith("git@");
|
|
1056
1078
|
const result = await services.store.create({
|
|
@@ -1061,6 +1083,7 @@ var handleCreateStore = async (args, context) => {
|
|
|
1061
1083
|
...validated.description !== void 0 ? { description: validated.description } : {}
|
|
1062
1084
|
});
|
|
1063
1085
|
if (!result.success) {
|
|
1086
|
+
logger4.error({ name: validated.name, error: result.error.message }, "Create store failed");
|
|
1064
1087
|
throw new Error(result.error.message);
|
|
1065
1088
|
}
|
|
1066
1089
|
const jobService = new JobService(options.dataDir);
|
|
@@ -1080,6 +1103,10 @@ var handleCreateStore = async (args, context) => {
|
|
|
1080
1103
|
message: `Indexing ${result.data.name}...`
|
|
1081
1104
|
});
|
|
1082
1105
|
spawnBackgroundWorker(job.id, options.dataDir);
|
|
1106
|
+
logger4.info(
|
|
1107
|
+
{ storeId: result.data.id, storeName: result.data.name, jobId: job.id },
|
|
1108
|
+
"Create store completed"
|
|
1109
|
+
);
|
|
1083
1110
|
return {
|
|
1084
1111
|
content: [
|
|
1085
1112
|
{
|
|
@@ -1108,9 +1135,11 @@ var handleCreateStore = async (args, context) => {
|
|
|
1108
1135
|
};
|
|
1109
1136
|
var handleIndexStore = async (args, context) => {
|
|
1110
1137
|
const validated = IndexStoreArgsSchema.parse(args);
|
|
1138
|
+
logger4.info({ store: validated.store }, "Index store started");
|
|
1111
1139
|
const { services, options } = context;
|
|
1112
1140
|
const store = await services.store.getByIdOrName(createStoreId(validated.store));
|
|
1113
1141
|
if (store === void 0) {
|
|
1142
|
+
logger4.warn({ store: validated.store }, "Store not found for indexing");
|
|
1114
1143
|
throw new Error(`Store not found: ${validated.store}`);
|
|
1115
1144
|
}
|
|
1116
1145
|
const jobService = new JobService(options.dataDir);
|
|
@@ -1127,6 +1156,7 @@ var handleIndexStore = async (args, context) => {
|
|
|
1127
1156
|
message: `Re-indexing ${store.name}...`
|
|
1128
1157
|
});
|
|
1129
1158
|
spawnBackgroundWorker(job.id, options.dataDir);
|
|
1159
|
+
logger4.info({ storeId: store.id, storeName: store.name, jobId: job.id }, "Index store completed");
|
|
1130
1160
|
return {
|
|
1131
1161
|
content: [
|
|
1132
1162
|
{
|
|
@@ -1153,24 +1183,35 @@ var handleIndexStore = async (args, context) => {
|
|
|
1153
1183
|
};
|
|
1154
1184
|
var handleDeleteStore = async (args, context) => {
|
|
1155
1185
|
const validated = DeleteStoreArgsSchema.parse(args);
|
|
1186
|
+
logger4.info({ store: validated.store }, "Delete store started");
|
|
1156
1187
|
const { services, options } = context;
|
|
1157
1188
|
const store = await services.store.getByIdOrName(createStoreId(validated.store));
|
|
1158
1189
|
if (store === void 0) {
|
|
1190
|
+
logger4.warn({ store: validated.store }, "Store not found for deletion");
|
|
1159
1191
|
throw new Error(`Store not found: ${validated.store}`);
|
|
1160
1192
|
}
|
|
1193
|
+
logger4.debug({ storeId: store.id, storeName: store.name }, "Deleting LanceDB table");
|
|
1161
1194
|
await services.lance.deleteStore(store.id);
|
|
1195
|
+
logger4.debug({ storeId: store.id }, "Deleting code graph");
|
|
1162
1196
|
await services.codeGraph.deleteGraph(store.id);
|
|
1163
1197
|
if (store.type === "repo" && "url" in store && store.url !== void 0) {
|
|
1164
1198
|
if (options.dataDir === void 0) {
|
|
1165
1199
|
throw new Error("dataDir is required to delete cloned repository files");
|
|
1166
1200
|
}
|
|
1167
1201
|
const repoPath = join(options.dataDir, "repos", store.id);
|
|
1202
|
+
logger4.debug({ storeId: store.id, repoPath }, "Removing cloned repository");
|
|
1168
1203
|
await rm(repoPath, { recursive: true, force: true });
|
|
1169
1204
|
}
|
|
1205
|
+
logger4.debug({ storeId: store.id }, "Removing from registry");
|
|
1170
1206
|
const result = await services.store.delete(store.id);
|
|
1171
1207
|
if (!result.success) {
|
|
1208
|
+
logger4.error({ storeId: store.id, error: result.error.message }, "Delete store failed");
|
|
1172
1209
|
throw new Error(result.error.message);
|
|
1173
1210
|
}
|
|
1211
|
+
logger4.info(
|
|
1212
|
+
{ storeId: store.id, storeName: store.name, storeType: store.type },
|
|
1213
|
+
"Delete store completed"
|
|
1214
|
+
);
|
|
1174
1215
|
return {
|
|
1175
1216
|
content: [
|
|
1176
1217
|
{
|
|
@@ -1243,7 +1284,12 @@ var storeCommands = [
|
|
|
1243
1284
|
|
|
1244
1285
|
// src/mcp/commands/sync.commands.ts
|
|
1245
1286
|
import { z as z6 } from "zod";
|
|
1287
|
+
var logger5 = createLogger("mcp-sync");
|
|
1246
1288
|
async function handleStoresSync(args, context) {
|
|
1289
|
+
logger5.info(
|
|
1290
|
+
{ prune: args.prune, dryRun: args.dryRun, reindex: args.reindex },
|
|
1291
|
+
"Stores sync started"
|
|
1292
|
+
);
|
|
1247
1293
|
const { services, options } = context;
|
|
1248
1294
|
const projectRoot = options.projectRoot;
|
|
1249
1295
|
if (projectRoot === void 0) {
|
|
@@ -1326,6 +1372,18 @@ async function handleStoresSync(args, context) {
|
|
|
1326
1372
|
}
|
|
1327
1373
|
}
|
|
1328
1374
|
}
|
|
1375
|
+
logger5.info(
|
|
1376
|
+
{
|
|
1377
|
+
created: result.created.length,
|
|
1378
|
+
skipped: result.skipped.length,
|
|
1379
|
+
failed: result.failed.length,
|
|
1380
|
+
orphans: result.orphans.length,
|
|
1381
|
+
pruned: result.pruned?.length ?? 0,
|
|
1382
|
+
reindexJobs: result.reindexJobs?.length ?? 0,
|
|
1383
|
+
dryRun: args.dryRun
|
|
1384
|
+
},
|
|
1385
|
+
"Stores sync completed"
|
|
1386
|
+
);
|
|
1329
1387
|
return {
|
|
1330
1388
|
content: [
|
|
1331
1389
|
{
|
|
@@ -1431,7 +1489,7 @@ import { existsSync } from "fs";
|
|
|
1431
1489
|
import { readdir, rm as rm2 } from "fs/promises";
|
|
1432
1490
|
import { homedir } from "os";
|
|
1433
1491
|
import { join as join2 } from "path";
|
|
1434
|
-
var
|
|
1492
|
+
var logger6 = createLogger("uninstall-handler");
|
|
1435
1493
|
var handleUninstall = async (args, context) => {
|
|
1436
1494
|
const { global: includeGlobal = false, keepDefinitions = true } = args;
|
|
1437
1495
|
const deleted = [];
|
|
@@ -1439,7 +1497,7 @@ var handleUninstall = async (args, context) => {
|
|
|
1439
1497
|
const errors = [];
|
|
1440
1498
|
const projectRoot = context.options.projectRoot ?? process.cwd();
|
|
1441
1499
|
const projectDataDir = join2(projectRoot, ".bluera", "bluera-knowledge");
|
|
1442
|
-
|
|
1500
|
+
logger6.info({ projectDataDir, includeGlobal, keepDefinitions }, "Starting uninstall");
|
|
1443
1501
|
if (existsSync(projectDataDir)) {
|
|
1444
1502
|
if (keepDefinitions) {
|
|
1445
1503
|
try {
|
|
@@ -1456,13 +1514,13 @@ var handleUninstall = async (args, context) => {
|
|
|
1456
1514
|
} catch (err) {
|
|
1457
1515
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1458
1516
|
errors.push(`Failed to delete ${entryPath}: ${msg}`);
|
|
1459
|
-
|
|
1517
|
+
logger6.error({ error: msg, path: entryPath }, "Failed to delete");
|
|
1460
1518
|
}
|
|
1461
1519
|
}
|
|
1462
1520
|
} catch (err) {
|
|
1463
1521
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1464
1522
|
errors.push(`Failed to read ${projectDataDir}: ${msg}`);
|
|
1465
|
-
|
|
1523
|
+
logger6.error({ error: msg, path: projectDataDir }, "Failed to read directory");
|
|
1466
1524
|
}
|
|
1467
1525
|
} else {
|
|
1468
1526
|
try {
|
|
@@ -1471,7 +1529,7 @@ var handleUninstall = async (args, context) => {
|
|
|
1471
1529
|
} catch (err) {
|
|
1472
1530
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1473
1531
|
errors.push(`Failed to delete ${projectDataDir}: ${msg}`);
|
|
1474
|
-
|
|
1532
|
+
logger6.error({ error: msg, path: projectDataDir }, "Failed to delete");
|
|
1475
1533
|
}
|
|
1476
1534
|
}
|
|
1477
1535
|
}
|
|
@@ -1484,11 +1542,11 @@ var handleUninstall = async (args, context) => {
|
|
|
1484
1542
|
} catch (err) {
|
|
1485
1543
|
const msg = err instanceof Error ? err.message : String(err);
|
|
1486
1544
|
errors.push(`Failed to delete ${globalDir}: ${msg}`);
|
|
1487
|
-
|
|
1545
|
+
logger6.error({ error: msg, path: globalDir }, "Failed to delete global data");
|
|
1488
1546
|
}
|
|
1489
1547
|
}
|
|
1490
1548
|
}
|
|
1491
|
-
|
|
1549
|
+
logger6.info({ deleted, kept, errors }, "Uninstall complete");
|
|
1492
1550
|
const lines = [];
|
|
1493
1551
|
if (deleted.length > 0) {
|
|
1494
1552
|
lines.push("## Deleted:");
|
|
@@ -1549,10 +1607,32 @@ commandRegistry.registerAll(syncCommands);
|
|
|
1549
1607
|
commandRegistry.registerAll(uninstallCommands);
|
|
1550
1608
|
|
|
1551
1609
|
// src/mcp/handlers/execute.handler.ts
|
|
1610
|
+
var logger7 = createLogger("mcp-execute");
|
|
1552
1611
|
var handleExecute = async (args, context) => {
|
|
1553
1612
|
const validated = ExecuteArgsSchema.parse(args);
|
|
1554
1613
|
const commandArgs = validated.args ?? {};
|
|
1555
|
-
|
|
1614
|
+
logger7.info(
|
|
1615
|
+
{ command: validated.command, args: JSON.stringify(commandArgs) },
|
|
1616
|
+
"Execute command started"
|
|
1617
|
+
);
|
|
1618
|
+
const startTime = Date.now();
|
|
1619
|
+
try {
|
|
1620
|
+
const result = await executeCommand(validated.command, commandArgs, context);
|
|
1621
|
+
const durationMs = Date.now() - startTime;
|
|
1622
|
+
logger7.info({ command: validated.command, durationMs }, "Execute command completed");
|
|
1623
|
+
return result;
|
|
1624
|
+
} catch (error) {
|
|
1625
|
+
const durationMs = Date.now() - startTime;
|
|
1626
|
+
logger7.error(
|
|
1627
|
+
{
|
|
1628
|
+
command: validated.command,
|
|
1629
|
+
durationMs,
|
|
1630
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1631
|
+
},
|
|
1632
|
+
"Execute command failed"
|
|
1633
|
+
);
|
|
1634
|
+
throw error;
|
|
1635
|
+
}
|
|
1556
1636
|
};
|
|
1557
1637
|
|
|
1558
1638
|
// src/services/token.service.ts
|
|
@@ -1650,11 +1730,11 @@ var LRUCache = class {
|
|
|
1650
1730
|
};
|
|
1651
1731
|
|
|
1652
1732
|
// src/mcp/handlers/search.handler.ts
|
|
1653
|
-
var
|
|
1733
|
+
var logger8 = createLogger("mcp-search");
|
|
1654
1734
|
var resultCache = new LRUCache(1e3);
|
|
1655
1735
|
var handleSearch = async (args, context) => {
|
|
1656
1736
|
const validated = SearchArgsSchema.parse(args);
|
|
1657
|
-
|
|
1737
|
+
logger8.info(
|
|
1658
1738
|
{
|
|
1659
1739
|
query: validated.query,
|
|
1660
1740
|
stores: validated.stores,
|
|
@@ -1731,7 +1811,7 @@ var handleSearch = async (args, context) => {
|
|
|
1731
1811
|
const header = `Search: "${validated.query}" | Results: ${String(results.totalResults)} | ${formatTokenCount(responseTokens)} tokens | ${String(results.timeMs)}ms${confidenceInfo}
|
|
1732
1812
|
|
|
1733
1813
|
`;
|
|
1734
|
-
|
|
1814
|
+
logger8.info(
|
|
1735
1815
|
{
|
|
1736
1816
|
query: validated.query,
|
|
1737
1817
|
totalResults: results.totalResults,
|
|
@@ -1752,7 +1832,7 @@ var handleSearch = async (args, context) => {
|
|
|
1752
1832
|
};
|
|
1753
1833
|
var handleGetFullContext = async (args, context) => {
|
|
1754
1834
|
const validated = GetFullContextArgsSchema.parse(args);
|
|
1755
|
-
|
|
1835
|
+
logger8.info({ resultId: validated.resultId }, "Get full context requested");
|
|
1756
1836
|
const resultId = validated.resultId;
|
|
1757
1837
|
const cachedResult = resultCache.get(resultId);
|
|
1758
1838
|
if (!cachedResult) {
|
|
@@ -1770,7 +1850,7 @@ var handleGetFullContext = async (args, context) => {
|
|
|
1770
1850
|
null,
|
|
1771
1851
|
2
|
|
1772
1852
|
);
|
|
1773
|
-
|
|
1853
|
+
logger8.info(
|
|
1774
1854
|
{
|
|
1775
1855
|
resultId,
|
|
1776
1856
|
cached: true,
|
|
@@ -1836,7 +1916,7 @@ var handleGetFullContext = async (args, context) => {
|
|
|
1836
1916
|
null,
|
|
1837
1917
|
2
|
|
1838
1918
|
);
|
|
1839
|
-
|
|
1919
|
+
logger8.info(
|
|
1840
1920
|
{
|
|
1841
1921
|
resultId,
|
|
1842
1922
|
cached: false,
|
|
@@ -1872,7 +1952,7 @@ var tools = [
|
|
|
1872
1952
|
];
|
|
1873
1953
|
|
|
1874
1954
|
// src/mcp/server.ts
|
|
1875
|
-
var
|
|
1955
|
+
var logger9 = createLogger("mcp-server");
|
|
1876
1956
|
var registry = AdapterRegistry.getInstance();
|
|
1877
1957
|
if (!registry.hasExtension(".zil")) {
|
|
1878
1958
|
registry.register(new ZilAdapter());
|
|
@@ -1988,7 +2068,7 @@ function createMCPServer(options, services) {
|
|
|
1988
2068
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1989
2069
|
const { name, arguments: args } = request.params;
|
|
1990
2070
|
const startTime = Date.now();
|
|
1991
|
-
|
|
2071
|
+
logger9.info({ tool: name, args: JSON.stringify(args) }, "Tool invoked");
|
|
1992
2072
|
const context = { services, options };
|
|
1993
2073
|
try {
|
|
1994
2074
|
let result;
|
|
@@ -2004,11 +2084,11 @@ function createMCPServer(options, services) {
|
|
|
2004
2084
|
result = await tool.handler(validated, context);
|
|
2005
2085
|
}
|
|
2006
2086
|
const durationMs = Date.now() - startTime;
|
|
2007
|
-
|
|
2087
|
+
logger9.info({ tool: name, durationMs }, "Tool completed");
|
|
2008
2088
|
return result;
|
|
2009
2089
|
} catch (error) {
|
|
2010
2090
|
const durationMs = Date.now() - startTime;
|
|
2011
|
-
|
|
2091
|
+
logger9.error(
|
|
2012
2092
|
{
|
|
2013
2093
|
tool: name,
|
|
2014
2094
|
durationMs,
|
|
@@ -2022,7 +2102,7 @@ function createMCPServer(options, services) {
|
|
|
2022
2102
|
return server;
|
|
2023
2103
|
}
|
|
2024
2104
|
async function runMCPServer(options) {
|
|
2025
|
-
|
|
2105
|
+
logger9.info(
|
|
2026
2106
|
{
|
|
2027
2107
|
dataDir: options.dataDir,
|
|
2028
2108
|
projectRoot: options.projectRoot
|
|
@@ -2033,12 +2113,12 @@ async function runMCPServer(options) {
|
|
|
2033
2113
|
const server = createMCPServer(options, services);
|
|
2034
2114
|
const transport = new StdioServerTransport();
|
|
2035
2115
|
const shutdown = async (signal) => {
|
|
2036
|
-
|
|
2116
|
+
logger9.info({ signal }, "Shutdown signal received");
|
|
2037
2117
|
try {
|
|
2038
2118
|
await destroyServices(services);
|
|
2039
|
-
|
|
2119
|
+
logger9.info("Services destroyed, exiting");
|
|
2040
2120
|
} catch (error) {
|
|
2041
|
-
|
|
2121
|
+
logger9.error(
|
|
2042
2122
|
{ error: error instanceof Error ? error.message : String(error) },
|
|
2043
2123
|
"Error during shutdown"
|
|
2044
2124
|
);
|
|
@@ -2047,7 +2127,7 @@ async function runMCPServer(options) {
|
|
|
2047
2127
|
process.on("SIGINT", () => void shutdown("SIGINT"));
|
|
2048
2128
|
process.on("SIGTERM", () => void shutdown("SIGTERM"));
|
|
2049
2129
|
await server.connect(transport);
|
|
2050
|
-
|
|
2130
|
+
logger9.info("MCP server connected to stdio transport");
|
|
2051
2131
|
}
|
|
2052
2132
|
var scriptPath = process.argv[1] ?? "";
|
|
2053
2133
|
var isMCPServerEntry = scriptPath.endsWith("mcp/server.js") || scriptPath.endsWith("mcp/server");
|
|
@@ -2061,7 +2141,7 @@ if (isMCPServerEntry) {
|
|
|
2061
2141
|
config: process.env["CONFIG_PATH"],
|
|
2062
2142
|
projectRoot
|
|
2063
2143
|
}).catch((error) => {
|
|
2064
|
-
|
|
2144
|
+
logger9.error(
|
|
2065
2145
|
{ error: error instanceof Error ? error.message : String(error) },
|
|
2066
2146
|
"Failed to start MCP server"
|
|
2067
2147
|
);
|
|
@@ -2075,4 +2155,4 @@ export {
|
|
|
2075
2155
|
createMCPServer,
|
|
2076
2156
|
runMCPServer
|
|
2077
2157
|
};
|
|
2078
|
-
//# sourceMappingURL=chunk-
|
|
2158
|
+
//# sourceMappingURL=chunk-3EQRQOXD.js.map
|