Commit Graph

64 Commits

Author SHA1 Message Date
Levi Neely 2f040bf810 Make the Settings dialog content scrollable
Adding the Org Path group pushed the settings content past the dialog's
fixed height, so the lower groups and the Close button overflowed the
dialog bounds. Wrap the content ColumnLayout in a ScrollView (vertical
only; the inner layout matches the viewport width so Layout.fillWidth
children still size correctly) and raise the default height from 400 to
520 so the common case fits without scrolling. Content that still exceeds
the dialog now scrolls instead of overflowing.
2026-10-02 12:14:12 +02:00
Levi Neely c4dc18cbfc Add an org path setting with a directory picker to Settings
Let the user change the server's scanned org directory from the GUI,
backed by the server's /cfg file. The server expands a leading ~ and
rescans, so the client only sends a path.

OrkClient:
- orgPath() reads /cfg and extracts the org_path value (basic TOML
  string, with escapes).
- setOrgPath() writes org_path to /cfg with proper TOML escaping, and
  emits orgPathChanged() on success. On failure the server's message is
  left in error().

SettingsDialog:
- New "Org Path" group: a text field prefilled from orgPath() when the
  dialog opens, a Browse… button opening a FolderDialog (QtQuick.Dialogs),
  and an Apply button. The folder picker's file:// URL is converted to a
  local path. A status line shows success or the server error. The field
  accepts a raw path too, so ~ and typed paths work.

Main.qml:
- On orgPathChanged, clear the selection and refresh the document list so
  the sidebar reflects the newly scanned directory.

Verified over 9P against a live server using the exact TOML setApply
writes: empty initial config, ~/org expanded to $HOME/org, and an
absolute Browse-style path each switch the served documents. GUI builds
clean (QML cache compiles SettingsDialog).
2026-10-02 12:11:19 +02:00
Levi Neely 7c9779b2fc Expose /cfg to read and write an on-disk config file
Add a root /cfg file to the 9P namespace backed by a TOML config file on
physical storage, so clients can read and change server settings without
restarting. The first setting is org_path: the directory scanned for org
files, with a leading ~ expanded to $HOME.

New config module (config.rs):
- Resolve the config file at $XDG_CONFIG_HOME/orkmode/config.toml, else
  ~/.config/orkmode/config.toml.
- expand_tilde(), read_raw(), write_raw(), parse(), and load().
- Config holds an optional org_path. Unit tests cover tilde expansion
  (bare ~, ~/sub, non-tilde, ~user left intact) and TOML parsing.

Mutable org directory (state.rs):
- org_dir becomes an RwLock<PathBuf> with an org_dir() getter and a
  set_org_dir() that validates the directory and rescans.
- config_raw() backs the /cfg read; apply_config() validates the TOML and
  the target directory, applies org_path, then persists. A rejected write
  (bad TOML or missing directory) never reaches disk and never mutates
  state.

Namespace (namespace.rs):
- /cfg is a read+write file: read returns the raw config, write calls
  apply_config.

Startup (ork-server.rs):
- With no -d/positional directory, fall back to the config file's
  org_path (tilde-expanded), else the current directory. An explicit CLI
  directory still takes precedence. Help text documents the config file.

Verified over 9P with an isolated HOME: /cfg reads empty on a fresh
install; writing org_path="~/org" expands the tilde and live-switches the
served documents; absolute paths work; nonexistent directories and
invalid TOML are rejected without changing state or disk; the setting
persists; and a no-flag restart loads org_path from the config file.
Server tests: 61 passed.
2026-10-02 12:07:52 +02:00
Levi Neely b385429d1b Add sample links exercising every resolver branch
Extend the sample org data with links that cover each resolve_target
dispatch path, so the link-navigation feature can be exercised by hand
and in the GUI.

test.org:
- Add a <<intro-anchor>> dedicated target and a #+NAME: languages-table
  named element as link destinations.
- Add "Same-file links" and "Cross-file links" subsections listing one
  link per kind: external URL, #custom-id, *headline, dedicated target,
  named element, plain text, and file:notes.org[::target] forms.

