@yuhan1124/draw-prompt 0.4.3 → 0.4.5

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.md CHANGED
@@ -34,14 +34,20 @@ Prompt 的默认结构是三段:`User visual brief` 原始视觉需求、`Styl
34
34
  发布到 npm 后可以直接:
35
35
 
36
36
  ```bash
37
- npx @yuhan1124/draw-prompt status
38
- npx @yuhan1124/draw-prompt convert "茶饮新品海报,写冷泡系列"
39
- npx @yuhan1124/draw-prompt install-skill --target codex
37
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest status
38
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest convert "茶饮新品海报,写冷泡系列"
39
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest install-skill --target codex
40
40
  ```
41
41
 
42
42
  `npx` 包内置同一份 Python CLI 和 references。执行时优先使用 `uv run` 自动处理
43
43
  PEP723 依赖;没有 `uv` 时退回 `python3`。`overlay`、`visual-check`、`edit-check`
44
44
  需要 Pillow,推荐用户安装 `uv` 获得最稳运行链路。
45
+ 显式 `--registry=https://registry.npmjs.org/` 是为了避开公司/镜像 registry 的同步延迟;
46
+ 如果你的 npm 默认 registry 已经是公网 npm,也可以省略。
47
+
48
+ 如果当前目录就是本仓库源码目录,`npx @yuhan1124/draw-prompt ...` 可能被 npm 解析到同名本地
49
+ package 而失败;本地开发请直接用 `node bin/draw-prompt.js ...` 或
50
+ `python3 scripts/prompt_cli.py ...`。
45
51
 
46
52
  `visual-regress` / `benchmark` 用到的回归集只保留在开发仓库本地,不随 npm 包发布。
47
53
 
@@ -51,13 +57,13 @@ PEP723 依赖;没有 `uv` 时退回 `python3`。`overlay`、`visual-check`、`
51
57
 
52
58
  ```bash
53
59
  # 安装到 Codex:~/.codex/skills/draw-prompt
54
- npx @yuhan1124/draw-prompt install-skill --target codex
60
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest install-skill --target codex
55
61
 
56
62
  # 安装到 Claude Code:~/.claude/skills/draw-prompt
57
- npx @yuhan1124/draw-prompt install-skill --target claude
63
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest install-skill --target claude
58
64
 
59
65
  # 同时安装两边;更新已有安装时加 --force
60
- npx @yuhan1124/draw-prompt install-skill --target both --force
66
+ npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest install-skill --target both --force
61
67
  ```
62
68
 
63
69
  `install-skill` 默认复制 npm 包内的运行文件,避免软链到 npx 缓存导致后续路径失效。它只复制
@@ -73,7 +79,9 @@ ln -s ~/Desktop/draw-prompt ~/.claude/skills/draw-prompt
73
79
 
74
80
  依赖:`uv`(推荐,PEP723 自动装 pyyaml)或 `python3`。检查环境:
75
81
  ```bash
76
- uv run scripts/prompt_cli.py status
82
+ node bin/draw-prompt.js status
83
+ # 或
84
+ python3 scripts/prompt_cli.py status
77
85
  ```
78
86
 
79
87
  ## 怎么用
package/SKILL.md CHANGED
@@ -8,7 +8,7 @@ description: >-
8
8
  画图的指令"、"优化我的出图 prompt"、"按我的风格生成 prompt",或在用 GPT Image 2 /
9
9
  gpt-image-2 出图前需要一段精准提示词时,使用本 skill。
10
10
  metadata:
11
- version: 0.4.3
11
+ version: 0.4.5
12
12
  openclaw:
13
13
  anyBins: ["uv", "python3"]
14
14
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuhan1124/draw-prompt",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Convert natural-language image requests into high-quality gpt-image-2 prompts and Codex handoff blocks.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -51,6 +51,7 @@ import json
51
51
  import os
52
52
  import re
53
53
  import shutil
54
+ import subprocess
54
55
  import sys
55
56
  from datetime import datetime, timezone
56
57
  from pathlib import Path
@@ -135,7 +136,7 @@ def ensure_home() -> None:
135
136
 
136
137
 
137
138
  SCHEMA_VERSION = 1
138
- COMPILER_VERSION = "0.4.3"
139
+ COMPILER_VERSION = "0.4.5"
139
140
 
140
141
 
141
142
  PACKAGED_SKILL_FILES = [
@@ -4178,7 +4179,8 @@ def load_json_value(value: str | None) -> dict:
4178
4179
 
4179
4180
  def missing_pillow_message(command: str) -> str:
4180
4181
  return (
4181
- f"{command} 需要 Pillow 图像库。请优先用 `uv run` / `npx @yuhan1124/draw-prompt ...` 自动安装依赖,"
4182
+ f"{command} 需要 Pillow 图像库。请优先用 `uv run` / "
4183
+ "`npx --yes --registry=https://registry.npmjs.org/ @yuhan1124/draw-prompt@latest ...` 自动安装依赖,"
4182
4184
  "或在当前 Python 环境中安装:python3 -m pip install pillow"
