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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ bottom of the window.

<img src="opencode/preview.png" alt="Pulse in the opencode sidebar" width="720">

Add it to `~/.config/opencode/tui.json` and restart opencode:
In opencode v2, run `opencode plugin add opencode-pulse-ticker`. In opencode v1
(1.15+), add it to `~/.config/opencode/tui.json` and restart opencode:

```json
{ "plugin": ["opencode-pulse-ticker"] }
Expand Down
22 changes: 14 additions & 8 deletions opencode/AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Pulse for opencode

- An opencode TUI plugin (npm package `opencode-pulse-ticker`, entry
`exports["./tui"]` = `src/tui.tsx`). opencode compiles the TSX with its own
Solid runtime, so ship source, no build step and no runtime dependencies.
Use only `@opencode-ai/plugin/tui` APIs that exist since opencode 1.15
(`slots`, `keymap.registerLayer`, `kv`, `lifecycle`, `ui`), and test in a real
opencode before release.
`exports["./tui"]` = `src/tui.tsx`) for both opencode lines. opencode compiles
the TSX with its own Solid runtime, so ship source, no build step and no
runtime dependencies. `src/tui.tsx` exports `{ id, tui, setup }`: v1
(`opencode-ai` 1.15+) calls `tui` (`src/v1.tsx`: `@opencode-ai/plugin/tui`
`slots`, `keymap.registerLayer`, `kv`, `lifecycle`, `ui`), v2 (`@opencode/cli`
2.x) calls `setup` (`src/v2.tsx`: `@opencode/plugin/tui` `ui.slot`,
`keymap.layer`, `storage.store`, promise dialogs). Both render the views in
`src/view.tsx`. v2's `storage.store` updates only after its file is written,
so `v2.tsx` keeps an unsaved edit in memory until then. Test both lines in a
real opencode before release.
- `src/quotes.js` and `src/watchlist.js` are copies of the Herdr mod's
(`herdr/pulse/mods/pulse/`): only the header comment and `PULSE_URLS` differ,
and a test checks it. Change both copies together. Keep them and
Expand All @@ -18,10 +23,11 @@
- Respect Yahoo cooldowns; never show cached data as fresh or unknown delay as
real time. Crypto never waits on Yahoo.
- The quote band shows quotes only, never a Pulse for Mac link, and uses only
slots opencode adds content to (`app_bottom`, `*_prompt_right`). Never replace
opencode's own UI (`session_prompt`, `home_prompt`, `home_logo` etc.).
slots opencode adds content to (v1 `app_bottom`, `*_prompt_right`; v2 `append`
to `app`, `prompt.footer`, `sidebar.content`). Never replace opencode's own UI
(v1 `session_prompt`, `home_prompt`, `home_logo`; v2 `replace` claims).
- `preview.png` must be a screenshot of the real plugin running in opencode.
- Releases: bump `version` in `package.json` and `VERSION` in `src/tui.tsx`
- Releases: bump `version` in `package.json` and `VERSION` in `src/view.tsx`
together (a test checks they match), merge to main, then push the tag
`opencode-v<version>`. `.github/workflows/release-opencode.yml` checks the tag,
tests, publishes to npm with provenance through npm trusted publishing
Expand Down
34 changes: 28 additions & 6 deletions opencode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ Finance, crypto pairs (`BTC/USDT`) from Binance's public Spot data.

## Install

Requires opencode 1.15 or later. Add the plugin to `tui.json`
Works with both opencode lines: v1 (`opencode-ai` 1.15 or later) and v2
(`@opencode/cli` 2.x).

**opencode v2:** run `opencode plugin add opencode-pulse-ticker`, or add it to
`~/.config/opencode/cli.json` yourself:

```json
{
"plugins": ["opencode-pulse-ticker"]
}
```

**opencode v1:** add the plugin to `tui.json`
(`~/.config/opencode/tui.json` for every project, or `.opencode/tui.json` in one):

```json
Expand All @@ -23,7 +35,15 @@ Requires opencode 1.15 or later. Add the plugin to `tui.json`

Restart opencode and open a session: Pulse appears in the sidebar. To start
from your own list instead of the starter one (AAPL, NVDA, ^GSPC, BTC/USDT),
pass it as an option:
pass it as an option. In v2's `cli.json`:

```json
{
"plugins": [{ "package": "opencode-pulse-ticker", "options": { "symbols": ["AAPL", "0700.HK", "^GSPC", "BTC/USDT"], "placement": "bottom" } }]
}
```

In v1's `tui.json`:

```json
{
Expand All @@ -36,7 +56,7 @@ pass it as an option:
| `placement` | Where |
| --- | --- |
| `bottom` (default) | The bottom line of the window, on every screen |
| `right` | Right of the model name inside the prompt, first two tickers |
| `right` | In the prompt's footer, on the right (v1: right of the model name), first two tickers |
| `off` | No band; the sidebar only |

## Use
Expand All @@ -62,7 +82,7 @@ earlier day carries its date, and a delay Yahoo does not state is shown as

Pulse sends read-only requests to two hosts, `query1.finance.yahoo.com` and
`data-api.binance.vision`, with the tickers on your list and nothing else. Your
watchlist stays in opencode's own state on your computer. The only program the
watchlist stays in opencode's own storage on your computer. The only program the
plugin starts is your system's browser (`open`, `xdg-open` or `start`), and
only when you click "Pulse for Mac".

Expand All @@ -76,14 +96,16 @@ Want the same watchlist in your menu bar, with charts and positions?

## Development

Point `tui.json` at your checkout and restart opencode after each change:
In opencode v2, link your checkout into a project's `.opencode/plugins/`
(`ln -s /path/to/Pulse/opencode .opencode/plugins/pulse`); v2 reloads it on
save. In v1, point `tui.json` at it and restart opencode after each change:

```json
{ "plugin": ["/path/to/Pulse/opencode"] }
```

`node --test opencode/tests/*.test.mjs` from the repository root runs the tests.
To release, bump the version in `package.json` and `src/tui.tsx`, merge, and
To release, bump the version in `package.json` and `src/view.tsx`, merge, and
push the tag `opencode-v<version>`: GitHub Actions publishes to npm with
provenance (trusted publishing, no token) and creates a GitHub release.
`src/quotes.js` and `src/watchlist.js` are shared with the Herdr mod; see
Expand Down
2 changes: 1 addition & 1 deletion opencode/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-pulse-ticker",
"version": "0.1.0",
"version": "0.2.0",
"description": "Stock and crypto quotes in the opencode sidebar, from the makers of Pulse for Mac",
"type": "module",
"license": "MIT",
Expand Down
Loading
Loading