ai-devkit icon indicating copy to clipboard operation
ai-devkit copied to clipboard

Sort docs folder filenames by date

Open hiiamtrong opened this issue 8 months ago • 3 comments

Problem

When multiple phase documents exist in the docs/ai/ subdirectories (e.g. requirements/, design/, planning/), there is no consistent date-based ordering for filenames. This makes it difficult to track the chronological evolution of documents and identify the most recent files at a glance.

Proposed Solution

Add a date prefix convention (e.g. YYYY-MM-DD-) to generated filenames, so files are naturally sorted by date in file explorers and directory listings.

Example:

docs/ai/requirements/
  2026-03-01-initial-requirements.md
  2026-03-10-updated-auth-requirements.md

Alternatively, sort/list files by modification date when reading the docs/ai/ directory tree.

Expected Behavior

  • Files within each docs subdirectory should be presented in chronological order
  • The most recent document should be easy to identify without checking file metadata

Additional Context

This would improve the AI-assisted development workflow by making it clearer which documents represent the latest state of requirements, design, or planning decisions.

hiiamtrong avatar Mar 16 '26 08:03 hiiamtrong

The core issue is that filename generation likely doesn't prepend a date prefix, so files sort alphabetically by their semantic name rather than chronologically — in a typical AI-assisted doc generation flow, the filename is derived purely from the document title or phase name. The "read directory tree" path (wherever docs/ai/ subdirectories are listed or surfaced to the AI context) probably uses a default filesystem glob with no explicit sort order, so the ordering is effectively undefined across OS/filesystem combinations. Adding a YYYY-MM-DD- prefix at generation time is the most robust fix since it makes ordering deterministic without relying on mtime metadata, which can be unreliable after clones or copies. Worth checking the file-naming logic in whatever generates the initial document stubs — that's the single place where a new Date().toISOString().slice(0, 10) insertion would propagate consistently.

JiwaniZakir avatar Apr 17 '26 06:04 JiwaniZakir

I like this idea

linhvuquach avatar Apr 17 '26 13:04 linhvuquach

Thanks for sharing ideas, this has been added in https://github.com/codeaholicguy/ai-devkit/releases/tag/cli%400.34.0

codeaholicguy avatar May 25 '26 20:05 codeaholicguy