sigrank 1.0.1 → 1.0.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.
File without changes
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Thin command shim for SigRank Standard commands.
5
+ *
6
+ * All existing commands and MCP/TUI behavior are delegated to ../index.mjs.
7
+ * The shim exists so the standard commands can be added without coupling the
8
+ * large presentation CLI to the standard specification.
9
+ */
10
+
11
+ const args = process.argv.slice(2);
12
+ const cmd = args[0];
13
+
14
+ const SPEC = "sigrank/0.1-draft";
15
+ const STANDARD_URL = "https://signalaf.com/standard";
16
+ const SCHEMA_URL =
17
+ "https://signalaf.com/standard/sigrank-operator-record-v0.1.schema.json";
18
+
19
+ function flag(name, fallback = undefined) {
20
+ const eq = args.find((a) => a.startsWith(`--${name}=`));
21
+ if (eq) return eq.slice(name.length + 3);
22
+ const i = args.indexOf(`--${name}`);
23
+ if (i >= 0 && i + 1 < args.length && !args[i + 1].startsWith("--")) {
24
+ return args[i + 1];
25
+ }
26
+ return fallback;
27
+ }
28
+
29
+ function printStandard() {
30
+ const payload = {
31
+ spec: SPEC,
32
+ status: "proposed_open_standard",
33
+ scope: "human operation of generative AI systems",
34
+ telemetry: ["input", "output", "cache_write", "cache_read"],
35
+ metrics: {
36
+ yield: "(cache_read * output) / input^2",
37
+ leverage: "cache_read / input",
38
+ velocity: "output / input",
39
+ snr: "output / (input + output)",
40
+ dev10x: "log10(cache_read / input)",
41
+ },
42
+ privacy:
43
+ "Core metrics do not require prompt text, response text, source code, or repository contents.",
44
+ reference_math: "@sigrank/cascade",
45
+ reference_platform: "SignalAF",
46
+ standard_url: STANDARD_URL,
47
+ schema_url: SCHEMA_URL,
48
+ };
49
+
50
+ if (args.includes("--json")) {
51
+ process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
52
+ return;
53
+ }
54
+
55
+ process.stdout.write(`SigRank Standard ${SPEC}\n`);
56
+ process.stdout.write(`The new standard in operator metrics.\n\n`);
57
+ process.stdout.write(`Scope: ${payload.scope}\n`);
58
+ process.stdout.write(`Primitives: input / output / cache_write / cache_read\n`);
59
+ process.stdout.write(`Core metrics: Yield / Leverage / Velocity / SNR / 10xDEV\n`);
60
+ process.stdout.write(`Reference math: @sigrank/cascade\n`);
61
+ process.stdout.write(`Reference platform: SignalAF\n`);
62
+ process.stdout.write(`Spec: ${STANDARD_URL}\n`);
63
+ process.stdout.write(`Schema: ${SCHEMA_URL}\n`);
64
+ }
65
+
66
+ async function exportStandardRecord() {
67
+ const { callTool } = await import("../tools.mjs");
68
+
69
+ const platform = flag("platform", "claude");
70
+ const window = flag("window", "30d");
71
+
72
+ const explicit = ["input", "output", "cache-write", "cache-read"].every(
73
+ (name) => flag(name) !== undefined,
74
+ );
75
+
76
+ let pillars;
77
+ let sourcePlatform = platform;
78
+
79
+ if (explicit) {
80
+ pillars = {
81
+ input: Number(flag("input")),
82
+ output: Number(flag("output")),
83
+ cache_write: Number(flag("cache-write")),
84
+ cache_read: Number(flag("cache-read")),
85
+ };
86
+ } else {
87
+ const pulled = await callTool("tokenpull", { platform });
88
+ const selected = (pulled?.windows || []).find(
89
+ (w) => w.window === window || (window === "all_time" && w.window === "all"),
90
+ );
91
+ if (!selected?.pillars) {
92
+ throw new Error(
93
+ `No ${window} telemetry found for ${platform}. Pass --platform/--window or explicit --input --output --cache-write --cache-read.`,
94
+ );
95
+ }
96
+ sourcePlatform = pulled.platform || platform;
97
+ pillars = {
98
+ input: selected.pillars.input,
99
+ output: selected.pillars.output,
100
+ cache_write: selected.pillars.cacheCreate,
101
+ cache_read: selected.pillars.cacheRead,
102
+ };
103
+ }
104
+
105
+ for (const [key, value] of Object.entries(pillars)) {
106
+ if (!Number.isFinite(value) || value < 0) {
107
+ throw new Error(`${key} must be a non-negative finite number.`);
108
+ }
109
+ }
110
+
111
+ const record = await callTool("get_sigrank_standard_record", {
112
+ ...pillars,
113
+ provider: flag("provider", "local"),
114
+ model: flag("model", "unknown"),
115
+ tool: flag("tool", sourcePlatform || "sigrank"),
116
+ timestamp: new Date().toISOString(),
117
+ });
118
+
119
+ record.context = {
120
+ ...(record.context || {}),
121
+ window,
122
+ source_platform: sourcePlatform,
123
+ };
124
+
125
+ process.stdout.write(`${JSON.stringify(record, null, 2)}\n`);
126
+ }
127
+
128
+ if (cmd === "standard") {
129
+ printStandard();
130
+ } else if (cmd === "export" && args.includes("--standard")) {
131
+ exportStandardRecord().catch((err) => {
132
+ process.stderr.write(`[sigrank] ${err?.message || err}\n`);
133
+ process.exitCode = 1;
134
+ });
135
+ } else {
136
+ await import("../index.mjs");
137
+ }
package/manifest.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "$schema": "https://raw.githubusercontent.com/anthropics/mcpb/main/schemas/mcpb-manifest-v0.4.schema.json",
3
3
  "manifest_version": "0.4",
