Shared interface design
Output Path Template Resolver
The output path template resolver provides one common way for output-producing commands to build safe relative folders and filenames from fixed strings, project parameters, command context, and the current processed variant.
Interface Ownership
Rationale
SVG, design JSON, BOM, PnP, and JLC outputs all need project-specific naming. Keeping this logic in one module avoids command-local string replacement rules and makes release folder naming testable.
Purpose
Resolve Altium-style concatenation expressions and brace templates into
strings, single output names, or safe relative output paths. Project
parameters supply values such as Revision,
RevisionMinor, PartNumberPCB,
PartNumberPCBA, and Title. The runtime
VariantName token represents the variant currently being
processed.
Test Requirements
Rack L0 tests exercise literal and parameter concatenation, brace
templates, VariantName, missing parameter policy, unsafe
filename character handling, path traversal rejection, absolute path
rejection, and Windows separator normalization.
Working Definition
The resolver is working when every output-producing command can call the same module to resolve a command-configured relative output path or file name, and the resolved value cannot escape the selected output root unless a future explicit absolute-path policy is designed and tested.
Supported Template Forms
| Form | Example | Purpose |
|---|---|---|
| Altium-style concatenation | 'releases/rev' + Revision + '.' + RevisionMinor + '/' + PartNumberPCBA |
Matches the shape used by OutJob release path expressions. |
| Brace template | {Command}/{VariantName}/{PartNumberPCB}-{OutputKind} |
Compact JSON-config-friendly form for command-specific templates. |
Safety Rules
- Resolved output paths are relative by default.
- Drive-prefixed and root-anchored paths are rejected.
.and..path components are rejected.- Invalid filename characters are replaced with underscores.
- Backslashes normalize to path separators before validation.