Skip to content

Commit 5ff71fa

Browse files
authored
Merge pull request #20 from TheNotelyApp/calendar_feature
Calendar feature
2 parents 0068186 + 19953c0 commit 5ff71fa

51 files changed

Lines changed: 6165 additions & 648 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Notely is built with Electron + React and is designed for project notes, meeting
4848
- Preview Mermaid diagrams and rendered Markdown content.
4949
- Create and edit structured technical diagrams with **Draw.io integration** directly from markdown previews, supporting drag-and-drop import for `.drawio` and `.drawio.xml` files, image export, and offline drawing.
5050
- Visualize the workspace as an interactive note graph.
51-
- Use built-in AI features powered by Vercel AI SDK (Gemini, Groq, OpenAI) with a 3-Brain Architecture (`WorkspaceBrain`, `ReasoningBrain`, `ActionBrain`), autonomous multi-step Planner, semantic domain tools, local-first Embeddings Engine (`BGE-small-en-v1.5` ONNX model), recursive SQLite Knowledge Graph, strict read-only note immutability safeguards, ReAct self-correction engine (`SelfCorrectionEngine`), and an automated diagnostic evaluation harness (`AgentHarness`).
51+
- Use built-in AI features powered by Vercel AI SDK (Gemini, Groq, OpenAI / OpenAI-compatible endpoints) with a 3-Brain Architecture (`WorkspaceBrain`, `ReasoningBrain`, `ActionBrain`), autonomous multi-step Planner, semantic domain tools, local-first ONNX Embeddings Engine (`BGE-small-en-v1.5`), zero-latency Context Compaction (`CompactionEngine`), local GLiNER2 ONNX Knowledge Graph Engine, strict read-only note immutability safeguards, ReAct self-correction engine (`SelfCorrectionEngine`), and an automated diagnostic evaluation harness (`AgentHarness`).
5252
- Aggregate tasks across notes with **Open Tasks** and **All Tasks** panels.
5353
- Open Tasks focuses on unchecked items.
5454
- All Tasks includes open + closed items with filtering and note grouping.
@@ -61,7 +61,7 @@ Notely is built with Electron + React and is designed for project notes, meeting
6161
- Optional `.notes-app` metadata inclusion (default off)
6262
- View note statistics (word count, line count, reading time estimate) in the status bar.
6363
- Copy note content as HTML or plain text directly from the editor toolbar.
64-
- Execute JavaScript (`js`/`javascript`) and Python (`py`/`python`) code blocks locally with the interactive ▶ Run (Play) button in both Markdown Previews and the popup Code Editor modal. Outputs (stdout/stderr) are rendered in an integrated high-contrast dark terminal output pane.
64+
- Execute JavaScript (`js`/`javascript`), Python (`py`/`python`), Bash (`bash`/`sh`), PowerShell (`powershell`/`ps1`), and HTML live-preview code blocks locally with the interactive ▶ Run (Play) button in both Markdown Previews and the popup Code Editor modal. Outputs (stdout/stderr) are rendered in an integrated high-contrast dark terminal output pane.
6565
- Navigate nested folders with breadcrumb links for easy folder traversal.
6666
- Navigate active note tabs using **Ctrl+Tab** (next tab) and **Ctrl+Shift+Tab** (previous tab) standard shortcuts.
6767
- Copy note link paths relative to the current workspace root from right-click context menus on tabs and dashboard document list items.

