claude-code-monitor 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 +22 -0
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/dist/bin/ccm.d.ts +3 -0
- package/dist/bin/ccm.d.ts.map +1 -0
- package/dist/bin/ccm.js +128 -0
- package/dist/components/Dashboard.d.ts +3 -0
- package/dist/components/Dashboard.d.ts.map +1 -0
- package/dist/components/Dashboard.js +64 -0
- package/dist/components/SessionCard.d.ts +10 -0
- package/dist/components/SessionCard.d.ts.map +1 -0
- package/dist/components/SessionCard.js +16 -0
- package/dist/components/Spinner.d.ts +7 -0
- package/dist/components/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner.js +39 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +17 -0
- package/dist/hook/handler.d.ts +9 -0
- package/dist/hook/handler.d.ts.map +1 -0
- package/dist/hook/handler.js +62 -0
- package/dist/hooks/useSessions.d.ts +7 -0
- package/dist/hooks/useSessions.d.ts.map +1 -0
- package/dist/hooks/useSessions.js +41 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/setup/index.d.ts +39 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +183 -0
- package/dist/store/file-store.d.ts +17 -0
- package/dist/store/file-store.d.ts.map +1 -0
- package/dist/store/file-store.js +134 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/focus.d.ts +16 -0
- package/dist/utils/focus.d.ts.map +1 -0
- package/dist/utils/focus.js +109 -0
- package/dist/utils/prompt.d.ts +7 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +20 -0
- package/dist/utils/status.d.ts +8 -0
- package/dist/utils/status.d.ts.map +1 -0
- package/dist/utils/status.js +10 -0
- package/dist/utils/time.d.ts +5 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +19 -0
- package/dist/utils/tty-cache.d.ts +12 -0
- package/dist/utils/tty-cache.d.ts.map +1 -0
- package/dist/utils/tty-cache.js +36 -0
- package/package.json +77 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/utils/time.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAc5D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a timestamp as relative time (e.g., "5s ago", "2m ago", "1h ago")
|
|
3
|
+
*/
|
|
4
|
+
export function formatRelativeTime(timestamp) {
|
|
5
|
+
const now = Date.now();
|
|
6
|
+
const then = new Date(timestamp).getTime();
|
|
7
|
+
const diffMs = now - then;
|
|
8
|
+
const seconds = Math.floor(diffMs / 1000);
|
|
9
|
+
const minutes = Math.floor(seconds / 60);
|
|
10
|
+
const hours = Math.floor(minutes / 60);
|
|
11
|
+
// Check from largest to smallest unit (use the first matching unit)
|
|
12
|
+
if (hours > 0)
|
|
13
|
+
return `${hours}h ago`;
|
|
14
|
+
if (minutes > 0)
|
|
15
|
+
return `${minutes}m ago`;
|
|
16
|
+
if (seconds >= 0)
|
|
17
|
+
return `${seconds}s ago`;
|
|
18
|
+
return 'now';
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if a TTY device is still alive (exists in filesystem)
|
|
3
|
+
* Results are cached for TTY_CACHE_TTL_MS to avoid repeated stat calls
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function isTtyAlive(tty: string | undefined): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Clear the TTY cache (useful for testing)
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export declare function clearTtyCache(): void;
|
|
12
|
+
//# sourceMappingURL=tty-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tty-cache.d.ts","sourceRoot":"","sources":["../../src/utils/tty-cache.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAoB3D;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import { TTY_CACHE_TTL_MS } from '../constants.js';
|
|
3
|
+
// TTY check cache to avoid repeated statSync calls
|
|
4
|
+
const ttyCache = new Map();
|
|
5
|
+
/**
|
|
6
|
+
* Check if a TTY device is still alive (exists in filesystem)
|
|
7
|
+
* Results are cached for TTY_CACHE_TTL_MS to avoid repeated stat calls
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export function isTtyAlive(tty) {
|
|
11
|
+
if (!tty)
|
|
12
|
+
return true; // Treat unknown TTY as alive
|
|
13
|
+
const now = Date.now();
|
|
14
|
+
const cached = ttyCache.get(tty);
|
|
15
|
+
// Return cached result if still valid
|
|
16
|
+
if (cached && now - cached.checkedAt < TTY_CACHE_TTL_MS) {
|
|
17
|
+
return cached.alive;
|
|
18
|
+
}
|
|
19
|
+
// Check TTY and cache result
|
|
20
|
+
try {
|
|
21
|
+
statSync(tty);
|
|
22
|
+
ttyCache.set(tty, { alive: true, checkedAt: now });
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
ttyCache.set(tty, { alive: false, checkedAt: now });
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Clear the TTY cache (useful for testing)
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export function clearTtyCache() {
|
|
35
|
+
ttyCache.clear();
|
|
36
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-code-monitor",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI for monitoring multiple Claude Code sessions in real-time",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"ccm": "dist/bin/ccm.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"CHANGELOG.md"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "tsx watch src/bin/ccm.tsx",
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"start": "node dist/bin/ccm.js",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"lint": "biome check .",
|
|
31
|
+
"lint:fix": "biome check --write .",
|
|
32
|
+
"format": "biome format --write .",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"prepublishOnly": "npm run build"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"claude",
|
|
38
|
+
"claude-code",
|
|
39
|
+
"anthropic",
|
|
40
|
+
"monitor",
|
|
41
|
+
"cli",
|
|
42
|
+
"tui",
|
|
43
|
+
"terminal",
|
|
44
|
+
"session"
|
|
45
|
+
],
|
|
46
|
+
"author": "onikan27",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/onikan27/claude-code-monitor.git"
|
|
51
|
+
},
|
|
52
|
+
"bugs": {
|
|
53
|
+
"url": "https://github.com/onikan27/claude-code-monitor/issues"
|
|
54
|
+
},
|
|
55
|
+
"homepage": "https://github.com/onikan27/claude-code-monitor#readme",
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=18.0.0"
|
|
58
|
+
},
|
|
59
|
+
"os": [
|
|
60
|
+
"darwin"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"chokidar": "^4.0.3",
|
|
64
|
+
"commander": "^13.1.0",
|
|
65
|
+
"ink": "^5.2.0",
|
|
66
|
+
"react": "^18.3.1"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@biomejs/biome": "^2.3.11",
|
|
70
|
+
"@types/node": "^22.15.30",
|
|
71
|
+
"@types/react": "^18.3.12",
|
|
72
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
73
|
+
"tsx": "^4.20.3",
|
|
74
|
+
"typescript": "^5.8.3",
|
|
75
|
+
"vitest": "^4.0.17"
|
|
76
|
+
}
|
|
77
|
+
}
|