shinten-ship 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.
- package/dist/src/cli.js +2 -1
- package/dist/src/main.d.ts +5 -0
- package/dist/src/main.js +17 -0
- package/dist/src/mcp.js +2 -1
- package/package.json +1 -1
package/dist/src/cli.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
// input. What was made and purged is recorded, by digest, in
|
|
12
12
|
// SHINTEN_SHIP_RECORDS (default ~/.shinten-ship/records.jsonl).
|
|
13
13
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
14
|
+
import { isMain } from './main.js';
|
|
14
15
|
import { parseArgs } from 'node:util';
|
|
15
16
|
import { carrier, carriers } from './carriers/index.js';
|
|
16
17
|
import { parseConfig } from './config.js';
|
|
@@ -69,7 +70,7 @@ async function main(argv) {
|
|
|
69
70
|
return 2;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
if (
|
|
73
|
+
if (isMain(import.meta.url)) {
|
|
73
74
|
main(process.argv.slice(2)).then((code) => process.exit(code), (e) => {
|
|
74
75
|
console.error(e.message);
|
|
75
76
|
process.exit(1);
|
package/dist/src/main.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { realpathSync } from 'node:fs';
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
/**
|
|
4
|
+
* Whether the module at `url` is the program being run. npm installs a bin
|
|
5
|
+
* as a symlink, so argv[1] is resolved to its real path before comparing.
|
|
6
|
+
*/
|
|
7
|
+
export function isMain(url) {
|
|
8
|
+
const entry = process.argv[1];
|
|
9
|
+
if (!entry)
|
|
10
|
+
return false;
|
|
11
|
+
try {
|
|
12
|
+
return url === pathToFileURL(realpathSync(entry)).href;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/src/mcp.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
7
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
8
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
9
|
+
import { isMain } from './main.js';
|
|
9
10
|
import { z } from 'zod';
|
|
10
11
|
import { carrier, carriers } from './carriers/index.js';
|
|
11
12
|
import { parseConfig } from './config.js';
|
|
@@ -67,7 +68,7 @@ export function deskServer(opts) {
|
|
|
67
68
|
});
|
|
68
69
|
return server;
|
|
69
70
|
}
|
|
70
|
-
if (
|
|
71
|
+
if (isMain(import.meta.url)) {
|
|
71
72
|
deskServer({ keyPath: process.env.SHINTEN_KEY, configPath: process.env.SHINTEN_SHIP_CONFIG })
|
|
72
73
|
.connect(new StdioServerTransport())
|
|
73
74
|
.catch((e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinten-ship",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "The shipping desk for shinten: opens sealed delivery addresses on the desk's own device and writes the carrier's label-import CSV, so the store never holds an address in the clear.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "github:joeartsea/shinten-ship",
|