Skip to content

feat: add devlog tags command for tag management - #20

Merged
kacheo merged 4 commits into
mainfrom
claude/app-exploration-features-bbYfP
Jun 7, 2026
Merged

kacheo merged 4 commits into
mainfrom
claude/app-exploration-features-bbYfP

Conversation

@kacheo

@kacheo kacheo commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Adds three new capabilities:

  • devlog tags [list] — list all tags with per-day usage counts, sorted by
    frequency then alphabetically; supports --json for machine-readable output
  • devlog tags rename <old> <new> — rename a tag across all day files with
    case-insensitive matching, preserving tag order and unaffected files
  • Store.AllDates() — scans the journal dir for YYYY-MM-DD.md files,
    returns dates sorted oldest-first; reused by both ListTags and RenameTag

All functionality written TDD: tests were written first (22 new tests across
store and cmd packages) and the implementation written to make them pass.

https://claude.ai/code/session_012VD25qMzTC7GEYqYvCPP6Z

claude added 4 commits June 7, 2026 22:00
Adds three new capabilities:
- `devlog tags [list]` — list all tags with per-day usage counts, sorted by
  frequency then alphabetically; supports --json for machine-readable output
- `devlog tags rename <old> <new>` — rename a tag across all day files with
  case-insensitive matching, preserving tag order and unaffected files
- `Store.AllDates()` — scans the journal dir for YYYY-MM-DD.md files,
  returns dates sorted oldest-first; reused by both ListTags and RenameTag

All functionality written TDD: tests were written first (22 new tests across
store and cmd packages) and the implementation written to make them pass.

https://claude.ai/code/session_012VD25qMzTC7GEYqYvCPP6Z
Updates CHANGELOG, README, user guide, and AGENT_INSTRUCTIONS to cover
the new tags list and tags rename subcommands — including terminal output
format, JSON schema, jq patterns, filtering workflow, and key behaviors
(case-insensitive match, per-day counts, atomic rename).

https://claude.ai/code/session_012VD25qMzTC7GEYqYvCPP6Z
Bug fix:
- RenameTag now deduplicates tags after rename, preventing [auth, oauth]
  + rename auth→oauth from producing [oauth, oauth]

Validation:
- RenameTag returns an error for empty old or new tag strings

New tests (store):
- TestRenameTag_NewTagAlreadyPresent — dedup when newTag already in entry
- TestRenameTag_NewTagAlreadyPresent_PreservesFirst — first-seen wins after dedup
- TestRenameTag_EmptyOldTag / TestRenameTag_EmptyNewTag — empty string guards
- TestAllDates_NonExistentDir — non-existent dir returns empty, not error

New tests (render):
- TestTagsTerminal_Empty / TestTagsTerminal_ShowsTagsAndCounts
- TestTagsJSON_EmptySlice / TestTagsJSON_Schema / TestTagsJSON_PreservesInputOrder

New tests (cmd):
- TestTagsRenameCmd_DeduplicatesWhenNewTagAlreadyPresent
- TestTagsRenameCmd_CaseInsensitive

https://claude.ai/code/session_012VD25qMzTC7GEYqYvCPP6Z
Tags must now match [a-z0-9_]+ at write time:
- devlog add --tag rejects uppercase, hyphens, spaces, and empty strings
- devlog tags rename rejects an invalid new tag name (old tag still
  matched case-insensitively to handle pre-existing legacy tags)

Implementation:
- store.ValidateTag() — single validation function with compiled regexp
- Wired into cmd/add.go (before Modify) and cmd/tags.go (before RenameTag)

Tests (TDD — written before implementation):
- TestValidateTag_Valid / TestValidateTag_Invalid (9 valid, 8 invalid cases)
- TestAddCmd_RejectsUppercaseTag / RejectsHyphenatedTag / RejectsEmptyTag
- TestTagsRenameCmd_RejectsInvalidNewTag

Docs updated: user-guide.md add section, tags rename section; AGENT_INSTRUCTIONS key behaviors.

https://claude.ai/code/session_012VD25qMzTC7GEYqYvCPP6Z
@kacheo
kacheo merged commit aee0a20 into main Jun 7, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants