Skip to content

Commit f1d2215

Browse files
Harshi-Shah-CSclaudeSakshiKoli-CS
committed
fix(variables): drop --no-vars from projects:create and env:create
Variables are never required: without a terminal a create with no variable source sends an empty list and asks nothing, and on a terminal a bare Enter at "Add environment variables" now skips it. --no-vars only skipped that one checklist, so it goes, with the noVarsAlone rule and the noVars request field. Passing it is now oclif's unknown-flag error with exit 2. AGENTS.md and the README follow. The .talismanrc checksums are refreshed for every changed file the pre-push Talisman scan flags (file names, flag names and the words secret/token in prose; no secret). #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Sakshi Koli <sakshi.koli@contentstack.com>
1 parent f7b865c commit f1d2215

17 files changed

Lines changed: 37 additions & 103 deletions

‎.talismanrc‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fileignoreconfig:
9393
- "'SECRET=hunter2'"
9494
- "formFieldKey"
9595
- filename: test/integration/projects-create.test.ts
96-
checksum: 4826ca20f0c7fe1f23b82598ceed0a374199e2bb8b604b676efcf720244ff961
96+
checksum: c567d31fb18d0910410ce455c0a1b2f8ce6c8d46038396ec813ef73bd5fb8105
9797
- filename: test/fixtures/README.md
9898
checksum: d801c84c8b7d7f38f967573e9a3a70da4405b7cbcbf10d2a6e5be3d65fb3daa1
9999
allowed_patterns:
@@ -236,7 +236,7 @@ fileignoreconfig:
236236
- "a project name passed on argv to the project resolver"
237237
- "expect\\(Object.keys\\(DEPENDENCIES\\)\\).toEqual\\(\\['project', 'env'\\]\\)"
238238
- filename: AGENTS.md
239-
checksum: ba37b6b17d97940a6f7d5e69a531796ab0ee5b6859a9cd5cbdec56e4b7731b26
239+
checksum: 3379e8c597c8306e7377e60667f7df6e599e45e289928bc88b217356aa43feb1
240240
allowed_patterns:
241241
- "Do not add an exemption to a guard to make a new file pass"
242242
- "passes its own error wording to `client.request\\(req, MESSAGES\\)`"
@@ -259,7 +259,7 @@ fileignoreconfig:
259259
- filename: test/guards/layering.test.ts
260260
checksum: 55893e6e919b1e462afc989110cb9360e38aa18d06de932587beaa9006042639
261261
- filename: src/commands/launch/projects/create.test.ts
262-
checksum: 9c40b4b6ed4f7d678ecb921a71f5af7284cd685c1337f47144456ae43a38b1ad
262+
checksum: 2c407c366f2a1da2647fc6eb7e6ad1bb8cbe3c7f901090432ab0e27df2e5d4d6
263263
- filename: src/commands/launch/projects/delete.test.ts
264264
checksum: d67d8a804d14f9b809153d10b0cf9d5e52b70f9e0b65678ebb1663a7d2da22c1
265265
- filename: test/integration/projects-delete.test.ts
@@ -311,7 +311,7 @@ fileignoreconfig:
311311
- filename: test/credential-guard.setup.ts
312312
checksum: 519ccbeb0552fdb1d5f27308c56477c0258ee6cc0adec8f618e8e5bc047cbf6d
313313
- filename: src/environments/types.ts
314-
checksum: 6c054295075e51e9ce0f4514ebdc86a48bb74db9932a2baaa9f9158e9c14c6e8
314+
checksum: 2825d0e70757022e518465b134878b8cc8f9eccaf4e9ad088d73a31b9a35a826
315315
- filename: src/commands/launch/env/get.test.ts
316316
checksum: 6e739ef12bc0d887e652e23ee54d9fac30dd6a3505cf464cdaefc0e696cf3e51
317317
- filename: test/integration/environments-delete.test.ts
@@ -331,13 +331,13 @@ fileignoreconfig:
331331
- filename: src/commands/launch/env/update.test.ts
332332
checksum: 2da219594e7bdd589adc0eff9ff035252a75aaa51dfa20514b18fd3266d7b752
333333
- filename: README.md
334-
checksum: 112b973a24e59f79786df1b85b83ea35b1e355c52a8cbf3b28d98511959c60c8
334+
checksum: d955f95b66f10259eb2ddbe1935a67ce3c7f3a28187f0398e0af39ff75267c01
335335
allowed_patterns:
336336
- "password-protection"
337337
- "-p, --password"
338338
- "-u, --username"
339339
- filename: test/integration/environments-create.test.ts
340-
checksum: 0c64a4408d3c150a33c442403688d1e1d058f415cfdba704e372455927daa7e4
340+
checksum: 538527a26bc002aa21319aa615c9a9f00aaed494d0bdefc8db75c0eff3f8ec54
341341
- filename: src/commands/launch/variables/list.test.ts
342342
checksum: 87ccb762f4931326fc50bca1c01aeb4a16d552e4dfa141d00370fdfafa4363be
343343
- filename: src/commands/launch/variables/set.test.ts
@@ -353,9 +353,9 @@ fileignoreconfig:
353353
- filename: src/stacks/stacks.api.ts
354354
checksum: d59622ca6411b93d5469a1895b08ccde4b9cd83fbb909c82076ea70d74b5e1e4
355355
- filename: src/variables/variable.chooser.ts
356-
checksum: c776a4184eb1819055622784bc6f3342b67bc1babdca0cdbbe72a4a871cc2498
356+
checksum: 767bbcee93b0c10c5c9d0b526ce57770cc6323be52d8a4cc1c0452c880b5ab8e
357357
- filename: src/variables/variable.create.test.ts
358-
checksum: c888e2a4aca9c6855c79d743368387aeb0ab5db907beca8bef1113bc05a5260d
358+
checksum: a2650ca8e081afcf76c801d20e2df4baa96f814d1513080ba24971db0ae3a1bf
359359
- filename: src/variables/variable.dotenv.test.ts
360360
checksum: c3d5e33189736bb42b7c4fac7375cf0307681b34feca4830b49331f55a130f78
361361
- filename: src/variables/variable.dotenv.ts
@@ -365,9 +365,9 @@ fileignoreconfig:
365365
- filename: src/variables/variable.files.test.ts
366366
checksum: d8b0efd6bb448c4d501ba52c47119b352ef29d6b5b66cec0e7d373a0ce91a36c
367367
- filename: src/variables/variable.inputs.test.ts
368-
checksum: c434fd7f32ab0bd17db8f214ba54861b7d8ae8d8481dbbc1978f9dab35fd2429
368+
checksum: 4b3b9a6c353d099a65ef8f522cff8e46e5c0edbf66bcdb59e0d6dd4f87c78c84
369369
- filename: src/variables/variable.inputs.ts
370-
checksum: 050b93e158a1ff29f309f1531b085aa9f0327b47a8029038356869b2864531b2
370+
checksum: 0f572a86e0c0edbe707882df623a3a7f69715572812ae655eb6aa5e4579b496b
371371
- filename: src/variables/variable.merge.test.ts
372372
checksum: 581a5cc5d9d23223643bd461525c6755205ebf16f33ae7388c8e88de19461fbf
373373
- filename: src/variables/variable.merge.ts

