@revoengine/cli 1.0.11 → 1.0.13

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.
Files changed (81) hide show
  1. package/README.md +275 -479
  2. package/dist/src/cli.js +71 -5
  3. package/dist/src/client.d.ts +28 -12
  4. package/dist/src/client.js +234 -66
  5. package/dist/src/commands/component.d.ts +67 -0
  6. package/dist/src/commands/component.js +299 -27
  7. package/dist/src/commands/database-tables.d.ts +2 -0
  8. package/dist/src/commands/{database-schemas.js → database-tables.js} +21 -40
  9. package/dist/src/commands/database-views.js +21 -18
  10. package/dist/src/commands/endpoints.js +26 -16
  11. package/dist/src/commands/events.js +18 -20
  12. package/dist/src/commands/groups.js +13 -22
  13. package/dist/src/commands/index.d.ts +2 -1
  14. package/dist/src/commands/index.js +2 -1
  15. package/dist/src/commands/job-templates.js +21 -15
  16. package/dist/src/commands/metadata.js +58 -15
  17. package/dist/src/commands/migrate.d.ts +6 -0
  18. package/dist/src/commands/migrate.js +658 -0
  19. package/dist/src/commands/project.js +4 -4
  20. package/dist/src/commands/role-groups.js +14 -25
  21. package/dist/src/commands/schedules.js +19 -20
  22. package/dist/src/commands/terminal-browser.d.ts +16 -0
  23. package/dist/src/commands/terminal-browser.js +92 -0
  24. package/dist/src/commands/terminal-image.d.ts +7 -0
  25. package/dist/src/commands/terminal-image.js +40 -0
  26. package/dist/src/commands/terminal-patch-worker.d.ts +1 -0
  27. package/dist/src/commands/terminal-patch-worker.js +24 -0
  28. package/dist/src/commands/terminal-patch.d.ts +2 -0
  29. package/dist/src/commands/terminal-patch.js +156 -0
  30. package/dist/src/commands/terminal-sandbox.d.ts +8 -0
  31. package/dist/src/commands/terminal-sandbox.js +87 -0
  32. package/dist/src/commands/terminal-service.js +2 -2
  33. package/dist/src/commands/terminal.d.ts +31 -4
  34. package/dist/src/commands/terminal.js +360 -45
  35. package/dist/src/component-lock.d.ts +12 -2
  36. package/dist/src/component-lock.js +60 -1
  37. package/dist/src/diff-details.d.ts +8 -0
  38. package/dist/src/diff-details.js +152 -0
  39. package/dist/src/env-sync.js +8 -6
  40. package/dist/src/http-trace.d.ts +94 -0
  41. package/dist/src/http-trace.js +226 -0
  42. package/dist/src/metadata-backfill.d.ts +5 -4
  43. package/dist/src/metadata-backfill.js +82 -158
  44. package/dist/src/migration.d.ts +141 -0
  45. package/dist/src/migration.js +1632 -0
  46. package/dist/src/resource-inventory.d.ts +28 -0
  47. package/dist/src/resource-inventory.js +85 -0
  48. package/dist/src/resource-syncs/{database-schema-sync.d.ts → database-table-sync.d.ts} +13 -3
  49. package/dist/src/resource-syncs/{database-schema-sync.js → database-table-sync.js} +147 -62
  50. package/dist/src/resource-syncs/database-view-sync.d.ts +24 -2
  51. package/dist/src/resource-syncs/database-view-sync.js +156 -68
  52. package/dist/src/resource-syncs/endpoint-sync.d.ts +27 -0
  53. package/dist/src/resource-syncs/endpoint-sync.js +362 -82
  54. package/dist/src/resource-syncs/event-sync.d.ts +27 -0
  55. package/dist/src/resource-syncs/event-sync.js +123 -26
  56. package/dist/src/resource-syncs/group-sync.d.ts +7 -0
  57. package/dist/src/resource-syncs/group-sync.js +60 -14
  58. package/dist/src/resource-syncs/job-template-sync.d.ts +21 -0
  59. package/dist/src/resource-syncs/job-template-sync.js +91 -30
  60. package/dist/src/resource-syncs/role-group-sync.d.ts +7 -0
  61. package/dist/src/resource-syncs/role-group-sync.js +47 -9
  62. package/dist/src/resource-syncs/schedule-sync.d.ts +30 -1
  63. package/dist/src/resource-syncs/schedule-sync.js +114 -20
  64. package/dist/src/resource-syncs/util.d.ts +3 -0
  65. package/dist/src/resource-syncs/util.js +8 -6
  66. package/dist/src/resource-target.d.ts +11 -0
  67. package/dist/src/resource-target.js +48 -0
  68. package/dist/src/sync-output.d.ts +29 -1
  69. package/dist/src/sync-output.js +139 -2
  70. package/dist/src/tracked-resources.d.ts +1 -1
  71. package/dist/src/tracked-resources.js +8 -6
  72. package/dist/src/types.d.ts +3 -0
  73. package/dist/src/ui.js +18 -9
  74. package/dist/src/utils.d.ts +2 -0
  75. package/dist/src/utils.js +17 -0
  76. package/dist/src/workspace-diff.d.ts +25 -0
  77. package/dist/src/workspace-diff.js +75 -0
  78. package/package.json +9 -6
  79. package/dist/src/commands/database-schemas.d.ts +0 -2
  80. /package/dist/src/{database-schema-artifacts.d.ts → database-table-artifacts.d.ts} +0 -0
  81. /package/dist/src/{database-schema-artifacts.js → database-table-artifacts.js} +0 -0
