@aiyiran/myclaw 1.1.201 → 1.1.202

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.
Files changed (35) hide show
  1. package/assets/myclaw-artifacts.js +2 -1
  2. package/package.json +1 -1
  3. package/publish.sh +6 -1
  4. package/skills/yiran-playground-template-use/SKILL.md +1 -0
  5. package/skills/yiran-playground-template-use/prompts/single-html-handoff.txt +23 -0
  6. package/skills/yiran-playground-template-use/scripts/deploy_to_workspace.py +11 -5
  7. package/skills/yiran-course-template-pipeline/README.md +0 -132
  8. package/skills/yiran-course-template-pipeline/SKILL.md +0 -74
  9. package/skills/yiran-course-template-pipeline/assets/a100-teacher.example.html +0 -66
  10. package/skills/yiran-course-template-pipeline/assets/student-template.html +0 -77
  11. package/skills/yiran-course-template-pipeline/assets/teacher-portrait-demo.html +0 -105
  12. package/skills/yiran-course-template-pipeline/assets/teacher-task-view.html +0 -110
  13. package/skills/yiran-course-template-pipeline/prompts//350/257/204/344/273/267/347/202/271/345/255/220.md +0 -107
  14. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2651-demo/347/224/237/346/210/220.md +0 -121
  15. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2652-student/347/224/237/346/210/220.md +0 -115
  16. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2653-teacher/347/224/237/346/210/220.md +0 -144
  17. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2654-/346/211/223/345/214/205/350/220/275/347/233/230.md +0 -130
  18. package/skills/yiran-course-template-pipeline/references/student-example.json +0 -38
  19. package/skills/yiran-course-template-pipeline/references/student-fields.md +0 -195
  20. package/skills/yiran-course-template-pipeline/references/student-scaffold.json +0 -34
  21. package/skills/yiran-course-template-pipeline/references/teacher-fields.md +0 -271
  22. package/skills/yiran-course-template-pipeline/references/teacher-scaffold.json +0 -25
  23. package/skills/yiran-course-template-pipeline/scripts/build_template_index.py +0 -150
  24. package/skills/yiran-course-template-pipeline/scripts/build_template_views.py +0 -132
  25. package/skills/yiran-course-template-pipeline/scripts/identify_template.py +0 -174
  26. package/skills/yiran-course-template-pipeline/scripts/migrate_templates.py +0 -104
  27. package/skills/yiran-course-template-pipeline/scripts/move_template_task.py +0 -107
  28. package/skills/yiran-course-template-pipeline/scripts/publish_template.py +0 -131
  29. package/skills/yiran-course-template-pipeline/scripts/release_template.py +0 -84
  30. package/skills/yiran-course-template-pipeline/scripts/render_student_page.py +0 -66
  31. package/skills/yiran-course-template-pipeline/scripts/render_teacher_view.py +0 -108
  32. package/skills/yiran-course-template-pipeline/template-index.json +0 -671
  33. package/skills/yiran-course-template-pipeline/template-index.md +0 -246
  34. package/skills/yiran-course-template-pipeline//344/270/232/345/212/241/350/203/214/346/231/257.md +0 -81
  35. package/skills/yiran-course-template-pipeline//345/272/237/345/274/203/rewrite_html_refs.py +0 -102
