@solidactions/cli 3.35.0 → 3.36.0

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/README.md CHANGED
@@ -555,6 +555,18 @@ You do **not** need `--overwrite` to keep an edited file whose doc was deleted o
555
555
 
556
556
  **`doc pull` refuses to replace another folder's manifest.** If the destination already tracks a different folder, pulling into it would leave the previously tracked files untracked — and untracked files are not protected from being overwritten by a later pull. `pull` refuses (exit 1, before anything is written) and names both folders. Pull into a different directory, or pass `--overwrite` to replace the manifest anyway. This also covers the single-doc pull path, whose one-entry manifest would otherwise clobber a folder's.
557
557
 
558
+ ### app
559
+
560
+ | Command | Key Flags | Description |
561
+ |---------|-----------|-------------|
562
+ | `app preview <app>` | `--page <id>` | Print a one-time link that opens the app's dev copy in your own browser, no login |
563
+
564
+ `app preview` asks the server for a link and prints it on its own line. The CLI does not open a browser. The link opens the app's **dev copy** only (never production) as you, and only if you may deploy the app. It works once and must be opened within 60 seconds; the session ends after 3 minutes without use or 10 minutes in all, and you ask again for a new link when it ends. `--page <id>` opens one page of the app first (the page's numeric doc id).
565
+
566
+ If the dev copy shares a database with production, the command prints a warning naming the databases; the link is still issued. A refusal (the app is unknown, it has no dev copy, the page is not part of it, previews are switched off for the workspace, too many links asked for) prints a plain message and exits non-zero.
567
+
568
+ **For agents:** before calling an app change done, deploy it to dev (`solidactions project deploy <app> . -e dev`), run `solidactions app preview <app>`, open the link in your own browser and try the app (open pages, press buttons, fill forms).
569
+
558
570
  ### workspace
559
571
 
560
572
  | Command | Description |
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schema_version": 1,
3
3
  "cli_name": "solidactions",
4
- "cli_version": "3.35.0",
4
+ "cli_version": "3.36.0",
5
5
  "global_options": [
6
6
  {
7
7
  "flags": "-V, --version",
@@ -4871,6 +4871,93 @@
4871
4871
  ],
4872
4872
  "options": []
4873
4873
  },
