@kunlv/atdc 1.0.3 → 1.0.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/bin/add-command.py +7 -7
- package/install.sh +20 -20
- package/package.json +1 -1
- package/prompts/6-article.md +24 -9
package/bin/add-command.py
CHANGED
|
@@ -42,10 +42,10 @@ description: {desc}。触发词:{triggers}。
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
PATHS = {
|
|
45
|
-
"opencode": f"{ATD}/commands/opencode/
|
|
46
|
-
"claude": f"{ATD}/commands/claude/
|
|
47
|
-
"codex": f"{ATD}/commands/codex/
|
|
48
|
-
"cursor": f"{ATD}/commands/cursor/
|
|
45
|
+
"opencode": f"{ATD}/commands/opencode/atdc/{{name}}.md",
|
|
46
|
+
"claude": f"{ATD}/commands/claude/atdc/{{name}}.md",
|
|
47
|
+
"codex": f"{ATD}/commands/codex/atdc-{{name}}/SKILL.md",
|
|
48
|
+
"cursor": f"{ATD}/commands/cursor/atdc-{{name}}/SKILL.md",
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
def add_command(name, desc, triggers, prompt=None, short_desc=None, from_learn=False, failure=None, dead_end=None):
|
|
@@ -99,13 +99,13 @@ def add_command(name, desc, triggers, prompt=None, short_desc=None, from_learn=F
|
|
|
99
99
|
with open(install_sh) as f:
|
|
100
100
|
content = f.read()
|
|
101
101
|
|
|
102
|
-
skill_name = f"
|
|
103
|
-
marker = "for skill in
|
|
102
|
+
skill_name = f"atdc-{name}"
|
|
103
|
+
marker = "for skill in atdc "
|
|
104
104
|
if marker in content and skill_name not in content:
|
|
105
105
|
# Find the "for skill in" line and add the new skill
|
|
106
106
|
lines = content.split("\n")
|
|
107
107
|
for i, line in enumerate(lines):
|
|
108
|
-
if "for skill in
|
|
108
|
+
if "for skill in atdc " in line and skill_name not in line:
|
|
109
109
|
# Insert before the "do" keyword
|
|
110
110
|
j = line.rfind("; do")
|
|
111
111
|
if j < 0:
|
package/install.sh
CHANGED
|
@@ -68,26 +68,26 @@ echo "Step 2.6:检查旧 flow-kit symlink 迁移..."
|
|
|
68
68
|
MIGRATED=0
|
|
69
69
|
|
|
70
70
|
# Claude Code
|
|
71
|
-
if [ -L "$HOME_DIR/.claude/commands/
|
|
72
|
-
rm -f "$HOME_DIR/.claude/commands/
|
|
73
|
-
echo " ✓ 移除旧 symlink ~/.claude/commands/
|
|
71
|
+
if [ -L "$HOME_DIR/.claude/commands/atdc.md" ]; then
|
|
72
|
+
rm -f "$HOME_DIR/.claude/commands/atdc.md"
|
|
73
|
+
echo " ✓ 移除旧 symlink ~/.claude/commands/atdc.md"
|
|
74
74
|
MIGRATED=1
|
|
75
75
|
fi
|
|
76
|
-
if [ -L "$HOME_DIR/.claude/commands/
|
|
77
|
-
rm -rf "$HOME_DIR/.claude/commands/
|
|
78
|
-
echo " ✓ 移除旧 symlink ~/.claude/commands/
|
|
76
|
+
if [ -L "$HOME_DIR/.claude/commands/atdc" ]; then
|
|
77
|
+
rm -rf "$HOME_DIR/.claude/commands/atdc"
|
|
78
|
+
echo " ✓ 移除旧 symlink ~/.claude/commands/atdc/"
|
|
79
79
|
MIGRATED=1
|
|
80
80
|
fi
|
|
81
81
|
|
|
82
82
|
# OpenCode
|
|
83
|
-
if [ -L "$HOME_DIR/.config/opencode/commands/
|
|
84
|
-
rm -f "$HOME_DIR/.config/opencode/commands/
|
|
85
|
-
echo " ✓ 移除旧 symlink ~/.config/opencode/commands/
|
|
83
|
+
if [ -L "$HOME_DIR/.config/opencode/commands/atdc.md" ]; then
|
|
84
|
+
rm -f "$HOME_DIR/.config/opencode/commands/atdc.md"
|
|
85
|
+
echo " ✓ 移除旧 symlink ~/.config/opencode/commands/atdc.md"
|
|
86
86
|
MIGRATED=1
|
|
87
87
|
fi
|
|
88
|
-
if [ -L "$HOME_DIR/.config/opencode/commands/
|
|
89
|
-
rm -rf "$HOME_DIR/.config/opencode/commands/
|
|
90
|
-
echo " ✓ 移除旧 symlink ~/.config/opencode/commands/
|
|
88
|
+
if [ -L "$HOME_DIR/.config/opencode/commands/atdc" ]; then
|
|
89
|
+
rm -rf "$HOME_DIR/.config/opencode/commands/atdc"
|
|
90
|
+
echo " ✓ 移除旧 symlink ~/.config/opencode/commands/atdc/"
|
|
91
91
|
MIGRATED=1
|
|
92
92
|
fi
|
|
93
93
|
|
|
@@ -128,16 +128,16 @@ else
|
|
|
128
128
|
if [ -L "$CLAUDE_CMD/atd.md" ] || [ -f "$CLAUDE_CMD/atd.md" ]; then
|
|
129
129
|
rm -f "$CLAUDE_CMD/atd.md"
|
|
130
130
|
fi
|
|
131
|
-
ln -s "$ATDC_DIR/commands/claude/
|
|
131
|
+
ln -s "$ATDC_DIR/commands/claude/atdc.md" "$CLAUDE_CMD/atd.md"
|
|
132
132
|
|
|
133
133
|
# atd/ 子命令目录
|
|
134
134
|
if [ -L "$CLAUDE_CMD/atd" ] || [ -d "$CLAUDE_CMD/atd" ]; then
|
|
135
135
|
rm -rf "$CLAUDE_CMD/atd"
|
|
136
136
|
fi
|
|
137
|
-
ln -s "$ATDC_DIR/commands/claude/
|
|
137
|
+
ln -s "$ATDC_DIR/commands/claude/atdc" "$CLAUDE_CMD/atd"
|
|
138
138
|
|
|
139
|
-
echo " ✓ ~/.claude/commands/
|
|
140
|
-
echo " ✓ ~/.claude/commands/
|
|
139
|
+
echo " ✓ ~/.claude/commands/atdc.md → atdc/commands/claude/atdc.md"
|
|
140
|
+
echo " ✓ ~/.claude/commands/atdc/ → atdc/commands/claude/atdc/"
|
|
141
141
|
fi
|
|
142
142
|
|
|
143
143
|
echo ""
|
|
@@ -155,15 +155,15 @@ else
|
|
|
155
155
|
if [ -L "$OPENCODE_CMD/atd.md" ] || [ -f "$OPENCODE_CMD/atd.md" ]; then
|
|
156
156
|
rm -f "$OPENCODE_CMD/atd.md"
|
|
157
157
|
fi
|
|
158
|
-
ln -s "$ATDC_DIR/commands/opencode/
|
|
158
|
+
ln -s "$ATDC_DIR/commands/opencode/atdc.md" "$OPENCODE_CMD/atd.md"
|
|
159
159
|
|
|
160
160
|
if [ -L "$OPENCODE_CMD/atd" ] || [ -d "$OPENCODE_CMD/atd" ]; then
|
|
161
161
|
rm -rf "$OPENCODE_CMD/atd"
|
|
162
162
|
fi
|
|
163
|
-
ln -s "$ATDC_DIR/commands/opencode/
|
|
163
|
+
ln -s "$ATDC_DIR/commands/opencode/atdc" "$OPENCODE_CMD/atd"
|
|
164
164
|
|
|
165
|
-
echo " ✓ ~/.config/opencode/commands/
|
|
166
|
-
echo " ✓ ~/.config/opencode/commands/
|
|
165
|
+
echo " ✓ ~/.config/opencode/commands/atdc.md → atdc/commands/opencode/atdc.md"
|
|
166
|
+
echo " ✓ ~/.config/opencode/commands/atdc/ → atdc/commands/opencode/atdc/"
|
|
167
167
|
fi
|
|
168
168
|
|
|
169
169
|
echo ""
|
package/package.json
CHANGED
package/prompts/6-article.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
从此文件读取后,直接开始执行,无需用户再次确认。
|
|
4
4
|
|
|
5
|
-
> **触发方式**:`/
|
|
5
|
+
> **触发方式**:`/atd:article`、`/atd article`、`生成文章`、`写文章`
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -39,7 +39,7 @@ echo "TARGET_DIR=$CHANGE_DIR"
|
|
|
39
39
|
|
|
40
40
|
## Step 0.3:用户提供素材的优先处理(OCR 增强)
|
|
41
41
|
|
|
42
|
-
> **触发条件**:用户调用 `/
|
|
42
|
+
> **触发条件**:用户调用 `/atd:article` 时附带素材路径(如「素材在 /path/to/dir/」或「使用 /path/ 下面的图片」)。
|
|
43
43
|
|
|
44
44
|
### 检测素材路径
|
|
45
45
|
|
|
@@ -73,7 +73,7 @@ done
|
|
|
73
73
|
|
|
74
74
|
将 OCR 提取的文字内容用于:
|
|
75
75
|
|
|
76
|
-
1. **识别截图主题**:判断每张截图属于
|
|
76
|
+
1. **识别截图主题**:判断每张截图属于 atd-code 的哪个阶段(1-spec / 2-qa / 3-impl / 4-verify / 5-done)
|
|
77
77
|
2. **补充文章上下文**:OCR 文字作为会话历史的补充证据,丰富 Phase A 素材
|
|
78
78
|
3. **确定插图位置**:按阶段归类后,在文章对应章节插入 `![[素材目录/xxx.png]]`
|
|
79
79
|
|
|
@@ -292,11 +292,20 @@ python3 -c "import xml.etree.ElementTree as ET; ET.parse('<output-path.svg>')" &
|
|
|
292
292
|
|
|
293
293
|
```bash
|
|
294
294
|
# 一键导出目录下所有 SVG → PNG(2x 分辨率)
|
|
295
|
-
node ~/
|
|
295
|
+
node ~/atd-code/scripts/svg2png.js <assets-dir>
|
|
296
296
|
```
|
|
297
297
|
|
|
298
|
-
> 依赖:`~/
|
|
299
|
-
> 若报错 `Cannot find module 'puppeteer'`,执行:`cd ~/
|
|
298
|
+
> 依赖:`~/atd-code/node_modules/puppeteer`(已在 install.sh 中安装)。
|
|
299
|
+
> 若报错 `Cannot find module 'puppeteer'`,执行:`cd ~/atd-code && npm install puppeteer`
|
|
300
|
+
|
|
301
|
+
### B3.5. 修复 PNG 权限(强制)
|
|
302
|
+
|
|
303
|
+
> 🔴 `rsvg-convert` / `Puppeteer` 生成的 PNG 可能继承过紧的 umask,导致 Web 渲染器返回 403。
|
|
304
|
+
> **每张 PNG 导出后必须执行**:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
chmod 644 /Users/lvkun/Documents/Obsidian/Docs/assets/<image>.png
|
|
308
|
+
```
|
|
300
309
|
|
|
301
310
|
### B4. 布局验证
|
|
302
311
|
|
|
@@ -371,14 +380,20 @@ EOF
|
|
|
371
380
|
|
|
372
381
|
**用户素材**(Step 0.3 检测到的):
|
|
373
382
|
- 直接使用用户提供的路径,如 `![[素材目录/1.png]]`
|
|
374
|
-
- Obsidian wikilink 中的路径相对于 `assets/`,即 `/Users/lvkun/Documents/Obsidian/Docs/assets/`
|
|
375
383
|
|
|
376
384
|
**Auto-generated diagrams**(fireworks-tech-graph 生成的):
|
|
377
385
|
- 输出到 Obsidian assets 根目录:
|
|
378
386
|
```
|
|
379
387
|
/Users/lvkun/Documents/Obsidian/Docs/assets/<change-name>-<diagram-label>.png
|
|
380
388
|
```
|
|
381
|
-
-
|
|
389
|
+
- 文章中引用使用**纯文件名** Obsidian wikilink:`![[<change-name>-<diagram-label>.png]]`
|
|
390
|
+
|
|
391
|
+
> ⚠️ **禁止使用带路径前缀的引用**(如 `![[assets/img.png]]` 或 `![[../assets/img.png]]`)。
|
|
392
|
+
> 原因:Web 渲染器的 wikilink 转译规则将 `![[path/img.png]]` 转为 ``,
|
|
393
|
+
> 路径会相对于文档所在目录解析,而非 vault 根目录。纯文件名才能触发渲染器的全局 assets 搜索。
|
|
394
|
+
>
|
|
395
|
+
> ✅ 正确:`![[atdc-arch.png]]`
|
|
396
|
+
> ❌ 错误:`![[assets/atdc-arch.png]]`
|
|
382
397
|
|
|
383
398
|
---
|
|
384
399
|
|
|
@@ -405,7 +420,7 @@ EOF
|
|
|
405
420
|
缺失的 skill:<skill-name>
|
|
406
421
|
安装方式:npx skills add <skill-package>
|
|
407
422
|
|
|
408
|
-
所有 skill 就绪后重新运行 /
|
|
423
|
+
所有 skill 就绪后重新运行 /atd:article。
|
|
409
424
|
```
|
|
410
425
|
|
|
411
426
|
### C2. 写作规范(内嵌硬约束,与 skill 并行生效)
|