4183
4185
  )
4184
4186
 
@@ -5570,6 +5572,44 @@ def cmd_install_skill(args: argparse.Namespace) -> int:
5570
5572
  # --------------------------------------------------------------------------- #
5571
5573
  # status
5572
5574
  # --------------------------------------------------------------------------- #
5575
+ def npm_registry_status() -> str:
5576
+ npm = which("npm")
5577
+ if not npm:
5578
+ try:
5579
+ probe = subprocess.run(
5580
+ ["/bin/zsh", "-lic", "command -v npm"],
5581
+ text=True,
5582
+ capture_output=True,
5583
+ check=False,
5584
+ timeout=5,
5585
+ )
5586
+ except Exception:
5587
+ probe = None
5588
+ npm = ""
5589
+ if probe and probe.stdout:
5590
+ for line in probe.stdout.splitlines():
5591
+ candidate = line.strip()
5592
+ if candidate and Path(candidate).name == "npm" and Path(candidate).exists():
5593
+ npm = candidate
5594
+ break
5595
+ if not npm:
5596
+ return "未找到 npm(如需 npx 安装,请确认 npm 在 PATH 中)"
5597
+ try:
5598
+ result = subprocess.run(
5599
+ [npm, "config", "get", "registry"],
5600
+ text=True,
5601
+ capture_output=True,
5602
+ check=False,
5603
+ timeout=3,
5604
+ )
5605
+ except Exception as exc:
5606
+ return f"读取失败:{exc}"
5607
+ registry = (result.stdout or "").strip() or "未知"
5608
+ if registry == "https://registry.npmjs.org/" or registry == "https://registry.npmjs.org":
5609
+ return f"{registry}(公网 npm)"
5610
+ return f"{registry}(建议 npx 加 --registry=https://registry.npmjs.org/)"
5611
+
5612
+
5573
5613
  def cmd_status(args: argparse.Namespace) -> int:
5574
5614
  print("draw-prompt 环境检查")
5575
5615
  print(f" 数据目录 : {data_home()} ({'存在' if data_home().exists() else '未创建'})")
@@ -5586,6 +5626,7 @@ def cmd_status(args: argparse.Namespace) -> int:
5586
5626
  claude_skill = Path.home() / ".claude" / "skills" / "draw-prompt"
5587
5627
  print(f" Codex skill: {codex_skill} ({'已安装' if is_draw_prompt_install(codex_skill) else '未安装,可运行 install-skill --target codex'})")
5588
5628
  print(f" Claude skill: {claude_skill} ({'已安装' if is_draw_prompt_install(claude_skill) else '未安装,可运行 install-skill --target claude'})")
5629
+ print(f" npm registry: {npm_registry_status()}")
5589
5630
  print(" ── 下游出图通道(本 skill 不主动调用,仅提示可用性)──")
5590
5631
  print(f" codex CLI : {which('codex') or '未找到'}")
5591
5632
  plugin = Path.home() / ".claude" / "plugins" / "cache" / "codex-image-in-cc"