@carlesandres/house 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +99 -0
  4. package/package.json +67 -0
  5. package/src/Browser.tsx +472 -0
  6. package/src/Footer.tsx +151 -0
  7. package/src/HelpOverlay.tsx +130 -0
  8. package/src/cli/argv.ts +106 -0
  9. package/src/discovery/filter.ts +56 -0
  10. package/src/discovery/walk.ts +143 -0
  11. package/src/index.tsx +265 -0
  12. package/src/io/readFile.ts +14 -0
  13. package/src/keymap/browser.ts +229 -0
  14. package/src/keymap/keymap.ts +86 -0
  15. package/src/serve/css.ts +120 -0
  16. package/src/serve/openBrowser.ts +19 -0
  17. package/src/serve/render.ts +56 -0
  18. package/src/serve/server.ts +163 -0
  19. package/src/theme/atom.ts +23 -0
  20. package/src/theme/colors.ts +79 -0
  21. package/src/theme/loader.ts +110 -0
  22. package/src/theme/registry.ts +12 -0
  23. package/src/theme/resolve.ts +168 -0
  24. package/src/theme/themes/aura.json +58 -0
  25. package/src/theme/themes/ayu.json +69 -0
  26. package/src/theme/themes/carbonfox.json +201 -0
  27. package/src/theme/themes/catppuccin-frappe.json +186 -0
  28. package/src/theme/themes/catppuccin-macchiato.json +186 -0
  29. package/src/theme/themes/catppuccin.json +212 -0
  30. package/src/theme/themes/cobalt2.json +181 -0
  31. package/src/theme/themes/cursor.json +202 -0
  32. package/src/theme/themes/dracula.json +172 -0
  33. package/src/theme/themes/everforest.json +194 -0
  34. package/src/theme/themes/flexoki.json +190 -0
  35. package/src/theme/themes/github.json +186 -0
  36. package/src/theme/themes/gruvbox.json +195 -0
  37. package/src/theme/themes/kanagawa.json +180 -0
  38. package/src/theme/themes/lucent-orng.json +186 -0
  39. package/src/theme/themes/material.json +188 -0
  40. package/src/theme/themes/matrix.json +180 -0
  41. package/src/theme/themes/mercury.json +198 -0
  42. package/src/theme/themes/monokai.json +174 -0
  43. package/src/theme/themes/nightowl.json +174 -0
  44. package/src/theme/themes/nord.json +176 -0
  45. package/src/theme/themes/one-dark.json +184 -0
  46. package/src/theme/themes/opencode.json +198 -0
  47. package/src/theme/themes/orng.json +202 -0
  48. package/src/theme/themes/osaka-jade.json +193 -0
  49. package/src/theme/themes/palenight.json +175 -0
  50. package/src/theme/themes/rosepine.json +187 -0
  51. package/src/theme/themes/solarized.json +176 -0
  52. package/src/theme/themes/synthwave84.json +179 -0
  53. package/src/theme/themes/tokyonight.json +196 -0
  54. package/src/theme/themes/vercel.json +198 -0
  55. package/src/theme/themes/vesper.json +171 -0
  56. package/src/theme/themes/zenburn.json +176 -0
  57. package/src/theme/types.ts +109 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,179 @@
