honeytree 1.2.3 → 1.2.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "honeytree",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "code with claude, and watch your forest grow! ",
5
5
  "type": "module",
6
6
  "bin": {
package/src/auth.js CHANGED
@@ -29,7 +29,7 @@ export function isLoggedIn() {
29
29
  return !!(auth && auth.access_token);
30
30
  }
31
31
 
32
- export async function loginWithDevice(apiUrl = process.env.HONEYTREE_API_URL || "https://tryhoney.xyz") {
32
+ export async function loginWithDevice(apiUrl = process.env.HONEYTREE_API_URL || "https://www.tryhoney.xyz") {
33
33
  const res = await fetch(`${apiUrl}/api/auth/device`, { method: "POST" });
34
34
  const contentType = res.headers.get("content-type") || "";
35
35
  if (!contentType.includes("application/json")) {
@@ -6,6 +6,7 @@ import os from "node:os";
6
6
  import { execSync } from "node:child_process";
7
7
  import { getAuth, isLoggedIn } from "../auth.js";
8
8
  import { getRewards, syncRewards, uncelebratedUnlocked, markCelebrated } from "../rewards.js";
9
+ import { syncNow } from "../sync.js";
9
10
  import UnlockCelebration from "./UnlockCelebration.js";
10
11
 
11
12
  import ForestScene from "./ForestScene.js";
@@ -74,6 +75,9 @@ export default function ForestApp() {
74
75
  useEffect(() => {
75
76
  if (!isLoggedIn()) return;
76
77
  let cancelled = false;
78
+ // Push the local forest up once on launch so the web mirror catches up
79
+ // even if no new tree gets planted this session.
80
+ syncNow().catch(() => {});
77
81
  const pull = () =>
78
82
  syncRewards()
79
83
  .then((r) => {
@@ -298,7 +302,7 @@ export default function ForestApp() {
298
302
  // Open checkout in browser
299
303
  const auth = getAuth();
300
304
  if (auth && auth.access_token) {
301
- fetch("https://tryhoney.xyz/api/checkout", {
305
+ fetch("https://www.tryhoney.xyz/api/checkout", {
302
306
  method: "POST",
303
307
  headers: {
304
308
  "Content-Type": "application/json",
package/src/plant-real.js CHANGED
@@ -4,7 +4,7 @@ import { readForest } from "./state.js";
4
4
  import { syncToCloud } from "./sync.js";
5
5
  import { asciiTree } from "./ascii-tree.js";
6
6
 
7
- const API_URL = process.env.HONEYTREE_API_URL || "https://tryhoney.xyz";
7
+ const API_URL = process.env.HONEYTREE_API_URL || "https://www.tryhoney.xyz";
8
8
  const POLL_INTERVAL_MS = 4000;
9
9
  const POLL_TIMEOUT_MS = 5 * 60 * 1000;
10
10
 
package/src/plant.js CHANGED
@@ -129,8 +129,9 @@ export async function tick(shape = null) {
129
129
  if (badgePath) writeBadgeSVG(forest, badgePath);
130
130
  } catch {}
131
131
 
132
- // Cloud sync every 10 prompts (fire-and-forget)
133
- if (isLoggedIn() && forest.totalPrompts % 10 === 0) {
132
+ // Cloud sync on every plant (fire-and-forget) so the web dashboard, which
133
+ // polls every 20s, mirrors the terminal in near real time.
134
+ if (isLoggedIn()) {
134
135
  syncToCloud(forest).catch(() => {});
135
136
  }
136
137
 
package/src/rewards.js CHANGED
@@ -40,7 +40,7 @@ export function hasCherryBlossom() { return hasReward("cherry"); }
40
40
 
41
41
  // Fetch rewards from server and cache locally
42
42
  export async function syncRewards(apiUrl) {
43
- apiUrl = apiUrl || process.env.HONEYTREE_API_URL || "https://tryhoney.xyz";
43
+ apiUrl = apiUrl || process.env.HONEYTREE_API_URL || "https://www.tryhoney.xyz";
44
44
  const { getAuth } = await import("./auth.js");
45
45
  const auth = getAuth();
46
46
  if (!auth || !auth.access_token) return null;
package/src/sync.js CHANGED
@@ -1,17 +1,20 @@
1
1
  import { getAuth, saveAuth } from "./auth.js";
2
2
  import { readForest } from "./state.js";
3
3
 
4
- const API_URL = process.env.HONEYTREE_API_URL || "https://tryhoney.xyz";
4
+ const API_URL = process.env.HONEYTREE_API_URL || "https://www.tryhoney.xyz";
5
5
 
6
6
  export async function syncToCloud(forest) {
7
7
  const auth = getAuth();
8
8
  if (!auth || !auth.access_token) return;
9
9
 
10
- // Send tree data: type, growth, x position for rendering on the web
10
+ // Send tree data for rendering on the web. variant ("ancient") and
11
+ // heightBonus must travel too, or gold/tall trees mirror as plain short ones.
11
12
  const trees = (forest.trees || []).map((t) => ({
12
13
  type: t.type,
13
14
  growth: t.growth,
14
15
  x: t.x,
16
+ ...(t.variant ? { variant: t.variant } : {}),
17
+ ...(t.heightBonus ? { heightBonus: t.heightBonus } : {}),
15
18
  }));
16
19
 
17
20
  try {