@karmaniverous/stan-cli 0.11.4 → 0.11.5

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.
Files changed (2) hide show
  1. package/dist/cli/stan.js +17 -10
  2. package/package.json +1 -1
package/dist/cli/stan.js CHANGED
@@ -18135,6 +18135,7 @@ const writeConfigToDisk = async (args) => {
18135
18135
  // src/runner/init/service/service.main.ts
18136
18136
  const performInitService = async ({ cwd = process.cwd(), force = false, preserveScripts = false, dryRun = false, }) => {
18137
18137
  const existingPath = ke(cwd);
18138
+ const hasExisting = Boolean(existingPath);
18138
18139
  const defaultStanPath = '.stan';
18139
18140
  // Load existing config (raw) preserving key order; fallback to empty object.
18140
18141
  let base = await readExistingConfig(existingPath);
@@ -18144,6 +18145,7 @@ const performInitService = async ({ cwd = process.cwd(), force = false, preserve
18144
18145
  force: force || dryRun,
18145
18146
  });
18146
18147
  const namespaced = isObj$2(base['stan-core']) || isObj$2(base['stan-cli']);
18148
+ const namespacedTarget = namespaced || !hasExisting;
18147
18149
  // UI seeds (best-effort) for interactive mode
18148
18150
  const uiSeeds = await deriveUiSeeds(cwd, base, defaultStanPath);
18149
18151
  // Idempotency guard: under --force with an existing, already namespaced config,
@@ -18166,7 +18168,7 @@ const performInitService = async ({ cwd = process.cwd(), force = false, preserve
18166
18168
  await applyInteractiveChoices({
18167
18169
  cwd,
18168
18170
  base,
18169
- namespaced,
18171
+ namespaced: namespacedTarget,
18170
18172
  uiSeeds: {
18171
18173
  stanPath: uiSeeds.stanPath,
18172
18174
  includes: uiSeeds.includes,
@@ -18180,7 +18182,7 @@ const performInitService = async ({ cwd = process.cwd(), force = false, preserve
18180
18182
  const poc = cliCfg?.patchOpenCommand && typeof cliCfg.patchOpenCommand === 'string'
18181
18183
  ? cliCfg.patchOpenCommand
18182
18184
  : 'code -g {file}';
18183
- if (namespaced) {
18185
+ if (namespacedTarget) {
18184
18186
  const cli = ensureNsNode(base, 'stan-cli');
18185
18187
  if (!hasOwn$2(cli, 'patchOpenCommand'))
18186
18188
  cli.patchOpenCommand = poc;
@@ -18201,15 +18203,20 @@ const performInitService = async ({ cwd = process.cwd(), force = false, preserve
18201
18203
  cliCfg = undefined;
18202
18204
  }
18203
18205
  if (!existingPath) {
18206
+ // First-time creation: seed a namespaced config immediately.
18204
18207
  base = {
18205
- excludes: [],
18206
- includes: [],
18207
- patchOpenCommand: 'code -g {file}',
18208
- // Narrow safely instead of relying on a cast + “?? {}” (lints as unnecessary).
18209
- scripts: cliCfg && typeof cliCfg.scripts === 'object'
18210
- ? cliCfg.scripts
18211
- : {},
18212
- stanPath: defaultStanPath,
18208
+ 'stan-core': {
18209
+ stanPath: defaultStanPath,
18210
+ includes: [],
18211
+ excludes: [],
18212
+ },
18213
+ 'stan-cli': {
18214
+ // Narrow safely instead of relying on a cast + “?? {}”.
18215
+ scripts: cliCfg && typeof cliCfg.scripts === 'object'
18216
+ ? cliCfg.scripts
18217
+ : {},
18218
+ patchOpenCommand: cliCfg?.patchOpenCommand ?? 'code -g {file}',
18219
+ },
18213
18220
  };
18214
18221
  }
18215
18222
  else if (!namespaced) {
package/package.json CHANGED
@@ -164,5 +164,5 @@
164
164
  },
165
165
  "type": "module",
166
166
  "types": "dist/types/index.d.ts",
167
- "version": "0.11.4"
167
+ "version": "0.11.5"
168
168
  }