@notis_ai/cli 0.2.0-beta.153.2 → 0.2.0-beta.154.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notis_ai/cli",
3
- "version": "0.2.0-beta.153.2",
3
+ "version": "0.2.0-beta.154.1",
4
4
  "description": "Agent-first Notis CLI for apps and generic tool execution",
5
5
  "type": "module",
6
6
  "bin": {
@@ -485,10 +485,15 @@ export function updateConfig(updater) {
485
485
  }
486
486
 
487
487
  /**
488
- * Remove only worktree-owned profiles without normalizing the rest of the
489
- * shared file. Archive cleanup can run before a packaged Desktop upgrade has
490
- * migrated its legacy `jwt`; preserving unknown/raw fields here keeps that
491
- * migrate-then-strip handoff intact.
488
+ * Remove every profile owned by one worktree, plus stale localhost stubs that
489
+ * use one of that worktree's generated profile names. Older builds sometimes
490
+ * lost `dev_workspace_root`, so requiring the ownership marker alone leaves a
491
+ * dead local profile behind after archive.
492
+ *
493
+ * Do this without normalizing the rest of the shared file. Archive cleanup can
494
+ * run before a packaged Desktop upgrade has migrated its legacy `jwt`;
495
+ * preserving unknown/raw fields here keeps that migrate-then-strip handoff
496
+ * intact.
492
497
  */
493
498
  export function removeOwnedDevProfiles(profileNames, workspaceRoot) {
494
499
  return withConfigWriteLock((configFile) => {
@@ -502,16 +507,19 @@ export function removeOwnedDevProfiles(profileNames, workspaceRoot) {
502
507
  return [];
503
508
  }
504
509
 
510
+ const generatedNames = new Set(profileNames);
505
511
  const removed = [];
506
- for (const name of profileNames) {
507
- const profile = Object.hasOwn(raw.profiles, name) ? raw.profiles[name] : null;
508
- if (
509
- !profile
510
- || typeof profile !== 'object'
511
- || profile.dev_workspace_root !== workspaceRoot
512
- ) {
512
+ for (const [name, profile] of Object.entries(raw.profiles)) {
513
+ if (!profile || typeof profile !== 'object') {
513
514
  continue;
514
515
  }
516
+
517
+ const ownedByWorkspace = profile.dev_workspace_root === workspaceRoot;
518
+ const staleGeneratedLocalProfile = generatedNames.has(name)
519
+ && !profile.dev_workspace_root
520
+ && isLocalApiBase(profile.api_base);
521
+ if (!ownedByWorkspace && !staleGeneratedLocalProfile) continue;
522
+
515
523
  delete raw.profiles[name];
516
524
  removed.push(name);
517
525
  if (raw.current_profile === name) raw.current_profile = DEFAULT_PROFILE;