Skip to content

Directory listing, sortable lists, and a modified time that means what a person means #63

Description

@wiverson

Two things an assistant cannot ask today: "what is in this folder, newest first" and "what changed this week". list_notes and list_attachments always walk the whole subtree in path order; list_folders is a flat recursive list; nothing sorts by date. And on the git backend a file's mtime is when the server pulled it, not when a person edited it, so a date sort there would be wrong even if it existed.

Features, in build order

  1. A modified column in the index meaning "when a person last changed this". For a file git knows, the last commit's author time, filled after every pull by one git log --format=%at --name-only pass (first time seen per path wins), written in one transaction. Otherwise the filesystem mtime — Obsidian Sync preserves it, and tool writes are their own time. NoteInfo gains modified as an ISO string with the vault's configured timezone offset, alongside the existing mtime number.
  2. sort, order, modifiedAfter on list_notes and list_attachments. Sort by name | modified | size; default unchanged. modifiedAfter takes an ISO instant or a bare date meaning midnight in the configured timezone; applied before paging so total is the filtered count.
  3. list_directory: one level of a folder (default root), files and folders together as { name, path, kind, modified, size }, sorted by name, modified or size, standard envelope and paging. A folder's modified is the newest item beneath it, from the index by prefix query; a folder with nothing indexed beneath it falls back to its own mtime and says so.
  4. Descriptions, annotations, catalog test, changelog: 1.3.0, thirty tools, nothing breaking.

Testing

Never let a test depend on the clock; every fixture sets its own times and asserts against them.

  • Filesystem times via fs.utimesSync; the put() helpers take an optional mtime.
  • Git commit times via GIT_AUTHOR_DATE / GIT_COMMITTER_DATE: three notes committed on three dated days, cloned and pulled; the index's modified matches the commit dates while every file's mtime is "now". This is the test that fails against a backend that trusts mtime.
  • Timezone is a setting: with Pacific/Auckland, modifiedAfter: "2026-09-05" cuts at Auckland midnight, not UTC.
  • Folder recency as a pure index query: three notes under one folder, one under another, known mtimes, ordering by newest child; the fallback case (only an oversized, unindexed note beneath) explicitly.
  • Envelope, paging and identifier fencing through the real client in the fencing suite.
  • Consistency: write through edit_note, list immediately, the listing shows the write.
  • Mutations, one per rule: sort inverted; modifiedAfter compared as UTC; folder recency from directory mtime; the git pass keeping the last time seen; the pass skipped.

Verified by hand, not by test: that ob sync preserves mtimes on a scratch instance. The live vault's dates say it does.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions