Skip to content

Commit c616b52

Browse files
Copilotramya18101
andcommitted
fix: add missing --interactive guards and fix stale comment in import.ts
Agent-Logs-Url: https://github.com/auth0/auth0-deploy-cli/sessions/c63edc3a-7c80-40c0-972a-81df25db20a2 Co-authored-by: ramya18101 <62586490+ramya18101@users.noreply.github.com>
1 parent 2c711c0 commit c616b52

3 files changed

Lines changed: 42 additions & 2 deletions

File tree

src/commands/export.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default async function exportCMD(params: ExportParams) {
4545
overrides.AUTH0_EXPORT_IDENTIFIERS = exportIds;
4646
}
4747

48-
// Overrides AUTH0_INCLUDE_EXPERIMENTAL_EA is experimental_ea passed in command line
48+
// Overrides AUTH0_EXPERIMENTAL_EA if experimental_ea is passed in command line
4949
if (experimentalEA) {
5050
overrides.AUTH0_EXPERIMENTAL_EA = experimentalEA;
5151

src/commands/import.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ export default async function importCMD(params: ImportParams) {
3737
throw new Error('--apply must be used with --dry-run.');
3838
}
3939

40+
if (interactive && !effectiveDryRun) {
41+
throw new Error('--interactive must be used with --dry-run.');
42+
}
43+
44+
if (interactive && apply) {
45+
throw new Error('--interactive and --apply cannot be used together.');
46+
}
47+
4048
if (shouldInheritEnv) {
4149
nconf.env().use('memory');
4250

@@ -61,7 +69,7 @@ export default async function importCMD(params: ImportParams) {
6169
overrides.AUTH0_CLIENT_SECRET = clientSecret;
6270
}
6371

64-
// Overrides AUTH0_INCLUDE_EXPERIMENTAL_EA is experimental_ea passed in command line
72+
// Overrides AUTH0_EXPERIMENTAL_EA if experimental_ea is passed in command line
6573
if (experimentalEA) {
6674
overrides.AUTH0_EXPERIMENTAL_EA = experimentalEA;
6775

test/commands/import.test.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,38 @@ describe('#import command dry-run behavior', () => {
8787
}
8888
});
8989

90+
it('should require --dry-run when interactive is enabled', async () => {
91+
try {
92+
await importCMD({
93+
_: ['import'],
94+
input_file: 'tenant.yaml',
95+
interactive: true,
96+
env: false,
97+
} as any);
98+
expect.fail('Expected importCMD to reject when --interactive is used without --dry-run.');
99+
} catch (error) {
100+
expect((error as Error).message).to.equal('--interactive must be used with --dry-run.');
101+
}
102+
});
103+
104+
it('should reject when --interactive and --apply are used together', async () => {
105+
try {
106+
await importCMD({
107+
_: ['import'],
108+
input_file: 'tenant.yaml',
109+
dry_run: true,
110+
interactive: true,
111+
apply: true,
112+
env: false,
113+
} as any);
114+
expect.fail('Expected importCMD to reject when --interactive and --apply are both set.');
115+
} catch (error) {
116+
expect((error as Error).message).to.equal(
117+
'--interactive and --apply cannot be used together.'
118+
);
119+
}
120+
});
121+
90122
it('should set AUTH0_DRY_RUN_APPLY when apply is enabled', async () => {
91123
await importCMD({
92124
_: ['import'],

0 commit comments

Comments
 (0)