‎AGENTS.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,9 @@ than return a truncated list.
361361
`projects:create` and `env:create` take `--var` and `--dotenv` and reach the same resolver through
362362
`EnvironmentBuilder`, which asks last - after Contentstack Authentication, where V1 asked - with no auto-detection.
363363
With neither flag it offers a checkbox over the sources plus `Skip adding environment variables`, which cannot be
364-
combined with the others; without a terminal it sends an empty list. `--no-vars` is the flag form of that Skip
365-
choice, so a fully flagged create on a terminal asks nothing: it sends an empty list without the checkbox. Combined
366-
with `--var`, `--dotenv` or `--from-stack` it is a usage error from the `noVarsAlone` rule rather than oclif's
367-
`exclusive`, whose `--help` usage line would show those three sources excluding each other.
364+
combined with the others; a bare Enter with nothing ticked skips the same way, and without a terminal it sends an
365+
empty list. There is no `--no-vars` flag: variables are never required, so a fully flagged create on a terminal
366+
stops only at that checkbox, and a pipe or CI run skips it.
368367

369368
**`--from-stack` and `--alias`.** `--from-stack` is a bare flag on `variables:set`, `projects:create` and
370369
`env:create`; `--alias <name>` (`-a`) names a delivery token saved with `csdx auth:tokens:add`, and is a usage error