4
4
  "name": "sigrank",
5
- "version": "1.0.0",
6
- "description": "Ranks AI coding operators by token cascade efficiency (Yield = cache_read \u00d7 output / input\u00b2). 23 tools for yield calculation, local token usage pulls, signed submission, and tokscale-powered analytics (market share, developer profiles, model trends, cost analysis, device profiles, MCP usage, competitive intelligence). Privacy-first: runs locally, only four token counts leave the machine.",
5
+ "version": "1.0.2",
6
+ "description": "Ranks AI coding operators by token cascade efficiency (Yield = cache_read \u00d7 output / input\u00b2). 25 tools including SigRank Standard record, yield calculation, local token usage pulls, signed submission, and tokscale-powered analytics (market share, developer profiles, model trends, cost analysis, device profiles, MCP usage, competitive intelligence). Privacy-first: runs locally, only four token counts leave the machine.",
7
7
  "author": {
8
8
  "name": "SunrisesIllNeverSee",
9
9
  "url": "https://github.com/SunrisesIllNeverSee"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigrank",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "author": "SunrisesIllNeverSee (https://github.com/SunrisesIllNeverSee)",
5
5
  "description": "SigRank MCP server — AI operator evaluation and token cascade efficiency tools. The yield cascade + live leaderboard as MCP tools any agent can call.",
6
6
  "mcpName": "io.github.SunrisesIllNeverSee/sigrank-mcp",
@@ -15,8 +15,8 @@
15
15
  "url": "https://github.com/SunrisesIllNeverSee/sigrank-mcp/issues"
16
16
  },
17
17
  "bin": {
18
- "sigrank": "index.mjs",
19
- "sigrank-mcp": "index.mjs"
18
+ "sigrank": "bin/sigrank.mjs",
19
+ "sigrank-mcp": "bin/sigrank.mjs"
20
20
  },
21
21
  "main": "index.mjs",
22
22
  "engines": {
@@ -24,13 +24,14 @@
24
24
  },
25
25
  "scripts": {
26
26
  "start": "node index.mjs",
27
- "test": "node test.mjs && node __tests__/sign.test.mjs && node --test __tests__/cascade.test.mjs __tests__/badges.test.mjs __tests__/tui-input.test.mjs",
27
+ "test": "node test.mjs && node __tests__/sign.test.mjs && node --test __tests__/cascade.test.mjs __tests__/badges.test.mjs __tests__/tui-input.test.mjs __tests__/standard-record.test.mjs __tests__/standard-cli.test.mjs",
28
28
  "sync:platforms": "node scripts/sync-platforms.mjs",
29
29
  "sync:spine": "node scripts/sync-spine.mjs",
30
30
  "spine:check": "node scripts/sync-spine.mjs --check",
31
31
  "spine:diff": "node scripts/sync-spine.mjs --dry-run"
32
32
  },
33
33
  "files": [
34
+ "bin/",
34
35
  "index.mjs",
35
36
  "proxy.mjs",
36
37
  "lib/",
package/submit/index.mjs CHANGED
File without changes
package/tools/index.mjs CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  } from "../lib/constants.mjs";
16
16
 
17
17
  import { TOOL_DEF as rankPasteTool, handleRankPaste } from "./rank-paste.mjs";
18
+ import { TOOL_DEF as standardRecordTool, handleGetSigRankStandardRecord } from "./standard-record.mjs";
18
19
  import { TOOL_DEF as getLeaderboardTool, handleGetLeaderboard } from "./get-leaderboard.mjs";
19
20
  import { TOOL_DEF as getOperatorTool, handleGetOperator } from "./get-operator.mjs";
20
21
  import { TOOL_DEF as submitPasteTool, handleSubmitPaste } from "./submit-paste.mjs";
@@ -48,6 +49,7 @@ export { DEFAULT_API_BASE, DEFAULT_FETCH_TIMEOUT };
48
49
 
49
50
  export const TOOLS = [
50
51
  rankPasteTool,
52
+ standardRecordTool,
51
53
  getLeaderboardTool,
52
54
  getOperatorTool,
53
55
  submitPasteTool,
@@ -175,6 +177,8 @@ export async function callTool(name, args, opts = {}) {
175
177
  switch (name) {
176
178
  case "rank_paste":
177
179
  return handleRankPaste(args);
180
+ case "get_sigrank_standard_record":
181
+ return handleGetSigRankStandardRecord(args);
178
182
  case "get_leaderboard":
179
183
  return handleGetLeaderboard(args, ctx);
180
184
  case "get_operator":
@@ -0,0 +1,108 @@
1
+ import { cascade } from "../analytics/cascade.mjs";
2
+ import { ANNOTATIONS } from "./_schemas.mjs";
3
+
4
+ export const SIGRANK_STANDARD_VERSION = "sigrank/0.1-draft";
5
+
6
+ export const TOOL_DEF = {
7
+ name: "get_sigrank_standard_record",
8
+ description:
9
+ "Build a SigRank Standard v0.1-draft portable operator record from four token pillars. Computes the canonical cascade locally through @sigrank/cascade and returns versioned telemetry plus the normative core metrics: Yield, Leverage, Velocity, SNR, and 10xDEV. No data is submitted or persisted. The core record contains token telemetry only and does not require prompt text, code, or response content.",
10
+ annotations: {
11
+ title: "Export SigRank standard record",
12
+ ...ANNOTATIONS.readOnlyHint,
13
+ ...ANNOTATIONS.destructiveHint,
14
+ ...ANNOTATIONS.idempotentHint,
15
+ ...ANNOTATIONS.openWorldHint,
16
+ },
17
+ inputSchema: {
18
+ type: "object",
19
+ additionalProperties: false,
20
+ required: ["input", "output", "cache_write", "cache_read"],
21
+ properties: {
22
+ input: { type: "number", minimum: 0, description: "Fresh input tokens." },
23
+ output: { type: "number", minimum: 0, description: "Output tokens." },
24
+ cache_write: { type: "number", minimum: 0, description: "Cache-write / cache-creation tokens." },
25
+ cache_read: { type: "number", minimum: 0, description: "Cache-read tokens." },
26
+ provider: { type: "string", description: "Optional provider identifier." },
27
+ model: { type: "string", description: "Optional model identifier." },
28
+ tool: { type: "string", description: "Optional tool/client identifier." },
29
+ timestamp: { type: "string", description: "Optional ISO-8601 timestamp. Defaults to the current time." }
30
+ }
31
+ },
32
+ outputSchema: {
33
+ type: "object",
34
+ required: ["spec", "timestamp", "source", "telemetry", "metrics"],
35
+ properties: {
36
+ spec: { type: "string", description: "SigRank specification version." },
37
+ timestamp: { type: "string", description: "ISO-8601 record timestamp." },
38
+ source: {
39
+ type: "object",
40
+ properties: {
41
+ provider: { type: "string" },
42
+ model: { type: "string" },
43
+ tool: { type: "string" }
44
+ }
45
+ },
46
+ telemetry: {
47
+ type: "object",
48
+ properties: {
49
+ input: { type: "number" },
50
+ output: { type: "number" },
51
+ cache_write: { type: "number" },
52
+ cache_read: { type: "number" }
53
+ }
54
+ },
55
+ metrics: {
56
+ type: "object",
57
+ properties: {
58
+ yield: { type: ["number", "null"] },
59
+ leverage: { type: ["number", "null"] },
60
+ velocity: { type: ["number", "null"] },
61
+ snr: { type: ["number", "null"] },
62
+ dev10x: { type: ["number", "null"] }
63
+ }
64
+ },
65
+ warnings: { type: "array", items: { type: "string" } }
66
+ }
67
+ }
68
+ };
69
+
70
+ export async function handleGetSigRankStandardRecord(args) {
71
+ const input = Number(args?.input);
72
+ const output = Number(args?.output);
73
+ const cacheWrite = Number(args?.cache_write);
74
+ const cacheRead = Number(args?.cache_read);
75
+
76
+ if (![input, output, cacheWrite, cacheRead].every(Number.isFinite)) {
77
+ throw new Error("get_sigrank_standard_record requires four finite numeric token pillars.");
78
+ }
79
+ if ([input, output, cacheWrite, cacheRead].some((v) => v < 0)) {
80
+ throw new Error("get_sigrank_standard_record requires non-negative token pillars.");
81
+ }
82
+
83
+ const c = cascade({ input, output, cacheCreate: cacheWrite, cacheRead });
84
+
85
+ return {
86
+ spec: SIGRANK_STANDARD_VERSION,
87
+ timestamp: args?.timestamp || new Date().toISOString(),
88
+ source: {
89
+ provider: args?.provider || "unknown",
90
+ model: args?.model || "unknown",
91
+ tool: args?.tool || "sigrank-mcp",
92
+ },
93
+ telemetry: {
94
+ input,
95
+ output,
96
+ cache_write: cacheWrite,
97
+ cache_read: cacheRead,
98
+ },
99
+ metrics: {
100
+ yield: c.yield,
101
+ leverage: c.leverage,
102
+ velocity: c.velocity,
103
+ snr: c.snr,
104
+ dev10x: c.dev10x,
105
+ },
106
+ warnings: c.warnings || [],
107
+ };
108
+ }