@mutagent/cli 0.1.65 → 0.1.66

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/bin/cli.js CHANGED
@@ -900,6 +900,7 @@ class SDKClientWrapper {
900
900
  }
901
901
  async listWorkspaces(filters) {
902
902
  try {
903
+ await this.ensureOrganizationId();
903
904
  const response = await this.sdk.workspaces.listWorkspaces({
904
905
  includeInactive: false
905
906
  });
@@ -916,6 +917,7 @@ class SDKClientWrapper {
916
917
  }
917
918
  async getWorkspace(id) {
918
919
  try {
920
+ await this.ensureOrganizationId();
919
921
  const response = await this.sdk.workspaces.getWorkspace({
920
922
  wsId: id
921
923
  });
@@ -997,6 +999,14 @@ class SDKClientWrapper {
997
999
  getCurrentOrgId() {
998
1000
  return this.organizationId;
999
1001
  }
1002
+ async ensureOrganizationId() {
1003
+ if (this.organizationId)
1004
+ return;
1005
+ const orgs = await fetchOrganizations(this.apiKey, this.endpoint);
1006
+ if (orgs.length > 0 && orgs[0]) {
1007
+ this.organizationId = orgs[0].id;
1008
+ }
1009
+ }
1000
1010
  async testProvider(id) {
1001
1011
  try {
1002
1012
  const response = await this.sdk.providerConfigs.testProvider({
@@ -9029,5 +9039,5 @@ program.addCommand(createHooksCommand());
9029
9039
  program.addCommand(createFeedbackCommand());
9030
9040
  program.parse();
9031
9041
 
9032
- //# debugId=E63D3B793E7AE87C64756E2164756E21
9042
+ //# debugId=EA3BD8A71195D63264756E2164756E21
9033
9043
  //# sourceMappingURL=cli.js.map