@nowline/cli 0.0.0-dev.20261105234842.g537765c → 0.0.0-dev.20261106000822.g2041c05
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/dist/commands/mcp.d.ts +4 -3
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +16 -29
- package/dist/commands/mcp.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +2 -2
- package/package.json +14 -14
- package/src/commands/mcp.ts +17 -38
- package/src/generated/version.ts +2 -2
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ import type { ParsedArgs } from '../cli/args.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* `nowline --mcp` handler.
|
|
4
4
|
*
|
|
5
|
-
* Starts
|
|
6
|
-
*
|
|
5
|
+
* Starts the Model Context Protocol server through the same `startMcpServer`
|
|
6
|
+
* that `npx @nowline/mcp` calls, so `--root` (expansion and the binary-export
|
|
7
|
+
* delivery default), `--port` and the reported version behave identically.
|
|
7
8
|
*
|
|
8
9
|
* Transport selection:
|
|
9
10
|
* stdio (default) — when --port is absent.
|
|
10
|
-
* Streamable HTTP — when --port <N> is supplied; listens on
|
|
11
|
+
* Streamable HTTP — when --port <N> is supplied; listens on 127.0.0.1:<N>.
|
|
11
12
|
*
|
|
12
13
|
* Runs until the process receives SIGINT/SIGTERM or the client closes stdin.
|
|
13
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAc9E"}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -1,45 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createMcpHttpHandler } from '@nowline/mcp/http';
|
|
4
|
-
import { createMcpServer } from '@nowline/mcp/server';
|
|
1
|
+
import { InvalidPortError, startMcpServer } from '@nowline/mcp/start';
|
|
2
|
+
import { CliError, ExitCode } from '../io/exit-codes.js';
|
|
5
3
|
import { createLog } from '../io/log.js';
|
|
6
4
|
/**
|
|
7
5
|
* `nowline --mcp` handler.
|
|
8
6
|
*
|
|
9
|
-
* Starts
|
|
10
|
-
*
|
|
7
|
+
* Starts the Model Context Protocol server through the same `startMcpServer`
|
|
8
|
+
* that `npx @nowline/mcp` calls, so `--root` (expansion and the binary-export
|
|
9
|
+
* delivery default), `--port` and the reported version behave identically.
|
|
11
10
|
*
|
|
12
11
|
* Transport selection:
|
|
13
12
|
* stdio (default) — when --port is absent.
|
|
14
|
-
* Streamable HTTP — when --port <N> is supplied; listens on
|
|
13
|
+
* Streamable HTTP — when --port <N> is supplied; listens on 127.0.0.1:<N>.
|
|
15
14
|
*
|
|
16
15
|
* Runs until the process receives SIGINT/SIGTERM or the client closes stdin.
|
|
17
16
|
*/
|
|
18
17
|
export async function mcpHandler({ args }) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (!Number.isFinite(port) || port < 1 || port > 65535) {
|
|
25
|
-
throw new Error(`nowline: --port must be a number between 1 and 65535 (got ${portStr}).`);
|
|
26
|
-
}
|
|
27
|
-
const httpServer = createServer(createMcpHttpHandler(() => createMcpServer({ allowedRoot: root })));
|
|
28
|
-
await new Promise((resolve) => {
|
|
29
|
-
httpServer.listen(port, '127.0.0.1', () => {
|
|
30
|
-
createLog(args.logLevel).notice(`nowline: MCP Streamable HTTP listening on http://127.0.0.1:${port}`);
|
|
31
|
-
});
|
|
32
|
-
httpServer.on('close', resolve);
|
|
33
|
-
process.on('SIGINT', () => httpServer.close());
|
|
34
|
-
process.on('SIGTERM', () => httpServer.close());
|
|
18
|
+
try {
|
|
19
|
+
await startMcpServer({
|
|
20
|
+
root: args.root,
|
|
21
|
+
port: args.port,
|
|
22
|
+
onListening: (url) => createLog(args.logLevel).notice(`nowline: MCP Streamable HTTP listening on ${url}`),
|
|
35
23
|
});
|
|
36
24
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof InvalidPortError) {
|
|
27
|
+
throw new CliError(ExitCode.InputError, `nowline: ${err.message}`);
|
|
28
|
+
}
|
|
29
|
+
throw err;
|
|
43
30
|
}
|
|
44
31
|
}
|
|
45
32
|
//# sourceMappingURL=mcp.js.map
|
package/dist/commands/mcp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAE,IAAI,EAAwB;IAC3D,IAAI,CAAC;QACD,MAAM,cAAc,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CACjB,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,6CAA6C,GAAG,EAAE,CAAC;SAC1F,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,IAAI,GAAG,YAAY,gBAAgB,EAAE,CAAC;YAClC,MAAM,IAAI,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,GAAG,CAAC;IACd,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.0.0-dev.
|
|
1
|
+
export declare const CLI_VERSION = "0.0.0-dev.20261106000822.g2041c05";
|
|
2
2
|
export interface CliBuild {
|
|
3
3
|
/** Short git SHA at build time, or empty when not in a git checkout. */
|
|
4
4
|
readonly sha: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Auto-generated by scripts/bundle-templates.mjs. Do not edit by hand.
|
|
2
|
-
export const CLI_VERSION = "0.0.0-dev.
|
|
2
|
+
export const CLI_VERSION = "0.0.0-dev.20261106000822.g2041c05";
|
|
3
3
|
export const CLI_BUILD = {
|
|
4
|
-
"sha": "
|
|
4
|
+
"sha": "2041c05",
|
|
5
5
|
"isRelease": false,
|
|
6
6
|
"isDirty": true
|
|
7
7
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nowline/cli",
|
|
3
|
-
"version": "0.0.0-dev.
|
|
3
|
+
"version": "0.0.0-dev.20261106000822.g2041c05",
|
|
4
4
|
"description": "Command-line tool to check, convert, and create Nowline roadmaps.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"engines": {
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"@babel/code-frame": "^8.0.6",
|
|
34
34
|
"@clack/prompts": "^1.8.1",
|
|
35
35
|
"@modelcontextprotocol/server": "^2.3.1",
|
|
36
|
-
"@nowline/config": "0.0.0-dev.
|
|
37
|
-
"@nowline/core": "0.0.0-dev.
|
|
38
|
-
"@nowline/export": "0.0.0-dev.
|
|
39
|
-
"@nowline/export-core": "0.0.0-dev.
|
|
40
|
-
"@nowline/export-html": "0.0.0-dev.
|
|
41
|
-
"@nowline/export-mermaid": "0.0.0-dev.
|
|
42
|
-
"@nowline/export-msproj": "0.0.0-dev.
|
|
43
|
-
"@nowline/export-pdf": "0.0.0-dev.
|
|
44
|
-
"@nowline/export-png": "0.0.0-dev.
|
|
45
|
-
"@nowline/export-xlsx": "0.0.0-dev.
|
|
46
|
-
"@nowline/layout": "0.0.0-dev.
|
|
47
|
-
"@nowline/mcp": "0.0.0-dev.
|
|
48
|
-
"@nowline/renderer": "0.0.0-dev.
|
|
36
|
+
"@nowline/config": "0.0.0-dev.20261106000822.g2041c05",
|
|
37
|
+
"@nowline/core": "0.0.0-dev.20261106000822.g2041c05",
|
|
38
|
+
"@nowline/export": "0.0.0-dev.20261106000822.g2041c05",
|
|
39
|
+
"@nowline/export-core": "0.0.0-dev.20261106000822.g2041c05",
|
|
40
|
+
"@nowline/export-html": "0.0.0-dev.20261106000822.g2041c05",
|
|
41
|
+
"@nowline/export-mermaid": "0.0.0-dev.20261106000822.g2041c05",
|
|
42
|
+
"@nowline/export-msproj": "0.0.0-dev.20261106000822.g2041c05",
|
|
43
|
+
"@nowline/export-pdf": "0.0.0-dev.20261106000822.g2041c05",
|
|
44
|
+
"@nowline/export-png": "0.0.0-dev.20261106000822.g2041c05",
|
|
45
|
+
"@nowline/export-xlsx": "0.0.0-dev.20261106000822.g2041c05",
|
|
46
|
+
"@nowline/layout": "0.0.0-dev.20261106000822.g2041c05",
|
|
47
|
+
"@nowline/mcp": "0.0.0-dev.20261106000822.g2041c05",
|
|
48
|
+
"@nowline/renderer": "0.0.0-dev.20261106000822.g2041c05",
|
|
49
49
|
"chalk": "^6.0.1",
|
|
50
50
|
"citty": "^0.2.2",
|
|
51
51
|
"consola": "^3.4.2",
|
package/src/commands/mcp.ts
CHANGED
|
@@ -1,54 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
3
|
-
import { createMcpHttpHandler } from '@nowline/mcp/http';
|
|
4
|
-
import { createMcpServer } from '@nowline/mcp/server';
|
|
1
|
+
import { InvalidPortError, startMcpServer } from '@nowline/mcp/start';
|
|
5
2
|
import type { ParsedArgs } from '../cli/args.js';
|
|
3
|
+
import { CliError, ExitCode } from '../io/exit-codes.js';
|
|
6
4
|
import { createLog } from '../io/log.js';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* `nowline --mcp` handler.
|
|
10
8
|
*
|
|
11
|
-
* Starts
|
|
12
|
-
*
|
|
9
|
+
* Starts the Model Context Protocol server through the same `startMcpServer`
|
|
10
|
+
* that `npx @nowline/mcp` calls, so `--root` (expansion and the binary-export
|
|
11
|
+
* delivery default), `--port` and the reported version behave identically.
|
|
13
12
|
*
|
|
14
13
|
* Transport selection:
|
|
15
14
|
* stdio (default) — when --port is absent.
|
|
16
|
-
* Streamable HTTP — when --port <N> is supplied; listens on
|
|
15
|
+
* Streamable HTTP — when --port <N> is supplied; listens on 127.0.0.1:<N>.
|
|
17
16
|
*
|
|
18
17
|
* Runs until the process receives SIGINT/SIGTERM or the client closes stdin.
|
|
19
18
|
*/
|
|
20
19
|
export async function mcpHandler({ args }: { args: ParsedArgs }): Promise<void> {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (!Number.isFinite(port) || port < 1 || port > 65535) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`nowline: --port must be a number between 1 and 65535 (got ${portStr}).`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const httpServer = createServer(
|
|
34
|
-
createMcpHttpHandler(() => createMcpServer({ allowedRoot: root })),
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
await new Promise<void>((resolve) => {
|
|
38
|
-
httpServer.listen(port, '127.0.0.1', () => {
|
|
39
|
-
createLog(args.logLevel).notice(
|
|
40
|
-
`nowline: MCP Streamable HTTP listening on http://127.0.0.1:${port}`,
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
httpServer.on('close', resolve);
|
|
44
|
-
process.on('SIGINT', () => httpServer.close());
|
|
45
|
-
process.on('SIGTERM', () => httpServer.close());
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
const transport = new StdioServerTransport();
|
|
49
|
-
await createMcpServer({ allowedRoot: root }).connect(transport);
|
|
50
|
-
await new Promise<void>((resolve) => {
|
|
51
|
-
transport.onclose = resolve;
|
|
20
|
+
try {
|
|
21
|
+
await startMcpServer({
|
|
22
|
+
root: args.root,
|
|
23
|
+
port: args.port,
|
|
24
|
+
onListening: (url) =>
|
|
25
|
+
createLog(args.logLevel).notice(`nowline: MCP Streamable HTTP listening on ${url}`),
|
|
52
26
|
});
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err instanceof InvalidPortError) {
|
|
29
|
+
throw new CliError(ExitCode.InputError, `nowline: ${err.message}`);
|
|
30
|
+
}
|
|
31
|
+
throw err;
|
|
53
32
|
}
|
|
54
33
|
}
|
package/src/generated/version.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Auto-generated by scripts/bundle-templates.mjs. Do not edit by hand.
|
|
2
2
|
|
|
3
|
-
export const CLI_VERSION = "0.0.0-dev.
|
|
3
|
+
export const CLI_VERSION = "0.0.0-dev.20261106000822.g2041c05";
|
|
4
4
|
|
|
5
5
|
export interface CliBuild {
|
|
6
6
|
/** Short git SHA at build time, or empty when not in a git checkout. */
|
|
@@ -12,7 +12,7 @@ export interface CliBuild {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const CLI_BUILD: CliBuild = {
|
|
15
|
-
"sha": "
|
|
15
|
+
"sha": "2041c05",
|
|
16
16
|
"isRelease": false,
|
|
17
17
|
"isDirty": true
|
|
18
18
|
};
|