‎README.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ USAGE
319319
$ csdx launch:env:create [-c <value>] [-d <value>] [--org <value>] [--project <value>] [--name <value>]
320320
[--description <value>] [--branch <value>] [--framework <value>] [--build-cmd <value>] [--server-cmd <value>]
321321
[--output-dir <value>] [--res-mode <value>] [--auto-deploy <value>] [--cs-auth <value>] [--var <value>...] [--dotenv
322-
<value>...] [--from-stack] [-a <value>] [--no-vars]
322+
<value>...] [--from-stack] [-a <value>]
323323
324324
FLAGS
325325
-a, --alias=<value> Alias of a delivery token saved with csdx auth:tokens:add, used with --from-stack without a
@@ -337,7 +337,6 @@ FLAGS
337337
--from-stack Import the variables of a Contentstack stack. Asks for the stack and a delivery token on a
338338
terminal
339339
--name=<value> Environment name (200 characters or fewer)
340-
--no-vars Create the environment with no variables, without asking for them on a terminal
341340
--org=<value> Organization UID
342341
--output-dir=<value> Output directory
343342
--project=<value> Project name or UID
@@ -611,7 +610,7 @@ USAGE
611610
$ csdx launch:projects:create [-c <value>] [-d <value>] [--org <value>] [--type <value>] [--name <value>] [--description
612611
<value>] [--env-name <value>] [--branch <value>] [--framework <value>] [--build-cmd <value>] [--server-cmd <value>]
613612
[--output-dir <value>] [--res-mode <value>] [--auto-deploy <value>] [--cs-auth <value>] [--var <value>...] [--dotenv
614-
<value>...] [--from-stack] [-a <value>] [--no-vars]
613+
<value>...] [--from-stack] [-a <value>]
615614
616615
FLAGS
617616
-a, --alias=<value> Alias of a delivery token saved with csdx auth:tokens:add, used with --from-stack without a
@@ -630,7 +629,6 @@ FLAGS
630629
--from-stack Import the variables of a Contentstack stack. Asks for the stack and a delivery token on a
631630
terminal
632631
--name=<value> Project name (200 characters or fewer)
633-
--no-vars Create the environment with no variables, without asking for them on a terminal
634632
--org=<value> Organization UID
635633
--output-dir=<value> Output directory
636634
--res-mode=<value> Response mode (buffered | streaming)

‎src/commands/launch/env/create.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { catalog, resolution } from '../../../resources';
77
import { DEPLOYMENT_WAIT_TIMEOUT_MS } from '../../../deployments/deployment.watcher';
88
import { EnvironmentCreator } from '../../../environments/environment.create';
99
import { serverCommandFrameworkGate } from '../../../environments/environment.inputs';
10-
import { aliasRequiresFromStack, noVarsAlone } from '../../../variables/variable.rules';
10+
import { aliasRequiresFromStack } from '../../../variables/variable.rules';
1111
import EnvironmentsCreate from './create';
1212

1313
function commandUnderTest(resolved: Record<string, unknown>) {
@@ -102,10 +102,9 @@ describe('launch:env:create', () => {
102102
dotenv: {},
103103
'from-stack': {},
104104
alias: {},
105-
'no-vars': {},
106105
});
107106
expect(Object.keys(EnvironmentsCreate.flags).sort()).toEqual(Object.keys(EnvironmentsCreate.inputs).sort());
108-
expect(EnvironmentsCreate.rules).toEqual([serverCommandFrameworkGate, aliasRequiresFromStack, noVarsAlone]);
107+
expect(EnvironmentsCreate.rules).toEqual([serverCommandFrameworkGate, aliasRequiresFromStack]);
109108
});
110109

