pi-local-session-dir1.0.0
Pi extension: /local_ses_dir sets a project's session directory in .pi/settings.json
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
pi-local-session-dir
A pi extension that adds a /local_ses_dir command for setting the session directory of the current project.
It writes sessionDir into the project-level .pi/settings.json and keeps every other field untouched.
Install
pi install npm:pi-local-session-dir
Try it for a single run without saving it to your settings:
pi -e npm:pi-local-session-dir
Usage
/local_ses_dir # use the default directory: .pi/sessions
/local_ses_dir my/sessions # use the relative directory my/sessions
- Only paths relative to the current working directory are accepted; absolute paths are rejected with an error.
\is normalized to/, and a leading./, repeated/, and trailing/are cleaned up.- Arguments are completed from the subdirectories of the directory you are typing in.
- If
.pi/settings.jsonalready exists but is not valid JSON, the command refuses to write so your settings are not destroyed.
sessionDir is read once at pi startup, so restart pi (or start a new pi process) after running the command.
Result
Running /local_ses_dir my/sessions produces:
{
"sessionDir": "my/sessions"
}
Existing keys in .pi/settings.json (for example extensions or packages) are preserved.
Development
This repository is also the working copy of the extension. npm pack --dry-run shows the published tarball contents, and .pi/settings.json loads the extension from extensions/local-ses-dir.ts via extensions: ["../extensions/local-ses-dir.ts"].
License
MIT