docs/plans/2026-10-05-capture.md
23 lines · 2093 bytes
1# Capture Implementation Plan
2
3> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
5**Goal:** `org-capture`: templates, filling them, filing the result where Emacs would, from inside the app and from a system-wide shortcut.
6
7**Architecture:** `OrgCore/Capture/Capture.swift` ports `org-capture-fill-template` (`%?`, `%i`, `%a`, `%l`, `%L`, `%c`, `%f`, `%F`, `%n`, `%t`, `%T`, `%u`, `%U`, `%<…>`, `%^{prompt|default}`, `%\N`; the text trimmed and ending in one newline) and placement for `entry`, `plain`, `item` and `checkitem` into `file`, `file+headline` (created when missing) and `file+olp` targets, with `org-capture-place-entry`'s blank-line handling (`org--blank-before-heading-p` with `auto`, empty lines after removed) and level shifting, and a final newline as saving adds. Templates come from `capture.toml` beside `keymap.toml`, defaulting to the two in your Doom config, files relative to the first folder. The capture window picks a template by key, asks the prompts, and files the edited text through the open buffer or the save path. ⌃⌥Space opens it from any app (Carbon hot key, no accessibility permission), as do `C-c c` and ⇧⌘N.
8
9**Tech Stack:** Swift 6.2 tools, Swift Testing, Emacs 31.1 / Org 9.8.7 oracle (`org-capture` + `org-capture-finalize` in batch).
10
11**Spec:** `docs/design.md`, "Phase 5".
12
13## Global Constraints
14
15- Oracle: 12 templates × target files (existing and missing headlines, blank lines, prepend, nested outline paths, property drawers, lists, files without a final newline).
16- Not yet: datetree targets, `%^g`/`%^t`/`%^C` and other typed prompts, `%(sexp)`, `%[file]`, `%k`, `%K`, `%x`; such templates show a message instead of filing something different.
17
18---
19
20- [x] Fill, questions, placement; oracle.
21- [x] `CaptureTemplates`, `DocumentSession.capture`, `captureAnnotation`; tests.
22- [x] Capture window, global shortcut, menu, keys, settings.
23- [x] Commit "Capture".