feat(yaml): Kubernetes/CRD-aware YAML support with semantic search#73
Open
M0Rf30 wants to merge 2 commits into
Open
feat(yaml): Kubernetes/CRD-aware YAML support with semantic search#73M0Rf30 wants to merge 2 commits into
M0Rf30 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
2 issues found across 17 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Register LangId::Yaml end-to-end: tree-sitter-yaml grammar, extension detection (yaml/yml), and the semantic-index allowlist so manifests are embedded for aft_search. extract_yaml_symbols walks each document in a stream: - Tier 1 (k8s): docs with apiVersion+kind emit one rich symbol named <ns>/<Kind>/<name> with enriched signature (image, ports) feeding embed_text. Generalizes to CRDs via the apiVersion+kind contract. - Tier 2: generic YAML emits top-level keys as Variable symbols. Multi-doc (---) streams handled per-document; templated docs degrade gracefully. Wire LangId::Yaml across all match sites (parser, format, imports, calls, indent, inspect scanners, configure, outline, manager). Add 5 unit tests. README table updated.
…lows Flatten high-signal nested spec fields into embed_text so semantic queries match on intent: - resource limits/requests (cpu, memory, storage) - RBAC rules (verbs, resources, apiGroups) — sequences comma-joined - volumeMounts (mountPath), replicas - env var names via name-key collection (env=A,B) - Argo Workflow fields: entrypoint, templates (named-item collection), command, args, schedule (covers Workflow/CronWorkflow/WorkflowTemplate and any CRD via the apiVersion+kind contract) Fixes: - yaml_unwrap() peels block_node/flow_node wrappers so sequence/mapping detection actually fires (was dumping raw multi-line YAML before) - yaml_flatten_value returns empty for mapping values (no raw dumps); leaf scalars collected separately - metadata.generateName fallback for Argo workflows submitted without a fixed name Add 5 unit tests (resource limits, env names, RBAC, Argo workflow, generateName). 10 YAML tests total, all green. README documents the enrichment.
516804e to
33542af
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds YAML language support with Kubernetes/CRD-aware semantic symbols, so
aft_search,aft_outline, andaft_zoomwork on manifests and Argo Workflows.YAML was previously unsupported (only HTML/Markdown/JSON among the query-less languages). This wires
LangId::Yamlend-to-end and — critically — addsyaml/ymlto the semantic-index allowlist so manifests are actually embedded foraft_search.Design: two-tier extractor
apiVersion+kindbecomes one rich symbol named<namespace>/<Kind>/<name>(falls back tometadata.generateName). Generalizes to any CRD for free, since apiVersion+kind is the CRD contract.values.yaml) emits top-level keys asVariablesymbols.---) streams handled per document; templated/un-parseable docs degrade gracefully rather than failing the file.Semantic enrichment (the part that makes search useful)
Symbols are not raw text — the embed text is enriched with high-signal spec fields so intent queries match:
image/ portscpu/memorylimits & requestsvolumeMounts(mountPath),replicasenv=A,B)verbs/resources/apiGroupsentrypoint/templates/command/args/schedule(coversWorkflow/CronWorkflow/WorkflowTemplate)Example outputs (from the real binary):
Implementation notes
tree-sitter-yamlgrammar dep.yaml_unwrap()peels tree-sitter-yaml'sblock_node/flow_nodevalue wrappers (without it, sequence/mapping detection never fires and raw multi-line YAML leaks into embed text).yaml_flatten_valuecomma-joins sequences and returns empty for nested mappings (leaf scalars collected separately).LangId::Yamlwired across all match sites (parser, format, imports, calls, indent, inspect scanners, configure, outline, manager).Tests
10 unit tests covering: k8s resource naming, namespace/no-namespace, multi-doc, generic fallback, empty, resource limits, env names, RBAC rules, Argo workflow, generateName fallback. All green.
Notes / open questions for maintainers
SymbolKindchoice (currentlyClassfor resources), or the enrichment key set to match project conventions.specflattening is intentionally scoped to high-signal keys; broader/Helm-template-aware parsing is deferred.Need help on this PR? Tag
@codesmithwith what you need. Autofix is disabled.Summary by cubic
Adds YAML language support with Kubernetes/CRD-aware semantic symbols so
aft_search,aft_outline, andaft_zoomwork on manifests and Argo Workflows. YAML files (.yaml,.yml) are now semantically indexed across the toolchain.New Features
generateNamefallback; applies to any CRD.yaml/ymladded to the semantic index allowlist.Dependencies
tree-sitter-yaml(v0.7.2).Written for commit 33542af. Summary will update on new commits.