feat: add global loop tasks — dual ~/.pi-loop.json and local .pi-loop.json - #2
Open
ta3pks wants to merge 1 commit into
Open
feat: add global loop tasks — dual ~/.pi-loop.json and local .pi-loop.json#2ta3pks wants to merge 1 commit into
ta3pks wants to merge 1 commit into
Conversation
….json Adds a 'global' field to LoopTask. When true, persists to ~/.pi-loop.json instead of the CWD-based .pi-loop.json. On startup both files are loaded and merged (skips global path when CWD == $HOME to avoid dupes). cron_create accepts a new optional 'global' (bool) parameter. No tree walking — just local CWD + global $HOME.
Author
|
👋 gentle bump — this has been tested and is working well on our end. Any interest in reviewing? Happy to address any feedback. |
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 a
globalfield toLoopTask. Whentrue, the task persists to~/.pi-loop.jsoninstead of the CWD-based.pi-loop.json. Thecron_createtool accepts a new optionalglobal(boolean) parameter.How it works
session_start, reads tasks from both{cwd}/.pi-loop.json(local) and~/.pi-loop.json(global). No recursive tree walk — just two well-known locations.global: truego to~/.pi-loop.json; others go to{cwd}/.pi-loop.json. Empty files are cleaned up.Changes
src/types.tsglobal?: booleantoLoopTasksrc/store.tsloadDurableTasks/writeDurableTasks,isGlobalarg onacquireLock/releaseLocksrc/index.tssession_startloads from both paths and acquires both locks;session_shutdownreleases bothsrc/tools/cron-tools.tscron_createacceptsglobalparamUse case
This task persists to
~/.pi-loop.jsonand fires regardless of which directory pi runs from.