Skip to main content

Module storage

Module storage 

Source
Expand description

Workspace storage for jyn.

Jyn reuses joy-core’s generic YAML primitives (store::write_yaml, store::read_yaml) and ID helpers (item_filename, title_hash_suffix) to operate on .jyn/ without duplicating IO logic or requiring changes to joy-core. See docs/dev/Architecture.md.

Constants§

ACRONYM
ITEMS_DIR
JYN_DIR

Functions§

delete_task
Delete a task by ID. Returns the deleted task.
ensure_items_dir
Create .jyn/items/ if missing. Idempotent.
find_task_file
Find the file for a task ID. Accepts the display short form (#A1, A1), the ADR-027 short form (TODO-00A1), or the full form (TODO-00A1-EA). Returns an error if the ID is ambiguous or missing.
find_workspace_root
Walk up from start to the nearest directory that contains a .jyn/ subdirectory, and return that directory (the workspace root). Mirrors how git and joy locate their data dir, so running jyn from a subdirectory still finds the workspace above it. Returns None when no .jyn/ exists between start and the filesystem root; callers then fall back to start so a first jyn add creates .jyn/ there.
items_dir
jyn_dir
load_task
Load a single task by its full or short ID.
load_tasks
Load all tasks from .jyn/items/, sorted by filename.
next_id
Generate the next ID in the form TODO-XXXX-YY (ADR-027).
save_task
Write a task to .jyn/items/{ID}-{slug}.yaml.
update_task
Overwrite a task on disk. If the title changed and produced a new filename (slug-derived), the old file is removed.