Skip to content

Commit 4a96140

Browse files
refactor(prompts): move the shared prompt helpers into core/prompt and git/git.prompt
The prompt helpers no longer live in projects/project.create.prompt.ts and projects/project.update.prompt.ts. The generic ones - askText, askOptionalText, askOption, answered, checkLength, noteTruncation and the UxLike / PromptDeps / Choice types - are in src/core/prompt.ts, and the GitHub ones - askBranch, findRepository, repositorySearchTerm - are in src/git/git.prompt.ts, with repositoryLabel in git.presenter.ts. Imports across the commands, core, deployments, environments, functions, git, organizations, projects and transport modules point at the new homes, and the tests move with them. This lands on top of 366257f (fix(prompts): never answer a prompt with something that is not on its list), whose changes to the old prompt file are carried into the new one: the fixed-option picker is askOption and asks a plain 'list', so it takes no typed text, while the organization and project pickers stay on 'search-list' with its refusal of unlisted answers. The .talismanrc checksums are refreshed for the files this touches, and src/environments/environment.inputs.test.ts gets the same filename-only exemption as the other environments files: Talisman reads "env" in its name as a possible .env file. The pre-push scan reads whole changed files, so the files whose imports this rewrites also get per-file checksum entries: it flags their key, pass and token identifiers and the fixture uid, none of which is a secret. #claude_code# 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 21d2a1c commit 4a96140

95 files changed

