//! Native utilities exported via N-API for the Oh My Pi toolchain.
//!
//! # Overview
//! High-performance primitives for clipboard access, grep, file discovery,
//! ANSI-aware text measurement, syntax highlighting, HTML-to-Markdown
//! conversion, and terminal SIXEL encoding.
//!
//! # Example
//! ```ignore
//! use pi_natives::text::visible_width;
//!
//! let width = visible_width("hello");
//! assert_eq!(width, 5);
//! ```
//!
//! # Architecture
//! ```text
//! JS (packages/natives) -> N-API -> Rust modules (clipboard/fd/glob/grep/html/highlight/sixel/text)
//! ```

#![allow(clippy::trailing_empty_array, reason = "generated by napi macro")]
#![allow(clippy::trivially_copy_pass_by_ref, reason = "napi env idiom")]

pub mod appearance;
pub mod ast;
pub mod block;
pub mod clipboard;
pub mod fd;
pub mod fs_cache;
pub mod glob;
pub mod glob_util;
pub mod grep;
pub mod highlight;
pub mod html;
pub mod keys;
pub mod sixel;
pub use pi_ast::language;

pub mod power;

pub mod iso;
pub mod prof;
pub mod ps;
pub mod pty;
pub mod shell;
pub mod summary;
pub mod task;
pub mod text;
pub mod tokens;
pub(crate) mod utils;
pub mod workspace;

use napi_derive::napi;

/// Version sentinel — exists solely so the JS loader can prove at load time
/// that the `.node` file on disk is from the same package release as the
/// `index.js` ESM wrapper invoking it.
///
/// The `js_name` is bumped by `scripts/release.ts` to match the new
/// `Cargo.toml` / `package.json` version on every release. The JS loader
/// computes the expected name from `package.json#version` and refuses to use
/// a `.node` that doesn't expose it, turning the silent
/// `<sym> is not a function` crash from a locked-file update (the canonical
/// Windows `bun install -g` failure mode) into a clear load-time error.
///
/// Bump policy: `__piNativesV{major}_{minor}_{patch}` — non-alphanumerics in
/// the version string are mapped to `_` to keep it a valid JS identifier.
/// MUST stay in sync with `VERSION_SENTINEL_EXPORT` in
/// `packages/natives/native/index.js` (which derives the name from
/// `package.json#version`).
#[napi(js_name = "__piNativesV15_7_4")]
pub const fn pi_natives_version_sentinel() {}