@revoengine/cli 1.0.19 → 1.0.21
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 +60 -9
- package/dist/src/cli.js +5 -1
- package/dist/src/client.d.ts +20 -3
- package/dist/src/client.js +45 -1
- package/dist/src/commands/agents.d.ts +2 -0
- package/dist/src/commands/agents.js +56 -0
- package/dist/src/commands/component.js +2 -0
- package/dist/src/commands/index.d.ts +1 -0
- package/dist/src/commands/index.js +1 -0
- package/dist/src/commands/migrate.js +14 -2
- package/dist/src/component-lock.d.ts +5 -0
- package/dist/src/component-lock.js +45 -5
- package/dist/src/metadata-backfill.js +48 -1
- package/dist/src/migration.d.ts +9 -2
- package/dist/src/migration.js +60 -0
- package/dist/src/resource-inventory.d.ts +4 -2
- package/dist/src/resource-inventory.js +11 -1
- package/dist/src/resource-syncs/account-principal.d.ts +19 -1
- package/dist/src/resource-syncs/account-principal.js +94 -4
- package/dist/src/resource-syncs/agent-sync.d.ts +98 -0
- package/dist/src/resource-syncs/agent-sync.js +586 -0
- package/dist/src/resource-syncs/endpoint-sync.d.ts +3 -0
- package/dist/src/resource-syncs/endpoint-sync.js +27 -1
- package/dist/src/resource-syncs/group-sync.d.ts +4 -1
- package/dist/src/resource-syncs/group-sync.js +32 -17
- package/dist/src/resource-syncs/identity-migration.d.ts +1 -1
- package/dist/src/resource-syncs/identity-migration.js +20 -1
- package/dist/src/resource-syncs/job-template-sync.d.ts +2 -1
- package/dist/src/resource-syncs/job-template-sync.js +38 -32
- package/dist/src/resource-syncs/service-account-sync.js +16 -9
- package/dist/src/tracked-resources.d.ts +1 -1
- package/dist/src/tracked-resources.js +4 -2
- package/dist/src/types.d.ts +22 -0
- package/dist/src/ui.js +5 -1
- package/dist/src/workspace-diff.js +2 -0
- package/dist/src/workspace-prune.js +44 -3
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { readPortableOwner, resolvePortableOwner, ownerIsAvailable } from "./account-principal.js";
|
|
3
|
+
import { isBuiltinSystemAccount } from "./account-principal.js";
|
|
3
4
|
import { describeFieldChanges } from "../diff-details.js";
|
|
4
5
|
import { hashStable, readComponentLock, writeComponentLock, } from "../component-lock.js";
|
|
5
6
|
import { readConfiguredResourceMetadataStableKey, sanitizeUserMetadata, } from "../resource-metadata.js";
|
|
@@ -12,6 +13,8 @@ function serviceAccountIdOf(record) {
|
|
|
12
13
|
return String(record.userId || '');
|
|
13
14
|
}
|
|
14
15
|
export async function serviceAccountManifestFromRecord(client, record, stableKeyName) {
|
|
16
|
+
if (isBuiltinSystemAccount(record))
|
|
17
|
+
return null;
|
|
15
18
|
const stableKey = readConfiguredResourceMetadataStableKey(record, stableKeyName);
|
|
16
19
|
if (!stableKey) {
|
|
17
20
|
return null;
|
|
@@ -43,21 +46,21 @@ async function readManagementPrincipal(client, record, stableKeyName) {
|
|
|
43
46
|
}
|
|
44
47
|
export function hashPortableServiceAccount(manifest) {
|
|
45
48
|
return hashStable({ kind: manifest.kind, stableKey: manifest.stableKey, name: manifest.name, metadata: manifest.metadata,
|
|
46
|
-
...(['group', 'service-account'].includes(manifest.owner.type) ? { owner: manifest.owner } : {}) });
|
|
49
|
+
...(['group', 'service-account', 'system'].includes(manifest.owner.type) ? { owner: manifest.owner } : {}) });
|
|
47
50
|
}
|
|
48
51
|
function serviceAccountHint(value) {
|
|
49
52
|
return String(value.name || '').trim().toLowerCase();
|
|
50
53
|
}
|
|
51
54
|
function diffServiceAccounts(desired, target) {
|
|
52
55
|
return { changedFields: ['name', 'metadata', 'owner'].filter((field) => {
|
|
53
|
-
if (field === 'owner' && !['group', 'service-account'].includes(desired.owner.type)) {
|
|
56
|
+
if (field === 'owner' && !['group', 'service-account', 'system'].includes(desired.owner.type)) {
|
|
54
57
|
return false;
|
|
55
58
|
}
|
|
56
59
|
return hashStable(desired[field]) !== hashStable(target[field]);
|
|
57
60
|
}) };
|
|
58
61
|
}
|
|
59
62
|
function comparableManifest(desired, target) {
|
|
60
|
-
return ['group', 'service-account'].includes(desired.owner.type) ? target : { ...target, owner: desired.owner };
|
|
63
|
+
return ['group', 'service-account', 'system'].includes(desired.owner.type) ? target : { ...target, owner: desired.owner };
|
|
61
64
|
}
|
|
62
65
|
export function serviceAccountManifestPath(workspaceRoot, manifest) {
|
|
63
66
|
return path.join(workspaceRoot, SERVICE_ACCOUNTS_DIRECTORY, `${sanitizeSegment(manifest.name)}-${stableKeySuffix(manifest.stableKey)}`, SERVICE_ACCOUNT_MANIFEST_FILE);
|
|
@@ -97,13 +100,15 @@ function validateManifest(manifest, stableKeyName) {
|
|
|
97
100
|
|| !isRecord(manifest.metadata)) {
|
|
98
101
|
errors.push('manifest must contain kind, stableKey, name and metadata');
|
|
99
102
|
}
|
|
100
|
-
if (!isRecord(manifest.owner) || !['group', 'service-account', 'manual-user', 'unresolved'].includes(String(manifest.owner.type))) {
|
|
103
|
+
if (!isRecord(manifest.owner) || !['group', 'service-account', 'system', 'manual-user', 'unresolved'].includes(String(manifest.owner.type))) {
|
|
101
104
|
errors.push('owner must contain a portable owner policy');
|
|
102
105
|
}
|
|
103
106
|
else if (['group', 'service-account'].includes(String(manifest.owner.type))
|
|
104
107
|
&& (typeof manifest.owner.stableKey !== 'string' || !manifest.owner.stableKey.trim())) {
|
|
105
108
|
errors.push('portable owner requires stableKey');
|
|
106
109
|
}
|
|
110
|
+
if (isRecord(manifest.owner) && manifest.owner.type === 'system' && Object.keys(manifest.owner).length !== 1)
|
|
111
|
+
errors.push('System owner contains unsupported fields');
|
|
107
112
|
if (isRecord(manifest.owner) && Object.keys(manifest.owner).some((key) => !['type', 'stableKey', 'reason'].includes(key))) {
|
|
108
113
|
errors.push('owner contains unsupported fields');
|
|
109
114
|
}
|
|
@@ -194,9 +199,9 @@ export async function buildServiceAccountsPlan(input) {
|
|
|
194
199
|
items.push({ status: 'collision', stableKey: desired.stableKey, name: desired.name, reason: 'duplicate target stableKey', desiredHash });
|
|
195
200
|
continue;
|
|
196
201
|
}
|
|
197
|
-
if (desired.owner.type === 'group' || desired.owner.type === 'service-account') {
|
|
202
|
+
if (desired.owner.type === 'group' || desired.owner.type === 'service-account' || desired.owner.type === 'system') {
|
|
198
203
|
if (!await ownerIsAvailable(input.client, desired.owner, input.stableKeyName, projectedIdentities)) {
|
|
199
|
-
blockers.push(`Service account "${desired.stableKey}" owner "${desired.owner.stableKey}" is missing or ambiguous.`);
|
|
204
|
+
blockers.push(`Service account "${desired.stableKey}" owner "${desired.owner.type === 'system' ? 'System' : desired.owner.stableKey}" is missing or ambiguous.`);
|
|
200
205
|
items.push({ status: 'conflict', stableKey: desired.stableKey, name: desired.name, desiredHash, reason: 'owner is missing or ambiguous' });
|
|
201
206
|
continue;
|
|
202
207
|
}
|
|
@@ -273,7 +278,7 @@ export async function buildServiceAccountsPlan(input) {
|
|
|
273
278
|
if (consumedUnmanaged.has(record)) {
|
|
274
279
|
continue;
|
|
275
280
|
}
|
|
276
|
-
items.push({ status: 'skipped', name: String(record.name || 'unknown'), reason: `missing ${input.stableKeyName}; unmanaged` });
|
|
281
|
+
items.push({ status: 'skipped', name: String(record.name || 'unknown'), reason: isBuiltinSystemAccount(record) ? 'built-in System account is managed by the platform' : `missing ${input.stableKeyName}; unmanaged` });
|
|
277
282
|
}
|
|
278
283
|
const rank = {
|
|
279
284
|
create: 0,
|
|
@@ -312,7 +317,7 @@ export async function pullServiceAccountsToWorkspace(input) {
|
|
|
312
317
|
const manifest = await serviceAccountManifestFromRecord(input.client, record, input.stableKeyName);
|
|
313
318
|
if (!manifest) {
|
|
314
319
|
const name = String(record.name || serviceAccountIdOf(record) || 'unknown');
|
|
315
|
-
skipped.push({ name, targetPath: name, reason: `missing ${input.stableKeyName}; unmanaged` });
|
|
320
|
+
skipped.push({ name, targetPath: name, reason: isBuiltinSystemAccount(record) ? 'built-in System account is managed by the platform' : `missing ${input.stableKeyName}; unmanaged` });
|
|
316
321
|
continue;
|
|
317
322
|
}
|
|
318
323
|
const errors = validateManifest(manifest, input.stableKeyName);
|
|
@@ -463,10 +468,12 @@ async function buildCreatePayload(client, manifest, stableKeyName) {
|
|
|
463
468
|
return { name: manifest.name, metadata: manifest.metadata, access: await managementAccessPayload(client, manifest, stableKeyName) };
|
|
464
469
|
}
|
|
465
470
|
async function buildBaseUpdatePayload(client, manifest, target, stableKeyName) {
|
|
471
|
+
if (isBuiltinSystemAccount(target))
|
|
472
|
+
throw new Error('The built-in System account cannot be updated by workspace synchronization.');
|
|
466
473
|
if (!Number.isInteger(target.version)) {
|
|
467
474
|
throw new Error('target service-account version is required');
|
|
468
475
|
}
|
|
469
|
-
const ownerChanged = ['group', 'service-account'].includes(manifest.owner.type)
|
|
476
|
+
const ownerChanged = ['group', 'service-account', 'system'].includes(manifest.owner.type)
|
|
470
477
|
&& hashStable(manifest.owner) !== hashStable(await readManagementPrincipal(client, target, stableKeyName));
|
|
471
478
|
return { name: manifest.name, metadata: { ...sanitizeUserMetadata(target.metadata), ...manifest.metadata }, version: target.version,
|
|
472
479
|
...(ownerChanged
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const TRACK_ALL_RESOURCES = "all";
|
|
2
|
-
export declare const TRACKABLE_RESOURCE_TYPES: readonly ["component", "endpoint", "group", "role-group", "job-template", "schedule", "event", "database-table", "database-view", "service-account"];
|
|
2
|
+
export declare const TRACKABLE_RESOURCE_TYPES: readonly ["component", "endpoint", "group", "role-group", "job-template", "schedule", "event", "database-table", "database-view", "service-account", "agent-plugin", "agent"];
|
|
3
3
|
export type TrackableResourceType = typeof TRACKABLE_RESOURCE_TYPES[number];
|
|
4
4
|
export type TrackedResource = typeof TRACK_ALL_RESOURCES | TrackableResourceType;
|
|
5
5
|
export declare function normalizeTrackedResources(value: string | string[] | null | undefined): TrackedResource[];
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export const TRACK_ALL_RESOURCES = 'all';
|
|
2
|
-
export const TRACKABLE_RESOURCE_TYPES = ['component', 'endpoint', 'group', 'role-group', 'job-template', 'schedule', 'event', 'database-table', 'database-view', 'service-account'];
|
|
2
|
+
export const TRACKABLE_RESOURCE_TYPES = ['component', 'endpoint', 'group', 'role-group', 'job-template', 'schedule', 'event', 'database-table', 'database-view', 'service-account', 'agent-plugin', 'agent'];
|
|
3
3
|
const RESOURCE_ALIASES = {
|
|
4
4
|
'service-account': 'service-account',
|
|
5
5
|
'service-accounts': 'service-account',
|
|
6
6
|
serviceaccount: 'service-account',
|
|
7
7
|
serviceaccounts: 'service-account',
|
|
8
|
+
agent: 'agent', agents: 'agent',
|
|
9
|
+
'agent-plugin': 'agent-plugin', 'agent-plugins': 'agent-plugin',
|
|
8
10
|
all: TRACK_ALL_RESOURCES,
|
|
9
11
|
'*': TRACK_ALL_RESOURCES,
|
|
10
12
|
component: 'component',
|
|
@@ -47,7 +49,7 @@ export function normalizeTrackedResources(value) {
|
|
|
47
49
|
}
|
|
48
50
|
const resource = RESOURCE_ALIASES[key];
|
|
49
51
|
if (!resource) {
|
|
50
|
-
throw new Error(`Unsupported tracked resource "${part.trim()}". Supported values: all, component, endpoint, group, role-group, job-template, schedule, event, database-table, database-view.`);
|
|
52
|
+
throw new Error(`Unsupported tracked resource "${part.trim()}". Supported values: all, component, endpoint, group, role-group, job-template, schedule, event, database-table, database-view, service-account, agent-plugin, agent.`);
|
|
51
53
|
}
|
|
52
54
|
if (!normalized.includes(resource)) {
|
|
53
55
|
normalized.push(resource);
|
package/dist/src/types.d.ts
CHANGED
|
@@ -16,6 +16,18 @@ export type CommandContext = {
|
|
|
16
16
|
error: (message: string) => void;
|
|
17
17
|
warn?: (message: string) => void;
|
|
18
18
|
};
|
|
19
|
+
export type AgentRecord = ComponentRecord & {
|
|
20
|
+
agentId?: string;
|
|
21
|
+
serviceAccountUserId?: string;
|
|
22
|
+
config?: Record<string, unknown>;
|
|
23
|
+
policy?: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
export type AgentPluginRecord = ComponentRecord & {
|
|
26
|
+
agentPluginId?: string;
|
|
27
|
+
pluginSlug?: string;
|
|
28
|
+
kind?: string;
|
|
29
|
+
config?: Record<string, unknown>;
|
|
30
|
+
};
|
|
19
31
|
export type ComponentElementRecord = {
|
|
20
32
|
componentElementId?: string;
|
|
21
33
|
key: string;
|
|
@@ -110,6 +122,11 @@ export type DatabaseViewRecord = {
|
|
|
110
122
|
deletedBy?: string | null;
|
|
111
123
|
[key: string]: unknown;
|
|
112
124
|
};
|
|
125
|
+
export type RuntimeExecutionPolicy = {
|
|
126
|
+
mode: 'INHERIT' | 'CALLER' | 'SERVICE_ACCOUNT';
|
|
127
|
+
serviceAccountUserId?: string;
|
|
128
|
+
currentUser?: 'INHERIT' | 'CALLER' | 'EXECUTION_ACCOUNT';
|
|
129
|
+
};
|
|
113
130
|
export type EndpointOptions = {
|
|
114
131
|
input?: Record<string, unknown>;
|
|
115
132
|
guard?: Record<string, unknown>;
|
|
@@ -133,6 +150,7 @@ export type EndpointOptions = {
|
|
|
133
150
|
[key: string]: unknown;
|
|
134
151
|
};
|
|
135
152
|
export type EndpointRecord = {
|
|
153
|
+
executionPolicy?: RuntimeExecutionPolicy | null;
|
|
136
154
|
endpointId?: string;
|
|
137
155
|
id?: string;
|
|
138
156
|
name?: string;
|
|
@@ -172,6 +190,9 @@ export type ServiceAccountAccessRecord = {
|
|
|
172
190
|
}>;
|
|
173
191
|
};
|
|
174
192
|
export type ServiceAccountRecord = {
|
|
193
|
+
status?: number | string;
|
|
194
|
+
platformAccess?: boolean;
|
|
195
|
+
deletedBy?: string | null;
|
|
175
196
|
category?: string | null;
|
|
176
197
|
userId?: string;
|
|
177
198
|
name?: string;
|
|
@@ -228,6 +249,7 @@ export type GroupRecord = {
|
|
|
228
249
|
[key: string]: unknown;
|
|
229
250
|
};
|
|
230
251
|
export type JobTemplateRecord = {
|
|
252
|
+
executionPolicy?: RuntimeExecutionPolicy | null;
|
|
231
253
|
jobTemplateId?: string;
|
|
232
254
|
id?: string;
|
|
233
255
|
name?: string;
|
package/dist/src/ui.js
CHANGED
|
@@ -146,6 +146,10 @@ function renderCommandCatalog() {
|
|
|
146
146
|
commandRow('revo endpoints plan --all [--project <name>] [--json] [--strict]', 'Preview Endpoint state and Component compatibility'),
|
|
147
147
|
commandRow('revo endpoints push --all [--project <name>] [--yes] [--force]', 'Deploy and verify managed endpoints'),
|
|
148
148
|
'',
|
|
149
|
+
paintHeader('Agents and Agent Plugins'),
|
|
150
|
+
commandRow('revo agents <pull|plan|push> --all [--project <name>] [--json]', 'Sync Agent definitions; memory and execution state stay local'),
|
|
151
|
+
commandRow('revo agent-plugins <pull|plan|push> --all [--project <name>] [--json]', 'Sync tools, MCP servers, skills and packages'),
|
|
152
|
+
'',
|
|
149
153
|
paintHeader('Access'),
|
|
150
154
|
commandRow('revo service-accounts pull --all [--project <name>] [--force]', 'Pull portable service-account definitions'),
|
|
151
155
|
commandRow('revo service-accounts plan --all [--project <name>] [--json] [--strict]', 'Plan accounts, owners and manual credential setup'),
|
|
@@ -177,7 +181,7 @@ function renderCommandCatalog() {
|
|
|
177
181
|
commandRow('revo diff [--json]', 'Show only workspace-to-target resource differences without writes'),
|
|
178
182
|
commandRow('revo plan [--prune] [--out file] [--force] [--strict] [--json] [--hints]', 'Plan tracked workspace upserts and optional Stable Key deletions without writes'),
|
|
179
183
|
commandRow('revo deploy [--yes] [--prune] [--reviewed-plan file] [--force] [--json]', 'Review, confirm, deploy and prune tracked resources in dependency order'),
|
|
180
|
-
commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview
|
|
184
|
+
commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview twelve resource families and identity dependencies'),
|
|
181
185
|
commandRow('revo migrate run --from <env> --to <env> [--resources <list>] [--skip-groups] --yes [--force] [--json]', 'Pull, plan, migrate, and verify resources in dependency order'),
|
|
182
186
|
commandRow('revo migrate verify --from <env> --to <env> [--resources <list>] [--json]', 'Verify target resources against a fresh temporary source pull'),
|
|
183
187
|
commandRow('revo search <CODE|SIMPLE> <term>', 'Search code references or all platform content'),
|
|
@@ -9,6 +9,8 @@ function resourceItems(plan, resource) {
|
|
|
9
9
|
case 'schedule': return plan.schedules?.items || [];
|
|
10
10
|
case 'event': return plan.events?.items || [];
|
|
11
11
|
case 'group': return plan.groups?.items || [];
|
|
12
|
+
case 'agent': return plan.agents?.items || [];
|
|
13
|
+
case 'agent-plugin': return plan.agentPlugins?.items || [];
|
|
12
14
|
case 'service-account': return plan.serviceAccounts?.items || [];
|
|
13
15
|
case 'role-group': return plan.roleGroups?.items || [];
|
|
14
16
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { agentDependencies } from "./resource-syncs/agent-sync.js";
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { hashStable, readComponentLock, removeComponentLockBaseline, writeComponentLock } from "./component-lock.js";
|
|
4
5
|
import { readProjectStableKeyName } from "./project.js";
|
|
5
6
|
import { readResourceInventory, resourceIdOf } from "./resource-inventory.js";
|
|
6
7
|
import { normalizeStableKeyValue, readConfiguredResourceMetadataStableKey } from "./resource-metadata.js";
|
|
8
|
+
import { isBuiltinSystemAccount } from "./resource-syncs/account-principal.js";
|
|
7
9
|
import { findManifestFiles, isRecord, requireProjectLayout } from "./resource-syncs/util.js";
|
|
8
10
|
const manifests = {
|
|
11
|
+
agent: ['Agents', 'agent.json'],
|
|
12
|
+
'agent-plugin': ['AgentPlugins', 'agent-plugin.json'],
|
|
9
13
|
component: ['Components', 'component.json'],
|
|
10
14
|
'job-template': ['JobTemplates', 'job-template.json'],
|
|
11
15
|
endpoint: ['Endpoints', 'endpoint.json'],
|
|
@@ -18,7 +22,7 @@ const manifests = {
|
|
|
18
22
|
'service-account': ['ServiceAccounts', 'service-account.json'],
|
|
19
23
|
};
|
|
20
24
|
const deletionOrder = [
|
|
21
|
-
'event', 'schedule', 'endpoint', 'job-template', 'component',
|
|
25
|
+
'agent', 'agent-plugin', 'event', 'schedule', 'endpoint', 'job-template', 'component',
|
|
22
26
|
'database-view', 'database-table', 'role-group', 'service-account', 'group',
|
|
23
27
|
];
|
|
24
28
|
function key(resource, identity) {
|
|
@@ -64,6 +68,9 @@ function localReferences(resource, manifest) {
|
|
|
64
68
|
if (typeof value === 'string' && value)
|
|
65
69
|
refs.push({ resource: family, identity: value });
|
|
66
70
|
};
|
|
71
|
+
if (resource === 'agent' || resource === 'agent-plugin')
|
|
72
|
+
for (const [family, dependency] of agentDependencies(manifest))
|
|
73
|
+
add(family, dependency);
|
|
67
74
|
if (resource === 'job-template' && isRecord(manifest.component))
|
|
68
75
|
add('component', manifest.component.stableKey);
|
|
69
76
|
if (resource === 'endpoint') {
|
|
@@ -91,6 +98,8 @@ function localReferences(resource, manifest) {
|
|
|
91
98
|
}
|
|
92
99
|
if (isRecord(manifest.executionPrincipal))
|
|
93
100
|
add('service-account', manifest.executionPrincipal.stableKey);
|
|
101
|
+
if (isRecord(manifest.executionPolicy) && isRecord(manifest.executionPolicy.serviceAccount) && manifest.executionPolicy.serviceAccount.kind === 'service-account')
|
|
102
|
+
add('service-account', manifest.executionPolicy.serviceAccount.stableKey);
|
|
94
103
|
return refs;
|
|
95
104
|
}
|
|
96
105
|
function remoteReferences(resource, record, tables) {
|
|
@@ -99,12 +108,37 @@ function remoteReferences(resource, record, tables) {
|
|
|
99
108
|
if (typeof value === 'string' && value)
|
|
100
109
|
refs.push({ resource: family, identity: value, targetLocal });
|
|
101
110
|
};
|
|
111
|
+
if (resource === 'agent')
|
|
112
|
+
add('service-account', record.serviceAccountUserId);
|
|
113
|
+
const sections = resource === 'agent' ? [record.config, record.policy] : resource === 'agent-plugin' ? [record.config] : [];
|
|
114
|
+
function pluginRefs(value) {
|
|
115
|
+
if (!isRecord(value))
|
|
116
|
+
return;
|
|
117
|
+
add('component', value.componentId);
|
|
118
|
+
for (const kind of ['skill', 'package'])
|
|
119
|
+
if (isRecord(value[kind]) && Array.isArray(value[kind].pluginIds))
|
|
120
|
+
for (const id of value[kind].pluginIds)
|
|
121
|
+
add('agent-plugin', id);
|
|
122
|
+
}
|
|
123
|
+
for (const section of sections)
|
|
124
|
+
if (isRecord(section)) {
|
|
125
|
+
for (const field of ['pluginIds', 'eagerPluginIds'])
|
|
126
|
+
if (Array.isArray(section[field]))
|
|
127
|
+
for (const id of section[field])
|
|
128
|
+
add('agent-plugin', id);
|
|
129
|
+
if (Array.isArray(section.plugins))
|
|
130
|
+
for (const plugin of section.plugins)
|
|
131
|
+
pluginRefs(plugin);
|
|
132
|
+
pluginRefs(section);
|
|
133
|
+
}
|
|
102
134
|
if (resource === 'job-template' || resource === 'endpoint')
|
|
103
135
|
add('component', record.componentId);
|
|
104
136
|
if (resource === 'endpoint' && isRecord(record.options))
|
|
105
137
|
add('component', record.options.componentSchemaId);
|
|
106
138
|
if (resource === 'job-template')
|
|
107
139
|
add('service-account', record.triggerUser);
|
|
140
|
+
if ((resource === 'job-template' || resource === 'endpoint') && isRecord(record.executionPolicy) && record.executionPolicy.mode === 'SERVICE_ACCOUNT')
|
|
141
|
+
add('service-account', record.executionPolicy.serviceAccountUserId);
|
|
108
142
|
if (resource === 'schedule' || resource === 'event') {
|
|
109
143
|
add(record.targetType === 'JOB_TEMPLATE' ? 'job-template' : 'database-view', record.targetId);
|
|
110
144
|
}
|
|
@@ -174,7 +208,7 @@ export function planWorkspacePrune(input) {
|
|
|
174
208
|
throw new Error(`Repeated ${resource} target ID "${id}".`);
|
|
175
209
|
const stableKey = readConfiguredResourceMetadataStableKey(record, input.stableKeyName);
|
|
176
210
|
byId.set(key(resource, id), { resource, record, stableKey });
|
|
177
|
-
if (!stableKey)
|
|
211
|
+
if (!stableKey || isBuiltinSystemAccount(record))
|
|
178
212
|
continue;
|
|
179
213
|
const identity = normalizeStableKeyValue(stableKey);
|
|
180
214
|
if (keys.has(identity))
|
|
@@ -182,6 +216,8 @@ export function planWorkspacePrune(input) {
|
|
|
182
216
|
keys.add(identity);
|
|
183
217
|
if (!input.resources.includes(resource) || input.local[resource]?.has(identity))
|
|
184
218
|
continue;
|
|
219
|
+
if (resource === 'agent' || resource === 'agent-plugin')
|
|
220
|
+
blockers.push(`Prune of ${resource} is not supported; remove it explicitly after reviewing runs and dependencies.`);
|
|
185
221
|
if (resource === 'service-account' && (record.serviceAccount !== true || id === input.actorId)) {
|
|
186
222
|
blockers.push(`Cannot prune the authenticated account or a human account "${stableKey}".`);
|
|
187
223
|
}
|
|
@@ -303,7 +339,11 @@ export async function buildWorkspacePrunePlan(input) {
|
|
|
303
339
|
if (resources.has('component')) {
|
|
304
340
|
resources.add('job-template');
|
|
305
341
|
resources.add('endpoint');
|
|
342
|
+
resources.add('agent-plugin');
|
|
343
|
+
resources.add('agent');
|
|
306
344
|
}
|
|
345
|
+
if (resources.has('agent-plugin'))
|
|
346
|
+
resources.add('agent');
|
|
307
347
|
if (resources.has('job-template')) {
|
|
308
348
|
resources.add('event');
|
|
309
349
|
resources.add('schedule');
|
|
@@ -319,6 +359,7 @@ export async function buildWorkspacePrunePlan(input) {
|
|
|
319
359
|
resources.add('group');
|
|
320
360
|
resources.add('service-account');
|
|
321
361
|
resources.add('job-template');
|
|
362
|
+
resources.add('agent');
|
|
322
363
|
}
|
|
323
364
|
const local = readPruneManifests(input.cwd, input.resources);
|
|
324
365
|
const inventory = {};
|
|
@@ -368,7 +409,7 @@ function clearPruneBaseline(cwd, envName, item) {
|
|
|
368
409
|
const fields = {
|
|
369
410
|
'job-template': 'jobTemplates', endpoint: 'endpoints', schedule: 'schedules', event: 'events',
|
|
370
411
|
'database-table': 'databaseSchemas', 'database-view': 'databaseViews', group: 'groups',
|
|
371
|
-
'role-group': 'roleGroups', 'service-account': 'serviceAccounts',
|
|
412
|
+
'role-group': 'roleGroups', 'service-account': 'serviceAccounts', agent: 'agents', 'agent-plugin': 'agentPlugins',
|
|
372
413
|
};
|
|
373
414
|
const entries = lock[fields[item.resource]];
|
|
374
415
|
const entry = Object.values(entries).find((value) => normalizeStableKeyValue(value.stableKey) === normalizeStableKeyValue(item.stableKey));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revoengine/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
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/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/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/migration-actions.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/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/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",
|