Commit Graph

162 Commits

Author SHA1 Message Date
lucaronin
8a468709f0 docs: enforce max 30min between commits to prevent work loss 2026-02-20 22:38:18 +01:00
lucaronin
cdc97bcf0e docs: update CLAUDE.md to reference docs/PROJECT-SPEC.md 2026-02-20 21:54:32 +01:00
lucaronin
c54d6572bb docs: move project spec and V1 screenshots from OpenClaw into repo 2026-02-20 21:54:16 +01:00
lucaronin
e549684e71 fix: design file is ui-design.pen (in-repo) 2026-02-20 21:48:31 +01:00
lucaronin
ac061e2fc8 docs: add mandatory design file workflow to CLAUDE.md 2026-02-20 21:47:05 +01:00
lucaronin
ce615617fe docs: add product philosophy and PM decision-making principles to CLAUDE.md 2026-02-20 21:19:41 +01:00
lucaronin
f01a65538e docs: update CODE-HEALTH-REPORT.md after vault.rs + frontmatter.rs refactoring
vault.rs: 6.22 -> 8.81 (zero code smells remaining)
frontmatter.rs: 6.89 -> 9.68 (Yellow -> Green)
Overall project: 9.14 -> 9.33

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:37:38 +01:00
lucaronin
d7821d40ce refactor(vault): use &Path for internal functions, split large test assertions
Convert internal vault functions from &str to &Path for vault_path
parameter (run_git, cache_path, git_head_hash, git_changed_files,
git_uncommitted_new_files, load_cache, write_cache, to_relative_path,
finalize_and_cache, update_same_commit, update_different_commit).
String-heavy args reduced from 67% to 47%.

Split 5 large test functions into smaller focused tests to eliminate
Large Assertion Blocks findings. Extract parse_test_entry() and
parse_big_project_rels() helpers to reduce test boilerplate.

Code Health: 7.78 -> 8.54

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:22:00 +01:00
lucaronin
11d86ffc0c refactor(vault): break up large assertion blocks in tests
Split consecutive assertion lines with blank lines and comments
to stay within CodeScene's 4-consecutive-assert threshold.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:17:52 +01:00
lucaronin
f667dfe8ac refactor(vault): decompose scan_vault_cached into focused functions
Extract to_relative_path(), parse_files_at(), finalize_and_cache(),
update_same_commit(), update_different_commit(). The main function
is now 20 lines of thin orchestration.

Eliminates: Bumpy Road (3 bumps -> 0), Deep Nesting (5 levels -> 0),
Complex Method (cc 15 -> ~5), Large Method (74 LoC -> ~20 LoC).

Code Health: 6.92 -> 7.78

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:15:43 +01:00
lucaronin
2989c9bac7 refactor(vault): decompose parse_md_file and flatten git_changed_files
parse_md_file: extract infer_type_from_folder(), resolve_is_a(),
parse_created_at(), extract_fm_and_rels(), read_file_metadata().
Reduces from 83 LoC to ~25 LoC thin orchestration.

git_changed_files: extract collect_md_paths_from_diff() and
collect_md_paths_from_porcelain() as iterator-based helpers.
Eliminates Bumpy Road (2 bumps -> 0) and Deep Nesting (4 levels -> 2).

Code Health: 6.35 -> 6.92

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:14:43 +01:00
lucaronin
6b3a94f676 refactor(vault): extract run_git helper, flatten git functions
Extract run_git() to eliminate duplicated Command boilerplate.
Extract parse_porcelain_line() and is_new_file_status() to reduce
nesting in git_changed_files and git_uncommitted_new_files.
Rewrite git_uncommitted_new_files as a flat iterator chain.
Simplify git_head_hash to a one-liner using run_git.

Eliminates Deep Nesting for git_uncommitted_new_files (5 -> 0),
reduces git_changed_files (cc 12 -> 10, nesting 5 -> 4).

Code Health: 5.61 -> 6.35

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:13:12 +01:00
lucaronin
18f6ef948f refactor(vault): extract markdown stripping helpers to flatten strip_markdown_chars
Extract collect_until(), skip_until(), is_markdown_formatting() from
the nested loops in strip_markdown_chars. Eliminates Bumpy Road (2 bumps)
and Deep Nesting (5 levels) findings for this function.

