@revoengine/cli 1.0.33 → 1.0.34
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/CHANGELOG.md +25 -0
- package/README.md +83 -6
- package/dist/src/argument-contract.d.ts +17 -0
- package/dist/src/argument-contract.js +359 -0
- package/dist/src/automation-contract.generated.d.ts +2 -2
- package/dist/src/automation-contract.generated.js +2 -2
- package/dist/src/cli.js +15 -13
- package/dist/src/client.d.ts +2 -0
- package/dist/src/client.js +22 -0
- package/dist/src/commands/agents.js +5 -1
- package/dist/src/commands/auth.js +2 -0
- package/dist/src/commands/component.js +34 -17
- package/dist/src/commands/database-tables.js +5 -1
- package/dist/src/commands/database-views.js +5 -1
- package/dist/src/commands/endpoints.js +5 -1
- package/dist/src/commands/env.js +5 -1
- package/dist/src/commands/events.js +5 -1
- package/dist/src/commands/groups.js +5 -1
- package/dist/src/commands/info.js +2 -0
- package/dist/src/commands/job-templates.js +5 -1
- package/dist/src/commands/metadata.js +2 -0
- package/dist/src/commands/migrate.d.ts +2 -2
- package/dist/src/commands/migrate.js +31 -7
- package/dist/src/commands/project.js +19 -14
- package/dist/src/commands/request.js +2 -0
- package/dist/src/commands/role-groups.js +5 -1
- package/dist/src/commands/schedules.js +5 -1
- package/dist/src/commands/search.js +2 -0
- package/dist/src/commands/service-accounts.js +5 -1
- package/dist/src/commands/studio.js +2 -0
- package/dist/src/commands/terminal-file-descriptor.d.ts +9 -0
- package/dist/src/commands/terminal-file-descriptor.js +39 -0
- package/dist/src/commands/terminal-file.js +41 -6
- package/dist/src/commands/terminal-image.js +3 -31
- package/dist/src/commands/terminal-process-group.d.ts +25 -0
- package/dist/src/commands/terminal-process-group.js +144 -0
- package/dist/src/commands/terminal.js +123 -40
- package/dist/src/commands/tests.js +2 -0
- package/dist/src/component-lock.d.ts +15 -1
- package/dist/src/component-lock.js +96 -10
- package/dist/src/env-sync.js +12 -6
- package/dist/src/migration.d.ts +7 -0
- package/dist/src/migration.js +39 -21
- package/dist/src/planning-snapshot.d.ts +3 -0
- package/dist/src/planning-snapshot.js +60 -2
- package/dist/src/project.d.ts +1 -0
- package/dist/src/project.js +7 -8
- package/dist/src/resource-syncs/agent-sync.js +76 -24
- package/dist/src/resource-syncs/database-table-sync.js +33 -22
- package/dist/src/resource-syncs/database-view-sync.js +41 -28
- package/dist/src/resource-syncs/endpoint-sync.js +90 -18
- package/dist/src/resource-syncs/event-sync.js +33 -14
- package/dist/src/resource-syncs/group-sync.js +21 -11
- package/dist/src/resource-syncs/job-template-sync.js +98 -37
- package/dist/src/resource-syncs/role-group-sync.js +22 -11
- package/dist/src/resource-syncs/schedule-sync.js +26 -11
- package/dist/src/resource-syncs/service-account-sync.js +22 -11
- package/dist/src/reviewed-plan.js +3 -0
- package/dist/src/runtime-view.js +2 -18
- package/dist/src/sync-omit-command.d.ts +6 -0
- package/dist/src/sync-omit-command.js +49 -0
- package/dist/src/sync-omit-write-fence.d.ts +10 -0
- package/dist/src/sync-omit-write-fence.js +134 -0
- package/dist/src/sync-omit.d.ts +59 -0
- package/dist/src/sync-omit.js +469 -0
- package/dist/src/ui.js +10 -5
- package/dist/src/update-notifier.d.ts +1 -1
- package/dist/src/update-notifier.js +2 -1
- package/dist/src/utils.js +46 -17
- package/dist/src/workspace-prune.js +11 -3
- package/dist/src/workspace-write-lock.d.ts +7 -0
- package/dist/src/workspace-write-lock.js +144 -0
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.34 — 2026-10-30
|
|
4
|
+
|
|
5
|
+
### Destination property preservation
|
|
6
|
+
|
|
7
|
+
- Added CLI-only `--omit` for all twelve tracked resource families across repository and dedicated pull/plan/push, deployment, named migration, and Component environment synchronization.
|
|
8
|
+
- Pull preserves selected properties from the existing local manifest; push/deploy preserves them from the target. Creates initialize omitted definition values from the source. `--force` continues to preserve omitted destination values.
|
|
9
|
+
- Supports nested dot paths, JSON Pointer, repeated flags and family-qualified paths. Arrays are atomic; unsupported, structural, identity and permission paths are rejected. Job input and Event legacy input aliases remain consistent.
|
|
10
|
+
- Keeps full local source integrity separate from managed comparisons and remote baselines. Updates verify preserved values, including absence and `null`; creates verify the complete source definition. Saved plans retain omission policy, source integrity and live target revision checks.
|
|
11
|
+
|
|
12
|
+
### CLI and terminal fixes
|
|
13
|
+
|
|
14
|
+
- Reject unknown options, missing values, conflicting aliases, ambiguous selectors and invalid booleans before executing the requested operation. Boolean values must be exactly `true` or `false`; bare and negated flags remain supported.
|
|
15
|
+
- Reject unsupported `--dry-run` on push/deploy and direct users to `plan`. Command help works without authentication. Command-specific `-t`/`-i` options no longer override API credentials or instance selection, and `--no-update-notifier` suppresses update checks correctly.
|
|
16
|
+
- Retain control of the terminal process group through cancellation, timeout and policy expiry, including after its leader exits. If cleanup cannot be confirmed, report uncertain execution instead of permitting automatic retry. Preserve buffered output in its original streams.
|
|
17
|
+
- Verify the opened workspace file before upload or image transport. Downloads retain the opened descriptor and check parent and temporary-file identities before committing.
|
|
18
|
+
- Protect workspace writes across CLI processes, reject stale lock snapshots, and replace JSON state atomically. Read-only plans and diffs remain available while another command holds the workspace write lock.
|
|
19
|
+
|
|
20
|
+
### Upgrade notes
|
|
21
|
+
|
|
22
|
+
- Remote mutations with `--omit` require a matching RevoEngine API whose fresh `/api/v1/me` response advertises `capabilities.atomicResourceUpdates: true`. Older APIs are rejected before writing; upgrading the CLI alone does not enable this server capability.
|
|
23
|
+
- Existing scripts that relied on ignored flags or values such as `--yes=0`, `--force=no` or `--activate=FALSE` must use supported options and boolean values.
|
|
24
|
+
- Legacy lock hashes and changes to omission ownership may require a fresh full pull and review, or the command's existing explicitly reviewed force/source-wins reconciliation. Properties that remain omitted stay destination-owned.
|
|
25
|
+
- Event and Schedule activation keeps its existing repository behavior: deployment preserves target activation and creates definitions inactive unless `--activate` is selected. Existing Studio and Browser server compatibility requirements remain unchanged.
|
package/README.md
CHANGED
|
@@ -10,9 +10,11 @@ The CLI has three main capabilities:
|
|
|
10
10
|
2. **Project migration** — plan, run, and verify a direct migration between two saved projects with `--from` and `--to`.
|
|
11
11
|
3. **Resource synchronization** — work with one supported resource family through its dedicated `pull`, `plan`, and `push` commands.
|
|
12
12
|
|
|
13
|
-
## Version 1.0.
|
|
13
|
+
## Version 1.0.34
|
|
14
14
|
|
|
15
|
-
This release
|
|
15
|
+
This release adds `--omit` to preserve selected destination properties during synchronization, stricter argument validation, terminal process cleanup, opened-file workspace checks, and protection against concurrent or interrupted workspace state writes. See the [1.0.34 changelog](CHANGELOG.md) for changes and upgrade requirements. Writes with `--omit` require the matching API capability `atomicResourceUpdates`; upgrading the CLI alone does not enable it.
|
|
16
|
+
|
|
17
|
+
Studio sessions/native tests require a backend with the Studio APIs; Live Preview and recording require matching Realtime/API/Gateway and frontend support. Updating the CLI alone does not enable these server features. Existing runner registration and older terminal/browser operations remain compatible with backends that filter unsupported capabilities.
|
|
16
18
|
|
|
17
19
|
Runtime packages include all compiled modules, including native test workspace capture, Browser helpers and subprocess workers. Central browser-profile support requires matching API/Realtime and frontend changes; it is capability-gated independently from the published CLI version.
|
|
18
20
|
|
|
@@ -213,7 +215,7 @@ background recording; failed local segments are retained without blindly replayi
|
|
|
213
215
|
the PUT. Matching API/Realtime and an upgraded runner are required. Provider challenges may
|
|
214
216
|
still reject automated browsing; no spoofed headers or challenge bypass is enabled.
|
|
215
217
|
|
|
216
|
-
`forget` requires
|
|
218
|
+
For explicit cleanup of an older local snapshot, `terminal browser-profile forget` requires its workspace and selected terminal, authenticates the actor with the current API profile, and removes only that local snapshot and Keychain key. It rejects a profile currently in use; close its browser or stop its runner first. Manage central profiles and their grants in Revo Vault. Forgetting a legacy local snapshot does not remove a Vault profile or revoke the website's server-side login.
|
|
217
219
|
|
|
218
220
|
`upload_file` and `download_file` stream an explicit authorized workspace file directly to/from GCS HTTPS signed/resumable URLs with permitted headers. Full network permission is required. WebSocket carries metadata only. Resumable uploads report committed offsets and partial completion; do not finalize a Storage upload before completion or blindly repeat an uncertain upload. Downloads commit atomically and do not overwrite unless explicitly requested. The stream's idle timeout is 90 seconds; grant expiry and runner lifetime still apply. Signed URLs/headers are credentials and must not be copied into logs or source files.
|
|
219
221
|
|
|
@@ -355,11 +357,11 @@ revo pull \
|
|
|
355
357
|
--yes
|
|
356
358
|
```
|
|
357
359
|
|
|
358
|
-
|
|
360
|
+
Select pull resources with `--all`, `--resources`, or positional family names. For example, `revo pull databases --omit=name --yes` pulls Database Tables while preserving names in existing local manifests. Pull 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.
|
|
359
361
|
|
|
360
362
|
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.
|
|
361
363
|
|
|
362
|
-
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.
|
|
364
|
+
A normal pull protects locally changed files and does not remove source-deleted manifests. With `--omit`, differences confined to omitted properties do not block the pull; those existing local values remain intact. After review, `pull --force` replaces managed resource directories and prunes managed manifests that no longer exist on the source. Omitted properties in retained manifests remain local even with `--force`. Keep hand-written files outside generated resource directories.
|
|
363
365
|
|
|
364
366
|
### Review and deploy the repository
|
|
365
367
|
|
|
@@ -520,7 +522,7 @@ Older Event manifests without `custom` must be refreshed with `revo events pull`
|
|
|
520
522
|
|
|
521
523
|
Event and Schedule manifests retain runtime `input` (a JSON object) and `inputMode` at the top level. Pull, plan, push, migration and readback verification include both fields. Supported modes are `override` (shallow overlay onto Job template input), `deep_override` (nested object overlay, replacing arrays and retaining null values), and `replace` (whole-input replacement, including clearing it with `{}`). The CLI migrates these definitions; the backend resolves the Job input. Unknown modes, null/scalar/array input and duplicate top-level/extension fields block writes, including with `--force`.
|
|
522
524
|
|
|
523
|
-
Previously pulled Event manifests with `extensions.input` and `extensions.inputMode` remain accepted; only those extension fields are writable. A fresh pull writes them at the top level. Old Event lock hashes are recognized using the complete live input values, so they cannot hide remote drift. Other extension fields still block deployment.
|
|
525
|
+
Previously pulled Event manifests with `extensions.input` and `extensions.inputMode` remain accepted; only those extension fields are writable. A fresh pull writes them at the top level. With `--omit`, both layouts share runtime ownership and pulls retain the existing destination layout while refreshing managed nested siblings. Omitting all `extensions` also preserves runtime input and mode. Old Event lock hashes are recognized using the complete live input values, so they cannot hide remote drift. Other extension fields still block deployment.
|
|
524
526
|
|
|
525
527
|
Omitted fields mean `input: {}` and `inputMode: "override"` in the CLI's desired definition, including updates. Older Schedule pulls did not export these fields: re-pull from the source before promotion if that source uses nondefault automation input. A plan shows any difference from the target; approving an overwrite applies the manifest defaults. Regenerate saved reviewed plans after updating the CLI because input and mode now participate in definition hashes.
|
|
526
528
|
|
|
@@ -650,6 +652,40 @@ revo component debug <componentId> --read-only=false
|
|
|
650
652
|
|
|
651
653
|
Use low-level `request` carefully; it bypasses the higher-level migration planner.
|
|
652
654
|
|
|
655
|
+
## Command arguments and local workspace safety
|
|
656
|
+
|
|
657
|
+
The next CLI release rejects unknown options, missing option values and unsupported
|
|
658
|
+
option combinations before authentication or execution. Boolean options accept a
|
|
659
|
+
bare flag, `--flag=true`, `--flag=false`, or `--no-flag`; explicit values must be
|
|
660
|
+
the lowercase strings `true` or `false`. Values such as `0`, `1`, `no`, `FALSE`
|
|
661
|
+
and empty strings are errors, and conflicting repeated options are rejected.
|
|
662
|
+
For example, use `--no-force` rather than `--force=no`.
|
|
663
|
+
|
|
664
|
+
Named migration commands accept `--dry-run` to follow their read-only plan flow;
|
|
665
|
+
`env apply` supports it too. Use the corresponding `plan` command to preview
|
|
666
|
+
dedicated pushes, and `revo plan` to preview `revo deploy`.
|
|
667
|
+
Passing `--dry-run` to an unsupported command is an error; it never authorizes a
|
|
668
|
+
write. `revo <command> --help` shows help without connecting or executing.
|
|
669
|
+
Conflicting aliases are rejected as well as repeated values. Terminal connection
|
|
670
|
+
commands do not accept a child command or hidden options after `--`; raw request
|
|
671
|
+
JSON and query values remain data.
|
|
672
|
+
|
|
673
|
+
Commands that modify a workspace or its baseline take an exclusive local project
|
|
674
|
+
lock. A second writer fails before making changes; finish the active command and
|
|
675
|
+
retry. Read-only plan and diff commands remain available. Locks from a confirmed
|
|
676
|
+
dead process can be reclaimed; a live or unverifiable owner is never evicted just
|
|
677
|
+
because time has passed. A stale baseline snapshot is rejected rather than
|
|
678
|
+
replacing updates from another process. JSON state is written through a private
|
|
679
|
+
temporary file and atomic replacement, retaining the previous valid file if the
|
|
680
|
+
write fails before replacement.
|
|
681
|
+
|
|
682
|
+
Project init/update excludes the transient `.revoengine/workspace-write.lock/`
|
|
683
|
+
directory from Git. Keep `revo.lock.json` under its existing repository policy;
|
|
684
|
+
the operational writer lock is separate from that baseline file.
|
|
685
|
+
|
|
686
|
+
These local safeguards are separate from the target API's optimistic version
|
|
687
|
+
checks and do not make a multi-resource deployment one remote transaction.
|
|
688
|
+
|
|
653
689
|
## HTTP diagnostics
|
|
654
690
|
|
|
655
691
|
Enable a per-invocation HTTP trace in `.revoengine/revo.lock.json`:
|
|
@@ -753,6 +789,47 @@ MCP URLs must use public HTTPS without embedded credentials, query or fragment.
|
|
|
753
789
|
Agent and Agent Plugin synchronization is upsert-only. Repository prune blocks deletion of either family; retained Agents and inline/registry plugin references also protect Components, Groups and Service Accounts from unsafe pruning. Existing Service Account synchronization remains unchanged, including target-local credentials and membership policy.
|
|
754
790
|
|
|
755
791
|
|
|
792
|
+
### Preserve destination properties with `--omit`
|
|
793
|
+
|
|
794
|
+
`--omit` is an invocation-only CLI policy for all twelve resource families. Use it with every repository and dedicated family `pull`, repository `diff`/`plan`/`deploy`, dedicated family `plan`/`push`, named `migrate plan`/`run`/`verify`, and Component `env diff`/`apply`. On pull, the destination is the existing local manifest: selected properties stay local while the other fields refresh from the remote resource. On push or deploy, selected properties stay on the remote target. Resource metadata does not configure omission.
|
|
795
|
+
|
|
796
|
+
```bash
|
|
797
|
+
revo pull databases --omit=name --yes
|
|
798
|
+
revo pull --all --omit='job-template:inputs,endpoint:options.input' --yes
|
|
799
|
+
revo job-templates pull --all --omit='inputs,options.retry.maxAttempts'
|
|
800
|
+
revo job-templates plan --all --omit='inputs,options.retry.maxAttempts'
|
|
801
|
+
revo job-templates push --all --yes --omit='inputs,options.retry.maxAttempts'
|
|
802
|
+
|
|
803
|
+
revo plan --prune --omit='job-template:inputs,endpoint:options.input' --out reviewed-plan.json
|
|
804
|
+
revo deploy --prune --yes --reviewed-plan reviewed-plan.json \
|
|
805
|
+
--omit='job-template:inputs,endpoint:options.input'
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
An unqualified path must be supported by every selected family. Qualify family-specific fields in a mixed workspace, as above; a misspelled, unsupported, or out-of-scope path fails before writes. `--omit=name` applies to every selected family. Comma-separated paths and repeated `--omit` flags combine. Use dot paths for ordinary keys or JSON Pointer for literal dots and slashes, for example `--omit='endpoint:/options/input/feature.flag'`. Arrays are atomic: omit their complete property; indexes and wildcards are rejected.
|
|
809
|
+
|
|
810
|
+
| Resource family | Configurable omission examples |
|
|
811
|
+
| --- | --- |
|
|
812
|
+
| `database-table`, `database-view` | `name`, `category`, `description`, `metadata.label` |
|
|
813
|
+
| `component` | `name`, `description` (alias of `desc`), `active`, `testConfig`, `metadata.label` |
|
|
814
|
+
| `job-template` | `name`, `category`, `description`, `timeout`, `inputs`, `options.retry.maxAttempts` |
|
|
815
|
+
| `endpoint` | `name`, `category`, `description`, `active`, `timeout`, `options.input.tenant` |
|
|
816
|
+
| `schedule` | `name`, `category`, `description`, `cron`, `timezone`, `input.tenant`, `inputMode` |
|
|
817
|
+
| `event` | `name`, `category`, `description`, `filter`, `input.tenant`, `inputMode` |
|
|
818
|
+
| `group`, `role-group` | `name`, `category`, `description`, `metadata.label` |
|
|
819
|
+
| `service-account` | `name`, `metadata.label` |
|
|
820
|
+
| `agent` | `name`, `description`, `definition.config.model`, `definition.policy.maxTicks` |
|
|
821
|
+
| `agent-plugin` | `name`, `category`, `description`, `active`, `definition.timeoutMs` |
|
|
822
|
+
|
|
823
|
+
The first pull of a resource seeds its complete remote definition, including properties named by `--omit`. Later pulls preserve those properties from the existing local manifest, including nested values and absent or `null` fields. Normal pulls still protect changes to managed local fields. `--force` replaces conflicting managed fields while preserving omitted local properties. The remote environment baseline records the incoming instance state; a separate full local source proof records the complete definition written to disk.
|
|
824
|
+
|
|
825
|
+
Omitted properties do not contribute to managed differences or content conflicts. Existing targets retain their current values when another managed property changes, including nested siblings and the distinction between absent and `null`. Unchanged Job/Endpoint option envelopes are left out of update requests. If an actual option change would normalize an ignored legacy missing/null field, the CLI rejects it before writing; align the target defaults or omit the complete `options` envelope. Whole Endpoint `options` omission also blocks a conflicting schema-binding change. `--force` still preserves these properties. New resources use complete source values as their initial configuration and verify the full source definition, including omitted properties; omission never supplies missing creation fields. Job `inputs` and `options.input` aliases share ownership, including when omitting all `options`. Plugin name omission covers both its display name and writable definition name. JSON reports expose the normalized omission policy.
|
|
826
|
+
|
|
827
|
+
Identity, resource kind, Stable Key metadata, whole metadata envelopes, versions, code, database structure, routes, dependency bindings, owners, execution principals, roles, members, and built-in credential bindings cannot be omitted. Automation activation continues to use `--activate`. Omission does not authorize pruning or relax identity, dependency, request validation, or current-version checks.
|
|
828
|
+
|
|
829
|
+
The CLI advertises `capabilities.syncOmit` in `revo --version --json`. Before a remote mutation with `--omit`, it requires a fresh target `/api/v1/me` response with `capabilities.atomicResourceUpdates: true`; older APIs are rejected before writing, even when authentication was cached. Install the matching API safeguards before enabling this option in delivery pipelines.
|
|
830
|
+
|
|
831
|
+
Lock baselines record versioned property digests without raw configuration values, allowing comparison under the same or a broader omission policy. A legacy hash alone cannot prove unchanged managed fields; an unavailable baseline is reported as drift rather than silently converted. Equal managed definitions can adopt or refresh a baseline. Removing or narrowing omission invalidates its previous proof, because formerly ignored values were target-owned. Establish a fresh full baseline through pull without `--omit` and review, or explicitly review reconciliation through the command's existing `--force` or source-wins deployment policy. These overrides can replace managed differences and still preserve every property that remains omitted. Keep the same omission policy when applying a saved reviewed plan. Reviewed deployment still fences live versions and target revisions, so a target change after review requires a fresh plan. It also fences complete managed source manifests, including source values that initialize new resources; changing an omitted local value after review requires a new plan.
|
|
832
|
+
|
|
756
833
|
### Deployment verification in 1.0.22
|
|
757
834
|
|
|
758
835
|
Portable comparison includes ordinary Component metadata and full structured Database Table / Materialized View index definitions (logical names, methods, expressions, predicates, ordering, null placement, collation, operator classes and included columns). Physical index names, resource IDs and backend-reserved metadata remain instance-local. Older table/view manifests that omitted index settings should be refreshed from the source before promotion.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ParsedArgs } from './types.ts';
|
|
2
|
+
/** Keep repetitions for validation without changing the public parsed argument shape. */
|
|
3
|
+
export declare function recordParsedOption(args: ParsedArgs, name: string, value: string | boolean): void;
|
|
4
|
+
export declare function readBooleanOption(args: ParsedArgs, names: readonly string[]): boolean;
|
|
5
|
+
/** Short options owned by a command never become authentication overrides. */
|
|
6
|
+
export declare function runtimeConnectionOverrides(args: ParsedArgs): {
|
|
7
|
+
baseUrl: string | undefined;
|
|
8
|
+
token: string | undefined;
|
|
9
|
+
instance: string | undefined;
|
|
10
|
+
envName: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** Pure preflight: no configuration, filesystem, authentication or network effects. */
|
|
13
|
+
export declare function validateCommandArguments(args: ParsedArgs, options?: {
|
|
14
|
+
allowHelp?: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
/** Terminal owns connection arguments only; a suffix after -- is not a child command. */
|
|
17
|
+
export declare function validateTerminalArguments(argv: string[]): string[];
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
const occurrences = new WeakMap();
|
|
2
|
+
/** Keep repetitions for validation without changing the public parsed argument shape. */
|
|
3
|
+
export function recordParsedOption(args, name, value) {
|
|
4
|
+
if (['_', '__proto__', 'prototype', 'constructor'].includes(name))
|
|
5
|
+
throw new Error(`Unknown option --${name}: reserved argument name.`);
|
|
6
|
+
const entries = occurrences.get(args) || [];
|
|
7
|
+
entries.push({ name, value });
|
|
8
|
+
occurrences.set(args, entries);
|
|
9
|
+
}
|
|
10
|
+
function booleanValue(name, value) {
|
|
11
|
+
if (value === true || value === 'true')
|
|
12
|
+
return true;
|
|
13
|
+
if (value === false || value === 'false')
|
|
14
|
+
return false;
|
|
15
|
+
throw new Error(`--${name} accepts only true or false (or a bare flag / --no-${name}).`);
|
|
16
|
+
}
|
|
17
|
+
export function readBooleanOption(args, names) {
|
|
18
|
+
const recorded = occurrences.get(args)?.filter(entry => names.includes(entry.name));
|
|
19
|
+
const entries = recorded?.length ? recorded : names.flatMap(name => {
|
|
20
|
+
const value = args[name];
|
|
21
|
+
return value === undefined ? [] : (Array.isArray(value) ? value : [value]).map(value => ({ name, value }));
|
|
22
|
+
});
|
|
23
|
+
const values = entries.map(entry => booleanValue(names[0], entry.value));
|
|
24
|
+
if (new Set(values).size > 1)
|
|
25
|
+
throw new Error(`Conflicting values for --${names[0]}. Specify one boolean value.`);
|
|
26
|
+
return values[0] ?? false;
|
|
27
|
+
}
|
|
28
|
+
function flags(kind, names) {
|
|
29
|
+
return Object.fromEntries(names.split(' ').filter(Boolean).map(name => [name, kind]));
|
|
30
|
+
}
|
|
31
|
+
const b = (names) => flags('boolean', names);
|
|
32
|
+
const v = (names) => flags('value', names);
|
|
33
|
+
const many = (names) => flags('values', names);
|
|
34
|
+
const runtime = v('url baseUrl instance i token t project env');
|
|
35
|
+
const output = b('json');
|
|
36
|
+
const all = b('all a');
|
|
37
|
+
const force = b('force f');
|
|
38
|
+
const yes = b('yes y');
|
|
39
|
+
const plan = { ...output, ...b('strict hints') };
|
|
40
|
+
const omit = many('omit');
|
|
41
|
+
const resources = many('resources resource tracked-resources trackedResources');
|
|
42
|
+
const stableKey = v('stable-key-name stableKeyName');
|
|
43
|
+
const changed = { ...b('changed changed-only'), ...v('base git-base') };
|
|
44
|
+
function shortTokenIsRuntime(args) {
|
|
45
|
+
return args._[0] !== 'search' && !(args._[0] === 'component' && args._[1] === 'debug');
|
|
46
|
+
}
|
|
47
|
+
function runtimeContract(args) {
|
|
48
|
+
if (args._[0] === 'terminal')
|
|
49
|
+
return args._[1] === 'service' ? v('project env') : v('url token instance project env');
|
|
50
|
+
const result = { ...runtime };
|
|
51
|
+
if (args._[0] === 'component')
|
|
52
|
+
delete result.i;
|
|
53
|
+
if (!shortTokenIsRuntime(args))
|
|
54
|
+
delete result.t;
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
/** Short options owned by a command never become authentication overrides. */
|
|
58
|
+
export function runtimeConnectionOverrides(args) {
|
|
59
|
+
const string = (name) => typeof args[name] === 'string' ? args[name] : undefined;
|
|
60
|
+
return {
|
|
61
|
+
baseUrl: string('url') ?? string('baseUrl'),
|
|
62
|
+
token: string('token') ?? (shortTokenIsRuntime(args) ? string('t') : undefined),
|
|
63
|
+
instance: string('instance') ?? (args._[0] !== 'component' ? string('i') : undefined),
|
|
64
|
+
envName: string('env'),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const aliases = [
|
|
68
|
+
['yes', 'y'], ['force', 'f'], ['all', 'a'], ['stale', 's'], ['changed', 'changed-only'],
|
|
69
|
+
['dry-run', 'dryRun'], ['skip-partitions', 'skipPartitions'], ['offline', 'o'],
|
|
70
|
+
['raw-debug', 'debug-raw', 'debug-payload'], ['help', 'h'], ['version', 'V'],
|
|
71
|
+
];
|
|
72
|
+
function actionContract(args) {
|
|
73
|
+
const command = args._[0] || '';
|
|
74
|
+
const action = args._[1] || '';
|
|
75
|
+
if (!command || command === 'info')
|
|
76
|
+
return command ? {} : {
|
|
77
|
+
...b('info help h version V'),
|
|
78
|
+
...(typeof args.i === 'string' && !['true', 'false'].includes(args.i) ? v('i') : b('i')),
|
|
79
|
+
...(readBooleanOption(args, ['version', 'V']) ? output : {}),
|
|
80
|
+
};
|
|
81
|
+
if (command === 'help')
|
|
82
|
+
return {};
|
|
83
|
+
if (command === 'version')
|
|
84
|
+
return output;
|
|
85
|
+
if (command === 'auth') {
|
|
86
|
+
if (action && !['login', 'logout', 'status', 'get', 'set', 'key'].includes(action))
|
|
87
|
+
throw new Error('Unknown auth command.');
|
|
88
|
+
return action === 'key' ? { ...v('file f'), ...b('offline o') } : {};
|
|
89
|
+
}
|
|
90
|
+
if (command === 'project') {
|
|
91
|
+
if (action && !['init', 'update', 'switch'].includes(action))
|
|
92
|
+
throw new Error(`Unknown project action "${action}". Use revo project init or update.`);
|
|
93
|
+
return { ...resources, ...stableKey, ...v('identity-mode identityMode'), ...(action === 'init' ? b('metadata-backfill') : {}) };
|
|
94
|
+
}
|
|
95
|
+
if (command === 'projects' || command === 'env') {
|
|
96
|
+
const selected = action || 'list';
|
|
97
|
+
if (!['add', 'list', 'set', 'remove', 'diff', 'apply'].includes(selected))
|
|
98
|
+
throw new Error(`Unknown projects command: ${selected}.`);
|
|
99
|
+
if (selected === 'add')
|
|
100
|
+
return b('offline');
|
|
101
|
+
if (selected === 'list')
|
|
102
|
+
return output;
|
|
103
|
+
if (['set', 'remove'].includes(selected))
|
|
104
|
+
return {};
|
|
105
|
+
return { ...output, ...v('from to'), ...many('key category'), ...resources, ...stableKey, ...omit, ...b('prune'),
|
|
106
|
+
...(selected === 'diff' ? b('strict') : { ...yes, ...force, ...b('dry-run dryRun') }) };
|
|
107
|
+
}
|
|
108
|
+
if (command === 'request')
|
|
109
|
+
return { ...v('method m path p body d'), ...many('query q') };
|
|
110
|
+
if (command === 'search')
|
|
111
|
+
return v('type t term componentType caseSensitive take skip');
|
|
112
|
+
if (command === 'metadata') {
|
|
113
|
+
if (action && !['plan', 'apply'].includes(action))
|
|
114
|
+
throw new Error('Unknown metadata command. Use plan or apply.');
|
|
115
|
+
return { ...output, ...resources, ...stableKey, ...b('force skip-partitions skipPartitions'), ...(action === 'apply' ? b('yes') : {}) };
|
|
116
|
+
}
|
|
117
|
+
if (command === 'studio') {
|
|
118
|
+
const selected = action || 'list';
|
|
119
|
+
if (selected === 'list')
|
|
120
|
+
return { ...output, ...v('status') };
|
|
121
|
+
if (['get', 'file'].includes(selected))
|
|
122
|
+
return output;
|
|
123
|
+
if (['diff', 'files', 'events', 'chat', 'search', 'preview-rebase', 'claims'].includes(selected))
|
|
124
|
+
return { ...output, ...v('afterCursor take q') };
|
|
125
|
+
if (!['create', 'promote', 'update', 'delete', 'review', 'release-claim', 'cancel-test', 'patch', 'attach', 'fork', 'test', 'freeze', 'commit', 'prepare', 'activate', 'rebase', 'share', 'participant', 'presence', 'claim', 'message', 'baseline', 'rollback'].includes(selected))
|
|
126
|
+
throw new Error(`Unknown Studio action: ${selected}.`);
|
|
127
|
+
return { ...output, ...v('body body-file operation-id'), ...(selected === 'patch' ? v('patch-file') : {}) };
|
|
128
|
+
}
|
|
129
|
+
if (command === 'tests') {
|
|
130
|
+
const selected = action || 'list';
|
|
131
|
+
if (!['list', 'run', 'resume', 'cancel'].includes(selected))
|
|
132
|
+
throw new Error(`Unknown tests action: ${selected}. Use list, run, resume or cancel.`);
|
|
133
|
+
if (selected === 'cancel')
|
|
134
|
+
return output;
|
|
135
|
+
if (selected === 'resume')
|
|
136
|
+
return { ...output, ...b('wait no-wait'), ...v('wait-timeout') };
|
|
137
|
+
return { ...output, ...b('remote'), ...v('workspace search'), ...(selected === 'run' ? {
|
|
138
|
+
...b('all wait no-wait'), ...many('suite'), ...v('timeout wait-timeout operation-id'),
|
|
139
|
+
} : {}) };
|
|
140
|
+
}
|
|
141
|
+
if (command === 'terminal') {
|
|
142
|
+
const selected = action || 'help';
|
|
143
|
+
if (!['connect', 'status', 'disconnect', 'service', 'browser-profile', 'help'].includes(selected))
|
|
144
|
+
throw new Error(`Unknown command: ${selected}`);
|
|
145
|
+
if (selected === 'service' && args._[2] && !['install', 'uninstall', 'help'].includes(args._[2]))
|
|
146
|
+
throw new Error('Use revo terminal service install|uninstall.');
|
|
147
|
+
if (selected === 'browser-profile' && args._[2] !== 'forget')
|
|
148
|
+
throw new Error('Use terminal browser-profile forget --browser-profile NAME.');
|
|
149
|
+
if (selected === 'help')
|
|
150
|
+
return b('help');
|
|
151
|
+
if (selected === 'status')
|
|
152
|
+
return b('help');
|
|
153
|
+
if (selected === 'connect')
|
|
154
|
+
return { ...v('workspace name terminal-id realtime-url browser-profile'), ...b('service-runner help') };
|
|
155
|
+
return { ...v('workspace name terminal-id'), ...b('help'), ...(['service', 'browser-profile'].includes(selected) ? v('browser-profile') : {}) };
|
|
156
|
+
}
|
|
157
|
+
if (['plan', 'diff', 'deploy', 'pull', 'migrate'].includes(command)) {
|
|
158
|
+
if (command === 'pull')
|
|
159
|
+
return { ...output, ...all, ...yes, ...force, ...many('resources resource'), ...b('skip-groups'), ...omit };
|
|
160
|
+
if (command === 'diff')
|
|
161
|
+
return { ...output, ...omit, ...b('activate prune with-stats'), ...force };
|
|
162
|
+
if (command === 'plan') {
|
|
163
|
+
if (action && action !== 'update')
|
|
164
|
+
throw new Error('Unknown plan command; use revo plan or revo plan update.');
|
|
165
|
+
return { ...plan, ...omit, ...b('activate prune changed'), ...force, ...v('out base from to'), ...many('resources resource'), ...b('with-stats') };
|
|
166
|
+
}
|
|
167
|
+
if (command === 'deploy')
|
|
168
|
+
return { ...output, ...omit, ...yes, ...force, ...b('activate prune async changed hints'), ...v('reviewed-plan base'), ...many('resources resource'), ...b('with-stats') };
|
|
169
|
+
if (action && !['plan', 'run', 'verify'].includes(action))
|
|
170
|
+
throw new Error(`Unknown migrate command: ${action}. Use plan, run or verify.`);
|
|
171
|
+
const effectivePlan = !action || action === 'plan' || readBooleanOption(args, ['dry-run']);
|
|
172
|
+
return { ...output, ...v('from to'), ...many('resources resource'), ...b('skip-groups with-stats dry-run prune'), ...force, ...omit,
|
|
173
|
+
...(effectivePlan ? v('out') : {}), ...(effectivePlan || action === 'verify' ? b('hints') : {}), ...(action === 'run' ? yes : {}) };
|
|
174
|
+
}
|
|
175
|
+
const family = ['component', 'database-tables', 'database-schemas', 'database-views', 'endpoints', 'job-templates', 'schedules', 'events', 'groups', 'role-groups', 'service-accounts', 'agents', 'agent-plugins'].includes(command);
|
|
176
|
+
if (!family)
|
|
177
|
+
throw new Error(`Unknown command: ${command}`);
|
|
178
|
+
const component = command === 'component';
|
|
179
|
+
const actions = component ? ['pull', 'pull-all', 'plan', 'push', 'push-all', 'debug'] : ['pull', 'plan', 'push'];
|
|
180
|
+
if (action && !actions.includes(action))
|
|
181
|
+
throw new Error(`Unknown ${command} command.`);
|
|
182
|
+
if (!action)
|
|
183
|
+
return {};
|
|
184
|
+
if (component && action === 'debug')
|
|
185
|
+
return { ...v('id i body d timeout t memory m'), ...b('read-only stream extra-libs no-extra-libs raw-debug debug-raw debug-payload') };
|
|
186
|
+
const result = { ...all, ...output, ...omit,
|
|
187
|
+
...(action === 'plan' ? plan : force),
|
|
188
|
+
...(['push', 'push-all'].includes(action) ? yes : {}),
|
|
189
|
+
};
|
|
190
|
+
if (component) {
|
|
191
|
+
Object.assign(result, action === 'plan' ? {} : many('id i'), b('prune'), ['plan', 'push', 'push-all'].includes(action) ? changed : {}, ['pull', 'pull-all'].includes(action) ? { ...yes, ...b('stale s') } : {});
|
|
192
|
+
if (action !== 'plan')
|
|
193
|
+
delete result.json;
|
|
194
|
+
}
|
|
195
|
+
if (['agents', 'agent-plugins'].includes(command))
|
|
196
|
+
delete result.hints;
|
|
197
|
+
if (['database-tables', 'database-schemas'].includes(command))
|
|
198
|
+
Object.assign(result, action === 'plan' ? b('with-stats skip-partitions') : { ...b('prune-orphans'), ...yes }, action === 'pull' ? b('strict') : {}, action === 'push' ? { ...b('prune-partitions async'), ...v('idempotency-key') } : {});
|
|
199
|
+
if (command === 'database-views' && action === 'pull')
|
|
200
|
+
Object.assign(result, b('strict'));
|
|
201
|
+
if (['schedules', 'events'].includes(command) && ['plan', 'push'].includes(action))
|
|
202
|
+
Object.assign(result, b('activate'));
|
|
203
|
+
// These handlers explicitly reject prune; recognize it so their diagnostic remains specific.
|
|
204
|
+
if (['agents', 'agent-plugins'].includes(command) || ['groups', 'role-groups', 'service-accounts'].includes(command) && action !== 'pull' || command === 'endpoints' && action === 'push')
|
|
205
|
+
Object.assign(result, b('prune'));
|
|
206
|
+
return result;
|
|
207
|
+
}
|
|
208
|
+
/** Pure preflight: no configuration, filesystem, authentication or network effects. */
|
|
209
|
+
export function validateCommandArguments(args, options = {}) {
|
|
210
|
+
if (args.omit !== undefined && !['plan', 'diff', 'deploy', 'pull', 'migrate', 'component', 'database-tables', 'database-schemas', 'database-views', 'job-templates', 'endpoints', 'schedules', 'events', 'groups', 'role-groups', 'service-accounts', 'agents', 'agent-plugins', 'env', 'projects'].includes(args._[0])) {
|
|
211
|
+
throw new Error('--omit is a synchronization option; it cannot change raw requests or other commands.');
|
|
212
|
+
}
|
|
213
|
+
const contract = { ...runtimeContract(args), ...b('update-notifier no-update-notifier'), ...actionContract(args),
|
|
214
|
+
...(options.allowHelp ? b('help h') : {}) };
|
|
215
|
+
if (args['dry-run'] !== undefined || args.dryRun !== undefined) {
|
|
216
|
+
const supported = args._[0] === 'migrate' || (['env', 'projects'].includes(args._[0]) && args._[1] === 'apply');
|
|
217
|
+
if (!supported)
|
|
218
|
+
throw new Error(`${args._.slice(0, 2).join(' ') || 'This command'} does not support --dry-run. Use revo plan or the resource plan command to review changes.`);
|
|
219
|
+
}
|
|
220
|
+
const recorded = occurrences.get(args);
|
|
221
|
+
const optionEntries = recorded?.length
|
|
222
|
+
? [...recorded.map(({ name, value }) => [name, value]), ...Object.entries(args).filter(([name]) => name !== '_' && !recorded.some(entry => entry.name === name))]
|
|
223
|
+
: Object.entries(args);
|
|
224
|
+
for (const [name, value] of optionEntries) {
|
|
225
|
+
if (name === '_')
|
|
226
|
+
continue;
|
|
227
|
+
const kind = Object.hasOwn(contract, name) ? contract[name] : undefined;
|
|
228
|
+
if (!kind)
|
|
229
|
+
throw new Error(`Unknown option --${name} for ${args._.slice(0, 2).join(' ') || 'overview'}. Run revo help.`);
|
|
230
|
+
if (kind === 'boolean')
|
|
231
|
+
continue;
|
|
232
|
+
const values = Array.isArray(value) ? value : [value];
|
|
233
|
+
if (values.some(value => typeof value !== 'string' || !value.trim()))
|
|
234
|
+
throw new Error(`--${name} requires a value.`);
|
|
235
|
+
if (kind === 'value' && (values.length > 1 || (recorded?.filter(entry => entry.name === name).length || 0) > 1))
|
|
236
|
+
throw new Error(`--${name} accepts one value.`);
|
|
237
|
+
}
|
|
238
|
+
const valueAliases = [
|
|
239
|
+
['url', 'baseUrl'], ['stable-key-name', 'stableKeyName'], ['identity-mode', 'identityMode'],
|
|
240
|
+
['method', 'm'], ['path', 'p'], ['body', 'd'], ['file', 'f'], ['base', 'git-base'],
|
|
241
|
+
...(shortTokenIsRuntime(args) ? [['token', 't']] : args._[0] === 'search' ? [['type', 't']] : [['timeout', 't']]),
|
|
242
|
+
...(args._[0] === 'component' ? args._[1] === 'debug' ? [['id', 'i'], ['memory', 'm']] : [] : [['instance', 'i']]),
|
|
243
|
+
];
|
|
244
|
+
for (const group of valueAliases) {
|
|
245
|
+
const supplied = group.filter(name => contract[name] === 'value' && args[name] !== undefined);
|
|
246
|
+
if (new Set(supplied.map(name => args[name])).size > 1)
|
|
247
|
+
throw new Error(`Conflicting values for ${supplied.map(name => `--${name}`).join(' and ')}.`);
|
|
248
|
+
}
|
|
249
|
+
// Main rejects dual profile flags; command contexts also carry the normalized env alias.
|
|
250
|
+
if (args.project !== undefined && args.env !== undefined && args.project !== args.env)
|
|
251
|
+
throw new Error('Use either --project or --env, not both.');
|
|
252
|
+
const visited = new Set();
|
|
253
|
+
for (const [name, kind] of Object.entries(contract)) {
|
|
254
|
+
if (kind !== 'boolean' || visited.has(name))
|
|
255
|
+
continue;
|
|
256
|
+
const group = aliases.find(group => group.includes(name))?.filter(alias => contract[alias] === 'boolean') || [name];
|
|
257
|
+
group.forEach(alias => visited.add(alias));
|
|
258
|
+
const value = readBooleanOption(args, group);
|
|
259
|
+
for (const alias of group)
|
|
260
|
+
if (args[alias] !== undefined)
|
|
261
|
+
args[alias] = value;
|
|
262
|
+
}
|
|
263
|
+
const [command, action] = args._;
|
|
264
|
+
if (command === 'deploy' && readBooleanOption(args, ['async']))
|
|
265
|
+
throw new Error('Full deploy waits for schema readiness and verified readback before dependent phases; use database-tables push <stableKey> --async for admission only.');
|
|
266
|
+
const positionalAliases = command === 'request'
|
|
267
|
+
? [[1, ['method', 'm'], true], [2, ['path', 'p']], [3, ['body', 'd']]]
|
|
268
|
+
: command === 'search' ? [[1, ['type', 't'], true], [2, ['term']]]
|
|
269
|
+
: command === 'component' && action === 'debug' ? [[2, ['id', 'i']], [3, ['body', 'd']]] : [];
|
|
270
|
+
for (const [index, names, uppercase] of positionalAliases) {
|
|
271
|
+
const positional = args._[index];
|
|
272
|
+
if (positional === undefined)
|
|
273
|
+
continue;
|
|
274
|
+
for (const name of names) {
|
|
275
|
+
const value = args[name];
|
|
276
|
+
if (typeof value === 'string' && (uppercase ? value.toUpperCase() !== positional.toUpperCase() : value !== positional))
|
|
277
|
+
throw new Error(`Conflicting positional value and --${name}. Choose one value.`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
if (command === 'terminal' && args.name !== undefined && args['terminal-id'] !== undefined)
|
|
281
|
+
throw new Error('Use either --name or --terminal-id, not both.');
|
|
282
|
+
let maximum;
|
|
283
|
+
if (['deploy', 'diff', 'info', 'help', 'version'].includes(command))
|
|
284
|
+
maximum = 1;
|
|
285
|
+
else if (command === 'plan')
|
|
286
|
+
maximum = action === 'update' ? 2 : 1;
|
|
287
|
+
else if (command === 'auth' || command === 'metadata' || command === 'migrate')
|
|
288
|
+
maximum = 2;
|
|
289
|
+
else if (command === 'project' || command === 'search')
|
|
290
|
+
maximum = 3;
|
|
291
|
+
else if (command === 'request')
|
|
292
|
+
maximum = 4;
|
|
293
|
+
else if (['env', 'projects'].includes(command))
|
|
294
|
+
maximum = ['add', 'set', 'remove'].includes(action) ? 3 : 2;
|
|
295
|
+
else if (command === 'tests' && action !== 'run')
|
|
296
|
+
maximum = ['resume', 'cancel'].includes(action) ? 3 : 2;
|
|
297
|
+
else if (command === 'studio')
|
|
298
|
+
maximum = ['file', 'review', 'release-claim', 'cancel-test'].includes(action) ? 4 : ['list', 'create', 'promote'].includes(action || 'list') ? 2 : 3;
|
|
299
|
+
else if (command === 'terminal')
|
|
300
|
+
maximum = ['service', 'browser-profile'].includes(action) ? 3 : 2;
|
|
301
|
+
else if (command === 'component' && action === 'debug')
|
|
302
|
+
maximum = 4;
|
|
303
|
+
else if (command === 'component' && action === 'plan')
|
|
304
|
+
maximum = 2;
|
|
305
|
+
else if (['database-tables', 'database-schemas', 'database-views'].includes(command))
|
|
306
|
+
maximum = action === 'push' ? 3 : 2;
|
|
307
|
+
else if (['endpoints', 'job-templates', 'schedules', 'events', 'groups', 'role-groups', 'service-accounts', 'agents', 'agent-plugins'].includes(command))
|
|
308
|
+
maximum = 2;
|
|
309
|
+
if (maximum !== undefined && args._.length > maximum)
|
|
310
|
+
throw new Error(`Unexpected positional argument for ${command}${action ? ` ${action}` : ''}. Run revo help.`);
|
|
311
|
+
if (command === 'endpoints' && action === 'push' && readBooleanOption(args, ['prune']))
|
|
312
|
+
throw new Error('Endpoint prune is disabled until a reviewed deletion contract is introduced.');
|
|
313
|
+
if (command === 'component' && ['pull', 'push', 'pull-all', 'push-all'].includes(action)) {
|
|
314
|
+
const ids = args.id !== undefined || args.i !== undefined;
|
|
315
|
+
const positionals = args._.length > 2;
|
|
316
|
+
if (ids && positionals || (ids || positionals) && (readBooleanOption(args, ['all', 'a']) || action.endsWith('-all')))
|
|
317
|
+
throw new Error('Choose one Component selector: positional identities, --id, or --all.');
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
/** Terminal owns connection arguments only; a suffix after -- is not a child command. */
|
|
321
|
+
export function validateTerminalArguments(argv) {
|
|
322
|
+
const args = { _: ['terminal'] };
|
|
323
|
+
const normalized = [];
|
|
324
|
+
for (let index = 0; index < argv.length; index++) {
|
|
325
|
+
const token = argv[index];
|
|
326
|
+
if (token === '--') {
|
|
327
|
+
if (index < argv.length - 1)
|
|
328
|
+
throw new Error('Unexpected positional argument after -- for terminal. Terminal commands do not accept a child command.');
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
if (!token.startsWith('-')) {
|
|
332
|
+
args._.push(token);
|
|
333
|
+
normalized.push(token);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (!token.startsWith('--'))
|
|
337
|
+
throw new Error(`Unknown option ${token} for terminal. Use long options.`);
|
|
338
|
+
const equal = token.indexOf('=');
|
|
339
|
+
const rawName = token.slice(2, equal < 0 ? undefined : equal);
|
|
340
|
+
if (rawName.startsWith('no-') && equal >= 0)
|
|
341
|
+
throw new Error('Negated terminal flags do not accept a value; use the bare --no-flag form.');
|
|
342
|
+
const name = rawName.startsWith('no-') ? rawName.slice(3) : rawName;
|
|
343
|
+
const bool = ['help', 'service-runner', 'update-notifier'].includes(name);
|
|
344
|
+
let value = rawName.startsWith('no-') ? false : equal >= 0 ? token.slice(equal + 1) : true;
|
|
345
|
+
if (equal < 0 && !rawName.startsWith('no-') && argv[index + 1] !== undefined && !argv[index + 1].startsWith('--'))
|
|
346
|
+
value = argv[++index];
|
|
347
|
+
recordParsedOption(args, name, value);
|
|
348
|
+
const previous = args[name];
|
|
349
|
+
args[name] = previous === undefined ? value : Array.isArray(previous) ? [...previous, String(value)] : [String(previous), String(value)];
|
|
350
|
+
if (bool) {
|
|
351
|
+
if (booleanValue(name, value))
|
|
352
|
+
normalized.push(`--${name}`);
|
|
353
|
+
}
|
|
354
|
+
else
|
|
355
|
+
normalized.push(`--${name}`, String(value));
|
|
356
|
+
}
|
|
357
|
+
validateCommandArguments(args);
|
|
358
|
+
return normalized;
|
|
359
|
+
}
|
|
@@ -738,11 +738,11 @@ export declare const requestContractSemanticSources: {
|
|
|
738
738
|
readonly "packages/platform-shared/src/utils/job-retry-policy.util.ts#assertJobRetryPolicyValid": "6511ccafc15233a4ffe4e024f13e6c0e5c9d8a53c261ecc571300495afd804cf";
|
|
739
739
|
readonly "packages/domain/src/dto/components/component.validator.ts#validateEndpointGuardSemantics": "fd885b48c2990e47d1f05965af044aef8e2256da5fa4a86d1248967b04a3fd1e";
|
|
740
740
|
readonly "apps/api/src/modules/endpoints/endpoint.service.ts#create": "cb10fc198892423088d396acd09618d8c64504a57fac0df3a892d57993913067";
|
|
741
|
-
readonly "apps/api/src/modules/endpoints/endpoint.service.ts#update": "
|
|
741
|
+
readonly "apps/api/src/modules/endpoints/endpoint.service.ts#update": "bc59acaffdb7275659bddb65b8d71e9d8266447054723ea87495eaa0dd512fe1";
|
|
742
742
|
readonly "apps/api/src/modules/endpoints/endpoint.service.ts#validateEndpointOptions": "07401218669a87a9488b0aeb59f15b8d51341a172fb346ff83d38ed563a2988f";
|
|
743
743
|
readonly "apps/api/src/modules/endpoints/endpoint.service.ts#applyEndpointOptionDefaults": "990c27ae925b613215601c215a6e38f6ecb4e2b34b77d6e2819f0921d4e56230";
|
|
744
744
|
readonly "apps/api/src/modules/automation/jobs.service.ts#createJobTemplate": "1513bad8634fdf6abcca52f0041044512b3e53b3e7451f1b443f7e79fc026b01";
|
|
745
|
-
readonly "apps/api/src/modules/automation/jobs.service.ts#update": "
|
|
745
|
+
readonly "apps/api/src/modules/automation/jobs.service.ts#update": "950fad34e7ac3ffdfce9114ba213c11e113aea036a44569b126a8c1e5e589228";
|
|
746
746
|
readonly "packages/platform-shared/src/services/job.scheduler.service.ts#resolveTemplateInputs": "a9a4cc5df4627abf7ee2d2df7f2494d290292a15f4889a5f07a9de104ee33d9f";
|
|
747
747
|
readonly "packages/domain/src/dto/components/component-element-key.const.ts#isLowCodeComponentType": "4918470ef562727becb8c97c5afb7761a49734ecd21a6d3d5436576dbd10a6da";
|
|
748
748
|
readonly "packages/domain/src/dto/components/component-element-key.const.ts#isDefaultLibraryElement": "4faa356b91be5c44ebe3d442b6da26088d6d35d2db5fb073e1103165431cee48";
|
|
@@ -1025,11 +1025,11 @@ export const requestContractSemanticSources = {
|
|
|
1025
1025
|
"packages/platform-shared/src/utils/job-retry-policy.util.ts#assertJobRetryPolicyValid": "6511ccafc15233a4ffe4e024f13e6c0e5c9d8a53c261ecc571300495afd804cf",
|
|
1026
1026
|
"packages/domain/src/dto/components/component.validator.ts#validateEndpointGuardSemantics": "fd885b48c2990e47d1f05965af044aef8e2256da5fa4a86d1248967b04a3fd1e",
|
|
1027
1027
|
"apps/api/src/modules/endpoints/endpoint.service.ts#create": "cb10fc198892423088d396acd09618d8c64504a57fac0df3a892d57993913067",
|
|
1028
|
-
"apps/api/src/modules/endpoints/endpoint.service.ts#update": "
|
|
1028
|
+
"apps/api/src/modules/endpoints/endpoint.service.ts#update": "bc59acaffdb7275659bddb65b8d71e9d8266447054723ea87495eaa0dd512fe1",
|
|
1029
1029
|
"apps/api/src/modules/endpoints/endpoint.service.ts#validateEndpointOptions": "07401218669a87a9488b0aeb59f15b8d51341a172fb346ff83d38ed563a2988f",
|
|
1030
1030
|
"apps/api/src/modules/endpoints/endpoint.service.ts#applyEndpointOptionDefaults": "990c27ae925b613215601c215a6e38f6ecb4e2b34b77d6e2819f0921d4e56230",
|
|
1031
1031
|
"apps/api/src/modules/automation/jobs.service.ts#createJobTemplate": "1513bad8634fdf6abcca52f0041044512b3e53b3e7451f1b443f7e79fc026b01",
|
|
1032
|
-
"apps/api/src/modules/automation/jobs.service.ts#update": "
|
|
1032
|
+
"apps/api/src/modules/automation/jobs.service.ts#update": "950fad34e7ac3ffdfce9114ba213c11e113aea036a44569b126a8c1e5e589228",
|
|
1033
1033
|
"packages/platform-shared/src/services/job.scheduler.service.ts#resolveTemplateInputs": "a9a4cc5df4627abf7ee2d2df7f2494d290292a15f4889a5f07a9de104ee33d9f",
|
|
1034
1034
|
"packages/domain/src/dto/components/component-element-key.const.ts#isLowCodeComponentType": "4918470ef562727becb8c97c5afb7761a49734ecd21a6d3d5436576dbd10a6da",
|
|
1035
1035
|
"packages/domain/src/dto/components/component-element-key.const.ts#isDefaultLibraryElement": "4faa356b91be5c44ebe3d442b6da26088d6d35d2db5fb073e1103165431cee48",
|