paintress 0.0.0-stage → 0.1.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CThun's Eye
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,127 @@
1
- # Temporary Holding Version
1
+ # Paintress
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 面向 AI agent 的设计稿操作层。用 MCP 工具读写结构化的 `.pen` 设计稿,渲染为 HTML,在浏览器里查看与标记。
4
+
5
+ 早期开发中,尚未发布。
6
+
7
+ ## 能力
8
+
9
+ - **读写**:查询、修改、插入、删除设计稿节点,保持文件格式不变
10
+ - **渲染**:设计稿 → HTML/CSS,由浏览器排版,输出可直接使用的页面
11
+ - **查看**:本地服务,文件变更自动刷新
12
+ - **标记**:点击节点生成短号,便于在对话中指代
13
+
14
+ ## 安装
15
+
16
+ 要求 Node.js ≥ 22。
17
+
18
+ ```bash
19
+ npm install -g paintress # 全局安装,命令名为 paintress
20
+ npx paintress --help # 或临时运行
21
+ ```
22
+
23
+ > 包名待最终确定:若发布在 `@aliciai` 作用域下,把下文命令里的 `paintress` 换成 `@aliciai/paintress`,CLI 命令名不变。
24
+
25
+ ## 接入 MCP 客户端
26
+
27
+ 服务端就是一条 stdio 命令:`paintress mcp`。各客户端的差异只在配置文件位置与顶层字段名。
28
+
29
+ ### 自动写入(推荐)
30
+
31
+ ```bash
32
+ paintress doctor # 先看各客户端是否已安装、配置是否已就位
33
+ paintress install --dry-run # 预览将要写入的内容,不动磁盘
34
+ paintress install # 写入所有已检测到的客户端
35
+ paintress install pi cursor # 只写指定客户端
36
+ ```
37
+
38
+ 写入规则:只合并 `mcpServers.paintress`(VS Code 为 `servers.paintress`)这一条,其他键与他人条目原样保留;改动前会生成 `*.bak-<时间戳>` 备份;已有的 Codex TOML 只追加不重写。
39
+
40
+ 单个客户端也可以只要片段:
41
+
42
+ ```bash
43
+ paintress mcp-config pi # 输出 JSON 片段
44
+ paintress mcp-config codex # 输出 TOML 片段
45
+ ```
46
+
47
+ 下面是手工配置时的完整写法。
48
+
49
+ ### Claude Desktop
50
+
51
+ `claude_desktop_config.json`:
52
+
53
+ ```json
54
+ {
55
+ "mcpServers": {
56
+ "paintress": { "command": "npx", "args": ["-y", "paintress", "mcp"] }
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### Cursor
62
+
63
+ `~/.cursor/mcp.json`(全局)或 `.cursor/mcp.json`(项目,可提交):
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "paintress": { "command": "npx", "args": ["-y", "paintress", "mcp"] }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### VS Code
74
+
75
+ `.vscode/mcp.json`(顶层键是 `servers`,不是 `mcpServers`):
76
+
77
+ ```json
78
+ {
79
+ "servers": {
80
+ "paintress": { "type": "stdio", "command": "npx", "args": ["-y", "paintress", "mcp"] }
81
+ }
82
+ }
83
+ ```
84
+
85
+ ### Codex
86
+
87
+ `~/.codex/config.toml`:
88
+
89
+ ```toml
90
+ [mcp_servers.paintress]
91
+ command = "npx"
92
+ args = ["-y", "paintress", "mcp"]
93
+ ```
94
+
95
+ ### pi
96
+
97
+ `~/.pi/agent/mcp.json`(用户级)或 `.pi/mcp.json`(项目级):
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "paintress": { "command": "paintress", "args": ["mcp"] }
103
+ }
104
+ }
105
+ ```
106
+
107
+ 若 paintress 装在 `~/.pi/agent/npm` 里(该目录的 `.bin` 不在 PATH),`command` 写成 `~/.pi/agent/npm/node_modules/.bin/paintress`。
108
+
109
+ ## 查看设计稿
110
+
111
+ ```bash
112
+ paintress web --idle 3600000 # 起本地查看器(默认 http://localhost:3316)
113
+ paintress watch demo ./demo # 注册一个项目目录
114
+ ```
115
+
116
+ 浏览器打开 `http://localhost:3316/?project=demo&file=hello.ptr`:滚轮以光标为锚点缩放,空格 / 中键 / 空白处拖拽平移,`Ctrl/Cmd+0` 回 100%,`Shift+1` 适应窗口;多画板文件会显示画板条。
117
+
118
+ ## 原则
119
+
120
+ - 只处理明文 JSON 设计稿,不依赖任何商业设计工具的 SDK、账号或托管服务
121
+ - 渲染输出标准 HTML,不使用私有格式
122
+ - 不含编辑器 UI:支持查看与标记,不支持拖拽改布局
123
+ - 写入前备份、原子替换,避免数据损坏
124
+
125
+ ## 许可
126
+
127
+ MIT