Commit Graph

66 Commits

Author SHA1 Message Date
ruohki 5759ec83e6 feat(quick-3): add ureq dep, allowed_remote_domains config, and fetch_remote_markdown
- Add ureq = "2.12" to Cargo.toml for synchronous HTTP fetching
- Add allowed_remote_domains: Vec<String> field to Config struct with serde default
- Add RemoteDocument enum with Loaded/DomainNotAllowed/FetchError/NotMarkdown variants
- Add fetch_remote_markdown() with domain whitelist, 10s timeout, content-type validation, 5MB body limit
2026-03-01 13:12:27 +01:00
ruohki eb1c7866ce docs(quick-3): plan remote markdown page linking with domain whitelist 2026-03-01 13:10:39 +01:00
ruohki 1752554cf6 docs(quick-2): demo vault content with ASCII art splash and feature pages 2026-03-01 11:58:14 +01:00
ruohki 4464774c7a content: create demo vault with splash art and feature showcase pages
8 files: index.md with wiki-links, features overview, navigation guide,
markdown showcase (all constructs), about page, changelog, and two
guides (sysop handbook, writing content) in a subdirectory. Includes
ANSI art splash.txt for the index page header.
2026-03-01 11:58:01 +01:00
ruohki f3d787a2b7 docs(quick-1): arrow key navigation and directory description column 2026-03-01 11:40:12 +01:00
ruohki 2d1e01821c docs(quick-1): complete arrow key navigation and directory description plan 2026-03-01 11:39:38 +01:00
ruohki f0ec2edc53 feat(quick-1): add arrow key navigation and directory descriptions
- Add bare Left arrow key as alias for navigate_back (same as Backspace)
- Add bare Right arrow key as alias for navigate_forward (same as Alt+Right)
- Update handle_key doc comment to list new Left/Right bindings
- Add description field to DirEntry struct in vault.rs
- Add extract_frontmatter_description() to parse YAML frontmatter
- Populate description from frontmatter in list_vault_files()
- Show descriptions in DarkGray beside file entries in build_directory_lines()
- Truncate descriptions to keep total line width within 78 chars
- Link span_len covers only [name] portion, not the description
2026-03-01 11:38:50 +01:00
ruohki 67509c3863 docs(quick-1): plan arrow key navigation and directory descriptions 2026-03-01 11:37:19 +01:00
ruohki 2e0c9d2277 docs(04-03): complete live reload plan — project complete
- Create 04-03-SUMMARY.md documenting FileWatcher integration
- Update STATE.md: Phase 4 COMPLETE, project COMPLETE, 100% progress
- Update ROADMAP.md: 04-03 checked, Phase 4 3/3 Complete with date
- Update REQUIREMENTS.md: LIVE-01, BBS-01, BBS-02 marked complete
2026-03-01 11:30:37 +01:00
ruohki f3133dd8dc feat(04-03): initialize FileWatcher in main.rs and wire App constructor
- Create FileWatcher watching index.md's parent directory before App::new()
- Pass file_watcher Option to App::new() as seventh argument
- Watcher failure is non-fatal: prints warning and passes None to App
2026-03-01 11:27:15 +01:00
ruohki a44c9ccb28 feat(04-03): add FileWatcher struct and integrate into event loop
- Add FileWatcher struct with RecommendedWatcher, mpsc channel, and rewatch() method
- Add file_watcher and pending_reload_at fields to App struct
- Update App::new() to accept Option<FileWatcher> parameter
- Add reload_current_document() preserving scroll and link selection
- Add rewatch_for_current_page() to re-point watcher on navigation
- Integrate try_recv() drain loop in event loop (non-blocking)
- Add 300ms debounce timer that fires reload after last relevant event
- Call rewatch_for_current_page() in navigate_to/back/forward/to_directory
2026-03-01 11:26:30 +01:00
ruohki 5a083238b2 docs(04-02): complete directory listing plan
- 04-02-SUMMARY.md created with full deviations, decisions, and dependency graph
- STATE.md updated: position to plan 2/3, decisions, session continuity, metrics
- ROADMAP.md updated: phase 4 progress 2/3 plans complete
- REQUIREMENTS.md: LIVE-02 marked complete
2026-03-01 11:19:21 +01:00
ruohki 600b46a83b feat(04-02): wire virtual directory listing page with history and Tab-cycling
- navigate_to_directory() builds tree view via list_vault_files() + build_directory_lines()
- follow_selected_link() routes __directory__ sentinel to navigate_to_directory()
- navigate_back/forward regenerate directory listing fresh when target_path == __directory__
- handle_resize() skips re-render for directory pages (fixed-width text, no markdown)
- build_directory_lines() emits yellow-bold dirs and cyan bracketed file links with LinkRecord
2026-03-01 10:58:14 +01:00
ruohki fe69cf5fab feat(04-02): add [[Directory]] sentinel and list_vault_files() to vault.rs
- resolve_wiki_link() returns PathBuf::from("__directory__") for case-insensitive 'directory' target
- DirEntry struct with depth, name, is_dir, vault_path fields
- list_vault_files() using WalkDir::new().sort_by_file_name() for alphabetical tree
- Skips hidden entries (leading '.') and non-.md files silently
2026-03-01 10:56:48 +01:00
ruohki 9b12d4beee docs(04-01): complete splash screen and file metadata plan 2026-03-01 10:55:42 +01:00
ruohki 27139cf7cd feat(04-01): wire splash prepend and file metadata to status bar
- Add PageMeta struct and read_page_meta() to app.rs with Gregorian date math
- App::new() computes initial page_meta from vault path + current_path
- navigate_to/back/forward all prepend splash lines and offset link_records for index.md
- handle_resize re-prepends splash for index.md after re-render
- Initial index.md load in main.rs prepends splash and adjusts link_records
- Status bar right side now shows 'Last modified: Mon DD, YYYY | X.X KB'
- Graceful truncation loop drops metadata fields when status bar is too narrow
2026-02-28 23:49:21 +01:00
ruohki 6aa5a940f2 chore(04-01): add Phase 4 deps and create splash module
- Add notify = "6.1", ansi-to-tui = "8.0", walkdir = "2.5" to Cargo.toml
- Create src/splash.rs with load_splash() using IntoText trait
- Add mod splash to main.rs module declarations
- Verified single ratatui-core v0.1.0 in dependency tree
2026-02-28 23:46:45 +01:00
ruohki 6d03979ddd docs(04): create phase plan 2026-02-28 23:41:11 +01:00
ruohki 13f14ae88e docs(04): research phase domain 2026-02-28 23:33:45 +01:00
ruohki b8b13828fd docs(04): capture phase context 2026-02-28 23:23:58 +01:00
ruohki 17afa969e8 docs(phase-3): complete phase execution 2026-02-28 23:15:53 +01:00
ruohki 2c9ad682da docs(03-02): complete navigation, history, and breadcrumb status bar plan
- Create 03-02-SUMMARY.md documenting HistoryEntry, navigate_to/back/forward, Tab-cycling, breadcrumb
- Update STATE.md: Phase 3 complete, plan 2/2 done, decisions added, session updated
- Update ROADMAP.md: Phase 3 marked complete, 2/2 plans checked
- Mark requirements NAV-03, NAV-04, NAV-11 complete in REQUIREMENTS.md
2026-02-28 23:12:39 +01:00
ruohki d705313aae feat(03-02): add navigation history, link cycling, and navigate_to to App
- Add HistoryEntry struct with path, scroll_offset, selected_link fields
- Add Phase 3 navigation fields to App: history, history_index, link_records, selected_link, current_path
- Update App::new() to accept link_records and current_path parameters
- Implement navigate_to() with browser-style forward history truncation
- Implement navigate_back() and navigate_forward() with state restoration
- Implement follow_selected_link() for wiki-link and standard link resolution
- Implement select_next_link() and select_prev_link() with wrap-around
- Implement scroll_to_selected_link() for auto-scroll centering
- Add Tab, Shift-Tab, Enter, Backspace, Alt+Left, Alt+Right key bindings
- Update handle_resize() to capture and validate link_records after re-render
- Update main.rs to destructure link_records and pass to App::new()
- Remove #[allow(dead_code)] on config field (now actively used)
2026-02-28 23:10:23 +01:00
ruohki 8ea4545c9b docs(03-01): complete link record extraction and wiki-link resolution plan
- 03-01-SUMMARY.md: documents LinkRecord struct, render_markdown signature change,
  resolve_wiki_link algorithm, is_within_vault guard, and all decisions
