feat: configurable save directories via environment variables#1
Open
glassdimly wants to merge 1 commit intolearningpro:mainfrom
Open
feat: configurable save directories via environment variables#1glassdimly wants to merge 1 commit intolearningpro:mainfrom
glassdimly wants to merge 1 commit intolearningpro:mainfrom
Conversation
Add OPENCODE_AUTOSAVE_DIR and OPENCODE_AUTOSAVE_GLOBAL_DIR environment variables to control where conversations are saved. Either location can be set to a custom path or disabled entirely by setting the value to 'false'. This allows users to: - Disable local project saves (avoid polluting project directories) - Redirect global saves to a custom location (e.g. ~/Notes/) - Disable either or both save locations independently All defaults remain unchanged for backward compatibility.
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
Adds two environment variables to control where conversations are saved, allowing users to customize or disable either save location:
OPENCODE_AUTOSAVE_DIR— Local (project-level) save directory. Defaults to./conversations. Set tofalseto disable local saves entirely.OPENCODE_AUTOSAVE_GLOBAL_DIR— Global (secondary) save base directory. Defaults to~/.conversations. The project name is appended as a subdirectory automatically. Set tofalseto disable.Motivation
Currently both save paths are hardcoded, which means:
./conversations/directory created in the project root, which can pollute repos and requires.gitignoreentries~/.conversations/) can't be redirected to a preferred location (e.g.~/Notes/conversations/)This is a common pain point — for example, users who only want a single centralized archive have to manually patch the plugin's
dist/index.jsafter everynpm install.Changes
src/types.ts: AddedresolveConfig()that reads env vars and builds config withlocalEnabled/globalEnabledflags and custom pathssrc/file-manager.ts:getGlobalSaveDirectory()now accepts config and uses the configured base directorysrc/index.ts: Plugin init respectslocalEnabled; skips local directory creation and writes when disabled. Both save locations nullable throughout.README.md: Documented the new environment variables with usage examplesBackward Compatibility
All defaults are unchanged. With no env vars set, behavior is identical to v1.1.0.