notes.org (new):
- Second document providing cross-file targets: *Meeting Notes headline,
  #design-decision custom id, <<release-anchor>> dedicated target, and a
  #+NAME: roadmap-table named element.
- Includes a back-link to test.org and its own same-file links.

All 14 links verified to resolve over a live server (dedicated/fuzzy
kinds, same-file, cross-file, and back-link directions). Property
drawers are placed directly under their headlines so CUSTOM_ID targets
parse; the plain-text target phrase is chosen so sorted-order section
scanning lands on the intended prose.
2026-10-02 11:43:24 +02:00
Levi Neely 66a1ca11b5 Make resolve offsets index the rendered /body text
Link resolution reported byte offsets relative to a section's raw
content region (headline end), but the GUI renders /body, which strips
the planning line, property drawer, and surrounding blank lines. An
offset into raw content therefore did not line up with the body the
GUI shows, so scrolling to a link target landed in the wrong place.

Server:
- Extract section_body_text() as a shared helper so section_body() and
  resolve_target() derive offsets from the exact same rendered string.
- Rewrite the dedicated-target, named-element, and plain-text branches
  of resolve_target() to search section_body_text() and report a
  /body-relative offset.
- Replace the affiliated-keyword lookup with find_name_line(), a text
  scan over /body: the parser only attaches #+NAME to some element
  kinds (not tables), so scanning the rendered body is more reliable.
