@@ -77,7 +77,7 @@ type RepoBasics = {
7777
7878const resolveRepoBasics = ( raw : RawOptions ) : Either . Either < RepoBasics , ParseError > =>
7979 Either . gen ( function * ( _ ) {
80- const rawRepoUrl = yield * _ ( nonEmpty ( "--repo-url" , raw . repoUrl ) )
80+ const rawRepoUrl = raw . repoUrl ?. trim ( ) ?? ""
8181 const resolvedRepo = resolveRepoInput ( rawRepoUrl )
8282 const repoUrl = resolvedRepo . repoUrl
8383 const repoSlug = deriveRepoSlug ( repoUrl )
@@ -200,6 +200,47 @@ const resolvePaths = (
200200 }
201201 } )
202202
203+ type BuildTemplateConfigInput = {
204+ readonly raw : RawOptions
205+ readonly repo : RepoBasics
206+ readonly names : NameConfig
207+ readonly paths : PathConfig
208+ readonly dockerNetworkMode : CreateCommand [ "config" ] [ "dockerNetworkMode" ]
209+ readonly dockerSharedNetworkName : string
210+ }
211+
212+ const buildTemplateConfig = ( input : BuildTemplateConfigInput ) : CreateCommand [ "config" ] => {
213+ const enableMcpPlaywright = input . raw . enableMcpPlaywright ?? false
214+ const gitTokenLabel = normalizeGitTokenLabel ( input . raw . gitTokenLabel )
215+ const codexAuthLabel = normalizeAuthLabel ( input . raw . codexTokenLabel )
216+ const claudeAuthLabel = normalizeAuthLabel ( input . raw . claudeTokenLabel )
217+
218+ return {
219+ containerName : input . names . containerName ,
220+ serviceName : input . names . serviceName ,
221+ sshUser : input . repo . sshUser ,
222+ sshPort : input . repo . sshPort ,
223+ repoUrl : input . repo . repoUrl ,
224+ repoRef : input . repo . repoRef ,
225+ gitTokenLabel,
226+ codexAuthLabel,
227+ claudeAuthLabel,
228+ targetDir : input . repo . targetDir ,
229+ volumeName : input . names . volumeName ,
230+ dockerGitPath : input . paths . dockerGitPath ,
231+ authorizedKeysPath : input . paths . authorizedKeysPath ,
232+ envGlobalPath : input . paths . envGlobalPath ,
233+ envProjectPath : input . paths . envProjectPath ,
234+ codexAuthPath : input . paths . codexAuthPath ,
235+ codexSharedAuthPath : input . paths . codexSharedAuthPath ,
236+ codexHome : input . paths . codexHome ,
237+ dockerNetworkMode : input . dockerNetworkMode ,
238+ dockerSharedNetworkName : input . dockerSharedNetworkName ,
239+ enableMcpPlaywright,
240+ pnpmVersion : defaultTemplateConfig . pnpmVersion
241+ }
242+ }
243+
203244// CHANGE: build a typed create command from raw options (CLI or API)
204245// WHY: share deterministic command construction across CLI and server
205246// QUOTE(ТЗ): "В lib ты оставляешь бизнес логику, а все CLI морду хранишь в app"
@@ -221,14 +262,18 @@ export const buildCreateCommand = (
221262 const openSsh = raw . openSsh ?? false
222263 const force = raw . force ?? false
223264 const forceEnv = raw . forceEnv ?? false
224- const enableMcpPlaywright = raw . enableMcpPlaywright ?? false
225- const gitTokenLabel = normalizeGitTokenLabel ( raw . gitTokenLabel )
226- const codexAuthLabel = normalizeAuthLabel ( raw . codexTokenLabel )
227- const claudeAuthLabel = normalizeAuthLabel ( raw . claudeTokenLabel )
228265 const dockerNetworkMode = yield * _ ( parseDockerNetworkMode ( raw . dockerNetworkMode ) )
229266 const dockerSharedNetworkName = yield * _ (
230267 nonEmpty ( "--shared-network" , raw . dockerSharedNetworkName , defaultTemplateConfig . dockerSharedNetworkName )
231268 )
269+ const config = buildTemplateConfig ( {
270+ raw,
271+ repo,
272+ names,
273+ paths,
274+ dockerNetworkMode,
275+ dockerSharedNetworkName
276+ } )
232277
233278 return {
234279 _tag : "Create" ,
@@ -238,29 +283,6 @@ export const buildCreateCommand = (
238283 force,
239284 forceEnv,
240285 waitForClone : false ,
241- config : {
242- containerName : names . containerName ,
243- serviceName : names . serviceName ,
244- sshUser : repo . sshUser ,
245- sshPort : repo . sshPort ,
246- repoUrl : repo . repoUrl ,
247- repoRef : repo . repoRef ,
248- gitTokenLabel,
249- codexAuthLabel,
250- claudeAuthLabel,
251- targetDir : repo . targetDir ,
252- volumeName : names . volumeName ,
253- dockerGitPath : paths . dockerGitPath ,
254- authorizedKeysPath : paths . authorizedKeysPath ,
255- envGlobalPath : paths . envGlobalPath ,
256- envProjectPath : paths . envProjectPath ,
257- codexAuthPath : paths . codexAuthPath ,
258- codexSharedAuthPath : paths . codexSharedAuthPath ,
259- codexHome : paths . codexHome ,
260- dockerNetworkMode,
261- dockerSharedNetworkName,
262- enableMcpPlaywright,
263- pnpmVersion : defaultTemplateConfig . pnpmVersion
264- }
286+ config
265287 }
266288 } )
0 commit comments