4874
+ {
4875
+ "path": [
4876
+ "app"
4877
+ ],
4878
+ "name": "app",
4879
+ "aliases": [],
4880
+ "description": "Try an app before it ships",
4881
+ "hidden": false,
4882
+ "arguments": [],
4883
+ "options": [
4884
+ {
4885
+ "flags": "-h, --help",
4886
+ "long": "--help",
4887
+ "short": "-h",
4888
+ "description": "display help for command",
4889
+ "required": false,
4890
+ "value_required": false,
4891
+ "value_optional": false,
4892
+ "variadic": false,
4893
+ "negated": false,
4894
+ "hidden": false
4895
+ }
4896
+ ]
4897
+ },
4898
+ {
4899
+ "path": [
4900
+ "app",
4901
+ "preview"
4902
+ ],
4903
+ "name": "preview",
4904
+ "aliases": [],
4905
+ "description": "Print a one-time link that opens an app's dev copy in your own browser, no login",
4906
+ "hidden": false,
4907
+ "arguments": [
4908
+ {
4909
+ "name": "app",
4910
+ "required": true,
4911
+ "variadic": false,
4912
+ "description": "App name, or the slug of any of its environment rows"
4913
+ }
4914
+ ],
4915
+ "options": [
4916
+ {
4917
+ "flags": "--page <id>",
4918
+ "long": "--page",
4919
+ "short": null,
4920
+ "description": "Open this page first (the page's numeric doc id)",
4921
+ "required": false,
4922
+ "value_required": true,
4923
+ "value_optional": false,
4924
+ "variadic": false,
4925
+ "negated": false,
4926
+ "hidden": false
4927
+ },
4928
+ {
4929
+ "flags": "-h, --help",
4930
+ "long": "--help",
4931
+ "short": "-h",
4932
+ "description": "display help for command",
4933
+ "required": false,
4934
+ "value_required": false,
4935
+ "value_optional": false,
4936
+ "variadic": false,
4937
+ "negated": false,
4938
+ "hidden": false
4939
+ }
4940
+ ]
4941
+ },
4942
+ {
4943
+ "path": [
4944
+ "app",
4945
+ "help"
4946
+ ],
4947
+ "name": "help",
4948
+ "aliases": [],
4949
+ "description": "display help for command",
4950
+ "hidden": false,
4951
+ "arguments": [
4952
+ {
4953
+ "name": "command",
4954
+ "required": false,
4955
+ "variadic": false,
4956
+ "description": ""
4957
+ }
4958
+ ],
4959
+ "options": []
4960
+ },
4874
4961
  {
4875
4962
  "path": [
4876
4963
  "ai"
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.appPreview = appPreview;
7
+ const chalk_1 = __importDefault(require("chalk"));
8
+ const api_1 = require("../utils/api");
9
+ const connect_link_1 = require("../utils/connect-link");
10
+ const mcp_1 = require("../utils/mcp");
11
+ const output_1 = require("../utils/output");
12
+ function fail(line) {
13
+ (0, output_1.err)(line, chalk_1.default.red);
14
+ process.exit(1);
15
+ }
16
+ /** The doc id for --page, or null when it is not a positive whole number a JSON integer can hold. */
17
+ function parsePage(value) {
18
+ if (!/^[1-9][0-9]*$/.test(value))
19
+ return null;
20
+ const n = Number(value);
21
+ return Number.isSafeInteger(n) ? n : null;
22
+ }
23
+ async function appPreview(app, options) {
24
+ const project = app.trim();
25
+ if (project === '') {
26
+ fail('app preview: give the app name, e.g. solidactions app preview my-app.');
27
+ }
28
+ const args = { action: 'preview_link', project };
29
+ if (options.page !== undefined) {
30
+ const page = parsePage(options.page);
31
+ if (page === null) {
32
+ fail("app preview: --page needs a whole number (the page's doc id), e.g. --page 12.");
33
+ }
34
+ args.page = page;
35
+ }
36
+ const config = await (0, api_1.requireConfigWithWorkspace)();
37
+ let result;
38
+ try {
39
+ result = await (0, mcp_1.callProjectsSandbox)(config, args);
40
+ }
41
+ catch (error) {
42
+ fail(`error: ${error.message}`);
43
+ }
44
+ if (!result.ok) {
45
+ const refusal = result.data?.error ?? result.data ?? {};
46
+ const code = typeof refusal.code === 'string' ? refusal.code : '';
47
+ const message = typeof refusal.message === 'string' && refusal.message !== ''
48
+ ? refusal.message
49
+ : code !== '' ? code : 'the server refused the request';
50
+ (0, output_1.err)(`error: ${message}`, chalk_1.default.red);
51
+ if (code === 'no_dev_copy') {
52
+ (0, output_1.err)(`Deploy it to dev first: solidactions project deploy ${(0, connect_link_1.shellArg)(project)} . -e dev`, chalk_1.default.red);
53
+ }
54
+ else if (code === 'rate_limited' && typeof refusal.retry_after === 'number') {
55
+ (0, output_1.err)(`Try again in ${refusal.retry_after} seconds.`, chalk_1.default.red);
56
+ }
57
+ else if (code === 'invalid_action') {
58
+ (0, output_1.err)('This server may be older than the CLI expects: preview links need app v0.295.0 or later.', chalk_1.default.red);
59
+ }
60
+ process.exit(1);
61
+ }
62
+ const data = result.data ?? {};
63
+ if (typeof data.link !== 'string' || data.link === '') {
64
+ fail('Failed: the server answered without a preview link.');
65
+ }
66
+ (0, output_1.out)(`Preview link for ${project} (dev copy):`);
67
+ // Same style as the device-login URL: two-space indent, blue underline on the URL only (src/commands/device-login.ts).
68
+ (0, output_1.out)(' ' + data.link, (s) => ' ' + chalk_1.default.blue.underline(s.slice(2)));
69
+ if (typeof data.note === 'string' && data.note !== '') {
70
+ (0, output_1.out)(data.note);
71
+ }
72
+ if (data.shares_production_data === true) {
73
+ const names = Array.isArray(data.databases) && data.databases.length > 0
74
+ ? data.databases.filter((name) => typeof name === 'string').join(', ')
75
+ : 'unknown';
76
+ (0, output_1.out)(`Warning: this dev copy shares data with production (databases: ${names || 'unknown'}). What you press in the preview changes that data.`, chalk_1.default.yellow);
77
+ }
78
+ }
package/dist/index.js CHANGED
@@ -76,6 +76,7 @@ const oauth_action_platforms_1 = require("./commands/oauth-action-platforms");
76
76
  const connection_connect_1 = require("./commands/connection-connect");
77
77
  const connection_wait_1 = require("./commands/connection-wait");
78
78
  const connection_list_1 = require("./commands/connection-list");
79
+ const app_preview_1 = require("./commands/app-preview");
79
80
  const workspaces_1 = require("./commands/workspaces");
80
81
  const skill_push_1 = require("./commands/skill-push");
81
82
  const skill_publish_1 = require("./commands/skill-publish");
@@ -980,6 +981,26 @@ connection
980
981
  (0, connection_wait_1.connectionWait)(requestId, options);
981
982
  });
