honeytree 1.1.2 → 1.1.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/bin/honeydew.js +19 -1
- package/package.json +1 -1
- package/src/commands/watch.js +5 -3
- package/src/renderers/terminal.js +13 -1
package/bin/honeydew.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
3
5
|
const command = process.argv[2];
|
|
6
|
+
const invokedAs = path.basename(process.argv[1] || "honeytree");
|
|
7
|
+
|
|
8
|
+
function printUsage() {
|
|
9
|
+
console.error("Usage:");
|
|
10
|
+
console.error(" honeytree show your forest");
|
|
11
|
+
console.error(" honeytree init create or migrate your forest");
|
|
12
|
+
console.error(" honeytree watch open the terminal forest");
|
|
13
|
+
console.error(" honeytree stats show a non-TUI summary");
|
|
14
|
+
console.error(" honeytree export write honeytree-badge.svg and FOREST.md");
|
|
15
|
+
}
|
|
4
16
|
|
|
5
17
|
if (command === "init") {
|
|
6
18
|
const { init } = await import("../src/commands/init.js");
|
|
@@ -11,11 +23,17 @@ if (command === "init") {
|
|
|
11
23
|
} else if (command === "watch" || !command) {
|
|
12
24
|
const { watch } = await import("../src/commands/watch.js");
|
|
13
25
|
await watch();
|
|
26
|
+
} else if (command === "stats") {
|
|
27
|
+
const { stats } = await import("../src/commands/stats.js");
|
|
28
|
+
await stats();
|
|
14
29
|
} else if (command === "plant") {
|
|
15
30
|
const { plant } = await import("../src/commands/plant.js");
|
|
16
31
|
await plant();
|
|
17
32
|
} else {
|
|
18
33
|
console.error(`Unknown command: ${command}`);
|
|
19
|
-
|
|
34
|
+
if (invokedAs === "honeydew") {
|
|
35
|
+
console.error("Run `honeydew watch` or `honeytree init`.");
|
|
36
|
+
}
|
|
37
|
+
printUsage();
|
|
20
38
|
process.exit(1);
|
|
21
39
|
}
|
package/package.json
CHANGED
package/src/commands/watch.js
CHANGED
|
@@ -8,8 +8,9 @@ import { createActivityTracker } from "../tracker/activity.js";
|
|
|
8
8
|
import { startFileTracker } from "../tracker/files.js";
|
|
9
9
|
import { startGitTracker } from "../tracker/git.js";
|
|
10
10
|
|
|
11
|
-
const FRAME_MS =
|
|
12
|
-
const
|
|
11
|
+
const FRAME_MS = 150;
|
|
12
|
+
const STATE_SYNC_MS = 1_000;
|
|
13
|
+
const GIT_POLL_MS = 30_000;
|
|
13
14
|
const h = React.createElement;
|
|
14
15
|
|
|
15
16
|
function buildCommandHint(width) {
|
|
@@ -57,7 +58,7 @@ function ForestWatchApp() {
|
|
|
57
58
|
if (latest) {
|
|
58
59
|
setState(latest);
|
|
59
60
|
}
|
|
60
|
-
},
|
|
61
|
+
}, STATE_SYNC_MS);
|
|
61
62
|
return () => clearInterval(syncTimer);
|
|
62
63
|
}, []);
|
|
63
64
|
|
|
@@ -82,6 +83,7 @@ function ForestWatchApp() {
|
|
|
82
83
|
const gitTracker = startGitTracker({
|
|
83
84
|
cwd: process.cwd(),
|
|
84
85
|
lastCommitHash: state.last_commit_hash,
|
|
86
|
+
pollMs: GIT_POLL_MS,
|
|
85
87
|
async onCommit(commitHash) {
|
|
86
88
|
const nextState = updateState((draft) => applyCommit(draft, { commitHash }));
|
|
87
89
|
setState(nextState);
|
|
@@ -248,10 +248,19 @@ function desaturatePalette(palette, skyBottom, amount) {
|
|
|
248
248
|
return result;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
function silhouettePalette(palette) {
|
|
252
|
+
const result = {};
|
|
253
|
+
for (const key of Object.keys(palette)) {
|
|
254
|
+
result[key] = key.toLowerCase().includes("light") ? "#24243f" : "#111827";
|
|
255
|
+
}
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
|
|
251
259
|
function drawForest(buffer, width, viewportTrees, state, environment, tick, layout) {
|
|
252
260
|
const { skyRows, forestRows, artRows, groundRows } = layout;
|
|
253
261
|
const treeBaseY = skyRows + forestRows - 1;
|
|
254
262
|
const crystalPalette = getCrystalPalette(tick);
|
|
263
|
+
const isSunsetSilhouette = environment.sky.name === "sunset";
|
|
255
264
|
|
|
256
265
|
const rowOffset = { back: 4, mid: 2, front: 0 };
|
|
257
266
|
const rowDesaturation = { back: 0.3, mid: 0.1, front: 0 };
|
|
@@ -261,7 +270,9 @@ function drawForest(buffer, width, viewportTrees, state, environment, tick, layo
|
|
|
261
270
|
|
|
262
271
|
for (const tree of rowTrees) {
|
|
263
272
|
let palette = environment.palette;
|
|
264
|
-
if (
|
|
273
|
+
if (isSunsetSilhouette) {
|
|
274
|
+
palette = silhouettePalette(palette);
|
|
275
|
+
} else if (rowDesaturation[targetRow] > 0) {
|
|
265
276
|
palette = desaturatePalette(palette, environment.sky.bottom, rowDesaturation[targetRow]);
|
|
266
277
|
}
|
|
267
278
|
if (tree.species === "crystal_tree") {
|
|
@@ -400,6 +411,7 @@ export function buildTerminalScene(state, termWidth = 80, tick = 0, options = {}
|
|
|
400
411
|
width,
|
|
401
412
|
environment,
|
|
402
413
|
layout,
|
|
414
|
+
viewportTrees,
|
|
403
415
|
buffer,
|
|
404
416
|
statsLine: buildStatsLine(state, environment, width, options.color !== false),
|
|
405
417
|
};
|