|
| 1 | +# Application Metadata Standard |
| 2 | + |
| 3 | +The Application metadata (`.app.yml`) is the **primary entry point** for user interaction. It acts as a **container** that bundles navigation, routing, data access, and UI behaviors into a coherent workspace. |
| 4 | + |
| 5 | +It supersedes separate menu definitions by combining **Identity**, **Navigation**, and **Workspace Context** into a single, unified definition. |
| 6 | + |
| 7 | +**File Naming Convention:** `[app_name].app.yml` |
| 8 | + |
| 9 | +## 1. Root Structure (Schema) |
| 10 | + |
| 11 | +```yaml |
| 12 | +# Identity |
| 13 | +name: sales_crm # Unique API identifier (formerly 'code') |
| 14 | +label: Sales Command Center # Display name |
| 15 | +description: Manage leads, pipeline, and forecasts. |
| 16 | +icon: briefcase # Icon (e.g., Lucide, Material) |
| 17 | +version: 1.0.0 |
| 18 | + |
| 19 | +# Branding |
| 20 | +theme: |
| 21 | + mode: light # default, dark, system |
| 22 | + primary_color: "#0F6CBD" # Brand color for this app |
| 23 | + density: compact # default, compact, spacious |
| 24 | + |
| 25 | +# Access Control |
| 26 | +permissions: |
| 27 | + roles: [admin, sales_manager, sales_rep] |
| 28 | + |
| 29 | +# AI Context (Agent Guidance) |
| 30 | +ai_context: |
| 31 | + intent: "Central workspace for sales representatives to manage deal flow" |
| 32 | + target_persona: "Sales Representative" |
| 33 | + key_tasks: |
| 34 | + - "Qualify incoming leads" |
| 35 | + - "Track opportunity stages" |
| 36 | + - "Generate quotes" |
| 37 | + |
| 38 | +# Workspace Capabilities (Context) |
| 39 | +features: |
| 40 | + global_search: |
| 41 | + enabled: true |
| 42 | + scope: [leads, opportunities, accounts] |
| 43 | + hotkey: "cmd+k" |
| 44 | + |
| 45 | + quick_actions: |
| 46 | + - name: new_lead |
| 47 | + label: New Lead |
| 48 | + action: create_record |
| 49 | + object: leads |
| 50 | + shortcut: "cmd+shift+l" |
| 51 | + |
| 52 | +# Navigation Structure (The Menu Tree) |
| 53 | +navigaai_context: "Overview of daily tasks and KPIs. Primary landing page." |
| 54 | + tion: |
| 55 | + type: sidebar # sidebar, topnav, mobile_bottom |
| 56 | + collapsible: true |
| 57 | + |
| 58 | + items: |
| 59 | + # 1. Dashboard (Page) |
| 60 | + - type: page |
| 61 | + name: home |
| 62 | + label: Dashboard |
| 63 | + icon: layout-dashboard |
| 64 | + path: / |
| 65 | + component: sales-dashboard-v1 |
| 66 | + |
| 67 | + # 2. Section (Collapsible Group) |
| 68 | + - type: section |
| 69 | + label: Pipeline |
| 70 | + expanded: true |
| 71 | + items: |
| 72 | + # Object View Link |
| 73 | + - type: object |
| 74 | + name: leads |
| 75 | + label: Leads |
| 76 | + object: leads |
| 77 | + view: all_leads |
| 78 | + badge: |
| 79 | + function: count |
| 80 | + filter: [['status', '=', 'new']] |
| 81 | + color: red |
| 82 | + |
| 83 | + - type: object |
| 84 | + name: opportunities |
| 85 | + label: Opportunities |
| 86 | + object: opportunities |
| 87 | + |
| 88 | + # 3. External Link |
| 89 | + - type: divider |
| 90 | + |
| 91 | + - type: link |
| 92 | + label: Help Center |
| 93 | + url: https://internal.wiki/sales |
| 94 | + target: _blank |
| 95 | + icon: help-circle |
| 96 | +``` |
| 97 | +
|
| 98 | +## 2. Property Reference |
| 99 | +
|
| 100 | +### 2.1 Identity & Branding |
| 101 | +
|
| 102 | +| Property | Type | Description | |
| 103 | +| :--- | :--- | :--- | |
| 104 | +| `name` | `string` | **Required.** Unique API identifier (slug). Used in URLs (e.g., `/app/sales_crm`). Matches file name. | |
| 105 | +| `label` | `string` | **Required.** Human-readable title displayed in the App Launcher. | |
| 106 | +| `icon` | `string` | The icon name representing the app (e.g., in the sidebar or launcher). | |
| 107 | +| `theme` | `object` | UI customization for this specific app context. | |
| 108 | + |
| 109 | +### 2.2 Features (Workspace Context) |
| 110 | + |
| 111 | +Defines global capabilities available while the user is inside this application. |
| 112 | + |
| 113 | +* **`global_search`**: |
| 114 | + * Defines the behavior of the top search bar. |
| 115 | + * `scope`: Limits search results to specific objects relevant to this app. |
| 116 | +* **`quick_actions`**: |
| 117 | + * Global shortcuts available anywhere within the app (e.g., in the specialized top bar or utility bar). |
| 118 | + |
| 119 | +### 2.3 Navigation Items (`items`) |
| 120 | + |
| 121 | +The `navigation.items` array supports polymorphic types. |
| 122 | + |
| 123 | +#### Type: `object` (Entity View) |
| 124 | +Links directly to a standard ObjectQL view (List/Grid). |
| 125 | + |
| 126 | +```yaml |
| 127 | +- type: object |
| 128 | + object: invoices # The object code |
| 129 | + view: pending_payment # (Optional) Specific view to open |
| 130 | + label: My Invoices # (Optional) Override default object label |
| 131 | +``` |
| 132 | + |
| 133 | +#### Type: `page` (Custom Page) |
| 134 | +Links to a custom UI page or dashboard. |
| 135 | + |
| 136 | +```yaml |
| 137 | +- type: page |
| 138 | + path: /analytics |
| 139 | + component: analytics-board |
| 140 | +``` |
| 141 | + |
| 142 | +#### Type: `section` (Group) |
| 143 | +A visual grouping of items, usually with a header. |
| 144 | + |
| 145 | +```yaml |
| 146 | +- type: section |
| 147 | + label: Admin |
| 148 | + collapsible: true |
| 149 | + items: [...] |
| 150 | +``` |
| 151 | + |
| 152 | +#### Type: `folder` (Dropdown) |
| 153 | +A nested submenu (popover or accordion depending on layout). |
| 154 | + |
| 155 | +```yaml |
| 156 | +- type: folder |
| 157 | + label: Reports |
| 158 | + items: [...] |
| 159 | +``` |
| 160 | + |
| 161 | +## 3. Best Practices |
| 162 | + |
| 163 | +1. **Context Isolation**: Ensure `quick_actions` and `global_search.scope` only include items relevant to *this* app's persona. Don't include "Inventory Search" in the "Sales App". |
| 164 | +2. **Badge Performance**: Use badges sparingly. Each badge executes a real-time query (`count`) when the menu loads. |
| 165 | +3. **Role Filtering**: Use `permissions` at the App level to hide the entire app. Use `visible_when` on specific menu items for fine-grained control. |
| 166 | + |
| 167 | +## 4. Mobile Responsiveness |
| 168 | + |
| 169 | +The `navigation` block is the source of truth. The frontend engine (`@objectql/studio`) automatically adapts this structure: |
| 170 | +* **Desktop**: Renders as `type` defined (e.g., Sidebar). |
| 171 | +* **Mobile**: Flattens `section`s and prioritizes the first 4 items for the bottom navigation bar, moving the rest to a "More" drawer. |
| 172 | + |
| 173 | +## 5. AI Context & Agent Integration |
| 174 | + |
| 175 | +ObjectQL apps are designed to be "Agent-Ready". By providing `ai_context`, you allow LLMs and AI Agents to navigate and operate the application intelligently. |
| 176 | + |
| 177 | +### 5.1 Application Level Context |
| 178 | +Describes the *purpose* of the workspace. |
| 179 | + |
| 180 | +```yaml |
| 181 | +ai_context: |
| 182 | + intent: "Customer Support Console" |
| 183 | + target_persona: "Support Agent" |
| 184 | + description: "Used for resolving high-priority tickets and managing SLAs." |
| 185 | +``` |
| 186 | + |
| 187 | +**Usage by AI:** |
| 188 | +* **Routing**: "I see you are a Support Agent. I will route you to the `support_console` app." |
| 189 | +* **Context Setting**: When an agent works within this app, it knows to prioritize "Resolution Time" over "Sales Volume". |
| 190 | + |
| 191 | +### 5.2 Navigation Level Context |
| 192 | +Helps Agents find the right tool for the user's request. |
| 193 | + |
| 194 | +```yaml |
| 195 | +- type: page |
| 196 | + name: quarterly_reports |
| 197 | + label: Q3 Reports |
| 198 | + ai_context: "Use this screen to analyze revenue trends and export PDF reports." |
| 199 | +``` |
| 200 | + |
| 201 | +**Usage by AI:** |
| 202 | +* **Navigation**: User asks *"Where can I see how much we made in Q3?"* -> AI matches intent to `quarterly_reports` item. |
| 203 | +* **Tool Selection**: If an AI Agent needs to "download a report", it knows this page contains that functionality. |
0 commit comments