Skip to content

Commit ecd79df

Browse files
committed
fix: serve /SKILL.md through a rewrite, restore the site root, and keep checkout fonts local
site/SKILL.md made the skills CLI install the website: any SKILL.md one level below the repo root counts as a skill. The served copy is now kami-skill.md behind a /SKILL.md rewrite. The transitional root config gained explicit / and /SKILL.md rewrites. CI's --check-fonts paths are skill-relative because verify resolves them against the skill root. ensure-fonts.sh copies the root fonts into the skill checkout (ignored there, filtered from the mirror and the package) so templates keep their local-first font path.
1 parent 26bb5b0 commit ecd79df

12 files changed

Lines changed: 141 additions & 38 deletions

File tree

‎.github/workflows/check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ jobs:
106106
# this reports a serif fallback and passes; it fails if the CJK body
107107
# ever lands on a sans or gets split across two families, which is how
108108
# a broken font install would otherwise ship looking merely "fine".
109-
run: python3 skills/kami/scripts/build.py --check-fonts skills/kami/assets/examples/one-pager.pdf skills/kami/assets/examples/one-pager-ko.pdf skills/kami/assets/examples/resume.pdf
109+
run: python3 skills/kami/scripts/build.py --check-fonts assets/examples/one-pager.pdf assets/examples/one-pager-ko.pdf assets/examples/resume.pdf

‎.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ __pycache__/
99
*.pyc
1010
.pytest_cache/
1111

