markymark 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 (42) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/CHANGELOG.md +29 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +255 -0
  6. data/Rakefile +8 -0
  7. data/assets/.gitkeep +0 -0
  8. data/assets/Markymark.icns +0 -0
  9. data/assets/Markymark.iconset/icon_128x128.png +0 -0
  10. data/assets/Markymark.iconset/icon_128x128@2x.png +0 -0
  11. data/assets/Markymark.iconset/icon_16x16.png +0 -0
  12. data/assets/Markymark.iconset/icon_16x16@2x.png +0 -0
  13. data/assets/Markymark.iconset/icon_256x256.png +0 -0
  14. data/assets/Markymark.iconset/icon_256x256@2x.png +0 -0
  15. data/assets/Markymark.iconset/icon_32x32.png +0 -0
  16. data/assets/Markymark.iconset/icon_32x32@2x.png +0 -0
  17. data/assets/Markymark.iconset/icon_512x512.png +0 -0
  18. data/assets/Markymark.iconset/icon_512x512@2x.png +0 -0
  19. data/assets/README.md +3 -0
  20. data/assets/marky-mark-dj.jpg +0 -0
  21. data/assets/marky-mark-icon.png +0 -0
  22. data/assets/marky-mark-icon2.png +0 -0
  23. data/config.ru +19 -0
  24. data/docs/for_llms.md +141 -0
  25. data/docs/plans/2025-12-18-macos-app-installer-design.md +149 -0
  26. data/exe/markymark +5 -0
  27. data/lib/markymark/app_installer.rb +437 -0
  28. data/lib/markymark/cli.rb +497 -0
  29. data/lib/markymark/init_wizard.rb +186 -0
  30. data/lib/markymark/pumadev_manager.rb +194 -0
  31. data/lib/markymark/server_simple.rb +452 -0
  32. data/lib/markymark/version.rb +5 -0
  33. data/lib/markymark.rb +12 -0
  34. data/lib/public/css/style.css +350 -0
  35. data/lib/public/js/app.js +186 -0
  36. data/lib/public/js/theme.js +79 -0
  37. data/lib/public/js/tree.js +124 -0
  38. data/lib/views/browse.erb +225 -0
  39. data/lib/views/index.erb +37 -0
  40. data/lib/views/simple.erb +806 -0
  41. data/sig/markymark.rbs +4 -0
  42. metadata +242 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f86eabf718d44dbbe9900aba654a581b36ad66d9271e42aef392cfcc8027db3a
