mcpal 1.3.2 → 1.3.4
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/{license.md → LICENSE} +15 -3
- package/README.md +38 -4
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/notifier-paths.d.ts +13 -0
- package/dist/notifier-paths.d.ts.map +1 -0
- package/dist/notifier-paths.js +86 -0
- package/dist/notifier-paths.js.map +1 -0
- package/dist/notify.d.ts +82 -0
- package/dist/notify.d.ts.map +1 -1
- package/dist/notify.js +103 -45
- package/dist/notify.js.map +1 -1
- package/dist/scripts/setup-notifier.d.ts.map +1 -1
- package/dist/scripts/setup-notifier.js +3 -66
- package/dist/scripts/setup-notifier.js.map +1 -1
- package/package.json +1 -1
package/{license.md → LICENSE}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 MCPal Contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,16 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
ASSET LICENSE EXCEPTION
|
|
26
|
+
|
|
27
|
+
The MCPal logo, icon designs, and brand assets located in src/assets/
|
|
28
|
+
(excluding src/assets/clients/) are NOT covered by the MIT License above.
|
|
29
|
+
|
|
30
|
+
These assets are © 2025 All Rights Reserved and may not be used, copied,
|
|
31
|
+
modified, or distributed without explicit written permission.
|
|
32
|
+
|
|
33
|
+
This exception does not affect the MIT licensing of the source code.
|
package/README.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/user-attachments/assets/f3803867-5b50-4cc6-baa5-1dfe372c7169" alt="MCPal" width="128" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">MCPal</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
MCP server for native macOS notifications with action buttons, text replies, and LLM-aware icons.<br/>
|
|
9
|
+
Built for <strong>Claude Code</strong> and <strong>Claude Desktop</strong>. Compatible with any MCP client.
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="https://github.com/user-attachments/assets/5d113a38-f5b1-41de-be39-606e14a25b4f" alt="MCPal Notification" width="400" />
|
|
14
|
+
</p>
|
|
4
15
|
|
|
5
16
|
## Usage
|
|
6
17
|
|
|
@@ -29,6 +40,27 @@ claude mcp add mcpal -- npx -y mcpal
|
|
|
29
40
|
claude mcp add mcpal --scope user -- npx -y mcpal
|
|
30
41
|
```
|
|
31
42
|
|
|
43
|
+
### Configuring Proactive Notifications (Claude)
|
|
44
|
+
|
|
45
|
+
MCPal includes built-in MCP instructions that tell Claude *how* to use notifications. To configure *when* Claude should proactively notify you, add this to your `CLAUDE.md`:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## Post Task Completion Hook
|
|
49
|
+
|
|
50
|
+
ALWAYS use MCPal MCP tool to notify me when you finish any tasks (this includes reading files, investigating, coding). You should use this tool before you terminate any conversations. Also notify when:
|
|
51
|
+
- A long-running task completes (builds, tests, deployments)
|
|
52
|
+
- You need my input or decision on something
|
|
53
|
+
- You encounter an error that blocks progress
|
|
54
|
+
|
|
55
|
+
Use `reply: true` when you need free-form input from me.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Customize this based on your preferences - some users want frequent updates, others only want notifications for important decisions.
|
|
59
|
+
|
|
60
|
+
### Other MCP Clients
|
|
61
|
+
|
|
62
|
+
MCPal works with any MCP-compatible client (Cursor, VS Code with MCP extensions, etc.). The setup varies by client - refer to your client's documentation for adding MCP servers.
|
|
63
|
+
|
|
32
64
|
## Tool: `send_notification`
|
|
33
65
|
|
|
34
66
|
Send native notifications with optional features.
|
|
@@ -74,7 +106,7 @@ Send native notifications with optional features.
|
|
|
74
106
|
|
|
75
107
|
## LLM-Aware Icons
|
|
76
108
|
|
|
77
|
-
MCPal
|
|
109
|
+
MCPal detects which MCP client is calling the tool and displays the appropriate icon in notifications. Currently tested with Claude Code and Claude Desktop:
|
|
78
110
|
|
|
79
111
|
| Client | Icon |
|
|
80
112
|
|--------|------|
|
|
@@ -167,4 +199,6 @@ pnpm run test:notification all
|
|
|
167
199
|
|
|
168
200
|
## License
|
|
169
201
|
|
|
170
|
-
MIT
|
|
202
|
+
**Code:** MIT License
|
|
203
|
+
|
|
204
|
+
**MCPal Icon & Branding:** © 2025 All Rights Reserved. The MCPal logo and icon designs may not be used without permission.
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ server.registerTool("send_notification", {
|
|
|
43
43
|
timeout: zod_1.z
|
|
44
44
|
.number()
|
|
45
45
|
.optional()
|
|
46
|
-
.describe("Custom timeout in seconds. Defaults:
|
|
46
|
+
.describe("Custom timeout in seconds. Defaults: 10s (simple), 30s (actions), 60s (reply)"),
|
|
47
47
|
},
|
|
48
48
|
}, async ({ message, title, actions, dropdownLabel, reply, timeout }) => {
|
|
49
49
|
try {
|
|
@@ -64,7 +64,6 @@ server.registerTool("send_notification", {
|
|
|
64
64
|
parts.push(`Done! We got the message to the user.`);
|
|
65
65
|
parts.push(`Title: "${title ?? "MCPal"}"`);
|
|
66
66
|
parts.push(`Message: "${message}"`);
|
|
67
|
-
// Describe user's response
|
|
68
67
|
if (result.activationType === "contentsClicked") {
|
|
69
68
|
parts.push(`The user clicked the notification. Curious one, aren't they?`);
|
|
70
69
|
}
|
|
@@ -100,7 +99,6 @@ server.registerTool("send_notification", {
|
|
|
100
99
|
}
|
|
101
100
|
});
|
|
102
101
|
async function main() {
|
|
103
|
-
// Ensure MCPal.app is set up (handles npx installs where postinstall doesn't run)
|
|
104
102
|
await (0, setup_notifier_js_1.ensureMcpalAppSetup)();
|
|
105
103
|
const transport = new stdio_js_1.StdioServerTransport();
|
|
106
104
|
await server.connect(transport);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,oEAAoE;AACpE,wEAAiF;AACjF,6BAAwB;AAExB,2CAA+D;AAC/D,mEAAkE;AAElE,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;IACE,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;;;;;;;;;;+CAU6B;CAC5C,CACF,CAAC;AAEF,MAAM,CAAC,YAAY,CACjB,mBAAmB,EACnB;IACE,WAAW,EAAE,6HAA6H;IAC1I,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE;QACX,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;QAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAC/D,OAAO,EAAE,OAAC;aACP,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;aACjB,QAAQ,EAAE;aACV,QAAQ,CACP,6EAA6E,CAC9E;QACH,aAAa,EAAE,OAAC;aACb,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,mEAAm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IAAI;IACjB,MAAM,IAAA,uCAAmB,GAAE,CAAC;IAE5B,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find all potential mac.noindex directories containing terminal-notifier.app or MCPal.app.
|
|
3
|
+
*
|
|
4
|
+
* Searches multiple locations to handle different installation methods:
|
|
5
|
+
* - Local node_modules (npm/yarn/pnpm)
|
|
6
|
+
* - npx cache (~/.npm/_npx)
|
|
7
|
+
* - pnpm dlx cache (~/Library/Caches/pnpm/dlx)
|
|
8
|
+
*
|
|
9
|
+
* @param packageRoot - The root directory of the package (where node_modules lives)
|
|
10
|
+
* @returns Array of directory paths ending at `mac.noindex/`
|
|
11
|
+
*/
|
|
12
|
+
export declare function findAllNotifierBaseDirs(packageRoot: string): string[];
|
|
13
|
+
//# sourceMappingURL=notifier-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifier-paths.d.ts","sourceRoot":"","sources":["../src/notifier-paths.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAkHrE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.findAllNotifierBaseDirs = findAllNotifierBaseDirs;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
/**
|
|
11
|
+
* Find all potential mac.noindex directories containing terminal-notifier.app or MCPal.app.
|
|
12
|
+
*
|
|
13
|
+
* Searches multiple locations to handle different installation methods:
|
|
14
|
+
* - Local node_modules (npm/yarn/pnpm)
|
|
15
|
+
* - npx cache (~/.npm/_npx)
|
|
16
|
+
* - pnpm dlx cache (~/Library/Caches/pnpm/dlx)
|
|
17
|
+
*
|
|
18
|
+
* @param packageRoot - The root directory of the package (where node_modules lives)
|
|
19
|
+
* @returns Array of directory paths ending at `mac.noindex/`
|
|
20
|
+
*/
|
|
21
|
+
function findAllNotifierBaseDirs(packageRoot) {
|
|
22
|
+
const dirs = [];
|
|
23
|
+
// 1. Local node_modules (npm/yarn)
|
|
24
|
+
dirs.push(path_1.default.join(packageRoot, "node_modules", "node-notifier", "vendor", "mac.noindex"));
|
|
25
|
+
// 2. Local node_modules (pnpm)
|
|
26
|
+
const localPnpmDir = path_1.default.join(packageRoot, "node_modules", ".pnpm");
|
|
27
|
+
if (fs_1.default.existsSync(localPnpmDir)) {
|
|
28
|
+
try {
|
|
29
|
+
const entries = fs_1.default.readdirSync(localPnpmDir);
|
|
30
|
+
const nodeNotifierDir = entries.find((e) => e.startsWith("node-notifier@"));
|
|
31
|
+
if (nodeNotifierDir) {
|
|
32
|
+
dirs.push(path_1.default.join(localPnpmDir, nodeNotifierDir, "node_modules", "node-notifier", "vendor", "mac.noindex"));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Ignore errors
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// 3. npx cache locations
|
|
40
|
+
const npxCacheDirs = [
|
|
41
|
+
// npm npx cache
|
|
42
|
+
path_1.default.join(os_1.default.homedir(), ".npm", "_npx"),
|
|
43
|
+
// pnpm dlx cache
|
|
44
|
+
path_1.default.join(os_1.default.homedir(), "Library", "Caches", "pnpm", "dlx"),
|
|
45
|
+
];
|
|
46
|
+
for (const cacheDir of npxCacheDirs) {
|
|
47
|
+
if (!fs_1.default.existsSync(cacheDir)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const cacheEntries = fs_1.default.readdirSync(cacheDir);
|
|
52
|
+
for (const entry of cacheEntries) {
|
|
53
|
+
const entryPath = path_1.default.join(cacheDir, entry);
|
|
54
|
+
// Check for node-notifier in standard npm structure
|
|
55
|
+
const npmPath = path_1.default.join(entryPath, "node_modules", "node-notifier", "vendor", "mac.noindex");
|
|
56
|
+
if (fs_1.default.existsSync(npmPath)) {
|
|
57
|
+
dirs.push(npmPath);
|
|
58
|
+
}
|
|
59
|
+
// Check for node-notifier in mcpal's node_modules (npx installs mcpal which has node-notifier as dep)
|
|
60
|
+
const mcpalPath = path_1.default.join(entryPath, "node_modules", "mcpal", "node_modules", "node-notifier", "vendor", "mac.noindex");
|
|
61
|
+
if (fs_1.default.existsSync(mcpalPath)) {
|
|
62
|
+
dirs.push(mcpalPath);
|
|
63
|
+
}
|
|
64
|
+
// Check pnpm structure in cache
|
|
65
|
+
const pnpmDir = path_1.default.join(entryPath, "node_modules", ".pnpm");
|
|
66
|
+
if (fs_1.default.existsSync(pnpmDir)) {
|
|
67
|
+
try {
|
|
68
|
+
const pnpmEntries = fs_1.default.readdirSync(pnpmDir);
|
|
69
|
+
const nodeNotifierDir = pnpmEntries.find((e) => e.startsWith("node-notifier@"));
|
|
70
|
+
if (nodeNotifierDir) {
|
|
71
|
+
dirs.push(path_1.default.join(pnpmDir, nodeNotifierDir, "node_modules", "node-notifier", "vendor", "mac.noindex"));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
// Ignore errors
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// Ignore errors reading cache directories
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return dirs;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=notifier-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifier-paths.js","sourceRoot":"","sources":["../src/notifier-paths.ts"],"names":[],"mappings":";;;;;AAeA,0DAkHC;AAjID,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AAExB;;;;;;;;;;GAUG;AACH,SAAgB,uBAAuB,CAAC,WAAmB;IACzD,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,mCAAmC;IACnC,IAAI,CAAC,IAAI,CACP,cAAI,CAAC,IAAI,CACP,WAAW,EACX,cAAc,EACd,eAAe,EACf,QAAQ,EACR,aAAa,CACd,CACF,CAAC;IAEF,+BAA+B;IAC/B,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IACrE,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,YAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;YAC7C,MAAM,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CACzC,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAC/B,CAAC;YACF,IAAI,eAAe,EAAE,CAAC;gBACpB,IAAI,CAAC,IAAI,CACP,cAAI,CAAC,IAAI,CACP,YAAY,EACZ,eAAe,EACf,cAAc,EACd,eAAe,EACf,QAAQ,EACR,aAAa,CACd,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gBAAgB;QAClB,CAAC;IACH,CAAC;IAED,yBAAyB;IACzB,MAAM,YAAY,GAAG;QACnB,gBAAgB;QAChB,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC;QACvC,iBAAiB;QACjB,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,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GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7C,CAAC,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAC/B,CAAC;wBACF,IAAI,eAAe,EAAE,CAAC;4BACpB,IAAI,CAAC,IAAI,CACP,cAAI,CAAC,IAAI,CACP,OAAO,EACP,eAAe,EACf,cAAc,EACd,eAAe,EACf,QAAQ,EACR,aAAa,CACd,CACF,CAAC;wBACJ,CAAC;oBACH,CAAC;oBAAC,MAAM,CAAC;wBACP,gBAAgB;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,0CAA0C;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/notify.d.ts
CHANGED
|
@@ -1,20 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the path to the MCPal.app (or terminal-notifier.app) executable.
|
|
3
|
+
*
|
|
4
|
+
* Searches multiple locations to handle different installation methods:
|
|
5
|
+
* - Local node_modules (npm/yarn/pnpm)
|
|
6
|
+
* - npx cache (~/.npm/_npx)
|
|
7
|
+
* - pnpm dlx cache (~/Library/Caches/pnpm/dlx)
|
|
8
|
+
*
|
|
9
|
+
* @returns The path to the notifier executable, or undefined if not found
|
|
10
|
+
*/
|
|
1
11
|
export declare function getNotifierPath(): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Mapping of MCP client names to their icon filenames.
|
|
14
|
+
* Keys are normalized client names (lowercase, hyphens instead of spaces).
|
|
15
|
+
*/
|
|
2
16
|
export declare const CLIENT_ICONS: Record<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Get the directory containing client icon assets.
|
|
19
|
+
* @returns Absolute path to the clients icon directory
|
|
20
|
+
*/
|
|
3
21
|
export declare function getClientsDir(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Get the content image path for a given MCP client.
|
|
24
|
+
*
|
|
25
|
+
* The content image appears on the right side of macOS notifications,
|
|
26
|
+
* showing the logo of the LLM client that triggered the notification.
|
|
27
|
+
*
|
|
28
|
+
* @param clientName - The MCP client name (e.g., "claude-code", "cursor")
|
|
29
|
+
* @returns Absolute path to the client's icon, or undefined if not found or not on macOS
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const icon = getContentImageForClient("claude-code");
|
|
34
|
+
* // Returns: "/path/to/assets/clients/claude.png"
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
4
37
|
export declare function getContentImageForClient(clientName?: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Options for sending a native notification.
|
|
40
|
+
*/
|
|
5
41
|
export interface NotifyOptions {
|
|
42
|
+
/** The notification body text */
|
|
6
43
|
message: string;
|
|
44
|
+
/** The notification title */
|
|
7
45
|
title: string;
|
|
46
|
+
/** Action buttons (e.g., ["Yes", "No"]). macOS only. */
|
|
8
47
|
actions?: string[];
|
|
48
|
+
/** Label for the actions dropdown. Required when using multiple actions on macOS. */
|
|
9
49
|
dropdownLabel?: string;
|
|
50
|
+
/** Enable text reply input. macOS only. */
|
|
10
51
|
reply?: boolean;
|
|
52
|
+
/** Path to an image to display on the right side of the notification. macOS only. */
|
|
11
53
|
contentImage?: string;
|
|
54
|
+
/** Custom timeout in seconds. Defaults: 10s (simple), 30s (actions), 60s (reply). */
|
|
12
55
|
timeout?: number;
|
|
13
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Result returned after a notification is dismissed or interacted with.
|
|
59
|
+
*/
|
|
14
60
|
export interface NotifyResult {
|
|
61
|
+
/** The response type or action clicked (e.g., "timeout", "closed", action label) */
|
|
15
62
|
response: string;
|
|
63
|
+
/** The user's text reply, if `reply: true` was set and user responded */
|
|
16
64
|
reply?: string;
|
|
65
|
+
/** How the user interacted: "contentsClicked", "actionClicked", "replied", etc. */
|
|
17
66
|
activationType?: string;
|
|
18
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Send a native desktop notification and wait for user interaction.
|
|
70
|
+
*
|
|
71
|
+
* @param options - Notification configuration
|
|
72
|
+
* @returns Promise that resolves with the user's response
|
|
73
|
+
* @throws Error if the notification fails to send
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* // Simple notification
|
|
78
|
+
* const result = await notify({
|
|
79
|
+
* title: "Build Complete",
|
|
80
|
+
* message: "Your project compiled successfully!"
|
|
81
|
+
* });
|
|
82
|
+
*
|
|
83
|
+
* // With reply input
|
|
84
|
+
* const result = await notify({
|
|
85
|
+
* title: "Question",
|
|
86
|
+
* message: "What should we name this file?",
|
|
87
|
+
* reply: true
|
|
88
|
+
* });
|
|
89
|
+
* console.log(result.reply); // User's typed response
|
|
90
|
+
*
|
|
91
|
+
* // With action buttons
|
|
92
|
+
* const result = await notify({
|
|
93
|
+
* title: "Deploy",
|
|
94
|
+
* message: "Ready to deploy to production?",
|
|
95
|
+
* actions: ["Deploy", "Cancel"],
|
|
96
|
+
* dropdownLabel: "Choose"
|
|
97
|
+
* });
|
|
98
|
+
* console.log(result.response); // "Deploy" or "Cancel"
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
19
101
|
export declare function notify(options: NotifyOptions): Promise<NotifyResult>;
|
|
20
102
|
//# sourceMappingURL=notify.d.ts.map
|
package/dist/notify.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":"AAWA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAmBpD;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQ/C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAmBpB;AASD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,qFAAqF;IACrF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,oFAAoF;IACpF,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AA6CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAwBpE"}
|
package/dist/notify.js
CHANGED
|
@@ -12,40 +12,29 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
12
12
|
const node_notifier_1 = __importDefault(require("node-notifier"));
|
|
13
13
|
const os_1 = __importDefault(require("os"));
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const notifier_paths_1 = require("./notifier-paths");
|
|
15
16
|
const isMacOS = os_1.default.platform() === "darwin";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
const packageRoot = path_1.default.resolve(__dirname, "..");
|
|
18
|
+
/**
|
|
19
|
+
* Get the path to the MCPal.app (or terminal-notifier.app) executable.
|
|
20
|
+
*
|
|
21
|
+
* Searches multiple locations to handle different installation methods:
|
|
22
|
+
* - Local node_modules (npm/yarn/pnpm)
|
|
23
|
+
* - npx cache (~/.npm/_npx)
|
|
24
|
+
* - pnpm dlx cache (~/Library/Caches/pnpm/dlx)
|
|
25
|
+
*
|
|
26
|
+
* @returns The path to the notifier executable, or undefined if not found
|
|
27
|
+
*/
|
|
28
|
+
function getNotifierPath() {
|
|
29
|
+
const notifierDirs = (0, notifier_paths_1.findAllNotifierBaseDirs)(packageRoot);
|
|
30
|
+
const possiblePaths = [];
|
|
31
|
+
// For each directory, check MCPal.app first, then terminal-notifier.app as fallback
|
|
32
|
+
for (const dir of notifierDirs) {
|
|
33
|
+
possiblePaths.push(path_1.default.join(dir, "MCPal.app"));
|
|
31
34
|
}
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
for (const dir of notifierDirs) {
|
|
36
|
+
possiblePaths.push(path_1.default.join(dir, "terminal-notifier.app"));
|
|
34
37
|
}
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
// Get the path to the renamed MCPal.app notifier executable
|
|
38
|
-
function getNotifierPath() {
|
|
39
|
-
const projectRoot = path_1.default.resolve(__dirname, "..");
|
|
40
|
-
const possiblePaths = [
|
|
41
|
-
// pnpm - check for MCPal.app first
|
|
42
|
-
...findPnpmPaths().map((p) => path_1.default.join(p, "MCPal.app")),
|
|
43
|
-
// npm/yarn - check for MCPal.app first
|
|
44
|
-
path_1.default.join(projectRoot, "node_modules", "node-notifier", "vendor", "mac.noindex", "MCPal.app"),
|
|
45
|
-
// Fallback to terminal-notifier.app (before rename)
|
|
46
|
-
...findPnpmPaths().map((p) => path_1.default.join(p, "terminal-notifier.app")),
|
|
47
|
-
path_1.default.join(projectRoot, "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app"),
|
|
48
|
-
];
|
|
49
38
|
for (const p of possiblePaths) {
|
|
50
39
|
const execPath = path_1.default.join(p, "Contents", "MacOS", "terminal-notifier");
|
|
51
40
|
if (fs_1.default.existsSync(execPath)) {
|
|
@@ -54,7 +43,10 @@ function getNotifierPath() {
|
|
|
54
43
|
}
|
|
55
44
|
return undefined;
|
|
56
45
|
}
|
|
57
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Mapping of MCP client names to their icon filenames.
|
|
48
|
+
* Keys are normalized client names (lowercase, hyphens instead of spaces).
|
|
49
|
+
*/
|
|
58
50
|
exports.CLIENT_ICONS = {
|
|
59
51
|
claude: "claude.png",
|
|
60
52
|
"claude-desktop": "claude.png",
|
|
@@ -64,15 +56,33 @@ exports.CLIENT_ICONS = {
|
|
|
64
56
|
openai: "openai.png",
|
|
65
57
|
chatgpt: "openai.png",
|
|
66
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Get the directory containing client icon assets.
|
|
61
|
+
* @returns Absolute path to the clients icon directory
|
|
62
|
+
*/
|
|
67
63
|
function getClientsDir() {
|
|
68
64
|
return path_1.default.resolve(__dirname, "assets", "clients");
|
|
69
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the content image path for a given MCP client.
|
|
68
|
+
*
|
|
69
|
+
* The content image appears on the right side of macOS notifications,
|
|
70
|
+
* showing the logo of the LLM client that triggered the notification.
|
|
71
|
+
*
|
|
72
|
+
* @param clientName - The MCP client name (e.g., "claude-code", "cursor")
|
|
73
|
+
* @returns Absolute path to the client's icon, or undefined if not found or not on macOS
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const icon = getContentImageForClient("claude-code");
|
|
78
|
+
* // Returns: "/path/to/assets/clients/claude.png"
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
70
81
|
function getContentImageForClient(clientName) {
|
|
71
82
|
// contentImage is a macOS-specific feature (terminal-notifier)
|
|
72
83
|
if (!isMacOS || !clientName) {
|
|
73
84
|
return undefined;
|
|
74
85
|
}
|
|
75
|
-
// Normalize client name (lowercase, no spaces)
|
|
76
86
|
const normalized = clientName.toLowerCase().replace(/\s+/g, "-");
|
|
77
87
|
// Check for exact match or partial match
|
|
78
88
|
const iconFile = exports.CLIENT_ICONS[normalized] ??
|
|
@@ -83,13 +93,20 @@ function getContentImageForClient(clientName) {
|
|
|
83
93
|
const iconPath = path_1.default.join(getClientsDir(), iconFile);
|
|
84
94
|
return fs_1.default.existsSync(iconPath) ? iconPath : undefined;
|
|
85
95
|
}
|
|
86
|
-
|
|
87
|
-
const TIMEOUT_SIMPLE =
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
96
|
+
/** Default timeout for simple notifications (seconds) */
|
|
97
|
+
const TIMEOUT_SIMPLE = 10;
|
|
98
|
+
/** Default timeout for notifications with action buttons (seconds) */
|
|
99
|
+
const TIMEOUT_ACTIONS = 30;
|
|
100
|
+
/** Default timeout for notifications with text reply input (seconds) */
|
|
101
|
+
const TIMEOUT_REPLY = 60;
|
|
102
|
+
/**
|
|
103
|
+
* Create a notifier instance configured for the current platform.
|
|
104
|
+
*
|
|
105
|
+
* On macOS, uses the custom MCPal.app bundle for branded notifications.
|
|
106
|
+
* On other platforms, uses the default node-notifier backend.
|
|
107
|
+
*
|
|
108
|
+
* @returns A configured NodeNotifier instance
|
|
109
|
+
*/
|
|
93
110
|
function getNotifier() {
|
|
94
111
|
if (isMacOS) {
|
|
95
112
|
const customPath = getNotifierPath();
|
|
@@ -102,19 +119,60 @@ function getNotifier() {
|
|
|
102
119
|
// On non-macOS or if customPath not found, use default notifier
|
|
103
120
|
return node_notifier_1.default;
|
|
104
121
|
}
|
|
105
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Determine the appropriate timeout based on notification type.
|
|
124
|
+
*
|
|
125
|
+
* Reply notifications get the longest timeout (user needs time to type),
|
|
126
|
+
* action notifications get moderate timeout, simple notifications are quick.
|
|
127
|
+
*
|
|
128
|
+
* @param options - The notification options
|
|
129
|
+
* @returns Timeout in seconds
|
|
130
|
+
*/
|
|
106
131
|
function getTimeout(options) {
|
|
107
132
|
if (options.timeout !== undefined) {
|
|
108
|
-
return options.timeout;
|
|
133
|
+
return options.timeout;
|
|
109
134
|
}
|
|
110
135
|
if (options.reply) {
|
|
111
|
-
return TIMEOUT_REPLY;
|
|
136
|
+
return TIMEOUT_REPLY;
|
|
112
137
|
}
|
|
113
138
|
if (options.actions && options.actions.length > 0) {
|
|
114
|
-
return TIMEOUT_ACTIONS;
|
|
139
|
+
return TIMEOUT_ACTIONS;
|
|
115
140
|
}
|
|
116
|
-
return TIMEOUT_SIMPLE;
|
|
141
|
+
return TIMEOUT_SIMPLE;
|
|
117
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Send a native desktop notification and wait for user interaction.
|
|
145
|
+
*
|
|
146
|
+
* @param options - Notification configuration
|
|
147
|
+
* @returns Promise that resolves with the user's response
|
|
148
|
+
* @throws Error if the notification fails to send
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* // Simple notification
|
|
153
|
+
* const result = await notify({
|
|
154
|
+
* title: "Build Complete",
|
|
155
|
+
* message: "Your project compiled successfully!"
|
|
156
|
+
* });
|
|
157
|
+
*
|
|
158
|
+
* // With reply input
|
|
159
|
+
* const result = await notify({
|
|
160
|
+
* title: "Question",
|
|
161
|
+
* message: "What should we name this file?",
|
|
162
|
+
* reply: true
|
|
163
|
+
* });
|
|
164
|
+
* console.log(result.reply); // User's typed response
|
|
165
|
+
*
|
|
166
|
+
* // With action buttons
|
|
167
|
+
* const result = await notify({
|
|
168
|
+
* title: "Deploy",
|
|
169
|
+
* message: "Ready to deploy to production?",
|
|
170
|
+
* actions: ["Deploy", "Cancel"],
|
|
171
|
+
* dropdownLabel: "Choose"
|
|
172
|
+
* });
|
|
173
|
+
* console.log(result.response); // "Deploy" or "Cancel"
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
118
176
|
function notify(options) {
|
|
119
177
|
return new Promise((resolve, reject) => {
|
|
120
178
|
const notificationOptions = {
|
package/dist/notify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"notify.js","sourceRoot":"","sources":["../src/notify.ts"],"names":[],"mappings":";;;;;;AAqBA,0CAmBC;AAoBD,sCAEC;AAiBD,4DAqBC;AAqHD,wBAwBC;AAjPD,4CAAoB;AACpB,kEAAyC;AACzC,4CAAoB;AACpB,gDAAwB;AAExB,qDAA2D;AAE3D,MAAM,OAAO,GAAG,YAAE,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC;AAE3C,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAElD;;;;;;;;;GASG;AACH,SAAgB,eAAe;IAC7B,MAAM,YAAY,GAAG,IAAA,wCAAuB,EAAC,WAAW,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAa,EAAE,CAAC;IAEnC,oFAAoF;IACpF,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,aAAa,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,aAAa,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,aAAa,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACxE,IAAI,YAAE,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OAAO;YACxB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,GAAG,CAAC,OAAO,CAAC,YAAY,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SACpE,CAAC;QAEF,WAAW,EAAE,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;YACpE,IAAI,GAAG,EAAE,CAAC;gBACR,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;YACrB,CAAC;YACD,OAAO,CAAC;gBACN,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;gBAC1B,KAAK,EAAE,QAAQ,EAAE,eAAe;gBAChC,cAAc,EAAE,QAAQ,EAAE,cAAc;aACzC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-notifier.d.ts","sourceRoot":"","sources":["../../src/scripts/setup-notifier.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"setup-notifier.d.ts","sourceRoot":"","sources":["../../src/scripts/setup-notifier.ts"],"names":[],"mappings":";AAiEA;;;GAGG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoEzD"}
|
|
@@ -6,79 +6,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ensureMcpalAppSetup = ensureMcpalAppSetup;
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const os_1 = __importDefault(require("os"));
|
|
10
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const notifier_paths_1 = require("../notifier-paths");
|
|
11
11
|
// Get the package root (where src/assets lives)
|
|
12
12
|
const packageRoot = path_1.default.resolve(__dirname, "..", "..");
|
|
13
13
|
/**
|
|
14
14
|
* Find all potential locations where node-notifier's terminal-notifier.app might be located.
|
|
15
|
-
*
|
|
15
|
+
* Uses shared discovery logic and appends terminal-notifier.app to each base directory.
|
|
16
16
|
*/
|
|
17
17
|
function findAllTerminalNotifierPaths() {
|
|
18
|
-
|
|
19
|
-
// 1. Local node_modules (npm/yarn)
|
|
20
|
-
paths.push(path_1.default.join(packageRoot, "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app"));
|
|
21
|
-
// 2. Local node_modules (pnpm)
|
|
22
|
-
const localPnpmDir = path_1.default.join(packageRoot, "node_modules", ".pnpm");
|
|
23
|
-
if (fs_1.default.existsSync(localPnpmDir)) {
|
|
24
|
-
try {
|
|
25
|
-
const entries = fs_1.default.readdirSync(localPnpmDir);
|
|
26
|
-
const nodeNotifierDir = entries.find((e) => e.startsWith("node-notifier@"));
|
|
27
|
-
if (nodeNotifierDir) {
|
|
28
|
-
paths.push(path_1.default.join(localPnpmDir, nodeNotifierDir, "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app"));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// Ignore errors
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// 3. npx cache locations
|
|
36
|
-
const npxCacheDirs = [
|
|
37
|
-
// npm npx cache
|
|
38
|
-
path_1.default.join(os_1.default.homedir(), ".npm", "_npx"),
|
|
39
|
-
// pnpm dlx cache
|
|
40
|
-
path_1.default.join(os_1.default.homedir(), "Library", "Caches", "pnpm", "dlx"),
|
|
41
|
-
];
|
|
42
|
-
for (const cacheDir of npxCacheDirs) {
|
|
43
|
-
if (!fs_1.default.existsSync(cacheDir)) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
// Search recursively for node-notifier in cache
|
|
48
|
-
const cacheEntries = fs_1.default.readdirSync(cacheDir);
|
|
49
|
-
for (const entry of cacheEntries) {
|
|
50
|
-
const entryPath = path_1.default.join(cacheDir, entry);
|
|
51
|
-
// Check for node-notifier in standard npm structure
|
|
52
|
-
const npmPath = path_1.default.join(entryPath, "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app");
|
|
53
|
-
if (fs_1.default.existsSync(npmPath)) {
|
|
54
|
-
paths.push(npmPath);
|
|
55
|
-
}
|
|
56
|
-
// Check for node-notifier in mcpal's node_modules (npx installs mcpal which has node-notifier as dep)
|
|
57
|
-
const mcpalPath = path_1.default.join(entryPath, "node_modules", "mcpal", "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app");
|
|
58
|
-
if (fs_1.default.existsSync(mcpalPath)) {
|
|
59
|
-
paths.push(mcpalPath);
|
|
60
|
-
}
|
|
61
|
-
// Check pnpm structure in cache
|
|
62
|
-
const pnpmDir = path_1.default.join(entryPath, "node_modules", ".pnpm");
|
|
63
|
-
if (fs_1.default.existsSync(pnpmDir)) {
|
|
64
|
-
try {
|
|
65
|
-
const pnpmEntries = fs_1.default.readdirSync(pnpmDir);
|
|
66
|
-
const nodeNotifierDir = pnpmEntries.find((e) => e.startsWith("node-notifier@"));
|
|
67
|
-
if (nodeNotifierDir) {
|
|
68
|
-
paths.push(path_1.default.join(pnpmDir, nodeNotifierDir, "node_modules", "node-notifier", "vendor", "mac.noindex", "terminal-notifier.app"));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
// Ignore errors
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
// Ignore errors reading cache directories
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return paths;
|
|
18
|
+
return (0, notifier_paths_1.findAllNotifierBaseDirs)(packageRoot).map((dir) => path_1.default.join(dir, "terminal-notifier.app"));
|
|
82
19
|
}
|
|
83
20
|
/**
|
|
84
21
|
* Find the first existing terminal-notifier.app or MCPal.app
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-notifier.js","sourceRoot":"","sources":["../../src/scripts/setup-notifier.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"setup-notifier.js","sourceRoot":"","sources":["../../src/scripts/setup-notifier.ts"],"names":[],"mappings":";;;;;;AAqEA,kDAoEC;AAvID,4CAAoB;AACpB,gDAAwB;AAExB,sDAA4D;AAE5D,gDAAgD;AAChD,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAExD;;;GAGG;AACH,SAAS,4BAA4B;IACnC,OAAO,IAAA,wCAAuB,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtD,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,CAAC,CACxC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,eAAe;IACtB,MAAM,WAAW,GAAG,4BAA4B,EAAE,CAAC;IAEnD,KAAK,MAAM,OAAO,IAAI,WAAW,EAAE,CAAC;QAClC,wCAAwC;QACxC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;QAChE,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;QAC9C,CAAC;QAED,wCAAwC;QACxC,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc;IACrB,MAAM,aAAa,GAAG;QACpB,qCAAqC;QACrC,cAAI,C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