@pecot/visual-mcp 1.3.0 → 1.3.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/.claude-plugin/plugin.json +1 -1
- package/README.md +35 -5
- package/assets/slidev/package.json +2 -2
- package/assets/slidev/runtime/package.json +1 -1
- package/cli/dist/domain/evidence-xlsx/layout.d.ts +2 -3
- package/cli/dist/domain/evidence-xlsx/ooxml.d.ts +1 -8
- package/cli/dist/domain/evidence-xlsx/ooxml.js +35 -24
- package/npm-shrinkwrap.json +24 -30
- package/package.json +1 -1
- package/vendor/text-rules/dist/source-hash +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,35 @@ MCP クライアントに 1 エントリ登録するだけで pecot-visual の
|
|
|
26
26
|
"mcpServers": {
|
|
27
27
|
"pecot-visual": {
|
|
28
28
|
"command": "npx",
|
|
29
|
-
"args": ["-y", "@pecot/visual-mcp"]
|
|
29
|
+
"args": ["-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`--prefix=/` は、pnpm の `devEngines` を宣言したリポジトリの中で起動しても止まらないようにするための指定です。
|
|
36
|
+
`--prefix` を付けないと、そのリポジトリを cwd にした npx が `EBADDEVENGINES` で止まります。
|
|
37
|
+
npm には devEngines の判定だけを外す公式の手段が無く、要望(npm/rfcs#830)は not_planned で閉じています。
|
|
38
|
+
|
|
39
|
+
パッケージは `--package=` ではなく、位置引数で渡してください。
|
|
40
|
+
`--package=` で渡すと、npm が `npm_config_package` をサーバの子プロセスに残します。
|
|
41
|
+
すると、テーマの依存の取得(pnpm と corepack のどちらも無いとき)が打つ npx が、これを読んで別のパッケージを実行します。
|
|
42
|
+
|
|
43
|
+
`--prefix=/` には次の副作用があります。
|
|
44
|
+
|
|
45
|
+
- 利用者のリポジトリの `.npmrc` を読まず、globalconfig も `/etc/npmrc` になる。registry・proxy・cafile は `~/.npmrc` に置く
|
|
46
|
+
- `npm_config_prefix=/` などの環境変数がサーバに引き継がれる。サーバの子で `npm i -g` を打つと `/lib/node_modules` を向く
|
|
47
|
+
|
|
48
|
+
`setup` は `npm install --prefix` で置き場を明示します。
|
|
49
|
+
テーマの依存の取得(pnpm)は、talk-dir を cwd か `--dir` で指します。どちらも、この副作用の影響を受けません。
|
|
50
|
+
|
|
51
|
+
この副作用を避けたいときは、先に `npm i -g @pecot/visual-mcp` で入れて、コマンドを直接登録します。
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"pecot-visual": {
|
|
57
|
+
"command": "pecot-visual-mcp"
|
|
30
58
|
}
|
|
31
59
|
}
|
|
32
60
|
}
|
|
@@ -40,7 +68,7 @@ MCP クライアントに 1 エントリ登録するだけで pecot-visual の
|
|
|
40
68
|
"mcpServers": {
|
|
41
69
|
"pecot-visual": {
|
|
42
70
|
"command": "npx",
|
|
43
|
-
"args": ["-y", "@pecot/visual-mcp"],
|
|
71
|
+
"args": ["-y", "--prefix=/", "@pecot/visual-mcp"],
|
|
44
72
|
"env": { "PLUGIN_DATA": "/home/<user>/pecot-visual-data" }
|
|
45
73
|
}
|
|
46
74
|
}
|
|
@@ -54,7 +82,7 @@ Windows の MCP クライアントから使う場合は WSL2 経由で起動し
|
|
|
54
82
|
"mcpServers": {
|
|
55
83
|
"pecot-visual": {
|
|
56
84
|
"command": "wsl",
|
|
57
|
-
"args": ["npx", "-y", "@pecot/visual-mcp"]
|
|
85
|
+
"args": ["npx", "-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
58
86
|
}
|
|
59
87
|
}
|
|
60
88
|
}
|
|
@@ -67,14 +95,14 @@ WSL 側に `PLUGIN_DATA` を渡すには、`env` を `args` に含めます。Wi
|
|
|
67
95
|
"mcpServers": {
|
|
68
96
|
"pecot-visual": {
|
|
69
97
|
"command": "wsl",
|
|
70
|
-
"args": ["env", "PLUGIN_DATA=/home/<user>/pecot-visual-data", "npx", "-y", "@pecot/visual-mcp"]
|
|
98
|
+
"args": ["env", "PLUGIN_DATA=/home/<user>/pecot-visual-data", "npx", "-y", "--prefix=/", "@pecot/visual-mcp"]
|
|
71
99
|
}
|
|
72
100
|
}
|
|
73
101
|
}
|
|
74
102
|
```
|
|
75
103
|
|
|
76
104
|
WSL 内の npx が非ログインシェルの PATH に無い場合は、次のように指定します。
|
|
77
|
-
`"args": ["-e", "bash", "-lc", "npx -y @pecot/visual-mcp"]`
|
|
105
|
+
`"args": ["-e", "bash", "-lc", "npx -y --prefix=/ @pecot/visual-mcp"]`
|
|
78
106
|
|
|
79
107
|
ツールのパス引数には `C:\...` と `\\wsl.localhost\<distro>\...` をそのまま渡せます。
|
|
80
108
|
変換の対象はツール引数のみです。spec ファイル等の中身に書かれたパスは変換しません。
|
|
@@ -129,6 +157,8 @@ Chromium を使うため `setup` が必要です。
|
|
|
129
157
|
|
|
130
158
|
`setup` が必要なツールを `setup` 前に呼ぶと、`setup` を案内する応答が返ります。`setup` を呼んでから再実行してください。
|
|
131
159
|
|
|
160
|
+
`EBADDEVENGINES` で止まるときは、登録の `args` に `--prefix=/` が付いているか確認してください。
|
|
161
|
+
|
|
132
162
|
## 版
|
|
133
163
|
|
|
134
164
|
npm の版は pecot-v(pecot-visual)プラグインの版と一致します。
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"c8": "^12.0.0",
|
|
33
33
|
"eslint": "^10.14.0",
|
|
34
34
|
"eslint-config-prettier": "^10.1.8",
|
|
35
|
-
"eslint-plugin-vue": "^10.12.
|
|
35
|
+
"eslint-plugin-vue": "^10.12.1",
|
|
36
36
|
"globals": "^17.14.0",
|
|
37
37
|
"jszip": "^3.10.2",
|
|
38
38
|
"playwright": "^1.65.0",
|
|
39
39
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
40
|
-
"typescript-eslint": "^8.72.
|
|
40
|
+
"typescript-eslint": "^8.72.2",
|
|
41
41
|
"typescript7": "npm:typescript@^7.0.2",
|
|
42
42
|
"vue-eslint-parser": "^10.4.2",
|
|
43
43
|
"yaml": "^2.9.1"
|
|
@@ -123,9 +123,8 @@ export interface ImageAnchor {
|
|
|
123
123
|
readonly heightEmu: number;
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
|
-
注記図形 1
|
|
127
|
-
|
|
128
|
-
これは pic 側の colOff / rowOff が 0 であることに依存するため、両者は一緒に変える。
|
|
126
|
+
注記図形 1 件の共通部分。オフセットはグループ内の座標 (画像左上が原点) の EMU で、
|
|
127
|
+
`a:off` にそのまま入る。
|
|
129
128
|
*/
|
|
130
129
|
interface AnnotationShapeBase {
|
|
131
130
|
readonly offsetXEmu: number;
|
|
@@ -59,14 +59,7 @@ styles.xml。要素順 `fonts → fills → borders → cellStyleXfs → cellXfs
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function buildStylesXml(): string;
|
|
61
61
|
/**
|
|
62
|
-
drawing1.xml
|
|
63
|
-
`xdr:oneCellAnchor` の子要素順は `xdr:from → xdr:ext → (xdr:pic|xdr:sp) → xdr:clientData`。
|
|
64
|
-
`xdr:pic` の子要素順は `nvPicPr → blipFill → spPr`。
|
|
65
|
-
`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
66
|
-
|
|
67
|
-
注記図形は画像と同じアンカーセルに置き、画像左上からの EMU オフセットを
|
|
68
|
-
colOff / rowOff で与える (画像側の colOff / rowOff が 0 であることに依存する)。
|
|
69
|
-
cNvPr の id は画像・注記を通した連番で、drawing 全体で一意にする。
|
|
62
|
+
drawing1.xml。`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
70
63
|
*/
|
|
71
64
|
export declare function buildDrawingXml(placements: readonly ImagePlacement[]): string;
|
|
72
65
|
/**
|
|
@@ -395,18 +395,9 @@ function cellXfXml(definition) {
|
|
|
395
395
|
+ `</xf>`;
|
|
396
396
|
}
|
|
397
397
|
/**
|
|
398
|
-
drawing1.xml
|
|
399
|
-
`xdr:oneCellAnchor` の子要素順は `xdr:from → xdr:ext → (xdr:pic|xdr:sp) → xdr:clientData`。
|
|
400
|
-
`xdr:pic` の子要素順は `nvPicPr → blipFill → spPr`。
|
|
401
|
-
`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
402
|
-
|
|
403
|
-
注記図形は画像と同じアンカーセルに置き、画像左上からの EMU オフセットを
|
|
404
|
-
colOff / rowOff で与える (画像側の colOff / rowOff が 0 であることに依存する)。
|
|
405
|
-
cNvPr の id は画像・注記を通した連番で、drawing 全体で一意にする。
|
|
398
|
+
drawing1.xml。`r:embed` の rId は placement の並び順で振るため、buildDrawingRelsXml と同じ順で渡す。
|
|
406
399
|
*/
|
|
407
400
|
export function buildDrawingXml(placements) {
|
|
408
|
-
// 画像 → その画像の注記 の順に採番する。id を先に確定させてから XML を組むことで、
|
|
409
|
-
// 連結の順序と採番の順序を切り離す。
|
|
410
401
|
let nextShapeId = FIRST_SHAPE_ID;
|
|
411
402
|
const takeShapeId = () => {
|
|
412
403
|
const id = nextShapeId;
|
|
@@ -415,30 +406,49 @@ export function buildDrawingXml(placements) {
|
|
|
415
406
|
};
|
|
416
407
|
const anchors = placements.map((placement, offset) => {
|
|
417
408
|
const { anchor } = placement;
|
|
418
|
-
const
|
|
409
|
+
const relationshipId = imageRelationshipId(offset);
|
|
410
|
+
let body;
|
|
411
|
+
if (placement.annotationShapes.length > 0) {
|
|
412
|
+
const groupId = takeShapeId();
|
|
413
|
+
const pictureXml = buildPictureXml(placement, relationshipId, takeShapeId());
|
|
414
|
+
const shapesXml = placement.annotationShapes.map(shape => buildShapeXml(shape, takeShapeId())).join('');
|
|
415
|
+
body = buildGroupXml(placement, groupId, pictureXml, shapesXml);
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
body = buildPictureXml(placement, relationshipId, takeShapeId());
|
|
419
|
+
}
|
|
420
|
+
return anchorXml({
|
|
419
421
|
column: anchor.column,
|
|
420
422
|
row: anchor.row,
|
|
421
423
|
columnOffsetEmu: 0,
|
|
422
424
|
rowOffsetEmu: 0,
|
|
423
425
|
widthEmu: anchor.widthEmu,
|
|
424
426
|
heightEmu: anchor.heightEmu,
|
|
425
|
-
},
|
|
426
|
-
const shapeAnchors = placement.annotationShapes
|
|
427
|
-
.map(shape => anchorXml({
|
|
428
|
-
column: anchor.column,
|
|
429
|
-
row: anchor.row,
|
|
430
|
-
columnOffsetEmu: shape.offsetXEmu,
|
|
431
|
-
rowOffsetEmu: shape.offsetYEmu,
|
|
432
|
-
widthEmu: shape.widthEmu,
|
|
433
|
-
heightEmu: shape.heightEmu,
|
|
434
|
-
}, buildShapeXml(shape, takeShapeId())))
|
|
435
|
-
.join('');
|
|
436
|
-
return pictureAnchor + shapeAnchors;
|
|
427
|
+
}, body);
|
|
437
428
|
}).join('');
|
|
438
429
|
return `${XML_DECLARATION}\n<xdr:wsDr xmlns:xdr="${NS_SPREADSHEET_DRAWING}" xmlns:a="${NS_DRAWINGML}"`
|
|
439
430
|
+ ` xmlns:r="${NS_OFFICE_RELATIONSHIPS}">${anchors}</xdr:wsDr>`;
|
|
440
431
|
}
|
|
441
432
|
/**
|
|
433
|
+
画像と注記をまとめる `xdr:grpSp`。子の座標系 (chOff / chExt) は画像の寸法に揃え、
|
|
434
|
+
グループ内の座標が EMU のまま画像左上を原点にする。
|
|
435
|
+
*/
|
|
436
|
+
function buildGroupXml(placement, groupId, pictureXml, shapesXml) {
|
|
437
|
+
const { widthEmu, heightEmu } = placement.anchor;
|
|
438
|
+
const cx = widthEmu.toString();
|
|
439
|
+
const cy = heightEmu.toString();
|
|
440
|
+
return `<xdr:grpSp>`
|
|
441
|
+
+ `<xdr:nvGrpSpPr>`
|
|
442
|
+
+ `<xdr:cNvPr id="${groupId.toString()}" name="Group ${placement.index.toString()}"/>`
|
|
443
|
+
+ `<xdr:cNvGrpSpPr/>`
|
|
444
|
+
+ `</xdr:nvGrpSpPr>`
|
|
445
|
+
+ `<xdr:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${cx}" cy="${cy}"/>`
|
|
446
|
+
+ `<a:chOff x="0" y="0"/><a:chExt cx="${cx}" cy="${cy}"/></a:xfrm></xdr:grpSpPr>`
|
|
447
|
+
+ pictureXml
|
|
448
|
+
+ shapesXml
|
|
449
|
+
+ `</xdr:grpSp>`;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
442
452
|
oneCellAnchor の外枠。clientData は省略不可 (欠くと LibreOffice が図形を描画しない)。
|
|
443
453
|
`editAs` は CT_TwoCellAnchor だけが持つ属性なので oneCellAnchor には出さない。
|
|
444
454
|
*/
|
|
@@ -488,7 +498,8 @@ function buildShapeXml(shape, shapeId) {
|
|
|
488
498
|
+ `<xdr:cNvSpPr/>`
|
|
489
499
|
+ `</xdr:nvSpPr>`
|
|
490
500
|
+ `<xdr:spPr>`
|
|
491
|
-
+ `<a:xfrm${parts.transformAttributes}
|
|
501
|
+
+ `<a:xfrm${parts.transformAttributes}>`
|
|
502
|
+
+ `<a:off x="${shape.offsetXEmu.toString()}" y="${shape.offsetYEmu.toString()}"/>${extent}</a:xfrm>`
|
|
492
503
|
+ parts.geometry
|
|
493
504
|
+ parts.style
|
|
494
505
|
+ `</xdr:spPr>`
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pecot/visual-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@pecot/visual-mcp",
|
|
9
|
-
"version": "1.3.
|
|
9
|
+
"version": "1.3.1",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@cffnpwr/textlint-plugin-comments": "1.0.0",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
"node_modules/@babel/helper-string-parser": {
|
|
74
|
-
"version": "7.29.
|
|
75
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.
|
|
76
|
-
"integrity": "sha512-
|
|
74
|
+
"version": "7.29.14",
|
|
75
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.14.tgz",
|
|
76
|
+
"integrity": "sha512-CXvKMFvM80ihI7Vox9jb+kQjnyjESQNPM+vB7U0Zz6TWuZA+Z/FL0QPMH300h33qJtIx+REeBhXqWOPW48TcAQ==",
|
|
77
77
|
"license": "MIT",
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=6.9.0"
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"node_modules/@babel/parser": {
|
|
92
|
-
"version": "7.29.
|
|
93
|
-
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.
|
|
94
|
-
"integrity": "sha512-
|
|
92
|
+
"version": "7.29.14",
|
|
93
|
+
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.14.tgz",
|
|
94
|
+
"integrity": "sha512-VL220vXuyO2z3rNIQwY7ftj9UwpqOt+33sH+sBWkOekbsSR2g7EEMnOx24ZlCH0xOA3DM/33SifVFGbnJD8r/w==",
|
|
95
95
|
"license": "MIT",
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"@babel/types": "^7.29.
|
|
97
|
+
"@babel/types": "^7.29.14"
|
|
98
98
|
},
|
|
99
99
|
"bin": {
|
|
100
100
|
"parser": "bin/babel-parser.js"
|
|
@@ -104,12 +104,12 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"node_modules/@babel/types": {
|
|
107
|
-
"version": "7.29.
|
|
108
|
-
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.
|
|
109
|
-
"integrity": "sha512-
|
|
107
|
+
"version": "7.29.14",
|
|
108
|
+
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.14.tgz",
|
|
109
|
+
"integrity": "sha512-UjI/dKmwJwT9pOszJitq2G6EObZPnsZUfdCr92z2TlF3EZK9J3EdfOKUrCzHl6wFthbzwhzl1Soc/UIwxRiq6w==",
|
|
110
110
|
"license": "MIT",
|
|
111
111
|
"dependencies": {
|
|
112
|
-
"@babel/helper-string-parser": "^7.29.
|
|
112
|
+
"@babel/helper-string-parser": "^7.29.14",
|
|
113
113
|
"@babel/helper-validator-identifier": "^7.29.7"
|
|
114
114
|
},
|
|
115
115
|
"engines": {
|
|
@@ -613,16 +613,10 @@
|
|
|
613
613
|
"license": "MIT"
|
|
614
614
|
},
|
|
615
615
|
"node_modules/@textlint/regexp-string-matcher": {
|
|
616
|
-
"version": "2.0.
|
|
617
|
-
"resolved": "https://registry.npmjs.org/@textlint/regexp-string-matcher/-/regexp-string-matcher-2.0.
|
|
618
|
-
"integrity": "sha512-
|
|
619
|
-
"license": "MIT"
|
|
620
|
-
"dependencies": {
|
|
621
|
-
"escape-string-regexp": "^4.0.0",
|
|
622
|
-
"lodash.sortby": "^4.7.0",
|
|
623
|
-
"lodash.uniq": "^4.5.0",
|
|
624
|
-
"lodash.uniqwith": "^4.5.0"
|
|
625
|
-
}
|
|
616
|
+
"version": "2.0.3",
|
|
617
|
+
"resolved": "https://registry.npmjs.org/@textlint/regexp-string-matcher/-/regexp-string-matcher-2.0.3.tgz",
|
|
618
|
+
"integrity": "sha512-oLaihTHU+vutFmWOXTJexrIYFTF2f60QMTXQjvWO0/jJmCXQ2yfOq6xic0XO2MjG7A1d0UIk4oBMXTLps3mfsg==",
|
|
619
|
+
"license": "MIT"
|
|
626
620
|
},
|
|
627
621
|
"node_modules/@textlint/resolver": {
|
|
628
622
|
"version": "15.8.0",
|
|
@@ -976,9 +970,9 @@
|
|
|
976
970
|
"license": "BSD-2-Clause"
|
|
977
971
|
},
|
|
978
972
|
"node_modules/brace-expansion": {
|
|
979
|
-
"version": "5.0.
|
|
980
|
-
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.
|
|
981
|
-
"integrity": "sha512-
|
|
973
|
+
"version": "5.0.13",
|
|
974
|
+
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.13.tgz",
|
|
975
|
+
"integrity": "sha512-Vh3dmFbc4wZeox7M9I/0L9GfFd83Su4+yCck/OF9Gi/P/dAHn0RT7X4K9R7gMNMhDck3DvhR6QXsnQdjjgwNvQ==",
|
|
982
976
|
"license": "MIT",
|
|
983
977
|
"dependencies": {
|
|
984
978
|
"balanced-match": "^4.0.2"
|
|
@@ -2063,10 +2057,10 @@
|
|
|
2063
2057
|
}
|
|
2064
2058
|
},
|
|
2065
2059
|
"node_modules/graceful-fs": {
|
|
2066
|
-
"version": "4.2.
|
|
2067
|
-
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.
|
|
2068
|
-
"integrity": "sha512-
|
|
2069
|
-
"license": "
|
|
2060
|
+
"version": "4.2.12",
|
|
2061
|
+
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.12.tgz",
|
|
2062
|
+
"integrity": "sha512-iuyGF2E4oafQfPsRrG2wtY2ILupMhvtdrhzrxB+0VcjsPpSPttpfYdjnGFGsTi5MaJFjI1jOKHPQ6UTbTj9TAw==",
|
|
2063
|
+
"license": "BlueOak-1.0.0"
|
|
2070
2064
|
},
|
|
2071
2065
|
"node_modules/has-bigints": {
|
|
2072
2066
|
"version": "1.1.0",
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ca6077478e9603280ff689d7bbe18d5cc1071d92f6c112d99d30c689ac15e47c
|