session-steward 0.1.1 → 0.3.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 +57 -0
- package/README.md +158 -104
- package/bin/session-steward-cli.mjs +49 -7
- package/bin/session-steward.mjs +3 -0
- package/dist/assets/index-CN9iax_v.css +2 -0
- package/dist/assets/index-fUX3qen0.js +9 -0
- package/dist/index.html +14 -3
- package/lib/cli.mjs +464 -61
- package/lib/providers/claude-code/index.mjs +7 -0
- package/lib/providers/claude-code/store.mjs +951 -0
- package/lib/providers/codex/index.mjs +8 -0
- package/lib/providers/codex/store.mjs +477 -64
- package/lib/providers/index.mjs +2 -1
- package/lib/server.mjs +316 -59
- package/lib/settings.mjs +39 -0
- package/lib/storage/files.mjs +39 -0
- package/package.json +19 -10
- package/dist/assets/index-DGVNvKX8.js +0 -9
- package/dist/assets/index-DTDZWQb9.css +0 -2
- package/docs/session-steward-overview.jpg +0 -0
package/lib/settings.mjs
CHANGED
|
@@ -7,6 +7,17 @@ const CONFIG_VERSION = 1;
|
|
|
7
7
|
const PROVIDERS = {
|
|
8
8
|
codex: {
|
|
9
9
|
defaultHome: () => path.join(os.homedir(), ".codex"),
|
|
10
|
+
displayName: "Codex",
|
|
11
|
+
homeLabel: "Codex home folder",
|
|
12
|
+
homePlaceholder: "~/.codex",
|
|
13
|
+
},
|
|
14
|
+
"claude-code": {
|
|
15
|
+
defaultHome: () => process.env.CLAUDE_CONFIG_DIR && path.isAbsolute(process.env.CLAUDE_CONFIG_DIR)
|
|
16
|
+
? path.resolve(process.env.CLAUDE_CONFIG_DIR)
|
|
17
|
+
: path.join(os.homedir(), ".claude"),
|
|
18
|
+
displayName: "Claude Code",
|
|
19
|
+
homeLabel: "Claude home folder",
|
|
20
|
+
homePlaceholder: "~/.claude",
|
|
10
21
|
},
|
|
11
22
|
};
|
|
12
23
|
|
|
@@ -165,7 +176,10 @@ export async function createProviderSettings({ configDirectory, providerHomeOver
|
|
|
165
176
|
|
|
166
177
|
return {
|
|
167
178
|
defaultHome,
|
|
179
|
+
displayName: definition.displayName,
|
|
168
180
|
home,
|
|
181
|
+
homeLabel: definition.homeLabel,
|
|
182
|
+
homePlaceholder: definition.homePlaceholder,
|
|
169
183
|
isDefault: home === defaultHome,
|
|
170
184
|
source: startupHomes[providerId] && home === startupHomes[providerId]
|
|
171
185
|
? "startup"
|
|
@@ -175,6 +189,29 @@ export async function createProviderSettings({ configDirectory, providerHomeOver
|
|
|
175
189
|
};
|
|
176
190
|
}
|
|
177
191
|
|
|
192
|
+
function getActiveProviderId() {
|
|
193
|
+
return typeof config.activeProviderId === "string" && PROVIDERS[config.activeProviderId]
|
|
194
|
+
? config.activeProviderId
|
|
195
|
+
: "codex";
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async function setActiveProviderId(providerId) {
|
|
199
|
+
getProviderDefinition(providerId);
|
|
200
|
+
const nextConfig = {
|
|
201
|
+
...config,
|
|
202
|
+
activeProviderId: providerId,
|
|
203
|
+
providers: config.providers,
|
|
204
|
+
version: CONFIG_VERSION,
|
|
205
|
+
};
|
|
206
|
+
try {
|
|
207
|
+
await writeConfig(configPath, nextConfig);
|
|
208
|
+
} catch (error) {
|
|
209
|
+
throw new Error("Session Steward could not remember this provider.", { cause: error });
|
|
210
|
+
}
|
|
211
|
+
config = nextConfig;
|
|
212
|
+
return providerId;
|
|
213
|
+
}
|
|
214
|
+
|
|
178
215
|
async function setProviderHome(providerId, value) {
|
|
179
216
|
const definition = getProviderDefinition(providerId);
|
|
180
217
|
const home = await requireExistingDirectory(value);
|
|
@@ -221,9 +258,11 @@ export async function createProviderSettings({ configDirectory, providerHomeOver
|
|
|
221
258
|
}
|
|
222
259
|
|
|
223
260
|
return {
|
|
261
|
+
getActiveProviderId,
|
|
224
262
|
getAll: () => Object.fromEntries(Object.keys(PROVIDERS).map((providerId) => [providerId, getProvider(providerId)])),
|
|
225
263
|
getHome: (providerId) => getProvider(providerId).home,
|
|
226
264
|
resetProviderHome,
|
|
265
|
+
setActiveProviderId,
|
|
227
266
|
setProviderHome,
|
|
228
267
|
};
|
|
229
268
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
export async function measurePath(targetPath) {
|
|
5
|
+
let bytes = 0;
|
|
6
|
+
let fileCount = 0;
|
|
7
|
+
const pending = [path.resolve(targetPath)];
|
|
8
|
+
|
|
9
|
+
while (pending.length > 0) {
|
|
10
|
+
const currentPath = pending.pop();
|
|
11
|
+
let stats;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
stats = await fs.lstat(currentPath);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error?.code === "ENOENT") continue;
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (stats.isSymbolicLink()) continue;
|
|
21
|
+
|
|
22
|
+
if (stats.isDirectory()) {
|
|
23
|
+
const entries = await fs.readdir(currentPath);
|
|
24
|
+
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
pending.push(path.join(currentPath, entry));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (stats.isFile()) {
|
|
33
|
+
bytes += stats.size;
|
|
34
|
+
fileCount += 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return { bytes, fileCount };
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "session-steward",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "A local Codex and Claude Code session manager for safely reviewing and deleting old sessions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mallik Cheripally",
|
|
7
7
|
"type": "module",
|
|
@@ -17,25 +17,31 @@
|
|
|
17
17
|
"bugs": "https://github.com/mallikcheripally/session-steward/issues",
|
|
18
18
|
"keywords": [
|
|
19
19
|
"codex",
|
|
20
|
+
"claude-code",
|
|
21
|
+
"claude-code-sessions",
|
|
22
|
+
"claude-desktop",
|
|
20
23
|
"codex-cli",
|
|
21
|
-
"codex-sessions",
|
|
22
24
|
"openai-codex",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
+
"codex-sessions",
|
|
26
|
+
"codex-session-manager",
|
|
27
|
+
"codex-session-cleanup",
|
|
28
|
+
"codex-cleanup",
|
|
29
|
+
"codex-history",
|
|
30
|
+
"delete-codex-sessions",
|
|
25
31
|
"session-manager",
|
|
26
32
|
"session-cleanup",
|
|
33
|
+
"ai-session-manager",
|
|
34
|
+
"chatgpt-desktop",
|
|
35
|
+
"chatgpt-history",
|
|
27
36
|
"ai-coding-agent",
|
|
28
|
-
"
|
|
29
|
-
"backup",
|
|
30
|
-
"privacy",
|
|
31
|
-
"local-first"
|
|
37
|
+
"chatgpt-app-cleanup"
|
|
32
38
|
],
|
|
33
39
|
"os": ["darwin", "linux"],
|
|
34
40
|
"files": [
|
|
35
41
|
"bin",
|
|
36
42
|
"dist",
|
|
37
|
-
"docs",
|
|
38
43
|
"lib",
|
|
44
|
+
"CHANGELOG.md",
|
|
39
45
|
"LICENSE",
|
|
40
46
|
"README.md"
|
|
41
47
|
],
|
|
@@ -48,9 +54,12 @@
|
|
|
48
54
|
"scripts": {
|
|
49
55
|
"build": "vite build",
|
|
50
56
|
"benchmark:discovery": "node --expose-gc test/benchmarks/codex-discovery.mjs",
|
|
57
|
+
"benchmark:overview": "node --expose-gc test/benchmarks/codex-overview.mjs",
|
|
51
58
|
"benchmark:scale": "node --expose-gc test/benchmarks/codex-list.mjs",
|
|
59
|
+
"benchmark:size": "node --expose-gc test/benchmarks/codex-size.mjs",
|
|
52
60
|
"benchmark:transcripts": "node --expose-gc test/benchmarks/codex-transcripts.mjs",
|
|
53
61
|
"prepack": "npm run build",
|
|
62
|
+
"pretest": "npm run build",
|
|
54
63
|
"start": "node ./bin/session-steward.mjs",
|
|
55
64
|
"serve": "node ./bin/session-steward.mjs",
|
|
56
65
|
"check": "node ./bin/session-steward-cli.mjs --json --limit 5",
|