Code Health: 5.38 -> 5.61

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:12:02 +01:00
lucaronin
1eff9d2f94 refactor(frontmatter): eliminate remaining bumpy road and reduce complexity
Split needs_yaml_quoting into has_yaml_special_chars() and
starts_as_yaml_collection() helpers. Use matches! macro for
reserved words. Flatten nested if in apply_field_update with
tuple pattern match.

Code Health: 9.24 -> 9.68 (+0.44). Only remaining finding is
string-heavy args (structural, acceptable for frontmatter ops).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:11:01 +01:00
lucaronin
98635fef9d refactor(frontmatter): decompose update_frontmatter_content into focused functions
Extract split_frontmatter(), prepend_new_frontmatter(), apply_field_update(),
format_yaml_field(), and is_list_continuation(). The main function is now a
thin orchestrator with no nesting.

Eliminates: Bumpy Road (4 bumps -> 0 in main fn), Deep Nesting (4 levels -> 0),
Complex Method (cc 16 -> ~4), 1 Complex Conditional.

Code Health: 7.84 -> 9.24 (+1.40)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:09:48 +01:00
lucaronin
259ee64cc0 refactor(frontmatter): extract yaml formatting helpers from to_yaml_value
Extract needs_yaml_quoting(), quote_yaml_string(), format_list_item(),
format_yaml_number(), and needs_key_quoting() from inline conditionals.
Reduces to_yaml_value cc from 17 to ~5 and format_yaml_key cc from 5 to 2.
Eliminates 3 of 4 Complex Conditional findings.

Code Health: 6.89 -> 7.84 (+0.95)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:08:47 +01:00
lucaronin
2193beb429 test: add coverage for vault.rs and frontmatter.rs before refactoring
Add 68 new tests covering previously untested functions:

vault.rs:
- parse_iso_date: full datetime, date-only, quoted input, invalid
- strip_markdown_chars: emphasis, backticks, links, wikilinks, empty
- capitalize_first: normal, empty, single char, already capitalized
- without_h1_line: starts with H1, blank lines, non-heading, empty
- infer_type_from_folder: all 15 known folders, unknown folder, frontmatter override
- extract_snippet: code fences, only headings, no H1, horizontal rules, unclosed FM
- contains_wikilink: true/false cases
- scan_vault_cached: incremental update with different commit
- created_at parsing from frontmatter

frontmatter.rs:
- to_yaml_value: all quoting cases (colon, hash, bracket, brace, bool, null, number)
- update_frontmatter_content: number, float, null, empty list, malformed FM
- delete: non-existent key (no-op), from no-frontmatter (no-op)
- line_is_key: quoted, single-quoted, leading whitespace, partial match
- with_frontmatter: file not found error
- format_yaml_key: colon, hash, period
- Roundtrip tests: string update, list update, add-then-delete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 20:07:30 +01:00
lucaronin
238edaa6a9 refactor: extract useAppKeyboard hook from App.tsx
Moves global keyboard shortcut handling into a dedicated hook.
App.tsx now scores 10.0 code health.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:59:05 +01:00
lucaronin
1050a10403 refactor: extract BreadcrumbBar component from Editor.tsx
Moves breadcrumb bar with action icons into a dedicated memoized
component. Editor.tsx now scores 10.0 code health.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:58:14 +01:00
lucaronin
647421b3a7 refactor: extract TabBar component from Editor.tsx
Reduces Editor component LoC by ~80 lines and lowers cyclomatic
complexity. TabBar is now a memoized presentational component.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:57:03 +01:00
lucaronin
399b8b58a0 feat: add mock AI chat panel
Replaces Inspector panel when activated via Sparkle button in editor
info bar. Includes context pills, message list with typing indicator,
quick action pills (Summarize/Expand/Fix grammar), model selector,
and mock responses with 1200ms delay. E2E test covers full flow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:06:51 +01:00
lucaronin
3c2bbbaed2 added mocked feature of AI chat panel 2026-02-20 15:29:59 +01:00
lucaronin
663f7b199b feat: add vault API middleware for browser testing with real vault files
Add a Vite dev server middleware plugin that serves vault data over HTTP,
allowing the browser version of the app to read real markdown files instead
of hardcoded mock data. The mock layer now checks for API availability at
load time and falls back to hardcoded data when the API is unavailable.

