jaitus 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 (55) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +248 -0
  3. package/bin/jaitus.js +60 -0
  4. package/package.json +46 -0
  5. package/src/agent/loop.js +548 -0
  6. package/src/agent/permissions.js +218 -0
  7. package/src/agent/rules.js +190 -0
  8. package/src/agent/tools.js +923 -0
  9. package/src/agent/websearch.js +522 -0
  10. package/src/api.js +72 -0
  11. package/src/background.js +85 -0
  12. package/src/brand.js +232 -0
  13. package/src/commands/code-review.js +8 -0
  14. package/src/commands/commit.js +73 -0
  15. package/src/commands/completion.js +68 -0
  16. package/src/commands/doctor.js +185 -0
  17. package/src/commands/explain.js +33 -0
  18. package/src/commands/init.js +62 -0
  19. package/src/commands/login.js +201 -0
  20. package/src/commands/logout.js +25 -0
  21. package/src/commands/research.js +60 -0
  22. package/src/commands/review.js +80 -0
  23. package/src/commands/security-review.js +8 -0
  24. package/src/commands/simplify.js +8 -0
  25. package/src/commands/test.js +68 -0
  26. package/src/commands/update.js +97 -0
  27. package/src/config.js +95 -0
  28. package/src/diff.js +129 -0
  29. package/src/errors.js +101 -0
  30. package/src/hooks.js +55 -0
  31. package/src/index.js +2503 -0
  32. package/src/ledger.js +73 -0
  33. package/src/logo-data.js +33 -0
  34. package/src/mcp.js +160 -0
  35. package/src/open.js +50 -0
  36. package/src/project.js +0 -0
  37. package/src/rewind.js +130 -0
  38. package/src/session.js +207 -0
  39. package/src/sessions.js +179 -0
  40. package/src/sixel.js +131 -0
  41. package/src/skills.js +62 -0
  42. package/src/term-sim.js +103 -0
  43. package/src/terminal.js +90 -0
  44. package/src/tui/ansi.js +287 -0
  45. package/src/tui/entries.js +366 -0
  46. package/src/tui/highlight.js +211 -0
  47. package/src/tui/logo.js +93 -0
  48. package/src/tui/markdown.js +280 -0
  49. package/src/tui/mouse.js +125 -0
  50. package/src/tui/theme.js +201 -0
  51. package/src/tui/widgets.js +226 -0
  52. package/src/tui/wordmark.js +135 -0
  53. package/src/tui-ink.js +1927 -0
  54. package/src/tui.js +2555 -0
  55. package/src/ui.js +562 -0
