@revoengine/cli 1.0.33 → 1.0.34
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 +25 -0
- package/README.md +83 -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 +22 -0
- 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 +3 -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
|
@@ -4,6 +4,7 @@ import { AUTH_VALIDATION_TTL_MS, buildAuthValidationKey, DEFAULT_BASE_URL, readA
|
|
|
4
4
|
import { beginHttpTraceRequest, completeHttpTraceRequest, responseSize, } from "./http-trace.js";
|
|
5
5
|
import { currentRequestQueue, RequestQueue } from "./request-queue.js";
|
|
6
6
|
import { createSpinner } from "./spinner.js";
|
|
7
|
+
import { currentSyncOmitPolicy } from "./sync-omit.js";
|
|
7
8
|
import { mapWithConcurrency } from "./utils.js";
|
|
8
9
|
export function isDatabaseSchemaOperation(value) {
|
|
9
10
|
return Boolean(value && typeof value === 'object' && value.accepted === true
|
|
@@ -425,6 +426,7 @@ export class RevoClient {
|
|
|
425
426
|
retryDelayMs;
|
|
426
427
|
requestQueue;
|
|
427
428
|
componentSyncManifestsSupported;
|
|
429
|
+
atomicResourceUpdatesValidation;
|
|
428
430
|
constructor(options = {}) {
|
|
429
431
|
const config = resolveRuntimeConfig(options);
|
|
430
432
|
this.baseUrl = config.baseUrl;
|
|
@@ -502,8 +504,28 @@ export class RevoClient {
|
|
|
502
504
|
throw error;
|
|
503
505
|
}
|
|
504
506
|
}
|
|
507
|
+
requireAtomicResourceUpdates() {
|
|
508
|
+
const key = this.authValidationKey;
|
|
509
|
+
if (this.atomicResourceUpdatesValidation?.key === key)
|
|
510
|
+
return this.atomicResourceUpdatesValidation.promise;
|
|
511
|
+
const validation = { key, promise: Promise.resolve() };
|
|
512
|
+
this.atomicResourceUpdatesValidation = validation;
|
|
513
|
+
// A stored auth profile can predate the API rollout. Always fetch the
|
|
514
|
+
// capability from this client's current target once before omitted writes.
|
|
515
|
+
validation.promise = this.validateSession({ force: true }).then(({ profile }) => {
|
|
516
|
+
validation.key = this.authValidationKey;
|
|
517
|
+
const value = isRecord(profile) && isRecord(profile.data) ? profile.data : profile;
|
|
518
|
+
if (!isRecord(value) || !isRecord(value.capabilities) || value.capabilities.atomicResourceUpdates !== true) {
|
|
519
|
+
throw new Error('The target API does not support atomic resource updates required by --omit. Upgrade the RevoEngine API before retrying.');
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
return validation.promise;
|
|
523
|
+
}
|
|
505
524
|
async request(method, path, options = {}) {
|
|
506
525
|
this.assertReady();
|
|
526
|
+
if (currentSyncOmitPolicy().rules.length && !['GET', 'HEAD', 'OPTIONS'].includes(method.toUpperCase()) && path !== '/api/v1/me') {
|
|
527
|
+
await this.requireAtomicResourceUpdates();
|
|
528
|
+
}
|
|
507
529
|
if (options.authGuard !== false && path !== '/api/v1/me') {
|
|
508
530
|
await this.validateSession();
|
|
509
531
|
}
|
|
@@ -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>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withCommandSyncOmit, workspaceSyncOmitFamilies } from "../sync-omit-command.js";
|
|
1
2
|
import { updateWorkspaceDigests } from "../workspace-digests.js";
|
|
2
3
|
import fs from 'node:fs';
|
|
3
4
|
import path from 'node:path';
|
|
@@ -20,6 +21,7 @@ const RESOURCE_ALIASES = {
|
|
|
20
21
|
'database-schema': 'database-table',
|
|
21
22
|
'database-schemas': 'database-table',
|
|
22
23
|
database: 'database-table',
|
|
24
|
+
databases: 'database-table',
|
|
23
25
|
'database-view': 'database-view',
|
|
24
26
|
'database-views': 'database-view',
|
|
25
27
|
dbview: 'database-view',
|
|
@@ -447,7 +449,7 @@ async function handleMigrationRead(context, input, command) {
|
|
|
447
449
|
throw new Error('Migration verification failed: target still requires changes.');
|
|
448
450
|
}
|
|
449
451
|
}
|
|
450
|
-
|
|
452
|
+
async function executeDiffCommand(context) {
|
|
451
453
|
if (readBoolFlag(context.args, ['prune']))
|
|
452
454
|
throw new Error('Review deletions with revo plan --prune; diff compares content only.');
|
|
453
455
|
if (readBoolFlag(context.args, ['force', 'f'])) {
|
|
@@ -455,7 +457,7 @@ export async function handleDiffCommand(context) {
|
|
|
455
457
|
}
|
|
456
458
|
await handleMigrationRead(context, await readWorkspaceDeploymentInput(context), 'diff');
|
|
457
459
|
}
|
|
458
|
-
|
|
460
|
+
async function executePlanCommand(context) {
|
|
459
461
|
if (context.args._[1] === 'update') {
|
|
460
462
|
if (Object.keys(context.args).some(key => !['_', 'json', 'project', 'update-notifier'].includes(key))) {
|
|
461
463
|
throw new Error('Offline plan update accepts --json and --project only; target/deployment flags require revo plan.');
|
|
@@ -483,14 +485,21 @@ export async function handlePlanCommand(context) {
|
|
|
483
485
|
function readPullResources(context) {
|
|
484
486
|
const all = readBoolFlag(context.args, ['all', 'a']);
|
|
485
487
|
const values = readValues(context.args, ['resources', 'resource']);
|
|
486
|
-
|
|
488
|
+
const positional = context.args._.slice(1);
|
|
489
|
+
if (positional.length && (all || values.length)) {
|
|
490
|
+
throw new Error('Repository pull accepts positional resources, --all, or --resources <list>; choose one selection form.');
|
|
491
|
+
}
|
|
492
|
+
if (!all && values.length === 0 && positional.length === 0) {
|
|
487
493
|
throw new Error('Repository pull requires --all or --resources <list>.');
|
|
488
494
|
}
|
|
489
495
|
if (all && values.length > 0) {
|
|
490
496
|
throw new Error('Repository pull accepts either --all or --resources <list>, not both.');
|
|
491
497
|
}
|
|
492
498
|
if (!all) {
|
|
493
|
-
return readMigrationResources(
|
|
499
|
+
return readMigrationResources(positional.length ? {
|
|
500
|
+
...context,
|
|
501
|
+
args: { ...context.args, resources: positional },
|
|
502
|
+
} : context, 'Repository pull');
|
|
494
503
|
}
|
|
495
504
|
const resources = [...MIGRATION_RESOURCE_ORDER];
|
|
496
505
|
return readBoolFlag(context.args, ['skip-groups'])
|
|
@@ -505,7 +514,7 @@ async function confirmPull(context) {
|
|
|
505
514
|
throw new Error('Repository pull requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
506
515
|
}
|
|
507
516
|
}
|
|
508
|
-
|
|
517
|
+
async function executePullCommand(context) {
|
|
509
518
|
const resources = readPullResources(context);
|
|
510
519
|
await confirmPull(context);
|
|
511
520
|
const authenticatedInstance = await resolveAuthenticatedInstance(context.client, 'source');
|
|
@@ -576,7 +585,7 @@ function printRunResult(context, result, showPlan = true) {
|
|
|
576
585
|
}
|
|
577
586
|
context.println(`Final verdict: ${result.verdict}.`);
|
|
578
587
|
}
|
|
579
|
-
|
|
588
|
+
async function executeDeployCommand(context) {
|
|
580
589
|
if (readBoolFlag(context.args, ['async']))
|
|
581
590
|
throw new Error('Full deploy waits for schema readiness and verified readback before dependent phases; use database-tables push <stableKey> --async for admission only.');
|
|
582
591
|
if (readBoolFlag(context.args, ['changed']) || readFlag(context.args, ['base']) || readValues(context.args, ['resources', 'resource']).length > 0) {
|
|
@@ -622,7 +631,7 @@ export async function handleDeployCommand(context) {
|
|
|
622
631
|
throw new Error(`Deployment finished with verdict "${result.verdict}".`);
|
|
623
632
|
}
|
|
624
633
|
}
|
|
625
|
-
|
|
634
|
+
async function executeMigrateCommand(context) {
|
|
626
635
|
if (readBoolFlag(context.args, ['prune']))
|
|
627
636
|
throw new Error('Prune requires repository plan/deploy; named migration remains upsert-only.');
|
|
628
637
|
const requestedSubcommand = context.args._[1] || 'plan';
|
|
@@ -651,3 +660,18 @@ export async function handleMigrateCommand(context) {
|
|
|
651
660
|
throw new Error(`Migration run finished with verdict "${result.verdict}".`);
|
|
652
661
|
}
|
|
653
662
|
}
|
|
663
|
+
export async function handlePlanCommand(context) {
|
|
664
|
+
return withCommandSyncOmit(context, workspaceSyncOmitFamilies(context), scoped => executePlanCommand(scoped));
|
|
665
|
+
}
|
|
666
|
+
export async function handleDiffCommand(context) {
|
|
667
|
+
return withCommandSyncOmit(context, workspaceSyncOmitFamilies(context), scoped => executeDiffCommand(scoped));
|
|
668
|
+
}
|
|
669
|
+
export async function handleDeployCommand(context) {
|
|
670
|
+
return withCommandSyncOmit(context, workspaceSyncOmitFamilies(context), scoped => executeDeployCommand(scoped));
|
|
671
|
+
}
|
|
672
|
+
export async function handlePullCommand(context) {
|
|
673
|
+
return withCommandSyncOmit(context, readPullResources(context), scoped => executePullCommand(scoped));
|
|
674
|
+
}
|
|
675
|
+
export async function handleMigrateCommand(context) {
|
|
676
|
+
return withCommandSyncOmit(context, readMigrationResources(context), scoped => executeMigrateCommand(scoped));
|
|
677
|
+
}
|