3.5 KiB
Copilot instructions for openstreetbrowser-categories-main
This file gives succinct, actionable guidance for AI coding agents working in this package.
-
Big picture: this package defines map category descriptors as YAML files. Each category YAML contains metadata for the UI (localized
name), an Overpass-stylequery, afeatureJinja template (controls title/description/marker/style) and aconstsection mapping tag-derived keys (e.g.piste:type=ice_skate) to rendering details. -
Key files/locations:
- Category examples:
ice_skating.yaml(root of this package). - Translations helper:
lang/README.md(contains rules for copying translation entries into categories).
- Category examples:
-
YAML + Jinja pattern:
- Templates use Jinja-like expressions inside YAML block scalars (
feature.pre,feature.title,feature.body, etc.). - Common template helpers used in files:
attribute(tags, '...'),localizedTag(tags, '...'),tagTrans(key,value),keyTrans(...), andmarkerPointer()/markerCircle()helpers. - Be careful with quoting and nested braces; preserve existing whitespace and indentation when editing.
- Templates use Jinja-like expressions inside YAML block scalars (
-
Query conventions:
typeis frequentlyoverpassandqueryholds Overpass QL blocks. Look atice_skating.yamlfor examples combiningway[...],node[...], and boolean filters.- Category queries intentionally avoid overlap with other category packages (see inline comments). When updating queries, maintain such exclusions and add TODO comments for unresolved tagging patterns.
-
Rendering conventions:
constkeys usetag=valuestrings (e.g.piste:type=ice_skate) to map tosymbol,style,sign, andpriority.feature.preusually resolves whichkey/valuepair applies and setsconstIndex = (key ~ "=" ~ value)to lookupconst[constIndex].markerSignmay include raw HTML (icons).markerSymbol/listMarkerSymbolchoose display helpers based onitem.symbol.- Respect
restricted_access_valuelogic: values likeno,private,discouragedshould gray-out markers (#7F7F7F) and change behavior in templates.
-
When adding a new category YAML:
- Copy an existing file (e.g.
ice_skating.yaml) as the minimal scaffold:name,type,query,feature,const. - Implement
feature.preto deterministically setkeyandvaluethen lookupconstvia theconstIndexpattern. - Keep UI strings via
localizedTag/tagTransrather than hardcoding text.
- Copy an existing file (e.g.
-
Project-specific patterns for AI:
- Prefer read-only edits first: update
conststyles orfeaturetemplates without changing query logic unless necessary. - Preserve TODO comments in queries — they encode tagging ambiguity and cross-package concerns.
- Use existing helper names (
markerPointer,markerCircle,tagTrans) rather than inventing new ones.
- Prefer read-only edits first: update
-
Testing / validation (discoverable):
- There are no unit tests in this package. Validate changes by comparing rendered template outputs in a running OpenStreetBrowser instance (manual step outside this package).
- For syntax safety, run a YAML linter and ensure Jinja blocks remain properly indented and quoted.
-
Examples to inspect:
ice_skating.yaml: demonstrates query composition,feature.prelogic,constmappings, localizedname, and marker styling.lang/README.md: describes how translations inlang/are applied to categories.
If anything here is unclear or you want the instructions tailored to a different contributor workflow, tell me which parts to expand or examples to add.