Interactive In-Terminal Documentation Studio (leai doc)
The leai doc command launches a rich Terminal User Interface (TUI) built with prompt_toolkit and rich. It allows software engineers and DBAs to document tables, columns, routines, and business rules without leaving the shell or manually editing raw YAML files.
β‘ Launching the TUI Editor
You can launch the editor in two distinct modes:
Mode 1: Interactive Paged Catalog
Presents all database entities in a paginated catalog with live visual progress bars reflecting documentation completeness.Mode 2: Direct Object Target
You can also trigger it from within an interactive chat session (leai chat):
π The Paginated Objects Catalog
When launched without arguments, LEAI presents the catalog overview:
β¦ Database Objects Catalog (142 objects) β’ Page 1/12
ββββββ¬βββββββββββββ¬ββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββββββββ¬βββββββββββββββββββ
β # β Schema β Type β Object Name β Technical Details β Doc Status β
ββββββΌβββββββββββββΌββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββββββΌβββββββββββββββββββ€
β 1 β FINANCE β TABLE β CONTRACTS_TB β 18 cols (PK: ID) β ββββββββββ 100% β
β 2 β FINANCE β TABLE β ENTRIES_TB β 12 cols (PK: ID) β ββββββββββ 40% β
β 3 β HR β PACKAGE β PKG_PAYROLL β 14 routines β ββββββββββ 0% β
ββββββ΄βββββββββββββ΄ββββββββββ΄βββββββββββββββββββββββ΄βββββββββββββββββββββββ΄βββββββββββββββββββ
Catalog Controls:
- Enter item number (
1,2, ...): Instantly opens the editor for that item. - Enter object name (
CONTRACTS_TB): Searches and opens directly. - Page Navigation: Type
n(next page) orp(previous page). - Search & Status Filters:
- Type
pending: filters for 0% documented items. - Type
partial: filters for in-progress items. - Type
done: filters for 100% completed items. - Type any text (e.g.
hr,payroll): filters across schemas and names. - Exit: Type
0orq.
π Documentation Completeness Algorithm
LEAI computes an automated completeness score (0% to 100%) for every catalog item:
| Component | Weight | Criteria |
|---|---|---|
| Object Description | 35% | Textual explanation of functional purpose. |
| Columns / Routines | 35% | Percentage of columns/subprograms with comments. |
| Business Rules | 20% | At least one codified bullet point rule. |
| Tags / Domain | 10% | Functional domain tags (e.g. billing, compliance). |
π οΈ Main Form Navigation
When an entity is selected, LEAI renders technical Oracle metadata (Primary Keys, Foreign Keys, LAST_DDL_TIME) alongside the editing menu:
β¦ LEAI Documentation Studio β’ FINANCE.CONTRACTS_TB [TABLE]
ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Context Badges β SCHEMA: FINANCE TYPE: TABLE OBJECT: CONTRACTS_TB β
β Doc Completeness β ββββββββββ 100% β
β Primary Keys β ID_CONTRACT β
β Foreign Keys β 2 FK constraints β
β Description β Primary repository for client contracts and renewals β
β Columns Done β 18 / 18 β
β Business Rules β 3 rules registered β
β Tags / Domain β sales, compliance β
ββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Select an action to edit:
1 β’ π Edit Main Object Description
2 β’ π Edit Column / Routine Comments
3 β’ π Edit Business Rules (Bullet Points)
4 β’ π·οΈ Edit Tags & Functional Domain
5 β’ β οΈ Edit Technical Warnings / Alerts
6 β’ π Edit Related Objects Lineage
7 β’ πΎ Preview YAML & Save Changes
0 β’ β Cancel & Back
β¨οΈ Section-by-Section Workflow
1. Object Description (Option 1)
Opens a multiline editor with existing notes pre-populated for quick editing.
2. Column / Subprogram Comments (Option 2)
Displays a numbered column roster with color-coded completeness indicators: * [green]β[/green]: Documented column. * [red]β[/red]: Undocumented column. * Enter column number to edit or update its description.
3. Business Rules (Option 3)
Manages bullet point business rules: * Press a to append a new rule. * Enter rule number to edit or delete existing entries.
4. Domain Tags (Option 4)
Enter comma-separated tags for semantic classification (e.g. finance, audit, pii).
β‘ 1-Click Instant Save & Markdown Recompile
Upon choosing Option 7 (or typing s / save):
- Non-Destructive Local Disk Persistence: Writes updated YAML directly to
./annotations/<SCHEMA>/tables/<OBJECT>.yml, allowing safe local verification and diffing before syncing to remote storage or Git. - Colorized YAML Preview: Renders formatted YAML in the console for confirmation.
- Instant Recompile Prompt: Pressing
Enteror typingyimmediately recompiles only that specific Markdown document (./docs/<SCHEMA>/tables/CONTRACTS_TB.md), refreshing frontmatter, Mermaid diagrams, and column tables in under 1 second without a full project rebuild!