Commit Graph
268 Commits
Author SHA1 Message Date
amitwh dd6d97c35d docs(security): formal security assessment summary
Manual audit + Task 24 formal pass: SEC-1 Pandoc argument injection
(critical, fixed), Git sidebar XSS (high, fixed), File.path dead on
Electron 41 (fixed), pdf-lib encryption silent no-op (fixed, honest
failure). 14 areas verified clean. 7 deferred/accepted risks documented
(D1-D7) incl. real-encryption dependency decision and GUI-pass release
blocker.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 0604c65683 fix(security): escape repo-derived strings in Git sidebar rendering (XSS) 2026-08-23 19:31:33 +05:30
amitwh c43caf3902 fix(security): convert Pandoc invocation to execFile argument arrays (SEC-1) 2026-08-23 19:31:33 +05:30
amitwh 25dcaaa816 fix(pdf): make encrypt/decrypt/permissions fail honestly instead of silent no-op 2026-08-23 19:31:33 +05:30
amitwh c6ec1cef64 fix(renderer): migrate File.path reads to webUtils.getPathForFile for Electron 41 2026-08-23 19:31:33 +05:30
amitwh 5fcc282fe0 docs(plan): append Task 27 — honest failure for pdf-lib encryption no-op
Task-22-review finding: pdf-lib 1.17.1 silently ignores userPassword/
ownerPassword; encrypt/permissions write unprotected files reporting
success; decrypt is a copy no-op.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 8a95144bf3 feat(pdf): add bulk PDF operations (watermark/compress/rotate/etc.) to batch converter 2026-08-23 19:31:33 +05:30
amitwh bc47316746 fix(export): one-time import of legacy localStorage export profiles into presets 2026-08-23 19:31:33 +05:30
amitwh 02ce06d364 feat(export): add save/select/delete export presets 2026-08-23 19:31:33 +05:30
amitwh 2e3af826f7 docs(plan): append Task 26 — File.path → webUtils migration (Electron 41 fix)
Task-20-review finding: File.path removed in Electron 32, app on ^41.1.1,
~15 renderer file-picker sites read it and get undefined at runtime.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 758dcb4166 feat(compare): implement Document Compare dialog with local-diff and git-HEAD-diff modes
Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 1f5db511ba feat(editor): add CSV-to-markdown-table toolbar converter
Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 63c35ef2dc fix(preload): whitelist word-template IPC channels, drop orphaned set-custom-start-page 2026-08-23 19:31:33 +05:30
amitwh c8883e77fe feat(export): add visual word-template settings dialog with graceful default-template fallback
Replaces the two native OS dialogs used to configure the DOCX "Enhanced"
export template (an open-file picker + a message-box question) with a
single in-app modal that shows the currently active template state, per
Task 18's original audit finding that this state was invisible until a
user thought to reopen the menu. Consolidates the "Select Word
Template..."/"Template Settings..." menu items into one "Word Template
Settings..." entry wired to the new dialog; Browse still uses the native
file picker since there is genuinely no bundled folder of templates to
enumerate (confirmed by investigation — see task-18-report.md).

Also fixes a related dangling-reference bug: WordTemplateExporter's
hardcoded default template path (word_template.docx) was deleted from
the repo in an earlier commit, but the code still tried to read it and
threw ENOENT whenever no custom template was selected. convert() now
degrades gracefully by generating a minimal, valid DOCX shell (styles +
numbering matching what markdownToWordXml() already references) instead
of crashing, and the new dialog surfaces this state honestly ("using
default formatting, no default template is bundled") rather than
implying a working default exists.

Out of scope, per explicit instruction: bundling fabricated starter
.docx templates to populate a literal multi-item gallery (rejected as
disproportionate/fake-content scope), and an EPUB template gallery (no
EPUB template mechanism exists anywhere in this codebase to build one
for).

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 8a28c21512 fix(plugins): whitelist plugin export-format IPC channels in preload.js
Task 17's three new IPC channels (plugin-export-formats-registered,
run-plugin-export-format, plugin-export-format-result) were missing
from preload.js's ALLOWED_SEND_CHANNELS/ALLOWED_RECEIVE_CHANNELS,
breaking the established convention that the allowlist is the
authoritative registry of every valid channel regardless of whether
it's accessed via window.electronAPI or raw ipcRenderer (see
toggle-sidebar-panel, set-current-file, save-recent-files).

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh d6baa2daf7 feat(plugins): add export-format registration hook to plugin API
Add context.formats.registerExportFormat(id, opts) to PluginContext,
backed by a new FormatRegistry (mirrors PluginRegistry's Map-based
shape). Plugins register namespaced (${pluginId}:${id}) export
formats with a label/extension/handler; the writing-studio built-in
plugin registers a trivial "sprint-summary" .txt export as a
worked example.

