Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
main ▾

Modern-Apps.git / office / AGENTS.md

AGENTS.md8.2 KiBRenderedCodeRaw
1# AGENTS.md — office/ (':office')
2
3> Scoped supplement. Global rules in root `AGENTS.md` apply. Stay inside `office/` + allowed shared modules. Do not root-scan.
4
5_Install: ./install office (dev by default)._
6- Gradle: :office / dir: office/
7- Package roots present: ui
8- Entry files: MainActivity.kt, Route.kt (`Route` sealed interface), Navigation.kt
9- Deps: :library:network, :library:e2ee-p2p
10- Metadata: metadata_data/office.md (present)
11- Rust: yes / screenshotTest: yes
12
13### Relay server (backend, outside this repo)
14Host: `api.maproj.org` (Cloudflare FIRST_PARTY pins). Server checkout: `../location_share_server` (sibling of this repo root, `C:\Users\Vayun\Documents\code\location_share_server`). Live SSH: `ssh [email protected]`. Env template: `../location_share_server/.env.example` (copy to `.env`, never commit secrets). Full details: root `AGENTS.md` → "Backend server (outside this repo)".
15
16## Overview
17**Purpose:** Document viewer/editor for ODF (odt/ods/odp) and Microsoft (docx/xlsx/pptx) files, with E2EE collaboration over a dumb relay. Internet only for collaboration.
18**Key features:**
19- Full ODF + OOXML importers (`odf/`), incl. Excel formulas, number formats, charts, diagrams, themes, and math (ODF/OMML→MathML)
20- Editing across text, spreadsheets, and presentations with comments, change tracking, footnotes, headers/footers, and export/print menus
21- Native Rust formula engine + document CRDT (`OfficeNative`); online collaboration is E2EE with no accounts — the relay only forwards ciphertext
22- Opens files shared from other apps or `office://join` collaboration links
23**Architecture / data-flow:** Root-level document chrome + `ui/` type-specific views over the `util/OfficeViewModel*` family (split per surface: documents, text, sheet, slides, tables, sync A/B/C, export) backed by `:library:ui`'s `OdfDocument` model; sync goes through `util/OfficeSync` + `util/DocumentTreeCrdt` to the E2EE relay. `onCreateBeforeContent`: `NetworkClient.init(FIRST_PARTY)` → load settings → split join-links from document URIs; `Content()` roots the `OfficeRoute` (`OfflineHome` / `OnlineHome` / `OfflineEditor` / `OnlineEditor`) graph and fires `initSync`.
24**Entry points + reading order:** `Route` in Route.kt (`OfflineHome` / `OnlineHome` / `OfflineEditor(uri)` / `OnlineEditor(docId)` plus the `DeleteOnlineDocumentDialog`, `GoToSlideDialog` and `SlideshowDialog` dialog routes) → `MainActivity.kt` → `Navigation.kt` (`OfficeTabs` + `officeDialogEntries`) → `OfficeDocumentPane.kt`.
25**Gotchas:**
26- Display names must come from `OpenableColumns.DISPLAY_NAME`, not the URI path — `DocumentImporter` routes by extension and content URIs often have extensionless ids
27- The document "paper" stays light in dark mode by design (`OfficeLightTheme`); dark mode inverts luminance via a color matrix, never the model colors
28- `OfficeLightTheme` is public for `screenshotTest` — don't privatize it
29- `office://join` links never enter the document-loading path (different scheme); handle them via `parseJoinLink`/`handleJoinLink` only
30
31## Key files
32### Root — entry, chrome, and document shell
33- com/vayunmathur/office/MainActivity.kt — OfficeRoute, OfficeRoot, join-link handling
34- com/vayunmathur/office/DocumentScreenShell.kt
35- com/vayunmathur/office/DocumentScreenChrome.kt
36- com/vayunmathur/office/OfficeBottomBarHost.kt
37- com/vayunmathur/office/OfficeDocumentPane.kt
38- com/vayunmathur/office/OfficeDocumentState.kt
39- com/vayunmathur/office/OfficeDocumentUtils.kt
40- com/vayunmathur/office/OfficeDocumentMenuBar.kt
41- com/vayunmathur/office/OfficeDocumentOverlays.kt
42- com/vayunmathur/office/OfficeDocumentLaunchers.kt
43- com/vayunmathur/office/OfficeDocumentFindBars.kt
44- com/vayunmathur/office/OfficeHomeScreens.kt
45- com/vayunmathur/office/OfficeOnlineScreens.kt
46- com/vayunmathur/office/Route.kt — `Route` destinations incl. dialog routes
47- com/vayunmathur/office/ui/OfficeDialogEntries.kt — DialogPage entries for the dialog routes (delete-online-document, go-to-slide, slideshow; slide results via the nav result registry)
48- com/vayunmathur/office/OfficeEnableOnlineDialog.kt
49- com/vayunmathur/office/OfficeOutlinePane.kt
50- com/vayunmathur/office/OfficeExportMenu.kt
51- com/vayunmathur/office/OfficeInsertMenu.kt
52- com/vayunmathur/office/OfficeShareMembers.kt
53- com/vayunmathur/office/OfficeCellOverlays.kt
54- com/vayunmathur/office/OfficeChangesOverlays.kt
55- com/vayunmathur/office/OfficeCommentsOverlays.kt
56- com/vayunmathur/office/OfficePageSetupOverlays.kt
57- com/vayunmathur/office/OfficeSlideElementOverlays.kt
58- com/vayunmathur/office/OfficeSlideOverlays.kt
59### odf/ — ODF + OOXML import/export
60- com/vayunmathur/office/odf/DocumentImporter.kt — extension-routed entry
61- com/vayunmathur/office/odf/OdfParser.kt
62- com/vayunmathur/office/odf/OdfParserText.kt
63- com/vayunmathur/office/odf/OdfParserSheet.kt
64- com/vayunmathur/office/odf/OdfParserSlides.kt
65- com/vayunmathur/office/odf/OdfParserInline.kt
66- com/vayunmathur/office/odf/OdfParserChart.kt
67- com/vayunmathur/office/odf/OdfParserStyles.kt
68- com/vayunmathur/office/odf/OdfMath.kt
69- com/vayunmathur/office/odf/OmmlToMathml.kt
70- com/vayunmathur/office/odf/OdfWriter.kt
71- com/vayunmathur/office/odf/ExcelFormula.kt
72- com/vayunmathur/office/odf/ExcelNumFmt.kt
73- com/vayunmathur/office/odf/OoxmlImporter.kt
74- com/vayunmathur/office/odf/OoxmlDocx.kt
75- com/vayunmathur/office/odf/OoxmlDocxStyles.kt
76- com/vayunmathur/office/odf/OoxmlXlsx.kt
77- com/vayunmathur/office/odf/OoxmlXlsxHelper.kt
78- com/vayunmathur/office/odf/OoxmlPptx.kt
79- com/vayunmathur/office/odf/OoxmlChart.kt
80- com/vayunmathur/office/odf/OoxmlDiagram.kt
81- com/vayunmathur/office/odf/OoxmlTheme.kt
82- com/vayunmathur/office/odf/OoxmlColor.kt
83- com/vayunmathur/office/odf/OoxmlMetadata.kt
84- com/vayunmathur/office/odf/OoxmlPackage.kt
85- com/vayunmathur/office/odf/OoxmlUnits.kt
86- com/vayunmathur/office/odf/OoxmlXml.kt
87### ui/ — type views + editor dialogs
88- com/vayunmathur/office/ui/DocumentViews.kt
89- com/vayunmathur/office/ui/TextDocumentView.kt
90- com/vayunmathur/office/ui/ParagraphViews.kt
91- com/vayunmathur/office/ui/SpreadsheetViews.kt
92- com/vayunmathur/office/ui/PresentationViews.kt
93- com/vayunmathur/office/ui/FloatingElementViews.kt
94- com/vayunmathur/office/ui/OdfChartViews.kt
95- com/vayunmathur/office/ui/OdfImageViews.kt
96- com/vayunmathur/office/ui/MathViews.kt
97- com/vayunmathur/office/ui/OfficeTextFormat.kt
98- com/vayunmathur/office/ui/OfficeCellFormat.kt
99- com/vayunmathur/office/ui/OfficeEditorWideLayout.kt
100- com/vayunmathur/office/ui/OfficeBottomBar.kt
101- com/vayunmathur/office/ui/CommentDialog.kt
102- com/vayunmathur/office/ui/ChartEditorDialog.kt
103- com/vayunmathur/office/ui/AddBookmarkDialog.kt
104- com/vayunmathur/office/ui/ColorPickerDialog.kt
105- com/vayunmathur/office/ui/FontSizePickerDialog.kt
106- com/vayunmathur/office/ui/FootnoteDialog.kt
107- com/vayunmathur/office/ui/HeaderFooterDialog.kt
108- com/vayunmathur/office/ui/InsertHyperlinkDialog.kt
109- com/vayunmathur/office/ui/InsertTableDialog.kt
110- com/vayunmathur/office/ui/SortDialog.kt
111- com/vayunmathur/office/ui/SpecialCharsDialog.kt
112- com/vayunmathur/office/ui/SettingsDialog.kt
113- com/vayunmathur/office/ui/dialogs/DeleteOnlineDocumentDialogContent.kt — stateless delete/remove confirmation hosted by the `DeleteOnlineDocumentDialog` route
114- com/vayunmathur/office/ui/dialogs/GoToSlideDialogContent.kt — stateless go-to-slide picker hosted by the `GoToSlideDialog` route
115- com/vayunmathur/office/ui/dialogs/SlideshowDialogContent.kt — stateless slideshow hosted by the `SlideshowDialog` route
116### util/ — ViewModels, sync, CRDT, native bridge
117- com/vayunmathur/office/util/OfficeViewModel.kt
118- com/vayunmathur/office/util/OfficeViewModelDocuments.kt
119- com/vayunmathur/office/util/OfficeViewModelText.kt
120- com/vayunmathur/office/util/OfficeViewModelSheet.kt
121- com/vayunmathur/office/util/OfficeViewModelSlides.kt
122- com/vayunmathur/office/util/OfficeViewModelTables.kt
123- com/vayunmathur/office/util/OfficeViewModelSyncA.kt
124- com/vayunmathur/office/util/OfficeViewModelSyncB.kt
125- com/vayunmathur/office/util/OfficeViewModelSyncC.kt
126- com/vayunmathur/office/util/OfficeViewModelExport.kt
127- com/vayunmathur/office/util/OfficeSync.kt
128- com/vayunmathur/office/util/DocumentTreeCrdt.kt
129- com/vayunmathur/office/util/OfficeNative.kt — Rust formula/CRDT bridge
130
131## Verify (this module only)
132```
133./gradlew :office:compileDevKotlin
134./gradlew :office:lint
135./gradlew :office:checkMetadata
136```