Lightweight coding agent that runs in your terminal
Rust
Sync system skills from public repo for openai yaml changes (#10322)
Gav Vermae470461a9626
diff --git a/codex-rs/core/src/skills/assets/samples/skill-creator/agents/openai.yaml b/codex-rs/core/src/skills/assets/samples/skill-creator/agents/openai.yamlnew file mode 100644index 0000000000..3095c600ce--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-creator/agents/openai.yaml@@ -0,0 +1,5 @@+interface:+ display_name: "Skill Creator"+ short_description: "Create or update a skill"+ icon_small: "./assets/skill-creator-small.svg"+ icon_large: "./assets/skill-creator.png"diff --git a/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator-small.svg b/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator-small.svgnew file mode 100644index 0000000000..c6e4f67c62--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator-small.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 20 20">+ <path fill="#0D0D0D" d="M12.03 4.113a3.612 3.612 0 0 1 5.108 5.108l-6.292 6.29c-.324.324-.56.561-.791.752l-.235.176c-.205.14-.422.261-.65.36l-.229.093a4.136 4.136 0 0 1-.586.16l-.764.134-2.394.4c-.142.024-.294.05-.423.06-.098.007-.232.01-.378-.026l-.149-.05a1.081 1.081 0 0 1-.521-.474l-.046-.093a1.104 1.104 0 0 1-.075-.527c.01-.129.035-.28.06-.422l.398-2.394c.1-.602.162-.987.295-1.35l.093-.23c.1-.228.22-.445.36-.65l.176-.235c.19-.232.428-.467.751-.79l6.292-6.292Zm-5.35 7.232c-.35.35-.534.535-.66.688l-.11.147a2.67 2.67 0 0 0-.24.433l-.062.154c-.08.22-.124.462-.232 1.112l-.398 2.394-.001.001h.003l2.393-.399.717-.126a2.63 2.63 0 0 0 .394-.105l.154-.063a2.65 2.65 0 0 0 .433-.24l.147-.11c.153-.126.339-.31.688-.66l4.988-4.988-3.227-3.226-4.987 4.988Zm9.517-6.291a2.281 2.281 0 0 0-3.225 0l-.364.362 3.226 3.227.363-.364c.89-.89.89-2.334 0-3.225ZM4.583 1.783a.3.3 0 0 1 .294.241c.117.585.347 1.092.707 1.48.357.385.859.668 1.549.783a.3.3 0 0 1 0 .592c-.69.115-1.192.398-1.549.783-.315.34-.53.77-.657 1.265l-.05.215a.3.3 0 0 1-.588 0c-.117-.585-.347-1.092-.707-1.48-.357-.384-.859-.668-1.549-.783a.3.3 0 0 1 0-.592c.69-.115 1.192-.398 1.549-.783.36-.388.59-.895.707-1.48l.015-.05a.3.3 0 0 1 .279-.19Z"/>+</svg>diff --git a/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator.png b/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator.pngnew file mode 100644index 0000000000..4f3d6d82faBinary files /dev/null and b/codex-rs/core/src/skills/assets/samples/skill-creator/assets/skill-creator.png differdiff --git a/codex-rs/core/src/skills/assets/samples/skill-creator/references/openai_yaml.md b/codex-rs/core/src/skills/assets/samples/skill-creator/references/openai_yaml.mdnew file mode 100644index 0000000000..da5629f8de--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-creator/references/openai_yaml.md@@ -0,0 +1,43 @@+# openai.yaml fields (full example + descriptions)++`agents/openai.yaml` is an extended, product-specific config intended for the machine/harness to read, not the agent. Other product-specific config can also live in the `agents/` folder.++## Full example++```yaml+interface:+ display_name: "Optional user-facing name"+ short_description: "Optional user-facing description"+ icon_small: "./assets/small-400px.png"+ icon_large: "./assets/large-logo.svg"+ brand_color: "#3B82F6"+ default_prompt: "Optional surrounding prompt to use the skill with"++dependencies:+ tools:+ - type: "mcp"+ value: "github"+ description: "GitHub MCP server"+ transport: "streamable_http"+ url: "https://api.githubcopilot.com/mcp/"+```++## Field descriptions and constraints++Top-level constraints:++- Quote all string values.+- Keep keys unquoted.+- For `interface.default_prompt`: generate a helpful, short (typically 1 sentence) example starting prompt based on the skill. It must explicitly mention the skill as `$skill-name` (e.g., "Use $skill-name-here to draft a concise weekly status update.").++- `interface.display_name`: Human-facing title shown in UI skill lists and chips.+- `interface.short_description`: Human-facing short UI blurb (25–64 chars) for quick scanning.+- `interface.icon_small`: Path to a small icon asset (relative to skill dir). Default to `./assets/` and place icons in the skill's `assets/` folder.+- `interface.icon_large`: Path to a larger logo asset (relative to skill dir). Default to `./assets/` and place icons in the skill's `assets/` folder.+- `interface.brand_color`: Hex color used for UI accents (e.g., badges).+- `interface.default_prompt`: Default prompt snippet inserted when invoking the skill.+- `dependencies.tools[].type`: Dependency category. Only `mcp` is supported for now.+- `dependencies.tools[].value`: Identifier of the tool or dependency.+- `dependencies.tools[].description`: Human-readable explanation of the dependency.+- `dependencies.tools[].transport`: Connection type when `type` is `mcp`.+- `dependencies.tools[].url`: MCP server URL when `type` is `mcp`.diff --git a/codex-rs/core/src/skills/assets/samples/skill-creator/scripts/generate_openai_yaml.py b/codex-rs/core/src/skills/assets/samples/skill-creator/scripts/generate_openai_yaml.pynew file mode 100644index 0000000000..1a9d784f87--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-creator/scripts/generate_openai_yaml.py@@ -0,0 +1,225 @@+#!/usr/bin/env python3+"""+OpenAI YAML Generator - Creates agents/openai.yaml for a skill folder.++Usage:+ generate_openai_yaml.py <skill_dir> [--name <skill_name>] [--interface key=value]+"""++import argparse+import re+import sys+from pathlib import Path++import yaml++ACRONYMS = {+ "GH",+ "MCP",+ "API",+ "CI",+ "CLI",+ "LLM",+ "PDF",+ "PR",+ "UI",+ "URL",+ "SQL",+}++BRANDS = {+ "openai": "OpenAI",+ "openapi": "OpenAPI",+ "github": "GitHub",+ "pagerduty": "PagerDuty",+ "datadog": "DataDog",+ "sqlite": "SQLite",+ "fastapi": "FastAPI",+}++SMALL_WORDS = {"and", "or", "to", "up", "with"}++ALLOWED_INTERFACE_KEYS = {+ "display_name",+ "short_description",+ "icon_small",+ "icon_large",+ "brand_color",+ "default_prompt",+}+++def yaml_quote(value):+ escaped = value.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")+ return f'"{escaped}"'+++def format_display_name(skill_name):+ words = [word for word in skill_name.split("-") if word]+ formatted = []+ for index, word in enumerate(words):+ lower = word.lower()+ upper = word.upper()+ if upper in ACRONYMS:+ formatted.append(upper)+ continue+ if lower in BRANDS:+ formatted.append(BRANDS[lower])+ continue+ if index > 0 and lower in SMALL_WORDS:+ formatted.append(lower)+ continue+ formatted.append(word.capitalize())+ return " ".join(formatted)+++def generate_short_description(display_name):+ description = f"Help with {display_name} tasks"++ if len(description) < 25:+ description = f"Help with {display_name} tasks and workflows"+ if len(description) < 25:+ description = f"Help with {display_name} tasks with guidance"++ if len(description) > 64:+ description = f"Help with {display_name}"+ if len(description) > 64:+ description = f"{display_name} helper"+ if len(description) > 64:+ description = f"{display_name} tools"+ if len(description) > 64:+ suffix = " helper"+ max_name_length = 64 - len(suffix)+ trimmed = display_name[:max_name_length].rstrip()+ description = f"{trimmed}{suffix}"+ if len(description) > 64:+ description = description[:64].rstrip()++ if len(description) < 25:+ description = f"{description} workflows"+ if len(description) > 64:+ description = description[:64].rstrip()++ return description+++def read_frontmatter_name(skill_dir):+ skill_md = Path(skill_dir) / "SKILL.md"+ if not skill_md.exists():+ print(f"[ERROR] SKILL.md not found in {skill_dir}")+ return None+ content = skill_md.read_text()+ match = re.match(r"^---\n(.*?)\n---", content, re.DOTALL)+ if not match:+ print("[ERROR] Invalid SKILL.md frontmatter format.")+ return None+ frontmatter_text = match.group(1)+ try:+ frontmatter = yaml.safe_load(frontmatter_text)+ except yaml.YAMLError as exc:+ print(f"[ERROR] Invalid YAML frontmatter: {exc}")+ return None+ if not isinstance(frontmatter, dict):+ print("[ERROR] Frontmatter must be a YAML dictionary.")+ return None+ name = frontmatter.get("name", "")+ if not isinstance(name, str) or not name.strip():+ print("[ERROR] Frontmatter 'name' is missing or invalid.")+ return None+ return name.strip()+++def parse_interface_overrides(raw_overrides):+ overrides = {}+ optional_order = []+ for item in raw_overrides:+ if "=" not in item:+ print(f"[ERROR] Invalid interface override '{item}'. Use key=value.")+ return None, None+ key, value = item.split("=", 1)+ key = key.strip()+ value = value.strip()+ if not key:+ print(f"[ERROR] Invalid interface override '{item}'. Key is empty.")+ return None, None+ if key not in ALLOWED_INTERFACE_KEYS:+ allowed = ", ".join(sorted(ALLOWED_INTERFACE_KEYS))+ print(f"[ERROR] Unknown interface field '{key}'. Allowed: {allowed}")+ return None, None+ overrides[key] = value+ if key not in ("display_name", "short_description") and key not in optional_order:+ optional_order.append(key)+ return overrides, optional_order+++def write_openai_yaml(skill_dir, skill_name, raw_overrides):+ overrides, optional_order = parse_interface_overrides(raw_overrides)+ if overrides is None:+ return None++ display_name = overrides.get("display_name") or format_display_name(skill_name)+ short_description = overrides.get("short_description") or generate_short_description(display_name)++ if not (25 <= len(short_description) <= 64):+ print(+ "[ERROR] short_description must be 25-64 characters "+ f"(got {len(short_description)})."+ )+ return None++ interface_lines = [+ "interface:",+ f" display_name: {yaml_quote(display_name)}",+ f" short_description: {yaml_quote(short_description)}",+ ]++ for key in optional_order:+ value = overrides.get(key)+ if value is not None:+ interface_lines.append(f" {key}: {yaml_quote(value)}")++ agents_dir = Path(skill_dir) / "agents"+ agents_dir.mkdir(parents=True, exist_ok=True)+ output_path = agents_dir / "openai.yaml"+ output_path.write_text("\n".join(interface_lines) + "\n")+ print(f"[OK] Created agents/openai.yaml")+ return output_path+++def main():+ parser = argparse.ArgumentParser(+ description="Create agents/openai.yaml for a skill directory.",+ )+ parser.add_argument("skill_dir", help="Path to the skill directory")+ parser.add_argument(+ "--name",+ help="Skill name override (defaults to SKILL.md frontmatter)",+ )+ parser.add_argument(+ "--interface",+ action="append",+ default=[],+ help="Interface override in key=value format (repeatable)",+ )+ args = parser.parse_args()++ skill_dir = Path(args.skill_dir).resolve()+ if not skill_dir.exists():+ print(f"[ERROR] Skill directory not found: {skill_dir}")+ sys.exit(1)+ if not skill_dir.is_dir():+ print(f"[ERROR] Path is not a directory: {skill_dir}")+ sys.exit(1)++ skill_name = args.name or read_frontmatter_name(skill_dir)+ if not skill_name:+ sys.exit(1)++ result = write_openai_yaml(skill_dir, skill_name, args.interface)+ if result:+ sys.exit(0)+ sys.exit(1)+++if __name__ == "__main__":+ main()diff --git a/codex-rs/core/src/skills/assets/samples/skill-installer/agents/openai.yaml b/codex-rs/core/src/skills/assets/samples/skill-installer/agents/openai.yamlnew file mode 100644index 0000000000..88d40cd946--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-installer/agents/openai.yaml@@ -0,0 +1,5 @@+interface:+ display_name: "Skill Installer"+ short_description: "Install curated skills from openai/skills or other repos"+ icon_small: "./assets/skill-installer-small.svg"+ icon_large: "./assets/skill-installer.png"diff --git a/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer-small.svg b/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer-small.svgnew file mode 100644index 0000000000..ccfc034241--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer-small.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">+ <path fill="#0D0D0D" d="M2.145 3.959a2.033 2.033 0 0 1 2.022-1.824h5.966c.551 0 .997 0 1.357.029.367.03.692.093.993.246l.174.098c.397.243.72.593.932 1.01l.053.114c.116.269.168.557.194.878.03.36.03.805.03 1.357v4.3a2.365 2.365 0 0 1-2.366 2.365h-1.312a2.198 2.198 0 0 1-4.377 0H4.167A2.032 2.032 0 0 1 2.135 10.5V9.333l.004-.088A.865.865 0 0 1 3 8.468l.116-.006A1.135 1.135 0 0 0 3 6.199a.865.865 0 0 1-.865-.864V4.167l.01-.208Zm1.054 1.186a2.198 2.198 0 0 1 0 4.376v.98c0 .534.433.967.968.967H6l.089.004a.866.866 0 0 1 .776.861 1.135 1.135 0 0 0 2.27 0c0-.478.387-.865.865-.865h1.5c.719 0 1.301-.583 1.301-1.301v-4.3c0-.57 0-.964-.025-1.27a1.933 1.933 0 0 0-.09-.493L12.642 4a1.47 1.47 0 0 0-.541-.585l-.102-.056c-.126-.065-.295-.11-.596-.135a17.31 17.31 0 0 0-1.27-.025H4.167a.968.968 0 0 0-.968.968v.978Z"/>+</svg>diff --git a/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer.png b/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer.pngnew file mode 100644index 0000000000..2977cd5bb4Binary files /dev/null and b/codex-rs/core/src/skills/assets/samples/skill-installer/assets/skill-installer.png differdiff --git a/codex-rs/core/src/skills/assets/samples/skill-installer/scripts/list-skills.py b/codex-rs/core/src/skills/assets/samples/skill-installer/scripts/list-skills.pynew file mode 100755index 0000000000..0977c296ab--- /dev/null+++ b/codex-rs/core/src/skills/assets/samples/skill-installer/scripts/list-skills.py@@ -0,0 +1,107 @@+#!/usr/bin/env python3+"""List skills from a GitHub repo path."""++from __future__ import annotations++import argparse+import json+import os+import sys+import urllib.error++from github_utils import github_api_contents_url, github_request++DEFAULT_REPO = "openai/skills"+DEFAULT_PATH = "skills/.curated"+DEFAULT_REF = "main"+++class ListError(Exception):+ pass+++class Args(argparse.Namespace):+ repo: str+ path: str+ ref: str+ format: str+++def _request(url: str) -> bytes:+ return github_request(url, "codex-skill-list")+++def _codex_home() -> str:+ return os.environ.get("CODEX_HOME", os.path.expanduser("~/.codex"))+++def _installed_skills() -> set[str]:+ root = os.path.join(_codex_home(), "skills")+ if not os.path.isdir(root):+ return set()+ entries = set()+ for name in os.listdir(root):+ path = os.path.join(root, name)+ if os.path.isdir(path):+ entries.add(name)+ return entries+++def _list_skills(repo: str, path: str, ref: str) -> list[str]:+ api_url = github_api_contents_url(repo, path, ref)+ try:+ payload = _request(api_url)+ except urllib.error.HTTPError as exc:+ if exc.code == 404:+ raise ListError(+ "Skills path not found: "+ f"https://github.com/{repo}/tree/{ref}/{path}"+ ) from exc+ raise ListError(f"Failed to fetch skills: HTTP {exc.code}") from exc+ data = json.loads(payload.decode("utf-8"))+ if not isinstance(data, list):+ raise ListError("Unexpected skills listing response.")+ skills = [item["name"] for item in data if item.get("type") == "dir"]+ return sorted(skills)+++def _parse_args(argv: list[str]) -> Args:+ parser = argparse.ArgumentParser(description="List skills.")+ parser.add_argument("--repo", default=DEFAULT_REPO)+ parser.add_argument(+ "--path",+ default=DEFAULT_PATH,+ help="Repo path to list (default: skills/.curated)",+ )+ parser.add_argument("--ref", default=DEFAULT_REF)+ parser.add_argument(+ "--format",+ choices=["text", "json"],+ default="text",+ help="Output format",+ )+ return parser.parse_args(argv, namespace=Args())+++def main(argv: list[str]) -> int:+ args = _parse_args(argv)+ try:+ skills = _list_skills(args.repo, args.path, args.ref)+ installed = _installed_skills()+ if args.format == "json":+ payload = [+ {"name": name, "installed": name in installed} for name in skills+ ]+ print(json.dumps(payload))+ else:+ for idx, name in enumerate(skills, start=1):+ suffix = " (already installed)" if name in installed else ""+ print(f"{idx}. {name}{suffix}")+ return 0+ except ListError as exc:+ print(f"Error: {exc}", file=sys.stderr)+ return 1+++if __name__ == "__main__":+ raise SystemExit(main(sys.argv[1:]))