README file from
GithubNewest Files
Newest Files is a local Obsidian plugin that lists the newest files added to the vault, including attachments and other non-Markdown files that have never been opened.
Behavior
- Registers a sidebar view named
newest-files-view. - Uses
app.vault.getFiles()so Markdown files and attachments are part of the same list. - Maintains a plugin-managed first-seen index in this plugin's
data.json. - Handles Obsidian vault events for create, delete, rename and modify.
- Opens files with Obsidian's native
workspace.openFile()behavior. - Renders a compact sidebar row as optional timestamp, filename and a subtle extension label.
- Uses Obsidian CSS variables so the view follows the active theme.
First-seen index
For files created while the plugin is active, the first-seen timestamp is recorded from the live create event. Existing files need a backfill value because Obsidian cannot reconstruct the historical moment they were added to the vault. Backfilled entries use either the file created timestamp or modified timestamp, depending on the setting.
This means:
- Live additions are the most reliable source for "newest added".
- Initial backfill is an approximation.
- Editing a file updates its metadata but does not change its first-seen timestamp.
- Renaming a file preserves the original first-seen timestamp.
Settings
- Maximum files: number of list items shown.
- Show timestamps: show or hide the leading
HH:mmcolumn. - Sort source: first-seen index or modified time.
- Backfill timestamp: created or modified timestamp for existing files.
- Extension filter: optional list such as
md pdf png xlsx. - Excluded paths: path prefixes such as
.trash/ornode_modules/.
Development
npm install
npm run build
npm run sync:test-vault
npm run lint
npm run typecheck
npm test
npm run smoke:cdp
npm run community:check
The generated main.js, manifest.json and styles.css are the files Obsidian loads from the plugin folder.
Sync to the Windows-local test vault
Use the sync command to build and copy the runtime artifacts to the Windows-local test vault only:
npm run sync:test-vault
Default target:
/mnt/c/Users/viggo/github/obsidian-test-vault/.obsidian/plugins/newest-files
The command copies only:
main.jsmanifest.jsonstyles.css
Safety boundaries:
- Refuses any target containing
Syncthing/vault. - Refuses any target that is not inside
obsidian-test-vault/.obsidian/plugins/newest-files. - Does not write to the main Life OS vault.
Optional dry run / explicit target:
npm run sync:test-vault -- --dry-run
npm run sync:test-vault -- --target /mnt/c/Users/viggo/github/obsidian-test-vault/.obsidian/plugins/newest-files
CDP smoke route on Windows/WSL
Use this route to prove the plugin through Obsidian's real Electron UI instead of only proving that the process is open. It targets the Windows-local test vault only: C:\Users\viggo\github\obsidian-test-vault.
- Build/copy the plugin runtime into the test vault plugin folder.
- Close any Obsidian instance that was started without CDP.
- Launch Obsidian with a Chrome DevTools Protocol port:
powershell.exe -NoProfile -Command 'Start-Process "$env:LOCALAPPDATA\Programs\Obsidian\Obsidian.exe" -ArgumentList "--remote-debugging-port=9222","obsidian://open?vault=obsidian-test-vault"'
- Run the smoke:
npm run smoke:cdp
When run from WSL, the script automatically delegates to Windows Node so it can reach Obsidian's Windows-local 127.0.0.1:9222 CDP listener.
The smoke attaches to 127.0.0.1:9222 and verifies:
obsidian-test-vaultis the open vault.newest-filesis loaded.newest-files:open-newest-files-viewis registered.- The Newest Files view opens through the command.
- The refresh button is actually clicked in the rendered UI.
- Markdown and non-Markdown fixture files are visible.
- Rename, modify and delete events update the view.
The script writes JSON evidence to stdout and saves a screenshot to /tmp/newest-files-cdp-smoke-*.png by default. Override with:
npm run smoke:cdp -- --port 9223 --screenshot /tmp/newest-files-smoke.png
Community release checklist
Before submitting or publishing a community release:
npm run lint
npm run typecheck
npm test
npm run build
npm run sync:test-vault
npm run smoke:cdp
npm run community:check
GitHub release assets must include exactly the Obsidian runtime files:
main.jsmanifest.jsonstyles.css
The release tag must match manifest.json.version.