Skip to main content

Module suggest

Module suggest 

Source
Expand description

SRD-85 deep workload suggestions — the shared “did you mean” set over the local file hierarchy and the bundled catalog, used by completion and the resolver not-found paths. Deep workload suggestions — the shared “did you mean” set.

When an exact workload reference misses, three callers want the same answer: the shell-completion provider (nmbrs::completion) as its fallback, and the resolver’s not-found paths (nmbrs_runtime::runner::resolve_workload, crate::verify::verify_target, nmbrs::copy_cmd) as the suggestion tail on the error. Each asks the same question — every workload whose final name segment begins with what the operator typed — over the local file hierarchy and the bundled catalog.

Leaf-segment matching is the point: it is what makes a bare phase_poll surface a buried examples/controls/phase_poll_smoke. The catalog carries the namespace; the operator types the stem. A slash-qualified partial (examples/controls/phase_poll) still matches by full-reference prefix, so both habits work.

The local walk descends [MAX_DEPTH] directory levels below the start directory (the operator’s cwd); the bundled catalog is a flat namespace with no depth bound. SRD-85 makes the catalog the discovery surface, so a suggestion drawn from it is always runnable by the name shown.

Constants§

MAX_DEPTH
Directory levels the local walk descends below the start directory. A file at a/b/c/<name>.yaml is the deepest reached at the default of 3. The bundled catalog is flat and not subject to this bound.

Functions§

did_you_mean
Render a hit list (from suggest_workloads / suggest_bundled) as a human “did you mean” tail, ready to append to an error message: Did you mean: a, b? for a short list, or Did you mean one of: a, b (+N more — \nmbrs describe workloads –all`) when capped at [MAX_LISTED]. Empty string when hits` is empty, so callers can append it unconditionally.
suggest_bundled
Catalog-only matches, for callers that run bundled names exclusively (nmbrs copy): suggesting a local file there would name something the command cannot act on.
suggest_workloads
Every workload reference matching partial by leaf segment (or by full-reference prefix), drawn from the local file hierarchy below the current directory (down to MAX_DEPTH levels) and the bundled catalog. Sorted and deduped.