Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
ae6bfcf
📝 add scroll specification and implementation
cowboyd Apr 20, 2026
3c5fee2
📝 add transitions design specification
cowboyd Apr 22, 2026
f7bf413
⬆️ bump Clay submodule to latest main (transitions API)
cowboyd Apr 22, 2026
5b4216f
🔧 adapt clayterm to new Clay signatures (OpenTextElement, EndLayout)
cowboyd Apr 22, 2026
272acd0
⬆️ pin Clay to 938967a (work around upstream CLAY_WASM_EXPORT typo)
cowboyd Apr 22, 2026
04ae09c
✨ add deltaTime parameter to reduce()
cowboyd Apr 22, 2026
db1a124
🔧 add deltaTime to Native.reduce signature
cowboyd Apr 22, 2026
00db8aa
✨ track deltaTime on Term, accept deltaTime override
cowboyd Apr 22, 2026
e486d56
✨ add animating_count to Clayterm context
cowboyd Apr 22, 2026
7b3afcb
🔧 expose animating() via Native binding
cowboyd Apr 22, 2026
1aa74a3
✨ surface animating: boolean on RenderResult
cowboyd Apr 22, 2026
0be2409
📝 rewrite transitions spec for v1 (Clay-supported subset)
cowboyd Apr 22, 2026
c239543
✨ add transition property names, bitmask helpers, and Easing
cowboyd Apr 22, 2026
015349c
✨ add transition field type to OpenElement
cowboyd Apr 22, 2026
7eea069
✨ encode transition block in pack()
cowboyd Apr 22, 2026
c18a97b
✨ register Clay handlers, interpolate on property change
cowboyd Apr 22, 2026
cbd6109
✨ reset deltaTime to 0 after idle (preserve transitions across long g…
cowboyd Apr 23, 2026
7325164
✅ verify color transitions work in line mode
cowboyd Apr 23, 2026
9e273d4
🎨 apply deno fmt and clang-format
cowboyd Apr 23, 2026
31ce2cb
✨ add transitions demo (collapsing sidebar)
cowboyd Apr 23, 2026
83decb4
📝 reference transitions-spec from renderer-spec
cowboyd Apr 23, 2026
53bc723
✨ rewrite transitions demo as interactive full-screen menu
cowboyd Apr 23, 2026
896435c
✨ add clay-transitions demo port (v1-compatible subset)
cowboyd Apr 23, 2026
10d38ab
🎨 let clay-transitions demo rows fill available height
cowboyd Apr 23, 2026
8730e55
🎨 remove modeline from clay-transitions demo
cowboyd Apr 23, 2026
c6c7f87
📝 note ct_active_context is a workaround for Clay userData PR
cowboyd Apr 23, 2026
b7eb6bb
🎨 use border-only boxes in clay-transitions demo
cowboyd Apr 23, 2026
03058a3
🎨 prevent menu text from wrapping during sidebar transition
cowboyd Apr 23, 2026
949dea5
🔥 drop unused grow import in transitions-run test
cowboyd Apr 23, 2026
a44b553
docs: add maintainer build guide
rauhryan May 9, 2026
bd2dcc9
feat: expand floating parameters
rauhryan May 9, 2026
d386e17
🐛 add memmove shim for wasm builds
rauhryan May 9, 2026
264616b
💄 format build docs
rauhryan May 9, 2026
a62376d
🐛 improve pack string overflow errors
rauhryan May 10, 2026
ea34f5b
♻️ use string literals for floating options
rauhryan May 10, 2026
da915f5
Merge PR #27 transitions
rauhryan May 10, 2026
fe6026b
Merge PR #28 build docs
rauhryan May 10, 2026
18a2486
Merge PR #29 floating parameters
rauhryan May 10, 2026
bb508c7
Merge PR #32 memmove shim
rauhryan May 10, 2026
4d09e0c
Merge PR #33 descriptive pack errors
rauhryan May 10, 2026
56f16bd
Merge PR #25 scroll specification
rauhryan May 10, 2026
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
14 changes: 14 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
- The workflow is: propose the spec change, wait for approval, then implement.
Do not combine spec changes with implementation in a single step.

- During implementation, the spec is the sole authority. Do not add APIs,
exports, parameters, or architectural elements that are not described in the
spec — even if an implementation plan or subagent recommends them. If the spec
is insufficient, update the spec first.

- If an implementation requires changing any API boundary — public TS exports,
WASM exports, function signatures, the command protocol, or any interface that
crosses a module boundary — stop and consult the user before proceeding. Do
not rationalize changes as "internal." If it has a signature, it's an API.

- The renderer and input parser are specified separately (`renderer-spec.md` and
`input-spec.md`). They are architecturally independent. Do not introduce
dependencies between them.
Expand All @@ -26,6 +36,10 @@
Do not include any agent marketing material (e.g. "Generated with...",
"Co-Authored-By: \<agent>") in commits, pull requests, issues, or comments.

Before every commit, run `deno fmt` and `deno lint` and fix any issues. For C
files, also run `clang-format -i src/*.c src/*.h`. Do not commit unformatted
code.

## Rendering invariants

- The renderer MUST NOT perform IO. It produces bytes; the caller writes them.
Expand Down
296 changes: 296 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
# Building clayterm from source

This guide is for maintainers and builders working on clayterm itself.

It covers:

- cloning the repo correctly,
- initializing the `clay` git submodule,
- installing the toolchain needed to compile the C sources to WebAssembly,
- building the local development artifacts, and
- verifying that the repo is ready for development.

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

## What the local build produces

The local source build is driven by `make`.

It generates:

- `clayterm.wasm` — the compiled WebAssembly module built from the C sources
- `wasm.ts` — a generated TypeScript file derived from `clayterm.wasm`

`wasm.ts` is generated output, not hand-maintained source.

## Clone the repo with submodules

The build depends on the `clay` git submodule.

Preferred fresh clone:

```sh
git clone --recurse-submodules https://github.com/thefrontside/clayterm.git
cd clayterm
```

If you already cloned without submodules:

```sh
git submodule update --init --recursive
```

Quick check:

```sh
git submodule status --recursive
```

You should also see a populated `clay/` directory. If `clay/` is missing or
empty, fix the submodule state before building.

## Required tools

You need:

- `git`
- `make`
- `clang` with wasm32-capable support
- `deno`

Equivalent packages are fine if your package manager uses different names.

## Install the toolchain

### macOS

Install Apple's command line tools first. They provide the base developer tools,
including `git` and `make`.

```sh
xcode-select --install
```

Then install LLVM and Deno with Homebrew:

```sh
brew install llvm deno
```

Use Homebrew LLVM before Apple's system `clang` when building clayterm:

```sh
echo 'export PATH="$(brew --prefix llvm)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
```

If you do not already have `git` available after installing the command line
tools, install it with Homebrew:

```sh
brew install git
```

### Debian / Ubuntu

Install the build toolchain and Git:

```sh
sudo apt-get update
sudo apt-get install -y build-essential clang lld git curl
```

Install Deno with the official installer:

```sh
curl -fsSL https://deno.land/install.sh | sh
```

Add Deno to your shell path:

```sh
echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

### Fedora / RHEL

Install the build toolchain and Git:

```sh
sudo dnf install -y clang lld make git curl
```

Install Deno with the official installer:

```sh
curl -fsSL https://deno.land/install.sh | sh
```

Add Deno to your shell path:

```sh
echo 'export PATH="$HOME/.deno/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

### Windows

The recommended Windows build-host path is **WSL2 with Ubuntu**.

From an elevated PowerShell prompt:

```powershell
wsl --install -d Ubuntu
```

Then open the Ubuntu environment and follow the **Debian / Ubuntu** instructions
above.

The build host runs inside WSL2, but the resulting WebAssembly artifacts are
intended to run on **native Windows** at runtime.

## Verify the toolchain

Before building, confirm the required tools are available:

```sh
git --version
make --version
clang --version
deno --version
```

For a quick wasm-target smoke test, make sure `clang` can compile for `wasm32`:

```sh
clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o
rm -f /tmp/clayterm-wasm-test.o
```

On macOS, if `which clang` still points to `/usr/bin/clang` and the wasm test
fails, make sure the Homebrew LLVM `bin/` directory is at the front of your
`PATH`.

## Build from source

Run the local source build from the repository root:

```sh
make
```

This should produce:

- `clayterm.wasm`
- `wasm.ts`

For a clean rebuild:

```sh
make clean && make
```

## When to rebuild

Re-run `make` when:

- you change files under `src/`
- you update the `clay` submodule
- `clayterm.wasm` or `wasm.ts` is missing
- generated outputs look stale after switching branches or pulling changes

When in doubt, use a clean rebuild:

```sh
make clean && make
```

## Verify the build

After `make` succeeds, run the test suite:

```sh
deno task test
```

Before opening a PR, it is also a good idea to run the same checks CI runs:

```sh
deno task fmt:check
deno lint
```

## Troubleshooting

### `clay/` is missing or empty

Symptoms may include build failures such as:

- `fatal error: '../clay/clay.h' file not found`

Recovery:

```sh
git submodule update --init --recursive
```

Then verify the submodule state and rebuild:

```sh
git submodule status --recursive
make clean && make
```

### `clang` cannot target `wasm32`

Symptoms may include:

- target-related `clang` errors mentioning `wasm32`
- linker failures while producing `clayterm.wasm`

Recovery:

- make sure you are using an LLVM/Clang build with wasm support
- on macOS, prefer the Homebrew `llvm` toolchain over `/usr/bin/clang`
- on Linux/WSL2, make sure both `clang` and `lld` are installed
- rerun the wasm smoke test:

```sh
clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o
rm -f /tmp/clayterm-wasm-test.o
```

If the smoke test fails, fix the toolchain first and only then rerun `make`.

### Generated artifacts are missing or stale

Symptoms may include:

- `clayterm.wasm` is missing
- `wasm.ts` is missing
- you changed `src/` or updated `clay/`, but the generated outputs do not match

Recovery:

```sh
make clean && make
```

Then verify the repo is in a good state:

```sh
deno task test
```

## Scope note

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
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,12 @@ process.stdin.on("data", (buf) => {

## Development

Requires `clang` with wasm32 target support.
For local source builds, toolchain setup, and `clay` submodule instructions, see
[BUILD.md](BUILD.md).

First build the `.wasm`
Quick local validation:

```sh
make
```

run tests

```sh
deno task test
```
Loading
Loading