@noteplanco/noteplan-mcp 1.1.7 → 1.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/noteplan/embeddings.d.ts +8 -0
- package/dist/noteplan/embeddings.d.ts.map +1 -1
- package/dist/noteplan/embeddings.js +3 -3
- package/dist/noteplan/embeddings.js.map +1 -1
- package/dist/noteplan/file-reader.d.ts +6 -0
- package/dist/noteplan/file-reader.d.ts.map +1 -1
- package/dist/noteplan/file-reader.js +15 -0
- package/dist/noteplan/file-reader.js.map +1 -1
- package/dist/noteplan/file-writer.d.ts.map +1 -1
- package/dist/noteplan/file-writer.js +13 -1
- package/dist/noteplan/file-writer.js.map +1 -1
- package/dist/noteplan/file-writer.test.js +4 -0
- package/dist/noteplan/file-writer.test.js.map +1 -1
- package/dist/noteplan/frontmatter-parser.d.ts +2 -2
- package/dist/noteplan/frontmatter-parser.d.ts.map +1 -1
- package/dist/noteplan/frontmatter-parser.js +9 -12
- package/dist/noteplan/frontmatter-parser.js.map +1 -1
- package/dist/noteplan/frontmatter-parser.test.js +92 -0
- package/dist/noteplan/frontmatter-parser.test.js.map +1 -1
- package/dist/noteplan/markdown-parser.d.ts.map +1 -1
- package/dist/noteplan/markdown-parser.js +4 -2
- package/dist/noteplan/markdown-parser.js.map +1 -1
- package/dist/noteplan/markdown-parser.test.js +37 -0
- package/dist/noteplan/markdown-parser.test.js.map +1 -1
- package/dist/noteplan/template-docs.d.ts +35 -0
- package/dist/noteplan/template-docs.d.ts.map +1 -0
- package/dist/noteplan/template-docs.js +184 -0
- package/dist/noteplan/template-docs.js.map +1 -0
- package/dist/noteplan/unified-store.d.ts +2 -0
- package/dist/noteplan/unified-store.d.ts.map +1 -1
- package/dist/noteplan/unified-store.js +22 -6
- package/dist/noteplan/unified-store.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +275 -55
- package/dist/server.js.map +1 -1
- package/dist/tools/calendar.d.ts +2 -2
- package/dist/tools/notes.d.ts +81 -22
- package/dist/tools/notes.d.ts.map +1 -1
- package/dist/tools/notes.js +267 -21
- package/dist/tools/notes.js.map +1 -1
- package/dist/tools/notes.test.js +202 -0
- package/dist/tools/notes.test.js.map +1 -1
- package/dist/tools/plugins.d.ts.map +1 -1
- package/dist/tools/plugins.js +1 -0
- package/dist/tools/plugins.js.map +1 -1
- package/dist/tools/search.d.ts +2 -2
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +32 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/templates.d.ts +64 -3
- package/dist/tools/templates.d.ts.map +1 -1
- package/dist/tools/templates.js +73 -1
- package/dist/tools/templates.js.map +1 -1
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +67 -23
- package/dist/utils/version.js.map +1 -1
- package/docs/templates.db.gz +0 -0
- package/docs/x-callback-url.md +318 -0
- package/package.json +1 -1
package/dist/tools/templates.js
CHANGED
|
@@ -3,14 +3,19 @@ import { z } from 'zod';
|
|
|
3
3
|
import * as store from '../noteplan/unified-store.js';
|
|
4
4
|
import { runAppleScript, escapeAppleScript, APP_NAME } from '../utils/applescript.js';
|
|
5
5
|
import { getNotePlanVersion, MIN_BUILD_RENDER_TEMPLATE } from '../utils/version.js';
|
|
6
|
+
import { tryEmbedQuery, searchTemplateDocs, textSearchTemplateDocs, getDocChunk } from '../noteplan/template-docs.js';
|
|
6
7
|
export const templatesSchema = z.object({
|
|
7
|
-
action: z.enum(['list', 'render']).describe('Action to perform'),
|
|
8
|
+
action: z.enum(['list', 'render', 'search_docs', 'get_doc']).describe('Action to perform'),
|
|
8
9
|
templateTitle: z.string().optional().describe('Template title — used by render (loads a saved template by title)'),
|
|
9
10
|
content: z.string().optional().describe('Raw template content string — used by render (renders arbitrary template code for debugging)'),
|
|
10
11
|
folder: z.string().optional().describe('Template subfolder — used by list (default: @Templates)'),
|
|
11
12
|
limit: z.number().min(1).max(200).optional().default(50).describe('Maximum results — used by list'),
|
|
12
13
|
offset: z.number().min(0).optional().default(0).describe('Pagination offset — used by list'),
|
|
13
14
|
cursor: z.string().optional().describe('Cursor from previous page — used by list'),
|
|
15
|
+
query: z.string().optional().describe('Search query — used by search_docs'),
|
|
16
|
+
includeContent: z.boolean().optional().describe('Include full chunk text in results — used by search_docs'),
|
|
17
|
+
noteTitle: z.string().optional().describe('Doc note title — used by get_doc (from search_docs results)'),
|
|
18
|
+
chunkIndex: z.number().optional().describe('Chunk index — used by get_doc (from search_docs results, default 0)'),
|
|
14
19
|
});
|
|
15
20
|
// ── Frontmatter helpers ──
|
|
16
21
|
function extractFrontmatter(content) {
|
|
@@ -62,6 +67,7 @@ export function listTemplates(params) {
|
|
|
62
67
|
const nextCursor = hasMore ? String(offset + page.length) : null;
|
|
63
68
|
return {
|
|
64
69
|
success: true,
|
|
70
|
+
tip: 'Before writing or editing templates, use action "search_docs" with a query to search the built-in documentation for syntax, helpers, DataStore API, and examples.',
|
|
65
71
|
count: page.length,
|
|
66
72
|
totalCount: notes.length,
|
|
67
73
|
offset,
|
|
@@ -115,6 +121,7 @@ export function renderTemplate(params) {
|
|
|
115
121
|
if (parsed.success === true) {
|
|
116
122
|
return {
|
|
117
123
|
success: true,
|
|
124
|
+
tip: 'Use action "search_docs" with a query to search the built-in documentation for template syntax, helpers, DataStore API, and examples.',
|
|
118
125
|
renderedContent: parsed.rendered ?? raw,
|
|
119
126
|
source: content ? 'raw_content' : 'saved_template',
|
|
120
127
|
templateTitle: templateTitle || undefined,
|
|
@@ -142,4 +149,69 @@ export function renderTemplate(params) {
|
|
|
142
149
|
};
|
|
143
150
|
}
|
|
144
151
|
}
|
|
152
|
+
// ── Get full doc chunk ──
|
|
153
|
+
export function getDoc(params) {
|
|
154
|
+
const noteTitle = params.noteTitle?.trim();
|
|
155
|
+
if (!noteTitle) {
|
|
156
|
+
return { success: false, error: 'noteTitle is required for get_doc' };
|
|
157
|
+
}
|
|
158
|
+
const chunkIndex = params.chunkIndex ?? 0;
|
|
159
|
+
const chunk = getDocChunk(noteTitle, chunkIndex);
|
|
160
|
+
if (!chunk) {
|
|
161
|
+
return {
|
|
162
|
+
success: false,
|
|
163
|
+
error: `No doc chunk found for noteTitle="${noteTitle}" chunkIndex=${chunkIndex}`,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
success: true,
|
|
168
|
+
noteTitle: chunk.noteTitle,
|
|
169
|
+
chunkIndex: chunk.chunkIndex,
|
|
170
|
+
totalChunks: chunk.totalChunks,
|
|
171
|
+
content: chunk.content,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
// ── Search template docs ──
|
|
175
|
+
export async function searchDocs(params) {
|
|
176
|
+
const query = params.query?.trim();
|
|
177
|
+
if (!query) {
|
|
178
|
+
return {
|
|
179
|
+
success: false,
|
|
180
|
+
error: 'query is required for search_docs',
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const searchOptions = {
|
|
184
|
+
limit: params.limit ?? 5,
|
|
185
|
+
includeContent: params.includeContent,
|
|
186
|
+
};
|
|
187
|
+
try {
|
|
188
|
+
const embedResult = await tryEmbedQuery(query);
|
|
189
|
+
if (embedResult.ok) {
|
|
190
|
+
// Semantic search using embeddings
|
|
191
|
+
const matches = searchTemplateDocs(embedResult.vector, searchOptions);
|
|
192
|
+
return {
|
|
193
|
+
success: true,
|
|
194
|
+
query,
|
|
195
|
+
count: matches.length,
|
|
196
|
+
embeddingSource: embedResult.source,
|
|
197
|
+
matches,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// No embedding source available — fall back to text search
|
|
201
|
+
const matches = textSearchTemplateDocs(query, searchOptions);
|
|
202
|
+
return {
|
|
203
|
+
success: true,
|
|
204
|
+
query,
|
|
205
|
+
count: matches.length,
|
|
206
|
+
embeddingSource: 'text',
|
|
207
|
+
matches,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
return {
|
|
212
|
+
success: false,
|
|
213
|
+
error: error instanceof Error ? error.message : 'Template doc search failed',
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
145
217
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/tools/templates.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAE5C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEtH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC1F,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mEAAmE,CAAC;IAClH,OAAO,EAAE,C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YACtE,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK;gBACL,KAAK,EAAE,OAAO,CAAC,MAAM;gBACrB,eAAe,EAAE,WAAW,CAAC,MAAM;gBACnC,OAAO;aACR,CAAC;QACJ,CAAC;QAED,2DAA2D;QAC3D,MAAM,OAAO,GAAG,sBAAsB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QAC7D,OAAO;YACL,OAAO,EAAE,IAAI;YACb,KAAK;YACL,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,eAAe,EAAE,MAAe;YAChC,OAAO;SACR,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B;SAC7E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export interface NotePlanVersion {
|
|
|
5
5
|
}
|
|
6
6
|
export declare const MIN_BUILD_ADVANCED_FEATURES = 1300;
|
|
7
7
|
export declare const MIN_BUILD_RENDER_TEMPLATE = 1400;
|
|
8
|
+
export declare const MIN_BUILD_EMBED_TEXT = 1490;
|
|
8
9
|
export declare const MIN_BUILD_CREATE_BACKUP = 1492;
|
|
9
10
|
export declare function getNotePlanVersion(forceRefresh?: boolean): NotePlanVersion;
|
|
10
11
|
export declare function isAdvancedFeaturesAvailable(forceRefresh?: boolean): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAGD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAG9C,eAAO,MAAM,uBAAuB,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;CAC7C;AAGD,eAAO,MAAM,2BAA2B,OAAO,CAAC;AAGhD,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAG9C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAGzC,eAAO,MAAM,uBAAuB,OAAO,CAAC;AA6G5C,wBAAgB,kBAAkB,CAAC,YAAY,UAAQ,GAAG,eAAe,CAUxE;AAED,wBAAgB,2BAA2B,CAAC,YAAY,UAAQ,GAAG,OAAO,CAGzE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAID,wBAAgB,mBAAmB,IAAI,MAAM,CAU5C"}
|
package/dist/utils/version.js
CHANGED
|
@@ -6,47 +6,91 @@ import * as path from 'path';
|
|
|
6
6
|
export const MIN_BUILD_ADVANCED_FEATURES = 1300;
|
|
7
7
|
// Build that ships the renderTemplate AppleScript command
|
|
8
8
|
export const MIN_BUILD_RENDER_TEMPLATE = 1400;
|
|
9
|
+
// Build that ships the embedText AppleScript command
|
|
10
|
+
export const MIN_BUILD_EMBED_TEXT = 1490;
|
|
9
11
|
// Build that ships the createBackup AppleScript command
|
|
10
12
|
export const MIN_BUILD_CREATE_BACKUP = 1492;
|
|
11
13
|
const CACHE_TTL_MS = 60_000;
|
|
12
14
|
let cachedVersion = null;
|
|
13
15
|
let cachedAt = 0;
|
|
16
|
+
// AppleScript may resolve the app by CFBundleName or by .app filename depending on macOS version.
|
|
17
|
+
// MAS installs can use the store marketing name as the .app folder name, so we try multiple names.
|
|
18
|
+
const APPLESCRIPT_APP_NAMES = [
|
|
19
|
+
'NotePlan',
|
|
20
|
+
'NotePlan 3',
|
|
21
|
+
'NotePlan - To-Do List & Notes',
|
|
22
|
+
];
|
|
14
23
|
function detectViaAppleScript() {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
for (const appName of APPLESCRIPT_APP_NAMES) {
|
|
25
|
+
try {
|
|
26
|
+
const isRunning = execFileSync('osascript', ['-e', `application "${appName}" is running`], {
|
|
27
|
+
encoding: 'utf-8',
|
|
28
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
29
|
+
timeout: 3_000,
|
|
30
|
+
}).trim();
|
|
31
|
+
if (isRunning !== 'true')
|
|
32
|
+
continue;
|
|
33
|
+
const raw = execFileSync('osascript', ['-e', `tell application "${appName}" to getVersion`], {
|
|
34
|
+
encoding: 'utf-8',
|
|
35
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
36
|
+
timeout: 5_000,
|
|
37
|
+
}).trim();
|
|
38
|
+
const parsed = JSON.parse(raw);
|
|
39
|
+
if (typeof parsed.version === 'string' && typeof parsed.build === 'number') {
|
|
40
|
+
return { version: parsed.version, build: parsed.build, source: 'applescript' };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
45
|
+
console.error(`[noteplan-mcp] AppleScript detection failed for "${appName}": ${msg}`);
|
|
46
|
+
if (msg.includes('not allowed') || msg.includes('permission') || msg.includes('1743') || msg.includes('assistive')) {
|
|
47
|
+
console.error('[noteplan-mcp] Hint: The parent app (e.g. Claude Desktop, Terminal) may need Automation permission for NotePlan. Check System Settings > Privacy & Security > Automation.');
|
|
48
|
+
return null; // Permission issue — no point trying other names
|
|
49
|
+
}
|
|
32
50
|
}
|
|
33
51
|
}
|
|
34
|
-
|
|
35
|
-
// App not running or command not available
|
|
36
|
-
}
|
|
52
|
+
console.error('[noteplan-mcp] AppleScript: NotePlan not found running under any known name.');
|
|
37
53
|
return null;
|
|
38
54
|
}
|
|
39
55
|
const KNOWN_APP_PATHS = [
|
|
40
56
|
'/Applications/NotePlan 3.app',
|
|
41
57
|
'/Applications/NotePlan.app',
|
|
58
|
+
'/Applications/NotePlan - To-Do List & Notes.app',
|
|
42
59
|
path.join(process.env.HOME ?? '', 'Applications/NotePlan 3.app'),
|
|
43
60
|
path.join(process.env.HOME ?? '', 'Applications/NotePlan.app'),
|
|
61
|
+
path.join(process.env.HOME ?? '', 'Applications/NotePlan - To-Do List & Notes.app'),
|
|
44
62
|
// Setapp
|
|
45
63
|
'/Applications/Setapp/NotePlan 3.app',
|
|
46
64
|
'/Applications/Setapp/NotePlan.app',
|
|
47
65
|
];
|
|
48
66
|
function detectViaPlist() {
|
|
49
|
-
|
|
67
|
+
// First try hardcoded known paths
|
|
68
|
+
const result = readVersionFromAppPath(KNOWN_APP_PATHS);
|
|
69
|
+
if (result)
|
|
70
|
+
return result;
|
|
71
|
+
// Fallback: use mdfind (Spotlight) to locate the app bundle dynamically
|
|
72
|
+
console.error(`[noteplan-mcp] Plist: app not found at known paths, trying mdfind...`);
|
|
73
|
+
try {
|
|
74
|
+
const mdfindResult = execFileSync('mdfind', ['kMDItemCFBundleIdentifier == "co.noteplan.NotePlan3" || kMDItemCFBundleIdentifier == "co.noteplan.NotePlan-setapp" || kMDItemCFBundleIdentifier == "co.noteplan.NotePlan"'], {
|
|
75
|
+
encoding: 'utf-8',
|
|
76
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
77
|
+
timeout: 5_000,
|
|
78
|
+
}).trim();
|
|
79
|
+
if (mdfindResult) {
|
|
80
|
+
const discoveredPaths = mdfindResult.split('\n').filter(Boolean);
|
|
81
|
+
console.error(`[noteplan-mcp] mdfind discovered: ${discoveredPaths.join(', ')}`);
|
|
82
|
+
const found = readVersionFromAppPath(discoveredPaths);
|
|
83
|
+
if (found)
|
|
84
|
+
return found;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
console.error(`[noteplan-mcp] mdfind fallback failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
function readVersionFromAppPath(appPaths) {
|
|
93
|
+
for (const appPath of appPaths) {
|
|
50
94
|
const plistPath = path.join(appPath, 'Contents/Info.plist');
|
|
51
95
|
if (!fs.existsSync(plistPath))
|
|
52
96
|
continue;
|
|
@@ -66,8 +110,8 @@ function detectViaPlist() {
|
|
|
66
110
|
return { version, build, source: 'plist' };
|
|
67
111
|
}
|
|
68
112
|
}
|
|
69
|
-
catch {
|
|
70
|
-
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.error(`[noteplan-mcp] Plist read failed for ${appPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
71
115
|
}
|
|
72
116
|
}
|
|
73
117
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAQ7B,iFAAiF;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAEhD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAE9C,wDAAwD;AACxD,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,YAAY,GAAG,MAAM,CAAC;AA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AC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,gBAAgB,GAAG,GAAG,CAAC,OAAO,IAAI,SAAS,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,gBAAgB,GAAG,SAAS,CAAC;IAC/B,CAAC;IACD,OAAO,gBAAiB,CAAC;AAC3B,CAAC"}
|
|
Binary file
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# NotePlan x-callback-url Reference
|
|
2
|
+
|
|
3
|
+
NotePlan supports the `noteplan://x-callback-url/` URL scheme for automation, deep linking, and integration with other apps. These URLs work on both macOS and iOS.
|
|
4
|
+
|
|
5
|
+
## Base URL Format
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
noteplan://x-callback-url/<action>?<param1>=<value1>&<param2>=<value2>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
All parameter values must be **percent-encoded** (URL-encoded). Use `%20` for spaces, `%0A` for newlines, `%23` for `#`, etc.
|
|
12
|
+
|
|
13
|
+
## x-callback-url Support
|
|
14
|
+
|
|
15
|
+
All actions support the standard [x-callback-url](http://x-callback-url.com) parameters:
|
|
16
|
+
- **x-success** — URL to open when the action completes successfully. For `noteInfo`, the callback receives `?path=<path>&name=<name>`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Note Targeting Parameters
|
|
21
|
+
|
|
22
|
+
Many actions need to identify which note to act on. Use **one** of these parameters:
|
|
23
|
+
|
|
24
|
+
| Parameter | Description | Example |
|
|
25
|
+
|-----------|-------------|---------|
|
|
26
|
+
| `noteDate` | Date of a calendar note. Accepts `YYYYMMDD`, `YYYY-MM-DD`, `today`, `tomorrow`, `yesterday` | `noteDate=20250217` |
|
|
27
|
+
| `noteTitle` | Title of a project note (case-sensitive by default) | `noteTitle=My%20Note` |
|
|
28
|
+
| `fileName` | Filename/path of a note (with extension) | `fileName=Projects/todo.md` |
|
|
29
|
+
| `id` | Supabase note ID | `id=abc123` |
|
|
30
|
+
|
|
31
|
+
Additional targeting options:
|
|
32
|
+
- **caseSensitive** — `true` (default) or `false`, applies to `noteTitle` lookups
|
|
33
|
+
- **heading** / **subheading** — Jump to a specific heading within the note
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Actions
|
|
38
|
+
|
|
39
|
+
### openNote
|
|
40
|
+
|
|
41
|
+
Open an existing note. If the note doesn't exist, it creates one (using `noteTitle` as the title).
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
noteplan://x-callback-url/openNote?noteTitle=Meeting%20Notes
|
|
45
|
+
noteplan://x-callback-url/openNote?noteDate=today
|
|
46
|
+
noteplan://x-callback-url/openNote?fileName=Projects/roadmap.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
| Parameter | Description |
|
|
50
|
+
|-----------|-------------|
|
|
51
|
+
| `noteDate` / `noteTitle` / `fileName` | Which note to open (see Note Targeting) |
|
|
52
|
+
| `heading` | Scroll to and highlight this heading |
|
|
53
|
+
| `subWindow` | `yes` to open in a new window (macOS) |
|
|
54
|
+
| `splitView` | `yes` to open in split view (macOS) |
|
|
55
|
+
| `reuseSplitView` | `yes` to reuse an existing split view |
|
|
56
|
+
| `useExistingSubWindow` | `yes` to reuse an existing sub window (macOS) |
|
|
57
|
+
| `view` | `daily` or `week` — override the view for calendar notes (macOS) |
|
|
58
|
+
| `timeframe` | `day`, `week`, `month`, `quarter`, `year` |
|
|
59
|
+
| `parent` | Teamspace/space parent identifier |
|
|
60
|
+
| `stayInSpace` | `yes` to stay in the current teamspace context |
|
|
61
|
+
| `highlightStart` | Character offset to highlight |
|
|
62
|
+
| `highlightLength` | Length of highlight range |
|
|
63
|
+
| `editorID` | Target a specific editor pane |
|
|
64
|
+
| `showEventsOnly` | `yes` to show only calendar events (iOS) |
|
|
65
|
+
| `shouldOpenTrashedNotes` | `yes` to allow opening trashed notes |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
### addText
|
|
70
|
+
|
|
71
|
+
Append or prepend text to an existing note.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
noteplan://x-callback-url/addText?noteDate=today&text=*%20Buy%20groceries&mode=append&openNote=no
|
|
75
|
+
noteplan://x-callback-url/addText?noteTitle=Journal&text=Had%20a%20great%20day&mode=append
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Parameter | Required | Description |
|
|
79
|
+
|-----------|----------|-------------|
|
|
80
|
+
| `noteDate` / `noteTitle` / `fileName` | Yes | Which note to modify |
|
|
81
|
+
| `text` | Yes | The text to add (percent-encoded) |
|
|
82
|
+
| `mode` | No | `append` (default) or `prepend` |
|
|
83
|
+
| `openNote` | No | `yes` to open the note after adding text, `no` (default) to stay in current app |
|
|
84
|
+
|
|
85
|
+
**Tips:**
|
|
86
|
+
- Use `%0A` for newlines in the text parameter
|
|
87
|
+
- Prefix tasks with `*%20` for bullet/task format (e.g., `text=*%20My%20task`)
|
|
88
|
+
- Use `mode=prepend` to add at the top of the note (after the heading for calendar notes)
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
### addNote
|
|
93
|
+
|
|
94
|
+
Create a new project note.
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
noteplan://x-callback-url/addNote?noteTitle=Weekly%20Review&text=##%20Wins&openNote=yes
|
|
98
|
+
noteplan://x-callback-url/addNote?noteTitle=Meeting&text=Attendees&folder=Work
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Parameter | Required | Description |
|
|
102
|
+
|-----------|----------|-------------|
|
|
103
|
+
| `noteTitle` | Yes | Title for the new note (a `#` heading is auto-prepended if missing) |
|
|
104
|
+
| `text` | No | Body content of the note |
|
|
105
|
+
| `folder` | No | Folder to create the note in (e.g., `Projects`, `Work/Active`) |
|
|
106
|
+
| `openNote` | No | `yes` to open after creation |
|
|
107
|
+
| `subWindow` | No | `yes` to open in a new window (macOS) |
|
|
108
|
+
| `splitView` | No | `yes` to open in split view (macOS) |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### addQuickTask (iOS only)
|
|
113
|
+
|
|
114
|
+
Opens the quick-add task editor, optionally pre-targeted to a specific note.
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
noteplan://x-callback-url/addQuickTask?destination=today
|
|
118
|
+
noteplan://x-callback-url/addQuickTask?destination=tomorrow&heading=Tasks&position=beginning
|
|
119
|
+
noteplan://x-callback-url/addQuickTask?destination=customnote¬eTitle=Inbox
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Parameter | Required | Description |
|
|
123
|
+
|-----------|----------|-------------|
|
|
124
|
+
| `destination` | No | `today` (default), `tomorrow`, `yesterday`, `thisWeek`, `nextWeek`, `thisMonth`, `nextMonth`, `thisQuarter`, `nextQuarter`, `thisYear`, `nextYear`, or `customnote` |
|
|
125
|
+
| `timeframe` | No | `day` (default), `week`, `month`, `quarter`, `year` — sets the note timeframe |
|
|
126
|
+
| `noteTitle` | No | Required when `destination=customnote` — the project note title |
|
|
127
|
+
| `heading` | No | Target heading section in the note |
|
|
128
|
+
| `position` | No | `beginning` (default) or `end` |
|
|
129
|
+
| `content` | No | Pre-fill the task content |
|
|
130
|
+
| `input` | No | `text` (default), `voice`, or `drawing` |
|
|
131
|
+
| `lineType` | No | `task` (default), `bullet`, `quote`, `empty`, `checklist` |
|
|
132
|
+
| `skipPostProcessing` | No | `true` (default) or `false` — skip AI post-processing for voice |
|
|
133
|
+
| `postProcessing` | No | Pre-selected post-processing mode for voice |
|
|
134
|
+
| `fast` | No | `true` to skip cache loading (used by widgets) |
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### deleteNote
|
|
139
|
+
|
|
140
|
+
Move a note to trash (project notes) or clear content (calendar notes).
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
noteplan://x-callback-url/deleteNote?noteTitle=Old%20Note
|
|
144
|
+
noteplan://x-callback-url/deleteNote?noteDate=20250101
|
|
145
|
+
noteplan://x-callback-url/deleteNote?fileName=Projects/archive.md
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
| Parameter | Required | Description |
|
|
149
|
+
|-----------|----------|-------------|
|
|
150
|
+
| `noteDate` / `noteTitle` / `fileName` | Yes | Which note to delete |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### search
|
|
155
|
+
|
|
156
|
+
Open the search view with a keyword or open a saved filter.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
noteplan://x-callback-url/search?text=meeting%20notes&view=calendar
|
|
160
|
+
noteplan://x-callback-url/search?filter=Overdue%20Tasks
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
| Parameter | Required | Description |
|
|
164
|
+
|-----------|----------|-------------|
|
|
165
|
+
| `text` | No* | Search keyword |
|
|
166
|
+
| `filter` | No* | Name of a saved filter/review to open |
|
|
167
|
+
| `view` | No | `calendar` or `notes` — which view to search in |
|
|
168
|
+
|
|
169
|
+
*One of `text` or `filter` is required.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### selectTag
|
|
174
|
+
|
|
175
|
+
Filter notes by a tag (hashtag or mention).
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
noteplan://x-callback-url/selectTag?name=%23project
|
|
179
|
+
noteplan://x-callback-url/selectTag?name=%40waiting
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
| Parameter | Required | Description |
|
|
183
|
+
|-----------|----------|-------------|
|
|
184
|
+
| `name` | Yes | The tag to filter by, including the `#` or `@` prefix |
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### runPlugin
|
|
189
|
+
|
|
190
|
+
Execute a plugin command.
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
noteplan://x-callback-url/runPlugin?pluginID=jgclark.NoteHelpers&command=jump%20to%20heading
|
|
194
|
+
noteplan://x-callback-url/runPlugin?pluginID=my.plugin&command=doThing&arg0=hello&arg1=world
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
| Parameter | Required | Description |
|
|
198
|
+
|-----------|----------|-------------|
|
|
199
|
+
| `pluginID` | Yes | The plugin identifier |
|
|
200
|
+
| `command` | Yes | The command name to execute |
|
|
201
|
+
| `arg0`, `arg1`, ... | No | Positional arguments passed to the plugin command |
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
### installPlugin
|
|
206
|
+
|
|
207
|
+
Install or update a plugin from the online repository.
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
noteplan://x-callback-url/installPlugin?plugin_id=jgclark.NoteHelpers
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
| Parameter | Required | Description |
|
|
214
|
+
|-----------|----------|-------------|
|
|
215
|
+
| `plugin_id` | Yes | Plugin ID to install (also accepts `pluginID`, `pluginId`, `id`) |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### openView
|
|
220
|
+
|
|
221
|
+
Open a named view in NotePlan.
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
noteplan://x-callback-url/openView?name=review
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
| Parameter | Required | Description |
|
|
228
|
+
|-----------|----------|-------------|
|
|
229
|
+
| `name` | Yes | The view name to open |
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### toggleSidebar
|
|
234
|
+
|
|
235
|
+
Toggle sidebar visibility.
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
noteplan://x-callback-url/toggleSidebar
|
|
239
|
+
noteplan://x-callback-url/toggleSidebar?forceCollapse=yes
|
|
240
|
+
noteplan://x-callback-url/toggleSidebar?forceOpen=yes
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
| Parameter | Required | Description |
|
|
244
|
+
|-----------|----------|-------------|
|
|
245
|
+
| `forceCollapse` | No | `yes` to force the sidebar closed |
|
|
246
|
+
| `forceOpen` | No | `yes` to force the sidebar open |
|
|
247
|
+
| `animated` | No | `no` to skip animation |
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### setTheme
|
|
252
|
+
|
|
253
|
+
Set the active theme.
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
noteplan://x-callback-url/setTheme?name=Nord&mode=dark
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
| Parameter | Required | Description |
|
|
260
|
+
|-----------|----------|-------------|
|
|
261
|
+
| `name` | Yes | Theme filename |
|
|
262
|
+
| `mode` | No | `light`, `dark`, or `auto` (default) |
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
### closePluginWindow (macOS only)
|
|
267
|
+
|
|
268
|
+
Close plugin HTML windows.
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
noteplan://x-callback-url/closePluginWindow?windowID=my-window
|
|
272
|
+
noteplan://x-callback-url/closePluginWindow?title=Dashboard
|
|
273
|
+
noteplan://x-callback-url/closePluginWindow
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
| Parameter | Required | Description |
|
|
277
|
+
|-----------|----------|-------------|
|
|
278
|
+
| `windowID` | No | Specific window ID to close |
|
|
279
|
+
| `title` | No | Close window matching this title |
|
|
280
|
+
|
|
281
|
+
If no parameters are given, **all** plugin windows are closed.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### noteInfo
|
|
286
|
+
|
|
287
|
+
Returns information about the currently open note via the `x-success` callback.
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
noteplan://x-callback-url/noteInfo?x-success=myapp://callback
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
The `x-success` URL receives `?path=<encoded_path>&name=<encoded_name>`.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Encoding Examples
|
|
298
|
+
|
|
299
|
+
| Content | Encoded |
|
|
300
|
+
|---------|---------|
|
|
301
|
+
| `Buy groceries` | `Buy%20groceries` |
|
|
302
|
+
| `# Heading` | `%23%20Heading` |
|
|
303
|
+
| Newline | `%0A` |
|
|
304
|
+
| `Task & notes` | `Task%20%26%20notes` |
|
|
305
|
+
| `[Link](url)` | `%5BLink%5D(url)` |
|
|
306
|
+
|
|
307
|
+
### Multi-line text example
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
noteplan://x-callback-url/addText?noteDate=today&text=%23%23%20Morning%0A-%20Coffee%0A-%20Read%20news&mode=prepend&openNote=no
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
This prepends to today's note:
|
|
314
|
+
```
|
|
315
|
+
## Morning
|
|
316
|
+
- Coffee
|
|
317
|
+
- Read news
|
|
318
|
+
```
|