shijimi-editor 0.0.0-stage → 0.4.2

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +402 -2
  3. package/bin/shj.js +25 -0
  4. package/package.json +25 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mm1995tk
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 CHANGED
@@ -1,3 +1,403 @@
1
- # Temporary Holding Version
1
+ # <img src="manual/docs/assets/icon.png" alt="" width="32" align="top"> shijimi
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ English | [日本語](README.ja.md)
4
+
5
+ An integrated development environment for the terminal (TUI). The screen is laid out like VS Code. For editing you can choose between Helix-style modal editing and modeless VS Code-style keys. The command is `shj`.
6
+
7
+ Manual (English, with a Japanese version): <https://shijimi-manual.pages.dev/> (source in [`manual/`](manual/))
8
+
9
+ The UI is in English by default. To switch it to Japanese, set `ui-language = "ja"` in `config.toml` (see [UI language](#ui-language)).
10
+
11
+ ## Features
12
+
13
+ - **Modal editing and VS Code-style keys**: choose Helix-style modal editing (normal / insert / select, `:` commands) or modeless VS Code-style keys
14
+ - **Multiple cursors** (Helix-style): `C` / `Alt+C` copy the cursor to the line below / above, `s` splits a selection by a regex, `,` goes back to one cursor. Inserting, deleting, `c` and so on apply to every cursor
15
+ - **File tree** (shows Git status as M / U / A)
16
+ - **LSP**: diagnostics, completion, hover, signature help, go to definition, references, rename, code actions, symbol list, formatting
17
+ - **LSP configuration** is written in a `languages.toml` that is compatible with Helix's (`.shijimi-editor/languages.toml` or `~/.config/shijimi-editor/languages.toml`). If you are coming from Helix, copy your `languages.toml` to `~/.config/shijimi-editor/`
18
+ - **Diff mode** (`Space G` / `Ctrl+G` compares with `HEAD`; `Space g` / `:pr` compares with the base of a pull request): switches the whole editor to diff mode. Changed files are listed in a tree (CHANGES), and a changed file opens as the **whole file** in a split (or unified) diff. The right side is editable. The bar on the right edge shows where the changes are, and the parts that changed inside a line are highlighted (see below)
19
+ - **Image preview** (PNG / JPEG / GIF / BMP / WebP / TIFF)
20
+ - **Markdown preview** (`Space m` / `:preview`): renders headings, lists, code and tables, and shows them beside the buffer you are editing. Press it again to show only the preview at full width. Mermaid code blocks are shown as diagrams (see below)
21
+ - **Send the current context to an agent** (`Space a` / `Alt+A` / command palette): formats the selection (or the cursor line) as `path:line-line`, the text, and the diagnostics on those lines, and after you check it in a preview, pastes it into the terminal panel (it does not press Enter)
22
+ - **Suggestions panel and ACP** (`Alt+I` / `Space i`): lists suggestions such as "Resolve the conflicts?", "Create a PR?" and "Investigate the cause of the failure?" in the right panel, based on the state of git, LSP and the terminal. When you pick one, it asks an agent over ACP (Agent Client Protocol), shows the progress and the reply in the panel, and shows changes in diff mode. Comments proposed by an AI review are placed as unsent comments
23
+ - **Claude Code IDE integration**: Claude Code running in the terminal panel can get the selection, the open files and the diagnostics, and you approve its changes as a diff (Claude Code writes the file after you approve; see "Agent integration" below)
24
+ - Tabs, syntax highlighting, Quick Open, project-wide search, a terminal panel, mouse support
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ nix run github:mm1995tk/shijimi-editor/release # run it right away
30
+ nix profile install github:mm1995tk/shijimi-editor/release
31
+ go install github.com/mm1995tk/shijimi-editor/cmd/shj@latest # installs the shj command
32
+ go install github.com/mm1995tk/shijimi-editor/cmd/shijimi@latest # installs the same thing as shijimi
33
+ npm install -g shijimi-editor # installs both shj and shijimi (Linux and macOS)
34
+ ```
35
+
36
+ All of them get the latest release: the Nix commands follow the `release` branch, `go install` takes the newest tag, and npm takes the binaries published at release time. Unreleased changes on `main` are not included.
37
+
38
+ To compare with the base of a pull request you need [gh](https://cli.github.com/) and `gh auth login`.
39
+
40
+ ## Usage
41
+
42
+ ```sh
43
+ shj # open the current directory
44
+ shj ./src # open a directory
45
+ shj main.go # edit just one file (single-file mode, for $EDITOR)
46
+ ```
47
+
48
+ `shijimi` works the same as `shj` (installing with Nix gives you both).
49
+
50
+ Given a file, shj starts in single-file mode. It does not start the file tree, LSP, terminal, diff mode or agent, and exits when you close it with `:q` or `:wq` (see [Installation and startup](manual/docs/install.en.md) in the manual).
51
+
52
+ ## Settings
53
+
54
+ Files are read in the following order, and later ones win (`languages.toml` is compatible with Helix's. If you are coming from Helix, copy your `languages.toml` to `~/.config/shijimi-editor/`).
55
+
56
+ 1. Built-in defaults (gopls / rust-analyzer / typescript-language-server and others)
57
+ 2. `~/.config/shijimi-editor/languages.toml`, `~/.config/shijimi-editor/config.toml`
58
+ 3. The project's `.shijimi-editor/languages.toml`, `.shijimi-editor/config.toml`
59
+
60
+ ### UI language
61
+
62
+ The language of the UI text (status line, command palette, suggestions panel, error messages, `shj --help`) is English by default. Set `ui-language` in `config.toml` to switch it.
63
+
64
+ ```toml
65
+ ui-language = "ja" # "en" (default) or "ja"
66
+ ```
67
+
68
+ shijimi does not choose the language from `LANG` or other environment variables. Any value other than `en` and `ja` is ignored. `:config-reload` applies a change without restarting.
69
+
70
+ ### Theme
71
+
72
+ Switch with `theme` in `config.toml`, or with `:theme <name>` while running (without a name it lists the themes). You can also choose it from the command palette ("Settings: Switch theme").
73
+
74
+ - Built in: `github-dark` (default), `dark-plus`, `light-plus`
75
+ - Helix's `github_dark*` maps to `github-dark`, and `github_light*` and `light` map to `light-plus`
76
+
77
+ ```toml
78
+ theme = "github_light"
79
+ ```
80
+
81
+ ### Listen address of port forwarding
82
+
83
+ Sets the address that `:browser forward` listens on.
84
+
85
+ ```toml
86
+ [browser]
87
+ listen-host = "127.0.0.1"
88
+ ```
89
+
90
+ ### Agent (suggestions panel)
91
+
92
+ Write the command of the ACP agent that runs the suggestions in `~/.config/shijimi-editor/config.toml` (it is not read from a project's settings).
93
+
94
+ ```toml
95
+ [agent]
96
+ command = "claude-agent-acp"
97
+ args = []
98
+ ```
99
+
100
+ ### Example LSP settings (`.shijimi-editor/languages.toml`)
101
+
102
+ ```toml
103
+ [language-server.my-gopls]
104
+ command = "gopls"
105
+ args = ["serve"]
106
+ config = { gofumpt = true } # sent as initializationOptions
107
+ environment = { GOFLAGS = "-tags=integration" }
108
+
109
+ [[language]]
110
+ name = "go"
111
+ language-servers = ["my-gopls"]
112
+ roots = ["go.mod"]
113
+ indent = { tab-width = 4, unit = "\t" }
114
+ ```
115
+
116
+ Supported keys: `command`, `args`, `config` and `environment` of `[language-server.*]`; `name`, `language-id`, `file-types`, `roots`, `language-servers` and `indent.unit` of `[[language]]`.
117
+
118
+ ### Editor settings (`config.toml`)
119
+
120
+ ```toml
121
+ keymap = "helix" # "vscode" for VS Code-style keys
122
+
123
+ [editor]
124
+ line-number = "relative" # how line numbers are shown
125
+ file-icons = true # Nerd Font icons in the file tree; false shows ▸/▾
126
+ mermaid-command = "mmdc -q -i {in} -o {out} -b transparent -s 2" # external command that turns mermaid into a PNG; empty disables it
127
+ watch-files = true # detect and reflect file changes by other processes (such as AI agents). A file with unsaved edits waits for :reload
128
+ mouse-hover = true # show the LSP hover when the pointer rests on a word in the editor for 0.5 seconds. false disables it (and stops receiving motion-only mouse events)
129
+
130
+ # Indent guides (a faint vertical line at each indent level). false disables them
131
+ [editor.indent-guides]
132
+ render = true
133
+
134
+ # Auto save (on by default; saves when editing pauses for 1 second; unnamed files are not saved)
135
+ [editor.auto-save.after-delay]
136
+ enable = true
137
+ timeout = 1000 # milliseconds
138
+ ```
139
+
140
+ ### Writing settings in Nix
141
+
142
+ If you put `config.nix` / `languages.nix` next to the `config.toml` / `languages.toml` of a directory, it is evaluated with `nix eval --json --file` and read as the same structure as TOML (in the same directory it is applied after the TOML file). A file is ignored if `nix` is missing or the evaluation fails.
143
+
144
+ ```nix
145
+ # ~/.config/shijimi-editor/languages.nix
146
+ {
147
+ language-server.nil.command = "nil";
148
+ language = [
149
+ { name = "nix"; language-servers = [ "nil" ]; }
150
+ ];
151
+ }
152
+ ```
153
+
154
+ ### home-manager
155
+
156
+ Import the flake's `homeManagerModules.default`. `settings` is written to `~/.config/shijimi-editor/` as `config.toml`, and `languages` as `languages.toml`.
157
+
158
+ ```nix
159
+ {
160
+ # inputs.shijimi.url = "github:mm1995tk/shijimi-editor/release";
161
+ imports = [ inputs.shijimi.homeManagerModules.default ];
162
+ programs.shijimi-editor = {
163
+ enable = true;
164
+ settings = { keymap = "vscode"; editor.line-number = "relative"; };
165
+ languages = {
166
+ language-server.gopls.command = "gopls";
167
+ language = [ { name = "go"; language-servers = [ "gopls" ]; } ];
168
+ };
169
+ };
170
+ }
171
+ ```
172
+
173
+ ### Markdown preview and mermaid
174
+
175
+ In a `.md` file, `Space m` (or `:preview`, or the command palette) opens a preview to the right of the buffer. It follows your edits and scrolls with the cursor. Press it again to show only the preview at full width, and a third time to close it. At full width, scroll with `j` / `k` or the mouse wheel.
176
+
177
+ Mermaid diagrams are turned into PNGs with [mermaid-cli](https://github.com/mermaid-js/mermaid-cli) (`mmdc`) and shown. If `mmdc` is not on the PATH, or rendering fails, the source and the error are shown instead of the diagram. `mermaid-command` replaces it with another command (`{in}` is the input, `{out}` the output PNG). Rendered images are kept in `~/.cache/shijimi/mermaid`.
178
+
179
+ ## Keys (Helix mode)
180
+
181
+ ### Normal mode
182
+
183
+ | Key | Action |
184
+ | --- | --- |
185
+ | `h j k l` | Move (a number before it gives a count) |
186
+ | `w` `b` `e` | Move while selecting a word |
187
+ | `x` | Select a line (press again to extend) |
188
+ | `%` / `;` | Select all / collapse the selection |
189
+ | `v` | Select mode |
190
+ | `d` `c` `y` | Delete / change / yank |
191
+ | `p` `P` | Paste after / before |
192
+ | `i` `a` `I` `A` `o` `O` | Go to insert mode |
193
+ | `u` `U` | Undo / redo |
194
+ | `f` `t` `F` `T` + a character | Find a character in the line |
195
+ | `r` + a character | Replace |
196
+ | `>` `<` | Indent |
197
+ | `J` | Join lines |
198
+ | `mm` | Go to the matching bracket |
199
+ | `gg` `ge` `gh` `gl` `gs` / `<number>g` | Jump |
200
+ | `gd` `gr` | Go to definition / references |
201
+ | `Ctrl+O` `Ctrl+I` | Go back / forward to where you jumped from (VS Code mode: `Alt+←` `Alt+→`) |
202
+ | `]d` `[d` | Next / previous diagnostic |
203
+ | `gn` `gp` | Next / previous tab |
204
+ | `/` `?` `n` `N` `*` | Search |
205
+ | `Ctrl+C` | Toggle a line comment |
206
+ | `:` | Commands (table below) |
207
+
208
+ ### Space menu
209
+
210
+ When you press `Space`, a popup at the bottom right of the editor area lists the keys you can press next. Close it with `Esc` or any key with no assignment.
211
+
212
+ | Key | Action |
213
+ | --- | --- |
214
+ | `Space f` | Open a file |
215
+ | `Space b` | Open buffers |
216
+ | `Space e` | Go to the file tree |
217
+ | `Space k` | Hover. While it is shown, scroll with `Ctrl+D` / `Ctrl+U` (`PgDn` / `PgUp`, wheel); copy the Markdown source with `y` or by clicking `[Copy]` at the top right of the frame |
218
+ | `Space o` | Open the URL under the cursor in the external browser (Linux: `xdg-open` / macOS: `open`) |
219
+ | `Space r` | Rename |
220
+ | `Space .` | Code actions (apply a diagnostic hint) |
221
+ | `Space s` / `Space S` | Symbol list (in the file / in the whole project) |
222
+ | `Space d` | Diagnostics list |
223
+ | `Space /` | Search and replace in the whole project (floating window; see "Search in files") |
224
+ | `Space g` | Open / close diff mode (compared with the base of the pull request) |
225
+ | `Space m` | Toggle the Markdown preview (side by side → full width → closed) |
226
+ | `Space G` | Open / close diff mode (compared with `HEAD`) |
227
+ | `Space v` | Review menu (when comparing with the base of a pull request) |
228
+ | `Space y` `Space p` | Copy to / paste from the system clipboard |
229
+ | `Space ?` | Command palette |
230
+
231
+ ### Insert mode
232
+
233
+ `Esc` goes back to normal mode. Completion appears automatically when you type `.` or similar, or after 2 characters (`Ctrl+X` to trigger it by hand). Confirm with `Tab` / `Enter`. A snippet completion is inserted with its placeholder selected, and `Tab` / `Shift+Tab` move between placeholders.
234
+
235
+ ### `:` commands
236
+
237
+ `:w` `:w <path>` `:wa` `:q` `:q!` `:wq` `:wqa` `:o <path>` `:n` `:bc` `:bc!` `:fmt` `:reload` `:<line number>` `:sh <command>` `:grep [-x exclude-glob] [-i include-glob] <text>` `:replace [-x exclude-glob] [-i include-glob] <text> => <replacement>` `:pr [number]` `:gitdiff [on|off|split|unified]` `:preview` `:lsp-restart` `:config-reload` `:browser forward|list|stop` `:keymap [helix|vscode]` `:open-url [URL]` (without an argument, the URL under the cursor)
238
+
239
+ ### Global
240
+
241
+ | Key | Action |
242
+ | --- | --- |
243
+ | `Ctrl+P` | Open a file |
244
+ | `F1` / `Ctrl+K` | Command palette |
245
+ | `Ctrl+B` | Toggle the file tree |
246
+ | `Ctrl+E` | Switch focus between the file tree and the editor |
247
+ | `Ctrl+G` | Open / close diff mode (compared with `HEAD`) |
248
+ | ``Ctrl+` `` / `Ctrl+J` | Toggle the terminal (inside the terminal, only ``Ctrl+` ``) |
249
+ | `Alt+R` | Pane resize mode (`←→` sidebar width, `↑↓` terminal height, `<` `>` boundary between the editor and the preview, `=` defaults, `Esc` to finish). You can also drag the borders with the mouse. The sizes are kept until you quit the editor |
250
+ | `Ctrl+S` | Save |
251
+ | `Ctrl+W` | Close the tab |
252
+ | `Ctrl+PgUp` / `Ctrl+PgDn` / `Alt+1`-`9` | Switch tabs |
253
+ | `Ctrl+Q` | Quit |
254
+
255
+ ### File tree
256
+
257
+ `j/k` move, `Enter` open, `h/l` collapse / expand, `a` new file, `A` new folder, `r` rename, `d` delete, `y` copy the relative path, `Y` copy the absolute path, `R` refresh, `Esc` back to the editor.
258
+
259
+ ### Diff mode
260
+
261
+ How you open it decides what you compare with (the base). Pressing the same key while it is open closes it, and pressing a different key switches the base.
262
+
263
+ | Key | Base |
264
+ | --- | --- |
265
+ | `Space G` / `Ctrl+G` / `:gitdiff` | `HEAD` (includes untracked files) |
266
+ | `Space g` / `:pr [number]` | The base of the pull request (`git merge-base <PR base> HEAD`). Opens the PR of the current branch. For a PR on another branch, run `gh pr checkout` first (needs `gh`) |
267
+
268
+ - From the top, the screen is the header (the base and what it is compared with), the sidebar and the diff, the help line (the keys you can use now), and the status line.
269
+ - The sidebar is split 7:3 vertically, and **CHANGES** (a tree of the changed files) appears in the lower 3. A folder with a single child is collapsed like `internal/config`. `Tab` moves between it and the file tree.
270
+ - A file without changes opens in the normal editor. A changed file opens as the whole file in **Split** (the base on the left, the current file on the right). A new file (including an untracked one) opens in a single editor. Lines are not colored, the bar on the right edge turns all green, and the `+N` / `-N` in the file name row at the top remain.
271
+ - The right side (the current file) can be edited and saved as usual. The diff updates right away when you edit.
272
+ - You can also switch to **Unified** (`s`, `:gitdiff unified` / `split`, or a click on the file name row).
273
+ - The bar on the right edge of the diff shows where the changes are by color (green: added, red: deleted, blue: modified). The range now shown is brighter, and clicking scrolls to that position.
274
+ - In a line where only a part changed, the changed part is highlighted in a darker color.
275
+ - While comparing with the base of a pull request, you can review with `Space v` (comments on lines, ranges and files, replies, resolving, applying suggestions, viewed, and submitting an approval and so on). You can comment only on files whose working tree content is the same as the PR's latest commit. See "Diff mode" in the manual for details.
276
+
277
+ | Key (with CHANGES focused) | Action |
278
+ | --- | --- |
279
+ | `j/k` | Move |
280
+ | `Enter` / `l` | Open the file |
281
+ | `s` | Toggle split / unified |
282
+ | `r` | Refresh the list |
283
+ | `Tab` | Go to the file tree |
284
+ | `Esc` | Go to the editor |
285
+
286
+ ## Limitations
287
+
288
+ - The terminal panel is a login shell (`$SHELL -l`) on a PTY. `.zshrc` and the like are read, and `vim` / `top` / `lazygit` work. While it has focus, almost every key goes to the shell (the global ones are only `Ctrl+Q` / ``Ctrl+` `` / `F1` / `Alt+R`). `Ctrl+J` goes to the shell, so you can enter a newline in Claude Code even on a terminal that sends Shift+Enter as LF. `F2` opens a new tab, `Ctrl+PageUp/PageDown` switches tabs, and the tab closes when the shell exits. You can scroll back through the output with the mouse wheel.
289
+ - Images and mermaid diagrams are drawn with the Kitty graphics protocol. You need a terminal that supports it (Kitty / Ghostty / WezTerm and others).
290
+
291
+ ## Development
292
+
293
+ Use the Nix devShell (Go, gopls, gomod2nix, git). With direnv, `.envrc` enters it automatically.
294
+
295
+ ```sh
296
+ nix develop # or: direnv allow
297
+ go test ./...
298
+ go build ./cmd/shj
299
+ nix build # build the package (also runs the tests)
300
+ nix fmt # format with nixfmt / gofmt / taplo
301
+ nix flake check # check the formatting
302
+ ```
303
+
304
+ After changing `go.mod`, run `gomod2nix` to update `gomod2nix.toml`.
305
+
306
+ User-visible strings live in one table per language, [`internal/i18n/en.go`](internal/i18n/en.go) and [`internal/i18n/ja.go`](internal/i18n/ja.go). Code asks for a string with `i18n.T("key")` and does not contain UI text. When you add a string, add the key to both tables (a test checks that they match).
307
+
308
+ ### Search in files
309
+
310
+ `Space /`, "Search: Search / replace in the project" in the command palette, `:grep` and `:replace` all open the same floating window (almost the full screen, leaving one column or row on each side). At the top are the conditions (four fields, Search, Replace, Include and Exclude, in bordered boxes in two columns, where the border color of the selected field changes; the toggles are below them), the matched lines (Matched) are at the lower left, and the lines around the selected one (View) at the lower right. When you change a condition, it searches again automatically after a short wait. When the Replace field has text, View also shows the `-` / `+` diff.
311
+
312
+ | Key | Action |
313
+ | --- | --- |
314
+ | `Tab` / `Shift+Tab` | Next / previous field |
315
+ | `↑` `↓` / `Ctrl+P` `Ctrl+N` / `PgUp` `PgDn` | Select a matched line |
316
+ | `Enter` | Open the selected line in its file |
317
+ | `Ctrl+X` (`Alt+X`) | Exclude the selected line from the replacement / put it back (an excluded line is marked `x`) |
318
+ | `Alt+C` / `Alt+W` / `Alt+R` / `Alt+P` | Match case / whole word / regex / preserve case when replacing |
319
+ | `Alt+1` | Replace only the selected line (the panel stays open and moves to the next match) |
320
+ | `Alt+Enter` | Replace every target line |
321
+ | `Esc` | Close |
322
+
323
+ - Replace All opens the target files as buffers and replaces in them. The disk does not change until you save, and `u` / `Ctrl+Z` undoes it.
324
+ - When regex is on, you can use captures such as `$1` in the Replace field. When it is off, `$` is just a character.
325
+ - When there are more than 5000 results, Replace All is unavailable until you narrow the conditions.
326
+ - The search covers text files under Git (including untracked files that are not ignored). Outside Git it searches everything except build directories. It also searches the unsaved content of open buffers.
327
+ - The arguments of `:grep -x '*.lock,dist/**' -i '*.go' foo` and `:replace foo => bar` open the window with those values in the fields. Typing just `:grep` / `:replace` opens it with the previous conditions.
328
+
329
+ ### Excluding and including files in search
330
+
331
+ In the Include and Exclude fields, write comma-separated globs (for example `*.lock,dist/**`). With `:grep` / `:replace` you can also give them with `-x` / `--exclude=` (exclude) and `-i` / `--include=` (include). The initial values come from the `[search]` setting. Put anything you always want applied in `~/.config/shijimi-editor/config.toml` or `.shijimi-editor/config.toml`.
332
+
333
+ ```toml
334
+ [search]
335
+ exclude = ["*.lock", "dist/**"]
336
+ include = []
337
+ ```
338
+
339
+ ### Port forwarding (`:browser forward`)
340
+
341
+ `:browser forward <target port> [listen port]` makes shijimi listen on `127.0.0.1` and forward over TCP to `localhost:<target port>` (both HTTP and WebSocket work). If you omit the listen port, a free port is chosen. `:browser list` lists the forwards, and `:browser stop <listen port>` stops one. Quitting shijimi stops them all.
342
+
343
+ When shijimi runs on a remote VM, running the following on your own machine lets your local browser see the development server at `http://localhost:8080`.
344
+
345
+ ```sh
346
+ ssh -L 8080:127.0.0.1:<listen port> vm
347
+ ```
348
+
349
+ Compared with running `ssh -L` directly, the advantages are that the listen port can be fixed, and that a server that listens only on `0.0.0.0` or IPv6 can still be reached through `127.0.0.1`. If you do not need those, use `ssh -L` directly.
350
+
351
+ The listen address can be changed with `listen-host` in `[browser]` (see "Listen address of port forwarding" under Settings). By default it does not bind to `0.0.0.0`. Change it only on a trusted network.
352
+
353
+ ## Agent integration
354
+
355
+ ### Claude Code IDE integration
356
+
357
+ shijimi supports Claude Code's IDE integration protocol (the same one as the VS Code extension and claudecode.nvim). On startup it starts a WebSocket MCP server on a free port of 127.0.0.1, and writes the destination and an authentication token to the lock file `~/.claude/ide/<port>.lock` (0600; under `ide/` of `CLAUDE_CONFIG_DIR` if it is set). It removes the file on exit.
358
+
359
+ When you start `claude` in shijimi's terminal panel, it connects automatically through the environment variables `CLAUDE_CODE_SSE_PORT`, `ENABLE_IDE_INTEGRATION=true` and `FORCE_CODE_TERMINAL=true`. A Claude Code running in another terminal can be chosen with `/ide` if its working directory is under shijimi's root.
360
+
361
+ Tools the agent can use:
362
+
363
+ | Tool | What it does |
364
+ |------|------|
365
+ | `getCurrentSelection` / `getLatestSelection` | The selection (or the cursor position) and its file |
366
+ | `getOpenEditors` / `getWorkspaceFolders` | The open files / the roots |
367
+ | `getDiagnostics` | LSP diagnostics (all files if the URI is omitted) |
368
+ | `openFile` | Open a file (select a range with `startText` / `endText`) |
369
+ | `openDiff` | Show a change as a diff. **Enter approves and Esc rejects.** Claude Code writes the file after you approve |
370
+ | `closeAllDiffTabs` / `close_tab` | Reject and close the diffs that are waiting |
371
+ | `checkDocumentDirty` / `saveDocument` | Check for unsaved changes / save |
372
+
373
+ - Whenever the selection or the cursor moves, it sends `selection_changed`.
374
+ - While connected, `Space a` / `Alt+A` (send the current context to the agent) sends `at_mentioned` instead of pasting. When not connected, it shows the preview and pastes into the terminal as before.
375
+ - Connections without an authentication token, and connections from a browser (with an `Origin` header), are refused.
376
+
377
+ ### Control socket
378
+
379
+ A running shijimi creates a Unix socket (0600) and tells its location through the environment variable `SHIJIMI_SOCKET`. From a shell in the terminal panel you can run the following. Only operations that the IDE integration lacks are kept.
380
+
381
+ - `shj diff [path]`: switch to diff mode (base `HEAD`). With `path`, opens that file as a diff
382
+ - `shj exec ":<command>"`: run a `:` command as it is (for example `shj exec ":preview"`). On success it writes the status-line text to standard output; on failure it writes the error text to standard error and exits with code 1. It returns an error without running commands that quit or discard (`:q` `:q!` `:wq` `:bc!` and so on), commands that open a picker when given no argument (`:o` `:theme` `:grep` `:replace` `:symbol` `:action`, and `:pr` with a non-numeric argument), and `:reload` and `:bc` on a file with unsaved changes
383
+
384
+ When the first argument is `diff` / `exec` / `skill`, it is treated as a subcommand. Write a file with the same name as `./diff`.
385
+
386
+ `shj skill install [destination]` writes a skill (`SKILL.md`) that describes how to use this command. Without a destination it writes to `~/.claude/skills/shijimi/`.
387
+
388
+ > `shj open` and `shj status` were removed and replaced by the IDE integration (`openFile` / `getOpenEditors` / `getCurrentSelection`).
389
+
390
+ ## Editing the manual
391
+
392
+ The manual is built from `manual/` with [MkDocs Material](https://squidfunk.github.io/mkdocs-material/). When you push to `main`, GitHub Actions publishes it to Cloudflare Pages (the repository Secrets need `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`). To preview it locally, run:
393
+
394
+ ```sh
395
+ pip install -r manual/requirements.txt
396
+ mkdocs serve --config-file manual/mkdocs.yml
397
+ ```
398
+
399
+ The manual has an English page (`name.en.md`, the default) and a Japanese page (`name.ja.md`) for each page. When you change one, change the other too. `manual/check-translations.sh` checks that every page has both languages and the same structure, and CI runs it on pull requests (it also fails when only one language of a page changed; add `[skip-i18n-check]` to the pull request title to skip that part, for a typo fix for example).
400
+
401
+ ## License
402
+
403
+ [MIT](LICENSE)
package/bin/shj.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ // Runs the shj binary from the package for this OS and CPU, which npm installs
3
+ // as one of the optionalDependencies (npm skips the ones whose os and cpu do not match).
4
+ "use strict";
5
+
6
+ const { spawnSync } = require("node:child_process");
7
+
8
+ const pkg = `shijimi-editor-${process.platform}-${process.arch}`;
9
+ let bin;
10
+ try {
11
+ bin = require.resolve(`${pkg}/bin/shj`);
12
+ } catch {
13
+ console.error(
14
+ `shijimi-editor: ${pkg} is not installed. ` +
15
+ "Builds exist for Linux and macOS on x64 and arm64. " +
16
+ "If you installed with --no-optional (or --omit=optional), reinstall without it.",
17
+ );
18
+ process.exit(1);
19
+ }
20
+
21
+ const r = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
22
+ if (r.error) throw r.error;
23
+ // Exit the same way the binary did, so that a shell sees the same signal or status.
24
+ if (r.signal) process.kill(process.pid, r.signal);
25
+ process.exit(r.status ?? 1);
package/package.json CHANGED
@@ -1,6 +1,27 @@
1
1
  {
2
2
  "name": "shijimi-editor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.2",
4
+ "description": "VS Code-style terminal IDE with Helix keybindings",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/mm1995tk/shijimi-editor",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mm1995tk/shijimi-editor.git"
10
+ },
11
+ "bin": {
12
+ "shj": "bin/shj.js",
13
+ "shijimi": "bin/shj.js"
14
+ },
15
+ "files": [
16
+ "bin"
17
+ ],
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "optionalDependencies": {
22
+ "shijimi-editor-linux-x64": "0.4.2",
23
+ "shijimi-editor-linux-arm64": "0.4.2",
24
+ "shijimi-editor-darwin-x64": "0.4.2",
25
+ "shijimi-editor-darwin-arm64": "0.4.2"
26
+ }
27
+ }