claude-home 1.0.1 → 1.0.3
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 +2 -2
- package/bin/cli.js +41 -1
- package/package.json +1 -1
- package/public/index.html +41 -13
- package/server.js +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ Commands:
|
|
|
90
90
|
|
|
91
91
|
claude-home includes a marketplace to discover and install skills from GitHub repositories.
|
|
92
92
|
|
|
93
|
-
On first run it comes pre-configured with the [Anthropic Official skills repo](https://github.com/anthropics/skills). You can add your own sources (including private repos) by editing `~/.claude/
|
|
93
|
+
On first run it comes pre-configured with the [Anthropic Official skills repo](https://github.com/anthropics/skills). You can add your own sources (including private repos) by editing `~/.claude/claude-home/marketplace.json`:
|
|
94
94
|
|
|
95
95
|
```json
|
|
96
96
|
{
|
|
@@ -108,7 +108,7 @@ On first run it comes pre-configured with the [Anthropic Official skills repo](h
|
|
|
108
108
|
}
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
For private repos, set your token in `~/.claude/
|
|
111
|
+
For private repos, set your token in `~/.claude/claude-home/.env`:
|
|
112
112
|
|
|
113
113
|
```
|
|
114
114
|
GITHUB_TOKEN=ghp_your_token_here
|
package/bin/cli.js
CHANGED
|
@@ -57,16 +57,56 @@ if (subcommand === 'setup-hook') {
|
|
|
57
57
|
|
|
58
58
|
// ─── Main: start server or reuse existing ────────────────────────────────────
|
|
59
59
|
|
|
60
|
+
checkForUpdates(); // async, non-blocking
|
|
61
|
+
|
|
60
62
|
isPortFree(port).then(free => {
|
|
61
63
|
if (free) {
|
|
62
64
|
const { startServer } = require('../server.js');
|
|
63
65
|
startServer(port);
|
|
64
66
|
} else {
|
|
65
|
-
console.log(`
|
|
67
|
+
console.log(`claude-home already running at http://localhost:${port}`);
|
|
66
68
|
}
|
|
67
69
|
if (!noOpen) openBrowser(`http://localhost:${port}`);
|
|
68
70
|
});
|
|
69
71
|
|
|
72
|
+
// ─── Update check ────────────────────────────────────────────────────────────
|
|
73
|
+
|
|
74
|
+
function checkForUpdates() {
|
|
75
|
+
const cacheFile = path.join(os.homedir(), '.claude', 'claude-home', '.update-check');
|
|
76
|
+
const TTL = 24 * 60 * 60 * 1000; // 24h
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
|
80
|
+
if (Date.now() - cache.checkedAt < TTL) return; // still fresh
|
|
81
|
+
} catch { /* no cache yet */ }
|
|
82
|
+
|
|
83
|
+
const https = require('https');
|
|
84
|
+
https.get(`https://registry.npmjs.org/claude-home/latest`, { headers: { 'User-Agent': 'claude-home' } }, res => {
|
|
85
|
+
let data = '';
|
|
86
|
+
res.on('data', c => data += c);
|
|
87
|
+
res.on('end', () => {
|
|
88
|
+
try {
|
|
89
|
+
const latest = JSON.parse(data).version;
|
|
90
|
+
fs.writeFileSync(cacheFile, JSON.stringify({ checkedAt: Date.now(), latest }), 'utf8');
|
|
91
|
+
if (latest && latest !== pkg.version && isNewer(latest, pkg.version)) {
|
|
92
|
+
console.log(`\n Update available: ${pkg.version} → ${latest}`);
|
|
93
|
+
console.log(` Run: npm install -g claude-home@latest\n`);
|
|
94
|
+
}
|
|
95
|
+
} catch { /* ignore parse errors */ }
|
|
96
|
+
});
|
|
97
|
+
}).on('error', () => { /* ignore network errors */ });
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function isNewer(a, b) {
|
|
101
|
+
const pa = a.split('.').map(Number);
|
|
102
|
+
const pb = b.split('.').map(Number);
|
|
103
|
+
for (let i = 0; i < 3; i++) {
|
|
104
|
+
if (pa[i] > pb[i]) return true;
|
|
105
|
+
if (pa[i] < pb[i]) return false;
|
|
106
|
+
}
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
70
110
|
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
71
111
|
|
|
72
112
|
function isPortFree(p) {
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -1555,12 +1555,32 @@
|
|
|
1555
1555
|
<span x-text="fmtCarbon(insights.totalCarbon) || '—'"></span>
|
|
1556
1556
|
</div>
|
|
1557
1557
|
<template x-if="insights.totalCarbon > 100">
|
|
1558
|
-
<div style="margin-top:6px;display:flex;flex-direction:column;gap:
|
|
1559
|
-
|
|
1560
|
-
<div style="font-size:10px;color:var(--ink-3)
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1558
|
+
<div style="margin-top:6px;display:flex;flex-direction:column;gap:3px">
|
|
1559
|
+
<!-- Car -->
|
|
1560
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1561
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M5 17H3v-5l2-5h14l2 5v5h-2"/><circle cx="7.5" cy="17.5" r="1.5"/><circle cx="16.5" cy="17.5" r="1.5"/><path d="M5 12h14"/></svg>
|
|
1562
|
+
<span x-text="carbonEquivs(insights.totalCarbon)?.car"></span>
|
|
1563
|
+
</div>
|
|
1564
|
+
<!-- Plane -->
|
|
1565
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1566
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5z"/></svg>
|
|
1567
|
+
<span x-text="carbonEquivs(insights.totalCarbon)?.flights"></span>
|
|
1568
|
+
</div>
|
|
1569
|
+
<!-- Tree -->
|
|
1570
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1571
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M12 22v-7"/><path d="M9 15l3-3 3 3"/><path d="M7 12l5-5 5 5"/><path d="M5 9l7-7 7 7"/></svg>
|
|
1572
|
+
<span x-text="carbonEquivs(insights.totalCarbon)?.trees"></span>
|
|
1573
|
+
</div>
|
|
1574
|
+
<!-- Burger / Food -->
|
|
1575
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1576
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M4 8h16"/><path d="M4 12h16"/><path d="M4 16h16"/><path d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/></svg>
|
|
1577
|
+
<span x-text="carbonEquivs(insights.totalCarbon)?.burgers"></span>
|
|
1578
|
+
</div>
|
|
1579
|
+
<!-- Home / Electricity -->
|
|
1580
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1581
|
+
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/><path d="M9 21V12h6v9"/></svg>
|
|
1582
|
+
<span x-text="carbonEquivs(insights.totalCarbon)?.electricity"></span>
|
|
1583
|
+
</div>
|
|
1564
1584
|
</div>
|
|
1565
1585
|
</template>
|
|
1566
1586
|
</div>
|
|
@@ -1617,11 +1637,13 @@
|
|
|
1617
1637
|
<template x-if="insights?.totalCarbon > 100">
|
|
1618
1638
|
<span style="display:block;margin-bottom:10px;padding-bottom:10px;border-bottom:1px solid var(--rule)">
|
|
1619
1639
|
<strong>What does this equal?</strong><br>
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1640
|
+
<span style="display:flex;flex-direction:column;gap:3px;margin-top:5px">
|
|
1641
|
+
<span style="display:flex;align-items:center;gap:5px"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 17H3v-5l2-5h14l2 5v5h-2"/><circle cx="7.5" cy="17.5" r="1.5"/><circle cx="16.5" cy="17.5" r="1.5"/><path d="M5 12h14"/></svg><span x-text="carbonEquivs(insights.totalCarbon)?.car"></span></span>
|
|
1642
|
+
<span style="display:flex;align-items:center;gap:5px"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5z"/></svg><span x-text="carbonEquivs(insights.totalCarbon)?.flights"></span></span>
|
|
1643
|
+
<span style="display:flex;align-items:center;gap:5px"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 22v-7"/><path d="M9 15l3-3 3 3"/><path d="M7 12l5-5 5 5"/><path d="M5 9l7-7 7 7"/></svg><span x-text="carbonEquivs(insights.totalCarbon)?.trees"></span></span>
|
|
1644
|
+
<span style="display:flex;align-items:center;gap:5px"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M4 8h16"/><path d="M4 12h16"/><path d="M4 16h16"/><path d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/></svg><span x-text="carbonEquivs(insights.totalCarbon)?.burgers"></span></span>
|
|
1645
|
+
<span style="display:flex;align-items:center;gap:5px"><svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9.5L12 3l9 6.5V20a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/><path d="M9 21V12h6v9"/></svg><span x-text="carbonEquivs(insights.totalCarbon)?.electricity"></span></span>
|
|
1646
|
+
</span>
|
|
1625
1647
|
</span>
|
|
1626
1648
|
</template>
|
|
1627
1649
|
<strong>Calculation methodology</strong><br>
|
|
@@ -1638,8 +1660,14 @@
|
|
|
1638
1660
|
<div class="db-card-sub">all time</div>
|
|
1639
1661
|
<template x-if="insights?.totalCarbon > 100">
|
|
1640
1662
|
<div style="margin-top:8px;display:flex;flex-direction:column;gap:3px">
|
|
1641
|
-
<div style="font-size:10px;color:var(--ink-3)
|
|
1642
|
-
|
|
1663
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1664
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M5 17H3v-5l2-5h14l2 5v5h-2"/><circle cx="7.5" cy="17.5" r="1.5"/><circle cx="16.5" cy="17.5" r="1.5"/><path d="M5 12h14"/></svg>
|
|
1665
|
+
<span x-text="'≈ ' + carbonEquivs(insights.totalCarbon)?.car"></span>
|
|
1666
|
+
</div>
|
|
1667
|
+
<div style="font-size:10px;color:var(--ink-3);display:flex;align-items:center;gap:5px">
|
|
1668
|
+
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M12 22v-7"/><path d="M9 15l3-3 3 3"/><path d="M7 12l5-5 5 5"/><path d="M5 9l7-7 7 7"/></svg>
|
|
1669
|
+
<span x-text="'≈ ' + carbonEquivs(insights.totalCarbon)?.trees"></span>
|
|
1670
|
+
</div>
|
|
1643
1671
|
</div>
|
|
1644
1672
|
</template>
|
|
1645
1673
|
</div>
|
package/server.js
CHANGED
|
@@ -6,7 +6,7 @@ const readline = require('readline');
|
|
|
6
6
|
const https = require('https');
|
|
7
7
|
|
|
8
8
|
// ─── Data directory (user config, separate from package install location) ─────
|
|
9
|
-
const DATA_DIR = path.join(os.homedir(), '.claude', '
|
|
9
|
+
const DATA_DIR = path.join(os.homedir(), '.claude', 'claude-home');
|
|
10
10
|
|
|
11
11
|
function ensureDataDir() {
|
|
12
12
|
if (!fs.existsSync(DATA_DIR)) fs.mkdirSync(DATA_DIR, { recursive: true });
|