feat: filesystem-first create command and default open-type config#90
Merged
feat: filesystem-first create command and default open-type config#90
Conversation
- create command now writes files directly to disk — Obsidian no longer
needs to be running for note creation
- append, overwrite, and content flags are handled in Go; intermediate
directories are created automatically
- opening after creation is optional: Obsidian URI or $EDITOR
- add default_open_type config field ('obsidian' | 'editor') to
preferences.json
- set-default accepts --open-type flag to persist the preference; vault
name argument is now optional so open type can be set independently
- cmd/create.go falls back to configured open type when --editor is not
passed explicitly
- update README to document new create behaviour and set-default flags
- use cmd.Flags().Changed("editor") so --editor=false overrides
default_open_type=editor
- remove dead ObsCreateUrl/createAction constants
- add unit tests for DefaultOpenType() and SetDefaultOpenType()
- add DefaultOpenType() to VaultManager interface and mock
- open, search, search-content, and move commands now fall back to the configured default_open_type when --editor is not explicitly passed - open command gains --editor/-e flag and editor support in the action - add tests for open action with UseEditor - update README to list open alongside other editor-capable commands
…irst daily command - Create command now reads .obsidian/app.json to determine the default folder for new notes (when note name has no explicit path) - Daily command rewritten to create notes on disk instead of delegating to obsidian://daily URI, reading .obsidian/daily-notes.json for folder, date format, and template settings - Daily command now supports --editor flag and respects default_open_type - Added Moment.js to Go time format conversion for daily note naming - Removed unused OnsDailyUrl constant
…ltFolder - Extract resolveUseEditor() into cmd/editor.go to eliminate duplicated editor flag + config fallback boilerplate across 6 commands - Export WriteNoteFile and reuse it in daily.go instead of raw os.WriteFile - Move ApplyDefaultFolder from pkg/actions/create.go to pkg/obsidian/config.go where it belongs alongside DefaultNoteFolder
…terface type - Emit a stderr warning when --section and --editor are both passed to the open command, since editors cannot navigate to markdown headings - Remove the dd Moment.js token mapping which produced a static "Mo" literal instead of a dynamic weekday abbreviation (no Go equivalent) - Change resolveUseEditor parameter from concrete *obsidian.Vault to obsidian.VaultManager interface for consistency and testability
…with args - WriteNoteFile append path now checks f.Close() for errors instead of deferring it, preventing silent data loss on flush failure - OpenInEditor now splits the EDITOR env var into command + arguments using strings.Fields, so values like "code -w" work correctly instead of being treated as a single binary name
- Bump version from v0.3.0 to v0.3.1 - Regenerate docs/usage.png with updated command descriptions - print-default now also displays the configured default open type
…tests - WSL vault path tests used vault names that didn't match path suffixes (getPathForVault uses HasSuffix on path, not map key lookup) - Config obsidian path test didn't create the config file on disk, so os.Stat failed on non-Linux platforms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createcommand: Notes are now written directly to disk — Obsidian does not need to be running. Supports--content,--overwrite,--append, and--openflags.createcommand reads.obsidian/app.jsonto determine the configured default folder for new notes. When the note name has no explicit path (no/), the note is placed in that folder. Falls back to vault root if config is missing.dailycommand: Daily notes are now created on disk instead of delegating toobsidian://daily. Reads.obsidian/daily-notes.jsonforfolder,format(Moment.js date format), andtemplatesettings. Falls back to sensible defaults.default_open_type: Newset-default --open-typeflag lets users choose betweenobsidianandeditoras default open behavior. All editor-capable commands respect this setting.--editorflag on all commands: Added--editor/-eflag toopenanddailycommands (previously only onsearch,search-content,create,move). All commands now support config fallback viadefault_open_type.resolveUseEditor()helper to eliminate duplicated editor flag boilerplate across 6 commands. ExportedWriteNoteFilefor reuse. MovedApplyDefaultFoldertopkg/obsidian/config.go.ObsCreateUrl,OnsDailyUrl, andcreateActionconstants. Removed unsupportedddMoment.js token mapping.--sectionflag now emits a warning when used with--editor(editors cannot navigate to markdown headings).How to test
Test plan
🤖 Generated with Claude Code