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:
Joe Savona
2026-11-17 11:58:26 +00:00
committed by copyberry
parent 59ac39addb
commit 7df454ceb5
17 changed files with 414 additions and 2 deletions
+8
View File
@@ -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,