Commit Graph

13 Commits

Author SHA1 Message Date
Levi Neely 623aef4f42 Fix phantom namespace nodes and child section insertion
Dynamic child resolvers returned Some for any name, fabricating phantom
document and section directories so walks to nonexistent paths appeared
to succeed. Validate existence and return None instead:
- root resolver checks get_doc
- document resolver checks new OrkState::section_exists
- section resolver checks child_ids

Also fix create_child_section, which corrupted the org file:
- find_section_end used the parent's headline-end offset, inserting the
  child before the parent's PROPERTIES/ID drawer and detaching its ID.
  Use section.span.end, which covers planning, drawer, body, children.
- The child headline was written verbatim; demote it to parent.level + 1
  via the new restar helper.

Add regression tests for restar and child section nesting.
2026-09-30 21:28:52 +02:00
Levi Neely 17f4caa37f Add write handlers for section properties
- set_section_keyword/priority/title/tags
- set_section_scheduled/deadline/closed
- set_section_properties/body
- rebuild_headline helper for atomic headline updates
- Fixed replace_headline to preserve DEADLINE/:PROPERTIES: lines
- Clear read cache on write in 9P server

All writes tested working via 9p client.
2026-09-30 16:09:44 +02:00
Levi Neely 94862b7f26 Add 9P client to ork-cli
Simple 9P2000 client supporting:
- Connect via Unix socket or TCP
- read/write/rdwr operations
- Directory listing

Preparation for reworking CLI to use 9P server.
2026-09-30 15:11:10 +02:00
Levi Neely 9e2fcb9010 Add 9P2000 server implementation
- p9.rs: Full 9P2000 protocol handler
  - Tversion/Tattach/Twalk/Topen/Tread/Twrite/Tclunk/Tstat
  - Directory listing with stat encoding
  - File read/write with buffering
  - Rdwr support for command files

- ork-server binary:
  - TCP or Unix socket listener
  - Threaded connection handling
  - Usage: ork-server -a unix:///tmp/ork.sock ~/org

Tested with plan9port 9p client - read/write/ls all working.
2026-09-30 15:09:59 +02:00
Levi Neely 96f89acd65 Add complete section properties to 9P namespace
Section files now include:
- level (read-only): headline level 1-6
- scheduled: SCHEDULED timestamp
- deadline: DEADLINE timestamp
- closed: CLOSED timestamp
- properties: key=value lines from property drawer
- body: section content (text between headline and first child)

All timestamp fields use org-mode format: <YYYY-MM-DD Day HH:MM +repeat>
2026-09-30 14:16:18 +02:00
Levi Neely 6bb2994dff Add section creation with UUID IDs
- new file at root: create org file
- new file at doc level: create top-level section
- new file at section level: create child section
- All created sections get UUID in :ID: property
- body file added to doc (alias for raw)
- Test for section creation via 9P namespace
2026-09-30 10:41:19 +02:00
Levi Neely 246bd9bb5a Add ork-server crate with virtfs EDSL
- virtfs: Declarative filesystem EDSL (port of ollie's pattern)
  - dir(), file(), each(), dir_dynamic() constructors
  - read(), write(), rdwr(), rw() handlers
  - FsNode with walk(), list(), read(), write()

- state: OrkState manages parsed documents
  - Scans org directory, parses on load
  - Section ID from CUSTOM_ID > ID > slugified title
  - Read/write document content

- namespace: 9P namespace builder
  - ctl, idx, keywords at root
  - agenda/todos, agenda/today, agenda/week
  - {doc}/ with raw, meta, and sections
  - {section}/ with headline, title, keyword, priority, tags
  - Nested children for subsections
2026-09-30 10:31:11 +02:00
Levi Neely 0c5f56aad9 Revise 9P design: nested hierarchy, EDSL sketch
- Sections nest as directories mirroring org structure
- One file per property (title, keyword, tags, etc.)
- ID from CUSTOM_ID > ID > slug+hash
- EDSL pattern from ollie's virtfs for declarative namespace
2026-09-30 10:25:47 +02:00
Levi Neely 030ac3beeb Add 9P server design doc (draft)
Documents design options for:
- Section hierarchy (nested vs flat)
- Property granularity (per-file vs structured)
- Change notification
- Write semantics
- Agenda/query views

Needs decisions before implementation.
2026-09-30 10:05:18 +02:00
Levi Neely 7e24a9cf02 Implement property/tag writes, timestamp formatting, add tests
- property command: set/delete properties in property drawer
- tag command: add/remove tags on headlines
- Timestamp formatting: agenda shows actual dates instead of 'set'
- Added 17 unit tests for parser (headlines, TODOs, tags, planning, etc.)
2026-09-30 09:52:14 +02:00
Levi Neely 320fda7acc Add Makefile
Targets: build, install, uninstall, test, check, fmt
Installs to ~/.local/bin by default
2026-09-30 09:46:41 +02:00
Levi Neely 6f3cc0578d Add VISION.md and AGENTS.md
VISION.md: Project goals, design principles, architecture, milestones
AGENTS.md: AI agent guidelines for working on the codebase
2026-09-30 09:45:38 +02:00
Levi Neely 14fc3233e9 Initial commit: org-mode parser and CLI
- org-ast: AST types for org documents
- org-parser: tree-sitter based parser
- orkmode-core: library + C FFI
- ork-cli: directory-aware CLI tool

CLI operates on directories by default, supports -R for recursive.
2026-09-30 09:43:21 +02:00