ontoref/reflection/migrations/0007-card-repo-field.ncl

31 lines
1.2 KiB
Plaintext
Raw Normal View History

{
id = "0007",
slug = "card-repo-field",
description = "Add repo field to card.ncl for UI file-path navigation to the project repository",
check = {
tag = "NuCmd",
cmd = "let f = $\"($env.ONTOREF_PROJECT_ROOT)/card.ncl\"; if not ($f | path exists) { exit 0 }; let r = (do { ^rg -q 'repo\\s*=' $f } | complete); if $r.exit_code == 0 { exit 0 } else { exit 1 }",
expect_exit = 0,
},
instructions = "
Open card.ncl and add a repo field pointing to the project source repository.
The field must be a full URL (Gitea, GitHub, Sourcehut, etc.).
Example:
repo = \"https://repo.example.com/owner/project\",
The daemon injects this value as card_repo into every Tera template.
srcOpen() in graph, search, and api_catalog pages uses it to build the URL:
{repo}/src/branch/main/{path}
If the project also publishes cargo docs, add:
docs = \"https://docs.example.com/project\",
That value is injected as card_docs. For .rs file paths, srcOpen() opens
docs instead of the source file (cargo doc output is more useful than raw source).
Verify card.ncl still exports cleanly:
nickel export --import-path \"$NICKEL_IMPORT_PATH\" card.ncl > /dev/null && echo ok
",
}