botanary 0.3.0 → 0.4.0

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.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * This package's own version, read from its real `package.json` at runtime.
3
+ *
4
+ * WHY NOT `await import('../package.json', { with: { type: 'json' } })`, which is what `bin/botanary.ts`
5
+ * used to do: with `resolveJsonModule`, `tsc` COPIES that JSON into `outDir`, so every build emitted a
6
+ * `dist/package.json` - a second, nested manifest inside the tarball that `files: ["dist"]` then
7
+ * published. Node reads a nested `package.json` as a package boundary for everything beneath it, and
8
+ * this one arrived carrying the whole dev manifest: `scripts`, `devDependencies`, and a `bin` path
9
+ * (`dist/bin/botanary.js`) that is wrong when read relative to `dist/` itself. It worked only because
10
+ * tsc copies the file verbatim and the copy happened to inherit `"type": "module"`; the moment that
11
+ * field moved or changed, every `.js` under `dist/` would have been reinterpreted and the published
12
+ * entrypoint would have failed to load. botanary-mcp hit exactly this and solved it the same way -
13
+ * see `src/package-version.ts` there, whose header this mirrors.
14
+ *
15
+ * So: read it with `fs` at runtime. `dist/` stays free of any nested manifest, and the version reported
16
+ * is the one in the manifest npm actually installed.
17
+ *
18
+ * The walk handles BOTH layouts this file runs under with one code path: `src/package-version.ts` under
19
+ * vitest/@swc-node (package root is one level up) and `dist/src/package-version.js` when installed from
20
+ * npm (two levels up).
21
+ */
22
+ import { readFileSync } from 'node:fs';
23
+ import { dirname, join } from 'node:path';
24
+ import { fileURLToPath } from 'node:url';
25
+ /** Last resort only - see `readPackageVersion`. Never the normal path. */
26
+ const UNKNOWN_VERSION = '0.0.0-unknown';
27
+ function readPackageVersion() {
28
+ let dir = dirname(fileURLToPath(import.meta.url));
29
+ // Bounded: five levels is far more than either real layout needs, and a bound means a malformed
30
+ // install can never turn this into an unbounded filesystem walk on startup.
31
+ for (let i = 0; i < 5; i++) {
32
+ try {
33
+ const parsed = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'));
34
+ // Name-checked so a nested manifest (a bundler artifact, a stray fixture, a dependency's own
35
+ // package.json) can never be mistaken for ours and report someone else's version.
36
+ if (parsed.name === 'botanary' && typeof parsed.version === 'string')
37
+ return parsed.version;
38
+ }
39
+ catch {
40
+ // No package.json at this level, or it is unreadable - keep walking up.
41
+ }
42
+ const parent = dirname(dir);
43
+ if (parent === dir)
44
+ break; // filesystem root
45
+ dir = parent;
46
+ }
47
+ // Never throw: the version is metadata on a banner, a `--version` line and the update nag. Failing to
48
+ // read it must not be able to stop the CLI from running.
49
+ return UNKNOWN_VERSION;
50
+ }
51
+ /** Resolved once at module load - the file cannot change under a running process. */
52
+ export const CLI_VERSION = readPackageVersion();
53
+ //# sourceMappingURL=package-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/package-version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,0EAA0E;AAC1E,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,SAAS,kBAAkB;IACzB,IAAI,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,gGAAgG;IAChG,4EAA4E;IAC5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAGxE,CAAC;YACF,6FAA6F;YAC7F,kFAAkF;YAClF,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC,OAAO,CAAC;QAC9F,CAAC;QAAC,MAAM,CAAC;YACP,wEAAwE;QAC1E,CAAC;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,CAAC,kBAAkB;QAC7C,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,sGAAsG;IACtG,yDAAyD;IACzD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,qFAAqF;AACrF,MAAM,CAAC,MAAM,WAAW,GAAW,kBAAkB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "botanary",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.4.0",
5
5
  "description": "Botanary from your terminal - a guided CLI over the same wallet and agent lanes botanary-mcp exposes to a coding agent.",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://docs.botanary.xyz",
@@ -20,18 +20,9 @@
20
20
  "engines": {
21
21
  "node": ">=22.0.0"
22
22
  },
23
- "scripts": {
24
- "build": "tsc -p tsconfig.build.json",
25
- "prepare": "tsc -p tsconfig.build.json",
26
- "dev": "node --watch -r @swc-node/register bin/botanary.ts",
27
- "start": "node dist/bin/botanary.js",
28
- "typecheck": "tsc -p tsconfig.json --noEmit",
29
- "test": "vitest run",
30
- "test:watch": "vitest"
31
- },
32
23
  "dependencies": {
33
24
  "@clack/prompts": "^0.9.1",
34
- "botanary-mcp": "^0.7.0",
25
+ "botanary-mcp": "^0.8.0",
35
26
  "cli-table3": "^0.6.5",
36
27
  "commander": "^13.1.0",
37
28
  "figlet": "^1.7.0",
@@ -44,5 +35,13 @@
44
35
  "@types/node": "^22.10.5",
45
36
  "typescript": "^5.7.3",
46
37
  "vitest": "^2.1.8"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.build.json",
41
+ "dev": "node --watch -r @swc-node/register bin/botanary.ts",
42
+ "start": "node dist/bin/botanary.js",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest"
47
46
  }
48
- }
47
+ }