Resolve a `--args` value to its JSON text. `--args` is a *whole-payload argument (the value IS the object), so it follows the same convention as `memory curate --llm-ops`: `-` reads stdin and any non-inline value is a file path — a plain path "just works" without the `@` sigil that per-key values need. Inline JSON (starting `{`/`[`) is returned verbatim; `@file` and `@-` stay valid as back-compat
(
raw: &str,
read_stdin: &mut impl FnMut() -> Result<String>,
)
| 553 | /// values need. Inline JSON (starting `{`/`[`) is returned verbatim; `@file` |
| 554 | /// and `@-` stay valid as back-compat aliases so existing scripts keep working. |
| 555 | fn resolve_args_payload( |
| 556 | raw: &str, |
| 557 | read_stdin: &mut impl FnMut() -> Result<String>, |
| 558 | ) -> Result<String> { |
| 559 | let trimmed = raw.trim_start(); |
| 560 | if raw == "-" { |
| 561 | read_stdin() |
| 562 | } else if trimmed.starts_with('{') || trimmed.starts_with('[') { |
| 563 | Ok(raw.to_string()) |
| 564 | } else if raw.starts_with('@') { |
| 565 | resolve_at_file(raw, read_stdin) |
| 566 | } else { |
| 567 | std::fs::read_to_string(raw).map_err(|e| TraceDecayError::Config { |
| 568 | message: format!( |
| 569 | "--args: `{raw}` is not inline JSON, `-` (stdin), or a readable file: {e}" |
| 570 | ), |
| 571 | }) |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | /// Coerce a CLI string value to the JSON type declared in the property schema. |
| 576 | /// Falls back to a JSON string when the schema is absent or specifies an |
no test coverage detected