@atlashub/smartstack-cli 4.58.0 → 4.59.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
@@ -113279,13 +113279,18 @@ async function installRalphConfig(options = {}) {
113279
113279
  result.errors.push("Ralph config template not found");
113280
113280
  logger.warning("Ralph config template not found in package");
113281
113281
  }
113282
- const gitignoreSrc = (0, import_path2.join)(TEMPLATES_DIR, "ralph", ".gitignore");
113282
+ const gitignoreSrc = (0, import_path2.join)(TEMPLATES_DIR, "ralph", "gitignore.template");
113283
113283
  const gitignoreDest = (0, import_path2.join)(ralphDir, ".gitignore");
113284
113284
  if (await import_fs_extra2.default.pathExists(gitignoreSrc)) {
113285
113285
  if (!await import_fs_extra2.default.pathExists(gitignoreDest) || options.force) {
113286
113286
  const content = await import_fs_extra2.default.readFile(gitignoreSrc);
113287
113287
  await import_fs_extra2.default.writeFile(gitignoreDest, content);
113288
+ logger.success("Created .ralph/.gitignore");
113289
+ } else {
113290
+ logger.info(".ralph/.gitignore already exists (use --force to overwrite)");
113288
113291
  }
113292
+ } else {
113293
+ logger.warning(".ralph/gitignore.template not found in package \u2014 .gitignore not created");
113289
113294
  }
113290
113295
  const readmeSrc = (0, import_path2.join)(TEMPLATES_DIR, "ralph", "README.md");
113291
113296
  const readmeDest = (0, import_path2.join)(ralphDir, "README.md");
