@revoengine/cli 1.0.13 → 1.0.15
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 +26 -12
- package/dist/src/cli.js +4 -0
- package/dist/src/client.d.ts +5 -11
- package/dist/src/client.js +41 -74
- package/dist/src/commands/component.js +26 -25
- package/dist/src/commands/env.js +1 -5
- package/dist/src/commands/migrate.js +10 -0
- package/dist/src/commands/terminal-browser.d.ts +41 -6
- package/dist/src/commands/terminal-browser.js +503 -20
- package/dist/src/commands/terminal-image.js +59 -1
- package/dist/src/commands/terminal-operational-log.d.ts +18 -0
- package/dist/src/commands/terminal-operational-log.js +119 -0
- package/dist/src/commands/terminal-policy.d.ts +29 -0
- package/dist/src/commands/terminal-policy.js +67 -0
- package/dist/src/commands/terminal-pty.d.ts +4 -0
- package/dist/src/commands/terminal-pty.js +41 -0
- package/dist/src/commands/terminal-reconnect-grace.d.ts +30 -0
- package/dist/src/commands/terminal-reconnect-grace.js +87 -0
- package/dist/src/commands/terminal-sandbox.d.ts +5 -1
- package/dist/src/commands/terminal-sandbox.js +19 -5
- package/dist/src/commands/terminal-secure-browser.d.ts +25 -0
- package/dist/src/commands/terminal-secure-browser.js +58 -0
- package/dist/src/commands/terminal-service.d.ts +4 -3
- package/dist/src/commands/terminal-service.js +19 -15
- package/dist/src/commands/terminal.d.ts +22 -3
- package/dist/src/commands/terminal.js +622 -95
- package/dist/src/config.d.ts +0 -3
- package/dist/src/config.js +0 -2
- package/dist/src/migration.js +10 -11
- package/dist/src/request-queue.d.ts +20 -0
- package/dist/src/request-queue.js +80 -0
- package/dist/src/resource-inventory.js +9 -10
- package/dist/src/resource-syncs/database-view-sync.d.ts +0 -1
- package/dist/src/resource-syncs/database-view-sync.js +1 -12
- package/dist/src/resource-syncs/endpoint-sync.js +12 -46
- package/dist/src/types.d.ts +2 -0
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -77,16 +77,28 @@ revo terminal status
|
|
|
77
77
|
An approved terminal can run as a per-user background service on macOS or Linux. The service uses the active project at installation, or an explicit `--project <name>`; use the same project when uninstalling after a switch.
|
|
78
78
|
|
|
79
79
|
```bash
|
|
80
|
-
revo terminal service install --workspace "$HOME/projects/my-project"
|
|
81
|
-
revo terminal service uninstall --workspace "$HOME/projects/my-project"
|
|
82
|
-
revo terminal disconnect --workspace "$HOME/projects/my-project"
|
|
80
|
+
revo terminal service install --workspace "$HOME/projects/my-project" --name "Work Mac"
|
|
81
|
+
revo terminal service uninstall --workspace "$HOME/projects/my-project" --name "Work Mac"
|
|
82
|
+
revo terminal disconnect --workspace "$HOME/projects/my-project" --name "Work Mac"
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
The service starts at login, reconnects automatically, and pins the selected project profile at installation
|
|
85
|
+
Stop the foreground runner before installing its service. The service starts at login, reconnects automatically, and pins the selected terminal UUID and project profile at installation. Multiple terminals can share one machine and workspace when they have distinct names; pass the same `--name` to `connect`, `service install|uninstall`, and `disconnect`. Without `--name`, the CLI uses the machine hostname. If two registrations have the same name, the CLI refuses an ambiguous choice; use `revo terminal status` to find the UUID and pass `--terminal-id <uuid>`. A legacy workspace service must be uninstalled before installing a terminal-specific service. Uninstall stops the selected service but keeps its grant and local registration. `disconnect` revokes only the selected grant and removes its local credential; uninstall its service first. On macOS, service logs are in `~/Library/Logs/RevoEngine/`. On Linux, inspect them with `journalctl --user -u <unit-name>`; `install` prints the unit name. Linux user services normally stop after logout unless an administrator enables user lingering.
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
Runner credentials are stored in `runner.json` beside the CLI configuration. Each executed shell command writes raw output to a private `runner-logs/<executionId>.log` there, capped at 10 MB per file. Logs older than 24 hours are removed when the next command starts; a runner left idle does not perform timed cleanup. Optional CLI HTTP tracing writes sanitized request metadata under the project `.revoengine/logs/http-trace/`. These are separate from the Assistant's server-side tool history and do not form a complete local transcript. Treat runner logs as sensitive because command output may contain secrets.
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
Terminal connection and execution metadata is also written under the CLI configuration at `logs/terminal/<agentTerminalId>/debug.log`. Each line has `[ISO UTC timestamp][severity][assistantThreadId][assistantMessageId] event` followed by allowlisted metadata such as the execution ID, operation, sandbox, exit code, and reconnect delay. Commands, browser URLs, input, output, and credentials are excluded. On the first write after UTC midnight or after a restart, the completed day moves to `YYYY-MM-DD-debug.log.gz`; archives older than 30 days are removed. The log directory is private (`0700`) and files are `0600`. Runner/service stderr remains available for startup failures that occur before this operational log is ready.
|
|
90
|
+
|
|
91
|
+
The Agent terminal has independent command and network grants. Grants are ceilings; each execution frame carries the requested sandbox and `networkAccess=none|local|full`, so a Full grant does not silently widen a workspace or local-only call. Workspace commands keep writes inside the registered workspace and a private temporary directory; a workspace shell with external networking uses `workspace-network`. An explicit `unrestricted` command requests host file access without adding network access. A localhost development server must request Local network access to bind its port. macOS uses Seatbelt for workspace isolation and host plus local-only network; Linux uses `bwrap` and fails closed for shell Local access because enforceable localhost-only isolation is unavailable there. Missing isolation support fails closed. The runner requires a complete `terminal_policy_v2` execution frame from Realtime, including requested command/network modes, grant revision and optional expiry. New runners advertise `terminal_policy_selective_v1`: an increased grant takes effect on subsequent calls without disconnecting; a reduced grant stops only commands and Browser sessions no longer covered by the current grant or an unexpired temporary scope. Temporary scope expiry stops affected work and closes Browser sessions using that scope. Workspace patches and stdin for a running process are supported. A personal API key is required.
|
|
92
|
+
|
|
93
|
+
Browser actions use Playwright's Chromium headless shell. The CLI's npm install downloads that browser into Playwright's per-user cache without requiring Python 3; a separate Chrome installation is not required. If npm scripts were disabled or the download was interrupted, reinstall the CLI with scripts enabled before using Browser. Linux hosts still need Playwright's system libraries; an administrator can install them with `npx playwright install-deps chromium`.
|
|
94
|
+
|
|
95
|
+
The runner keeps a separate browser context for each connected assistant chat, so navigation, DOM inspection, clicks, form controls, waiting, scrolling, and screenshots share that chat's cookies and page state. It follows an SSO popup opened by a click or key press and returns to its opener when the popup closes. Browser sessions expire after 10 minutes idle (up to four per runner), on a Local or Full network lease expiry, or when the runner stops or its access is revoked. A one-time Browser network approval closes its context immediately after that action finishes. DOM results include bounded selector hints for interactive elements without their field values. The Browser action supports `fill`, `check`, `select`, `press`, `scroll`, and `wait_for` as well as navigation, DOM, and click. Ordinary `fill` rejects password and secret-like controls; the Assistant may request a one-time secure credential dialog, which encrypts the value to this runner and fills it in memory without sending it in model tool arguments. Screenshots can capture the viewport (default), the full page, one selected element, or a bounded viewport crop. For viewport capture, an optional selector limits only the returned DOM text; the image still covers the viewport. Element capture requires a selector. Full-page and crop capture reject selectors. A screenshot is uploaded and attached automatically; calling `save_image` on its local path uploads a second copy. For custom Playwright E2E scripts, run them as ordinary terminal commands in the project, using the requested sandbox and network grant; the Browser action does not execute arbitrary JavaScript.
|
|
96
|
+
|
|
97
|
+
Interactive PTY commands use the optional native `node-pty` package. An unavailable native build does not block CLI installation; PTY requests return `pty_unavailable` until the optional package can be installed. To skip native installation when PTY is not needed, install locally with `npm install --omit=optional @revoengine/cli` and run `npx revo`; npm 11.9 may still install the optional dependency during a global installation. On macOS, the runner verifies the spawn helper's executable permission when a PTY starts. Ordinary commands and local development servers run with pipes.
|
|
98
|
+
|
|
99
|
+
Local Browser mode filters HTTP and WebSocket requests and disables WebRTC, WebTransport, Worker and SharedWorker before page scripts. Worker-dependent pages may not work in this mode; Chromium is not enclosed in an OS network sandbox. A temporary Local or Full network lease closes the Browser context at expiry when the current permanent grant does not cover it, including before a queued secure credential fill. A lost WebSocket connection, a controlled Realtime restart, or a temporary dependency outage retains running processes and Browser contexts for one two-minute reconnect period; repeated failures do not renew it. Receiving `ready` alone does not reset that period while executions still await resume confirmation. Handshake, ready and execution resume each have a ten-second transport deadline. Access revocation and malformed runner frames stop the runner and its processes. Grant revision changes reject older execute frames and stop only work outside the remaining permanent or temporary scope. A network upgrade preserves the original temporary lease for a subsequent downgrade.
|
|
100
|
+
|
|
101
|
+
`save_image` validates the canonical path of the opened file descriptor and reads the image from that same descriptor (up to 30 MiB). It rejects the upload if the descriptor path cannot be verified, including when `lsof` is unavailable on macOS or `/proc/self/fd` cannot be resolved on Linux.
|
|
90
102
|
|
|
91
103
|
### Environment variables
|
|
92
104
|
|
|
@@ -132,7 +144,7 @@ Avoid putting tokens directly in shell history. Prefer environment variables for
|
|
|
132
144
|
|
|
133
145
|
### Cross-environment migration
|
|
134
146
|
|
|
135
|
-
Saved projects are required by `revo migrate --from/--to` and are also accepted through `--project` or the compatible `--env` alias. Examples use `source` and `target` for migration roles. Both may use the production API URL shown below, with separate API keys for their respective instances; the profile name itself does not select an API
|
|
147
|
+
Saved projects are required by `revo migrate --from/--to` and are also accepted through `--project` or the compatible `--env` alias. Examples use `source` and `target` for migration roles. Both may use the production API URL shown below, with separate API keys for their respective instances; the profile name itself does not select an API.
|
|
136
148
|
|
|
137
149
|
```bash
|
|
138
150
|
revo projects add source --url https://api.revoengine.com
|
|
@@ -140,9 +152,7 @@ revo projects add target --url https://api.revoengine.com
|
|
|
140
152
|
revo projects list
|
|
141
153
|
```
|
|
142
154
|
|
|
143
|
-
`projects add` prompts for an API key
|
|
144
|
-
|
|
145
|
-
A production profile requires an interactive confirmation before the first remote write in every invocation. `--yes`, `--force`, and non-interactive CI do not bypass this guard.
|
|
155
|
+
`projects add` prompts for an API key and validates the profile. Use `--token <apiKey>` to supply the key directly or `--offline` to skip validation. Remove an unused profile with `revo projects remove <name>`.
|
|
146
156
|
|
|
147
157
|
Runtime configuration precedence is:
|
|
148
158
|
|
|
@@ -222,6 +232,8 @@ revo pull \
|
|
|
222
232
|
|
|
223
233
|
`pull` requires either `--all` or `--resources`. It writes resources in dependency order and records the source baseline under the authenticated instance ID. Add `--skip-groups` to omit Group and Role Group resources from the selected scope.
|
|
224
234
|
|
|
235
|
+
Repository pull, plan, and deployment use Stable Keys for Component identity, including projects with a legacy UUID lock or no explicit `componentIdentity` setting. Pull reports resources without a Stable Key as unmanaged WIP and skips them while continuing with managed resources; `--force` does not assign missing keys or include WIP resources.
|
|
236
|
+
|
|
225
237
|
A normal pull protects locally changed files and does not remove source-deleted manifests. After review, `pull --force` replaces managed resource directories and prunes managed manifests that no longer exist on the source. Keep hand-written files outside generated resource directories.
|
|
226
238
|
|
|
227
239
|
### Review and deploy the repository
|
|
@@ -315,7 +327,7 @@ revo migrate plan --from source --to target --skip-groups
|
|
|
315
327
|
revo migrate run --from source --to target --skip-groups --yes
|
|
316
328
|
```
|
|
317
329
|
|
|
318
|
-
The migration model is source-wins upsert. Missing target resources are created and changed resources are updated. Target-only resources are reported as exclusions and are not deleted. A failed phase prevents all later phases from writing; earlier verified writes are not rolled back. Named migration includes Materialized View and access-group writes in its selected scope without the additional repository force gates; destructive column removal still requires `--force`.
|
|
330
|
+
The migration model is source-wins upsert. Missing target resources are created and changed resources are updated. Target-only resources are reported as exclusions and are not deleted. A failed phase prevents all later phases from writing; earlier verified writes are not rolled back. Named migration includes Materialized View and access-group writes in its selected scope without the additional repository force gates; destructive column removal still requires `--force`.
|
|
319
331
|
|
|
320
332
|
Plans project earlier phase results into later dependencies: a Schedule can plan against a Job Template or Materialized View that an earlier phase will create. After each phase verifies its writes, the next phase resolves the actual target UUIDs and versions again before writing. A failed readback stops subsequent phases; `verify` uses a fresh source pull to detect remaining changes.
|
|
321
333
|
|
|
@@ -337,6 +349,8 @@ Full pull, deployment, and migration use this fixed dependency order:
|
|
|
337
349
|
| 8 | `group` | `groups` | `Groups/` | Group owners use Stable Keys; users and memberships remain target-local. |
|
|
338
350
|
| 9 | `role-group` | `role-groups` | `RoleGroups/` | Role assignments run last; members and user identifiers remain target-local. |
|
|
339
351
|
|
|
352
|
+
Active Materialized View refresh Schedules are reported in Database View plans but do not block push, repository deployment, or named migration. Updating a view preserves Schedule activation; API write failures and readback verification failures are still reported.
|
|
353
|
+
|
|
340
354
|
`--resources all` selects all nine families. Singular, plural, and common compact aliases are accepted where the command parser documents them, but the selectors above are the canonical values.
|
|
341
355
|
|
|
342
356
|
Existing `database-schema` selectors and `revo database-schemas` commands remain accepted as compatibility aliases. New table manifests use `DatabaseTables/**/database-table.json`; older `DatabaseSchemas/**/database-schema.json` files remain readable and are relocated by the next successful table pull. A locally edited manifest still needs `--force` before pull replaces it. The manifest `kind` and `databaseSchemas` lock and plan keys retain their existing schema names for format compatibility.
|
|
@@ -470,7 +484,7 @@ Each enabled invocation writes `.revoengine/logs/http-trace/<timestamp>.json` an
|
|
|
470
484
|
|
|
471
485
|
Traces retain only known static API route segments, method, status, timing, payload byte counts, and diagnostic stage or resource labels. They omit URL origins and query strings, dynamic IDs and names, Stable Keys, profile names, headers, correlation values, bodies, error messages, and command arguments. An error contributes its class name only. This keeps credentials and instance-specific identifiers out of trace reports.
|
|
472
486
|
|
|
473
|
-
|
|
487
|
+
Each CLI invocation shares one queue of up to six active API requests across resource clients. An available slot starts the next waiting request, with queued POST, PUT, PATCH, and DELETE requests taking priority over reads. Waiting requests can be cancelled and expire after five minutes; the HTTP timeout starts when the first network attempt begins. Retry backoff releases the slot before the next attempt is queued. Endpoint and general resource inventories use order-preserving workers that refill free slots without batch barriers. Database View inventory deduplicates active list IDs, fetches complete details, excludes deleted readbacks, and sorts by ID. Failed detail reads fail the inventory instead of silently producing a partial snapshot. Streaming debug and terminal connections use separate transport paths.
|
|
474
488
|
|
|
475
489
|
Client requests default to no transport retries and there is no global retry flag. Database View detail reads opt into two retries, for up to three attempts. Opted-in requests can retry transport or response-read errors and HTTP 429, 502, 503, or 504; HTTP 500 is retried only for GET, HEAD, and OPTIONS. Aborted requests are not retried. Backoff starts at 100 ms with jitter, respects a bounded numeric `Retry-After`, and shares one request timeout across attempts. This opt-in behavior can also apply to mutations, so resource-specific write recovery still performs its own fresh live validation before retrying.
|
|
476
490
|
|
package/dist/src/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getActiveEnvironmentName } from "./config.js";
|
|
|
6
6
|
import { handleAuthCommand, handleComponentCommand, handleDatabaseTablesCommand, handleDatabaseViewsCommand, handleDeployCommand, handleDiffCommand, handleEndpointsCommand, handleEnvCommand, handleEventsCommand, handleGroupsCommand, handleInfoCommand, handleJobTemplatesCommand, handleMetadataCommand, handleMigrateCommand, handlePlanCommand, handlePullCommand, handleProjectCommand, handleRequestCommand, handleRoleGroupsCommand, handleSearchCommand, handleSchedulesCommand, handleTerminalCommand, } from "./commands/index.js";
|
|
7
7
|
import { createHttpTraceSession, finalizeHttpTraceSession, withHttpTraceSession, } from "./http-trace.js";
|
|
8
8
|
import { resolveProjectRoot } from "./project.js";
|
|
9
|
+
import { withRequestQueue } from "./request-queue.js";
|
|
9
10
|
import { buildRuntimeViewModel } from "./runtime-view.js";
|
|
10
11
|
import { renderHelp, renderOverview } from "./ui.js";
|
|
11
12
|
import { maybeNotifyUpdateAvailable } from "./update-notifier.js";
|
|
@@ -307,6 +308,9 @@ async function runMain(args, argv) {
|
|
|
307
308
|
throw new Error(`Unknown command: ${command}`);
|
|
308
309
|
}
|
|
309
310
|
export async function main(argv = process.argv.slice(2)) {
|
|
311
|
+
return withRequestQueue(() => runCommandWithTrace(argv));
|
|
312
|
+
}
|
|
313
|
+
async function runCommandWithTrace(argv) {
|
|
310
314
|
const args = parseArgs(argv);
|
|
311
315
|
const trace = configuredHttpTrace(args);
|
|
312
316
|
if (!trace) {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { RequestQueue } from './request-queue.ts';
|
|
1
2
|
import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord } from './types.ts';
|
|
2
3
|
export type RequestOptions = {
|
|
3
4
|
query?: Record<string, unknown>;
|
|
@@ -5,8 +6,9 @@ export type RequestOptions = {
|
|
|
5
6
|
headers?: HeadersInit;
|
|
6
7
|
authGuard?: boolean;
|
|
7
8
|
spinnerLabel?: string;
|
|
8
|
-
productionWrite?: boolean;
|
|
9
9
|
timeoutMs?: number;
|
|
10
|
+
queueTimeoutMs?: number;
|
|
11
|
+
signal?: AbortSignal;
|
|
10
12
|
/** Explicitly trusted service endpoint, such as the sandbox URL returned by /me. */
|
|
11
13
|
allowExternalOrigin?: boolean;
|
|
12
14
|
maxRetries?: number;
|
|
@@ -276,16 +278,11 @@ export type ClientOptions = {
|
|
|
276
278
|
token?: string;
|
|
277
279
|
envName?: string;
|
|
278
280
|
environmentName?: string;
|
|
279
|
-
production?: true;
|
|
280
281
|
fetch?: typeof fetch;
|
|
281
|
-
confirmProductionWrite?: (details: {
|
|
282
|
-
baseUrl: string;
|
|
283
|
-
method: string;
|
|
284
|
-
path: string;
|
|
285
|
-
}) => Promise<boolean>;
|
|
286
282
|
trustedServiceOrigins?: string[];
|
|
287
283
|
maxRetries?: number;
|
|
288
284
|
retryDelayMs?: number;
|
|
285
|
+
requestQueue?: RequestQueue;
|
|
289
286
|
};
|
|
290
287
|
export type ApiResponse<T = unknown> = {
|
|
291
288
|
status: number;
|
|
@@ -319,14 +316,12 @@ export declare class RevoClient {
|
|
|
319
316
|
baseUrl: string;
|
|
320
317
|
instance: string;
|
|
321
318
|
token: string;
|
|
322
|
-
production: boolean;
|
|
323
319
|
environmentName: string;
|
|
324
320
|
fetchImpl: typeof fetch | undefined;
|
|
325
|
-
private productionWriteConfirmed;
|
|
326
|
-
private confirmProductionWrite;
|
|
327
321
|
private trustedServiceOrigins;
|
|
328
322
|
private maxRetries;
|
|
329
323
|
private retryDelayMs;
|
|
324
|
+
private requestQueue;
|
|
330
325
|
constructor(options?: ClientOptions);
|
|
331
326
|
get authHeader(): string;
|
|
332
327
|
get authValidationKey(): string;
|
|
@@ -343,7 +338,6 @@ export declare class RevoClient {
|
|
|
343
338
|
profile: unknown;
|
|
344
339
|
}>;
|
|
345
340
|
request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
|
|
346
|
-
private assertProductionWriteConfirmed;
|
|
347
341
|
requestData<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
348
342
|
me(options?: {
|
|
349
343
|
force?: boolean;
|
package/dist/src/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setTimeout as waitForDelay } from 'node:timers/promises';
|
|
2
2
|
import { AUTH_VALIDATION_TTL_MS, buildAuthValidationKey, DEFAULT_BASE_URL, readAuthValidationState, resolveRuntimeConfig, saveAuthValidationState, } from "./config.js";
|
|
3
3
|
import { beginHttpTraceRequest, completeHttpTraceRequest, responseSize, } from "./http-trace.js";
|
|
4
|
-
import {
|
|
4
|
+
import { currentRequestQueue, RequestQueue } from "./request-queue.js";
|
|
5
5
|
import { createSpinner } from "./spinner.js";
|
|
6
6
|
import { mapWithConcurrency } from "./utils.js";
|
|
7
7
|
export class ApiError extends Error {
|
|
@@ -262,12 +262,6 @@ function normalizeToken(token) {
|
|
|
262
262
|
}
|
|
263
263
|
return token.startsWith('Bearer ') ? token : `Bearer ${token}`;
|
|
264
264
|
}
|
|
265
|
-
async function confirmProductionWriteInTerminal(details) {
|
|
266
|
-
if (!isInteractiveTerminal()) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
return promptConfirm(`PRODUCTION: send ${details.method} ${details.path} to ${details.baseUrl}?`, false);
|
|
270
|
-
}
|
|
271
265
|
function defaultSpinnerLabel(method, path) {
|
|
272
266
|
const upperMethod = method.toUpperCase();
|
|
273
267
|
if (path === '/api/v1/me') {
|
|
@@ -411,26 +405,23 @@ export class RevoClient {
|
|
|
411
405
|
baseUrl;
|
|
412
406
|
instance;
|
|
413
407
|
token;
|
|
414
|
-
production;
|
|
415
408
|
environmentName;
|
|
416
409
|
fetchImpl;
|
|
417
|
-
productionWriteConfirmed = false;
|
|
418
|
-
confirmProductionWrite;
|
|
419
410
|
trustedServiceOrigins;
|
|
420
411
|
maxRetries;
|
|
421
412
|
retryDelayMs;
|
|
413
|
+
requestQueue;
|
|
422
414
|
constructor(options = {}) {
|
|
423
415
|
const config = resolveRuntimeConfig(options);
|
|
424
416
|
this.baseUrl = config.baseUrl;
|
|
425
417
|
this.instance = config.instance || '';
|
|
426
418
|
this.token = config.token;
|
|
427
|
-
this.production = options.production === true || config.production === true;
|
|
428
419
|
this.environmentName = options.environmentName || options.envName || '';
|
|
429
420
|
this.fetchImpl = options.fetch || globalThis.fetch;
|
|
430
|
-
this.confirmProductionWrite = options.confirmProductionWrite || confirmProductionWriteInTerminal;
|
|
431
421
|
this.trustedServiceOrigins = resolveTrustedServiceOrigins(options.trustedServiceOrigins);
|
|
432
422
|
this.maxRetries = options.maxRetries ?? 0;
|
|
433
423
|
this.retryDelayMs = options.retryDelayMs ?? 100;
|
|
424
|
+
this.requestQueue = options.requestQueue || currentRequestQueue() || new RequestQueue();
|
|
434
425
|
}
|
|
435
426
|
get authHeader() {
|
|
436
427
|
return normalizeToken(this.token);
|
|
@@ -499,9 +490,6 @@ export class RevoClient {
|
|
|
499
490
|
}
|
|
500
491
|
async request(method, path, options = {}) {
|
|
501
492
|
this.assertReady();
|
|
502
|
-
if (options.productionWrite !== false) {
|
|
503
|
-
await this.assertProductionWriteConfirmed(method, path);
|
|
504
|
-
}
|
|
505
493
|
if (options.authGuard !== false && path !== '/api/v1/me') {
|
|
506
494
|
await this.validateSession();
|
|
507
495
|
}
|
|
@@ -526,9 +514,10 @@ export class RevoClient {
|
|
|
526
514
|
text: options.spinnerLabel || defaultSpinnerLabel(method, path),
|
|
527
515
|
});
|
|
528
516
|
const abortController = options.timeoutMs === undefined ? undefined : new AbortController();
|
|
529
|
-
const
|
|
530
|
-
?
|
|
531
|
-
:
|
|
517
|
+
const signal = abortController && options.signal
|
|
518
|
+
? AbortSignal.any([abortController.signal, options.signal])
|
|
519
|
+
: abortController?.signal || options.signal;
|
|
520
|
+
let timeout;
|
|
532
521
|
const traceRequest = beginHttpTraceRequest({
|
|
533
522
|
method,
|
|
534
523
|
url,
|
|
@@ -544,59 +533,54 @@ export class RevoClient {
|
|
|
544
533
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
545
534
|
if (attempt > 0) {
|
|
546
535
|
const backoff = baseRetryDelay * Math.pow(2, attempt - 1) + Math.floor(Math.random() * 25);
|
|
547
|
-
await delay(backoff,
|
|
536
|
+
await delay(backoff, signal);
|
|
548
537
|
}
|
|
549
|
-
await delay(REQUEST_DELAY_MS,
|
|
538
|
+
await delay(REQUEST_DELAY_MS, signal);
|
|
539
|
+
const stage = { value: 'queue' };
|
|
540
|
+
let failedResponse;
|
|
550
541
|
let response;
|
|
551
|
-
try {
|
|
552
|
-
response = await this.fetchImpl(url, {
|
|
553
|
-
method: normalizedMethod,
|
|
554
|
-
headers,
|
|
555
|
-
body: body,
|
|
556
|
-
redirect: 'manual',
|
|
557
|
-
...(abortController ? { signal: abortController.signal } : {}),
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
catch (error) {
|
|
561
|
-
lastError = error;
|
|
562
|
-
if (attempt < maxRetries && !abortController?.signal.aborted) {
|
|
563
|
-
continue;
|
|
564
|
-
}
|
|
565
|
-
completeHttpTraceRequest(traceRequest, { ok: false, error });
|
|
566
|
-
throw error;
|
|
567
|
-
}
|
|
568
|
-
try {
|
|
569
|
-
assertNoAuthenticatedRedirect(response);
|
|
570
|
-
}
|
|
571
|
-
catch (error) {
|
|
572
|
-
completeHttpTraceRequest(traceRequest, {
|
|
573
|
-
status: response.status,
|
|
574
|
-
ok: false,
|
|
575
|
-
responseHeaders: response.headers,
|
|
576
|
-
error,
|
|
577
|
-
});
|
|
578
|
-
throw error;
|
|
579
|
-
}
|
|
580
542
|
let data;
|
|
581
543
|
try {
|
|
582
|
-
data = await
|
|
544
|
+
({ response, data } = await this.requestQueue.run(async () => {
|
|
545
|
+
if (abortController && !timeout) {
|
|
546
|
+
timeout = setTimeout(() => abortController.abort(), options.timeoutMs);
|
|
547
|
+
}
|
|
548
|
+
stage.value = 'fetch';
|
|
549
|
+
const fetched = await this.fetchImpl(url, {
|
|
550
|
+
method: normalizedMethod,
|
|
551
|
+
headers,
|
|
552
|
+
body: body,
|
|
553
|
+
redirect: 'manual',
|
|
554
|
+
...(signal ? { signal } : {}),
|
|
555
|
+
});
|
|
556
|
+
failedResponse = fetched;
|
|
557
|
+
stage.value = 'redirect';
|
|
558
|
+
assertNoAuthenticatedRedirect(fetched);
|
|
559
|
+
stage.value = 'body';
|
|
560
|
+
return { response: fetched, data: await readResponseData(fetched) };
|
|
561
|
+
}, {
|
|
562
|
+
signal,
|
|
563
|
+
timeoutMs: options.queueTimeoutMs,
|
|
564
|
+
priority: ['POST', 'PUT', 'PATCH', 'DELETE'].includes(normalizedMethod) ? 'mutation' : 'read',
|
|
565
|
+
}));
|
|
583
566
|
}
|
|
584
567
|
catch (error) {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
568
|
+
if (stage.value === 'fetch' || stage.value === 'body') {
|
|
569
|
+
lastError = error;
|
|
570
|
+
if (attempt < maxRetries && !signal?.aborted) {
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
588
573
|
}
|
|
589
574
|
completeHttpTraceRequest(traceRequest, {
|
|
590
|
-
status:
|
|
575
|
+
...(failedResponse ? { status: failedResponse.status, responseHeaders: failedResponse.headers } : {}),
|
|
591
576
|
ok: false,
|
|
592
|
-
responseHeaders: response.headers,
|
|
593
577
|
error,
|
|
594
578
|
});
|
|
595
579
|
throw error;
|
|
596
580
|
}
|
|
597
581
|
const isRetryableStatus = [429, 502, 503, 504].includes(response.status)
|
|
598
582
|
|| (response.status === 500 && ['GET', 'HEAD', 'OPTIONS'].includes(normalizedMethod));
|
|
599
|
-
if (!response.ok && response.status !== 304 && isRetryableStatus && attempt < maxRetries && !
|
|
583
|
+
if (!response.ok && response.status !== 304 && isRetryableStatus && attempt < maxRetries && !signal?.aborted) {
|
|
600
584
|
let retryAfterMs = 0;
|
|
601
585
|
const retryAfterHeader = response.headers.get('retry-after');
|
|
602
586
|
if (retryAfterHeader) {
|
|
@@ -606,7 +590,7 @@ export class RevoClient {
|
|
|
606
590
|
}
|
|
607
591
|
}
|
|
608
592
|
if (retryAfterMs > 0) {
|
|
609
|
-
await delay(Math.min(5000, retryAfterMs),
|
|
593
|
+
await delay(Math.min(5000, retryAfterMs), signal);
|
|
610
594
|
}
|
|
611
595
|
continue;
|
|
612
596
|
}
|
|
@@ -664,21 +648,6 @@ export class RevoClient {
|
|
|
664
648
|
spinner.stop();
|
|
665
649
|
}
|
|
666
650
|
}
|
|
667
|
-
async assertProductionWriteConfirmed(method, path) {
|
|
668
|
-
const normalizedMethod = method.toUpperCase();
|
|
669
|
-
if (!this.production || this.productionWriteConfirmed || !['POST', 'PUT', 'PATCH', 'DELETE'].includes(normalizedMethod)) {
|
|
670
|
-
return;
|
|
671
|
-
}
|
|
672
|
-
const confirmed = await this.confirmProductionWrite({
|
|
673
|
-
baseUrl: this.baseUrl,
|
|
674
|
-
method: normalizedMethod,
|
|
675
|
-
path,
|
|
676
|
-
});
|
|
677
|
-
if (!confirmed) {
|
|
678
|
-
throw new Error('Production write cancelled. Confirm the operation in an interactive terminal.');
|
|
679
|
-
}
|
|
680
|
-
this.productionWriteConfirmed = true;
|
|
681
|
-
}
|
|
682
651
|
async requestData(method, path, options = {}) {
|
|
683
652
|
const response = await this.request(method, path, options);
|
|
684
653
|
return response.data;
|
|
@@ -936,7 +905,6 @@ export class RevoClient {
|
|
|
936
905
|
try {
|
|
937
906
|
return await this.requestData('POST', '/api/v1/databases/views/preview', {
|
|
938
907
|
body,
|
|
939
|
-
productionWrite: false,
|
|
940
908
|
spinnerLabel: 'Previewing Database View',
|
|
941
909
|
timeoutMs: 30_000,
|
|
942
910
|
});
|
|
@@ -1070,7 +1038,6 @@ export class RevoClient {
|
|
|
1070
1038
|
}
|
|
1071
1039
|
async *debugComponentStream(requestPath, body) {
|
|
1072
1040
|
this.assertReady();
|
|
1073
|
-
await this.assertProductionWriteConfirmed('POST', requestPath);
|
|
1074
1041
|
await this.validateSession();
|
|
1075
1042
|
const url = buildUrl(this.baseUrl, requestPath);
|
|
1076
1043
|
assertCredentialDestination(this.baseUrl, url, true, this.trustedServiceOrigins);
|
|
@@ -200,7 +200,11 @@ function getProjectRoot(cwd) {
|
|
|
200
200
|
currentDir = path.dirname(currentDir);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function resolveComponentIdentity(
|
|
203
|
+
function resolveComponentIdentity(context) {
|
|
204
|
+
if (context.componentIdentity) {
|
|
205
|
+
return context.componentIdentity;
|
|
206
|
+
}
|
|
207
|
+
const { cwd } = context;
|
|
204
208
|
const metadata = readProjectMetadata(cwd);
|
|
205
209
|
if (metadata) {
|
|
206
210
|
return readProjectComponentIdentity(cwd);
|
|
@@ -279,7 +283,7 @@ function findComponentManifestsById(cwd, componentId) {
|
|
|
279
283
|
});
|
|
280
284
|
}
|
|
281
285
|
function findComponentManifestsByTarget(cwd, target) {
|
|
282
|
-
const identity = resolveComponentIdentity(cwd);
|
|
286
|
+
const identity = resolveComponentIdentity({ cwd });
|
|
283
287
|
const matches = findComponentManifestsById(cwd, target);
|
|
284
288
|
if (identity.mode !== 'stableKey') {
|
|
285
289
|
return matches;
|
|
@@ -648,8 +652,9 @@ function findLocalEntryForRemote(remote, localCatalog) {
|
|
|
648
652
|
}
|
|
649
653
|
return idMatch;
|
|
650
654
|
}
|
|
651
|
-
function upsertLockFromRemote(
|
|
652
|
-
const
|
|
655
|
+
function upsertLockFromRemote(context, remote, targetPath, local, environmentName) {
|
|
656
|
+
const { cwd } = context;
|
|
657
|
+
const identity = resolveComponentIdentity(context);
|
|
653
658
|
const remoteComponentId = componentIdOf(remote);
|
|
654
659
|
const localComponentId = componentIdOf(local || remote);
|
|
655
660
|
const identityKey = readComponentIdentityValue(remote, identity);
|
|
@@ -676,7 +681,7 @@ function upsertLockFromRemote(cwd, remote, targetPath, local, environmentName) {
|
|
|
676
681
|
pulledAt: new Date().toISOString(),
|
|
677
682
|
}, identity, environmentName);
|
|
678
683
|
}
|
|
679
|
-
function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalog(cwd, resolveComponentIdentity(cwd)), environmentName) {
|
|
684
|
+
function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalog(cwd, resolveComponentIdentity({ cwd })), environmentName) {
|
|
680
685
|
const identity = localCatalog.identity;
|
|
681
686
|
const remoteTargetPath = componentTargetPath(cwd, remote);
|
|
682
687
|
const identityKey = readComponentIdentityValue(remote, identity);
|
|
@@ -684,7 +689,7 @@ function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalo
|
|
|
684
689
|
return {
|
|
685
690
|
kind: 'skip',
|
|
686
691
|
targetPath: remoteTargetPath,
|
|
687
|
-
reason: `missing ${identityDescription(identity)}; unmanaged`,
|
|
692
|
+
reason: `missing ${identityDescription(identity)}; unmanaged WIP`,
|
|
688
693
|
};
|
|
689
694
|
}
|
|
690
695
|
const local = findLocalEntryForRemote(remote, localCatalog);
|
|
@@ -854,7 +859,7 @@ async function resolveRemoteComponentForTarget(context, target, identity, remote
|
|
|
854
859
|
}
|
|
855
860
|
async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
856
861
|
const { cwd, println } = context;
|
|
857
|
-
const identity = resolveComponentIdentity(
|
|
862
|
+
const identity = resolveComponentIdentity(context);
|
|
858
863
|
const componentId = componentIdOf(component);
|
|
859
864
|
const decision = buildPullDecision(cwd, component, localCatalog || buildLocalComponentCatalog(cwd, identity), context.componentEnvironment);
|
|
860
865
|
if (decision.kind === 'skip' && decision.reason.includes('; unmanaged')) {
|
|
@@ -918,7 +923,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
|
918
923
|
const localComponent = decision.manifestPath
|
|
919
924
|
? readWorkspaceComponentSafe(decision.manifestPath) || decision.localComponent
|
|
920
925
|
: decision.localComponent;
|
|
921
|
-
upsertLockFromRemote(
|
|
926
|
+
upsertLockFromRemote(context, component, decision.targetPath, localComponent, context.componentEnvironment);
|
|
922
927
|
}
|
|
923
928
|
const result = {
|
|
924
929
|
status: metadataUpdated ? 'pulled' : 'skipped',
|
|
@@ -958,7 +963,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
|
958
963
|
}
|
|
959
964
|
const manifestPath = path.join(folder, 'component.json');
|
|
960
965
|
const localComponent = readWorkspaceComponentSafe(manifestPath) || decision.localComponent;
|
|
961
|
-
upsertLockFromRemote(
|
|
966
|
+
upsertLockFromRemote(context, component, targetPath, localComponent, context.componentEnvironment);
|
|
962
967
|
const result = {
|
|
963
968
|
status: 'pulled',
|
|
964
969
|
targetPath,
|
|
@@ -975,7 +980,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
|
975
980
|
return result;
|
|
976
981
|
}
|
|
977
982
|
async function pullSingleComponent(context, target, mode = { force: false, stale: false }) {
|
|
978
|
-
const identity = resolveComponentIdentity(context
|
|
983
|
+
const identity = resolveComponentIdentity(context);
|
|
979
984
|
let remoteCatalog;
|
|
980
985
|
let localCatalog;
|
|
981
986
|
if (identity.mode === 'stableKey'
|
|
@@ -1015,13 +1020,9 @@ export async function pullAllComponents(context, options) {
|
|
|
1015
1020
|
context.println('No components found.');
|
|
1016
1021
|
return [];
|
|
1017
1022
|
}
|
|
1018
|
-
const identity = resolveComponentIdentity(context
|
|
1023
|
+
const identity = resolveComponentIdentity(context);
|
|
1019
1024
|
const remoteCatalog = await buildRemoteComponentCatalog(context, identity, components);
|
|
1020
1025
|
const managedCount = remoteCatalog.byIdentity.size;
|
|
1021
|
-
if (managedCount === 0 && options.pruneOrphans !== true) {
|
|
1022
|
-
context.println(`No components managed by ${identityDescription(identity)} were found.`);
|
|
1023
|
-
return [];
|
|
1024
|
-
}
|
|
1025
1026
|
await confirmBulkAction(context, 'pull', identity.mode === 'componentId'
|
|
1026
1027
|
? discoveredTotal ?? (components.length >= COMPONENT_LIST_PAGE_SIZE ? `at least ${components.length} components` : components.length)
|
|
1027
1028
|
: managedCount, options.force || options.yes);
|
|
@@ -1130,7 +1131,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1130
1131
|
const component = readWorkspaceComponent(manifestPath);
|
|
1131
1132
|
const localComponentId = componentIdOf(component);
|
|
1132
1133
|
const targetPath = componentWorkspacePath(context.cwd, manifestPath);
|
|
1133
|
-
const identity = resolveComponentIdentity(context
|
|
1134
|
+
const identity = resolveComponentIdentity(context);
|
|
1134
1135
|
const identityKey = readComponentIdentityValue(component, identity);
|
|
1135
1136
|
if (!localComponentId) {
|
|
1136
1137
|
throw new Error(`Missing componentId in ${manifestPath}.`);
|
|
@@ -1180,7 +1181,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1180
1181
|
});
|
|
1181
1182
|
throw new Error(`Cannot push ${targetPath}: created component did not verify against local source. Diagnostic: ${logPath}`);
|
|
1182
1183
|
}
|
|
1183
|
-
upsertLockFromRemote(context
|
|
1184
|
+
upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
|
|
1184
1185
|
const result = { status: 'deployed', targetPath };
|
|
1185
1186
|
printSyncStatus(println, { status: 'Deployed', direction: 'push', targetPath });
|
|
1186
1187
|
return result;
|
|
@@ -1212,7 +1213,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1212
1213
|
const remoteHash = componentSourceHash(remote, identity);
|
|
1213
1214
|
const localHash = componentSourceHash(component, identity);
|
|
1214
1215
|
if (context.componentEnvironment && localHash === remoteHash) {
|
|
1215
|
-
upsertLockFromRemote(context
|
|
1216
|
+
upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
|
|
1216
1217
|
const result = {
|
|
1217
1218
|
status: 'skipped',
|
|
1218
1219
|
targetPath,
|
|
@@ -1235,7 +1236,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1235
1236
|
const localHash = componentSourceHash(component, identity);
|
|
1236
1237
|
if (remoteHash !== lockEntry.remoteHash) {
|
|
1237
1238
|
if (localHash === remoteHash) {
|
|
1238
|
-
upsertLockFromRemote(context
|
|
1239
|
+
upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
|
|
1239
1240
|
const result = {
|
|
1240
1241
|
status: 'skipped',
|
|
1241
1242
|
targetPath,
|
|
@@ -1276,7 +1277,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1276
1277
|
targetPath,
|
|
1277
1278
|
reason: 'no changes',
|
|
1278
1279
|
};
|
|
1279
|
-
upsertLockFromRemote(context
|
|
1280
|
+
upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
|
|
1280
1281
|
printSyncStatus(println, {
|
|
1281
1282
|
status: 'Skipped',
|
|
1282
1283
|
direction: 'push',
|
|
@@ -1361,7 +1362,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1361
1362
|
});
|
|
1362
1363
|
throw new Error(`Cannot push ${targetPath}: updated component did not verify against local source. Diagnostic: ${logPath}`);
|
|
1363
1364
|
}
|
|
1364
|
-
upsertLockFromRemote(context
|
|
1365
|
+
upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
|
|
1365
1366
|
if (!configurationChanged && !elementsChanged) {
|
|
1366
1367
|
const result = {
|
|
1367
1368
|
status: 'skipped',
|
|
@@ -1425,7 +1426,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1425
1426
|
export async function pushAllComponents(context, options) {
|
|
1426
1427
|
const { cwd, println } = context;
|
|
1427
1428
|
const root = getWorkspaceRoot(cwd);
|
|
1428
|
-
const identity = resolveComponentIdentity(
|
|
1429
|
+
const identity = resolveComponentIdentity(context);
|
|
1429
1430
|
const prunePlan = options.prune ? await buildComponentPlan(context, undefined, false, true) : null;
|
|
1430
1431
|
const pruneCandidates = prunePlan?.items.filter((item) => item.status === 'delete') || [];
|
|
1431
1432
|
const pruneBlockers = prunePlan?.items.filter((item) => item.blocked && item.localHash === null) || [];
|
|
@@ -1560,7 +1561,7 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
|
|
|
1560
1561
|
const projectRoot = getProjectRoot(context.cwd);
|
|
1561
1562
|
const lock = readComponentLock(projectRoot);
|
|
1562
1563
|
const root = getWorkspaceRoot(context.cwd);
|
|
1563
|
-
const identity = resolveComponentIdentity(context
|
|
1564
|
+
const identity = resolveComponentIdentity(context);
|
|
1564
1565
|
const localCatalog = buildLocalComponentCatalog(context.cwd, identity, prune);
|
|
1565
1566
|
const { components } = await fetchAllComponentSummaries(context);
|
|
1566
1567
|
const remoteCatalog = await buildRemoteComponentCatalog(context, identity, components);
|
|
@@ -2049,7 +2050,7 @@ export async function handleComponentCommand(context) {
|
|
|
2049
2050
|
throw new Error('Component push --prune requires --yes --force.');
|
|
2050
2051
|
}
|
|
2051
2052
|
if (context.componentEnvironment && ['pull', 'plan', 'push'].includes(subcommand)) {
|
|
2052
|
-
const identity = resolveComponentIdentity(context
|
|
2053
|
+
const identity = resolveComponentIdentity(context);
|
|
2053
2054
|
if (identity.mode !== 'stableKey') {
|
|
2054
2055
|
throw new Error('Component sync with a named project requires componentIdentity.mode "stableKey". Configure it in .revoengine/revo.json before pulling from a named project.');
|
|
2055
2056
|
}
|
|
@@ -2133,7 +2134,7 @@ export async function handleComponentCommand(context) {
|
|
|
2133
2134
|
if (manifests.length === 0) {
|
|
2134
2135
|
throw new Error(`Unable to find local component for ${targets.join(', ')}.`);
|
|
2135
2136
|
}
|
|
2136
|
-
const identity = resolveComponentIdentity(context
|
|
2137
|
+
const identity = resolveComponentIdentity(context);
|
|
2137
2138
|
const hasManagedManifest = manifests.some((manifestPath) => (Boolean(readComponentIdentityValue(readWorkspaceComponent(manifestPath), identity))));
|
|
2138
2139
|
const remoteCatalog = identity.mode === 'stableKey' && hasManagedManifest
|
|
2139
2140
|
? await buildRemoteComponentCatalog(context, identity)
|
package/dist/src/commands/env.js
CHANGED
|
@@ -160,13 +160,11 @@ async function handleEnvAdd(context) {
|
|
|
160
160
|
await probe.validateSession({ force: true });
|
|
161
161
|
instance = probe.instance;
|
|
162
162
|
}
|
|
163
|
-
const production = await promptConfirm('Is this a production project?', existing?.production === true);
|
|
164
163
|
const existed = Boolean(existing);
|
|
165
164
|
saveEnvironmentProfile(name, {
|
|
166
165
|
baseUrl,
|
|
167
166
|
token,
|
|
168
167
|
...(instance ? { instance } : {}),
|
|
169
|
-
...(production ? { production: true } : {}),
|
|
170
168
|
}, { activate: true });
|
|
171
169
|
println(`${existed ? 'Updated' : 'Saved'} project "${name}" in ${getConfigDir()}.`);
|
|
172
170
|
println(`Active project: ${name}.`);
|
|
@@ -180,7 +178,6 @@ function handleEnvList(context) {
|
|
|
180
178
|
print(Object.fromEntries(Object.keys(profiles).sort().map((name) => [name, {
|
|
181
179
|
baseUrl: profiles[name].baseUrl,
|
|
182
180
|
instance: profiles[name].instance || null,
|
|
183
|
-
...(profiles[name].production ? { production: true } : {}),
|
|
184
181
|
tokenConfigured: Boolean(profiles[name].token),
|
|
185
182
|
}])));
|
|
186
183
|
return;
|
|
@@ -189,8 +186,7 @@ function handleEnvList(context) {
|
|
|
189
186
|
for (const name of names) {
|
|
190
187
|
const profile = name === DEFAULT_ENV_NAME ? defaultRuntime : profiles[name];
|
|
191
188
|
const instanceSuffix = profile.instance ? ` (instance ${profile.instance})` : '';
|
|
192
|
-
|
|
193
|
-
println(`${name === active ? '*' : ' '} ${paint(name.padEnd(16), ANSI.bold + ANSI.cyan)} ${profile.baseUrl}${instanceSuffix}${productionSuffix}`);
|
|
189
|
+
println(`${name === active ? '*' : ' '} ${paint(name.padEnd(16), ANSI.bold + ANSI.cyan)} ${profile.baseUrl}${instanceSuffix}`);
|
|
194
190
|
}
|
|
195
191
|
}
|
|
196
192
|
function handleEnvSet(context) {
|
|
@@ -584,6 +584,16 @@ export async function handlePullCommand(context) {
|
|
|
584
584
|
continue;
|
|
585
585
|
}
|
|
586
586
|
context.println(`${resource}: pulled ${summary.pulled}, pruned ${summary.pruned}, skipped ${summary.skipped}.`);
|
|
587
|
+
if (resource === 'component') {
|
|
588
|
+
for (const skipped of result.results.components || []) {
|
|
589
|
+
if (skipped.status !== 'skipped') {
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
printSyncStatus(context.println, {
|
|
593
|
+
status: 'Skipped', direction: 'pull', targetPath: skipped.targetPath, reason: skipped.reason,
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
}
|
|
587
597
|
if (resource === 'job-template') {
|
|
588
598
|
for (const skipped of result.results.jobTemplates?.skipped || []) {
|
|
589
599
|
printSyncStatus(context.println, {
|