@chinhae/atw-cli 0.2.10 → 0.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/README.md +29 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +243 -123
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +18 -3
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts +0 -3
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +45 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/index.d.ts +8 -0
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +19 -0
- package/dist/configurators/index.js.map +1 -1
- package/dist/migrations/manifests/0.3.0.json +3410 -0
- package/dist/migrations/manifests/0.3.1.json +9 -0
- package/dist/templates/atw/config.yaml +4 -3
- package/dist/templates/atw/index.d.ts +2 -0
- package/dist/templates/atw/index.d.ts.map +1 -1
- package/dist/templates/atw/index.js +4 -0
- package/dist/templates/atw/index.js.map +1 -1
- package/dist/templates/atw/scripts/common/noob_mode.py +102 -0
- package/dist/templates/atw/scripts/common/session_context.py +7 -0
- package/dist/templates/atw/scripts/noob_mode.py +41 -0
- package/dist/templates/atw/scripts/tickets.py +66 -10
- package/dist/templates/atw/workflow.md +81 -17
- package/dist/templates/common/bundled-skills/atw-code-review/SKILL.md +4 -2
- package/dist/templates/common/bundled-skills/atw-codebase-design/DESIGN-IT-TWICE.md +1 -1
- package/dist/templates/common/bundled-skills/atw-diagnosing-bugs/SKILL.md +2 -2
- package/dist/templates/common/bundled-skills/atw-domain-modeling/{CONTEXT-FORMAT.md → GLOSSARY-FORMAT.md} +10 -10
- package/dist/templates/common/bundled-skills/atw-domain-modeling/SKILL.md +12 -12
- package/dist/templates/common/bundled-skills/atw-handoff/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/atw-implement/SKILL.md +6 -4
- package/dist/templates/common/bundled-skills/atw-implement-spec/SKILL.md +79 -0
- package/dist/templates/common/bundled-skills/atw-implement-spec/agents/openai.yaml +5 -0
- package/dist/templates/common/bundled-skills/atw-improve-codebase-architecture/SKILL.md +5 -5
- package/dist/templates/common/bundled-skills/atw-init-repo/SKILL.md +6 -4
- package/dist/templates/common/bundled-skills/atw-init-repo/references/domain.md +8 -8
- package/dist/templates/common/bundled-skills/atw-init-repo/references/issue-tracker-atw-local.md +5 -2
- package/dist/templates/common/bundled-skills/atw-init-repo/references/issue-tracker-atw.md +5 -2
- package/dist/templates/common/bundled-skills/atw-init-repo/references/issue-tracker-github.md +5 -4
- package/dist/templates/common/bundled-skills/atw-init-repo/references/issue-tracker-gitlab.md +2 -2
- package/dist/templates/common/bundled-skills/atw-init-repo/references/triage-labels.md +1 -1
- package/dist/templates/common/bundled-skills/atw-interview/SKILL.md +9 -1
- package/dist/templates/common/bundled-skills/atw-map/SKILL.md +5 -5
- package/dist/templates/common/bundled-skills/atw-noob-mode/SKILL.md +101 -0
- package/dist/templates/common/bundled-skills/atw-noob-mode/agents/openai.yaml +3 -0
- package/dist/templates/common/bundled-skills/atw-spec/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/atw-tdd/SKILL.md +2 -2
- package/dist/templates/common/bundled-skills/atw-tickets/SKILL.md +4 -4
- package/dist/templates/common/bundled-skills/atw-triage/SKILL.md +2 -2
- package/dist/templates/common/commands/continue.md +1 -1
- package/dist/templates/opencode/plugins/inject-workflow-state.js +29 -1
- package/dist/templates/shared-hooks/inject-subagent-context.py +29 -3
- package/dist/templates/shared-hooks/inject-workflow-state.py +27 -3
- package/dist/templates/shared-hooks/session-start.py +23 -0
- package/dist/templates/snow/SNOW.md +1 -1
- package/dist/utils/file-writer.d.ts.map +1 -1
- package/dist/utils/file-writer.js +29 -16
- package/dist/utils/file-writer.js.map +1 -1
- package/dist/utils/interactive-guard.d.ts +2 -2
- package/dist/utils/interactive-guard.js +2 -2
- package/dist/utils/lang.d.ts +14 -0
- package/dist/utils/lang.d.ts.map +1 -0
- package/dist/utils/lang.js +20 -0
- package/dist/utils/lang.js.map +1 -0
- package/dist/utils/optional-skills.d.ts +90 -0
- package/dist/utils/optional-skills.d.ts.map +1 -0
- package/dist/utils/optional-skills.js +266 -0
- package/dist/utils/optional-skills.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +6 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +1 -1
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +2 -2
- package/dist/templates/common/bundled-skills/atw-merge/SKILL.md +0 -14
- package/dist/templates/common/bundled-skills/atw-merge/agents/openai.yaml +0 -3
- package/dist/templates/common/bundled-skills/dejargonizer/SKILL.md +0 -133
- package/dist/templates/common/bundled-skills/noob-mode/SKILL.md +0 -175
- package/dist/templates/common/bundled-skills/noob-mode/references/examples.md +0 -418
- package/dist/templates/common/bundled-skills/noob-mode/references/glossary.md +0 -368
- package/dist/templates/common/bundled-skills/oxy-explanation/SKILL.md +0 -80
- package/dist/templates/common/bundled-skills/oxy-learning-hub/SKILL.md +0 -179
- package/dist/templates/common/bundled-skills/oxy-learning-hub/assets/course.css +0 -1044
- package/dist/templates/common/bundled-skills/oxy-learning-hub/assets/course.js +0 -184
- package/dist/templates/common/bundled-skills/oxy-learning-hub/assets/lesson-template.html +0 -125
- package/dist/templates/common/bundled-skills/oxy-learning-hub/assets/summary-template.html +0 -659
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/publishing.md +0 -64
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/summary-mode.md +0 -96
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/teaching/GLOSSARY-FORMAT.md +0 -30
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/teaching/LEARNING-RECORD-FORMAT.md +0 -42
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/teaching/MISSION-FORMAT.md +0 -50
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/teaching/RESOURCES-FORMAT.md +0 -40
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/teaching-mode.md +0 -251
- package/dist/templates/common/bundled-skills/oxy-learning-hub/references/workspace.md +0 -112
- package/dist/templates/common/bundled-skills/oxy-learning-hub/scripts/validate_html.py +0 -200
- package/dist/templates/common/bundled-skills/show-me/SKILL.md +0 -127
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
import argparse
|
|
6
|
-
import re
|
|
7
|
-
import sys
|
|
8
|
-
from html.parser import HTMLParser
|
|
9
|
-
from pathlib import Path
|
|
10
|
-
|
|
11
|
-
PLACEHOLDER = re.compile(r"\{\{[A-Z_]+\}\}")
|
|
12
|
-
URI_SCHEME = re.compile(r"^[a-z][a-z0-9+.-]*:", re.IGNORECASE)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def is_local_reference(value: str) -> bool:
|
|
16
|
-
value = value.strip()
|
|
17
|
-
return bool(value) and not value.startswith("//") and not URI_SCHEME.match(value)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class HTMLStructureParser(HTMLParser):
|
|
21
|
-
"""提取文档结构、本地资源和本地导航,不限制远程能力。"""
|
|
22
|
-
|
|
23
|
-
def __init__(self) -> None:
|
|
24
|
-
super().__init__(convert_charrefs=True)
|
|
25
|
-
self.in_head = False
|
|
26
|
-
self.in_title = False
|
|
27
|
-
self.html_has_lang = False
|
|
28
|
-
self.has_viewport = False
|
|
29
|
-
self.title_parts: list[str] = []
|
|
30
|
-
self.duplicate_attributes: list[str] = []
|
|
31
|
-
self.local_assets: list[str] = []
|
|
32
|
-
self.local_links: list[str] = []
|
|
33
|
-
self.ids: set[str] = set()
|
|
34
|
-
|
|
35
|
-
def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
|
|
36
|
-
tag = tag.lower()
|
|
37
|
-
attributes: dict[str, str] = {}
|
|
38
|
-
for name, value in attrs:
|
|
39
|
-
name = name.lower()
|
|
40
|
-
if name in attributes:
|
|
41
|
-
self.duplicate_attributes.append(f"{tag} 含重复属性 {name}")
|
|
42
|
-
continue
|
|
43
|
-
attributes[name] = value or ""
|
|
44
|
-
|
|
45
|
-
element_id = attributes.get("id", "").strip()
|
|
46
|
-
if element_id:
|
|
47
|
-
self.ids.add(element_id)
|
|
48
|
-
|
|
49
|
-
if tag == "html":
|
|
50
|
-
self.html_has_lang = bool(attributes.get("lang", "").strip())
|
|
51
|
-
elif tag == "head":
|
|
52
|
-
self.in_head = True
|
|
53
|
-
elif tag == "body":
|
|
54
|
-
self.in_head = False
|
|
55
|
-
self.in_title = False
|
|
56
|
-
elif tag == "title" and self.in_head:
|
|
57
|
-
self.in_title = True
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
tag == "meta"
|
|
61
|
-
and self.in_head
|
|
62
|
-
and attributes.get("name", "").lower() == "viewport"
|
|
63
|
-
and attributes.get("content", "").strip()
|
|
64
|
-
):
|
|
65
|
-
self.has_viewport = True
|
|
66
|
-
|
|
67
|
-
asset_attributes = {
|
|
68
|
-
"script": ("src",),
|
|
69
|
-
"link": ("href",),
|
|
70
|
-
"img": ("src", "srcset"),
|
|
71
|
-
"source": ("src", "srcset"),
|
|
72
|
-
"video": ("src", "poster"),
|
|
73
|
-
"audio": ("src",),
|
|
74
|
-
}
|
|
75
|
-
for name in asset_attributes.get(tag, ()):
|
|
76
|
-
for item in attributes.get(name, "").split(","):
|
|
77
|
-
candidate = item.strip().split()[0] if item.strip() else ""
|
|
78
|
-
if candidate and is_local_reference(candidate) and not candidate.startswith("#"):
|
|
79
|
-
self.local_assets.append(candidate)
|
|
80
|
-
|
|
81
|
-
if tag == "a":
|
|
82
|
-
href = attributes.get("href", "").strip()
|
|
83
|
-
if href and is_local_reference(href):
|
|
84
|
-
self.local_links.append(href)
|
|
85
|
-
|
|
86
|
-
def handle_endtag(self, tag: str) -> None:
|
|
87
|
-
tag = tag.lower()
|
|
88
|
-
if tag == "head":
|
|
89
|
-
self.in_head = False
|
|
90
|
-
elif tag == "title":
|
|
91
|
-
self.in_title = False
|
|
92
|
-
|
|
93
|
-
def handle_data(self, data: str) -> None:
|
|
94
|
-
if self.in_title:
|
|
95
|
-
self.title_parts.append(data)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def parse(text: str) -> HTMLStructureParser:
|
|
99
|
-
parser = HTMLStructureParser()
|
|
100
|
-
parser.feed(text)
|
|
101
|
-
return parser
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def validate_text(text: str) -> list[str]:
|
|
105
|
-
"""验证必要结构;远程资源、网络 API 和页面跳转均允许。"""
|
|
106
|
-
errors: list[str] = []
|
|
107
|
-
parser = parse(text)
|
|
108
|
-
|
|
109
|
-
if PLACEHOLDER.search(text):
|
|
110
|
-
errors.append("仍有未替换的模板占位符")
|
|
111
|
-
if parser.duplicate_attributes:
|
|
112
|
-
errors.extend(parser.duplicate_attributes)
|
|
113
|
-
if not parser.html_has_lang:
|
|
114
|
-
errors.append("html 根元素缺少非空 lang 属性")
|
|
115
|
-
if not parser.has_viewport:
|
|
116
|
-
errors.append("head 中缺少 viewport 元数据")
|
|
117
|
-
if not "".join(parser.title_parts).strip():
|
|
118
|
-
errors.append("head 中缺少非空 title")
|
|
119
|
-
|
|
120
|
-
return errors
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def validate(path: Path) -> list[str]:
|
|
124
|
-
text = path.read_text(encoding="utf-8")
|
|
125
|
-
errors = validate_text(text)
|
|
126
|
-
parser = parse(text)
|
|
127
|
-
|
|
128
|
-
for asset in parser.local_assets:
|
|
129
|
-
clean = asset.split("?", 1)[0].split("#", 1)[0]
|
|
130
|
-
if clean and not (path.parent / clean).resolve().is_file():
|
|
131
|
-
errors.append(f"本地资源不存在:{asset}")
|
|
132
|
-
|
|
133
|
-
for link in parser.local_links:
|
|
134
|
-
target, _, fragment = link.partition("#")
|
|
135
|
-
target_path = path if not target else (path.parent / target).resolve()
|
|
136
|
-
if not target_path.is_file():
|
|
137
|
-
errors.append(f"本地链接目标不存在:{link}")
|
|
138
|
-
continue
|
|
139
|
-
if fragment and target_path.suffix.lower() in {".html", ".htm"}:
|
|
140
|
-
target_parser = parse(target_path.read_text(encoding="utf-8"))
|
|
141
|
-
if fragment not in target_parser.ids:
|
|
142
|
-
errors.append(f"本地链接锚点不存在:{link}")
|
|
143
|
-
|
|
144
|
-
return errors
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def self_test() -> None:
|
|
148
|
-
"""最小自检:远程资源和网络 API 可用,结构错误仍会被发现。"""
|
|
149
|
-
good = """<!doctype html><html lang="zh-CN"><head>
|
|
150
|
-
<meta name="viewport" content="width=device-width"><title>课程</title>
|
|
151
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Manrope">
|
|
152
|
-
</head><body><script>fetch('/lesson'); location.replace('#done')</script></body></html>"""
|
|
153
|
-
bad_cases = [
|
|
154
|
-
good.replace("课程", "{{TITLE}}"),
|
|
155
|
-
good.replace('<html lang="zh-CN">', "<html>"),
|
|
156
|
-
good.replace('<meta name="viewport" content="width=device-width">', ""),
|
|
157
|
-
good.replace("<title>课程</title>", "<title></title>"),
|
|
158
|
-
good.replace("<title>课程</title>", '<title id="a" id="b">课程</title>'),
|
|
159
|
-
]
|
|
160
|
-
|
|
161
|
-
if validate_text(good):
|
|
162
|
-
raise RuntimeError("远程资源或网络 API 被错误拒绝")
|
|
163
|
-
if any(not validate_text(case) for case in bad_cases):
|
|
164
|
-
raise RuntimeError("占位符或文档结构检查未生效")
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
def main() -> int:
|
|
168
|
-
parser = argparse.ArgumentParser(description="验证 Oxy Learning Hub HTML 结构与本地引用")
|
|
169
|
-
parser.add_argument("files", nargs="*", type=Path)
|
|
170
|
-
parser.add_argument("--self-test", action="store_true")
|
|
171
|
-
args = parser.parse_args()
|
|
172
|
-
|
|
173
|
-
if args.self_test:
|
|
174
|
-
self_test()
|
|
175
|
-
print("自检通过")
|
|
176
|
-
return 0
|
|
177
|
-
if not args.files:
|
|
178
|
-
parser.error("请提供至少一个 HTML 文件,或使用 --self-test")
|
|
179
|
-
|
|
180
|
-
failed = False
|
|
181
|
-
for path in args.files:
|
|
182
|
-
if not path.is_file():
|
|
183
|
-
print(f"失败 {path}: 文件不存在")
|
|
184
|
-
failed = True
|
|
185
|
-
continue
|
|
186
|
-
|
|
187
|
-
errors = validate(path)
|
|
188
|
-
if errors:
|
|
189
|
-
failed = True
|
|
190
|
-
print(f"失败 {path}:")
|
|
191
|
-
for error in errors:
|
|
192
|
-
print(f" - {error}")
|
|
193
|
-
else:
|
|
194
|
-
print(f"通过 {path}")
|
|
195
|
-
|
|
196
|
-
return 1 if failed else 0
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if __name__ == "__main__":
|
|
200
|
-
sys.exit(main())
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: show-me
|
|
3
|
-
description: 使用简洁的图表、代码形状草图和聚焦的HTML构件,帮助用户直观地理解当前主题。
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Help the user understand the current topic of conversation visually. Skip the preamble and keep prose brief. Pick the smallest view that makes the key point clear.
|
|
7
|
-
|
|
8
|
-
- Show logic or an algorithm as pseudocode:
|
|
9
|
-
|
|
10
|
-
```text
|
|
11
|
-
on(save)
|
|
12
|
-
if content is unchanged
|
|
13
|
-
return cached result
|
|
14
|
-
write new content
|
|
15
|
-
return fresh result
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
- Show runtime control flow as a call tree:
|
|
19
|
-
|
|
20
|
-
```text
|
|
21
|
-
submitForm
|
|
22
|
-
createSession
|
|
23
|
-
persistPrompt
|
|
24
|
-
launchAgent
|
|
25
|
-
navigateToSession
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Show UI structure as a component tree, including state and module boundaries that matter:
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
<SessionPage> (apps/example/src/routes/session.tsx)
|
|
32
|
-
useSessionEvents()
|
|
33
|
-
<SessionToolbar>
|
|
34
|
-
<RunSkillButton> (packages/ui)
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
- Show file responsibility or a broad refactor as a shallow file tree:
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
|
-
src/
|
|
41
|
-
├── commands/ # parses user actions
|
|
42
|
-
├── sessions/ # owns session state
|
|
43
|
-
└── transport/ # sends API requests
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
- Show component interaction, control flow, or data flow with Mermaid:
|
|
47
|
-
|
|
48
|
-
```mermaid
|
|
49
|
-
sequenceDiagram
|
|
50
|
-
participant User
|
|
51
|
-
participant UI
|
|
52
|
-
participant Daemon
|
|
53
|
-
User->>UI: choose command
|
|
54
|
-
UI->>Daemon: send expanded prompt
|
|
55
|
-
Daemon-->>UI: stream result
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.
|
|
59
|
-
|
|
60
|
-
For a component change:
|
|
61
|
-
|
|
62
|
-
```diff
|
|
63
|
-
<SessionPage>
|
|
64
|
-
useSessionEvents()
|
|
65
|
-
<SessionToolbar>
|
|
66
|
-
+ <RunSkillButton />
|
|
67
|
-
<SessionTimeline>
|
|
68
|
-
+ <SkillResultCard />
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
For a file-layout change:
|
|
72
|
-
|
|
73
|
-
```diff
|
|
74
|
-
src/
|
|
75
|
-
├── commands/
|
|
76
|
-
+│ └── show-me.ts # expands the slash command
|
|
77
|
-
├── sessions/
|
|
78
|
-
-└── transport.ts
|
|
79
|
-
+└── transport/
|
|
80
|
-
+ ├── client.ts
|
|
81
|
-
+ └── stream.ts
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
For a call-tree or call-stack change:
|
|
85
|
-
|
|
86
|
-
```diff
|
|
87
|
-
submitForm
|
|
88
|
-
createSession
|
|
89
|
-
persistPrompt
|
|
90
|
-
+ expandSkillMention
|
|
91
|
-
launchAgent
|
|
92
|
-
- navigateToSession
|
|
93
|
-
+ navigateToSession
|
|
94
|
-
+ subscribeToEvents
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
For a state or control-flow change:
|
|
98
|
-
|
|
99
|
-
```diff
|
|
100
|
-
on(save)
|
|
101
|
-
- write content
|
|
102
|
-
+ if content is unchanged
|
|
103
|
-
+ return cached result
|
|
104
|
-
+ write new content
|
|
105
|
-
+ invalidate cache
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
function expandSkill(command: string): string {
|
|
112
|
-
const skillName = command.slice(1)
|
|
113
|
-
return `use the ${skillName} skill`
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
- For a visual UI, layout, state comparison, or concept too dense for Mermaid, write one focused HTML file — a diagram, an infographic, or a short slide deck, whichever fits the point. Match the product's colors, type, spacing, and components; use real labels and data; support desktop and mobile. Then open it for the user:
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
Bash(open path/to/show-me-{description}.html)
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
### guidance
|
|
124
|
-
|
|
125
|
-
Place each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.
|
|
126
|
-
|
|
127
|
-
You may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.
|