Commit Graph

42 Commits

Author SHA1 Message Date
Claude
eec759aafb Fix import error: rename tui.py to tui_app.py to avoid package naming conflict
Resolved naming conflict between trace/tui.py (file) and trace/tui/ (package).
Python prioritizes packages over modules with the same name, causing import failures.

Changes:
- Renamed trace/tui.py to trace/tui_app.py
- Updated trace/cli.py to import from tui_app
- Updated trace/tui/__init__.py to re-export from tui_app for backward compatibility

This allows both direct imports (from trace.tui_app) and package imports (from trace.tui)
to work correctly, maintaining backward compatibility while supporting the new modular structure.
2025-12-13 18:05:12 +00:00
Claude
b6387f4b0c Restructure codebase for AI agent optimization
Major refactoring to organize code into focused, single-responsibility modules
that are easier for AI coding agents and developers to navigate and modify.

**Module Reorganization:**

Models Package (trace/models/):
- Moved models.py content into models/__init__.py
- Extracted IOC extraction into models/extractors/ioc_extractor.py (236 lines)
- Extracted tag extraction into models/extractors/tag_extractor.py (34 lines)
- Reduced duplication and improved maintainability

Storage Package (trace/storage_impl/):
- Split storage.py (402 lines) into focused modules:
  - storage.py: Main Storage class (112 lines)
  - state_manager.py: StateManager for context/settings (92 lines)
  - lock_manager.py: Cross-platform file locking (87 lines)
  - demo_data.py: Demo case creation (143 lines)
- Added backward-compatible wrapper at trace/storage.py

TUI Utilities (trace/tui/):
- Created rendering package:
  - colors.py: Color pair constants and initialization (43 lines)
  - text_renderer.py: Text rendering with highlighting (137 lines)
- Created handlers package:
  - export_handler.py: Export functionality (238 lines)
- Main tui.py (3307 lines) remains for future refactoring

**Benefits:**
- Smaller, focused files (most < 250 lines)
- Clear single responsibilities
- Easier to locate and modify specific functionality
- Better separation of concerns
- Reduced cognitive load for AI agents
- All tests pass, no features removed

**Testing:**
- All existing tests pass
- Imports verified
- CLI and storage functionality tested
- Backward compatibility maintained

Updated CLAUDE.md to document new architecture and AI optimization strategy.
2025-12-13 17:38:53 +00:00
overcuriousity
09729ee7a3 Merge pull request #8 from overcuriousity/claude/debug-code-issues-01ANayVVF2LaNAabfcL6G49y
Improve navigation: remember selected index when going back
2025-12-13 18:25:59 +01:00
Claude
68834858e0 Improve navigation: remember selected index when going back
When navigating between views (case list -> case detail -> evidence detail)
and pressing 'b' to go back, the previously selected item is now restored
instead of always jumping to the top of the list.

Implementation:
- Added nav_history dict to track selected indices per view/context
- _save_nav_position() saves current index before navigating away
- _restore_nav_position() restores index when returning to a view
- Works across all navigation paths: cases, evidence, tags, IOCs, notes

This improves UX by maintaining user context during navigation.

Location: trace/tui.py
2025-12-13 17:24:57 +00:00
overcuriousity
5fdf6d0aba Merge pull request #7 from overcuriousity/claude/debug-code-issues-01ANayVVF2LaNAabfcL6G49y
Fix critical bugs and improve data integrity across codebase
2025-12-13 18:18:44 +01:00
Claude
2453bd4f2a Fix critical bugs and improve data integrity across codebase
This commit addresses 20 bugs discovered during comprehensive code review,
focusing on data integrity, concurrent access, and user experience.

CRITICAL FIXES:
- Fix GPG key listing to support keys with multiple UIDs (crypto.py:40)
- Implement cross-platform file locking to prevent concurrent access corruption (storage.py)
- Fix evidence detail delete logic that could delete wrong note (tui.py:2481-2497)
- Add corrupted JSON handling with user prompt and automatic backup (storage.py, tui.py)

DATA INTEGRITY:
- Fix IOC/Hash pattern false positives by checking longest hashes first (models.py:32-95)
- Fix URL pattern to exclude trailing punctuation (models.py:81, 152, 216)
- Improve IOC overlap detection with proper range tracking (models.py)
- Fix note deletion to use note_id instead of object identity (tui.py:2498-2619)
- Add state validation to detect and clear orphaned references (storage.py:355-384)

