Skip to content
Open
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
47 changes: 42 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to npm
name: Publish packages

on:
workflow_dispatch:
Expand All @@ -7,13 +7,25 @@ on:
description: Git ref to publish
required: true
default: main
package:
description: Package to publish
required: true
default: all
type: choice
options:
- all
- opentui
- app
- pi

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
SKIP_INSTALL_SIMPLE_GIT_HOOKS: "1"

steps:
- name: Check out repository
Expand All @@ -24,7 +36,7 @@ jobs:
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.10

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -35,10 +47,35 @@ jobs:
- name: Install dependencies
run: bun install --frozen-lockfile

- name: Verify package
- name: Verify workspace
run: bun run check

- name: Publish package
run: npm publish --access public --provenance
- name: Verify publishable package contents
run: bun run pack:check

- name: Publish selected packages
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
publish_package() {
local package_dir="$1"
echo "Publishing ${package_dir}"
(cd "${package_dir}" && npm publish --access public --provenance)
}

case "${{ inputs.package }}" in
opentui)
publish_package packages/opentui
;;
app)
publish_package packages/app
;;
pi)
publish_package packages/pi
;;
all)
publish_package packages/opentui
publish_package packages/app
publish_package packages/pi
;;
esac
18 changes: 11 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v0.3.0

Splits the published surface into dedicated app, OpenTUI, and Pi packages.

### Highlights

- publishes the standalone terminal app as `@termdraw/app`
- publishes the embeddable OpenTUI package as `@termdraw/opentui`
- publishes the Pi integration as `@termdraw/pi`
- keeps the `termdraw` executable as the main app entrypoint

## v0.2.0

Adds a dedicated select tool for selection-first editing workflows.
Expand All @@ -26,10 +37,3 @@ Initial public release of termDRAW!.
- embeddable OpenTUI React components:
- `TermDrawApp` for the full chrome
- `TermDrawEditor` for the bare editor surface

### Packaging

- publish-ready npm package configuration
- CLI entrypoint exposed as `termdraw`
- package name configured as `@benvinegar/termdraw`
- manual GitHub Actions workflow for npm publishing
152 changes: 50 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,57 @@
# termDRAW!

termDRAW! is an object-based terminal illustrator for diagrams, UI mocks, and terminal-native graphics.
termDRAW! is a terminal drawing editor for developers who want editable diagrams, UI mocks, and text graphics without leaving the terminal.

## Why termDRAW!
## Packages

- Make terminal-native diagrams without leaving your terminal.
- Keep editing as you think: drawn elements stay selectable, movable, and resizable.
- Group related content inside boxes so diagrams stay organized while you iterate.
- Export plain text or fenced Markdown for READMEs, docs, tickets, and agent prompts.
- `@termdraw/app` — the standalone terminal app with the `termdraw` command
- `@termdraw/opentui` — embeddable OpenTUI components and renderables
- `@termdraw/pi` — Pi package that opens termDRAW in a Pi overlay

## Install
## Install the app

Requirements:

