@revoengine/cli 1.0.11 → 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.
- package/README.md +275 -479
- package/dist/src/cli.js +71 -5
- package/dist/src/client.d.ts +28 -12
- package/dist/src/client.js +234 -66
- package/dist/src/commands/component.d.ts +67 -0
- package/dist/src/commands/component.js +299 -27
- package/dist/src/commands/database-tables.d.ts +2 -0
- package/dist/src/commands/{database-schemas.js → database-tables.js} +21 -40
- package/dist/src/commands/database-views.js +21 -18
- package/dist/src/commands/endpoints.js +26 -16
- package/dist/src/commands/events.js +18 -20
- package/dist/src/commands/groups.js +13 -22
- package/dist/src/commands/index.d.ts +2 -1
- package/dist/src/commands/index.js +2 -1
- package/dist/src/commands/job-templates.js +21 -15
- package/dist/src/commands/metadata.js +58 -15
- package/dist/src/commands/migrate.d.ts +6 -0
- package/dist/src/commands/migrate.js +658 -0
- package/dist/src/commands/project.js +4 -4
- package/dist/src/commands/role-groups.js +14 -25
- package/dist/src/commands/schedules.js +19 -20
- package/dist/src/commands/terminal-browser.d.ts +16 -0
- package/dist/src/commands/terminal-browser.js +92 -0
- package/dist/src/commands/terminal-image.d.ts +7 -0
- package/dist/src/commands/terminal-image.js +40 -0
- package/dist/src/commands/terminal-patch-worker.d.ts +1 -0
- package/dist/src/commands/terminal-patch-worker.js +24 -0
- package/dist/src/commands/terminal-patch.d.ts +2 -0
- package/dist/src/commands/terminal-patch.js +156 -0
- package/dist/src/commands/terminal-sandbox.d.ts +8 -0
- package/dist/src/commands/terminal-sandbox.js +87 -0
- package/dist/src/commands/terminal-service.js +2 -2
- package/dist/src/commands/terminal.d.ts +31 -4
- package/dist/src/commands/terminal.js +360 -45
- package/dist/src/component-lock.d.ts +12 -2
- package/dist/src/component-lock.js +60 -1
- package/dist/src/diff-details.d.ts +8 -0
- package/dist/src/diff-details.js +152 -0
- package/dist/src/env-sync.js +8 -6
- package/dist/src/http-trace.d.ts +94 -0
- package/dist/src/http-trace.js +226 -0
- package/dist/src/metadata-backfill.d.ts +5 -4
- package/dist/src/metadata-backfill.js +82 -158
- package/dist/src/migration.d.ts +141 -0
- package/dist/src/migration.js +1632 -0
- package/dist/src/resource-inventory.d.ts +28 -0
- package/dist/src/resource-inventory.js +85 -0
- package/dist/src/resource-syncs/{database-schema-sync.d.ts → database-table-sync.d.ts} +13 -3
- package/dist/src/resource-syncs/{database-schema-sync.js → database-table-sync.js} +147 -62
- package/dist/src/resource-syncs/database-view-sync.d.ts +24 -2
- package/dist/src/resource-syncs/database-view-sync.js +156 -68
- package/dist/src/resource-syncs/endpoint-sync.d.ts +27 -0
- package/dist/src/resource-syncs/endpoint-sync.js +362 -82
- package/dist/src/resource-syncs/event-sync.d.ts +27 -0
- package/dist/src/resource-syncs/event-sync.js +123 -26
- package/dist/src/resource-syncs/group-sync.d.ts +7 -0
- package/dist/src/resource-syncs/group-sync.js +60 -14
- package/dist/src/resource-syncs/job-template-sync.d.ts +21 -0
- package/dist/src/resource-syncs/job-template-sync.js +91 -30
- package/dist/src/resource-syncs/role-group-sync.d.ts +7 -0
- package/dist/src/resource-syncs/role-group-sync.js +47 -9
- package/dist/src/resource-syncs/schedule-sync.d.ts +30 -1
- package/dist/src/resource-syncs/schedule-sync.js +114 -20
- package/dist/src/resource-syncs/util.d.ts +3 -0
- package/dist/src/resource-syncs/util.js +8 -6
- package/dist/src/resource-target.d.ts +11 -0
- package/dist/src/resource-target.js +48 -0
- package/dist/src/sync-output.d.ts +29 -1
- package/dist/src/sync-output.js +139 -2
- package/dist/src/tracked-resources.d.ts +1 -1
- package/dist/src/tracked-resources.js +8 -6
- package/dist/src/types.d.ts +3 -0
- package/dist/src/ui.js +18 -9
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.js +17 -0
- package/dist/src/workspace-diff.d.ts +25 -0
- package/dist/src/workspace-diff.js +75 -0
- package/package.json +9 -6
- package/dist/src/commands/database-schemas.d.ts +0 -2
- /package/dist/src/{database-schema-artifacts.d.ts → database-table-artifacts.d.ts} +0 -0
- /package/dist/src/{database-schema-artifacts.js → database-table-artifacts.js} +0 -0
|
@@ -1,54 +1,39 @@
|
|
|
1
|
-
import { RevoClient } from "../client.js";
|
|
2
|
-
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
1
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
4
2
|
import { readProjectStableKeyName } from "../project.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return '(absent)';
|
|
11
|
-
}
|
|
12
|
-
const serialized = JSON.stringify(value);
|
|
13
|
-
return serialized === undefined ? String(value) : serialized;
|
|
14
|
-
}
|
|
15
|
-
export async function handleDatabaseSchemasCommand(context) {
|
|
3
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
4
|
+
import { buildDatabaseSchemasPlan, pullDatabaseSchemasToWorkspace, pushDatabaseSchemas } from "../resource-syncs/database-table-sync.js";
|
|
5
|
+
import { planValueChanges, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
|
+
import { readBoolFlag } from "../utils.js";
|
|
7
|
+
export async function handleDatabaseTablesCommand(context) {
|
|
16
8
|
const subcommand = context.args._[1] || '';
|
|
17
9
|
if (subcommand !== 'pull' && subcommand !== 'plan' && subcommand !== 'push') {
|
|
18
|
-
throw new Error('Unknown database-
|
|
10
|
+
throw new Error('Unknown database-tables command. Usage: revo database-tables <pull|plan|push> --all [--env <name>]');
|
|
19
11
|
}
|
|
20
12
|
const selectedStableKey = context.args._[2];
|
|
21
13
|
const all = readBoolFlag(context.args, ['all', 'a']);
|
|
22
14
|
const skipPartitions = readBoolFlag(context.args, ['skip-partitions']);
|
|
23
15
|
const pruneOrphans = readBoolFlag(context.args, ['prune-orphans']);
|
|
24
16
|
if (subcommand !== 'push' && !all) {
|
|
25
|
-
throw new Error(`Database
|
|
17
|
+
throw new Error(`Database Table ${subcommand} currently requires --all.`);
|
|
26
18
|
}
|
|
27
19
|
if (subcommand === 'push' && all === Boolean(selectedStableKey)) {
|
|
28
|
-
throw new Error('Database
|
|
20
|
+
throw new Error('Database Table push requires exactly one selector: <stableKey> or --all.');
|
|
29
21
|
}
|
|
30
22
|
if (skipPartitions && subcommand !== 'plan') {
|
|
31
|
-
throw new Error('Database
|
|
23
|
+
throw new Error('Database Table --skip-partitions is supported only by plan.');
|
|
32
24
|
}
|
|
33
25
|
if (pruneOrphans && subcommand === 'plan') {
|
|
34
|
-
throw new Error('Database
|
|
26
|
+
throw new Error('Database Table --prune-orphans is supported only by pull or push.');
|
|
35
27
|
}
|
|
36
28
|
if (pruneOrphans && (!readBoolFlag(context.args, ['yes', 'y']) || !readBoolFlag(context.args, ['force', 'f']))) {
|
|
37
|
-
throw new Error(`Database
|
|
38
|
-
}
|
|
39
|
-
const envName = readFlag(context.args, ['env']);
|
|
40
|
-
if (!envName) {
|
|
41
|
-
throw new Error('Missing --project <name>.');
|
|
42
|
-
}
|
|
43
|
-
if (envName === DEFAULT_ENV_NAME) {
|
|
44
|
-
throw new Error(`Database Schema ${subcommand} requires a named environment profile; "default" is not supported.`);
|
|
29
|
+
throw new Error(`Database Table ${subcommand} --prune-orphans requires --yes --force.`);
|
|
45
30
|
}
|
|
46
|
-
const client =
|
|
31
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Database Table' });
|
|
47
32
|
if (subcommand === 'push') {
|
|
48
33
|
const confirmed = readBoolFlag(context.args, ['yes', 'y']);
|
|
49
34
|
if (!confirmed) {
|
|
50
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push Database
|
|
51
|
-
throw new Error('Database
|
|
35
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push Database Tables to "${displayName}"?`, false)) {
|
|
36
|
+
throw new Error('Database Table push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
52
37
|
}
|
|
53
38
|
}
|
|
54
39
|
const startedAt = Date.now();
|
|
@@ -92,7 +77,7 @@ export async function handleDatabaseSchemasCommand(context) {
|
|
|
92
77
|
...(failed.length > 0 ? [`${failed.length} failure(s)`] : []),
|
|
93
78
|
...(unverifiedWrites.length > 0 ? [`${unverifiedWrites.length} unverified write(s)`] : []),
|
|
94
79
|
];
|
|
95
|
-
throw new Error(`Database
|
|
80
|
+
throw new Error(`Database Table push finished with ${outcomes.join(', ')}.`);
|
|
96
81
|
}
|
|
97
82
|
return;
|
|
98
83
|
}
|
|
@@ -110,18 +95,14 @@ export async function handleDatabaseSchemasCommand(context) {
|
|
|
110
95
|
}
|
|
111
96
|
else {
|
|
112
97
|
printSyncPlan(context.println, {
|
|
113
|
-
title: 'Database
|
|
114
|
-
environment:
|
|
98
|
+
title: 'Database Table',
|
|
99
|
+
environment: displayName,
|
|
115
100
|
counts: plan.counts,
|
|
101
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
116
102
|
items: plan.items.map((item) => ({
|
|
117
103
|
...item,
|
|
118
|
-
details: [
|
|
119
|
-
|
|
120
|
-
? [{
|
|
121
|
-
label: 'changes',
|
|
122
|
-
values: item.changes.map((change) => (`${change.field} (${change.risk}): ${formatPlanChangeValue(change.before)} -> ${formatPlanChangeValue(change.after)}`)),
|
|
123
|
-
}]
|
|
124
|
-
: []),
|
|
104
|
+
details: planValueChanges(item.changes || []),
|
|
105
|
+
hints: [
|
|
125
106
|
...(item.hints.length ? [{ label: 'hints', values: item.hints }] : []),
|
|
126
107
|
...(item.stats
|
|
127
108
|
? [{
|
|
@@ -139,7 +120,7 @@ export async function handleDatabaseSchemasCommand(context) {
|
|
|
139
120
|
const converged = new Set(['clean', 'reconciled', 'orphan-root', 'orphan-partition']);
|
|
140
121
|
const drift = plan.items.filter((item) => !converged.has(item.status));
|
|
141
122
|
if (plan.blockers.length > 0 || drift.length > 0) {
|
|
142
|
-
throw new Error(`Database
|
|
123
|
+
throw new Error(`Database Table strict plan is not converged: ${drift.length} drift or incomplete item(s), ${plan.blockers.length} blocker(s).`);
|
|
143
124
|
}
|
|
144
125
|
}
|
|
145
126
|
return;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { RevoClient } from "../client.js";
|
|
2
|
-
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
1
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
4
2
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
5
4
|
import { buildDatabaseViewsPlan, pullDatabaseViewsToWorkspace, pushDatabaseViews } from "../resource-syncs/database-view-sync.js";
|
|
6
5
|
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
7
|
-
import { readBoolFlag
|
|
6
|
+
import { readBoolFlag } from "../utils.js";
|
|
8
7
|
export async function handleDatabaseViewsCommand(context) {
|
|
9
8
|
const subcommand = context.args._[1] || '';
|
|
10
9
|
if (subcommand !== 'pull' && subcommand !== 'plan' && subcommand !== 'push') {
|
|
11
|
-
throw new Error('Unknown database-views command. Usage: revo database-views <pull|plan|push> --all --
|
|
10
|
+
throw new Error('Unknown database-views command. Usage: revo database-views <pull|plan|push> --all [--env <name>]');
|
|
12
11
|
}
|
|
13
12
|
const selectedStableKey = context.args._[2];
|
|
14
13
|
const all = readBoolFlag(context.args, ['all', 'a']);
|
|
@@ -18,18 +17,11 @@ export async function handleDatabaseViewsCommand(context) {
|
|
|
18
17
|
if (subcommand === 'push' && all === Boolean(selectedStableKey)) {
|
|
19
18
|
throw new Error('Database View push requires exactly one selector: <stableKey> or --all.');
|
|
20
19
|
}
|
|
21
|
-
const envName =
|
|
22
|
-
if (!envName) {
|
|
23
|
-
throw new Error('Missing --project <name>.');
|
|
24
|
-
}
|
|
25
|
-
if (envName === DEFAULT_ENV_NAME) {
|
|
26
|
-
throw new Error(`Database View ${subcommand} requires a named environment profile; "default" is not supported.`);
|
|
27
|
-
}
|
|
28
|
-
const client = new RevoClient({ envName });
|
|
20
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Database View' });
|
|
29
21
|
if (subcommand === 'push') {
|
|
30
22
|
const confirmed = readBoolFlag(context.args, ['yes', 'y']);
|
|
31
23
|
if (!confirmed) {
|
|
32
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push Database Views to "${
|
|
24
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push Database Views to "${displayName}"?`, false)) {
|
|
33
25
|
throw new Error('Database View push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
34
26
|
}
|
|
35
27
|
}
|
|
@@ -41,7 +33,6 @@ export async function handleDatabaseViewsCommand(context) {
|
|
|
41
33
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
42
34
|
...(selectedStableKey ? { stableKey: selectedStableKey } : {}),
|
|
43
35
|
force: readBoolFlag(context.args, ['force', 'f']),
|
|
44
|
-
allowMaterializedWrites: readBoolFlag(context.args, ['allow-materialized']),
|
|
45
36
|
});
|
|
46
37
|
if (readBoolFlag(context.args, ['json'])) {
|
|
47
38
|
context.print(result);
|
|
@@ -62,10 +53,13 @@ export async function handleDatabaseViewsCommand(context) {
|
|
|
62
53
|
}
|
|
63
54
|
}
|
|
64
55
|
const failed = result.results.filter((item) => item.status === 'failed' || item.status === 'write-unverified');
|
|
65
|
-
|
|
56
|
+
const validationFailures = result.plan.items.filter((item) => (item.status === 'validation-failed'
|
|
57
|
+
&& (!selectedStableKey || item.stableKey === selectedStableKey)));
|
|
58
|
+
if (failed.length > 0 || result.plan.globalBlockers.length > 0 || validationFailures.length > 0) {
|
|
66
59
|
const reasons = failed.map((item) => item.error || item.reason || item.stableKey).join('; ');
|
|
67
60
|
const blockers = result.plan.globalBlockers.join('; ');
|
|
68
|
-
|
|
61
|
+
const validationReasons = validationFailures.map((item) => `${item.stableKey || item.name}: ${item.reason || 'target validation failed'}`).join('; ');
|
|
62
|
+
throw new Error(`Database View push finished with ${failed.length} failed or unverified write(s), ${result.plan.globalBlockers.length} global blocker(s), and ${validationFailures.length} validation failure(s): ${[reasons, blockers, validationReasons].filter(Boolean).join('; ')}`);
|
|
69
63
|
}
|
|
70
64
|
return;
|
|
71
65
|
}
|
|
@@ -82,9 +76,18 @@ export async function handleDatabaseViewsCommand(context) {
|
|
|
82
76
|
else {
|
|
83
77
|
printSyncPlan(context.println, {
|
|
84
78
|
title: 'Database View',
|
|
85
|
-
environment:
|
|
79
|
+
environment: displayName,
|
|
86
80
|
counts: plan.counts,
|
|
87
|
-
|
|
81
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
82
|
+
items: plan.items.map((item) => ({
|
|
83
|
+
...item,
|
|
84
|
+
details: item.rawQueryDiff?.length
|
|
85
|
+
? [{ label: 'rawQuery diff', lines: item.rawQueryDiff }]
|
|
86
|
+
: undefined,
|
|
87
|
+
hints: item.scheduleDependencies?.length
|
|
88
|
+
? [{ label: 'schedule dependencies', values: item.scheduleDependencies }]
|
|
89
|
+
: undefined,
|
|
90
|
+
})),
|
|
88
91
|
warnings: [...plan.exclusions, ...plan.warnings],
|
|
89
92
|
blockers: plan.blockers,
|
|
90
93
|
});
|
|
@@ -1,31 +1,23 @@
|
|
|
1
|
-
import { RevoClient } from "../client.js";
|
|
2
|
-
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
1
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
4
2
|
import { readProjectStableKeyName } from "../project.js";
|
|
3
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
5
4
|
import { buildEndpointsPlan, pullEndpointsToWorkspace, pushEndpoints } from "../resource-syncs/endpoint-sync.js";
|
|
6
5
|
import { printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
7
|
-
import { readBoolFlag
|
|
6
|
+
import { readBoolFlag } from "../utils.js";
|
|
8
7
|
export async function handleEndpointsCommand(context) {
|
|
9
8
|
const subcommand = context.args._[1] || '';
|
|
10
9
|
if (subcommand === 'pull' || subcommand === 'plan' || subcommand === 'push') {
|
|
11
10
|
if (!readBoolFlag(context.args, ['all', 'a'])) {
|
|
12
11
|
throw new Error('Endpoint sync currently requires --all.');
|
|
13
12
|
}
|
|
14
|
-
const envName =
|
|
15
|
-
if (!envName) {
|
|
16
|
-
throw new Error('Missing --project <name>.');
|
|
17
|
-
}
|
|
18
|
-
if (envName === DEFAULT_ENV_NAME) {
|
|
19
|
-
throw new Error('Endpoint sync requires a named environment profile; "default" is not supported.');
|
|
20
|
-
}
|
|
21
|
-
const client = new RevoClient({ envName });
|
|
13
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Endpoint' });
|
|
22
14
|
const stableKeyName = readProjectStableKeyName(context.cwd);
|
|
23
15
|
if (subcommand === 'push') {
|
|
24
16
|
if (readBoolFlag(context.args, ['prune'])) {
|
|
25
17
|
throw new Error('Endpoint prune is disabled until a reviewed deletion contract is introduced.');
|
|
26
18
|
}
|
|
27
19
|
if (!readBoolFlag(context.args, ['yes', 'y'])) {
|
|
28
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push Endpoints to "${
|
|
20
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push Endpoints to "${displayName}"?`, false)) {
|
|
29
21
|
throw new Error('Endpoint push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
30
22
|
}
|
|
31
23
|
}
|
|
@@ -66,10 +58,24 @@ export async function handleEndpointsCommand(context) {
|
|
|
66
58
|
else {
|
|
67
59
|
printSyncPlan(context.println, {
|
|
68
60
|
title: 'Endpoint',
|
|
69
|
-
environment:
|
|
61
|
+
environment: displayName,
|
|
70
62
|
counts: plan.counts,
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
64
|
+
items: plan.items.map((item) => ({
|
|
65
|
+
...item,
|
|
66
|
+
details: undefined,
|
|
67
|
+
hints: [
|
|
68
|
+
...(item.details || []),
|
|
69
|
+
...(item.dependencies || []).map((dependency) => ({
|
|
70
|
+
label: `${dependency.relation} dependency`,
|
|
71
|
+
values: `${dependency.stableKey} (${dependency.readiness})`,
|
|
72
|
+
})),
|
|
73
|
+
...(item.routeDependencies?.length
|
|
74
|
+
? [{ label: 'route waits for', values: item.routeDependencies.join(', ') }]
|
|
75
|
+
: []),
|
|
76
|
+
],
|
|
77
|
+
})),
|
|
78
|
+
warnings: [...plan.warnings, ...plan.exclusions],
|
|
73
79
|
blockers: plan.blockers,
|
|
74
80
|
});
|
|
75
81
|
}
|
|
@@ -98,6 +104,10 @@ export async function handleEndpointsCommand(context) {
|
|
|
98
104
|
printSyncStatus(context.println, { status: 'Pulled', direction: 'pull', targetPath: pulled.targetPath });
|
|
99
105
|
output.push({ status: 'pulled', targetPath: pulled.targetPath });
|
|
100
106
|
}
|
|
107
|
+
for (const pruned of result.pruned) {
|
|
108
|
+
printSyncStatus(context.println, { status: 'Pruned', direction: 'pull', targetPath: pruned.targetPath });
|
|
109
|
+
output.push({ status: 'pruned', targetPath: pruned.targetPath });
|
|
110
|
+
}
|
|
101
111
|
for (const skipped of result.skipped) {
|
|
102
112
|
printSyncStatus(context.println, {
|
|
103
113
|
status: 'Skipped',
|
|
@@ -111,7 +121,7 @@ export async function handleEndpointsCommand(context) {
|
|
|
111
121
|
return;
|
|
112
122
|
}
|
|
113
123
|
if (subcommand) {
|
|
114
|
-
throw new Error('Unknown endpoints command. Usage: revo endpoints [pull|plan|push] --all --
|
|
124
|
+
throw new Error('Unknown endpoints command. Usage: revo endpoints [pull|plan|push] --all [--env <name>]');
|
|
115
125
|
}
|
|
116
126
|
const endpoints = await context.client.listEndpoints();
|
|
117
127
|
context.print(endpoints);
|
|
@@ -1,32 +1,25 @@
|
|
|
1
|
-
import { RevoClient } from "../client.js";
|
|
2
|
-
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
1
|
import { readProjectStableKeyName } from "../project.js";
|
|
2
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
4
3
|
import { activateVerifiedEvents, buildEventsPlan, pullEventsToWorkspace, pushEvents } from "../resource-syncs/event-sync.js";
|
|
5
4
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
6
|
-
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
7
|
-
import { readBoolFlag
|
|
5
|
+
import { planDependencyHints, printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
6
|
+
import { readBoolFlag } from "../utils.js";
|
|
8
7
|
export async function handleEventsCommand(context) {
|
|
9
8
|
const subcommand = context.args._[1] || '';
|
|
10
9
|
if (!['pull', 'plan', 'push'].includes(subcommand)) {
|
|
11
|
-
throw new Error('Unknown events command. Usage: revo events <pull|plan|push> --all --
|
|
10
|
+
throw new Error('Unknown events command. Usage: revo events <pull|plan|push> --all [--env <name>]');
|
|
12
11
|
}
|
|
13
12
|
if (!readBoolFlag(context.args, ['all', 'a'])) {
|
|
14
13
|
throw new Error('Event sync currently requires --all.');
|
|
15
14
|
}
|
|
16
|
-
const envName =
|
|
17
|
-
if (!envName) {
|
|
18
|
-
throw new Error('Missing --project <name>.');
|
|
19
|
-
}
|
|
20
|
-
if (envName === DEFAULT_ENV_NAME) {
|
|
21
|
-
throw new Error('Event sync requires a named environment profile; "default" is not supported.');
|
|
22
|
-
}
|
|
15
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Event' });
|
|
23
16
|
const activate = readBoolFlag(context.args, ['activate']);
|
|
24
17
|
if (activate && subcommand !== 'push') {
|
|
25
18
|
throw new Error('--activate is available only with events push.');
|
|
26
19
|
}
|
|
27
20
|
if (subcommand === 'plan') {
|
|
28
21
|
const plan = await buildEventsPlan({
|
|
29
|
-
client
|
|
22
|
+
client,
|
|
30
23
|
cwd: context.cwd,
|
|
31
24
|
envName,
|
|
32
25
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -37,10 +30,16 @@ export async function handleEventsCommand(context) {
|
|
|
37
30
|
else {
|
|
38
31
|
printSyncPlan(context.println, {
|
|
39
32
|
title: 'Event',
|
|
40
|
-
environment:
|
|
33
|
+
environment: displayName,
|
|
41
34
|
counts: plan.counts,
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
36
|
+
items: plan.items.map((item) => ({
|
|
37
|
+
...item,
|
|
38
|
+
hints: item.dependency
|
|
39
|
+
? planDependencyHints({ ...item.dependency, resource: 'job-template' })
|
|
40
|
+
: undefined,
|
|
41
|
+
})),
|
|
42
|
+
warnings: [...plan.warnings, ...plan.exclusions],
|
|
44
43
|
blockers: plan.blockers,
|
|
45
44
|
});
|
|
46
45
|
}
|
|
@@ -57,12 +56,11 @@ export async function handleEventsCommand(context) {
|
|
|
57
56
|
if (activate && !isInteractiveTerminal()) {
|
|
58
57
|
throw new Error('Event activation in non-interactive mode requires --yes --activate.');
|
|
59
58
|
}
|
|
60
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push Events to "${
|
|
59
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push Events to "${displayName}"?`, false)) {
|
|
61
60
|
throw new Error('Event push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
63
|
const startedAt = Date.now();
|
|
65
|
-
const client = new RevoClient({ envName });
|
|
66
64
|
const pushed = await pushEvents({
|
|
67
65
|
client,
|
|
68
66
|
cwd: context.cwd,
|
|
@@ -79,7 +77,7 @@ export async function handleEventsCommand(context) {
|
|
|
79
77
|
activation = { candidateCount, results: [], skipped: 'configuration phase has failures' };
|
|
80
78
|
}
|
|
81
79
|
else {
|
|
82
|
-
const confirmed = !isInteractiveTerminal() || await promptConfirm(`Align activation for ${candidateCount} verified Event(s) on "${
|
|
80
|
+
const confirmed = !isInteractiveTerminal() || await promptConfirm(`Align activation for ${candidateCount} verified Event(s) on "${displayName}"?`, false);
|
|
83
81
|
if (confirmed) {
|
|
84
82
|
const activationResults = await activateVerifiedEvents({ client, candidates: pushed.verifiedActivationCandidates });
|
|
85
83
|
results.push(...activationResults);
|
|
@@ -124,7 +122,7 @@ export async function handleEventsCommand(context) {
|
|
|
124
122
|
}
|
|
125
123
|
const startedAt = Date.now();
|
|
126
124
|
const result = await pullEventsToWorkspace({
|
|
127
|
-
client
|
|
125
|
+
client,
|
|
128
126
|
cwd: context.cwd,
|
|
129
127
|
envName,
|
|
130
128
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { RevoClient } from "../client.js";
|
|
4
3
|
import { resolveProjectRoot, readProjectStableKeyName } from "../project.js";
|
|
4
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
5
5
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
6
6
|
import { buildGroupsPlan, pullGroupsToWorkspace, pushGroups } from "../resource-syncs/group-sync.js";
|
|
7
7
|
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary, } from "../sync-output.js";
|
|
8
|
-
import { readBoolFlag
|
|
9
|
-
function requireEnvName(context) {
|
|
10
|
-
const envName = readFlag(context.args, ['env']);
|
|
11
|
-
if (!envName) {
|
|
12
|
-
throw new Error('Missing --project <name>.');
|
|
13
|
-
}
|
|
14
|
-
return envName;
|
|
15
|
-
}
|
|
16
|
-
function environmentClient(envName) {
|
|
17
|
-
return new RevoClient({ envName });
|
|
18
|
-
}
|
|
8
|
+
import { readBoolFlag } from "../utils.js";
|
|
19
9
|
function warnAboutExperimentalState(context) {
|
|
20
10
|
const projectRoot = resolveProjectRoot(context.cwd) || path.resolve(context.cwd);
|
|
21
11
|
const legacyPaths = [
|
|
@@ -38,10 +28,10 @@ async function handlePull(context) {
|
|
|
38
28
|
if (!readBoolFlag(context.args, ['all', 'a'])) {
|
|
39
29
|
throw new Error('Group pull currently requires --all.');
|
|
40
30
|
}
|
|
41
|
-
const envName =
|
|
31
|
+
const { client, envName } = await resolveResourceTarget(context, { resource: 'Group', allowDefaultProfile: true });
|
|
42
32
|
const startedAt = Date.now();
|
|
43
33
|
const result = await pullGroupsToWorkspace({
|
|
44
|
-
client
|
|
34
|
+
client,
|
|
45
35
|
cwd: context.cwd,
|
|
46
36
|
envName,
|
|
47
37
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -77,9 +67,9 @@ async function handlePlan(context) {
|
|
|
77
67
|
if (readBoolFlag(context.args, ['prune'])) {
|
|
78
68
|
throw new Error('Group prune is disabled until a reviewed deletion contract is introduced.');
|
|
79
69
|
}
|
|
80
|
-
const envName =
|
|
70
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Group', allowDefaultProfile: true });
|
|
81
71
|
const plan = await buildGroupsPlan({
|
|
82
|
-
client
|
|
72
|
+
client,
|
|
83
73
|
cwd: context.cwd,
|
|
84
74
|
envName,
|
|
85
75
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -90,11 +80,12 @@ async function handlePlan(context) {
|
|
|
90
80
|
else {
|
|
91
81
|
printSyncPlan(context.println, {
|
|
92
82
|
title: 'Group',
|
|
93
|
-
environment:
|
|
83
|
+
environment: displayName,
|
|
94
84
|
counts: plan.counts,
|
|
85
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
95
86
|
items: plan.items.map((item) => ({
|
|
96
87
|
...item,
|
|
97
|
-
|
|
88
|
+
hints: item.ownerStableKey
|
|
98
89
|
? [{ label: 'owner', values: item.ownerStableKey }]
|
|
99
90
|
: [],
|
|
100
91
|
})),
|
|
@@ -116,15 +107,15 @@ async function handlePush(context) {
|
|
|
116
107
|
if (readBoolFlag(context.args, ['prune'])) {
|
|
117
108
|
throw new Error('Group prune is disabled until a reviewed deletion contract is introduced.');
|
|
118
109
|
}
|
|
119
|
-
const envName =
|
|
110
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Group', allowDefaultProfile: true });
|
|
120
111
|
if (!readBoolFlag(context.args, ['yes', 'y'])) {
|
|
121
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push Groups to "${
|
|
112
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push Groups to "${displayName}"?`, false)) {
|
|
122
113
|
throw new Error('Group push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
123
114
|
}
|
|
124
115
|
}
|
|
125
116
|
const startedAt = Date.now();
|
|
126
117
|
const result = await pushGroups({
|
|
127
|
-
client
|
|
118
|
+
client,
|
|
128
119
|
cwd: context.cwd,
|
|
129
120
|
envName,
|
|
130
121
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -165,5 +156,5 @@ export async function handleGroupsCommand(context) {
|
|
|
165
156
|
await handlePush(context);
|
|
166
157
|
return;
|
|
167
158
|
}
|
|
168
|
-
throw new Error('Unknown groups command. Usage: revo groups <pull|plan|push> --all --
|
|
159
|
+
throw new Error('Unknown groups command. Usage: revo groups <pull|plan|push> --all [--env <name>]');
|
|
169
160
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './auth.ts';
|
|
2
2
|
export * from './component.ts';
|
|
3
|
-
export * from './database-
|
|
3
|
+
export * from './database-tables.ts';
|
|
4
4
|
export * from './database-views.ts';
|
|
5
5
|
export * from './endpoints.ts';
|
|
6
6
|
export * from './env.ts';
|
|
@@ -9,6 +9,7 @@ export * from './groups.ts';
|
|
|
9
9
|
export * from './info.ts';
|
|
10
10
|
export * from './job-templates.ts';
|
|
11
11
|
export * from './metadata.ts';
|
|
12
|
+
export * from './migrate.ts';
|
|
12
13
|
export * from './project.ts';
|
|
13
14
|
export * from './request.ts';
|
|
14
15
|
export * from './role-groups.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./auth.js";
|
|
2
2
|
export * from "./component.js";
|
|
3
|
-
export * from "./database-
|
|
3
|
+
export * from "./database-tables.js";
|
|
4
4
|
export * from "./database-views.js";
|
|
5
5
|
export * from "./endpoints.js";
|
|
6
6
|
export * from "./env.js";
|
|
@@ -9,6 +9,7 @@ export * from "./groups.js";
|
|
|
9
9
|
export * from "./info.js";
|
|
10
10
|
export * from "./job-templates.js";
|
|
11
11
|
export * from "./metadata.js";
|
|
12
|
+
export * from "./migrate.js";
|
|
12
13
|
export * from "./project.js";
|
|
13
14
|
export * from "./request.js";
|
|
14
15
|
export * from "./role-groups.js";
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import { RevoClient } from "../client.js";
|
|
2
|
-
import { DEFAULT_ENV_NAME } from "../config.js";
|
|
3
1
|
import { buildJobTemplatesPlan, pullJobTemplatesToWorkspace, pushJobTemplates } from "../resource-syncs/job-template-sync.js";
|
|
4
2
|
import { isInteractiveTerminal, promptConfirm } from "../prompt.js";
|
|
5
3
|
import { readProjectStableKeyName } from "../project.js";
|
|
4
|
+
import { resolveResourceTarget } from "../resource-target.js";
|
|
6
5
|
import { printSyncNotice, printSyncPlan, printSyncStatus, printSyncSummary } from "../sync-output.js";
|
|
7
|
-
import { readBoolFlag
|
|
6
|
+
import { readBoolFlag } from "../utils.js";
|
|
8
7
|
export async function handleJobTemplatesCommand(context) {
|
|
9
8
|
const subcommand = context.args._[1] || '';
|
|
10
9
|
if (!['pull', 'plan', 'push'].includes(subcommand))
|
|
11
|
-
throw new Error('Unknown job-templates command. Usage: revo job-templates <pull|plan|push> --all --
|
|
10
|
+
throw new Error('Unknown job-templates command. Usage: revo job-templates <pull|plan|push> --all [--env <name>]');
|
|
12
11
|
if (!readBoolFlag(context.args, ['all', 'a']))
|
|
13
12
|
throw new Error('Job-template sync currently requires --all.');
|
|
14
|
-
const envName =
|
|
15
|
-
if (!envName)
|
|
16
|
-
throw new Error('Missing --project <name>.');
|
|
17
|
-
if (envName === DEFAULT_ENV_NAME)
|
|
18
|
-
throw new Error('Job-template sync requires a named environment profile; "default" is not supported.');
|
|
13
|
+
const { client, envName, displayName } = await resolveResourceTarget(context, { resource: 'Job-template' });
|
|
19
14
|
if (subcommand === 'push') {
|
|
20
15
|
if (!readBoolFlag(context.args, ['yes', 'y'])) {
|
|
21
|
-
if (!isInteractiveTerminal() || !await promptConfirm(`Push job templates to "${
|
|
16
|
+
if (!isInteractiveTerminal() || !await promptConfirm(`Push job templates to "${displayName}"?`, false)) {
|
|
22
17
|
throw new Error('Job-template push requires confirmation. Re-run with --yes or use an interactive terminal.');
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
20
|
const startedAt = Date.now();
|
|
26
21
|
const result = await pushJobTemplates({
|
|
27
|
-
client
|
|
22
|
+
client,
|
|
28
23
|
cwd: context.cwd,
|
|
29
24
|
envName,
|
|
30
25
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -52,7 +47,7 @@ export async function handleJobTemplatesCommand(context) {
|
|
|
52
47
|
}
|
|
53
48
|
if (subcommand === 'plan') {
|
|
54
49
|
const plan = await buildJobTemplatesPlan({
|
|
55
|
-
client
|
|
50
|
+
client,
|
|
56
51
|
cwd: context.cwd,
|
|
57
52
|
envName,
|
|
58
53
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -63,9 +58,16 @@ export async function handleJobTemplatesCommand(context) {
|
|
|
63
58
|
else {
|
|
64
59
|
printSyncPlan(context.println, {
|
|
65
60
|
title: 'Job-template',
|
|
66
|
-
environment:
|
|
61
|
+
environment: displayName,
|
|
67
62
|
counts: plan.counts,
|
|
68
|
-
|
|
63
|
+
showHints: readBoolFlag(context.args, ['hints']),
|
|
64
|
+
items: plan.items.map((item) => ({
|
|
65
|
+
...item,
|
|
66
|
+
hints: [
|
|
67
|
+
...(item.componentStableKey ? [{ label: 'component', values: item.componentStableKey }] : []),
|
|
68
|
+
...(item.dependencyReadiness ? [{ label: 'dependency', values: item.dependencyReadiness }] : []),
|
|
69
|
+
],
|
|
70
|
+
})),
|
|
69
71
|
warnings: plan.warnings,
|
|
70
72
|
blockers: plan.blockers,
|
|
71
73
|
});
|
|
@@ -80,7 +82,7 @@ export async function handleJobTemplatesCommand(context) {
|
|
|
80
82
|
}
|
|
81
83
|
const startedAt = Date.now();
|
|
82
84
|
const result = await pullJobTemplatesToWorkspace({
|
|
83
|
-
client
|
|
85
|
+
client,
|
|
84
86
|
cwd: context.cwd,
|
|
85
87
|
envName,
|
|
86
88
|
stableKeyName: readProjectStableKeyName(context.cwd),
|
|
@@ -95,6 +97,10 @@ export async function handleJobTemplatesCommand(context) {
|
|
|
95
97
|
printSyncStatus(context.println, { status: 'Pulled', direction: 'pull', targetPath: pulled.targetPath });
|
|
96
98
|
output.push({ status: 'pulled', targetPath: pulled.targetPath });
|
|
97
99
|
}
|
|
100
|
+
for (const skipped of result.skipped) {
|
|
101
|
+
printSyncStatus(context.println, { status: 'Skipped', direction: 'pull', targetPath: skipped.targetPath, reason: skipped.reason });
|
|
102
|
+
output.push({ status: 'skipped', targetPath: skipped.targetPath, reason: skipped.reason });
|
|
103
|
+
}
|
|
98
104
|
for (const warning of result.warnings)
|
|
99
105
|
printSyncNotice(context.println, `${warning.stableKey}: ${warning.reason}`);
|
|
100
106
|
printSyncSummary(context.println, 'Pulled', output, Date.now() - startedAt);
|