@sooink/ai-session-tidy 0.1.2 → 0.1.4
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/.github/workflows/release.yml +57 -0
- package/CHANGELOG.md +32 -0
- package/README.md +50 -11
- package/assets/demo-interactive.gif +0 -0
- package/assets/demo.gif +0 -0
- package/dist/index.js +369 -116
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/commands/clean.ts +187 -78
- package/src/commands/config.ts +7 -2
- package/src/commands/scan.ts +74 -2
- package/src/commands/watch.ts +12 -7
- package/src/core/cleaner.ts +5 -0
- package/src/core/constants.ts +10 -10
- package/src/core/service.ts +64 -10
- package/src/scanners/claude-code.ts +55 -0
- package/src/scanners/types.ts +1 -1
- package/src/utils/paths.ts +43 -3
- package/README.ko.md +0 -176
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
release:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
fetch-tags: true
|
|
20
|
+
|
|
21
|
+
- name: Get version from tag
|
|
22
|
+
id: version
|
|
23
|
+
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
- name: Get previous tag
|
|
26
|
+
id: prev_tag
|
|
27
|
+
run: |
|
|
28
|
+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
29
|
+
echo "tag=$PREV_TAG" >> $GITHUB_OUTPUT
|
|
30
|
+
|
|
31
|
+
- name: Read CHANGELOG
|
|
32
|
+
id: changelog
|
|
33
|
+
env:
|
|
34
|
+
VERSION: ${{ steps.version.outputs.version }}
|
|
35
|
+
PREV_TAG: ${{ steps.prev_tag.outputs.tag }}
|
|
36
|
+
CURRENT_TAG: ${{ github.ref_name }}
|
|
37
|
+
REPO: ${{ github.repository }}
|
|
38
|
+
run: |
|
|
39
|
+
# Extract section for this version only (between version header and next ## header)
|
|
40
|
+
CHANGES=$(sed -n "/^## ${VERSION}$/,/^## /p" CHANGELOG.md | sed '1d;$d')
|
|
41
|
+
|
|
42
|
+
# Add Full Changelog link if previous tag exists
|
|
43
|
+
if [ -n "$PREV_TAG" ]; then
|
|
44
|
+
LINK="**Full Changelog**: https://github.com/${REPO}/compare/${PREV_TAG}...${CURRENT_TAG}"
|
|
45
|
+
CHANGES=$(printf "%s\n\n---\n\n%s" "$CHANGES" "$LINK")
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
echo "changes<<EOF" >> $GITHUB_OUTPUT
|
|
49
|
+
echo "$CHANGES" >> $GITHUB_OUTPUT
|
|
50
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
51
|
+
|
|
52
|
+
- name: Create Release
|
|
53
|
+
uses: softprops/action-gh-release@v2
|
|
54
|
+
with:
|
|
55
|
+
body: ${{ steps.changelog.outputs.changes }}
|
|
56
|
+
env:
|
|
57
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
- Added support for Claude Code tasks
|
|
6
|
+
- Improve macOS background activity attribution for LaunchAgent (displays as `ai-session-tidy`)
|
|
7
|
+
|
|
8
|
+
## 0.1.3
|
|
9
|
+
|
|
10
|
+
- Fixed ignored folder patterns to match folders themselves (e.g., `/Downloads`, `/Documents`)
|
|
11
|
+
- Fixed log files not being cleared on service start, causing stale error messages
|
|
12
|
+
- Added TTY checks for interactive mode (`-i`) and confirmation prompts
|
|
13
|
+
- Added helpful error messages in non-TTY environments (scripts/CI)
|
|
14
|
+
- Changed `clean -i` to show clean "Selected items" list after selection
|
|
15
|
+
|
|
16
|
+
## 0.1.2
|
|
17
|
+
|
|
18
|
+
- Added system folder ignore patterns for watch mode
|
|
19
|
+
- Added automatic exclusion of macOS system folders (Library, Applications, Downloads, etc.)
|
|
20
|
+
- Added exclusion of hidden folders and node_modules from watching
|
|
21
|
+
|
|
22
|
+
## 0.1.1
|
|
23
|
+
|
|
24
|
+
- Fixed npm publish configuration
|
|
25
|
+
|
|
26
|
+
## 0.1.0
|
|
27
|
+
|
|
28
|
+
- Added scan command to find orphaned sessions from Claude Code and Cursor
|
|
29
|
+
- Added clean command with interactive mode and trash support
|
|
30
|
+
- Added watch command for automatic cleanup on project deletion
|
|
31
|
+
- Added background daemon with auto-start at login (macOS)
|
|
32
|
+
- Added config command for managing watch paths, delay, and depth
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# AI Session Tidy
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**Automatically clean up orphaned sessions from AI coding tools**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@sooink/ai-session-tidy)
|
|
8
8
|
[](https://nodejs.org/)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## The Problem
|
|
17
17
|
|
|
18
|
-
AI coding tools like **Claude Code** and **Cursor** store session data locally—conversation history, file snapshots, todos, and more.
|
|
18
|
+
AI coding tools like **Claude Code** and **Cursor** store session data locally—conversation history, file snapshots, todos, tasks, and more.
|
|
19
19
|
|
|
20
20
|
When you delete, move, or rename a project, the session data becomes orphaned:
|
|
21
21
|
|
|
@@ -26,24 +26,31 @@ When you delete, move, or rename a project, the session data becomes orphaned:
|
|
|
26
26
|
│ ├── -Users-you-temp-worktree/ # 👈 Worktree removed
|
|
27
27
|
│ └── -Users-you-renamed-project/ # 👈 Project renamed
|
|
28
28
|
├── todos/ # Orphaned todo files
|
|
29
|
-
|
|
29
|
+
├── file-history/ # Orphaned rewind snapshots
|
|
30
|
+
└── tasks/ # Orphaned task folders
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
This becomes especially problematic with **git worktree workflows**, where branches are frequently created and removed—each leaving behind session data that accumulates quickly.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
While Claude Code cleans up old sessions after 30 days, **Cursor has no automatic cleanup**. And even with Claude Code, you're left with orphaned data for up to a month. Manually cleaning up after each worktree removal is tedious.
|
|
36
|
+
|
|
37
|
+
**This tool detects orphaned sessions automatically and cleans them up.**
|
|
38
|
+
Just run `watch start` once—it monitors in the background and cleans up as projects are deleted.
|
|
35
39
|
|
|
36
40
|
## Quick Start
|
|
37
41
|
|
|
38
42
|
```bash
|
|
39
43
|
npm install -g @sooink/ai-session-tidy
|
|
40
44
|
|
|
45
|
+
# Automatic cleanup (recommended)
|
|
46
|
+
ai-session-tidy watch start
|
|
47
|
+
|
|
48
|
+
# Manual cleanup
|
|
41
49
|
ai-session-tidy # Scan for orphaned sessions
|
|
42
50
|
ai-session-tidy clean # Move to trash
|
|
43
|
-
ai-session-tidy watch start # Auto-cleanup daemon
|
|
44
51
|
```
|
|
45
52
|
|
|
46
|
-

|
|
53
|
+

|
|
47
54
|
|
|
48
55
|
## Use Cases
|
|
49
56
|
|
|
@@ -84,7 +91,7 @@ This multiplies session data accumulation. Watch mode keeps your system clean au
|
|
|
84
91
|
|
|
85
92
|
### `scan` (default)
|
|
86
93
|
|
|
87
|
-
Find orphaned sessions without deleting.
|
|
94
|
+
Find orphaned sessions without deleting. Running `ai-session-tidy` without a command is equivalent to `ai-session-tidy scan`.
|
|
88
95
|
|
|
89
96
|
```bash
|
|
90
97
|
ai-session-tidy # Basic scan
|
|
@@ -92,18 +99,49 @@ ai-session-tidy -v # Verbose output
|
|
|
92
99
|
ai-session-tidy --json # JSON output
|
|
93
100
|
```
|
|
94
101
|
|
|
102
|
+
<details>
|
|
103
|
+
<summary>Example output with <code>-v</code></summary>
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
⚠ Found 2 session folder(s) + 1 config entry(ies) + 3 session-env folder(s) (156.2 MB)
|
|
107
|
+
|
|
108
|
+
┌─────────────┬──────────┬────────┬─────┬───────┬─────────┬───────┬──────────┬───────────┐
|
|
109
|
+
│ Tool │ Sessions │ Config │ Env │ Todos │ History │ Tasks │ Size │ Scan Time │
|
|
110
|
+
├─────────────┼──────────┼────────┼─────┼───────┼─────────┼───────┼──────────┼───────────┤
|
|
111
|
+
│ claude-code │ 2 │ 1 │ 3 │ - │ - │ - │ 156.2 MB │ 45ms │
|
|
112
|
+
└─────────────┴──────────┴────────┴─────┴───────┴─────────┴───────┴──────────┴───────────┘
|
|
113
|
+
|
|
114
|
+
Session Folders:
|
|
115
|
+
|
|
116
|
+
[claude-code] deleted-project (128.5 MB)
|
|
117
|
+
→ /Users/you/deleted-project
|
|
118
|
+
Modified: 1/15/2025
|
|
119
|
+
|
|
120
|
+
[claude-code] old-worktree (27.7 MB)
|
|
121
|
+
→ /Users/you/old-worktree
|
|
122
|
+
Modified: 1/10/2025
|
|
123
|
+
|
|
124
|
+
Config Entries (~/.claude.json):
|
|
125
|
+
|
|
126
|
+
[config] deleted-project
|
|
127
|
+
→ /Users/you/deleted-project
|
|
128
|
+
Cost: $1.25 | Tokens: 150K in / 12K out
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
</details>
|
|
132
|
+
|
|
95
133
|
### `clean`
|
|
96
134
|
|
|
97
135
|
Remove orphaned sessions.
|
|
98
136
|
|
|
99
137
|
```bash
|
|
100
138
|
ai-session-tidy clean # Move to trash (with confirmation)
|
|
101
|
-
ai-session-tidy clean -i # Interactive selection
|
|
102
|
-
ai-session-tidy clean -f # Skip confirmation
|
|
139
|
+
ai-session-tidy clean -i # Interactive selection (TTY only)
|
|
140
|
+
ai-session-tidy clean -f # Skip confirmation (required for scripts/CI)
|
|
103
141
|
ai-session-tidy clean -n # Dry-run (show what would be deleted)
|
|
104
142
|
```
|
|
105
143
|
|
|
106
|
-

|
|
144
|
+

|
|
107
145
|
|
|
108
146
|
### `watch`
|
|
109
147
|
|
|
@@ -146,6 +184,7 @@ ai-session-tidy config reset # Reset to defaults
|
|
|
146
184
|
| `~/.claude/session-env/{uuid}/` | Session environment | Empty folder |
|
|
147
185
|
| `~/.claude/todos/{uuid}-*.json` | Todo files | Session gone |
|
|
148
186
|
| `~/.claude/file-history/{uuid}/` | Rewind snapshots | Session gone |
|
|
187
|
+
| `~/.claude/tasks/{uuid}/` | Task folders | Session gone |
|
|
149
188
|
|
|
150
189
|
### Cursor
|
|
151
190
|
|
|
Binary file
|
package/assets/demo.gif
CHANGED
|
Binary file
|