SCROLLING & NAVIGATION:
- Fix evidence detail view to support full scrolling instead of "last N" (tui.py:816-847)
- Fix filter reset index bounds bug (tui.py:1581-1654)
- Add scroll_offset validation after all operations (tui.py:1608-1654)
- Fix division by zero in scroll calculations (tui.py:446-478)
- Validate selection bounds across all views (tui.py:_validate_selection_bounds)

EXPORT & CLI:
- Fix multi-line note export with proper markdown indentation (cli.py:129-143)
- Add stderr warnings for GPG signature failures (cli.py:61, 63)
- Validate active context and show warnings in CLI (cli.py:12-44)

TESTING:
- Update tests to support new lock file mechanism (test_models.py)
- All existing tests pass with new changes

Breaking changes: None
Backward compatible: Yes (existing data files work unchanged)
2025-12-13 16:16:54 +00:00
overcuriousity
ba7a8fdd5d Delete CONSISTENCY_ANALYSIS.md 2025-12-13 15:57:32 +00:00
overcuriousity
107feaf560 Merge pull request #6 from overcuriousity/claude/fix-note-details-access-01XmzZ6wE2NUAXba8tF6TrxD
Fix filter-related index bugs across all filterable views
2025-12-13 16:57:02 +01:00
Claude
d97207633b Fix filter-related index bugs across all filterable views
When adding filter support, the display logic correctly used filtered
lists but the interaction handlers (Enter, 'v', 'd' keys) and navigation
(max_idx calculations) still used unfiltered lists. This caused:
- Wrong item selected when filter active
- Potential out-of-bounds errors
- Inconsistent behavior between display and action

Fixed in all affected views:

1. evidence_detail:
   - Enter key navigation now uses filtered notes
   - 'v' key (notes modal) now uses filtered notes
   - Delete handler now uses filtered notes
   - max_idx navigation now uses filtered notes

2. tag_notes_list:
   - Enter key navigation now uses filtered notes
   - Delete handler now uses filtered notes
   - max_idx navigation now uses filtered notes

3. ioc_notes_list:
   - Enter key navigation now uses filtered notes
   - Delete handler now uses filtered notes
   - max_idx navigation now uses filtered notes

4. tags_list:
   - Enter key navigation now uses filtered tags
   - max_idx navigation now uses filtered tags

5. ioc_list:
   - Enter key navigation now uses filtered IOCs
   - max_idx navigation now uses filtered IOCs

All views now consistently respect active filters across display,
navigation, and interaction handlers.
2025-12-13 15:55:31 +00:00
overcuriousity
7df42cb811 Merge pull request #5 from overcuriousity/claude/fix-note-details-access-01XmzZ6wE2NUAXba8tF6TrxD
Fix case_detail delete logic order bug
2025-12-13 16:52:03 +01:00
Claude
71ae0eef35 Fix case_detail delete logic order bug
The delete handler was checking case notes first, then evidence,
but the display order is evidence first, then notes. This caused:
- Selecting evidence + pressing 'd' -> asked to delete a note
- Selecting note + pressing 'd' -> asked to delete evidence

Fixed by reordering the checks to match display order:
1. Check if index < len(evidence) -> delete evidence
2. Otherwise check if in notes range -> delete note

Now delete correctly targets the selected item type.
2025-12-13 15:50:51 +00:00
overcuriousity
d94901a41d Merge pull request #4 from overcuriousity/claude/fix-note-details-access-01XmzZ6wE2NUAXba8tF6TrxD
Claude/fix note details access 01 xmz z6w e2 nua xba8t f6 trx d
2025-12-13 16:46:25 +01:00
Claude
ec5a3d9f31 Add comprehensive menu consistency improvements
Based on UX analysis, added three major improvements:

1. Context-sensitive filtering everywhere ('/' key):
   - evidence_detail: Filter notes by content
   - tags_list: Filter tags by name
   - tag_notes_list: Filter notes by content
   - ioc_list: Filter IOCs by value or type
   - ioc_notes_list: Filter notes by content
   - All views show active filter in footer

