honeytree 1.2.1 → 1.2.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 +1 -1
- package/package.json +1 -2
- package/src/auth.js +8 -4
- package/src/components/ForestApp.js +24 -8
- package/src/rewards.js +4 -4
- package/src/varieties.js +4 -4
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "honeytree",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "code with claude, and watch your forest grow! ",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"chalk": "^5.4.1",
|
|
38
|
-
"honeytree": "^1.2.0",
|
|
39
38
|
"ink": "^7.0.4",
|
|
40
39
|
"react": "^19.2.6"
|
|
41
40
|
},
|
package/src/auth.js
CHANGED
|
@@ -36,13 +36,17 @@ export async function loginWithDevice(apiUrl = process.env.HONEYTREE_API_URL ||
|
|
|
36
36
|
console.error(" Server returned unexpected response. Is the Honeytree web app running?");
|
|
37
37
|
return false;
|
|
38
38
|
}
|
|
39
|
-
const { device_code, user_code, interval } = await res.json();
|
|
39
|
+
const { device_code, user_code, interval, verification_url } = await res.json();
|
|
40
|
+
|
|
41
|
+
const base = verification_url || `${apiUrl}/auth/device`;
|
|
42
|
+
const signInUrl = `${base}?code=${encodeURIComponent(user_code)}`;
|
|
40
43
|
|
|
41
44
|
console.log();
|
|
42
|
-
console.log(
|
|
45
|
+
console.log(" Open this link to sign in:");
|
|
46
|
+
console.log(` \x1b[36m${signInUrl}\x1b[0m`);
|
|
43
47
|
console.log();
|
|
44
|
-
console.log(
|
|
45
|
-
console.log(" Waiting...");
|
|
48
|
+
console.log(` (or enter code ${user_code} manually at ${base})`);
|
|
49
|
+
console.log(" Waiting for you to sign in...");
|
|
46
50
|
|
|
47
51
|
while (true) {
|
|
48
52
|
await new Promise((r) => setTimeout(r, (interval || 5) * 1000));
|
|
@@ -69,16 +69,32 @@ export default function ForestApp() {
|
|
|
69
69
|
const viewportXRef = useRef(viewportX);
|
|
70
70
|
viewportXRef.current = viewportX;
|
|
71
71
|
|
|
72
|
-
// Fetch rewards from server
|
|
72
|
+
// Fetch rewards from server, then re-poll so a variety unlocked on the web
|
|
73
|
+
// (after planting a real tree) appears here live, without restarting.
|
|
73
74
|
useEffect(() => {
|
|
74
|
-
if (isLoggedIn())
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
if (!isLoggedIn()) return;
|
|
76
|
+
let cancelled = false;
|
|
77
|
+
const pull = () =>
|
|
78
|
+
syncRewards()
|
|
79
|
+
.then((r) => {
|
|
80
|
+
if (!r || cancelled) return;
|
|
77
81
|
setRewards(r);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
// Queue any newly-unlocked celebrations without dropping one mid-show.
|
|
83
|
+
setCelebrationQueue((prev) => {
|
|
84
|
+
const merged = [...prev];
|
|
85
|
+
for (const k of uncelebratedUnlocked()) {
|
|
86
|
+
if (!merged.includes(k)) merged.push(k);
|
|
87
|
+
}
|
|
88
|
+
return merged;
|
|
89
|
+
});
|
|
90
|
+
})
|
|
91
|
+
.catch(() => {});
|
|
92
|
+
pull();
|
|
93
|
+
const id = setInterval(pull, 30000);
|
|
94
|
+
return () => {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
clearInterval(id);
|
|
97
|
+
};
|
|
82
98
|
}, []);
|
|
83
99
|
|
|
84
100
|
// Sync width to disk
|
package/src/rewards.js
CHANGED
|
@@ -7,10 +7,10 @@ const REWARDS_FILE = path.join(os.homedir(), ".honeydew", "rewards.json");
|
|
|
7
7
|
|
|
8
8
|
const TIERS = [
|
|
9
9
|
{ slug: "cherry", label: "Cherry Blossom", threshold: 1, description: "Cherry blossom trees in your forest" },
|
|
10
|
-
{ slug: "pine", label: "Pine", threshold:
|
|
11
|
-
{ slug: "oak", label: "Oak", threshold:
|
|
12
|
-
{ slug: "ancient", label: "Ancient", threshold:
|
|
13
|
-
{ slug: "mythic", label: "Mythic", threshold:
|
|
10
|
+
{ slug: "pine", label: "Pine", threshold: 2, description: "Evergreen pines in your forest" },
|
|
11
|
+
{ slug: "oak", label: "Oak", threshold: 4, description: "Broad oaks in your forest" },
|
|
12
|
+
{ slug: "ancient", label: "Ancient", threshold: 7, description: "Rare tall golden ancients" },
|
|
13
|
+
{ slug: "mythic", label: "Mythic", threshold: 10, description: "Glowing mythic trees" },
|
|
14
14
|
];
|
|
15
15
|
|
|
16
16
|
export { TIERS };
|
package/src/varieties.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
export const VARIETIES = [
|
|
6
6
|
{ key: "standard", threshold: 0, label: "Standard", species: [{ type: "birch" }, { type: "willow" }] },
|
|
7
7
|
{ key: "cherry", threshold: 1, label: "Cherry Blossom", species: [{ type: "cherry_blossom" }] },
|
|
8
|
-
{ key: "pine", threshold:
|
|
9
|
-
{ key: "oak", threshold:
|
|
10
|
-
{ key: "ancient", threshold:
|
|
11
|
-
{ key: "mythic", threshold:
|
|
8
|
+
{ key: "pine", threshold: 2, label: "Pine", species: [{ type: "pine" }] },
|
|
9
|
+
{ key: "oak", threshold: 4, label: "Oak", species: [{ type: "oak" }] },
|
|
10
|
+
{ key: "ancient", threshold: 7, label: "Ancient", species: [{ type: "oak", variant: "ancient" }] },
|
|
11
|
+
{ key: "mythic", threshold: 10, label: "Mythic", species: [{ type: "mythic" }] },
|
|
12
12
|
];
|
|
13
13
|
|
|
14
14
|
// Build the species pool from the set of unlocked variety keys.
|