minovative-mind-cli 2.5.1 → 2.5.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.
|
@@ -811,19 +811,64 @@ export async function handleSlashCommand(command, context) {
|
|
|
811
811
|
}
|
|
812
812
|
}
|
|
813
813
|
else if (action === 'remove') {
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
options: removeOptions,
|
|
814
|
+
const removeType = await p['select']({
|
|
815
|
+
message: 'What would you like to remove?',
|
|
816
|
+
options: [
|
|
817
|
+
{ value: 'master', label: 'Master Workspace (Profile)' },
|
|
818
|
+
{ value: 'sub', label: 'Sub-workspace (Alias)' },
|
|
819
|
+
{ value: 'cancel', label: 'Cancel' },
|
|
820
|
+
],
|
|
822
821
|
});
|
|
823
|
-
if (p.isCancel(
|
|
822
|
+
if (p.isCancel(removeType) || removeType === 'cancel')
|
|
824
823
|
continue;
|
|
825
|
-
|
|
826
|
-
|
|
824
|
+
if (removeType === 'master') {
|
|
825
|
+
const profiles = workspaceRegistry.listProfiles();
|
|
826
|
+
if (profiles.length === 0) {
|
|
827
|
+
p.log.error('No master workspaces (profiles) exist.');
|
|
828
|
+
continue;
|
|
829
|
+
}
|
|
830
|
+
const profileOptions = profiles.map((p) => ({
|
|
831
|
+
value: p.name,
|
|
832
|
+
label: p.name,
|
|
833
|
+
}));
|
|
834
|
+
profileOptions.push({ value: 'cancel', label: 'Cancel' });
|
|
835
|
+
const profileToRemove = await p['select']({
|
|
836
|
+
message: 'Select Master Workspace (Profile) to remove:',
|
|
837
|
+
options: profileOptions,
|
|
838
|
+
});
|
|
839
|
+
if (p.isCancel(profileToRemove) || profileToRemove === 'cancel')
|
|
840
|
+
continue;
|
|
841
|
+
const associated = workspaceRegistry.getWorkspacesByProfile(profileToRemove);
|
|
842
|
+
let warningMsg = `Are you sure you want to remove the Master Workspace "${profileToRemove}"?`;
|
|
843
|
+
if (associated.length > 0) {
|
|
844
|
+
const aliasesList = associated.map((ws) => `@${ws.alias}`).join(', ');
|
|
845
|
+
warningMsg += ` This will also delete all associated sub-workspaces: ${aliasesList}.`;
|
|
846
|
+
}
|
|
847
|
+
const confirm = await p['confirm']({
|
|
848
|
+
message: warningMsg,
|
|
849
|
+
});
|
|
850
|
+
if (p.isCancel(confirm) || !confirm) {
|
|
851
|
+
p.log.warn('Removal canceled.');
|
|
852
|
+
continue;
|
|
853
|
+
}
|
|
854
|
+
workspaceRegistry.unregisterProfile(profileToRemove);
|
|
855
|
+
p.log.success(`Removed Master Workspace "${profileToRemove}" and its associated sub-workspaces.`);
|
|
856
|
+
}
|
|
857
|
+
else {
|
|
858
|
+
const removeOptions = workspaceRegistry.list().map((r) => ({
|
|
859
|
+
value: r.alias,
|
|
860
|
+
label: `@${r.alias} -> ${r.absolutePath}`,
|
|
861
|
+
}));
|
|
862
|
+
removeOptions.push({ value: 'cancel', label: 'Cancel' });
|
|
863
|
+
const aliasToRemove = await p['select']({
|
|
864
|
+
message: 'Select Sub-workspace (Alias) to remove:',
|
|
865
|
+
options: removeOptions,
|
|
866
|
+
});
|
|
867
|
+
if (p.isCancel(aliasToRemove) || aliasToRemove === 'cancel')
|
|
868
|
+
continue;
|
|
869
|
+
workspaceRegistry.unregister(aliasToRemove);
|
|
870
|
+
p.log.success(`Removed @${aliasToRemove}`);
|
|
871
|
+
}
|
|
827
872
|
}
|
|
828
873
|
else if (action === 'list') {
|
|
829
874
|
for (const { alias, root } of allRoots) {
|
|
@@ -78,6 +78,13 @@ declare class WorkspaceRegistry {
|
|
|
78
78
|
* @returns `true` if the workspace was found and removed, `false` otherwise.
|
|
79
79
|
*/
|
|
80
80
|
unregister(alias: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Removes a registered profile and all its associated workspaces.
|
|
83
|
+
*
|
|
84
|
+
* @param profileName - The name of the profile to unregister.
|
|
85
|
+
* @returns `true` if the profile was found and removed, `false` otherwise.
|
|
86
|
+
*/
|
|
87
|
+
unregisterProfile(profileName: string): boolean;
|
|
81
88
|
/**
|
|
82
89
|
* Returns all registered workspaces as an array, sorted by alias.
|
|
83
90
|
*/
|
|
@@ -118,6 +118,28 @@ class WorkspaceRegistry {
|
|
|
118
118
|
}
|
|
119
119
|
return existed;
|
|
120
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Removes a registered profile and all its associated workspaces.
|
|
123
|
+
*
|
|
124
|
+
* @param profileName - The name of the profile to unregister.
|
|
125
|
+
* @returns `true` if the profile was found and removed, `false` otherwise.
|
|
126
|
+
*/
|
|
127
|
+
unregisterProfile(profileName) {
|
|
128
|
+
const normalizedProfile = profileName.toLowerCase().trim();
|
|
129
|
+
const existed = this.profiles.delete(normalizedProfile);
|
|
130
|
+
if (existed) {
|
|
131
|
+
// Find and delete all workspaces associated with this profile
|
|
132
|
+
for (const [alias, ws] of this.workspaces.entries()) {
|
|
133
|
+
if (ws.profile === normalizedProfile) {
|
|
134
|
+
this.workspaces.delete(alias);
|
|
135
|
+
debugLog(`Unregistered workspace: @${alias} (via profile removal)`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
this.saveToDisk();
|
|
139
|
+
debugLog(`Unregistered profile: ${normalizedProfile}`);
|
|
140
|
+
}
|
|
141
|
+
return existed;
|
|
142
|
+
}
|
|
121
143
|
/**
|
|
122
144
|
* Returns all registered workspaces as an array, sorted by alias.
|
|
123
145
|
*/
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED