stilura 0.0.0-stage → 0.6.1

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 (45) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/LICENSE +21 -0
  3. package/README.md +100 -2
  4. package/SPEC.md +532 -0
  5. package/chat-edits.js +107 -0
  6. package/desktop.js +87 -0
  7. package/document-store.js +73 -0
  8. package/editing.js +140 -0
  9. package/index.js +776 -0
  10. package/markdown.js +66 -0
  11. package/mcp-server.mjs +322 -0
  12. package/package.json +80 -4
  13. package/pi.js +325 -0
  14. package/public/app.js +24109 -0
  15. package/public/dictionary/LICENSE +347 -0
  16. package/public/dictionary/en.aff +205 -0
  17. package/public/dictionary/en.dic +49569 -0
  18. package/public/fonts/iAWriterDuoS-Bold.woff2 +0 -0
  19. package/public/fonts/iAWriterDuoS-BoldItalic.woff2 +0 -0
  20. package/public/fonts/iAWriterDuoS-Italic.woff2 +0 -0
  21. package/public/fonts/iAWriterDuoS-Regular.woff2 +0 -0
  22. package/public/icons/LICENSE +26 -0
  23. package/public/icons/arrow-up.svg +17 -0
  24. package/public/icons/arrows-clockwise.svg +16 -0
  25. package/public/icons/clock-counter-clockwise.svg +16 -0
  26. package/public/icons/download-simple.svg +17 -0
  27. package/public/icons/file-plus.svg +18 -0
  28. package/public/icons/file-text.svg +19 -0
  29. package/public/icons/gear.svg +16 -0
  30. package/public/icons/magnifying-glass.svg +16 -0
  31. package/public/icons/sidebar.svg +16 -0
  32. package/public/icons/upload-simple.svg +17 -0
  33. package/public/icons/x.svg +16 -0
  34. package/public/index.html +363 -0
  35. package/public/logo-mark-white.png +0 -0
  36. package/public/logo-mark.png +0 -0
  37. package/public/logo-tile.png +0 -0
  38. package/public/style.css +2861 -0
  39. package/review-model.js +45 -0
  40. package/review-prompt.js +93 -0
  41. package/review.js +337 -0
  42. package/skills/stilura/SKILL.md +128 -0
  43. package/style.md +150 -0
  44. package/suggestions.js +79 -0
  45. package/tasks.js +94 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,97 @@
