chekk 0.5.5 → 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/src/detect.js DELETED
@@ -1,146 +0,0 @@
1
- import { existsSync, readdirSync, statSync } from 'fs';
2
- import { join } from 'path';
3
- import { homedir } from 'os';
4
-
5
- /**
6
- * Detect installed AI coding tools and count available sessions.
7
- */
8
- export function detectTools() {
9
- const home = homedir();
10
- const results = [];
11
-
12
- // ── Claude Code: ~/.claude/projects/ ──
13
- const claudeProjectsDir = join(home, '.claude', 'projects');
14
- if (existsSync(claudeProjectsDir)) {
15
- const projects = readdirSync(claudeProjectsDir).filter(f => {
16
- const full = join(claudeProjectsDir, f);
17
- return statSync(full).isDirectory();
18
- });
19
-
20
- let totalSessions = 0;
21
- let totalLines = 0;
22
- const projectDetails = [];
23
-
24
- for (const project of projects) {
25
- const projectDir = join(claudeProjectsDir, project);
26
- const jsonlFiles = readdirSync(projectDir).filter(f =>
27
- f.endsWith('.jsonl') && !f.startsWith('agent-')
28
- );
29
-
30
- if (jsonlFiles.length > 0) {
31
- totalSessions += jsonlFiles.length;
32
- for (const file of jsonlFiles) {
33
- try {
34
- const stat = statSync(join(projectDir, file));
35
- totalLines += Math.floor(stat.size / 500);
36
- } catch {}
37
- }
38
- projectDetails.push({
39
- name: project.replace(/-/g, '/').replace(/^\//, ''),
40
- sessions: jsonlFiles.length,
41
- path: projectDir,
42
- });
43
- }
44
- }
45
-
46
- if (totalSessions > 0) {
47
- results.push({
48
- tool: 'Claude Code',
49
- sessions: totalSessions,
50
- projects: projectDetails,
51
- estimatedPrompts: totalLines,
52
- basePath: claudeProjectsDir,
53
- });
54
- }
55
- }
56
-
57
- // ── Cursor: workspaceStorage with state.vscdb files ──
58
- const cursorPaths = [
59
- join(home, 'Library', 'Application Support', 'Cursor', 'User', 'workspaceStorage'), // macOS
60
- join(home, '.config', 'Cursor', 'User', 'workspaceStorage'), // Linux
61
- join(home, 'AppData', 'Roaming', 'Cursor', 'User', 'workspaceStorage'), // Windows
62
- ];
63
-
64
- for (const cursorPath of cursorPaths) {
65
- if (existsSync(cursorPath)) {
66
- // Count workspaces that have state.vscdb
67
- let workspaceCount = 0;
68
- const projectDetails = [];
69
-
70
- try {
71
- const dirs = readdirSync(cursorPath).filter(f => {
72
- try { return statSync(join(cursorPath, f)).isDirectory(); } catch { return false; }
73
- });
74
-
75
- for (const dir of dirs) {
76
- const dbPath = join(cursorPath, dir, 'state.vscdb');
77
- if (existsSync(dbPath)) {
78
- workspaceCount++;
79
- projectDetails.push({
80
- name: dir.slice(0, 8),
81
- sessions: 1,
82
- path: join(cursorPath, dir),
83
- });
84
- }
85
- }
86
- } catch {}
87
-
88
- if (workspaceCount > 0) {
89
- results.push({
90
- tool: 'Cursor',
91
- sessions: workspaceCount,
92
- projects: projectDetails,
93
- estimatedPrompts: 0,
94
- basePath: cursorPath,
95
- });
96
- }
97
- break;
98
- }
99
- }
100
-
101
- // ── Codex: ~/.codex/sessions/ ──
102
- const codexPath = join(home, '.codex');
103
- const codexSessionsPath = join(codexPath, 'sessions');
104
- if (existsSync(codexSessionsPath)) {
105
- // Count JSONL session files recursively
106
- let totalSessions = 0;
107
- const projectDetails = [];
108
-
109
- function countFiles(dir) {
110
- try {
111
- const entries = readdirSync(dir);
112
- for (const entry of entries) {
113
- const full = join(dir, entry);
114
- try {
115
- const stat = statSync(full);
116
- if (stat.isDirectory()) {
117
- countFiles(full);
118
- } else if (entry.endsWith('.jsonl')) {
119
- totalSessions++;
120
- }
121
- } catch {}
122
- }
123
- } catch {}
124
- }
125
-
126
- countFiles(codexSessionsPath);
127
-
128
- if (totalSessions > 0) {
129
- projectDetails.push({
130
- name: 'codex',
131
- sessions: totalSessions,
132
- path: codexSessionsPath,
133
- });
134
-
135
- results.push({
136
- tool: 'Codex',
137
- sessions: totalSessions,
138
- projects: projectDetails,
139
- estimatedPrompts: 0,
140
- basePath: codexPath,
141
- });
142
- }
143
- }
144
-
145
- return results;
146
- }