- Drop the now-unused section_content() helper.
- Update tests with concrete /body-relative offset assertions
  (<<target>> at 22, blank-stripped at 5, #+NAME at 44).

GUI:
- sectionRevealed gains a bodyOffset argument, threaded from the
  resolve response through revealSection into the QML Connections.
- OutlineView positions the row at Beginning when the match lies inside
  the body (offset > 0) so the body is visible, else just Contain.

Scroll granularity is section-top: the row is scrolled into view, not
the exact character. True char-precise scrolling needs a single
addressable body text widget; /body is currently segmented into
text/code/table/list parts. Deferred.
2026-10-02 11:04:05 +02:00
Levi Neely cc2b341754 Make org links in headline titles clickable
Headline titles were rendered as plain text, so an inline org link in a
heading showed its raw [[target][desc]] syntax and could not be followed.
Body text and list items already route links through renderInline and
onLinkActivated; apply the same treatment to the title Label.

The title now renders as StyledText via renderInline, exposes a pointer
cursor over links through a HoverHandler, and dispatches clicks to
openLink (which resolves and navigates via the model). Non-link text
keeps its done-aware color and strike-through.
2026-10-02 09:37:15 +02:00
Levi Neely c6bb21800a Resolve fuzzy org link targets across the full search ladder
Fuzzy link targets previously resolved only to an exact headline title or
a slug id, always with offset 0. Extend resolve_in_doc to follow the
Emacs org-link-search precedence:

  1. a <<target>> dedicated target (or <<<radio>>> radio target)
  2. an element named with #+NAME: target
  3. a headline whose title matches
  4. (compat) a section whose slug id matches
  5. the target text appearing literally in a section's content
     (case-insensitive)

Each branch returns the owning section plus a byte offset relative to the
start of that section's raw content, so a caller can later scroll within
/body. Dedicated-target and plain-text matches use lightweight scans over
the raw section slice (find_org_target, find_plain_text); #+NAME uses the
parsed affiliated keywords. The new section_content helper yields a
section's raw content region and its starting offset.

Fuzzy matching inherits the cross-document fallback already wrapping
resolve_in_doc, so a bare target can reach a <<target>>, named element,
or body text in another file.
2026-10-02 09:34:33 +02:00
Levi Neely 27e63f7a6f Follow org links in the GUI, resolving across the org path
Clicking an internal org link now navigates the outline to its target.
The GUI resolves the link via /<doc>/resolve and acts on the result:
external targets open in the OS handler; internal targets expand the
target's ancestors, scroll to it, and flash it.

Resolution spans the whole org path rather than a single document:

  - file:DOC::TARGET and file:DOC resolve TARGET within the named
    document (a file: link to a document not in the path stays external).
  - id:uuid links are globally unique and resolve in whichever document
    owns the ID.
  - #custom-id, *Headline, and bare fuzzy targets resolve in the current
    document first, then fall back across every other document.

The resolve result gains a `doc:` field naming the owning document. When
it differs from the current document, DocumentModel::followLink switches
the model to that document before revealing the section.

DocumentModel gains revealSection() and followLink(); OutlineView wires
link clicks to followLink and animates the revealed row via the new
sectionRevealed signal.
2026-10-02 09:26:03 +02:00
Levi Neely b21b675980 Add /<doc>/resolve for link target resolution
A read-write 9P file per document: write a link target, read back its
structural resolution. resolve_target dispatches by target syntax,
mirroring Emacs org-link-search precedence but terminating in a section
id rather than a buffer position:

  #custom-id / id:uuid / *Headline -> dedicated (exact section)
  http(s)/mailto/ftp/file          -> external (OS-handled)
  bare target naming a heading     -> fuzzy (section)
  otherwise                        -> notfound

Response schema carries kind/section/offset; the offset field is wired
now (0 for current cases) so Phase 2 fuzzy text/<<target>>/#+NAME search
with an intra-section byte offset slots in without changing the contract.
Resolved ids are directly valid 9P paths (/<doc>/<id>).
2026-10-01 16:31:41 +02:00
Levi Neely b79970b62f Render org links in the GUI body
Body text and list items now render org links ([[target]] and
[[target][description]]) as clickable hyperlinks via StyledText. Other
text is HTML-escaped and newlines become <br> so formatting is preserved.

Activating a link opens external URL schemes (http(s), mailto, file) in
the system handler; internal links (id:, #custom, *headline) are left for
a future navigation pass. The pointer cursor shows over hovered links.
2026-10-01 15:56:56 +02:00
Levi Neely 39ab7108ff Cycle checkboxes with the mouse wheel
Scrolling over a checkbox glyph cycles its state
unchecked -> partial -> checked (and back), respecting scroll direction:
wheel up steps forward, wheel down steps in reverse. Left-click still
toggles checked/unchecked.

The shared rewriteCheckbox helper applies a state-mapping function to the
Nth cookie; toggleCheckbox and the new cycleCheckbox are thin callers.
2026-10-01 15:53:06 +02:00
Levi Neely 3d3ccd1e11 Align checkbox detection between QML and model
The QML list parser required whitespace after the checkbox bracket
(\]\s+), so a bare cookie with no trailing text (e.g. "- [X]") was not
counted as a checkbox. The model's toggle regex had no such requirement,
so the two disagreed on checkbox ordinals and a click could toggle the
wrong item. Relax the QML regex to \]\s* so both layers count the same
set of checkboxes in the same order.
2026-10-01 15:48:20 +02:00
Levi Neely 55856707c7 Make GUI checkboxes clickable
Clicking a checkbox glyph toggles its state and writes the change back.
DocumentModel::toggleCheckbox(row, ordinal) finds the Nth checkbox cookie
in the section body (document order), flips [ ]/[-] -> [X] and [X] -> [ ],
writes the body via /body, and refreshes the row.

The body parser assigns each checkbox item a stable ordinal across the
whole section, and the list delegate wires a pointer-cursor MouseArea on
the glyph (checkbox items only) to the model toggle.
2026-10-01 15:45:26 +02:00
Levi Neely 754051b3a4 Render list items and checkboxes in the GUI body
The body parser now recognizes org list items (- / + / ordered) and
splits them out of text runs into dedicated "list" parts. Each item
captures its indent, bullet, optional checkbox state, and text.

A new list component renders checkbox items with ☐ / ▣ / ☑ glyphs
(unchecked / partial / checked), colored by state, with checked items
dimmed and struck through. Plain list items render with their bullet.
2026-10-01 15:40:50 +02:00
Levi Neely 36a9607576 Add code block execution to the GUI outline view
Each executable source block now shows a "Run" button in the outline.
Clicking it runs the block server-side and renders the inserted
#+RESULTS: in place, with an exit-status indicator.

DocumentModel gains executeBlock(row, blockIndex), which runs
/ctl execute <doc> <id> <n>, refreshes the section body, and emits
dataChanged(BodyRole). isLanguageSupported(lang) backs button visibility
via /ctl languages (loaded once, cached).

