@atlashub/smartstack-cli 3.3.1 → 3.4.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
@@ -124888,6 +124888,30 @@ async function syncAppSettings(projectDir, baseNamespace, dryRun) {
124888
124888
  }
124889
124889
  return added;
124890
124890
  }
124891
+ async function syncClaudeSettings(projectDir, dryRun) {
124892
+ const settingsPath = (0, import_path7.join)(projectDir, ".claude", "settings.json");
124893
+ const templatePath = (0, import_path7.join)(TEMPLATES_DIR3, "claude-settings.json.template");
124894
+ if (!await import_fs_extra6.default.pathExists(templatePath)) {
124895
+ logger.debug("claude-settings.json.template not found, skipping");
124896
+ return [];
124897
+ }
124898
+ const templateContent = await import_fs_extra6.default.readFile(templatePath, "utf-8");
124899
+ const templateJson = JSON.parse(templateContent);
124900
+ let clientJson = {};
124901
+ if (await import_fs_extra6.default.pathExists(settingsPath)) {
124902
+ const clientContent = await import_fs_extra6.default.readFile(settingsPath, "utf-8");
124903
+ clientJson = JSON.parse(clientContent);
124904
+ }
124905
+ const added = addMissingKeys(clientJson, templateJson);
124906
+ if (added.length === 0) {
124907
+ return [];
124908
+ }
124909
+ if (!dryRun) {
124910
+ await import_fs_extra6.default.ensureDir((0, import_path7.join)(projectDir, ".claude"));
124911
+ await import_fs_extra6.default.writeFile(settingsPath, JSON.stringify(clientJson, null, 2) + "\n");
124912
+ }
124913
+ return added;
124914
+ }
124891
124915
  var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack packages to the latest version").option("--preview", "Upgrade to latest preview/prerelease version").option("--dry-run", "Show what would be upgraded without actually upgrading").action(async (options) => {
124892
124916
  logger.header("SmartStack Package Upgrade");
124893
124917
  const dryRun = options.dryRun || false;
@@ -124901,6 +124925,7 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
124901
124925
  npmUpgraded: false,
124902
124926
  npmSkipped: false,
124903
124927
  configSynced: 0,
124928
+ claudeSettingsSynced: 0,
124904
124929
  programCsIssues: []
124905
124930
  };
124906
124931
  if (dryRun) {
@@ -125092,6 +125117,22 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125092
125117
  logger.info(`appsettings.json ${source_default.green("\u2713")} up to date`);
125093
125118
  console.log();
125094
125119
  }
125120
+ logger.info("Syncing .claude/settings.json...");
125121
+ const addedClaudeKeys = await syncClaudeSettings(projectDir, dryRun);
125122
+ result.claudeSettingsSynced = addedClaudeKeys.length;
125123
+ if (addedClaudeKeys.length > 0) {
125124
+ if (dryRun) {
125125
+ logger.warning(`[DRY RUN] Would add ${addedClaudeKeys.length} new setting(s) to .claude/settings.json`);
125126
+ }
125127
+ for (const key of addedClaudeKeys) {
125128
+ logger.info(` ${source_default.green("+")} ${key}`);
125129
+ }
125130
+ logger.success(`${addedClaudeKeys.length} new setting(s) added to .claude/settings.json`);
125131
+ console.log();
125132
+ } else {
125133
+ logger.info(`.claude/settings.json ${source_default.green("\u2713")} up to date`);
125134
+ console.log();
125135
+ }
125095
125136
  logger.info("Validating Program.cs...");
125096
125137
  result.programCsIssues = await validateProgramCs(projectDir, config.baseNamespace);
125097
125138
  if (result.programCsIssues.length > 0) {
@@ -125119,7 +125160,7 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125119
125160
  logger.success(`Updated config version to ${source_default.cyan(nugetVersion)}`);
125120
125161
  console.log();
125121
125162
  }
125122
- const totalChanged = result.nugetUpgraded + result.otherPkgUpdated + (result.npmUpgraded ? 1 : 0) + migrationSummary.totalApplied + result.configSynced;
125163
+ const totalChanged = result.nugetUpgraded + result.otherPkgUpdated + (result.npmUpgraded ? 1 : 0) + migrationSummary.totalApplied + result.configSynced + result.claudeSettingsSynced;
125123
125164
  const allUpToDate = totalChanged === 0 && result.nugetFailed === 0 && result.otherPkgFailed === 0;
