@@ -100,3 +100,69 @@ stacker/ StackerConfig::from_str+validate_semantics registry lookup → cloud
1001001 . Badge in ` ai-automation-workflows ` opens console preloaded with Flowise+n8n+Ollama+Qdrant.
1011012 . ` .env.example ` vars land in the env form (secrets autofilled).
1021023 . Invalid stacker.yml → ` Invalid stacker.yml in target repository ` (422), never a 500.
103+
104+ ---
105+
106+ ## Env field types
107+
108+ The ` POST /deploy/prepare ` response includes a ` type ` field on each env entry so
109+ the frontend can render the correct input widget (text, checkbox, password).
110+
111+ ### How types are determined
112+
113+ Types are resolved in two stages:
114+
115+ 1 . ** Declared types from ` config_contract ` ** — when ` stacker.yml ` declares a
116+ ` display ` field on a ` config_contract.services.<service>.fields.<FIELD> `
117+ entry, the user service reads it from the validate response and applies it
118+ to the matching ` env_fields ` entry. This is the ** primary** source of truth.
119+
120+ 2 . ** Fallback heuristic** — for fields not declared in ` config_contract ` , the
121+ user service infers ` boolean ` from values ` true ` /` false ` /` yes ` /` no ` /` 1 ` /` 0 ` /` on ` /` off ` ,
122+ and ` password ` for fields whose key matches secret-related keywords
123+ (` SECRET ` , ` PASSWORD ` , ` TOKEN ` , etc.). Everything else defaults to ` text ` .
124+
125+ ### Response shape
126+
127+ ``` json
128+ {
129+ "key" : " FLOCI_TLS_ENABLED" ,
130+ "value" : " true" ,
131+ "required" : true ,
132+ "secret" : false ,
133+ "type" : " boolean"
134+ }
135+ ```
136+
137+ ### Frontend rendering
138+
139+ | ` type ` | Widget | Value sent to ` /deploy/start ` |
140+ | --------| --------| -------------------------------|
141+ | ` boolean ` | Checkbox (toggle) | ` "true" ` or ` "false" ` (string) |
142+ | ` number ` | Number input | The numeric string as-is |
143+ | ` password ` | Password input (masked, with regeneration) | The string value |
144+ | ` text ` | Text input | The string value |
145+
146+ ### Declaring types in stacker.yml
147+
148+ Template authors declare ` display ` on ` config_contract ` fields:
149+
150+ ``` yaml
151+ config_contract :
152+ services :
153+ app :
154+ fields :
155+ TLS_ENABLED :
156+ mutability : editable
157+ display : boolean
158+ PORT :
159+ mutability : editable
160+ display : number
161+ API_SECRET :
162+ mutability : generated
163+ type : base64
164+ display : password
165+ length : 48
166+ ` ` `
167+
168+ See [FIELD_POLICY.md](./FIELD_POLICY.md) for the full ` display` reference.
0 commit comments