@@ -200,46 +200,68 @@ const resolvePaths = (
200200 }
201201 } )
202202
203+ type CreateBehavior = {
204+ readonly runUp : boolean
205+ readonly openSsh : boolean
206+ readonly force : boolean
207+ readonly forceEnv : boolean
208+ readonly enableMcpPlaywright : boolean
209+ }
210+
211+ const resolveCreateBehavior = ( raw : RawOptions ) : CreateBehavior => ( {
212+ runUp : raw . up ?? true ,
213+ openSsh : raw . openSsh ?? false ,
214+ force : raw . force ?? false ,
215+ forceEnv : raw . forceEnv ?? false ,
216+ enableMcpPlaywright : raw . enableMcpPlaywright ?? false
217+ } )
218+
203219type BuildTemplateConfigInput = {
204- readonly raw : RawOptions
205220 readonly repo : RepoBasics
206221 readonly names : NameConfig
207222 readonly paths : PathConfig
208223 readonly dockerNetworkMode : CreateCommand [ "config" ] [ "dockerNetworkMode" ]
209224 readonly dockerSharedNetworkName : string
225+ readonly gitTokenLabel : string | undefined
226+ readonly codexAuthLabel : string | undefined
227+ readonly claudeAuthLabel : string | undefined
228+ readonly enableMcpPlaywright : boolean
210229}
211230
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- }
231+ const buildTemplateConfig = ( {
232+ claudeAuthLabel,
233+ codexAuthLabel,
234+ dockerNetworkMode,
235+ dockerSharedNetworkName,
236+ enableMcpPlaywright,
237+ gitTokenLabel,
238+ names,
239+ paths,
240+ repo
241+ } : BuildTemplateConfigInput ) : CreateCommand [ "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+ } )
243265
244266// CHANGE: build a typed create command from raw options (CLI or API)
245267// WHY: share deterministic command construction across CLI and server
@@ -258,31 +280,33 @@ export const buildCreateCommand = (
258280 const repo = yield * _ ( resolveRepoBasics ( raw ) )
259281 const names = yield * _ ( resolveNames ( raw , repo . projectSlug ) )
260282 const paths = yield * _ ( resolvePaths ( raw , repo . repoPath ) )
261- const runUp = raw . up ?? true
262- const openSsh = raw . openSsh ?? false
263- const force = raw . force ?? false
264- const forceEnv = raw . forceEnv ?? false
283+ const behavior = resolveCreateBehavior ( raw )
284+ const gitTokenLabel = normalizeGitTokenLabel ( raw . gitTokenLabel )
285+ const codexAuthLabel = normalizeAuthLabel ( raw . codexTokenLabel )
286+ const claudeAuthLabel = normalizeAuthLabel ( raw . claudeTokenLabel )
265287 const dockerNetworkMode = yield * _ ( parseDockerNetworkMode ( raw . dockerNetworkMode ) )
266288 const dockerSharedNetworkName = yield * _ (
267289 nonEmpty ( "--shared-network" , raw . dockerSharedNetworkName , defaultTemplateConfig . dockerSharedNetworkName )
268290 )
269- const config = buildTemplateConfig ( {
270- raw,
271- repo,
272- names,
273- paths,
274- dockerNetworkMode,
275- dockerSharedNetworkName
276- } )
277291
278292 return {
279293 _tag : "Create" ,
280294 outDir : paths . outDir ,
281- runUp,
282- openSsh,
283- force,
284- forceEnv,
295+ runUp : behavior . runUp ,
296+ openSsh : behavior . openSsh ,
297+ force : behavior . force ,
298+ forceEnv : behavior . forceEnv ,
285299 waitForClone : false ,
286- config
300+ config : buildTemplateConfig ( {
301+ repo,
302+ names,
303+ paths,
304+ dockerNetworkMode,
305+ dockerSharedNetworkName,
306+ gitTokenLabel,
307+ codexAuthLabel,
308+ claudeAuthLabel,
309+ enableMcpPlaywright : behavior . enableMcpPlaywright
310+ } )
287311 }
288312 } )
0 commit comments