record-slug-rename

command
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command record-slug-rename renames every committed record file whose slug is longer than the record cap (recordid.MaxSlugLen) to the slug the minting verbs would cut today, and rewrites every reference to the old name across the tracked tree. It is the one-off half of iss-2610100626320367: the minting verbs cut new slugs at the cap, and this brings the records minted before it inside the same budget. Ids never change.

It is a maintenance tool, run by hand at the moment of landing, on a fresh default branch inside an announced window, because the rename touches records peer sessions edit all day. Nothing in CI or the Makefile runs it.

go run ./cmd/record-slug-rename            # dry run: print the plan, change nothing
go run ./cmd/record-slug-rename -apply     # rename, rewrite, stage, report; never commits

What -apply does, in order:

  1. Refuses unless the working tree is clean, so nothing uncommitted is folded into the rename.
  2. Finds every tracked record of the four families whose filenames carry a minted slug — issues, intents, specs and ADRs, every bucket — whose slug exceeds the cap, and computes the new slug with recordid.CapSlug, the same cut the minting verbs apply to a slug that arrives whole.
  3. Moves each with `git mv`, and rewrites the `slug:` field of its leading frontmatter block to the same value, so the filename and the field stay one value (record-lint's record_schema and the ledger reader compare them exactly).
  4. Rewrites every reference to an old name in every tracked text file: the name `<id-part>-<old-slug>` (iss-N-, itd-N-, spc-N-, or an ADR's bare number) where it stands whole — not glued to a letter or a hyphen before it, nor to a letter, digit or hyphen after it. The id part is in the match, so the replacement is the path's name, never the slug alone, and a repository-relative path, a relative link, a bare filename and an anchor all follow. A name glued to more text (a derived file such as `<name>-review.json`) is not a reference to the record and is left. A decision record is rewritten like any other record (spc-2610110931381316, decision 13).
  5. Stages every change (the tree was clean, so every change is the run's), leaving the commit to whoever runs it.
  6. Reports per family how many records it renamed, how many references it rewrote in how many files, and every place an old slug still appears anywhere in the tracked tree afterwards, with the reason it was left.

A second run over the committed result finds nothing to do. Exit codes: 0 done, or a dry run (leftovers are a report to read, not a failure: most are prose quoting an old slug, which names no file); 1 a fault, or a refusal (a dirty tree, a name collision, a slug field that disagrees with its filename), with nothing changed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL