feat(cli): check --refs validates Markdown reference targets

Blueprint section 4.2: reference edges are static, never execution.

- For every loaded document, resolve same-document anchors, relative file
  links and target anchors (analysing referenced files statically without
  executing them); unresolved targets produce `ref.unresolved` errors with
  source spans.
- External HTTP(S) links are treated as external references, not errors.
- `inspect --refs` continues to print the resolved edge graph as JSON.
This commit is contained in:
cflmy committed 2026-11-20 10:51:54 +08:00
1 parent dbecf8d019
commit 33341a0e92
2 files changed
+47 -4

No files matched your search

+4 -1
View File
@@ -149,6 +149,9 @@ struct CallArgs {
struct CheckArgs {
/// Document to check (defaults to index.mq.md).
file: Option<PathBuf>,
/// Also validate Markdown reference/link targets (`check --refs`).
#[arg(long)]
refs: bool,
/// Machine readable JSON output.
#[arg(long)]
json: bool,
@@ -259,7 +262,7 @@ fn main() {
let cli = Cli::parse();
let code = match cli.command {
Command::Init(args) => commands::init(args.dir.as_deref()),
Command::Check(args) => commands::check(args.file.as_deref(), args.json),
Command::Check(args) => commands::check(args.file.as_deref(), args.json, args.refs),
Command::Inspect(args) => {
let flags = commands::InspectFlags {
ast: args.ast,