@@ -117316,6 +117321,7 @@ async function createFrontendStructure(config, state, dryRun) {
117316
117321
  "eslint-plugin-react-refresh": "^0.4.24",
117317
117322
  globals: "^16.5.0",
117318
117323
  jsdom: "^28.0.0",
117324
+ msw: "^2.7.5",
117319
117325
  typescript: "~5.9.3",
117320
117326
  "typescript-eslint": "^8.46.4",
117321
117327
  vite: "^7.2.4",
@@ -118134,6 +118140,17 @@ var initCommand = new Command("init").description("Initialize a new SmartStack p
118134
118140
  const ralphResult = await installRalphConfig({ projectPath: finalProjectDir });
118135
118141
  if (ralphResult.success) {
118136
118142
  logger.success("Ralph configuration created at .ralph/");
118143
+ const ralphFiles = [
118144
+ { path: ".ralph/ralph.config.yaml", abs: ralphResult.configPath },
118145
+ { path: ".ralph/.gitignore", abs: (0, import_path7.join)(finalProjectDir, ".ralph", ".gitignore") },
118146
+ { path: ".ralph/README.md", abs: (0, import_path7.join)(finalProjectDir, ".ralph", "README.md") }
118147
+ ];
118148
+ for (const rf of ralphFiles) {
118149
+ if (await import_fs_extra6.default.pathExists(rf.abs)) {
118150
+ const content = await import_fs_extra6.default.readFile(rf.abs);
118151
+ recordFile(state, "ralph", rf.path, computeHash(content));
118152
+ }
118153
+ }
118137
118154
  } else {
118138
118155
  logger.warning("Could not create Ralph configuration (non-critical)");
118139
118156
  }
@@ -125275,20 +125292,87 @@ async function syncClaudeSettings(projectDir, dryRun) {
125275
125292
  }
125276
125293
  return added;
125277
125294
  }
125295
+ async function syncTestFrontendTemplates(frontendDir, dryRun) {
125296
+ const testFrontendDir = (0, import_path8.join)(TEMPLATES_DIR3, "test-frontend");
125297
+ if (!await import_fs_extra7.default.pathExists(testFrontendDir)) {
125298
+ logger.debug("test-frontend templates not found, skipping");
125299
+ return 0;
125300
+ }
125301
+ let synced = 0;
125302
+ const testFiles = [
125303
+ { src: "vitest.config.ts", dest: "vitest.config.ts" },
125304
+ { src: "setup.ts", dest: (0, import_path8.join)("src", "test", "setup.ts") },
125305
+ { src: "test-utils.tsx", dest: (0, import_path8.join)("src", "test", "test-utils.tsx") },
125306
+ { src: "msw/handlers.ts", dest: (0, import_path8.join)("src", "test", "msw", "handlers.ts") },
125307
+ { src: "msw/server.ts", dest: (0, import_path8.join)("src", "test", "msw", "server.ts") }
125308
+ ];
125309
+ for (const file of testFiles) {
125310
+ const destPath = (0, import_path8.join)(frontendDir, file.dest);
125311
+ if (await import_fs_extra7.default.pathExists(destPath)) continue;
125312
+ const srcPath = (0, import_path8.join)(testFrontendDir, file.src);
125313
+ if (!await import_fs_extra7.default.pathExists(srcPath)) continue;
125314
+ if (dryRun) {
125315
+ logger.warning(`[DRY RUN] Would create ${file.dest}`);
125316
+ } else {
125317
+ await import_fs_extra7.default.ensureDir((0, import_path8.dirname)(destPath));
125318
+ const content = await import_fs_extra7.default.readFile(srcPath, "utf-8");
125319
+ await import_fs_extra7.default.writeFile(destPath, content, "utf-8");
125320
+ logger.info(` ${source_default.green("+")} ${file.dest}`);
125321
+ }
125322
+ synced++;
125323
+ }
125324
+ return synced;
125325
+ }
125326
+ async function cleanResidualFiles(projectDir, baseNamespace, dryRun) {
125327
+ let cleaned = 0;
125328
+ const residuals = [
125329
+ (0, import_path8.join)(projectDir, "src", `${baseNamespace}.Api`, `${baseNamespace}.Api.http`)
125330
+ ];
125331
+ for (const file of residuals) {
125332
+ if (await import_fs_extra7.default.pathExists(file)) {
125333
+ if (dryRun) {
125334
+ logger.warning(`[DRY RUN] Would remove residual: ${file}`);
125335
+ } else {
125336
+ await import_fs_extra7.default.remove(file);
125337
+ logger.info(` ${source_default.red("\u2212")} Removed residual: ${baseNamespace}.Api.http`);
125338
+ }
125339
+ cleaned++;
125340
+ }
125341
+ }
125342
+ return cleaned;
125343
+ }
125344
+ async function fixInitStateVersion(projectDir, cliVersion, dryRun) {
125345
+ const statePath = (0, import_path8.join)(projectDir, ".smartstack", "init-state.json");
125346
+ if (!await import_fs_extra7.default.pathExists(statePath)) return false;
125347
+ try {
125348
+ const state = await import_fs_extra7.default.readJson(statePath);
125349
+ if (state.cliVersion === "0.0.0") {
125350
+ if (dryRun) {
125351
+ logger.warning("[DRY RUN] Would fix cliVersion 0.0.0 in init-state.json");
125352
+ } else {
125353
+ state.cliVersion = cliVersion;
125354
+ await import_fs_extra7.default.writeJson(statePath, state, { spaces: 2 });
125355
+ logger.info(` ${source_default.green("+")} Fixed cliVersion: 0.0.0 \u2192 ${cliVersion}`);
125356
+ }
125357
+ return true;
125358
+ }
125359
+ } catch {
125360
+ }
125361
+ return false;
125362
+ }
125278
125363
  async function syncDockerFiles(projectDir, baseNamespace, dryRun) {
125279
125364
  const projectName = baseNamespace;
125280
- const projectNameLower = projectName.toLowerCase();
125281
125365
  let updated = 0;
125282
125366
  const files = [
125283
125367
  {
125284
125368
  template: "Dockerfile.backend.template",
125285
- dest: (0, import_path8.join)(projectDir, "src", `${projectName}.Api`, "Dockerfile"),
125286
- label: `src/${projectName}.Api/Dockerfile`
125369
+ dest: (0, import_path8.join)(projectDir, "docker-images", "Dockerfile.backend"),
125370
+ label: "docker-images/Dockerfile.backend"
125287
125371
  },
125288
125372
  {
125289
125373
  template: "Dockerfile.frontend.template",
125290
- dest: (0, import_path8.join)(projectDir, "web", `${projectNameLower}-web`, "Dockerfile"),
125291
- label: `web/${projectNameLower}-web/Dockerfile`
125374
+ dest: (0, import_path8.join)(projectDir, "docker-images", "Dockerfile.frontend"),
125375
+ label: "docker-images/Dockerfile.frontend"
125292
125376
  },
125293
125377
  {
125294
125378
  template: "dockerignore.template",
@@ -125342,6 +125426,9 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125342
125426
  ralphInitialized: false,
125343
125427
  ralphUpToDate: false,
125344
125428
  dockerSynced: 0,
125429
+ testFrontendSynced: 0,
125430
+ residualsCleaned: 0,
125431
+ initStateFixed: false,
125345
125432
  programCsIssues: []
125346
125433
  };
125347
125434
  if (dryRun) {
@@ -125525,6 +125612,14 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125525
125612
  } else {
125526
125613
  logger.info(`Other npm packages: ${source_default.gray("skipped")} (use ${source_default.cyan("--all-packages")} to upgrade all)`);
125527
125614
  }
125615
+ logger.info("Syncing test-frontend templates...");
125616
+ const testSynced = await syncTestFrontendTemplates(frontendDir, dryRun);
125617
+ result.testFrontendSynced = testSynced;
125618
+ if (testSynced > 0) {
125619
+ logger.success(`${testSynced} test template(s) deployed`);
125620
+ } else {
125621
+ logger.info(`Test templates ${source_default.green("\u2713")} up to date`);
125622
+ }
125528
125623
  console.log();
125529
125624
  }
125530
125625
  logger.info("Checking for code migrations...");
@@ -125595,6 +125690,17 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125595
125690
  logger.info(`Dockerfiles ${source_default.green("\u2713")} up to date`);
125596
125691
  }
125597
125692
  console.log();
125693
+ const residualsCleaned = await cleanResidualFiles(projectDir, config.baseNamespace, dryRun);
125694
+ result.residualsCleaned = residualsCleaned;
125695
+ if (residualsCleaned > 0) {
125696
+ logger.success(`${residualsCleaned} residual file(s) cleaned`);
125697
+ console.log();
125698
+ }
125699
+ result.initStateFixed = await fixInitStateVersion(projectDir, nugetVersion, dryRun);
125700
+ if (result.initStateFixed) {
125701
+ logger.success("Fixed cliVersion in init-state.json");
125702
+ console.log();
125703
+ }
125598
125704
  logger.info("Checking Ralph configuration...");
125599
125705
  const ralphStatus = await checkRalphInstallation(projectDir);
125600
125706
  if (ralphStatus.configExists) {
@@ -125638,7 +125744,7 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125638
125744
  logger.success(`Updated config version to ${source_default.cyan(nugetVersion)}`);
125639
125745
  console.log();
125640
125746
  }
125641
- const totalChanged = result.nugetUpgraded + result.otherPkgUpdated + (result.npmUpgraded ? 1 : 0) + (result.npmOtherUpdated ? 1 : 0) + migrationSummary.totalApplied + result.configSynced + result.claudeSettingsSynced + result.dockerSynced + (result.ralphInitialized ? 1 : 0);
125747
+ const totalChanged = result.nugetUpgraded + result.otherPkgUpdated + (result.npmUpgraded ? 1 : 0) + (result.npmOtherUpdated ? 1 : 0) + migrationSummary.totalApplied + result.configSynced + result.claudeSettingsSynced + result.dockerSynced + result.testFrontendSynced + result.residualsCleaned + (result.initStateFixed ? 1 : 0) + (result.ralphInitialized ? 1 : 0);
125642
125748
  const allUpToDate = totalChanged === 0 && result.nugetFailed === 0 && result.otherPkgFailed === 0;
125643
125749
  const hasProgramIssues = result.programCsIssues.length > 0;
125644
125750
  if (allUpToDate && !hasProgramIssues) {
@@ -125702,6 +125808,15 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125702
125808
  if (result.dockerSynced > 0) {
125703
125809
  lines.push(` ${source_default.green("\u2713")} Docker: ${result.dockerSynced} Dockerfile(s) updated`);
125704
125810
  }
125811
+ if (result.testFrontendSynced > 0) {
125812
+ lines.push(` ${source_default.green("\u2713")} Test templates: ${result.testFrontendSynced} file(s) deployed`);
125813
+ }
125814
+ if (result.residualsCleaned > 0) {
125815
+ lines.push(` ${source_default.green("\u2713")} Cleanup: ${result.residualsCleaned} residual file(s) removed`);
125816
+ }
125817
+ if (result.initStateFixed) {
125818
+ lines.push(` ${source_default.green("\u2713")} Init-state: cliVersion fixed`);
125819
+ }
125705
125820
  if (result.ralphInitialized) {
125706
125821
  lines.push(` ${source_default.green("\u2713")} Ralph: configuration initialized`);
125707
125822
  }