vite-plugin-ai-annotator 1.14.16 → 1.16.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/README.md +26 -53
- package/dist/annotator-toolbar.js +22 -10
- package/dist/index.cjs +22 -22
- package/dist/nuxt-module.js +28 -2
- package/dist/nuxt-module.js.map +3 -3
- package/dist/vite-plugin.d.ts +8 -0
- package/dist/vite-plugin.js +28 -2
- package/dist/vite-plugin.js.map +3 -3
- package/package.json +1 -1
package/dist/nuxt-module.js
CHANGED
|
@@ -5,7 +5,8 @@ import { defineNuxtModule, addVitePlugin } from "@nuxt/kit";
|
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { dirname as dirname2, join as join2, relative } from "node:path";
|
|
8
|
-
import { existsSync as existsSync2 } from "node:fs";
|
|
8
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
9
10
|
|
|
10
11
|
// node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
11
12
|
var comma = ",".charCodeAt(0);
|
|
@@ -1221,6 +1222,27 @@ ${body}
|
|
|
1221
1222
|
}
|
|
1222
1223
|
|
|
1223
1224
|
// src/vite-plugin.ts
|
|
1225
|
+
var CHANNEL_PLUGIN_KEY = "claude-annotator-plugin@claude-annotator-plugin";
|
|
1226
|
+
var CHANNEL_PLUGIN_REPO = "nguyenvanduocit/claude-annotator-plugin";
|
|
1227
|
+
function isChannelPluginEnabled() {
|
|
1228
|
+
try {
|
|
1229
|
+
const settingsPath = join2(homedir(), ".claude", "settings.json");
|
|
1230
|
+
if (!existsSync2(settingsPath)) return false;
|
|
1231
|
+
const settings = JSON.parse(readFileSync2(settingsPath, "utf-8"));
|
|
1232
|
+
return Boolean(settings?.enabledPlugins?.[CHANNEL_PLUGIN_KEY]);
|
|
1233
|
+
} catch {
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function printChannelPluginSuggestion() {
|
|
1238
|
+
console.log(
|
|
1239
|
+
`[ai-annotator] \u{1F4A1} Channel push plugin not detected. For instant push to Claude Code (instead of copy-paste), run once:
|
|
1240
|
+
/plugin marketplace add ${CHANNEL_PLUGIN_REPO}
|
|
1241
|
+
/plugin install ${CHANNEL_PLUGIN_KEY}
|
|
1242
|
+
claude --dangerously-load-development-channels plugin:${CHANNEL_PLUGIN_KEY}
|
|
1243
|
+
(Claude Code v2.1.80+; set autoSetupChannelPlugin: false in your vite.config to hide this.)`
|
|
1244
|
+
);
|
|
1245
|
+
}
|
|
1224
1246
|
var SOURCE_LOC_ATTR = "data-source-loc";
|
|
1225
1247
|
function injectSourceLocations(code, id, root) {
|
|
1226
1248
|
if (!code.includes("<")) return null;
|
|
@@ -1304,7 +1326,8 @@ var AiAnnotatorServer = class {
|
|
|
1304
1326
|
publicAddress: options.publicAddress ?? `http://${listenAddress}:${port}`,
|
|
1305
1327
|
verbose: options.verbose ?? false,
|
|
1306
1328
|
injectSourceLoc: options.injectSourceLoc ?? true,
|
|
1307
|
-
autoSetupSkills: options.autoSetupSkills ?? true
|
|
1329
|
+
autoSetupSkills: options.autoSetupSkills ?? true,
|
|
1330
|
+
autoSetupChannelPlugin: options.autoSetupChannelPlugin ?? true
|
|
1308
1331
|
};
|
|
1309
1332
|
const currentFileDir = dirname2(fileURLToPath(import.meta.url));
|
|
1310
1333
|
this.isRunningFromSource = currentFileDir.endsWith("/src") || currentFileDir.endsWith("\\src");
|
|
@@ -1454,6 +1477,9 @@ function aiAnnotator(options = {}) {
|
|
|
1454
1477
|
console.log(`[ai-annotator] \u2705 AI skills updated: ${skillsResult.updated.map((f) => f.replace(root + "/", "")).join(", ")}`);
|
|
1455
1478
|
}
|
|
1456
1479
|
}
|
|
1480
|
+
if (options.autoSetupChannelPlugin !== false && !isChannelPluginEnabled()) {
|
|
1481
|
+
printChannelPluginSuggestion();
|
|
1482
|
+
}
|
|
1457
1483
|
},
|
|
1458
1484
|
async buildStart() {
|
|
1459
1485
|
await serverManager.start();
|