@@ -1,3 +1,33 @@
1
+ import { formatDiffValue } from "./diff-details.js";
2
+ export function planValueChanges(changes) {
3
+ if (changes.length === 0) {
4
+ return [];
5
+ }
6
+ return [{
7
+ label: 'changes',
8
+ diffs: changes.map((change) => ({
9
+ field: change.field,
10
+ ...(change.risk ? { risk: change.risk } : {}),
11
+ before: formatDiffValue(change.before, change.field),
12
+ after: formatDiffValue(change.after, change.field),
13
+ })),
14
+ }];
15
+ }
16
+ export function planListChanges(label, removed = [], added = []) {
17
+ const lines = [
18
+ ...removed.map((value) => `- ${value}`),
19
+ ...added.map((value) => `+ ${value}`),
20
+ ];
21
+ return lines.length > 0 ? [{ label, lines }] : [];
22
+ }
23
+ export function planDependencyHints(dependency) {
24
+ return [
25
+ { label: 'dependency', values: `${dependency.resource}:${dependency.stableKey} (${dependency.readiness})` },
26
+ { label: 'expected hash', values: dependency.expectedHash || '<not projected>' },
27
+ { label: 'projected hash', values: dependency.projectedHash || '<not projected>' },
28
+ { label: 'actual hash', values: dependency.actualHash || '<missing>' },
29
+ ];
30
+ }
1
31
  const ANSI = {
2
32
  reset: '\u001b[0m',
3
33
  bold: '\u001b[1m',
@@ -8,6 +38,10 @@ const ANSI = {
8
38
  cyan: '\u001b[36m',
9
39
  blue: '\u001b[34m',
10
40
  magenta: '\u001b[35m',
41
+ white: '\u001b[97m',
42
+ black: '\u001b[30m',
43
+ redBackground: '\u001b[41m',
44
+ greenBackground: '\u001b[42m',
11
45
  };
12
46
  function supportsColor() {
13
47
  return Boolean(process.stdout.isTTY || process.env.FORCE_COLOR);
@@ -48,6 +82,7 @@ const PLAN_STATUS_MARKS = {
48
82
  'safe-update': { symbol: '~', code: ANSI.bold + ANSI.yellow },
49
83
  'remote-changed': { symbol: '>', code: ANSI.bold + ANSI.magenta },
50
84
  conflict: { symbol: '!', code: ANSI.bold + ANSI.red },
85
+ 'validation-failed': { symbol: '!', code: ANSI.bold + ANSI.red },
51
86
  'missing-lock': { symbol: '?', code: ANSI.bold + ANSI.red },
52
87
  reconciled: { symbol: '=', code: ANSI.bold + ANSI.cyan },
53
88
  'manual-schema-migration-required': { symbol: '!', code: ANSI.bold + ANSI.red },
@@ -65,8 +100,23 @@ const PLAN_STATUS_MARKS = {
65
100
  'replacement-requires-two-phases': { symbol: '!', code: ANSI.bold + ANSI.yellow },
66
101
  };
67
102
  function planDetailValue(values) {
103
+ if (values === undefined) {
104
+ return '';
105
+ }
68
106
  return typeof values === 'string' ? values : values.join(', ');
69
107
  }
108
+ function paintPlanDiffLine(line) {
109
+ if (line.startsWith('-')) {
110
+ return paint(line, ANSI.redBackground + ANSI.white);
111
+ }
112
+ if (line.startsWith('+')) {
113
+ return paint(line, ANSI.greenBackground + ANSI.black);
114
+ }
115
+ if (line.startsWith('@@')) {
116
+ return paint(line, ANSI.cyan);
117
+ }
118
+ return paint(line, ANSI.dim);
119
+ }
70
120
  function printPlanSection(println, label, messages) {
71
121
  if (messages.length === 0) {
72
122
  return;
@@ -83,12 +133,52 @@ export function printSyncPlan(println, input) {
83
133
  const mark = PLAN_STATUS_MARKS[item.status] || { symbol: '-', code: ANSI.dim };
84
134
  const target = item.target || item.stableKey || item.name || 'unknown';
85
135
  println(`${paint(mark.symbol, mark.code)} ${paint(item.status.padEnd(14), mark.code)} ${paint(target, ANSI.cyan)}`);
136
+ const lineDiffFields = new Set((item.details || []).filter((detail) => detail.label === 'rawQuery diff' && detail.lines?.length)
137
+ .map(() => 'rawQuery'));
138
+ const fieldChanges = item.status === 'create'
139
+ ? []
140
+ : (item.fieldChanges || []).filter((change) => !lineDiffFields.has(change.field));
141
+ const describedFields = new Set([
142
+ ...fieldChanges.map((change) => change.field),
143
+ ...(item.details || []).flatMap((detail) => detail.diffs?.map((diff) => diff.field) || []),
144
+ ]);
145
+ const remainingFields = item.changedFields?.filter((field) => !describedFields.has(field) && !lineDiffFields.has(field)) || [];
86
146
  const details = [
87
- ...(item.reason ? [{ label: 'reason', values: item.reason }] : []),
88
- ...(item.changedFields?.length ? [{ label: 'fields', values: item.changedFields }] : []),
147
+ ...(remainingFields.length ? [{ label: 'fields', values: remainingFields }] : []),
148
+ ...(fieldChanges.length ? [{
149
+ label: 'changes',
150
+ diffs: fieldChanges.map((change) => ({
151
+ field: change.field,
152
+ before: change.target,
153
+ after: change.workspace,
154
+ })),
155
+ }] : []),
89
156
  ...(item.details || []),
157
+ ...(input.showHints === true ? item.hints || [] : []),
90
158
  ];
91
159
  for (const detail of details) {
160
+ if (detail.label === 'reason') {
161
+ continue;
162
+ }
163
+ if (detail.label === 'hints' && input.showHints !== true) {
164
+ continue;
165
+ }
166
+ if (detail.lines?.length) {
167
+ println(` ${paint(detail.label, ANSI.dim)}`);
168
+ for (const line of detail.lines) {
169
+ println(` ${paintPlanDiffLine(line)}`);
170
+ }
171
+ continue;
172
+ }
173
+ if (detail.diffs?.length) {
174
+ println(` ${paint(detail.label, ANSI.dim)}`);
175
+ for (const diff of detail.diffs) {
176
+ println(` ${paint(`${diff.field}${diff.risk ? ` (${diff.risk})` : ''}`, ANSI.bold)}`);
177
+ println(` ${paintPlanDiffLine(`- ${diff.before}`)}`);
178
+ println(` ${paintPlanDiffLine(`+ ${diff.after}`)}`);
179
+ }
180
+ continue;
181
+ }
92
182
  const value = planDetailValue(detail.values);
93
183
  if (value) {
94
184
  println(` ${paint(detail.label.padEnd(14), ANSI.dim)} ${value}`);
@@ -102,6 +192,53 @@ export function printSyncPlan(println, input) {
102
192
  printPlanSection(println, 'Warnings', input.warnings || []);
103
193
  printPlanSection(println, 'Blockers', input.blockers || []);
104
194
  }
195
+ const DIFF_KIND_STYLE = {
196
+ create: { symbol: '+', code: ANSI.bold + ANSI.green },
197
+ update: { symbol: '~', code: ANSI.bold + ANSI.yellow },
198
+ 'target-only': { symbol: '-', code: ANSI.dim + ANSI.cyan },
199
+ };
200
+ export function printWorkspaceDiff(println, diff) {
201
+ println(`${paint('Workspace diff', ANSI.bold)} for ${paint(diff.to, ANSI.bold + ANSI.cyan)}`);
202
+ if (diff.changes.length === 0) {
203
+ println(paint('No differences.', ANSI.green));
204
+ return;
205
+ }
206
+ for (const change of diff.changes) {
207
+ const style = DIFF_KIND_STYLE[change.kind];
208
+ println(`${paint(style.symbol, style.code)} ${paint(change.resource, style.code)} ${paint(change.identity, ANSI.cyan)} ${paint(`(${change.kind})`, style.code)}`);
209
+ if (change.resource === 'component' && change.kind === 'create') {
210
+ continue;
211
+ }
212
+ const describedFields = new Set(change.fieldChanges?.map((field) => field.field) || []);
213
+ const remainingFields = (change.fields || []).filter((field) => !describedFields.has(field) && field !== 'elements');
214
+ if (remainingFields.length > 0) {
215
+ println(` ${paint('changed fields:', ANSI.dim)} ${remainingFields.join(', ')}`);
216
+ }
217
+ for (const field of change.fieldChanges || []) {
218
+ println(` ${paint(`${field.field}:`, ANSI.bold)}`);
219
+ println(` ${paintPlanDiffLine(`- ${field.target}`)}`);
220
+ println(` ${paintPlanDiffLine(`+ ${field.workspace}`)}`);
221
+ }
222
+ for (const code of change.codeDiffs || []) {
223
+ const label = code.element === 'rawQuery' ? 'rawQuery diff:' : `element ${code.element}:`;
224
+ println(` ${paint(label, ANSI.bold)}`);
225
+ for (const line of code.lines) {
226
+ println(` ${paintPlanDiffLine(line)}`);
227
+ }
228
+ }
229
+ for (const role of change.rolesToRemove || []) {
230
+ println(` ${paintPlanDiffLine(`- role ${role}`)}`);
231
+ }
232
+ for (const role of change.rolesToAdd || []) {
233
+ println(` ${paintPlanDiffLine(`+ role ${role}`)}`);
234
+ }
235
+ if (change.kind === 'update' && !change.fieldChanges?.length && !change.codeDiffs?.length
236
+ && !change.rolesToAdd?.length && !change.rolesToRemove?.length && remainingFields.length === 0) {
237
+ println(` ${paint('target hash:', ANSI.dim)} ${(change.targetHash || '').slice(0, 12)}`);
238
+ println(` ${paint('workspace hash:', ANSI.dim)} ${(change.workspaceHash || '').slice(0, 12)}`);
239
+ }
240
+ }
241
+ }
105
242
  export function printSyncStatus(println, input) {
106
243
  const engine = paint('RevoEngine', ANSI.bold + ANSI.blue);
107
244
  const arrow = paint(input.direction === 'pull' ? '->' : '<-', ANSI.bold + ANSI.magenta);
@@ -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-schema", "database-view"];
2
+ export declare const TRACKABLE_RESOURCE_TYPES: readonly ["component", "endpoint", "group", "role-group", "job-template", "schedule", "event", "database-table", "database-view"];
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,5 +1,5 @@
1
1
  export const TRACK_ALL_RESOURCES = 'all';
2
- export const TRACKABLE_RESOURCE_TYPES = ['component', 'endpoint', 'group', 'role-group', 'job-template', 'schedule', 'event', 'database-schema', 'database-view'];
2
+ export const TRACKABLE_RESOURCE_TYPES = ['component', 'endpoint', 'group', 'role-group', 'job-template', 'schedule', 'event', 'database-table', 'database-view'];
3
3
  const RESOURCE_ALIASES = {
4
4
  all: TRACK_ALL_RESOURCES,
5
5
  '*': TRACK_ALL_RESOURCES,
@@ -21,10 +21,12 @@ const RESOURCE_ALIASES = {
21
21
  schedules: 'schedule',
22
22
  event: 'event',
23
23
  events: 'event',
24
- 'database-schema': 'database-schema',
25
- 'database-schemas': 'database-schema',
26
- database: 'database-schema',
27
- databases: 'database-schema',
24
+ 'database-table': 'database-table',
25
+ 'database-tables': 'database-table',
26
+ 'database-schema': 'database-table',
27
+ 'database-schemas': 'database-table',
28
+ database: 'database-table',
29
+ databases: 'database-table',
28
30
  'database-view': 'database-view',
29
31
  'database-views': 'database-view',
30
32
  databaseview: 'database-view',
@@ -41,7 +43,7 @@ export function normalizeTrackedResources(value) {
41
43
  }
42
44
  const resource = RESOURCE_ALIASES[key];
43
45
  if (!resource) {
44
- throw new Error(`Unsupported tracked resource "${part.trim()}". Supported values: all, component, endpoint, group, role-group, job-template, schedule, event, database-schema, database-view.`);
46
+ throw new Error(`Unsupported tracked resource "${part.trim()}". Supported values: all, component, endpoint, group, role-group, job-template, schedule, event, database-table, database-view.`);
45
47
  }
46
48
  if (!normalized.includes(resource)) {
47
49
  normalized.push(resource);
@@ -187,6 +187,8 @@ export type GroupRecord = {
187
187
  avatar?: string | null;
188
188
  memberCount?: number;
189
189
  version?: number;
190
+ deletedAt?: string | null;
191
+ deletedBy?: string | null;
190
192
  metadata?: Record<string, unknown>;
191
193
  metaData?: Record<string, unknown>;
192
194
  resourceMetadata?: Record<string, unknown>;
@@ -248,6 +250,7 @@ export type EventRecord = {
248
250
  desc?: string;
249
251
  description?: string;
250
252
  active?: boolean;
253
+ custom?: boolean;
251
254
  type?: string;
252
255
  targetType?: string;
253
256
  targetId?: string;
package/dist/src/ui.js CHANGED
@@ -96,7 +96,9 @@ function renderCommandCatalog() {
96
96
  paintHeader('Global Options'),
97
97
  commandRow('--project <name>', 'Use one saved project for this command'),
98
98
  commandRow('--url <url>', 'Override API base URL for TEST, prod, local, or dedicated tenants'),
99
+ commandRow('--instance <uuid>', 'Override target instance for tenant-scoped requests'),
99
100
  commandRow('--token <apiKey>', 'Override API key for non-interactive runs'),
101
+ commandRow('--hints', 'Show per-resource hints in human-readable plans'),
100
102
  commandRow('--no-update-notifier', 'Disable npm version update checks for this run'),
101
103
  '',
102
104
  paintHeader('Projects'),
@@ -123,20 +125,20 @@ function renderCommandCatalog() {
123
125
  commandRow('revo terminal disconnect --workspace <path>', 'Revoke a local terminal grant'),
124
126
  '',
125
127
  paintHeader('Components'),
126
- commandRow('revo component plan --all [--project <name>] [--json] [--strict] [--changed --base <ref>]', 'Preview local/remote sync status'),
128
+ commandRow('revo component plan --all [--project <name>] [--json] [--strict] [--hints] [--prune] [--changed --base <ref>]', 'Preview local/remote sync status'),
127
129
  commandRow('revo component pull <identity...> [--project <name>] [--force]', 'Pull by configured stable key or component ID'),
128
130
  commandRow('revo component pull --all [--project <name>] [--yes] [--force]', 'Pull every available component safely'),
129
131
  commandRow('revo component push <identity...> [--project <name>]', 'Push by configured stable key or component ID'),
130
- commandRow('revo component push --all [--project <name>] [--yes] [--force] [--changed --base <ref>]', 'Push local components with lock checks'),
132
+ commandRow('revo component push --all [--project <name>] [--yes] [--force] [--prune] [--changed --base <ref>]', 'Push local components with lock checks'),
131
133
  commandRow('revo component debug <componentId> [BODY] [--stream] [--raw-debug]', 'Debug one local component against sandbox'),
132
134
  '',
133
135
  paintHeader('Databases'),
134
- commandRow('revo database-schemas pull --all [--project <name>] [--force] [--strict]', 'Pull portable Database Schemas and partitions'),
135
- commandRow('revo database-schemas plan --all [--project <name>] [--with-stats] [--json] [--strict]', 'Preview schema drift, DDL risks, partitions, and performance hints'),
136
- commandRow('revo database-schemas push <stableKey>|--all [--project <name>] --yes [--force] [--prune-partitions]', 'Create, safely update, or explicitly prune managed partitions'),
137
- commandRow('revo database-views pull --all [--project <name>] [--force] [--strict]', 'Pull portable STRUCTURED and RAW_SQL Database Views after Database Schema convergence'),
138
- commandRow('revo database-views plan --all [--project <name>] [--json] [--strict]', 'Preview Database View drift, source readiness, and target compilation'),
139
- commandRow('revo database-views push <stableKey>|--all [--project <name>] --yes [--force] [--allow-materialized]', 'Create or update Database Views after live preview'),
136
+ commandRow('revo database-tables pull --all [--project <name>] [--force] [--strict]', 'Pull portable Database Tables and partitions'),
137
+ commandRow('revo database-tables plan --all [--project <name>] [--with-stats] [--json] [--strict] [--hints]', 'Preview schema drift, DDL risks, partitions, and performance hints'),
138
+ commandRow('revo database-tables push <stableKey>|--all [--project <name>] --yes [--force] [--prune-partitions]', 'Create, safely update, or explicitly prune managed partitions'),
139
+ commandRow('revo database-views pull --all [--project <name>] [--force] [--strict]', 'Pull portable STRUCTURED and RAW_SQL Database Views after Database Table convergence'),
140
+ commandRow('revo database-views plan --all [--project <name>] [--json] [--strict] [--hints]', 'Preview Database View drift, source readiness, and target compilation'),
141
+ commandRow('revo database-views push <stableKey>|--all [--project <name>] --yes [--force]', 'Create or update Database Views after live preview'),
140
142
  '',
141
143
  paintHeader('Endpoints'),
142
144
  commandRow('revo endpoints', 'List available API endpoints'),
@@ -158,7 +160,7 @@ function renderCommandCatalog() {
158
160
  commandRow('revo job-templates push --all [--project <name>] --yes [--force] [--json]', 'Create or safely update job templates with live lock checks'),
159
161
  commandRow('revo schedules pull --all [--project <name>] [--force]', 'Pull Job Template and Materialized View schedules into the configured workspace'),
160
162
  commandRow('revo schedules plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, target schedules, and portable dependencies'),
161
- commandRow('revo schedules push --all [--project <name>] --yes [--force] [--allow-materialized] [--activate] [--json]', 'Create or safely update disabled-by-default Schedule definitions'),
163
+ commandRow('revo schedules push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Create or safely update disabled-by-default Schedule definitions'),
162
164
  commandRow('revo events pull --all [--project <name>] [--force] [--json]', 'Pull portable Job Template Event definitions into the configured workspace'),
163
165
  commandRow('revo events plan --all [--project <name>] [--json] [--strict]', 'Preview Event manifests, lock baselines, target state, and Job Template dependencies'),
164
166
  commandRow('revo events push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Create or safely update disabled-by-default Event definitions'),
@@ -168,6 +170,13 @@ function renderCommandCatalog() {
168
170
  commandRow('revo env apply --from <env> --to <env> [--yes] [--prune] [--force]', 'Mirror components from one project into another'),
169
171
  commandRow('revo metadata plan [--project <name>] [--skip-partitions] [--json]', 'Preview stable-key metadata backfill'),
170
172
  commandRow('revo metadata apply [--project <name>] --yes [--skip-partitions]', 'Populate missing stable-key metadata'),
173
+ commandRow('revo pull --all|--resources <list> --yes [--skip-groups] [--force] [--json]', 'Build the repository workspace from the configured runtime source'),
174
+ commandRow('revo diff [--json]', 'Show only workspace-to-target resource differences without writes'),
175
+ commandRow('revo plan [--force] [--strict] [--json] [--hints]', 'Plan deployment of tracked workspace resources to the configured runtime target without writes'),
176
+ commandRow('revo deploy --yes [--force] [--json]', 'Deploy tracked workspace resources to the configured runtime target in dependency order'),
177
+ commandRow('revo migrate plan --from <env> --to <env> [--resources <list>] [--skip-groups] [--force] [--json] [--hints]', 'Preview nine phases through Groups and Role Groups'),
178
+ commandRow('revo migrate run --from <env> --to <env> [--resources <list>] [--skip-groups] --yes [--force] [--json]', 'Pull, plan, migrate, and verify resources in dependency order'),
179
+ commandRow('revo migrate verify --from <env> --to <env> [--resources <list>] [--json]', 'Verify target resources against a fresh temporary source pull'),
171
180
  commandRow('revo search <CODE|SIMPLE> <term>', 'Search code references or all platform content'),
172
181
  commandRow('revo request <METHOD> <PATH> [BODY]', 'Make a raw API request with optional JSON body'),
173
182
  ].join('\n');
@@ -10,3 +10,5 @@ export declare function readJsonFile(filePath: string): any;
10
10
  export declare function writeJsonFile(filePath: string, data: unknown): void;
11
11
  export declare function deepClone<T>(value: T): T;
12
12
  export declare function readPackageVersion(): string;
13
+ export declare const DEFAULT_RESOURCE_CONCURRENCY = 10;
14
+ export declare function mapWithConcurrency<T, R>(items: readonly T[], mapper: (item: T, index: number) => Promise<R>, concurrency?: number): Promise<R[]>;
package/dist/src/utils.js CHANGED
@@ -148,3 +148,20 @@ export function readPackageVersion() {
148
148
  const raw = fs.readFileSync(packageJsonPath, 'utf8');
149
149
  return JSON.parse(raw).version;
150
150
  }
151
+ export const DEFAULT_RESOURCE_CONCURRENCY = 10;
152
+ export async function mapWithConcurrency(items, mapper, concurrency = DEFAULT_RESOURCE_CONCURRENCY) {
153
+ if (items.length === 0) {
154
+ return [];
155
+ }
156
+ const limit = Math.max(1, Math.min(concurrency, items.length));
157
+ const results = new Array(items.length);
158
+ let currentIndex = 0;
159
+ const workers = Array.from({ length: limit }, async () => {
160
+ while (currentIndex < items.length) {
161
+ const index = currentIndex++;
162
+ results[index] = await mapper(items[index], index);
163
+ }
164
+ });
165
+ await Promise.all(workers);
166
+ return results;
167
+ }
@@ -0,0 +1,25 @@
1
+ import { type FieldChange } from './diff-details.ts';
2
+ import type { MigrationPlan, MigrationResource } from './migration.ts';
3
+ export type WorkspaceDiffChange = {
4
+ resource: MigrationResource;
5
+ identity: string;
6
+ kind: 'create' | 'update' | 'target-only';
7
+ fields?: string[];
8
+ fieldChanges?: FieldChange[];
9
+ codeDiffs?: Array<{
10
+ element: string;
11
+ lines: string[];
12
+ }>;
13
+ rolesToAdd?: string[];
14
+ rolesToRemove?: string[];
15
+ targetHash?: string;
16
+ workspaceHash?: string;
17
+ };
18
+ export type WorkspaceDiff = {
19
+ schemaVersion: 1;
20
+ command: 'diff';
21
+ from: 'workspace';
22
+ to: string;
23
+ changes: WorkspaceDiffChange[];
24
+ };
25
+ export declare function buildWorkspaceDiff(plan: MigrationPlan): WorkspaceDiff;
@@ -0,0 +1,75 @@
1
+ import { formatDiffValue } from "./diff-details.js";
2
+ function resourceItems(plan, resource) {
3
+ switch (resource) {
4
+ case 'database-table': return plan.databaseSchemas?.items || [];
5
+ case 'database-view': return plan.databaseViews?.items || [];
6
+ case 'component': return plan.components?.items || [];
7
+ case 'job-template': return plan.jobTemplates?.items || [];
8
+ case 'endpoint': return plan.endpoints?.items || [];
9
+ case 'schedule': return plan.schedules?.items || [];
10
+ case 'event': return plan.events?.items || [];
11
+ case 'group': return plan.groups?.items || [];
12
+ case 'role-group': return plan.roleGroups?.items || [];
13
+ }
14
+ }
15
+ function classify(item, resource) {
16
+ const workspaceHash = item.desiredHash ?? item.localHash ?? null;
17
+ const targetHash = item.currentHash ?? item.remoteHash ?? null;
18
+ if (workspaceHash && targetHash) {
19
+ return workspaceHash !== targetHash || (resource !== 'database-table' && (item.changedFields?.length || 0) > 0)
20
+ || (item.rolesToAdd?.length || 0) > 0 || (item.rolesToRemove?.length || 0) > 0
21
+ ? 'update'
22
+ : null;
23
+ }
24
+ if (workspaceHash && !targetHash && ['create', 'restore'].includes(item.status)) {
25
+ return 'create';
26
+ }
27
+ if (!workspaceHash && targetHash) {
28
+ return 'target-only';
29
+ }
30
+ return null;
31
+ }
32
+ export function buildWorkspaceDiff(plan) {
33
+ const changes = [];
34
+ for (const resource of plan.resources) {
35
+ for (const item of resourceItems(plan, resource)) {
36
+ const kind = classify(item, resource);
37
+ if (!kind) {
38
+ continue;
39
+ }
40
+ const workspaceHash = item.desiredHash ?? item.localHash ?? undefined;
41
+ const targetHash = item.currentHash ?? item.remoteHash ?? undefined;
42
+ const rawQueryDiff = resource === 'database-view' ? item.rawQueryDiff || [] : [];
43
+ const fieldChanges = item.fieldChanges?.filter((field) => (rawQueryDiff.length === 0 || field.field !== 'rawQuery'));
44
+ const valueChanges = item.changes?.filter((change) => (change.before !== undefined || change.after !== undefined)) || [];
45
+ const displayFields = resource === 'database-table'
46
+ ? item.changedFields?.filter((field) => valueChanges.some((change) => change.field === field))
47
+ : item.changedFields;
48
+ const displayedFieldChanges = [
49
+ ...(fieldChanges || []),
50
+ ...valueChanges.map((change) => ({
51
+ field: change.field,
52
+ target: formatDiffValue(change.before, change.field),
53
+ workspace: formatDiffValue(change.after, change.field),
54
+ })),
55
+ ];
56
+ const codeDiffs = [
57
+ ...(item.codeDiffs || []),
58
+ ...(rawQueryDiff.length > 0 ? [{ element: 'rawQuery', lines: rawQueryDiff }] : []),
59
+ ];
60
+ changes.push({
61
+ resource,
62
+ identity: item.stableKey || item.path || item.name || 'unknown',
63
+ kind,
64
+ ...(displayFields?.length ? { fields: displayFields } : {}),
65
+ ...(displayedFieldChanges.length ? { fieldChanges: displayedFieldChanges } : {}),
66
+ ...(codeDiffs.length ? { codeDiffs } : {}),
67
+ ...(item.rolesToAdd?.length ? { rolesToAdd: item.rolesToAdd } : {}),
68
+ ...(item.rolesToRemove?.length ? { rolesToRemove: item.rolesToRemove } : {}),
69
+ ...(targetHash ? { targetHash } : {}),
70
+ ...(workspaceHash ? { workspaceHash } : {}),
71
+ });
72
+ }
73
+ }
74
+ return { schemaVersion: 1, command: 'diff', from: 'workspace', to: plan.to, changes };
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revoengine/cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "CLI package for the RevoEngine Platform API",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -11,10 +11,11 @@
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/client.ts'); await import('./src/component-lock.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/resource-syncs/database-schema-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/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-schemas.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/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.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/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/migration.ts'); await import('./src/workspace-diff.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
- "test": "node --test ./test/*.test.ts"
17
+ "test": "node --test ./test/*.test.ts",
18
+ "postinstall": "playwright-core install --only-shell chromium"
18
19
  },
19
20
  "files": [
20
21
  "dist/",
@@ -26,12 +27,14 @@
26
27
  "node": ">=24"
27
28
  },
28
29
  "license": "MIT",
29
- "dependencies": {
30
- "ws": "^8.19.0"
31
- },
32
30
  "devDependencies": {
33
31
  "@types/node": "^25.5.0",
34
32
  "@types/ws": "^8.18.1",
35
33
  "typescript": "^6.0.3"
34
+ },
35
+ "dependencies": {
36
+ "ws": "^8.19.0",
37
+ "node-pty": "^1.0.0",
38
+ "playwright-core": "1.63.0"
36
39
  }
37
40
  }
@@ -1,2 +0,0 @@
1
- import type { CommandContext } from '../types.ts';
2
- export declare function handleDatabaseSchemasCommand(context: CommandContext): Promise<void>;