mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Add TypeScript contracts for custom statusline providers (#62034)
## What changed Bundle a generated `statusline.d.ts` reference with the `create-statusline` skill, covering status snapshots, UI trees, colors, and canonical statusline item IDs. Add test-only `ts-rs` derives and an `UPDATE_STATUSLINE_TYPES` regeneration path. Clarify that rate-limit usage percentages can exceed 100. ## Testing Add a Rust test that checks key type exports in the installed skill and a strict TypeScript fixture covering provider rendering and invalid item IDs, row props, and colors. GitOrigin-RevId: f615e0b3c2cd3d0d95a75de36ce0a84467ecd5b6
This commit is contained in:
@@ -63,6 +63,7 @@ fn terminal_color(color: Option<TerminalColor>, fallback: TerminalColor) -> Term
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
#[cfg_attr(test, derive(ts_rs::TS), ts(export_to = "statusline.d.ts"))]
|
||||
pub(super) enum Color {
|
||||
Primary,
|
||||
Surface,
|
||||
@@ -121,8 +122,14 @@ impl Color {
|
||||
}
|
||||
}
|
||||
|
||||
/// A six-digit sRGB color in `#RRGGBB` form.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(try_from = "String", into = "String")]
|
||||
#[cfg_attr(
|
||||
test,
|
||||
derive(ts_rs::TS),
|
||||
ts(export_to = "statusline.d.ts", type = "`#${string}`")
|
||||
)]
|
||||
pub(super) struct HexRgb((u8, u8, u8));
|
||||
|
||||
impl TryFrom<String> for HexRgb {
|
||||
@@ -148,6 +155,7 @@ impl From<HexRgb> for String {
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
#[cfg_attr(test, derive(ts_rs::TS), ts(export_to = "statusline.d.ts"))]
|
||||
pub(super) enum TextWeight {
|
||||
Normal,
|
||||
Bold,
|
||||
|
||||
Reference in New Issue
Block a user