@@ -1,131 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- publish_template.py
4
-
5
- 发布模板文件夹到七牛 CDN,完成后重建并上传 template-index.json。
6
-
7
- CDN 路径:{CDN_PREFIX}/{folder_name}/{version}/{filename}
8
- 版本号从 templates/{folder}/v{N}/ 子目录读取(以本地最新版本为准)。
9
-
10
- 用法:
11
- python3 scripts/publish_template.py <模板文件夹路径>
12
- python3 scripts/publish_template.py --all
13
- """
14
- import argparse
15
- import re
16
- import subprocess
17
- import sys
18
- from pathlib import Path
19
-
20
- from qiniu import Auth, put_file_v2, CdnManager
21
-
22
- QINIU_KEY = "T3tgxM7EMx1j4VESw4m4PIfFXoOvBo-wQEOQewXX"
23
- QINIU_SECRET = "PVZvlKVOjX2RqlV2ILMg-QwpNMssOlpVbaEzypz0"
24
- QINIU_BUCKET = "yiran1"
25
- CDN_DOMAIN = "https://cdn.yiranlaoshi.com"
26
- CDN_INDEX_KEY = "myclaw/live/yiran/skills/yiran-playground-template-use/template-index.json"
27
- CDN_PREFIX = "myclaw/live/yiran/skills/yiran-playground-template-use/templates"
28
-
29
- q = Auth(QINIU_KEY, QINIU_SECRET)
30
- cdn_manager = CdnManager(q)
31
-
32
-
33
- def get_latest_version_dir(folder: Path):
34
- """返回最新 v{N} 子目录和版本号,没有则返回 (None, 0)"""
35
- max_v = 0
36
- result = None
37
- for d in folder.iterdir():
38
- if d.is_dir():
39
- m = re.match(r'^v(\d+)$', d.name)
40
- if m:
41
- v = int(m.group(1))
42
- if v > max_v:
43
- max_v = v
44
- result = d
45
- return result, max_v
46
-
47
-
48
- def upload_file(local_path: Path, cdn_key: str) -> str:
49
- token = q.upload_token(QINIU_BUCKET, cdn_key, 3600, policy={'insertOnly': 0})
50
- ret, info = put_file_v2(token, cdn_key, str(local_path))
51
- if info.status_code != 200:
52
- raise RuntimeError('上传失败 {}: {}'.format(local_path.name, info))
53
- cdn_url = '{}/{}'.format(CDN_DOMAIN, cdn_key)
54
- cdn_manager.refresh_urls([cdn_url])
55
- return cdn_url
56
-
57
-
58
- def publish(folder_path: Path):
59
- folder_name = folder_path.name
60
- version_dir, version_num = get_latest_version_dir(folder_path)
61
-
62
- if not version_dir:
63
- print('⚠️ {} 没有版本子目录,跳过'.format(folder_name))
64
- return
65
-
66
- version_str = 'v{}'.format(version_num)
67
- files = [f for f in version_dir.rglob('*') if f.is_file() and f.name != '.sync-done']
68
-
69
- if not files:
70
- print('⚠️ 文件夹为空: {}/{}'.format(folder_name, version_str))
71
- return
72
-
73
- print('📂 发布: {}/{}'.format(folder_name, version_str))
74
- for f in sorted(files):
75
- rel = f.relative_to(version_dir)
76
- cdn_key = '{}/{}/{}/{}'.format(CDN_PREFIX, folder_name, version_str, rel.as_posix())
77
- cdn_url = upload_file(f, cdn_key)
78
- print(' ⬆️ {} → {}'.format(rel, cdn_url))
79
-
80
- print('✅ 完成: {}/{}\n'.format(folder_name, version_str))
81
-
82
-
83
- def publish_index(pipeline_root: Path):
84
- index_script = pipeline_root / 'scripts' / 'build_template_index.py'
85
- print('🔄 重建 template-index.json ...')
86
- subprocess.run(['python3', str(index_script)], check=True)
87
-
88
- index_file = pipeline_root / 'template-index.json'
89
- if not index_file.is_file():
90
- print('⚠️ template-index.json 未生成,跳过上传')
91
- return
92
-
93
- token = q.upload_token(QINIU_BUCKET, CDN_INDEX_KEY, 3600, policy={'insertOnly': 0})
94
- ret, info = put_file_v2(token, CDN_INDEX_KEY, str(index_file))
95
- if info.status_code != 200:
96
- raise RuntimeError('index 上传失败: {}'.format(info))
97
- cdn_url = '{}/{}'.format(CDN_DOMAIN, CDN_INDEX_KEY)
98
- cdn_manager.refresh_urls([cdn_url])
99
- print(' ⬆️ 已上传索引 → {}'.format(cdn_url))
100
-
101
-
102
- def main():
103
- parser = argparse.ArgumentParser(description='发布模板到七牛 CDN')
104
- group = parser.add_mutually_exclusive_group(required=True)
105
- group.add_argument('folder', nargs='?', help='单个模板文件夹路径')
106
- group.add_argument('--all', action='store_true', help='发布 templates/ 下所有模板')
107
- args = parser.parse_args()
108
-
109
- pipeline_root = Path(__file__).resolve().parent.parent
110
-
111
- if args.all:
112
- templates_dir = pipeline_root / 'templates'
113
- folders = sorted(d for d in templates_dir.iterdir() if d.is_dir())
114
- if not folders:
115
- print('⚠️ templates/ 下没有找到任何模板文件夹')
116
- sys.exit(0)
117
- print('📦 共 {} 个模板,开始全量发布...\n'.format(len(folders)))
118
- for folder in folders:
119
- publish(folder)
120
- else:
121
- folder = Path(args.folder).expanduser().resolve()
122
- if not folder.is_dir():
123
- print('❌ 路径不存在或不是文件夹: {}'.format(folder))
124
- sys.exit(1)
125
- publish(folder)
126
-
127
- publish_index(pipeline_root)
128
-
129
-
130
- if __name__ == '__main__':
131
- main()
@@ -1,84 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- release_template.py
4
-
5
- 一键发布脚本:合并 build → move → publish 三个步骤。
6
-
7
- 传入原始模板目录(或已有 vN/ 目录),自动执行:
8
- Step 1: build_template_views.py <source_dir> → 生成/更新 HTML 视图
9
- Step 2: move_template_task.py <source_dir> → 创建新版本目录 vN+1/
10
- Step 3: publish_template.py <templates/xxx/> → 上传 CDN + 上传 index
11
-
12
- 用法:
13
- python3 scripts/release_template.py <模板目录>
14
- """
15
- import json
16
- import re
17
- import subprocess
18
- import sys
19
- from pathlib import Path
20
-
21
- ROOT = Path(__file__).resolve().parent.parent
22
- BUILD_SCRIPT = ROOT / 'scripts' / 'build_template_views.py'
23
- MOVE_SCRIPT = ROOT / 'scripts' / 'move_template_task.py'
24
- PUBLISH_SCRIPT = ROOT / 'scripts' / 'publish_template.py'
25
- TEMPLATES_DIR = ROOT / 'templates'
26
-
27
-
28
- def load_json(path: Path) -> dict:
29
- try:
30
- return json.loads(path.read_text(encoding='utf-8'))
31
- except Exception:
32
- return {}
33
-
34
-
35
- def sanitize_name(name: str) -> str:
36
- return re.sub(r'[/\\ ]', '_', str(name).strip())
37
-
38
-
39
- def main():
40
- if len(sys.argv) < 2:
41
- print('用法: python3 scripts/release_template.py <模板目录>')
42
- sys.exit(1)
43
-
44
- source_dir = Path(sys.argv[1]).expanduser().resolve()
45
-
46
- if not source_dir.is_dir():
47
- print(f'❌ 目录不存在: {source_dir}')
48
- sys.exit(1)
49
-
50
- teacher_path = source_dir / '__teacher__.json'
51
- if not teacher_path.exists():
52
- print(f'❌ 找不到 __teacher__.json: {teacher_path}')
53
- sys.exit(1)
54
-
55
- # ── Step 1: Build HTML views ──────────────────────────────────────────
56
- print('\n══ Step 1: 生成 HTML 视图 ══════════════════════════════')
57
- subprocess.run([sys.executable, str(BUILD_SCRIPT), str(source_dir)], check=True)
58
-
59
- # ── Step 2: Move to templates/ ────────────────────────────────────────
60
- print('\n══ Step 2: 移入 templates/ ═════════════════════════════')
61
- subprocess.run([sys.executable, str(MOVE_SCRIPT), str(source_dir)], check=True)
62
-
63
- # ── Determine publish target from updated teacher.json ────────────────
64
- teacher = load_json(teacher_path)
65
- category = teacher.get('任务类别', '').upper()
66
- number = teacher.get('任务编号', '100')
67
- name = sanitize_name(teacher.get('任务名称', 'untitled'))
68
- folder_name = f'{category.lower()}{number}_{name}'
69
- publish_target = TEMPLATES_DIR / folder_name
70
-
71
- if not publish_target.is_dir():
72
- print(f'❌ 发布目标目录不存在: {publish_target}')
73
- sys.exit(1)
74
-
75
- # ── Step 3: Publish to CDN ────────────────────────────────────────────
76
- print('\n══ Step 3: 上传 CDN ════════════════════════════════════')
77
- subprocess.run([sys.executable, str(PUBLISH_SCRIPT), str(publish_target)], check=True)
78
-
79
- print('\n✅ 发布完成!')
80
- print(f' 模板目录: {publish_target}')
81
-
82
-
83
- if __name__ == '__main__':
84
- main()
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env python3
2
- import json
3
- import html
4
- import sys
5
- from pathlib import Path
6
-
7
-
8
- def esc(value):
9
- return html.escape(str(value if value is not None else ''))
10
-
11
-
12
- def render_steps(steps):
13
- blocks = []
14
- for idx, item in enumerate(steps, start=1):
15
- blocks.append(f'''<div class="task-item"><div class="item-top"><span class="num">{idx}</span><span>{esc(item.get('标题', '步骤'))}</span></div><div class="item-body">{esc(item.get('说明', ''))}</div></div>''')
16
- return ''.join(blocks)
17
-
18
-
19
- def render_goals(goals):
20
- blocks = []
21
- for item in goals:
22
- blocks.append(f'''<div class="task-item star-item"><div class="item-top"><span class="num">{esc(item.get('等级', ''))}</span><span>{esc(item.get('等级', ''))}</span></div><div class="item-body">{esc(item.get('说明', ''))}</div></div>''')
23
- return ''.join(blocks)
24
-
25
-
26
- def render_tips(tips):
27
- blocks = []
28
- for item in tips:
29
- blocks.append(f'''<div class="tip-item"><div class="tip-title">{esc(item.get('标题', '小提示'))}</div><div class="tip-desc">{esc(item.get('说明', ''))}</div><div class="tip-prompt">参考提示词:{esc(item.get('参考提示词', ''))}</div></div>''')
30
- return ''.join(blocks)
31
-
32
-
33
- def main():
34
- if len(sys.argv) < 2:
35
- print('用法: python3 render_student_page.py <__student__.json> [输出html] [模板html]')
36
- sys.exit(1)
37
-
38
- input_path = Path(sys.argv[1]).expanduser().resolve()
39
- output_path = Path(sys.argv[2]).expanduser().resolve() if len(sys.argv) > 2 else input_path.parent / '__student-view__.html'
40
- template_path = Path(sys.argv[3]).expanduser().resolve() if len(sys.argv) > 3 else Path(__file__).resolve().parent.parent / 'assets' / 'student-template.html'
41
-
42
- data = json.loads(input_path.read_text(encoding='utf-8'))
43
- template = template_path.read_text(encoding='utf-8')
44
-
45
- folder = input_path.parent
46
- if (folder / '__任务__.html').exists():
47
- preview_file = '__任务__.html'
48
- else:
49
- preview_file = data.get('示例页面文件', '__demo__.html')
50
-
51
- rendered = (template
52
- .replace('{{任务标题}}', esc(data.get('任务标题', '未命名任务')))
53
- .replace('{{一句话说明}}', esc(data.get('一句话说明', '')))
54
- .replace('{{步骤区域}}', render_steps(data.get('步骤', [])))
55
- .replace('{{评价目标区域}}', render_goals(data.get('评价目标', [])))
56
- .replace('{{示例区标题}}', esc(data.get('示例区标题', '示范样例')))
57
- .replace('{{示例页面文件}}', esc(preview_file))
58
- .replace('{{小提示区域}}', render_tips(data.get('小提示', [])))
59
- )
60
-
61
- output_path.write_text(rendered, encoding='utf-8')
62
- print(f'已生成: {output_path}')
63
-
64
-
65
- if __name__ == '__main__':
66
- main()
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env python3
2
- import json
3
- import html
4
- import sys
5
- from pathlib import Path
6
-
7
-
8
- def esc(value):
9
- return html.escape(str(value if value is not None else ""))
10
-
11
-
12
- def render_tags(items):
13
- return ''.join(f'<span class="tag">{esc(item)}</span>' for item in items)
14
-
15
-
16
- def render_list(items):
17
- return ''.join(f'<div class="list-item">{esc(item)}</div>' for item in items)
18
-
19
-
20
- def render_issues(items):
21
- blocks = []
22
- for item in items:
23
- card = item.get('卡点', '') if isinstance(item, dict) else ''
24
- solution = item.get('解决方案', '') if isinstance(item, dict) else ''
25
- blocks.append('<div class="list-item issue">' f'<strong>卡点</strong>{esc(card)}' f'<strong>解决方案</strong>{esc(solution)}' '</div>')
26
- return ''.join(blocks)
27
-
28
-
29
- def guess_preview_file(input_path: Path):
30
- folder = input_path.parent
31
- for name in ['__demo__.html', 'example.html', 'index.html', 'preview.html']:
32
- candidate = folder / name
33
- if candidate.exists() and candidate.name != input_path.name:
34
- return candidate.name
35
- return ''
36
-
37
-
38
- def render_html(data, preview_file=''):
39
- title = f"{data.get('任务类别', '')}{data.get('任务编号', '')} · {data.get('任务名称', '')}".strip(' ·')
40
- iframe_html = f'<div class="preview-card"><div class="preview-head"><h2>作品预览</h2></div><iframe src="{esc(preview_file)}" title="作品预览"></iframe></div>' if preview_file else '<div class="preview-card empty"><div class="preview-head"><h2>作品预览</h2></div><div class="empty-box">当前文件夹下没有找到 example.html / index.html / preview.html</div></div>'
41
- return f'''<!DOCTYPE html>
42
- <html lang="zh-CN">
43
- <head>
44
- <meta charset="UTF-8" />
45
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
46
- <title>{esc(title or '教师任务查看页')}</title>
47
- <style>
48
- * {{ box-sizing: border-box; }}
49
- body {{ margin: 0; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f7fb; color: #24324a; }}
50
- .page {{ max-width: 1400px; margin: 0 auto; padding: 20px; }}
51
- .hero {{ background: linear-gradient(135deg,#5f82ff 0%,#8c74ff 100%); color: #fff; border-radius: 24px; padding: 22px 24px; box-shadow: 0 16px 36px rgba(92,108,192,.22); }}
52
- .hero h1 {{ margin: 0; font-size: 28px; }}
53
- .hero p {{ margin: 8px 0 0; opacity: .92; font-size: 14px; }}
54
- .layout {{ margin-top: 18px; display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 16px; align-items: start; }}
55
- .sidebar {{ display: grid; gap: 16px; }}
56
- .card, .preview-card {{ background: #fff; border: 1px solid #e7eefc; border-radius: 20px; padding: 18px; box-shadow: 0 10px 24px rgba(100,122,166,.08); }}
57
- .card h2, .preview-head h2 {{ margin: 0 0 12px; font-size: 18px; color: #314a96; }}
58
- .meta-grid {{ display: grid; grid-template-columns: 1fr; gap: 10px; }}
59
- .meta-item {{ background: #f8faff; border: 1px solid #e7eefc; border-radius: 14px; padding: 12px; }}
60
- .meta-item .label {{ font-size: 12px; color: #7a89ad; margin-bottom: 6px; }}
61
- .meta-item .value {{ font-size: 14px; color: #24324a; font-weight: 700; }}
62
- .tags {{ display: flex; flex-wrap: wrap; gap: 8px; }}
63
- .tag {{ display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: #edf2ff; color: #4c65c3; font-size: 13px; font-weight: 700; }}
64
- .list {{ display: grid; gap: 10px; }}
65
- .list-item {{ background: #f8faff; border: 1px solid #e7eefc; border-radius: 14px; padding: 12px; line-height: 1.7; font-size: 14px; color: #60708b; }}
66
- .issue {{ border-left: 4px solid #8c74ff; background: #faf8ff; }}
67
- .issue strong {{ color: #314a96; display: block; margin: 6px 0; }}
68
- iframe {{ width: 100%; height: 900px; border: 1px solid #dfe7fb; border-radius: 16px; background: #fff; display: block; }}
69
- .empty-box {{ background: #f8faff; border: 1px dashed #cfdcff; border-radius: 14px; padding: 24px; color: #7a89ad; line-height: 1.8; }}
70
- @media (max-width: 960px) {{ .layout {{ grid-template-columns: 1fr; }} iframe {{ height: 420px; }} }}
71
- </style>
72
- </head>
73
- <body>
74
- <div class="page">
75
- <section class="hero">
76
- <h1>{esc(title or '教师任务查看页')}</h1>
77
- <p>这是根据教师 JSON 自动生成的可视化查看页,左边快速扫读,右边直接看作品预览。</p>
78
- </section>
79
- <section class="layout">
80
- <div class="sidebar">
81
- <div class="card"><h2>基础信息</h2><div class="meta-grid"><div class="meta-item"><div class="label">主能力标签</div><div class="value">{esc(data.get('主能力标签', '—'))}</div></div><div class="meta-item"><div class="label">任务类型标签</div><div class="value">{esc(data.get('任务类型标签', '—'))}</div></div></div></div>
82
- <div class="card"><h2>适合学生类型</h2><div class="tags">{render_tags(data.get('适合学生类型', []))}</div></div>
83
- <div class="card"><h2>训练重点</h2><div class="list">{render_list(data.get('训练重点', []))}</div></div>
84
- <div class="card"><h2>卡点和解决方案</h2><div class="list">{render_issues(data.get('卡点和解决方案', []))}</div></div>
85
- <div class="card"><h2>可拓展方向</h2><div class="list">{render_list(data.get('可拓展方向', []))}</div></div>
86
- <div class="card"><h2>课后作业</h2><div class="list">{render_list(data.get('课后作业', []))}</div></div>
87
- </div>
88
- {iframe_html}
89
- </section>
90
- </div>
91
- </body>
92
- </html>'''
93
-
94
-
95
- def main():
96
- if len(sys.argv) < 2:
97
- print('用法: python3 render_teacher_view.py <输入json> [输出html]')
98
- sys.exit(1)
99
- input_path = Path(sys.argv[1]).expanduser().resolve()
100
- output_path = Path(sys.argv[2]).expanduser().resolve() if len(sys.argv) > 2 else input_path.parent / '__teacher-view__.html'
101
- with input_path.open('r', encoding='utf-8') as f:
102
- data = json.load(f)
103
- output_path.write_text(render_html(data, guess_preview_file(input_path)), encoding='utf-8')
104
- print(f'已生成: {output_path}')
105
-
106
-
107
- if __name__ == '__main__':
108
- main()