@jango-blockchained/hoox-cli 0.9.1 → 0.9.4

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.
Files changed (4) hide show
  1. package/README.md +37 -31
  2. package/bin/hoox.js +47 -4
  3. package/dist/index.js +2611 -1943
  4. package/package.json +4 -4
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  > **Runtime requirement:** Bun ≥ 1.2. The bin shebang and bundle target are Bun-only; `npm install -g` will install the package but the CLI will not run under Node.js.
8
8
 
9
- **v0.9.1** — 411 unit tests, 25 command groups, 60+ subcommands. Modern-minimal visual refresh, completion footer, did-you-mean suggestions, custom help. **v0.9.0** had a banner version-lookup bug in global installs — fixed in 0.9.1.
9
+ **v0.9.3** — 28 top-level command groups, 800+ unit tests. Modern-minimal visual refresh, completion footer, did-you-mean suggestions, custom help, hop-level `perf fastpath` observability. **v0.9.0** had a banner version-lookup bug in global installs — fixed in 0.9.1.
10
10
 
11
11
  ## Features
12
12
 
@@ -44,9 +44,14 @@ bun add -g @jango-blockchained/hoox-cli
44
44
  ```bash
45
45
  cd packages/cli
46
46
  bun install
47
- bun run build
47
+ bun run build # produces dist/index.js — required for `hoox` after global install
48
48
  ```
49
49
 
50
+ > `bin/hoox.js` resolves `dist/index.js` first and falls back to `src/index.ts`
51
+ > when `dist/` is missing, so contributors who skip the build step can still
52
+ > run the CLI via `bun bin/hoox.js …` or a `bun link`-based install. Production
53
+ > releases and the `prepublishOnly` script always build first.
54
+
50
55
  ## Quick Start
51
56
 
