anixcode 0.8.0__py3-none-any.whl

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.
@@ -0,0 +1,374 @@
1
+ """Chat widgets: messages, streaming markdown, tool cards, prompt input."""
2
+ from __future__ import annotations
3
+ from ..i18n import tr
4
+
5
+ import re
6
+
7
+ from rich.console import Group
8
+ from rich.syntax import Syntax
9
+ from rich.text import Text
10
+ from textual import events
11
+ from textual.containers import Horizontal, Vertical, VerticalScroll
12
+ from textual.message import Message
13
+ from textual.widgets import Markdown, OptionList, Static, TextArea
14
+
15
+ from ..mentions import MENTION
16
+ from ..tools import ToolResult
17
+
18
+ _PREFIX = re.compile(r"(?:^|\s)@([^\s@]*)$")
19
+ _CMD_PREFIX = re.compile(r"^/([a-z0-9_-]*)$", re.IGNORECASE)
20
+
21
+ TOOL_ICONS = {"read": "→", "ls": "▤", "glob": "⌕", "grep": "⌕", "edit": "✎", "write": "✎", "bash": "$"}
22
+
23
+
24
+ class Chip(Static):
25
+ """A small clickable label (looks like a tag, takes one line)."""
26
+
27
+ def __init__(self, label: str, on_press, **kwargs) -> None:
28
+ super().__init__(label, **kwargs)
29
+ self._on_press = on_press
30
+
31
+ def on_click(self) -> None:
32
+ self._on_press()
33
+
34
+
35
+ class PermissionBar(Horizontal):
36
+ """One line above the prompt: "Выполнить: rm -rf build [Разрешить ⏎] [Отклонить esc] [Полный доступ]"."""
37
+
38
+ def __init__(self, on_decide, **kwargs) -> None:
39
+ super().__init__(**kwargs)
40
+ self.perm_text = Static(id="perm-text")
41
+ self.perm_decide = on_decide
42
+ self.perm_ok = Chip(tr(" Разрешить ⏎ "), lambda: self.perm_decide("once"), classes="chip ok")
43
+ self.perm_no = Chip(tr(" Отклонить esc "), lambda: self.perm_decide("deny"), classes="chip no")
44
+ self.perm_full = Chip(tr(" Полный доступ "), lambda: self.perm_decide("full"), classes="chip full")
45
+
46
+ def compose(self):
47
+ yield self.perm_text
48
+ yield self.perm_ok
49
+ yield self.perm_no
50
+ yield self.perm_full
51
+
52
+ def show(self, req) -> None:
53
+ text = Text()
54
+ verb = tr("Изменить") if req.kind == "edit" else tr("Выполнить")
55
+ text.append(f"{verb}: ", style="bold")
56
+ text.append(req.title, style="bold red" if req.dangerous else "bold")
57
+ for why in req.danger:
58
+ text.append(f" · {why}", style="red")
59
+ for why in req.warnings:
60
+ text.append(f" · {why}", style="yellow")
61
+ text.append(tr("\nEnter — разрешить · Esc — отклонить · напишите текст и Enter — отклонить с пояснением"),
62
+ style="dim")
63
+ self.perm_text.update(text)
64
+ self.set_class(req.dangerous, "danger")
65
+ self.display = True
66
+
67
+ def hide(self) -> None:
68
+ self.display = False
69
+
70
+
71
+ class MentionList(OptionList):
72
+ """@file suggestions under the cursor. Never takes focus: the prompt keeps typing."""
73
+
74
+ can_focus = False
75
+
76
+ def __init__(self, **kwargs) -> None:
77
+ super().__init__(**kwargs)
78
+ self.mention_items: list[str] = []
79
+ self.takes_args: dict[str, bool] = {} # for /commands: does it expect arguments?
80
+
81
+ def show(self, items: list[str], labels: list[Text] | None = None, takes_args: dict[str, bool] | None = None) -> None:
82
+ self.mention_items = items
83
+ self.takes_args = takes_args or {}
84
+ self.clear_options()
85
+ self.add_options(labels or [Text(("📁 " if i.endswith("/") else "📄 ") + i) for i in items])
86
+ self.highlighted = 0
87
+ self.display = True
88
+
89
+ def hide(self) -> None:
90
+ self.display = False
91
+
92
+ def current(self) -> str | None:
93
+ if not self.display or self.highlighted is None or not self.mention_items:
94
+ return None
95
+ return self.mention_items[self.highlighted]
96
+
97
+
98
+ class PromptInput(TextArea):
99
+ """Enter sends, Ctrl+J (or Shift+Enter where the terminal supports it) adds a new line."""
100
+
101
+ class Submitted(Message):
102
+ def __init__(self, text: str) -> None:
103
+ super().__init__()
104
+ self.text = text
105
+
106
+ def __init__(self, **kwargs) -> None:
107
+ super().__init__(soft_wrap=True, show_line_numbers=False, tab_behavior="focus", **kwargs)
108
+ self._prompt_history: list[str] = []
109
+ self._prompt_pos = 0
110
+ self.mention_list: MentionList | None = None
111
+ self.permission_handler = None # set while the agent waits for approval
112
+
113
+ def suggestion_query(self) -> tuple[str, str] | None:
114
+ """('command', 'rev') while typing '/rev' at the start, ('mention', 'src/a') after '@', else None."""
115
+ row, col = self.cursor_location
116
+ line = self.document.get_line(row)[:col]
117
+ if row == 0:
118
+ m = _CMD_PREFIX.match(line)
119
+ if m:
120
+ return "command", m.group(1)
121
+ m = _PREFIX.search(line)
122
+ return ("mention", m.group(1)) if m else None
123
+
124
+ def accept_suggestion(self, item: str | None = None, submit: bool = False) -> None:
125
+ ml = self.mention_list
126
+ item = item or (ml.current() if ml else None)
127
+ query = self.suggestion_query()
128
+ if item is None or query is None:
129
+ if ml:
130
+ ml.hide()
131
+ return
132
+ kind, prefix = query
133
+ row, col = self.cursor_location
134
+ if kind == "command":
135
+ needs_args = ml.takes_args.get(item, False) if ml else False
136
+ if ml:
137
+ ml.hide()
138
+ if submit and not needs_args:
139
+ self.clear()
140
+ self.post_message(self.Submitted(f"/{item}"))
141
+ else:
142
+ self.replace(f"/{item} ", (0, 0), (row, col))
143
+ return
144
+ self.replace(f"@{item}" if item.endswith("/") else f"@{item} ", (row, col - len(prefix) - 1), (row, col))
145
+ if ml and not item.endswith("/"):
146
+ ml.hide()
147
+
148
+ async def _on_key(self, event: events.Key) -> None:
149
+ handler = self.permission_handler
150
+ if handler is not None and event.key in ("enter", "escape"):
151
+ event.stop()
152
+ event.prevent_default()
153
+ typed = self.text.strip()
154
+ if event.key == "escape":
155
+ handler("deny", "")
156
+ elif typed:
157
+ self.clear()
158
+ handler("deny", typed) # "no, do it like this instead"
159
+ else:
160
+ handler("once", "")
161
+ return
162
+ ml = self.mention_list
163
+ if ml is not None and ml.display:
164
+ if event.key in ("up", "down", "enter", "tab", "escape"):
165
+ event.stop()
166
+ event.prevent_default()
167
+ if event.key == "up":
168
+ ml.action_cursor_up()
169
+ elif event.key == "down":
170
+ ml.action_cursor_down()
171
+ elif event.key == "escape":
172
+ ml.hide()
173
+ else:
174
+ self.accept_suggestion(submit=event.key == "enter")
175
+ return
176
+ if event.key == "enter":
177
+ event.stop()
178
+ event.prevent_default()
179
+ text = self.text.strip()
180
+ if text:
181
+ self._prompt_history.append(text)
182
+ self._prompt_pos = len(self._prompt_history)
183
+ self.post_message(self.Submitted(text))
184
+ self.clear()
185
+ return
186
+ if event.key in ("ctrl+j", "shift+enter"):
187
+ event.stop()
188
+ event.prevent_default()
189
+ self.insert("\n")
190
+ return
191
+ if event.key in ("up", "down") and "\n" not in self.text and self._prompt_history:
192
+ event.stop()
193
+ event.prevent_default()
194
+ step = -1 if event.key == "up" else 1
195
+ self._prompt_pos = max(0, min(len(self._prompt_history), self._prompt_pos + step))
196
+ self.text = self._prompt_history[self._prompt_pos] if self._prompt_pos < len(self._prompt_history) else ""
197
+ self.move_cursor(self.document.end)
198
+ return
199
+ await super()._on_key(event)
200
+
201
+
202
+ class UserMessage(Static):
203
+ def __init__(self, text: str) -> None:
204
+ rich = Text(text)
205
+ for m in MENTION.finditer(text):
206
+ rich.stylize("bold underline", m.start(), m.end())
207
+ super().__init__(rich)
208
+
209
+
210
+ class Notice(Static):
211
+ pass
212
+
213
+
214
+ class ErrorMessage(Static):
215
+ def __init__(self, text: str) -> None:
216
+ super().__init__(Text("✗ " + text))
217
+
218
+
219
+ class AssistantMessage(Markdown):
220
+ """Streaming Markdown.
221
+
222
+ New Textual versions can append to a Markdown widget (only the new part is parsed); older ones
223
+ re-render the whole text, so there the refresh rate drops as the answer grows.
224
+ """
225
+
226
+ def __init__(self, text: str = "") -> None:
227
+ super().__init__(text)
228
+ self._stream_text = text
229
+ self._stream_pending = ""
230
+ self._stream_busy = False
231
+ self._stream_last = 0.0
232
+ self._stream_timer = None
233
+ self._can_append = hasattr(Markdown, "append")
234
+
235
+ def on_mount(self) -> None:
236
+ self._stream_timer = self.set_interval(0.05, self._flush)
237
+
238
+ def append_text(self, chunk: str) -> None:
239
+ self._stream_text += chunk
240
+ self._stream_pending += chunk
241
+
242
+ def _interval(self) -> float:
243
+ if self._can_append:
244
+ return 0.05
245
+ n = len(self._stream_text)
246
+ return 0.1 if n < 3000 else 0.25 if n < 12000 else 0.6
247
+
248
+ async def _flush(self, force: bool = False) -> None:
249
+ import time
250
+
251
+ if self._stream_busy or not self._stream_pending:
252
+ return
253
+ now = time.monotonic()
254
+ if not force and now - self._stream_last < self._interval():
255
+ return
256
+ self._stream_busy = True
257
+ self._stream_last = now
258
+ chunk, self._stream_pending = self._stream_pending, ""
259
+ try:
260
+ if self._can_append:
261
+ try:
262
+ await self.append(chunk)
263
+ return
264
+ except Exception:
265
+ self._can_append = False # fall back to full re-render
266
+ await self.update(self._stream_text)
267
+ finally:
268
+ self._stream_busy = False
269
+
270
+ async def finish(self) -> None:
271
+ if self._stream_timer is not None:
272
+ self._stream_timer.stop()
273
+ while self._stream_busy:
274
+ import asyncio
275
+ await asyncio.sleep(0.01)
276
+ await self._flush(force=True)
277
+
278
+
279
+ class ReasoningBlock(Static):
280
+ """Model thinking: shows the tail while streaming, collapses when done (click to expand)."""
281
+
282
+ def __init__(self) -> None:
283
+ super().__init__("")
284
+ self._think_text = ""
285
+ self._think_done = False
286
+ self._think_open = False
287
+
288
+ def append(self, chunk: str) -> None:
289
+ self._think_text += chunk
290
+ tail = " ".join(self._think_text[-300:].split())
291
+ self.update(Text(f"💭 {tail}"))
292
+
293
+ def finish(self) -> None:
294
+ self._think_done = True
295
+ self._render_done()
296
+
297
+ def _render_done(self) -> None:
298
+ if self._think_open:
299
+ self.update(Text(tr('💭 Размышления (свернуть)\n{0}', self._think_text.strip())))
300
+ else:
301
+ self.update(Text(tr('💭 Размышления · {0} символов (клик, чтобы развернуть)', len(self._think_text))))
302
+
303
+ def on_click(self) -> None:
304
+ if self._think_done:
305
+ self._think_open = not self._think_open
306
+ self._render_done()
307
+
308
+
309
+ class ToolCard(Vertical):
310
+ """One tool call: a header line, and a body (diff or output) that opens on click."""
311
+
312
+ def __init__(self, tool: str, title: str, kind: str, full_title: str = "", dangerous: bool = False) -> None:
313
+ super().__init__(classes=f"kind-{kind}" + (" danger" if dangerous else ""))
314
+ self.tool = tool
315
+ one_line = " ".join(title.split())
316
+ self.title_text = one_line if len(one_line) <= 100 else one_line[:99] + "…"
317
+ self.full_title = full_title or title
318
+ self.tool_header = Static(classes="tool-header")
319
+ self.tool_body = VerticalScroll(classes="tool-body")
320
+ self.tool_output = Static()
321
+ self._set_header("◌", "")
322
+
323
+ def compose(self):
324
+ yield self.tool_header
325
+ with self.tool_body:
326
+ yield self.tool_output
327
+
328
+ def _set_header(self, mark: str, extra: str | Text) -> None:
329
+ icon = TOOL_ICONS.get(self.tool, "•")
330
+ line = Text.assemble((f"{mark} ", "bold"), (f"{icon} ", "bold"), (self.title_text, ""))
331
+ if extra:
332
+ line.append(" ")
333
+ line.append(extra if isinstance(extra, Text) else Text(extra, style="dim"))
334
+ self.tool_header.update(line)
335
+
336
+ def show_pending(self, preview: str | None, kind: str) -> None:
337
+ """Waiting for approval: show what is about to happen."""
338
+ self.add_class("pending")
339
+ self._set_header("?", Text(tr("ждёт разрешения"), style="yellow"))
340
+ if preview:
341
+ if kind == "edit":
342
+ self.tool_output.update(Syntax(preview.rstrip(), "diff", theme="monokai", word_wrap=True,
343
+ background_color="default"))
344
+ else:
345
+ self.tool_output.update(Text(f"$ {preview}", style="bold"))
346
+ self.add_class("open")
347
+
348
+ def finish(self, result: ToolResult) -> None:
349
+ self.remove_class("pending", "open") # collapse after approval; small diffs and errors reopen below
350
+ self.add_class("error" if result.error else "done")
351
+ if result.diff is not None:
352
+ extra = Text.assemble((f"+{result.added}", "green"), " ", (f"−{result.removed}", "red"))
353
+ else:
354
+ extra = Text(result.title or "", style="dim") if result.title and result.title != self.title_text else ""
355
+ self._set_header("✗" if result.error else "✓", extra)
356
+ if result.diff:
357
+ self.tool_output.update(Syntax(result.diff.rstrip(), "diff", theme="monokai", word_wrap=True,
358
+ background_color="default"))
359
+ if result.added + result.removed <= 30:
360
+ self.add_class("open") # small diffs are shown right away
361
+ elif result.output and self.tool in ("bash", "grep", "glob", "ls") or result.error:
362
+ out = result.output.strip()
363
+ lines = out.splitlines()
364
+ shown = "\n".join(lines[:200]) + (tr('\n… ещё {0} строк', len(lines) - 200) if len(lines) > 200 else "")
365
+ parts = []
366
+ if self.tool == "bash" and self.full_title != self.title_text:
367
+ parts.append(Text(f"$ {self.full_title}\n", style="bold"))
368
+ parts.append(Text(shown, style="red" if result.error else "dim"))
369
+ self.tool_output.update(Group(*parts))
370
+ if result.error:
371
+ self.add_class("open")
372
+
373
+ def on_click(self) -> None:
374
+ self.toggle_class("open")
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.4
2
+ Name: anixcode
3
+ Version: 0.8.0
4
+ Summary: AI coding agent for the terminal. Bring your own API key.
5
+ Author: an1zy
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/an1zy/anixcode
8
+ Project-URL: Issues, https://github.com/an1zy/anixcode/issues
9
+ Keywords: ai,agent,coding,terminal,tui,llm,deepseek,openai
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Software Development
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: textual>=1.0
19
+ Requires-Dist: httpx>=0.27
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest>=8; extra == "dev"
22
+ Requires-Dist: ruff>=0.5; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # ANIX Code
26
+
27
+ [![tests](https://github.com/an1zy/anixcode/actions/workflows/tests.yml/badge.svg)](https://github.com/an1zy/anixcode/actions/workflows/tests.yml)
28
+ ![python](https://img.shields.io/badge/python-3.11%2B-blue) ![license](https://img.shields.io/badge/license-MIT-green)
29
+ ![status](https://img.shields.io/badge/status-alpha-orange)
30
+
31
+ 🇬🇧 English · 🇷🇺 [Русский](README.ru.md)
32
+
33
+ > ⚠️ Early version. The main things work, but bugs are possible: please report them in Issues.
34
+
35
+ An AI coding agent for your terminal. Paste an API key from any provider, describe a task, and the agent
36
+ reads the project, edits files and runs commands by itself. Every change is shown as a diff, and nothing
37
+ is changed without your approval (unless you turn on full access).
38
+
39
+ ```
40
+ ◆ ANIX Code ~/projects/my-app BUILD
41
+ ▎ add a /health endpoint to api.py with a test
42
+ ✓ → read api.py 84 lines
43
+ ✓ ⌕ grep def test_ 6 matches
44
+ ✓ ✎ edit api.py +7 −0
45
+ ✓ $ pytest -q → 0
46
+ Done: added GET /health and a test in tests/test_api.py, all 7 tests pass.
47
+ ```
48
+
49
+ ## Install
50
+
51
+ Python 3.11+ is required.
52
+
53
+ ```bash
54
+ pipx install git+https://github.com/an1zy/anixcode # one command
55
+ # or for development:
56
+ git clone https://github.com/an1zy/anixcode && cd anixcode
57
+ pip install -e .
58
+ anixcode # open in the current folder
59
+ anixcode ~/proj # or in a specific one
60
+ ```
61
+
62
+ On the first start a connection window opens: choose a provider, paste the key and press “Model list”.
63
+ Any OpenAI-compatible server works:
64
+
65
+ | Provider | Key |
66
+ |---|---|
67
+ | DeepSeek | platform.deepseek.com |
68
+ | OpenAI, Anthropic, Google Gemini, Groq | in their consoles |
69
+ | ANIX Router, Ollama, LM Studio | not needed, they run locally |
70
+ | ★ Your own providers | “+ Own” button: name, `/v1` address, key, “Check” |
71
+
72
+ The model has to support tool calling (function calling).
73
+
74
+ If you start ANIX Code from your home folder or `C:\Windows\System32` (a fresh cmd window), it asks which
75
+ project to work in. Switch projects any time with `Ctrl+P` or by clicking the path in the header; you can
76
+ also paste a `https://github.com/...` link there to clone a repository.
77
+
78
+ The interface language follows your system (Russian or English). Switch it with `/language`.
79
+
80
+ ## Usage
81
+
82
+ | Keys | |
83
+ |---|---|
84
+ | `Enter` / `Ctrl+J` | send / new line |
85
+ | `Tab` / `Shift+Tab` | **Build** (edits code) ↔ **Plan** (only reads and plans) |
86
+ | `Esc` | stop the agent |
87
+ | `Ctrl+P` | choose a project: recent, found git repositories, browse disks, clone by link |
88
+ | `F2` | full access on/off |
89
+ | `Ctrl+O` | model and key |
90
+ | `Ctrl+N` / `Ctrl+S` | new session / past sessions |
91
+ | `Ctrl+T` | theme picker with preview: ANIX (peach), Noir (black & white), Tokyo Night, Catppuccin, Dracula, Nord… |
92
+ | `F1` | help |
93
+
94
+ Click an action card to expand its diff or command output.
95
+ Logo and progress animations can be turned off in `settings.json`: `"animations": false`.
96
+
97
+ **Approvals.** When the agent wants to change a file or run a command, a line appears above the input
98
+ (the diff or the command is shown in the card in the chat): `Enter` allows, `Esc` denies, typing text and
99
+ pressing `Enter` denies and tells the agent what to do instead. Dangerous commands (`rm -rf`,
100
+ `Remove-Item -Recurse`, `del /s`, `git push --force`, `git reset --hard`…) are highlighted in red.
101
+ **Full access** (`F2` or click “🔒 ask first” at the bottom right): the agent works without asking until
102
+ you turn it off.
103
+
104
+ **@files.** Type `@` in a prompt to get suggestions of project files (↑↓, Enter or Tab). The whole file is
105
+ sent with the prompt and the agent can edit it right away: `fix the bug in @src/api.py`.
106
+ `@folder/` attaches a listing of the folder.
107
+
108
+ **Project rules.** `/init`: the agent studies the project and writes `AGENTS.md` (what the project is,
109
+ structure, build and test commands, code style). Add your own rules there, for example “tests use vitest,
110
+ don't touch the legacy folder”. The agent reads this file before every task.
111
+
112
+ **Reliability:**
113
+ - `/undo` reverts all file changes from the agent's last answer (several times in a row, also after a
114
+ restart); `/redo` brings them back. Terminal commands (`bash`) are not undone.
115
+ - The bottom right shows how full the model context is. At 80% the history is compressed automatically:
116
+ old command outputs are removed first, then old steps are folded into a summary. Manually: `/compact`.
117
+ - On network failures, timeouts, 429 and 5xx responses the request is retried up to 4 times.
118
+ - The context size is guessed from the model name. For your own model set it in `settings.json`:
119
+ `"context_window": 128000`.
120
+
121
+ ## Commands
122
+
123
+ Type `/` to get the list with descriptions (↑↓, `Tab` completes, `Enter` runs).
124
+ The set follows Claude Code and OpenCode.
125
+
126
+ | Command | |
127
+ |---|---|
128
+ | `/init` | study the project and write `AGENTS.md` |
129
+ | `/review [focus]` | review uncommitted changes (or the last commit) |
130
+ | `/commit [details]` | commit with a good message in the project's style |
131
+ | `/test [what]` | find and run the tests, fix failing ones |
132
+ | `/fix <error>` | fix an error from its text or a description |
133
+ | `/explain <@file>` | explain code |
134
+ | `/pr` | pull request description for the current branch |
135
+ | `/undo` / `/redo` | undo the last answer's changes / bring them back |
136
+ | `/compact` | compress the history |
137
+ | `/new`, `/clear`, `/sessions`, `/resume` | sessions |
138
+ | `/model`, `/connect` | model and key |
139
+ | `/project` | choose a project |
140
+ | `/theme`, `/mode`, `/permissions` | theme, Build/Plan, full access |
141
+ | `/status` | summary: project, model, tokens, context |
142
+ | `/export` | save the session as Markdown |
143
+ | `/doctor` | check git, ripgrep, connection to the model, AI-RPC |
144
+ | `/language` | interface language: Русский / English (after a restart) |
145
+
146
+ **Quick input:**
147
+ - `!command` runs a command in the terminal yourself, without the model; the agent sees the output:
148
+ `!pytest -q`, then “fix it”.
149
+ - `# text` saves a rule to `AGENTS.md`: `# use pnpm, not npm`.
150
+
151
+ **Own commands.** A Markdown file in `.anixcode/commands/name.md` (this project) or in
152
+ `%APPDATA%\anixcode\commands\name.md` / `~/.config/anixcode/commands/name.md` (all projects) becomes the
153
+ command `/name`. `$ARGUMENTS` is replaced with everything after the command, `$1`, `$2` with single words.
154
+ An example is in `.anixcode/commands/check.md`:
155
+
156
+ ```markdown
157
+ ---
158
+ description: run the project tests and show the result
159
+ ---
160
+ Run `pytest -q`. If tests fail, show the failing test names and the short reason for each. $ARGUMENTS
161
+ ```
162
+
163
+ Prompt commands also work without the interface: `anixcode run "/review"`.
164
+
165
+ **Without the interface:**
166
+ ```bash
167
+ anixcode run "find where the discount is calculated and explain it" --plan
168
+ anixcode run "fix the failing test" -y # -y: allow everything without asking
169
+ anixcode connect # connect a model from the console
170
+ anixcode models # list the provider's models
171
+ ```
172
+
173
+ ## Tools
174
+
175
+ | Tool | |
176
+ |---|---|
177
+ | `read` | reads a file with line numbers, big files in parts |
178
+ | `ls`, `glob` | folder tree, find files by pattern |
179
+ | `grep` | search in code (ripgrep if installed) |
180
+ | `edit` | precise text replacement; the file must have been read and not changed since |
181
+ | `write` | new file or full rewrite |
182
+ | `bash` | commands: tests, git, builds (PowerShell on Windows) |
183
+
184
+ File tools never leave the project folder. Edits and commands need approval unless full access is on.
185
+ Fine-tuning in `settings.json`: `"permissions": {"edit": "ask", "exec": "ask"}` (`ask` / `allow` / `deny`).
186
+
187
+ **AI-RPC.** If [AI-RPC](https://github.com/an1zy/ai-rpc) is running, Discord shows “ANIX Code · Generating”.
188
+
189
+ ## Updates and keys
190
+
191
+ Keys and settings are stored **outside the code folder**, so you can unpack a new version over the old one
192
+ or into another folder: keys, own providers and sessions stay. To move to another computer, copy the whole
193
+ folder below.
194
+
195
+ `%APPDATA%\anixcode\` (Windows) or `~/.config/anixcode/`:
196
+ - `settings.json`: provider, model, theme, permissions, language;
197
+ - `auth.json`: API keys (only on your computer, readable only by your user);
198
+ - `sessions.db`: session history.
199
+
200
+ ## Development
201
+
202
+ ```bash
203
+ pip install -e ".[dev]" && pytest
204
+ ```
205
+
206
+ **Full self-test:** `python selftest.py` (on Windows you can double-click `selftest.bat`). It runs the unit
207
+ tests, then starts the interface invisibly with a fake model and checks the answers, approvals, full access,
208
+ `/undo` and `/redo`, `/` and `@` suggestions, `!command`, `# note`, Build/Plan, `/status`, `/doctor`,
209
+ `/export`, `/compact`, all windows, stopping with Esc and `/new`. No API key needed, no money spent, your
210
+ settings and sessions are not touched.
211
+
212
+ Translations: interface strings are written in Russian in the code as `tr("…")`; English versions live in
213
+ `anixcode/i18n_en.py` (a test checks that every string has one).
214
+
215
+ ```
216
+ anixcode/
217
+ llm.py OpenAI-compatible API client: streaming, tool calls, readable errors, retries
218
+ agent.py the agent loop, approvals, Build/Plan modes, undo/redo
219
+ tools/ read, ls, glob, grep, edit, write, bash
220
+ prompts.py system prompt + AGENTS.md
221
+ storage.py sessions and file snapshots in SQLite
222
+ checkpoints.py file snapshots for /undo
223
+ compaction.py history compression to fit the context
224
+ danger.py spotting dangerous commands
225
+ mentions.py @files: suggestions and attaching
226
+ commands.py /commands: built-in, ready-made prompts, own ones from .md
227
+ i18n.py Russian / English interface
228
+ providers.py provider list
229
+ tui/ the Textual interface
230
+ ```
231
+
232
+ ## Roadmap
233
+
234
+ - [x] Undo (`/undo`, `/redo`)
235
+ - [x] History compression, retries on failures
236
+ - [x] `@file` in prompts, `/init`, dangerous-command highlighting
237
+ - [x] `/review`, `/commit`, `/test`…, own commands from `.md`, `!` and `#`
238
+ - [x] English interface
239
+ - [ ] MCP servers
240
+ - [ ] Several agents in parallel
241
+ - [ ] Desktop version
@@ -0,0 +1,35 @@
1
+ anixcode/__init__.py,sha256=N4bE9Cs9daxTvGJ9i8p1dbn_w9i6E4A1UtN6UOwZoPo,102
2
+ anixcode/__main__.py,sha256=-CfcTSUPfiKqynzzzPrFLVfacQtEtJ75fxyt1kkbrms,87
3
+ anixcode/agent.py,sha256=mtThSZh7ozB4ECN_EVAh_zrxV0n-14jwlbx7qPl0B88,15437
4
+ anixcode/airpc.py,sha256=z8wwQYl0qGGewDJBo_-sR5A7DWbLOMMy_Fo4TxuZ-x0,2165
5
+ anixcode/checkpoints.py,sha256=uIhILHlUX0exGPnnD0EvYVLtelZcg2NBNL2_Xj5sWDc,3332
6
+ anixcode/cli.py,sha256=Pwu5aU2bQ7C_VTLh4wl2yGFeDGjPCDkPOwvsvuqoktA,8242
7
+ anixcode/commands.py,sha256=oIFeWn9_3HKWIg6O8TXJquF2H0JqfkZsjMPtrUft9yE,12027
8
+ anixcode/compaction.py,sha256=PJKfGXNhDRTmGlcWTSjSgBh8jykMs3y1RaCJ0vpps54,4075
9
+ anixcode/danger.py,sha256=WPUyqzWpSgjwHEtgdp_yaIj8h45lFb_Dil2jsPei1ao,5799
10
+ anixcode/i18n.py,sha256=JFYd-sS1ZoKtAKj3n2gaNmGhmVc6PoDSjwIsuyDXL7s,2213
11
+ anixcode/i18n_en.py,sha256=DPgrgqSV30sKEtPPKZosxDUcjuEkGuxb3nigHxkAo5w,31086
12
+ anixcode/llm.py,sha256=O3nEp-ceTRKkgldTsWm0MXc_6t024xurLaa8uhMDCnU,10766
13
+ anixcode/mentions.py,sha256=OWTkW0Z9-V8apOyMh-jjxMdFBV-byYqG6jOZp8gAxmU,4303
14
+ anixcode/projects.py,sha256=4YfOK65_C83Y4-qAQSyoXkhJeOaFJa1pkA5y0DwZbPg,5597
15
+ anixcode/prompts.py,sha256=m57kpHm6Jsex0IJAEj_LbvKnFLbRkMlXBSgNeH9jbO0,2753
16
+ anixcode/providers.py,sha256=Ck_rd8beTfZ22mCipVWzy2kA2UPUv1MQg7xifVUJKhI,2634
17
+ anixcode/settings.py,sha256=tkwJdkpNpwWAYHizyEqsJFzItQe-4Cg26Tx_-e7LcDU,4076
18
+ anixcode/storage.py,sha256=VTv5itmF3rht-TxojRWIasLO7bzkPScMOWdjDXqE_bo,5865
19
+ anixcode/tools/__init__.py,sha256=CPaHry0FyeT6z4uzzo_sxV6LwoQ87QS0XxbLUvSafeU,576
20
+ anixcode/tools/base.py,sha256=AtfcZRUuxBqcUvdTfj4_D5CTALf0U4KFPDoOaPQYHoQ,7412
21
+ anixcode/tools/files.py,sha256=3nJOdFMR6k9Qhkm4Sl4Dk6vVYKcd_vMgQY0KiOM3QHs,10595
22
+ anixcode/tools/search.py,sha256=0ikeDWkfKxGFiyR40L_fPP1Kj8jmXUdphkelo6wYyqs,4407
23
+ anixcode/tools/shell.py,sha256=lzxaiH1sJHng4qFj1BfnrI7t0vpcm-aDPLzVQ6ptc_c,3516
24
+ anixcode/tui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ anixcode/tui/anim.py,sha256=qMjUq3FMUdG25Ppb62TSFl1y4EPz_dRnYwKg8LnsLWg,9817
26
+ anixcode/tui/app.py,sha256=G7yAaq6c9kVaQEKttAt0neIsRwbCzKKtr9Upn1cY-nY,38411
27
+ anixcode/tui/app.tcss,sha256=hva0evzN_DOBgId1d25zins-H8oFioTl-3_vl9GmeSo,4282
28
+ anixcode/tui/screens.py,sha256=oarU3ot94_jYGMI5J0F4U39F3dGas_FyJKwbG-SzqfQ,25967
29
+ anixcode/tui/widgets.py,sha256=BJKNxPnEwZTZt6RJWknimD6GFBd-riQfMjXDv0HZSxk,14720
30
+ anixcode-0.8.0.dist-info/licenses/LICENSE,sha256=qCl75LKPMwvZm0Xgo-DFYzQAgOCy2fCxzds4iqRW0K4,1062
31
+ anixcode-0.8.0.dist-info/METADATA,sha256=8hOkE2NDghAwxIaVgB-WCJW9xqQymvRjgQs3jJroUfk,11032
32
+ anixcode-0.8.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
33
+ anixcode-0.8.0.dist-info/entry_points.txt,sha256=gC37zpX1yBczN1eZfNsOXEi31djH7VkUeja2nTG0ivo,47
34
+ anixcode-0.8.0.dist-info/top_level.txt,sha256=AjvTvQQfcgdELZzMyaslRPlXxGaa3qWC-aOYrqxRy28,9
35
+ anixcode-0.8.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ anixcode = anixcode.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 an1zy
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.