OutlineView tags each parsed code part with its src-block ordinal so the
GUI index matches the server's block indexing, and the code block header
carries the Run control plus running/ok/error status.
2026-10-01 15:26:05 +02:00
Levi Neely d073c8fa5e Honor :results header args on code execution
Parse the :results switch from a src block's header arguments and apply
Emacs org-babel semantics when writing results:

- silent/none: execute and report, but do not write a #+RESULTS: block
- raw: insert output verbatim, no prefix or wrapping
- drawer: wrap output in a :results: ... 🔚 drawer
- default: fixed-width for <10 lines, #+begin_example for 10+

The insert_results detection loop now recognizes and replaces all four
wrapping styles in place, so re-execution and cross-mode transitions
(e.g. drawer to fixed-width) update cleanly without duplication. Raw
results, which have no delimiters, terminate at a blank line or heading.
2026-10-01 13:48:13 +02:00
Levi Neely a13f76cd40 Add languages and reload-languages ctl verbs
Expose the language registry via ctl: `languages` lists supported src
block languages (one per line), `reload-languages` reloads plugin configs
from /etc/orkmode/languages and ~/.config/orkmode/languages and reports
how many were loaded.
2026-10-01 13:39:16 +02:00
Levi Neely 84101145d7 Add language plugin registry and Emacs-style #+RESULTS: formatting
Code execution now uses a LanguageRegistry with built-in defaults
(bash, python, ruby, perl, javascript) that can be overridden by TOML
config files in /etc/orkmode/languages or ~/.config/orkmode/languages.

Match Emacs org-babel result formatting: fixed-width (": " prefix) for
output under 10 lines, #+begin_example blocks for 10+ lines
(org-babel-min-lines-for-block-output).

Fix insert_results duplication: the source block span end already points
to the start of the line after #+END_SRC, so searching for the next
newline skipped the existing #+RESULTS: line and prepended duplicates on
re-execution. Also handle replacing existing #+begin_example result blocks.

Fix parser: #+begin_example, comment, and export blocks were misparsed as
SourceBlock with a bogus language, causing "unsupported language" errors
on re-execution. Map them to their correct AST element kinds.
2026-10-01 13:36:38 +02:00
Levi Neely 4a865d7546 Write #+RESULTS: blocks after code execution
- Execute returns results and writes them to the org file
- Replaces existing #+RESULTS: block if present
- Results formatted with : prefix per org convention
- Process blocks in reverse order to preserve byte offsets
- Blank line added after results for proper separation
2026-10-01 11:46:16 +02:00
Levi Neely 17f18b044c Add Landlock sandbox for code execution
- sandbox.rs: Landlock filesystem restrictions applied via pre_exec
- Library paths (/lib, /usr/lib) need execute permission for dynamic linker
- 30s timeout with SIGKILL on expiry
- Network access allowed (Landlock only restricts filesystem)
- Minimal env: PATH, HOME=/tmp, LANG, TERM
2026-10-01 11:38:43 +02:00
Levi Neely 445177bbfa Add execute ctl verb for org-babel style code execution
- execute <doc> — all blocks in document
- execute <doc> <section> — all blocks in subtree
- execute <doc> <section> <idx> — single block by index
- execute <doc> <section> <name> — block by #+NAME in section
- execute <doc> :<name> — named block anywhere in doc

Parser now extracts #+NAME: from block's affiliated keywords.
Supports bash, python, ruby, perl, and node interpreters.
Basic sandboxing via env_clear() and restricted PATH.
2026-10-01 10:51:39 +02:00
Levi Neely b2953a7caf Fix font and scaling in Main.qml
Replace all pixelSize with pointSize using baseFontSize:
- Sidebar width: 16em (was 220px)
- Header margins: 1em (was 12px)
- Document title: baseFontSize (was 13px)
- Document name: baseFontSize-2 (was 10px)
- Section header: baseFontSize-1 (was 11px)
- Delegate padding: 0.8em / 0.4em
- All spacing font-relative
2026-10-01 10:25:03 +02:00
Levi Neely 9e48a89c92 Use font-relative units instead of pixels
All spacing/margins now scale with baseFontSize:
- Table cell padding: 0.5em horizontal, 0.25em vertical
- Table margins: 0.75em
- Column spacing: 1.5em
- Code block margins: 0.5em
- Border radius: fontSize/3
- Left rule width: fontSize/6