12-
# Font build artifacts
12+
# Font build artifacts, plus the commercial fonts ensure-fonts.sh copies into the skill checkout
1313
assets/fonts/*.otf
14+
skills/kami/assets/fonts/*.ttf
15+
skills/kami/assets/fonts/*.otf
1416

1517
# Template examples with placeholder content, regenerate via: python3 scripts/build.py
1618
assets/examples/

‎AGENTS.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ One repository, three top-level roles, and the install tools only ever copy the
2626
into it, never hand-copied.
2727
- The root holds repository tooling only: `scripts/` (`build_metadata.py`,
2828
`package-skill.sh`, `release_gate.py`, `draft-release-notes.py`, `tests/`),
29-
`assets/fonts/` (the commercial TTFs used by checkout renders; templates fall back
30-
to jsDelivr and `ensure-fonts.sh` when they are absent), `assets/examples/`
29+
`assets/fonts/` (the commercial TTFs; run `bash skills/kami/scripts/ensure-fonts.sh`
30+
once after cloning to copy them into the skill's ignored `assets/fonts/`, otherwise
31+
templates fall back to jsDelivr), `assets/examples/`
3132
(ignored render output), `docs/`, and `.github/`.
3233

3334
Run skill-side commands from `skills/kami/` (`cd skills/kami && python3
@@ -102,7 +103,7 @@ Only the entries whose role is not obvious from the filename:
102103
applies `rewrites` only after the filesystem and `/` always matches `index.html`),
103104
`developers|about|contact|privacy.md`, `developers/llms.txt`, and the generated
104105
`.well-known/agent-skills/index.json`, `.well-known/mcp/server-card.json`,
105-
`feeds/catalog.jsonld`, `schemamap.xml`, `SKILL.md` (served at `/SKILL.md`). Every new prose page needs its `.md` twin,
106+
`feeds/catalog.jsonld`, `schemamap.xml`, `kami-skill.md` (served at `/SKILL.md` through a rewrite; it must not be named `SKILL.md`, or the skills CLI installs the site). Every new prose page needs its `.md` twin,
106107
a `rewrites` entry for the extensionless URL, and a `sitemap.xml` row.
107108
The `has`-conditioned redirects and the `Link` headers are only observable on a
108109
deploy: verify them with `curl -sI` against the preview URL, never locally.
@@ -215,8 +216,8 @@ The same generator owns the site's machine-readable files under `site/`:
215216
`.well-known/agent-skills/index.json` (carries a SHA-256 digest of `SKILL.md`, so any
216217
skill edit changes it), `.well-known/mcp/server-card.json` (version plus the tool list
217218
parsed out of `scripts/mcp_server.py` without importing it), `feeds/catalog.jsonld`
218-
(built from `HTML_TEMPLATES` / `DIAGRAM_TEMPLATES`), `schemamap.xml`, and `SKILL.md`
219-
(the copy served at `/SKILL.md`). Never hand-edit these; change the source and
219+
(built from `HTML_TEMPLATES` / `DIAGRAM_TEMPLATES`), `schemamap.xml`, and
220+
`kami-skill.md` (the copy served at `/SKILL.md`). Never hand-edit these; change the source and
220221
regenerate.
221222

222223
Marketplace, plugin path, version, or install-path changes need runtime installation

‎plugins/kami/skills/kami/scripts/ensure-fonts.sh‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ set -euo pipefail
55
# Avoids `declare -A` so the script runs on a fresh macOS without `brew install bash`.
66

77
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8-
REPO_FONT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)/assets/fonts"
9-
# In a repository checkout the commercial fonts sit two levels up, outside the
10-
# skill directory, so installs stay light.
8+
SKILL_FONT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)/assets/fonts"
9+
REPO_FONT_DIR="$SKILL_FONT_DIR"
10+
# In a repository checkout the commercial fonts are tracked two levels up,
11+
# outside the skill directory, so installs stay light. Templates resolve
12+
# ../fonts/ against the skill directory, so copy them in (gitignored there).
1113
if [ -d "$SCRIPT_DIR/../../../assets/fonts" ]; then
12-
REPO_FONT_DIR="$(cd "$SCRIPT_DIR/../../../assets/fonts" && pwd)"
14+
ROOT_FONT_DIR="$(cd "$SCRIPT_DIR/../../../assets/fonts" && pwd)"
15+
mkdir -p "$SKILL_FONT_DIR"
16+
for f in "$ROOT_FONT_DIR"/*.ttf "$ROOT_FONT_DIR"/*.otf; do
17+
[ -f "$f" ] || continue
18+
if [ ! -f "$SKILL_FONT_DIR/$(basename "$f")" ]; then
19+
cp "$f" "$SKILL_FONT_DIR/$(basename "$f")"
20+
echo "OK: copied $(basename "$f") from the repository root into $SKILL_FONT_DIR"
21+
fi
22+
done
1323
fi
1424

1525
# Download target lives OUTSIDE the skill directory on purpose.

‎plugins/kami/skills/kami/scripts/verify.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ def verify_target(name: str, source: str, max_pages: int, src_dir: Path) -> list
333333
if missing_fonts:
334334
for mf in missing_fonts:
335335
print(f" [FONT MISS] {name}: {mf} not found")
336-
print(f" [FONT MISS] Repo fix: git checkout -- assets/fonts at the repository root (commercial TTFs are tracked there)")
336+
print(f" [FONT MISS] Repo checkout fix: bash scripts/ensure-fonts.sh (copies the tracked fonts from the repository root into assets/fonts)")
337337
print(f" [FONT MISS] Skill recovery (downloads to the user font dir, not the skill): bash scripts/ensure-fonts.sh")
338338
print(f" [FONT MISS] Fallback: brew install --cask font-source-han-serif-sc")
339339

‎scripts/build_metadata.py‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@
7474
)
7575

7676
SKILL_MIRROR_ROOT = Path("plugins/kami/skills/kami")
77+
SKILL_MIRROR_ALLOWED_FONT_FILES = {
78+
"JetBrainsMono.woff2",
79+
"LICENSE-SourceHanSerifK.txt",
80+
}
7781
SKILL_MIRROR_IGNORED_DIRS = {
7882
"examples",
7983
"__pycache__",
@@ -507,6 +511,8 @@ def should_include_skill_mirror_file(path: Path) -> bool:
507511
return False
508512
if path.suffix in SKILL_MIRROR_IGNORED_SUFFIXES:
509513
return False
514+
if path.parts[:2] == ("assets", "fonts"):
515+
return path.name in SKILL_MIRROR_ALLOWED_FONT_FILES
510516
return True
511517

512518

@@ -664,9 +670,11 @@ def main() -> int:
664670
),
665671
(site_root / "feeds" / "catalog.jsonld", build_catalog_feed(skill_root)),
666672
(site_root / "schemamap.xml", build_schemamap()),
667-
# The website serves the skill definition at /SKILL.md; it is a copy of
668-
# the source, never edited in site/.
669-
(site_root / "SKILL.md", skill_source.decode("utf-8")),
673+
# The website serves the skill definition at /SKILL.md through a rewrite
674+
# to this copy. It is deliberately not named SKILL.md: the skills CLI
675+
# treats any SKILL.md one level below the repo root as an installable
676+
# skill, and site/SKILL.md would win over skills/kami.
677+
(site_root / "kami-skill.md", skill_source.decode("utf-8")),
670678
]
671679

672680
if args.check:
File renamed without changes.

‎site/vercel.json‎

Lines changed: 82 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,59 @@
77
},
88
{
99
"source": "/",
10-
"has": [{ "type": "query", "key": "mode", "value": "agent" }],
10+
"has": [
11+
{
12+
"type": "query",
13+
"key": "mode",
14+
"value": "agent"
15+
}
16+
],
1117
"destination": "/index.md",
1218
"permanent": false
1319
},
1420
{
1521
"source": "/",
16-
"has": [{ "type": "header", "key": "accept", "value": ".*text/markdown.*" }],
22+
"has": [
23+
{
24+
"type": "header",
25+
"key": "accept",
26+
"value": ".*text/markdown.*"
27+
}
28+
],
1729
"destination": "/index.md",
1830
"permanent": false
1931
}
2032
],
2133
"rewrites": [
22-
{ "source": "/developers", "destination": "/developers.html" },
23-
{ "source": "/about", "destination": "/about.html" },
24-
{ "source": "/contact", "destination": "/contact.html" },
25-
{ "source": "/privacy", "destination": "/privacy.html" }
34+
{
35+
"source": "/SKILL.md",
36+
"destination": "/kami-skill.md"
37+
},
38+
{
39+
"source": "/developers",
40+
"destination": "/developers.html"
41+
},
42+
{
43+
"source": "/about",
44+
"destination": "/about.html"
45+
},
46+
{
47+
"source": "/contact",
48+
"destination": "/contact.html"
49+
},
50+
{
51+
"source": "/privacy",
52+
"destination": "/privacy.html"
53+
}
2654
],
2755
"headers": [
2856
{
2957
"source": "/",
3058
"headers": [
31-
{ "key": "Vary", "value": "Accept, Accept-Encoding" },
59+
{
60+
"key": "Vary",
61+
"value": "Accept, Accept-Encoding"
62+
},
3263
{
3364
"key": "Link",
3465
"value": "</sitemap.xml>; rel=\"sitemap\", </index.md>; rel=\"alternate\"; type=\"text/markdown\", </llms.txt>; rel=\"service-doc\"; type=\"text/plain\", </.well-known/mcp/server-card.json>; rel=\"service-desc\"; type=\"application/json\", </feeds/catalog.jsonld>; rel=\"describedby\"; type=\"application/ld+json\", </developers>; rel=\"help\""
@@ -38,7 +69,10 @@
3869
{
3970
"source": "/developers",
4071
"headers": [
41-
{ "key": "Vary", "value": "Accept, Accept-Encoding" },
72+
{
73+
"key": "Vary",
74+
"value": "Accept, Accept-Encoding"
75+
},
4276
{
4377
"key": "Link",
4478
"value": "</developers.md>; rel=\"alternate\"; type=\"text/markdown\", </developers/llms.txt>; rel=\"service-doc\"; type=\"text/plain\", </.well-known/mcp/server-card.json>; rel=\"service-desc\"; type=\"application/json\", </feeds/catalog.jsonld>; rel=\"describedby\"; type=\"application/ld+json\""
@@ -48,46 +82,76 @@
4882
{
4983
"source": "/about",
5084
"headers": [
51-
{ "key": "Link", "value": "</about.md>; rel=\"alternate\"; type=\"text/markdown\"" }
85+
{
86+
"key": "Link",
87+
"value": "</about.md>; rel=\"alternate\"; type=\"text/markdown\""
88+
}
5289
]
5390
},
5491
{
5592
"source": "/contact",
5693
"headers": [
57-
{ "key": "Link", "value": "</contact.md>; rel=\"alternate\"; type=\"text/markdown\"" }
94+
{
95+
"key": "Link",
96+
"value": "</contact.md>; rel=\"alternate\"; type=\"text/markdown\""
97+
}
5898
]
5999
},
60100
{
61101
"source": "/privacy",
62102
"headers": [
63-
{ "key": "Link", "value": "</privacy.md>; rel=\"alternate\"; type=\"text/markdown\"" }
103+
{
104+
"key": "Link",
105+
"value": "</privacy.md>; rel=\"alternate\"; type=\"text/markdown\""
106+
}
64107
]
65108
},
66109
{
67110
"source": "/(.*).md",
68111
"headers": [
69-
{ "key": "Content-Type", "value": "text/markdown; charset=utf-8" },
70-
{ "key": "Access-Control-Allow-Origin", "value": "*" }
112+
{
113+
"key": "Content-Type",
114+
"value": "text/markdown; charset=utf-8"
115+
},
116+
{
117+
"key": "Access-Control-Allow-Origin",
118+
"value": "*"
119+
}
71120
]
72121
},
73122
{
74123
"source": "/feeds/(.*).jsonld",
75124
"headers": [
76-
{ "key": "Content-Type", "value": "application/ld+json; charset=utf-8" },
77-
{ "key": "Access-Control-Allow-Origin", "value": "*" }
125+
{
126+
"key": "Content-Type",
127+
"value": "application/ld+json; charset=utf-8"
128+
},
129+
{
130+
"key": "Access-Control-Allow-Origin",
131+
"value": "*"
132+
}
78133
]
79134
},
80135
{
81136
"source": "/.well-known/(.*).json",
82137
"headers": [
83-
{ "key": "Content-Type", "value": "application/json; charset=utf-8" },
84-
{ "key": "Access-Control-Allow-Origin", "value": "*" }
138+
{
139+
"key": "Content-Type",
140+
"value": "application/json; charset=utf-8"
141+
},
142+
{
143+
"key": "Access-Control-Allow-Origin",
144+
"value": "*"
145+
}
85146
]
86147
},
87148
{
88149
"source": "/schemamap.xml",
89150
"headers": [
90-
{ "key": "Content-Type", "value": "application/xml; charset=utf-8" }
151+
{
152+
"key": "Content-Type",
153+
"value": "application/xml; charset=utf-8"
154+
}
91155
]
92156
}
93157
]
142 KB
Binary file not shown.

‎skills/kami/scripts/ensure-fonts.sh‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,21 @@ set -euo pipefail
55
# Avoids `declare -A` so the script runs on a fresh macOS without `brew install bash`.
66

77
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
8-
REPO_FONT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)/assets/fonts"
9-
# In a repository checkout the commercial fonts sit two levels up, outside the
10-
# skill directory, so installs stay light.
8+
SKILL_FONT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)/assets/fonts"
9+
REPO_FONT_DIR="$SKILL_FONT_DIR"
10+
# In a repository checkout the commercial fonts are tracked two levels up,
11+
# outside the skill directory, so installs stay light. Templates resolve
12+
# ../fonts/ against the skill directory, so copy them in (gitignored there).
1113
if [ -d "$SCRIPT_DIR/../../../assets/fonts" ]; then
12-
REPO_FONT_DIR="$(cd "$SCRIPT_DIR/../../../assets/fonts" && pwd)"
14+
ROOT_FONT_DIR="$(cd "$SCRIPT_DIR/../../../assets/fonts" && pwd)"
15+
mkdir -p "$SKILL_FONT_DIR"
16+
for f in "$ROOT_FONT_DIR"/*.ttf "$ROOT_FONT_DIR"/*.otf; do
17+
[ -f "$f" ] || continue
18+
if [ ! -f "$SKILL_FONT_DIR/$(basename "$f")" ]; then
19+
cp "$f" "$SKILL_FONT_DIR/$(basename "$f")"
20+
echo "OK: copied $(basename "$f") from the repository root into $SKILL_FONT_DIR"
21+
fi
22+
done
1323
fi
1424

1525
# Download target lives OUTSIDE the skill directory on purpose.

0 commit comments

Comments
 (0)