1111log = logging .getLogger ("mkdocs" )
1212
1313WELL_KNOWN_SKILLS_DIR = ".well-known/skills"
14- SKILL_SOURCE = "skill .md"
14+ SKILL_PATH = ( "skills" , "dstack" , "SKILL .md")
1515DISABLE_EXAMPLES_ENV = "DSTACK_DOCS_DISABLE_EXAMPLES"
1616
1717
@@ -79,12 +79,13 @@ def on_post_build(config):
7979 os .makedirs (os .path .dirname (dest_path ), exist_ok = True )
8080 shutil .copy2 (src_path , dest_path )
8181
82- _write_well_known_skills (docs_dir , site_dir )
82+ _write_well_known_skills (config , site_dir )
8383
8484
85- def _write_well_known_skills (docs_dir , site_dir ):
86- """Parse skill.md and write .well-known/skills/index.json. name and description come from frontmatter only."""
87- skill_src = os .path .join (docs_dir , SKILL_SOURCE )
85+ def _write_well_known_skills (config , site_dir ):
86+ """Parse skills/dstack/SKILL.md and write .well-known/skills/index.json. name and description come from frontmatter only."""
87+ repo_root = os .path .dirname (config ["config_file_path" ])
88+ skill_src = os .path .join (repo_root , * SKILL_PATH )
8889 if not os .path .isfile (skill_src ):
8990 return
9091
@@ -105,13 +106,15 @@ def _write_well_known_skills(docs_dir, site_dir):
105106
106107 if not name or not description :
107108 log .warning (
108- "skill .md missing name or description in frontmatter; skipping .well-known/skills"
109+ "skills/dstack/SKILL .md missing name or description in frontmatter; skipping .well-known/skills"
109110 )
110111 return
111112
112113 out_dir = os .path .join (site_dir , WELL_KNOWN_SKILLS_DIR , name )
113114 os .makedirs (out_dir , exist_ok = True )
114115 shutil .copy2 (skill_src , os .path .join (out_dir , "skill.md" ))
116+ # Serve skill at site root (e.g. https://dstack.ai/skill.md) from skills/dstack/SKILL.md
117+ shutil .copy2 (skill_src , os .path .join (site_dir , "skill.md" ))
115118
116119 index_path = os .path .join (site_dir , WELL_KNOWN_SKILLS_DIR , "index.json" )
117120 index = {"skills" : [{"name" : name , "description" : description [:1024 ], "files" : ["skill.md" ]}]}
0 commit comments