mosaic-headless 1.36.2 → 1.37.0
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/SKILL.md +179 -1119
- package/assets/templates/platforms/claude-ai.json +6 -3
- package/assets/templates/platforms/claude-code.json +10 -4
- package/assets/templates/platforms/codex-cli.json +6 -3
- package/assets/templates/platforms/continue.json +1 -1
- package/assets/templates/platforms/copilot.json +6 -3
- package/assets/templates/platforms/cursor.json +1 -1
- package/assets/templates/platforms/gemini-cli.json +6 -3
- package/data/pending.csv +8 -0
- package/data/terms-zh.csv +97 -0
- package/evals/RESULTS.md +41 -0
- package/evals/cases.json +329 -0
- package/evals/grade.py +121 -0
- package/evals/runs/2026-11-16-final-with-skill.json +29 -0
- package/evals/runs/2026-11-16-final-without-skill.json +30 -0
- package/evals/runs/2026-11-16-r1-with-skill.json +19 -0
- package/evals/runs/2026-11-16-r1-without-skill.json +19 -0
- package/evals/runs/2026-11-16-r2-with-skill.json +9 -0
- package/evals/runs/2026-11-16-r2-without-skill.json +9 -0
- package/evals/runs/2026-11-16-r3-without-skill.json +1 -0
- package/package.json +1 -1
- package/references/building.md +93 -0
- package/references/core-rules.md +143 -0
- package/references/data-files.md +102 -0
- package/references/design-system.md +1 -1
- package/references/facts.md +261 -0
- package/references/failure-modes.md +1 -1
- package/references/maintenance.md +70 -0
- package/references/tools.md +84 -0
- package/references/tutorials.md +1 -1
- package/references/upgrading.md +2 -2
- package/references/verification-record.md +395 -0
- package/scripts/check-release.mjs +15 -7
- package/scripts/install.mjs +35 -14
- package/scripts/sync-version.mjs +5 -3
- package/tools/check_numbers.py +196 -0
- package/tools/mo.py +132 -7
- package/tools/test_mosaic.py +373 -0
- package/tools/verify_menus.py +1 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
check_numbers.py - every number in SKILL.md must be accounted for and match the data.
|
|
4
|
+
|
|
5
|
+
skill-SOP 6-1: numbers that change (versions, counts, dates) are not hand-written
|
|
6
|
+
unchecked. This is a whitelist, not a spot check: every number in SKILL.md
|
|
7
|
+
(outside code blocks, inline `code` and URLs) must be claimed by a rule below,
|
|
8
|
+
or the check fails. Adding a number means adding a rule.
|
|
9
|
+
|
|
10
|
+
Rule kinds:
|
|
11
|
+
fact counted from data/*.csv (the same values `mo.py stats` prints);
|
|
12
|
+
--fix rewrites SKILL.md when they drift
|
|
13
|
+
fixed not from the data (plugin version measured on, a date, a pass
|
|
14
|
+
criterion, a width); the reason is written next to it
|
|
15
|
+
|
|
16
|
+
Engine copied from elementor-headless / line-api; only FACTS and RULES are ours.
|
|
17
|
+
Standard library only.
|
|
18
|
+
|
|
19
|
+
python tools/check_numbers.py # exit 1 on any problem
|
|
20
|
+
python tools/check_numbers.py --fix # rewrite drifted facts in SKILL.md
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import argparse
|
|
26
|
+
import csv
|
|
27
|
+
import re
|
|
28
|
+
import sys
|
|
29
|
+
from pathlib import Path
|
|
30
|
+
|
|
31
|
+
HERE = Path(__file__).resolve().parent
|
|
32
|
+
ROOT = HERE.parent
|
|
33
|
+
SKILL_MD = ROOT / "SKILL.md"
|
|
34
|
+
DATA = ROOT / "data"
|
|
35
|
+
|
|
36
|
+
for _s in (sys.stdout, sys.stderr):
|
|
37
|
+
if hasattr(_s, "reconfigure"):
|
|
38
|
+
_s.reconfigure(encoding="utf-8", errors="replace")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# ---------------------------------------------------------------------------
|
|
42
|
+
# This skill's facts and rules
|
|
43
|
+
# ---------------------------------------------------------------------------
|
|
44
|
+
def _rows(name: str) -> list[dict]:
|
|
45
|
+
with open(DATA / (name + ".csv"), encoding="utf-8", newline="") as fh:
|
|
46
|
+
return list(csv.DictReader(fh))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _facts() -> dict:
|
|
50
|
+
decl = _rows("node-properties")
|
|
51
|
+
probe = _rows("node-property-verification")
|
|
52
|
+
names = {r["property"] for r in decl}
|
|
53
|
+
probed = {r["property"] for r in probe}
|
|
54
|
+
return {
|
|
55
|
+
"node_types": str(len(_rows("node-types"))),
|
|
56
|
+
"prop_names": str(len(names)),
|
|
57
|
+
"prop_decl": str(len(decl)),
|
|
58
|
+
"prop_probe": str(len(probe)),
|
|
59
|
+
"prop_probed_names": str(len(names & probed)),
|
|
60
|
+
"style_props": str(len(_rows("style-properties"))),
|
|
61
|
+
"states": str(len(_rows("style-states"))),
|
|
62
|
+
"variants": str(len(_rows("variants"))),
|
|
63
|
+
"dynvars": str(len(_rows("dynamic-variables"))),
|
|
64
|
+
"triggers": str(len(_rows("interaction-types"))),
|
|
65
|
+
"routes": str(len(_rows("rest-routes"))),
|
|
66
|
+
"tables": str(len({r["table"] for r in _rows("db-columns")})),
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# (regex, kind, arg). Group 1 is the claimed number; no group claims the whole match.
|
|
71
|
+
# Every number inside a matched span counts as claimed.
|
|
72
|
+
RULES: list[tuple[str, str, str]] = [
|
|
73
|
+
# ---- from the data: the description ----
|
|
74
|
+
(r"\((\d+) node types, \d+ node properties", "fact", "node_types"),
|
|
75
|
+
(r"node types, (\d+) node properties, \d+ style", "fact", "prop_names"),
|
|
76
|
+
(r"node properties, (\d+) style properties, \d+ style states, \d+ variants", "fact", "style_props"),
|
|
77
|
+
(r"style properties, (\d+) style states, \d+ variants, \d+ dynamic", "fact", "states"),
|
|
78
|
+
(r"style states, (\d+) variants, \d+ dynamic variables, \d+ interaction", "fact", "variants"),
|
|
79
|
+
(r"variants, (\d+) dynamic variables, \d+ interaction triggers, \d+ REST", "fact", "dynvars"),
|
|
80
|
+
(r"dynamic variables, (\d+) interaction triggers, \d+ REST routes\)", "fact", "triggers"),
|
|
81
|
+
(r"interaction triggers, (\d+) REST routes\)", "fact", "routes"),
|
|
82
|
+
# ---- from the data: the Sources table ----
|
|
83
|
+
(r"\| (\d+) node types, \d+ node property names", "fact", "node_types"),
|
|
84
|
+
(r"node types, (\d+) node property names declared", "fact", "prop_names"),
|
|
85
|
+
(r"declared in (\d+) rows \(one row per owning", "fact", "prop_decl"),
|
|
86
|
+
(r"data class\), (\d+) node-property probe rows", "fact", "prop_probe"),
|
|
87
|
+
(r"probe rows covering (\d+) of those names", "fact", "prop_probed_names"),
|
|
88
|
+
(r"not yet probed\), (\d+) style properties", "fact", "style_props"),
|
|
89
|
+
(r"style properties, (\d+) style states, \d+ variants, \d+ dynamic variables, \d+ interaction triggers, \d+ REST routes, \d+ tables", "fact", "states"),
|
|
90
|
+
(r"style states, (\d+) variants, \d+ dynamic variables, \d+ interaction triggers, \d+ REST routes, \d+ tables", "fact", "variants"),
|
|
91
|
+
(r"variants, (\d+) dynamic variables, \d+ interaction triggers, \d+ REST routes, \d+ tables", "fact", "dynvars"),
|
|
92
|
+
(r"dynamic variables, (\d+) interaction triggers, \d+ REST routes, \d+ tables", "fact", "triggers"),
|
|
93
|
+
(r"interaction triggers, (\d+) REST routes, \d+ tables", "fact", "routes"),
|
|
94
|
+
(r"REST routes, (\d+) tables\.", "fact", "tables"),
|
|
95
|
+
# ---- not from the data ----
|
|
96
|
+
(r'version: "\d+\.\d+\.\d+"', "fixed", "package version; scripts/check-release.mjs checks it against package.json"),
|
|
97
|
+
(r"Measured on Mosaic Pro 1\.0\.10", "fixed", "version the popover / modal / trigger features were measured on (verification-record.md)"),
|
|
98
|
+
(r"1\.0\.7 -> 1\.0\.10 data upgrades", "fixed", "upgrade range driven over the milestone route (upgrading.md)"),
|
|
99
|
+
(r"re-verified on 1\.0\.11 and 1\.0\.12", "fixed", "plugin versions of the latest re-extraction"),
|
|
100
|
+
(r"\*\*Mosaic Pro 1\.0\.12\*\*", "fixed", "current measured plugin version (CLAUDE.md: the demo site stays on 1.0.12)"),
|
|
101
|
+
(r"WordPress 7\.1 \+ WooCommerce 11\.1", "fixed", "test site stack (verification-record.md)"),
|
|
102
|
+
(r"from 1\.0\.7 to 1\.0\.12", "fixed", "upgrade history of the test site"),
|
|
103
|
+
(r"Node sweep: 133 of 134 types on 1\.0\.11 / 1\.0\.12", "fixed", "document is the one type excluded from the sweep"),
|
|
104
|
+
(r"the 2026-11-05 designer glossary", "fixed", "date the zh_TW designer glossary was decided"),
|
|
105
|
+
(r"2026-11-16: offline self-test", "fixed", "date of the last full self-test + number check"),
|
|
106
|
+
(r"since 1\.0\.11", "fixed", "version that escapes text-run markup (facts.md)"),
|
|
107
|
+
(r"since 1\.0\.10", "fixed", "version that renamed the scrollDepth slot (facts.md)"),
|
|
108
|
+
(r"\(1\.0\.11\+\)", "fixed", "same: 1.0.11 escapes text-run markup"),
|
|
109
|
+
(r"1\.0\.12: `select", "fixed", "version of the Select split (upgrading.md)"),
|
|
110
|
+
(r"returns HTTP 500", "fixed", "measured status of the @media( failure"),
|
|
111
|
+
(r"exit [01]\b", "fixed", "validator pass criteria"),
|
|
112
|
+
(r"exits 1 on any FAIL|exits 1 and says", "fixed", "validator / lookup contract"),
|
|
113
|
+
(r"every page 200", "fixed", "HTTP status a page must answer"),
|
|
114
|
+
(r"wrong writes with HTTP 200", "fixed", "Mosaic's status on a silently dropped write (core-rules.md)"),
|
|
115
|
+
(r"build exits 0", "fixed", "build pass criterion"),
|
|
116
|
+
(r"a 5xx reads as empty", "fixed", "HTTP status class"),
|
|
117
|
+
(r"em925", "fixed", "a site name (em925), not a number"),
|
|
118
|
+
(r"Read the page \*\*logged out\*\* \(an admin sees a test-mode theme and 406", "fixed", "Mosaic's no-template status (core-rules.md)"),
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# ---------------------------------------------------------------------------
|
|
123
|
+
# Engine (copied from line-api / elementor-headless)
|
|
124
|
+
# ---------------------------------------------------------------------------
|
|
125
|
+
NUM = re.compile(r"\d+(?:[.,]\d+)*")
|
|
126
|
+
_MASKS = [
|
|
127
|
+
re.compile(r"^```.*?^```", re.S | re.M), # code blocks
|
|
128
|
+
re.compile(r"`[^`\n]+`"), # inline code
|
|
129
|
+
re.compile(r"\]\([^)\n]*\)"), # markdown link targets
|
|
130
|
+
re.compile(r"https?://[^\s))(,、|\"]+"), # URLs
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _masked(text: str, keep_inline: bool = False) -> str:
|
|
135
|
+
"""Blank out unchecked spans, keeping positions."""
|
|
136
|
+
for i, rx in enumerate(_MASKS):
|
|
137
|
+
if keep_inline and i == 1:
|
|
138
|
+
continue
|
|
139
|
+
text = rx.sub(lambda m: re.sub(r"[^\n]", " ", m.group(0)), text)
|
|
140
|
+
return text
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def check(path: Path = SKILL_MD, fix: bool = False) -> tuple[list[str], int]:
|
|
144
|
+
"""(problems, numbers checked). fix=True rewrites drifted facts in place."""
|
|
145
|
+
text = path.read_text(encoding="utf-8")
|
|
146
|
+
scan = _masked(text)
|
|
147
|
+
match_view = _masked(text, keep_inline=True)
|
|
148
|
+
facts = _facts()
|
|
149
|
+
problems: list[str] = []
|
|
150
|
+
covered: set[int] = set()
|
|
151
|
+
edits: list[tuple[int, int, str]] = []
|
|
152
|
+
|
|
153
|
+
for pattern, kind, arg in RULES:
|
|
154
|
+
found = list(re.finditer(pattern, match_view, re.M))
|
|
155
|
+
if not found:
|
|
156
|
+
problems.append(f"rule unused (SKILL.md wording changed?): {pattern}")
|
|
157
|
+
continue
|
|
158
|
+
for m in found:
|
|
159
|
+
span = m.span(1) if m.re.groups else m.span()
|
|
160
|
+
covered.update(range(*m.span()))
|
|
161
|
+
if kind == "fact":
|
|
162
|
+
got, want = text[span[0]:span[1]], facts[arg]
|
|
163
|
+
if got != want:
|
|
164
|
+
problems.append(f"fact {arg}: SKILL.md says {got}, data says {want}")
|
|
165
|
+
edits.append((span[0], span[1], want))
|
|
166
|
+
|
|
167
|
+
line_of = lambda pos: text.count("\n", 0, pos) + 1 # noqa: E731
|
|
168
|
+
for m in NUM.finditer(scan):
|
|
169
|
+
if not any(i in covered for i in range(*m.span())):
|
|
170
|
+
problems.append(f"line {line_of(m.start())}: {m.group(0)} is not claimed by any rule")
|
|
171
|
+
|
|
172
|
+
if fix and edits:
|
|
173
|
+
for start, end, want in sorted(edits, reverse=True):
|
|
174
|
+
text = text[:start] + want + text[end:]
|
|
175
|
+
path.write_text(text, encoding="utf-8", newline="\n")
|
|
176
|
+
return problems, sum(1 for _ in NUM.finditer(scan))
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def main() -> int:
|
|
180
|
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[1])
|
|
181
|
+
ap.add_argument("--fix", action="store_true", help="rewrite drifted facts in SKILL.md")
|
|
182
|
+
args = ap.parse_args()
|
|
183
|
+
problems, n = check(fix=args.fix)
|
|
184
|
+
if not problems:
|
|
185
|
+
print(f"all {n} numbers in SKILL.md are claimed and match the data.")
|
|
186
|
+
return 0
|
|
187
|
+
print(f"SKILL.md has {len(problems)} number problem(s):")
|
|
188
|
+
for p in problems:
|
|
189
|
+
print(" x", p)
|
|
190
|
+
if args.fix:
|
|
191
|
+
print("(facts rewritten; the rest needs a human)")
|
|
192
|
+
return 1
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
if __name__ == "__main__":
|
|
196
|
+
raise SystemExit(main())
|
package/tools/mo.py
CHANGED
|
@@ -120,7 +120,109 @@ def wrap(text: str, width: int) -> list[str]:
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
def matches(text: str, needle: str | None) -> bool:
|
|
123
|
-
|
|
123
|
+
if needle is None:
|
|
124
|
+
return True
|
|
125
|
+
hay = (text or "").lower()
|
|
126
|
+
return any(n.lower() in hay for n in expand(needle))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
# ── Chinese and colloquial terms ─────────────────────────────────────────────
|
|
130
|
+
#
|
|
131
|
+
# data/terms-zh.csv maps the words a designer types (內距, 懸停, 彈窗) to Mosaic's
|
|
132
|
+
# English names. Every query that takes a word goes through expand(), so
|
|
133
|
+
# `mo.py css 內距` and `mo.py style --grep 內距` both mean padding. A word that
|
|
134
|
+
# maps to nothing is reported, never guessed: the caller is told to record it
|
|
135
|
+
# in data/pending.csv.
|
|
136
|
+
|
|
137
|
+
def has_cjk(text: str) -> bool:
|
|
138
|
+
return any(ord(ch) > 0x2E7F for ch in text or "")
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def terms() -> list[dict]:
|
|
142
|
+
return rows("terms-zh")
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def term_rows(word: str) -> list[dict]:
|
|
146
|
+
w = (word or "").strip().lower()
|
|
147
|
+
return [r for r in terms() if r["zh"].lower() == w]
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def expand(word: str, kinds: tuple[str, ...] = ()) -> list[str]:
|
|
151
|
+
"""English names for `word`. ASCII words pass through unchanged; a mapped
|
|
152
|
+
Chinese word becomes its English names; an unmapped one exits 1 naming it."""
|
|
153
|
+
if not has_cjk(word):
|
|
154
|
+
return [word]
|
|
155
|
+
hits = [r for r in term_rows(word) if not kinds or r["kind"] in kinds]
|
|
156
|
+
if not hits:
|
|
157
|
+
known = term_rows(word)
|
|
158
|
+
if known:
|
|
159
|
+
sys.exit("%s is a %s term (%s), not one this command looks up - try "
|
|
160
|
+
"`mo.py terms %s`" % (word, known[0]["kind"], known[0]["en"], word))
|
|
161
|
+
sys.exit("no English term for %s in data/terms-zh.csv. Retry in English; "
|
|
162
|
+
"still nothing -> say so and record it in data/pending.csv (待補)." % word)
|
|
163
|
+
out: list[str] = []
|
|
164
|
+
for r in hits:
|
|
165
|
+
for en in split(r["en"]):
|
|
166
|
+
if en not in out:
|
|
167
|
+
out.append(en)
|
|
168
|
+
return out
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def cmd_terms(a):
|
|
172
|
+
out = term_rows(a.word) if a.word else terms()
|
|
173
|
+
if a.word and not out:
|
|
174
|
+
near = [r for r in terms() if a.word in r["zh"] or a.word.lower() in r["en"].lower()]
|
|
175
|
+
out = near
|
|
176
|
+
if a.kind:
|
|
177
|
+
out = [r for r in out if r["kind"] == a.kind]
|
|
178
|
+
|
|
179
|
+
def render():
|
|
180
|
+
table(["zh", "en", "kind", "trust", "note"],
|
|
181
|
+
[[r["zh"], r["en"], r["kind"], r["trust"], r["note"][:70]] for r in out])
|
|
182
|
+
if a.word and not out:
|
|
183
|
+
print("\nnot mapped: record it in data/pending.csv (待補)")
|
|
184
|
+
else:
|
|
185
|
+
print("\nkind -> command: css = `mo.py css <en>`, type = `mo.py type <en>`, "
|
|
186
|
+
"state = `mo.py states --grep <en>`, concept = see the note")
|
|
187
|
+
|
|
188
|
+
emit(out, render)
|
|
189
|
+
if a.word and not out:
|
|
190
|
+
sys.exit(1)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def cmd_facts(a):
|
|
194
|
+
"""Search the measured facts (references/facts.md, references/core-rules.md)
|
|
195
|
+
bullet by bullet: the front-end behaviour no table row can hold."""
|
|
196
|
+
refs = os.path.join(os.path.dirname(DATA), "references")
|
|
197
|
+
needles = [n.lower() for w in a.words for n in expand(w)]
|
|
198
|
+
out = []
|
|
199
|
+
for name in ("facts.md", "core-rules.md"):
|
|
200
|
+
with open(os.path.join(refs, name), encoding="utf-8") as fh:
|
|
201
|
+
text = fh.read()
|
|
202
|
+
for block in re.split(r"\n(?=- \*\*|\*\*)", text):
|
|
203
|
+
low = block.lower()
|
|
204
|
+
if all(n in low for n in needles):
|
|
205
|
+
out.append({"file": "references/" + name, "text": block.strip()})
|
|
206
|
+
|
|
207
|
+
def render():
|
|
208
|
+
for r in out:
|
|
209
|
+
print("[%s]\n%s\n" % (r["file"], r["text"]))
|
|
210
|
+
print("%d fact(s)%s" % (len(out), "" if out else
|
|
211
|
+
" - nothing measured on this; say so and record it in data/pending.csv (待補)"))
|
|
212
|
+
|
|
213
|
+
emit(out, render)
|
|
214
|
+
if not out:
|
|
215
|
+
sys.exit(1)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def resolve_type(name: str) -> str:
|
|
219
|
+
"""A node type name, or the single type a Chinese word maps to."""
|
|
220
|
+
if not has_cjk(name):
|
|
221
|
+
return name
|
|
222
|
+
names = expand(name, ("type",))
|
|
223
|
+
if len(names) > 1:
|
|
224
|
+
sys.exit("%s maps to several types: %s - pick one" % (name, ", ".join(names)))
|
|
225
|
+
return names[0]
|
|
124
226
|
|
|
125
227
|
|
|
126
228
|
# ── node types ────────────────────────────────────────────────────────────────
|
|
@@ -513,11 +615,11 @@ def cmd_css(a):
|
|
|
513
615
|
"""Reverse lookup: which Mosaic style property drives this CSS property.
|
|
514
616
|
|
|
515
617
|
The names mostly transliterate, but not always, and `radius` -> `border-radius`
|
|
516
|
-
is not something to guess at 2am."""
|
|
517
|
-
|
|
618
|
+
is not something to guess at 2am. A Chinese word (`內距`) is expanded first."""
|
|
619
|
+
wants = [w.lower() for w in expand(a.property, ("css",))]
|
|
518
620
|
out = [r for r in rows("style-verification")
|
|
519
|
-
if
|
|
520
|
-
|
|
621
|
+
if any(w in (r["css_property"] or "").lower() or w in r["property"].lower()
|
|
622
|
+
for w in wants)]
|
|
521
623
|
props = index("style-properties", "property")
|
|
522
624
|
emit([dict(r, group=props.get(r["property"], {}).get("group", "")) for r in out],
|
|
523
625
|
lambda: table(["css property", "set in Mosaic as", "group", "swept"],
|
|
@@ -599,8 +701,9 @@ def cmd_interactions(a):
|
|
|
599
701
|
emit(out, lambda: (
|
|
600
702
|
table(["id", "family", "label"],
|
|
601
703
|
[[r["id"], r["family"], r["label"]] for r in out]),
|
|
602
|
-
print("\
|
|
603
|
-
"
|
|
704
|
+
print("\nValues bind only in the editor's stored shape (meta-uuid keys, CSS-string "
|
|
705
|
+
"values): build them with tools/interactions.py, never by hand - "
|
|
706
|
+
"references/interactions.md.")))
|
|
604
707
|
|
|
605
708
|
|
|
606
709
|
def cmd_conditions(a):
|
|
@@ -724,6 +827,9 @@ def cmd_stats(a):
|
|
|
724
827
|
"node_type_outcomes": counts,
|
|
725
828
|
"unsafe_types": sorted(r["type"] for r in ver if r["outcome"] in UNSAFE),
|
|
726
829
|
"node_properties": len(rows("node-property-verification")),
|
|
830
|
+
"node_property_declarations": len(rows("node-properties")),
|
|
831
|
+
"node_property_names": len({r["property"] for r in rows("node-properties")}),
|
|
832
|
+
"node_property_names_probed": len({r["property"] for r in rows("node-property-verification")}),
|
|
727
833
|
"node_property_outcomes": np,
|
|
728
834
|
"style_properties": len(rows("style-properties")),
|
|
729
835
|
"style_outcomes": sv,
|
|
@@ -744,6 +850,11 @@ def cmd_stats(a):
|
|
|
744
850
|
print("node properties %3d %s" % (
|
|
745
851
|
payload["node_properties"],
|
|
746
852
|
" ".join("%s %d" % (k, v) for k, v in sorted(np.items()))))
|
|
853
|
+
print(" = %d probe rows (one per property x host type) covering %d of the %d "
|
|
854
|
+
"declared names; node-properties.csv has %d rows because a name is "
|
|
855
|
+
"declared once per owning data class" % (
|
|
856
|
+
payload["node_properties"], payload["node_property_names_probed"],
|
|
857
|
+
payload["node_property_names"], payload["node_property_declarations"]))
|
|
747
858
|
print("style properties %3d %s" % (
|
|
748
859
|
payload["style_properties"],
|
|
749
860
|
" ".join("%s %d" % (k, v) for k, v in sorted(sv.items()))))
|
|
@@ -842,10 +953,24 @@ def main():
|
|
|
842
953
|
|
|
843
954
|
add("skeleton", cmd_skeleton, "a minimal valid page spec")
|
|
844
955
|
|
|
956
|
+
p = add("terms", cmd_terms, "Chinese / colloquial word -> Mosaic's English name")
|
|
957
|
+
p.add_argument("word", nargs="?")
|
|
958
|
+
p.add_argument("--kind", choices=["css", "type", "state", "concept"])
|
|
959
|
+
|
|
960
|
+
p = add("facts", cmd_facts, "search the measured front-end facts (all words must match)")
|
|
961
|
+
p.add_argument("words", nargs="+")
|
|
962
|
+
|
|
845
963
|
global ARGS
|
|
846
964
|
ARGS = ap.parse_args()
|
|
965
|
+
if ARGS.cmd in ("type", "params", "placement"):
|
|
966
|
+
ARGS.name = resolve_type(ARGS.name)
|
|
967
|
+
if ARGS.cmd == "check":
|
|
968
|
+
ARGS.names = [resolve_type(n) for n in ARGS.names]
|
|
847
969
|
ARGS.fn(ARGS)
|
|
848
970
|
|
|
849
971
|
|
|
850
972
|
if __name__ == "__main__":
|
|
973
|
+
for _s in (sys.stdout, sys.stderr):
|
|
974
|
+
if hasattr(_s, "reconfigure"):
|
|
975
|
+
_s.reconfigure(encoding="utf-8", errors="replace")
|
|
851
976
|
main()
|