111110
it('describes --name and --description as the environment its own, leaving the project wording alone', () => {

‎src/commands/launch/env/create.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { flagsFor, inputs } from '../../../core/inputs';
33
import { defaultWatchTiming } from '../../../deployments/deployment.watcher';
44
import { EnvironmentCreator } from '../../../environments/environment.create';
55
import { serverCommandFrameworkGate, withEnvironmentWording } from '../../../environments/environment.inputs';
6-
import { aliasRequiresFromStack, noVarsAlone } from '../../../variables/variable.rules';
6+
import { aliasRequiresFromStack } from '../../../variables/variable.rules';
77

88
const createInputs = inputs({
99
org: { required: true },
@@ -22,7 +22,6 @@ const createInputs = inputs({
2222
dotenv: {},
2323
'from-stack': {},
2424
alias: {},
25-
'no-vars': {},
2625
});
2726

2827
export default class EnvironmentsCreate extends LaunchCommand<typeof createInputs> {
@@ -39,7 +38,7 @@ export default class EnvironmentsCreate extends LaunchCommand<typeof createInput
3938

4039
static flags = withEnvironmentWording(flagsFor(createInputs));
4140

42-
static rules = [serverCommandFrameworkGate, aliasRequiresFromStack, noVarsAlone];
41+
static rules = [serverCommandFrameworkGate, aliasRequiresFromStack];
4342

4443
async run(): Promise<void> {
4544
const resolved = this.resolved;
@@ -63,7 +62,6 @@ export default class EnvironmentsCreate extends LaunchCommand<typeof createInput
6362
envFiles: resolved['dotenv'],
6463
fromStack: resolved['from-stack'],
6564
alias: resolved.alias,
66-
noVars: resolved['no-vars'],
6765
});
6866
}
6967
}

‎src/commands/launch/projects/create.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { defaultWatchTiming } from '../../../deployments/deployment.watcher';
22
import { DEPLOYMENT_WAIT_TIMEOUT_MS } from '../../../deployments/deployment.watcher';
33
import { serverCommandFrameworkGate } from '../../../environments/environment.inputs';
4-
import { aliasRequiresFromStack, noVarsAlone } from '../../../variables/variable.rules';
4+
import { aliasRequiresFromStack } from '../../../variables/variable.rules';
55
import { ProjectCreator } from '../../../projects/project.create';
66

77
type WatchTiming = ReturnType<typeof defaultWatchTiming>;
@@ -101,7 +101,7 @@ describe('launch:projects:create', () => {
101101
});
102102

103103
it('declares only the framework gate as a rule, leaving GitHub-only flags on FileUpload to a confirmation', () => {
104-
expect(ProjectsCreate.rules).toEqual([serverCommandFrameworkGate, aliasRequiresFromStack, noVarsAlone]);
104+
expect(ProjectsCreate.rules).toEqual([serverCommandFrameworkGate, aliasRequiresFromStack]);
105105
});
106106

107107
it('declares every flag it reads and requires only the organization', () => {
@@ -123,7 +123,6 @@ describe('launch:projects:create', () => {
123123
'dotenv',
124124
'from-stack',
125125
'alias',
126-
'no-vars',
127126
]);
128127
expect(Object.keys(ProjectsCreate.flags).sort()).toEqual(Object.keys(ProjectsCreate.inputs).sort());
129128
expect(

‎src/commands/launch/projects/create.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { flagsFor, inputs } from '../../../core/inputs';
33
import { defaultWatchTiming } from '../../../deployments/deployment.watcher';
44
import { serverCommandFrameworkGate } from '../../../environments/environment.inputs';
55
import { ProjectCreator } from '../../../projects/project.create';
6-
import { aliasRequiresFromStack, noVarsAlone } from '../../../variables/variable.rules';
6+
import { aliasRequiresFromStack } from '../../../variables/variable.rules';
77

88
const createInputs = inputs({
99
org: { required: true },
@@ -23,7 +23,6 @@ const createInputs = inputs({
2323
dotenv: {},
2424
'from-stack': {},
2525
alias: {},
26-
'no-vars': {},
2726
});
2827

2928
export default class ProjectsCreate extends LaunchCommand<typeof createInputs> {
@@ -42,7 +41,7 @@ export default class ProjectsCreate extends LaunchCommand<typeof createInputs> {
4241

4342
static flags = flagsFor(createInputs);
4443

45-
static rules = [serverCommandFrameworkGate, aliasRequiresFromStack, noVarsAlone];
44+
static rules = [serverCommandFrameworkGate, aliasRequiresFromStack];
4645

4746
async run(): Promise<void> {
4847
const resolved = this.resolved;
@@ -67,7 +66,6 @@ export default class ProjectsCreate extends LaunchCommand<typeof createInputs> {
6766
envFiles: resolved['dotenv'],
6867
fromStack: resolved['from-stack'],
6968
alias: resolved.alias,
70-
noVars: resolved['no-vars'],
7169
});
7270
}
7371
}

‎src/environments/environment.builder.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export class EnvironmentBuilder {
6464
envFiles: request.envFiles,
6565
fromStack: request.fromStack,
6666
alias: request.alias,
67-
noVars: request.noVars,
6867
dataDir: request.dataDir ?? '.',
6968
},
7069
this.services,

‎src/environments/types.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export interface EnvironmentRequest {
114114
envFiles?: string[];
115115
fromStack?: boolean;
116116
alias?: string;
117-
noVars?: boolean;
118117
framework?: FrameworkPreset;
119118
buildCmd?: string;
120119
outputDir?: string;

‎src/variables/variable.create.test.ts‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,6 @@ describe('variable create', () => {
9696
expect(printed).toEqual([]);
9797
});
9898

99-
it('returns nothing on a terminal with --no-vars, asking nothing, reading nothing and printing nothing', async () => {
100-
const { services, io, asked, reads, printed } = fakes({ files: { '/work/.env': 'X=1' } });
101-
102-
expect(await variablesForCreate({ ...NONE, noVars: true }, services, io)).toEqual([]);
103-
expect(asked).toEqual([]);
104-
expect(reads).toEqual([]);
105-
expect(printed).toEqual([]);
106-
});
107-
10899
it('treats empty flag lists as no flags', async () => {
109100
const { services, io, asked } = fakes({ answers: { 'Add environment variables': [SKIP] } });
110101

0 commit comments

Comments
 (0)