@cannbot-ai/install-helper 1.1.6-beta.7 → 1.1.6-beta.9

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/index.js CHANGED
@@ -844,7 +844,7 @@ var init_zh_CN = __esm({
844
844
  doctor_result_without_fix: "{warnings} \u4E2A\u8B66\u544A",
845
845
  count_suffix: "\u4E2A",
846
846
  try_prompt: "\u5E2E\u6211\u5F00\u53D1\u4E00\u4E2A Abs \u7B97\u5B50",
847
- uninstall_interactive_title: "\u7BA1\u7406\u5DF2\u5B89\u88C5\u7684\u5185\u5BB9 \u2014 \u53D6\u6D88\u52FE\u9009\u8981\u5378\u8F7D\u7684\u9879",
847
+ uninstall_interactive_title: "\u7BA1\u7406\u5DF2\u5B89\u88C5\u7684\u5185\u5BB9 \u2014 \u52FE\u9009\u8981\u5378\u8F7D\u7684\u9879",
848
848
  uninstall_select_type: "\u9009\u62E9\u8981\u5378\u8F7D\u7684\u7C7B\u578B",
849
849
  uninstall_type_skill: "\u5378\u8F7D Skills",
850
850
  uninstall_type_plugin: "\u5378\u8F7D Plugins",
@@ -1067,7 +1067,7 @@ var init_en_US = __esm({
1067
1067
  doctor_result_without_fix: "{warnings} warnings",
1068
1068
  count_suffix: "",
1069
1069
  try_prompt: "help me develop an Abs operator",
1070
- uninstall_interactive_title: "Manage installed items \u2014 uncheck to uninstall",
1070
+ uninstall_interactive_title: "Manage installed items \u2014 check to uninstall",
1071
1071
  uninstall_select_type: "Select type to uninstall",
1072
1072
  uninstall_type_skill: "Uninstall Skills",
1073
1073
  uninstall_type_plugin: "Uninstall Plugins",
@@ -1463,24 +1463,27 @@ function scanInstalled() {
1463
1463
  function verifyPluginFilesExist(configRoot, manifest, tool, level) {
1464
1464
  const skillsDir = join5(configRoot, "skills");
1465
1465
  const agentsDir = join5(configRoot, "agents");
1466
+ let hasAnyComponent = false;
1466
1467
  if (manifest.installed_skills && manifest.installed_skills.length > 0) {
1467
1468
  const hasAnySkill = manifest.installed_skills.some((skillId) => {
1468
1469
  const skillPath = join5(skillsDir, skillId);
1469
1470
  return existsSync5(skillPath);
1470
1471
  });
1471
- if (!hasAnySkill) return false;
1472
+ if (hasAnySkill) hasAnyComponent = true;
1472
1473
  }
1473
1474
  if (manifest.installed_agents && manifest.installed_agents.length > 0) {
1474
1475
  const hasAnyAgent = manifest.installed_agents.some((agentId) => {
1475
1476
  const agentPath = join5(agentsDir, agentId);
1476
1477
  return existsSync5(agentPath);
1477
1478
  });
1478
- if (!hasAnyAgent) return false;
1479
+ if (hasAnyAgent) hasAnyComponent = true;
1479
1480
  }
1480
1481
  const agentsFileName = getAgentsFileName(tool);
1481
1482
  const configFilePath = level === "project" ? join5(configRoot, "..", agentsFileName) : join5(configRoot, agentsFileName);
1482
- if (!existsSync5(configFilePath)) return false;
1483
- return true;
1483
+ if (existsSync5(configFilePath)) hasAnyComponent = true;
1484
+ const pluginManifestPath = join5(configRoot, `${manifest.team}-manifest.json`);
1485
+ if (existsSync5(pluginManifestPath)) hasAnyComponent = true;
1486
+ return hasAnyComponent;
1484
1487
  }
1485
1488
  var init_manifest = __esm({
1486
1489
  "src/core/manifest.ts"() {
@@ -2736,7 +2739,7 @@ function deleteRecord(pluginId) {
2736
2739
  unlinkSync3(recordPath);
2737
2740
  }
2738
2741
  }
2739
- function scanInstalledFiles(pluginId, displayName, tool, level, installPath, configRoot, manifest, externalRepoNames) {
2742
+ function scanInstalledFiles(pluginId, displayName, tool, level, installPath, configRoot, manifest, externalRepoNames, configRootConfigLink) {
2740
2743
  const files = [];
2741
2744
  const directories = [];
2742
2745
  if (manifest) {
@@ -2778,9 +2781,15 @@ function scanInstalledFiles(pluginId, displayName, tool, level, installPath, con
2778
2781
  }
2779
2782
  const configFileName = tool === "claude" ? "CLAUDE.md" : "AGENTS.md";
2780
2783
  const configFilePath = level === "project" ? join10(installPath, configFileName) : join10(configRoot, configFileName);
2781
- if (existsSync11(configFilePath)) {
2784
+ if (existsSync11(configFilePath) || isSymlink(configFilePath)) {
2782
2785
  files.push(configFilePath);
2783
2786
  }
2787
+ if (level === "project" && configRootConfigLink !== false) {
2788
+ const configRootConfigPath = join10(configRoot, configFileName);
2789
+ if (configRootConfigPath !== configFilePath && (existsSync11(configRootConfigPath) || isSymlink(configRootConfigPath))) {
2790
+ files.push(configRootConfigPath);
2791
+ }
2792
+ }
2784
2793
  const repoLinks = externalRepoNames && externalRepoNames.length > 0 ? externalRepoNames : ["asc-devkit", "pypto", "tilelang-ascend", "cann-recipes-infer", "cann-samples"];
2785
2794
  for (const repoName of repoLinks) {
2786
2795
  const repoLinkPath = join10(installPath, repoName);
@@ -3451,7 +3460,8 @@ async function installPlugin(opts) {
3451
3460
  cwd,
3452
3461
  configRoot,
3453
3462
  result.manifest,
3454
- plugin.externalRepos?.map((r) => basename2(r.dir))
3463
+ plugin.externalRepos?.map((r) => basename2(r.dir)),
3464
+ plugin.configRootConfigLink
3455
3465
  );
3456
3466
  if (backupInfo) {
3457
3467
  record.backup = {
@@ -3537,7 +3547,8 @@ async function installPlugin(opts) {
3537
3547
  cwd,
3538
3548
  configRoot,
3539
3549
  manifest,
3540
- plugin.externalRepos?.map((r) => basename2(r.dir))
3550
+ plugin.externalRepos?.map((r) => basename2(r.dir)),
3551
+ plugin.configRootConfigLink
3541
3552
  );
3542
3553
  if (backupInfo) {
3543
3554
  record.backup = {
@@ -4981,7 +4992,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
4981
4992
  // src/commands/uninstall.ts
4982
4993
  init_registry();
4983
4994
  import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync7 } from "fs";
4984
- import { resolve, basename as basename3, sep } from "path";
4995
+ import { resolve, basename as basename3, sep, join as join18 } from "path";
4985
4996
  import chalk11 from "chalk";
4986
4997
  import { select as select5, checkbox as checkbox2, Separator as Separator4, confirm as confirm3 } from "@inquirer/prompts";
4987
4998
  init_config();
@@ -5271,7 +5282,15 @@ async function uninstallPluginById(pluginId, batchMode) {
5271
5282
  };
5272
5283
  let removedFiles = 0;
5273
5284
  let removedDirs = 0;
5274
- for (const filePath of record.files) {
5285
+ const configFileName = record.tool === "claude" ? "CLAUDE.md" : "AGENTS.md";
5286
+ const configRootConfigPath = join18(configRoot, configFileName);
5287
+ const installPathConfigPath = join18(record.installPath, configFileName);
5288
+ const extraFiles = [];
5289
+ if (record.level === "project" && configRootConfigPath !== installPathConfigPath && !record.files.includes(configRootConfigPath) && (existsSync18(configRootConfigPath) || isSymlink(configRootConfigPath))) {
5290
+ extraFiles.push(configRootConfigPath);
5291
+ }
5292
+ const allFiles = [...record.files, ...extraFiles];
5293
+ for (const filePath of allFiles) {
5275
5294
  if (!isSafePath(filePath)) continue;
5276
5295
  try {
5277
5296
  if (existsSync18(filePath) || isSymlink(filePath)) {
@@ -5452,7 +5471,7 @@ async function updateCommand(pluginNames, options) {
5452
5471
  init_registry();
5453
5472
  import chalk13 from "chalk";
5454
5473
  import { existsSync as existsSync19, readdirSync as readdirSync8 } from "fs";
5455
- import { join as join18 } from "path";
5474
+ import { join as join19 } from "path";
5456
5475
  init_manifest();
5457
5476
  init_i18n();
5458
5477
  async function infoCommand(pluginName) {
@@ -5479,11 +5498,11 @@ async function infoCommand(pluginName) {
5479
5498
  try {
5480
5499
  const repoManager = createRepositoryManager();
5481
5500
  const repoPath = await repoManager.ensureRepo();
5482
- const quickstartPath = join18(repoPath, plugin.dir, "quickstart.md");
5501
+ const quickstartPath = join19(repoPath, plugin.dir, "quickstart.md");
5483
5502
  if (existsSync19(quickstartPath)) {
5484
5503
  console.log(` ${chalk13.dim(t("info_quickstart") + ":")} ${quickstartPath}`);
5485
5504
  }
5486
- const agentsDir = join18(repoPath, plugin.dir, "agents");
5505
+ const agentsDir = join19(repoPath, plugin.dir, "agents");
5487
5506
  if (existsSync19(agentsDir)) {
5488
5507
  const agentFiles = readdirSync8(agentsDir).filter((f) => f.endsWith(".md"));
5489
5508
  if (agentFiles.length > 0) {
@@ -5542,7 +5561,7 @@ init_config();
5542
5561
  init_i18n();
5543
5562
  import { readFileSync as readFileSync9, existsSync as existsSync20 } from "fs";
5544
5563
  import { fileURLToPath as fileURLToPath4 } from "url";
5545
- import { dirname as dirname6, join as join19 } from "path";
5564
+ import { dirname as dirname6, join as join20 } from "path";
5546
5565
  function readVersion() {
5547
5566
  try {
5548
5567
  if (typeof INSTALL_HELPER_VERSION !== "undefined" && INSTALL_HELPER_VERSION) {
@@ -5554,9 +5573,9 @@ function readVersion() {
5554
5573
  const __filename4 = fileURLToPath4(import.meta.url);
5555
5574
  const __dirname4 = dirname6(__filename4);
5556
5575
  const candidates = [
5557
- join19(__dirname4, "..", "package.json"),
5558
- join19(__dirname4, "package.json"),
5559
- join19(process.cwd(), "package.json")
5576
+ join20(__dirname4, "..", "package.json"),
5577
+ join20(__dirname4, "package.json"),
5578
+ join20(process.cwd(), "package.json")
5560
5579
  ];
5561
5580
  for (const pkgPath of candidates) {
5562
5581
  if (existsSync20(pkgPath)) {