@chinhae/atw-cli 0.2.9 → 0.2.10

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": "0.2.10",
3
+ "description": "Python typecheck fixes for two bundled skill scripts; validate_html.py runs on Python 3.9 again.",
4
+ "breaking": false,
5
+ "recommendMigrate": false,
6
+ "changelog": "atw-prototype's comparison-page generator (build_explorer.py) now passes the Python typecheck; its behaviour is unchanged and it still needs Python 3.10+. oxy-learning-hub's validate_html.py adds from __future__ import annotations, which fixes a crash on import under Python 3.9 and its typecheck error.",
7
+ "migrations": [],
8
+ "notes": "No migration required. Two bundled skill scripts changed; no files were added, deleted or renamed. They update as Template updated where the project left them untouched; where a project edited them locally, atw update asks before replacing."
9
+ }
@@ -51,25 +51,25 @@ class AssetCheck(HTMLParser):
51
51
  self.head_position = None
52
52
 
53
53
  def handle_starttag(self, tag: str, attrs: list) -> None:
54
- attrs = dict(attrs)
54
+ attributes = dict(attrs)
55
55
  if tag == "head" and self.head_position is None:
56
- self.head_position = (self.getpos(), self.get_starttag_text())
56
+ self.head_position = (self.getpos(), self.get_starttag_text() or "")
57
57
  if tag in ("iframe", "frame", "object", "embed"):
58
58
  raise ValueError("候选 HTML 不支持嵌套文档;请提供静态内容或截图")
59
59
  if tag == "style":
60
60
  self.in_style = True
61
- if attrs.get("style"):
62
- self.styles.append(attrs["style"])
61
+ if attributes.get("style"):
62
+ self.styles.append(attributes["style"])
63
63
  if tag == "base":
64
64
  raise ValueError("候选 HTML 不应包含 base;资源需要内嵌")
65
- if tag == "meta" and attrs.get("http-equiv", "").lower() == "refresh":
65
+ if tag == "meta" and attributes.get("http-equiv", "").lower() == "refresh":
66
66
  raise ValueError("候选 HTML 不应自动跳转")
67
67
  for key in ("src", "poster", "data", "href", "xlink:href"):
68
- value = attrs.get(key, "") or ""
68
+ value = attributes.get(key, "") or ""
69
69
  if not value or value.startswith(("#", "data:")):
70
70
  continue
71
71
  raise ValueError(f"候选 HTML 含未内嵌资源 {tag}.{key}: {value}")
72
- if attrs.get("srcset"):
72
+ if attributes.get("srcset"):
73
73
  raise ValueError("候选 HTML 请用内嵌 src 代替 srcset")
74
74
 
75
75
  def handle_endtag(self, tag: str) -> None:
@@ -251,6 +251,7 @@ def load_manifest(path: Path) -> tuple[dict, set[Path]]:
251
251
  source = None
252
252
  url = local_url(text_field(candidate, "url"), identifier)
253
253
  else:
254
+ url = None
254
255
  source = (path.parent / text_field(candidate, "source")).resolve()
255
256
  if not source.is_relative_to(path.parent) or not source.is_file():
256
257
  raise ValueError(f"候选 source 必须是 manifest 目录内可读文件: {identifier}")
@@ -258,12 +259,17 @@ def load_manifest(path: Path) -> tuple[dict, set[Path]]:
258
259
  colors = text_list(candidate, "palette")
259
260
  if any(not re.fullmatch(r"#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})", c) for c in colors):
260
261
  raise ValueError(f"{identifier}: palette 需要十六进制颜色")
262
+ if source is None:
263
+ content = source_label = url
264
+ else:
265
+ content = prepare_html(source, interactive, path.parent, inputs) if kind == "html" else prepare_image(source)
266
+ source_label = source.name
261
267
  output.append({
262
268
  "id": identifier,
263
269
  **{name: text_field(candidate, name) for name in ("name", "concept", "typography")},
264
270
  "palette": colors, "traits": text_list(candidate, "traits"), "kind": kind,
265
- "content": url if kind == "url" else prepare_html(source, interactive, path.parent, inputs) if kind == "html" else prepare_image(source),
266
- "sourceLabel": url if kind == "url" else source.name,
271
+ "content": content,
272
+ "sourceLabel": source_label,
267
273
  "baseline": baseline,
268
274
  "interactive": interactive,
269
275
  })
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import argparse
4
6
  import re
5
7
  import sys
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chinhae/atw-cli",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "A Team Workflow — an AI coding workflow framework that encodes your team's conventions into the process",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -33,7 +33,7 @@
33
33
  "inquirer": "^9.3.7",
34
34
  "undici": "^6.21.0",
35
35
  "zod": "^4.4.2",
36
- "@chinhae/atw-core": "0.2.9"
36
+ "@chinhae/atw-core": "0.2.10"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@eslint/js": "^9.18.0",