runcloud 0.2.139 → 0.2.140

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.
@@ -0,0 +1,50 @@
1
+ import { ApiClient, friendlyApiError } from "../api.js";
2
+ import { requireCredentials, resolveProject } from "../config.js";
3
+ export function registerAi(program) {
4
+ const ai = program
5
+ .command("ai")
6
+ .description("Manage runtime AI for a Newly Backend");
7
+ const client = () => {
8
+ const credentials = requireCredentials();
9
+ return new ApiClient(credentials.apiUrl, credentials.token);
10
+ };
11
+ const path = (project, env) => {
12
+ if (!["dev", "prod"].includes(env))
13
+ throw new Error("--env must be dev or prod");
14
+ return `/projects/${encodeURIComponent(resolveProject(process.cwd(), project))}/ai/${env}`;
15
+ };
16
+ ai.command("status")
17
+ .option("--project <id>")
18
+ .option("--env <environment>", "Backend environment", "dev")
19
+ .action(async (opts) => {
20
+ try {
21
+ console.log(JSON.stringify(await client().get(path(opts.project, opts.env)), null, 2));
22
+ }
23
+ catch (error) {
24
+ console.error(friendlyApiError(error));
25
+ process.exitCode = 1;
26
+ }
27
+ });
28
+ ai.command("enable")
29
+ .requiredOption("--models <ids>", "Comma-separated model IDs from ai status")
30
+ .option("--project <id>")
31
+ .option("--env <environment>", "Backend environment", "dev")
32
+ .action(async (opts) => {
33
+ try {
34
+ const api = client();
35
+ const url = path(opts.project, opts.env);
36
+ const models = String(opts.models)
37
+ .split(",")
38
+ .map((s) => s.trim())
39
+ .filter(Boolean);
40
+ await api.put(url, { enabled: true, models });
41
+ console.log("App AI enabled. Run newly deploy --env " +
42
+ opts.env +
43
+ " to connect backend access.");
44
+ }
45
+ catch (error) {
46
+ console.error(friendlyApiError(error));
47
+ process.exitCode = 1;
48
+ }
49
+ });
50
+ }
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { registerAi } from "./commands/ai.js";
2
3
  import { Command } from 'commander';
3
4
  import { registerLogin } from './commands/login.js';
4
5
  import { registerStatus } from './commands/status.js';
@@ -33,6 +34,7 @@ registerCreate(program);
33
34
  registerInit(program);
34
35
  registerPull(program);
35
36
  registerDeploy(program);
37
+ registerAi(program);
36
38
  registerMisc(program);
37
39
  registerStack(program);
38
40
  registerCreds(program);
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.139';
1
+ export const CLI_VERSION = '0.2.140';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.139",
3
+ "version": "0.2.140",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file