Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 1 addition & 64 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,6 @@ permissions:
contents: read

jobs:
verify-jsr:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
submodules: true
persist-credentials: false

- name: setup deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.x

- name: build wasm
run: make

- name: Get Version
id: vars
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT

- name: Build JSR
run: deno task build:jsr "${STEPS_VARS_OUTPUTS_VERSION}"
env:
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}

- name: dry run publish
run: deno publish --dry-run --allow-dirty

verify-npm:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -82,7 +53,7 @@ jobs:
path: ./build/npm

publish-npm:
needs: [verify-jsr, verify-npm]
needs: [verify-npm]
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -105,37 +76,3 @@ jobs:
- name: Publish NPM
run: npm publish --access=public --tag=latest
working-directory: ./build/npm

publish-jsr:
needs: [verify-jsr, verify-npm]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
submodules: true
persist-credentials: false

- name: setup deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.x

- name: build wasm
run: make

- name: Get Version
id: vars
run: echo "version=$(echo "${GITHUB_REF_NAME}" | sed 's/^v//')" >> $GITHUB_OUTPUT

- name: Build JSR
run: deno task build:jsr "${STEPS_VARS_OUTPUTS_VERSION}"
env:
STEPS_VARS_OUTPUTS_VERSION: ${{steps.vars.outputs.version}}

- name: Publish JSR
run: deno publish --allow-dirty
24 changes: 0 additions & 24 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,6 @@ jobs:
- name: test
run: deno task test

jsr:
needs: test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
submodules: true
persist-credentials: false

- name: setup deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.x

- name: build wasm
run: make

- name: Build JSR
run: deno task build:jsr 0.0.0-verify.0

- name: dry run publish
run: deno publish --dry-run --allow-dirty

npm:
needs: test
runs-on: ubuntu-latest
Expand Down
14 changes: 6 additions & 8 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Building clayterm from source
# Building @bomb.sh/tty from source

This guide is for maintainers and builders working on clayterm itself.
This guide is for maintainers and builders working on `@bomb.sh/tty` itself.

It covers:

Expand All @@ -10,7 +10,7 @@ It covers:
- building the local development artifacts, and
- verifying that the repo is ready for development.

It does **not** cover npm/JSR packaging or publishing.
It does **not** cover npm packaging or publishing.

## What the local build produces

Expand All @@ -30,8 +30,8 @@ The build depends on the `clay` git submodule.
Preferred fresh clone:

```sh
git clone --recurse-submodules https://github.com/bombshell-dev/clayterm.git
cd clayterm
git clone --recurse-submodules https://github.com/bombshell-dev/tty.git
cd tty
```

If you already cloned without submodules:
Expand Down Expand Up @@ -77,7 +77,7 @@ Then install LLVM and Deno with Homebrew:
brew install llvm deno
```

Use Homebrew LLVM before Apple's system `clang` when building clayterm:
Use Homebrew LLVM before Apple's system `clang` when building `@bomb.sh/tty`:

```sh
echo 'export PATH="$(brew --prefix llvm)/bin:$PATH"' >> ~/.zshrc
Expand Down Expand Up @@ -290,7 +290,5 @@ This document is intentionally limited to local source builds for development.
Out of scope:

- `deno task build:npm`
- `deno task build:jsr`
- `npm publish`
- `deno publish`
- release tagging and package publishing workflows
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# clayterm
# @bomb.sh/tty

A low-level, platform-independent terminal renderer and event parser for
JavaScript. You can use clayterm directly, or as the foundation for your own
framework.
JavaScript. You can use `@bomb.sh/tty` directly, or as the foundation for your
own framework.

## Features

