vite-plugin-ai-annotator 1.2.2 → 1.2.4
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/dist/annotator-toolbar.js +12 -15
- package/dist/auto-setup-mcp.d.ts +6 -1
- package/dist/index.cjs +7 -7
- package/dist/vite-plugin.js +23 -3
- package/dist/vite-plugin.js.map +2 -2
- package/package.json +1 -1
package/dist/vite-plugin.js
CHANGED
|
@@ -1178,6 +1178,11 @@ ${configJson}
|
|
|
1178
1178
|
}
|
|
1179
1179
|
function autoSetupMcp(options) {
|
|
1180
1180
|
const { projectRoot, serverUrl, verbose = false } = options;
|
|
1181
|
+
const result = {
|
|
1182
|
+
updated: [],
|
|
1183
|
+
alreadyConfigured: [],
|
|
1184
|
+
noConfigsFound: false
|
|
1185
|
+
};
|
|
1181
1186
|
const packageManager = detectPackageManager(projectRoot);
|
|
1182
1187
|
const serverConfig = buildMcpServerConfig(packageManager, serverUrl);
|
|
1183
1188
|
if (verbose) {
|
|
@@ -1185,17 +1190,24 @@ function autoSetupMcp(options) {
|
|
|
1185
1190
|
}
|
|
1186
1191
|
const existingConfigs = detectExistingConfigs(projectRoot);
|
|
1187
1192
|
if (existingConfigs.length === 0) {
|
|
1193
|
+
result.noConfigsFound = true;
|
|
1188
1194
|
if (verbose) {
|
|
1189
1195
|
printGenericInstructions(serverUrl, packageManager);
|
|
1190
1196
|
}
|
|
1191
|
-
return;
|
|
1197
|
+
return result;
|
|
1192
1198
|
}
|
|
1193
1199
|
if (verbose) {
|
|
1194
1200
|
console.log(`[ai-annotator] Found ${existingConfigs.length} MCP config file(s)`);
|
|
1195
1201
|
}
|
|
1196
1202
|
for (const configFile of existingConfigs) {
|
|
1197
|
-
setupConfigFile(configFile, serverConfig, verbose);
|
|
1203
|
+
const wasUpdated = setupConfigFile(configFile, serverConfig, verbose);
|
|
1204
|
+
if (wasUpdated) {
|
|
1205
|
+
result.updated.push(configFile);
|
|
1206
|
+
} else {
|
|
1207
|
+
result.alreadyConfigured.push(configFile);
|
|
1208
|
+
}
|
|
1198
1209
|
}
|
|
1210
|
+
return result;
|
|
1199
1211
|
}
|
|
1200
1212
|
|
|
1201
1213
|
// src/vite-plugin.ts
|
|
@@ -1329,6 +1341,9 @@ var AiAnnotatorServer = class {
|
|
|
1329
1341
|
if (this.options.verbose) {
|
|
1330
1342
|
args.push("--verbose");
|
|
1331
1343
|
}
|
|
1344
|
+
if (this.options.autoSetupMcp) {
|
|
1345
|
+
args.push("--skip-mcp-instructions");
|
|
1346
|
+
}
|
|
1332
1347
|
this.log(`Starting annotator server: ${cmd} ${args.join(" ")}`);
|
|
1333
1348
|
this.log(`Working directory: ${this.packageDir}`);
|
|
1334
1349
|
this.serverProcess = spawn(cmd, args, {
|
|
@@ -1422,11 +1437,16 @@ function aiAnnotator(options = {}) {
|
|
|
1422
1437
|
root = config.root;
|
|
1423
1438
|
if (options.autoSetupMcp) {
|
|
1424
1439
|
const serverUrl = `http://${options.listenAddress ?? "localhost"}:${options.port ?? 7318}`;
|
|
1425
|
-
autoSetupMcp({
|
|
1440
|
+
const result = autoSetupMcp({
|
|
1426
1441
|
projectRoot: root,
|
|
1427
1442
|
serverUrl,
|
|
1428
1443
|
verbose: options.verbose
|
|
1429
1444
|
});
|
|
1445
|
+
if (result.updated.length > 0) {
|
|
1446
|
+
console.log(`[ai-annotator] \u2705 MCP config updated: ${result.updated.map((f) => f.replace(root + "/", "")).join(", ")}`);
|
|
1447
|
+
} else if (result.alreadyConfigured.length > 0) {
|
|
1448
|
+
console.log(`[ai-annotator] \u2705 MCP config already up-to-date`);
|
|
1449
|
+
}
|
|
1430
1450
|
}
|
|
1431
1451
|
},
|
|
1432
1452
|
async buildStart() {
|