obsidigen 1.0.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 (112) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +521 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +115 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/cloudflare/access.d.ts +31 -0
  8. package/dist/cloudflare/access.d.ts.map +1 -0
  9. package/dist/cloudflare/access.js +194 -0
  10. package/dist/cloudflare/access.js.map +1 -0
  11. package/dist/cloudflare/tunnel.d.ts +49 -0
  12. package/dist/cloudflare/tunnel.d.ts.map +1 -0
  13. package/dist/cloudflare/tunnel.js +333 -0
  14. package/dist/cloudflare/tunnel.js.map +1 -0
  15. package/dist/commands/access.d.ts +2 -0
  16. package/dist/commands/access.d.ts.map +1 -0
  17. package/dist/commands/access.js +162 -0
  18. package/dist/commands/access.js.map +1 -0
  19. package/dist/commands/config.d.ts +8 -0
  20. package/dist/commands/config.d.ts.map +1 -0
  21. package/dist/commands/config.js +94 -0
  22. package/dist/commands/config.js.map +1 -0
  23. package/dist/commands/daemon.d.ts +5 -0
  24. package/dist/commands/daemon.d.ts.map +1 -0
  25. package/dist/commands/daemon.js +135 -0
  26. package/dist/commands/daemon.js.map +1 -0
  27. package/dist/commands/init.d.ts +7 -0
  28. package/dist/commands/init.d.ts.map +1 -0
  29. package/dist/commands/init.js +74 -0
  30. package/dist/commands/init.js.map +1 -0
  31. package/dist/commands/service.d.ts +2 -0
  32. package/dist/commands/service.d.ts.map +1 -0
  33. package/dist/commands/service.js +334 -0
  34. package/dist/commands/service.js.map +1 -0
  35. package/dist/commands/start.d.ts +9 -0
  36. package/dist/commands/start.d.ts.map +1 -0
  37. package/dist/commands/start.js +185 -0
  38. package/dist/commands/start.js.map +1 -0
  39. package/dist/commands/tunnel.d.ts +7 -0
  40. package/dist/commands/tunnel.d.ts.map +1 -0
  41. package/dist/commands/tunnel.js +174 -0
  42. package/dist/commands/tunnel.js.map +1 -0
  43. package/dist/config/global.d.ts +16 -0
  44. package/dist/config/global.d.ts.map +1 -0
  45. package/dist/config/global.js +102 -0
  46. package/dist/config/global.js.map +1 -0
  47. package/dist/config/types.d.ts +45 -0
  48. package/dist/config/types.d.ts.map +1 -0
  49. package/dist/config/types.js +3 -0
  50. package/dist/config/types.js.map +1 -0
  51. package/dist/config/vault.d.ts +12 -0
  52. package/dist/config/vault.d.ts.map +1 -0
  53. package/dist/config/vault.js +87 -0
  54. package/dist/config/vault.js.map +1 -0
  55. package/dist/server/index.d.ts +8 -0
  56. package/dist/server/index.d.ts.map +1 -0
  57. package/dist/server/index.js +84 -0
  58. package/dist/server/index.js.map +1 -0
  59. package/dist/server/routes/graph.d.ts +11 -0
  60. package/dist/server/routes/graph.d.ts.map +1 -0
  61. package/dist/server/routes/graph.js +97 -0
  62. package/dist/server/routes/graph.js.map +1 -0
  63. package/dist/server/routes/preview.d.ts +11 -0
  64. package/dist/server/routes/preview.d.ts.map +1 -0
  65. package/dist/server/routes/preview.js +41 -0
  66. package/dist/server/routes/preview.js.map +1 -0
  67. package/dist/server/routes/search.d.ts +11 -0
  68. package/dist/server/routes/search.d.ts.map +1 -0
  69. package/dist/server/routes/search.js +38 -0
  70. package/dist/server/routes/search.js.map +1 -0
  71. package/dist/server/routes/static.d.ts +9 -0
  72. package/dist/server/routes/static.d.ts.map +1 -0
  73. package/dist/server/routes/static.js +45 -0
  74. package/dist/server/routes/static.js.map +1 -0
  75. package/dist/server/routes/tree.d.ts +18 -0
  76. package/dist/server/routes/tree.d.ts.map +1 -0
  77. package/dist/server/routes/tree.js +61 -0
  78. package/dist/server/routes/tree.js.map +1 -0
  79. package/dist/server/routes/wiki.d.ts +11 -0
  80. package/dist/server/routes/wiki.d.ts.map +1 -0
  81. package/dist/server/routes/wiki.js +102 -0
  82. package/dist/server/routes/wiki.js.map +1 -0
  83. package/dist/templates/page.d.ts +23 -0
  84. package/dist/templates/page.d.ts.map +1 -0
  85. package/dist/templates/page.js +1913 -0
  86. package/dist/templates/page.js.map +1 -0
  87. package/dist/utils/plist.d.ts +60 -0
  88. package/dist/utils/plist.d.ts.map +1 -0
  89. package/dist/utils/plist.js +185 -0
  90. package/dist/utils/plist.js.map +1 -0
  91. package/dist/utils/systemd.d.ts +75 -0
  92. package/dist/utils/systemd.d.ts.map +1 -0
  93. package/dist/utils/systemd.js +220 -0
  94. package/dist/utils/systemd.js.map +1 -0
  95. package/dist/vault/indexer.d.ts +92 -0
  96. package/dist/vault/indexer.d.ts.map +1 -0
  97. package/dist/vault/indexer.js +360 -0
  98. package/dist/vault/indexer.js.map +1 -0
  99. package/dist/vault/parser.d.ts +14 -0
  100. package/dist/vault/parser.d.ts.map +1 -0
  101. package/dist/vault/parser.js +206 -0
  102. package/dist/vault/parser.js.map +1 -0
  103. package/dist/vault/resolver.d.ts +27 -0
  104. package/dist/vault/resolver.d.ts.map +1 -0
  105. package/dist/vault/resolver.js +111 -0
  106. package/dist/vault/resolver.js.map +1 -0
  107. package/dist/vault/watcher.d.ts +28 -0
  108. package/dist/vault/watcher.d.ts.map +1 -0
  109. package/dist/vault/watcher.js +86 -0
  110. package/dist/vault/watcher.js.map +1 -0
  111. package/package.json +77 -0
  112. package/public/styles/.gitkeep +0 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Caleb Smith
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.
22
+
package/README.md ADDED
@@ -0,0 +1,521 @@
1
+ # Obsidigen
2
+
3
+ Render your Obsidian vaults as beautiful web wikis with Cloudflare Tunnel integration.
4
+
5
+ ## Features
6
+
7
+ ### Wiki Interface
8
+ - **Three-Column Layout** - Navigation tree, content, and widgets panel
9
+ - **Tree Navigation** - Collapsible folder structure with current page highlighting
10
+ - **Smart Widgets** - Properties display, table of contents with scroll spy, backlinks
11
+ - **Hover Previews** - Preview page content by hovering over any wiki link
12
+ - **Responsive Design** - Mobile-friendly with slide-out navigation panels
13
+ - **Live Search** - Fast search with keyboard shortcuts (⌘K / Ctrl+K)
14
+
15
+ ### Obsidian Integration
16
+ - **Full Obsidian Support** - Wiki links, backlinks, aliases, frontmatter
17
+ - **Backlink Tracking** - Automatic bidirectional links between pages
18
+ - **Properties Display** - View frontmatter metadata including tags
19
+ - **Live Reload** - Automatic updates when files change
20
+
21
+ ### Customization
22
+ - **Custom Title** - Set a custom display title via config
23
+ - **Custom Favicon** - Place any favicon image in vault root
24
+ - **Theme Toggle** - Light/dark mode with localStorage persistence
25
+
26
+ ### Deployment
27
+ - **Cloudflare Tunnel** - Secure public access via tunnels
28
+ - **Cloudflare Access** - Zero-trust authentication
29
+ - **Boot Service** - Run as a system service (macOS & Linux)
30
+
31
+ ## Installation
32
+
33
+ ### From npm (Recommended)
34
+
35
+ ```bash
36
+ npm install -g obsidigen
37
+ ```
38
+
39
+ ### From Source
40
+
41
+ ```bash
42
+ git clone https://github.com/yourusername/obsidigen.git
43
+ cd obsidigen
44
+ npm install
45
+ npm run build
46
+ npm link
47
+ ```
48
+
49
+ ### Requirements
50
+
51
+ - Node.js 18 or higher
52
+ - npm or yarn
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ # Navigate to your Obsidian vault
58
+ cd /path/to/your/vault
59
+
60
+ # Initialize Obsidigen
61
+ obsidigen init
62
+
63
+ # Start the server
64
+ obsidigen start
65
+ ```
66
+
67
+ Visit `http://localhost:4000` to view your wiki.
68
+
69
+ **Landing Page:** The home page (`/`) automatically displays:
70
+ 1. A root-level page with "welcome" in the title (case-insensitive), or
71
+ 2. The first alphabetically-sorted root-level page, or
72
+ 3. A generated index of all pages
73
+
74
+ ## User Interface
75
+
76
+ Obsidigen features a clean, three-column wiki layout:
77
+
78
+ ### Left Sidebar - Navigation
79
+ - **Vault Title** - Displays your vault name at the top
80
+ - **Search Bar** - Quick search with live results (keyboard shortcut: ⌘K / Ctrl+K)
81
+ - **Tree View** - Collapsible folder structure
82
+ - Click folders to expand/collapse
83
+ - Current page highlighted
84
+ - Automatically expands to show active page
85
+
86
+ ### Center - Content
87
+ - Clean, centered reading experience (max 800px width)
88
+ - Full markdown rendering
89
+ - Syntax highlighting for code blocks
90
+ - Responsive tables and images
91
+
92
+ ### Right Sidebar - Widgets
93
+
94
+ **Properties Widget**
95
+ - Displays page frontmatter metadata
96
+ - Shows last modified date
97
+ - Tags displayed as colored badges
98
+
99
+ **On This Page Widget**
100
+ - Automatic table of contents from headings
101
+ - Scroll spy - highlights current section as you read
102
+ - Click to jump to any section
103
+
104
+ **Backlinks Widget**
105
+ - Lists all pages that link to the current page
106
+ - Click to navigate to linking pages
107
+
108
+ ### Theme Toggle
109
+ - Light/dark mode switcher at the bottom of the right sidebar
110
+ - Preference saved in localStorage
111
+ - Respects system theme preference on first visit
112
+
113
+ ### Hover Previews
114
+ - Hover over any wiki link to see a preview of the page (except tree navigation)
115
+ - 300ms delay before preview appears
116
+ - Preview shows page title and content
117
+ - Hover over the preview to keep it open and scroll through content
118
+ - Click anywhere on the preview to navigate to that page
119
+ - Links inside previews are disabled (click preview to navigate)
120
+ - Cached for instant subsequent previews
121
+ - Automatically positioned to stay on screen
122
+ - Border highlights on hover
123
+
124
+ ### Mobile Experience
125
+ - Hamburger menu for navigation (left)
126
+ - Backlinks button for widgets (right)
127
+ - Only one sidebar open at a time
128
+ - Full touch support
129
+
130
+ ## Commands
131
+
132
+ ### Basic Commands
133
+
134
+ | Command | Description |
135
+ |---------|-------------|
136
+ | `obsidigen init` | Initialize current directory as wiki |
137
+ | `obsidigen start` | Start local server |
138
+ | `obsidigen start -d` | Start as background daemon |
139
+ | `obsidigen stop` | Stop the server |
140
+ | `obsidigen status` | Show server status |
141
+ | `obsidigen config` | View configuration |
142
+ | `obsidigen config --edit` | Edit configuration in editor |
143
+ | `obsidigen config --set key=value` | Set configuration value |
144
+ | `obsidigen config --get key` | Get configuration value |
145
+
146
+ #### Configuration Examples
147
+
148
+ ```bash
149
+ # Set a custom title for your wiki
150
+ obsidigen config --set title="My Personal Wiki"
151
+
152
+ # Change the port
153
+ obsidigen config --set port=4001
154
+
155
+ # Get the current title
156
+ obsidigen config --get title
157
+ ```
158
+
159
+ ### Cloudflare Tunnel
160
+
161
+ | Command | Description |
162
+ |---------|-------------|
163
+ | `obsidigen tunnel login` | Authenticate with Cloudflare |
164
+ | `obsidigen tunnel create` | Create tunnel for this vault |
165
+ | `obsidigen tunnel start` | Start server + tunnel |
166
+ | `obsidigen tunnel status` | Show tunnel status |
167
+
168
+ ### Cloudflare Access
169
+
170
+ | Command | Description |
171
+ |---------|-------------|
172
+ | `obsidigen access setup` | Configure access policies |
173
+ | `obsidigen access status` | Show access status |
174
+
175
+ ### System Service (macOS)
176
+
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `obsidigen service install` | Register vault with boot service |
180
+ | `obsidigen service remove` | Unregister from service |
181
+ | `obsidigen service start` | Start the daemon |
182
+ | `obsidigen service stop` | Stop the daemon |
183
+ | `obsidigen service list` | List registered vaults |
184
+
185
+ ## Customization
186
+
187
+ ### Custom Title
188
+
189
+ Set a custom display title for your wiki (different from the vault name):
190
+
191
+ ```bash
192
+ obsidigen config --set title="My Personal Knowledge Base"
193
+ ```
194
+
195
+ The title appears in:
196
+ - Browser tab title
197
+ - Site header
198
+ - Page titles
199
+
200
+ If not set, defaults to the vault name (folder name).
201
+
202
+ ### Custom Favicon
203
+
204
+ Place a favicon file in your vault's root directory with one of these names:
205
+ - `favicon.ico` (recommended)
206
+ - `favicon.png`
207
+ - `favicon.svg`
208
+ - `favicon.jpg`
209
+ - `favicon.jpeg`
210
+ - `favicon.gif`
211
+
212
+ The favicon will automatically be detected and served. Supported formats:
213
+ - **ICO**: Standard favicon format, works everywhere
214
+ - **PNG**: Modern format with transparency support
215
+ - **SVG**: Scalable vector graphics (great for simple logos)
216
+ - **JPG/JPEG**: Photo-based favicons
217
+ - **GIF**: Animated favicons (if you're feeling adventurous!)
218
+
219
+ **Example:**
220
+ ```bash
221
+ # Copy your favicon to the vault root
222
+ cp ~/my-logo.png /path/to/vault/favicon.png
223
+
224
+ # Restart the server to see changes
225
+ obsidigen stop
226
+ obsidigen start
227
+ ```
228
+
229
+ ## Configuration
230
+
231
+ Configuration is stored in `.obsidigen/config.json`:
232
+
233
+ ```json
234
+ {
235
+ "name": "my-wiki",
236
+ "title": "My Personal Wiki",
237
+ "port": 4000,
238
+ "vaultPath": "/path/to/vault",
239
+ "tunnel": {
240
+ "name": "my-wiki",
241
+ "hostname": "wiki.example.com"
242
+ },
243
+ "access": {
244
+ "enabled": true,
245
+ "allowedEmails": ["me@example.com"]
246
+ }
247
+ }
248
+ ```
249
+
250
+ **Configuration Fields:**
251
+ - `name` - Internal identifier (usually folder name)
252
+ - `title` - Display title shown in UI and browser (optional, defaults to `name`)
253
+ - `port` - Local server port
254
+ - `vaultPath` - Absolute path to vault directory
255
+ - `tunnel` - Cloudflare Tunnel configuration (optional)
256
+ - `access` - Cloudflare Access configuration (optional)
257
+
258
+ ## Cloudflare Setup
259
+
260
+ ### 1. Install cloudflared
261
+
262
+ ```bash
263
+ # macOS
264
+ brew install cloudflare/cloudflare/cloudflared
265
+
266
+ # Linux - see https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
267
+ ```
268
+
269
+ ### 2. Authenticate
270
+
271
+ ```bash
272
+ obsidigen tunnel login
273
+ ```
274
+
275
+ ### 3. Create Tunnel
276
+
277
+ ```bash
278
+ # Basic (uses auto-generated hostname)
279
+ obsidigen tunnel create
280
+
281
+ # With custom domain
282
+ obsidigen tunnel create --domain wiki.yourdomain.com
283
+ ```
284
+
285
+ ### 4. Start with Tunnel
286
+
287
+ ```bash
288
+ obsidigen tunnel start
289
+ ```
290
+
291
+ ### 5. (Optional) Add Access Protection
292
+
293
+ ```bash
294
+ obsidigen access setup
295
+ ```
296
+
297
+ ## Run on Boot
298
+
299
+ Obsidigen can run as a system service on both macOS and Linux, automatically starting your wiki(s) on login.
300
+
301
+ ### Quick Start
302
+
303
+ ```bash
304
+ cd /path/to/vault
305
+ obsidigen service install
306
+ obsidigen service start
307
+ ```
308
+
309
+ ### Service Commands
310
+
311
+ | Command | Description |
312
+ |---------|-------------|
313
+ | `obsidigen service install` | Register vault for autostart |
314
+ | `obsidigen service remove` | Unregister vault |
315
+ | `obsidigen service start` | Start the daemon |
316
+ | `obsidigen service stop` | Stop the daemon |
317
+ | `obsidigen service list` | Show registered vaults and status |
318
+
319
+ ### Platform-Specific Details
320
+
321
+ #### macOS (launchd)
322
+
323
+ **Service file location:**
324
+ ```
325
+ ~/Library/LaunchAgents/com.obsidigen.daemon.plist
326
+ ```
327
+
328
+ **View logs:**
329
+ ```bash
330
+ tail -f ~/.obsidigen/daemon.log
331
+ ```
332
+
333
+ #### Linux (systemd)
334
+
335
+ **Requirements:**
336
+ - Linux with systemd (most modern distributions)
337
+ - systemd user services enabled
338
+
339
+ **Service file location:**
340
+ ```
341
+ ~/.config/systemd/user/obsidigen-daemon.service
342
+ ```
343
+
344
+ **Direct systemd commands:**
345
+ ```bash
346
+ # Start/stop/restart
347
+ systemctl --user start obsidigen-daemon
348
+ systemctl --user stop obsidigen-daemon
349
+ systemctl --user restart obsidigen-daemon
350
+
351
+ # Enable/disable autostart
352
+ systemctl --user enable obsidigen-daemon
353
+ systemctl --user disable obsidigen-daemon
354
+
355
+ # Check status
356
+ systemctl --user status obsidigen-daemon
357
+ ```
358
+
359
+ **View logs:**
360
+ ```bash
361
+ # Follow logs in real-time
362
+ journalctl --user -u obsidigen-daemon -f
363
+
364
+ # View last 50 lines
365
+ journalctl --user -u obsidigen-daemon -n 50
366
+
367
+ # View logs since boot
368
+ journalctl --user -u obsidigen-daemon -b
369
+ ```
370
+
371
+ ### Multiple Vaults
372
+
373
+ You can register multiple vaults to run simultaneously:
374
+
375
+ ```bash
376
+ # Register first vault
377
+ cd /path/to/vault1
378
+ obsidigen init --name "Vault 1" --port 4000
379
+ obsidigen service install
380
+
381
+ # Register second vault
382
+ cd /path/to/vault2
383
+ obsidigen init --name "Vault 2" --port 4001
384
+ obsidigen service install
385
+
386
+ # Start the daemon (runs all vaults)
387
+ obsidigen service start
388
+
389
+ # List all registered vaults
390
+ obsidigen service list
391
+ ```
392
+
393
+ ### Troubleshooting
394
+
395
+ #### Service won't start
396
+
397
+ Check the logs:
398
+ ```bash
399
+ # macOS
400
+ cat ~/.obsidigen/daemon.log
401
+
402
+ # Linux
403
+ journalctl --user -u obsidigen-daemon -n 50
404
+ ```
405
+
406
+ Common issues:
407
+ - Port already in use
408
+ - Vault directory doesn't exist
409
+ - Permissions issues
410
+
411
+ #### Linux: Service not loading on login
412
+
413
+ Enable user lingering (allows services to run without active session):
414
+ ```bash
415
+ loginctl enable-linger $USER
416
+ ```
417
+
418
+ #### Uninstalling the service
419
+
420
+ ```bash
421
+ # Remove all registered vaults
422
+ cd /path/to/each/vault
423
+ obsidigen service remove
424
+
425
+ # Or manually (Linux)
426
+ systemctl --user stop obsidigen-daemon
427
+ systemctl --user disable obsidigen-daemon
428
+ rm ~/.config/systemd/user/obsidigen-daemon.service
429
+ systemctl --user daemon-reload
430
+ ```
431
+
432
+ ### Architecture
433
+
434
+ The Obsidigen daemon:
435
+ 1. Reads the global config (`~/.obsidigen/config.json`) for registered vaults
436
+ 2. Starts a separate Node.js process for each vault
437
+ 3. Monitors health and restarts crashed vaults
438
+ 4. Handles graceful shutdown
439
+
440
+ Each vault runs independently on its configured port.
441
+
442
+ ## Supported Obsidian Features
443
+
444
+ **Implemented:**
445
+ - Wiki links `[[Page]]` with automatic resolution
446
+ - Wiki links with aliases `[[Page|Display Text]]`
447
+ - Wiki links in frontmatter properties
448
+ - Hover previews for wiki links (Obsidian-style)
449
+ - Frontmatter aliases and metadata
450
+ - YAML frontmatter with full property display
451
+ - Headers with automatic anchor links
452
+ - Table of contents generation from headings
453
+ - Highlights `==text==`
454
+ - Callouts `> [!note]`, `> [!warning]`, etc.
455
+ - Code blocks with syntax highlighting
456
+ - Tables with responsive layout
457
+ - Images with automatic sizing
458
+ - Backlink tracking (bidirectional links)
459
+ - Tag display from frontmatter
460
+
461
+ **Planned:**
462
+ - Embeds `![[Page]]`
463
+ - Canvas files
464
+ - Mermaid diagrams
465
+ - Math (LaTeX)
466
+
467
+ ## Development
468
+
469
+ ```bash
470
+ # Watch mode
471
+ npm run dev
472
+
473
+ # Build
474
+ npm run build
475
+
476
+ # Test locally
477
+ npm link
478
+ obsidigen --help
479
+ ```
480
+
481
+ ## Contributing
482
+
483
+ Contributions are welcome! Please feel free to submit a Pull Request.
484
+
485
+ ### Getting Started
486
+
487
+ 1. Fork the repository
488
+ 2. Clone your fork: `git clone https://github.com/yourusername/obsidigen.git`
489
+ 3. Create a branch: `git checkout -b feature/your-feature`
490
+ 4. Make your changes and commit: `git commit -am 'Add some feature'`
491
+ 5. Push to the branch: `git push origin feature/your-feature`
492
+ 6. Submit a Pull Request
493
+
494
+ ### Development Guidelines
495
+
496
+ - Follow the existing code style
497
+ - Add tests for new features (when test suite is available)
498
+ - Update documentation for user-facing changes
499
+ - Keep commits focused and write clear commit messages
500
+
501
+ ## Publishing
502
+
503
+ For maintainers publishing to npm, see [PUBLISHING.md](PUBLISHING.md) for detailed instructions.
504
+
505
+ Quick publish:
506
+
507
+ ```bash
508
+ # Bump version and publish
509
+ npm run release:patch # For bug fixes
510
+ npm run release:minor # For new features
511
+ npm run release:major # For breaking changes
512
+
513
+ # Manual publish
514
+ npm version patch
515
+ npm publish
516
+ ```
517
+
518
+ ## License
519
+
520
+ MIT - see [LICENSE](LICENSE) file for details
521
+
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { initCommand } from './commands/init.js';
4
+ import { startCommand, stopCommand, statusCommand } from './commands/start.js';
5
+ import { configCommand } from './commands/config.js';
6
+ import { tunnelCommand } from './commands/tunnel.js';
7
+ import { accessCommand } from './commands/access.js';
8
+ import { serviceCommand } from './commands/service.js';
9
+ import { startDaemon } from './commands/daemon.js';
10
+ const program = new Command();
11
+ program
12
+ .name('obsidigen')
13
+ .description('Render Obsidian vaults as web wikis with Cloudflare Tunnel integration')
14
+ .version('1.0.0');
15
+ // Init command
16
+ program
17
+ .command('init')
18
+ .description('Initialize current directory as an Obsidigen wiki')
19
+ .option('-p, --port <port>', 'Port to run the server on', '4000')
20
+ .option('-n, --name <name>', 'Name for this wiki')
21
+ .action(initCommand);
22
+ // Start command
23
+ program
24
+ .command('start')
25
+ .description('Start the wiki server')
26
+ .option('-d, --daemon', 'Run as background daemon')
27
+ .option('-p, --port <port>', 'Override port')
28
+ .action(startCommand);
29
+ // Stop command
30
+ program
31
+ .command('stop')
32
+ .description('Stop the wiki server')
33
+ .action(stopCommand);
34
+ // Status command
35
+ program
36
+ .command('status')
37
+ .description('Show server status')
38
+ .action(statusCommand);
39
+ // Config command
40
+ program
41
+ .command('config')
42
+ .description('View or edit vault configuration')
43
+ .option('-e, --edit', 'Open config in editor')
44
+ .option('--set <key=value>', 'Set a config value')
45
+ .option('--get <key>', 'Get a config value')
46
+ .action(configCommand);
47
+ // Tunnel commands
48
+ const tunnel = program
49
+ .command('tunnel')
50
+ .description('Manage Cloudflare Tunnel');
51
+ tunnel
52
+ .command('login')
53
+ .description('Authenticate with Cloudflare')
54
+ .action((options) => tunnelCommand('login', options));
55
+ tunnel
56
+ .command('create')
57
+ .description('Create a tunnel for this vault')
58
+ .option('-n, --name <name>', 'Tunnel name')
59
+ .option('-d, --domain <domain>', 'Custom domain (optional)')
60
+ .action((options) => tunnelCommand('create', options));
61
+ tunnel
62
+ .command('start')
63
+ .description('Start server with tunnel')
64
+ .action((options) => tunnelCommand('start', options));
65
+ tunnel
66
+ .command('stop')
67
+ .description('Stop the tunnel')
68
+ .action((options) => tunnelCommand('stop', options));
69
+ tunnel
70
+ .command('status')
71
+ .description('Show tunnel status')
72
+ .action((options) => tunnelCommand('status', options));
73
+ // Access commands
74
+ const access = program
75
+ .command('access')
76
+ .description('Manage Cloudflare Access');
77
+ access
78
+ .command('setup')
79
+ .description('Configure access policies')
80
+ .action(() => accessCommand('setup'));
81
+ access
82
+ .command('status')
83
+ .description('Show access policy status')
84
+ .action(() => accessCommand('status'));
85
+ // Service commands
86
+ const service = program
87
+ .command('service')
88
+ .description('Manage system service');
89
+ service
90
+ .command('install')
91
+ .description('Register vault with boot service')
92
+ .action(() => serviceCommand('install'));
93
+ service
94
+ .command('remove')
95
+ .description('Unregister from boot service')
96
+ .action(() => serviceCommand('remove'));
97
+ service
98
+ .command('start')
99
+ .description('Start the daemon service')
100
+ .action(() => serviceCommand('start'));
101
+ service
102
+ .command('stop')
103
+ .description('Stop the daemon service')
104
+ .action(() => serviceCommand('stop'));
105
+ service
106
+ .command('list')
107
+ .description('List all registered vaults')
108
+ .action(() => serviceCommand('list'));
109
+ // Daemon command (internal - used by launchd)
110
+ program
111
+ .command('daemon')
112
+ .description('Run daemon mode (internal)')
113
+ .action(startDaemon);
114
+ program.parse();
115
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,wEAAwE,CAAC;KACrF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,eAAe;AACf,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,CAAC;KAChE,MAAM,CAAC,mBAAmB,EAAE,oBAAoB,CAAC;KACjD,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,gBAAgB;AAChB,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uBAAuB,CAAC;KACpC,MAAM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AC,GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;AAE1C,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,0BAA0B,CAAC;KACvC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzC,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,yBAAyB,CAAC;KACtC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAExC,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAExC,8CAA8C;AAC9C,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,4BAA4B,CAAC;KACzC,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { AccessConfig } from '../config/types.js';
2
+ /**
3
+ * Check if API credentials are configured
4
+ */
5
+ export declare function hasApiCredentials(): boolean;
6
+ /**
7
+ * Configure API credentials
8
+ */
9
+ export declare function setApiCredentials(accountId: string, apiToken: string): void;
10
+ /**
11
+ * Create or update Access application for a vault
12
+ */
13
+ export declare function setupAccessApplication(vaultPath: string, config: AccessConfig): Promise<string | null>;
14
+ /**
15
+ * Delete Access application
16
+ */
17
+ export declare function deleteAccessApplication(vaultPath: string): Promise<boolean>;
18
+ /**
19
+ * Get Access application status
20
+ */
21
+ export declare function getAccessStatus(vaultPath: string): Promise<{
22
+ configured: boolean;
23
+ applicationId?: string;
24
+ allowedEmails?: string[];
25
+ allowedDomains?: string[];
26
+ } | null>;
27
+ /**
28
+ * Verify API credentials work
29
+ */
30
+ export declare function verifyCredentials(): Promise<boolean>;
31
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../../src/cloudflare/access.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAwBvD;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAG3C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQ3E;AA4CD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA0DxB;AA+DD;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBjF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAChE,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,GAAG,IAAI,CAAC,CAaR;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC,CAO1D"}