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

Function _build_namespace

src/specify_cli/workflows/expressions.py:126–146  ·  view source on GitHub ↗

Build the variable namespace from a StepContext.

(context: Any)

Source from the content-addressed store, hash-verified

124
125
126def _build_namespace(context: Any) -> dict[str, Any]:
127 """Build the variable namespace from a StepContext."""
128 ns: dict[str, Any] = {}
129 if hasattr(context, "inputs"):
130 ns["inputs"] = context.inputs or {}
131 if hasattr(context, "steps"):
132 ns["steps"] = context.steps or {}
133 if hasattr(context, "item"):
134 ns["item"] = context.item
135 if hasattr(context, "fan_in"):
136 ns["fan_in"] = context.fan_in or {}
137 # Engine-managed runtime metadata. Always present (even outside a
138 # run) so templates referencing it never error: `run_id` falls back
139 # to an empty string when no run is active (dry-run, validation,
140 # ad-hoc evaluator usage). The value is the same one Spec Kit
141 # prints as `Run ID:` at the end of `workflow run` — auto-generated
142 # runs use an 8-character uuid4 hex; operator-supplied ids may be
143 # any alphanumeric string with hyphens or underscores.
144 run_id = getattr(context, "run_id", None) or ""
145 ns["context"] = {"run_id": run_id}
146 return ns
147
148
149def _is_single_expression(stripped: str) -> bool:

Callers 1

evaluate_expressionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected