Private
Public Access
0
0

docs(gui_2): Document context composition, context files table, and ast inspector

This commit is contained in:
2026-06-12 21:27:44 -04:00
parent d1a69395b8
commit 92cff70543
3 changed files with 89 additions and 1 deletions
+83
View File
@@ -3365,6 +3365,33 @@ def render_add_context_files_modal(app: App) -> None:
def render_context_composition_panel(app: App) -> None:
"""
Renders the Context Composition panel containing loaded project files, presets,
and visual screenshot files. Displays token stats, batch files actions, and collapsible trees.
State Mutations:
app.context_files (adds/removes file records)
app.screenshots (adds/removes screen image attachments)
DAG Context / Render Flow:
Called by: render_main_interface()
Calls: render_context_batch_actions(), render_context_files_table(),
render_context_presets(), render_context_screenshots()
ASCII Layout Preview:
+-------------------------------------------------------------+
| > Context Composition |
| [Presets v] [Add Files] [Batch Actions] |
| +-------------------------------------------------------+ |
| | [-] src/ | |
| | [x] gui_2.py (Sig) [Inspect] [Slices] [Remove] | |
| | [ ] models.py [Inspect] [Slices] [Remove] | |
| +-------------------------------------------------------+ |
| > Screenshots |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
[C: tests/test_auto_slices.py:test_add_all_triggers_auto_slices, tests/test_gui_fast_render.py:test_render_context_composition_panel_fast]
"""
if imgui.collapsing_header("Context Composition##panel"):
@@ -3379,6 +3406,38 @@ def render_context_composition_panel(app: App) -> None:
render_context_screenshots(app)
def render_ast_inspector_modal(app: App) -> None:
"""
Renders the 'Structural File Editor' modal dialog.
Provides an interactive tree-sitter AST inspector to mask classes, methods, or
functions and extract custom annotated slices (Definition, Signature, Hide).
State Mutations:
app.show_structural_editor_modal (set to False when opened)
app.ui_editing_slices_file.ast_mask (mutated on node click)
app.ui_editing_slices_file.custom_slices (mutated on slice modification)
DAG Context / Render Flow:
Called by: render_main_interface() (as popup modal render)
Calls: ts_c_get_code_outline(), py_get_code_outline()
ASCII Layout Preview:
+-------------------------------------------------------------+
| Structural File Editor: src/gui_2.py [X] |
+-------------------------------------------------------------+
| [Filter: ] [Clear Filters] [Preset: Sig-Only v] |
+--------------------+----------------------------------------+
| AST Tree | File Preview |
| | |
| [-] Class: App | 302: class App: |
| [x] __init__ | 305: def __init__(self): |
| [ ] run | |
+--------------------+----------------------------------------+
| [Add selected slices] [Close] |
+-------------------------------------------------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
if getattr(app, 'show_structural_editor_modal', False):
imgui.open_popup('Structural File Editor')
app.show_structural_editor_modal = False
@@ -3628,6 +3687,30 @@ def render_context_screenshots(app: App) -> None:
for i, s in enumerate(app.screenshots): imgui.text(s)
def render_context_files_table(app: App) -> None:
"""
Renders a two-column table mapping active context files to their AST view modes
(Definition, Signature, Hide) and slice indicators. Grouped by directories.
State Mutations:
app.context_files[index].view_mode (Def/Sig/Hide)
app.context_files (elements removed via delete action)
DAG Context / Render Flow:
Called by: render_context_composition_panel()
Calls: aggregate.group_files_by_dir()
ASCII Layout Preview:
+-------------------------------------------------------------+
| File | Flags |
+--------------------------------------+----------------------+
| [-] src/ | |
| [x] gui_2.py | [Sig v] [Inspect] [X] |
| [x] models.py | [Def v] [Inspect] [X] |
+--------------------------------------+----------------------+
Threading & Safety:
Must run synchronously on the Main Thread.
"""
imgui.dummy(imgui.ImVec2(0, 4))
grouped_files = aggregate.group_files_by_dir(app.context_files)