azclaude-copilot 0.5.1 → 0.5.2

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
@@ -758,11 +758,11 @@ An agent is a sub-process. Use one when work must happen **in parallel** or **in
758
758
 
759
759
  ## Verified
760
760
 
761
- 1758 tests. Every template, command, capability, agent, hook, and CLI feature verified.
761
+ 1763 tests. Every template, command, capability, agent, hook, and CLI feature verified.
762
762
 
763
763
  ```bash
764
764
  bash tests/test-features.sh
765
- # Results: 1758 passed, 0 failed, 1758 total
765
+ # Results: 1763 passed, 0 failed, 1763 total
766
766
  ```
767
767
 
768
768
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azclaude-copilot",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
4
4
  "description": "AI coding environment — 39 commands, 10 skills, 15 agents, memory, reflexes, evolution. Install: npx azclaude-copilot@latest, then open Claude Code.",
5
5
  "bin": {
6
6
  "azclaude": "bin/cli.js",
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  // AZCLAUDE statusline — auto-installed by setup
3
- // Shows: model | context % (color-coded) | rate limit | session time | lines changed
3
+ // Shows: model | context bar | git branch | rate limit | cache | time | lines | cost
4
4
  // Updates automatically after every turn — no manual action needed.
5
5
  // Zero dependencies — uses only Node.js (already required by AZCLAUDE).
6
6
  'use strict';
7
7
 
8
+ const { execSync } = require('child_process');
9
+
8
10
  let raw = '';
9
11
  process.stdin.setEncoding('utf8');
10
12
  process.stdin.on('data', chunk => { raw += chunk; });
@@ -25,6 +27,12 @@ process.stdin.on('end', () => {
25
27
  const linesDel = data.cost?.total_lines_removed || 0;
26
28
  const rate5h = data.rate_limits?.five_hour?.used_percentage ?? -1;
27
29
 
30
+ // Token details
31
+ const inputTok = data.context_window?.total_input_tokens || 0;
32
+ const outputTok = data.context_window?.total_output_tokens || 0;
33
+ const cachWrite = data.context_window?.current_usage?.cache_creation_input_tokens || 0;
34
+ const cachRead = data.context_window?.current_usage?.cache_read_input_tokens || 0;
35
+
28
36
  // ── Format helpers ──
29
37
  const durSec = Math.floor(durMs / 1000);
30
38
  const mins = Math.floor(durSec / 60);
@@ -32,10 +40,50 @@ process.stdin.on('end', () => {
32
40
 
33
41
  const ctxLabel = ctxSize >= 1000000 ? '1M' : ctxSize >= 100000 ? '200k' : String(ctxSize);
34
42
 
43
+ // Format large token numbers: 1234567 → 1.2M, 12345 → 12k
44
+ function fmtTok(n) {
45
+ if (n >= 1000000) return (n / 1000000).toFixed(1) + 'M';
46
+ if (n >= 1000) return (n / 1000).toFixed(0) + 'k';
47
+ return String(n);
48
+ }
49
+
50
+ // ── Git info (cached — fast on subsequent calls) ──
51
+ let gitBranch = '';
52
+ let gitDirty = 0;
53
+ try {
54
+ gitBranch = execSync('git branch --show-current 2>/dev/null', { encoding: 'utf8', timeout: 2000 }).trim();
55
+ const status = execSync('git status --porcelain 2>/dev/null', { encoding: 'utf8', timeout: 2000 }).trim();
56
+ gitDirty = status ? status.split('\n').length : 0;
57
+ } catch (_) {}
58
+
59
+ // ── Compaction prediction ──
60
+ // Estimate turns remaining before context hits 90% (compaction threshold)
61
+ // Uses average tokens per turn from session data
62
+ let compactHint = '';
63
+ if (ctxPct > 0 && ctxPct < 90 && inputTok > 0) {
64
+ const totalTok = Math.floor(ctxSize * ctxPct / 100);
65
+ const remaining = Math.floor(ctxSize * 0.9) - totalTok;
66
+ // Rough estimate: average ~4000 tokens per turn (input + output + overhead)
67
+ const avgPerTurn = 4000;
68
+ const turnsLeft = Math.max(1, Math.floor(remaining / avgPerTurn));
69
+ if (turnsLeft <= 20) {
70
+ compactHint = turnsLeft <= 5 ? ` ~${turnsLeft}t!` : ` ~${turnsLeft}t`;
71
+ }
72
+ }
73
+
74
+ // ── Cache hit ratio ──
75
+ let cacheHint = '';
76
+ if (cachRead > 0 || cachWrite > 0) {
77
+ const total = cachRead + cachWrite;
78
+ const hitPct = total > 0 ? Math.floor(cachRead / total * 100) : 0;
79
+ cacheHint = `Cache:${hitPct}%`;
80
+ }
81
+
35
82
  // ── ANSI colors ──
36
83
  const GREEN = '\x1b[32m';
37
84
  const YELLOW = '\x1b[33m';
38
85
  const RED = '\x1b[31m';
86
+ const CYAN = '\x1b[36m';
39
87
  const DIM = '\x1b[2m';
40
88
  const BOLD = '\x1b[1m';
41
89
  const RESET = '\x1b[0m';
@@ -51,20 +99,39 @@ process.stdin.on('end', () => {
51
99
  else if (ctxPct >= 60) { ctxColor = YELLOW; }
52
100
  else { ctxColor = GREEN; }
53
101
 
54
- // ── Line 1: model + context bar ──
102
+ // ── Line 1: model + context bar + compaction prediction ──
55
103
  let line1 = `${DIM}[${RESET}${BOLD}${model}${RESET}${DIM}]${RESET} `;
56
104
  line1 += `${ctxColor}${bar} ${ctxPct}%${RESET}`;
57
105
  line1 += `${DIM}/${ctxLabel}${RESET}`;
58
106
  if (ctxWarn) line1 += `${RED}${ctxWarn}${RESET}`;
107
+ if (compactHint) {
108
+ const compColor = compactHint.includes('!') ? RED : YELLOW;
109
+ line1 += `${compColor}${compactHint}${RESET}`;
110
+ }
111
+ // Git branch
112
+ if (gitBranch) {
113
+ line1 += ` ${DIM}|${RESET} ${CYAN}${gitBranch}${RESET}`;
114
+ if (gitDirty > 0) line1 += `${YELLOW}*${gitDirty}${RESET}`;
115
+ }
59
116
 
60
- // ── Line 2: rate limit + time + lines + cost ──
117
+ // ── Line 2: rate limit + cache + tokens + time + lines + cost ──
61
118
  let line2 = '';
62
119
 
63
120
  // Rate limit (only show if available — Pro/Max subscription)
64
121
  if (rate5h >= 0) {
65
122
  const r = Math.floor(rate5h);
66
123
  const rColor = r >= 80 ? RED : r >= 50 ? YELLOW : DIM;
67
- line2 += `${rColor}Rate: ${r}%${RESET} ${DIM}|${RESET} `;
124
+ line2 += `${rColor}Rate:${r}%${RESET} `;
125
+ }
126
+
127
+ // Cache hit ratio
128
+ if (cacheHint) {
129
+ line2 += `${DIM}${cacheHint}${RESET} `;
130
+ }
131
+
132
+ // Token totals
133
+ if (inputTok > 0 || outputTok > 0) {
134
+ line2 += `${DIM}In:${fmtTok(inputTok)} Out:${fmtTok(outputTok)}${RESET} `;
68
135
  }
69
136
 
70
137
  // Duration
@@ -72,12 +139,12 @@ process.stdin.on('end', () => {
72
139
 
73
140
  // Lines changed
74
141
  if (linesAdd > 0 || linesDel > 0) {
75
- line2 += ` ${DIM}|${RESET} ${GREEN}+${linesAdd}${RESET}${DIM}/${RESET}${RED}-${linesDel}${RESET}`;
142
+ line2 += ` ${GREEN}+${linesAdd}${RESET}${DIM}/${RESET}${RED}-${linesDel}${RESET}`;
76
143
  }
77
144
 
78
145
  // Cost (only show if > 0 — API billing)
79
146
  if (cost > 0) {
80
- line2 += ` ${DIM}|${RESET} $${cost.toFixed(2)}`;
147
+ line2 += ` ${DIM}$${cost.toFixed(2)}${RESET}`;
81
148
  }
82
149
 
83
150
  // ── Output ──