Skip to content
GitHub

Organize large bundles: tags, renames, links, checks

Organize large bundles: tag cleanup, fix broken links, okf maintenance

Tags, links and drift stay under control as a bundle grows: each upkeep command previews its change first, and okf check reports what is left. The output below comes from okf 0.2.5 on a throwaway copy of the test catalogue.

Set it up

  1. Put the catalogue under git and commit. Every command below then lands as one reviewable diff. rename also stages its move with git mv.
  2. Run the command without --apply. The preview is a unified diff plus a summary line.
  3. Run it again with --apply, then review git status and git diff.

Work through it

List tags that occur once, then check a tag against the registry:

Audit tags
$ okf tags --singletons
bread 1
deploy 1
incident 1
misc 1
pasta 1
security 1
x-experimental 1
[exit 0]
$ okf tags --validate misc governance
UNKNOWN misc
1 UNKNOWN — register with: okf tags --register <tag> "<description, max 150 chars>"
[exit 4]

Fold a stray tag into a registered one. This is the preview:

okf merge-tags misc --into governance
$ okf merge-tags misc --into governance
--- a/recipes/stew.md
+++ b/recipes/stew.md
@@ -4,7 +4,7 @@
beschreibung: Deutscher Eintopf
tags:
- food
- - misc
+ - governance
superseded_by: handbook/ops/deploy
---
unparseable handbook/broken-yaml.md (frontmatter does not parse: did not find expected ',' or ']' (line 3, column 9) — skipped)
merge-tags: 1 file(s) would rewrite, 1 unparseable — misc -> governance
[exit 0]

Add --apply to write. okf normalize-tags converts inline tags: [a, b] to the block list in the same way; it lists the files it would rewrite and ends with normalize-tags: 3 file(s) would rewrite, 1 unparseable on the test catalogue.

Details: Tags and registry, okf merge-tags, okf normalize-tags.

What you get

A bundle whose tags are registered and in block form, whose links use one form and point at existing concepts, and whose okf check run lists only the findings you decided to keep. Each step is one git diff.

Limits

  • Dry run differs per command: see the caution above and Safe edits.
  • One refused file ends a whole tag run [n760].
  • After rename --apply of a canon owner, consumer copies keep the old path in the > [!quote] line and sync-status can still say synced [6peo]. Run okf sync-update --apply.

Reference