Lines changed: 631 additions & 559 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.talismanrc‎

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,26 @@
11
fileignoreconfig:
2+
- filename: test/integration/retired-commands.test.ts
3+
checksum: ed3911c4dfc42bb7b2e4806f6785b15c839c87ddbd7ae7ad70f6e3a493ab76f8
4+
- filename: test/integration/manage-base-path.test.ts
5+
checksum: 79eb9ad420ea47d5bee8045d812c45b010bbeeafcaf5f85d11653140b0cd0db1
6+
- filename: src/transport/rest-client.ts
7+
checksum: bf0b19bdce7796208e7a8f29f7fdc8aad36ed2ffc10e148439fa19fd166c63d3
8+
- filename: src/transport/rest-client.test.ts
9+
checksum: 3b5751449c61f7a1d71b978ed03b9472f714e12dd1679f691bbd4dd8f84be923
10+
- filename: src/transport/cma-client.ts
11+
checksum: b1cc7c3348930846f1d27b9d025e3a76f807eaccd48db6464ef9c27ef83ec4ac
12+
- filename: src/transport/auth-strategy.test.ts
13+
checksum: a4f3e3ea7db10dbf82abbac0207d2231ee740916f476fcda836a2268505295ef
14+
- filename: src/projects/types.ts
15+
checksum: 563a1f339c7b1ba1a366e8cac087a52805af21d46f07e4078716358ed99270f5
16+
- filename: src/projects/projects.api.ts
17+
checksum: 4bc980a0c0558046de0d8b0b98c45c34b7bacb18e91833d00f658c660ae1cc85
18+
- filename: src/core/service-context.test.ts
19+
checksum: 7bc4f6ca3ec8a960f84fb4c07453a287bb2bb0ccc7e06c5805a7f56df160024a
20+
- filename: src/core/rules.test.ts
21+
checksum: 2dbc873f3e635a72b1b566311c04252d2a2c25142570006523415c81a91c7a6a
22+
- filename: src/core/inputs.test.ts
23+
checksum: c5b4be7a0aa2f0878153f062e1500b2bdbd53bdd2d84bb7c13c731db3c3699c4
224
- filename: .github/workflows/secrets-scan.yml
325
checksum: aa468892940460dd050b7bc2ec997d589fe88c3557779dabdb1583645e45b79b
426
- filename: .husky/secrets-scan.sh
@@ -83,13 +105,18 @@ fileignoreconfig:
83105
ignore_detectors:
84106
- filename
85107
- filename: src/git/git.api.ts
86-
checksum: dc9951fbcf6c1204c5eedb84c476bcce7d83339b1515ec10143e4f06bafda1aa
108+
checksum: 57c98f5d7ba6da4fe4ecc211d803d67bb334244d947ea281b7994ab2d1e84b84
87109
allowed_patterns:
88110
- "assertArray\\(response, key, `\\$\\{key\\} response`\\)"
89111
- filename: src/environments/environment.inputs.ts
90112
ignore_detectors:
91113
- filename
114+
- filename: src/environments/environment.inputs.test.ts
115+
checksum: 87139e8df1adc655cabff993774dea596e1f5c55cdc243da21a7fab30115ce14
116+
ignore_detectors:
117+
- filename
92118
- filename: src/core/inputs.ts
119+
checksum: 6af3bfdfd7473eff2cce16acb6e7feb377eab05c68ad96a05101b20873582c49
93120
allowed_patterns:
94121
- "FlagKey"
95122
- "InputKeys"
@@ -117,6 +144,7 @@ fileignoreconfig:
117144
- "b2c3d4e5f60718293a4b5c6d"
118145
- "c3d4e5f60718293a4b5c6d7e"
119146
- filename: src/core/rules.ts
147+
checksum: ac94c82b5ce3805f986b5aeecc4e53579dfdf1473d9617c20bc126597657fe37
120148
allowed_patterns:
121149
- "FlagKey"
122150
- filename: src/resources.ts
@@ -143,39 +171,39 @@ fileignoreconfig:
143171
- filename: src/core/project-config.test.ts
144172
checksum: 65c0a613ec77d4dc6727224d4d097de4a02b300339286db692dbaea9379565ae
145173
- filename: src/core/resolve.ts
146-
checksum: 25cb3c5eb789bfd148efb1a990932b99970c45d5777344d34e66cf54207c5256
174+
checksum: 5d150db11cb1c976911ecba61336118ddad051942da95f809695c0cf0346de42
147175
- filename: src/core/resolve.test.ts
148-
checksum: 1a07140c5f61d2c1cbd1f9746fca2e907fd2467f804c62a0ed6c188b6944b126
176+
checksum: 42dfd6c77b752f64f6a927845a2d98626934ba0952c911cf701b3df502cb0443
149177
- filename: src/git/local-repository.ts
150178
checksum: 7f266d6d6796574721ca463a14914759c91ce25dfa5b333f103258fe2336cfe5
151179
- filename: src/core/layering.test.ts
152-
checksum: 7a62eca2d63801b98591267dcbaa9e2568b20e1732ab1c744263ddab7f0dbbe8
180+
checksum: a1efe5f165b1c41e638eb6585cec28009b87cff00183072136d4954fed7f142a
153181
- filename: src/commands/launch/projects/create.test.ts
154-
checksum: 65a8c28525aa8ade9af5f5356cf505d3ebe5fd0d6131ba9b758c709c2a34e242
182+
checksum: df6bd90d4a8584442024f450f29299da748cf12a5a4be1701b8c26b31386dbf7
155183
- filename: src/commands/launch/projects/delete.test.ts
156-
checksum: 029c034d3d38d8cb37901b0936a7d6b4525d5bedf8c7ce052984c9b6f9ceffec
184+
checksum: d67d8a804d14f9b809153d10b0cf9d5e52b70f9e0b65678ebb1663a7d2da22c1
157185
- filename: test/integration/projects-delete.test.ts
158-
checksum: 4e2960b921f69bcb5fc1b4d6089b7ded1b71ed54609d8304bf7ee84041cf7fc2
186+
checksum: 61e5c6bb9c82260797552a1d9e263e7e0b6c88a627bcc996f5fd3b678d99f9b7
159187
- filename: src/core/launch-command.ts
160-
checksum: 4bccae32140aa3b4da94346b4bfd3b199a2a7d568f26e28d7dad58b266148038
188+
checksum: 85f86ea5f075bfdd78652dc05d20a2f6e89348466c6bd41ae903bcb1b7e8515d
161189
- filename: src/core/launch-command.test.ts
162-
checksum: 2cc245f8a4af102eb9edb53184d1af2486c6bbf9588a41e56452895a4c580e99
190+
checksum: 930069aeddbf4348097f33713e4e57bd26cb3be1b7970eb60142bb53010e1674
163191
- filename: src/projects/project.inputs.test.ts
164-
checksum: 9d409c408f433eb1c7ca8fcff6dfc76d212281adaf7fcfd7bd9a121b8096577d
192+
checksum: c20f69186e74bc5fe6deb73a9036fa2cb86aeff1bde48670f0c489d9e9121c62
165193
- filename: test/integration/projects-command-flows.test.ts
166-
checksum: 58364e1ed8e4958fe32bfa86e1598c156ab260d495f2700690b0443e3cc670b9
194+
checksum: ae02de4f2bb6c577065a31351cb7e4a3456f085148de6779fd1f23c36f6b85ad
167195
- filename: src/core/redact.test.ts
168196
checksum: ae497ea8c3a4c3f12217d2c4c028a1da3d1324e18362d68c355ba8120902bcb3
169197
- filename: src/commands/launch/projects/list.test.ts
170-
checksum: 42f9d2d0e6fd1d16513ac5c675d2eb37beef6071e329b2b243215f4614e2b210
198+
checksum: ad565f30c957dc4463d13e242dd8bb0cbae9270d345cb59e28999474855693dc
171199
- filename: src/commands/launch/projects/get.test.ts
172-
checksum: 9e99dc536b36b27810388039f61cc2c5ffa757fa33509171d91c91396d16e657
200+
checksum: fec6ca189bc3d93aefa109ee6405f8ce74a42318aa18a99045d40c3cb5561b9e
173201
- filename: test/integration/projects-list-command.test.ts
174-
checksum: b34a68639ba0694dd89df11373b0192329e58cef9e2b1ff9d7e5456a528f882b
202+
checksum: 1012c9fb505778c3ccd955da2d0877e16b69408ca460d78244e339c6afd28a8c
175203
- filename: src/functions/cloud-functions.test.ts
176-
checksum: b3e7ad3428544faf1695752bd04af45716a0189b5950f77fcb104f282516a56c
204+
checksum: cb88289005016bb88b1e3c70dcf91980156e5ec4e9a80bb63584022aa73a2890
177205
- filename: src/transport/proxy.test.ts
178206
checksum: 06db291bb40ec55774179b02e3e1a9644bbaa116ec511c163e8d6012aebb3868
179207
- filename: test/integration/project-upload-proxy.test.ts
180-
checksum: 668f517734e60580470f770cb5b180b4f876db9746029610dafcb5d9826c8871
208+
checksum: 6e3ebdd77f0bb99bc2cd2fc778c46c8a77b601d1a6bfdd40590cdf21d41009b6
181209
version: "1.0"

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ a prompt is checked as well as one from argv.
355355
Supplying either flag is the whole request: the supplied fields are sent as given and the other one
356356
is neither prompted for nor fetched, in a terminal or not. Only when neither flag is supplied, in a
357357
terminal, are both fields prompted for, in order (name, then description): `promptForProjectUpdate`
358-
in `src/projects/project.update.prompt.ts`. Prompts carry no pre-filled value; a blank answer, or one
358+
in `src/projects/project.prompt.ts`. Prompts carry no pre-filled value; a blank answer, or one
359359
equal to the current value (read with one `GET` first), leaves that field out. The length limits are
360360
checked inside each prompt's `validate`, so an oversized answer re-prompts instead of failing. If
361361
nothing is left to send, the command prints a yellow `Project not updated. No changes were entered.`,
@@ -570,8 +570,8 @@ makes the deadline unreachable and the suite **hangs** rather than failing - the
570570
as the `loadDataURL` rule below. Have `sleep` advance the same counter `now` reads.
571571

