@atlashub/smartstack-cli 4.7.0 → 4.9.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/dist/index.js CHANGED
@@ -112712,6 +112712,14 @@ async function installCommands(options = {}) {
112712
112712
  logger.info(`Installing to: ${claudeDir}`);
112713
112713
  const dirsToInstall = installAll ? INSTALL_DIRS : INSTALL_DIRS.filter((d) => components.includes(d));
112714
112714
  const version2 = getPackageVersion();
112715
+ let forceUpdate = options.force ?? false;
112716
+ if (!forceUpdate) {
112717
+ const existingManifest = await readManifest(claudeDir);
112718
+ if (existingManifest && existingManifest.version !== version2) {
112719
+ logger.info(`Version upgrade detected: ${existingManifest.version} \u2192 ${version2} (forcing update)`);
112720
+ forceUpdate = true;
112721
+ }
112722
+ }
112715
112723
  for (const dir of dirsToInstall) {
112716
112724
  const sourceDir = (0, import_path2.join)(TEMPLATES_DIR, dir);
112717
112725
  const targetDir = (0, import_path2.join)(claudeDir, dir);
@@ -112726,7 +112734,7 @@ async function installCommands(options = {}) {
112726
112734
  const relativePath = (0, import_path2.join)(dir, file);
112727
112735
  try {
112728
112736
  const exists = await import_fs_extra2.default.pathExists(dest);
112729
- if (exists && !options.force) {
112737
+ if (exists && !forceUpdate) {
112730
112738
  result.skipped++;
112731
112739
  result.installedFiles.push(relativePath);
112732
112740
  continue;
@@ -112737,7 +112745,7 @@ async function installCommands(options = {}) {
112737
112745
  const processed = processTemplateVariables(content, version2);
112738
112746
  await import_fs_extra2.default.writeFile(dest, processed, "utf-8");
112739
112747
  } else {
112740
- await import_fs_extra2.default.copy(src, dest, { overwrite: options.force });
112748
+ await import_fs_extra2.default.copy(src, dest, { overwrite: forceUpdate });
112741
112749
  }
112742
112750
  result.installed++;
112743
112751
  result.installedFiles.push(relativePath);
@@ -112982,6 +112990,28 @@ async function updateCommands(options = {}) {
112982
112990
  logger.error(msg);
112983
112991
  }
112984
112992
  }
112993
+ for (const dir of INSTALL_DIRS) {
112994
+ const targetDir = (0, import_path2.join)(claudeDir, dir);
112995
+ if (await import_fs_extra2.default.pathExists(targetDir)) {
112996
+ const diskFiles = await getTemplateFiles(targetDir);
112997
+ for (const file of diskFiles) {
112998
+ const relativePath = (0, import_path2.join)(dir, file);
112999
+ if (!newFiles.has(relativePath)) {
113000
+ const filePath = (0, import_path2.join)(claudeDir, relativePath);
113001
+ try {
113002
+ await import_fs_extra2.default.remove(filePath);
113003
+ result.removed++;
113004
+ result.removedFiles.push(relativePath);
113005
+ logger.warning(`Removed orphan: ${relativePath}`);
113006
+ } catch (error) {
113007
+ const msg = `Failed to remove orphan ${relativePath}: ${error}`;
113008
+ result.errors.push(msg);
113009
+ logger.error(msg);
113010
+ }
113011
+ }
113012
+ }
113013
+ }
113014
+ }
112985
113015
  await cleanEmptyDirectories(claudeDir);
112986
113016
  } else {
112987
113017
  const newFiles = /* @__PURE__ */ new Set();
@@ -113000,6 +113030,18 @@ async function updateCommands(options = {}) {
113000
113030
  wouldRemove.push(oldFile);
113001
113031
  }
113002
113032
  }
113033
+ for (const dir of INSTALL_DIRS) {
113034
+ const targetDir = (0, import_path2.join)(claudeDir, dir);
113035
+ if (await import_fs_extra2.default.pathExists(targetDir)) {
113036
+ const diskFiles = await getTemplateFiles(targetDir);
113037
+ for (const file of diskFiles) {
113038
+ const relativePath = (0, import_path2.join)(dir, file);
113039
+ if (!newFiles.has(relativePath) && !wouldRemove.includes(relativePath)) {
113040
+ wouldRemove.push(relativePath);
113041
+ }
113042
+ }
113043
+ }
113044
+ }
113003
113045
  if (wouldRemove.length > 0) {
113004
113046
  logger.info(`
113005
113047
  Files that would be REMOVED (${wouldRemove.length}):`);