magura 0.0.1__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.
- magura-0.0.1/LICENSE +21 -0
- magura-0.0.1/PKG-INFO +177 -0
- magura-0.0.1/README.md +163 -0
- magura-0.0.1/magura/__init__.py +2 -0
- magura-0.0.1/magura/arrows.py +186 -0
- magura-0.0.1/magura/cli.py +238 -0
- magura-0.0.1/magura/codemap.py +110 -0
- magura-0.0.1/magura/glossary.py +57 -0
- magura-0.0.1/magura/image.py +145 -0
- magura-0.0.1/magura/layers.py +57 -0
- magura-0.0.1/magura/mentions.py +209 -0
- magura-0.0.1/magura/netguard.py +566 -0
- magura-0.0.1/magura/progress.py +80 -0
- magura-0.0.1/magura/remote.py +341 -0
- magura-0.0.1/magura/server.py +308 -0
- magura-0.0.1/magura/trace.py +139 -0
- magura-0.0.1/magura/triangulate.py +332 -0
- magura-0.0.1/magura/webui/app.js +410 -0
- magura-0.0.1/magura/webui/i18n.js +35 -0
- magura-0.0.1/magura/webui/index.html +129 -0
- magura-0.0.1/magura/webui/lang/de.js +64 -0
- magura-0.0.1/magura/webui/lang/en.js +64 -0
- magura-0.0.1/magura/webui/lang/es.js +64 -0
- magura-0.0.1/magura/webui/lang/fr.js +64 -0
- magura-0.0.1/magura/webui/lang/pt.js +64 -0
- magura-0.0.1/magura/webui/lang/uk.js +64 -0
- magura-0.0.1/magura/webui/style.css +94 -0
- magura-0.0.1/magura/webui/themes/beach.css +19 -0
- magura-0.0.1/magura/webui/themes/dark.css +19 -0
- magura-0.0.1/magura/webui/themes/light.css +19 -0
- magura-0.0.1/magura/webui/themes/mono-dark.css +19 -0
- magura-0.0.1/magura/webui/themes/mono-light.css +19 -0
- magura-0.0.1/magura/webui/themes/ocean.css +19 -0
- magura-0.0.1/magura/webui/themes/soft.css +19 -0
- magura-0.0.1/magura/webui/themes/summer.css +19 -0
- magura-0.0.1/magura.egg-info/PKG-INFO +177 -0
- magura-0.0.1/magura.egg-info/SOURCES.txt +48 -0
- magura-0.0.1/magura.egg-info/dependency_links.txt +1 -0
- magura-0.0.1/magura.egg-info/entry_points.txt +2 -0
- magura-0.0.1/magura.egg-info/requires.txt +5 -0
- magura-0.0.1/magura.egg-info/top_level.txt +1 -0
- magura-0.0.1/pyproject.toml +28 -0
- magura-0.0.1/setup.cfg +4 -0
- magura-0.0.1/tests/test_arrows.py +123 -0
- magura-0.0.1/tests/test_image.py +107 -0
- magura-0.0.1/tests/test_mentions.py +82 -0
- magura-0.0.1/tests/test_netguard.py +138 -0
- magura-0.0.1/tests/test_remote.py +221 -0
- magura-0.0.1/tests/test_server.py +93 -0
- magura-0.0.1/tests/test_triangulate.py +50 -0
magura-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stanislav Zholobetskyi
|
|
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.
|
magura-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: magura
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: The image of a term across a code base, without a build: a glossary term, the code names that carry it (a svitovyd map), the files that define and use them — and task text to files through those images.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: flask>=3.0
|
|
10
|
+
Requires-Dist: waitress>=2.1
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
# magura
|
|
18
|
+
|
|
19
|
+
The image of a term across a code base, without a build. Magura reads what the
|
|
20
|
+
pantheon already indexed — a 1bcoder glossary and a svitovyd map — and builds nothing.
|
|
21
|
+
|
|
22
|
+
## What it does
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
magura image min-alias-length --map .svitovyd/<name>/map.txt
|
|
26
|
+
min_alias_length (covers 1.00)
|
|
27
|
+
defined in src/sqlfluff/core/default_config.cfg
|
|
28
|
+
used in src/sqlfluff/rules/aliasing/AL06.py
|
|
29
|
+
used in src/sqlfluff/rules/aliasing/__init__.py
|
|
30
|
+
used in test/fixtures/rules/std_rule_cases/AL06.yml
|
|
31
|
+
|
|
32
|
+
magura search "add a new lint rule that reports identifiers longer than 8 characters" \
|
|
33
|
+
--glossary .1bcoder/glossary/sqlfluff-docs --map .svitovyd/<name>/map.txt
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- **image** — the code names that carry a term (every word of the term is a subword of
|
|
37
|
+
the name; plurals folded), the files that define them and the files that use them
|
|
38
|
+
(svitovyd's `links → target (kind:name)`).
|
|
39
|
+
- **search** — task text → the glossary terms it holds → their images → files, each with
|
|
40
|
+
the term and the name it came through. Meant as a fourth source beside simargl,
|
|
41
|
+
gamayun and svitovyd: the task speaks the language of the problem, the code its own,
|
|
42
|
+
and the glossary stands between them.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
magura triangulate "add a new lint rule that reports identifiers longer than 8 characters"
|
|
46
|
+
magura triangulate "<task>" --tools gamayun,svitovyd,glossary --format paths
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- **triangulate** — any of five sources on one task, merged by reciprocal rank fusion
|
|
50
|
+
(equal weights, k = 60): simargl (vectors of past tasks), gamayun (statistics of the
|
|
51
|
+
history), svitovyd (the code map), the glossary (the images above), boyan (the project's own
|
|
52
|
+
vocabulary, `<folder>/.boyan/`). boyan answers first: its names' files are the fifth list, and its
|
|
53
|
+
project words (D-masks) are appended to the query the others get (`words=False` / `"words": false`
|
|
54
|
+
keeps the query as typed); simrgl exp17.8: a newcomer's paraphrases 119 -> 144 gold files in the
|
|
55
|
+
fused top 10, the developers' text 141 -> 145. Every source is
|
|
56
|
+
optional: without simargl nothing needs Ollama. Besides the fused top, each source's own
|
|
57
|
+
best files outside it ("singles") — a file only one source finds sinks in the fusion.
|
|
58
|
+
`--format paths` gives the fused top + the singles: the set to look at.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
magura trace severity --scope issue # mentions by layer and kind, arrows between files, history bridges
|
|
62
|
+
magura dead weight # used, or only defined and carried (a candidate for a person)
|
|
63
|
+
magura ui --root C:\path\to\project # the web UI, http://127.0.0.1:8092
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **trace** — a field's mentions line by line: the layer of the file (by path; a project corrects
|
|
67
|
+
the rules in `.magura/layers.txt`) and the kind of the line (definition, copy, transform,
|
|
68
|
+
consume, output, unknown). Arrows between files: Java imports (a getter read, a setter write),
|
|
69
|
+
the database (a column of a DDL or a migration and a MyBatis query that names its table),
|
|
70
|
+
a mapper and the classes it maps, the calls of a svitovyd map of depth 3 (`.svitovyd/map_d3.txt`,
|
|
71
|
+
kept when the caller imports the target); and gamayun's history bridges (files changed together).
|
|
72
|
+
- **ui** — Flask + waitress, as the rest of the pantheon (8 themes, 6 languages): Triangulate (the
|
|
73
|
+
sources ticked, the fused top, the singles), Trace (the picture: lanes of layers, file cards with
|
|
74
|
+
the kinds of their mentions, arrows; click a file for its arrows and mentions, a line for the
|
|
75
|
+
code around it), Image, Search, Remote. Listens on 127.0.0.1; `--bind 0.0.0.0` (or `"bind"` in `~/.magura/config.json`)
|
|
76
|
+
opens it to the network; a foreign `Host` (DNS rebinding) or another site's request is refused, and with no password every page warns where it is visible — set one with the lock button
|
|
77
|
+
(HTTP Basic auth, `~/.magura/config.json`) or mark the address as a private network.
|
|
78
|
+
- **Remote** — a remote project: Triangulate over simargl, gamayun, svitovyd, boyan (port 8094) and an
|
|
79
|
+
alkonost glossary running on other devices (phones), nothing downloaded but the glossary and its map (the
|
|
80
|
+
term -> code matching runs here). Per source: address, port, login, password and the project's
|
|
81
|
+
name there — written into `~/.magura/remote.json` (plain text, like every tool's password) and
|
|
82
|
+
never shown on the page again; saving a source again replaces it. The project then appears in
|
|
83
|
+
the project list (🌐). Companions and moved/gone paths need the indexes here and are left out.
|
|
84
|
+
|
|
85
|
+
No LLM. The design is in `concepts/MAGURA.md` of the
|
|
86
|
+
[simrgl](https://github.com/szholobetsky/simrgl) research repository.
|
|
87
|
+
|
|
88
|
+
## Install
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
pip install -e .
|
|
92
|
+
python -m pytest tests
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Open it to the network
|
|
98
|
+
|
|
99
|
+
By default `magura ui` listens on `127.0.0.1`: only this computer can open http://127.0.0.1:8092/.
|
|
100
|
+
To let other devices open it (a phone, a teammate's laptop):
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
magura ui --bind 0.0.0.0
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
or once for every start, by hand in `~/.magura/config.json`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{"bind": "0.0.0.0"}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--bind` wins over the file. No page can write `bind` — only a person editing the file. Then open
|
|
113
|
+
`http://<this machine's IP>:8092/` on the other device. With no password every page warns where
|
|
114
|
+
it is visible: set one with the lock button in the corner (HTTP Basic auth, kept in the same file
|
|
115
|
+
as `auth_user` / `auth_pass`), or mark the network as private there.
|
|
116
|
+
|
|
117
|
+
Whatever the address, requests are checked:
|
|
118
|
+
|
|
119
|
+
- a `Host` that is not this machine gets 421 (the guard against DNS rebinding). An IP, `localhost`,
|
|
120
|
+
a name without a dot (`minipc`), `.local` / `.lan` and this computer's own name pass; a name of
|
|
121
|
+
yours with dots (a domain behind a proxy) goes into `"allowed_hosts": ["tools.example.org"]` in
|
|
122
|
+
the same file;
|
|
123
|
+
- a browser request from another site gets 403; curl and the other tools pass.
|
|
124
|
+
|
|
125
|
+
Remote in another magura reaches this one's tools only when they are open this way.
|
|
126
|
+
|
|
127
|
+
`--host` is never where a pantheon tool listens: where a tool has `--host`, it is the Ollama address.
|
|
128
|
+
|
|
129
|
+
## Part of the SIMARGL toolkit
|
|
130
|
+
|
|
131
|
+
magura is one of thirteen tools that together form an **intellectual development support system**:
|
|
132
|
+
|
|
133
|
+
| Tool | Role |
|
|
134
|
+
|---|---|
|
|
135
|
+
| **[simargl](https://github.com/szholobetsky/simargl)** | Task-to-code retrieval — given a task description, finds which files and modules are likely affected, using semantic similarity over git history |
|
|
136
|
+
| **[svitovyd](https://github.com/szholobetsky/svitovyd)** | Project map — scans any codebase and produces a structural map of definitions and cross-file dependencies; queried from the CLI, a web UI with a layered map, or an MCP server |
|
|
137
|
+
| **[1bcoder](https://github.com/szholobetsky/1bcoder)** | AI coding assistant for small local models — surgical context management, agents, parallel inference, proc scripts |
|
|
138
|
+
| **[yasna](https://github.com/szholobetsky/yasna)** | Session memory — indexes conversations from all AI agents so you can find what was discussed, when, and where |
|
|
139
|
+
| **[radogast](https://github.com/szholobetsky/radogast)** | Context drift monitor — measures how far an AI agent's conversation has drifted from the original task |
|
|
140
|
+
| **[vyrii](https://github.com/szholobetsky/vyrii)** | Local AI web UI — chat, translate, web research, RAG and file management in the browser (Flask); powered by Ollama or any OpenAI-compatible backend |
|
|
141
|
+
| **[syryn](https://github.com/szholobetsky/syryn)** | Bluetooth identity beacon for headless devices — the device's IP is its Bluetooth name; hostname, mDNS and network interfaces on request |
|
|
142
|
+
| **[alkonost](https://github.com/szholobetsky/alkonost)** | Browser cockpit for 1bcoder's flows — the `deepagent_*` spec pipeline (plan tree → specs → task board) and the glossary (build, browse, search), tuned for small local models |
|
|
143
|
+
| **[gamayun](https://github.com/szholobetsky/gamayun)** | Statistical ontology without an LLM — builds triples of terms, identifiers, files and modules from task history or a folder of documents and code; every triple carries its significance test |
|
|
144
|
+
| **[mokosh](https://github.com/szholobetsky/mokosh)** | Dataset gathering — commits of a git repository and the tasks of its tracker (Jira, GitHub, GitLab, YouTrack) in one SQLite database that the other tools read |
|
|
145
|
+
| **[magura](https://github.com/szholobetsky/magura)** | The image of a term across the code, without a build — glossary term → code names → files; triangulation of simargl, gamayun, svitovyd, the glossary and boyan with each source's singles; a field traced through the layers |
|
|
146
|
+
| **[boyan](https://github.com/szholobetsky/boyan)** | The project's own vocabulary — the names a project uses for its parts, learned from its files and task history without an LLM, and a translator (word2vec on the project) from anyone's words to those names and their files; magura's fifth, independent source |
|
|
147
|
+
| **[khors](https://github.com/szholobetsky/khors)** | Markdown document editor inside vyrii and alkonost — write beside the chat, a small local model rewrites the selection or writes at the cursor (shown as a diff to accept), Save as md / ODT / ODP in a theme with formulas and diagrams as LibreOffice objects |
|
|
148
|
+
|
|
149
|
+
- **simargl** finds the code related to a task by vector search over the task history (embeddings).
|
|
150
|
+
- **svitovyd** answers: *how is the code structured and what depends on what?*
|
|
151
|
+
- **1bcoder** answers: *how do I work with local models efficiently?*
|
|
152
|
+
- **yasna** answers: *where did I already discuss this?*
|
|
153
|
+
- **radogast** answers: *is the AI agent still on track toward the goal?*
|
|
154
|
+
- **vyrii** answers: *how do I access all of this through a browser?*
|
|
155
|
+
- **syryn** answers: *what is the address of this headless device?*
|
|
156
|
+
- **alkonost** answers: *how do I turn one task description into a reviewed, working plan — and see the project's glossary — without a big model or a big context window?*
|
|
157
|
+
- **gamayun** finds the code related to a task through an ontology of significant links between words, files and modules (no LLM).
|
|
158
|
+
- **mokosh** prepares the initial dataset from version control and the issue tracker.
|
|
159
|
+
- **magura** answers: *where does this business term live in the code, and which files do all the tools point to?*
|
|
160
|
+
- **boyan** answers: *what does this project call the thing I am describing, and where does it live?*
|
|
161
|
+
- **khors** answers: *how do I turn a chat, a plan or my notes into a document I can hand over — a text or slides — with a small model's help?*
|
|
162
|
+
|
|
163
|
+
Together they cover the full development loop: gather the history, understand the codebase, find relevant history, work with AI locally, remember what was decided, and verify the context stays on target.
|
|
164
|
+
|
|
165
|
+
The name comes from Slavic mythology. Magura (Магура) is a winged warrior maiden, daughter of Perun, who flies over the battlefield, inspires the warriors and finds the fallen to give them the water of life. A fitting name for a tool that follows one term through every layer of the code and finds each place it lives.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## License
|
|
170
|
+
|
|
171
|
+
MIT. See [LICENSE](LICENSE).
|
|
172
|
+
|
|
173
|
+
## About
|
|
174
|
+
|
|
175
|
+
(c) 2026 Stanislav Zholobetskyi, Oleh Andriichuk
|
|
176
|
+
Institute for Information Recording, National Academy of Sciences of Ukraine, Kyiv
|
|
177
|
+
PhD research: «Intelligent Technology for Software Development and Maintenance Support»
|
magura-0.0.1/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# magura
|
|
4
|
+
|
|
5
|
+
The image of a term across a code base, without a build. Magura reads what the
|
|
6
|
+
pantheon already indexed — a 1bcoder glossary and a svitovyd map — and builds nothing.
|
|
7
|
+
|
|
8
|
+
## What it does
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
magura image min-alias-length --map .svitovyd/<name>/map.txt
|
|
12
|
+
min_alias_length (covers 1.00)
|
|
13
|
+
defined in src/sqlfluff/core/default_config.cfg
|
|
14
|
+
used in src/sqlfluff/rules/aliasing/AL06.py
|
|
15
|
+
used in src/sqlfluff/rules/aliasing/__init__.py
|
|
16
|
+
used in test/fixtures/rules/std_rule_cases/AL06.yml
|
|
17
|
+
|
|
18
|
+
magura search "add a new lint rule that reports identifiers longer than 8 characters" \
|
|
19
|
+
--glossary .1bcoder/glossary/sqlfluff-docs --map .svitovyd/<name>/map.txt
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- **image** — the code names that carry a term (every word of the term is a subword of
|
|
23
|
+
the name; plurals folded), the files that define them and the files that use them
|
|
24
|
+
(svitovyd's `links → target (kind:name)`).
|
|
25
|
+
- **search** — task text → the glossary terms it holds → their images → files, each with
|
|
26
|
+
the term and the name it came through. Meant as a fourth source beside simargl,
|
|
27
|
+
gamayun and svitovyd: the task speaks the language of the problem, the code its own,
|
|
28
|
+
and the glossary stands between them.
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
magura triangulate "add a new lint rule that reports identifiers longer than 8 characters"
|
|
32
|
+
magura triangulate "<task>" --tools gamayun,svitovyd,glossary --format paths
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- **triangulate** — any of five sources on one task, merged by reciprocal rank fusion
|
|
36
|
+
(equal weights, k = 60): simargl (vectors of past tasks), gamayun (statistics of the
|
|
37
|
+
history), svitovyd (the code map), the glossary (the images above), boyan (the project's own
|
|
38
|
+
vocabulary, `<folder>/.boyan/`). boyan answers first: its names' files are the fifth list, and its
|
|
39
|
+
project words (D-masks) are appended to the query the others get (`words=False` / `"words": false`
|
|
40
|
+
keeps the query as typed); simrgl exp17.8: a newcomer's paraphrases 119 -> 144 gold files in the
|
|
41
|
+
fused top 10, the developers' text 141 -> 145. Every source is
|
|
42
|
+
optional: without simargl nothing needs Ollama. Besides the fused top, each source's own
|
|
43
|
+
best files outside it ("singles") — a file only one source finds sinks in the fusion.
|
|
44
|
+
`--format paths` gives the fused top + the singles: the set to look at.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
magura trace severity --scope issue # mentions by layer and kind, arrows between files, history bridges
|
|
48
|
+
magura dead weight # used, or only defined and carried (a candidate for a person)
|
|
49
|
+
magura ui --root C:\path\to\project # the web UI, http://127.0.0.1:8092
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- **trace** — a field's mentions line by line: the layer of the file (by path; a project corrects
|
|
53
|
+
the rules in `.magura/layers.txt`) and the kind of the line (definition, copy, transform,
|
|
54
|
+
consume, output, unknown). Arrows between files: Java imports (a getter read, a setter write),
|
|
55
|
+
the database (a column of a DDL or a migration and a MyBatis query that names its table),
|
|
56
|
+
a mapper and the classes it maps, the calls of a svitovyd map of depth 3 (`.svitovyd/map_d3.txt`,
|
|
57
|
+
kept when the caller imports the target); and gamayun's history bridges (files changed together).
|
|
58
|
+
- **ui** — Flask + waitress, as the rest of the pantheon (8 themes, 6 languages): Triangulate (the
|
|
59
|
+
sources ticked, the fused top, the singles), Trace (the picture: lanes of layers, file cards with
|
|
60
|
+
the kinds of their mentions, arrows; click a file for its arrows and mentions, a line for the
|
|
61
|
+
code around it), Image, Search, Remote. Listens on 127.0.0.1; `--bind 0.0.0.0` (or `"bind"` in `~/.magura/config.json`)
|
|
62
|
+
opens it to the network; a foreign `Host` (DNS rebinding) or another site's request is refused, and with no password every page warns where it is visible — set one with the lock button
|
|
63
|
+
(HTTP Basic auth, `~/.magura/config.json`) or mark the address as a private network.
|
|
64
|
+
- **Remote** — a remote project: Triangulate over simargl, gamayun, svitovyd, boyan (port 8094) and an
|
|
65
|
+
alkonost glossary running on other devices (phones), nothing downloaded but the glossary and its map (the
|
|
66
|
+
term -> code matching runs here). Per source: address, port, login, password and the project's
|
|
67
|
+
name there — written into `~/.magura/remote.json` (plain text, like every tool's password) and
|
|
68
|
+
never shown on the page again; saving a source again replaces it. The project then appears in
|
|
69
|
+
the project list (🌐). Companions and moved/gone paths need the indexes here and are left out.
|
|
70
|
+
|
|
71
|
+
No LLM. The design is in `concepts/MAGURA.md` of the
|
|
72
|
+
[simrgl](https://github.com/szholobetsky/simrgl) research repository.
|
|
73
|
+
|
|
74
|
+
## Install
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
pip install -e .
|
|
78
|
+
python -m pytest tests
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Open it to the network
|
|
84
|
+
|
|
85
|
+
By default `magura ui` listens on `127.0.0.1`: only this computer can open http://127.0.0.1:8092/.
|
|
86
|
+
To let other devices open it (a phone, a teammate's laptop):
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
magura ui --bind 0.0.0.0
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
or once for every start, by hand in `~/.magura/config.json`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{"bind": "0.0.0.0"}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`--bind` wins over the file. No page can write `bind` — only a person editing the file. Then open
|
|
99
|
+
`http://<this machine's IP>:8092/` on the other device. With no password every page warns where
|
|
100
|
+
it is visible: set one with the lock button in the corner (HTTP Basic auth, kept in the same file
|
|
101
|
+
as `auth_user` / `auth_pass`), or mark the network as private there.
|
|
102
|
+
|
|
103
|
+
Whatever the address, requests are checked:
|
|
104
|
+
|
|
105
|
+
- a `Host` that is not this machine gets 421 (the guard against DNS rebinding). An IP, `localhost`,
|
|
106
|
+
a name without a dot (`minipc`), `.local` / `.lan` and this computer's own name pass; a name of
|
|
107
|
+
yours with dots (a domain behind a proxy) goes into `"allowed_hosts": ["tools.example.org"]` in
|
|
108
|
+
the same file;
|
|
109
|
+
- a browser request from another site gets 403; curl and the other tools pass.
|
|
110
|
+
|
|
111
|
+
Remote in another magura reaches this one's tools only when they are open this way.
|
|
112
|
+
|
|
113
|
+
`--host` is never where a pantheon tool listens: where a tool has `--host`, it is the Ollama address.
|
|
114
|
+
|
|
115
|
+
## Part of the SIMARGL toolkit
|
|
116
|
+
|
|
117
|
+
magura is one of thirteen tools that together form an **intellectual development support system**:
|
|
118
|
+
|
|
119
|
+
| Tool | Role |
|
|
120
|
+
|---|---|
|
|
121
|
+
| **[simargl](https://github.com/szholobetsky/simargl)** | Task-to-code retrieval — given a task description, finds which files and modules are likely affected, using semantic similarity over git history |
|
|
122
|
+
| **[svitovyd](https://github.com/szholobetsky/svitovyd)** | Project map — scans any codebase and produces a structural map of definitions and cross-file dependencies; queried from the CLI, a web UI with a layered map, or an MCP server |
|
|
123
|
+
| **[1bcoder](https://github.com/szholobetsky/1bcoder)** | AI coding assistant for small local models — surgical context management, agents, parallel inference, proc scripts |
|
|
124
|
+
| **[yasna](https://github.com/szholobetsky/yasna)** | Session memory — indexes conversations from all AI agents so you can find what was discussed, when, and where |
|
|
125
|
+
| **[radogast](https://github.com/szholobetsky/radogast)** | Context drift monitor — measures how far an AI agent's conversation has drifted from the original task |
|
|
126
|
+
| **[vyrii](https://github.com/szholobetsky/vyrii)** | Local AI web UI — chat, translate, web research, RAG and file management in the browser (Flask); powered by Ollama or any OpenAI-compatible backend |
|
|
127
|
+
| **[syryn](https://github.com/szholobetsky/syryn)** | Bluetooth identity beacon for headless devices — the device's IP is its Bluetooth name; hostname, mDNS and network interfaces on request |
|
|
128
|
+
| **[alkonost](https://github.com/szholobetsky/alkonost)** | Browser cockpit for 1bcoder's flows — the `deepagent_*` spec pipeline (plan tree → specs → task board) and the glossary (build, browse, search), tuned for small local models |
|
|
129
|
+
| **[gamayun](https://github.com/szholobetsky/gamayun)** | Statistical ontology without an LLM — builds triples of terms, identifiers, files and modules from task history or a folder of documents and code; every triple carries its significance test |
|
|
130
|
+
| **[mokosh](https://github.com/szholobetsky/mokosh)** | Dataset gathering — commits of a git repository and the tasks of its tracker (Jira, GitHub, GitLab, YouTrack) in one SQLite database that the other tools read |
|
|
131
|
+
| **[magura](https://github.com/szholobetsky/magura)** | The image of a term across the code, without a build — glossary term → code names → files; triangulation of simargl, gamayun, svitovyd, the glossary and boyan with each source's singles; a field traced through the layers |
|
|
132
|
+
| **[boyan](https://github.com/szholobetsky/boyan)** | The project's own vocabulary — the names a project uses for its parts, learned from its files and task history without an LLM, and a translator (word2vec on the project) from anyone's words to those names and their files; magura's fifth, independent source |
|
|
133
|
+
| **[khors](https://github.com/szholobetsky/khors)** | Markdown document editor inside vyrii and alkonost — write beside the chat, a small local model rewrites the selection or writes at the cursor (shown as a diff to accept), Save as md / ODT / ODP in a theme with formulas and diagrams as LibreOffice objects |
|
|
134
|
+
|
|
135
|
+
- **simargl** finds the code related to a task by vector search over the task history (embeddings).
|
|
136
|
+
- **svitovyd** answers: *how is the code structured and what depends on what?*
|
|
137
|
+
- **1bcoder** answers: *how do I work with local models efficiently?*
|
|
138
|
+
- **yasna** answers: *where did I already discuss this?*
|
|
139
|
+
- **radogast** answers: *is the AI agent still on track toward the goal?*
|
|
140
|
+
- **vyrii** answers: *how do I access all of this through a browser?*
|
|
141
|
+
- **syryn** answers: *what is the address of this headless device?*
|
|
142
|
+
- **alkonost** answers: *how do I turn one task description into a reviewed, working plan — and see the project's glossary — without a big model or a big context window?*
|
|
143
|
+
- **gamayun** finds the code related to a task through an ontology of significant links between words, files and modules (no LLM).
|
|
144
|
+
- **mokosh** prepares the initial dataset from version control and the issue tracker.
|
|
145
|
+
- **magura** answers: *where does this business term live in the code, and which files do all the tools point to?*
|
|
146
|
+
- **boyan** answers: *what does this project call the thing I am describing, and where does it live?*
|
|
147
|
+
- **khors** answers: *how do I turn a chat, a plan or my notes into a document I can hand over — a text or slides — with a small model's help?*
|
|
148
|
+
|
|
149
|
+
Together they cover the full development loop: gather the history, understand the codebase, find relevant history, work with AI locally, remember what was decided, and verify the context stays on target.
|
|
150
|
+
|
|
151
|
+
The name comes from Slavic mythology. Magura (Магура) is a winged warrior maiden, daughter of Perun, who flies over the battlefield, inspires the warriors and finds the fallen to give them the water of life. A fitting name for a tool that follows one term through every layer of the code and finds each place it lives.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT. See [LICENSE](LICENSE).
|
|
158
|
+
|
|
159
|
+
## About
|
|
160
|
+
|
|
161
|
+
(c) 2026 Stanislav Zholobetskyi, Oleh Andriichuk
|
|
162
|
+
Institute for Information Recording, National Academy of Sciences of Ukraine, Kyiv
|
|
163
|
+
PhD research: «Intelligent Technology for Software Development and Maintenance Support»
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""Arrows between files (MAGURA.md §4.2), from the field's mentions and the code itself — no
|
|
2
|
+
build, no call graph. A svitovyd map of depth 2 knows classes, not their methods, so the links
|
|
3
|
+
of a field are read from the files:
|
|
4
|
+
|
|
5
|
+
1. Java -> Java. A file that defines the field (a field, its getter or setter) is a class
|
|
6
|
+
(Foo.java -> Foo). Another file that mentions the field and imports Foo, or lies in Foo's
|
|
7
|
+
package, reads it (getter, plain name: Foo -> reader) or writes it (setter: writer -> Foo).
|
|
8
|
+
2. Through the database. A column defined in storage (DDL, a migration) and the same column in a
|
|
9
|
+
query (MyBatis XML, SQL): SELECT / WHERE / `as` read it (storage -> query); `#{x}` in an
|
|
10
|
+
INSERT or UPDATE writes it (query -> storage).
|
|
11
|
+
3. MyBatis XML <-> its classes. A mapper names its classes (resultType, parameterType, type=):
|
|
12
|
+
a read in the XML goes on into them (query -> dto), a `#{x}` comes from them (dto -> query).
|
|
13
|
+
|
|
14
|
+
Each arrow carries its evidence (file:line); a person can drop a wrong one (MAGURA.md §7).
|
|
15
|
+
"""
|
|
16
|
+
import os
|
|
17
|
+
import re
|
|
18
|
+
from collections import defaultdict
|
|
19
|
+
|
|
20
|
+
_IMPORT = re.compile(r"^\s*import\s+(?:static\s+)?([\w.]+)\s*;", re.M)
|
|
21
|
+
_PACKAGE = re.compile(r"^\s*package\s+([\w.]+)\s*;", re.M)
|
|
22
|
+
_XML_TYPE = re.compile(r"(?:resultType|parameterType|type|javaType|ofType)\s*=\s*\"([\w.]+)\"")
|
|
23
|
+
_JVM = (".java", ".kt", ".groovy", ".scala")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _read(root, rel, cache):
|
|
27
|
+
if rel not in cache:
|
|
28
|
+
try:
|
|
29
|
+
with open(os.path.join(root, rel), encoding="utf-8", errors="replace") as f:
|
|
30
|
+
cache[rel] = f.read()
|
|
31
|
+
except OSError:
|
|
32
|
+
cache[rel] = ""
|
|
33
|
+
return cache[rel]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _class_of(rel):
|
|
37
|
+
return os.path.splitext(os.path.basename(rel))[0]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _snake(name):
|
|
41
|
+
return re.sub(r"(?<=[a-z0-9])([A-Z])", r"_\1", name).lower()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _table_of(root, m, cache):
|
|
45
|
+
"""The table a storage definition belongs to, or None: the CREATE TABLE above it in a DDL; in a
|
|
46
|
+
migration the table it names (TABLE_NAME = "x", newTableBuilder("x"), tableName("x")) or its
|
|
47
|
+
class (CreateIssuesTable -> issues)."""
|
|
48
|
+
text = _read(root, m["file"], cache)
|
|
49
|
+
if m["file"].endswith((".ddl", ".sql")):
|
|
50
|
+
above = "\n".join(text.splitlines()[:m["line"]])
|
|
51
|
+
hits = re.findall(r"create\s+table\s+\"?(\w+)\"?", above, re.I)
|
|
52
|
+
return hits[-1].lower() if hits else None
|
|
53
|
+
hit = re.search(r"(?:TABLE_NAME\s*=\s*|newTableBuilder\(\s*|[tT]ableName\(\s*|table\(\s*)\"(\w+)\"", text)
|
|
54
|
+
if hit:
|
|
55
|
+
return hit.group(1).lower()
|
|
56
|
+
cls = re.match(r"(?:Create|Add\w+To|Alter)?(\w+?)(?:Table)?$", _class_of(m["file"]))
|
|
57
|
+
return _snake(cls.group(1)) if cls else None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def _is_write(m):
|
|
61
|
+
return bool(re.search(r"\.set[A-Z]\w*\(", m["text"])) and any(n.lower().startswith("set") for n in m["names"]) \
|
|
62
|
+
or (m["file"].endswith((".xml", ".sql")) and "#{" in m["text"])
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def arrows_between(root, ms):
|
|
66
|
+
"""[{"from", "to", "how", "at"}] — file to file; at = the evidence lines."""
|
|
67
|
+
cache = {}
|
|
68
|
+
found = defaultdict(list) # (from, to, how) -> [file:line]
|
|
69
|
+
|
|
70
|
+
# 1. Java -> Java
|
|
71
|
+
definers = {} # class name -> its file
|
|
72
|
+
for m in ms:
|
|
73
|
+
if m["kind"] == "definition" and m["file"].endswith(_JVM):
|
|
74
|
+
definers[_class_of(m["file"])] = m["file"]
|
|
75
|
+
pkg_of = {}
|
|
76
|
+
for f in set(definers.values()) | {m["file"] for m in ms if m["file"].endswith(_JVM)}:
|
|
77
|
+
p = _PACKAGE.search(_read(root, f, cache))
|
|
78
|
+
pkg_of[f] = p.group(1) if p else ""
|
|
79
|
+
for m in ms:
|
|
80
|
+
f = m["file"]
|
|
81
|
+
if not f.endswith(_JVM) or m["kind"] == "definition":
|
|
82
|
+
continue
|
|
83
|
+
text = _read(root, f, cache)
|
|
84
|
+
imported = {i.rsplit(".", 1)[-1] for i in _IMPORT.findall(text)}
|
|
85
|
+
for cls, df in definers.items():
|
|
86
|
+
if df == f:
|
|
87
|
+
continue
|
|
88
|
+
if cls in imported or (pkg_of.get(df) and pkg_of.get(df) == pkg_of.get(f) and re.search(r"\b%s\b" % cls, text)):
|
|
89
|
+
key = (f, df, "writes") if _is_write(m) else (df, f, "reads")
|
|
90
|
+
found[key].append(f"{f}:{m['line']}")
|
|
91
|
+
|
|
92
|
+
# 2. storage <-> query by the column — and by its table: `severity` is a column of several
|
|
93
|
+
# tables, and a query reads the one it names (issues i … i.severity)
|
|
94
|
+
storage = [m for m in ms if m["layer"] == "storage" and m["kind"] == "definition"]
|
|
95
|
+
tables = {id(s): _table_of(root, s, cache) for s in storage}
|
|
96
|
+
for m in ms:
|
|
97
|
+
if m["layer"] != "query" or not m["file"].endswith((".xml", ".sql")):
|
|
98
|
+
continue
|
|
99
|
+
qtext = _read(root, m["file"], cache).lower()
|
|
100
|
+
for s in storage:
|
|
101
|
+
t = tables[id(s)]
|
|
102
|
+
if t and not re.search(r"\b%s\b" % re.escape(t.lower()), qtext):
|
|
103
|
+
continue
|
|
104
|
+
key = (m["file"], s["file"], "writes the column") if _is_write(m) else (s["file"], m["file"], "reads the column")
|
|
105
|
+
found[key].append(f"{m['file']}:{m['line']}")
|
|
106
|
+
|
|
107
|
+
# 3. a MyBatis mapper <-> the classes it names
|
|
108
|
+
for m in ms:
|
|
109
|
+
if not m["file"].endswith(".xml") or m["layer"] != "query":
|
|
110
|
+
continue
|
|
111
|
+
for full in set(_XML_TYPE.findall(_read(root, m["file"], cache))):
|
|
112
|
+
cls = full.rsplit(".", 1)[-1]
|
|
113
|
+
df = definers.get(cls)
|
|
114
|
+
if not df:
|
|
115
|
+
continue
|
|
116
|
+
key = (df, m["file"], "maps into the query") if _is_write(m) else (m["file"], df, "maps the result into")
|
|
117
|
+
found[key].append(f"{m['file']}:{m['line']}")
|
|
118
|
+
|
|
119
|
+
return [{"from": a, "to": b, "how": how, "at": sorted(set(at))} for (a, b, how), at in found.items()]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def confirmed_by_import(root, arrow, cache=None):
|
|
123
|
+
"""A map arrow between two Java files holds when the caller imports the other's class or
|
|
124
|
+
lies in its package (the caller is the side that is not the definer's class)."""
|
|
125
|
+
cache = cache if cache is not None else {}
|
|
126
|
+
a, b = arrow["from"], arrow["to"]
|
|
127
|
+
if not (a.endswith(_JVM) and b.endswith(_JVM)):
|
|
128
|
+
return True
|
|
129
|
+
reader_side = arrow["how"].endswith("read by")
|
|
130
|
+
definer, caller = (a, b) if reader_side else (b, a)
|
|
131
|
+
text = _read(root, caller, cache)
|
|
132
|
+
if _class_of(definer) in {i.rsplit(".", 1)[-1] for i in _IMPORT.findall(text)}:
|
|
133
|
+
return True
|
|
134
|
+
p1, p2 = _PACKAGE.search(_read(root, definer, cache)), _PACKAGE.search(text)
|
|
135
|
+
return bool(p1 and p2 and p1.group(1) == p2.group(1))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def map_arrows(codemap, field, files=None):
|
|
139
|
+
"""Arrows from a svitovyd map of depth 3: its links name the call and the file that defines
|
|
140
|
+
it (call:getSeverity -> RuleForIndexingDto.java). A getter read is target -> caller, a setter
|
|
141
|
+
call is caller -> target. files: keep the arrows that touch them (the field's mentions)."""
|
|
142
|
+
from .mentions import classify_name, is_type_name
|
|
143
|
+
out = defaultdict(list)
|
|
144
|
+
for name, pairs in codemap.links.items():
|
|
145
|
+
if is_type_name(name) or classify_name(name, field) != "field":
|
|
146
|
+
continue # Severity (a class) is not the field severity
|
|
147
|
+
write = name.lower().startswith(("set", "with", "put"))
|
|
148
|
+
for user, target, kinds in pairs:
|
|
149
|
+
if user == target or (files is not None and user not in files and target not in files):
|
|
150
|
+
continue
|
|
151
|
+
if "call" not in kinds and "ref" not in kinds and "import" not in kinds:
|
|
152
|
+
continue # a bare word (expr) is no use of the field
|
|
153
|
+
key = (user, target, f"calls {name}") if write else (target, user, f"{name} read by")
|
|
154
|
+
out[key].append(user)
|
|
155
|
+
return [{"from": a, "to": b, "how": how, "at": sorted(set(at))} for (a, b, how), at in out.items()]
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
_COCHANGE = re.compile(r"^file:(\S+) :: co_changes_with :: file:(\S+)\s+\[src: n=(\d+);g2=([\d.]+);lift=([\d.]+)\]")
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def history_bridges(files, gamayun_dir, min_n=2):
|
|
162
|
+
"""Bridges of the history (MAGURA.md §4.2, 5): two files that both mention the field and were
|
|
163
|
+
changed together by past tasks (gamayun's co_changes_with: n tasks, G², lift). No direction —
|
|
164
|
+
the history says they go together, not which way the value runs; the layers order them."""
|
|
165
|
+
path = os.path.join(gamayun_dir, "triples.txt")
|
|
166
|
+
if not os.path.isfile(path):
|
|
167
|
+
return []
|
|
168
|
+
want = set(files)
|
|
169
|
+
out = []
|
|
170
|
+
with open(path, encoding="utf-8", errors="replace") as f:
|
|
171
|
+
for line in f:
|
|
172
|
+
if " co_changes_with " not in line:
|
|
173
|
+
continue
|
|
174
|
+
m = _COCHANGE.match(line)
|
|
175
|
+
if m and m.group(1) in want and m.group(2) in want and int(m.group(3)) >= min_n:
|
|
176
|
+
out.append({"a": m.group(1), "b": m.group(2), "n": int(m.group(3)),
|
|
177
|
+
"g2": float(m.group(4)), "lift": float(m.group(5))})
|
|
178
|
+
return sorted(out, key=lambda x: -x["g2"])
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def layer_flow(arrows, layer_of_file):
|
|
182
|
+
"""How many file arrows go from one layer to another: {(from layer, to layer): n}."""
|
|
183
|
+
out = defaultdict(int)
|
|
184
|
+
for a in arrows:
|
|
185
|
+
out[(layer_of_file.get(a["from"], "?"), layer_of_file.get(a["to"], "?"))] += 1
|
|
186
|
+
return dict(out)
|