docs-site/.vitepress/config.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export default withMermaid(
5151
{ text: "Home", link: "/" },
5252
{ text: "Getting Started", link: "/getting-started/" },
5353
{ text: "Editor", link: "/editor/" },
54+
{ text: "Workspace", link: "/workspace/" },
5455
{ text: "Git", link: "/git/" },
5556
{ text: "AI", link: "/ai/" },
5657
{
@@ -92,6 +93,7 @@ export default withMermaid(
9293
items: [
9394
{ text: "Workspace Overview", link: "/workspace/" },
9495
{ text: "Tasks", link: "/workspace/tasks" },
96+
{ text: "Calendar", link: "/workspace/calendar" },
9597
{ text: "Media", link: "/workspace/media" },
9698
{ text: "Screen Capture", link: "/workspace/screen-capture" },
9799
{ text: "Workspace Graph", link: "/workspace/graph" },

docs/ai/setup.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Setting Up AI Providers
33
description: Configure AI settings, API keys, local endpoints, and feature flags.
4-
keywords: AI settings, API key, Ollama, OpenAI, Gemini, Groq, HuggingFace, ONNX, BGE embeddings
4+
keywords: AI settings, API key, OpenAI, Gemini, Groq, HuggingFace, ONNX, BGE embeddings
55
category: AI
66
---
77

@@ -13,12 +13,11 @@ Configure LLM provider models, API tokens, and local vector index settings insid
1313

1414
## 1. Text Generation Providers
1515

16-
Notely uses the **Vercel AI SDK** and local bindings to connect to multiple LLM APIs:
17-
- **Local (Qwen2.5-0.5B)**: Runs completely on-device and offline. Requires downloading local GGUF weights (~400MB) via the settings dashboard.
18-
- **Google Gemini**: Requires a Gemini API key. Highly recommended for rich tool calling.
19-
- **Groq**: Requires a Groq API key (supports models like `llama-3.3-70b-specdec`).
20-
- **OpenAI Compatible**: Connect to OpenAI or local servers (Ollama, LM Studio) by setting a custom Base URL and Model name.
21-
- **Connection Diagnostics**: Click the **Test** button next to any configured provider to run a diagnostic round-trip test.
16+
Notely connects to cloud and custom LLM providers using the **Vercel AI SDK**:
17+
- **Google Gemini**: Requires a Gemini API key. Default provider (`gemini-2.0-flash`), recommended for rich tool calling.
18+
- **Groq**: Requires a Groq API key (supports models like `llama-3.3-70b-versatile`, `llama-3.1-8b-instant`, `deepseek-r1-distill-llama-70b`).
19+
- **OpenAI / OpenAI-Compatible**: Connect to OpenAI (`gpt-4o`, `gpt-4o-mini`) or custom compatible endpoints by setting an API Key and custom Base URL.
20+
- **Connection Diagnostics**: Click the **Test** button next to any configured provider in **AI Settings** to verify connection status.
2221

2322
---
2423

docs/architecture.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ The Electron main process (`electron/main.cjs` & `electron/lib/`) coordinates ap
112112
* **Vector Embeddings Engine (`EmbeddingDB.js`)**: Stores 384-dimensional `BGE-small` vector chunks in `{workspace}/.notes-app/ai-embeddings.db`. Features physical vector dimension validation (`verifyModelDimensions`) to prevent dimension mismatches.
113113
* **Knowledge Graph Subsystem (`GraphService.js`, `GraphDB.js`)**: Maps note relations, tags, mentions, Wikilinks, Images, Local Documents, and External URLs in `{workspace}/.notes-app/ai-graph.db`. Executes relation traversals via SQLite **Recursive Common Table Expressions (CTEs)**.
114114
* **Agent & Tool Orchestration**: Integrates with a local embedding runtime and cloud LLMs (Gemini, Groq, OpenAI) using the Vercel AI SDK.
115-
* **Local GGUF Engines**: Supports local text generation and offline graph extraction via `node-llama-cpp`. `LocalModelManager` handles shared runtime loads of the Qwen GGUF model to prevent CPU/RAM overheads.
115+
* **Local ONNX Neural Models**: Vector embeddings (`BGE-small-en-v1.5`) and Knowledge Graph entity/relationship extraction (`gliner2-multi-v1-onnx`) run 100% on-device and offline using `onnxruntime-node`.
116116

117117
#### AI Layer Architecture
118118

@@ -235,9 +235,11 @@ graph TD
235235
end
236236
237237
subgraph CacheDir ["📁 .notes-app (Hidden Cache Folder)"]
238+
TDB[("task-db.sqlite<br/>(Task DB & Bi-directional Sync)")]
238239
VECDB[("ai-embeddings.db<br/>(384-dim Vector BLOBs)")]
239240
GDB[("ai-graph.db<br/>(Entities & CTE Edges)")]
240241
LDB[("ai-logs.db<br/>(System & App Logs)")]
242+
STATE["app-state.json / metadata"]
241243
end
242244
end
243245
@@ -261,7 +263,10 @@ graph TD
261263
* Video & Audio recordings (`.mp4`, `.webm`, `.mp3`, `.wav`, `.m4a`).
262264
* Document attachments (`.pdf`).
263265
* Excalidraw drawing files (`.excalidraw`).
264-
* **Hidden Subsystem Folder (`{workspace}/.notes-app/`)**: Internal SQLite caches for AI and system features:
266+
* **Hidden Subsystem Folder (`{workspace}/.notes-app/`)**: Internal SQLite caches for AI, tasks, and system features:
267+
* `task-db.sqlite`: Stores workspace-wide task metadata, priorities, due dates, assignee tags, source note hashes, and line indices for bi-directional checklist synchronization.
265268
* `ai-embeddings.db`: Stores chunk text, line offsets, hashes, and 384-dimensional binary vector `BLOB`s.
266269
* `ai-graph.db`: Stores extracted Knowledge Graph entity nodes, Wikilinks, media links, and relationship edges.
267270
* `ai-logs.db`: Stores multitenant application, git, embedding, graph, and AI log entries.
271+
* `app-state.json`: Caches workspace UI state, last opened note handles, and view preferences.
272+

docs/developer/index.md

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,90 @@ category: Developer
99

1010
Notely is built with Electron, React, and Vite.
1111

12-
## Architecture
12+
## 1. Core Architecture & Process Model
1313

1414
```mermaid
1515
graph TD
16-
A[Electron Main Process] -->|IPC Bridges| B[Electron Preload Script]
17-
B -->|Services| C[React Renderer Frontend]
18-
D[Local Filesystem] <--> A
19-
E[Git Binary] <--> A
16+
A[Electron Main Process main.cjs] -->|ContextBridge| B[Preload Bridge preload.cjs]
17+
B -->|React Hooks & Services| C[React Renderer Process src/]
18+
A -->|UtilityProcess| D[AI Background Worker workerProcess.cjs]
19+
A -->|Node.js child_process| E[Native Git & PTY Terminals]
20+
A <--> F[(SQLite & Markdown Storage)]
2021
```
2122

22-
- **Main Process (`electron/main.cjs`)**: Handles system calls, window lifecycle, local file input/output, Git operations via `simple-git`, and local network pairing processes.
23-
- **Preload (`electron/preload.cjs`)**: Exposes structured API handles safely to the renderer context using `contextBridge`.
24-
- **Renderer (`src/`)**: Built using React, CodeMirror for the editor canvas, and Lucide for icons.
23+
- **Main Process (`electron/main.cjs`)**: Handles window lifecycle, file I/O, IPC handler registration, menu creation, and system integrations.
24+
- **Background Utility Process (`workerManager.cjs` / `workerProcess.cjs`)**: Spawns an isolated Node.js `UtilityProcess` for asynchronous vector embedding generation and Knowledge Graph indexing. This keeps background indexing CPU spikes off the main thread.
25+
- **Preload Bridge (`electron/preload.cjs`)**: Exposes safe, validated IPC invocation methods to `window.electronAPI`.
26+
- **Renderer Process (`src/`)**: React 18 frontend with Vite, CodeMirror 6 editor canvas, KaTeX rendering, and Lucide icons.
2527

2628
---
2729

28-
## Build Tasks
30+
## 2. IPC Channel Security Guard Pattern
31+
32+
All `ipcMain.handle` endpoints MUST enforce IPC security guards and payload validation:
33+
34+
1. **Sender Authentication (`assertTrustedIpcSender`)**: Enforces that IPC invocation events originate strictly from verified internal application renderer windows, rejecting unauthorized external or injected frame messages:
35+
```javascript
36+
const { assertTrustedIpcSender } = require("./ipcSecurity.cjs");
37+
ipcMain.handle("myChannel", async (event, rawPayload) => {
38+
assertTrustedIpcSender(BrowserWindow, event, "myChannel");
39+
// ...
40+
});
41+
```
42+
2. **Payload Schema Validation (`ipcSchemas.cjs`)**: Validate raw payloads against strict schema contracts (`validatePayload`) to ensure type safety before processing file paths or commands.
43+
44+
---
45+
46+
## 3. Development Workflow & Commands
47+
48+
### Development Server
49+
```bash
50+
npm run dev
51+
```
52+
Launches Vite HMR server and Electron wrapper simultaneously.
53+
54+
### Build Production Bundle
55+
```bash
56+
npm run build
57+
```
58+
Compiles Vite frontend assets and validates CommonJS Electron main scripts.
59+
60+
### Documentation Site
61+
```bash
62+
npm run docs:dev # Launch VitePress live preview server
63+
npm run docs:build # Build static production docs site
64+
```
65+
66+
---
67+
68+
## 4. Test Suite Execution
69+
70+
Notely uses **Vitest** for comprehensive unit, integration, and IPC service testing:
71+
72+
```bash
73+
# Run all unit and integration tests
74+
npm test
75+
76+
# Run tests in watch mode
77+
npm run test:watch
78+
79+
# Run P2P network integration test harness
80+
npm run test:p2p
81+
```
82+
83+
### Key Test Directories
84+
- `tests/ai/`: Core AI orchestration, 5-stage `AIFlow`, 4-layer planning, compaction, and facade integrity tests.
85+
- `tests/golden_workspace.test.js`: Workspace creation, note CRUD, task database sync, and file watcher tests.
86+
- `electron/lib/ipc/codeExecutorIpc.test.js`: Code execution runner tests.
87+
- `electron/p2p/p2pLive.test.js`: Peer-to-peer discovery and encrypted handshake tests.
88+
89+
---
90+
91+
## 5. Build & Packaging Scripts
92+
93+
For generating standalone distribution packages:
94+
95+
- **Windows Executable Build Script (`build-windows-exe.sh`)**: Compiles and bundles a standalone Windows executable.
96+
- **Release Packaging Script (`release.sh`)**: Automates version stamping, package archive creation, and release checksum generation.
97+
- **Icon Generation (`scripts/generate-icon.cjs`)**: Generates app icons from source image assets (`process.env.NOTELY_ICON_SOURCE`).
2998

30-
- **`npm run dev`**: Starts Vite dev server and runs the Electron wrapper.
31-
- **`npm run build`**: Compiles assets for distribution.
32-
- **`npm run docs:dev`**: Launch VitePress development site.
33-
- **`npm run docs:build`**: Builds the static documentation site.

docs/editor/code-blocks.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,24 @@ Click **Save** to write changes back to the note, or **Cancel** to discard.
6767
You can run code snippets directly from your notes:
6868

6969
1. Hover over a code block in **Preview** mode.
70-
2. If the block is written in JavaScript (`js`, `javascript`) or Python (`py`, `python`), the **▶ Run** button in the hover toolbar will be active.
71-
3. Click **▶ Run** to execute the script locally.
72-
4. The output is displayed in a collapsible, high-contrast dark terminal output frame beneath the code block.
70+
2. If the block is written in a supported language, the **▶ Run** button in the hover toolbar will be active.
71+
3. Supported execution languages include:
72+
- **JavaScript** (`js`, `javascript`): runs locally via `node`.
73+
- **Python** (`py`, `python`): runs locally via system `python` / `python3`.
74+
- **Bash** (`sh`, `bash`): runs shell scripts locally via `bash` or `sh`.
75+
- **PowerShell** (`ps1`, `powershell`): runs scripts via `powershell` or `pwsh`.
76+
- **HTML** (`html`): renders live HTML DOM output inside an interactive preview drawer.
77+
4. Click **▶ Run** to execute the script or preview output.
78+
5. Command outputs (stdout/stderr) are displayed in a collapsible, high-contrast dark terminal output frame beneath the code block.
7379

7480
You can also execute code from inside the **Dedicated Code Editor** modal using the **Execute** button in the top toolbar.
7581

7682
::: warning Security Note
77-
Running code execution spawns a local process on your machine using your local `node` or `python`/`python3` installation. Only run code from trusted workspaces and sources.
83+
Running code execution spawns a local process on your machine using your local system environment. Only run code from trusted workspaces and sources.
7884
:::
7985

8086
::: info Execution Limits & Loops
81-
Code execution terminates automatically after 10 seconds. If your code hangs or enters an infinite loop, the runner will kill the subprocess safely and report a timeout error.
87+
Code execution terminates automatically after 10 seconds. If your code hangs or enters an infinite loop, the runner will kill the subprocess safely and report a timeout error. Buffer sizes are capped at 64KB.
8288
:::
8389

8490
## Supported Languages

docs/editor/diagrams.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,5 @@ Drop any existing `.drawio` or `.drawio.xml` file directly into the Markdown Edi
128128
|---|---|---|---|
129129
| **Best for** | Fast text-based flows, timelines | Casual sketching, wireframes | Engineering schematics, network charts |
130130
| **Editing** | Text syntax | Visual canvas | Visual canvas |
131-
| **Storage** | Plain Markdown text | XML drawing + PNG preview | XML drawing + PNG preview |
131+
| **Storage** | Plain Markdown text | JSON `.excalidraw` + SVG preview | XML `.drawio` + PNG preview |
132132
| **Offline** ||||

docs/feature-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Notely provides a rich experience for working with code snippets:
8181
- **Auto-detection**: Paste a snippet without a language tag and Notely will automatically detect it (e.g., JavaScript, Python, HTML).
8282
- **Auto-formatting**: Use the 🪄 Format button in the preview hover toolbar or inside the editor to instantly auto-indent and format your code using Prettier.
8383
- **Dedicated Editor**: Click the ✎ Edit button on any code block in Preview mode to open a distraction-free Code Editor popup with syntax highlighting, search, and language selection.
84-
- **Code Execution**: Click the ▶ Run button in the hover toolbar or inside the popup editor to execute JavaScript (`js`, `javascript`) and Python (`py`, `python`) snippets locally. Output is displayed in an integrated high-contrast dark terminal output drawer (with exit status and a "Clear" button). Execution times out automatically after 10 seconds to prevent hanging. For other languages, the run button is disabled with a helpful tooltip.
84+
- **Code Execution**: Click the ▶ Run button in the hover toolbar or inside the popup editor to execute JavaScript (`js`), Python (`py`), Bash (`sh`), PowerShell (`ps1`), and HTML live-preview snippets locally. Output is displayed in an integrated high-contrast dark terminal output drawer (with exit status and a "Clear" button). Execution times out automatically after 10 seconds to prevent hanging. For unsupported languages, the run button is disabled with a helpful tooltip.
8585

8686
### Find and replace
8787

docs/git/branches.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Configure an upstream remote (like GitHub, GitLab, or a self-hosted Git server)
2424
- **Pull**: Fetch and merge changes from the remote repository to update your local workspace.
2525
- **Push**: Upload your local commits to the remote repository.
2626

27-
Credentials are saved securely within your system keychain.
27+
Authentication uses Personal Access Tokens (PAT). When performing remote actions with a PAT, Notely temporarily injects the token into the git remote URL for the operation and immediately restores the clean original URL afterwards, keeping plain-text credentials out of persistent repository settings.
2828

2929
---
3030

0 commit comments

Comments
 (0)