@revoengine/cli 1.0.25 → 1.0.27
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 +32 -0
- package/dist/src/cli.js +1 -1
- package/dist/src/client.d.ts +5 -0
- package/dist/src/client.js +44 -0
- package/dist/src/commands/component.js +7 -3
- package/dist/src/commands/migrate.js +25 -1
- package/dist/src/component-lock.d.ts +5 -0
- package/dist/src/component-lock.js +2 -0
- package/dist/src/component-manifests.d.ts +14 -0
- package/dist/src/component-manifests.js +73 -0
- package/dist/src/http-trace.js +2 -2
- package/dist/src/migration.d.ts +4 -0
- package/dist/src/migration.js +90 -59
- package/dist/src/planning-snapshot.d.ts +2 -0
- package/dist/src/planning-snapshot.js +29 -0
- package/dist/src/resource-syncs/endpoint-sync.js +10 -20
- package/dist/src/resource-syncs/event-sync.js +5 -0
- package/dist/src/resource-syncs/identity-migration.js +6 -4
- package/dist/src/resource-syncs/job-template-sync.js +6 -9
- package/dist/src/ui.js +3 -2
- package/dist/src/workspace-digests.d.ts +6 -0
- package/dist/src/workspace-digests.js +54 -0
- package/dist/src/workspace-prune.js +17 -4
- package/package.json +2 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { mapWithConcurrency } from "../utils.js";
|
|
2
|
+
import { HTTP_REQUEST_CONCURRENCY } from "../request-queue.js";
|
|
1
3
|
import { readComponentLock } from "../component-lock.js";
|
|
2
4
|
import { readConfiguredResourceMetadataStableKey } from "../resource-metadata.js";
|
|
3
5
|
import { readWorkspaceGroups } from "./group-sync.js";
|
|
@@ -19,8 +21,8 @@ export async function planIdentityMigration(input) {
|
|
|
19
21
|
const id = (node) => `${node.resource}:${node.stableKey}`;
|
|
20
22
|
const liveCounts = new Map();
|
|
21
23
|
const { serviceAccounts } = await input.client.listAllServiceAccounts();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
const accounts = await mapWithConcurrency(serviceAccounts, summary => input.client.getServiceAccount(String(summary.userId || '')), HTTP_REQUEST_CONCURRENCY);
|
|
25
|
+
for (const record of accounts) {
|
|
24
26
|
if (isBuiltinSystemAccount(record))
|
|
25
27
|
continue;
|
|
26
28
|
const key = readConfiguredResourceMetadataStableKey(record, input.stableKeyName);
|
|
@@ -31,8 +33,8 @@ export async function planIdentityMigration(input) {
|
|
|
31
33
|
}
|
|
32
34
|
if (nodes.some((node) => node.resource === 'group' || node.owner?.type === 'group')) {
|
|
33
35
|
const { groups } = await input.client.listAllGroups();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const details = await mapWithConcurrency(groups, async (summary) => unwrapData(await input.client.getGroup(String(summary.groupId || summary.id || ''))), HTTP_REQUEST_CONCURRENCY);
|
|
37
|
+
for (const record of details) {
|
|
36
38
|
const key = readConfiguredResourceMetadataStableKey(record, input.stableKeyName);
|
|
37
39
|
if (key && !record.deletedAt) {
|
|
38
40
|
const k = id({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { loadComponentSources } from "../component-manifests.js";
|
|
1
2
|
import { componentRevisionByDigest, isComponentDigest } from "../component-contract.js";
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { accountPrincipal, resolveExecutionPrincipal, executionPrincipalAvailable, portableExecutionPolicy, runtimeExecutionPolicyPayload, validExecutionPrincipal, validPortableExecutionPolicy } from "./account-principal.js";
|
|
@@ -87,12 +88,8 @@ async function loadRemoteJobTemplates(client) {
|
|
|
87
88
|
return id ? unwrapData(await client.getJobTemplate(id)) : summary;
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
|
-
async function loadRemoteComponents(client) {
|
|
91
|
-
|
|
92
|
-
return mapWithConcurrency(components, async (summary) => {
|
|
93
|
-
const id = componentIdOf(summary);
|
|
94
|
-
return id ? unwrapData(await client.getComponent(id)) : summary;
|
|
95
|
-
});
|
|
91
|
+
async function loadRemoteComponents(client, cwd) {
|
|
92
|
+
return loadComponentSources(client, cwd);
|
|
96
93
|
}
|
|
97
94
|
const JOB_TEMPLATE_MANIFEST_FIELDS = new Set([
|
|
98
95
|
'executionPrincipal', 'executionPolicy',
|
|
@@ -307,7 +304,7 @@ export async function buildJobTemplatesPlan(input) {
|
|
|
307
304
|
const lock = readComponentLock(projectRoot);
|
|
308
305
|
const localEntries = readWorkspaceJobTemplates(input.cwd);
|
|
309
306
|
const targetRecords = await loadRemoteJobTemplates(input.client);
|
|
310
|
-
const targetComponents = await loadRemoteComponents(input.client);
|
|
307
|
+
const targetComponents = await loadRemoteComponents(input.client, input.cwd);
|
|
311
308
|
const blockers = [];
|
|
312
309
|
const warnings = [];
|
|
313
310
|
const items = [];
|
|
@@ -723,7 +720,7 @@ async function prepareJobTemplateCreates(input) {
|
|
|
723
720
|
.map((entry) => [entry.manifest.stableKey, entry]));
|
|
724
721
|
const targetTemplates = await loadRemoteJobTemplates(input.client);
|
|
725
722
|
const targetKeys = targetTemplates.map((record) => readConfiguredResourceMetadataStableKey(record, input.stableKeyName));
|
|
726
|
-
const targetComponents = await loadRemoteComponents(input.client);
|
|
723
|
+
const targetComponents = await loadRemoteComponents(input.client, input.cwd);
|
|
727
724
|
const prepared = [];
|
|
728
725
|
for (const item of input.plan.items.filter((candidate) => candidate.status === 'create')) {
|
|
729
726
|
const stableKey = item.stableKey || '';
|
|
@@ -847,7 +844,7 @@ export async function pushJobTemplates(input) {
|
|
|
847
844
|
}
|
|
848
845
|
const updateItems = plan.items.filter((candidate) => (['safe-update', 'remote-changed', 'conflict', 'missing-lock'].includes(candidate.status)));
|
|
849
846
|
const liveTargetTemplates = updateItems.length > 0 ? await loadRemoteJobTemplates(input.client) : [];
|
|
850
|
-
const liveTargetComponents = updateItems.length > 0 ? await loadRemoteComponents(input.client) : [];
|
|
847
|
+
const liveTargetComponents = updateItems.length > 0 ? await loadRemoteComponents(input.client, input.cwd) : [];
|
|
851
848
|
for (const item of updateItems) {
|
|
852
849
|
const stableKey = item.stableKey || '';
|
|
853
850
|
const local = localByKey.get(stableKey);
|
package/dist/src/ui.js
CHANGED
|
@@ -179,8 +179,9 @@ function renderCommandCatalog() {
|
|
|
179
179
|
commandRow('revo metadata apply [--project <name>] --yes [--skip-partitions]', 'Populate missing stable-key metadata'),
|
|
180
180
|
commandRow('revo pull --all|--resources <list> --yes [--skip-groups] [--force] [--json]', 'Build the repository workspace from the configured runtime source'),
|
|
181
181
|
commandRow('revo diff [--json]', 'Show only workspace-to-target resource differences without writes'),
|
|
182
|
-
commandRow('revo plan [--prune] [--out file] [--force] [--strict] [--json] [--hints]', 'Plan tracked workspace upserts and optional Stable Key deletions without writes'),
|
|
183
|
-
commandRow('revo
|
|
182
|
+
commandRow('revo plan [--activate] [--prune] [--out file] [--force] [--strict] [--json] [--hints]', 'Plan tracked workspace upserts and optional Stable Key deletions without writes'),
|
|
183
|
+
commandRow('revo plan update [--json]', 'Update the local Stable Key source digest index without contacting the target'),
|
|
184
|
+
commandRow('revo deploy [--yes] [--activate] [--prune] [--reviewed-plan file] [--force] [--json]', 'Review, confirm, deploy and prune tracked resources in dependency order'),
|
|
184
185
|
commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview twelve resource families and identity dependencies'),
|
|
185
186
|
commandRow('revo migrate run --from <env> --to <env> [--resources <list>] [--skip-groups] --yes [--force] [--json]', 'Pull, plan, migrate, and verify resources in dependency order'),
|
|
186
187
|
commandRow('revo migrate verify --from <env> --to <env> [--resources <list>] [--json]', 'Verify target resources against a fresh temporary source pull'),
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { hashPortableComponentSource, readComponentLock, writeComponentLock } from "./component-lock.js";
|
|
2
|
+
import { componentContentDigest } from "./component-contract.js";
|
|
3
|
+
import { localComponentSources } from "./component-manifests.js";
|
|
4
|
+
import { readPruneManifests } from "./workspace-prune.js";
|
|
5
|
+
import { requireProjectLayout } from "./resource-syncs/util.js";
|
|
6
|
+
import { TRACKABLE_RESOURCE_TYPES, shouldTrackResource } from "./tracked-resources.js";
|
|
7
|
+
import { readProjectTrackedResources, readProjectStableKeyName } from "./project.js";
|
|
8
|
+
import { hashPortableAgent } from "./resource-syncs/agent-sync.js";
|
|
9
|
+
import { hashPortableDatabaseSchema, readWorkspaceDatabaseSchemas } from "./resource-syncs/database-table-sync.js";
|
|
10
|
+
import { hashPortableDatabaseView } from "./resource-syncs/database-view-sync.js";
|
|
11
|
+
import { hashPortableEndpoint } from "./resource-syncs/endpoint-sync.js";
|
|
12
|
+
import { hashPortableEvent } from "./resource-syncs/event-sync.js";
|
|
13
|
+
import { hashPortableGroup } from "./resource-syncs/group-sync.js";
|
|
14
|
+
import { hashPortableJobTemplate } from "./resource-syncs/job-template-sync.js";
|
|
15
|
+
import { hashPortableRoleGroup } from "./resource-syncs/role-group-sync.js";
|
|
16
|
+
import { hashPortableSchedule } from "./resource-syncs/schedule-sync.js";
|
|
17
|
+
import { hashPortableServiceAccount } from "./resource-syncs/service-account-sync.js";
|
|
18
|
+
/** Offline, deterministic authoring index. It never adopts or modifies a target baseline. */
|
|
19
|
+
export function updateWorkspaceDigests(cwd) {
|
|
20
|
+
const { projectRoot } = requireProjectLayout(cwd, 'Plan update');
|
|
21
|
+
const resources = TRACKABLE_RESOURCE_TYPES.filter(resource => shouldTrackResource(readProjectTrackedResources(cwd), resource));
|
|
22
|
+
const local = readPruneManifests(cwd, resources);
|
|
23
|
+
const workspaceDigests = {};
|
|
24
|
+
const hashers = { agent: hashPortableAgent, 'agent-plugin': hashPortableAgent,
|
|
25
|
+
'database-table': hashPortableDatabaseSchema, 'database-view': hashPortableDatabaseView,
|
|
26
|
+
endpoint: hashPortableEndpoint, event: hashPortableEvent, group: hashPortableGroup,
|
|
27
|
+
'job-template': hashPortableJobTemplate, 'role-group': hashPortableRoleGroup,
|
|
28
|
+
schedule: hashPortableSchedule, 'service-account': hashPortableServiceAccount };
|
|
29
|
+
for (const resource of resources) {
|
|
30
|
+
const entries = {};
|
|
31
|
+
if (resource === 'component') {
|
|
32
|
+
for (const [key, component] of [...localComponentSources(cwd)].sort(([a], [b]) => a.localeCompare(b))) {
|
|
33
|
+
entries[key] = { sourceDigest: hashPortableComponentSource(component), contentDigest: componentContentDigest(component) };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (resource === 'database-table') {
|
|
37
|
+
for (const { manifest } of readWorkspaceDatabaseSchemas(cwd, readProjectStableKeyName(cwd))) {
|
|
38
|
+
entries[manifest.stableKey] = { sourceDigest: hashPortableDatabaseSchema(manifest) };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
for (const [key, manifest] of [...(local[resource] || [])].sort(([a], [b]) => a.localeCompare(b))) {
|
|
43
|
+
entries[key] = { sourceDigest: hashers[resource](manifest) };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
workspaceDigests[resource] = entries;
|
|
47
|
+
}
|
|
48
|
+
const lock = readComponentLock(projectRoot);
|
|
49
|
+
const changed = JSON.stringify(lock.workspaceDigests) !== JSON.stringify(workspaceDigests);
|
|
50
|
+
if (changed)
|
|
51
|
+
writeComponentLock(projectRoot, { ...lock, workspaceDigests });
|
|
52
|
+
return { changed, resources: Object.keys(workspaceDigests).length,
|
|
53
|
+
resourcesIndexed: Object.values(workspaceDigests).reduce((sum, entries) => sum + Object.keys(entries).length, 0) };
|
|
54
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { loadComponentSources } from "./component-manifests.js";
|
|
1
2
|
import { agentDependencies } from "./resource-syncs/agent-sync.js";
|
|
2
3
|
import fs from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
5
|
+
import { HTTP_REQUEST_CONCURRENCY } from "./request-queue.js";
|
|
6
|
+
import { mapWithConcurrency } from "./utils.js";
|
|
4
7
|
import { hashStable, readComponentLock, removeComponentLockBaseline, writeComponentLock } from "./component-lock.js";
|
|
5
8
|
import { readProjectStableKeyName } from "./project.js";
|
|
6
9
|
import { readResourceInventory, resourceIdOf } from "./resource-inventory.js";
|
|
@@ -369,16 +372,26 @@ export async function buildWorkspacePrunePlan(input) {
|
|
|
369
372
|
// Human owners also block Group/Account deletion. Keep the client sanitization
|
|
370
373
|
// and sensitive-account trace redaction; never inventory credentials.
|
|
371
374
|
const { serviceAccounts } = await input.client.listAllServiceAccounts({ includeHumans: true });
|
|
372
|
-
|
|
375
|
+
const accounts = await mapWithConcurrency(serviceAccounts, async (account) => {
|
|
373
376
|
const id = resourceIdOf(account);
|
|
377
|
+
if (!id)
|
|
378
|
+
throw new Error('Incomplete account ownership inventory; prune blocked.');
|
|
374
379
|
const detail = await input.client.getAccount(id);
|
|
375
|
-
if (
|
|
380
|
+
if (resourceIdOf(detail) !== id)
|
|
376
381
|
throw new Error('Incomplete account ownership inventory; prune blocked.');
|
|
377
|
-
|
|
378
|
-
}
|
|
382
|
+
return detail;
|
|
383
|
+
}, HTTP_REQUEST_CONCURRENCY);
|
|
384
|
+
records.push(...accounts);
|
|
379
385
|
inventory[resource] = records;
|
|
380
386
|
continue;
|
|
381
387
|
}
|
|
388
|
+
if (resource === 'component') {
|
|
389
|
+
const components = await loadComponentSources(input.client, input.cwd);
|
|
390
|
+
if (components.some(component => !resourceIdOf(component)))
|
|
391
|
+
throw new Error('Incomplete component inventory; prune blocked.');
|
|
392
|
+
inventory[resource] = components;
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
382
395
|
for await (const entry of readResourceInventory(input.client, resource)) {
|
|
383
396
|
if (!entry.resource || resourceIdOf(entry.resource) !== entry.listedId)
|
|
384
397
|
throw new Error(`Incomplete ${resource} inventory; prune blocked.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revoengine/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "CLI package for the RevoEngine Platform API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
13
13
|
"clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true });\"",
|
|
14
|
-
"check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/component-contract.ts'); await import('./src/database-indexes.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/reviewed-plan.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
|
|
14
|
+
"check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/request-queue.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/component-contract.ts'); await import('./src/component-manifests.ts'); await import('./src/planning-snapshot.ts'); await import('./src/workspace-digests.ts'); await import('./src/database-indexes.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/agent-sync.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/resource-syncs/account-principal.ts'); await import('./src/resource-syncs/identity-migration.ts'); await import('./src/resource-syncs/service-account-sync.ts'); await import('./src/commands/service-accounts.ts'); await import('./src/commands/agents.ts'); await import('./src/migration-actions.ts'); await import('./src/reviewed-plan.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/workspace-prune.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
|
|
15
15
|
"dev": "node ./scripts/dev.ts",
|
|
16
16
|
"prepack": "npm run build",
|
|
17
17
|
"test": "node --test ./test/*.test.ts",
|