- STATE.md: advance to Phase 3 Plan 2, update progress to 75%, add 3 decisions,
  mark NAV path traversal blocker resolved
- ROADMAP.md: update phase 3 plan progress (1 of 2 summaries)
- REQUIREMENTS.md: mark NAV-01, NAV-02, NAV-10 complete
2026-02-28 23:06:30 +01:00
ruohki f2604d6429 feat(03-01): add wiki-link resolution and path traversal guard to vault.rs
- Add is_within_vault() with canonicalize + starts_with path traversal guard
- Add resolve_wiki_link() with case-insensitive multi-strategy matching
  (hyphens first, then underscores, then literal spaces per locked decision)
- Support subpath wiki-links: [[guides/Getting Started]] -> guides/getting-started.md
- Add resolve_standard_link() for inline [text](path.md) link resolution
  relative to the current document's directory within the vault
- All resolution functions guarded by is_within_vault() to prevent traversal
2026-02-28 23:04:27 +01:00
ruohki a63f4115f9 feat(03-01): extend renderer with LinkRecord extraction and link styling
- Add LinkRecord struct (line_index, col_offset, span_len, dest, is_wiki)
- Add PendingLink and PendingLinkRecord helpers in RenderState
- Enable ENABLE_WIKILINKS option in pulldown-cmark parser
- Handle Tag::Link Start: compute col_offset, determine broken wiki-link style
- Handle TagEnd::Link: compute span_len, enqueue PendingLinkRecord
- Update flush_line() to finalize pending link records with line_index
- Update render_markdown() signature to return (Vec<Line>, Vec<LinkRecord>)
- Add vault_path: Option<&Path> parameter for render-time broken link detection
- Update app.rs handle_resize and main.rs call sites to destructure tuple
- Wiki-links render as [Text] in LightCyan; broken wiki-links in Red+CROSSED_OUT
2026-02-28 23:04:20 +01:00
ruohki cf58e31bcb docs(03): create phase plan 2026-02-28 22:54:12 +01:00
ruohki b8bce79ef6 docs(03): research phase navigation and links 2026-02-28 22:47:45 +01:00
ruohki f3f77873d2 docs(state): record phase 3 context session 2026-02-28 22:39:54 +01:00
ruohki 8adc004691 docs(03): capture phase context 2026-02-28 22:39:38 +01:00
ruohki 9115a01b1f docs(phase-2): complete phase execution 2026-02-28 22:30:50 +01:00
ruohki 539efdc202 docs(02-03): complete app integration plan — Phase 2 all 3 plans done
- Create 02-03-SUMMARY.md documenting DocumentState, scrolling, status bar, error screen
- Update STATE.md: Phase 2 complete, 6 total plans, Phase 3 next
- Update ROADMAP.md: Phase 2 all 3 plans SUMMARY present, marked Complete
- Mark NAV-05, NAV-08, NAV-09 requirements complete in REQUIREMENTS.md
2026-02-28 22:26:19 +01:00
ruohki ddf9ebc42f feat(02-03): wire main.rs with highlighter init, vault loading, and renderer
- Add highlighter::init_highlighter() call before render_markdown()
- Load index.md via vault::load_document() with proper VaultDocument matching
- Query terminal size before terminal init for initial render width
- Render markdown via renderer::render_markdown() passing content and width
- Pass raw content string to App::new() for resize re-rendering
- Update App::new() call with all 4 arguments (is_login_shell, config, doc, raw)
- All 7 modules declared: app, config, highlighter, renderer, signals, terminal, vault
2026-02-28 22:24:00 +01:00
ruohki 9cdfc6b2c4 feat(02-03): rework app.rs with document display, scrolling, status bar, error screen
- Add DocumentState enum (Loaded/Missing/Error) for vault document state
- Extend App struct with document, scroll_offset, raw_content, filename, last_content_height
- Update App::new() signature to accept DocumentState and raw_content
- Replace Phase 1 placeholder draw() with content area + status bar layout
- Implement draw_status_bar() with reverse-video, filename left, hints right
- Implement draw_error_screen() BBS box-drawing error widget (red borders)
- Add j/k/Down/Up (1-line) and PgDn/PgUp (page) scroll key bindings
- Add handle_resize() for re-rendering markdown at new terminal width
- Preserve all Phase 1 quit behavior (double Ctrl+C, q key, login shell mode)
2026-02-28 22:23:52 +01:00
ruohki b6069d90e5 docs(02-02): complete markdown renderer plan — REND-01 through REND-10 satisfied
- 02-02-SUMMARY.md: documents render_markdown() pipeline, code block borders, GFM table grid, decisions, deviations
- STATE.md: advance to plan 02 done, update decisions log (02-02 entries), resolve REND Widget trait blocker
- ROADMAP.md: mark 02-02 complete (2/3 plans done for Phase 2)
2026-02-28 22:20:35 +01:00
ruohki 8690d2a857 feat(02-02): add code block borders with syntax highlighting and GFM table grid
- emit_code_block: ╭─ {lang} ─╮ / │ content │ / ╰──╯ rounded borders; lang label in Yellow; content via highlight_code()
- emit_table: ┌┬┐├┼┤└┴┘ full box-drawing grid; bold LightCyan header row; Left/Right/Center cell alignment
- Rename stub methods to emit_code_block_now / emit_table_now (clean naming; delegates to full emitters)
- Remove unused push_fg / push_fg_mod helper methods
- cargo check passes; 19 expected dead_code warnings (modules wired in Plan 03)
2026-02-28 22:18:31 +01:00
ruohki 9e6f79c233 feat(02-02): build core markdown renderer with inline and block elements
- Create src/renderer.rs with public render_markdown(input, width) -> Vec<Line<'static>>
- Implement RenderState with style stack, blockquote depth, list counters, table two-pass collection
- Handle all inline elements: headings H1-H6 (CGA colors + H1/H2 decorators), bold, italic, inline code
- Handle block elements: paragraphs, lists (ordered/unordered/nested with •/◦/▪), blockquotes with │ prefix, horizontal rules, images as [IMAGE: alt] placeholders
- Stub emit_code_block and emit_table delegate to full implementations (Task 2)
- Add mod highlighter, renderer, vault declarations to main.rs (wiring for Plan 03)
- cargo check passes clean (19 dead_code warnings expected — modules unwired until Plan 03)
2026-02-28 22:17:28 +01:00
ruohki af0fe03f12 docs(02-01): complete vault core and highlighter foundation plan
- Add 02-01-SUMMARY.md with full execution record and deviation documentation
- Update STATE.md: Phase 2 Plan 1 complete, resume at 02-02-PLAN.md
- Update REQUIREMENTS.md: mark REND-03, REND-10, NAV-06, NAV-07 complete
2026-02-28 22:14:20 +01:00
ruohki 8d45a7c263 feat(02-01): add syntax highlighter module with CGA color mapping
- Create src/highlighter.rs with OnceLock-based one-time syntect initialization
- Implement init_highlighter(), syntax_set(), theme_set() accessors
- Implement syntect_color_to_cga() with Euclidean RGB-to-CGA 16-color quantization
- Implement highlight_code() returning Vec<Line<'static>> using base16-ocean.dark theme
- LinesWithNewlines iterator preserves newlines for syntect grammar correctness
- Module verified to compile cleanly (tested via temporary mod registration)
2026-02-28 22:12:53 +01:00
ruohki 7622d41496 feat(02-01): add Phase 2 deps and vault file-loading module
- Add pulldown-cmark 0.13.1, syntect 5.3 (default-fancy), syntect-tui 3.0 to Cargo.toml
- Create src/vault.rs with VaultDocument enum (Loaded/Missing/ReadError variants)
- Implement load_document() using std::fs::read_to_string with structured error mapping
- cargo check passes with all new dependencies resolved
2026-02-28 22:11:55 +01:00
ruohki ae379b62f6 docs(02): create phase plans (3 plans, 3 waves) 2026-02-28 22:08:57 +01:00
ruohki ab71c42c6b docs(02): create phase plan 2026-02-28 22:02:14 +01:00
ruohki 24f11f39be docs(02): research vault core and rendering phase 2026-02-28 21:55:13 +01:00
ruohki 7222543d4c docs(02): capture phase context 2026-02-28 21:44:22 +01:00
ruohki 88f665a095 test(01): complete UAT - 8 passed, 0 issues 2026-02-28 21:35:20 +01:00
ruohki b81b893661 fix(terminal): switch to alternate screen buffer for clean exit
TUI frame was left in terminal after exit. Use EnterAlternateScreen/
LeaveAlternateScreen so exiting restores the original terminal content.
2026-02-28 21:35:01 +01:00
ruohki 240ae4aace test(01): complete UAT - 7 passed, 1 issue 2026-02-28 21:32:29 +01:00
ruohki 90dc4882ae docs(phase-1): complete phase execution 2026-02-28 21:24:04 +01:00
ruohki d9db04fb01 docs(01-03): complete app event loop and Phase 1 wiring plan
- 01-03-SUMMARY.md: documents App struct, event loop, double-Ctrl+C state machine, main.rs pipeline
- STATE.md: Phase 1 complete, 3/3 plans done, Phase 2 next, 01-03 decisions recorded
- ROADMAP.md: Phase 1 marked Complete (3 plans / 3 summaries)
- REQUIREMENTS.md: SHEL-01 marked complete
2026-02-28 21:20:02 +01:00
ruohki 771c9a8561 feat(01-03): wire complete startup-to-shutdown pipeline in main.rs
- All four modules declared: mod app, config, signals, terminal
- Pre-terminal phase: login shell detection, CLI parse, config load
- Terminal phase: panic hook installed first, then signals, then terminal init
- Event loop: App::new receives is_login_shell and app_config; run_event_loop runs
- Shutdown: restore_terminal() called before show_goodbye() in all exit paths
- BrokenPipe from event loop exits silently (LIFE-04)
- Unexpected I/O errors logged to stderr after terminal restore
2026-02-28 21:17:56 +01:00