**Declarative terminal UI** — Build terminal interfaces the same way you'd build
a web page. Clayterm uses [Clay](https://github.com/nicbarker/clay) under the
hood, giving you flexbox-like layout, pointer detection, and scroll containers —
all rendered to the terminal as box-drawing characters and ANSI escape
sequences.
a web page. `@bomb.sh/tty` uses [Clay](https://github.com/nicbarker/clay) under
the hood, giving you flexbox-like layout, pointer detection, and scroll
containers — all rendered to the terminal as box-drawing characters and ANSI
escape sequences.

**Zero I/O** — Clayterm never reads stdin or writes stdout. You feed it bytes
and get bytes back. This makes it trivially embeddable in any framework, any
runtime, any event loop. There are no opinions about how you do I/O, just pure
computation.
**Zero I/O** — `@bomb.sh/tty` never reads stdin or writes stdout. You feed it
bytes and get bytes back. This makes it trivially embeddable in any framework,
any runtime, any event loop. There are no opinions about how you do I/O, just
pure computation.

**Runs everywhere** — The entire engine is compiled to WebAssembly, so clayterm
will run anywhere JavaScript runs with no native dependencies, and no build step
for consumers.
**Runs everywhere** — The entire engine is compiled to WebAssembly, so
`@bomb.sh/tty` will run anywhere JavaScript runs with no native dependencies,
and no build step for consumers.

### Examples

See this keyboard example and more in the [examples folder](examples/README.md).
This demo uses Clayterm for all layout and input parsing.
This demo uses `@bomb.sh/tty` for all layout and input parsing.

#### Keyboard Events

Expand All @@ -42,9 +42,9 @@ state. Clay drives the hit testing; no manual coordinate math required.

## Architecture

Clayterm does not do any I/O itself. On the ouput side, it converts UI elements
into a raw sequence of bytes and pointer events, and on the input side, it
converts a stream of raw bytes into structured events.
`@bomb.sh/tty` does not do any I/O itself. On the ouput side, it converts UI
elements into a raw sequence of bytes and pointer events, and on the input side,
it converts a stream of raw bytes into structured events.

### Output

Expand Down Expand Up @@ -117,7 +117,7 @@ To render this:
```

```typescript
import { close, createTerm, grow, open, rgba, text } from "clayterm";
import { close, createTerm, grow, open, rgba, text } from "@bomb.sh/tty";

let term = await createTerm({ width: 80, height: 24 });

Expand Down Expand Up @@ -146,8 +146,8 @@ process.stdout.write(output);

### Pointer detection

Pass pointer state to `render()` to have clayterm do hit detection and return
pointer events in addition to the byte sequence.
Pass pointer state to `render()` to have `@bomb.sh/tty` do hit detection and
return pointer events in addition to the byte sequence.

```typescript
let { output, events } = term.render(
Expand Down Expand Up @@ -186,7 +186,7 @@ process.stdout.write(output);
### Input parsing

```typescript
import { createInput } from "clayterm/input";
import { createInput } from "@bomb.sh/tty/input";

let input = await createInput({ escLatency: 25 });

Expand Down
7 changes: 1 addition & 6 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "@clayterm/clayterm",
"name": "@bomb.sh/tty",
"license": "MIT",
"tasks": {
"test": "deno test",
"fmt": "deno fmt && clang-format -i src/*.c src/*.h",
"fmt:check": "deno fmt --check && clang-format --dry-run --Werror src/*.c src/*.h",
"build:npm": "deno run -A tasks/build-npm.ts",
"build:jsr": "deno run -A tasks/build-jsr.ts",
"bench": "deno run -A bench/mod.ts"
},
"imports": {
Expand All @@ -23,10 +22,6 @@
".": "./mod.ts",
"./validate": "./validate.ts"
},
"publish": {
"include": ["*.ts"],
"exclude": ["!wasm.ts"]
},
"nodeModulesDir": "auto",
"fmt": {
"exclude": ["clay", "build"]
Expand Down
2 changes: 1 addition & 1 deletion lint/prefer-let.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type VariableDeclaration = Deno.lint.VariableDeclaration;

const plugin: Deno.lint.Plugin = {
name: "clayterm",
name: "tty",
rules: {
"prefer-let": {
create(context) {
Expand Down
2 changes: 1 addition & 1 deletion ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function packString(
let next = o + 4 + paddedLength;
if (next > end) {
throw new RangeError(
`clayterm transfer buffer capacity exceeded while packing ${context} ` +
`transfer buffer capacity exceeded while packing ${context} ` +
`(${next} byte offset, ${end} byte limit). ` +
`Render a smaller visible slice or reduce frame content.`,
);
Expand Down
15 changes: 0 additions & 15 deletions tasks/build-jsr.ts

This file was deleted.

6 changes: 3 additions & 3 deletions tasks/build-npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ await build({
},
skipSourceOutput: true,
package: {
name: "clayterm",
name: "@bomb.sh/tty",
version,
description:
"A terminal rendering backend for Clay, compiled to WebAssembly",
license: "MIT",
repository: {
type: "git",
url: "git+https://github.com/bombshell-dev/clayterm.git",
url: "git+https://github.com/bombshell-dev/tty.git",
},
bugs: {
url: "https://github.com/bombshell-dev/clayterm/issues",
url: "https://github.com/bombshell-dev/tty/issues",
},
engines: {
node: ">= 22",
Expand Down
Loading