mastermind-md 0.1.0

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 (52) hide show
  1. package/.claude/skills/master/SKILL.md +10 -0
  2. package/.claude/skills/mastermind/SKILL.md +61 -0
  3. package/.claude/skills/mastermind/reference/demo.md +35 -0
  4. package/LICENSE +21 -0
  5. package/README.md +135 -0
  6. package/assets/agent/global.md +12 -0
  7. package/bin/mastermind.js +17 -0
  8. package/dist/cli/index.js +1284 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/server/index.js +1752 -0
  11. package/dist/server/index.js.map +1 -0
  12. package/dist/ui/assets/FindBar-CSKdPrxm.js +1 -0
  13. package/dist/ui/assets/RenameDialog-C6yP_6D8.js +1 -0
  14. package/dist/ui/assets/SettingsPanel-C6-wwvJr.js +1 -0
  15. package/dist/ui/assets/SourceEditor-DN44HaIZ.js +37 -0
  16. package/dist/ui/assets/TranslatedView-G29rKesM.js +1 -0
  17. package/dist/ui/assets/index-Bhf9eUP2.css +1 -0
  18. package/dist/ui/assets/index-cMAuoyhV.js +99 -0
  19. package/dist/ui/assets/jsx-runtime-BrnrUjgG.js +1 -0
  20. package/dist/ui/assets/react-DoK4WR2u.js +1 -0
  21. package/dist/ui/index.html +16 -0
  22. package/package.json +91 -0
  23. package/themes/carbon/theme.json +11 -0
  24. package/themes/carbon/tokens.css +67 -0
  25. package/themes/cobalt/theme.json +11 -0
  26. package/themes/cobalt/tokens.css +67 -0
  27. package/themes/fonts/BricolageGrotesque-Variable.woff2 +0 -0
  28. package/themes/fonts/CrimsonPro-Variable.woff2 +0 -0
  29. package/themes/fonts/Fraunces-Variable.woff2 +0 -0
  30. package/themes/fonts/GeistSans-Variable.woff2 +0 -0
  31. package/themes/fonts/HankenGrotesk-Variable.woff2 +0 -0
  32. package/themes/fonts/Inter-Variable.woff2 +0 -0
  33. package/themes/fonts/JetBrainsMono-Variable.woff2 +0 -0
  34. package/themes/fonts/Lora-Variable.woff2 +0 -0
  35. package/themes/fonts/Manrope-Variable.woff2 +0 -0
  36. package/themes/fonts/Newsreader-Variable.woff2 +0 -0
  37. package/themes/fonts/Outfit-Variable.woff2 +0 -0
  38. package/themes/fonts/SpaceGrotesk-Variable.woff2 +0 -0
  39. package/themes/fonts/SplineSansMono-Variable.woff2 +0 -0
  40. package/themes/fonts/UbuntuSansMono-Variable.woff2 +0 -0
  41. package/themes/grid/fonts/GeistMono-Variable.woff2 +0 -0
  42. package/themes/grid/fonts/SchibstedGrotesk-Variable.woff2 +0 -0
  43. package/themes/grid/theme.json +11 -0
  44. package/themes/grid/tokens.css +67 -0
  45. package/themes/nacht/theme.json +11 -0
  46. package/themes/nacht/tokens.css +67 -0
  47. package/themes/rose/theme.json +11 -0
  48. package/themes/rose/tokens.css +67 -0
  49. package/themes/sepia/theme.json +11 -0
  50. package/themes/sepia/tokens.css +67 -0
  51. package/themes/slate/theme.json +11 -0
  52. package/themes/slate/tokens.css +67 -0
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: master
3
+ description: Alias of /mastermind for opening a file in Mastermind. `/master <file>` is equivalent to `/mastermind <file>` — translate the file into both reading languages, then open it.
4
+ ---
5
+
6
+ # master — alias of /mastermind
7
+
8
+ Treat `/master $ARGUMENTS` exactly as `/mastermind $ARGUMENTS`: run the Mastermind **Visualize
9
+ flow** (translate the file into both reading languages first via `mastermind translate-blocks`,
10
+ then `mastermind open`). See the `mastermind` skill for the full protocol.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: mastermind
3
+ description: Visualize and review a Markdown file in Mastermind — configure preferences (/mastermind setup), run the bilingual demo (/mastermind demo), or open any .md (/mastermind <file>, or bare = the most recent .md from this chat). Always pre-translates the doc into both reading languages first. Use whenever the user wants to open, visualize, or review a doc in Mastermind.
4
+ ---
5
+
6
+ # Mastermind
7
+
8
+ Mastermind shows one `.md` as a reviewable document whose reading-language toggle flips
9
+ between the user's **Preferred** (`langPair.a`) and **Secondary** (`langPair.b`) languages.
10
+ **You are the translator** — there is no API key. The rule for every path below: **translate
11
+ first, then open**, so the toggle is warm the instant the page loads.
12
+
13
+ Dispatch on `$ARGUMENTS`:
14
+
15
+ ## `/mastermind setup`
16
+ Configure the five defaults. Pull the option lists from the CLI, then ask the user with your
17
+ native question UI (one round, multiple-choice where possible):
18
+
19
+ ```sh
20
+ mastermind browsers --json # installed browsers → "Preferred browser"
21
+ mastermind themes --json # color themes → "Color theme"
22
+ mastermind typefaces --json # type sets → "Font theme"
23
+ ```
24
+
25
+ Ask for: **Preferred language**, **Secondary language**, **Preferred browser**, **Color
26
+ theme**, **Font theme**. Apply in one call (a = Preferred, b = Secondary):
27
+
28
+ ```sh
29
+ mastermind config set langPair.a="<Preferred>" langPair.b="<Secondary>" \
30
+ browser="<app or empty>" theme="<themeId>" typeSet="<typeSetId>"
31
+ ```
32
+
33
+ Numeric/unknown keys are rejected with exit 2 — surface the message if a set fails. Confirm
34
+ what you set.
35
+
36
+ ## `/mastermind demo`
37
+ Localize the showcase template in `reference/demo.md` **into the Preferred language** (keep
38
+ every CriticMarkup mark intact), write it to `./mastermind-demo.md`, then run the **Visualize
39
+ flow** on it. The toggle reveals the Secondary-language version.
40
+
41
+ ## `/mastermind <file>` (bare `/mastermind` → most recent `.md` you wrote this chat)
42
+ Run the **Visualize flow** on the given file. With no argument, use the most recent `.md` you
43
+ created or edited in this conversation; if there is none, ask which file.
44
+
45
+ ## Visualize flow — ALWAYS TRANSLATE FIRST
46
+ 1. `mastermind translate-blocks <file>` → prints `{ "targetLang", "cachePath", "blocks":[{"hash","text"}] }`.
47
+ - If `blocks` is empty, the cache is already warm — skip to step 4.
48
+ - If it errors that `langPair` is unset, tell the user to run `/mastermind setup` first.
49
+ 2. Translate each block's `text` into `targetLang`. **Preserve all Markdown + CriticMarkup
50
+ syntax exactly** (`{++ ++}`, `{-- --}`, `{~~ ~> ~~}`, `{== ==}`, `{>> <<}`); translate only
51
+ human-readable text; leave `@name:` author tags untranslated.
52
+ 3. Write them to the cache via stdin:
53
+ ```sh
54
+ printf '%s' '[{"hash":"…","text":"<translated>"},…]' | mastermind translate-blocks <file> --save
55
+ ```
56
+ It reports how many cached (and skips stale-hash / CriticMarkup-mismatch entries).
57
+ 4. Open it: `mastermind open <file>` (uses the configured browser; toggle is warm).
58
+ - **Plan you want reviewed?** Use `mastermind open --wait <file>` instead, then follow the
59
+ plan-review protocol: when it returns, re-read the file, apply/argue each CriticMarkup
60
+ mark and comment, remove the resolved marks + the `mastermind:summary` block, and re-open
61
+ for the next round until approved.
@@ -0,0 +1,35 @@
1
+ # Welcome to Mastermind
2
+
3
+ This is a demo document. Mastermind renders Markdown **and** CriticMarkup review marks,
4
+ and the language toggle (top bar) flips it between your two reading languages.
5
+
6
+ ## What you're looking at
7
+
8
+ The file on disk is the single source of truth — no database, no cloud. An agent writes
9
+ a plan here; you review it {++with inline edits++} and comments; it reads the same file back.
10
+
11
+ > Marks flow one direction only: the agent proposes, you accept. Nothing reaches disk
12
+ > until you approve it.
13
+
14
+ ## The five review marks
15
+
16
+ - Insertion — adds {++a few words++} to the text.
17
+ - Deletion — removes {--an outdated phrase--}.
18
+ - Substitution — swaps {~~old wording~>clearer wording~~}.
19
+ - Highlight — calls out {==a passage worth a second look==}.
20
+ - Comment — leaves a margin note. {>> Try clicking the language toggle above. <<}
21
+
22
+ ## A small table and some code
23
+
24
+ | Surface | Purpose |
25
+ | ------- | ------------ |
26
+ | Reading | review marks |
27
+ | Source | raw markdown |
28
+
29
+ ```ts
30
+ function greet(name: string): string {
31
+ return `Hello, ${name}`
32
+ }
33
+ ```
34
+
35
+ Toggle the language to see this same document in your secondary language.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kevin Ding
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 ADDED
@@ -0,0 +1,135 @@
1
+ ```
2
+ █▀▄▀█ ▄▀█ █▀ ▀█▀ █▀▀ █▀█ █▀▄▀█ █ █▄░█ █▀▄
3
+ █░▀░█ █▀█ ▄█ ░█░ ██▄ █▀▄ █░▀░█ █ █░▀█ █▄▀
4
+ ```
5
+
6
+ **Review markdown with your coding agent — local-first, the file is the only channel.**
7
+
8
+ An agent writes a plan or doc as `.md`; you read and mark it up in the browser with
9
+ [CriticMarkup](https://github.com/CriticMarkup/CriticMarkup-toolkit); you hand it back; the agent
10
+ re-reads the same file. No database, no accounts, no cloud — just localhost and the file on disk.
11
+ Mastermind also renders any doc **bilingually**: your agent translates it into your two reading
12
+ languages, toggled live.
13
+
14
+ ![Mastermind Reading view](https://raw.githubusercontent.com/Jingquank/Mastermind/main/assets/screenshots/reading.png)
15
+
16
+ *The Reading view — rendered Markdown with the heading outline on the left.*
17
+
18
+ ## Requirements
19
+
20
+ - Node 20+ and a desktop browser (macOS is the tested platform).
21
+ - A coding agent (Claude Code, Cursor, Gemini, …) — it drives the review loop and does translation.
22
+
23
+ ## Install
24
+
25
+ ```sh
26
+ npm i -g mastermind-md # installs the `mastermind` command
27
+ mastermind install-agents # add the /mastermind + /master skills to your agent(s)
28
+ ```
29
+
30
+ <details>
31
+ <summary>Install from source</summary>
32
+
33
+ ```sh
34
+ git clone https://github.com/Jingquank/Mastermind.git
35
+ cd Mastermind
36
+ npm install
37
+ npm run build
38
+ npm link # puts `mastermind` on your PATH
39
+ mastermind install-agents
40
+ ```
41
+ </details>
42
+
43
+ `install-agents` writes the skills for every coding agent it finds (`~/.claude`, `~/.cursor`,
44
+ `~/.gemini`) and, where it can, a one-line rule so finished plans open in Mastermind automatically.
45
+ Undo any time with `mastermind uninstall-agents`.
46
+
47
+ ## How it works
48
+
49
+ - **The file is the protocol.** Open a `.md` and Mastermind serves it at `127.0.0.1:5173`. Your
50
+ edits, comments, and accept/reject decisions round-trip through that one file as CriticMarkup —
51
+ nothing else, nowhere else.
52
+ - **The review loop.** An agent writes a plan → you review and mark it up → **Save & hand back** →
53
+ the agent re-reads the file and revises. Repeat until you approve. Suggestions flow one direction
54
+ only (the agent proposes, you accept); nothing reaches disk until you do.
55
+ - **Bilingual, no API key.** Your coding agent *is* the translator. Mastermind shows the doc in your
56
+ Preferred and Secondary languages (default English ⇄ 简体中文), toggled live, cached on disk
57
+ (`.mastermind/translations/`) so the toggle is instant and keeps working offline once warmed.
58
+
59
+ ![The same document toggled to Simplified Chinese](https://raw.githubusercontent.com/Jingquank/Mastermind/main/assets/screenshots/bilingual.png)
60
+
61
+ *One click flips the whole doc to your second language; code and inline literals stay put.*
62
+
63
+ ## The `/mastermind` skills
64
+
65
+ After `install-agents`, type these in your agent:
66
+
67
+ | Command | What it does |
68
+ | --- | --- |
69
+ | `/mastermind setup` | Pick your two reading languages, preferred browser, and color / font theme. |
70
+ | `/mastermind demo` | Open a bilingual demo doc — see the marks and the language toggle in action. |
71
+ | `/mastermind <file>` | Translate any `.md` into both languages and open it. Bare `/mastermind` uses the most recent `.md` from the chat. |
72
+ | `/master <file>` | Shorthand for `/mastermind <file>`. |
73
+
74
+ Every open **translates first**, so the language toggle is warm the instant the page loads. With the
75
+ global rule installed, finished plans (in plan mode) open in Mastermind automatically, in both
76
+ languages.
77
+
78
+ ## Reviewing
79
+
80
+ Three views over the same file (`Cmd+E` cycles, `Cmd+S` saves):
81
+
82
+ - **Reading** — rendered markdown with CriticMarkup as a visual diff: green insertions, struck
83
+ deletions, paired substitutions, gold highlights, and comment threads in a margin rail. Select
84
+ text → Comment / Suggest deletion / Highlight. Hover a suggestion → Accept / Reject (`Cmd+Z`
85
+ undoes review actions). Task-list checkboxes are live.
86
+ - **Editing** — WYSIWYG; opening a file and saving it unchanged produces a byte-identical file.
87
+ - **Source** — raw markdown with CriticMarkup highlighting.
88
+
89
+ All five marks work inline anywhere: `{++ins++}`, `{--del--}`, `{~~old~>new~~}`, `{==highlight==}`,
90
+ `{>>comment<<}`. A highlight directly followed by a comment anchors it to that span; consecutive
91
+ comments form a thread; comments carry `@author:` tags.
92
+
93
+ ![CriticMarkup review marks](https://raw.githubusercontent.com/Jingquank/Mastermind/main/assets/screenshots/review-marks.png)
94
+
95
+ *An insertion, a substitution, a struck deletion, a highlight, and a margin comment — all CriticMarkup.*
96
+
97
+ The **language toggle** (top bar) flips the whole document between your two languages, block by
98
+ block. `Cmd+F` is a mark-aware find (filter by comments / edits / highlights); `Cmd+P` prints
99
+ ink-on-white with comments as numbered footnotes. Reviews are **multi-round**: when the agent
100
+ rewrites the open file, a banner offers a reload so you pick up the new version in place.
101
+
102
+ ## Settings & themes
103
+
104
+ Open Settings (the gear, bottom-right) to choose your **color theme** (seven ship — **Grid**, the
105
+ Swiss-red default, plus Mint, Sepia, Carbon, Slate, Cobalt, Rose), **typeface** and **code font**, an
106
+ optional **code-color scheme**, your **reading languages** (Preferred + Secondary), and the
107
+ **browser** Mastermind opens in. Everything persists to `~/.config/mastermind/config.json` and is
108
+ scriptable:
109
+
110
+ ```sh
111
+ mastermind config set langPair.a=English langPair.b=Japanese theme=sepia browser="Google Chrome"
112
+ ```
113
+
114
+ Themes are just data — drop a `themes/<id>/{theme.json,tokens.css}` folder in and it shows up in Settings.
115
+
116
+ ![Settings panel](https://raw.githubusercontent.com/Jingquank/Mastermind/main/assets/screenshots/settings.png)
117
+
118
+ *Themes, typeface, code font, code-color scheme, and your two reading languages — all in Settings.*
119
+
120
+ ## Commands
121
+
122
+ ```sh
123
+ mastermind open <file> # open a file for review
124
+ mastermind open --wait <file> # block until "Save & hand back" (the agent loop)
125
+ mastermind new # start a blank draft
126
+ mastermind workspace . # browse a directory as a file tree (alias: ws)
127
+ mastermind config get | set … # read / write preferences
128
+ mastermind translate-blocks <file> # pre-translate a doc into both languages (the skills use this)
129
+ mastermind install-agents # install the skills + global rule (undo: uninstall-agents)
130
+ mastermind status | stop # daemon status / shutdown
131
+ ```
132
+
133
+ ---
134
+
135
+ More: **[AGENT_SETUP.md](AGENT_SETUP.md)** — the agent protocol, assist channel, and exit-code contract.
@@ -0,0 +1,12 @@
1
+ ## Mastermind: always visualize bilingually
2
+
3
+ Whenever you open, visualize, or review any Markdown file or plan in Mastermind, you MUST
4
+ **translate it into both reading languages first, then open it** — so the reading-language
5
+ toggle is warm. Use the `mastermind` skill's Visualize flow: `mastermind translate-blocks
6
+ <file>` → translate the emitted blocks (preserving Markdown + CriticMarkup) → pipe them to
7
+ `mastermind translate-blocks <file> --save` → `mastermind open <file>`.
8
+
9
+ After you finish making a plan, write it to a `.md` file and run that same flow — preparing
10
+ both the chat-language version and the secondary-language translation — using `mastermind open
11
+ --wait <file>` when you want the user to review and hand it back. Set the language pair once
12
+ with `/mastermind setup`.
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs'
3
+ import { fileURLToPath } from 'node:url'
4
+ import path from 'node:path'
5
+
6
+ const here = path.dirname(fileURLToPath(import.meta.url))
7
+ const entry = path.join(here, '..', 'dist', 'cli', 'index.js')
8
+
9
+ if (!existsSync(entry)) {
10
+ console.error(
11
+ 'mastermind: build output missing.\n' +
12
+ 'Run `npm install && npm run build` in the mastermind repo, then try again.',
13
+ )
14
+ process.exit(1)
15
+ }
16
+
17
+ await import(entry)