jsx-notation

v0.1.6
io.github.SebastianMaciel/jsx-notation Checked 3 days ago Published 9 months ago

JSXN encoder/decoder — compact notation for React/Next.js files, optimized for LLMs

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

read_jsxn Read file as JSXN

Reads a React/Next.js file (.jsx, .tsx, .js, .ts), HTML file (.html), or SVG file (.svg) from disk and returns its JSXN-compressed representation (~40% fewer tokens). Use this instead of reading JSX/TSX files directly when you need to understand component structure, props, and rendering logic. For full files with imports/hooks/logic, the file-level encoding is used automatically. For .html and .svg files, the HTML encoder is used.

ParameterTypeDescription
path *stringAbsolute or relative path to the .jsx/.tsx/.js/.ts/.html/.svg file to encode

encode_jsxn Encode code to JSXN

Encodes raw JSX/TSX source code or HTML into JSXN compact notation (~40% fewer tokens). Use "snippet" mode for JSX fragments (just the template). Use "file" mode for complete React/Next.js files with imports, types, hooks, etc. Use format "html" to encode HTML source.

ParameterTypeDescription
code *stringThe JSX/TSX/HTML source code to encode
formatstring"jsx" for JSX/TSX (default), "html" for HTML source
modestring"file" for complete files with imports/hooks/logic, "snippet" for JSX-only fragments

decode_jsxn Decode JSXN to code

Decodes JSXN compact notation back into standard JSX/TSX or HTML source code. Use "snippet" mode for JSXN body fragments (just the template). Use "file" mode for complete JSXN files with imports, types, hooks, etc. Use format "html" to decode to HTML output.

ParameterTypeDescription
code *stringThe JSXN notation to decode
formatstring"jsx" for JSX/TSX (default), "html" for HTML output
modestring"file" for complete files with imports/hooks/logic, "snippet" for JSXN body fragments

write_jsxn Write JSXN as file

Decodes JSXN notation and writes the resulting JSX/TSX or HTML to a file on disk. Creates parent directories if needed. Writes to .jsx/.tsx/.js/.ts/.html/.svg files. For .html and .svg files, decodes with HTML format (class attrs, void elements, SVG self-closing, etc.). ## JSXN Format Reference JSXN is a compact notation for React/Next.js code that saves ~40% tokens. ### File-level headers - `@I module: default Name, x, y` → `import Name, { x, y } from "module"` - `@I "styles.css"` → `import "styles.css"` - `@T module: Type1` → `import type { Type1 } from "module"` ### Directives - `…

ParameterTypeDescription
code *stringThe JSXN notation to decode and write
path *stringTarget file path (.jsx, .tsx, .js, .ts, .html, or .svg)