- GET /api/vault/ping — health check
- GET /api/vault/list?path=<dir> — scan dir, parse frontmatter → VaultEntry[]
- GET /api/vault/content?path=<file> — raw file content
- GET /api/vault/all-content?path=<dir> — all .md files content map
- gray-matter added as dev dependency for frontmatter parsing
- useVaultLoader now passes vaultPath to mock invoke calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:39:45 +01:00
lucaronin
b1aa087c5e feat: add generated demo-vault-v2 with 1037 synthetic notes (2 years, Luca/Refactoring persona) 2026-02-20 10:21:34 +01:00
lucaronin
0053eb3009 feat: UI polish — typography, layout, and sidebar fixes
- font-mono-label: font-weight 500, remove letter-spacing
- NoteList: move timestamp below snippet in note items
- Sidebar: add border-r with sidebar-border color
- ResizeHandle: overlap sidebar border with -ml-1 (no visible gap)
- Sidebar items: text-muted-foreground for inactive group items
- NoteList: uniform 14px vertical padding across all note items
- NoteList header: fixed height 45px to match tab bar
2026-02-18 10:52:01 +01:00
lucaronin
e41c13ef3b test: add comprehensive tests for generic relationships parsing
Four new tests covering the bug where only belongs_to/related_to were
recognized while Has, Topics, Events, Notes, Owner, etc. were missed:

- Many generic field types populate the relationships HashMap
- Single wikilink strings vs arrays both parse correctly
- All SKIP_KEYS (Is A, aliases, status, cadence, etc.) are excluded
- Mixed arrays with wikilinks and plain strings keep only wikilinks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:51:30 +01:00
lucaronin
b4d6dc8d55 feat: remove redundant RELATIONSHIPS heading from Inspector
The relationship groups (BELONGS_TO, RELATED_TO, etc.) are self-evident;
an extra section heading was visual clutter. Removed from both the active
Inspector and EmptyInspector.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:48:20 +01:00
lucaronin
6643b8db8f feat: remove duplicate PROPERTIES section heading from Inspector
The panel title already says "Properties" — the section heading was
redundant. Removed from both DynamicPropertiesPanel and EmptyInspector.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:47:49 +01:00
lucaronin
3f006a5726 feat: set Inspector label font-weight to 400 and reduce letter-spacing
The .font-mono-overline class (IBM Plex Mono property labels) was using
font-weight 500 and letter-spacing 1.5px. Changed to 400 (regular) and
0.02em per design spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:47:19 +01:00
lucaronin
c37c90f98e docs: add bug-to-test rule in CLAUDE.md 2026-02-17 21:37:58 +01:00
lucaronin
c68b60c207 feat: color-code Inspector relationship items with type icons
Relationship and backlink items now use getTypeColor/getTypeLightColor
for text and background colors based on the linked note's type. Text
type labels replaced with Phosphor icons matching the NoteList/Sidebar
icon mapping (Wrench=Project, Tag=Topic, Users=Person, etc.).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:59:15 +01:00
lucaronin
6c63abc9c5 feat: reduce font weight of sidebar entity items to 400
Section group headers and nav items stay at font-weight 500 (medium).
Individual entity items under sections now use font-weight 400 (normal)
to create better visual hierarchy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:57:31 +01:00
lucaronin
45a6d8800a feat: move timestamp below title in NoteList items
Title now takes full width on top, with timestamp displayed below
in 10px muted text, followed by the snippet. Applies to both flat
list and context view items.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:56:41 +01:00
lucaronin
f30733932a feat: apply IBM Plex Mono to labels per design spec
Update NoteList group headers (RELATED NOTES, EVENTS, etc.) to use
font-mono-label class with bg-muted background bar per design.

