Unify frontmatter imports as import bind:target and drop > imports.

`import json:lib/json.mq.md` binds file libraries; `import fmt:time.format`
binds member short names (replaces `> use`). Legacy `> path.mq.md` / `> use`
now hard-error with a hint. Migrates repo docs, skills, ext, lib, public, examples,
man-test and tests; adds a negative gold and updates view/catalog rendering.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-13 10:03:21 +08:00
1 parent 56b9bfa5a3
commit ecc92f473a
163 files changed
+577 -593

No files matched your search

+4 -8
View File
@@ -200,18 +200,14 @@ pub fn render_module_structure_mode(
let writebacks = writeback::writeback_map(source);
let mut out = String::new();
if !module.imports.is_empty() {
if !module.imports.is_empty() || !module.uses.is_empty() {
out.push_str("<div class=\"card\"><span class=\"badge\">import</span>");
for imp in &module.imports {
let label = format!("{} as {}", imp.path, imp.bind);
let label = format!("{}:{}", imp.bind, imp.path);
out.push_str(&format!("<span class=\"chip\">{}</span>", escape(&label)));
}
out.push_str("</div>");
}
if !module.uses.is_empty() {
out.push_str("<div class=\"card\"><span class=\"badge\">use</span>");
for u in &module.uses {
let label = format!("{} as {}", u.path.join("."), u.bind);
let label = format!("{}:{}", u.bind, u.path.join("."));
out.push_str(&format!("<span class=\"chip\">{}</span>", escape(&label)));
}
out.push_str("</div>");
@@ -1502,7 +1498,7 @@ mod tests {
#[test]
fn structure_omits_imported_lib_bodies() {
let src = "---\ntitle: t\n> lib/text.mq.md\n---\n\n# main\n\n> print text=hi\n";
let src = "---\ntitle: t\nimport text:lib/text.mq.md\n---\n\n# main\n\n> print text=hi\n";
let local = crate::parse::parse_source(src).unwrap();
let html = render_module_structure(&local, src);
assert!(html.contains("badge\">import"), "{html}");