@orchagent/cli 0.3.25 → 0.3.26

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.
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
37
  };
@@ -170,10 +203,32 @@ argument or --file option instead.
170
203
  throw new errors_1.CliError('Missing API key. Run `orchagent login` first.');
171
204
  }
172
205
  const parsed = parseAgentRef(agentRef);
173
- const org = parsed.org ?? resolved.defaultOrg;
206
+ const configFile = await (0, config_1.loadConfig)();
207
+ const org = parsed.org ?? configFile.workspace ?? resolved.defaultOrg;
174
208
  if (!org) {
175
209
  throw new errors_1.CliError('Missing org. Use org/agent or set default org.');
176
210
  }
211
+ // First-use confirmation when workspace is active (and user didn't specify explicit org)
212
+ if (configFile.workspace && !configFile.workspace_confirmed && !parsed.org) {
213
+ // Only prompt in interactive mode (TTY)
214
+ if (process.stdin.isTTY) {
215
+ const readline = await Promise.resolve().then(() => __importStar(require('readline')));
216
+ const rl = readline.createInterface({
217
+ input: process.stdin,
218
+ output: process.stderr,
219
+ });
220
+ const answer = await new Promise((resolve) => {
221
+ rl.question(`Using workspace: ${configFile.workspace}. Continue? [Y/n]: `, resolve);
222
+ });
223
+ rl.close();
224
+ if (answer.toLowerCase() === 'n') {
225
+ throw new errors_1.CliError('Cancelled. Use explicit org/agent or `orch workspace use <slug>`.');
226
+ }
227
+ // Save confirmation so we don't prompt again until workspace changes
228
+ configFile.workspace_confirmed = true;
229
+ await (0, config_1.saveConfig)(configFile);
230
+ }
231
+ }
177
232
  const agentMeta = await (0, api_1.getAgentWithFallback)(resolved, org, parsed.agent, parsed.version);
178
233
  const endpoint = options.endpoint?.trim() || agentMeta.default_endpoint || 'analyze';
179
234
  const headers = {
@@ -816,10 +816,32 @@ Note: Use 'run' for local execution, 'call' for server-side execution.
816
816
  }
817
817
  const resolved = await (0, config_1.getResolvedConfig)();
818
818
  const parsed = parseAgentRef(agentRef);
819
- const org = parsed.org ?? resolved.defaultOrg;
819
+ const configFile = await (0, config_1.loadConfig)();
820
+ const org = parsed.org ?? configFile.workspace ?? resolved.defaultOrg;
820
821
  if (!org) {
821
822
  throw new errors_1.CliError('Missing org. Use org/agent format.');
822
823
  }
824
+ // First-use confirmation when workspace is active (and user didn't specify explicit org)
825
+ if (configFile.workspace && !configFile.workspace_confirmed && !parsed.org) {
826
+ // Only prompt in interactive mode (TTY)
827
+ if (process.stdin.isTTY) {
828
+ const readline = await Promise.resolve().then(() => __importStar(require('readline')));
829
+ const rl = readline.createInterface({
830
+ input: process.stdin,
831
+ output: process.stderr,
832
+ });
833
+ const answer = await new Promise((resolve) => {
834
+ rl.question(`Using workspace: ${configFile.workspace}. Continue? [Y/n]: `, resolve);
835
+ });
836
+ rl.close();
837
+ if (answer.toLowerCase() === 'n') {
838
+ throw new errors_1.CliError('Cancelled. Use explicit org/agent or `orch workspace use <slug>`.');
839
+ }
840
+ // Save confirmation so we don't prompt again until workspace changes
841
+ configFile.workspace_confirmed = true;
842
+ await (0, config_1.saveConfig)(configFile);
843
+ }
844
+ }
823
845
  // Download agent definition with spinner
824
846
  const agentData = await (0, spinner_1.withSpinner)(`Downloading ${org}/${parsed.agent}@${parsed.version}...`, async () => {
825
847
  try {
@@ -85,6 +85,7 @@ async function useWorkspace(slug) {
85
85
  // Save to config
86
86
  const configFile = await (0, config_1.loadConfig)();
87
87
  configFile.workspace = slug;
88
+ delete configFile.workspace_confirmed;
88
89
  await (0, config_1.saveConfig)(configFile);
89
90
  await (0, analytics_1.track)('cli_workspace_use', { slug });
90
91
  process.stdout.write(chalk_1.default.green('\u2713') + ` Now using workspace: ${workspace.name} (${workspace.slug})\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orchagent/cli",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "description": "Command-line interface for the orchagent AI agent marketplace",
5
5
  "license": "MIT",
6
6
  "author": "orchagent <hello@orchagent.io>",