Skip to content

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

leai doc
Presents all database entities in a paginated catalog with live visual progress bars reflecting documentation completeness.

Mode 2: Direct Object Target

leai doc CUSTOMERS_TB
# or with an explicit schema:
leai doc FINANCE.PKG_PAYROLL

You can also trigger it from within an interactive chat session (leai chat):

/doc CUSTOMERS_TB


πŸ“‹ 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) or p (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 0 or q.

πŸ“Š 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):

  1. 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.
  2. Colorized YAML Preview: Renders formatted YAML in the console for confirmation.
  3. Instant Recompile Prompt:
    Recompile Markdown doc for CONTRACTS_TB now? [Y/n]:
    
    Pressing Enter or typing y immediately 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!