Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/action/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenometer/action",
"version": "0.0.1",
"version": "0.0.2",
"description": "GitHub Action that posts a sticky PR comment with prompt-cost diff.",
"license": "MIT",
"private": true,
Expand All @@ -13,7 +13,7 @@
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"@tokenometer/core": "0.0.1",
"@tokenometer/core": "0.0.2",
"minimatch": "^10.2.5"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokenometer",
"version": "0.0.1",
"version": "0.0.2",
"description": "Empirical token-cost benchmarking CLI for LLM prompts. Tells you what your prompt actually costs across Claude, GPT-4o, and Gemini, in every format.",
"license": "MIT",
"author": "Faraazuddin Mohammed <mohdfaraaz1@gmail.com>",
Expand Down Expand Up @@ -49,7 +49,7 @@
"clean": "rm -rf dist"
},
"dependencies": {
"@tokenometer/core": "0.0.1"
"@tokenometer/core": "0.0.2"
},
"devDependencies": {
"@types/node": "^22.10.5",
Expand Down
17 changes: 14 additions & 3 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env node
import { realpathSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
import { pathToFileURL } from 'node:url';
import { tokenizeMatrix, tokenizeMatrixEmpirical } from '@tokenometer/core';
import type { EmpiricalEnv } from '@tokenometer/core';
import { HELP_TEXT, parseArgs } from './args.js';
import { renderSummary, renderTable } from './render.js';

const VERSION = '0.0.1';
const VERSION = '0.0.2';

const readEnv = (): EmpiricalEnv => {
const env: EmpiricalEnv = {};
Expand Down Expand Up @@ -88,8 +90,17 @@ export const main = async (argv: readonly string[]): Promise<number> => {
return 0;
};

const scriptUrl = `file://${process.argv[1]}`;
if (import.meta.url === scriptUrl) {
const isInvokedAsScript = (): boolean => {
const entry = process.argv[1];
if (!entry) return false;
try {
return pathToFileURL(realpathSync(entry)).href === import.meta.url;
} catch {
return false;
}
};

if (isInvokedAsScript()) {
main(process.argv.slice(2)).then(
(code) => process.exit(code),
(err: unknown) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenometer/core",
"version": "0.0.1",
"version": "0.0.2",
"description": "Empirical token-cost benchmarking for LLM prompts — core library (tokenizers, format converters, rate matrix, empirical countTokens dispatch).",
"license": "MIT",
"author": "Faraazuddin Mohammed <mohdfaraaz1@gmail.com>",
Expand Down
4 changes: 2 additions & 2 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenometer/web",
"version": "0.0.1",
"version": "0.0.2",
"description": "Browser playground for paste-and-compare prompt cost analysis.",
"license": "MIT",
"private": true,
Expand All @@ -13,7 +13,7 @@
"dependencies": {
"@anthropic-ai/sdk": "^0.40.0",
"@google/generative-ai": "^0.21.0",
"@tokenometer/core": "0.0.1",
"@tokenometer/core": "0.0.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
Expand Down
Loading