@revoengine/cli 1.0.10 → 1.0.12

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 (104) hide show
  1. package/README.md +314 -239
  2. package/dist/src/cli.js +126 -9
  3. package/dist/src/client.d.ts +373 -6
  4. package/dist/src/client.js +1005 -53
  5. package/dist/src/commands/auth.js +4 -2
  6. package/dist/src/commands/component.d.ts +67 -0
  7. package/dist/src/commands/component.js +555 -164
  8. package/dist/src/commands/database-tables.d.ts +2 -0
  9. package/dist/src/commands/database-tables.js +169 -0
  10. package/dist/src/commands/database-views.d.ts +2 -0
  11. package/dist/src/commands/database-views.js +126 -0
  12. package/dist/src/commands/endpoints.js +124 -0
  13. package/dist/src/commands/env.js +44 -24
  14. package/dist/src/commands/events.d.ts +2 -0
  15. package/dist/src/commands/events.js +144 -0
  16. package/dist/src/commands/groups.d.ts +2 -0
  17. package/dist/src/commands/groups.js +160 -0
  18. package/dist/src/commands/index.d.ts +9 -0
  19. package/dist/src/commands/index.js +9 -0
  20. package/dist/src/commands/job-templates.d.ts +2 -0
  21. package/dist/src/commands/job-templates.js +107 -0
  22. package/dist/src/commands/metadata.js +75 -10
  23. package/dist/src/commands/migrate.d.ts +6 -0
  24. package/dist/src/commands/migrate.js +658 -0
  25. package/dist/src/commands/project.js +10 -3
  26. package/dist/src/commands/role-groups.d.ts +2 -0
  27. package/dist/src/commands/role-groups.js +141 -0
  28. package/dist/src/commands/schedules.d.ts +2 -0
  29. package/dist/src/commands/schedules.js +140 -0
  30. package/dist/src/commands/terminal-browser.d.ts +16 -0
  31. package/dist/src/commands/terminal-browser.js +92 -0
  32. package/dist/src/commands/terminal-image.d.ts +7 -0
  33. package/dist/src/commands/terminal-image.js +40 -0
  34. package/dist/src/commands/terminal-patch-worker.d.ts +1 -0
  35. package/dist/src/commands/terminal-patch-worker.js +24 -0
  36. package/dist/src/commands/terminal-patch.d.ts +2 -0
  37. package/dist/src/commands/terminal-patch.js +156 -0
  38. package/dist/src/commands/terminal-sandbox.d.ts +8 -0
  39. package/dist/src/commands/terminal-sandbox.js +87 -0
  40. package/dist/src/commands/terminal-service.d.ts +38 -0
  41. package/dist/src/commands/terminal-service.js +210 -0
  42. package/dist/src/commands/terminal.d.ts +49 -0
  43. package/dist/src/commands/terminal.js +826 -0
  44. package/dist/src/component-lock.d.ts +111 -3
  45. package/dist/src/component-lock.js +363 -15
  46. package/dist/src/config.d.ts +10 -2
  47. package/dist/src/config.js +49 -14
  48. package/dist/src/database-table-artifacts.d.ts +7 -0
  49. package/dist/src/database-table-artifacts.js +8 -0
  50. package/dist/src/diff-details.d.ts +8 -0
  51. package/dist/src/diff-details.js +152 -0
  52. package/dist/src/env-sync.d.ts +0 -3
  53. package/dist/src/env-sync.js +11 -25
  54. package/dist/src/http-trace.d.ts +94 -0
  55. package/dist/src/http-trace.js +226 -0
  56. package/dist/src/metadata-backfill.d.ts +18 -7
  57. package/dist/src/metadata-backfill.js +1002 -27
  58. package/dist/src/migration.d.ts +141 -0
  59. package/dist/src/migration.js +1632 -0
  60. package/dist/src/project.d.ts +2 -0
  61. package/dist/src/project.js +4 -17
  62. package/dist/src/prompt.js +10 -18
  63. package/dist/src/resource-inventory.d.ts +28 -0
  64. package/dist/src/resource-inventory.js +85 -0
  65. package/dist/src/resource-metadata.d.ts +1 -0
  66. package/dist/src/resource-metadata.js +3 -0
  67. package/dist/src/resource-syncs/database-table-sync.d.ts +127 -0
  68. package/dist/src/resource-syncs/database-table-sync.js +2374 -0
  69. package/dist/src/resource-syncs/database-view-sync.d.ts +146 -0
  70. package/dist/src/resource-syncs/database-view-sync.js +1405 -0
  71. package/dist/src/resource-syncs/endpoint-sync.d.ts +123 -0
  72. package/dist/src/resource-syncs/endpoint-sync.js +1563 -0
  73. package/dist/src/resource-syncs/event-sync.d.ts +126 -0
  74. package/dist/src/resource-syncs/event-sync.js +1046 -0
  75. package/dist/src/resource-syncs/group-sync.d.ts +93 -0
  76. package/dist/src/resource-syncs/group-sync.js +928 -0
  77. package/dist/src/resource-syncs/job-template-sync.d.ts +106 -0
  78. package/dist/src/resource-syncs/job-template-sync.js +843 -0
  79. package/dist/src/resource-syncs/role-group-sync.d.ts +90 -0
  80. package/dist/src/resource-syncs/role-group-sync.js +635 -0
  81. package/dist/src/resource-syncs/schedule-sync.d.ts +140 -0
  82. package/dist/src/resource-syncs/schedule-sync.js +1396 -0
  83. package/dist/src/resource-syncs/util.d.ts +22 -0
  84. package/dist/src/resource-syncs/util.js +118 -0
  85. package/dist/src/resource-target.d.ts +11 -0
  86. package/dist/src/resource-target.js +48 -0
  87. package/dist/src/runtime-view.d.ts +1 -0
  88. package/dist/src/runtime-view.js +6 -1
  89. package/dist/src/sync-output.d.ts +66 -0
  90. package/dist/src/sync-output.js +268 -0
  91. package/dist/src/tracked-resources.d.ts +1 -1
  92. package/dist/src/tracked-resources.js +28 -2
  93. package/dist/src/types.d.ts +227 -0
  94. package/dist/src/ui.d.ts +3 -0
  95. package/dist/src/ui.js +76 -18
  96. package/dist/src/utils.d.ts +4 -0
  97. package/dist/src/utils.js +81 -0
  98. package/dist/src/workspace-component.d.ts +2 -0
  99. package/dist/src/workspace-component.js +34 -0
  100. package/dist/src/workspace-diff.d.ts +25 -0
  101. package/dist/src/workspace-diff.js +75 -0
  102. package/dist/src/workspace-resource.d.ts +2 -0
  103. package/dist/src/workspace-resource.js +52 -0
  104. package/package.json +12 -4
