Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 61 additions & 28 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fileignoreconfig:
- filename: src/core/failure.test.ts
checksum: 98ce2e3fbb4f6730cd7e295ec753d083f8483ff2c47bbde148f69dcc10771327
- filename: test/integration/retired-commands.test.ts
checksum: c1019c8477b25323206b675d883818452220477131369cd5e37ffceff088128b
checksum: 4833da1a6c90aefd1022a83f9e3d2eb067652efdd77c7d2adec73a3f54207b25
- filename: test/integration/manage-base-path.test.ts
checksum: 79eb9ad420ea47d5bee8045d812c45b010bbeeafcaf5f85d11653140b0cd0db1
- filename: src/transport/rest-client.ts
Expand Down Expand Up @@ -231,15 +231,16 @@ fileignoreconfig:
allowed_patterns:
- "FlagKey"
- filename: src/resources.ts
checksum: 527cbaf7a41201c1b739f635b309c48d1bf5cff87d0643975ede990612ba6d51
allowed_patterns:
- "FlagKey"
- filename: src/resources.test.ts
checksum: 4574756938e66ba1f2379c096bef5c50947cc60059c7dd9615c0f5104f8ac775
checksum: 6c2a0938d406767bbc80890aece988fbef1b01f809bd4b488403946aaef2ad37
allowed_patterns:
- "a project name passed on argv to the project resolver"
- "expect\\(Object.keys\\(DEPENDENCIES\\)\\).toEqual\\(\\['project', 'env'\\]\\)"
- filename: AGENTS.md
checksum: e7f2d908061e4b982b2e866c17e716467835cb5e7fd08bfc97b77331cb91d554
checksum: 90b869a85c0676f56a4926b540301e5a8018bd727a506e0dfc92ed0b5892e9dc
allowed_patterns:
- "Do not add an exemption to a guard to make a new file pass"
- "passes its own error wording to `client.request\\(req, MESSAGES\\)`"
Expand All @@ -260,7 +261,7 @@ fileignoreconfig:
- filename: src/git/local-repository.ts
checksum: b9091ed135dfebdf590a5412bbfba2b2f96d4a177cf944a20909b93405268e9f
- filename: test/guards/layering.test.ts
checksum: e75b5dbe065e8061cba9c92d7b27ed0297e8ec2aace7beda6657ac9767d77040
checksum: 7bac022f4db5bd85e05cc8949bd60a90ff53edeee9cc9246fe7bf9124d8356cf
- filename: src/commands/launch/projects/create.test.ts
checksum: fc7097703f1068e125596daebf6db539ed15643f75e1d240da8e059b4fe5e8a4
- filename: src/commands/launch/projects/delete.test.ts
Expand Down Expand Up @@ -336,21 +337,21 @@ fileignoreconfig:
- filename: src/commands/launch/env/update.test.ts
checksum: 82c76af721bfdfd8eb7cf49494ffbe15d98b988e98bca1015b9d34b42b5226bd
- filename: README.md
checksum: 47317e2767ecf41a22f3ba728f2c5a8098f8d17879af095199504e4eab54081f
checksum: 1fc59d9fd97816c9c1784f5a28cf4982161136ca4abc87ee0d0ab082f7c2ead8
allowed_patterns:
- "password-protection"
- "-p, --password"
- "-u, --username"
- filename: test/integration/environments-create.test.ts
checksum: b2bae2f96095ceb5b345339550f0af5dcf9e30b3fce2f98aca51a6e791d710cb
- filename: src/commands/launch/variables/list.test.ts
checksum: 87ccb762f4931326fc50bca1c01aeb4a16d552e4dfa141d00370fdfafa4363be
checksum: b0f70fc2d9c60307ad4e2212c88ecc3f829d92f2bd09ee1de513c06a4a6b7e13
- filename: src/commands/launch/variables/set.test.ts
checksum: 72688fdf094918b8b0c68c7cca57960c2badb635cbb5df15688e9da900c786c8
checksum: 43afa41270573dc7d081159389d607ba1bbf4c983e1f5cccca07fdbe81dbb06a
- filename: src/commands/launch/variables/unset.test.ts
checksum: bf2a359e57fdb0146dad160962f8ae01596450460c604794026ddcb697f74c68
checksum: 216cdf0e44419d55bf18e325acdd47d213faf716a372e9fd10878042b18690a9
- filename: src/commands/launch/variables/unset.ts
checksum: 233c50867eb28f61275ea58535f2839fda3d023b678cd38a9f9e853925de9719
checksum: 38d2c9bad2b1d5099cf23e79c01e6e284881b362cd8dcefe0b8eb25974d9a6c7
- filename: src/environments/environment.errors.test.ts
checksum: 33ae71db0a46173c903659438a77d1d441797a8296e0591dbaa48512f32a4cab
- filename: src/stacks/stacks.api.test.ts
Expand All @@ -364,31 +365,31 @@ fileignoreconfig:
- filename: src/variables/variable.dotenv.test.ts
checksum: 052f2825b778402e199e64ec887dc13f8fc2748535b8d176eb73dc6528f14824
- filename: src/variables/variable.dotenv.ts
checksum: 9dae58ca744cf45332d054387fa0707169d01c1b57754af5133898c0c0efeb8c
checksum: 6f5c1557d332820862ff4c83d9a25e6f26bd7d1c1debf2c2c0e63a11482aa5ca
- filename: src/variables/variable.errors.ts
checksum: f66b960365b83561f70b5fcef521bcc8a00d99b4415fb6a5df5bcf752a91d480
checksum: cd95d75b6f1b8a7887197fc9ee5e0575d6ab59e5012bfb5ea765752dd83e5186
- filename: src/variables/variable.files.test.ts
checksum: 301bc761c194453c0ec6fe073bf83960712e8f298f2fb6b782c1eadafd5089f5
- filename: src/variables/variable.inputs.test.ts
checksum: 11f41a57e57d9fec46afddd9f8a62df76eaf6fec4afbccf39fe4bce23a978eaf
checksum: a8da4cc9157b94d9cb4fa4f5c211f785e3889b58b2ad78023b2e20ecf67e35ce
- filename: src/variables/variable.inputs.ts
checksum: b29fcc7fdddc938507d060ff3590d1d0705f5e8f173b232a488fa09d4c96c177
checksum: 1d44e6482f6d3bbe34f82c0c81ea57a3e4bd099f9ea90c680eccb908035a0f00
- filename: src/variables/variable.merge.test.ts
checksum: 581a5cc5d9d23223643bd461525c6755205ebf16f33ae7388c8e88de19461fbf
- filename: src/variables/variable.merge.ts
checksum: f096c83e4894e6d96b620873815bc0f85c2a79c73b353c1a518bb870ca48976b
- filename: src/variables/variable.page.test.ts
checksum: 9a4e63c0dbfd35b499149a98ce5642787097e9491746b4b874b2eda88f1d2b50
checksum: 0fe41bd944b6af04e2c9f824b43ef11cd8ab993a842b2d759ac394118d6350a2
- filename: src/variables/variable.parse.test.ts
checksum: 8cfcd7f3b0784f525238ab09d8cbe8b8d8fb3a90eb164cb5bd4cdf15a8740e86
- filename: src/variables/variable.parse.ts
checksum: 912ef100eaec7e08ffef90100f8559a224aed709bd4527dcf15653f8b4131287
- filename: src/variables/variable.presenter.test.ts
checksum: 62e8b0eff16ed4408d929092ce6808aeabea001a6cc15780d46c4ac4226eec3d
checksum: 2b52d2638ca8eea42b14be3c498a7c86d171423ad1bf5240c35931befdf08841
- filename: src/variables/variable.presenter.ts
checksum: ee8e4dcf75ad7e849d1e8e64ce6a6549d13fc62dc9aa322d96eb2e725d629db5
checksum: c2bc7c96e29e681d7c9338216c4d878fdfa076ddec9f1209151f3b920ef46180
- filename: src/variables/variable.set.test.ts
checksum: f3571146c4b5b605efc85e0f9c9a8968273a4b5c856c00c9617dfae94000a3f6
checksum: 7a4dda6e582c37b4e1752a80e756b1f3e5cff4fddc5459572c3a2d7e44084934
- filename: src/variables/variable.sources.test.ts
checksum: 92c0365b05a8aa16be74da225cb49b85612358acbaaa5c79688183254b160059
- filename: src/variables/variable.sources.ts
Expand All @@ -398,31 +399,31 @@ fileignoreconfig:
- filename: src/variables/variable.stack.ts
checksum: 9d4bd5b72063e0d3951e01696794ec7409294a64ff65693b8dc910fe0a2d2c2d
- filename: src/variables/variable.summary.test.ts
checksum: 8b214a1f1f43ac1a76434b75e4ff1ffd73a9e73dc2a0d6bae9ca43fd678182e5
checksum: 81289639b2d44d04844860a03b3d52cb4b1f5ac41b90d3b4a2feccf9dda84c03
- filename: src/variables/variable.summary.ts
checksum: 0da287557a5c4280074d1a26aeff4f7d95b205e4266ff47c18b62665134f5bdc
checksum: 8f8fbe30dccf5a19d609e7456612e09bedfc8d3d3f4525a8b7cd403cadcc5318
- filename: src/variables/variable.unset.test.ts
checksum: 8797c7aa2960fc0328d5cab8cfdddf674ac624ace95f79338520851a2c7b732a
checksum: a7cc82fccd133f00dec6bf6048095cbaff4020c892228b39a54152b820e6e2b4
- filename: src/variables/variable.unset.ts
checksum: 4050a023edd3c6db1507eb2d0f2815d8c0c03622b2810b4977a8fba6e83818fe
checksum: 81dc12abdd102f5bf1002df27cac9f70ac1e0b1707de392f29feb72baf35d241
- filename: src/variables/variable.values.test.ts
checksum: cdedaa03735077efdfac3cfdc8a05e7f13e1fc3f1bc2274b8ed9f493f496d43c
- filename: src/variables/variable.values.ts
checksum: 9e078c80c9dd18d9cc9db43c58c702bf9e14d60bbd4d1d2efc41227e754c0fbc
checksum: a79563b50ab061e446550ddb673624678c29407d0ecf504ec506d4795dd10912
- filename: src/variables/variable.writer.test.ts
checksum: 7991a4ba0c58f187dfebf01092642459ce89b297f453159ca8e0953a2ee7e2b8
checksum: f30f00af216c5912ac3d795465e7209af9b3ee2c2c0a179c781a79318952e873
- filename: src/variables/variable.writer.ts
checksum: 11acfccfad30b66a44954e97127d2a7bcebdb80f92299da6d645ac847c97192a
checksum: 108c73c5a4b6f5266d33de103b214502c309027d89ea1fd15e3a2027ee6e83b4
- filename: src/variables/variables.api.test.ts
checksum: b6d455927d0b40b6b211ae979a4eba8298aa842cb2f7e7cbc79743641f0182f2
checksum: 25a5e54b304075622aebfc7fcb89cd000485ab979d168c05859fad8245e7b49b
- filename: src/variables/variables.api.ts
checksum: 85ea6db36b1e588b0435155fd20f4ed8d2aafa790c6ed02bf1ceef366e6e9b8e
checksum: edd5a9f96f4ded0683a5f68f6642efc700962abc67db15e40ed6e03cc89f28d2
- filename: test/fixtures/cms-environment-variables.json
checksum: cb2cbb2d1d858b1cf2115c218a0ecca04ce04baf054fe11fe6123589c1afce27
- filename: test/integration/variables-list.test.ts
checksum: 5ea6a0fcd331496ca19773e90dab81e09eb5290b8f22a1880bffc7916f3778b2
checksum: e4b28ea1deed65b6d9bbcbd147b07afd009a7ae5f4f82dcf61c03b80f0d01fe2
- filename: test/integration/variables-set-unset.test.ts
checksum: a8718e81d0e743f935eac40884a556a3a80bb55f66d339cef36916b33c57c2f7
checksum: 32943eb4167f93810577356a8a83b6ce5bdf077099b42fc2fbd0db8c3954fe8b
- filename: test/fixtures/deployments-list.json
checksum: 2f10f24dc0ceb8e85f5201b7c1530c0c540c044ef50b732cc29e07289112316e
- filename: test/integration/deployments-get.test.ts
Expand Down Expand Up @@ -491,4 +492,36 @@ fileignoreconfig:
checksum: b71ca5a072dc5a1ecc18ba9f2460fe33285404a7e10c19d454c0697d0fc91d3d
- filename: src/variables/variable.files.ts
checksum: 2a8df02d571a14f88fc9127eef0359dbbf5e8c61331466bb22143dfd4745d7ce
- filename: src/secrets/secrets.api.ts
checksum: 97726c06d37466fc18eddf8581e814ca9f981af507cb31b8065a4fe6e89ffc6d
- filename: src/secrets/secret.rules.test.ts
checksum: 97684adae48270c9b8d06292d622c654138351d5db7c76e6a033da70a9b0e0be
- filename: src/secrets/secret.rules.ts
checksum: 1b80dd54bd4ace1b312175c0a461e0c9faf6bbb4bc6963b2b41cf1b82b64236b
- filename: src/secrets/types.ts
checksum: 4d146539c1e02afb6d1bd6eb5ccd04a53c387802daeac6d6e2eafe7dbb43a322
- filename: src/secrets/secrets.errors.ts
checksum: ecdd6bf2233cf14312238aca6d8863a4621641b3ed465c0dd0c49e93c5b345e9
- filename: src/core/secret-input.ts
checksum: 72b3b0d121ad9e0fc0ef84dc2a85fe90f308835eabadf013732e2e71ffaaf9ab
- filename: src/secrets/secrets.api.test.ts
checksum: 0490d8a5bc12139a44503cf92f4568ca45f1de8a36d78cd90791d76ead1dab93
- filename: src/core/secret-input.test.ts
checksum: e9b9179635cc4848923d37c153eb1515ca260f4bf8d92e326709c749315c3d26
- filename: src/secrets/secrets.errors.test.ts
checksum: c116485896375f3317e1d1e57bf9f3ccfdbb3ccbe759eff4ac1c3bf79cc19a89
- filename: src/commands/launch/variables/set.ts
checksum: 72281bb3dc2d665fd614082692a0f6e2ab09394e86295a6542c89f0f1294cc28
- filename: src/variables/variable.rules.test.ts
checksum: 88e5e98a79584302390e97d65369616644653bbb9f74f6c6ddb38eaf7783b9af
- filename: src/variables/variable.rules.ts
checksum: f87e18ed22a3eef31c997e0b3daf49547a56cea35dc3e278c000e7d5f6402cf0
- filename: src/variables/variable.secrets.ts
checksum: 852c10918a9a0386e9567838ef0b40b0f5b4f0fbbbf28a9a327bac6aae9cd007
- filename: src/variables/variable.set.ts
checksum: 0a08a0da82e37383345100f4f3d32f5c39734a84fd3b32a4d51326420c040f22
- filename: src/commands/launch/variables/list.ts
checksum: a359e01ff4f7ef687df3e3c42672d5f794aa84ce8ebd4b33f84b43384617e76f
- filename: src/variables/variable.page.ts
checksum: 20bb11e438d6d94aae9f4e100f810dc4dfed772685e29cc2c8e9364b5df4cb29
version: "1.0"
50 changes: 44 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,15 @@ src/
stacks/ the Contentstack stack and delivery-token lookups behind --from-stack, through the
CmaSession (no Launch endpoint)
variables/ the shared variable-source resolver (--var, --dotenv, --from-stack, a detected .env file), the
writer behind launch:variables:set / :unset, and the masked presenter behind :list. Its
VariablesApi owns the per-variable PATCH and the stack template read; the
pre-confirmation read for unset and the list read go through environments.
writer behind launch:variables:set / :unset, and the presenter behind :list (variables and
secrets in one table). Its VariablesApi owns the per-variable PATCH and the stack template
read; the reads for unset and list go through environments and the shared api surface's
secrets list.
EnvironmentBuilder calls back into it for the create commands, so the two folders
each name the other in the layering allow-list
secrets/ SecretsApi (list and remove one secret) and the wording of the secret errors, reached through the
api surface by variables:list and variables:unset. It has no commands of its own: launch:secrets:*
was removed and answers as an unknown command, with no alias
deployments/ the deployment repository, the status classification, the
wait/stream loop and LogTail that projects:create, deployments:create
and logs:get all drive, the DeploymentFollower that watches one
Expand Down Expand Up @@ -341,8 +345,10 @@ the green `✔ Project deleted successfully.`, matching `projects:update`.
`PATCH .../environments/:uid/variables` (`VariablesApi.patch`, CL-7179) with a body of `{set: [{key, value}]}`
or `{unset: [key]}`, never both, so the CLI no longer reads the environment to merge and cannot overwrite a
concurrent change to another key. The server merges under a compare-and-swap and its response carries keys
only, which the CLI ignores. `unset` still reads the environment once, before it asks, to name it in the
question and to refuse a key that is not set with exit 2 before any prompt; a key that disappears after that
only, which the CLI ignores. `unset` reads the environment once, before it asks, to name it in the
question and to work out whether each `--key` is a variable or a secret, and reads `GET .../secrets` only when at least one
`--key` is not a held variable (a variables-only unset makes no secrets read, so a refused or missing secrets route cannot block it),
and refuses a key that is neither with exit 2 before any prompt; a key that disappears after that
read comes back as 404 `KEY.NOT_FOUND`, which `VariablesApi.patch` rewords to the same not-set usage error
(`variable.errors.ts`). A 409 `CONCURRENT_UPDATE` (the server gave up after its retries) exits 1 with advice to run the
command again; `PATCH_EMPTY` and `CONFLICTING_KEYS` cannot be sent by this CLI and read as a CLI bug. A PUT or
Expand All @@ -357,12 +363,44 @@ prints a yellow `Skipped adding variables.` and sends nothing (sources that supp
under `--data-dir`, always printing the file it chose, and fails with exit 2 when there is none. A bare `--var KEY` is a hidden prompt on a terminal, a stdin read for exactly one bare key without one, and
exit 2 naming `--var <KEY>=<value>` and `--dotenv <path>` for two or more. The API refuses an empty value, so `KEY=` is a usage error naming
the key, and an empty value inside a dotenv file is skipped with its key reported. No value reaches stdout, a
prompt message, a confirmation or an error: `list` masks through `redactedColumn`, and a failed `PATCH` is worded from
prompt message, a confirmation or an error: `list` masks through `REDACTED` and shows a secret as `(write-only)`, and a failed `PATCH` is worded from
`ENVIRONMENT_ERROR_MESSAGES`. A code with no entry there falls back to the API's own message, which the
service words from keys at most, never from a value (CL-7179). The stack and delivery-token lookups behind
`--from-stack` walk the Management API 100 per page and raise `CmaScanLimitError` after `MAX_PAGES` pages rather
than return a truncated list.

`set --secret KEY` (repeatable, or `--secret A,B`; one key per occurrence, so a value typed after it is a stray argument,
exit 2) marks keys write-only and still sends **one** `PATCH .../variables` with `set` for the variables and `secrets`
for every secret with a value, so all of it is saved or none of it. `--secret` counts as a given source: no source
chooser, no `.env` auto-detection, no `Using variables from` line. `VariableSetter.setWithSecrets` takes a key's value
from `--dotenv <file>`, `--dotenv -` (the dotenv text on standard input, read only when `--secret` is given; without it `-`
is a file named `-`) or `--from-stack`, else a masked `Value for KEY (1/2)` prompt on a terminal, else one piped value
(`readWithin`, 30 s). Every check runs before the first write and, where possible, before the first prompt, in
`src/variables/variable.secrets.ts`: a key twice, a key in both `--var` and `--secret`, a bare `--var KEY` or a second key that needs
standard input without a terminal (each exit 2), a `--secret` key that is a held variable (`KEY is a variable.`), an empty or
multi-line value, the combined 128 entries and, per request, 14336 bytes of the keys and values this run sends (the
server stays the authority on the environment-wide size). With `--dotenv -`, any key of the stream that `--secret` does not name is a
usage error naming the keys, since it would otherwise be saved as a readable variable; a `--dotenv <file>` or `--from-stack` keeps
sending its other keys as variables. The client-exposed-prefix warning for a `--secret` key prints once the key checks have passed,
before the first prompt or standard input read, and there is no confirmation or `--yes`. A 409 `KEY.CONFLICT` names each `set` key that is
a held secret (`KEY is a secret.`), else each `--secret` key that has become a variable (`KEY is a variable.`), else shows the API's own
message. A `--secret` run reads the environment and `GET .../secrets` first; a run without
`--secret` reads nothing. The summary is one line per kind (`1 variable set`, `1 secret added`, `1 secret updated`), never a
value. `src/core/secret-input.ts` holds the secret input pieces `variables` uses (`readWithin`, the stdin timeout error, whose
hint names `launch:variables:set --secret <KEY>`, the empty-value error and the client-exposed-prefix warning) because
`variables` may not import `secrets`.

`variables:list` fetches the environment and `GET .../secrets` and prints one `KEY | TYPE | VALUE | UPDATED` table: a
variable row is `variable`, masked, with the environment's `updatedAt`; a secret row is `secret`, `(write-only)`, with the
secret's own `updatedAt` (`-` when absent). `pageOfVariables` pages both lists in memory together, variables first, so
`--limit`/`--skip` and the `Showing a-b of n` footer count both; a secrets read the API answers with an error (403, 404) still prints the
variables table, then a yellow warning line with the read-failure wording and exit 0. `variables:unset --key` sends the variable keys in one `PATCH .../variables {unset}` (none when there are
none) and each secret key as its own `DELETE .../secrets/<key>`, one result line per key. A secret delete the API refuses
is reported and the rest are still attempted (`SecretsNotRemovedError`, exit 1); when the variables PATCH was refused as well, one
`RemovalFailedError` (exit 1) names the variables and the secrets left in place; a delete that fails without an API answer
stops the run (`SecretsRemovalStoppedError`, which also lists the variables already removed). These error classes live in
`src/core/secret-input.ts` because `variables` may not import `secrets`.

`projects:create` and `env:create` take `--var` and `--dotenv` and reach the same resolver through
`EnvironmentBuilder`, which asks last - after Contentstack Authentication, where V1 asked - with no auto-detection.
With neither flag it offers a checkbox over the sources plus `Skip adding environment variables`, which cannot be
Expand Down
Loading
Loading