tokenbuild 0.1.0 → 0.1.1

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.
@@ -166,6 +166,6 @@ switch (cmd) {
166
166
  runMcp(root);
167
167
  break;
168
168
  }
169
- case '--version': case 'version': out('0.1.0'); break;
169
+ case '--version': case 'version': out((await import('../src/util.mjs')).VERSION); break;
170
170
  default: out(HELP);
171
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokenbuild",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Build More. Use Less. Cut Claude Code token use and prove the saving.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/mcp.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  // Minimal MCP stdio server (JSON-RPC 2.0, newline-delimited). Tools answer from the local index: zero model tokens to compute.
2
2
  import readline from 'node:readline';
3
3
  import { loadIndex, buildIndex, repoMap, find, pack } from './repo.mjs';
4
- import { appendLedger } from './util.mjs';
4
+ import { appendLedger, VERSION } from './util.mjs';
5
5
  import { config, detect, digest } from './local.mjs';
6
6
  import { licensed, explain, refreshIfDue } from './license.mjs';
7
7
 
@@ -20,7 +20,7 @@ const DIGEST = { name: 'tb_digest', description: 'Ask a local model (on this mac
20
20
  export async function handle(msg, root, state) {
21
21
  const { id, method, params = {} } = msg;
22
22
  const ok = (result) => ({ jsonrpc: '2.0', id, result });
23
- if (method === 'initialize') return ok({ protocolVersion: params.protocolVersion || '2025-06-18', capabilities: { tools: {} }, serverInfo: { name: 'tokenbuild', version: '0.1.0' } });
23
+ if (method === 'initialize') return ok({ protocolVersion: params.protocolVersion || '2025-06-18', capabilities: { tools: {} }, serverInfo: { name: 'tokenbuild', version: VERSION } });
24
24
  if (method === 'tools/list') return ok({ tools: state.boost ? [...TOOLS, DIGEST] : TOOLS });
25
25
  if (method === 'tools/call') {
26
26
  if (!state.idx || Date.now() - state.at > 30_000) { state.idx = state.idx ? buildIndex(root).idx : loadIndex(root); state.at = Date.now(); }
package/src/util.mjs CHANGED
@@ -2,6 +2,8 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import crypto from 'node:crypto';
4
4
 
5
+ export const VERSION = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
6
+
5
7
  // ~4 chars per token for code and English; good enough for budgets.
6
8
  export const tokens = (s) => Math.ceil((s ? String(s).length : 0) / 4);
7
9