@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 +1 -1
- package/src/runtime/profiles.js +19 -11
package/package.json
CHANGED
package/src/runtime/profiles.js
CHANGED
|
@@ -485,10 +485,15 @@ export function updateConfig(updater) {
|
|
|
485
485
|
}
|
|
486
486
|
|
|
487
487
|
/**
|
|
488
|
-
* Remove
|
|
489
|
-
*
|
|
490
|
-
*
|
|
491
|
-
*
|
|
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
|
|
507
|
-
|
|
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;
|