Ensures proper display at any DPI/font size.
2026-10-01 10:23:20 +02:00
Levi Neely 09962cc800 Fix table rendering: left align, padding, nested Repeater scope
- Store tableData at Rectangle level to avoid scope issues
- Use ColumnLayout + RowLayout instead of GridLayout (cleaner nesting)
- Anchor left instead of center
- 8px margins, 16px column spacing
- Add ?? false fallback for hasHeader to prevent undefined errors
2026-10-01 10:21:09 +02:00
Levi Neely 30fa1bf35e Render org tables as styled grids
- Parse | delimited rows into cells
- Detect header separator (|---+---|)
- Header row: bold, text color
- Data rows: normal, placeholder color
- Same alternate background as code blocks
2026-10-01 10:19:15 +02:00
Levi Neely 17906c06f9 Render org src blocks as styled code blocks
- Parse body text into segments (text vs code)
- Src blocks get: monospace font, alternate background, rounded corners
- Language label shown above code (python, bash, etc.)
- Regular text keeps left rule indicator

Handles #+BEGIN_SRC lang ... #+END_SRC blocks.
2026-10-01 10:16:27 +02:00
Levi Neely 9e6dc589bd Fix Makefile install target
install depends on 'all' (which includes ui if Qt6 present)
instead of having broken split dependency lines
2026-10-01 10:12:53 +02:00
Levi Neely 43565ad1b6 Fix planning line stripping in section_body
- Use 'contains' instead of 'starts_with' to handle combined lines
  like 'SCHEDULED: <...> DEADLINE: <...>'
- Track 'seen_content' to strip planning/drawers only at the start
- Skip empty lines before content
- Continue stripping planning lines until real content appears
2026-10-01 10:10:45 +02:00
Levi Neely f5f2bffce4 Strip planning line and drawers from section body
section_body() now filters out:
- Leading planning line (SCHEDULED/DEADLINE/CLOSED)
- Property drawers (:PROPERTIES: ... :END:)
- Any other drawers (:LOGBOOK:, etc.)
- Leading/trailing blank lines

These are displayed separately in the UI.
2026-10-01 10:09:39 +02:00
Levi Neely ff48f9c7ee Remove Qt jargon from comments 2026-10-01 10:01:22 +02:00
Levi Neely 429c896f5a Add collapsible properties drawer
- PropertiesRole returns QVariantMap of key->value
- loadProperties() parses KEY=value lines from /properties file
- QML drawer shows ':PROPERTIES:' header with ▶/▼ toggle
- Properties shown as monospace :KEY: value pairs when expanded
- Drawer starts collapsed by default
2026-10-01 10:00:20 +02:00
Levi Neely eb3b174b12 Increase body text size and line height
Body text: baseFontSize + 1 (was baseFontSize)
Line height: 1.3 (was 1.15)
2026-10-01 09:47:56 +02:00
Levi Neely 7f948de2ab Use listDirs() instead of list() for section loading
list() returns files AND directories. Section entries are directories only.
Files like 'title', 'keyword', 'body' were being incorrectly treated as
child sections. Using listDirs() filters to directories only.
2026-10-01 09:40:03 +02:00
Levi Neely 350ce66860 Fix DocumentModel section loading
- loadSections: recursively load first, then populate childIds after
  all sections exist (checking parentId matches)
- Remove childIdsFor helper (dead code)
- Remove isSectionVisible (dead code)
2026-10-01 09:37:55 +02:00
Levi Neely fec815ac50 Fix path prefix in DocumentModel::loadDocument
9P paths need leading slash. loadSections was called with bare document
name (e.g., 'test') instead of '/test'.
2026-10-01 09:35:42 +02:00
Levi Neely 70ec9509a4 Replace TreeView with ListView for document outline
TreeView (inherits TableView) is designed for file browsers with fixed row
heights, not structured document editing. ListView gives us:
- Full control over row heights (implicitHeight just works)
- Simpler delegate without TreeViewDelegate quirks
- Manual indentation via leftMargin based on level
- Expansion state tracked in model with hasChildren/expanded roles
- Click-to-expand triangles for sections with children