@@ -6,11 +6,13 @@ export type ParsedArgs = {
6
6
  export type CommandContext = {
7
7
  args: ParsedArgs;
8
8
  client: RevoClient;
9
+ componentEnvironment?: string;
9
10
  cwd: string;
10
11
  packageVersion: string;
11
12
  print: (value: unknown) => void;
12
13
  println: (message: string) => void;
13
14
  error: (message: string) => void;
15
+ warn?: (message: string) => void;
14
16
  };
15
17
  export type ComponentElementRecord = {
16
18
  componentElementId?: string;
@@ -38,3 +40,228 @@ export type ComponentRecord = {
38
40
  elements?: ComponentElementRecord[];
39
41
  [key: string]: unknown;
40
42
  };
43
+ export type DatabaseSchemaRecord = {
44
+ databaseId?: string;
45
+ id?: string;
46
+ name?: string;
47
+ category?: string | null;
48
+ desc?: string;
49
+ description?: string;
50
+ type?: string;
51
+ version?: number;
52
+ metadata?: Record<string, unknown>;
53
+ metaData?: Record<string, unknown>;
54
+ resourceMetadata?: Record<string, unknown>;
55
+ definition?: unknown[];
56
+ partition?: Record<string, unknown> | null;
57
+ parent?: string | {
58
+ databaseId?: string;
59
+ id?: string;
60
+ name?: string;
61
+ } | null;
62
+ parentId?: string | null;
63
+ master?: string | {
64
+ databaseId?: string;
65
+ id?: string;
66
+ } | null;
67
+ masterId?: string | null;
68
+ foreignReferences?: unknown[];
69
+ audit?: unknown;
70
+ restricted?: boolean;
71
+ groups?: unknown[];
72
+ users?: unknown[];
73
+ tags?: unknown[];
74
+ deletedAt?: string | null;
75
+ deletedBy?: string | null;
76
+ [key: string]: unknown;
77
+ };
78
+ export type DatabaseViewRecord = {
79
+ databaseViewId?: string;
80
+ id?: string;
81
+ name?: string;
82
+ category?: string | null;
83
+ desc?: string;
84
+ description?: string;
85
+ metadata?: Record<string, unknown>;
86
+ metaData?: Record<string, unknown>;
87
+ resourceMetadata?: Record<string, unknown>;
88
+ type?: string;
89
+ definitionMode?: string;
90
+ request?: Record<string, unknown> | null;
91
+ rawQuery?: string | null;
92
+ definition?: Array<Record<string, unknown>>;
93
+ sourceDatabaseIds?: string[];
94
+ sourceFieldDependencies?: Record<string, string[]>;
95
+ fieldLineage?: unknown[];
96
+ uniqueKey?: string[] | null;
97
+ indexes?: unknown[];
98
+ restricted?: boolean;
99
+ users?: unknown[];
100
+ groups?: unknown[];
101
+ version?: number;
102
+ internalName?: string;
103
+ createdAt?: string;
104
+ createdBy?: string;
105
+ lastUpdateAt?: string;
106
+ lastUpdateBy?: string;
107
+ deletedAt?: string | null;
108
+ deletedBy?: string | null;
109
+ [key: string]: unknown;
110
+ };
111
+ export type EndpointOptions = {
112
+ input?: Record<string, unknown>;
113
+ guard?: Record<string, unknown>;
114
+ response?: unknown;
115
+ httpCode?: number;
116
+ noResult?: boolean;
117
+ popResult?: string;
118
+ customValidateResponse?: unknown;
119
+ validateResponse?: number;
120
+ validateHideResponse?: boolean;
121
+ includeLibs?: string[];
122
+ excludeLibs?: string[];
123
+ skipLibs?: boolean;
124
+ legacyResults?: boolean;
125
+ hideRequest?: boolean;
126
+ hideResponse?: boolean;
127
+ memory?: number;
128
+ componentSchemaId?: string | null;
129
+ componentSchemaVersion?: number | null;
130
+ componentSchemaElement?: string | null;
131
+ [key: string]: unknown;
132
+ };
133
+ export type EndpointRecord = {
134
+ endpointId?: string;
135
+ id?: string;
136
+ name?: string;
137
+ category?: string | null;
138
+ desc?: string;
139
+ description?: string;
140
+ timeout?: number;
141
+ path?: string;
142
+ method?: string;
143
+ componentId?: string | null;
144
+ componentVersion?: number | null;
145
+ active?: boolean;
146
+ parts?: number;
147
+ options?: EndpointOptions | null;
148
+ version?: number;
149
+ metadata?: Record<string, unknown>;
150
+ metaData?: Record<string, unknown>;
151
+ resourceMetadata?: Record<string, unknown>;
152
+ createdAt?: string;
153
+ createdBy?: string;
154
+ lastUpdateAt?: string;
155
+ lastUpdateBy?: string;
156
+ deletedAt?: string | null;
157
+ deletedBy?: string | null;
158
+ [key: string]: unknown;
159
+ };
160
+ export type RoleGroupRecord = {
161
+ roleGroupId?: string;
162
+ id?: string;
163
+ name?: string;
164
+ category?: string | null;
165
+ desc?: string;
166
+ description?: string;
167
+ version?: number;
168
+ metadata?: Record<string, unknown>;
169
+ metaData?: Record<string, unknown>;
170
+ resourceMetadata?: Record<string, unknown>;
171
+ roles?: unknown[];
172
+ members?: unknown[];
173
+ users?: unknown[];
174
+ [key: string]: unknown;
175
+ };
176
+ export type GroupRecord = {
177
+ groupId?: string;
178
+ id?: string;
179
+ name?: string;
180
+ category?: string | null;
181
+ desc?: string;
182
+ description?: string;
183
+ accessType?: string;
184
+ ownerId?: string;
185
+ ownerType?: string;
186
+ leaderId?: string;
187
+ avatar?: string | null;
188
+ memberCount?: number;
189
+ version?: number;
190
+ deletedAt?: string | null;
191
+ deletedBy?: string | null;
192
+ metadata?: Record<string, unknown>;
193
+ metaData?: Record<string, unknown>;
194
+ resourceMetadata?: Record<string, unknown>;
195
+ members?: unknown[];
196
+ users?: unknown[];
197
+ [key: string]: unknown;
198
+ };
199
+ export type JobTemplateRecord = {
200
+ jobTemplateId?: string;
201
+ id?: string;
202
+ name?: string;
203
+ category?: string | null;
204
+ desc?: string;
205
+ description?: string;
206
+ version?: number;
207
+ metadata?: Record<string, unknown>;
208
+ metaData?: Record<string, unknown>;
209
+ resourceMetadata?: Record<string, unknown>;
210
+ componentId?: string;
211
+ component?: ComponentRecord;
212
+ componentVersion?: number | null;
213
+ timeout?: number;
214
+ triggerUser?: string | null;
215
+ options?: unknown;
216
+ inputs?: unknown;
217
+ active?: boolean;
218
+ deletedAt?: string | null;
219
+ [key: string]: unknown;
220
+ };
221
+ export type ScheduleRecord = {
222
+ scheduleId?: string;
223
+ id?: string;
224
+ name?: string;
225
+ category?: string | null;
226
+ desc?: string;
227
+ description?: string;
228
+ active?: boolean;
229
+ cron?: string;
230
+ timezone?: string;
231
+ targetType?: string;
232
+ targetId?: string;
233
+ targetVersion?: number | null;
234
+ targetConfig?: Record<string, unknown> | null;
235
+ systemManaged?: boolean;
236
+ version?: number;
237
+ metadata?: Record<string, unknown>;
238
+ metaData?: Record<string, unknown>;
239
+ resourceMetadata?: Record<string, unknown>;
240
+ deletedAt?: string | null;
241
+ deletedBy?: string | null;
242
+ [key: string]: unknown;
243
+ };
244
+ export type EventRecord = {
245
+ jobEventId?: string;
246
+ eventId?: string;
247
+ id?: string;
248
+ name?: string;
249
+ category?: string | null;
250
+ desc?: string;
251
+ description?: string;
252
+ active?: boolean;
253
+ custom?: boolean;
254
+ type?: string;
255
+ targetType?: string;
256
+ targetId?: string;
257
+ targetVersion?: number | null;
258
+ targetConfig?: Record<string, unknown> | null;
259
+ filter?: Record<string, unknown> | null;
260
+ version?: number;
261
+ metadata?: Record<string, unknown>;
262
+ metaData?: Record<string, unknown>;
263
+ resourceMetadata?: Record<string, unknown>;
264
+ deletedAt?: string | null;
265
+ deletedBy?: string | null;
266
+ [key: string]: unknown;
267
+ };
package/dist/src/ui.d.ts CHANGED
@@ -10,11 +10,13 @@ export declare function renderRuntimeInfo(input: {
10
10
  nodeVersion: string;
11
11
  configDir: string;
12
12
  runtime: RuntimeConfig;
13
+ environmentName?: string;
13
14
  auth: AuthViewState;
14
15
  }): string;
15
16
  export declare function renderAuthStatus(input: {
16
17
  configDir: string;
17
18
  runtime: RuntimeConfig;
19
+ environmentName?: string;
18
20
  auth: AuthViewState;
19
21
  }): string;
20
22
  export declare function renderOverview(input: {
@@ -22,5 +24,6 @@ export declare function renderOverview(input: {
22
24
  nodeVersion: string;
23
25
  configDir: string;
24
26
  runtime: RuntimeConfig;
27
+ environmentName?: string;
25
28
  auth: AuthViewState;
26
29
  }): string;
package/dist/src/ui.js CHANGED
@@ -94,37 +94,89 @@ function renderCommandCatalog() {
94
94
  ` ${formatCommand(`${CLI_NAME} <command> [arguments] [options]`)}`,
95
95
  '',
96
96
  paintHeader('Global Options'),
97
+ commandRow('--project <name>', 'Use one saved project for this command'),
97
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'),
98
100
  commandRow('--token <apiKey>', 'Override API key for non-interactive runs'),
101
+ commandRow('--hints', 'Show per-resource hints in human-readable plans'),
99
102
  commandRow('--no-update-notifier', 'Disable npm version update checks for this run'),
100
103
  '',
101
- paintHeader('Core'),
104
+ paintHeader('Projects'),
102
105
  commandRow('revo -i', 'Show runtime info, config path, and auth state'),
106
+ commandRow('revo projects add <name> [--url <url>] [--token <apiKey>]', 'Save and activate a project'),
107
+ commandRow('revo projects list [--json]', 'List projects and mark the active one'),
108
+ commandRow('revo projects set <name>', 'Switch the active project; use default for the original login'),
109
+ commandRow('revo projects remove <name>', 'Remove a saved project'),
110
+ '',
111
+ paintHeader('Authentication'),
103
112
  commandRow('revo auth login', 'Paste API key in the terminal'),
104
113
  commandRow('revo auth status', 'Show the current authentication status'),
105
114
  commandRow('revo auth logout', 'Remove stored credentials'),
106
- commandRow('revo project [path] [--identity-mode <stableKey|componentId>] [--stable-key-name <name>] [--resources <list>]', 'Initialize editor types and component identity'),
115
+ '',
116
+ paintHeader('Workspace'),
117
+ commandRow('revo project init [path] [--identity-mode <stableKey|componentId>] [--stable-key-name <name>] [--resources <list>]', 'Initialize local workspace config and editor types'),
107
118
  commandRow('revo project update [path]', 'Refresh editor types and project metadata'),
108
- commandRow('revo endpoints', 'List available API endpoints'),
119
+ '',
120
+ paintHeader('Terminal'),
121
+ commandRow('revo terminal connect --workspace <path> --name <name>', 'Pair and run a local terminal'),
122
+ commandRow('revo terminal service install --workspace <path>', 'Run an approved terminal in the background on macOS or Linux'),
123
+ commandRow('revo terminal service uninstall --workspace <path>', 'Stop and remove the background service'),
124
+ commandRow('revo terminal status', 'Show terminal grants'),
125
+ commandRow('revo terminal disconnect --workspace <path>', 'Revoke a local terminal grant'),
109
126
  '',
110
127
  paintHeader('Components'),
111
- commandRow('revo component plan --all [--json] [--strict] [--changed --base <ref>]', 'Preview local/remote sync status'),
112
- commandRow('revo component pull <identity...> [--force]', 'Pull by configured stable key or component ID'),
113
- commandRow('revo component pull --all [--yes] [--force]', 'Pull every available component safely'),
114
- commandRow('revo component push <identity...>', 'Push by configured stable key or component ID'),
115
- commandRow('revo component push --all [--yes] [--force] [--changed --base <ref>]', 'Push local components with lock checks'),
128
+ commandRow('revo component plan --all [--project <name>] [--json] [--strict] [--hints] [--prune] [--changed --base <ref>]', 'Preview local/remote sync status'),
129
+ commandRow('revo component pull <identity...> [--project <name>] [--force]', 'Pull by configured stable key or component ID'),
130
+ commandRow('revo component pull --all [--project <name>] [--yes] [--force]', 'Pull every available component safely'),
131
+ commandRow('revo component push <identity...> [--project <name>]', 'Push by configured stable key or component ID'),
132
+ commandRow('revo component push --all [--project <name>] [--yes] [--force] [--prune] [--changed --base <ref>]', 'Push local components with lock checks'),
116
133
  commandRow('revo component debug <componentId> [BODY] [--stream] [--raw-debug]', 'Debug one local component against sandbox'),
117
134
  '',
118
- paintHeader('Environments'),
119
- commandRow('revo env add <name> [--url <url>] [--token <apiKey>]', 'Save a named environment profile'),
120
- commandRow('revo env list [--json]', 'List saved environment profiles'),
121
- commandRow('revo env remove <name>', 'Remove a saved environment profile'),
122
- commandRow('revo env diff --from <env> --to <env> [--prune] [--json] [--strict]', 'Compare components across two environments'),
123
- commandRow('revo env apply --from <env> --to <env> [--yes] [--prune] [--force]', 'Mirror components from one environment into another'),
124
- commandRow('revo metadata plan --env <env> [--json]', 'Preview stable-key metadata backfill'),
125
- commandRow('revo metadata apply --env <env> --yes', 'Populate missing stable-key metadata'),
135
+ paintHeader('Databases'),
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'),
142
+ '',
143
+ paintHeader('Endpoints'),
144
+ commandRow('revo endpoints', 'List available API endpoints'),
145
+ commandRow('revo endpoints pull --all [--project <name>] [--force]', 'Pull managed endpoints into the configured workspace'),
146
+ commandRow('revo endpoints plan --all [--project <name>] [--json] [--strict]', 'Preview Endpoint state and Component compatibility'),
147
+ commandRow('revo endpoints push --all [--project <name>] [--yes] [--force]', 'Deploy and verify managed endpoints'),
148
+ '',
149
+ paintHeader('Access'),
150
+ commandRow('revo role-groups pull --all [--project <name>] [--force]', 'Pull managed role groups into the configured workspace'),
151
+ commandRow('revo role-groups plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, and live target state'),
152
+ commandRow('revo role-groups push --all [--project <name>] [--yes] [--force]', 'Push role groups with live stable-key and lock checks'),
153
+ commandRow('revo groups pull --all [--project <name>] [--force]', 'Pull managed groups into the configured workspace'),
154
+ commandRow('revo groups plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, and live target state'),
155
+ commandRow('revo groups push --all [--project <name>] [--yes] [--force]', 'Push portable group structures with live owner resolution'),
156
+ '',
157
+ paintHeader('Automation'),
158
+ commandRow('revo job-templates pull --all [--project <name>] [--force]', 'Pull portable job templates into the configured workspace'),
159
+ commandRow('revo job-templates plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, dependencies, and live target state'),
160
+ commandRow('revo job-templates push --all [--project <name>] --yes [--force] [--json]', 'Create or safely update job templates with live lock checks'),
161
+ commandRow('revo schedules pull --all [--project <name>] [--force]', 'Pull Job Template and Materialized View schedules into the configured workspace'),
162
+ commandRow('revo schedules plan --all [--project <name>] [--json] [--strict]', 'Preview workspace, lock, target schedules, and portable dependencies'),
163
+ commandRow('revo schedules push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Create or safely update disabled-by-default Schedule definitions'),
164
+ commandRow('revo events pull --all [--project <name>] [--force] [--json]', 'Pull portable Job Template Event definitions into the configured workspace'),
165
+ commandRow('revo events plan --all [--project <name>] [--json] [--strict]', 'Preview Event manifests, lock baselines, target state, and Job Template dependencies'),
166
+ commandRow('revo events push --all [--project <name>] --yes [--force] [--activate] [--json]', 'Create or safely update disabled-by-default Event definitions'),
126
167
  '',
127
- paintHeader('Low-Level'),
168
+ paintHeader('Advanced'),
169
+ commandRow('revo env diff --from <env> --to <env> [--prune] [--json] [--strict]', 'Compare components across two projects'),
170
+ commandRow('revo env apply --from <env> --to <env> [--yes] [--prune] [--force]', 'Mirror components from one project into another'),
171
+ commandRow('revo metadata plan [--project <name>] [--skip-partitions] [--json]', 'Preview stable-key metadata backfill'),
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'),
128
180
  commandRow('revo search <CODE|SIMPLE> <term>', 'Search code references or all platform content'),
129
181
  commandRow('revo request <METHOD> <PATH> [BODY]', 'Make a raw API request with optional JSON body'),
130
182
  ].join('\n');
@@ -151,8 +203,11 @@ export function renderHelp(version) {
151
203
  }
152
204
  export function renderRuntimeInfo(input) {
153
205
  const { auth, configDir, nodeVersion, packageVersion, runtime } = input;
206
+ const environmentName = input.environmentName || 'default';
154
207
  const onboardingWarning = auth.status === 'not_authenticated'
155
- ? paintWarning(`Warning: Start onboarding with ${CLI_ALIAS} auth login`)
208
+ ? paintWarning(environmentName === 'default'
209
+ ? `Warning: Start onboarding with ${CLI_NAME} auth login`
210
+ : `Warning: Check the API key for project "${environmentName}"`)
156
211
  : '';
157
212
  return [
158
213
  renderBanner(packageVersion),
@@ -161,11 +216,13 @@ export function renderRuntimeInfo(input) {
161
216
  paintHeader('Runtime'),
162
217
  row('Node', nodeVersion),
163
218
  row('Config', configDir),
219
+ row('Project', environmentName),
164
220
  row('Base URL', runtime.baseUrl),
165
221
  row('Status', formatStatusValue(auth)),
166
222
  ...(shouldRenderValidationRow(auth) ? [row('Validation', auth.validation || 'skipped')] : []),
167
223
  '',
168
224
  paintHeader('Tips'),
225
+ commandRow('revo projects list', 'See and switch projects'),
169
226
  commandRow('revo auth login', 'Save credentials interactively'),
170
227
  commandRow('revo --help', 'Show the command reference'),
171
228
  ].join('\n');
@@ -176,6 +233,7 @@ export function renderAuthStatus(input) {
176
233
  paintHeader('Auth Status'),
177
234
  row('Status', formatStatusValue(auth)),
178
235
  row('Config', configDir),
236
+ row('Project', input.environmentName || 'default'),
179
237
  row('Base URL', runtime.baseUrl),
180
238
  row('API key', runtime.token ? 'configured' : 'missing'),
181
239
  ...(shouldRenderValidationRow(auth) ? [row('Validation', auth.validation || 'skipped')] : []),
@@ -4,7 +4,11 @@ export declare function readBoolFlag(args: ParsedArgs, names: string[]): boolean
4
4
  export declare function readValues(args: ParsedArgs, names: string[]): string[];
5
5
  export declare function toArray(value: string | string[] | undefined): string[];
6
6
  export declare function sanitizeSegment(value: string): string;
7
+ export declare function normalizeCron(value: string): string;
8
+ export declare function isValidNormalizedCron(value: string): boolean;
7
9
  export declare function readJsonFile(filePath: string): any;
8
10
  export declare function writeJsonFile(filePath: string, data: unknown): void;
9
11
  export declare function deepClone<T>(value: T): T;
10
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
@@ -51,6 +51,70 @@ export function sanitizeSegment(value) {
51
51
  .replace(/\s+/g, '_');
52
52
  return normalized.length > 0 ? normalized : 'untitled';
53
53
  }
54
+ const CRON_MONTH_ALIASES = {
55
+ JAN: 1,
56
+ FEB: 2,
57
+ MAR: 3,
58
+ APR: 4,
59
+ MAY: 5,
60
+ JUN: 6,
61
+ JUL: 7,
62
+ AUG: 8,
63
+ SEP: 9,
64
+ OCT: 10,
65
+ NOV: 11,
66
+ DEC: 12,
67
+ };
68
+ const CRON_DAY_ALIASES = {
69
+ SUN: 0,
70
+ MON: 1,
71
+ TUE: 2,
72
+ WED: 3,
73
+ THU: 4,
74
+ FRI: 5,
75
+ SAT: 6,
76
+ };
77
+ export function normalizeCron(value) {
78
+ return value.trim().replace(/\s+/g, ' ');
79
+ }
80
+ function cronFieldIsValid(field, min, max, aliases = {}) {
81
+ return field.split(',').every((part) => {
82
+ if (part === '*') {
83
+ return true;
84
+ }
85
+ const [rangePart, step, ...extraStepParts] = part.split('/');
86
+ if (extraStepParts.length > 0 || !rangePart || (step !== undefined && (!/^\d+$/.test(step) || Number(step) <= 0))) {
87
+ return false;
88
+ }
89
+ if (rangePart === '*') {
90
+ return true;
91
+ }
92
+ const rangeMatch = rangePart.match(/^([A-Z0-9]+)(-([A-Z0-9]+))?$/i);
93
+ if (!rangeMatch) {
94
+ return false;
95
+ }
96
+ const startRaw = rangeMatch[1].toUpperCase();
97
+ const endRaw = rangeMatch[3] ? rangeMatch[3].toUpperCase() : startRaw;
98
+ const start = aliases[startRaw] ?? Number(startRaw);
99
+ const end = aliases[endRaw] ?? Number(endRaw);
100
+ return Number.isInteger(start) && Number.isInteger(end)
101
+ && start >= min && end <= max && start <= end;
102
+ });
103
+ }
104
+ export function isValidNormalizedCron(value) {
105
+ if (value !== normalizeCron(value)) {
106
+ return false;
107
+ }
108
+ const fields = value.split(' ');
109
+ if (fields.length !== 5) {
110
+ return false;
111
+ }
112
+ return cronFieldIsValid(fields[0], 0, 59)
113
+ && cronFieldIsValid(fields[1], 0, 23)
114
+ && cronFieldIsValid(fields[2], 1, 31)
115
+ && cronFieldIsValid(fields[3], 1, 12, CRON_MONTH_ALIASES)
116
+ && cronFieldIsValid(fields[4], 0, 6, CRON_DAY_ALIASES);
117
+ }
54
118
  export function readJsonFile(filePath) {
55
119
  const raw = fs.readFileSync(filePath, 'utf8');
56
120
  return raw.trim() ? JSON.parse(raw) : {};
@@ -84,3 +148,20 @@ export function readPackageVersion() {
84
148
  const raw = fs.readFileSync(packageJsonPath, 'utf8');
85
149
  return JSON.parse(raw).version;
86
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,2 @@
1
+ import type { ComponentRecord } from './types.ts';
2
+ export declare function hydrateWorkspaceComponentElementDetails<T extends ComponentRecord>(manifestPath: string, component: T, preferredExtension?: string): T;
@@ -0,0 +1,34 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ export function hydrateWorkspaceComponentElementDetails(manifestPath, component, preferredExtension) {
4
+ const componentDirectory = path.dirname(manifestPath);
5
+ const detailDirectories = [
6
+ path.join(componentDirectory, 'elements'),
7
+ path.join(componentDirectory, 'details'),
8
+ ];
9
+ return {
10
+ ...component,
11
+ elements: (component.elements || []).map((element) => {
12
+ let details = typeof element.details === 'string' ? element.details : '';
13
+ for (const detailDirectory of detailDirectories) {
14
+ if (!fs.existsSync(detailDirectory)) {
15
+ continue;
16
+ }
17
+ const preferredPath = preferredExtension
18
+ ? path.join(detailDirectory, `${element.order}_${element.key}.${preferredExtension}`)
19
+ : '';
20
+ if (preferredPath && fs.existsSync(preferredPath)) {
21
+ details = fs.readFileSync(preferredPath, 'utf8');
22
+ break;
23
+ }
24
+ const prefix = `${element.order}_${element.key}.`;
25
+ const detailFile = fs.readdirSync(detailDirectory).sort().find((entry) => entry.startsWith(prefix));
26
+ if (detailFile) {
27
+ details = fs.readFileSync(path.join(detailDirectory, detailFile), 'utf8');
28
+ break;
29
+ }
30
+ }
31
+ return { ...element, details };
32
+ }),
33
+ };
34
+ }
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ /** Replace one resource directory only after its replacement is fully written. */
2
+ export declare function replaceWorkspaceResourceDirectory(root: string, directory: string, populate: (stagingDirectory: string) => void): void;