[#2] Add slugify() string helper #3
No reviewers
Labels
No labels
agent-failed
agent-working
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jleicher/aitonomous!3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "agent/issue-2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds
slugify(input: string): stringinsrc/slugify.ts— a self-containedhelper that converts free-form text to a URL-safe slug:
Seven tests in
src/slugify_test.tscover all five acceptance criteria fromthe spec plus two regression cases discovered during review (see below).
deno task ciis green.Step ordering — why delete first, then collapse
The intuitive order (spaces → dashes, then strip non-alnum) introduced a
correctness bug found during self-review: a non-ASCII character flanked by
dashes (e.g.
"a-é-b") acts as a barrier in the collapse pass, so the twosurrounding dashes are never merged. When the character is deleted in the next
pass, two adjacent dashes remain with nothing left to collapse them.
The fix reorders to: delete non-slug chars first (keeping spaces), then
collapse all separator runs. After deletion, any consecutive dashes are visible
to the collapse pass and are merged correctly. Two regression tests pin this
behaviour:
"a-é-b"→"a-b"and"-é-a"→"a".Residual findings / deliberate omissions
—,–, etc.) are deleted rather than converted todashes. The spec explicitly lists only ASCII spaces as separator inputs and
says to delete non-
[a-z0-9-]characters. Treating Unicode punctuation asword separators is out of scope.
é → e) is explicitly out of scope per the spec("Comportement figé : on supprime les non-ASCII").
Closes #2
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.