neurouter 0.0.0-stage → 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.
- package/LICENSE +202 -0
- package/NOTICE +10 -0
- package/README.md +71 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/commands/common.d.ts +12 -0
- package/dist/commands/common.d.ts.map +1 -0
- package/dist/commands/common.js +62 -0
- package/dist/commands/common.js.map +1 -0
- package/dist/commands/compile.d.ts +14 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +92 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/eval.d.ts +28 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/eval.js +102 -0
- package/dist/commands/eval.js.map +1 -0
- package/dist/commands/keys.d.ts +2 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +2 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/mock.d.ts +7 -0
- package/dist/commands/mock.d.ts.map +1 -0
- package/dist/commands/mock.js +36 -0
- package/dist/commands/mock.js.map +1 -0
- package/dist/commands/serve.d.ts +21 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +69 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +103 -0
- package/dist/main.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +54 -4
package/dist/main.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { CLI_VERSION } from './version.js';
|
|
5
|
+
// commands load lazily: `serve` starts OpenTelemetry before the server modules are imported
|
|
6
|
+
const compileCmd = () => import('./commands/compile.js');
|
|
7
|
+
const serveCmd = () => import('./commands/serve.js');
|
|
8
|
+
/**
|
|
9
|
+
* `npx neurouter serve|validate|eval|mock|compile|keys|console-link` (§15.8). Exit codes: 0 ok,
|
|
10
|
+
* 1 failed check (validation errors, score below --min-score), 2 error.
|
|
11
|
+
*/
|
|
12
|
+
export function buildProgram() {
|
|
13
|
+
const program = new Command('neurouter').description('Turn an OpenAPI or GraphQL API into a governed MCP server').version(CLI_VERSION);
|
|
14
|
+
const defaultConfig = existsSync('neurouter.yaml') ? 'neurouter.yaml' : undefined;
|
|
15
|
+
program
|
|
16
|
+
.command('serve')
|
|
17
|
+
.description('Run the full server (SQLite at <data>/neurouter.db) and print the console link')
|
|
18
|
+
.option('-c, --config <file>', 'neurouter.yaml', defaultConfig)
|
|
19
|
+
.option('-p, --port <port>', 'port', '3000')
|
|
20
|
+
.option('--host <host>', 'host', '127.0.0.1')
|
|
21
|
+
.option('--data <dir>', 'data directory', './.neurouter')
|
|
22
|
+
.option('--embeddings', 'enable local search embeddings (downloads the model)', false)
|
|
23
|
+
.action(async (o) => {
|
|
24
|
+
const { otelEnabled, startOtel } = await import('@neurouter/server/otel');
|
|
25
|
+
if (otelEnabled(process.env))
|
|
26
|
+
await startOtel(process.env);
|
|
27
|
+
await (await serveCmd()).cmdServe(o);
|
|
28
|
+
});
|
|
29
|
+
program
|
|
30
|
+
.command('console-link')
|
|
31
|
+
.description('Mint a one-time console sign-in URL (talks to the same DATABASE_URL)')
|
|
32
|
+
.option('--data <dir>', 'data directory', './.neurouter')
|
|
33
|
+
.action(async (o) => (await serveCmd()).cmdConsoleLink(o));
|
|
34
|
+
program
|
|
35
|
+
.command('validate')
|
|
36
|
+
.description('Parse, reconcile (dry run), compile and lint neurouter.yaml; exit 1 on errors')
|
|
37
|
+
.option('-c, --config <file>', 'neurouter.yaml', defaultConfig ?? 'neurouter.yaml')
|
|
38
|
+
.option('--print-schema', 'print the neurouter.yaml JSON Schema and exit', false)
|
|
39
|
+
.action(async (o) => (await compileCmd()).cmdValidate(o));
|
|
40
|
+
program
|
|
41
|
+
.command('compile')
|
|
42
|
+
.description('Compile a spec (+ overlay) to the tool model and Python stubs')
|
|
43
|
+
.option('--spec <fileOrUrl>', 'OpenAPI 3.x / GraphQL SDL or introspection JSON')
|
|
44
|
+
.option('--overlay <file>', 'overlay YAML')
|
|
45
|
+
.option('--out <file>', 'write tools.json')
|
|
46
|
+
.option('--stubs <dir>', 'write <namespace>.pyi files')
|
|
47
|
+
.option('--namespace <ns>', 'Python namespace (default from the spec title)')
|
|
48
|
+
.option('--graphql-endpoint <url>', 'introspect a live GraphQL endpoint instead of --spec')
|
|
49
|
+
.action(async (o) => (await compileCmd()).cmdCompile(o));
|
|
50
|
+
program
|
|
51
|
+
.command('mock')
|
|
52
|
+
.description('Serve the mock API generated from a spec over HTTP')
|
|
53
|
+
.requiredOption('--spec <fileOrUrl>', 'spec file or URL')
|
|
54
|
+
.option('-p, --port <port>', 'port', '4010')
|
|
55
|
+
.option('--seed <n>', 'seed', '42')
|
|
56
|
+
.action(async (o) => (await import('./commands/mock.js')).cmdMock(o));
|
|
57
|
+
program
|
|
58
|
+
.command('eval')
|
|
59
|
+
.description('Generate or load an eval suite, run it (tool and code mode) and print the agent-readiness score')
|
|
60
|
+
.option('-c, --config <file>', 'neurouter.yaml (with --server)')
|
|
61
|
+
.option('--server <slug>', 'server in the config')
|
|
62
|
+
.option('--spec <fileOrUrl>', 'spec (boots an in-process server with a mock environment)')
|
|
63
|
+
.option('--overlay <file>', 'overlay YAML for --spec')
|
|
64
|
+
.option('--suite <file>', 'suite JSON to run')
|
|
65
|
+
.option('--generate', 'generate a suite', false)
|
|
66
|
+
.option('--counts <s,m,a,i>', 'tasks per category for --generate', '8,8,4,4')
|
|
67
|
+
.option('--save-suite <file>', 'write the suite JSON')
|
|
68
|
+
.option('--models <list>', 'comma-separated models (default gpt-6-luna; e.g. gpt-6-luna,claude-sonnet-5-5,gemini-3.5-flash-lite; provider:model forces a provider)')
|
|
69
|
+
.option('--modes <list>', 'tool,code', 'tool,code')
|
|
70
|
+
.option('--repeats <n>', 'attempts per task', '3')
|
|
71
|
+
.option('--env <slug>', 'environment', 'mock')
|
|
72
|
+
.option('--min-score <n>', 'exit 1 when the headline is below')
|
|
73
|
+
.option('--out <file>', 'write the JSON report')
|
|
74
|
+
.option('--md <file>', 'write the Markdown report')
|
|
75
|
+
.option('--transcripts <file>', 'write every attempt (transcript, observed calls, assertion results) as JSON, for debugging')
|
|
76
|
+
.option('--suggest', 'print fix suggestions', false)
|
|
77
|
+
.option('--embeddings', 'enable local search embeddings', false)
|
|
78
|
+
.action(async (o) => (await import('./commands/eval.js')).cmdEval(o));
|
|
79
|
+
const keys = program.command('keys').description('Crypto keys and API keys');
|
|
80
|
+
keys
|
|
81
|
+
.command('gen [keyId]')
|
|
82
|
+
.description('Print NEUROUTER_MASTER_KEYS / NEUROUTER_ACTIVE_KEY_ID / HASH_PEPPER')
|
|
83
|
+
.action(async (keyId) => console.log((await import('./commands/keys.js')).generateKeyEnv(keyId)));
|
|
84
|
+
keys
|
|
85
|
+
.command('create')
|
|
86
|
+
.description('Create an API key for a server environment (dev convenience; talks to DATABASE_URL)')
|
|
87
|
+
.requiredOption('--server <slug>')
|
|
88
|
+
.requiredOption('--env <slug>')
|
|
89
|
+
.option('--scopes <list>', 'tools:read,tools:write,code:run', 'tools:read,code:run')
|
|
90
|
+
.option('--name <name>', 'key name', 'cli')
|
|
91
|
+
.option('--data <dir>', 'data directory', './.neurouter')
|
|
92
|
+
.action(async (o) => (await serveCmd()).cmdKeysCreate(o));
|
|
93
|
+
return program;
|
|
94
|
+
}
|
|
95
|
+
if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith('/neurouter') || process.argv[1]?.endsWith('cli/src/main.ts') || process.argv[1]?.endsWith('cli/dist/main.js')) {
|
|
96
|
+
buildProgram()
|
|
97
|
+
.parseAsync(process.argv)
|
|
98
|
+
.catch((err) => {
|
|
99
|
+
console.error(err instanceof Error ? err.message : err);
|
|
100
|
+
process.exit(2);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,4FAA4F;AAC5F,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACzD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC,2DAA2D,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACvI,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS,CAAC;IAElF,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,gFAAgF,CAAC;SAC7F,MAAM,CAAC,qBAAqB,EAAE,gBAAgB,EAAE,aAAa,CAAC;SAC9D,MAAM,CAAC,mBAAmB,EAAE,MAAM,EAAE,MAAM,CAAC;SAC3C,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,CAAC;SAC5C,MAAM,CAAC,cAAc,EAAE,gBAAgB,EAAE,cAAc,CAAC;SACxD,MAAM,CAAC,cAAc,EAAE,sDAAsD,EAAE,KAAK,CAAC;SACr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C,CAAC,CAAC;IAC5D,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAChM,YAAY,EAAE;SACX,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC;SACxB,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neurouter",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"mcp",
|
|
6
|
+
"model-context-protocol",
|
|
7
|
+
"openapi",
|
|
8
|
+
"graphql",
|
|
9
|
+
"ai-agents",
|
|
10
|
+
"code-mode",
|
|
11
|
+
"evals",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/neurouter/core#readme",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/neurouter/core/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/neurouter/core.git",
|
|
21
|
+
"directory": "packages/cli"
|
|
22
|
+
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"type": "module",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=24"
|
|
27
|
+
},
|
|
28
|
+
"description": "Neurouter CLI: serve, validate, compile, mock and eval MCP servers generated from OpenAPI/GraphQL specs",
|
|
29
|
+
"bin": {
|
|
30
|
+
"neurouter": "./dist/main.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"NOTICE",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc -b",
|
|
40
|
+
"typecheck": "tsc -b && tsc -p tsconfig.test.json",
|
|
41
|
+
"typecheck:tests": "tsc -p tsconfig.test.json",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"prepack": "node ../../scripts/prepack.mjs --readme"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@neurouter/shared": "0.1.1",
|
|
47
|
+
"@neurouter/compiler": "0.1.1",
|
|
48
|
+
"@neurouter/evals": "0.1.1",
|
|
49
|
+
"@neurouter/server": "0.1.1",
|
|
50
|
+
"commander": "15.1.0",
|
|
51
|
+
"yaml": "2.9.1"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
}
|
|
56
|
+
}
|