1414from specify_cli .workflows .base import StepBase , StepContext , StepResult , StepStatus
1515from specify_cli .workflows .expressions import evaluate_expression
1616
17+ #: Valid ``script`` values, mirroring ``specify init --script``.
18+ VALID_SCRIPT_TYPES = ("sh" , "ps" )
19+
1720
1821class InitStep (StepBase ):
1922 """Bootstrap a project, equivalent to running ``specify init``.
@@ -170,9 +173,10 @@ def _run_init(
170173 os .chdir (prev_cwd )
171174
172175 stdout = result .output or ""
173- # click >= 8.2 captures stderr separately; older versions mix it in.
176+ # click >= 8.2 captures stderr separately; older versions mix it into
177+ # stdout and raise when ``result.stderr`` is accessed.
174178 try :
175- stderr = result .stderr if result . stderr_bytes is not None else ""
179+ stderr = result .stderr or ""
176180 except (ValueError , AttributeError ):
177181 stderr = ""
178182
@@ -185,8 +189,13 @@ def _run_init(
185189 def validate (self , config : dict [str , Any ]) -> list [str ]:
186190 errors = super ().validate (config )
187191 script = config .get ("script" )
188- if isinstance (script , str ) and "{{" not in script and script not in ("sh" , "ps" ):
192+ if (
193+ isinstance (script , str )
194+ and "{{" not in script
195+ and script not in VALID_SCRIPT_TYPES
196+ ):
189197 errors .append (
190- f"Init step { config .get ('id' , '?' )!r} : 'script' must be 'sh' or 'ps'."
198+ f"Init step { config .get ('id' , '?' )!r} : 'script' must be "
199+ f"{ ' or ' .join (repr (s ) for s in VALID_SCRIPT_TYPES )} ."
191200 )
192201 return errors
0 commit comments