shinten-ship 0.1.0 → 0.1.2
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/README.ja.md +1 -1
- package/README.md +1 -1
- 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 +2 -2
package/README.ja.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**shinten の出荷デスク。封じた住所を、送り状を作る場所でだけ開く。**
|
|
4
4
|
|
|
5
|
-
[shinten](https://github.com/
|
|
5
|
+
[shinten](https://github.com/eucassoc/shinten) で配送先を封じている店舗は、
|
|
6
6
|
注文ごとに郵便番号と封筒しか持ちません。それでも誰かが送り状を印字します。
|
|
7
7
|
shinten-ship はその誰かの道具です。出荷担当の端末で動き、各注文の封筒を
|
|
8
8
|
その端末の秘密鍵で開き、配送業者の送り状ソフトがそのまま受け付ける取込ファイルを
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**The shipping desk for shinten: open sealed addresses where labels are made, and nowhere else.**
|
|
4
4
|
|
|
5
|
-
A store that seals delivery addresses with [shinten](https://github.com/
|
|
5
|
+
A store that seals delivery addresses with [shinten](https://github.com/eucassoc/shinten)
|
|
6
6
|
keeps only the postal code and an envelope per order. Someone still has
|
|
7
7
|
to print the label. shinten-ship is that someone's tool: it runs on the
|
|
8
8
|
shipping desk's own device, opens each order's envelope with the desk's
|
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,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shinten-ship",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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
|
-
"repository": "github:
|
|
6
|
+
"repository": "github:eucassoc/shinten-ship",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=20"
|