AI CSV / Spreadsheet Insights Sidebar#477
Open
LukasHirt wants to merge 14 commits into
Open
Conversation
Signed-off-by: Lukas Hirt <info@hirt.cz>
…tils/csv-parse.ts` (RFC-4180 parser with TSV delimiter support), `src/utils/file-support.ts`, `src/composables/useLlm.ts` (verbatim copy), and `src/composables/useInsights.ts` (WebDAV fetch, column type inference, LLM POST with same-origin check and column cap). Update `src/index.ts` to register the `sidebarPanel` and `action` extensions with `isVisible` guards on `llmConfig` and supported extensions. Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…sightsPanel.vue` with the four render states (analyzing spinner, error banner, result table + observations, idle Analyze button) using `oc-button` and ODS utility classes. Wire `ensureReady` on `onMounted` and `triggerInsights` to the button actions. Signed-off-by: Lukas Hirt <info@hirt.cz>
…t/csv-parse.spec.ts` (RFC-4180 edge cases including embedded newlines, CRLF, truncation), `tests/unit/file-support.spec.ts`, `tests/unit/useLlm.spec.ts`, `tests/unit/useInsights.spec.ts` (mocked WebDAV, fetch, same-origin check, error codes), and `tests/unit/InsightsPanel.spec.ts` (mocked `useInsights`, all render states, button callbacks). Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…ton in `tests/e2e/acceptance.spec.ts` with real Playwright tests covering: "Insights" context-menu entry visible for `.csv` and invisible for `.jpeg`; clicking the entry opens the Insights sidebar panel. Add the `tests/e2e/pages/aiDataInsightsSidebarPage.ts` page object and `tests/e2e/fixtures/sample.csv` fixture. Signed-off-by: Lukas Hirt <info@hirt.cz>
Signed-off-by: Lukas Hirt <info@hirt.cz>
…md if present) for the extension Signed-off-by: Lukas Hirt <info@hirt.cz>
…CI matrix, and oCIS apps config Signed-off-by: Lukas Hirt <info@hirt.cz>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Data workers store CSV exports and data dumps in oCIS for team sharing, but the platform gives no quick insight layer — every analysis requires downloading the file and opening a spreadsheet app. Teams lose time cycling between tools just to answer "what's in this file?"
Solution
Selecting a CSV file shows an "Insights" tab in the right sidebar. The extension parses the file client-side (headers + first ~200 rows), then sends a structured preview to the configured LLM endpoint. The panel renders column types, value ranges, detected patterns (e.g. date trends, outliers), and 2–3 natural-language observations. Tier 1 (text completion): prose analysis split on section headers. Tier 2 (no LLM configured): panel is hidden.
Extension points
global.files.sidebar (sidebarPanel)·global.files.context-actions (action)Why ship this now
oCIS is increasingly used as a team data hub; the CSV use-case is high-frequency and zero existing extension touches tabular files. Gives analysts an instant "first read" without leaving the browser.
What was built
web-app-ai-data-insights-sidebarregisters two extension points: asidebarPanelthat appears as an "Insights" tab when a.csvor.tsvfile is selected, and a context-action entry in the file list. Both are gated at registration time — the extension checks that an LLM endpoint is configured and that the selected file is a supported type, so neither entry point appears when neither condition is met. There is no Tier 2 fallback UI; when no LLM is configured the panel is simply absent.The core data path lives in two composables.
useInsightsfetches the raw file text over WebDAV, runs it through a client-side RFC-4180 state-machine parser (csv-parse.ts) that handles quoted fields, embedded newlines, and CRLF, then derives column types (boolean / number / date / string), value ranges, and up to five representative samples per column. It caps output at 30 columns before sending the structured preview to the LLM endpoint as ajson_objectrequest. A same-origin check is enforced before the POST so credentials are never sent cross-origin.useLlmis a thin wrapper around the configured endpoint, following the pattern established inweb-app-ai-doc-summary; theasynckeyword was removed fromensureReadyto satisfy therequire-awaitlint rule without changing behavior.InsightsPanel.vuerenders four distinct states driven by composable-exposed reactive refs: an "Analyzing…" placeholder while the request is in flight, a red alert banner on error, a column-types table with Range column plus an observation list on success, and an idle state with a primary "Analyze" button. A "Re-analyze" button is available once a result has been returned. All ODS utility classes andoc-buttonusage follow the patterns fromSummaryPanel.vueandAltTextPanel.vue.Unit test coverage spans the parser (including RFC-4180 edge cases), file-type detection, both composables (24 tests for
useInsightscovering the full HTTP error matrix and non-JSON graceful handling), and all four panel render states. The Playwright acceptance suite uploads a minimalsample.csvfixture, asserts that the "Insights" context-menu entry is visible for CSV and invisible for a JPEG, then confirms the sidebar panel mounts when the action is clicked. Analysing files larger than 200 rows or wider than 30 columns is explicitly out of scope; the parser truncates silently at those limits before the LLM call.Gate
Effort: S · 🤖 Generated by extctl