572572
**`projects:create`.** The command is thin; `ProjectCreator` in `src/projects/project.create.ts` is
573-
the domain service, and `src/projects/project.create.prompt.ts` is a UI adapter that renders choices
574-
and nothing more.
573+
the domain service, and the prompts it asks come from `src/core/prompt.ts` (text, choice, cancel) and
574+
`src/git/git.prompt.ts` (branch picker), adapters that render choices and nothing more.
575575

576576
Interactive order is pinned by a test against the order a real `csdx launch` run prompts in: type ->
577577
organization -> (FileUpload only: zip + upload) -> project name -> environment name -> (GitHub only:

‎eslint.config.mjs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ export default tseslint.config(
3434
]
3535
},
3636
},
37+
{
38+
files: ['src/**/*.ts', 'test/**/*.ts'],
39+
rules: {
40+
'@typescript-eslint/consistent-type-imports': ['error'],
41+
},
42+
},
3743
{
3844
files: ['src/**/*.test.ts'],
3945
rules: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import type { defaultWatchTiming } from '../../../projects/project.create';
12
import {
23
DEPLOYMENT_WAIT_TIMEOUT_MS,
34
ProjectCreator,
4-
defaultWatchTiming,
55
serverCommandFrameworkGate,
66
} from '../../../projects/project.create';
77

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { UsageError } from '../../../core/errors';
2-
import { UxLike } from '../../../core/render';
3-
import { Project } from '../../../projects/types';
2+
import type { UxLike } from '../../../core/prompt';
3+
import type { Project } from '../../../projects/types';
44
import ProjectsDelete from './delete';
55

66
const PROJECT_UID = 'a1b2c3d4e5f60718293a4b5c';

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ApiSurface } from '../../../resources';
1+
import type { ApiSurface } from '../../../resources';
22
import { resolveInputs } from '../../../core/resolve';
3-
import { UxLike } from '../../../core/render';
3+
import type { UxLike } from '../../../core/prompt';
44
import ProjectsGet from './get';
55