4
+ data.tar.gz: a91f7cea3b15d2e2875fa6a39ffb7f3a3753284a543688193c1f3865692a305f
5
+ SHA512:
6
+ metadata.gz: ef7ef07208828a85d061410cbfb45ef874fdcf6026876073bbf6508848f7d87aa98117b7e44fe93f3f066f9247ead30b5680f24e5731dee22cf32eed372fa3fc
7
+ data.tar.gz: 141fa5b4dd0f86725504a51ec9075dbcaee5bbcf0a8b13728ad26c1fb5bf15e990eb5b2e95969f0304b7f8f6c2601fdf98343a8309fad6dd8f38555073cdc5e8
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.1.0] - 2025-12-19
6
+
7
+ ### Added
8
+ - Initial release
9
+ - GitHub-Flavored Markdown rendering with Kramdown
10
+ - Mermaid diagram support
11
+ - Syntax highlighting with Rouge
12
+ - Dark/Light theme toggle with localStorage persistence
13
+ - Accordion file organization grouped by directory
14
+ - Directory browser with bookmarks
15
+ - Smart directory switching without server restart
16
+ - `markymark <filename>` to open specific files directly
17
+ - **macOS Native Integration**:
18
+ - `markymark init` setup wizard
19
+ - Markymark.app installation to ~/Applications
20
+ - Double-click `.md` files in Finder
21
+ - Cmd-click paths in iTerm
22
+ - `open` command support
23
+ - Default file handler registration via duti
24
+ - Pumadev integration for `.test` domain support
25
+ - Standalone server mode on port 4545
26
+
27
+ ### Requirements
28
+ - Ruby >= 2.7
29
+ - macOS native integration requires Xcode Command Line Tools
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Forrest Chang
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,255 @@
1
+ # markymark <img src="assets/marky-mark-icon2.png" alt="Markymark icon" width="40" style="vertical-align: middle"/>
2
+
3
+ <p align="center">
4
+ <img src="assets/marky-mark-dj.jpg" alt="Marky Mark spinning docs" width="500"/>
5
+ </p>
6
+
7
+ > *Say hi to your docs* 👋
8
+ > **Your personal documentation DJ - one server, always spinning**
9
+
10
+ ## Finally, a Dedicated Markdown Viewer That Works Everywhere
11
+
12
+ **Double-click a `.md` file in Finder? Opens in markymark.**
13
+ **Cmd-click a path in iTerm? Opens in markymark.**
14
+ **Run `open README.md` in terminal? Opens in markymark.**
15
+
16
+ No more markdown files opening in Xcode, VS Code, or raw text editors. markymark gives you a beautiful, dedicated markdown viewer with navigation that integrates seamlessly with macOS - just like Preview for PDFs or QuickTime for videos.
17
+
18
+ **markymark** is a lightweight local markdown documentation browser that stays running in the background. Call it once from any directory, and it's always ready. Switch directories on the fly without starting new servers. Perfect for Claude Code workflows where you're constantly documenting and exploring context engineering prompts.
19
+
20
+ ## Quick Start (2 Steps)
21
+
22
+ ```bash
23
+ # Step 1: Install the gem
24
+ gem install markymark
25
+
26
+ # Step 2: Run the setup wizard
27
+ markymark init
28
+ ```
29
+
30
+ That's it! The wizard will:
31
+ - Install **Markymark.app** to ~/Applications
32
+ - Set markymark as the **default app for .md files**
33
+ - Configure your preferred server mode
34
+
35
+ Now double-click any `.md` file or cmd-click paths in iTerm - they'll open beautifully rendered in markymark.
36
+
37
+ ### Scripted Install
38
+
39
+ For automated setups, accept all defaults:
40
+
41
+ ```bash
42
+ gem install markymark && markymark init -y
43
+ ```
44
+
45
+ ## Features
46
+
47
+ - 🍎 **Native macOS integration** - Double-click `.md` files, cmd-click in iTerm, `open` command support
48
+ - 🔄 **Smart directory switching** - Run `markymark` from any directory to switch existing server
49
+ - 📁 **Auto-discovery** - Recursively finds all your markdown files
50
+ - 📂 **Accordion file organization** - Files grouped by directory with expand/collapse controls
51
+ - 🔖 **Bookmarks** - Save frequently-used directories for quick access
52
+ - 🌐 **Directory browser** - Navigate to any folder via the UI with quick shortcuts
53
+ - 🎨 **GitHub-Flavored Markdown** - Tables, task lists, syntax highlighting
54
+ - 📊 **Mermaid diagrams** - Flowcharts, sequence diagrams render beautifully
55
+ - 🌙 **Dark/Light theme toggle** - One-click switching, persisted in localStorage
56
+ - 🔗 **Bookmarkable URLs** - Share links to specific docs
57
+ - 🖼️ **Image support** - Images in `assets/` folders render properly
58
+ - 🌐 **Pumadev integration** - Optional `.test` domain support
59
+
60
+ ## Usage
61
+
62
+ ### Opening Files Directly
63
+
64
+ ```bash
65
+ # Open a specific markdown file (the killer feature!)
66
+ markymark README.md
67
+ markymark ~/docs/ARCHITECTURE.md
68
+
69
+ # Browse current directory
70
+ markymark
71
+
72
+ # Browse specific directory
73
+ markymark ~/my-docs
74
+ ```
75
+
76
+ When you open a file directly, markymark:
77
+ 1. Sets the root to the file's directory
78
+ 2. Opens the browser with that file displayed
79
+ 3. Shows all other markdown files in the sidebar
80
+
81
+ ### Server Management
82
+
83
+ ```bash
84
+ # Check server status
85
+ markymark --status
86
+
87
+ # Stop running server
88
+ markymark --stop
89
+
90
+ # Custom port
91
+ markymark --port 8080
92
+
93
+ # Don't open browser automatically
94
+ markymark --no-browser
95
+ ```
96
+
97
+ ### Setup Commands
98
+
99
+ ```bash
100
+ # Interactive setup wizard
101
+ markymark init
102
+
103
+ # Individual setup commands
104
+ markymark --install-app # Install Markymark.app
105
+ markymark --uninstall-app # Remove Markymark.app
106
+ markymark --set-default # Set as default .md handler
107
+ ```
108
+
109
+ ## One Server, All Your Docs
110
+
111
+ **markymark runs as a single background process.** Once started, it stays running and responds to all your commands:
112
+
113
+ ```bash
114
+ # Start once from anywhere
115
+ cd ~/docs/project-a
116
+ markymark
117
+
118
+ # Switch to different docs instantly - same server!
119
+ cd ~/work/api-docs
120
+ markymark # Server switches to api-docs, no restart
121
+
122
+ # Open a specific file from anywhere
123
+ markymark ~/notes/TODO.md # Switches to ~/notes, opens TODO.md
124
+ ```
125
+
126
+ **One server. Any directory. Always ready.**
127
+
128
+ ## Browse & Bookmarks
129
+
130
+ markymark includes a built-in directory browser accessible via the sidebar:
131
+
132
+ - **Quick shortcuts**: Jump to Home, Downloads, Desktop, or Work directories
133
+ - **Bookmarks**: Save frequently-accessed directories for one-click access
134
+ - **Full navigation**: Browse to any directory on your system
135
+
136
+ Bookmarks are stored in `~/.markymark/bookmarks.json` and persist across sessions.
137
+
138
+ ## Why markymark?
139
+
140
+ If you work with AI coding assistants like Claude Code, you're probably generating documentation constantly. Design docs, implementation plans, debugging notes, context engineering prompts - all in markdown, all needing quick reference.
141
+
142
+ ### Claude Code Workflow
143
+
144
+ ```bash
145
+ # Claude creates ARCHITECTURE.md, IMPLEMENTATION_PLAN.md, etc.
146
+ # Double-click any of them → beautifully rendered in markymark
147
+
148
+ # Exploring Claude's built-in skills?
149
+ markymark ~/.claude/commands
150
+
151
+ # Check out your AI framework prompts
152
+ markymark ~/bmad-agent
153
+ ```
154
+
155
+ ### Context Engineering Made Visual
156
+
157
+ Modern AI frameworks use markdown for prompts and skills:
158
+ - **Claude Code**: Skills and commands in `~/.claude/`
159
+ - **BMAD**: Agent method prompts and templates
160
+ - **AgentOS / OpenSpec**: Specification documents
161
+ - **Custom frameworks**: Your own prompt libraries
162
+
163
+ markymark renders these beautifully with:
164
+ - Formatted tables and lists
165
+ - Mermaid diagrams for workflows
166
+ - Syntax-highlighted code blocks
167
+ - Accordion navigation for nested directories
168
+
169
+ ## Pumadev Integration
170
+
171
+ For those who prefer `.test` domains over remembering ports:
172
+
173
+ ```bash
174
+ # Set up pumadev integration
175
+ markymark --setup-pumadev
176
+
177
+ # Now always available at http://markymark.test
178
+ ```
179
+
180
+ See `markymark --pumadev-info` for detailed setup instructions.
181
+
182
+ ## Requirements
183
+
184
+ - **Ruby >= 2.7**
185
+
186
+ ### Installing Ruby
187
+
188
+ markymark requires Ruby 2.7 or higher. macOS includes Ruby 2.6, which is too old. Install a modern Ruby via:
189
+
190
+ ```bash
191
+ # Homebrew
192
+ brew install ruby
193
+
194
+ # Or use a version manager (rbenv, rvm, asdf)
195
+ rbenv install 3.3.0
196
+ ```
197
+
198
+ ## Platform Support
199
+
200
+ **markymark's core markdown viewer works on any platform with Ruby** - macOS, Linux, Windows.
201
+
202
+ ```bash
203
+ # Works everywhere
204
+ markymark ~/docs
205
+ markymark README.md
206
+ ```
207
+
208
+ ### macOS Native Integration
209
+
210
+ The native app integration (double-click `.md` files, cmd-click in iTerm, `open` command) is **macOS only** and requires:
211
+ - **Xcode Command Line Tools** (for Swift compilation during `markymark init`)
212
+
213
+ ```bash
214
+ # Install Xcode Command Line Tools if you don't have them
215
+ xcode-select --install
216
+
217
+ # Then run the setup wizard
218
+ markymark init
219
+ ```
220
+
221
+ ### Contributing Cross-Platform Native Integration
222
+
223
+ We'd love native file associations on other platforms! Contributions welcome for:
224
+
225
+ - **Linux**: `.desktop` file integration, xdg-open support
226
+ - **Windows**: Registry associations, shell integration
227
+
228
+ ## Development
229
+
230
+ ```bash
231
+ git clone https://github.com/fkchang/markymark.git
232
+ cd markymark
233
+ bundle install
234
+
235
+ # Run locally
236
+ bundle exec exe/markymark /path/to/docs
237
+ ```
238
+
239
+ ## Contributing
240
+
241
+ Bug reports and pull requests are welcome on GitHub at https://github.com/fkchang/markymark.
242
+
243
+ ## License
244
+
245
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
246
+
247
+ ---
248
+
249
+ <p align="center">
250
+ ♪ ♫ ♪<br>
251
+ ♫ <img src="assets/marky-mark-icon2.png" alt="Markymark" width="60"/> ♪<br>
252
+ ♫ ♪ ♫<br>
253
+ <br>
254
+ <i>Built with good vibrations</i> 🎵
255
+ </p>
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/assets/.gitkeep ADDED
File without changes
Binary file
data/assets/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Assets Directory
2
+
3
+ Place the marky-mark-dj.jpg image here for the README.
Binary file
Binary file
Binary file
data/config.ru ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/markymark'
4
+
5
+ # For pumadev: Load root path from PumadevManager if in pumadev mode
6
+ if Markymark::PumadevManager.active?
7
+ # Load from pumadev configuration
8
+ root_file = Markymark::PumadevManager.env_file_path
9
+ root = File.exist?(root_file) ? File.read(root_file).strip : Dir.pwd
10
+ else
11
+ # Fall back to environment variable or current directory
12
+ root = ENV['MARKYMARK_ROOT'] || Dir.pwd
13
+ end
14
+
15
+ root = File.expand_path(root)
16
+ Markymark::ServerSimple.root_path = root
17
+ Markymark::ServerSimple.real_root_path = File.realpath(root)
18
+
19
+ run Markymark::ServerSimple
data/docs/for_llms.md ADDED
@@ -0,0 +1,141 @@
1
+ # markymark - LLM Context Guide
2
+
3
+ This document helps LLMs understand markymark's architecture and how to work with the codebase effectively.
4
+
5
+ ## What is markymark?
6
+
7
+ markymark is a **dedicated local markdown viewer** that runs on any platform with Ruby. On macOS, it integrates with the operating system like a native app - double-click a `.md` file in Finder, cmd-click in iTerm, or run `open file.md` and it opens beautifully rendered in markymark.
8
+
9
+ ## Quick Reference
10
+
11
+ ### Installation & Setup
12
+ ```bash
13
+ gem install markymark
14
+ markymark init # Interactive setup wizard
15
+ markymark init -y # Accept all defaults
16
+ ```
17
+
18
+ ### Common Commands
19
+ ```bash
20
+ markymark # Browse current directory
21
+ markymark README.md # Open specific file
22
+ markymark ~/docs # Browse specific directory
23
+ markymark --status # Check server status
24
+ markymark --stop # Stop server
25
+ markymark --install-app # Install macOS app
26
+ markymark --set-default # Set as default .md handler
27
+ ```
28
+
29
+ ## Architecture Overview
30
+
31
+ ### Core Components
32
+
33
+ | File | Purpose |
34
+ |------|---------|
35
+ | `lib/markymark/cli.rb` | Command-line interface, argument parsing, server management |
36
+ | `lib/markymark/server_simple.rb` | Sinatra-based web server, markdown rendering, file discovery |
37
+ | `lib/markymark/app_installer.rb` | macOS app bundle creation, Swift launcher compilation |
38
+ | `lib/markymark/init_wizard.rb` | Interactive setup wizard |
39
+ | `lib/markymark/pumadev_manager.rb` | puma-dev integration for `.test` domains |
40
+
41
+ ### Key Files
42
+
43
+ - `exe/markymark` - Entry point executable
44
+ - `lib/views/simple.erb` - Main HTML template
45
+ - `lib/public/css/style.css` - Styling
46
+ - `lib/public/js/theme.js` - Dark/light theme toggle
47
+ - `assets/Markymark.icns` - macOS app icon
48
+
49
+ ### How the macOS App Works
50
+
51
+ The app bundle at `~/Applications/Markymark.app` contains:
52
+ 1. **Swift launcher** (`Contents/MacOS/markymark-launcher`) - Compiled binary that receives files from Launch Services via `NSApplicationDelegate.application(_:openFile:)`
53
+ 2. **Shell helper** (`Contents/MacOS/markymark-helper`) - Called by Swift launcher, sets up Ruby environment and invokes markymark CLI
54
+ 3. **Info.plist** - Declares file type associations (`.md`, `.markdown`, `.mdown`, `.mkd`)
55
+
56
+ This architecture is necessary because:
57
+ - AppleScript droplets don't receive files from macOS `open` command
58
+ - Ruby scripts can't be registered as file handlers directly
59
+ - Swift properly implements the Launch Services file-opening protocol
60
+
61
+ ### Server Architecture
62
+
63
+ markymark runs as a **single persistent server**:
64
+ - PID tracked in `~/.markymark/server.pid`
65
+ - Supports directory switching without restart via `/switch` endpoint
66
+ - Can run in standalone mode (port 4545) or pumadev mode (markymark.test)
67
+
68
+ ### Data Storage
69
+
70
+ All persistent data stored in `~/.markymark/`:
71
+ - `server.pid` - Running server info (port, PID, directory)
72
+ - `bookmarks.json` - Saved directory bookmarks
73
+ - `launcher.log` - Debug log from app launcher
74
+ - `root_path` - Current root for pumadev mode
75
+
76
+ ## Common Development Tasks
77
+
78
+ ### Rebuilding the Gem
79
+ ```bash
80
+ gem build markymark.gemspec
81
+ gem install markymark-0.1.0.gem
82
+ ```
83
+
84
+ ### Reinstalling the App
85
+ ```bash
86
+ echo 'y' | markymark --install-app
87
+ xattr -cr ~/Applications/Markymark.app # Clear quarantine
88
+ ```
89
+
90
+ ### Testing the Launcher
91
+ ```bash
92
+ # Clear log and test
93
+ : > ~/.markymark/launcher.log
94
+ open -a ~/Applications/Markymark.app /path/to/file.md
95
+ cat ~/.markymark/launcher.log
96
+ ```
97
+
98
+ ### Debugging App Issues
99
+ 1. Check `~/.markymark/launcher.log` for helper script output
100
+ 2. Verify paths in `~/Applications/Markymark.app/Contents/MacOS/markymark-helper`
101
+ 3. Test Swift launcher receives files: the log should show "Helper called with: /path/to/file"
102
+
103
+ ## Key Implementation Details
104
+
105
+ ### File Discovery
106
+ - Uses `Dir.glob` with fallback to manual traversal for permission-protected directories
107
+ - Skips `~/Library/` and other protected macOS directories
108
+ - Groups files by directory with accordion UI
109
+
110
+ ### Markdown Rendering
111
+ - Kramdown with GFM (GitHub Flavored Markdown) parser
112
+ - Rouge for syntax highlighting
113
+ - Mermaid.js for diagrams (client-side rendering)
114
+ - UTF-8 encoding for international character support
115
+
116
+ ### Ruby Environment Setup
117
+ The macOS app helper script bakes in:
118
+ - `RUBY_PATH` - Full path to Ruby executable
119
+ - `MARKYMARK_PATH` - Path to markymark executable in gem
120
+ - `GEM_HOME` / `GEM_PATH` - Gem environment for require resolution
121
+ - `RUBYLIB` - Path to markymark lib directory
122
+
123
+ This is necessary because the Swift launcher doesn't inherit shell environment (no RVM/rbenv setup).
124
+
125
+ ## Dependencies
126
+
127
+ - `sinatra` ~> 3.0 - Web framework
128
+ - `puma` ~> 6.0 - Web server
129
+ - `kramdown` ~> 2.4 - Markdown parser
130
+ - `kramdown-parser-gfm` - GitHub Flavored Markdown
131
+ - `rouge` ~> 4.0 - Syntax highlighting
132
+ - `listen` ~> 3.8 - File watching (for future live reload)
133
+ - `launchy` ~> 2.5 - Browser opening
134
+
135
+ ## Platform Support
136
+
137
+ **The core markdown viewer works on any platform with Ruby** (macOS, Linux, Windows).
138
+
139
+ The **native app integration** (double-click to open, cmd-click in terminal) is **macOS only**. Cross-platform native integration contributions welcome:
140
+ - **Linux**: Need `.desktop` file integration, `xdg-open` support
141
+ - **Windows**: Need registry associations, shell integration
@@ -0,0 +1,149 @@
1
+ # macOS App Installer & Init Wizard Design
2
+
3
+ **Date:** 2025-12-18
4
+ **Status:** Approved
5
+
6
+ ## Overview
7
+
8
+ Add the ability to install Markymark as a macOS application that can be registered as the default handler for `.md` files. Includes an interactive setup wizard and standalone CLI flags.
9
+
10
+ ## CLI Interface
11
+
12
+ ### New Commands
13
+
14
+ ```bash
15
+ markymark init # Interactive setup wizard
16
+ markymark init -y # Accept all defaults (scripted)
17
+ markymark --install-app # Install macOS app bundle only
18
+ markymark --set-default # Set as default .md handler only
19
+ markymark --uninstall-app # Remove the app bundle
20
+ ```
21
+
22
+ ### Init Wizard Flow
23
+
24
+ 1. "Install Markymark.app for macOS file handling? [Y/n]"
25
+ 2. "Set Markymark as default app for .md files? [Y/n]" (only if step 1 was yes)
26
+ 3. "Setup server mode?" → choices: standalone (port 4545) / pumadev / skip
27
+ 4. Summary of what was configured
28
+
29
+ **Defaults for `-y` flag:** Install app, set as default, skip server setup.
30
+
31
+ ## macOS App Bundle
32
+
33
+ ### Location
34
+
35
+ `~/Applications/Markymark.app` - User's Applications folder, no sudo needed, persists across gem updates.
36
+
37
+ ### Structure
38
+
39
+ ```
40
+ Markymark.app/
41
+ ├── Contents/
42
+ │ ├── Info.plist # App metadata, file associations
43
+ │ ├── MacOS/
44
+ │ │ └── markymark-launcher # Shell script with baked-in Ruby paths
45
+ │ └── Resources/
46
+ │ └── Markymark.icns # App icon
47
+ ```
48
+
49
+ ### Info.plist Key Elements
50
+
51
+ - `CFBundleDocumentTypes` - Registers for `.md`, `.markdown` files
52
+ - `CFBundleIdentifier` - `com.markymark.app`
53
+ - `CFBundleURLTypes` - Optional URL scheme `markymark://`
54
+
55
+ ### Launcher Script Strategy
56
+
57
+ At install time, capture the current Ruby environment and bake it into the launcher:
58
+
59
+ ```bash
60
+ # During install, detect:
61
+ RUBY_PATH=$(which ruby)
62
+ MARKYMARK_PATH=$(which markymark)
63
+
64
+ # Generated launcher uses exact paths:
65
+ #!/bin/bash
66
+ exec /path/to/ruby /path/to/markymark "$@"
67
+ ```
68
+
69
+ **Benefits:**
70
+ - No runtime version manager detection needed
71
+ - Works with any Ruby setup (rvm, rbenv, asdf, homebrew, system)
72
+ - Guaranteed to use the same Ruby that installed the gem
73
+
74
+ **Caveat:** If user changes Ruby versions, they need to run `markymark --install-app` again.
75
+
76
+ ## Implementation Structure
77
+
78
+ ### New Files
79
+
80
+ **`lib/markymark/app_installer.rb`**
81
+
82
+ Handles:
83
+ - Creating the `.app` bundle structure
84
+ - Generating `Info.plist` with file associations
85
+ - Writing the launcher script with baked-in Ruby paths
86
+ - Copying the icon from gem assets
87
+ - Setting executable permissions
88
+ - Registering as default handler (via `duti` or `lsregister`)
89
+
90
+ **`lib/markymark/init_wizard.rb`**
91
+
92
+ Handles:
93
+ - Interactive prompts
94
+ - `-y` flag for accepting defaults
95
+ - Calling `AppInstaller` and `PumadevManager` as needed
96
+
97
+ ### CLI Additions (`lib/markymark/cli.rb`)
98
+
99
+ ```ruby
100
+ opts.on('--install-app', 'Install macOS app bundle to ~/Applications')
101
+ opts.on('--uninstall-app', 'Remove macOS app bundle')
102
+ opts.on('--set-default', 'Set as default handler for .md files')
103
+ # init handled as subcommand
104
+ ```
105
+
106
+ ## Error Handling
107
+
108
+ ### Pre-flight Checks for `--install-app`
109
+
110
+ - macOS only (fail gracefully on Linux/Windows with helpful message)
111
+ - Check `~/Applications` exists (create if not)
112
+ - Warn if app already exists, ask to overwrite
113
+
114
+ ### Pre-flight Checks for `--set-default`
115
+
116
+ - App must be installed first
117
+ - Check if `duti` is available; if not, fall back to manual instructions
118
+
119
+ ### Launcher Script Errors
120
+
121
+ - If baked-in Ruby path no longer exists → show error dialog via `osascript`
122
+ - Pass through markymark errors to Console.app for debugging
123
+
124
+ ### Version Mismatch Detection
125
+
126
+ On `markymark --status`:
127
+ - Check if installed app's Ruby path still exists
128
+ - Warn: "Markymark.app may need reinstalling (Ruby path changed)"
129
+
130
+ ## Web UI & README Updates
131
+
132
+ ### Sidebar Header (simple.erb)
133
+
134
+ - Add `marky-mark-icon2.png` as small logo (~48px)
135
+ - Position above or beside "Markymark" title
136
+
137
+ ### README.md
138
+
139
+ - Add DJ image (`marky-mark-dj.jpg`) at top as project banner
140
+ - Add "Installation" section covering `markymark init`
141
+ - Document all new flags
142
+
143
+ ## Assets
144
+
145
+ Already prepared:
146
+ - `assets/marky-mark-icon2.png` - 1024x1024 source icon
147
+ - `assets/Markymark.icns` - macOS app icon bundle
148
+ - `assets/Markymark.iconset/` - All icon sizes (16-1024)
149
+ - `assets/marky-mark-dj.jpg` - README banner image
data/exe/markymark ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "markymark"
4
+
5
+ Markymark::CLI.run(ARGV)