forked from diegoecab/oci-deal-accelerator
Extractor: drawio → absolute_layout YAML scaffold (107/132 cached)
Closes the procedural hole that kept making Codex sessions fall back
to ``examples/`` for YAML scaffolding even after the SKILL forbade it.
The lookup tool returns a canonical Oracle ``.drawio`` as the geometry
source, but the agent had no YAML version of that geometry to copy —
the .drawio is XML with stencil-encoded icons. Without a scaffold,
agents reverse-engineered or fell back to ``examples/`` (which is
forbidden but happened anyway because the alternative was painful).
New tool ``tools/archcenter_drawio_to_template.py`` extracts:
• canvas dimensions
• containers (region / vcn / ad / subnet) classified by stroke /
fill style markers
• service bounding boxes with ``type: TODO_identify`` (the icon
type is encoded in stencil bytes — agent fills it from the
renderer's TYPE_TO_ICON aliases when authoring the spec)
• edge waypoints (source, target, points)
Output lands at ``kb/diagram/assets/archcenter-refs/<slug>/_template.yaml``
next to the .drawio. Lookup now surfaces it as
``cached: yaml=<path>`` so the agent has a one-step "copy this YAML
and adapt" path.
Ran across all 132 cached folders: 107 templates emitted, 24 had no
.drawio (zip didn't ship one), 1 already cached.
Other persistent guardrails added in this commit:
- SKILL.md option 2 step 3: explicit reminder that valid ``type:``
values come from ``TYPE_TO_ICON`` / ``ICON_TYPE_ALIASES`` in the
renderer source plus the icon-index JSON files. Do NOT grep
``examples/`` for ``type:`` — that's where the previous Codex
session was looking, against the rule.
- ``make archcenter-templates-refresh`` Makefile target.
- The lookup index now also indexes ``_template.yaml`` per slug.
- Auto-extracted templates committed under
``kb/diagram/assets/archcenter-refs/*/_template.yaml`` so a fresh
clone has them on first lookup (no extraction step needed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -248,6 +248,12 @@ def _build_cache_dir_index() -> dict[str, dict[str, str]]:
|
||||
for path in sub.rglob(f"*.{ext}"):
|
||||
bucket[ext] = str(path.relative_to(PROJECT_ROOT))
|
||||
break # only the first hit per ext is enough
|
||||
# Surface the auto-extracted absolute_layout template if present.
|
||||
# Agents read this YAML as the spec scaffold (Oracle's canonical
|
||||
# geometry) — generated by tools/archcenter_drawio_to_template.py.
|
||||
template = sub / "_template.yaml"
|
||||
if template.is_file():
|
||||
bucket["yaml"] = str(template.relative_to(PROJECT_ROOT))
|
||||
if bucket:
|
||||
index[sub.name] = bucket
|
||||
|
||||
@@ -265,9 +271,16 @@ def _build_cache_dir_index() -> dict[str, dict[str, str]]:
|
||||
|
||||
|
||||
def _cached_assets(entry: dict) -> dict:
|
||||
"""Find .drawio / .png / .svg if a matching folder is cached locally.
|
||||
Served from the one-shot in-memory index built by
|
||||
``_build_cache_dir_index``."""
|
||||
"""Find .drawio / .png / .svg / _template.yaml if a matching folder
|
||||
is cached locally. Served from the one-shot in-memory index built
|
||||
by ``_build_cache_dir_index``.
|
||||
|
||||
The ``yaml`` key (when present) points to ``_template.yaml`` — the
|
||||
auto-extracted absolute_layout scaffold from
|
||||
``tools/archcenter_drawio_to_template.py``. Agents should copy this
|
||||
YAML as the starting point for a new spec instead of falling back
|
||||
to ``examples/`` (which is forbidden as a geometry source).
|
||||
"""
|
||||
cache_index = _build_cache_dir_index()
|
||||
if not cache_index:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user