mirror of
https://github.com/openai/codex.git
synced 2026-04-28 02:11:08 +03:00
## Why `codex-core` was carrying the embedded system-skill sample assets (and a `build.rs` that walks those files to register rerun triggers). Those assets change infrequently, but any change under `codex-core` still ties them to `codex-core`'s build/cache lifecycle. This change moves the embedded system-skills packaging into a dedicated `codex-skills` crate so it can be cached independently. That reduces unnecessary invalidation/rebuild pressure on `codex-core` when the skills bundle is the only thing that changes. ## What Changed - Added a new `codex-rs/skills` crate (`codex-skills`) with: - `Cargo.toml` - `BUILD.bazel` - `build.rs` to track skill asset file changes for Cargo rebuilds - `src/lib.rs` containing the embedded system-skills install/cache logic previously in `codex-core` - Moved the embedded sample skill assets from `codex-rs/core/src/skills/assets/samples` to `codex-rs/skills/src/assets/samples`. - Updated `codex-rs/core/Cargo.toml` to depend on `codex-skills` and removed `codex-core`'s direct `include_dir` dependency. - Removed `codex-core`'s `build.rs`. - Replaced `codex-rs/core/src/skills/system.rs` implementation with a thin re-export wrapper to keep existing `codex-core` call sites unchanged. - Updated workspace manifests/lockfile (`codex-rs/Cargo.toml`, `codex-rs/Cargo.lock`) for the new crate.
22 lines
659 B
Python
22 lines
659 B
Python
#!/usr/bin/env python3
|
|
"""Shared GitHub helpers for skill install scripts."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
import urllib.request
|
|
|
|
|
|
def github_request(url: str, user_agent: str) -> bytes:
|
|
headers = {"User-Agent": user_agent}
|
|
token = os.environ.get("GITHUB_TOKEN") or os.environ.get("GH_TOKEN")
|
|
if token:
|
|
headers["Authorization"] = f"token {token}"
|
|
req = urllib.request.Request(url, headers=headers)
|
|
with urllib.request.urlopen(req) as resp:
|
|
return resp.read()
|
|
|
|
|
|
def github_api_contents_url(repo: str, path: str, ref: str) -> str:
|
|
return f"https://api.github.com/repos/{repo}/contents/{path}?ref={ref}"
|