2. Extended delete support ('d' key):
   - note_detail: Delete current note and return to previous view
   - tag_notes_list: Delete selected note from filtered view
   - ioc_notes_list: Delete selected note from filtered view
   - Finds and removes note from parent case/evidence

3. Markdown export for case/evidence ('e' key):
   - case_detail: Export entire case + all evidence to markdown
   - evidence_detail: Export single evidence item to markdown
   - Files saved to ~/.trace/exports/ with timestamps
   - Complements existing IOC export functionality

All changes maintain consistent UX patterns across views and
provide clear feedback through updated footers showing available
actions in each context.
2025-12-13 15:43:32 +00:00
Claude
ac7e442970 Add UX consistency analysis documentation
Documents findings from comprehensive menu interface review across all
9 views in the TUI. Identifies inconsistencies with filter, delete,
and export functionality.

Clarifications from user:
- 'n' and 'a' keys correctly limited to case/evidence contexts
- Filter should work everywhere (context-sensitive)
- Delete should work for all note views, not tag/IOC lists
- Export should extend to case/evidence markdown exports
2025-12-13 15:35:39 +00:00
Claude
b973aa1009 Make note navigation consistent across case_detail and evidence_detail
Both views now support dual navigation options:
- Enter: Opens note_detail view (single note focus)
- 'v': Opens notes modal with selected note highlighted

Previously, case_detail would open the notes modal from the beginning
even when a case note was selected. Now it intelligently jumps to the
selected case note, matching the behavior in evidence_detail view.

This provides a consistent, predictable user experience across both
views where notes can be selected and viewed.
2025-12-13 15:22:59 +00:00
Claude
461da25c93 Add dual note navigation options in evidence_detail view
Now provides two ways to access notes in evidence_detail view:
- Enter: Opens note_detail view (single note focus)
- 'v': Opens notes modal with selected note highlighted (all notes)

The 'v' key now intelligently jumps to the selected note when
opening the modal, providing context while still showing all notes.
This gives users flexibility in how they want to view their notes.
2025-12-13 15:20:59 +00:00
Claude
b61b818952 Fix inconsistent note detail access in evidence_detail view
Previously, pressing Enter on a note in evidence_detail view would
open the notes modal (same as 'v' key), while in other views
(case_detail, tag_notes_list, ioc_notes_list) it would open the
note_detail view. This created confusing and inconsistent behavior.

Now Enter consistently opens note_detail view across all contexts:
- Enter: Opens note detail view (full note content)
- 'v': Opens notes modal (scrollable list of all notes)

This aligns the implementation with the help text which already
documented the correct behavior.
2025-12-13 15:06:16 +00:00
overcuriousity
fa90aeb063 Merge pull request #3 from overcuriousity/claude/fix-umlaut-support-01NVHwQkPasDs5ZPySfRqZgE
Fix UTF-8/umlaut support in note input
2025-12-13 16:02:15 +01:00
Claude
e38b018e41 Fix UTF-8/umlaut support in note input
Added full Unicode character support to the TUI's multiline input dialog.
Previously, only ASCII characters (32-126) were captured when typing notes.

Changes:
- Added UTF-8 multibyte character handling to _multiline_input_dialog()
- Properly collects and decodes 2/3/4-byte UTF-8 sequences
- Added explicit UTF-8 encoding to all file I/O operations
- Added ensure_ascii=False to JSON serialization for proper Unicode preservation

This fix allows users to enter umlauts (ä, ö, ü), accented characters
(é, à, ñ), and other Unicode characters in notes, case names, and all
other text input fields.

Tested with German umlauts, Asian characters, Cyrillic, and special chars.
2025-12-13 11:42:37 +00:00
overcuriousity
3c53969b45 Merge pull request #2 from overcuriousity/claude/code-review-bugs-011Ga38jN53dLDkW2sLfzG1a
Review code for bugs and issues
2025-12-12 21:43:09 +01:00
Claude
a829275ce0 Fix all identified bugs and issues
Critical Fixes:
- Fixed IOC extraction order: URLs now checked before domains to prevent duplicates
- Fixed overlapping IOC highlights with overlap detection
- Fixed IPv4 pattern to validate octets (0-255) preventing invalid IPs like 999.999.999.999
- Fixed IPv6 pattern to support compressed format (::)
- Fixed hash extraction order: SHA256 -> SHA1 -> MD5 to prevent misclassification

