MCPcopy
hub / github.com/wshobson/agents / _frontmatter_block

Function _frontmatter_block

tools/adapters/codex.py:165–182  ·  view source on GitHub ↗

Render a minimal YAML-ish frontmatter block (string/scalar fields only).

(fm: dict)

Source from the content-addressed store, hash-verified

163
164
165def _frontmatter_block(fm: dict) -> str:
166 """Render a minimal YAML-ish frontmatter block (string/scalar fields only)."""
167 lines = ["---"]
168 for k, v in fm.items():
169 if isinstance(v, list):
170 lines.append(f"{k}:")
171 for item in v:
172 lines.append(f" - {_yaml_scalar(item)}")
173 elif isinstance(v, dict):
174 lines.append(f"{k}:")
175 for subk, subv in v.items():
176 lines.append(f" {subk}: {_yaml_scalar(subv)}")
177 elif v is None:
178 continue
179 else:
180 lines.append(f"{k}: {_yaml_scalar(v)}")
181 lines.append("---")
182 return "\n".join(lines)
183
184
185def _rewrite_body_for_codex(body: str) -> str:

Callers 2

_emit_skillMethod · 0.85

Calls 1

_yaml_scalarFunction · 0.85

Tested by

no test coverage detected