DocumentModel changed from QAbstractItemModel (tree) to QAbstractListModel
(flat list) with sections ordered depth-first. Tree structure preserved via
level, parentId, childIds fields. Expansion state controls visibility.
2026-10-01 09:32:56 +02:00
Levi Neely 04425d9e9f Use rowHeightProvider for proper row sizing
TreeView (inherits TableView) defaults to fixed row heights. Setting
rowHeightProvider to return -1 tells it to use each delegate's
implicitHeight, enabling variable-height rows.
2026-10-01 09:29:35 +02:00
Levi Neely b0a4956d8f Fix row overlap in OutlineView
TreeViewDelegate doesn't auto-size from contentItem. Explicitly bind
implicitHeight to contentColumn.implicitHeight so rows size correctly.
2026-10-01 09:27:15 +02:00
Levi Neely 3d2edf1807 Fix system theme consistency
- In system mode, read palette from QGuiApplication::palette() rather
  than parsing kdeglobals (platform plugin already handles this)
- Don't call setPalette() in system mode — let Qt handle it
- Add isOverriding property for QML to check mode
- Use Fusion style by default for consistent palette respect
- Improved fallback logic in systemSchemePath() for dark/light detection
- Added /etc/xdg/kdeglobals as fallback for system-wide defaults
2026-10-01 09:15:31 +02:00
Levi Neely 5677be6236 Add font customization and UI scaling
ThemeManager now supports:
  - fontFamily, fontSize, fontStyle with full QFontDatabase access
  - uiScale (0.5x to 4.0x) saved to theme.conf
  - resetFont() to return to system defaults

SettingsDialog provides UI for:
  - Color scheme selection (all installed KDE schemes)
  - Font family/style/size with live preview
  - UI scale slider with percentage display

OutlineView uses pointSize (scalable) instead of pixelSize (fixed).
All font sizes derived from theme.fontSize or baseFontSize.
2026-10-01 09:11:45 +02:00
Levi Neely 64c7272f70 Add KDE color scheme support
ThemeManager reads .colors files from /usr/share/color-schemes and
~/.local/share/color-schemes (KDE standard locations). Supports:
  - 'system' mode: follows kdeglobals ColorScheme setting
  - explicit scheme name: forces specific scheme (BreezeDark, etc.)

QML now uses theme.* colors throughout instead of hardcoded Nord values.
Org-mode semantic colors (todoColor, doneColor, priorityAColor, etc.)
adjust automatically for dark/light themes.

Settings saved to ~/.config/orkmode/theme.conf
2026-10-01 09:08:15 +02:00
Levi Neely bc2130d5b1 Update Makefile to install all targets
- Add ork-server and orkmode (GUI) to install target
- Make UI build optional (only if Qt6 Qml available)
- Add ui target for explicit GUI build
- Clean ui/build directory on 'make clean'
- Update help text with requirements
2026-10-01 08:58:42 +02:00
Levi Neely ed73ae5cca Clean up docs and fix set_planning_field
- README: update CLI docs to reflect 9P client architecture
- README: update roadmap to reflect v0.3 progress (server, UI)
- AGENTS.md: update CLI examples and current limitations
- state.rs: rewrite set_planning_field to properly parse/rebuild
  planning lines (removes dead code, fixes replace logic)
2026-10-01 08:53:22 +02:00
Levi Neely e129f9ee94 Fix overlapping text in OutlineView
- Replace manual Item+anchoring with ColumnLayout for proper height calc
- Remove redundant bodyMeasure Text and bodyWidth property
- Add proper top/bottom margins using rowPad constant
- Body row now uses RowLayout with Layout.fillWidth
2026-10-01 08:50:52 +02:00
Levi Neely 71a89943ae Add v0.3 read-only Qt6/QML GUI (9P client)
A standalone Qt6/QML app in ui/ that speaks 9P to ork-server; no FFI,
no privileged path. All org logic stays in the server.