1
+ # Changelog
2
+
3
+ All notable changes to house (renamed from `openmdr` in 0.3.0) land here. Format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project
5
+ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) from
6
+ v0.1.0 onward.
7
+
8
+ The publish workflow (`.github/workflows/publish.yml`) runs on the
9
+ `release: published` event, runs `npm publish` via Trusted Publisher,
10
+ and lets GitHub auto-generate release notes from commit subjects; this
11
+ file is the curated, narrative version.
12
+
13
+ ## [Unreleased]
14
+
15
+ ## [0.3.0] — 2026-05-16
16
+
17
+ ### Changed
18
+
19
+ - **Project renamed from `openmdr` to `house`.** The npm package is now
20
+ `@carlesandres/house`; `@carlesandres/openmdr` is deprecated and will
21
+ not receive further releases. The CLI binary is now `house` (was
22
+ `openmdr`). The GitHub repository moved to
23
+ `https://github.com/carlesandres/house`; GitHub auto-redirects old
24
+ URLs and issue/PR numbers are preserved. The theme schema file moved
25
+ to `schema/house-theme.schema.json` and its `$id` is now a GitHub URL
26
+ on the new repo.
27
+ - `/` is no longer reserved (DESIGN.md §7.3) — it now drives the filter
28
+ input.
29
+
30
+ ### Added
31
+
32
+ - `--sort <mode>` flag selecting the per-directory group order in the
33
+ sidebar. `dirs-first` (the existing default) keeps directories above
34
+ files; `files-first` flips it, surfacing top-level files like
35
+ `README.md` before nested subtrees.
36
+ - `/` opens a filter input at the bottom of the sidebar. Typed
37
+ characters narrow the list with a fuzzy subsequence match on the
38
+ file's relative path; matches are re-ranked by score (word-boundary
39
+ and consecutive-character bonuses). Esc clears the query and closes
40
+ the filter; Return closes it and focuses the reader on the highlighted
41
+ match.
42
+
43
+ ## [0.2.1] — 2026-05-13
44
+
45
+ ### Added
46
+
47
+ - Footer hint row in the browser pane, generated from the keymap so the
48
+ visible hints stay in sync with the bindings.
49
+ - `ROADMAP.md` as the single index of planned work; footer/header chrome
50
+ issues registered there.
51
+
52
+ ### Changed
53
+
54
+ - Sidebar toggle rebound from `\` to `s`.
55
+ - Help overlay: theme keys (`t` / `T` / `L`) now cycle while the overlay
56
+ is open; the help hint label switches to `close` while the overlay is
57
+ showing.
58
+ - `DESIGN.md` §5.3 expanded with competitive-review gaps; keys reserved
59
+ for history and bookmarks.
60
+
61
+ ### Fixed
62
+
63
+ - Footer falls back to the bare first key on ultra-narrow viewports.
64
+ - `q` quit is stubbed on the help-open context (regression-tested).
65
+
66
+ ## [0.2.0] — 2026-05-11
67
+
68
+ ### Added — themes
69
+
70
+ - **33 bundled JSON themes** selectable via `--theme <id>`: `aura`, `ayu`,
71
+ `carbonfox`, `catppuccin`, `catppuccin-frappe`, `catppuccin-macchiato`,
72
+ `cobalt2`, `cursor`, `dracula`, `everforest`, `flexoki`, `github`,
73
+ `gruvbox`, `kanagawa`, `lucent-orng`, `material`, `matrix`, `mercury`,
74
+ `monokai`, `nightowl`, `nord`, `one-dark`, `opencode`, `orng`,
75
+ `osaka-jade`, `palenight`, `rosepine`, `solarized`, `synthwave84`,
76
+ `tokyonight`, `vercel`, `vesper`, `zenburn`. Token values sourced
77
+ directly from each upstream's canonical palette via
78
+ `dev/build-themes.ts`.
79
+ - **`--tone dark|light`** flag to select the variant of a theme. Defaults
80
+ to `dark`. Not all themes have a well-tuned light variant; quality is
81
+ best-effort for those.
82
+ - **JSON theme format**: each theme is a `{defs, theme: {dark, light}}`
83
+ file validated against `schema/openmdr-theme.schema.json`. The format
84
+ mirrors opencode's TUI theme shape; `defs` supports variable
85
+ substitution.
86
+ - **`dev/build-themes.ts`**: fetches themes from the opencode GitHub API,
87
+ strips diff tokens, resolves variables, and regenerates `src/theme/loader.ts`.
88
+ Supports `GITHUB_TOKEN` and `--dry-run`. Not shipped in the npm package.
89
+ - **Runtime theme cycling**: press `t` / `T` to step forward / backward
90
+ through all themes without restarting. Press `L` (shift+l) to toggle
91
+ between dark and light tone. Works in both browser mode and single-file
92
+ mode. Theme changes take effect immediately; syntax highlighting
93
+ rebuilds with the new palette.
94
+
95
+ ### Changed
96
+
97
+ - Theme system replaced: derivation engine (`derive.ts`) and the 12
98
+ TS-value themes removed in favour of the JSON format above. The
99
+ `ColorPalette` interface is unchanged; existing consumers (`Browser`,
100
+ `App`, `HelpOverlay`) required no changes beyond the re-render wiring.
101
+ - `--theme` default changed from `dark` to `opencode` (the opencode
102
+ project's own palette).
103
+ - Effect Atoms (`@effect/atom-react`) wired for re-render signalling:
104
+ `themeAtom` holds `{ id, tone }`; `RegistryProvider` wraps both render
105
+ paths in `index.tsx`.
106
+
107
+ ## [0.1.0] — 2026-05-10
108
+
109
+ The v1 MVP, published as `@carlesandres/openmdr` on npm.
110
+
111
+ ### Added — TUI
112
+
113
+ - Two-pane browser: sidebar + reader, with a focus model, sidebar
114
+ visibility toggle (`\`), and a `?` help overlay generated from the
115
+ bindings array.
116
+ - Single-file mode when invoked on a file path.
117
+ - Themes: dark + light as typed `ColorPalette` values, mutable singleton
118
+ consumer, selected via `--theme`.
119
+
120
+ ### Added — discovery
121
+
122
+ - Recursive walk from the path argument (or cwd), `.md` / `.markdown` /
123
+ `.mdx` only.
124
+ - Honors `.gitignore` (root + nested).
125
+ - Hard-skips `node_modules`, `.git`, `.venv` (always, even with `--all`).
126
+ - Does not follow symlinks.
127
+
128
+ ### Added — CLI
129
+
130
+ - `--help`, `--version`, `--width <N>`, `--all`, `--theme <id>`.
131
+
132
+ ### Added — keymap
133
+
134
+ - `KeyBinding[]` with `id` / `description` / `keys` / `group` / optional
135
+ `when` / `run`. Single source for both `useKeyboard` dispatch and the
136
+ help overlay.
137
+ - Bindings: `j`/`k` + arrows, shift-jump, page/half-page, `g`/`G`,
138
+ `return`/`l`/`→`, `escape`/`h`/`←`, `[`/`]`, `tab`, `\`, `?`,
139
+ `q`/`ctrl+c`. Reserved (not bound): `/`, `e`, `o`, `r`.
140
+
141
+ ### Added — release infra
142
+
143
+ - Distribution as `@carlesandres/openmdr` on npm (Bun runtime required
144
+ on user's `PATH`, no compiled binary). Modeled on ghui.
145
+ - `.github/workflows/ci.yml`: typecheck, lint, format:check, test,
146
+ and `npm pack --dry-run` on every push and PR.
147
+ - `.github/workflows/publish.yml`: `release: published` triggers
148
+ `npm publish` via Trusted Publisher (OIDC, no token), with a
149
+ tag-vs-`package.json`-version assertion before publish.
150
+ - `.oxfmtrc.json`: pinned formatting so `format:check` is meaningful.
151
+
152
+ ### Added — docs
153
+
154
+ - `DESIGN.md`: foundational design doc (13 sections; §3 non-goals,
155
+ §5.3 deferred, §7.3 reserved keys, §10 v2 gates, §12 deferred
156
+ patterns with triggers).
157
+ - `README.md`, `CONTRIBUTING.md`, `AGENTS.md` (cookbook for AI
158
+ assistants), `LICENSE` (MIT).
159
+ - Issue templates (bug + feature + blank), PR template. All
160
+ communication routes through GitHub issues.
161
+
162
+ ### Added — tests
163
+
164
+ - 75 headless tests via `testRender` + `captureCharFrame` +
165
+ `mockInput`.
166
+
167
+ ### Out of scope (deliberate, see DESIGN.md §3 / §5.3)
168
+
169
+ Search, stdin, URL fetching, cross-file link following, `$EDITOR`
170
+ hand-off, syntax highlighting, persistent config, OS-appearance
171
+ auto-detect, single-binary distribution (issue
172
+ [#2](https://github.com/carlesandres/openmdr/issues/2)),
173
+ Homebrew tap. All tracked.
174
+
175
+ [Unreleased]: https://github.com/carlesandres/house/compare/v0.3.0...HEAD
176
+ [0.3.0]: https://github.com/carlesandres/house/compare/v0.2.1...v0.3.0
177
+ [0.2.1]: https://github.com/carlesandres/house/compare/v0.2.0...v0.2.1
178
+ [0.2.0]: https://github.com/carlesandres/house/compare/v0.1.0...v0.2.0
179
+ [0.1.0]: https://github.com/carlesandres/house/releases/tag/v0.1.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Carles Andres
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # house
2
+
3
+ > **Renamed from `openmdr`.** The old npm package `@carlesandres/openmdr`
4
+ > is deprecated; install `@carlesandres/house` instead. The CLI binary is
5
+ > now `house` (was `openmdr`).
6
+
7
+ A terminal markdown reader built on [opentui](https://github.com/nicholasgasior/opentui).
8
+ Point it at a directory and navigate its `.md` files without leaving the terminal.
9
+
10
+ ```
11
+ npx @carlesandres/house docs/
12
+ ```
13
+
14
+ Requires [Bun](https://bun.sh) on `PATH`.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ npm install -g @carlesandres/house
20
+ # or
21
+ bun add -g @carlesandres/house
22
+ ```
23
+
24
+ ## Upgrade
25
+
26
+ ```bash
27
+ npm update -g @carlesandres/house
28
+ # or
29
+ bun add -g @carlesandres/house
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```
35
+ house [options] <path>
36
+ ```
37
+
38
+ `<path>` can be a directory (walks for `.md` files) or a single `.md` file.
39
+
40
+ ### Options
41
+
42
+ | Flag | Default | Description |
43
+ |------|---------|-------------|
44
+ | `--theme <name>` | `opencode` | Starting theme (see list below) |
45
+ | `--tone dark\|light` | `dark` | Starting tone |
46
+
47
+ ## Keys
48
+
49
+ ### Global
50
+
51
+ | Key | Action |
52
+ |-----|--------|
53
+ | `q` / `ctrl+c` | Quit |
54
+ | `tab` | Toggle focus (sidebar ↔ reader) |
55
+ | `\` | Toggle sidebar visibility |
56
+ | `?` | Show / dismiss help overlay |
57
+ | `t` | Next theme |
58
+ | `T` | Previous theme |
59
+ | `L` | Toggle dark / light tone |
60
+
61
+ ### Sidebar
62
+
63
+ | Key | Action |
64
+ |-----|--------|
65
+ | `j` / `↓` | Move selection down |
66
+ | `k` / `↑` | Move selection up |
67
+ | `J` | Jump down 10 |
68
+ | `K` | Jump up 10 |
69
+ | `space` / `ctrl+d` | Page down |
70
+ | `b` / `ctrl+u` | Page up |
71
+ | `g` | First file |
72
+ | `G` | Last file |
73
+ | `↵` / `→` / `l` | Open file (focus reader) |
74
+
75
+ ### Reader
76
+
77
+ | Key | Action |
78
+ |-----|--------|
79
+ | `esc` / `←` / `h` | Back to sidebar |
80
+ | `[` | Previous file |
81
+ | `]` | Next file |
82
+
83
+ ## Themes
84
+
85
+ 33 built-in themes, all sourced from the
86
+ [opencode](https://github.com/anomalyco/opencode) TUI palette:
87
+
88
+ `aura` · `ayu` · `carbonfox` · `catppuccin` · `catppuccin-frappe` ·
89
+ `catppuccin-macchiato` · `cobalt2` · `cursor` · `dracula` · `everforest` ·
90
+ `flexoki` · `github` · `gruvbox` · `kanagawa` · `lucent-orng` · `material` ·
91
+ `matrix` · `mercury` · `monokai` · `nightowl` · `nord` · `one-dark` ·
92
+ `opencode` · `orng` · `osaka-jade` · `palenight` · `rosepine` · `solarized` ·
93
+ `synthwave84` · `tokyonight` · `vercel` · `vesper` · `zenburn`
94
+
95
+ Each theme supports dark and light tones. Cycle with `t` / `T`; toggle tone with `L`.
96
+
97
+ ## License
98
+
99
+ MIT
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@carlesandres/house",
3
+ "version": "0.3.0",
4
+ "description": "TUI-first markdown reader on opentui",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/carlesandres/house.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/carlesandres/house/issues"
13
+ },
14
+ "homepage": "https://github.com/carlesandres/house#readme",
15
+ "keywords": [
16
+ "markdown",
17
+ "reader",
18
+ "terminal",
19
+ "tui",
20
+ "bun",
21
+ "opentui",
22
+ "glow",
23
+ "house"
24
+ ],
25
+ "files": [
26
+ "src",
27
+ "README.md",
28
+ "LICENSE",
29
+ "CHANGELOG.md"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true,
34
+ "registry": "https://registry.npmjs.org/"
35
+ },
36
+ "bin": {
37
+ "house": "src/index.tsx"
38
+ },
39
+ "scripts": {
40
+ "dev": "bun --watch src/index.tsx",
41
+ "start": "bun run src/index.tsx",
42
+ "typecheck": "tsc --noEmit",
43
+ "lint": "oxlint --tsconfig tsconfig.json src/",
44
+ "format": "oxfmt src/",
45
+ "format:check": "oxfmt --check src/",
46
+ "test": "bun test",
47
+ "build:themes": "bun run dev/build-themes.ts"
48
+ },
49
+ "dependencies": {
50
+ "@effect/atom-react": "4.0.0-beta.59",
51
+ "@opentui/core": "0.2.1",
52
+ "@opentui/react": "0.2.1",
53
+ "effect": "4.0.0-beta.59",
54
+ "ignore": "^7.0.5",
55
+ "marked": "^18.0.3",
56
+ "react": "19.2.5",
57
+ "scheduler": "0.27.0"
58
+ },
59
+ "devDependencies": {
60
+ "@effect/language-service": "0.85.1",
61
+ "@types/bun": "1.3.12",
62
+ "@types/react": "19.2.14",
63
+ "oxfmt": "0.47.0",
64
+ "oxlint": "1.62.0",
65
+ "typescript": "6.0.2"
66
+ }
67
+ }