Skip to content

Commit e735081

Browse files
committed
Release v0.1.36
1 parent fb37ff2 commit e735081

13 files changed

Lines changed: 83 additions & 27 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<a href="https://github.com/WGLabz/Notely/actions">
1212
<img src="https://github.com/WGLabz/Notely/actions/workflows/cd.yml/badge.svg" alt="CD Status">
1313
</a>
14-
<img src="https://img.shields.io/badge/version-v0.1.35-blue" alt="Version" />
14+
<img src="https://img.shields.io/badge/version-v0.1.36-blue" alt="Version" />
1515
<img src="https://img.shields.io/badge/license-CC--BY--NC--4.0-green" alt="License" />
1616
<img src="https://img.shields.io/badge/platform-Windows-lightgrey" alt="Platform" />
1717

‎ai/embeddings/EmbeddingDB.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ class EmbeddingDB {
242242
}
243243

244244
dequeue() {
245+
if (!this.db) return null;
245246
const nextJob = this.db.prepare(`
246247
SELECT * FROM indexing_queue
247248
WHERE status = 'pending'

‎ai/embeddings/MarkdownChunker.js‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,24 @@ class MarkdownChunker {
2222
let startLine = 1;
2323
let chunkIndex = 0;
2424
let currentType = 'paragraph';
25+
let currentHeading = '';
2526

2627
const flushChunk = (endLine) => {
2728
if (currentChunkLines.length === 0) return;
2829

29-
const chunkText = currentChunkLines.join('\n').trim();
30-
if (chunkText.length >= minChunkSize) {
30+
const rawText = currentChunkLines.join('\n').trim();
31+
if (rawText.length >= minChunkSize) {
3132
const basename = String(notePath).split(/[/\\]/).pop().replace(/\.md$/, '');
3233
const id = `${basename}#chunk-${chunkIndex}`;
34+
const content = currentHeading && !rawText.startsWith('#')
35+
? `[Context: ${currentHeading}]\n${rawText}`
36+
: rawText;
3337

3438
chunks.push({
3539
id,
3640
note_path: notePath,
3741
chunk_index: chunkIndex,
38-
content: chunkText,
42+
content,
3943
chunk_type: currentType,
4044
start_line: startLine,
4145
end_line: endLine,
@@ -58,6 +62,7 @@ class MarkdownChunker {
5862
if (isHeader) {
5963
// Flush previous chunk
6064
flushChunk(lineNum - 1);
65+
currentHeading = line.replace(/^#+\s*/, '').trim();
6166
startLine = lineNum;
6267
currentType = 'heading';
6368
currentChunkLines.push(line);

‎ai/graph/GraphDB.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class GraphDB {
5252
this.db.exec('PRAGMA foreign_keys = ON;');
5353
this.db.exec('PRAGMA journal_mode = WAL;');
5454
this.db.exec('PRAGMA synchronous = NORMAL;');
55+
this.db.exec('PRAGMA busy_timeout = 5000;');
5556

5657
// Create base tables
5758
this.db.exec(CREATE_ENTITIES_TABLE);

‎app-version.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"major": 0,
33
"minor": 1,
4-
"patch": 35
4+
"patch": 36
55
}

‎electron/lib/ipc/codeExecutorIpc.cjs‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ const fs = require("fs");
33
const path = require("path");
44
const os = require("os");
55
const { assertTrustedIpcSender } = require("./ipcSecurity.cjs");
6+
const { CodeExecuteSchema, validatePayload } = require("./ipcSchemas.cjs");
67

78
function registerCodeExecutorIpcHandlers(ipcMain, deps) {
89
const { BrowserWindow } = deps;
910

10-
ipcMain.handle("code:execute", async (event, payload) => {
11+
ipcMain.handle("code:execute", async (event, rawPayload) => {
1112
assertTrustedIpcSender(BrowserWindow, event, "code:execute");
12-
13-
const { language, code } = payload || {};
14-
if (!language || typeof code !== "string") {
15-
throw new Error("Invalid execution payload: language and code are required.");
16-
}
13+
const { language, code } = validatePayload(CodeExecuteSchema, rawPayload, "code:execute");
1714

1815
const normLang = language.toLowerCase();
1916
const supportedLangs = ["javascript", "js", "python", "py", "bash", "sh", "powershell", "ps1", "html"];

‎electron/lib/ipc/ipcSchemas.cjs‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const { z } = require("zod");
2+
3+
const DocumentReadSchema = z.object({
4+
filePath: z.string().min(1, "File path is required"),
5+
});
6+
7+
const DocumentSaveSchema = z.object({
8+
filePath: z.string().min(1, "File path is required"),
9+
content: z.string(),
10+
});
11+
12+
const CodeExecuteSchema = z.object({
13+
language: z.string().min(1, "Language is required"),
14+
code: z.string(),
15+
});
16+
17+
const PackageExportSchema = z.object({
18+
destinationPath: z.string().min(1, "Destination path is required"),
19+
notePaths: z.array(z.string()).optional(),
20+
});
21+
22+
function validatePayload(schema, payload, channelName) {
23+
const result = schema.safeParse(payload);
24+
if (!result.success) {
25+
const errorMsg = result.error.errors.map((e) => `${e.path.join(".")}: ${e.message}`).join("; ");
26+
throw new Error(`Invalid IPC payload for ${channelName}: ${errorMsg}`);
27+
}
28+
return result.data;
29+
}
30+
31+
module.exports = {
32+
DocumentReadSchema,
33+
DocumentSaveSchema,
34+
CodeExecuteSchema,
35+
PackageExportSchema,
36+
validatePayload,
37+
};

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "notely",
3-
"version": "0.1.35",
3+
"version": "0.1.36",
44
"private": true,
55
"description": "Notely desktop markdown notes app.",
66
"license": "CC-BY-NC-4.0",

‎src/components/mermaid/MermaidCanvas.jsx‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import {
1010
Square,
1111
Circle,
1212
Diamond,
13-
Plus,
14-
Maximize2,
13+
Plus
1514
} from "lucide-react";
1615

1716
export function MermaidCanvas({
@@ -70,7 +69,7 @@ export function MermaidCanvas({
7069
cursor: "pointer",
7170
}}
7271
>
73-
<Square size={13} /> Process
72+
<Square size={14} /> Process
7473
</button>
7574
<button
7675
className="canvas-shape-btn"
@@ -89,7 +88,7 @@ export function MermaidCanvas({
8988
cursor: "pointer",
9089
}}
9190
>
92-
<Diamond size={13} /> Decision
91+
<Diamond size={14} /> Decision
9392
</button>
9493
<button
9594
className="canvas-shape-btn"
@@ -108,7 +107,7 @@ export function MermaidCanvas({
108107
cursor: "pointer",
109108
}}
110109
>
111-
<Circle size={13} /> Start / End
110+
<Circle size={14} /> Start / End
112111
</button>
113112
<button
114113
className="canvas-shape-btn"
@@ -127,7 +126,7 @@ export function MermaidCanvas({
127126
cursor: "pointer",
128127
}}
129128
>
130-
<Circle size={13} /> Circle
129+
<Circle size={14} /> Circle
131130
</button>
132131
<button
133132
className="canvas-shape-btn primary"

‎src/components/mermaid/MermaidNode.jsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const MermaidNode = memo(function MermaidNode({ id, data, selected }) {
155155
) : (
156156
<div className="node-label-wrap" onDoubleClick={handleDoubleClick} style={{ display: "flex", alignItems: "center", gap: 6, cursor: "text" }}>
157157
<span className="node-label-text">{label}</span>
158-
<Edit2 size={10} className="node-edit-icon" style={{ opacity: 0.4, transition: "opacity 0.15s ease" }} />
158+
<Edit2 size={12} className="node-edit-icon" style={{ opacity: 0.4, transition: "opacity 0.15s ease" }} />
159159
</div>
160160
)}
161161
</div>
@@ -187,7 +187,7 @@ export const MermaidNode = memo(function MermaidNode({ id, data, selected }) {
187187
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
188188
}}
189189
>
190-
<Trash2 size={10} />
190+
<Trash2 size={12} />
191191
</button>
192192
)}
193193
</div>

0 commit comments

Comments
 (0)