claude-code-monitor 1.0.2 → 1.0.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/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.4] - 2026-01-18
9
+
10
+ ### Fixed
11
+
12
+ - Use alternate screen buffer to prevent TUI stacking on re-render ([#5](https://github.com/onikan27/claude-code-monitor/pull/5)) by [@msdjzmst](https://github.com/msdjzmst)
13
+
14
+ ## [1.0.3] - 2026-01-17
15
+
16
+ ### Changed
17
+
18
+ - Update README: Add macOS-only badge and note, rename demo gif
19
+
8
20
  ## [1.0.2] - 2026-01-17
9
21
 
10
22
  ### Fixed
package/README.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/claude-code-monitor.svg)](https://www.npmjs.com/package/claude-code-monitor)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![macOS](https://img.shields.io/badge/platform-macOS-lightgrey.svg)](https://www.apple.com/macos/)
5
6
 
6
- A CLI tool to monitor multiple Claude Code sessions in real-time from your terminal.
7
+ **A CLI tool to monitor multiple Claude Code sessions in real-time from your terminal.**
7
8
 
8
9
  <p align="center">
9
- <img src="docs/demo.gif" alt="Claude Code Monitor Demo" width="1000">
10
+ <img src="https://raw.githubusercontent.com/onikan27/claude-code-monitor/main/docs/ccm-demo.gif" alt="Claude Code Monitor Demo" width="1000">
10
11
  </p>
11
12
 
12
13
  ---
@@ -43,6 +44,8 @@ A CLI tool to monitor multiple Claude Code sessions in real-time from your termi
43
44
 
44
45
  ## 📋 Requirements
45
46
 
47
+ > **Note**: This tool is **macOS only** due to its use of AppleScript for terminal focus features.
48
+
46
49
  - **macOS** (focus feature is macOS only)
47
50
  - **Node.js** >= 18.0.0
48
51
  - **Claude Code** installed
package/dist/bin/ccm.js CHANGED
@@ -11,7 +11,9 @@ import { clearSessions, getSessions } from '../store/file-store.js';
11
11
  import { getStatusDisplay } from '../utils/status.js';
12
12
  const require = createRequire(import.meta.url);
13
13
  const pkg = require('../../package.json');
14
- const CLEAR_SCREEN = '\x1B[2J\x1B[0f';
14
+ // Alternate screen buffer escape sequences
15
+ const ENTER_ALT_SCREEN = '\x1b[?1049h\x1b[H';
16
+ const EXIT_ALT_SCREEN = '\x1b[?1049l';
15
17
  /**
16
18
  * Get TTY from ancestor processes
17
19
  */
@@ -42,6 +44,19 @@ function getTtyFromAncestors() {
42
44
  }
43
45
  return undefined;
44
46
  }
47
+ /**
48
+ * Run TUI with alternate screen buffer
49
+ */
50
+ async function runWithAltScreen(renderFn) {
51
+ process.stdout.write(ENTER_ALT_SCREEN);
52
+ const { waitUntilExit } = renderFn();
53
+ try {
54
+ await waitUntilExit();
55
+ }
56
+ finally {
57
+ process.stdout.write(EXIT_ALT_SCREEN);
58
+ }
59
+ }
45
60
  const program = new Command();
46
61
  program
47
62
  .name('ccm')
@@ -51,10 +66,8 @@ program
51
66
  .command('watch')
52
67
  .alias('w')
53
68
  .description('Start the monitoring TUI')
54
- .action(() => {
55
- process.stdout.write(CLEAR_SCREEN);
56
- const { waitUntilExit } = render(_jsx(Dashboard, {}));
57
- waitUntilExit().catch(console.error);
69
+ .action(async () => {
70
+ await runWithAltScreen(() => render(_jsx(Dashboard, {})));
58
71
  });
59
72
  program
60
73
  .command('hook <event>')
@@ -115,9 +128,7 @@ async function defaultAction() {
115
128
  console.log('');
116
129
  }
117
130
  // Launch monitor
118
- process.stdout.write(CLEAR_SCREEN);
119
- const { waitUntilExit } = render(_jsx(Dashboard, {}));
120
- await waitUntilExit();
131
+ await runWithAltScreen(() => render(_jsx(Dashboard, {})));
121
132
  }
122
133
  // Default action when executed without commands
123
134
  if (process.argv.length === 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-monitor",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "CLI for monitoring multiple Claude Code sessions in real-time",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",