claude-scope 0.6.9 → 0.6.10
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/dist/claude-scope.cjs +37 -34
- package/package.json +2 -2
package/dist/claude-scope.cjs
CHANGED
|
@@ -1788,14 +1788,42 @@ function createWidgetMetadata(name, description, version = "1.0.0", author = "cl
|
|
|
1788
1788
|
};
|
|
1789
1789
|
}
|
|
1790
1790
|
|
|
1791
|
-
// src/
|
|
1791
|
+
// src/ui/utils/formatters.ts
|
|
1792
|
+
function formatDuration(ms) {
|
|
1793
|
+
if (ms <= 0) return "0s";
|
|
1794
|
+
const seconds = Math.floor(ms / TIME.MS_PER_SECOND);
|
|
1795
|
+
const hours = Math.floor(seconds / TIME.SECONDS_PER_HOUR);
|
|
1796
|
+
const minutes = Math.floor(seconds % TIME.SECONDS_PER_HOUR / TIME.SECONDS_PER_MINUTE);
|
|
1797
|
+
const secs = seconds % TIME.SECONDS_PER_MINUTE;
|
|
1798
|
+
const parts = [];
|
|
1799
|
+
if (hours > 0) {
|
|
1800
|
+
parts.push(`${hours}h`);
|
|
1801
|
+
parts.push(`${minutes}m`);
|
|
1802
|
+
parts.push(`${secs}s`);
|
|
1803
|
+
} else if (minutes > 0) {
|
|
1804
|
+
parts.push(`${minutes}m`);
|
|
1805
|
+
parts.push(`${secs}s`);
|
|
1806
|
+
} else {
|
|
1807
|
+
parts.push(`${secs}s`);
|
|
1808
|
+
}
|
|
1809
|
+
return parts.join(" ");
|
|
1810
|
+
}
|
|
1811
|
+
function formatCostUSD(usd) {
|
|
1812
|
+
return `$${usd.toFixed(2)}`;
|
|
1813
|
+
}
|
|
1814
|
+
function colorize2(text, color) {
|
|
1815
|
+
return `${color}${text}${ANSI_COLORS.RESET}`;
|
|
1816
|
+
}
|
|
1792
1817
|
function formatK(n) {
|
|
1793
|
-
|
|
1818
|
+
const absN = Math.abs(n);
|
|
1819
|
+
if (absN < 1e3) {
|
|
1794
1820
|
return n.toString();
|
|
1795
1821
|
}
|
|
1796
1822
|
const k = n / 1e3;
|
|
1797
|
-
return k < 10 ? `${k.toFixed(1)}k` : `${Math.round(k)}k`;
|
|
1823
|
+
return Math.abs(k) < 10 ? `${k.toFixed(1)}k` : `${Math.round(k)}k`;
|
|
1798
1824
|
}
|
|
1825
|
+
|
|
1826
|
+
// src/widgets/cache-metrics/styles.ts
|
|
1799
1827
|
function formatCurrency(usd) {
|
|
1800
1828
|
if (usd < 5e-3 && usd > 0) {
|
|
1801
1829
|
return "<$0.01";
|
|
@@ -1926,8 +1954,9 @@ var CacheMetricsWidget = class extends StdinDataWidget {
|
|
|
1926
1954
|
const cacheWrite = usage.cache_creation_input_tokens ?? 0;
|
|
1927
1955
|
const inputTokens = usage.input_tokens ?? 0;
|
|
1928
1956
|
const outputTokens = usage.output_tokens ?? 0;
|
|
1929
|
-
const
|
|
1930
|
-
const
|
|
1957
|
+
const totalInputTokens = cacheRead + cacheWrite + inputTokens;
|
|
1958
|
+
const totalTokens = totalInputTokens + outputTokens;
|
|
1959
|
+
const hitRate = totalInputTokens > 0 ? Math.min(100, Math.round(cacheRead / totalInputTokens * 100)) : 0;
|
|
1931
1960
|
const costPerToken = 3e-6;
|
|
1932
1961
|
const savings = cacheRead * 0.9 * costPerToken;
|
|
1933
1962
|
return {
|
|
@@ -2350,33 +2379,6 @@ var ContextWidget = class extends StdinDataWidget {
|
|
|
2350
2379
|
}
|
|
2351
2380
|
};
|
|
2352
2381
|
|
|
2353
|
-
// src/ui/utils/formatters.ts
|
|
2354
|
-
function formatDuration(ms) {
|
|
2355
|
-
if (ms <= 0) return "0s";
|
|
2356
|
-
const seconds = Math.floor(ms / TIME.MS_PER_SECOND);
|
|
2357
|
-
const hours = Math.floor(seconds / TIME.SECONDS_PER_HOUR);
|
|
2358
|
-
const minutes = Math.floor(seconds % TIME.SECONDS_PER_HOUR / TIME.SECONDS_PER_MINUTE);
|
|
2359
|
-
const secs = seconds % TIME.SECONDS_PER_MINUTE;
|
|
2360
|
-
const parts = [];
|
|
2361
|
-
if (hours > 0) {
|
|
2362
|
-
parts.push(`${hours}h`);
|
|
2363
|
-
parts.push(`${minutes}m`);
|
|
2364
|
-
parts.push(`${secs}s`);
|
|
2365
|
-
} else if (minutes > 0) {
|
|
2366
|
-
parts.push(`${minutes}m`);
|
|
2367
|
-
parts.push(`${secs}s`);
|
|
2368
|
-
} else {
|
|
2369
|
-
parts.push(`${secs}s`);
|
|
2370
|
-
}
|
|
2371
|
-
return parts.join(" ");
|
|
2372
|
-
}
|
|
2373
|
-
function formatCostUSD(usd) {
|
|
2374
|
-
return `$${usd.toFixed(2)}`;
|
|
2375
|
-
}
|
|
2376
|
-
function colorize2(text, color) {
|
|
2377
|
-
return `${color}${text}${ANSI_COLORS.RESET}`;
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
2382
|
// src/widgets/cost/styles.ts
|
|
2381
2383
|
var costStyles = {
|
|
2382
2384
|
balanced: (data, colors) => {
|
|
@@ -3268,7 +3270,8 @@ function getStraightIndices(cards, highCard) {
|
|
|
3268
3270
|
indices.push(cardIndicesByRank.get(next1)[0]);
|
|
3269
3271
|
indices.push(cardIndicesByRank.get(next2)[0]);
|
|
3270
3272
|
indices.push(cardIndicesByRank.get(next3)[0]);
|
|
3271
|
-
|
|
3273
|
+
const rank4 = next4 === 1 ? 14 : next4;
|
|
3274
|
+
indices.push(cardIndicesByRank.get(rank4)[0]);
|
|
3272
3275
|
return indices;
|
|
3273
3276
|
}
|
|
3274
3277
|
}
|
|
@@ -3632,7 +3635,7 @@ var PokerWidget = class extends StdinDataWidget {
|
|
|
3632
3635
|
async update(data) {
|
|
3633
3636
|
await super.update(data);
|
|
3634
3637
|
const now = Date.now();
|
|
3635
|
-
if (now - this.lastUpdateTimestamp < this.THROTTLE_MS) {
|
|
3638
|
+
if (this.lastUpdateTimestamp > 0 && now - this.lastUpdateTimestamp < this.THROTTLE_MS) {
|
|
3636
3639
|
return;
|
|
3637
3640
|
}
|
|
3638
3641
|
const deck = new Deck();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-scope",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.10",
|
|
4
4
|
"description": "Claude Code plugin for session status and analytics",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"test": "tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts tests/unit/ui/theme/*.test.ts",
|
|
23
23
|
"test:unit": "tsx --test tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts",
|
|
24
24
|
"test:integration": "tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts",
|
|
25
|
-
"test:coverage": "c8 --reporter=text --reporter=html --exclude='tests/**' --exclude='**/*.test.ts' tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts tests/unit/ui/theme/*.test.ts",
|
|
25
|
+
"test:coverage": "c8 --check-coverage --lines=80 --functions=75 --statements=80 --branches=65 --reporter=text --reporter=html --exclude='tests/**' --exclude='**/*.test.ts' tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts tests/unit/ui/theme/*.test.ts",
|
|
26
26
|
"test:snapshot": "SNAPSHOT_UPDATE=true tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts",
|
|
27
27
|
"test:snapshot:verify": "tsx --test tests/e2e/stdin-flow.test.ts tests/integration/cli-flow.integration.test.ts tests/integration/five-widgets.integration.test.ts tests/unit/cli.test.ts tests/unit/types.test.ts tests/unit/core/*.test.ts tests/unit/data/*.test.ts tests/unit/utils/*.test.ts tests/unit/widgets/*.test.ts",
|
|
28
28
|
"dev": "tsx src/index.ts"
|