@revoengine/cli 1.0.33 → 1.0.35
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/CHANGELOG.md +34 -0
- package/README.md +89 -6
- package/dist/src/argument-contract.d.ts +17 -0
- package/dist/src/argument-contract.js +359 -0
- package/dist/src/automation-contract.generated.d.ts +2 -2
- package/dist/src/automation-contract.generated.js +2 -2
- package/dist/src/cli.js +15 -13
- package/dist/src/client.d.ts +2 -0
- package/dist/src/client.js +38 -1
- package/dist/src/commands/agents.js +5 -1
- package/dist/src/commands/auth.js +2 -0
- package/dist/src/commands/component.js +34 -17
- package/dist/src/commands/database-tables.js +5 -1
- package/dist/src/commands/database-views.js +5 -1
- package/dist/src/commands/endpoints.js +5 -1
- package/dist/src/commands/env.js +5 -1
- package/dist/src/commands/events.js +5 -1
- package/dist/src/commands/groups.js +5 -1
- package/dist/src/commands/info.js +2 -0
- package/dist/src/commands/job-templates.js +5 -1
- package/dist/src/commands/metadata.js +2 -0
- package/dist/src/commands/migrate.d.ts +2 -2
- package/dist/src/commands/migrate.js +31 -7
- package/dist/src/commands/project.js +19 -14
- package/dist/src/commands/request.js +2 -0
- package/dist/src/commands/role-groups.js +5 -1
- package/dist/src/commands/schedules.js +5 -1
- package/dist/src/commands/search.js +2 -0
- package/dist/src/commands/service-accounts.js +5 -1
- package/dist/src/commands/studio.js +2 -0
- package/dist/src/commands/terminal-file-descriptor.d.ts +9 -0
- package/dist/src/commands/terminal-file-descriptor.js +39 -0
- package/dist/src/commands/terminal-file.js +41 -6
- package/dist/src/commands/terminal-image.js +3 -31
- package/dist/src/commands/terminal-process-group.d.ts +25 -0
- package/dist/src/commands/terminal-process-group.js +144 -0
- package/dist/src/commands/terminal.js +123 -40
- package/dist/src/commands/tests.js +2 -0
- package/dist/src/component-lock.d.ts +15 -1
- package/dist/src/component-lock.js +96 -10
- package/dist/src/env-sync.js +12 -6
- package/dist/src/migration.d.ts +7 -0
- package/dist/src/migration.js +39 -21
- package/dist/src/planning-snapshot.d.ts +3 -0
- package/dist/src/planning-snapshot.js +60 -2
- package/dist/src/project.d.ts +1 -0
- package/dist/src/project.js +7 -8
- package/dist/src/resource-syncs/agent-sync.js +76 -24
- package/dist/src/resource-syncs/database-table-sync.js +33 -22
- package/dist/src/resource-syncs/database-view-sync.js +41 -28
- package/dist/src/resource-syncs/endpoint-sync.js +90 -18
- package/dist/src/resource-syncs/event-sync.js +33 -14
- package/dist/src/resource-syncs/group-sync.js +21 -11
- package/dist/src/resource-syncs/job-template-sync.js +98 -37
- package/dist/src/resource-syncs/role-group-sync.js +22 -11
- package/dist/src/resource-syncs/schedule-sync.js +26 -11
- package/dist/src/resource-syncs/service-account-sync.js +22 -11
- package/dist/src/reviewed-plan.js +3 -0
- package/dist/src/runtime-view.js +2 -18
- package/dist/src/sync-omit-command.d.ts +6 -0
- package/dist/src/sync-omit-command.js +49 -0
- package/dist/src/sync-omit-write-fence.d.ts +10 -0
- package/dist/src/sync-omit-write-fence.js +134 -0
- package/dist/src/sync-omit.d.ts +59 -0
- package/dist/src/sync-omit.js +469 -0
- package/dist/src/ui.js +10 -5
- package/dist/src/update-notifier.d.ts +1 -1
- package/dist/src/update-notifier.js +2 -1
- package/dist/src/utils.js +46 -17
- package/dist/src/workspace-prune.js +11 -3
- package/dist/src/workspace-write-lock.d.ts +7 -0
- package/dist/src/workspace-write-lock.js +144 -0
- package/package.json +4 -2
package/dist/src/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { realpathSync } from 'node:fs';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { recordParsedOption, runtimeConnectionOverrides, validateCommandArguments } from "./argument-contract.js";
|
|
3
4
|
import { RevoClient } from "./client.js";
|
|
4
5
|
import { readComponentLock } from "./component-lock.js";
|
|
5
6
|
import { getActiveEnvironmentName } from "./config.js";
|
|
@@ -34,7 +35,8 @@ export function parseArgs(argv) {
|
|
|
34
35
|
const result = { _: [] };
|
|
35
36
|
let stopOptions = false;
|
|
36
37
|
const setValue = (key, value) => {
|
|
37
|
-
|
|
38
|
+
recordParsedOption(result, key, value);
|
|
39
|
+
const current = Object.hasOwn(result, key) ? result[key] : undefined;
|
|
38
40
|
if (current === undefined) {
|
|
39
41
|
result[key] = value;
|
|
40
42
|
return;
|
|
@@ -140,12 +142,7 @@ function printError(error) {
|
|
|
140
142
|
process.stderr.write(`${danger('Error:')} ${message}\n`);
|
|
141
143
|
}
|
|
142
144
|
function resolveClient(args) {
|
|
143
|
-
return new RevoClient(
|
|
144
|
-
baseUrl: typeof args.url === 'string' ? args.url : typeof args.baseUrl === 'string' ? args.baseUrl : undefined,
|
|
145
|
-
instance: typeof args.instance === 'string' ? args.instance : typeof args.i === 'string' ? args.i : undefined,
|
|
146
|
-
token: typeof args.token === 'string' ? args.token : typeof args.t === 'string' ? args.t : undefined,
|
|
147
|
-
envName: typeof args.env === 'string' ? args.env : undefined,
|
|
148
|
-
});
|
|
145
|
+
return new RevoClient(runtimeConnectionOverrides(args));
|
|
149
146
|
}
|
|
150
147
|
function createContext(args) {
|
|
151
148
|
if (args.project !== undefined && args.env !== undefined) {
|
|
@@ -197,18 +194,14 @@ async function runMain(args, argv) {
|
|
|
197
194
|
});
|
|
198
195
|
const command = args._[0];
|
|
199
196
|
const noPositionals = args._.length === 0;
|
|
200
|
-
if (command === 'version' || ((args.version
|
|
201
|
-
print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true } } : packageVersion);
|
|
197
|
+
if (command === 'version' || ((args.version === true || args.V === true) && noPositionals)) {
|
|
198
|
+
print(args.json ? { version: packageVersion, capabilities: { workspacePrune: true, reviewedPrunePlan: true, reviewedDeploymentPlan: true, componentMutationReview: true, reviewedAutomationActivation: true, preservedAutomationActivation: true, syncOmit: true } } : packageVersion);
|
|
202
199
|
return;
|
|
203
200
|
}
|
|
204
201
|
if (command === 'info' || ((args.i === true || args.info === true) && noPositionals)) {
|
|
205
202
|
await handleInfoCommand(createContext(args));
|
|
206
203
|
return;
|
|
207
204
|
}
|
|
208
|
-
if (command === 'help' || ((args.help !== undefined || args.h !== undefined) && noPositionals)) {
|
|
209
|
-
printHelp();
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
205
|
const context = createContext(args);
|
|
213
206
|
if (!command) {
|
|
214
207
|
const view = await buildRuntimeViewModel(context);
|
|
@@ -328,6 +321,15 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
328
321
|
}
|
|
329
322
|
async function runCommandWithTrace(argv) {
|
|
330
323
|
const args = parseArgs(argv);
|
|
324
|
+
validateCommandArguments(args, { allowHelp: true });
|
|
325
|
+
if (args._[0] === 'help' || args.help === true || args.help === 'true' || args.h === true || args.h === 'true') {
|
|
326
|
+
printHelp();
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (args.help === false || args.help === 'false')
|
|
330
|
+
delete args.help;
|
|
331
|
+
if (args.h === false || args.h === 'false')
|
|
332
|
+
delete args.h;
|
|
331
333
|
const trace = configuredHttpTrace(args);
|
|
332
334
|
if (!trace) {
|
|
333
335
|
await runMain(args, argv);
|
package/dist/src/client.d.ts
CHANGED
|
@@ -393,6 +393,7 @@ export declare class RevoClient {
|
|
|
393
393
|
private retryDelayMs;
|
|
394
394
|
private requestQueue;
|
|
395
395
|
private componentSyncManifestsSupported?;
|
|
396
|
+
private atomicResourceUpdatesValidation?;
|
|
396
397
|
constructor(options?: ClientOptions);
|
|
397
398
|
get authHeader(): string;
|
|
398
399
|
get authValidationKey(): string;
|
|
@@ -408,6 +409,7 @@ export declare class RevoClient {
|
|
|
408
409
|
fromCache: false;
|
|
409
410
|
profile: unknown;
|
|
410
411
|
}>;
|
|
412
|
+
private requireAtomicResourceUpdates;
|
|
411
413
|
request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
|
|
412
414
|
requestData<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
413
415
|
me(options?: {
|
package/dist/src/client.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { getGlobalDispatcher } from 'undici';
|
|
2
3
|
import { setTimeout as waitForDelay } from 'node:timers/promises';
|
|
3
4
|
import { AUTH_VALIDATION_TTL_MS, buildAuthValidationKey, DEFAULT_BASE_URL, readAuthValidationState, resolveRuntimeConfig, saveAuthValidationState, } from "./config.js";
|
|
4
5
|
import { beginHttpTraceRequest, completeHttpTraceRequest, responseSize, } from "./http-trace.js";
|
|
5
6
|
import { currentRequestQueue, RequestQueue } from "./request-queue.js";
|
|
6
7
|
import { createSpinner } from "./spinner.js";
|
|
8
|
+
import { currentSyncOmitPolicy } from "./sync-omit.js";
|
|
7
9
|
import { mapWithConcurrency } from "./utils.js";
|
|
10
|
+
const COMPONENT_VALIDATION_TIMEOUT_MS = 10 * 60_000;
|
|
11
|
+
// Node fetch otherwise stops waiting for response headers after five minutes.
|
|
12
|
+
// Delegate to the configured dispatcher so proxy/TLS policy remains authoritative.
|
|
13
|
+
const validationDispatcher = {
|
|
14
|
+
dispatch(options, handler) {
|
|
15
|
+
return getGlobalDispatcher().dispatch({ ...options,
|
|
16
|
+
headersTimeout: COMPONENT_VALIDATION_TIMEOUT_MS,
|
|
17
|
+
bodyTimeout: COMPONENT_VALIDATION_TIMEOUT_MS,
|
|
18
|
+
}, handler);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
8
21
|
export function isDatabaseSchemaOperation(value) {
|
|
9
22
|
return Boolean(value && typeof value === 'object' && value.accepted === true
|
|
10
23
|
&& typeof value.jobId === 'string' && typeof value.status === 'string');
|
|
@@ -425,6 +438,7 @@ export class RevoClient {
|
|
|
425
438
|
retryDelayMs;
|
|
426
439
|
requestQueue;
|
|
427
440
|
componentSyncManifestsSupported;
|
|
441
|
+
atomicResourceUpdatesValidation;
|
|
428
442
|
constructor(options = {}) {
|
|
429
443
|
const config = resolveRuntimeConfig(options);
|
|
430
444
|
this.baseUrl = config.baseUrl;
|
|
@@ -502,8 +516,28 @@ export class RevoClient {
|
|
|
502
516
|
throw error;
|
|
503
517
|
}
|
|
504
518
|
}
|
|
519
|
+
requireAtomicResourceUpdates() {
|
|
520
|
+
const key = this.authValidationKey;
|
|
521
|
+
if (this.atomicResourceUpdatesValidation?.key === key)
|
|
522
|
+
return this.atomicResourceUpdatesValidation.promise;
|
|
523
|
+
const validation = { key, promise: Promise.resolve() };
|
|
524
|
+
this.atomicResourceUpdatesValidation = validation;
|
|
525
|
+
// A stored auth profile can predate the API rollout. Always fetch the
|
|
526
|
+
// capability from this client's current target once before omitted writes.
|
|
527
|
+
validation.promise = this.validateSession({ force: true }).then(({ profile }) => {
|
|
528
|
+
validation.key = this.authValidationKey;
|
|
529
|
+
const value = isRecord(profile) && isRecord(profile.data) ? profile.data : profile;
|
|
530
|
+
if (!isRecord(value) || !isRecord(value.capabilities) || value.capabilities.atomicResourceUpdates !== true) {
|
|
531
|
+
throw new Error('The target API does not support atomic resource updates required by --omit. Upgrade the RevoEngine API before retrying.');
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
return validation.promise;
|
|
535
|
+
}
|
|
505
536
|
async request(method, path, options = {}) {
|
|
506
537
|
this.assertReady();
|
|
538
|
+
if (currentSyncOmitPolicy().rules.length && !['GET', 'HEAD', 'OPTIONS'].includes(method.toUpperCase()) && path !== '/api/v1/me') {
|
|
539
|
+
await this.requireAtomicResourceUpdates();
|
|
540
|
+
}
|
|
507
541
|
if (options.authGuard !== false && path !== '/api/v1/me') {
|
|
508
542
|
await this.validateSession();
|
|
509
543
|
}
|
|
@@ -566,6 +600,7 @@ export class RevoClient {
|
|
|
566
600
|
headers,
|
|
567
601
|
body: body,
|
|
568
602
|
redirect: 'manual',
|
|
603
|
+
...(options.timeoutMs === COMPONENT_VALIDATION_TIMEOUT_MS ? { dispatcher: validationDispatcher } : {}),
|
|
569
604
|
...(signal ? { signal } : {}),
|
|
570
605
|
});
|
|
571
606
|
failedResponse = fetched;
|
|
@@ -1293,6 +1328,7 @@ export class RevoClient {
|
|
|
1293
1328
|
return this.requestData('POST', '/api/v1/component', {
|
|
1294
1329
|
body,
|
|
1295
1330
|
spinnerLabel: 'Creating component',
|
|
1331
|
+
timeoutMs: COMPONENT_VALIDATION_TIMEOUT_MS,
|
|
1296
1332
|
});
|
|
1297
1333
|
}
|
|
1298
1334
|
async listNativeTests(query = {}) {
|
|
@@ -1805,11 +1841,12 @@ export class RevoClient {
|
|
|
1805
1841
|
return unwrapList(await this.listSystemRoles()).filter(isRecord);
|
|
1806
1842
|
}
|
|
1807
1843
|
async reviewComponentElements(componentId, body) {
|
|
1808
|
-
return this.requestData('POST', `/api/v1/component/${componentId}/save/review`, { body });
|
|
1844
|
+
return this.requestData('POST', `/api/v1/component/${componentId}/save/review`, { body, timeoutMs: COMPONENT_VALIDATION_TIMEOUT_MS });
|
|
1809
1845
|
}
|
|
1810
1846
|
async saveComponentElements(componentId, body, expectedToken) {
|
|
1811
1847
|
return this.request('POST', `/api/v1/component/${componentId}/save`, {
|
|
1812
1848
|
body,
|
|
1849
|
+
timeoutMs: COMPONENT_VALIDATION_TIMEOUT_MS,
|
|
1813
1850
|
...(expectedToken ? { headers: { 'x-revo-mutation-review': expectedToken } } : {}),
|
|
1814
1851
|
});
|
|
1815
1852
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
2
3
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
4
|
import { buildAgentsPlan, pullAgentsToWorkspace, pushAgents } from "../resource-syncs/agent-sync.js";
|
|
4
5
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
5
6
|
import { printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeAgentsCommand(context) {
|
|
8
9
|
const family = context.args._[0] === 'agent-plugins' ? 'agent-plugin' : 'agent';
|
|
9
10
|
const command = context.args._[1];
|
|
10
11
|
if (!['pull', 'plan', 'push'].includes(command))
|
|
@@ -54,3 +55,6 @@ export async function handleAgentsCommand(context) {
|
|
|
54
55
|
if (result.results.some(item => item.status === 'failed'))
|
|
55
56
|
throw new Error(`${family} push failed; inspect results.`);
|
|
56
57
|
}
|
|
58
|
+
export async function handleAgentsCommand(context) {
|
|
59
|
+
return withCommandSyncOmit(context, [context.args._[0] === 'agent-plugins' ? 'agent-plugin' : 'agent'], scoped => executeAgentsCommand(scoped));
|
|
60
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
+
import { validateCommandArguments } from "../argument-contract.js";
|
|
2
3
|
import { clearAuthValidationState, clearStoredConfig, getConfigDir, loadStoredConfig, resolveRuntimeConfig, saveStoredConfig, } from "../config.js";
|
|
3
4
|
import { readLegacyImportFromFile } from "../legacy.js";
|
|
4
5
|
import { promptSecret } from "../prompt.js";
|
|
@@ -26,6 +27,7 @@ async function promptMissingConfig(runtime) {
|
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
export async function handleAuthCommand(context) {
|
|
30
|
+
validateCommandArguments(context.args);
|
|
29
31
|
const { args, client, print, println, error } = context;
|
|
30
32
|
const subcommand = args._[1] || 'login';
|
|
31
33
|
if (subcommand === 'logout') {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
2
|
+
import { preserveOmittedProperties, syncBaselineHash, syncSourceBaselineHash, withoutSyncOmit, assertOmittedPropertiesPreserved, omitPaths } from "../sync-omit.js";
|
|
1
3
|
import { hydrateComponentManifest, listComponentManifests } from "../component-manifests.js";
|
|
2
4
|
import { verifyComponentRuntime } from "../component-contract.js";
|
|
3
5
|
import { changeComponentActivation } from "../component-lifecycle.js";
|
|
@@ -583,19 +585,23 @@ function migrateComponentLockIdentity(cwd, identity, localCatalog, remoteCatalog
|
|
|
583
585
|
if (!legacy || !remoteComponentId) {
|
|
584
586
|
continue;
|
|
585
587
|
}
|
|
586
|
-
const remoteLegacyHash = hashComponentSource(remote.component);
|
|
587
|
-
const localLegacyHash = local ? hashComponentSource(local.component) : null;
|
|
588
|
+
const remoteLegacyHash = withoutSyncOmit(() => hashComponentSource(remote.component));
|
|
589
|
+
const localLegacyHash = local ? withoutSyncOmit(() => hashComponentSource(local.component)) : null;
|
|
588
590
|
let portableBaselineHash = null;
|
|
591
|
+
let sourceBaselineComponent;
|
|
589
592
|
if (legacy.remoteHash === remoteLegacyHash) {
|
|
590
593
|
portableBaselineHash = remote.hash;
|
|
594
|
+
sourceBaselineComponent = remote.component;
|
|
591
595
|
}
|
|
592
596
|
else if (local && legacy.remoteHash === localLegacyHash) {
|
|
593
597
|
portableBaselineHash = local.hash;
|
|
598
|
+
sourceBaselineComponent = local.component;
|
|
594
599
|
}
|
|
595
|
-
else if (local && local.
|
|
600
|
+
else if (local && withoutSyncOmit(() => componentSourceHash(local.component, identity)) === withoutSyncOmit(() => componentSourceHash(remote.component, identity))) {
|
|
596
601
|
portableBaselineHash = remote.hash;
|
|
602
|
+
sourceBaselineComponent = remote.component;
|
|
597
603
|
}
|
|
598
|
-
if (!portableBaselineHash) {
|
|
604
|
+
if (!portableBaselineHash || !sourceBaselineComponent) {
|
|
599
605
|
continue;
|
|
600
606
|
}
|
|
601
607
|
migratedComponents[stableKey] = {
|
|
@@ -611,12 +617,13 @@ function migrateComponentLockIdentity(cwd, identity, localCatalog, remoteCatalog
|
|
|
611
617
|
: legacy.path || componentTargetPath(cwd, remote.component),
|
|
612
618
|
remoteVersion: legacy.remoteVersion,
|
|
613
619
|
remoteHash: portableBaselineHash,
|
|
614
|
-
sourceHash:
|
|
620
|
+
sourceHash: withoutSyncOmit(() => componentSourceHash(sourceBaselineComponent, identity)),
|
|
615
621
|
pulledAt: legacy.pulledAt,
|
|
616
622
|
};
|
|
617
623
|
}
|
|
618
624
|
}
|
|
619
625
|
const migrated = {
|
|
626
|
+
...lock,
|
|
620
627
|
schemaVersion: 2,
|
|
621
628
|
componentIdentity: identity,
|
|
622
629
|
components: migratedComponents,
|
|
@@ -685,7 +692,7 @@ function upsertLockFromRemote(context, remote, targetPath, local, environmentNam
|
|
|
685
692
|
path: targetPath || componentTargetPath(cwd, local || remote),
|
|
686
693
|
remoteVersion: componentVersion(remote),
|
|
687
694
|
remoteHash,
|
|
688
|
-
sourceHash:
|
|
695
|
+
sourceHash: withoutSyncOmit(() => componentSourceHash(local || remote, identity)),
|
|
689
696
|
pulledAt: new Date().toISOString(),
|
|
690
697
|
}, identity, environmentName);
|
|
691
698
|
}
|
|
@@ -730,21 +737,23 @@ function buildPullDecision(cwd, remote, localCatalog = buildLocalComponentCatalo
|
|
|
730
737
|
reason: 'missing lock',
|
|
731
738
|
};
|
|
732
739
|
}
|
|
733
|
-
|
|
740
|
+
const sourceBaseline = syncSourceBaselineHash('component', lockEntry);
|
|
741
|
+
const remoteBaseline = syncBaselineHash('component', lockEntry);
|
|
742
|
+
if (localHash === sourceBaseline) {
|
|
734
743
|
return {
|
|
735
744
|
kind: 'pull',
|
|
736
745
|
...base,
|
|
737
746
|
reason: 'remote changed',
|
|
738
747
|
};
|
|
739
748
|
}
|
|
740
|
-
if (
|
|
749
|
+
if (remoteHash === remoteBaseline) {
|
|
741
750
|
return {
|
|
742
751
|
kind: 'skip',
|
|
743
752
|
...base,
|
|
744
753
|
reason: 'local changes',
|
|
745
754
|
};
|
|
746
755
|
}
|
|
747
|
-
if (localHash !==
|
|
756
|
+
if (localHash !== remoteHash) {
|
|
748
757
|
return {
|
|
749
758
|
kind: 'skip',
|
|
750
759
|
...base,
|
|
@@ -948,9 +957,10 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
|
948
957
|
}
|
|
949
958
|
}
|
|
950
959
|
const root = getWorkspaceRoot(cwd);
|
|
960
|
+
const effectiveComponent = preserveOmittedProperties('component', component, decision.localComponent);
|
|
951
961
|
const folder = decision.manifestPath
|
|
952
962
|
? path.dirname(decision.manifestPath)
|
|
953
|
-
: path.join(root, getComponentFolder(
|
|
963
|
+
: path.join(root, getComponentFolder(effectiveComponent));
|
|
954
964
|
const targetPath = path.relative(cwd, folder);
|
|
955
965
|
const populate = (directory) => {
|
|
956
966
|
const elementsDir = path.join(directory, 'elements');
|
|
@@ -961,7 +971,7 @@ async function pullResolvedComponent(context, component, mode, localCatalog) {
|
|
|
961
971
|
const filePath = path.join(elementsDir, `${element.order}_${element.key}.${extension}`);
|
|
962
972
|
fs.writeFileSync(filePath, content);
|
|
963
973
|
}
|
|
964
|
-
writeJsonFile(path.join(directory, 'component.json'), buildPulledManifest(
|
|
974
|
+
writeJsonFile(path.join(directory, 'component.json'), buildPulledManifest(effectiveComponent, decision.localComponent, identity));
|
|
965
975
|
};
|
|
966
976
|
if (mode.force) {
|
|
967
977
|
replaceWorkspaceResourceDirectory(root, folder, populate);
|
|
@@ -1205,7 +1215,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1205
1215
|
}
|
|
1206
1216
|
await client.saveComponentElements(createdComponentId, buildPushElements(component, { elements: [] }, identity));
|
|
1207
1217
|
const refreshedRemote = unwrapComponent(await client.getComponent(createdComponentId));
|
|
1208
|
-
if (componentSourceHash(refreshedRemote, identity) !== componentSourceHash(component, identity)) {
|
|
1218
|
+
if (withoutSyncOmit(() => componentSourceHash(refreshedRemote, identity)) !== withoutSyncOmit(() => componentSourceHash(component, identity))) {
|
|
1209
1219
|
const logPath = writeComponentPushVerificationLog({
|
|
1210
1220
|
cwd: context.cwd,
|
|
1211
1221
|
targetPath,
|
|
@@ -1272,7 +1282,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1272
1282
|
}
|
|
1273
1283
|
const remoteHash = componentSourceHash(remote, identity);
|
|
1274
1284
|
const localHash = componentSourceHash(component, identity);
|
|
1275
|
-
if (remoteHash !== lockEntry
|
|
1285
|
+
if (remoteHash !== syncBaselineHash('component', lockEntry)) {
|
|
1276
1286
|
if (localHash === remoteHash) {
|
|
1277
1287
|
upsertLockFromRemote(context, remote, targetPath, component, context.componentEnvironment);
|
|
1278
1288
|
const result = {
|
|
@@ -1290,7 +1300,7 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1290
1300
|
}
|
|
1291
1301
|
throw new Error(`Cannot push ${targetPath}: remote changed since the last lock baseline. Run \`revo component plan --all\` and pull/reconcile first.`);
|
|
1292
1302
|
}
|
|
1293
|
-
if (localHash === lockEntry
|
|
1303
|
+
if (localHash === syncBaselineHash('component', lockEntry)) {
|
|
1294
1304
|
const result = {
|
|
1295
1305
|
status: 'skipped',
|
|
1296
1306
|
targetPath,
|
|
@@ -1437,6 +1447,8 @@ async function pushSingleComponent(context, manifestPath, remoteCatalog) {
|
|
|
1437
1447
|
});
|
|
1438
1448
|
throw new Error(`Cannot push ${targetPath}: updated component did not verify against local source. Diagnostic: ${logPath}`);
|
|
1439
1449
|
}
|
|
1450
|
+
if (hasLiveRemote && omitPaths('component').length)
|
|
1451
|
+
assertOmittedPropertiesPreserved('component', normalizePortableComponentSource(remote), normalizePortableComponentSource(refreshedRemote));
|
|
1440
1452
|
await verifyComponentRuntime(client, refreshedRemote, 120_000);
|
|
1441
1453
|
upsertLockFromRemote(context, refreshedRemote, targetPath, component, context.componentEnvironment);
|
|
1442
1454
|
if (!configurationChanged && !elementsChanged) {
|
|
@@ -1648,8 +1660,10 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
|
|
|
1648
1660
|
...Object.keys(lockEntries),
|
|
1649
1661
|
])].sort();
|
|
1650
1662
|
const items = allIdentityKeys.map((identityKey) => {
|
|
1651
|
-
|
|
1663
|
+
let local = localCatalog.byIdentity.get(identityKey) || null;
|
|
1652
1664
|
const remote = remoteCatalog.byIdentity.get(identityKey) || null;
|
|
1665
|
+
if (local && remote)
|
|
1666
|
+
local = { ...local, component: preserveOmittedProperties('component', local.component, remote.component) };
|
|
1653
1667
|
const lockEntry = lockEntries[identityKey] || null;
|
|
1654
1668
|
const component = local?.component || remote?.component;
|
|
1655
1669
|
const localComponentId = local ? componentIdOf(local.component) : '';
|
|
@@ -1665,7 +1679,7 @@ export async function buildComponentPlan(context, scope = { enabled: false, base
|
|
|
1665
1679
|
: lockEntry?.path || identityKey;
|
|
1666
1680
|
const localHash = local?.hash || null;
|
|
1667
1681
|
const remoteHash = remote?.hash || null;
|
|
1668
|
-
const lockHash = lockEntry
|
|
1682
|
+
const lockHash = syncBaselineHash('component', lockEntry || undefined) || null;
|
|
1669
1683
|
const changedFields = local && remote
|
|
1670
1684
|
? diffPortableComponentSource(local.component, remote.component).changedFields
|
|
1671
1685
|
: [];
|
|
@@ -2148,7 +2162,7 @@ async function debugSingleComponent(context, componentId) {
|
|
|
2148
2162
|
writeDebugOutputFile(context.cwd, response);
|
|
2149
2163
|
context.print(extractResultPayload(response));
|
|
2150
2164
|
}
|
|
2151
|
-
|
|
2165
|
+
async function executeComponentCommand(context) {
|
|
2152
2166
|
const { args } = context;
|
|
2153
2167
|
const subcommand = args._[1] || '';
|
|
2154
2168
|
const targets = parseTargets(args, ['id', 'i']);
|
|
@@ -2261,3 +2275,6 @@ export async function handleComponentCommand(context) {
|
|
|
2261
2275
|
}
|
|
2262
2276
|
throw new Error('Unknown component command.');
|
|
2263
2277
|
}
|
|
2278
|
+
export async function handleComponentCommand(context) {
|
|
2279
|
+
return withCommandSyncOmit(context, ['component'], scoped => executeComponentCommand(scoped));
|
|
2280
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
2
3
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
4
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
4
5
|
import { buildDatabaseSchemasPlan, pullDatabaseSchemasToWorkspace, pushDatabaseSchemas } from "../resource-syncs/database-table-sync.js";
|
|
5
6
|
import { planValueChanges, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag, readFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeDatabaseTablesCommand(context) {
|
|
8
9
|
const subcommand = context.args._[1] || '';
|
|
9
10
|
if (subcommand !== 'pull' && subcommand !== 'plan' && subcommand !== 'push') {
|
|
10
11
|
throw new Error('Unknown database-tables command. Usage: revo database-tables <pull|plan|push> --all [--env <name>]');
|
|
@@ -174,3 +175,6 @@ export async function handleDatabaseTablesCommand(context) {
|
|
|
174
175
|
}
|
|
175
176
|
printSyncSummary(context.println, 'Pulled', output, Date.now() - startedAt);
|
|
176
177
|
}
|
|
178
|
+
export async function handleDatabaseTablesCommand(context) {
|
|
179
|
+
return withCommandSyncOmit(context, ['database-table'], scoped => executeDatabaseTablesCommand(scoped));
|
|
180
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
2
3
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
4
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
4
5
|
import { buildDatabaseViewsPlan, pullDatabaseViewsToWorkspace, pushDatabaseViews } from "../resource-syncs/database-view-sync.js";
|
|
5
6
|
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeDatabaseViewsCommand(context) {
|
|
8
9
|
const subcommand = context.args._[1] || '';
|
|
9
10
|
if (subcommand !== 'pull' && subcommand !== 'plan' && subcommand !== 'push') {
|
|
10
11
|
throw new Error('Unknown database-views command. Usage: revo database-views <pull|plan|push> --all [--env <name>]');
|
|
@@ -124,3 +125,6 @@ export async function handleDatabaseViewsCommand(context) {
|
|
|
124
125
|
}
|
|
125
126
|
printSyncSummary(context.println, 'Pulled', output, Date.now() - startedAt);
|
|
126
127
|
}
|
|
128
|
+
export async function handleDatabaseViewsCommand(context) {
|
|
129
|
+
return withCommandSyncOmit(context, ['database-view'], scoped => executeDatabaseViewsCommand(scoped));
|
|
130
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
2
3
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
4
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
4
5
|
import { buildEndpointsPlan, pullEndpointsToWorkspace, pushEndpoints } from "../resource-syncs/endpoint-sync.js";
|
|
5
6
|
import { printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeEndpointsCommand(context) {
|
|
8
9
|
const subcommand = context.args._[1] || '';
|
|
9
10
|
if (subcommand === 'pull' || subcommand === 'plan' || subcommand === 'push') {
|
|
10
11
|
if (!readBoolFlag(context.args, ['all', 'a'])) {
|
|
@@ -126,3 +127,6 @@ export async function handleEndpointsCommand(context) {
|
|
|
126
127
|
const endpoints = await context.client.listEndpoints();
|
|
127
128
|
context.print(endpoints);
|
|
128
129
|
}
|
|
130
|
+
export async function handleEndpointsCommand(context) {
|
|
131
|
+
return withCommandSyncOmit(context, ['endpoint'], scoped => executeEndpointsCommand(scoped));
|
|
132
|
+
}
|
package/dist/src/commands/env.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { RevoClient } from "../client.js";
|
|
2
3
|
import { DEFAULT_BASE_URL, DEFAULT_ENV_NAME, getActiveEnvironmentName, getConfigDir, getEnvironmentProfile, listEnvironmentProfiles, removeEnvironmentProfile, resolveRuntimeConfig, saveEnvironmentProfile, setActiveEnvironmentName, } from "../config.js";
|
|
3
4
|
import { applyEnvSyncPlan, buildEnvSyncPlan, captureEnvSnapshot, } from "../env-sync.js";
|
|
@@ -349,7 +350,7 @@ async function handleEnvApply(context) {
|
|
|
349
350
|
throw new Error(`Apply finished with ${failed.length} failure(s), ${unverified.length} verification mismatch(es).`);
|
|
350
351
|
}
|
|
351
352
|
}
|
|
352
|
-
|
|
353
|
+
async function executeEnvCommand(context) {
|
|
353
354
|
const subcommand = context.args._[1] || 'list';
|
|
354
355
|
if (subcommand === 'add') {
|
|
355
356
|
await handleEnvAdd(context);
|
|
@@ -377,3 +378,6 @@ export async function handleEnvCommand(context) {
|
|
|
377
378
|
}
|
|
378
379
|
throw new Error(`Unknown projects command: ${subcommand}. Available: add, list, set, remove, diff, apply.`);
|
|
379
380
|
}
|
|
381
|
+
export async function handleEnvCommand(context) {
|
|
382
|
+
return withCommandSyncOmit(context, ['component'], scoped => executeEnvCommand(scoped));
|
|
383
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { readProjectStableKeyName } from "../project.js";
|
|
2
3
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
3
4
|
import { activateVerifiedEvents, buildEventsPlan, pullEventsToWorkspace, pushEvents } from "../resource-syncs/event-sync.js";
|
|
4
5
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
5
6
|
import { planDependencyHints, printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeEventsCommand(context) {
|
|
8
9
|
const subcommand = context.args._[1] || '';
|
|
9
10
|
if (!['pull', 'plan', 'push'].includes(subcommand)) {
|
|
10
11
|
throw new Error('Unknown events command. Usage: revo events <pull|plan|push> --all [--env <name>]');
|
|
@@ -142,3 +143,6 @@ export async function handleEventsCommand(context) {
|
|
|
142
143
|
}
|
|
143
144
|
printSyncSummary(context.println, 'Pulled', output, Date.now() - startedAt);
|
|
144
145
|
}
|
|
146
|
+
export async function handleEventsCommand(context) {
|
|
147
|
+
return withCommandSyncOmit(context, ['event'], scoped => executeEventsCommand(scoped));
|
|
148
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { resolveProjectRoot, readProjectStableKeyName } from "../project.js";
|
|
@@ -141,7 +142,7 @@ async function handlePush(context) {
|
|
|
141
142
|
throw new Error(`Group push finished with ${failed.length} failure(s).`);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
+
async function executeGroupsCommand(context) {
|
|
145
146
|
warnAboutExperimentalState(context);
|
|
146
147
|
const subcommand = context.args._[1] || '';
|
|
147
148
|
if (subcommand === 'pull') {
|
|
@@ -158,3 +159,6 @@ export async function handleGroupsCommand(context) {
|
|
|
158
159
|
}
|
|
159
160
|
throw new Error('Unknown groups command. Usage: revo groups <pull|plan|push> --all [--env <name>]');
|
|
160
161
|
}
|
|
162
|
+
export async function handleGroupsCommand(context) {
|
|
163
|
+
return withCommandSyncOmit(context, ['group'], scoped => executeGroupsCommand(scoped));
|
|
164
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { validateCommandArguments } from "../argument-contract.js";
|
|
1
2
|
import { buildRuntimeViewModel } from "../runtime-view.js";
|
|
2
3
|
import { renderRuntimeInfo } from "../ui.js";
|
|
3
4
|
export async function handleInfoCommand(context) {
|
|
5
|
+
validateCommandArguments(context.args);
|
|
4
6
|
const view = await buildRuntimeViewModel(context);
|
|
5
7
|
context.print(renderRuntimeInfo(view));
|
|
6
8
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { withCommandSyncOmit } from "../sync-omit-command.js";
|
|
1
2
|
import { buildJobTemplatesPlan, pullJobTemplatesToWorkspace, pushJobTemplates } from "../resource-syncs/job-template-sync.js";
|
|
2
3
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
3
4
|
import { readProjectStableKeyName } from "../project.js";
|
|
4
5
|
import { resolveResourceTarget } from "../resource-target.js";
|
|
5
6
|
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
7
|
import { readBoolFlag } from "../utils.js";
|
|
7
|
-
|
|
8
|
+
async function executeJobTemplatesCommand(context) {
|
|
8
9
|
const subcommand = context.args._[1] || '';
|
|
9
10
|
if (!['pull', 'plan', 'push'].includes(subcommand))
|
|
10
11
|
throw new Error('Unknown job-templates command. Usage: revo job-templates <pull|plan|push> --all [--env <name>]');
|
|
@@ -105,3 +106,6 @@ export async function handleJobTemplatesCommand(context) {
|
|
|
105
106
|
printSyncNotice(context.println, `${warning.stableKey}: ${warning.reason}`);
|
|
106
107
|
printSyncSummary(context.println, 'Pulled', output, Date.now() - startedAt);
|
|
107
108
|
}
|
|
109
|
+
export async function handleJobTemplatesCommand(context) {
|
|
110
|
+
return withCommandSyncOmit(context, ['job-template'], scoped => executeJobTemplatesCommand(scoped));
|
|
111
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { validateCommandArguments } from "../argument-contract.js";
|
|
1
2
|
import { RevoClient } from "../client.js";
|
|
2
3
|
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
4
|
import { applyMetadataBackfillPlan, buildMetadataBackfillPlan, } from "../metadata-backfill.js";
|
|
@@ -189,6 +190,7 @@ async function handleMetadataApply(context) {
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
export async function handleMetadataCommand(context) {
|
|
193
|
+
validateCommandArguments(context.args);
|
|
192
194
|
const subcommand = context.args._[1] || 'plan';
|
|
193
195
|
if (subcommand === 'plan') {
|
|
194
196
|
await handleMetadataPlan(context);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CommandContext } from '../types.ts';
|
|
2
|
-
export declare function handleDiffCommand(context: CommandContext): Promise<void>;
|
|
3
2
|
export declare function handlePlanCommand(context: CommandContext): Promise<void>;
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function handleDiffCommand(context: CommandContext): Promise<void>;
|
|
5
4
|
export declare function handleDeployCommand(context: CommandContext): Promise<void>;
|
|
5
|
+
export declare function handlePullCommand(context: CommandContext): Promise<void>;
|
|
6
6
|
export declare function handleMigrateCommand(context: CommandContext): Promise<void>;
|