982
983
  // =============================================================================
984
+ // app <subcommand>
985
+ // =============================================================================
986
+ const app = exports.program.command('app').description('Try an app before it ships');
987
+ app
988
+ .command('preview')
989
+ .description("Print a one-time link that opens an app's dev copy in your own browser, no login")
990
+ .argument('<app>', 'App name, or the slug of any of its environment rows')
991
+ .option('--page <id>', "Open this page first (the page's numeric doc id)")
992
+ .addHelpText('after', `
993
+ The link opens the app's dev copy only, never production, as you. It works once and
994
+ must be opened within 60 seconds. The session ends after 3 minutes without use or
995
+ 10 minutes in all; ask again for a new link when it ends. The CLI does not open a browser.
996
+
997
+ For agents: before you call an app change done, run this, open the link in your own
998
+ browser and try the app on the dev copy (open pages, press buttons, fill forms).
999
+ Deploy to dev first: solidactions project deploy <app> . -e dev`)
1000
+ .action(async (appName, options) => {
1001
+ await (0, app_preview_1.appPreview)(appName, options);
1002
+ });
1003
+ // =============================================================================
983
1004
  // ai <subcommand>
984
1005
  // =============================================================================
985
1006
  const ai = exports.program.command('ai').description('AI helper tools');
package/dist/utils/mcp.js CHANGED
@@ -47,6 +47,7 @@ exports.McpRpcError = void 0;
47
47
  exports.retryAfterSeconds = retryAfterSeconds;
48
48
  exports.resolveCrewsCall = resolveCrewsCall;
49
49
  exports.callCrewsTool = callCrewsTool;
50
+ exports.callProjectsSandbox = callProjectsSandbox;
50
51
  exports.resolveDocsCall = resolveDocsCall;
51
52
  exports.callDocsTool = callDocsTool;
52
53
  exports.callCrewsToolContent = callCrewsToolContent;
@@ -254,6 +255,10 @@ async function callCrewsTool(config, toolName, args) {
254
255
  }
255
256
  return callMcpTool(config, UNIFIED_MCP_PATH, toolName, args);
256
257
  }
258
+ /** Call the projects_sandbox MCP tool (the app's dev-copy actions: exec, status, clear, promote, preview_link). */
259
+ async function callProjectsSandbox(config, args) {
260
+ return callMcpTool(config, UNIFIED_MCP_PATH, 'projects_sandbox', args);
261
+ }
257
262
  // Current catalog (solidactions-app ToolCatalog.php): the public docs tool depends on the action.
258
263
  // Call sites send the public action names, so only the tool is routed (no action/param renames).
259
264
  // Only actions the CLI actually sends are routed; anything else throws in resolveDocsCall.
@@ -104,6 +104,8 @@ exports.MUTATING_COMMANDS = new Set([
104
104
  'doc upload',
105
105
  // POSTs a connect-link request (a row the workspace counts against its open-link limit).
106
106
  'connection connect',
107
+ // Mints a preview session row (counts against the workspace's mint limit); the link itself changes nothing until it is opened.
108
+ 'app preview',
107
109
  ]);
108
110
  /** Space-joined command paths that do not mutate server state. */
109
111
  exports.READONLY_COMMANDS = new Set([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidactions/cli",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "description": "SolidActions CLI - Deploy and manage workflow automation",
5
5
  "main": "dist/index.js",
6
6
  "bin": {