package/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ Jaitus CLI — Proprietary Software Licence
2
+
3
+ Copyright (c) 2026 Jaitus. All rights reserved.
4
+
5
+ This software and its source code (the "Software") are the property of Jaitus and
6
+ are licensed, not sold.
7
+
8
+ You may install and run the Software, unmodified, only to access the Jaitus service
9
+ with your own Jaitus account, subject to the Jaitus Terms of Service at
10
+ https://www.jaitus.com/terms.
11
+
12
+ You may not, except where applicable law expressly permits it despite this
13
+ restriction: copy, modify, merge, publish, distribute, sublicense, sell or rent the
14
+ Software or any part of it; create derivative works from it; use it, or any part of
15
+ it, to build or provide a competing product or service; use it to access the Jaitus
16
+ service other than through your own account; or remove or alter any notice in it.
17
+
18
+ No other right or licence is granted, by implication or otherwise. This licence ends
19
+ automatically if you breach it or if your Jaitus account is closed, and you must then
20
+ stop using and delete the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
23
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
24
+ PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL JAITUS BE LIABLE FOR ANY
25
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
26
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR ITS USE, TO THE
27
+ EXTENT PERMITTED BY LAW.
28
+
29
+ Third-party open-source components included with or installed alongside the
30
+ Software (such as Ink and React) remain under their own licences.
31
+
32
+ Contact: support@jaitus.com
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # jaitus
2
+
3
+ A coding agent in your terminal. Sign in once in the browser and start working —
4
+ there is no API key to create, copy or keep safe.
5
+
6
+ ```
7
+ ██╗ █████╗ ██╗████████╗██╗ ██╗███████╗
8
+ /\_/\ ██║██╔══██╗██║╚══██╔══╝██║ ██║██╔════╝
9
+ ( o.o ) ██║███████║██║ ██║ ██║ ██║███████╗
10
+ > ^ < ██ ██║██╔══██║██║ ██║ ██║ ██║╚════██║
11
+ ╚█████╔╝██║ ██║██║ ██║ ╚██████╔╝███████║
12
+ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
13
+
14
+ a coding agent in your terminal
15
+ ```
16
+
17
+ ## Install
18
+
19
+ ```bash
20
+ npm install -g jaitus # then just `jaitus`
21
+ npx jaitus # or don't install anything
22
+ ```
23
+
24
+ Node 20 or newer is enough for one-shot, piped, and interactive usage. The
25
+ interactive terminal surface is built with Ink and ships as ordinary npm
26
+ dependencies — no Bun, Rust, native runtime, or extra installer is required.
27
+
28
+ Set `JAITUS_RENDERER=classic` if you need the legacy renderer temporarily.
29
+
30
+ ## Start
31
+
32
+ Create an account at [jaitus.com](https://www.jaitus.com) — every new account gets free
33
+ prompts to try it — then:
34
+
35
+ ```bash
36
+ jaitus login # opens your browser, nothing to copy
37
+ cd your-project
38
+ jaitus # start the interactive session surface
39
+ ```
40
+
41
+ Or give it one task and let it finish:
42
+
43
+ ```bash
44
+ jaitus "add a test for the date parser and run the suite"
45
+ cat error.log | jaitus "why is this failing?"
46
+ ```
47
+
48
+ ## What it can do
49
+
50
+ It reads your code, searches it, edits files and runs commands — tests, builds, git — and
51
+ works from what it actually finds rather than from what it assumes. It asks before
52
+ changing a file or running a command, showing you exactly what it is about to do.
53
+
54
+ ```
55
+ ● Edit src/parse.js
56
+ - return JSON.parse(x)
57
+ + try { return JSON.parse(x) } catch { return null }
58
+
59
+ [y] once [a] always this session [n] no ›
60
+ ```
61
+
62
+ ## Commands
63
+
64
+ | | |
65
+ |---|---|
66
+ | `jaitus` | start a session in this directory |
67
+ | `jaitus "<task>"` | run one task and exit |
68
+ | `jaitus login` / `logout` | sign in through the browser / sign this computer out |
69
+ | `jaitus whoami` | which account, which plan, this period's usage |
70
+ | `jaitus usage` | plan allowance, requests and tokens used |
71
+ | `jaitus sessions` | list saved sessions |
72
+ | `jaitus mcp list` | list configured MCP servers |
73
+ | `jaitus config` | show or change CLI settings |
74
+ | `jaitus init` | create `JAITUS.md` and `.jaitusignore` here |
75
+ | `jaitus doctor` | check everything that can stop this working |
76
+ | `jaitus update` | is a newer version published |
77
+ | `jaitus completion <shell>` | bash, zsh, fish or PowerShell completion |
78
+ | `jaitus help <command>` | detail on one command |
79
+
80
+ ## In a session
81
+
82
+ | | |
83
+ |---|---|
84
+ | `/help` | these commands |
85
+ | `/model [id]` | show or change the model for this session |
86
+ | `/cost` | tokens used so far this session |
87
+ | `/status` | current model, mode, session, and context |
88
+ | `/context` | inspect the current context |
89
+ | `/compact [focus]` | summarize and free context |
90
+ | `/skills` | list project workflows |
91
+ | `/sessions` | list saved sessions |
92
+ | `/resume <id>` | load a saved session |
93
+ | `/rename <title>` | name this session |
94
+ | `/hooks` | show lifecycle hooks |
95
+ | `/tui [fullscreen\|default]` | switch renderer, relaunching with the conversation intact |
96
+ | `/fork` | copy this conversation into a brand-new session |
97
+ | `/theme [name]` | color theme: dark, light, daltonized, plain, auto |
98
+ | `/scroll-speed [n]` | mouse-wheel speed, 0.25–10 |
99
+ | `/agent <task>` | run an isolated read-only side task |
100
+ | `/cwd` | which directory the agent is working in |
101
+ | `/clear` | start the conversation over |
102
+ | `/undo` | drop the last exchange |
103
+ | `/exit` | leave |
104
+
105
+ Arrow keys, word-delete and history all work — history is kept in `~/.jaitus/history`
106
+ and survives across sessions. Ctrl-C clears the line (or copies the selection,
107
+ or interrupts a running turn) but never exits — only `/exit` leaves.
108
+
109
+ Enter sends in one press — Tab completes a `/` command or `@` file without
110
+ sending, Esc dismisses the suggestion first. `Ctrl+J`, `Shift+Enter` and
111
+ `\+Enter` insert a newline. Up/Down (or `Ctrl+P`/`Ctrl+N`) moves inside a
112
+ multiline prompt first, then through history. `Ctrl+R` searches history,
113
+ `Shift+Tab` cycles permission modes, `Ctrl+T` shows session activity, `Ctrl+G`
114
+ edits the draft in `$VISUAL`/`$EDITOR`, `Ctrl+S` stashes/recalls the draft,
115
+ `Ctrl+_` undoes, `Ctrl+Y` pastes the last deletion, `Alt+B`/`F`/`D` do word
116
+ jumps/edits, `?` on an empty prompt lists shortcuts. Large pastes collapse to
117
+ `[Pasted text #N]` chips (full text still sends), `Ctrl+V` attaches a clipboard
118
+ image, `:name:` inserts emoji, `! cmd &` or `Ctrl+B` backgrounds a command.
119
+
120
+ Scrolling stays inside the app (alternate screen): `PgUp` /
121
+ `PgDn` half a screen, `Ctrl+Home` / `Ctrl+End` top / bottom, mouse wheel a few
122
+ lines. Scrolling up pauses auto-follow and shows new-message count — `Ctrl+End`
123
+ or scroll to the bottom resumes. `JAITUS_SCROLL_SPEED` (1–20)
124
+ multiplies wheel distance.
125
+ `Ctrl+O` opens the transcript viewer: `/` searches, `n` / `N` next / previous,
126
+ `j` / `k` lines, `Ctrl+u` / `Ctrl+d` half page, `Ctrl+b` / `Ctrl+f` / `Space`
127
+ full page, `{` / `}` previous / next prompt, `g` / `G` ends, `[` dumps the full
128
+ conversation to native scrollback for `Cmd+F` / tmux copy mode, `v` opens it in
129
+ `$VISUAL` / `$EDITOR`, `q` / `Esc` returns.
130
+
131
+ Drag selects inside the session and auto-copies on release (double-click word,
132
+ triple-click line, `Shift+arrows` extends, `Ctrl+C` copies when a selection is
133
+ active, `Ctrl+Shift+C` copies manually when auto-copy is off). Clipboard order:
134
+ tmux buffer, `pbcopy` / `wl-copy` / `xclip` / `xsel` / `clip` / PowerShell
135
+ `Set-Clipboard`, then OSC 52 over SSH. `jaitus config copyOnSelect on|off`
136
+ toggles auto-copy. `JAITUS_DISABLE_MOUSE=1`
137
+ keeps flicker-free rendering with native selection; `JAITUS_DISABLE_MOUSE_CLICKS=1`
138
+ keeps wheel scrolling only. Hold `Shift` (`Option` in iTerm2, `Fn` in
139
+ Terminal.app) for one-off native selection.
140
+
141
+ ## Options
142
+
143
+ | | |
144
+ |---|---|
145
+ | `--model <id>` | override the model for this run |
146
+ | `--print, -p` | headless one-prompt mode |
147
+ | `--continue, -c` | continue the latest session in this directory |
148
+ | `--resume, -r <id>` | resume a saved session |
149
+ | `--output-format text\|json\|stream-json` | structured output for automation |
150
+ | `--max-turns <n>` | cap agentic turns |
151
+ | `--permission-mode <mode>` | default, acceptEdits, plan or bypassPermissions |
152
+ | `--system-prompt <text>` | replace the system prompt in print mode |
153
+ | `--append-system-prompt <text>` | add controlled instructions |
154
+ | `--yes` | do not ask before writing files or running commands |
155
+ | `--cwd <dir>` | work somewhere other than here |
156
+ | `--json` | machine-readable output, wherever a command reports something |
157
+ | `--no-color` | plain text, no escape codes |
158
+ | `--no-banner` | skip the logo |
159
+
160
+ `--json` is on every command that reports rather than does, so `jaitus doctor --json`,
161
+ `jaitus whoami --json` and `jaitus usage --json` can be read by a script instead of a
162
+ person.
163
+
164
+ ## Telling it about your project
165
+
166
+ `jaitus init` writes two files. Both are meant to be committed, so everyone working on
167
+ the project gets the same behaviour rather than configuring their own copy.
168
+
169
+ **`JAITUS.md`** — notes handed to the agent with every request: how to run the tests, the
170
+ conventions, the things that are not obvious from reading the code. Keep it short and keep
171
+ it true; a stale instruction here is worse than no instruction.
172
+
173
+ **`.jaitusignore`** — paths the agent must not list, search, read or write. One pattern per
174
+ line. A leading `/` anchors to the project root, a trailing `/` means a directory, `*`
175
+ matches within a path segment and `**` across them.
176
+
177
+ ```
178
+ .env
179
+ .env.*
180
+ *.pem
181
+ secrets/
182
+ ```
183
+
184
+ An ignored path is *refused*, not merely hidden — otherwise the agent cannot find
185
+ `secrets/` by browsing but will happily open it the moment a filename turns up in a stack
186
+ trace, which is the case the file was written for.
187
+
188
+ ## Where it keeps things
189
+
190
+ `~/.jaitus/credentials.json` (0600), `~/.jaitus/settings.json`, `~/.jaitus/history`, and
191
+ `~/.jaitus/sessions/`.
192
+
193
+ It does **not** write to your shell profile or your machine environment, so nothing it does
194
+ can change how another tool on your computer behaves.
195
+
196
+ Environment variables it reads: `NO_COLOR`, `FORCE_COLOR`, `JAITUS_ASCII` (plain-ASCII logo),
197
+ `JAITUS_NO_BANNER`, `JAITUS_DEBUG` (stack traces).
198
+ Renderer: fullscreen on capable terminals, classic scrollback on legacy consoles
199
+ or pipes. Force either way with `JAITUS_FULLSCREEN=1` / `JAITUS_NO_FULLSCREEN=1`
200
+ (`/tui` switches mid-session), `JAITUS_16COLOR=1` for sixteen colors,
201
+ `JAITUS_NO_ANIMATION=1` for reduced motion.
202
+
203
+ ## Extending it
204
+
205
+ - `.jaitus/skills/<name>/SKILL.md` adds a workflow available as `/<name>`, in the open
206
+ Agent Skills format. Skills already in `.claude/skills` are picked up too.
207
+ - `.jaitus/hooks.json` adds lifecycle commands. A non-zero `beforePrompt` hook blocks the
208
+ request; hook output is not echoed into the transcript.
209
+ - `.mcp.json` configures local stdio MCP servers. Use `jaitus mcp list`, `jaitus mcp add`
210
+ and `jaitus mcp remove`; discovered tools are permission-gated.
211
+ - `~/.jaitus/sessions` stores resumable conversations. Use `jaitus sessions`, `--continue`,
212
+ `--resume <id>`, or the matching slash commands.
213
+
214
+ ## Safety
215
+
216
+ - Every path is resolved and checked to be inside the working directory, symlinks
217
+ included. The agent cannot read or write outside the project you started it in.
218
+ - Writes and commands need permission. `--yes` skips the prompts and is deliberately not
219
+ the default; without a terminal to ask in, an action that needs permission is refused
220
+ rather than assumed.
221
+ - Commands run with no TTY, so anything interactive exits instead of hanging forever.
222
+ - The agent stops after 40 steps rather than looping on your bill.
223
+ - `jaitus doctor` never prints your sign-in token — only whether you are signed in.
224
+
225
+ ## Signing in
226
+
227
+ `jaitus login` is the loopback-redirect flow from RFC 8252 with PKCE, the same shape
228
+ `gh auth login` uses. The CLI opens a random port on `127.0.0.1`, you approve in the
229
+ browser, the browser carries back a single-use code, and the CLI exchanges that code over
230
+ HTTPS for a short-lived sign-in token that renews itself. No token ever travels in a URL.
231
+
232
+ Each computer you sign in on appears under **Devices** on the website, where you can sign
233
+ it out. `jaitus logout` signs out this computer only.
234
+
235
+ ## Plans
236
+
237
+ Jaitus is a subscription. Plans are listed at [jaitus.com](https://www.jaitus.com); each
238
+ includes a monthly token allowance. `jaitus whoami` and `jaitus usage` show where you
239
+ are in the current period.
240
+
241
+ ## Requirements
242
+
243
+ Node 20 or newer.
244
+
245
+ ## Licence
246
+
247
+ Proprietary. © 2026 Jaitus. All rights reserved. Use is governed by the Jaitus Terms of
248
+ Service at [jaitus.com/terms](https://www.jaitus.com/terms). See `LICENSE`.
package/bin/jaitus.js ADDED
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ import main from '../src/index.js';
3
+
4
+ // Node 20 is the floor: the CLI uses global fetch, and on 18 it exists but streaming
5
+ // bodies behave differently enough to matter. Better a clear message than a confusing
6
+ // failure halfway through a task.
7
+ const major = Number(process.versions.node.split('.')[0]);
8
+ if (major < 20) {
9
+ process.stderr.write(`jaitus needs Node 20 or newer (you have ${process.versions.node}).\n`);
10
+ process.exit(1);
11
+ }
12
+
13
+ // Ctrl-C should leave the terminal usable rather than mid-escape-sequence. Mouse
14
+ // reporting has to be turned off here too: the terminal keeps sending reports after the
15
+ // process is gone, and every click in the shell afterwards prints escape codes.
16
+ const restoreTerminal = () => {
17
+ // Only to a real terminal. Written unconditionally, these codes end up in the output
18
+ // of every piped invocation — `jaitus models --json | jq` would be handed a JSON
19
+ // document with escape sequences glued to the end of it.
20
+ if (!process.stdout.isTTY) return;
21
+ try { process.stdout.write('\x1b[?1006l\x1b[?1002l\x1b[?1000l\x1b[?25h'); } catch { /* going away anyway */ }
22
+ };
23
+ process.on('SIGINT', () => {
24
+ restoreTerminal();
25
+ process.stdout.write('\n');
26
+ process.exit(130);
27
+ });
28
+ process.on('exit', restoreTerminal);
29
+
30
+ /**
31
+ * Finish WITHOUT process.exit().
32
+ *
33
+ * Calling process.exit() after two fetches have shared a keep-alive connection crashes
34
+ * Node on Windows with `Assertion failed: !(handle->flags & UV_HANDLE_CLOSING)` — a
35
+ * libuv teardown race, not something this code does wrong, but it would print a crash
36
+ * after every successful run. Closing undici's dispatcher first does not help; only not
37
+ * calling exit() does.
38
+ *
39
+ * Setting exitCode and letting the loop drain is also measurably faster (295ms vs 406ms
40
+ * on the same work), because exit() was racing teardown rather than waiting for it. The
41
+ * dispatcher is still closed first so idle sockets are released immediately instead of
42
+ * holding the process open for their keep-alive timeout.
43
+ */
44
+ async function finish(code) {
45
+ process.exitCode = code ?? 0;
46
+ try {
47
+ const dispatcher = globalThis[Symbol.for('undici.globalDispatcher.1')];
48
+ if (dispatcher?.close) await dispatcher.close();
49
+ } catch {
50
+ // Internal and version-dependent; if it is gone, natural drain still gets there.
51
+ }
52
+ }
53
+
54
+ main(process.argv.slice(2))
55
+ .then(finish)
56
+ .catch(async (err) => {
57
+ process.stderr.write(`\x1b[31m✗\x1b[39m ${err?.message || err}\n`);
58
+ if (process.env.JAITUS_DEBUG) process.stderr.write(`${err?.stack}\n`);
59
+ await finish(1);
60
+ });
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "jaitus",
3
+ "version": "0.3.0",
4
+ "description": "Jaitus — a coding agent in your terminal.",
5
+ "type": "module",
6
+ "bin": {
7
+ "jaitus": "bin/jaitus.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "engines": {
16
+ "node": ">=20"
17
+ },
18
+ "scripts": {
19
+ "test": "node tests/source-sanity.js && node tests/rules.js && node tests/run.js && node tests/commands.js && node tests/login.js && node tests/session.js && node tests/openUrl.js && node tests/ink-tui.js && node tests/tui-render.js",
20
+ "preview": "node scripts/tui-preview.js",
21
+ "prepublishOnly": "npm test"
22
+ },
23
+ "keywords": [
24
+ "jaitus",
25
+ "coding-agent",
26
+ "cli",
27
+ "terminal",
28
+ "ai"
29
+ ],
30
+ "homepage": "https://www.jaitus.com",
31
+ "bugs": {
32
+ "url": "https://www.jaitus.com",
33
+ "email": "support@jaitus.com"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "ink": "^7.1.1",
40
+ "react": "^19.3.0"
41
+ },
42
+ "license": "SEE LICENSE IN LICENSE",
43
+ "devDependencies": {
44
+ "acorn": "^8.18.0"
45
+ }
46
+ }