125124
125165
  const hasProgramIssues = result.programCsIssues.length > 0;
125125
125166
  if (allUpToDate && !hasProgramIssues) {
@@ -125174,6 +125215,9 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SmartStack pack
125174
125215
  if (result.configSynced > 0) {
125175
125216
  lines.push(` ${source_default.green("\u2713")} Config: ${result.configSynced} new setting(s) added`);
125176
125217
  }
125218
+ if (result.claudeSettingsSynced > 0) {
125219
+ lines.push(` ${source_default.green("\u2713")} Claude: ${result.claudeSettingsSynced} new setting(s) added`);
125220
+ }
125177
125221
  if (result.programCsIssues.length > 0) {
125178
125222
  lines.push(` ${source_default.red("\u26A0")} Program.cs: ${result.programCsIssues.length} missing call(s) - manual fix required`);
125179
125223
  }
@@ -126978,6 +127022,12 @@ function checkClaudeInWsl() {
126978
127022
  const match2 = out.match(/(\d+\.\d+\.\d+)/);
126979
127023
  return { installed: true, version: match2 ? match2[1] : out };
126980
127024
  }
127025
+ function checkSmartStackInWsl() {
127026
+ const out = wslExec("source ~/.nvm/nvm.sh 2>/dev/null; ss --version 2>/dev/null");
127027
+ if (!out) return { installed: false, version: null };
127028
+ const match2 = out.match(/(\d+\.\d+\.\d+)/);
127029
+ return { installed: true, version: match2 ? match2[1] : out };
127030
+ }
126981
127031
  async function installGitInWsl() {
126982
127032
  const status = checkGitInWsl();
126983
127033
  if (status.installed) return { success: true, version: status.version, skipped: true };
@@ -127071,7 +127121,8 @@ async function installDotnetInWsl() {
127071
127121
  return { success: false, error: "dotnet-install.sh failed" };
127072
127122
  }
127073
127123
  wslInstall(
127074
- `grep -q .dotnet ~/.bashrc || echo 'export PATH="$PATH:$HOME/.dotnet"' >> ~/.bashrc`,
127124
+ `grep -q .dotnet ~/.bashrc || echo 'export DOTNET_ROOT="$HOME/.dotnet"
127125
+ export PATH="$PATH:$HOME/.dotnet:$HOME/.dotnet/tools"' >> ~/.bashrc`,
127075
127126
  5e3
127076
127127
  );
127077
127128
  const check = checkDotnetInWsl();
@@ -127106,6 +127157,63 @@ async function installClaudeInWsl() {
127106
127157
  spinner.fail("Claude Code installation could not be verified");
127107
127158
  return { success: false, error: "Verification failed after install" };
127108
127159
  }
127160
+ async function installSmartStackInWsl() {
127161
+ const status = checkSmartStackInWsl();
127162
+ if (status.installed) return { success: true, version: status.version, skipped: true };
127163
+ const nodeCheck = checkNodeInWsl();
127164
+ if (!nodeCheck.installed) {
127165
+ return { success: false, error: "Node.js is not installed (required for SmartStack CLI)" };
127166
+ }
127167
+ const spinner = logger.spinner("Installing SmartStack CLI...");
127168
+ const result = wslInstall(
127169
+ "source ~/.nvm/nvm.sh && npm install -g @atlashub/smartstack-cli",
127170
+ 18e4
127171
+ );
127172
+ if (result === null) {
127173
+ spinner.fail("Failed to install SmartStack CLI");
127174
+ return { success: false, error: "npm install -g @atlashub/smartstack-cli failed" };
127175
+ }
127176
+ const check = checkSmartStackInWsl();
127177
+ if (check.installed) {
127178
+ spinner.succeed(`SmartStack CLI ${check.version} installed`);
127179
+ return { success: true, version: check.version };
127180
+ }
127181
+ spinner.fail("SmartStack CLI installation could not be verified");
127182
+ return { success: false, error: "Verification failed after install" };
127183
+ }
127184
+ function installStartupScript() {
127185
+ const script = [
127186
+ "#!/bin/bash",
127187
+ "source ~/.nvm/nvm.sh 2>/dev/null",
127188
+ 'export DOTNET_ROOT="$HOME/.dotnet"',
127189
+ 'export PATH="$PATH:$HOME/.dotnet:$HOME/.dotnet/tools"',
127190
+ "",
127191
+ "if tmux has-session -t smartstack 2>/dev/null; then",
127192
+ " tmux attach -t smartstack",
127193
+ "else",
127194
+ " tmux new-session -d -s smartstack -n claude",
127195
+ ' tmux send-keys -t smartstack:claude "claude --dangerously-skip-permissions" Enter',
127196
+ " tmux new-window -t smartstack -n dev",
127197
+ " tmux select-window -t smartstack:claude",
127198
+ " tmux attach -t smartstack",
127199
+ "fi"
127200
+ ].join("\n");
127201
+ const result = wslInstall(
127202
+ `mkdir -p ~/.local/bin && cat > ~/.local/bin/smartstack-dev << 'SCRIPT'
127203
+ ${script}
127204
+ SCRIPT
127205
+ chmod +x ~/.local/bin/smartstack-dev`,
127206
+ 1e4
127207
+ );
127208
+ if (result === null) {
127209
+ return { success: false, error: "Failed to write startup script" };
127210
+ }
127211
+ wslInstall(
127212
+ `grep -q ".local/bin" ~/.bashrc || echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc`,
127213
+ 5e3
127214
+ );
127215
+ return { success: true };
127216
+ }
127109
127217
  var SMARTSTACK_PROFILE_NAME = "SmartStack Dev";
127110
127218
  var SMARTSTACK_PROFILE_GUID = "{17ce5bfe-17ed-5f3a-ab15-5cd5baafed5b}";
127111
127219
  function checkWindowsTerminal() {
@@ -127174,7 +127282,7 @@ function configureWindowsTerminal() {
127174
127282
  const profile = {
127175
127283
  guid: SMARTSTACK_PROFILE_GUID,
127176
127284
  name: SMARTSTACK_PROFILE_NAME,
127177
- commandline: 'wsl -e bash -lc "source ~/.nvm/nvm.sh 2>/dev/null; tmux new-session -A -s smartstack"',
127285
+ commandline: "wsl -e bash -l ~/.local/bin/smartstack-dev",
127178
127286
  icon: "\u26A1",
127179
127287
  colorScheme: "One Half Dark",
127180
127288
  startingDirectory: "~"
@@ -127212,14 +127320,15 @@ var tmuxCommand = new Command("tmux").description("WSL development environment s
127212
127320
  console.log(` ${source_default.cyan("ss tmux install")} Set up complete WSL dev environment`);
127213
127321
  console.log(` ${source_default.cyan("ss tmux status")} Check WSL environment status`);
127214
127322
  console.log();
127215
- console.log("Installs: Windows Terminal, git, tmux, nvm, Node.js, .NET 10, Claude Code");
127216
- console.log("Then launches Windows Terminal with Claude Code in tmux.");
127323
+ console.log("Installs: Windows Terminal, git, tmux, nvm, Node.js, .NET 10,");
127324
+ console.log(" Claude Code, SmartStack CLI");
127325
+ console.log("Then launches Windows Terminal with tmux.");
127217
127326
  console.log();
127218
127327
  });
127219
127328
  tmuxCommand.command("install").description("Install complete WSL dev environment and launch Claude Code").option("-f, --force", "Re-install even if already present").option("-v, --verbose", "Show detailed debug output").option("--no-launch", "Do not launch Windows Terminal after install").action(async (options) => {
127220
127329
  if (options.verbose) logger.setVerbose(true);
127221
127330
  logger.header("WSL Development Environment Setup");
127222
- const totalSteps = 10;
127331
+ const totalSteps = 11;
127223
127332
  logger.step(1, totalSteps, "Windows Terminal...");
127224
127333
  const wtStatus = checkWindowsTerminal();
127225
127334
  if (wtStatus.installed && !options.force) {
@@ -127266,7 +127375,8 @@ tmuxCommand.command("install").description("Install complete WSL dev environment
127266
127375
  { name: "nvm", step: 5, check: checkNvmInWsl, install: installNvmInWsl },
127267
127376
  { name: "Node.js", step: 6, check: checkNodeInWsl, install: installNodeInWsl },
127268
127377
  { name: ".NET SDK 10", step: 7, check: checkDotnetInWsl, install: installDotnetInWsl },
127269
- { name: "Claude Code", step: 8, check: checkClaudeInWsl, install: installClaudeInWsl }
127378
+ { name: "Claude Code", step: 8, check: checkClaudeInWsl, install: installClaudeInWsl },
127379
+ { name: "SmartStack CLI", step: 9, check: checkSmartStackInWsl, install: installSmartStackInWsl }
127270
127380
  ];
127271
127381
  let allSuccess = true;
127272
127382
  const results = [];
@@ -127307,7 +127417,7 @@ tmuxCommand.command("install").description("Install complete WSL dev environment
127307
127417
  ], "error");
127308
127418
  process.exit(1);
127309
127419
  }
127310
- logger.step(9, totalSteps, "Configuring Windows Terminal...");
127420
+ logger.step(10, totalSteps, "Configuring Windows Terminal...");
127311
127421
  const wtCheck = checkWindowsTerminal();
127312
127422
  if (wtCheck.installed) {
127313
127423
  const configResult = configureWindowsTerminal();
@@ -127324,8 +127434,14 @@ tmuxCommand.command("install").description("Install complete WSL dev environment
127324
127434
  } else {
127325
127435
  logger.warning("Windows Terminal not available - skipping configuration");
127326
127436
  }
127437
+ const scriptResult = installStartupScript();
127438
+ if (scriptResult.success) {
127439
+ logger.success("Startup script installed (~/.local/bin/smartstack-dev)");
127440
+ } else {
127441
+ logger.warning(`Startup script: ${scriptResult.error}`);
127442
+ }
127327
127443
  console.log();
127328
- logger.step(10, totalSteps, "Launching...");
127444
+ logger.step(11, totalSteps, "Launching...");
127329
127445
  if (options.launch === false) {
127330
127446
  logger.info("Launch skipped (--no-launch)");
127331
127447
  logger.box([
@@ -127374,6 +127490,7 @@ tmuxCommand.command("status").description("Show WSL development environment stat
127374
127490
  const nodeStatus = checkNodeInWsl();
127375
127491
  const dotnetStatus = checkDotnetInWsl();
127376
127492
  const claudeStatus = checkClaudeInWsl();
127493
+ const smartstackStatus = checkSmartStackInWsl();
127377
127494
  if (options.json) {
127378
127495
  console.log(JSON.stringify({
127379
127496
  wsl: wslStatus,
@@ -127384,10 +127501,11 @@ tmuxCommand.command("status").description("Show WSL development environment stat
127384
127501
  nvm: nvmStatus,
127385
127502
  node: nodeStatus,
127386
127503
  dotnet: dotnetStatus,
127387
- claude: claudeStatus
127504
+ claude: claudeStatus,
127505
+ smartstack: smartstackStatus
127388
127506
  }
127389
127507
  }, null, 2));
127390
- const allInstalled2 = wtStatus.installed && gitStatus.installed && tmuxStatus.installed && nodeStatus.installed && dotnetStatus.installed && claudeStatus.installed;
127508
+ const allInstalled2 = wtStatus.installed && gitStatus.installed && tmuxStatus.installed && nodeStatus.installed && dotnetStatus.installed && claudeStatus.installed && smartstackStatus.installed;
127391
127509
  process.exit(allInstalled2 ? 0 : 1);
127392
127510
  }
127393
127511
  logger.header("WSL Development Environment Status");
@@ -127419,7 +127537,8 @@ tmuxCommand.command("status").description("Show WSL development environment stat
127419
127537
  { name: "nvm", s: nvmStatus },
127420
127538
  { name: "Node.js", s: nodeStatus },
127421
127539
  { name: ".NET SDK", s: dotnetStatus },
127422
- { name: "Claude Code", s: claudeStatus }
127540
+ { name: "Claude Code", s: claudeStatus },
127541
+ { name: "SmartStack CLI", s: smartstackStatus }
127423
127542
  ];
127424
127543
  for (const t of tools) {
127425
127544
  table.push([