cli-nix 0.3.0__tar.gz

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 (120) hide show
  1. cli_nix-0.3.0/LICENSE +18 -0
  2. cli_nix-0.3.0/MANIFEST.in +2 -0
  3. cli_nix-0.3.0/PKG-INFO +340 -0
  4. cli_nix-0.3.0/README.md +316 -0
  5. cli_nix-0.3.0/cli_nix.egg-info/PKG-INFO +340 -0
  6. cli_nix-0.3.0/cli_nix.egg-info/SOURCES.txt +118 -0
  7. cli_nix-0.3.0/cli_nix.egg-info/dependency_links.txt +1 -0
  8. cli_nix-0.3.0/cli_nix.egg-info/entry_points.txt +2 -0
  9. cli_nix-0.3.0/cli_nix.egg-info/requires.txt +2 -0
  10. cli_nix-0.3.0/cli_nix.egg-info/top_level.txt +1 -0
  11. cli_nix-0.3.0/nix/__init__.py +1 -0
  12. cli_nix-0.3.0/nix/__main__.py +4 -0
  13. cli_nix-0.3.0/nix/app.py +188 -0
  14. cli_nix-0.3.0/nix/avatar.py +518 -0
  15. cli_nix-0.3.0/nix/body.py +55 -0
  16. cli_nix-0.3.0/nix/brain.py +198 -0
  17. cli_nix-0.3.0/nix/cli.py +27 -0
  18. cli_nix-0.3.0/nix/commands.py +1733 -0
  19. cli_nix-0.3.0/nix/config.py +83 -0
  20. cli_nix-0.3.0/nix/daemon.py +210 -0
  21. cli_nix-0.3.0/nix/git.py +231 -0
  22. cli_nix-0.3.0/nix/i18n.py +734 -0
  23. cli_nix-0.3.0/nix/journal.py +59 -0
  24. cli_nix-0.3.0/nix/logger.py +24 -0
  25. cli_nix-0.3.0/nix/modules/__init__.py +46 -0
  26. cli_nix-0.3.0/nix/modules/bundled/__init__.py +0 -0
  27. cli_nix-0.3.0/nix/modules/bundled/c/__init__.py +0 -0
  28. cli_nix-0.3.0/nix/modules/bundled/c/blocks.json +21 -0
  29. cli_nix-0.3.0/nix/modules/bundled/c/gen/function.tmpl +4 -0
  30. cli_nix-0.3.0/nix/modules/bundled/c/module.json +6 -0
  31. cli_nix-0.3.0/nix/modules/bundled/c/ops.json +19 -0
  32. cli_nix-0.3.0/nix/modules/bundled/c/probe.json +9 -0
  33. cli_nix-0.3.0/nix/modules/bundled/cpp/__init__.py +0 -0
  34. cli_nix-0.3.0/nix/modules/bundled/cpp/blocks.json +30 -0
  35. cli_nix-0.3.0/nix/modules/bundled/cpp/gen/class.tmpl +4 -0
  36. cli_nix-0.3.0/nix/modules/bundled/cpp/gen/function.tmpl +4 -0
  37. cli_nix-0.3.0/nix/modules/bundled/cpp/module.json +6 -0
  38. cli_nix-0.3.0/nix/modules/bundled/cpp/ops.json +25 -0
  39. cli_nix-0.3.0/nix/modules/bundled/cpp/probe.json +14 -0
  40. cli_nix-0.3.0/nix/modules/bundled/csharp/__init__.py +0 -0
  41. cli_nix-0.3.0/nix/modules/bundled/csharp/blocks.json +30 -0
  42. cli_nix-0.3.0/nix/modules/bundled/csharp/gen/class.tmpl +4 -0
  43. cli_nix-0.3.0/nix/modules/bundled/csharp/gen/function.tmpl +4 -0
  44. cli_nix-0.3.0/nix/modules/bundled/csharp/module.json +6 -0
  45. cli_nix-0.3.0/nix/modules/bundled/csharp/ops.json +25 -0
  46. cli_nix-0.3.0/nix/modules/bundled/csharp/probe.json +14 -0
  47. cli_nix-0.3.0/nix/modules/bundled/go/__init__.py +0 -0
  48. cli_nix-0.3.0/nix/modules/bundled/go/blocks.json +17 -0
  49. cli_nix-0.3.0/nix/modules/bundled/go/gen/function.tmpl +4 -0
  50. cli_nix-0.3.0/nix/modules/bundled/go/module.json +6 -0
  51. cli_nix-0.3.0/nix/modules/bundled/go/ops.json +13 -0
  52. cli_nix-0.3.0/nix/modules/bundled/go/probe.json +14 -0
  53. cli_nix-0.3.0/nix/modules/bundled/java/__init__.py +0 -0
  54. cli_nix-0.3.0/nix/modules/bundled/java/blocks.json +30 -0
  55. cli_nix-0.3.0/nix/modules/bundled/java/gen/class.tmpl +4 -0
  56. cli_nix-0.3.0/nix/modules/bundled/java/gen/function.tmpl +4 -0
  57. cli_nix-0.3.0/nix/modules/bundled/java/module.json +6 -0
  58. cli_nix-0.3.0/nix/modules/bundled/java/ops.json +25 -0
  59. cli_nix-0.3.0/nix/modules/bundled/java/probe.json +14 -0
  60. cli_nix-0.3.0/nix/modules/bundled/javascript/__init__.py +0 -0
  61. cli_nix-0.3.0/nix/modules/bundled/javascript/blocks.json +30 -0
  62. cli_nix-0.3.0/nix/modules/bundled/javascript/gen/class.tmpl +4 -0
  63. cli_nix-0.3.0/nix/modules/bundled/javascript/gen/function.tmpl +4 -0
  64. cli_nix-0.3.0/nix/modules/bundled/javascript/module.json +6 -0
  65. cli_nix-0.3.0/nix/modules/bundled/javascript/ops.json +25 -0
  66. cli_nix-0.3.0/nix/modules/bundled/javascript/probe.json +19 -0
  67. cli_nix-0.3.0/nix/modules/bundled/php/__init__.py +0 -0
  68. cli_nix-0.3.0/nix/modules/bundled/php/blocks.json +30 -0
  69. cli_nix-0.3.0/nix/modules/bundled/php/gen/class.tmpl +4 -0
  70. cli_nix-0.3.0/nix/modules/bundled/php/gen/function.tmpl +4 -0
  71. cli_nix-0.3.0/nix/modules/bundled/php/module.json +6 -0
  72. cli_nix-0.3.0/nix/modules/bundled/php/ops.json +25 -0
  73. cli_nix-0.3.0/nix/modules/bundled/php/probe.json +14 -0
  74. cli_nix-0.3.0/nix/modules/bundled/python/__init__.py +0 -0
  75. cli_nix-0.3.0/nix/modules/bundled/python/blocks.json +30 -0
  76. cli_nix-0.3.0/nix/modules/bundled/python/gen/class.tmpl +3 -0
  77. cli_nix-0.3.0/nix/modules/bundled/python/gen/function.tmpl +3 -0
  78. cli_nix-0.3.0/nix/modules/bundled/python/gen/scaffold_crud.tmpl +35 -0
  79. cli_nix-0.3.0/nix/modules/bundled/python/gen/scaffold_model.tmpl +9 -0
  80. cli_nix-0.3.0/nix/modules/bundled/python/gen/scaffold_test.tmpl +41 -0
  81. cli_nix-0.3.0/nix/modules/bundled/python/gen/testgen.tmpl +13 -0
  82. cli_nix-0.3.0/nix/modules/bundled/python/module.json +1 -0
  83. cli_nix-0.3.0/nix/modules/bundled/python/ops.json +25 -0
  84. cli_nix-0.3.0/nix/modules/bundled/python/probe.json +14 -0
  85. cli_nix-0.3.0/nix/modules/bundled/rust/__init__.py +0 -0
  86. cli_nix-0.3.0/nix/modules/bundled/rust/blocks.json +21 -0
  87. cli_nix-0.3.0/nix/modules/bundled/rust/gen/function.tmpl +4 -0
  88. cli_nix-0.3.0/nix/modules/bundled/rust/module.json +6 -0
  89. cli_nix-0.3.0/nix/modules/bundled/rust/ops.json +19 -0
  90. cli_nix-0.3.0/nix/modules/bundled/rust/probe.json +14 -0
  91. cli_nix-0.3.0/nix/modules/bundled/typescript/__init__.py +0 -0
  92. cli_nix-0.3.0/nix/modules/bundled/typescript/blocks.json +30 -0
  93. cli_nix-0.3.0/nix/modules/bundled/typescript/gen/class.tmpl +4 -0
  94. cli_nix-0.3.0/nix/modules/bundled/typescript/gen/function.tmpl +4 -0
  95. cli_nix-0.3.0/nix/modules/bundled/typescript/module.json +6 -0
  96. cli_nix-0.3.0/nix/modules/bundled/typescript/ops.json +25 -0
  97. cli_nix-0.3.0/nix/modules/bundled/typescript/probe.json +19 -0
  98. cli_nix-0.3.0/nix/modules/engine.py +174 -0
  99. cli_nix-0.3.0/nix/modules/loader.py +172 -0
  100. cli_nix-0.3.0/nix/pet.py +103 -0
  101. cli_nix-0.3.0/nix/scaffold.py +251 -0
  102. cli_nix-0.3.0/nix/scanner.py +73 -0
  103. cli_nix-0.3.0/nix/state.py +63 -0
  104. cli_nix-0.3.0/nix/ui.py +1187 -0
  105. cli_nix-0.3.0/pyproject.toml +50 -0
  106. cli_nix-0.3.0/requirements.txt +2 -0
  107. cli_nix-0.3.0/setup.cfg +4 -0
  108. cli_nix-0.3.0/tests/test_avatar.py +138 -0
  109. cli_nix-0.3.0/tests/test_body.py +138 -0
  110. cli_nix-0.3.0/tests/test_brain.py +79 -0
  111. cli_nix-0.3.0/tests/test_codeops.py +270 -0
  112. cli_nix-0.3.0/tests/test_commands.py +176 -0
  113. cli_nix-0.3.0/tests/test_config.py +104 -0
  114. cli_nix-0.3.0/tests/test_daemon.py +82 -0
  115. cli_nix-0.3.0/tests/test_modules.py +239 -0
  116. cli_nix-0.3.0/tests/test_pet.py +40 -0
  117. cli_nix-0.3.0/tests/test_scaffold.py +360 -0
  118. cli_nix-0.3.0/tests/test_scanner.py +57 -0
  119. cli_nix-0.3.0/tests/test_state.py +48 -0
  120. cli_nix-0.3.0/tests/test_tui.py +246 -0