The plugin system lives entirely in the renderer process while the
Export menu is built in main.js, so wiring formats into the menu
required a small IPC round-trip: renderer sends format metadata to
main after plugin load (main rebuilds the menu via the already-
idempotent createMenu()), and a menu click sends the resolved save
path back to the renderer, which is the only process holding the
plugin's handler function.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 44624cd4bf feat(pdf): add form field detection, fill, and flatten
Adds pdfGetFormFields (lists AcroForm fields with name/type/value) and
pdfFillForm (fills text fields by name, optionally flattens) to
PDFOperations.js, dispatched via 'formFields'/'fillForm' in
executeOperation. pdfFillForm skips unknown/non-text fields per-field
(logs + continues) rather than failing the whole batch, matching the
partial-success precedent set by pdfExtractImages.

Wires a "Fill Form" entry into the PDF editor dialog: selecting a PDF
fetches its fields via a new get-pdf-form-fields/pdf-form-fields IPC
round trip and renders one text input per field, plus a flatten
checkbox, following the same structure as the crop/pageNumbers dialogs.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 2334ab30ed feat(pdf): add extract text, page numbers, crop, extract images operations
Adds four new PDFOperations: pdfExtractText (pdfjs-dist getTextContent),
pdfAddPageNumbers (reuses pdfWatermark's position-mapping logic, extracted
into a shared resolvePosition helper), pdfCrop (page.setCropBox against the
existing MediaBox), and pdfExtractImages (pdfjs-dist operator list +
paintImageXObject + sharp). Wired into executeOperation's switch and the PDF
editor dialog UI (4 new sections/toolbar buttons/menu items) with no new IPC
channel needed.

pdfjs-dist v5 is ESM-only, so it's loaded via dynamic import() of its
Node-friendly legacy build; Jest needs --experimental-vm-modules to support
that, so the test scripts now set NODE_OPTIONS accordingly via cross-env.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh abcfb03e52 feat(git): add diff, branch, checkout, push, pull to Git sidebar panel
Extends GitOperations.js with diff/branches/checkoutBranch/push/pull,
wires the 5 new IPC handlers in main.js (reusing the existing dir
resolution), whitelists the new channels in preload.js, and fixes the
Git sidebar panel's previously dead _gitDiff callback by wiring up a
diff view, branch list/create/checkout UI, and push/pull buttons.
Resolves Task 5, which deferred this work to this task.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 6ba3174480 feat(export): expose AsciiDoc, RST, MediaWiki, Org, Textile, man, ipynb export formats
Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh b83b86b31e feat(media): add batch folder mode to Image/Audio/Video Tools dialog
Reviewer follow-up on Task 12: the task's own title/brief called for
batch support and no later task in the plan picks it up, so this closes
that gap. Adds a "Single File" / "Batch Folder" mode toggle to the
existing media-operations-dialog.js; batch mode swaps the per-file
input/output fields for an Input Folder + "Include subfolders" +
Output Folder trio while keeping every other parameter (width/height/
quality/angle/startTime/duration/crf/fps/format/fit) applied uniformly
to every matching file. Disabled for audio "Merge", which combines many
inputs into one output and doesn't fit a per-file batch model.

main.js: adds collectFilesByExtension() (src/main/collectFilesByExtension.js,
unit tested), a generalization of the inline collectFiles() closure inside
ipcMain.on('universal-convert-batch', ...) to match a set of extensions
instead of one format. runMediaBatchOperation() loops
ImageOperations/AudioOperations/VideoOperations.executeOperation() over
the matched files, reporting per-file progress via new
'media-batch-progress' events and a final 'media-batch-complete' event,
then shows a "Batch Conversion Complete" dialog.showMessageBox with
completed/failed counts, mirroring performBatchConversion()'s pattern.
Wired via three new ipcMain.on handlers: batch-image-operation,
batch-audio-operation, batch-video-operation.

