@wrongstack/cli 0.272.1 → 0.272.2

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
@@ -21191,11 +21191,24 @@ function buildBadges(chosen) {
21191
21191
  return badges;
21192
21192
  }
21193
21193
  async function persistLaunchChoices(configPath2, choices) {
21194
+ let fileExists2 = false;
21195
+ try {
21196
+ await fs4.access(configPath2);
21197
+ fileExists2 = true;
21198
+ } catch {
21199
+ }
21194
21200
  let existing = {};
21195
21201
  try {
21196
21202
  const raw = await fs4.readFile(configPath2, "utf8");
21197
21203
  existing = JSON.parse(raw);
21198
- } catch {
21204
+ } catch (err) {
21205
+ if (fileExists2) {
21206
+ throw new Error(
21207
+ `Refusing to overwrite corrupt config at ${configPath2} (${err.message}). Fix or move the file aside before retrying.`,
21208
+ { cause: err }
21209
+ );
21210
+ }
21211
+ existing = {};
21199
21212
  }
21200
21213
  existing.yolo = choices.yolo;
21201
21214
  existing.launch = {