claude-smart 0.1.16 → 0.1.17

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/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License">
14
14
  </a>
15
15
  <a href="plugin/pyproject.toml">
16
- <img src="https://img.shields.io/badge/version-0.1.16-green.svg" alt="Version">
16
+ <img src="https://img.shields.io/badge/version-0.1.17-green.svg" alt="Version">
17
17
  </a>
18
18
  <a href="plugin/pyproject.toml">
19
19
  <img src="https://img.shields.io/badge/python-%3E%3D3.12-brightgreen.svg" alt="Python">
@@ -25,31 +25,53 @@ function runClaude(args, { spinnerLabel } = {}) {
25
25
  stdio: useSpinner ? ["inherit", "pipe", "pipe"] : "inherit",
26
26
  });
27
27
 
28
- let spinnerActive = false;
29
- let timer = null;
30
28
  if (useSpinner) {
31
29
  const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
32
30
  let i = 0;
33
- spinnerActive = true;
34
- const render = () => {
35
- process.stdout.write(`\r${frames[i = (i + 1) % frames.length]} ${spinnerLabel}`);
31
+ let spinTimer = null;
32
+ let rearmTimer = null;
33
+ let exited = false;
34
+
35
+ const draw = () => {
36
+ process.stdout.write(`\r⠿ ${spinnerLabel}`.replace("⠿", frames[i = (i + 1) % frames.length]));
37
+ };
38
+ const clearLine = () => process.stdout.write("\r\x1b[2K");
39
+ const startSpin = () => {
40
+ if (spinTimer || exited) return;
41
+ draw();
42
+ spinTimer = setInterval(draw, 80);
43
+ };
44
+ const stopSpin = () => {
45
+ if (!spinTimer) return;
46
+ clearInterval(spinTimer);
47
+ spinTimer = null;
48
+ clearLine();
36
49
  };
37
- render();
38
- timer = setInterval(render, 80);
39
-
40
- const clear = () => {
41
- if (!spinnerActive) return;
42
- spinnerActive = false;
43
- clearInterval(timer);
44
- process.stdout.write("\r\x1b[2K");
50
+ const armRearm = () => {
51
+ if (rearmTimer) clearTimeout(rearmTimer);
52
+ rearmTimer = setTimeout(() => {
53
+ rearmTimer = null;
54
+ startSpin();
55
+ }, 200);
45
56
  };
57
+
58
+ startSpin();
59
+
46
60
  const passthrough = (stream) => (chunk) => {
47
- clear();
61
+ stopSpin();
48
62
  stream.write(chunk);
63
+ armRearm();
49
64
  };
50
65
  child.stdout.on("data", passthrough(process.stdout));
51
66
  child.stderr.on("data", passthrough(process.stderr));
52
- child.on("exit", clear);
67
+ child.on("exit", () => {
68
+ exited = true;
69
+ if (rearmTimer) {
70
+ clearTimeout(rearmTimer);
71
+ rearmTimer = null;
72
+ }
73
+ stopSpin();
74
+ });
53
75
  }
54
76
 
55
77
  child.on("exit", (code) => resolve(typeof code === "number" ? code : 1));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-smart",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Self-improving Claude Code plugin — learns from corrections via reflexio",
5
5
  "keywords": [
6
6
  "claude",