1
+ # Changelog
2
+
3
+ Stilura (renamed from Litura) follows [semantic versioning](https://semver.org). Until 1.0 the minor number carries breaking changes.
4
+
5
+ ## Unreleased
6
+
7
+ - Fixed cross-document Undo and saves from concurrent tabs. File writes now keep revision checks and history; workspace APIs reject symbolic links.
8
+ - Desktop state survives server port changes. Closing, changing folders, and installing updates wait for confirmed saves. Partial brief answers survive reloads, and Save as falls back to a download where the system file-picker API is unavailable.
9
+
10
+ - Renamed Litura → Stilura (*stilus*, the pen, + *litura*, the correction): npm package `stilura`, commands `stilura` / `stilura-mcp`, desktop app, skill (`skills/stilura`), and all user-facing strings. `STILURA_*` environment variables replace `LITURA_*` (old spellings still honored). The GitHub repo, release URLs, and the Tauri bundle identifier move with the name — reinstall the desktop app from the new releases page; its saved folder choice does not carry over. Browser drafts, `style.md`, and disk history (`.litura-history`, `litura:` storage keys, `<litura-edits>` tags) are untouched and keep working.
11
+
12
+ ## 0.6.0 — 2026-10-09
13
+
14
+ - Litura now works alongside coding agents. `litura-mcp` (also `mcp-server.mjs`) is a stdio MCP server with seven tools — `draft_read`, `draft_write`, `review`, `rewrite`, `suggest`, `chat`, `idea` — that reuse the editor's own prompts; only `draft_write` changes anything, under the same revision guard as `PUT /draft`. A ready-made skill ships in `skills/litura/SKILL.md` with the voice rules, finding codes and the localhost API, for Codex CLI and Claude Code.
15
+ - Continuations use their own suggestion model, chosen in Settings. It defaults to the cheapest authenticated model that writes well, with reasoning off; review, rewrites, chat and `/idea` keep the default model.
16
+ - Settings offers ChatGPT Plus/Pro sign-in as an alternative to an API key, with a note that subscriptions count messages and automatic checks send many small requests.
17
+ - The bubble's `Add to context` is now `Discuss`, matching the button on finding cards. After `Discuss` the paragraph `+` is available again: the passage stays selected, and that no longer hides it.
18
+ - Markdown in the draft stays plain text: markers remain, dimmed, and what they mark is styled in place. Headings set bold, `**bold**`, `*italic*`, `_italic_` and `***both***` follow suit, `` `code` `` gets a quiet background, `[links](url)` an accent underline, `>` lines are muted, list markers dimmed and `---` carries a thin rule. Fenced blocks and inline code are left unparsed.
19
+ - The draft sets larger (17px) on a 68-character measure. Margin notes are written in the draft's own italic, sit on the passage's baseline and open as a single line with no background. The conversation island now morphs its outline between the pill, the composer and a notice, notices are pill-sized and wait eight seconds (longer under the pointer), and `Suggesting…` shows in the folded pill instead of vanishing with the composer.
20
+ - The paragraph `+` stands on the line under the pointer instead of a long paragraph's first line, stays up while a bubble is open, and on a paragraph that already has a note opens that note. The selection and Continue bubbles wait a beat (250 and 450 ms) and never appear if you type or click again first; every bubble fades in and out.
21
+ - A margin note now stands on the line it was made at — its passage, or the line its `+` was pressed beside — instead of at the top of a long paragraph, and the `+` is no longer offered beside a line a note already covers. Retrying a failed draft load no longer duplicates the restored notes.
22
+ - Notes in the margin no longer overlap: the rail cards were positioned relative to their normal place instead of the rail, and now also restack when a note grows. The conversation island sits 16px higher.
23
+ - Experiment, Settings → While you write → Actions in the margin: `Note` and `Discuss` stand in the notes rail beside the selected line, and `Continue` sits right after the caret with its `⌘↵` hint, instead of floating over the text. Falls back to the floating bubble where there is no rail.
24
+ - With a conversation open, the turns and the field now stand inside one opaque panel (near-black in dark mode) instead of floating over the draft, and the fade behind the island is gone. Notes in the margin no longer get cut at the header: the rail reaches the window top like the draft's lines do.
25
+ - The text column now narrows (down to 52 characters) before margin notes give up their rail, so notes stay beside their lines on a 1100px pane instead of dropping into the chat.
26
+ - The delete `×` on a margin note stands right after its last word instead of a box corner, and the paragraph `+` shows on a freshly loaded page without waiting for a resize.
27
+ - A notice now takes over the whole island: the turns, finding cards and `×` above it are put away while it stands and come back when it goes, instead of hanging over an alert.
28
+ - The draft no longer slides left when it grows past the window and a scrollbar appears (for instance when a note is added): the gutter is reserved on both edges.
29
+ - Margin notes, slice 1: select a passage and press `Note` in the bubble to pin your own remark beside the line — plain text on the margin, no card chrome, blur commits and `Escape` drops, no Save/Cancel. Hover the empty margin beside a paragraph for its `+` (a paragraph note, never drifts); select all and press `Note` for the whole draft (pinned at the rail top, no mark). Notes stand in the margin rail on wide windows and stack in the chat stream on narrow ones. Create, edit, delete with Undo; notes persist per file. Notes go to the model with chat and rewrite requests as labeled scope context. No threads yet.
30
+
31
+ ## 0.5.0 — 2026-09-27
32
+
33
+ - A file sidebar lists the `.md` and `.txt` files beside the draft, with a filter. Clicking one opens it; the previous text goes to History first. New, Open, Save as and History moved there from the header. The sidebar starts hidden.
34
+ - `Save as new` uses the system save dialog.
35
+ - Icons are now Tabler outline at a thinner stroke, resting dim and full on hover.
36
+ - Provider errors such as an exceeded quota are shown as their message instead of raw JSON.
37
+ - The chosen model survives restarts, even while it is missing from the current catalog.
38
+ - The desktop app opens at once: it no longer fetches the model catalog on startup.
39
+
40
+ ## 0.4.2 — 2026-09-13
41
+
42
+ - Clicking at the end of a paragraph now offers a Continue bubble, asking for the same continuation Cmd/Ctrl+Enter would. An explicit ask is allowed to open the next sentence and run longer than a background suggestion, instead of stopping at a finished thought.
43
+ - Fixed the field popovers flashing at their previous position before snapping to the trigger.
44
+ - Removed the unused standalone Rewrite button from the chat chip.
45
+
46
+ ## 0.4.0 — 2026-09-13
47
+
48
+ - Added spell checking. Misspelled words are marked in the editor using a vendored en_US Hunspell dictionary, checked client-side alongside the existing style-tell markers.
49
+
50
+ ## 0.3.7 — 2026-09-13
51
+
52
+ - Litura is now also a desktop app. A Tauri shell picks the writing folder, starts the same server on a free port, and shows it in its own window; it carries its own Node runtime, so nothing has to be installed first.
53
+ - The review panel is one list again. Wording marks and review findings sat in separate sections repeating the same reason on every row; now they share a single list in document order, each row naming the passage and where the remark came from, with the reason on the card a click away. The header button says how many remarks are waiting instead of a bare number.
54
+ - The desktop app updates itself: it asks GitHub on launch and from `Check for Updates…`, installs only what you accept and what its signing key verifies, and restarts. In that build the npm update switch is gone, since it would name a second, wrong way to update.
55
+
56
+ ## 0.3.6 — 2026-09-07
57
+
58
+ - Published the latest editor interface and behavior updates together with the product audit and local draft history.
59
+
60
+ ## 0.3.5 — 2026-09-07
61
+
62
+ - Refreshed the README preview with natural generic-writing highlights and meaningful rewrite options in a full-screen review flow.
63
+
64
+ ## 0.3.4 — 2026-09-07
65
+
66
+ - Refreshed the README preview with a full-screen Litura review flow and three rewrite options.
67
+
68
+ ## 0.3.3 — 2026-09-07
69
+
70
+ - Refreshed the README preview with a full-screen editor screenshot showing review marks and inline continuation.
71
+
72
+ ## 0.3.2 — 2026-09-07
73
+
74
+ - Moved the Slop Score next to the settings control in the editor header.
75
+
76
+ ## 0.3.1 — 2026-09-07
77
+
78
+ - The update badge now copies `npx litura-app` instead of opening a changelog, so the next update command is ready to paste.
79
+
80
+ ## 0.3.0 — 2026-09-07
81
+
82
+ - Review remarks stay beside the passage they describe without shifting the draft when opened or clicked.
83
+ - Added document actions and local history, replace-in-place previews, light/dark appearance settings, and automatic settings saves.
84
+ - Refined the editor header, chat composer, settings controls, and release safety checks.
85
+
86
+ ## 0.2.0 — 2026-09-06
87
+
88
+ - Settings can ask npm about new versions once a day, off by default. When a newer version is published the header shows a badge linking to this file; the badge links rather than installs, so updating stays a command you run. Left off, Litura opens no connection of its own.
89
+ - Releases are cut by tag, with GitHub Actions running the checks and publishing over OIDC.
90
+
91
+ ## 0.1.0 — 2026-09-06
92
+
93
+ First npm release, published as `litura-app`; the command it installs is `litura`.
94
+
95
+ - Run from any folder with `npx litura-app`. The draft and the style guide are read from the folder Litura starts in, not from its install directory.
96
+ - The browser opens on start, and a taken port falls through to the next free one.
97
+ - `litura --version` and `litura --check-update` report the running and published versions. Litura opens no connection of its own.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vadim
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.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ <img src="public/logo-tile.png" alt="Stilura mark" width="72">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Stilura
4
+
5
+ Local AI writing enhancer that writes with you. It highlights generic, AI-sounding phrases in your draft, names the pattern, and offers rewrites. Nothing changes until you pick one.
6
+
7
+ ```bash
8
+ npx stilura
9
+ ```
10
+
11
+ ![Stilura highlighting sales language, a "not X but Y" construction and a forced triple, with a finding card open](docs/screenshot.png)
12
+ ## How it works
13
+
14
+ Stilura checks your draft against 20 named patterns in `style.md`: sales language, vague attribution, forced triples, filler openers, stacked qualifiers, and more. A second pass catches structural issues like buried points and broken paragraph promises.
15
+
16
+ - **Options** — three rewrites for any finding. Hover to preview, click to apply.
17
+ - **Discuss** — chat about a passage or the whole draft.
18
+ - **Brief** (`/brief`) — tell it who reads this and what it should do. Rewrites aim at that reader; review stays unbiased.
19
+ - **Continuations** — short next-line suggestions appear when you pause. `Tab` to accept, `Escape` to dismiss.
20
+
21
+ Click the count in the header to see all findings. `F8` / `Shift+F8` to step between them. `Keep as is` dismisses one for good.
22
+
23
+ ## Run
24
+
25
+ ```bash
26
+ npx stilura
27
+ ```
28
+
29
+ Needs Node 20+. Opens [http://127.0.0.1:3000](http://127.0.0.1:3000). Choose a provider and model under the gear button.
30
+
31
+ **Desktop:** download from [Releases](https://github.com/vadimchirkov/stilura/releases) (`.dmg` / `.exe` / `.AppImage` / `.deb`). On macOS, unsigned: `System Settings → Privacy & Security → Open Anyway` on first launch.
32
+
33
+ **Shortcuts:** `Cmd/Ctrl+K` — chat. `Cmd/Ctrl+Enter` — continuation. `Cmd/Ctrl+S` — download draft. `/` in composer — commands.
34
+
35
+ ## Configuration
36
+
37
+ Use the gear button to choose a provider, model, and reasoning level. Stilura also finds credentials stored by Pi and provider environment variables. ChatGPT Plus/Pro sign-in works as an alternative to an API key.
38
+
39
+ ```bash
40
+ PI_PROVIDER=anthropic
41
+ PI_MODEL=claude-sonnet-4-6
42
+ PI_THINKING_LEVEL=medium
43
+ PORT=3000
44
+ STYLE_FILE=./style.md
45
+ DRAFT_FILE=./draft.md
46
+ ```
47
+
48
+ Edit `style.md` to describe the voice and constraints to preserve. Changes apply without restarting.
49
+
50
+ ## Data
51
+
52
+ The draft lives in `draft.md` in your folder. Findings, chat, brief, and model choice live in browser local storage. Nothing leaves the machine except model requests to the provider you chose.
53
+
54
+ The desktop app saves state under its application data directory, so changing ports does not reset it. Updates check GitHub on launch; accepting verifies the bundle against a signing key and restarts.
55
+
56
+ ## Agent integration
57
+
58
+ The draft is a plain file, and the server exposes what the UI uses as HTTP endpoints. A skill for Claude Code / Codex ships in `skills/stilura/SKILL.md`:
59
+
60
+ ```bash
61
+ cp -r skills/stilura ~/.claude/skills/
62
+ ```
63
+
64
+ ### MCP server
65
+
66
+ Seven stdio tools — `draft_read`, `draft_write`, `review`, `rewrite`, `suggest`, `chat`, `idea` — in `mcp-server.mjs`. Same prompts as the editor, same revision guard.
67
+
68
+ ```bash
69
+ # Claude Code
70
+ claude mcp add --scope user stilura -- node /path/to/stilura/mcp-server.mjs
71
+ ```
72
+
73
+ ```toml
74
+ # Codex: ~/.codex/config.toml
75
+ [mcp_servers.stilura]
76
+ command = "node"
77
+ args = ["/path/to/stilura/mcp-server.mjs"]
78
+ cwd = "/path/to/writing"
79
+ tool_timeout_sec = 180
80
+ ```
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ git clone https://github.com/vadimchirkov/stilura.git
86
+ cd stilura && npm install && npm start
87
+ ```
88
+
89
+ Node native HTTP server. Vanilla JS frontend with CodeMirror 6, bundled by esbuild (`src/app.js` → `public/app.js`).
90
+
91
+ ```bash
92
+ npm run build # bundle frontend
93
+ npm run check # lint + tests
94
+ npm run desktop # Tauri desktop shell (needs Rust + Tauri prerequisites)
95
+ ```
96
+
97
+ See [SPEC.md](SPEC.md) for API contracts and behavior details.
98
+
99
+ ## License
100
+
101
+ [MIT](LICENSE)