- [Bun](https://bun.sh)
- [Bun](https://bun.sh) 1.3+
- A terminal with mouse support

From npm:

```bash
bun add @benvinegar/termdraw
```

Or from source:

```bash
git clone https://github.com/benvinegar/termdraw.git
cd termdraw
bun install
npm install --global @termdraw/app
```

## Quick start

Start the app from a local checkout:

```bash
bun run start
```

Or run the published CLI:

```bash
bunx @benvinegar/termdraw
```

Draw something, then press `Enter` or `Ctrl+S` to save. By default, termDRAW! writes the result to stdout after the app exits.

Write directly to a file:

```bash
bun run start -- --output diagram.txt
termdraw
```

Export as a fenced Markdown code block:
Draw something, then press `Enter` or `Ctrl+S` to write the result to stdout.

```bash
bun run start -- --fenced > diagram.md
```

Show CLI help:
## App usage

```bash
bun run start -- --help
```

## Usage

termDRAW! behaves more like a small vector-style editor than a paint program. Lines, boxes, and text are retained objects, so you can keep rearranging the diagram after you draw it. Boxes can also act as frames for fully contained children.

Everything still snaps to terminal cells. termDRAW! outputs terminal art, not SVG or bitmap graphics.
# save plain text directly to a file
termdraw --output diagram.txt

Controls are shown in the app footer and tool palette.
# export a fenced Markdown code block
termdraw --fenced > diagram.md

## Output examples

Plain text to stdout:

```bash
bun run start > drawing.txt
# show CLI help
termdraw --help
```

Plain text to a file:

```bash
bun run start -- --output drawing.txt
```
termDRAW! outputs terminal text, not SVG or bitmap graphics.

Markdown fenced output:
## Embed in an OpenTUI app

```bash
bun run start -- --fenced > drawing.md
npm install @termdraw/opentui @opentui/core @opentui/react react
```

## Embedding

termDRAW! can also be mounted as OpenTUI React components inside another terminal app.

- `TermDrawApp`: the full app chrome with header, palette, footer, and splash
- `TermDrawEditor`: the bare editor surface without the surrounding app chrome
- `TermDraw`: an alias for `TermDrawApp`

Full chrome:

```tsx
import { createCliRenderer } from "@opentui/core";
import { createRoot } from "@opentui/react";
import { TermDrawApp } from "@benvinegar/termdraw";
import { TermDrawApp } from "@termdraw/opentui";

const renderer = await createCliRenderer({
useMouse: true,
Expand All @@ -129,29 +75,34 @@ createRoot(renderer).render(
);
```

Bare editor surface:
Also exported from `@termdraw/opentui`:

```tsx
import { TermDrawEditor } from "@benvinegar/termdraw";
- `TermDrawApp`
- `TermDrawEditor`
- `TermDraw`
- `TermDrawAppRenderable`
- `TermDrawEditorRenderable`
- `TermDrawRenderable`
- `formatSavedOutput`
- `buildHelpText`

<TermDrawEditor width="100%" height="100%" autoFocus onSave={(art) => console.log(art)} />;
```
## Use it in Pi

## Development
```bash
pi install npm:@termdraw/pi
```

This repo is organized as a small workspace:
Then inside Pi:

- `packages/tui` — the main `@benvinegar/termdraw` OpenTUI app/library package
- `packages/pi` — the Pi embedding prototype package
```text
/termdraw
```

From the repo root, the main scripts still proxy to the TUI package and shared checks:
## Docs

```bash
bun run format
bun run lint
bun test
bun run typecheck
```
- App package: [`packages/app`](https://github.com/benvinegar/termdraw/tree/main/packages/app)
- OpenTUI package: [`packages/opentui`](https://github.com/benvinegar/termdraw/tree/main/packages/opentui)
- Pi package: [`packages/pi`](https://github.com/benvinegar/termdraw/tree/main/packages/pi)

## Contributing

Expand All @@ -160,19 +111,16 @@ Contributions are welcome.
Before opening a PR:

- keep the change focused
- run `bun run format`, `bun run lint`, `bun test`, and `bun run typecheck`
- add or update tests when you change editor behavior
- open an issue first for larger UX or architecture changes
- run `bun run check`
- add or update tests when editor behavior changes
- open an issue first for larger UX or API changes

## License

MIT. See [LICENSE](LICENSE).
## Security

## Publishing note
Please report security issues privately through GitHub Security Advisories:

The unscoped `termdraw` package name is already taken on npm, so this package is configured to publish as `@benvinegar/termdraw`.
- <https://github.com/benvinegar/termdraw/security/advisories/new>

## Support
## License

- Bugs and feature requests: [GitHub issues](https://github.com/benvinegar/termdraw/issues)
- Source: [github.com/benvinegar/termdraw](https://github.com/benvinegar/termdraw)
MIT. See [LICENSE](LICENSE).
Loading