High Priority Fixes:
- Added 10s timeout to all GPG subprocess calls to prevent hangs
- Fixed indentation inconsistency in storage.py:253

Performance Improvements:
- Removed 8 time.sleep(0.1) calls from demo case creation (800ms faster startup)

Robustness Improvements:
- Added error handling to export_markdown() for IOError/OSError/PermissionError
- Implemented atomic writes for state file (set_active)
- Implemented atomic writes for settings file (set_setting)

All changes tested and verified with unit tests.
2025-12-12 20:24:45 +00:00
Claude
e59f7be3e4 Add comprehensive bug report from code review
Found 11 bugs/issues across the codebase:
- 3 critical: IOC extraction order, overlapping highlights, invalid IPv4
- 2 high priority: subprocess timeout, indentation error
- 3 medium: slow startup, missing error handling, IPv6 pattern
- 3 low: hash classification, non-atomic writes

Detailed report includes line numbers, impact analysis, and fixes.
2025-12-12 20:15:23 +00:00
overcuriousity
dc16a16d49 Merge pull request #1 from overcuriousity/claude/add-install-instructions-015g7n4vPZWeuAUYrHmM74hU
Add binary installation instructions to README
v0.1.1-alpha
2025-12-12 12:30:51 +01:00
Claude
e4976c81f9 Add optional ultra-fast alias setup for quick logging 2025-12-12 11:28:08 +00:00
Claude
b627f92172 Add installation instructions for latest release binaries 2025-12-12 11:24:52 +00:00
overcuriousity
4c99013426 disclaimer
Added a disclaimer about the coding process and agents used.
2025-12-12 10:21:12 +00:00
overcuriousity
f80a343610 clearer readme
Updated README to reflect new project name and features.
2025-12-12 10:13:41 +00:00
overcuriousity
e1886edee1 bug fixes v0.1.0 2025-12-12 10:26:27 +01:00
overcuriousity
aa0f67f1fc visual improvements, readme file update v0.0.2-alpha 2025-12-12 00:00:35 +01:00
overcuriousity
dc8bd777ef bug fixes 2025-12-11 23:40:16 +01:00
overcuriousity
89e7b20694 bug fixes 2025-12-11 23:25:06 +01:00
overcuriousity
ba1fff36f2 rename binaries 2025-12-11 23:09:04 +01:00
overcuriousity
e37597c315 bug fixes v0.0.1-alpha 2025-12-11 23:07:19 +01:00
overcuriousity
4f9522181e Fix release upload permissions v0.0.0-alpha 2025-12-11 22:01:29 +01:00
overcuriousity
4bd255e616 Add permissions for release workflow 2025-12-11 20:56:59 +00:00
overcuriousity
44dc7e0e4a optical enhancements, user experience enhancements 2025-12-11 21:51:57 +01:00
Overcuriousity
47c43e81f3 Update workflow to use Python 3.13 2025-12-11 21:38:28 +01:00
Overcuriousity
2964c27788 Add GitHub Actions workflow for building release binaries 2025-12-11 21:34:18 +01:00
Overcuriousity
cfc71fc68d Update trace application with improvements and documentation 2025-12-11 21:33:19 +01:00
google-labs-jules[bot]
be36cbd116 Move trace project to root and rebrand from fnote
- Move all project files from `trace/` subdirectory to the repository root
- Rename directory structure from `fnote` to `trace`
- Update package references and imports (fnote -> trace)
- Update application branding and storage paths (~/.trace)
- Update build script and documentation
- Ensure __pycache__ is ignored
2025-12-11 07:55:18 +00:00
google-labs-jules[bot]
0d425f69f2 Rebrand fnote to trace
- Rename directory structure from fnote to trace
- Update package references and imports
- Update application branding and storage paths
- Update build script and documentation
2025-12-11 07:01:22 +00:00
google-labs-jules[bot]
27f4d65d59 Rebrand fnote to trace
- Rename directory structure from fnote to trace
- Update package references and imports
- Update application branding and storage paths
- Update build script and documentation
2025-12-11 06:50:36 +00:00