cli_nix-0.3.0/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ MIT No Attribution
2
+
3
+ Copyright (c) 2026 MrBulochka
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.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ recursive-include nix/modules/bundled *.json *.tmpl
2
+ include LICENSE README.md requirements.txt
cli_nix-0.3.0/PKG-INFO ADDED
@@ -0,0 +1,340 @@
1
+ Metadata-Version: 2.4
2
+ Name: cli-nix
3
+ Version: 0.3.0
4
+ Summary: NIX — local-first project-aware testing agent
5
+ License-Expression: MIT-0
6
+ Keywords: cli,tui,testing,agent,textual,code-analysis
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: Microsoft :: Windows
11
+ Classifier: Operating System :: POSIX :: Linux
12
+ Classifier: Operating System :: MacOS
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Testing
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: rich>=13
22
+ Requires-Dist: textual>=0.60
23
+ Dynamic: license-file
24
+
25
+ <div align="center">
26
+
27
+ <pre>
28
+ _ _______ __
29
+ / | / / _/ |/ /
30
+ / |/ // / | /
31
+ / /| // / / |
32
+ /_/ |_/___//_/|_|
33
+ </pre>
34
+
35
+ # NIX — Local Project Testing Agent
36
+
37
+ A local-first terminal agent that lives inside your project directory.
38
+ It scans, analyzes, mutates, tests, and learns — all through a rich,
39
+ modern TUI in the terminal.
40
+
41
+ ![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat&logo=python&logoColor=white)
42
+ ![License](https://img.shields.io/badge/license-MIT--0-brightgreen)
43
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
44
+ ![TUI](https://img.shields.io/badge/built_on-Textual-8BE9FD)
45
+
46
+ </div>
47
+
48
+ ---
49
+
50
+ ## Screenshots
51
+
52
+ | Main view with your pet | Project scan |
53
+ |:---:|:---:|
54
+ | ![Main](docs/screenshots/main.svg) | ![Scan](docs/screenshots/scan.svg) |
55
+
56
+ | Pet panel | Status | Help |
57
+ |:---:|:---:|:---:|
58
+ | ![Pet](docs/screenshots/pet.svg) | ![Status](docs/screenshots/status.svg) | ![Help](docs/screenshots/help.svg) |
59
+
60
+ > Screenshots are real headless renders of the actual TUI. Regenerate them
61
+ > any time with [`scripts/make_screenshots.py`](scripts/make_screenshots.py).
62
+
63
+ ## Features
64
+
65
+ - Full-screen terminal UI built on [Textual](https://github.com/Textualize/textual)
66
+ — like opencode or Claude Code
67
+ - **Pet companion** — a tamagotchi that lives in your repo, evolves, and
68
+ gets a new skin every `pill` (8 skins, 30-minute cooldown)
69
+ - **Language modules** — plain-data packs (no code) describing how blocks,
70
+ operations and generation work per language
71
+ - **Project brain** — `.nix/brain/` index of functions/classes/patterns that
72
+ the pet rebuilds on demand (always fresher than the developer's memory)
73
+ - **Read-only by default** — dry-runs for everything (scan, status, git,
74
+ gen, wrap, rename): nothing changes unless `--apply`
75
+ - **Git companion** — status, diff, log, branch, auto-messaged commits,
76
+ remote info and optional `gh`/`glab` PR support
77
+ - **IDE daemon** — headless JSON-line protocol over stdin/stdout or a socket
78
+ - Chain commands on one line with `;` or `&&`
79
+
80
+ ## Install
81
+
82
+ ### From a git clone (any platform)
83
+
84
+ **Windows 10/11 + Python 3.11+**
85
+
86
+ ```bat
87
+ git clone https://github.com/Mr-Bulochka/NIX.git
88
+ cd NIX
89
+ python -m pip install -r requirements.txt
90
+ python -m nix
91
+ ```
92
+
93
+ **Linux / macOS + Python 3.11+**
94
+
95
+ ```bash
96
+ git clone https://github.com/Mr-Bulochka/NIX.git
97
+ cd NIX
98
+ python3 -m pip install -r requirements.txt
99
+ python3 -m nix
100
+ ```
101
+
102
+ ### From PyPI
103
+
104
+ ```bash
105
+ pip install cli-nix
106
+ nix
107
+ ```
108
+
109
+ ### From the latest GitHub Release
110
+
111
+ Check the **Releases** tab for the current `.whl`, then:
112
+
113
+ ```bash
114
+ pip install https://github.com/Mr-Bulochka/NIX/releases/download/v0.3.0/cli_nix-0.3.0-py3-none-any.whl
115
+ nix
116
+ ```
117
+
118
+ ### Platform support
119
+
120
+ NIX is pure Python (3.11+) with two cross-platform dependencies
121
+ (`rich`, `textual`) — the same code runs on Windows, Linux and macOS.
122
+ The `nix` console command is created by the package entry point and works
123
+ everywhere; `nix.bat` in the repo root is just a Windows convenience
124
+ launcher equivalent to `python -m nix`.
125
+
126
+ ## Quick Start
127
+
128
+ ```bash
129
+ cd C:\MyProject # or /home/you/myproject on Linux/macOS
130
+ nix # or: python -m nix
131
+ ```
132
+
133
+ On first launch, NIX creates a `.nix/` directory and asks for your pet's name.
134
+
135
+ ## The Interface
136
+
137
+ - Header bar with project name, safety mode and live clock
138
+ - Pet panel with animated idle spinner and stats
139
+ - Buttons row — **clickable with the mouse**: Pet, Scan, Status, Settings, Quit
140
+ - Scrollable color-coded event log (syntax highlighting, tables, panels)
141
+ - Command input with focus, arrow-key navigation
142
+ - Hotkeys: `Ctrl+Q` quit, `Ctrl+L` clear, `Ctrl+S` scan, `Ctrl+P` pet
143
+
144
+ ## Commands
145
+
146
+ Every command is a **constructor**: positional words + `--flag value`, `-flag`
147
+ switches and `k=v` pairs, all combinable on one infinite-length line. Chain
148
+ several commands in a single line with `;` or `&&`.
149
+
150
+ | Command | Description |
151
+ |---------|-------------|
152
+ | `help [cmd]` | Show all commands, or details of one |
153
+ | `which <cmd>` | Show info about a command |
154
+ | `status` | Current project and NIX state |
155
+ | `stats [--top N]` | Full project analytics |
156
+ | `scan [--tree] [--depth N]` | Read-only project inventory |
157
+ | `tree [--depth N]` | Show project tree |
158
+ | `ls [path] [--all] [--size]` | List a directory |
159
+ | `lang [--top N]` | Detect languages in the project |
160
+ | `tests [--max N] [--count]` | Find test files and functions |
161
+ | `deps [--top N]` | Collect imported modules |
162
+ | `find <name> [--ext py,js]` | Search files by name |
163
+ | `todo [--max N]` | Scan code for TODO/FIXME |
164
+ | `attempts [N\|+N\|-N]` | Show/set attempt budget |
165
+ | `mode [local\|safe\|git]` | Show/set safety mode |
166
+ | `save` | Persist config and pet |
167
+ | `pet` | Show pet status |
168
+ | `pill [--status]` | Give the pet a skin pill (30 min cooldown) |
169
+ | `settings` | Open settings |
170
+ | `tag [name] [--remove]` | List/add/remove pet tags |
171
+ | `note <text>` | Save an idea to project memory |
172
+ | `memory [N]` | Show recent project notes |
173
+ | `journal <text>` | Write a journal entry |
174
+ | `logs [N]` | Show session log |
175
+ | `history [N]` | Show journal history |
176
+ | `checkpoint [name]` | List or create checkpoints |
177
+ | `echo <text>` | Print text to the log |
178
+ | `time` | Show current UTC time |
179
+ | `pwd` | Show current working directory |
180
+ | `version` | Show NIX version |
181
+ | `clear` | Clear the event log |
182
+ | `quit` | Exit NIX |
183
+
184
+ ### Code & language modules
185
+
186
+ NIX understands code through **code modules** (language modules) —
187
+ plain-data packs (no code) that describe how blocks, operations and
188
+ generation work in a given language. Bundled modules live in
189
+ `nix/modules/bundled/`; user modules are picked up from
190
+ `~/.nix/modules/<id>/` and shadow bundled ones.
191
+
192
+ | Command | Description |
193
+ |---------|-------------|
194
+ | `module [name]` | List language modules or show one in detail |
195
+ | `defs [--max N] [glob]` | List project functions/classes (from the project index) |
196
+ | `blocks <file> <line>` | Show the block enclosing a line |
197
+ | `wrap <file> <line> in <op> [--slot v] [--apply]` | Wrap a block in a language op (dry-run unless `--apply`) |
198
+ | `gen <type> <name> [--into f] [--at N] [--apply] [--params .. --ret .. --doc .. --body ..]` | Generate code from a template (preview unless `--into`; `--apply` writes into it or creates a new file) |
199
+ | `make <entity> [--cols name:str:pk,...] [--into f] [--test-into f] [--apply]` | Scaffold a model + CRUD + tests from column specs (dry-run unless `--apply`; language inferred from `--into` extension or `--lang`, an unsupported hint is an error) |
200
+ | `testgen <file\|all> [--into f] [--apply]` | Generate test stubs from the project index (dry-run unless `--apply`) |
201
+ | `recipe [list\|<name>] [--apply] [args...]` | Run named command chains; built-ins: `feature`, `scaffold`, `test`; user recipes live in `.nix/recipes.json` (`{0}`, `{1}`, ... are positional args; re-run with `--apply` to write) |
202
+ | `rename <old> <new> [--file f] [--apply]` | Project-wide symbolic rename (dry-run unless `--apply`) |
203
+ | `ident` | Show the project's identity patterns (naming, docstrings, ...) |
204
+
205
+ ### Version control companion
206
+
207
+ | Command | Description |
208
+ |---------|-------------|
209
+ | `git status` | Short working-tree status |
210
+ | `git log [N]` | Last N commits oneline |
211
+ | `git diff` | Change statistics |
212
+ | `git branch` | Current branch |
213
+ | `git commit [msg] [--apply]` | Stage all and commit; message auto-generated from diff (dry-run unless `--apply`) |
214
+ | `remote info` | Show origin, platform (GitHub/GitLab/other), branch, ahead/behind |
215
+ | `remote fetch` / `pull` / `push` | Remote sync, dry-run unless `--apply` |
216
+ | `remote pr` | List open PRs/MRs via `gh`/`glab`; `remote pr "title" --apply` opens one |
217
+
218
+ ### IDE daemon & protocol (Stage I)
219
+
220
+ NIX runs headless without the TUI, so any IDE/editor can drive the same
221
+ deterministic toolkit:
222
+
223
+ ```
224
+ nix daemon # line protocol over stdin/stdout (JSON Lines)
225
+ nix daemon --socket 127.0.0.1:7411
226
+ nix daemon --once "status" # one command, one JSON response
227
+ ```
228
+
229
+ Each request is one line; each response is one JSON object:
230
+
231
+ ```
232
+ > HELP
233
+ {"ok": true, "session_end": false, "commands": [{"name": "defs", ...}]}
234
+ > defs
235
+ {"ok": true, "session_end": false, "events": [{"op": "block", "title": "Symbols", ...}]}
236
+ > quit
237
+ {"ok": true, "session_end": true}
238
+ ```
239
+
240
+ Commands are the exact `COMMANDS` the TUI uses; events are ordered
241
+ (`message`, `block`, `code`, `tree`, `pet`, `status`, `scan`, `logs`,
242
+ `history`, `help`) and re-renderable by the client verbatim.
243
+
244
+ Module layout:
245
+
246
+ ```
247
+ nix/modules/bundled/python/
248
+ ├── module.json id, name, version, extensions
249
+ ├── blocks.json block start regex + body mode (indent/braces/do-end)
250
+ ├── ops.json semantic ops (wrap-in-try, wrap-in-if, ...)
251
+ ├── gen/*.tmpl generation templates (function, class, ...)
252
+ └── probe.json self-test cases
253
+ ```
254
+
255
+ The pet's memory of a project lives in `.nix/brain/` (`index.json`,
256
+ `patterns.json`) and is (re)built by `defs`/`ident`/`gen` on demand, so
257
+ the pet always knows the project fresher than the developer does.
258
+
259
+ Pets evolve and get a **new random skin** when you give them a pill (once every
260
+ 30 minutes); the stage/pattern is always preserved. Each of the 8 skins has
261
+ its own signature palette, so every pill is a visible transformation.
262
+
263
+ ## Learning how a project works
264
+
265
+ NIX is interesting when it can *change* things. Try, in order:
266
+
267
+ ```text
268
+ status # what is here
269
+ scan # inventory (read-only)
270
+ lang # what languages live here
271
+ ident # how this project is written
272
+ defs # what functions/classes exist
273
+ wrap src/app.py 12 in try # dry-run proposed edit
274
+ gen function login --into src/app.py # preview a generated function
275
+ recipe feature "my idea text"
276
+ ```
277
+
278
+ Everything stays a dry-run until you add `--apply`.
279
+
280
+ ## `.nix/` Structure
281
+
282
+ ```
283
+ .nix/
284
+ ├── config.json
285
+ ├── recipes.json
286
+ ├── state/
287
+ ├── journal/
288
+ ├── logs/
289
+ ├── memory/
290
+ ├── experiments/
291
+ ├── checkpoints/
292
+ │ ├── permanent/
293
+ │ └── temporary/
294
+ ├── pet/
295
+ │ └── identity.json
296
+ ├── brain/
297
+ │ ├── index.json
298
+ │ ├── patterns.json
299
+ │ └── backups/
300
+ └── origin/
301
+ ```
302
+
303
+ ## Development
304
+
305
+ ```bash
306
+ pip install -e .
307
+ python -m unittest discover -s tests -v
308
+ python -m nix
309
+ ```
310
+
311
+ ## Build a release
312
+
313
+ ```bash
314
+ pip install build
315
+ python -m build
316
+ ```
317
+
318
+ Produces `dist/cli_nix-<version>*.whl` and `.tar.gz` (the wheel embeds
319
+ all bundled language modules). Attach both to a GitHub Release to let anyone
320
+ `pip install` the program directly.
321
+
322
+ ## License
323
+
324
+ [MIT-0](LICENSE) — the code is free to use, copy, modify, merge, publish,
325
+ distribute, sublicense, or sell, with **no obligations** to the author.
326
+
327
+ That said, it would make my day if you mention the author or link to this
328
+ repository — purely as a nice-to-have, never a requirement.
329
+
330
+ ## Roadmap
331
+
332
+ - **Stage A** — Foundation + modern TUI (done)
333
+ - **Stage B** — Code modules + project brain: structural engine, `defs`/`blocks`/`wrap`/`gen`/`rename` + `git` companion (current)
334
+ - **Stage C** — Mutation Engine + Sandbox + World Laws
335
+ - **Stage D** — Checkpoint Manager + Experience System
336
+ - **Stage E** — Destructive Testing
337
+ - **Stage F** — GitHub/GitLab Bridge
338
+ - **Stage G** — Tamagotchi Evolution
339
+ - **Stage H** — Full TUI polish
340
+ - **Stage I** — IDE daemon + protocol (done: `nix daemon`, see above; plugins per-editor remain)
@@ -0,0 +1,316 @@
1
+ <div align="center">
2
+
3
+ <pre>
4
+ _ _______ __
5
+ / | / / _/ |/ /
6
+ / |/ // / | /
7
+ / /| // / / |
8
+ /_/ |_/___//_/|_|
9
+ </pre>
10
+
11
+ # NIX — Local Project Testing Agent
12
+
13
+ A local-first terminal agent that lives inside your project directory.
14
+ It scans, analyzes, mutates, tests, and learns — all through a rich,
15
+ modern TUI in the terminal.
16
+
17
+ ![Python](https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat&logo=python&logoColor=white)
18
+ ![License](https://img.shields.io/badge/license-MIT--0-brightgreen)
19
+ ![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey)
20
+ ![TUI](https://img.shields.io/badge/built_on-Textual-8BE9FD)
21
+
22
+ </div>
23
+
24
+ ---
25
+
26
+ ## Screenshots
27
+
28
+ | Main view with your pet | Project scan |
29
+ |:---:|:---:|
30
+ | ![Main](docs/screenshots/main.svg) | ![Scan](docs/screenshots/scan.svg) |
31
+
32
+ | Pet panel | Status | Help |
33
+ |:---:|:---:|:---:|
34
+ | ![Pet](docs/screenshots/pet.svg) | ![Status](docs/screenshots/status.svg) | ![Help](docs/screenshots/help.svg) |
35
+
36
+ > Screenshots are real headless renders of the actual TUI. Regenerate them
37
+ > any time with [`scripts/make_screenshots.py`](scripts/make_screenshots.py).
38
+
39
+ ## Features
40
+
41
+ - Full-screen terminal UI built on [Textual](https://github.com/Textualize/textual)
42
+ — like opencode or Claude Code
43
+ - **Pet companion** — a tamagotchi that lives in your repo, evolves, and
44
+ gets a new skin every `pill` (8 skins, 30-minute cooldown)
45
+ - **Language modules** — plain-data packs (no code) describing how blocks,
46
+ operations and generation work per language
47
+ - **Project brain** — `.nix/brain/` index of functions/classes/patterns that
48
+ the pet rebuilds on demand (always fresher than the developer's memory)
49
+ - **Read-only by default** — dry-runs for everything (scan, status, git,
50
+ gen, wrap, rename): nothing changes unless `--apply`
51
+ - **Git companion** — status, diff, log, branch, auto-messaged commits,
52
+ remote info and optional `gh`/`glab` PR support
53
+ - **IDE daemon** — headless JSON-line protocol over stdin/stdout or a socket
54
+ - Chain commands on one line with `;` or `&&`
55
+
56
+ ## Install
57
+
58
+ ### From a git clone (any platform)
59
+
60
+ **Windows 10/11 + Python 3.11+**
61
+
62
+ ```bat
63
+ git clone https://github.com/Mr-Bulochka/NIX.git
64
+ cd NIX
65
+ python -m pip install -r requirements.txt
66
+ python -m nix
67
+ ```
68
+
69
+ **Linux / macOS + Python 3.11+**
70
+
71
+ ```bash
72
+ git clone https://github.com/Mr-Bulochka/NIX.git
73
+ cd NIX
74
+ python3 -m pip install -r requirements.txt
75
+ python3 -m nix
76
+ ```
77
+
78
+ ### From PyPI
79
+
80
+ ```bash
81
+ pip install cli-nix
82
+ nix
83
+ ```
84
+
85
+ ### From the latest GitHub Release
86
+
87
+ Check the **Releases** tab for the current `.whl`, then:
88
+
89
+ ```bash
90
+ pip install https://github.com/Mr-Bulochka/NIX/releases/download/v0.3.0/cli_nix-0.3.0-py3-none-any.whl
91
+ nix
92
+ ```
93
+
94
+ ### Platform support
95
+
96
+ NIX is pure Python (3.11+) with two cross-platform dependencies
97
+ (`rich`, `textual`) — the same code runs on Windows, Linux and macOS.
98
+ The `nix` console command is created by the package entry point and works
99
+ everywhere; `nix.bat` in the repo root is just a Windows convenience
100
+ launcher equivalent to `python -m nix`.
101
+
102
+ ## Quick Start
103
+
104
+ ```bash
105
+ cd C:\MyProject # or /home/you/myproject on Linux/macOS
106
+ nix # or: python -m nix
107
+ ```
108
+
109
+ On first launch, NIX creates a `.nix/` directory and asks for your pet's name.
110
+
111
+ ## The Interface
112
+
113
+ - Header bar with project name, safety mode and live clock
114
+ - Pet panel with animated idle spinner and stats
115
+ - Buttons row — **clickable with the mouse**: Pet, Scan, Status, Settings, Quit
116
+ - Scrollable color-coded event log (syntax highlighting, tables, panels)
117
+ - Command input with focus, arrow-key navigation
118
+ - Hotkeys: `Ctrl+Q` quit, `Ctrl+L` clear, `Ctrl+S` scan, `Ctrl+P` pet
119
+
120
+ ## Commands
121
+
122
+ Every command is a **constructor**: positional words + `--flag value`, `-flag`
123
+ switches and `k=v` pairs, all combinable on one infinite-length line. Chain
124
+ several commands in a single line with `;` or `&&`.
125
+
126
+ | Command | Description |
127
+ |---------|-------------|
128
+ | `help [cmd]` | Show all commands, or details of one |
129
+ | `which <cmd>` | Show info about a command |
130
+ | `status` | Current project and NIX state |
131
+ | `stats [--top N]` | Full project analytics |
132
+ | `scan [--tree] [--depth N]` | Read-only project inventory |
133
+ | `tree [--depth N]` | Show project tree |
134
+ | `ls [path] [--all] [--size]` | List a directory |
135
+ | `lang [--top N]` | Detect languages in the project |
136
+ | `tests [--max N] [--count]` | Find test files and functions |
137
+ | `deps [--top N]` | Collect imported modules |
138
+ | `find <name> [--ext py,js]` | Search files by name |
139
+ | `todo [--max N]` | Scan code for TODO/FIXME |
140
+ | `attempts [N\|+N\|-N]` | Show/set attempt budget |
141
+ | `mode [local\|safe\|git]` | Show/set safety mode |
142
+ | `save` | Persist config and pet |
143
+ | `pet` | Show pet status |
144
+ | `pill [--status]` | Give the pet a skin pill (30 min cooldown) |
145
+ | `settings` | Open settings |
146
+ | `tag [name] [--remove]` | List/add/remove pet tags |
147
+ | `note <text>` | Save an idea to project memory |
148
+ | `memory [N]` | Show recent project notes |
149
+ | `journal <text>` | Write a journal entry |
150
+ | `logs [N]` | Show session log |
151
+ | `history [N]` | Show journal history |
152
+ | `checkpoint [name]` | List or create checkpoints |
153
+ | `echo <text>` | Print text to the log |
154
+ | `time` | Show current UTC time |
155
+ | `pwd` | Show current working directory |
156
+ | `version` | Show NIX version |
157
+ | `clear` | Clear the event log |
158
+ | `quit` | Exit NIX |
159
+
160
+ ### Code & language modules
161
+
162
+ NIX understands code through **code modules** (language modules) —
163
+ plain-data packs (no code) that describe how blocks, operations and
164
+ generation work in a given language. Bundled modules live in
165
+ `nix/modules/bundled/`; user modules are picked up from
166
+ `~/.nix/modules/<id>/` and shadow bundled ones.
167
+
168
+ | Command | Description |
169
+ |---------|-------------|
170
+ | `module [name]` | List language modules or show one in detail |
171
+ | `defs [--max N] [glob]` | List project functions/classes (from the project index) |
172
+ | `blocks <file> <line>` | Show the block enclosing a line |
173
+ | `wrap <file> <line> in <op> [--slot v] [--apply]` | Wrap a block in a language op (dry-run unless `--apply`) |
174
+ | `gen <type> <name> [--into f] [--at N] [--apply] [--params .. --ret .. --doc .. --body ..]` | Generate code from a template (preview unless `--into`; `--apply` writes into it or creates a new file) |
175
+ | `make <entity> [--cols name:str:pk,...] [--into f] [--test-into f] [--apply]` | Scaffold a model + CRUD + tests from column specs (dry-run unless `--apply`; language inferred from `--into` extension or `--lang`, an unsupported hint is an error) |
176
+ | `testgen <file\|all> [--into f] [--apply]` | Generate test stubs from the project index (dry-run unless `--apply`) |
177
+ | `recipe [list\|<name>] [--apply] [args...]` | Run named command chains; built-ins: `feature`, `scaffold`, `test`; user recipes live in `.nix/recipes.json` (`{0}`, `{1}`, ... are positional args; re-run with `--apply` to write) |
178
+ | `rename <old> <new> [--file f] [--apply]` | Project-wide symbolic rename (dry-run unless `--apply`) |
179
+ | `ident` | Show the project's identity patterns (naming, docstrings, ...) |
180
+
181
+ ### Version control companion
182
+
183
+ | Command | Description |
184
+ |---------|-------------|
185
+ | `git status` | Short working-tree status |
186
+ | `git log [N]` | Last N commits oneline |
187
+ | `git diff` | Change statistics |
188
+ | `git branch` | Current branch |
189
+ | `git commit [msg] [--apply]` | Stage all and commit; message auto-generated from diff (dry-run unless `--apply`) |
190
+ | `remote info` | Show origin, platform (GitHub/GitLab/other), branch, ahead/behind |
191
+ | `remote fetch` / `pull` / `push` | Remote sync, dry-run unless `--apply` |
192
+ | `remote pr` | List open PRs/MRs via `gh`/`glab`; `remote pr "title" --apply` opens one |
193
+
194
+ ### IDE daemon & protocol (Stage I)
195
+
196
+ NIX runs headless without the TUI, so any IDE/editor can drive the same
197
+ deterministic toolkit:
198
+
199
+ ```
200
+ nix daemon # line protocol over stdin/stdout (JSON Lines)
201
+ nix daemon --socket 127.0.0.1:7411
202
+ nix daemon --once "status" # one command, one JSON response
203
+ ```
204
+
205
+ Each request is one line; each response is one JSON object:
206
+
207
+ ```
208
+ > HELP
209
+ {"ok": true, "session_end": false, "commands": [{"name": "defs", ...}]}
210
+ > defs
211
+ {"ok": true, "session_end": false, "events": [{"op": "block", "title": "Symbols", ...}]}
212
+ > quit
213
+ {"ok": true, "session_end": true}
214
+ ```
215
+
216
+ Commands are the exact `COMMANDS` the TUI uses; events are ordered
217
+ (`message`, `block`, `code`, `tree`, `pet`, `status`, `scan`, `logs`,
218
+ `history`, `help`) and re-renderable by the client verbatim.
219
+
220
+ Module layout:
221
+
222
+ ```
223
+ nix/modules/bundled/python/
224
+ ├── module.json id, name, version, extensions
225
+ ├── blocks.json block start regex + body mode (indent/braces/do-end)
226
+ ├── ops.json semantic ops (wrap-in-try, wrap-in-if, ...)
227
+ ├── gen/*.tmpl generation templates (function, class, ...)
228
+ └── probe.json self-test cases
229
+ ```
230
+
231
+ The pet's memory of a project lives in `.nix/brain/` (`index.json`,
232
+ `patterns.json`) and is (re)built by `defs`/`ident`/`gen` on demand, so
233
+ the pet always knows the project fresher than the developer does.
234
+
235
+ Pets evolve and get a **new random skin** when you give them a pill (once every
236
+ 30 minutes); the stage/pattern is always preserved. Each of the 8 skins has
237
+ its own signature palette, so every pill is a visible transformation.
238
+
239
+ ## Learning how a project works
240
+
241
+ NIX is interesting when it can *change* things. Try, in order:
242
+
243
+ ```text
244
+ status # what is here
245
+ scan # inventory (read-only)
246
+ lang # what languages live here
247
+ ident # how this project is written
248
+ defs # what functions/classes exist
249
+ wrap src/app.py 12 in try # dry-run proposed edit
250
+ gen function login --into src/app.py # preview a generated function
251
+ recipe feature "my idea text"
252
+ ```
253
+
254
+ Everything stays a dry-run until you add `--apply`.
255
+
256
+ ## `.nix/` Structure
257
+
258
+ ```
259
+ .nix/
260
+ ├── config.json
261
+ ├── recipes.json
262
+ ├── state/
263
+ ├── journal/
264
+ ├── logs/
265
+ ├── memory/
266
+ ├── experiments/
267
+ ├── checkpoints/
268
+ │ ├── permanent/
269
+ │ └── temporary/
270
+ ├── pet/
271
+ │ └── identity.json
272
+ ├── brain/
273
+ │ ├── index.json
274
+ │ ├── patterns.json
275
+ │ └── backups/
276
+ └── origin/
277
+ ```
278
+
279
+ ## Development
280
+
281
+ ```bash
282
+ pip install -e .
283
+ python -m unittest discover -s tests -v
284
+ python -m nix
285
+ ```
286
+
287
+ ## Build a release
288
+
289
+ ```bash
290
+ pip install build
291
+ python -m build
292
+ ```
293
+
294
+ Produces `dist/cli_nix-<version>*.whl` and `.tar.gz` (the wheel embeds
295
+ all bundled language modules). Attach both to a GitHub Release to let anyone
296
+ `pip install` the program directly.
297
+
298
+ ## License
299
+
300
+ [MIT-0](LICENSE) — the code is free to use, copy, modify, merge, publish,
301
+ distribute, sublicense, or sell, with **no obligations** to the author.
302
+
303
+ That said, it would make my day if you mention the author or link to this
304
+ repository — purely as a nice-to-have, never a requirement.
305
+
306
+ ## Roadmap
307
+
308
+ - **Stage A** — Foundation + modern TUI (done)
309
+ - **Stage B** — Code modules + project brain: structural engine, `defs`/`blocks`/`wrap`/`gen`/`rename` + `git` companion (current)
310
+ - **Stage C** — Mutation Engine + Sandbox + World Laws
311
+ - **Stage D** — Checkpoint Manager + Experience System
312
+ - **Stage E** — Destructive Testing
313
+ - **Stage F** — GitHub/GitLab Bridge
314
+ - **Stage G** — Tamagotchi Evolution
315
+ - **Stage H** — Full TUI polish
316
+ - **Stage I** — IDE daemon + protocol (done: `nix daemon`, see above; plugins per-editor remain)