- p9client: minimal synchronous 9P2000 client over QTcp/QLocalSocket
- orkclient: QML-facing facade (read/list/listDirs/write/rdwr/docs)
- documentmodel: lazy QAbstractItemModel of the section tree, with a
  BodyRole that reads /<doc>/<id>/body (planning line + :PROPERTIES:
  drawer stripped, since those are shown as structural objects)
- Main.qml: document sidebar + outline; OutlineView.qml: folding
  TreeView rendering keyword/priority/title/tags/timestamps as distinct
  objects, with section body shown inline beneath each headline
- main.cpp: --addr/$ORK_ADDR, --selftest (headless outline dump),
  --shot (headless window grab for debugging)
- CMake build; binary emitted to bin/ to avoid the QML-module-URI vs
  target-name directory clash

Known issue: inline body layout still needs work (row sizing/overlap
when bodies wrap); to be iterated.
2026-10-01 02:02:53 +02:00
Levi Neely 33173bcc29 Remove dead orkmode-core (FFI) crate
Dropping the C FFI layer left orkmode-core unused: nothing in the
workspace depends on it, and the GUI will speak 9P instead. Delete the
crate, drop it from the workspace, and scrub FFI references from the
docs (README structure/usage, AGENTS structure/FFI/next-steps).
2026-09-30 22:27:50 +02:00
Levi Neely 7ee65a4a2d Update VISION to the 9P architecture and editing model
The vision predated the 9P pivot and the GUI direction. Correct it:

- Architecture: clients (GUI, CLI, Emacs/vim, agents) speak 9P to
  ork-server; drop the C FFI layer entirely.
- Replace "keyboard-first, mouse optional" with "the document is the
  control surface": actions live on objects, mouse and keyboard equal,
  no menu trees or button walls.
- Add an explicit Editing Model: structured render, per-section
  raw-text editing with reparse-on-commit, and direct-manipulation
  structural edits that each map to one 9P operation.
- Refresh milestones (v0.1 parser/CLI and v0.2 9P server/client done;
  GUI is next) and the rationale (add the "Why 9P" section).
2026-09-30 22:21:10 +02:00
Levi Neely 943c05b61c Add rm, mv, promote, demote, refile, archive, lint, query to ork
Client verbs for the new server capabilities, each a thin wrapper over
the base 9P operations: the structural verbs write to /ctl, and query
writes to /query and prints the matches.
2026-09-30 21:52:33 +02:00
Levi Neely 12869fb9f0 Add structural ops, query, lint, and real agenda views to ork-server
Rework /ctl into a self-describing dispatch table (name, desc, fn),
inspired by the ollie 9P server: an empty write or "help" lists the
verbs, and unknown verbs report the valid set.

New control verbs, each operating on a section subtree:
- rm: delete a section and its subtree
- move up|down: reorder among siblings
- promote/demote: shift the subtree's outline level
- refile <to-doc> [parent]: move a subtree across or within documents,
  re-leveling to the target depth
- archive: move a subtree to the companion <doc>.org_archive file
- lint [doc]: reparse and report per document

Add a root /query file (rdwr): write a tag:X+todo:Y+priority:Z match
expression, read back matching sections.

Implement the previously stubbed agenda today/week views with real date
filtering, using a dependency-free civil-date day-number calculation.

Subtree edits share span-based helpers (subtree_range, sibling_ranges,
shift_headline_levels, insert_at). Covered by unit tests.
2026-09-30 21:52:33 +02:00
Levi Neely 73c4eb6cff Add tag, prop, todo, and tree commands to ork
Four more friendly verbs, all pure compositions of the base 9P
operations against the existing namespace (no server change):

- tag <doc> <id> <tag> [--remove]: toggle a single tag, mirroring
  org-toggle-tag, instead of rewriting the whole tag list.
- prop <doc> <id> <key> [value] [--delete]: get, set, or delete one
  property, mirroring org-set-property, instead of the whole drawer.
- todo <doc> <id> [state]: set the keyword, or with no argument cycle
  to the next state following the /keywords sequence, like org-todo.
- tree <doc>: print the recursive section outline.

Each edit reads the relevant namespace file, modifies it, and writes it
back; all validate the section exists first for a clear error.
2026-09-30 21:40:39 +02:00