grada-run 0.40.16 → 0.41.0
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/bin/cli.js +22 -18
- package/package.json +1 -1
- package/src/commands/add.js +25 -8
- package/src/commands/alerts.js +6 -3
- package/src/commands/apply.js +119 -8
- package/src/commands/db/backup.js +5 -2
- package/src/commands/db/connect.js +6 -3
- package/src/commands/db/enable-vector.js +5 -2
- package/src/commands/db/import.js +5 -2
- package/src/commands/db/migrate.js +5 -2
- package/src/commands/db/restore.js +5 -2
- package/src/commands/destroy.js +6 -3
- package/src/commands/doctor.js +44 -25
- package/src/commands/domain.js +5 -2
- package/src/commands/drift.js +19 -3
- package/src/commands/eject.js +5 -2
- package/src/commands/exec.js +6 -2
- package/src/commands/gc.js +87 -17
- package/src/commands/init.js +8 -3
- package/src/commands/logs.js +6 -2
- package/src/commands/mcp.js +5 -2
- package/src/commands/rollback.js +6 -3
- package/src/commands/sleep.js +5 -2
- package/src/commands/status.js +6 -2
- package/src/commands/wake.js +6 -3
- package/src/core/parser.js +25 -7
- package/src/utils/args.js +11 -5
- package/src/utils/aws.js +38 -26
- package/src/utils/command.js +20 -0
- package/src/utils/file-lock.js +0 -22
- package/src/utils/hcl.js +27 -2
- package/src/utils/reconcile.js +40 -0
- package/templates/github/preview.yml +4 -3
- package/templates/github/teardown.yml +5 -2
package/bin/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ import { runDrift, parseDriftArgs } from '../src/commands/drift.js';
|
|
|
23
23
|
import { runAlerts, parseAlertsArgs } from '../src/commands/alerts.js';
|
|
24
24
|
import { runMcp, parseMcpArgs } from '../src/commands/mcp.js';
|
|
25
25
|
import { runTelemetry } from '../src/commands/telemetry.js';
|
|
26
|
-
import { parseCliArgs } from '../src/core/parser.js';
|
|
26
|
+
import { parseCliArgs, stripGlobalOnlyFlags } from '../src/core/parser.js';
|
|
27
27
|
import { getCliVersion } from '../src/core/telemetry.js';
|
|
28
28
|
|
|
29
29
|
const HELP_TEXT = [
|
|
@@ -77,6 +77,10 @@ const HELP_TEXT = [
|
|
|
77
77
|
|
|
78
78
|
const rawArgs = process.argv.slice(2);
|
|
79
79
|
const parsed = parseCliArgs(rawArgs);
|
|
80
|
+
// Per-command parsers see everything except globally-honored flags:
|
|
81
|
+
// --no-telemetry already took effect via DO_NOT_TRACK, and the
|
|
82
|
+
// unknown-flag gate would otherwise reject it on every command.
|
|
83
|
+
const commandArgs = stripGlobalOnlyFlags(rawArgs);
|
|
80
84
|
|
|
81
85
|
if (parsed.hasNoTelemetry) {
|
|
82
86
|
process.env.DO_NOT_TRACK = '1';
|
|
@@ -138,43 +142,43 @@ if (wantsVersion) {
|
|
|
138
142
|
const projectName = path.basename(process.cwd());
|
|
139
143
|
runCommand(auditSecrets(envFile, projectName, { region: parseRegionFlag(rawArgs) }));
|
|
140
144
|
} else if (dispatchCommand === 'apply') {
|
|
141
|
-
runCommand(applyStack({ ...parseApplyArgs(
|
|
145
|
+
runCommand(applyStack({ ...parseApplyArgs(commandArgs), isDryRun, ...(autoApprove ? { autoApprove: true } : {}), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
142
146
|
} else if (positionalArgs[0] === 'doctor') {
|
|
143
|
-
runCommand(runDoctor({ ...parseDoctorArgs(
|
|
147
|
+
runCommand(runDoctor({ ...parseDoctorArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
144
148
|
} else if (positionalArgs[0] === 'destroy') {
|
|
145
|
-
runCommand(destroyStack({ ...parseDestroyArgs(
|
|
149
|
+
runCommand(destroyStack({ ...parseDestroyArgs(commandArgs), ...(confirmYes ? { yes: true } : {}), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
146
150
|
} else if (positionalArgs[0] === 'eject') {
|
|
147
|
-
runCommand(ejectStack({ ...parseEjectArgs(
|
|
151
|
+
runCommand(ejectStack({ ...parseEjectArgs(commandArgs), ...(confirmYes ? { yes: true } : {}), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
148
152
|
} else if (positionalArgs[0] === 'sync-ai') {
|
|
149
153
|
runCommand(syncAi());
|
|
150
154
|
} else if (positionalArgs[0] === 'diagnose' || positionalArgs[0] === 'wtf') {
|
|
151
155
|
runCommand(runDiagnose(headlessOptions));
|
|
152
156
|
} else if (positionalArgs[0] === 'logs') {
|
|
153
|
-
runCommand(runLogs(parseLogsArgs(
|
|
157
|
+
runCommand(runLogs({ ...parseLogsArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
154
158
|
} else if (positionalArgs[0] === 'status') {
|
|
155
|
-
runCommand(runStatus(parseStatusArgs(
|
|
159
|
+
runCommand(runStatus({ ...parseStatusArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
156
160
|
} else if (positionalArgs[0] === 'rollback') {
|
|
157
|
-
runCommand(runRollback({ ...parseRollbackArgs(
|
|
161
|
+
runCommand(runRollback({ ...parseRollbackArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
158
162
|
} else if (positionalArgs[0] === 'exec') {
|
|
159
|
-
runCommand(runExec(parseExecArgs(
|
|
163
|
+
runCommand(runExec({ ...parseExecArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
160
164
|
} else if (positionalArgs[0] === 'db') {
|
|
161
|
-
runCommand(runDb(
|
|
165
|
+
runCommand(runDb(commandArgs, { ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
162
166
|
} else if (positionalArgs[0] === 'gc') {
|
|
163
|
-
runCommand(runGc(parseGcArgs(
|
|
167
|
+
runCommand(runGc({ ...parseGcArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
164
168
|
} else if (positionalArgs[0] === 'add') {
|
|
165
|
-
runCommand(runAdd(parseAddArgs(
|
|
169
|
+
runCommand(runAdd(parseAddArgs(commandArgs)));
|
|
166
170
|
} else if (positionalArgs[0] === 'domain') {
|
|
167
|
-
runCommand(runDomain(parseDomainArgs(
|
|
171
|
+
runCommand(runDomain(parseDomainArgs(commandArgs)));
|
|
168
172
|
} else if (positionalArgs[0] === 'sleep') {
|
|
169
|
-
runCommand(runSleep({ ...parseSleepArgs(
|
|
173
|
+
runCommand(runSleep({ ...parseSleepArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
170
174
|
} else if (positionalArgs[0] === 'wake') {
|
|
171
|
-
runCommand(runWake({ ...parseWakeArgs(
|
|
175
|
+
runCommand(runWake({ ...parseWakeArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
172
176
|
} else if (positionalArgs[0] === 'drift') {
|
|
173
|
-
runCommand(runDrift({ ...parseDriftArgs(
|
|
177
|
+
runCommand(runDrift({ ...parseDriftArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
174
178
|
} else if (positionalArgs[0] === 'alerts') {
|
|
175
|
-
runCommand(runAlerts({ ...parseAlertsArgs(
|
|
179
|
+
runCommand(runAlerts({ ...parseAlertsArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
176
180
|
} else if (positionalArgs[0] === 'mcp') {
|
|
177
|
-
runCommand(runMcp(parseMcpArgs(
|
|
181
|
+
runCommand(runMcp({ ...parseMcpArgs(commandArgs), ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
178
182
|
} else if (positionalArgs[0] === 'telemetry') {
|
|
179
183
|
runCommand(runTelemetry({ subcommand: positionalArgs[1], ...(isHeadless ? { isHeadless: true } : {}) }));
|
|
180
184
|
} else if (positionalArgs[0] === undefined || positionalArgs[0] === 'init') {
|
package/package.json
CHANGED
package/src/commands/add.js
CHANGED
|
@@ -11,8 +11,8 @@ import { ADDON_REGISTRY, ADDON_UPSERT_KEYS, resolveAddonEnvVars, addonTargetDisp
|
|
|
11
11
|
import { stripTerraformMetadata, readEjectedMarker } from '../utils/terraform-metadata.js';
|
|
12
12
|
import { normalizeDomain, isValidDomain, normalizeZoneId, isValidFromEmail, parseDomainTf } from '../utils/domains.js';
|
|
13
13
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../utils/args.js';
|
|
14
|
-
import { failCommand, failProjectNotInitialized, isProgrammaticCall, refuseIfNonInteractive } from '../utils/command.js';
|
|
15
|
-
import { findArrayBounds, findMapBounds, findNestedBlock, findResourceBlock, enclosingBraceBounds, normalizeBlankLines, realignAssignmentRuns } from '../utils/hcl.js';
|
|
14
|
+
import { failCommand, failProjectNotInitialized, isProgrammaticCall, refuseIfNonInteractive, refuseUnknownFlags } from '../utils/command.js';
|
|
15
|
+
import { findArrayBounds, findMapBounds, findNestedBlock, findResourceBlock, removeResourceBlock, enclosingBraceBounds, normalizeBlankLines, realignAssignmentRuns } from '../utils/hcl.js';
|
|
16
16
|
import { syncDocCostEstimate } from '../utils/visualizer.js';
|
|
17
17
|
import { withProjectLock } from '../utils/file-lock.js';
|
|
18
18
|
import { guardSleepingEnv, resolveSleepTarget } from '../utils/sleep-state.js';
|
|
@@ -76,7 +76,7 @@ export const DB_ADD_ENGINES = {
|
|
|
76
76
|
export function parseAddArgs(argv = []) {
|
|
77
77
|
const args = normalizeArgv(argv);
|
|
78
78
|
if (args[0] === 'add') args.shift();
|
|
79
|
-
const { options: parsed, rest } = parseFlags(args, {
|
|
79
|
+
const { options: parsed, rest, unknown } = parseFlags(args, {
|
|
80
80
|
string: ['region', 'project-name', 'partition-key', 'model', 'domain', 'from-email', 'zone-id', 'schedule', { name: 'cmd', key: 'cronCommand' }, { name: 'cron-command', key: 'cronCommand' }, 'name', 'timezone'],
|
|
81
81
|
boolean: ['force', { name: 'headless', key: 'isHeadless' }],
|
|
82
82
|
bareBoolean: ['list-models', 'refresh'],
|
|
@@ -92,6 +92,7 @@ export function parseAddArgs(argv = []) {
|
|
|
92
92
|
...parsed,
|
|
93
93
|
};
|
|
94
94
|
if (parsed.model !== undefined) options.modelProvided = true;
|
|
95
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
95
96
|
for (const arg of rest) {
|
|
96
97
|
if (typeof arg === 'string' && !arg.startsWith('-') && options.capability === undefined) {
|
|
97
98
|
options.capability = arg;
|
|
@@ -478,21 +479,35 @@ resource "aws_subnet" "db_isolated" {
|
|
|
478
479
|
}`;
|
|
479
480
|
|
|
480
481
|
// Idempotently appends the isolated-subnet block to network.tf content.
|
|
481
|
-
// Returns the content unchanged when the block already exists.
|
|
482
|
+
// Returns the content unchanged when the block already exists. Uses the
|
|
483
|
+
// line-anchored lookup so a `#` comment quoting the header never
|
|
484
|
+
// false-positives.
|
|
482
485
|
export function ensureIsolatedSubnets(networkTfContent) {
|
|
483
486
|
const content = String(networkTfContent ?? '');
|
|
484
|
-
if (content
|
|
487
|
+
if (findResourceBlock(content, 'aws_subnet', 'db_isolated')) return content;
|
|
485
488
|
const prefix = content.endsWith('\n') ? content : `${content}\n`;
|
|
486
489
|
return `${prefix}\n${ISOLATED_SUBNETS_BLOCK}\n`;
|
|
487
490
|
}
|
|
488
491
|
|
|
489
492
|
// Backfills the isolated-subnet block into a tree whose network.tf predates
|
|
490
|
-
// it.
|
|
491
|
-
//
|
|
493
|
+
// it. Legacy trees carry the block in database.tf instead: it is migrated
|
|
494
|
+
// (same state address — no state move needed), never duplicated. No-op
|
|
495
|
+
// when network.tf is missing (static), already has the block, or an
|
|
496
|
+
// unexpected file declares it. Returns true when network.tf was written.
|
|
492
497
|
async function backfillIsolatedSubnets(projectDir) {
|
|
493
|
-
const
|
|
498
|
+
const tfDir = path.join(projectDir, 'terraform');
|
|
499
|
+
const networkTfPath = path.join(tfDir, 'network.tf');
|
|
494
500
|
if (!fsSync.existsSync(networkTfPath)) return false;
|
|
495
501
|
const before = await fs.readFile(networkTfPath, 'utf-8');
|
|
502
|
+
if (findResourceBlock(before, 'aws_subnet', 'db_isolated')) return false;
|
|
503
|
+
for (const file of fsSync.readdirSync(tfDir).filter((f) => f.endsWith('.tf'))) {
|
|
504
|
+
if (file === 'network.tf') continue;
|
|
505
|
+
const filePath = path.join(tfDir, file);
|
|
506
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
507
|
+
if (!findResourceBlock(content, 'aws_subnet', 'db_isolated')) continue;
|
|
508
|
+
if (file !== 'database.tf') return false;
|
|
509
|
+
await atomicWriteFile(filePath, normalizeBlankLines(removeResourceBlock(content, 'aws_subnet', 'db_isolated')));
|
|
510
|
+
}
|
|
496
511
|
const after = ensureIsolatedSubnets(before);
|
|
497
512
|
if (after === before) return false;
|
|
498
513
|
await atomicWriteFile(networkTfPath, normalizeBlankLines(after));
|
|
@@ -1244,6 +1259,8 @@ export async function runAdd(input = {}) {
|
|
|
1244
1259
|
|
|
1245
1260
|
async function runAddMain(input = {}) {
|
|
1246
1261
|
const options = normalizeOptions(input);
|
|
1262
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'add', event: 'add_run' });
|
|
1263
|
+
if (unknownRefusal) return unknownRefusal;
|
|
1247
1264
|
const noExit = isProgrammaticCall(options);
|
|
1248
1265
|
let cwd;
|
|
1249
1266
|
let projectName;
|
package/src/commands/alerts.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import color from 'picocolors';
|
|
4
4
|
import { intro, outro, select, text, cancel, isCancel } from '@clack/prompts';
|
|
5
5
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../core/telemetry.js';
|
|
6
|
-
import { failCommand, failProjectNotInitialized, refuseIfNonInteractive } from '../utils/command.js';
|
|
6
|
+
import { failCommand, failProjectNotInitialized, refuseIfNonInteractive, refuseUnknownFlags } from '../utils/command.js';
|
|
7
7
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../utils/args.js';
|
|
8
8
|
import { resolveRegion, resolveProjectName, resolveCwd, resolveHeadless, readFileSafe, readTerraformComputeTarget } from '../utils/resolvers.js';
|
|
9
9
|
import { findNestedBlock } from '../utils/hcl.js';
|
|
@@ -33,12 +33,13 @@ const TARGET_ANCHORS = {
|
|
|
33
33
|
export function parseAlertsArgs(argv = []) {
|
|
34
34
|
const args = normalizeArgv(argv);
|
|
35
35
|
if (args[0] === 'alerts') args.shift();
|
|
36
|
-
const { options, rest } = parseFlags(args, {
|
|
36
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
37
37
|
string: ['region', 'project-name', 'email', 'webhook', 'threshold'],
|
|
38
|
-
boolean: ['force'],
|
|
38
|
+
boolean: ['force', 'headless'],
|
|
39
39
|
});
|
|
40
40
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
41
41
|
if (positionals.length > 0) options.unexpectedPositionals = positionals;
|
|
42
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
42
43
|
return options;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -396,6 +397,8 @@ export async function runAlerts(input = {}) {
|
|
|
396
397
|
|
|
397
398
|
async function runAlertsMain(input = {}) {
|
|
398
399
|
const options = normalizeOptions(input);
|
|
400
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'alerts', event: 'alerts_run' });
|
|
401
|
+
if (unknownRefusal) return unknownRefusal;
|
|
399
402
|
let cwd;
|
|
400
403
|
let region;
|
|
401
404
|
let projectName;
|
package/src/commands/apply.js
CHANGED
|
@@ -5,30 +5,127 @@ import color from 'picocolors';
|
|
|
5
5
|
import { renderDryRunPreview, parseTerraformConfig, buildCostTelemetryProps } from '../utils/visualizer.js';
|
|
6
6
|
import { detectFramework } from '../utils/detector.js';
|
|
7
7
|
import { trackEvent, flushTelemetry, trackSuccess, trackFailure, setActiveCommandName, resetActiveCommandName } from '../core/telemetry.js';
|
|
8
|
-
import { failCommand, shouldAutoApprove, refuseIfNonInteractive } from '../utils/command.js';
|
|
8
|
+
import { failCommand, isProgrammaticCall, shouldAutoApprove, refuseIfNonInteractive, refuseUnknownFlags } from '../utils/command.js';
|
|
9
9
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../utils/args.js';
|
|
10
10
|
import { spawnSync } from 'child_process';
|
|
11
11
|
import { runTerraformCommand, getTerraformOutputs, readLastRunMarker, isInterruptedMarker, ensureTerraformInit, checkOutputsContract, DEFAULT_TERRAFORM_PHASE_TIMEOUT_MS } from '../utils/terraform.js';
|
|
12
12
|
import { classifyTerraformError, countRecreateCollisions, getRunbook, ERROR_CODES } from '../utils/terraform-errors.js';
|
|
13
13
|
import { readInitManifest, recordAppliedTarget } from '../utils/backup.js';
|
|
14
|
-
import { requireManagedTree } from '../utils/terraform-metadata.js';
|
|
15
|
-
import { readTerraformComputeTarget } from '../utils/resolvers.js';
|
|
14
|
+
import { requireManagedTree, parseStateBucketBackend } from '../utils/terraform-metadata.js';
|
|
15
|
+
import { readTerraformComputeTarget, resolveRegion } from '../utils/resolvers.js';
|
|
16
16
|
import { requireAwakeEnvironment, resolveSleepTarget, guardSleepingEnv } from '../utils/sleep-state.js';
|
|
17
17
|
import { promptStateBucketRecovery, recreateStateBucket } from '../utils/recovery.js';
|
|
18
18
|
import { resolveProjectName, readResourceSuffix } from '../utils/resolvers.js';
|
|
19
19
|
import { ensureLambdaSeedImage } from '../utils/lambda-ecr.js';
|
|
20
|
+
import { checkAwsCredentials, ensureStateBucketExists, printAwsAuthGuidance } from '../utils/aws.js';
|
|
21
|
+
import { findUnreconciledFiles, isValidAccountId, PLACEHOLDER_ACCOUNT_ID } from '../utils/reconcile.js';
|
|
20
22
|
import { runWake } from './wake.js';
|
|
21
23
|
|
|
22
24
|
export function parseApplyArgs(argv = []) {
|
|
23
25
|
const args = normalizeArgv(argv);
|
|
24
26
|
if (args[0] === 'apply' || args[0] === 'deploy') args.shift();
|
|
25
|
-
const { options } = parseFlags(args, {
|
|
26
|
-
boolean: ['force', 'destroy-previous-target', 'force-resume', 'allow-partial-outputs'],
|
|
27
|
-
string: ['force-unlock'],
|
|
27
|
+
const { options, unknown } = parseFlags(args, {
|
|
28
|
+
boolean: ['force', 'destroy-previous-target', 'force-resume', 'allow-partial-outputs', 'headless', 'auto-approve', 'dry-run'],
|
|
29
|
+
string: ['force-unlock', 'account-id'],
|
|
28
30
|
});
|
|
31
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
29
32
|
return { force: false, ...options };
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
// Offline reconcile: an `init --offline` tree carries
|
|
36
|
+
// YOUR_AWS_ACCOUNT_ID placeholders instead of an account id and has no
|
|
37
|
+
// state bucket. Resolve the account (explicit flag, else STS ground
|
|
38
|
+
// truth), confirm once, rewrite the files, and ensure the bucket —
|
|
39
|
+
// afterwards the normal flow sees a reconciled tree. Returns
|
|
40
|
+
// { proceed: true } or { proceed: false, result } carrying the
|
|
41
|
+
// refusal/failure for the caller to return.
|
|
42
|
+
export async function reconcileOfflineTree({ targetDir, options = {}, projectName }) {
|
|
43
|
+
const files = findUnreconciledFiles(targetDir);
|
|
44
|
+
let accountId;
|
|
45
|
+
let source;
|
|
46
|
+
const flag = options.accountId;
|
|
47
|
+
if (flag !== undefined && flag !== null) {
|
|
48
|
+
if (!isValidAccountId(flag)) {
|
|
49
|
+
return {
|
|
50
|
+
proceed: false,
|
|
51
|
+
result: await failCommand({
|
|
52
|
+
noExit: isProgrammaticCall(options),
|
|
53
|
+
message: `\n✖ Invalid --account-id "${flag}": ${describeAccountIdShape(flag)}.\n`,
|
|
54
|
+
event: 'infrastructure_applied',
|
|
55
|
+
telemetry: { projectName },
|
|
56
|
+
errorCode: 'INVALID_ACCOUNT_ID',
|
|
57
|
+
reason: 'invalid-account-id',
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
accountId = flag;
|
|
62
|
+
source = 'flag';
|
|
63
|
+
} else {
|
|
64
|
+
try {
|
|
65
|
+
accountId = (await checkAwsCredentials(resolveRegion(options, targetDir))).accountId;
|
|
66
|
+
source = 'sts';
|
|
67
|
+
} catch {
|
|
68
|
+
printAwsAuthGuidance(options);
|
|
69
|
+
return {
|
|
70
|
+
proceed: false,
|
|
71
|
+
result: await failCommand({
|
|
72
|
+
noExit: isProgrammaticCall(options),
|
|
73
|
+
message: '\n✖ Could not resolve the AWS account: configure credentials first — apply cannot provision without them.\n',
|
|
74
|
+
event: 'infrastructure_applied',
|
|
75
|
+
telemetry: { projectName },
|
|
76
|
+
errorCode: 'AWS_CREDENTIALS_MISSING',
|
|
77
|
+
reason: 'aws-credentials-missing',
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const from = source === 'flag' ? '--account-id' : 'AWS credentials';
|
|
83
|
+
log.message(`Reconciling ${files.length} offline placeholder file(s) with account ${color.cyan(accountId)} (from ${from}):`);
|
|
84
|
+
for (const file of files) log.message(` ${color.dim('-')} ${file}`);
|
|
85
|
+
const refused = await refuseIfNonInteractive(options, {
|
|
86
|
+
message: '\n✖ apply needs approval to reconcile offline placeholders.',
|
|
87
|
+
hint: ' Re-run with --auto-approve to reconcile non-interactively.\n',
|
|
88
|
+
event: 'infrastructure_applied',
|
|
89
|
+
telemetry: { projectName },
|
|
90
|
+
errorCode: 'RECONCILE_NON_INTERACTIVE',
|
|
91
|
+
});
|
|
92
|
+
if (refused) return { proceed: false, result: refused };
|
|
93
|
+
if (!shouldAutoApprove(options)) {
|
|
94
|
+
const confirmed = await confirm({
|
|
95
|
+
message: 'Rewrite the placeholders and ensure the state bucket?',
|
|
96
|
+
initialValue: false,
|
|
97
|
+
});
|
|
98
|
+
if (confirmed !== true) {
|
|
99
|
+
cancel('Reconcile aborted.');
|
|
100
|
+
process.exit(0);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
for (const file of files) {
|
|
104
|
+
const abs = path.join(targetDir, file);
|
|
105
|
+
fs.writeFileSync(abs, fs.readFileSync(abs, 'utf8').split(PLACEHOLDER_ACCOUNT_ID).join(accountId));
|
|
106
|
+
}
|
|
107
|
+
log.message(color.green(`Rewrote ${files.length} file(s).`));
|
|
108
|
+
const backend = fs.readFileSync(path.join(targetDir, 'terraform', 'backend.tf'), 'utf8');
|
|
109
|
+
const { bucket, region: backendRegion } = parseStateBucketBackend(backend);
|
|
110
|
+
const ensured = await ensureStateBucketExists({
|
|
111
|
+
region: backendRegion ?? resolveRegion(options, targetDir),
|
|
112
|
+
bucket,
|
|
113
|
+
});
|
|
114
|
+
trackEvent('apply_reconciled', {
|
|
115
|
+
projectName,
|
|
116
|
+
account_source: source,
|
|
117
|
+
file_count: files.length,
|
|
118
|
+
bucket_created: ensured.created,
|
|
119
|
+
});
|
|
120
|
+
return { proceed: true };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function describeAccountIdShape(value) {
|
|
124
|
+
const text = String(value);
|
|
125
|
+
if (!/^\d+$/.test(text)) return 'expected exactly 12 digits, got non-digit characters';
|
|
126
|
+
return `expected exactly 12 digits, got ${text.length}`;
|
|
127
|
+
}
|
|
128
|
+
|
|
32
129
|
// Unlock-and-retry flow for a stale Terraform state lock. Headless
|
|
33
130
|
// refuses unless `--force-unlock <id>` was passed; interactive asks once.
|
|
34
131
|
// Retries the apply exactly once, skipping the already-confirmed preview.
|
|
@@ -188,6 +285,8 @@ export async function applyStack(input = {}) {
|
|
|
188
285
|
|
|
189
286
|
async function applyStackMain(input = {}) {
|
|
190
287
|
const options = normalizeOptions(input);
|
|
288
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'apply', event: 'infrastructure_applied' });
|
|
289
|
+
if (unknownRefusal) return unknownRefusal;
|
|
191
290
|
intro(color.bgCyan(color.black(' grada apply ☁️ ')));
|
|
192
291
|
|
|
193
292
|
const targetDir = process.cwd();
|
|
@@ -210,14 +309,26 @@ async function applyStackMain(input = {}) {
|
|
|
210
309
|
});
|
|
211
310
|
}
|
|
212
311
|
|
|
213
|
-
// 1a.
|
|
312
|
+
// 1a. Offline reconcile: an `init --offline` tree still carries
|
|
313
|
+
// account placeholders and has no state bucket — resolve, confirm,
|
|
314
|
+
// rewrite, and ensure it before anything reads the files. Dry runs
|
|
315
|
+
// only warn: previews change nothing.
|
|
316
|
+
const unreconciled = findUnreconciledFiles(targetDir);
|
|
317
|
+
if (unreconciled.length > 0 && !options.isDryRun) {
|
|
318
|
+
const reconciled = await reconcileOfflineTree({ targetDir, options, projectName: path.basename(targetDir) });
|
|
319
|
+
if (!reconciled.proceed) return reconciled.result;
|
|
320
|
+
} else if (unreconciled.length > 0) {
|
|
321
|
+
log.warn(color.yellow('⚠ This tree still carries offline account placeholders. Run a real apply to reconcile it.'));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// 1b. Surface an interrupted previous run. Informational only — the
|
|
214
325
|
// new run overwrites the marker when it starts.
|
|
215
326
|
const lastRun = readLastRunMarker(targetDir);
|
|
216
327
|
if (isInterruptedMarker(lastRun)) {
|
|
217
328
|
log.warn(color.yellow(`⚠ Previous ${lastRun.command || 'terraform'} run was interrupted (started ${lastRun.startedAt || 'unknown'}). If it died mid-apply, review with ${color.green('cd terraform && terraform plan')} before trusting this run.`));
|
|
218
329
|
}
|
|
219
330
|
|
|
220
|
-
//
|
|
331
|
+
// 1c. Refuse to apply against an asleep environment: apply resets
|
|
221
332
|
// the app desired count while the database stays stopped, so fresh
|
|
222
333
|
// tasks would crash-loop. Dry runs change nothing, so they keep the
|
|
223
334
|
// historical advisory warning instead of the shared gate.
|
|
@@ -2,7 +2,7 @@ import { RDSClient, CreateDBSnapshotCommand, DescribeDBSnapshotsCommand, CreateD
|
|
|
2
2
|
import color from 'picocolors';
|
|
3
3
|
import { intro, outro, spinner } from '@clack/prompts';
|
|
4
4
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../../core/telemetry.js';
|
|
5
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
5
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
6
6
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
7
7
|
import { isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
8
8
|
import { resolveRegion, resolveProjectName, resolveAppName, resolveCwd } from '../../utils/resolvers.js';
|
|
@@ -22,7 +22,7 @@ export function parseDbBackupArgs(argv = []) {
|
|
|
22
22
|
const args = normalizeArgv(argv);
|
|
23
23
|
if (args[0] === 'db') args.shift();
|
|
24
24
|
if (args[0] === 'backup') args.shift();
|
|
25
|
-
const { options, rest } = parseFlags(args, {
|
|
25
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
26
26
|
string: [
|
|
27
27
|
{ name: 'id', key: 'snapshotId' },
|
|
28
28
|
{ name: 'timeout', key: 'timeout' },
|
|
@@ -35,6 +35,7 @@ export function parseDbBackupArgs(argv = []) {
|
|
|
35
35
|
});
|
|
36
36
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
37
37
|
if (positionals.length > 0) options.unexpectedPositionals = positionals;
|
|
38
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
38
39
|
return options;
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -51,6 +52,8 @@ export async function runDbBackup(input = {}) {
|
|
|
51
52
|
|
|
52
53
|
async function runDbBackupMain(input = {}) {
|
|
53
54
|
const options = normalizeOptions(input);
|
|
55
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db backup', event: 'db_backup_run' });
|
|
56
|
+
if (unknownRefusal) return unknownRefusal;
|
|
54
57
|
let cwd;
|
|
55
58
|
let region;
|
|
56
59
|
let projectName;
|
|
@@ -5,7 +5,7 @@ import { spawn } from 'child_process';
|
|
|
5
5
|
import color from 'picocolors';
|
|
6
6
|
import { intro, outro, spinner } from '@clack/prompts';
|
|
7
7
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../../core/telemetry.js';
|
|
8
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
8
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
9
9
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
10
10
|
import { hasAwsCli, AWS_CLI_INSTALL_URL, isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
11
11
|
import { resolveRegion, resolveProjectName, resolveCluster, resolveService, resolveAppName, resolveCwd } from '../../utils/resolvers.js';
|
|
@@ -46,10 +46,11 @@ export function parseDbArgs(argv = []) {
|
|
|
46
46
|
const args = normalizeArgv(argv);
|
|
47
47
|
if (args[0] === 'db') args.shift();
|
|
48
48
|
if (args[0] === 'connect') args.shift();
|
|
49
|
-
const { options } = parseFlags(args, {
|
|
49
|
+
const { options, unknown } = parseFlags(args, {
|
|
50
50
|
string: ['port', 'region', 'cluster', 'service', 'workspace'],
|
|
51
|
-
boolean: ['show-credentials'],
|
|
51
|
+
boolean: ['show-credentials', 'headless'],
|
|
52
52
|
});
|
|
53
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
53
54
|
return options;
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -104,6 +105,8 @@ export async function runDbConnect(input = {}) {
|
|
|
104
105
|
|
|
105
106
|
async function runDbConnectMain(input = {}) {
|
|
106
107
|
const options = normalizeOptions(input);
|
|
108
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db connect', event: 'db_connect_run' });
|
|
109
|
+
if (unknownRefusal) return unknownRefusal;
|
|
107
110
|
let cwd;
|
|
108
111
|
let region;
|
|
109
112
|
let projectName;
|
|
@@ -3,7 +3,7 @@ import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
|
3
3
|
import color from 'picocolors';
|
|
4
4
|
import { intro, outro, spinner } from '@clack/prompts';
|
|
5
5
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../../core/telemetry.js';
|
|
6
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
6
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
7
7
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
8
8
|
import { isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
9
9
|
import {
|
|
@@ -37,7 +37,7 @@ export function parseDbEnableVectorArgs(argv = []) {
|
|
|
37
37
|
const args = normalizeArgv(argv);
|
|
38
38
|
if (args[0] === 'db') args.shift();
|
|
39
39
|
if (args[0] === 'enable-vector') args.shift();
|
|
40
|
-
const { options, rest } = parseFlags(args, {
|
|
40
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
41
41
|
string: [
|
|
42
42
|
{ name: 'cluster', key: 'cluster' },
|
|
43
43
|
{ name: 'service', key: 'service' },
|
|
@@ -52,6 +52,7 @@ export function parseDbEnableVectorArgs(argv = []) {
|
|
|
52
52
|
});
|
|
53
53
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
54
54
|
if (positionals.length > 0) options.unexpectedPositionals = positionals;
|
|
55
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
55
56
|
return options;
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -129,6 +130,8 @@ export async function runDbEnableVector(input = {}) {
|
|
|
129
130
|
|
|
130
131
|
async function runDbEnableVectorMain(input = {}) {
|
|
131
132
|
const options = normalizeOptions(input);
|
|
133
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db enable-vector', event: 'db_enable_vector_run' });
|
|
134
|
+
if (unknownRefusal) return unknownRefusal;
|
|
132
135
|
const startTime = Date.now();
|
|
133
136
|
let cwd;
|
|
134
137
|
let region;
|
|
@@ -8,7 +8,7 @@ import zlib from 'node:zlib';
|
|
|
8
8
|
import color from 'picocolors';
|
|
9
9
|
import { intro, outro, spinner, select, text, password, confirm, cancel, isCancel } from '@clack/prompts';
|
|
10
10
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../../core/telemetry.js';
|
|
11
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
11
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
12
12
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
13
13
|
import { hasAwsCli, AWS_CLI_INSTALL_URL, isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
14
14
|
import {
|
|
@@ -49,7 +49,7 @@ export function parseDbImportArgs(argv = []) {
|
|
|
49
49
|
const args = normalizeArgv(argv);
|
|
50
50
|
if (args[0] === 'db') args.shift();
|
|
51
51
|
if (args[0] === 'import') args.shift();
|
|
52
|
-
const { options, rest } = parseFlags(args, {
|
|
52
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
53
53
|
string: [
|
|
54
54
|
{ name: 'file', key: 'file' },
|
|
55
55
|
{ name: 'from', key: 'from' },
|
|
@@ -62,6 +62,7 @@ export function parseDbImportArgs(argv = []) {
|
|
|
62
62
|
});
|
|
63
63
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
64
64
|
if (positionals.length > 0) options.unexpectedPositionals = positionals;
|
|
65
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
65
66
|
return options;
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -165,6 +166,8 @@ export async function runDbImport(input = {}) {
|
|
|
165
166
|
|
|
166
167
|
async function runDbImportMain(input = {}) {
|
|
167
168
|
const options = normalizeOptions(input);
|
|
169
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db import', event: 'db_import_run' });
|
|
170
|
+
if (unknownRefusal) return unknownRefusal;
|
|
168
171
|
let cwd;
|
|
169
172
|
let region;
|
|
170
173
|
let projectName;
|
|
@@ -3,7 +3,7 @@ import { CloudWatchLogsClient } from '@aws-sdk/client-cloudwatch-logs';
|
|
|
3
3
|
import color from 'picocolors';
|
|
4
4
|
import { intro, outro, spinner, text, isCancel } from '@clack/prompts';
|
|
5
5
|
import { trackEvent, trackSuccess, setActiveCommandName, resetActiveCommandName, getCliVersion } from '../../core/telemetry.js';
|
|
6
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
6
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
7
7
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
8
8
|
import { isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
9
9
|
import {
|
|
@@ -58,7 +58,7 @@ export function parseDbMigrateArgs(argv = []) {
|
|
|
58
58
|
const args = normalizeArgv(argv);
|
|
59
59
|
if (args[0] === 'db') args.shift();
|
|
60
60
|
if (args[0] === 'migrate') args.shift();
|
|
61
|
-
const { options, rest } = parseFlags(args, {
|
|
61
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
62
62
|
string: [
|
|
63
63
|
{ name: 'cmd', key: 'cmd' },
|
|
64
64
|
{ name: 'task-def', key: 'taskDef' },
|
|
@@ -74,6 +74,7 @@ export function parseDbMigrateArgs(argv = []) {
|
|
|
74
74
|
});
|
|
75
75
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
76
76
|
if (positionals.length > 0) options.unexpectedPositionals = positionals;
|
|
77
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
77
78
|
return options;
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -260,6 +261,8 @@ export async function runDbMigrate(input = {}) {
|
|
|
260
261
|
|
|
261
262
|
async function runDbMigrateMain(input = {}) {
|
|
262
263
|
const options = normalizeOptions(input);
|
|
264
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db migrate', event: 'db_migrate_run' });
|
|
265
|
+
if (unknownRefusal) return unknownRefusal;
|
|
263
266
|
let cwd;
|
|
264
267
|
let region;
|
|
265
268
|
let projectName;
|
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import color from 'picocolors';
|
|
5
5
|
import { intro, outro, spinner, select, confirm, cancel, isCancel } from '@clack/prompts';
|
|
6
6
|
import { trackSuccess, setActiveCommandName, resetActiveCommandName } from '../../core/telemetry.js';
|
|
7
|
-
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized } from '../../utils/command.js';
|
|
7
|
+
import { failCommand, failAwsError, trackAwsFailure, failProjectNotInitialized, refuseUnknownFlags } from '../../utils/command.js';
|
|
8
8
|
import { parseFlags, normalizeOptions, normalizeArgv } from '../../utils/args.js';
|
|
9
9
|
import { isAuthError, handleAuthErrorBranch, resolveClient } from '../../utils/aws.js';
|
|
10
10
|
import { resolveRegion, resolveProjectName, resolveAppName, resolveHeadless, resolveCwd } from '../../utils/resolvers.js';
|
|
@@ -24,7 +24,7 @@ export function parseDbRestoreArgs(argv = []) {
|
|
|
24
24
|
const args = normalizeArgv(argv);
|
|
25
25
|
if (args[0] === 'db') args.shift();
|
|
26
26
|
if (args[0] === 'restore') args.shift();
|
|
27
|
-
const { options, rest } = parseFlags(args, {
|
|
27
|
+
const { options, rest, unknown } = parseFlags(args, {
|
|
28
28
|
string: [
|
|
29
29
|
{ name: 'project-name', key: 'projectName' },
|
|
30
30
|
{ name: 'region', key: 'region' },
|
|
@@ -36,6 +36,7 @@ export function parseDbRestoreArgs(argv = []) {
|
|
|
36
36
|
const positionals = rest.filter((arg) => typeof arg === 'string' && !arg.startsWith('-'));
|
|
37
37
|
if (positionals.length > 0) options.snapshotId = positionals[0];
|
|
38
38
|
if (positionals.length > 1) options.unexpectedPositionals = positionals.slice(1);
|
|
39
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
39
40
|
return options;
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -172,6 +173,8 @@ export async function runDbRestore(input = {}) {
|
|
|
172
173
|
|
|
173
174
|
async function runDbRestoreMain(input = {}) {
|
|
174
175
|
const options = normalizeOptions(input);
|
|
176
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'db restore', event: 'db_restore_run' });
|
|
177
|
+
if (unknownRefusal) return unknownRefusal;
|
|
175
178
|
let cwd;
|
|
176
179
|
let region;
|
|
177
180
|
let projectName;
|
package/src/commands/destroy.js
CHANGED
|
@@ -7,7 +7,7 @@ import { S3Client } from '@aws-sdk/client-s3';
|
|
|
7
7
|
import { teardownStateBucket, drainBucketObjects, resolveClient } from '../utils/aws.js';
|
|
8
8
|
import { checkDependency, pollUntil } from '../utils/system.js';
|
|
9
9
|
import { trackEvent, flushTelemetry, trackSuccess, setActiveCommandName, resetActiveCommandName } from '../core/telemetry.js';
|
|
10
|
-
import { failCommand, shouldAutoApprove, refuseIfNonInteractive } from '../utils/command.js';
|
|
10
|
+
import { failCommand, shouldAutoApprove, refuseIfNonInteractive, refuseUnknownFlags } from '../utils/command.js';
|
|
11
11
|
import { runTerraformCommand, readLastRunMarker, isInterruptedMarker, ensureTerraformInit, getTerraformStateBuckets, DEFAULT_TERRAFORM_PHASE_TIMEOUT_MS } from '../utils/terraform.js';
|
|
12
12
|
import { classifyTerraformError, getRunbook, ERROR_CODES } from '../utils/terraform-errors.js';
|
|
13
13
|
import { findDbTarget, dbStatusOf, resolveDbIdentifier, resolveDbClusterIdentifier, generateSnapshotId } from '../utils/rds.js';
|
|
@@ -38,10 +38,11 @@ export function treeDeclaresDataLossVar(tfDir) {
|
|
|
38
38
|
|
|
39
39
|
export function parseDestroyArgs(argv = []) {
|
|
40
40
|
const args = normalizeArgv(argv);
|
|
41
|
-
const { options } = parseFlags(args, {
|
|
42
|
-
boolean: ['allow-data-loss', 'force'],
|
|
41
|
+
const { options, unknown } = parseFlags(args, {
|
|
42
|
+
boolean: ['allow-data-loss', 'force', 'headless', 'yes'],
|
|
43
43
|
string: ['force-unlock'],
|
|
44
44
|
});
|
|
45
|
+
if (unknown.length > 0) options.unknownFlags = unknown;
|
|
45
46
|
return { allowDataLoss: false, force: false, ...options };
|
|
46
47
|
}
|
|
47
48
|
|
|
@@ -145,6 +146,8 @@ export async function destroyStack(input = {}) {
|
|
|
145
146
|
|
|
146
147
|
async function destroyStackMain(input = {}) {
|
|
147
148
|
const options = normalizeOptions(input);
|
|
149
|
+
const unknownRefusal = await refuseUnknownFlags(options, { command: 'destroy', event: 'infrastructure_destroyed' });
|
|
150
|
+
if (unknownRefusal) return unknownRefusal;
|
|
148
151
|
intro(color.bgRed(color.white(' grada destroy 🗑️ ')));
|
|
149
152
|
|
|
150
153
|
// Ejected trees are user-owned: refuse unless --force.
|