claude-sessions 0.1.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.
Files changed (48) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +140 -0
  3. package/data/model-pricing.json +113 -0
  4. package/dist/cost-calculator.d.ts +49 -0
  5. package/dist/cost-calculator.d.ts.map +1 -0
  6. package/dist/cost-calculator.js +429 -0
  7. package/dist/cost-calculator.js.map +1 -0
  8. package/dist/index.d.ts +28 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +65 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/projects-service.d.ts +106 -0
  13. package/dist/projects-service.d.ts.map +1 -0
  14. package/dist/projects-service.js +317 -0
  15. package/dist/projects-service.js.map +1 -0
  16. package/dist/session-cache-store.d.ts +48 -0
  17. package/dist/session-cache-store.d.ts.map +1 -0
  18. package/dist/session-cache-store.js +231 -0
  19. package/dist/session-cache-store.js.map +1 -0
  20. package/dist/session-cache.d.ts +266 -0
  21. package/dist/session-cache.d.ts.map +1 -0
  22. package/dist/session-cache.js +1294 -0
  23. package/dist/session-cache.js.map +1 -0
  24. package/dist/session-parser.d.ts +265 -0
  25. package/dist/session-parser.d.ts.map +1 -0
  26. package/dist/session-parser.js +555 -0
  27. package/dist/session-parser.js.map +1 -0
  28. package/dist/session-reader.d.ts +87 -0
  29. package/dist/session-reader.d.ts.map +1 -0
  30. package/dist/session-reader.js +279 -0
  31. package/dist/session-reader.js.map +1 -0
  32. package/dist/tasks-service.d.ts +100 -0
  33. package/dist/tasks-service.d.ts.map +1 -0
  34. package/dist/tasks-service.js +290 -0
  35. package/dist/tasks-service.js.map +1 -0
  36. package/dist/teams-service.d.ts +30 -0
  37. package/dist/teams-service.d.ts.map +1 -0
  38. package/dist/teams-service.js +85 -0
  39. package/dist/teams-service.js.map +1 -0
  40. package/dist/types.d.ts +87 -0
  41. package/dist/types.d.ts.map +1 -0
  42. package/dist/types.js +7 -0
  43. package/dist/types.js.map +1 -0
  44. package/dist/utils/path-utils.d.ts +80 -0
  45. package/dist/utils/path-utils.d.ts.map +1 -0
  46. package/dist/utils/path-utils.js +355 -0
  47. package/dist/utils/path-utils.js.map +1 -0
  48. package/package.json +42 -0
