negaresh 0.2.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.
- negaresh-0.2.0/LICENSE +21 -0
- negaresh-0.2.0/NOTICE.md +19 -0
- negaresh-0.2.0/PKG-INFO +214 -0
- negaresh-0.2.0/README.md +190 -0
- negaresh-0.2.0/pyproject.toml +42 -0
- negaresh-0.2.0/setup.cfg +4 -0
- negaresh-0.2.0/src/negaresh/__init__.py +4 -0
- negaresh-0.2.0/src/negaresh/api.py +260 -0
- negaresh-0.2.0/src/negaresh/cli.py +85 -0
- negaresh-0.2.0/src/negaresh/corpus.py +36 -0
- negaresh-0.2.0/src/negaresh/data/corpus.json +1 -0
- negaresh-0.2.0/src/negaresh/mechanics.py +494 -0
- negaresh-0.2.0/src/negaresh/patches.py +140 -0
- negaresh-0.2.0/src/negaresh/search.py +108 -0
- negaresh-0.2.0/src/negaresh/server.py +170 -0
- negaresh-0.2.0/src/negaresh/textutil.py +79 -0
- negaresh-0.2.0/src/negaresh.egg-info/PKG-INFO +214 -0
- negaresh-0.2.0/src/negaresh.egg-info/SOURCES.txt +22 -0
- negaresh-0.2.0/src/negaresh.egg-info/dependency_links.txt +1 -0
- negaresh-0.2.0/src/negaresh.egg-info/entry_points.txt +2 -0
- negaresh-0.2.0/src/negaresh.egg-info/requires.txt +5 -0
- negaresh-0.2.0/src/negaresh.egg-info/top_level.txt +1 -0
- negaresh-0.2.0/tests/test_negaresh.py +146 -0
- negaresh-0.2.0/tests/test_precision.py +249 -0
negaresh-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 negaresh contributors
|
|
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.
|
negaresh-0.2.0/NOTICE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Sources
|
|
2
|
+
|
|
3
|
+
The rules were built from these books:
|
|
4
|
+
|
|
5
|
+
| Id | Book |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| dastur-khat-1401 | فرهنگستان زبان و ادب فارسی، دستور خطّ فارسی (ویراست جدید)، تهران: نشر آثار، ۱۴۰۱ |
|
|
8
|
+
| anvari-givi-1 | حسن احمدی گیوی و حسن انوری، دستور زبان فارسی ۱، ویرایش چهارم، تهران: فاطمی |
|
|
9
|
+
| anvari-givi-2 | حسن انوری و حسن احمدی گیوی، دستور زبان فارسی ۲، ویرایش چهارم، تهران: فاطمی |
|
|
10
|
+
| arjang-1374 | غلامرضا ارژنگ، دستور زبان فارسی امروز، تهران: قطره، ۱۳۷۴ |
|
|
11
|
+
| samiee-1386 | احمد سمیعی (گیلانی)، نگارش و ویرایش، تهران: سمت، چاپ هشتم ۱۳۸۶ |
|
|
12
|
+
|
|
13
|
+
## How the rules were made
|
|
14
|
+
|
|
15
|
+
The author bought the books, scanned them with OCR for personal use, and extracted the rules from them. The rules were then rewritten and tuned to the author's needs, with new examples. The books are not part of this project and cannot be read or searched through the skill or the server. The skill does not check sentences against the books; it applies the rules. Each rule names the book and page it comes from.
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
All rules have the status `draft`. No human editor has approved them.
|
negaresh-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: negaresh
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Persian (Farsi) writing guide: sourced rule set, mechanical checks and a local MCP server
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/Aricept094/negaresh
|
|
7
|
+
Project-URL: Repository, https://github.com/Aricept094/negaresh
|
|
8
|
+
Project-URL: Changelog, https://github.com/Aricept094/negaresh/blob/main/CHANGELOG.md
|
|
9
|
+
Keywords: persian,farsi,writing,editing,mcp,mcp-server,agent-skills
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Natural Language :: Persian
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: NOTICE.md
|
|
19
|
+
Requires-Dist: mcp==2.3.0
|
|
20
|
+
Requires-Dist: pydantic<3,>=2.12
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# negaresh (نگارش)
|
|
26
|
+
|
|
27
|
+
[](https://github.com/Aricept094/negaresh/actions/workflows/ci.yml) [](LICENSE)
|
|
28
|
+
|
|
29
|
+
A Persian (Farsi) writing guide for AI assistants and editors. It has three parts that work together or alone:
|
|
30
|
+
|
|
31
|
+
- **A rule set**: 163 rules for Iranian standard Persian. They cover sentence structure and natural word order, verb tense and mood, paragraph flow, removing translated or machine-like Persian, grammar, usage, punctuation, numbers and citations, Academy orthography (نیمفاصله), and meaning preservation. Each rule has a test, examples, and a citation to the book it comes from.
|
|
32
|
+
- **A skill** (standard Agent Skills `SKILL.md` folder) for Claude, Codex and other agents: how to write, copyedit, proofread or naturalize (روانسازی) a Persian text with the rules.
|
|
33
|
+
- **An MCP server** (stdio and Streamable HTTP) for Claude, ChatGPT, Codex, Gemini CLI, Cursor, VS Code and any MCP client: deterministic checks (Arabic letters, digits, spacing, half-spaces, quotes, variant spellings, listed calques, and sentence shapes typical of machine Persian), rule search, and validation of edits before they are applied.
|
|
34
|
+
|
|
35
|
+
> **Status: draft (0.2.0).** No human editor has approved the rules yet. Use them as suggestions and check important text yourself.
|
|
36
|
+
|
|
37
|
+
راهنمای نگارش فارسی برای دستیارهای هوش مصنوعی و ویراستاران: ۱۶۳ قاعده دربارهٔ ساخت جمله، ترتیب طبیعی اجزا، زمان و وجه فعل، پیوند بندها، زدودن نثر ترجمهای و ماشینی، دستور، کاربرد، نشانهگذاری و دستور خط فرهنگستان؛ با یک مهارت (skill) برای Claude و یک سرور MCP محلی برای بررسیهای مکانیکی. همهٔ قاعدهها پیشنویساند.
|
|
38
|
+
|
|
39
|
+
## Sources
|
|
40
|
+
|
|
41
|
+
The rules were built from five books: the Academy's «دستور خطّ فارسی» (1401), Anvari and Ahmadi-Givi's «دستور زبان فارسی» 1 and 2, Arzhang's «دستور زبان فارسی امروز», and Samiee's «نگارش و ویرایش». The author bought the books, scanned them with OCR, extracted the rules, and rewrote and tuned them to the author's needs. The books are not included, and the skill and server cannot read or search them; the skill applies the rules, not the books. Full titles are in [NOTICE.md](NOTICE.md).
|
|
42
|
+
|
|
43
|
+
## What it does
|
|
44
|
+
|
|
45
|
+
| Task | Ask for | What happens |
|
|
46
|
+
| --- | --- | --- |
|
|
47
|
+
| Write | «این را به فارسی بنویس» / "write this in Persian" | The model writes with a real subject and a finite verb for each action, no stock frames, natural order and tense. |
|
|
48
|
+
| Copyedit | «ویرایش کن» | Grammar, usage and spelling are fixed. Sentences with machine or translated shapes get a proposed rebuild. |
|
|
49
|
+
| Naturalize | «روانش کن»، «طبیعیترش کن»، «ترجمهای است» | Sentences and paragraphs are rebuilt from their meaning. Facts, hedges, actors, numbers and names are kept. |
|
|
50
|
+
| Proofread | «غلطگیری کن» | Characters, spacing, half-spaces, spelling and punctuation only. |
|
|
51
|
+
| Ask | «این درست است؟» | The rule is found and cited. |
|
|
52
|
+
|
|
53
|
+
## Requirements
|
|
54
|
+
|
|
55
|
+
- For the MCP server: Python 3.11 or later and [uv](https://docs.astral.sh/uv/) (`uvx` must be on the PATH). The server needs no network access while it runs.
|
|
56
|
+
- The skill and the rule set need nothing.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
The server command is the same everywhere:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
uvx --from git+https://github.com/Aricept094/negaresh negaresh serve
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Claude Code (plugin: skill and MCP server together)
|
|
67
|
+
|
|
68
|
+
In Claude Code:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
/plugin marketplace add Aricept094/negaresh
|
|
72
|
+
/plugin install negaresh@negaresh
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or from a terminal:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
claude plugin marketplace add Aricept094/negaresh
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
claude plugin install negaresh@negaresh
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Claude Desktop
|
|
86
|
+
|
|
87
|
+
Add the server to `claude_desktop_config.json` (Settings → Developer → Edit Config) and restart the app:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"mcpServers": {
|
|
92
|
+
"negaresh": {
|
|
93
|
+
"command": "uvx",
|
|
94
|
+
"args": ["--from", "git+https://github.com/Aricept094/negaresh", "negaresh", "serve"]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
For the skill, upload `negaresh-skill.zip` from the [latest release](https://github.com/Aricept094/negaresh/releases/latest) under Settings → Capabilities → Skills.
|
|
101
|
+
|
|
102
|
+
### Claude.ai
|
|
103
|
+
|
|
104
|
+
Upload `negaresh-skill.zip` from the [latest release](https://github.com/Aricept094/negaresh/releases/latest) under Settings → Capabilities → Skills. The skill works without the server.
|
|
105
|
+
|
|
106
|
+
### ChatGPT
|
|
107
|
+
|
|
108
|
+
Two ways, both in [clients/chatgpt](clients/chatgpt/README.md): an MCP connector in developer mode (run the server with `--http` behind an HTTPS tunnel), or a custom GPT with the rule files as knowledge.
|
|
109
|
+
|
|
110
|
+
### Codex CLI
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
codex mcp add negaresh -- uvx --from git+https://github.com/Aricept094/negaresh negaresh serve
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For the skill, copy `skills/negaresh` to `~/.codex/skills/negaresh`.
|
|
117
|
+
|
|
118
|
+
### Gemini CLI
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
gemini extensions install https://github.com/Aricept094/negaresh
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Cursor
|
|
125
|
+
|
|
126
|
+
[Install in Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=negaresh&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXQraHR0cHM6Ly9naXRodWIuY29tL0FyaWNlcHQwOTQvbmVnYXJlc2giLCJuZWdhcmVzaCIsInNlcnZlIl19), or add the JSON block above to `~/.cursor/mcp.json`.
|
|
127
|
+
|
|
128
|
+
### VS Code
|
|
129
|
+
|
|
130
|
+
[Install in VS Code](https://insiders.vscode.dev/redirect/mcp/install?name=negaresh&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22git%2Bhttps%3A//github.com/Aricept094/negaresh%22%2C%22negaresh%22%2C%22serve%22%5D%7D), or:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
code --add-mcp "{\"name\":\"negaresh\",\"command\":\"uvx\",\"args\":[\"--from\",\"git+https://github.com/Aricept094/negaresh\",\"negaresh\",\"serve\"]}"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Any other MCP client
|
|
137
|
+
|
|
138
|
+
- stdio: `uvx --from git+https://github.com/Aricept094/negaresh negaresh serve`
|
|
139
|
+
- Streamable HTTP: `uvx --from git+https://github.com/Aricept094/negaresh negaresh serve --http --port 8000`, then connect to `http://127.0.0.1:8000/mcp`. Use `--allowed-host <name>` for a proxy or tunnel host.
|
|
140
|
+
- With pip: `pip install git+https://github.com/Aricept094/negaresh`, then `negaresh serve`.
|
|
141
|
+
|
|
142
|
+
### Skill only (any client that reads Agent Skills)
|
|
143
|
+
|
|
144
|
+
The skill is a standard `SKILL.md` folder: [`skills/negaresh`](skills/negaresh). Copy it into the client's skills folder (`~/.claude/skills/`, `~/.codex/skills/`, or the client's own location).
|
|
145
|
+
|
|
146
|
+
### Rule set only
|
|
147
|
+
|
|
148
|
+
- `corpus/rules/*.json`: the rules as JSON (one array per category).
|
|
149
|
+
- `docs/RULEBOOK__NEEDS-INPUT.md`: the full rule book in Persian.
|
|
150
|
+
- `corpus/lexicon/`: variant spellings, listed expressions and sentence-shape patterns.
|
|
151
|
+
|
|
152
|
+
## MCP tools
|
|
153
|
+
|
|
154
|
+
| Tool | Use |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| `search_rules` | Find rules by Persian or English words. |
|
|
157
|
+
| `get_rule` | One rule in full. |
|
|
158
|
+
| `get_profile` | Conventions for a kind of text (academic, journalistic, literary, ...). |
|
|
159
|
+
| `check_mechanics` | Checks M01 to M16. It returns findings with exact offsets, candidate patches, and a low-risk `auto_patch_set`. |
|
|
160
|
+
| `validate_patches` | Checks that a set of edits applies cleanly and leaves URLs, code and other protected text unchanged. |
|
|
161
|
+
| `search`, `fetch` | Over HTTP only: the search-and-read pair that ChatGPT connectors use. |
|
|
162
|
+
|
|
163
|
+
All tools are read-only. The server stores no text on disk. Each call takes up to 12,000 Unicode code points.
|
|
164
|
+
|
|
165
|
+
## Command line
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
negaresh doctor
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
negaresh check draft.txt --profile academic
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
negaresh search "نیمفاصله می"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Rule families
|
|
180
|
+
|
|
181
|
+
| Prefix | Family | Rules | Main sources |
|
|
182
|
+
| --- | --- | --- | --- |
|
|
183
|
+
| ORT | Orthography and spacing | 44 | Academy «دستور خطّ فارسی» (1401) |
|
|
184
|
+
| GRM | Grammar, word order, tense and mood | 39 | Anvari and Ahmadi-Givi 1 and 2; Arzhang; Samiee |
|
|
185
|
+
| USG | Usage and calques | 23 | the three grammars; Samiee |
|
|
186
|
+
| STY | Style and sentence building | 19 | Samiee; editorial synthesis |
|
|
187
|
+
| PUN | Punctuation and characters | 18 | Samiee |
|
|
188
|
+
| TRM | Numbers, dates, citations, notes, names | 9 | Samiee |
|
|
189
|
+
| INT | Meaning preservation | 6 | Samiee; editorial synthesis |
|
|
190
|
+
| DSC | Paragraphs and discourse | 5 | Samiee |
|
|
191
|
+
|
|
192
|
+
Each rule has a severity (`error`, `convention`, `advisory`) and an evidence class. `sourced` rules name the book and page they come from; `editorial_synthesis` rules are editorial practice and are offered as suggestions only.
|
|
193
|
+
|
|
194
|
+
## Edit the rules
|
|
195
|
+
|
|
196
|
+
1. Edit the JSON in `corpus/rules/`.
|
|
197
|
+
2. Run `python tools/build.py`. It validates the corpus and regenerates the bundle, the skill references and the rule book.
|
|
198
|
+
3. Run `pytest`.
|
|
199
|
+
|
|
200
|
+
Do not edit generated files: `src/negaresh/data/corpus.json`, `skills/negaresh/references/rules-*.md`, `docs/RULEBOOK__NEEDS-INPUT.md`.
|
|
201
|
+
|
|
202
|
+
To make the release files (wheel, skill zip, clean folder): `python tools/package.py`.
|
|
203
|
+
|
|
204
|
+
<!-- mcp-name: io.github.Aricept094/negaresh -->
|
|
205
|
+
|
|
206
|
+
## Limits
|
|
207
|
+
|
|
208
|
+
- The rules are drafts. No human editor has approved them.
|
|
209
|
+
- The mechanical checker sees characters, listed expressions and a few sentence shapes. No finding does not mean that the prose is natural. Sentence and paragraph rebuilding is done by the model with the rules.
|
|
210
|
+
- The «می» half-space check uses a closed list of verb stems.
|
|
211
|
+
|
|
212
|
+
## Licence
|
|
213
|
+
|
|
214
|
+
MIT. See [LICENSE](LICENSE).
|
negaresh-0.2.0/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# negaresh (نگارش)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/Aricept094/negaresh/actions/workflows/ci.yml) [](LICENSE)
|
|
4
|
+
|
|
5
|
+
A Persian (Farsi) writing guide for AI assistants and editors. It has three parts that work together or alone:
|
|
6
|
+
|
|
7
|
+
- **A rule set**: 163 rules for Iranian standard Persian. They cover sentence structure and natural word order, verb tense and mood, paragraph flow, removing translated or machine-like Persian, grammar, usage, punctuation, numbers and citations, Academy orthography (نیمفاصله), and meaning preservation. Each rule has a test, examples, and a citation to the book it comes from.
|
|
8
|
+
- **A skill** (standard Agent Skills `SKILL.md` folder) for Claude, Codex and other agents: how to write, copyedit, proofread or naturalize (روانسازی) a Persian text with the rules.
|
|
9
|
+
- **An MCP server** (stdio and Streamable HTTP) for Claude, ChatGPT, Codex, Gemini CLI, Cursor, VS Code and any MCP client: deterministic checks (Arabic letters, digits, spacing, half-spaces, quotes, variant spellings, listed calques, and sentence shapes typical of machine Persian), rule search, and validation of edits before they are applied.
|
|
10
|
+
|
|
11
|
+
> **Status: draft (0.2.0).** No human editor has approved the rules yet. Use them as suggestions and check important text yourself.
|
|
12
|
+
|
|
13
|
+
راهنمای نگارش فارسی برای دستیارهای هوش مصنوعی و ویراستاران: ۱۶۳ قاعده دربارهٔ ساخت جمله، ترتیب طبیعی اجزا، زمان و وجه فعل، پیوند بندها، زدودن نثر ترجمهای و ماشینی، دستور، کاربرد، نشانهگذاری و دستور خط فرهنگستان؛ با یک مهارت (skill) برای Claude و یک سرور MCP محلی برای بررسیهای مکانیکی. همهٔ قاعدهها پیشنویساند.
|
|
14
|
+
|
|
15
|
+
## Sources
|
|
16
|
+
|
|
17
|
+
The rules were built from five books: the Academy's «دستور خطّ فارسی» (1401), Anvari and Ahmadi-Givi's «دستور زبان فارسی» 1 and 2, Arzhang's «دستور زبان فارسی امروز», and Samiee's «نگارش و ویرایش». The author bought the books, scanned them with OCR, extracted the rules, and rewrote and tuned them to the author's needs. The books are not included, and the skill and server cannot read or search them; the skill applies the rules, not the books. Full titles are in [NOTICE.md](NOTICE.md).
|
|
18
|
+
|
|
19
|
+
## What it does
|
|
20
|
+
|
|
21
|
+
| Task | Ask for | What happens |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| Write | «این را به فارسی بنویس» / "write this in Persian" | The model writes with a real subject and a finite verb for each action, no stock frames, natural order and tense. |
|
|
24
|
+
| Copyedit | «ویرایش کن» | Grammar, usage and spelling are fixed. Sentences with machine or translated shapes get a proposed rebuild. |
|
|
25
|
+
| Naturalize | «روانش کن»، «طبیعیترش کن»، «ترجمهای است» | Sentences and paragraphs are rebuilt from their meaning. Facts, hedges, actors, numbers and names are kept. |
|
|
26
|
+
| Proofread | «غلطگیری کن» | Characters, spacing, half-spaces, spelling and punctuation only. |
|
|
27
|
+
| Ask | «این درست است؟» | The rule is found and cited. |
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- For the MCP server: Python 3.11 or later and [uv](https://docs.astral.sh/uv/) (`uvx` must be on the PATH). The server needs no network access while it runs.
|
|
32
|
+
- The skill and the rule set need nothing.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
The server command is the same everywhere:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
uvx --from git+https://github.com/Aricept094/negaresh negaresh serve
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Claude Code (plugin: skill and MCP server together)
|
|
43
|
+
|
|
44
|
+
In Claude Code:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
/plugin marketplace add Aricept094/negaresh
|
|
48
|
+
/plugin install negaresh@negaresh
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or from a terminal:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude plugin marketplace add Aricept094/negaresh
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude plugin install negaresh@negaresh
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Claude Desktop
|
|
62
|
+
|
|
63
|
+
Add the server to `claude_desktop_config.json` (Settings → Developer → Edit Config) and restart the app:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"negaresh": {
|
|
69
|
+
"command": "uvx",
|
|
70
|
+
"args": ["--from", "git+https://github.com/Aricept094/negaresh", "negaresh", "serve"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For the skill, upload `negaresh-skill.zip` from the [latest release](https://github.com/Aricept094/negaresh/releases/latest) under Settings → Capabilities → Skills.
|
|
77
|
+
|
|
78
|
+
### Claude.ai
|
|
79
|
+
|
|
80
|
+
Upload `negaresh-skill.zip` from the [latest release](https://github.com/Aricept094/negaresh/releases/latest) under Settings → Capabilities → Skills. The skill works without the server.
|
|
81
|
+
|
|
82
|
+
### ChatGPT
|
|
83
|
+
|
|
84
|
+
Two ways, both in [clients/chatgpt](clients/chatgpt/README.md): an MCP connector in developer mode (run the server with `--http` behind an HTTPS tunnel), or a custom GPT with the rule files as knowledge.
|
|
85
|
+
|
|
86
|
+
### Codex CLI
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
codex mcp add negaresh -- uvx --from git+https://github.com/Aricept094/negaresh negaresh serve
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
For the skill, copy `skills/negaresh` to `~/.codex/skills/negaresh`.
|
|
93
|
+
|
|
94
|
+
### Gemini CLI
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
gemini extensions install https://github.com/Aricept094/negaresh
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Cursor
|
|
101
|
+
|
|
102
|
+
[Install in Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=negaresh&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXQraHR0cHM6Ly9naXRodWIuY29tL0FyaWNlcHQwOTQvbmVnYXJlc2giLCJuZWdhcmVzaCIsInNlcnZlIl19), or add the JSON block above to `~/.cursor/mcp.json`.
|
|
103
|
+
|
|
104
|
+
### VS Code
|
|
105
|
+
|
|
106
|
+
[Install in VS Code](https://insiders.vscode.dev/redirect/mcp/install?name=negaresh&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22git%2Bhttps%3A//github.com/Aricept094/negaresh%22%2C%22negaresh%22%2C%22serve%22%5D%7D), or:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
code --add-mcp "{\"name\":\"negaresh\",\"command\":\"uvx\",\"args\":[\"--from\",\"git+https://github.com/Aricept094/negaresh\",\"negaresh\",\"serve\"]}"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Any other MCP client
|
|
113
|
+
|
|
114
|
+
- stdio: `uvx --from git+https://github.com/Aricept094/negaresh negaresh serve`
|
|
115
|
+
- Streamable HTTP: `uvx --from git+https://github.com/Aricept094/negaresh negaresh serve --http --port 8000`, then connect to `http://127.0.0.1:8000/mcp`. Use `--allowed-host <name>` for a proxy or tunnel host.
|
|
116
|
+
- With pip: `pip install git+https://github.com/Aricept094/negaresh`, then `negaresh serve`.
|
|
117
|
+
|
|
118
|
+
### Skill only (any client that reads Agent Skills)
|
|
119
|
+
|
|
120
|
+
The skill is a standard `SKILL.md` folder: [`skills/negaresh`](skills/negaresh). Copy it into the client's skills folder (`~/.claude/skills/`, `~/.codex/skills/`, or the client's own location).
|
|
121
|
+
|
|
122
|
+
### Rule set only
|
|
123
|
+
|
|
124
|
+
- `corpus/rules/*.json`: the rules as JSON (one array per category).
|
|
125
|
+
- `docs/RULEBOOK__NEEDS-INPUT.md`: the full rule book in Persian.
|
|
126
|
+
- `corpus/lexicon/`: variant spellings, listed expressions and sentence-shape patterns.
|
|
127
|
+
|
|
128
|
+
## MCP tools
|
|
129
|
+
|
|
130
|
+
| Tool | Use |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `search_rules` | Find rules by Persian or English words. |
|
|
133
|
+
| `get_rule` | One rule in full. |
|
|
134
|
+
| `get_profile` | Conventions for a kind of text (academic, journalistic, literary, ...). |
|
|
135
|
+
| `check_mechanics` | Checks M01 to M16. It returns findings with exact offsets, candidate patches, and a low-risk `auto_patch_set`. |
|
|
136
|
+
| `validate_patches` | Checks that a set of edits applies cleanly and leaves URLs, code and other protected text unchanged. |
|
|
137
|
+
| `search`, `fetch` | Over HTTP only: the search-and-read pair that ChatGPT connectors use. |
|
|
138
|
+
|
|
139
|
+
All tools are read-only. The server stores no text on disk. Each call takes up to 12,000 Unicode code points.
|
|
140
|
+
|
|
141
|
+
## Command line
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
negaresh doctor
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
negaresh check draft.txt --profile academic
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
negaresh search "نیمفاصله می"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Rule families
|
|
156
|
+
|
|
157
|
+
| Prefix | Family | Rules | Main sources |
|
|
158
|
+
| --- | --- | --- | --- |
|
|
159
|
+
| ORT | Orthography and spacing | 44 | Academy «دستور خطّ فارسی» (1401) |
|
|
160
|
+
| GRM | Grammar, word order, tense and mood | 39 | Anvari and Ahmadi-Givi 1 and 2; Arzhang; Samiee |
|
|
161
|
+
| USG | Usage and calques | 23 | the three grammars; Samiee |
|
|
162
|
+
| STY | Style and sentence building | 19 | Samiee; editorial synthesis |
|
|
163
|
+
| PUN | Punctuation and characters | 18 | Samiee |
|
|
164
|
+
| TRM | Numbers, dates, citations, notes, names | 9 | Samiee |
|
|
165
|
+
| INT | Meaning preservation | 6 | Samiee; editorial synthesis |
|
|
166
|
+
| DSC | Paragraphs and discourse | 5 | Samiee |
|
|
167
|
+
|
|
168
|
+
Each rule has a severity (`error`, `convention`, `advisory`) and an evidence class. `sourced` rules name the book and page they come from; `editorial_synthesis` rules are editorial practice and are offered as suggestions only.
|
|
169
|
+
|
|
170
|
+
## Edit the rules
|
|
171
|
+
|
|
172
|
+
1. Edit the JSON in `corpus/rules/`.
|
|
173
|
+
2. Run `python tools/build.py`. It validates the corpus and regenerates the bundle, the skill references and the rule book.
|
|
174
|
+
3. Run `pytest`.
|
|
175
|
+
|
|
176
|
+
Do not edit generated files: `src/negaresh/data/corpus.json`, `skills/negaresh/references/rules-*.md`, `docs/RULEBOOK__NEEDS-INPUT.md`.
|
|
177
|
+
|
|
178
|
+
To make the release files (wheel, skill zip, clean folder): `python tools/package.py`.
|
|
179
|
+
|
|
180
|
+
<!-- mcp-name: io.github.Aricept094/negaresh -->
|
|
181
|
+
|
|
182
|
+
## Limits
|
|
183
|
+
|
|
184
|
+
- The rules are drafts. No human editor has approved them.
|
|
185
|
+
- The mechanical checker sees characters, listed expressions and a few sentence shapes. No finding does not mean that the prose is natural. Sentence and paragraph rebuilding is done by the model with the rules.
|
|
186
|
+
- The «می» half-space check uses a closed list of verb stems.
|
|
187
|
+
|
|
188
|
+
## Licence
|
|
189
|
+
|
|
190
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "negaresh"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Persian (Farsi) writing guide: sourced rule set, mechanical checks and a local MCP server"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE", "NOTICE.md"]
|
|
12
|
+
requires-python = ">=3.11"
|
|
13
|
+
dependencies = ["mcp==2.3.0", "pydantic>=2.12,<3"]
|
|
14
|
+
|
|
15
|
+
keywords = ["persian", "farsi", "writing", "editing", "mcp", "mcp-server", "agent-skills"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Natural Language :: Persian",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Topic :: Text Processing :: Linguistic",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/Aricept094/negaresh"
|
|
26
|
+
Repository = "https://github.com/Aricept094/negaresh"
|
|
27
|
+
Changelog = "https://github.com/Aricept094/negaresh/blob/main/CHANGELOG.md"
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = ["pytest>=8"]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
negaresh = "negaresh.cli:main"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.package-data]
|
|
39
|
+
negaresh = ["data/*.json"]
|
|
40
|
+
|
|
41
|
+
[tool.pytest.ini_options]
|
|
42
|
+
testpaths = ["tests"]
|
negaresh-0.2.0/setup.cfg
ADDED