66
function commandUnderTest(project: unknown) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { UxLike } from '../../../core/render';
1+
import type { UxLike } from '../../../core/prompt';
22
import ProjectsList from './list';
33

44
function commandUnderTest(page: unknown, resolved: Record<string, unknown> = { org: 'org1', limit: 50, skip: 0 }) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { UsageError } from '../../../core/errors';
2-
import { UxLike } from '../../../core/render';
2+
import type { UxLike } from '../../../core/prompt';
33
import { resolveInputs } from '../../../core/resolve';
4-
import { ApiSurface } from '../../../resources';
5-
import { Project } from '../../../projects/types';
4+
import type { ApiSurface } from '../../../resources';
5+
import type { Project } from '../../../projects/types';
66
import ProjectsUpdate from './update';
77

88
const PROJECT_UID = 'a1b2c3d4e5f60718293a4b5c';

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
import { LaunchCommand } from '../../../core/launch-command';
22
import { UsageError } from '../../../core/errors';
33
import { flagsFor, inputs } from '../../../core/inputs';
4-
import {
5-
PROJECT_UPDATABLE_FIELDS,
6-
projectNotUpdatedLine,
7-
projectUpdatedLine,
8-
} from '../../../projects/project.presenter';
9-
import { promptForProjectUpdate } from '../../../projects/project.update.prompt';
4+
import { projectNotUpdatedLine, projectUpdatedLine } from '../../../projects/project.presenter';
5+
import { PROJECT_UPDATABLE_FIELDS, promptForProjectUpdate } from '../../../projects/project.prompt';
106
import type { ProjectUpdate } from '../../../projects/types';
117

128
const updateInputs = inputs({

‎src/core/inputs.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Catalog, catalog } from '../resources';
1+
import type { Catalog } from '../resources';
2+
import { catalog } from '../resources';
23
import { flagsFor, inputs } from './inputs';
34

45
describe('inputs and flagsFor', () => {

0 commit comments

Comments
 (0)