@@ -0,0 +1,355 @@
1
+ "use strict";
2
+ /**
3
+ * Path utilities for Claude CLI Manager
4
+ * Handles path encoding/decoding for session storage
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.legacyEncodeProjectPath = legacyEncodeProjectPath;
41
+ exports.encodePath = encodePath;
42
+ exports.decodePath = decodePath;
43
+ exports.getDataDir = getDataDir;
44
+ exports.getClaudeConfigDir = getClaudeConfigDir;
45
+ exports.getProjectsDir = getProjectsDir;
46
+ exports.getSessionFilePath = getSessionFilePath;
47
+ exports.getProjectStorageDir = getProjectStorageDir;
48
+ exports.transformPaths = transformPaths;
49
+ exports.normalizePath = normalizePath;
50
+ exports.isAbsolutePath = isAbsolutePath;
51
+ exports.getRelativePath = getRelativePath;
52
+ exports.extractProjectPath = extractProjectPath;
53
+ const path = __importStar(require("path"));
54
+ const os = __importStar(require("os"));
55
+ const fs = __importStar(require("fs"));
56
+ /**
57
+ * Encode a project path using Claude Code's legacy dash-replacement method.
58
+ * Cross-platform: handles both / and \ separators, and removes colons.
59
+ * Linux: /home/user/project -> -home-user-project
60
+ * macOS: /Users/admin/project -> -Users-admin-project
61
+ * Windows: C:\home\project -> C--home-project (colon and backslashes become dashes)
62
+ */
63
+ function legacyEncodeProjectPath(projectPath) {
64
+ return projectPath.replace(/[:\\/]/g, '-');
65
+ }
66
+ /**
67
+ * Encode a path for use in Claude session storage
68
+ * Uses URL-safe Base64 encoding to handle paths with dashes/special characters
69
+ * Example: /home/ubuntu/my-project -> aG9tZS91YnVudHUvbXktcHJvamVjdA
70
+ *
71
+ * Note: This uses a different encoding than the legacy dash-replacement method
72
+ * to avoid collisions where /home/my-project and /home/my/project would
73
+ * both encode to the same string.
74
+ */
75
+ function encodePath(absolutePath) {
76
+ // Remove leading slash for encoding
77
+ const pathWithoutLeadingSlash = absolutePath.replace(/^\//, '');
78
+ // Use URL-safe Base64 encoding (replace +/ with -_)
79
+ const base64 = Buffer.from(pathWithoutLeadingSlash, 'utf-8').toString('base64');
80
+ return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
81
+ }
82
+ /**
83
+ * Decode an encoded path back to absolute path
84
+ * Supports both new Base64 encoding and legacy dash-replacement format
85
+ * Example: aG9tZS91YnVudHUvbXktcHJvamVjdA -> /home/ubuntu/my-project
86
+ * Example: -home-ubuntu-my-project -> /home/ubuntu/my-project (legacy)
87
+ */
88
+ function decodePath(encodedPath) {
89
+ // Check if this looks like legacy encoding:
90
+ // Legacy format: -home-ubuntu-project (starts with dash, all lowercase, dashes as separators)
91
+ // Base64 format: aG9tZS91YnVudHUvbXktcHJvamVjdA (mixed case, may contain underscores)
92
+ //
93
+ // Legacy format characteristics:
94
+ // 1. Starts with '-' (representing root /)
95
+ // 2. Contains only lowercase letters, numbers, and dashes
96
+ // 3. No underscores (which are used in URL-safe Base64)
97
+ // 4. No uppercase letters (which appear in Base64)
98
+ const isLikelyLegacy = /^-[a-z0-9-]*$/.test(encodedPath) && !encodedPath.includes('_');
99
+ // Windows legacy format: C--home-project (drive letter + -- for colon, dashes for backslashes)
100
+ // Pattern: single uppercase letter followed by -- (from C:\ -> C--)
101
+ // No underscore guard needed: ^[A-Z]-- is a sufficient discriminator — no valid
102
+ // Base64-encoded printable-ASCII path can produce this pattern.
103
+ const isWindowsLegacy = /^[A-Z]--/.test(encodedPath);
104
+ if (isWindowsLegacy) {
105
+ // Windows legacy decoding: C--home-lm-assist -> C:\home\lm-assist
106
+ // The drive letter and colon come from the first char + '--' pattern
107
+ const driveLetter = encodedPath[0];
108
+ const rest = encodedPath.slice(2); // Skip drive letter and first dash (from colon)
109
+ // rest starts with '-' (from backslash after colon), e.g., '-home-lm-assist'
110
+ return decodeWindowsPathWithFilesystemCheck(driveLetter, rest);
111
+ }
112
+ if (isLikelyLegacy) {
113
+ // Legacy decoding with filesystem verification
114
+ // Problem: -home-ubuntu-sample-project could be:
115
+ // /home/ubuntu/sample-project or /home/ubuntu/sample/project
116
+ // Solution: Try to find the actual path that exists on the filesystem
117
+ return decodePathWithFilesystemCheck(encodedPath);
118
+ }
119
+ try {
120
+ // Restore URL-safe Base64 to standard Base64
121
+ let base64 = encodedPath.replace(/-/g, '+').replace(/_/g, '/');
122
+ // Add padding if needed
123
+ const padding = base64.length % 4;
124
+ if (padding > 0) {
125
+ base64 += '='.repeat(4 - padding);
126
+ }
127
+ const decoded = Buffer.from(base64, 'base64').toString('utf-8');
128
+ // Validate the decoded result looks like a path (should contain valid path characters)
129
+ if (decoded && !decoded.includes('\0') && decoded.length > 0 && /^[a-zA-Z0-9/_.-]+$/.test(decoded)) {
130
+ return '/' + decoded;
131
+ }
132
+ }
133
+ catch {
134
+ // Fall through to legacy decoding
135
+ }
136
+ // Fallback to legacy decoding (handles edge cases)
137
+ if (encodedPath.startsWith('-')) {
138
+ return decodePathWithFilesystemCheck(encodedPath);
139
+ }
140
+ return '/' + encodedPath.replace(/-/g, '/');
141
+ }
142
+ /**
143
+ * Decode a legacy dash-encoded path by checking which interpretation exists on disk
144
+ * For -home-ubuntu-sample-project, tries paths in order:
145
+ * 1. /home/ubuntu/sample-project (least slashes - most dashes preserved)
146
+ * 2. /home/ubuntu/sample/project (more slashes)
147
+ * Falls back to all-slashes interpretation if no path exists
148
+ */
149
+ function decodePathWithFilesystemCheck(encodedPath) {
150
+ // Remove leading dash and split by dash
151
+ const parts = encodedPath.replace(/^-/, '').split('-');
152
+ // Build path progressively, checking filesystem at each level
153
+ // We want to find the interpretation where the most dashes are preserved
154
+ // (i.e., fewest directory levels that still exists on disk)
155
+ // Start building from root
156
+ let currentPath = '';
157
+ let partIndex = 0;
158
+ while (partIndex < parts.length) {
159
+ const part = parts[partIndex];
160
+ const testPath = currentPath + '/' + part;
161
+ // Check if this path exists as a directory
162
+ try {
163
+ const stat = fs.statSync(testPath);
164
+ if (stat.isDirectory()) {
165
+ // This level exists, continue
166
+ currentPath = testPath;
167
+ partIndex++;
168
+ continue;
169
+ }
170
+ }
171
+ catch {
172
+ // Path doesn't exist, try combining with remaining parts
173
+ }
174
+ // Current part doesn't exist as a directory
175
+ // Try combining remaining parts with dashes to see if that exists
176
+ if (partIndex < parts.length) {
177
+ // Try progressively combining parts with dashes
178
+ for (let endIndex = parts.length; endIndex > partIndex; endIndex--) {
179
+ const combinedPart = parts.slice(partIndex, endIndex).join('-');
180
+ const combinedPath = currentPath + '/' + combinedPart;
181
+ try {
182
+ const stat = fs.statSync(combinedPath);
183
+ if (stat.isDirectory() || stat.isFile()) {
184
+ // Found a valid path with dashes preserved
185
+ currentPath = combinedPath;
186
+ partIndex = endIndex;
187
+ break;
188
+ }
189
+ }
190
+ catch {
191
+ // Continue trying shorter combinations
192
+ }
193
+ }
194
+ // If no combination worked, just add this part and continue
195
+ if (partIndex < parts.length && !currentPath.endsWith('/' + parts[partIndex])) {
196
+ currentPath = currentPath + '/' + parts[partIndex];
197
+ partIndex++;
198
+ }
199
+ }
200
+ }
201
+ // If we didn't build a valid path, fall back to all-slashes interpretation
202
+ if (!currentPath || currentPath === '/') {
203
+ return '/' + parts.join('/');
204
+ }
205
+ return currentPath;
206
+ }
207
+ /**
208
+ * Decode a Windows legacy dash-encoded path by checking which interpretation exists on disk.
209
+ * For C--home-lm-assist, the drive letter and rest are split by the caller.
210
+ * rest = '-home-lm-assist' (leading dash from backslash after colon)
211
+ * We reconstruct C:\ + path using filesystem checks to resolve dash ambiguity.
212
+ */
213
+ function decodeWindowsPathWithFilesystemCheck(driveLetter, rest) {
214
+ // rest starts with '-' (from backslash), e.g., '-home-lm-assist'
215
+ const parts = rest.replace(/^-/, '').split('-');
216
+ const driveRoot = driveLetter + ':\\';
217
+ // Build path progressively, checking filesystem at each level
218
+ let currentPath = driveRoot;
219
+ let partIndex = 0;
220
+ while (partIndex < parts.length) {
221
+ const part = parts[partIndex];
222
+ const testPath = path.join(currentPath, part);
223
+ // Check if this path exists as a directory
224
+ try {
225
+ const stat = fs.statSync(testPath);
226
+ if (stat.isDirectory()) {
227
+ currentPath = testPath;
228
+ partIndex++;
229
+ continue;
230
+ }
231
+ }
232
+ catch {
233
+ // Path doesn't exist, try combining with remaining parts
234
+ }
235
+ // Try combining remaining parts with dashes to see if that exists
236
+ if (partIndex < parts.length) {
237
+ let found = false;
238
+ for (let endIndex = parts.length; endIndex > partIndex; endIndex--) {
239
+ const combinedPart = parts.slice(partIndex, endIndex).join('-');
240
+ const combinedPath = path.join(currentPath, combinedPart);
241
+ try {
242
+ const stat = fs.statSync(combinedPath);
243
+ if (stat.isDirectory() || stat.isFile()) {
244
+ currentPath = combinedPath;
245
+ partIndex = endIndex;
246
+ found = true;
247
+ break;
248
+ }
249
+ }
250
+ catch {
251
+ // Continue trying shorter combinations
252
+ }
253
+ }
254
+ if (!found) {
255
+ currentPath = path.join(currentPath, parts[partIndex]);
256
+ partIndex++;
257
+ }
258
+ }
259
+ }
260
+ return currentPath;
261
+ }
262
+ /**
263
+ * Get the lm-assist data directory
264
+ * Default: ~/.lm-assist
265
+ * Can be overridden with LM_ASSIST_DATA_DIR env var
266
+ * All lm-assist owned data lives here (knowledge, milestones, vectors, cache, etc.)
267
+ */
268
+ function getDataDir() {
269
+ return process.env.LM_ASSIST_DATA_DIR || path.join(os.homedir(), '.lm-assist');
270
+ }
271
+ /**
272
+ * Get the Claude config directory
273
+ * Default: ~/.claude
274
+ * Can be overridden with CLAUDE_CONFIG_DIR env var
275
+ */
276
+ function getClaudeConfigDir() {
277
+ return process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude');
278
+ }
279
+ /**
280
+ * Get the projects directory
281
+ * Default: ~/.claude/projects
282
+ */
283
+ function getProjectsDir(configDir) {
284
+ return path.join(configDir || getClaudeConfigDir(), 'projects');
285
+ }
286
+ /**
287
+ * Get the session file path for a project and session ID
288
+ */
289
+ function getSessionFilePath(projectPath, sessionId, configDir) {
290
+ const projectsDir = getProjectsDir(configDir);
291
+ const encodedProject = encodePath(projectPath);
292
+ return path.join(projectsDir, encodedProject, `${sessionId}.jsonl`);
293
+ }
294
+ /**
295
+ * Get the project directory in Claude storage
296
+ */
297
+ function getProjectStorageDir(projectPath, configDir) {
298
+ const projectsDir = getProjectsDir(configDir);
299
+ const encodedProject = encodePath(projectPath);
300
+ return path.join(projectsDir, encodedProject);
301
+ }
302
+ /**
303
+ * Transform paths in content for migration
304
+ * Example: Transform all /home/ubuntu to /home/opc
305
+ */
306
+ function transformPaths(content, transforms) {
307
+ let result = content;
308
+ for (const { from, to } of transforms) {
309
+ result = result.replace(new RegExp(escapeRegex(from), 'g'), to);
310
+ }
311
+ return result;
312
+ }
313
+ /**
314
+ * Escape special regex characters
315
+ */
316
+ function escapeRegex(str) {
317
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
318
+ }
319
+ /**
320
+ * Normalize a path (resolve ~, ., ..)
321
+ */
322
+ function normalizePath(inputPath) {
323
+ if (inputPath.startsWith('~')) {
324
+ inputPath = path.join(os.homedir(), inputPath.slice(1));
325
+ }
326
+ return path.resolve(inputPath);
327
+ }
328
+ /**
329
+ * Check if a path is absolute
330
+ */
331
+ function isAbsolutePath(inputPath) {
332
+ return path.isAbsolute(inputPath) || inputPath.startsWith('~');
333
+ }
334
+ /**
335
+ * Get relative path from project root
336
+ */
337
+ function getRelativePath(absolutePath, projectRoot) {
338
+ return path.relative(projectRoot, absolutePath);
339
+ }
340
+ /**
341
+ * Extract project path from encoded storage path
342
+ */
343
+ function extractProjectPath(storagePath) {
344
+ const projectsDir = getProjectsDir();
345
+ if (!storagePath.startsWith(projectsDir)) {
346
+ return null;
347
+ }
348
+ const relativePath = storagePath.substring(projectsDir.length + 1);
349
+ const parts = relativePath.split(path.sep);
350
+ if (parts.length === 0) {
351
+ return null;
352
+ }
353
+ return decodePath(parts[0]);
354
+ }
355
+ //# sourceMappingURL=path-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-utils.js","sourceRoot":"","sources":["../../src/utils/path-utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaH,0DAEC;AAWD,gCAMC;AAQD,gCAyDC;AA8ID,gCAEC;AAOD,gDAEC;AAMD,wCAEC;AAKD,gDAQC;AAKD,oDAOC;AAMD,wCASC;AAYD,sCAKC;AAKD,wCAEC;AAKD,0CAEC;AAKD,gDAaC;AAzVD,2CAA6B;AAC7B,uCAAyB;AACzB,uCAAyB;AAEzB;;;;;;GAM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IAED,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "claude-sessions",
3
+ "version": "0.1.0",
4
+ "description": "Read Claude Code session data (sessions, projects, tasks, teams, costs) without running lm-assist",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist/",
9
+ "data/"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "clean": "rm -rf dist",
14
+ "prepublishOnly": "npm run clean && npm run build"
15
+ },
16
+ "keywords": [
17
+ "claude",
18
+ "claude-code",
19
+ "sessions",
20
+ "jsonl",
21
+ "parser"
22
+ ],
23
+ "author": "langmartai",
24
+ "license": "MIT",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/langmartai/claude-sessions.git"
28
+ },
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ },
32
+ "dependencies": {
33
+ "lmdb": "^3.5.1"
34
+ },
35
+ "optionalDependencies": {
36
+ "chokidar": "^5.0.0"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^20.10.0",
40
+ "typescript": "^5.3.0"
41
+ }
42
+ }