@cannbot-ai/install-helper 0.0.2-beta.36 → 0.0.2-beta.38
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/config/repository.yaml +2 -0
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -195,8 +195,19 @@ function isDirectory(path) {
|
|
|
195
195
|
// src/core/registry.ts
|
|
196
196
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
197
197
|
var __dirname2 = dirname2(__filename2);
|
|
198
|
+
function findPluginsDir() {
|
|
199
|
+
const candidates = [
|
|
200
|
+
join2(__dirname2, "plugins.d"),
|
|
201
|
+
join2(__dirname2, "..", "plugins.d"),
|
|
202
|
+
join2(__dirname2, "..", "..", "plugins.d")
|
|
203
|
+
];
|
|
204
|
+
for (const dir of candidates) {
|
|
205
|
+
if (existsSync(dir)) return dir;
|
|
206
|
+
}
|
|
207
|
+
return candidates[0];
|
|
208
|
+
}
|
|
198
209
|
function loadPluginsFromYaml() {
|
|
199
|
-
const pluginsDir =
|
|
210
|
+
const pluginsDir = findPluginsDir();
|
|
200
211
|
const defaultsPath = join2(pluginsDir, "_defaults.yml");
|
|
201
212
|
let defaults = {};
|
|
202
213
|
try {
|
|
@@ -388,6 +399,9 @@ function getConfigRoot(tool, level, base) {
|
|
|
388
399
|
function getConfigFileName(tool) {
|
|
389
400
|
return tool === "claude" ? "CLAUDE.md" : "AGENTS.md";
|
|
390
401
|
}
|
|
402
|
+
function getAgentsFileName(tool) {
|
|
403
|
+
return getConfigFileName(tool);
|
|
404
|
+
}
|
|
391
405
|
function getSkillsDir(configRoot) {
|
|
392
406
|
return join3(configRoot, "skills");
|
|
393
407
|
}
|
|
@@ -980,14 +994,17 @@ function loadScanConfig() {
|
|
|
980
994
|
const configPath = join7(__dirname3, "config", "repository.yaml");
|
|
981
995
|
try {
|
|
982
996
|
const config = parseYaml2(readFileSync5(configPath, "utf-8"));
|
|
997
|
+
const ttlHours = config.scanCacheTtlHours || 24;
|
|
983
998
|
return {
|
|
984
999
|
skillDirs: config.scanDirs || ["ops", "model", "graph", "infra", "ops-lab", "runtime"],
|
|
985
|
-
pluginDirs: config.pluginDirs || ["plugins-official", "plugins-community"]
|
|
1000
|
+
pluginDirs: config.pluginDirs || ["plugins-official", "plugins-community"],
|
|
1001
|
+
cacheTtlMs: ttlHours * 60 * 60 * 1e3
|
|
986
1002
|
};
|
|
987
1003
|
} catch {
|
|
988
1004
|
return {
|
|
989
1005
|
skillDirs: ["ops", "model", "graph", "infra", "ops-lab", "runtime"],
|
|
990
|
-
pluginDirs: ["plugins-official", "plugins-community"]
|
|
1006
|
+
pluginDirs: ["plugins-official", "plugins-community"],
|
|
1007
|
+
cacheTtlMs: 24 * 60 * 60 * 1e3
|
|
991
1008
|
};
|
|
992
1009
|
}
|
|
993
1010
|
}
|
|
@@ -1099,7 +1116,7 @@ function readScanCache() {
|
|
|
1099
1116
|
const cache = JSON.parse(content);
|
|
1100
1117
|
if (!cache.skills || !cache.timestamp) return null;
|
|
1101
1118
|
const age = Date.now() - cache.timestamp;
|
|
1102
|
-
if (age >
|
|
1119
|
+
if (age > scanConfig.cacheTtlMs) return null;
|
|
1103
1120
|
return cache;
|
|
1104
1121
|
} catch {
|
|
1105
1122
|
return null;
|
|
@@ -1863,7 +1880,7 @@ async function installPlugin(opts) {
|
|
|
1863
1880
|
}
|
|
1864
1881
|
const cwd = opts.installPath || process.cwd();
|
|
1865
1882
|
const configRoot = getConfigRoot(opts.tool, opts.level, opts.installPath);
|
|
1866
|
-
const agentsFile = join11(configRoot,
|
|
1883
|
+
const agentsFile = join11(configRoot, getAgentsFileName(opts.tool));
|
|
1867
1884
|
let backupInfo = null;
|
|
1868
1885
|
if (existsSync11(agentsFile)) {
|
|
1869
1886
|
const currentPlugin = detectCurrentPlugin(configRoot, opts.tool);
|
|
@@ -3188,9 +3205,7 @@ async function updateCommand(pluginNames, options) {
|
|
|
3188
3205
|
const repoManager = createRepositoryManager();
|
|
3189
3206
|
const updateSpinner = createSpinner(t("update_updating") + "...");
|
|
3190
3207
|
updateSpinner.start();
|
|
3191
|
-
await repoManager.
|
|
3192
|
-
const repoPath = repoManager.getRepoPath();
|
|
3193
|
-
await repoManager.ensureRepoAndScan();
|
|
3208
|
+
const repoPath = await repoManager.ensureRepoAndScan();
|
|
3194
3209
|
updateSpinner.succeed(t("install_repo_ready"));
|
|
3195
3210
|
const allPlugins = getAllPlugins();
|
|
3196
3211
|
const results = [];
|
|
@@ -3244,7 +3259,8 @@ async function infoCommand(pluginName) {
|
|
|
3244
3259
|
return;
|
|
3245
3260
|
}
|
|
3246
3261
|
const installed = scanInstalled();
|
|
3247
|
-
const
|
|
3262
|
+
const inst = installed.find((p) => p.id === plugin.id);
|
|
3263
|
+
const isInstalled = !!inst;
|
|
3248
3264
|
const statusText = isInstalled ? chalk13.green(`\u2713 ${t("status_installed")}`) : chalk13.dim(`\u2014 ${t("status_not_installed")}`);
|
|
3249
3265
|
console.log();
|
|
3250
3266
|
console.log(chalk13.bold(` ${plugin.displayName}`));
|
|
@@ -3253,8 +3269,8 @@ async function infoCommand(pluginName) {
|
|
|
3253
3269
|
console.log(` ${chalk13.dim(t("info_description") + ":")} ${plugin.description}`);
|
|
3254
3270
|
console.log(` ${chalk13.dim("ID:")} ${plugin.id}`);
|
|
3255
3271
|
console.log(` ${chalk13.dim(t("info_status") + ":")} ${statusText}`);
|
|
3256
|
-
console.log(` ${chalk13.dim(t("info_skills") + ":")} ${plugin.skills}`);
|
|
3257
|
-
console.log(` ${chalk13.dim(t("info_agents") + ":")} ${plugin.agents}`);
|
|
3272
|
+
console.log(` ${chalk13.dim(t("info_skills") + ":")} ${inst ? inst.skillsCount : plugin.skills}`);
|
|
3273
|
+
console.log(` ${chalk13.dim(t("info_agents") + ":")} ${inst ? inst.agentsCount : plugin.agents}`);
|
|
3258
3274
|
console.log(` ${chalk13.dim(t("info_aliases") + ":")} ${plugin.aliases.join(", ")}`);
|
|
3259
3275
|
console.log();
|
|
3260
3276
|
try {
|