@@ -8,15 +8,13 @@ import { type RawOptions } from "./command-options.js"
88import {
99 type AgentMode ,
1010 type CreateCommand ,
11- defaultCpuLimit ,
12- defaultRamLimit ,
1311 defaultTemplateConfig ,
1412 deriveRepoPathParts ,
1513 deriveRepoSlug ,
1614 type ParseError ,
1715 resolveRepoInput
1816} from "./domain.js"
19- import { normalizeCpuLimit , normalizeRamLimit } from "./resource-limits.js"
17+ import { resolveResourceLimitsIntent } from "./resource-limits.js"
2018import { trimRightChar } from "./strings.js"
2119import { normalizeAuthLabel , normalizeGitTokenLabel } from "./token-labels.js"
2220
@@ -193,6 +191,8 @@ type BuildTemplateConfigInput = {
193191 readonly paths : PathConfig
194192 readonly cpuLimit : string | undefined
195193 readonly ramLimit : string | undefined
194+ readonly playwrightCpuLimit : string | undefined
195+ readonly playwrightRamLimit : string | undefined
196196 readonly dockerNetworkMode : CreateCommand [ "config" ] [ "dockerNetworkMode" ]
197197 readonly dockerSharedNetworkName : string
198198 readonly gitTokenLabel : string | undefined
@@ -205,53 +205,64 @@ type BuildTemplateConfigInput = {
205205 readonly clonedOnHostname ?: string | undefined
206206}
207207
208- const buildTemplateConfig = ( {
209- agentAuto,
210- agentMode,
211- claudeAuthLabel,
212- clonedOnHostname,
213- codexAuthLabel,
214- cpuLimit,
215- dockerNetworkMode,
216- dockerSharedNetworkName,
217- enableMcpPlaywright,
218- gitTokenLabel,
219- names,
220- paths,
221- ramLimit,
222- repo,
223- skipGithubAuth
224- } : BuildTemplateConfigInput ) : CreateCommand [ "config" ] => ( {
225- containerName : names . containerName ,
226- serviceName : names . serviceName ,
227- sshUser : repo . sshUser ,
228- sshPort : repo . sshPort ,
229- repoUrl : repo . repoUrl ,
230- repoRef : repo . repoRef ,
231- gitTokenLabel,
232- skipGithubAuth,
233- codexAuthLabel,
234- claudeAuthLabel,
235- targetDir : repo . targetDir ,
236- volumeName : names . volumeName ,
237- dockerGitPath : paths . dockerGitPath ,
238- authorizedKeysPath : paths . authorizedKeysPath ,
239- envGlobalPath : paths . envGlobalPath ,
240- envProjectPath : paths . envProjectPath ,
241- codexAuthPath : paths . codexAuthPath ,
242- codexSharedAuthPath : paths . codexSharedAuthPath ,
243- codexHome : paths . codexHome ,
244- geminiAuthPath : paths . geminiAuthPath ,
245- geminiHome : paths . geminiHome ,
246- cpuLimit,
247- ramLimit,
248- dockerNetworkMode,
249- dockerSharedNetworkName,
250- enableMcpPlaywright,
208+ const buildTemplateConfigBase = (
209+ input : Pick < BuildTemplateConfigInput , "repo" | "names" | "paths" >
210+ ) : Pick <
211+ CreateCommand [ "config" ] ,
212+ | "containerName"
213+ | "serviceName"
214+ | "sshUser"
215+ | "sshPort"
216+ | "repoUrl"
217+ | "repoRef"
218+ | "targetDir"
219+ | "volumeName"
220+ | "dockerGitPath"
221+ | "authorizedKeysPath"
222+ | "envGlobalPath"
223+ | "envProjectPath"
224+ | "codexAuthPath"
225+ | "codexSharedAuthPath"
226+ | "codexHome"
227+ | "geminiAuthPath"
228+ | "geminiHome"
229+ > => ( {
230+ containerName : input . names . containerName ,
231+ serviceName : input . names . serviceName ,
232+ sshUser : input . repo . sshUser ,
233+ sshPort : input . repo . sshPort ,
234+ repoUrl : input . repo . repoUrl ,
235+ repoRef : input . repo . repoRef ,
236+ targetDir : input . repo . targetDir ,
237+ volumeName : input . names . volumeName ,
238+ dockerGitPath : input . paths . dockerGitPath ,
239+ authorizedKeysPath : input . paths . authorizedKeysPath ,
240+ envGlobalPath : input . paths . envGlobalPath ,
241+ envProjectPath : input . paths . envProjectPath ,
242+ codexAuthPath : input . paths . codexAuthPath ,
243+ codexSharedAuthPath : input . paths . codexSharedAuthPath ,
244+ codexHome : input . paths . codexHome ,
245+ geminiAuthPath : input . paths . geminiAuthPath ,
246+ geminiHome : input . paths . geminiHome
247+ } )
248+
249+ const buildTemplateConfig = ( input : BuildTemplateConfigInput ) : CreateCommand [ "config" ] => ( {
250+ ...buildTemplateConfigBase ( input ) ,
251+ gitTokenLabel : input . gitTokenLabel ,
252+ skipGithubAuth : input . skipGithubAuth ,
253+ codexAuthLabel : input . codexAuthLabel ,
254+ claudeAuthLabel : input . claudeAuthLabel ,
255+ cpuLimit : input . cpuLimit ,
256+ ramLimit : input . ramLimit ,
257+ playwrightCpuLimit : input . playwrightCpuLimit ,
258+ playwrightRamLimit : input . playwrightRamLimit ,
259+ dockerNetworkMode : input . dockerNetworkMode ,
260+ dockerSharedNetworkName : input . dockerSharedNetworkName ,
261+ enableMcpPlaywright : input . enableMcpPlaywright ,
251262 bunVersion : defaultTemplateConfig . bunVersion ,
252- agentMode,
253- agentAuto,
254- clonedOnHostname
263+ agentMode : input . agentMode ,
264+ agentAuto : input . agentAuto ,
265+ clonedOnHostname : input . clonedOnHostname
255266} )
256267
257268// CHANGE: build a typed create command from raw options (CLI or API)
@@ -275,8 +286,7 @@ export const buildCreateCommand = (
275286 const gitTokenLabel = normalizeGitTokenLabel ( raw . gitTokenLabel )
276287 const codexAuthLabel = normalizeAuthLabel ( raw . codexTokenLabel )
277288 const claudeAuthLabel = normalizeAuthLabel ( raw . claudeTokenLabel )
278- const cpuLimit = yield * _ ( normalizeCpuLimit ( raw . cpuLimit ?? defaultCpuLimit , "--cpu" ) )
279- const ramLimit = yield * _ ( normalizeRamLimit ( raw . ramLimit ?? defaultRamLimit , "--ram" ) )
289+ const limits = yield * _ ( resolveResourceLimitsIntent ( raw ) )
280290 const dockerNetworkMode = yield * _ ( parseDockerNetworkMode ( raw . dockerNetworkMode ) )
281291 const dockerSharedNetworkName = yield * _ (
282292 nonEmpty ( "--shared-network" , raw . dockerSharedNetworkName , defaultTemplateConfig . dockerSharedNetworkName )
@@ -295,8 +305,10 @@ export const buildCreateCommand = (
295305 repo,
296306 names,
297307 paths,
298- cpuLimit,
299- ramLimit,
308+ cpuLimit : limits . cpuLimit ,
309+ ramLimit : limits . ramLimit ,
310+ playwrightCpuLimit : limits . playwrightCpuLimit ,
311+ playwrightRamLimit : limits . playwrightRamLimit ,
300312 dockerNetworkMode,
301313 dockerSharedNetworkName,
302314 gitTokenLabel,
0 commit comments