MCPcopy
hub / github.com/github/spec-kit / execute

Method execute

src/specify_cli/workflows/steps/while_loop/__init__.py:21–47  ·  view source on GitHub ↗
(self, config: dict[str, Any], context: StepContext)

Source from the content-addressed store, hash-verified

19 type_key = "while"
20
21 def execute(self, config: dict[str, Any], context: StepContext) -> StepResult:
22 condition = config.get("condition", False)
23 max_iterations = config.get("max_iterations")
24 if max_iterations is None:
25 max_iterations = 10
26 nested_steps = config.get("steps", [])
27
28 result = evaluate_condition(condition, context)
29 if result:
30 return StepResult(
31 status=StepStatus.COMPLETED,
32 output={
33 "condition_result": True,
34 "max_iterations": max_iterations,
35 "loop_type": "while",
36 },
37 next_steps=nested_steps,
38 )
39
40 return StepResult(
41 status=StepStatus.COMPLETED,
42 output={
43 "condition_result": False,
44 "max_iterations": max_iterations,
45 "loop_type": "while",
46 },
47 )
48
49 def validate(self, config: dict[str, Any]) -> list[str]:
50 errors = super().validate(config)

Callers 2

Calls 3

evaluate_conditionFunction · 0.90
StepResultClass · 0.90
getMethod · 0.45

Tested by 2