@cannbot-ai/install-helper 1.1.6-beta.8 → 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
@@ -2739,7 +2739,7 @@ function deleteRecord(pluginId) {
2739
2739
  unlinkSync3(recordPath);
2740
2740
  }
2741
2741
  }
2742
- function scanInstalledFiles(pluginId, displayName, tool, level, installPath, configRoot, manifest, externalRepoNames) {
2742
+ function scanInstalledFiles(pluginId, displayName, tool, level, installPath, configRoot, manifest, externalRepoNames, configRootConfigLink) {
2743
2743
  const files = [];
2744
2744
  const directories = [];
2745
2745
  if (manifest) {
@@ -2781,9 +2781,15 @@ function scanInstalledFiles(pluginId, displayName, tool, level, installPath, con
2781
2781
  }
2782
2782
  const configFileName = tool === "claude" ? "CLAUDE.md" : "AGENTS.md";
2783
2783
  const configFilePath = level === "project" ? join10(installPath, configFileName) : join10(configRoot, configFileName);
2784
- if (existsSync11(configFilePath)) {
2784
+ if (existsSync11(configFilePath) || isSymlink(configFilePath)) {
2785
2785
  files.push(configFilePath);
2786
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
+ }
2787
2793
  const repoLinks = externalRepoNames && externalRepoNames.length > 0 ? externalRepoNames : ["asc-devkit", "pypto", "tilelang-ascend", "cann-recipes-infer", "cann-samples"];
2788
2794
  for (const repoName of repoLinks) {
2789
2795
  const repoLinkPath = join10(installPath, repoName);
@@ -3454,7 +3460,8 @@ async function installPlugin(opts) {
3454
3460
  cwd,
3455
3461
  configRoot,
3456
3462
  result.manifest,
3457
- plugin.externalRepos?.map((r) => basename2(r.dir))
3463
+ plugin.externalRepos?.map((r) => basename2(r.dir)),
3464
+ plugin.configRootConfigLink
3458
3465
  );
3459
3466
  if (backupInfo) {
3460
3467
  record.backup = {
@@ -3540,7 +3547,8 @@ async function installPlugin(opts) {
3540
3547
  cwd,
3541
3548
  configRoot,
3542
3549
  manifest,
3543
- plugin.externalRepos?.map((r) => basename2(r.dir))
3550
+ plugin.externalRepos?.map((r) => basename2(r.dir)),
3551
+ plugin.configRootConfigLink
3544
3552
  );
3545
3553
  if (backupInfo) {
3546
3554
  record.backup = {
@@ -4984,7 +4992,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
4984
4992
  // src/commands/uninstall.ts
4985
4993
  init_registry();
4986
4994
  import { existsSync as existsSync18, unlinkSync as unlinkSync6, rmdirSync, readdirSync as readdirSync7 } from "fs";
4987
- import { resolve, basename as basename3, sep } from "path";
4995
+ import { resolve, basename as basename3, sep, join as join18 } from "path";
4988
4996
  import chalk11 from "chalk";
4989
4997
  import { select as select5, checkbox as checkbox2, Separator as Separator4, confirm as confirm3 } from "@inquirer/prompts";
4990
4998
  init_config();
@@ -5274,7 +5282,15 @@ async function uninstallPluginById(pluginId, batchMode) {
5274
5282
  };
5275
5283
  let removedFiles = 0;
5276
5284
  let removedDirs = 0;
5277
- 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) {
5278
5294
  if (!isSafePath(filePath)) continue;
5279
5295
  try {
5280
5296
  if (existsSync18(filePath) || isSymlink(filePath)) {
@@ -5455,7 +5471,7 @@ async function updateCommand(pluginNames, options) {
5455
5471
  init_registry();
5456
5472
  import chalk13 from "chalk";
5457
5473
  import { existsSync as existsSync19, readdirSync as readdirSync8 } from "fs";
5458
- import { join as join18 } from "path";
5474
+ import { join as join19 } from "path";
5459
5475
  init_manifest();
5460
5476
  init_i18n();
5461
5477
  async function infoCommand(pluginName) {
@@ -5482,11 +5498,11 @@ async function infoCommand(pluginName) {
5482
5498
  try {
5483
5499
  const repoManager = createRepositoryManager();
5484
5500
  const repoPath = await repoManager.ensureRepo();
5485
- const quickstartPath = join18(repoPath, plugin.dir, "quickstart.md");
5501
+ const quickstartPath = join19(repoPath, plugin.dir, "quickstart.md");
5486
5502
  if (existsSync19(quickstartPath)) {
5487
5503
  console.log(` ${chalk13.dim(t("info_quickstart") + ":")} ${quickstartPath}`);
5488
5504
  }
5489
- const agentsDir = join18(repoPath, plugin.dir, "agents");
5505
+ const agentsDir = join19(repoPath, plugin.dir, "agents");
5490
5506
  if (existsSync19(agentsDir)) {
5491
5507
  const agentFiles = readdirSync8(agentsDir).filter((f) => f.endsWith(".md"));
5492
5508
  if (agentFiles.length > 0) {
@@ -5545,7 +5561,7 @@ init_config();
5545
5561
  init_i18n();
5546
5562
  import { readFileSync as readFileSync9, existsSync as existsSync20 } from "fs";
5547
5563
  import { fileURLToPath as fileURLToPath4 } from "url";
5548
- import { dirname as dirname6, join as join19 } from "path";
5564
+ import { dirname as dirname6, join as join20 } from "path";
5549
5565
  function readVersion() {
5550
5566
  try {
5551
5567
  if (typeof INSTALL_HELPER_VERSION !== "undefined" && INSTALL_HELPER_VERSION) {
@@ -5557,9 +5573,9 @@ function readVersion() {
5557
5573
  const __filename4 = fileURLToPath4(import.meta.url);
5558
5574
  const __dirname4 = dirname6(__filename4);
5559
5575
  const candidates = [
5560
- join19(__dirname4, "..", "package.json"),
5561
- join19(__dirname4, "package.json"),
5562
- join19(process.cwd(), "package.json")
5576
+ join20(__dirname4, "..", "package.json"),
5577
+ join20(__dirname4, "package.json"),
5578
+ join20(process.cwd(), "package.json")
5563
5579
  ];
5564
5580
  for (const pkgPath of candidates) {
5565
5581
  if (existsSync20(pkgPath)) {