52
57
  ```bash
@@ -70,35 +75,36 @@ hoox perf fastpath run --n 50
70
75
 
71
76
  ## Available Commands
72
77
 
73
- | Command | Description |
74
- | ----------------- | -------------------------------------------------------------------- |
75
- | `hoox onboard` | **Recommended entry point.** One-shot full bootstrap (init + setup) |
76
- | `hoox init` | Interactive setup wizard (writes `wrangler.jsonc`, collects secrets) |
77
- | `hoox setup` | Auto-bootstrap infrastructure (auth, keys, D1, secrets, dashboard) |
78
- | `hoox clone` | Clone worker repositories as git submodules |
79
- | `hoox dev` | Start local development environment for all workers |
80
- | `hoox deploy` | Deploy workers, dashboard, telegram webhook, and KV config |
81
- | `hoox infra` | Manage infrastructure (D1, KV, R2, Queues, Vectorize, Analytics) |
82
- | `hoox config` | Manage `wrangler.jsonc` configuration |
83
- | `hoox secrets` | Manage Cloudflare Worker secrets |
84
- | `hoox keys` | Manage internal auth keys |
85
- | `hoox check` | Validate setup, prerequisites, and worker health |
86
- | `hoox db` | Manage D1 databases (apply, migrate, query, export, reset) |
87
- | `hoox monitor` | Monitor trades, logs, kill switch, queue, backup |
88
- | `hoox workers` | Per-worker operations (list, dev, logs) |
89
- | `hoox repair` | Diagnose and repair the system (check, rebuild, per-component) |
90
- | `hoox schema` | Manage D1 schema and migrations |
91
- | `hoox update` | Self-update the CLI and check wrangler versions |
92
- | `hoox logs` | Stream and filter Cloudflare Worker logs |
93
- | `hoox test` | Run tests and CI pipeline |
94
- | `hoox waf` | Manage Cloudflare WAF rules and policies |
95
- | `hoox dashboard` | Dashboard operations (`dev`, `deploy`) |
96
- | `hoox tui` | Launch the OpenTUI terminal dashboard |
97
- | `hoox agent` | AI agent operations (health probe) |
98
- | `hoox trace` | Query Cloudflare Workers Observability (events, metrics, traces) |
99
- | `hoox perf` | Performance measurement tools (`fastpath` probe-based latency) |
100
- | `hoox disclaimer` | Display legal disclaimer |
101
- | `hoox completion` | Generate shell completion script (bash, zsh, fish) |
78
+ | Command | Description |
79
+ | ----------------- | ----------------------------------------------------------------------------- |
80
+ | `hoox onboard` | **Recommended entry point.** One-shot full bootstrap (init + setup) |
81
+ | `hoox init` | Interactive setup wizard (writes `wrangler.jsonc`, collects secrets) |
82
+ | `hoox setup` | Auto-bootstrap infrastructure (auth, keys, D1, secrets, dashboard) |
83
+ | `hoox clone` | Clone worker repositories as git submodules |
84
+ | `hoox dev` | Start local development environment for all workers |
85
+ | `hoox deploy` | Deploy workers, dashboard, telegram webhook, and KV config |
86
+ | `hoox infra` | Manage infrastructure (D1, KV, R2, Queues, Vectorize, Analytics) |
87
+ | `hoox config` | Manage `wrangler.jsonc` configuration |
88
+ | `hoox secrets` | Manage Cloudflare Worker secrets |
89
+ | `hoox keys` | Manage internal auth keys |
90
+ | `hoox check` | Validate setup, prerequisites, and worker health |
91
+ | `hoox db` | Manage D1 databases (apply, migrate, query, export, reset) |
92
+ | `hoox monitor` | Monitor trades, logs, kill switch, queue, backup |
93
+ | `hoox workers` | Per-worker operations (list, dev, logs) |
94
+ | `hoox repair` | Diagnose and repair the system (check, rebuild, per-component) |
95
+ | `hoox schema` | Manage D1 schema and migrations |
96
+ | `hoox update` | Self-update the CLI and check wrangler versions |
97
+ | `hoox logs` | Stream and filter Cloudflare Worker logs |
98
+ | `hoox test` | Run tests and CI pipeline |
99
+ | `hoox waf` | Manage Cloudflare WAF rules and policies |
100
+ | `hoox dashboard` | Dashboard operations (`dev`, `deploy`) |
101
+ | `hoox tui` | Launch the OpenTUI terminal dashboard |
102
+ | `hoox agent` | AI agent operations (health probe) |
103
+ | `hoox trace` | Query Cloudflare Workers Observability (events, metrics, traces) |
104
+ | `hoox perf` | Performance measurement tools (`fastpath` probe-based latency) |
105
+ | `hoox pine` | Pine Script tooling (download data, backtest, export chart data, bundle libs) |
106
+ | `hoox disclaimer` | Display legal disclaimer |
107
+ | `hoox completion` | Generate shell completion script (bash, zsh, fish) |
102
108
 
103
109
  ### Global Options
104
110
 
package/bin/hoox.js CHANGED
@@ -2,10 +2,53 @@
2
2
  /**
3
3
  * Hoox CLI binary entry point.
4
4
  *
5
- * Bun's bin-symlink resolves here. Uses the pre-built dist bundle
6
- * (self-contained includes hoox-shared). Run `bun run build` to regenerate.
5
+ * Resolution order (first match wins):
6
+ * 1. `../dist/index.js` bundled output from `bun run build`
7
+ * 2. `../src/index.ts` — dev mode (run from a fresh `bun install` without
8
+ * running the build first; Bun compiles TS on import)
9
+ * 3. Clear error message instructing the user to run `bun run build`
10
+ *
11
+ * The dev fallback lets contributors and CI jobs that haven't yet run
12
+ * `bun run build` still execute the CLI directly via `bun bin/hoox.js` or
13
+ * `hoox` after a `bun link`.
14
+ *
15
+ * `main` is exported from `src/index.ts` so we can call it explicitly —
16
+ * the `import.meta.main` guard inside that file would otherwise be false
17
+ * when the module is loaded as a side effect from here.
7
18
  */
8
19
 
9
- import { main } from "../dist/index.js";
20
+ import { existsSync } from "node:fs";
21
+ import { fileURLToPath } from "node:url";
22
+ import { dirname, resolve } from "node:path";
23
+
24
+ const here = dirname(fileURLToPath(import.meta.url));
25
+ const distEntry = resolve(here, "..", "dist", "index.js");
26
+ const srcEntry = resolve(here, "..", "src", "index.ts");
27
+
28
+ async function loadAndRun(entry) {
29
+ // Bun caches imports; the first import wins for the lifetime of the
30
+ // process. The dist build and the source file are the same module
31
+ // logically, so a second entry would be a no-op.
32
+ const mod = await import(entry);
33
+ if (typeof mod.main === "function") {
34
+ await mod.main();
35
+ }
36
+ }
10
37
 
11
- await main();
38
+ if (existsSync(distEntry)) {
39
+ // Production path — bundled and self-contained.
40
+ await loadAndRun(distEntry);
41
+ } else if (existsSync(srcEntry)) {
42
+ // Dev path — Bun transpiles on the fly. Useful for `bun link` and CI
43
+ // smoke tests that run before the build step.
44
+ await loadAndRun(srcEntry);
45
+ } else {
46
+ console.error(
47
+ `hoox: could not find an entry point. Looked for:\n` +
48
+ ` - ${distEntry}\n` +
49
+ ` - ${srcEntry}\n\n` +
50
+ `Run \`bun run build\` in packages/cli/ to produce the bundled dist/, ` +
51
+ `or install from source so src/index.ts is present.`
52
+ );
53
+ process.exit(1);
54
+ }