@revoengine/cli 1.0.16 → 1.0.18
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 +35 -3
- package/dist/src/cli.js +1 -1
- package/dist/src/client.d.ts +5 -1
- package/dist/src/client.js +27 -2
- package/dist/src/commands/component.js +1 -4
- package/dist/src/commands/migrate.js +110 -183
- package/dist/src/migration-actions.d.ts +44 -0
- package/dist/src/migration-actions.js +211 -0
- package/dist/src/migration.d.ts +21 -13
- package/dist/src/migration.js +128 -217
- package/dist/src/resource-syncs/endpoint-sync.d.ts +2 -0
- package/dist/src/resource-syncs/endpoint-sync.js +7 -0
- package/dist/src/resource-syncs/job-template-sync.d.ts +1 -0
- package/dist/src/resource-syncs/job-template-sync.js +31 -0
- package/dist/src/sync-output.js +7 -5
- package/dist/src/ui.js +2 -2
- package/dist/src/workspace-prune.d.ts +42 -0
- package/dist/src/workspace-prune.js +416 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ The CLI has three main capabilities:
|
|
|
8
8
|
2. **Project migration** — plan, run, and verify a direct migration between two saved projects with `--from` and `--to`.
|
|
9
9
|
3. **Resource synchronization** — work with one supported resource family through its dedicated `pull`, `plan`, and `push` commands.
|
|
10
10
|
|
|
11
|
+
## Version 1.0.18
|
|
12
|
+
|
|
13
|
+
Repository `plan/deploy --prune` now releases occupied Job Template names before upserts by deleting the reviewed obsolete templates and their obsolete Event/Schedule consumers. Retained references block this early phase; remaining deletions follow verified upserts. Saved plans include deletion timing, so regenerate older replacement plans before deployment. See the repository workflow below for approval, scope and failure behavior.
|
|
14
|
+
|
|
15
|
+
Repository CI reports now classify converged definitions as `operation: "noop"` and report missing or stale lock baselines separately through `baselineAction`, preserving dependency and permission checks.
|
|
16
|
+
|
|
11
17
|
## Requirements and installation
|
|
12
18
|
|
|
13
19
|
- Node.js 24 or newer
|
|
@@ -293,11 +299,37 @@ revo plan --json
|
|
|
293
299
|
revo deploy --yes --json
|
|
294
300
|
```
|
|
295
301
|
|
|
302
|
+
Repository `plan` and `deploy` reports separate resource operations from lock bookkeeping across all ten resource families. An existing resource whose managed definition matches the repository is `operation: "noop"`, including when its baseline is absent or stale. Per-item `baselineAction` is `"adopt"` for a missing baseline, `"refresh"` for a stale baseline, or `"none"`. It describes separate bookkeeping for converged resources; create/update operations still save their verified baselines through the existing deployment flow. Use `revo plan --hints` to see this diagnostic in terminal output.
|
|
303
|
+
|
|
304
|
+
The JSON extension retains schema version 2, raw family `status`/`counts`, and `operations.adopt`. Repository summaries count converged resources as `operations.noop`; CI consumers should use item `operation` or aggregate `operations` rather than raw family status to identify resource changes. Validation failures, owner/role changes, and activation exclusions still take precedence over content equality. Dedicated resource commands and named `migrate` keep their existing contract.
|
|
305
|
+
|
|
306
|
+
`plan` does not save manifests or baselines. `deploy` recomputes live state and may save a verified baseline in the runner checkout without modifying a converged resource. The next fresh checkout can therefore report the same `noop` without committing that lock back to Git. View validation can still issue a read-only preview POST when the runner lacks a trusted dependency fingerprint.
|
|
307
|
+
|
|
296
308
|
Repository deployment uses desired-source-wins upsert: it can adopt a missing baseline or overwrite target content drift with the repository state. Its Database Table policy permits supported table renames, column additions and changes, and copying foreign-reference declarations as metadata. Copying those declarations does not create physical SQL foreign-key constraints.
|
|
297
309
|
|
|
298
|
-
`deploy --force` additionally approves supported high-impact operations reported by `plan`, including column removal, managed partition deletion, Materialized View Schedule writes, Schedule target-type changes, and Group or Role Group writes. Review them with `revo plan --force` before deployment. Force does not bypass invalid identity, missing dependencies, unsupported DDL, ambiguity, or failed verification.
|
|
310
|
+
`deploy --force` additionally approves supported high-impact operations reported by `plan`, including column removal, managed partition deletion, Materialized View Schedule writes, Schedule target-type changes, and Group or Role Group writes. Review them with `revo plan --force` before deployment. Force does not bypass invalid identity, missing dependencies, unsupported DDL, ambiguity, or failed verification. Full repository reconciliation explicitly selects these supported operations with `--prune`; it does not require `--force`.
|
|
311
|
+
|
|
312
|
+
To reconcile all tracked families, review the complete plan and approve its deletion list:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
revo plan --prune --out reviewed-plan.json
|
|
316
|
+
revo deploy --prune --reviewed-plan reviewed-plan.json
|
|
317
|
+
# CI: approval is supplied by the pipeline's confirmation policy
|
|
318
|
+
revo deploy --prune --yes --reviewed-plan reviewed-plan.json
|
|
319
|
+
revo version --json
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`--prune` makes local manifests authoritative for the configured `trackedResources`. A keyed target resource absent locally is a deletion candidate even without an old lock entry. Unkeyed resources are unmanaged and preserved. This covers Components, Job Templates, Endpoints, Events, Schedules, Database Tables (including partitions), Database Views, Groups, Role Groups and Service Accounts when selected. Runtime Job executions/history and Webhook deliveries are outside this definition-sync scope; their existing lifecycle is unaffected. Choose only resource families owned by the repository: an empty selected family intentionally means deleting all its managed target definitions. Environment-local Service Accounts should be excluded from `trackedResources`.
|
|
323
|
+
|
|
324
|
+
The planner lists exact target IDs, names and Stable Keys in deletion order. Duplicate identity, retained local/unmanaged/out-of-scope consumers, system resources and deletion of the authenticated Service Account block the plan. When a desired Job Template name is occupied by a different Stable Key scheduled for deletion, the plan explicitly marks that template and its obsolete Event/Schedule consumers for deletion **before upserts**. An inactive consumer still retains its reference. Retained, unmanaged or out-of-scope consumers block this early deletion, including retained consumers that would otherwise rebind during upsert. An occupied name outside the approved prune scope or duplicate desired names block planning instead of failing later with HTTP 409.
|
|
325
|
+
|
|
326
|
+
All other deletions run after upserts and their readback verification, allowing a retained Job Template or Endpoint to move to a replacement Component. Pruning removes obsolete consumers before dependencies. API errors or failed readback stop further deletes; a failed early delete prevents upserts, and a failed upsert prevents the remaining prune. Early deletions can remain applied if a later write fails, so review both deletion phases before approval. The owning APIs retain their existing permission and reference guards and soft-delete semantics, including the table subtree lifecycle and view automation deactivation. Root deletion is blocked by any retained or unmanaged partition. No arbitrary implicit consumer cleanup is performed.
|
|
327
|
+
|
|
328
|
+
`plan --out <file>` saves the plan without mutation or lock changes. `deploy --reviewed-plan <file>` requires `--prune` and compares the saved deletion list, timing (`beforeUpserts: true` where required), revisions, authenticated instance and tracked scope with the live plan before any write. Regenerate reviewed plans saved by older CLI versions for replacements that now require early deletion. Each early deletion rechecks the remaining Job Template/Event/Schedule graph. Upserts are followed by another live comparison of the remaining prune plan. Each deletion rechecks identity and definition, verifies disappearance from the active catalog and clears only the selected target baseline; verified partition deletion retains its lock tombstone. Cascading table/view operations additionally recheck the remaining dependency graph. Plans are advisory, not an atomic server-side transaction: concurrent edits can still cause API rejection or partial progress. A fresh plan is required after target drift or a failed partial deployment.
|
|
329
|
+
|
|
330
|
+
`deploy` always shows the plan before interactive confirmation; `--yes` supplies noninteractive approval. Ordinary resource rows, field names, dependency hints and metadata use one line per item. Field/value diffs, list changes and code/SQL diffs retain multiline Git-style formatting. `revo version --json` advertises `workspacePrune` and `reviewedPrunePlan` so CI can reject older releases that ignore unknown flags. Without `--prune`, repository deployment remains upsert-only.
|
|
299
331
|
|
|
300
|
-
|
|
332
|
+
Component-only reconciliation remains available through `revo component plan --all --prune` and `revo component push --all --prune --yes`; interactive confirmation is also supported. This matches the configured identity, rechecks local reappearance and live target drift, verifies deletion and clears only the selected environment baseline. `--force` is not required for explicit Component pruning. Named `migrate` and legacy `env apply` retain their existing scope and confirmation rules; `migrate --prune` is rejected.
|
|
301
333
|
|
|
302
334
|
## 2. Project-to-project migration
|
|
303
335
|
|
|
@@ -448,7 +480,7 @@ Review `database-tables plan --all` before a destructive push. `database-tables
|
|
|
448
480
|
|
|
449
481
|
`database-tables push --all --prune-partitions --yes --force` removes only previously managed partitions whose local manifests were removed. It deletes from leaves to root, refuses to remove a parent with an active child, and records a tombstone in the selected environment's lock after verified deletion. Unknown target-only partitions stay untouched. `database-tables push '<stableKey>' --prune-orphans --yes --force` can remove a target-only root with that Stable Key without a prior baseline. Before either remote deletion, the CLI rechecks live identity and dependencies; active child partitions or Database Views referencing the table block it. A successful delete is verified before the lock changes.
|
|
450
482
|
|
|
451
|
-
`database-tables pull --prune-orphans --yes --force` removes local manifests missing from the source; it never deletes target tables. Dedicated plan reports root orphans without accepting `--prune-orphans`. Repository `deploy --force`
|
|
483
|
+
`database-tables pull --prune-orphans --yes --force` removes local manifests missing from the source; it never deletes target tables. Dedicated plan reports root orphans without accepting `--prune-orphans`. Repository `deploy --force` retains its legacy partition-only removal policy; `deploy --prune` additionally reconciles all selected keyed table roots and partitions. Named `migrate` does not prune remote tables or partitions.
|
|
452
484
|
|
|
453
485
|
Resource plans support `--json` for automation and generally support `--strict` as a convergence gate. Human-readable plans show changes by default and hide informational details such as dependency readiness, component hashes, owners, and size statistics; add `--hints` to show them in individual plans, `revo plan`, and `revo migrate plan`. JSON plans still include the complete diagnostic data. Run `revo --help` for resource-specific safety flags such as `--activate`, `--skip-partitions`, and prune controls.
|
|
454
486
|
|
package/dist/src/cli.js
CHANGED
|
@@ -198,7 +198,7 @@ async function runMain(args, argv) {
|
|
|
198
198
|
const command = args._[0];
|
|
199
199
|
const noPositionals = args._.length === 0;
|
|
200
200
|
if (command === 'version' || ((args.version !== undefined || args.V !== undefined) && noPositionals)) {
|
|
201
|
-
print(packageVersion);
|
|
201
|
+
print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true } } : packageVersion);
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RequestQueue } from './request-queue.ts';
|
|
2
2
|
import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ServiceAccountRecord, ScheduleRecord } from './types.ts';
|
|
3
|
+
import type { TrackableResourceType } from './tracked-resources.ts';
|
|
3
4
|
export type RequestOptions = {
|
|
4
5
|
query?: Record<string, unknown>;
|
|
5
6
|
body?: unknown;
|
|
@@ -404,9 +405,12 @@ export declare class RevoClient {
|
|
|
404
405
|
createComponent(body: unknown): Promise<unknown>;
|
|
405
406
|
updateComponent(componentId: string, body: unknown): Promise<unknown>;
|
|
406
407
|
deleteComponent(componentId: string): Promise<ApiResponse<unknown>>;
|
|
408
|
+
deleteWorkspaceResource(resource: TrackableResourceType, id: string): Promise<unknown>;
|
|
407
409
|
private accountForSync;
|
|
408
410
|
getAccount(userId: string): Promise<ServiceAccountRecord>;
|
|
409
|
-
listAllServiceAccounts(
|
|
411
|
+
listAllServiceAccounts(options?: {
|
|
412
|
+
includeHumans?: boolean;
|
|
413
|
+
}): Promise<{
|
|
410
414
|
serviceAccounts: ServiceAccountRecord[];
|
|
411
415
|
}>;
|
|
412
416
|
getServiceAccount(userId: string): Promise<ServiceAccountRecord>;
|
package/dist/src/client.js
CHANGED
|
@@ -1177,6 +1177,31 @@ export class RevoClient {
|
|
|
1177
1177
|
spinnerLabel: 'Deleting component',
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
|
+
async deleteWorkspaceResource(resource, id) {
|
|
1181
|
+
const encoded = encodeURIComponent(id);
|
|
1182
|
+
const single = {
|
|
1183
|
+
component: `/api/v1/component/${encoded}`,
|
|
1184
|
+
'database-table': `/api/v1/databases/${encoded}`,
|
|
1185
|
+
group: `/api/v1/groups/${encoded}`,
|
|
1186
|
+
'role-group': `/api/v1/role-groups/${encoded}`,
|
|
1187
|
+
'service-account': `/api/v1/accounts/${encoded}`,
|
|
1188
|
+
};
|
|
1189
|
+
const bulk = {
|
|
1190
|
+
'job-template': '/api/v1/automation/template/delete',
|
|
1191
|
+
schedule: '/api/v1/automation/schedule/delete',
|
|
1192
|
+
event: '/api/v1/automation/event/delete',
|
|
1193
|
+
endpoint: '/api/v1/endpoints/delete',
|
|
1194
|
+
'database-view': '/api/v1/databases/views/delete',
|
|
1195
|
+
};
|
|
1196
|
+
const requestPath = single[resource] || bulk[resource];
|
|
1197
|
+
if (!requestPath)
|
|
1198
|
+
throw new Error(`Unsupported workspace deletion family: ${resource}.`);
|
|
1199
|
+
return this.requestData(single[resource] ? 'DELETE' : 'POST', requestPath, {
|
|
1200
|
+
...(bulk[resource] ? { body: { data: [id] } } : {}),
|
|
1201
|
+
maxRetries: 0,
|
|
1202
|
+
spinnerLabel: `Deleting ${resource}`,
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1180
1205
|
accountForSync(value) {
|
|
1181
1206
|
const wrapper = isRecord(value) && isRecord(value.data) ? value.data : value;
|
|
1182
1207
|
if (!isRecord(wrapper)) {
|
|
@@ -1197,7 +1222,7 @@ export class RevoClient {
|
|
|
1197
1222
|
async getAccount(userId) {
|
|
1198
1223
|
return this.accountForSync(await this.requestData('GET', `/api/v1/accounts/${encodeURIComponent(userId)}`, { sensitiveAccountPayload: true }));
|
|
1199
1224
|
}
|
|
1200
|
-
async listAllServiceAccounts() {
|
|
1225
|
+
async listAllServiceAccounts(options = {}) {
|
|
1201
1226
|
const serviceAccounts = [];
|
|
1202
1227
|
let skip = 0;
|
|
1203
1228
|
const seenIds = new Set();
|
|
@@ -1209,7 +1234,7 @@ export class RevoClient {
|
|
|
1209
1234
|
}));
|
|
1210
1235
|
for (const item of page.items) {
|
|
1211
1236
|
const account = this.accountForSync(item);
|
|
1212
|
-
if (account.serviceAccount === true && !account.deletedAt) {
|
|
1237
|
+
if ((account.serviceAccount === true || options.includeHumans === true) && !account.deletedAt) {
|
|
1213
1238
|
if (!account.userId || seenIds.has(account.userId)) {
|
|
1214
1239
|
throw new Error('Invalid or repeated account ID while listing service accounts.');
|
|
1215
1240
|
}
|
|
@@ -1465,13 +1465,13 @@ export async function pushAllComponents(context, options) {
|
|
|
1465
1465
|
migrateComponentLockIdentity(cwd, identity, buildLocalComponentCatalog(cwd, identity), remoteCatalog);
|
|
1466
1466
|
}
|
|
1467
1467
|
await assertNoComponentTypeTransitionBlockers(context, manifests, identity, remoteCatalog);
|
|
1468
|
-
await confirmBulkAction(context, 'push', manifests.length + pruneCandidates.length, options.force || options.yes);
|
|
1469
1468
|
if (pruneCandidates.length > 0) {
|
|
1470
1469
|
printSyncNotice(println, `Pruning ${pruneCandidates.length} managed component(s) absent from the repository.`);
|
|
1471
1470
|
for (const item of pruneCandidates) {
|
|
1472
1471
|
println(` - ${item.identityKey || item.componentId} (${item.remoteComponentId})`);
|
|
1473
1472
|
}
|
|
1474
1473
|
}
|
|
1474
|
+
await confirmBulkAction(context, 'push', manifests.length + pruneCandidates.length, options.force || options.yes);
|
|
1475
1475
|
const startedAt = Date.now();
|
|
1476
1476
|
const results = [];
|
|
1477
1477
|
for (const manifestPath of manifests) {
|
|
@@ -2047,9 +2047,6 @@ export async function handleComponentCommand(context) {
|
|
|
2047
2047
|
if (prune && (!['plan', 'push'].includes(subcommand) || !all || changedScope.enabled)) {
|
|
2048
2048
|
throw new Error('Component --prune requires plan --all or push --all without --changed.');
|
|
2049
2049
|
}
|
|
2050
|
-
if (prune && subcommand === 'push' && (!yes || !force)) {
|
|
2051
|
-
throw new Error('Component push --prune requires --yes --force.');
|
|
2052
|
-
}
|
|
2053
2050
|
if (context.componentEnvironment && ['pull', 'plan', 'push'].includes(subcommand)) {
|
|
2054
2051
|
const identity = resolveComponentIdentity(context);
|
|
2055
2052
|
if (identity.mode !== 'stableKey') {
|