preload.js: whitelists the three new send channels and the two new
receive channels (media-batch-progress, media-batch-complete).
2026-08-23 19:31:33 +05:30
amitwh f271e27177 feat(media): add Image/Audio/Video Tools dialogs wired to new operation backends
Adds Tools > Image/Audio/Video Tools... menu items and a single dynamic
renderer dialog (src/renderer/media-operations-dialog.js) that lets the
user pick a media-kind-scoped operation, fill in its operation-specific
fields, and invoke process-image-operation/process-audio-operation/
process-video-operation (Tasks 9-11's backends). File selection reuses
the existing <input type="file"> + file.path convention; the one folder
picker need (video frame extraction) reuses the existing generic
select-folder/folder-selected IPC channels, so no new IPC handler was
required. Also removes the three dead electronAPI.image/audio/video
convenience blocks from preload.js (stale pre-Task-9-11 channel names,
unused everywhere).
2026-08-23 19:31:33 +05:30
amitwh 8dc1ae1c45 feat(video): implement ffmpeg-based video operations backend
Add src/main/VideoOperations.js with pure argument-builder functions
(buildConvertArgs, buildCompressArgs, buildTrimArgs, buildFramesArgs,
buildGifArgs) and a single executeOperation entry point that spawns
ffmpeg via dependency-injected execFileFn, mirroring AudioOperations.js.

Wire ipcMain.handle('process-video-operation', ...) in main.js using
getFFmpegPath() and sanitizeErrorMessage(). Update preload.js's
ALLOWED_SEND_CHANNELS: remove 6 stale video-* channel names, add
process-video-operation.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh a353a695b5 feat(audio): implement ffmpeg-based audio operations backend
Adds AudioOperations.js with pure argument builders (convert/trim/extract/merge)
plus one executeOperation that spawns ffmpeg via a dependency-injected execFileFn,
so tests never invoke a real binary. Wires process-audio-operation in main.js and
updates preload.js's ALLOWED_SEND_CHANNELS to replace the 5 stale audio-* entries.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 174eb3d6e9 style(image): apply Prettier formatting to ImageOperations test
Three lines in tests/main/ImageOperations.test.js (copied verbatim
from the task brief's sample) exceeded the project's 100-char width,
failing npm run format:check. Ran npm run format to auto-fix; no
behavioral change.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 8bada008b3 feat(image): implement sharp-based image operations backend
Add src/main/ImageOperations.js (convert/resize/compress/rotate via
sharp), modeled on PDFOperations.js's executeOperation dispatcher.
Wire ipcMain.handle('process-image-operation', ...) in main.js using
sanitizeErrorMessage() on error paths, and replace the 5 stale/unused
image-* channel names in preload.js's ALLOWED_SEND_CHANNELS with
process-image-operation + select-image-folder (mirroring
select-pdf-folder for a later batch-UI task).

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 949053a7c5 fix(deps): move jszip and sharp to runtime dependencies, unpack sharp from asar
- Add jszip (^3.10.1) to dependencies; keep version-pinned in overrides
- Move sharp (^0.34.3) from devDependencies to dependencies for Phase B runtime use
- Add node_modules/sharp/** to build.asarUnpack so native bindings are not packed

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh b80e34fcf5 fix(preload): whitelist monospace-setting-change channel
Reviewer caught that the new View > Monospace Font menu channel was
missing from preload.js's ALLOWED_RECEIVE_CHANNELS, the sole gap among
29 raw ipcRenderer.on(...) channels used in renderer.js. Add it under
the existing Font section for consistency with adjust-font-size.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 11b1c9e13e feat(settings): expose monospace font toggle in Settings UI
Add a View > Monospace Font menu (font family radio + ligatures
checkbox) — the app's existing reachable UI surface for this class of
preference (mirrors Theme/Font Size/Spell Check). The menu sends the
change to the renderer, which persists it via the already-working
ipcMain.handle('set-monospace-settings', ...) and applies it live via
the same applyMonospaceClasses() used on initial load.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh e09853952b fix(preload): whitelist show-document-compare channel
Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh d43fbaea59 fix(menu): wire Command Palette / Sidebar / Bottom Panel View-menu toggles 2026-08-23 19:31:33 +05:30
amitwh 66938968db fix(templates): wire New from Template menu to existing template-loading flow
Extract the sidebar Templates panel's inline load-into-new-tab callback into
a shared loadTemplateIntoNewTab() function, and add the missing
ipcRenderer.on('load-template-menu', ...) listener so the File > New from
Template submenu (which already sends this IPC event, already whitelisted in
preload.js) actually loads the selected template.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 5d9c46afc3 fix(menu): make Clear Recent Files actually clear the list
Extract the recent-files.json deletion logic into a standalone
clearRecentFilesOnDisk() function and call it from both the menu
click handler and the ipcMain.on handler. Previously the menu sent
the message in the wrong direction (main→renderer instead of
renderer→main), causing the feature to silently no-op. Both paths now
use the same function and send the correct 'recent-files-cleared'
notification to keep the renderer in sync.

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh bf3438902b fix(pdf): route Open PDF File menu item to the working editor dialog channel 2026-08-23 19:31:33 +05:30
amitwh edb5db358a docs: add implementation plan for feature audit, media converter, and security hardening
Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 6d564261b2 chore(release): bump version to 4.5.0
Monospace font embedding feature release. Adds bundled JetBrains Mono +
Fira Code TTFs (asarUnpack), preview/print font picker with ligatures
toggle, and embedded fonts in PDF (xelatex fontspec), DOCX (OOXML
surgery), EPUB (--epub-embed-font + OPF manifest), and HTML (sidecar
CSS with base64 data URI).
2026-08-23 19:31:33 +05:30
amitwh f5dcffeb8d test(monospace): add end-to-end smoke test for PDF/DOCX/EPUB/HTML font embedding
Exercises the real export pipeline against the bundled JetBrains Mono TTFs:
- PdfFontHeader emits valid xelatex fontspec with correct family + Ligatures=NoCommon
- ExportCss.build emits @font-face with base64 data URI
- DocxFontEmbedder injects TTFs into pandoc-produced DOCX (word/fontTable.xml + word/fonts/)
- EpubFontEmbedder.patchManifest adds TTF entry to OPF <manifest>
- HTML export links the sidecar CSS which embeds the font

Run with: node tests/smoke-e2e-monospace.js
2026-08-23 19:31:33 +05:30
amitwh 7095b34280 style: apply Prettier formatting
Run after full implementation to enforce 2-space / 100-char / single-quote
conventions across all new + adjacent files.
2026-08-23 19:31:33 +05:30
amitwh 58868eece0 feat(IPC): expose get-monospace-settings + set-monospace-settings to renderer
Renderer already calls window.electronAPI.invoke('get-monospace-settings')
to apply body classes; this wires up the channel allowlist and main-process
handlers so the IPC actually returns the active monospace settings and
persists updates.
2026-08-23 19:31:33 +05:30
amitwh cd3385ec69 build: asarUnpack assets/fonts/** so packaged builds can read bundled TTFs
MonospaceFontConfig + print-preview.js already look in app.asar.unpacked
first; without this entry the bundled TTFs would be unreachable at runtime.
2026-08-23 19:31:33 +05:30
amitwh f04a20252f feat(export): wire DOCX export through DocxFontEmbedder
Embeds regular + bold TTF of the active monospace family into pandoc's
DOCX output. ODT uses pandoc's built-in font handling; RTF has no font
embedding capability (documented limitation).
2026-08-23 19:31:33 +05:30
amitwh e5e14c88ce feat(monospace): DocxFontEmbedder injects TTF into pandoc DOCX output
Idempotent. Patches fontTable.xml, [Content_Types].xml, .rels, styles.xml.
2026-08-23 19:31:33 +05:30
amitwh 7a5a2ecba6 feat(monospace): EPUB export embeds TTF via --epub-embed-font + manifest patch 2026-08-23 19:31:33 +05:30
amitwh fac0d3d4a6 feat(export): wire HTML export to monospace ExportCss (pandoc + fallback) 2026-08-23 19:31:33 +05:30
amitwh 269d4ac028 feat(monospace): wire PDF export to use bundled monospace font
Replaces -V monofont=Consolas with a generated xelatex/lualatex header
that fontspec-loads the bundled JetBrains Mono or Fira Code TTF. Adds
a cached settings reader with proper invalidation on store.set, and
reorders fallback engines to prefer lualatex (fontspec-capable) before
pdflatex.
2026-08-23 19:31:33 +05:30
amitwh cdc318ebc7 feat(monospace): add PdfFontHeader builder for xelatex fontspec 2026-08-23 19:31:33 +05:30
amitwh 0c4043121f chore(pandoc): cache parsed major/minor version for capability checks 2026-08-23 19:31:33 +05:30
amitwh 151be60b03 feat(monospace): print-preview iframe uses bundled monospace font
Inlines @font-face as base64 data URI so the iframe srcdoc can render
JetBrains Mono / Fira Code without depending on the parent window's
loaded @font-face sets. Reads family + ligature state from the
renderer-wide cache populated by applyMonospaceClasses().

Amit Haridas
2026-08-23 19:31:33 +05:30
amitwh 228ee04b09 feat(monospace): ExportCss embeds woff2 as base64 in CSS
Self-contained CSS for HTML export and print-preview iframe.
2026-08-23 19:31:33 +05:30
amitwh 9fd81ff5a0 fix(ascii): replace Google Fonts CDN with local fonts.css
ASCII generator now renders in bundled JetBrains Mono without internet,
matching the preview pane.
2026-08-23 19:31:33 +05:30