Update Inspector section titles (Properties, Relationships, Backlinks,
History) and property labels (Type, Status, Modified, Words) to use
font-mono-overline class. Update status badge to IBM Plex Mono with
border-radius 16px per design spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:41:15 +01:00
lucaronin
c6265cf888 feat: add Inter font import and IBM Plex Mono CSS utility classes
Add Inter to Google Fonts import alongside IBM Plex Mono. Update root
font-family to use Inter as primary. Add .font-mono-label (11px/600/ls1.2)
and .font-mono-overline (10px/500/ls1.5) utility classes per design spec.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:41:08 +01:00
lucaronin
2c4808851f fix: remove unused constants and fix BACKLINKS_KEY reference
Removes unused GROUP_PRIORITY and BACKLINKS_KEY constants, replaces
the reference with a string literal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:17:03 +01:00
lucaronin
63768d0a6b fix: handle wikilink aliases in resolveRefs and refsMatch
Strips the |display-text alias from wikilinks before matching (e.g.
[[essay/foo|Foo]] now correctly resolves to essay/foo.md). This was
preventing the Has, Topics, and other relationship groups from resolving
entries whose wikilink references included aliases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:16:19 +01:00
lucaronin
7da76688d2 feat: use generic relationships map in NoteList context view
Updates buildRelationshipGroups to use the new relationships map from
VaultEntry instead of only belongsTo/relatedTo. Now shows Has, Topics,
and all other wikilink-containing frontmatter fields as groups. Group
order: Has, Children, Events, Topics, other fields alphabetically,
Referenced By, Backlinks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:11:01 +01:00
lucaronin
06e6964da3 feat: add relationships field to TypeScript VaultEntry and mock data
Adds `relationships: Record<string, string[]>` to the VaultEntry
interface. Updates mock data with realistic relationship fields (Has,
Topics, Owner, Notes) and adds essay mock entries for testing the
context view.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:08:42 +01:00
lucaronin
99069be0d3 feat: parse generic relationships from frontmatter wikilinks
Adds a `relationships: HashMap<String, Vec<String>>` field to VaultEntry
that captures ALL frontmatter fields containing wikilinks (e.g. Has,
Topics, Events, Notes, Buckets, Highlights). Handles both single string
and array values. Known non-relationship keys (Is A, aliases, Status,
etc.) are skipped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 19:07:02 +01:00
lucaronin
f0a8f7d014 feat: implement context view in NoteList
When a note is selected from the sidebar (entity selection), NoteList
now shows a context view instead of a flat list:

- Prominent top card with type-colored background, bold title, snippet,
  timestamp, and type icon
- Grouped relationship sections (Children, Events, Referenced By,
  Belongs To, Related To, Backlinks) with collapse/expand chevrons
- Backlinks detected by scanning allContent for wikilink references
- Groups show ALL-CAPS headers with count and CaretDown/CaretRight toggle
- Normal flat list shown when sidebar selection is "All Notes"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:47:38 +01:00
lucaronin
484f0672b0 feat: add type icons to NoteList items
Add a small (14px) Phosphor icon in the top-right corner of each note
item, colored by type using getTypeColor(). Uses the same icon mapping
as Sidebar: Wrench=Project, Flask=Experiment, Target=Responsibility,
ArrowsClockwise=Procedure, Users=Person, CalendarBlank=Event,
Tag=Topic, FileText=Note (default).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:45:34 +01:00
lucaronin
1c0bb2a71c feat: remove type filter pills from NoteList
Remove the filter pills row ("All 12", "Projects 1", etc.) and all
associated filtering logic (typeFilter state, typeCounts memo, displayed
memo, TYPE_PILLS constant). The note list now always shows all notes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:44:03 +01:00
lucaronin
2eb0705f00 feat: show type label on relationship items in Inspector
Each related note in the Relationships section now displays the note
title on the left and the type label on the right.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:21:20 +01:00
lucaronin
3939ba1e97 feat: increase Inspector section spacing to 16px with flex gap
Replace individual mb-4 margins with a flex column gap-4 on the
container, ensuring consistent 16px spacing between Inspector sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:20:26 +01:00
lucaronin
444dd03ca6 refactor: use shared getTypeColor utility in Sidebar
Replace inline color strings in SECTION_GROUPS and the string-replace
hack for light colors with the shared typeColors utility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:18:41 +01:00
lucaronin
0f49886f4e feat: use dynamic type colors for active filter pills
Active filter pills now show the accent color matching the type they
represent, instead of hardcoded blue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:17:50 +01:00
lucaronin
ebc77002d2 feat: use dynamic type colors for selected note in NoteList
The selected note's border-left and background now reflect the note's
type color instead of hardcoded blue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:17:21 +01:00
lucaronin
952d8afd05 feat: add shared type color utility for note type→color mapping
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 18:16:47 +01:00
lucaronin
6068c188e1 Added grouping of relationships in note list, and improved design here and there 2026-02-17 18:14:07 +01:00