@code-fixer-23/pi-session-manager 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +76 -0
- package/assets/Pi-Session-Manager-Small.png +0 -0
- package/assets/Pi-Session_Mangager-Big.png +0 -0
- package/extensions/index.test.ts +1042 -0
- package/extensions/index.ts +966 -0
- package/package.json +37 -0
- package/project.json +64 -0
- package/scripts/create-extension.ts +18 -0
- package/tsconfig.json +27 -0
- package/vitest.config.ts +30 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 1.0.0 (2026-07-02)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- ⚠️ **pi-session-manager:** implement auto-config generation ([0613594](https://github.com/louiss0/pi-packages/commit/0613594))
|
|
6
|
+
- **pi-session-manager:** implement persistent session configuration ([04e42a0](https://github.com/louiss0/pi-packages/commit/04e42a0))
|
|
7
|
+
- **pi-session-manager:** implement session series deletion logic ([5712f3b](https://github.com/louiss0/pi-packages/commit/5712f3b))
|
|
8
|
+
- ⚠️ **pi-session-manager:** refactor session cleaning logic ([b834b1b](https://github.com/louiss0/pi-packages/commit/b834b1b))
|
|
9
|
+
- **pi-session-manager:** implement session management commands ([cba8e90](https://github.com/louiss0/pi-packages/commit/cba8e90))
|
|
10
|
+
- **pi-session-manager:** add valibot dependency ([b460670](https://github.com/louiss0/pi-packages/commit/b460670))
|
|
11
|
+
|
|
12
|
+
### 🩹 Fixes
|
|
13
|
+
|
|
14
|
+
- **pi-session-manager:** prevent duplicate session series ([efb9993](https://github.com/louiss0/pi-packages/commit/efb9993))
|
|
15
|
+
- **pi-session-manager:** update createdAt schema to isoTimestamp ([b946434](https://github.com/louiss0/pi-packages/commit/b946434))
|
|
16
|
+
- **pi-session-manager:** use session list incase delete is called ([665b023](https://github.com/louiss0/pi-packages/commit/665b023))
|
|
17
|
+
- **pi-session-manager:** update reference to session entry schema ([0f3b50c](https://github.com/louiss0/pi-packages/commit/0f3b50c))
|
|
18
|
+
|
|
19
|
+
### ⚠️ Breaking Changes
|
|
20
|
+
|
|
21
|
+
- **pi-session-manager:** implement auto-config generation ([0613594](https://github.com/louiss0/pi-packages/commit/0613594))
|
|
22
|
+
- **pi-session-manager:** refactor session cleaning logic ([b834b1b](https://github.com/louiss0/pi-packages/commit/b834b1b))
|
|
23
|
+
|
|
24
|
+
### ❤️ Thank You
|
|
25
|
+
|
|
26
|
+
- louiss0 @louiss0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shelton Louis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# pi-session-manager
|
|
2
|
+
|
|
3
|
+
[!session-manager](https://raw.githubusercontent.com/louiss0/pi-packages/main/pi-session-manager/assets/Pi-Session-Manager-Big.png)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@code-fixer-23/pi-session-manager)
|
|
7
|
+
[](https://www.npmjs.com/package/@code-fixer-23/pi-session-manager)
|
|
8
|
+
[](./LICENSE)
|
|
9
|
+
[](https://github.com/louiss0/pi-packages/actions/workflows/ci.yml)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
`pi-session-manager` adds local session cleanup and series management workflows to PI. It helps keep session history organized by pruning stale sessions stored on your machine, naming related sessions consistently, and carrying series context forward between sessions. The package plugs into PI's extension lifecycle so it can react when a session starts, restore persisted series metadata, and expose commands that coordinate session creation, continuation, and cleanup.
|
|
13
|
+
|
|
14
|
+
## pi-session-manager
|
|
15
|
+
|
|
16
|
+
This package ships a single PI extension in `extensions/index.ts`, supported by a small test suite and a helper script for scaffolding additional extension entry points.
|
|
17
|
+
|
|
18
|
+
### Behavior overview
|
|
19
|
+
|
|
20
|
+
The extension centers on two workflows:
|
|
21
|
+
|
|
22
|
+
1. **Session cleanup** — it can remove inactive local sessions automatically on startup or manually through commands.
|
|
23
|
+
2. **Session series management** — it records related sessions under a shared series name, preserves that context across session restarts, and lets you continue or extend a series later.
|
|
24
|
+
|
|
25
|
+
On session start, the extension first restores any persisted series data from the temp directory so PI can resume the correct session name and custom entry. When the session starts normally or after a reload, it also loads the package config, checks the cleanup rules, and removes stale local sessions if they exceed the configured age limit.
|
|
26
|
+
|
|
27
|
+
If you want a session gone, delete it through the package commands instead of editing the config by hand. The config is an internal coordination file, not a user-edit surface.
|
|
28
|
+
|
|
29
|
+
> Warning: do not edit `pi-session-manager.config.json` directly. If you need to remove a series, use `session:series delete` and let the package update its own state.
|
|
30
|
+
|
|
31
|
+
### Commands
|
|
32
|
+
|
|
33
|
+
#### `session:clean:inactive`
|
|
34
|
+
Deletes local sessions that have been inactive longer than the configured day limit. This command uses the package config stored in the agent directory, so the cleanup window matches the same rule used during startup cleanup. Use this when you want PI to resume with a clean local session set without manually touching files.
|
|
35
|
+
|
|
36
|
+
#### `session:clean:older-than <duration>`
|
|
37
|
+
Deletes local sessions older than a specific duration. The argument accepts either full units like `5days`, `2weeks`, `12hours` or shorthand forms like `5d`, `2w`, `12h`. This is useful when you want to remove sessions using an ad hoc retention threshold instead of the saved day limit.
|
|
38
|
+
|
|
39
|
+
#### `session:delete-last <count>`
|
|
40
|
+
Deletes the most recent N local sessions. The argument is an integer from 1 to 10, which makes it a quick recovery tool for removing only the newest session files when you want to clean up by hand.
|
|
41
|
+
|
|
42
|
+
#### `session:series <action>`
|
|
43
|
+
Coordinates the session-series lifecycle. The available actions are:
|
|
44
|
+
|
|
45
|
+
- `create` — create a new series and a first session inside it, then persist the resulting session metadata so PI can restore the series context later.
|
|
46
|
+
- `new` — add a new session to an existing series and keep the series record updated.
|
|
47
|
+
- `continue` — inspect the currently active session entry, recover its series, and start the next session in that same chain.
|
|
48
|
+
- `delete` — remove a series and all local session files whose names start with that series prefix. This is the safest way to remove a series; avoid editing the config file directly.
|
|
49
|
+
|
|
50
|
+
### Features
|
|
51
|
+
|
|
52
|
+
#### Startup lifecycle coordination
|
|
53
|
+
The extension listens to PI session startup and reload events to restore persisted session-series data before the rest of the session flow continues. That lets PI reopen the correct session name and custom entry even after a new process starts.
|
|
54
|
+
|
|
55
|
+
#### Persistent session-series state
|
|
56
|
+
When a series session is created, the extension writes a small temp file in the OS temp directory. On the next session start, it consumes that file, applies the stored session name and entry, and then removes the temp file so the state only applies once.
|
|
57
|
+
|
|
58
|
+
#### Configured cleanup rules
|
|
59
|
+
The package stores its config in the PI agent directory as `pi-session-manager.config.json`. That config controls the automatic inactivity cleanup threshold and remembers the series/title structure per working directory.
|
|
60
|
+
|
|
61
|
+
Treat this file as internal state. Do not edit it manually unless you are debugging the package itself. If you need to remove a series, use `session:series delete` instead of changing the config file.
|
|
62
|
+
|
|
63
|
+
The package is designed to work with local session files only, so it should never be treated as a remote or shared-session cleanup tool.
|
|
64
|
+
|
|
65
|
+
### Developer notes
|
|
66
|
+
|
|
67
|
+
- Package metadata lives in `package.json` and identifies this as a PI extension package.
|
|
68
|
+
- The implementation is in `extensions/index.ts`.
|
|
69
|
+
- Tests live alongside the extension in `extensions/index.test.ts`.
|
|
70
|
+
- `scripts/create-extension.ts` is a small helper for scaffolding a new extension file under `extensions/`.
|
|
71
|
+
|
|
72
|
+
### Assets in this repository
|
|
73
|
+
|
|
74
|
+
- `extensions/` — extension implementation and tests
|
|
75
|
+
- `scripts/` — helper script for creating new extension files
|
|
76
|
+
- No `prompts/`, `skills/`, or `themes/` directories are present in this package
|
|
Binary file
|
|
Binary file
|