ccclub 0.3.14 → 0.3.15
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/index.js +34 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1709,6 +1709,7 @@ async function getUpdateResult() {
|
|
|
1709
1709
|
|
|
1710
1710
|
// src/commands/rank.ts
|
|
1711
1711
|
var ACTIVE_THRESHOLD_MS = 15 * 60 * 1e3;
|
|
1712
|
+
var AGENT_ORDER = ["claude", "codex", "opencode", "amp", "pi"];
|
|
1712
1713
|
async function rankCommand(options) {
|
|
1713
1714
|
const config = await requireConfig();
|
|
1714
1715
|
if (!isHookInstalled()) await installHook();
|
|
@@ -1845,10 +1846,12 @@ function printGroup(data, code, period, config, showCache = false, showAll = fal
|
|
|
1845
1846
|
${data.group.name}`));
|
|
1846
1847
|
const periodLabel = { daily: "TODAY", yesterday: "YESTERDAY", weekly: "7 DAYS", monthly: "30 DAYS", "all-time": "ALL TIME" };
|
|
1847
1848
|
const now = Date.now();
|
|
1848
|
-
const
|
|
1849
|
+
const activeEntries = data.rankings.filter((r) => isEntryActive(r, now));
|
|
1850
|
+
const activeCount = activeEntries.length;
|
|
1849
1851
|
console.log(theme.muted(` ${periodLabel[period] || period.toUpperCase()} \xB7 ${data.start.slice(0, 10)} \u2192 ${data.end.slice(0, 10)} \xB7 ${data.group.memberCount} members`));
|
|
1850
1852
|
if (activeCount > 0) {
|
|
1851
|
-
|
|
1853
|
+
const activeSplit = formatActiveSourceSplit(activeEntries);
|
|
1854
|
+
console.log(theme.success(` ${activeCount} active`) + (activeSplit ? ` ${activeSplit}` : ""));
|
|
1852
1855
|
}
|
|
1853
1856
|
console.log("");
|
|
1854
1857
|
const activeRankings = showAll || data.rankings.length <= 15 ? data.rankings : data.rankings.filter((r) => r.costUSD > 0 || r.userId === config.userId);
|
|
@@ -1945,6 +1948,34 @@ function isEntryActive(entry, now) {
|
|
|
1945
1948
|
const activeAt = new Date(value).getTime();
|
|
1946
1949
|
return Number.isFinite(activeAt) && now - activeAt < ACTIVE_THRESHOLD_MS;
|
|
1947
1950
|
}
|
|
1951
|
+
function activeSourceForEntry(entry) {
|
|
1952
|
+
return entry.lastActiveSource ?? entry.agents?.[0];
|
|
1953
|
+
}
|
|
1954
|
+
function formatActiveSourceSplit(entries) {
|
|
1955
|
+
const counts = /* @__PURE__ */ new Map();
|
|
1956
|
+
for (const entry of entries) {
|
|
1957
|
+
const source = activeSourceForEntry(entry);
|
|
1958
|
+
if (!source) continue;
|
|
1959
|
+
counts.set(source, (counts.get(source) ?? 0) + 1);
|
|
1960
|
+
}
|
|
1961
|
+
const sources = AGENT_ORDER.filter((source) => (counts.get(source) ?? 0) > 0);
|
|
1962
|
+
if (sources.length === 0) return "";
|
|
1963
|
+
if (sources.length === 2 && sources.includes("claude") && sources.includes("codex")) {
|
|
1964
|
+
return [
|
|
1965
|
+
theme.muted("Claude"),
|
|
1966
|
+
theme.successBold(String(counts.get("claude") ?? 0)) + theme.faint(":"),
|
|
1967
|
+
theme.successBold(String(counts.get("codex") ?? 0)),
|
|
1968
|
+
theme.muted("Codex")
|
|
1969
|
+
].join(" ");
|
|
1970
|
+
}
|
|
1971
|
+
return sources.map((source) => formatActiveSourceScore(source, counts.get(source) ?? 0, false)).join(theme.faint(" \xB7 "));
|
|
1972
|
+
}
|
|
1973
|
+
function formatActiveSourceScore(source, count, countFirst) {
|
|
1974
|
+
const icon = source === "claude" ? theme.gold("\u25CF") : source === "codex" ? theme.linkText("\u25CF") : theme.success("\u25CF");
|
|
1975
|
+
const label = source === "claude" ? "Claude" : formatAgentLabel(source);
|
|
1976
|
+
const coloredCount = theme.successBold(String(count));
|
|
1977
|
+
return countFirst ? `${coloredCount} ${icon} ${theme.muted(label)}` : `${icon} ${theme.muted(label)} ${coloredCount}`;
|
|
1978
|
+
}
|
|
1948
1979
|
function podiumStyle(rank) {
|
|
1949
1980
|
if (rank === 1) return theme.gold;
|
|
1950
1981
|
if (rank === 2) return theme.silver;
|
|
@@ -2357,7 +2388,7 @@ async function hookCommand() {
|
|
|
2357
2388
|
}
|
|
2358
2389
|
|
|
2359
2390
|
// src/index.ts
|
|
2360
|
-
var VERSION = "0.3.
|
|
2391
|
+
var VERSION = "0.3.15";
|
|
2361
2392
|
startUpdateCheck(VERSION);
|
|
2362
2393
|
var program = new Command();
|
|
2363
2394
|
if (process.argv.slice(2).includes("-v")) {
|