pomera-ai-commander 1.2.3 → 1.2.5
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/README.md +28 -4
- package/create_shortcut.py +237 -0
- package/mcp.json +1 -1
- package/package.json +4 -1
- package/pomera.py +50 -21
- package/pomera_mcp_server.py +8 -2
- package/resources/icon.ico +0 -0
- package/resources/icon.png +0 -0
- package/scripts/postinstall.js +166 -7
package/README.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
# Pomera AI Commander (PAC)
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="resources/icon.png" alt="Pomera - the fluffy Pomeranian mascot" width="128" height="128">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
2
7
|
[](https://github.com/matbanik/Pomera-AI-Commander/releases)
|
|
3
8
|
|
|
4
9
|
A desktop text "workbench" + MCP server: clean, transform, extract, and analyze text fast—manually in a GUI or programmatically from AI assistants (Cursor / Claude Desktop / MCP clients).
|
|
@@ -66,6 +71,17 @@ npm install -g pomera-ai-commander
|
|
|
66
71
|
pomera-mcp --help
|
|
67
72
|
```
|
|
68
73
|
|
|
74
|
+
### Create Desktop Shortcut
|
|
75
|
+
After installing via pip or npm, create a desktop shortcut for quick access:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# For pip install:
|
|
79
|
+
pomera-create-shortcut
|
|
80
|
+
|
|
81
|
+
# For npm install (from package directory):
|
|
82
|
+
python create_shortcut.py
|
|
83
|
+
```
|
|
84
|
+
|
|
69
85
|
---
|
|
70
86
|
|
|
71
87
|
## MCP Server for AI Assistants
|
|
@@ -77,8 +93,7 @@ Pomera exposes 22 text processing tools via MCP. Configure your AI assistant:
|
|
|
77
93
|
{
|
|
78
94
|
"mcpServers": {
|
|
79
95
|
"pomera": {
|
|
80
|
-
"command": "pomera-ai-commander"
|
|
81
|
-
"args": ["--mcp-server"]
|
|
96
|
+
"command": "pomera-ai-commander"
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
99
|
}
|
|
@@ -89,13 +104,22 @@ Pomera exposes 22 text processing tools via MCP. Configure your AI assistant:
|
|
|
89
104
|
{
|
|
90
105
|
"mcpServers": {
|
|
91
106
|
"pomera": {
|
|
92
|
-
"command": "pomera-ai-commander"
|
|
93
|
-
"args": ["--mcp-server"]
|
|
107
|
+
"command": "pomera-ai-commander"
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
111
|
```
|
|
98
112
|
|
|
113
|
+
> **💡 Tip:** If the simple command doesn't work, use the full path. Find it with:
|
|
114
|
+
> ```bash
|
|
115
|
+
> # For npm install:
|
|
116
|
+
> npm root -g
|
|
117
|
+
> # Then use: <result>/pomera-ai-commander/pomera_mcp_server.py
|
|
118
|
+
>
|
|
119
|
+
> # For pip install:
|
|
120
|
+
> pip show pomera-ai-commander | grep Location
|
|
121
|
+
> ```
|
|
122
|
+
|
|
99
123
|
See the full [MCP Server Guide](docs/MCP_SERVER_GUIDE.md) for Antigravity, executable configs, and troubleshooting.
|
|
100
124
|
|
|
101
125
|
---
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Create Desktop Shortcut for Pomera AI Commander
|
|
4
|
+
|
|
5
|
+
Cross-platform script to create desktop shortcuts/launchers:
|
|
6
|
+
- Windows: Creates .lnk shortcut
|
|
7
|
+
- macOS: Creates .command script in ~/Desktop
|
|
8
|
+
- Linux: Creates .desktop launcher
|
|
9
|
+
|
|
10
|
+
Can be run standalone or as npm postinstall hook.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
import sys
|
|
15
|
+
import stat
|
|
16
|
+
import platform
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_package_dir() -> Path:
|
|
21
|
+
"""Get the pomera-ai-commander package directory."""
|
|
22
|
+
# First check if we're running from the package itself
|
|
23
|
+
script_dir = Path(__file__).parent.resolve()
|
|
24
|
+
if (script_dir / "pomera.py").exists():
|
|
25
|
+
return script_dir
|
|
26
|
+
|
|
27
|
+
# Check npm global installation
|
|
28
|
+
npm_global = os.environ.get("APPDATA", "") or os.path.expanduser("~")
|
|
29
|
+
if platform.system() == "Windows":
|
|
30
|
+
npm_path = Path(npm_global) / "npm" / "node_modules" / "pomera-ai-commander"
|
|
31
|
+
else:
|
|
32
|
+
npm_path = Path(npm_global) / ".npm-global" / "lib" / "node_modules" / "pomera-ai-commander"
|
|
33
|
+
if not npm_path.exists():
|
|
34
|
+
npm_path = Path("/usr/local/lib/node_modules/pomera-ai-commander")
|
|
35
|
+
if not npm_path.exists():
|
|
36
|
+
npm_path = Path.home() / ".npm-packages" / "lib" / "node_modules" / "pomera-ai-commander"
|
|
37
|
+
|
|
38
|
+
if npm_path.exists():
|
|
39
|
+
return npm_path
|
|
40
|
+
|
|
41
|
+
return script_dir
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def get_desktop_path() -> Path:
|
|
45
|
+
"""Get the user's desktop directory."""
|
|
46
|
+
if platform.system() == "Windows":
|
|
47
|
+
return Path(os.environ.get("USERPROFILE", "")) / "Desktop"
|
|
48
|
+
elif platform.system() == "Darwin": # macOS
|
|
49
|
+
return Path.home() / "Desktop"
|
|
50
|
+
else: # Linux
|
|
51
|
+
# Check XDG user dirs
|
|
52
|
+
xdg_desktop = os.environ.get("XDG_DESKTOP_DIR")
|
|
53
|
+
if xdg_desktop:
|
|
54
|
+
return Path(xdg_desktop)
|
|
55
|
+
return Path.home() / "Desktop"
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def create_windows_shortcut(package_dir: Path, desktop: Path) -> bool:
|
|
59
|
+
"""Create Windows .lnk shortcut."""
|
|
60
|
+
try:
|
|
61
|
+
import subprocess
|
|
62
|
+
|
|
63
|
+
shortcut_path = desktop / "Pomera AI Commander.lnk"
|
|
64
|
+
pomera_py = package_dir / "pomera.py"
|
|
65
|
+
icon_path = package_dir / "resources" / "icon.ico"
|
|
66
|
+
|
|
67
|
+
# Use PowerShell to create shortcut
|
|
68
|
+
ps_script = f'''
|
|
69
|
+
$WshShell = New-Object -ComObject WScript.Shell
|
|
70
|
+
$Shortcut = $WshShell.CreateShortcut("{shortcut_path}")
|
|
71
|
+
$Shortcut.TargetPath = "pythonw.exe"
|
|
72
|
+
$Shortcut.Arguments = '"{pomera_py}"'
|
|
73
|
+
$Shortcut.WorkingDirectory = "{package_dir}"
|
|
74
|
+
$Shortcut.Description = "Pomera AI Commander - Text Processing Toolkit"
|
|
75
|
+
'''
|
|
76
|
+
if icon_path.exists():
|
|
77
|
+
ps_script += f'$Shortcut.IconLocation = "{icon_path},0"\n'
|
|
78
|
+
|
|
79
|
+
ps_script += '$Shortcut.Save()'
|
|
80
|
+
|
|
81
|
+
result = subprocess.run(
|
|
82
|
+
["powershell", "-Command", ps_script],
|
|
83
|
+
capture_output=True,
|
|
84
|
+
text=True
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
if result.returncode == 0:
|
|
88
|
+
print(f"✓ Created Windows shortcut: {shortcut_path}")
|
|
89
|
+
return True
|
|
90
|
+
else:
|
|
91
|
+
print(f"✗ Failed to create shortcut: {result.stderr}")
|
|
92
|
+
return False
|
|
93
|
+
|
|
94
|
+
except Exception as e:
|
|
95
|
+
print(f"✗ Error creating Windows shortcut: {e}")
|
|
96
|
+
return False
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def create_macos_shortcut(package_dir: Path, desktop: Path) -> bool:
|
|
100
|
+
"""Create macOS .command script."""
|
|
101
|
+
try:
|
|
102
|
+
shortcut_path = desktop / "Pomera AI Commander.command"
|
|
103
|
+
pomera_py = package_dir / "pomera.py"
|
|
104
|
+
|
|
105
|
+
script_content = f'''#!/bin/bash
|
|
106
|
+
# Pomera AI Commander Launcher
|
|
107
|
+
cd "{package_dir}"
|
|
108
|
+
python3 "{pomera_py}"
|
|
109
|
+
'''
|
|
110
|
+
|
|
111
|
+
shortcut_path.write_text(script_content)
|
|
112
|
+
# Make executable
|
|
113
|
+
shortcut_path.chmod(shortcut_path.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
114
|
+
|
|
115
|
+
print(f"✓ Created macOS launcher: {shortcut_path}")
|
|
116
|
+
return True
|
|
117
|
+
|
|
118
|
+
except Exception as e:
|
|
119
|
+
print(f"✗ Error creating macOS shortcut: {e}")
|
|
120
|
+
return False
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def create_linux_shortcut(package_dir: Path, desktop: Path) -> bool:
|
|
124
|
+
"""Create Linux .desktop launcher."""
|
|
125
|
+
try:
|
|
126
|
+
shortcut_path = desktop / "pomera-ai-commander.desktop"
|
|
127
|
+
pomera_py = package_dir / "pomera.py"
|
|
128
|
+
icon_path = package_dir / "resources" / "icon.png"
|
|
129
|
+
|
|
130
|
+
# Use icon if exists, otherwise use generic
|
|
131
|
+
icon = str(icon_path) if icon_path.exists() else "utilities-terminal"
|
|
132
|
+
|
|
133
|
+
desktop_entry = f'''[Desktop Entry]
|
|
134
|
+
Version=1.0
|
|
135
|
+
Type=Application
|
|
136
|
+
Name=Pomera AI Commander
|
|
137
|
+
Comment=Text Processing Toolkit with MCP tools for AI assistants
|
|
138
|
+
Exec=python3 "{pomera_py}"
|
|
139
|
+
Icon={icon}
|
|
140
|
+
Terminal=false
|
|
141
|
+
Categories=Development;Utility;TextTools;
|
|
142
|
+
StartupNotify=true
|
|
143
|
+
'''
|
|
144
|
+
|
|
145
|
+
shortcut_path.write_text(desktop_entry)
|
|
146
|
+
# Make executable
|
|
147
|
+
shortcut_path.chmod(shortcut_path.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
148
|
+
|
|
149
|
+
print(f"✓ Created Linux launcher: {shortcut_path}")
|
|
150
|
+
|
|
151
|
+
# Also try to add to applications menu
|
|
152
|
+
try:
|
|
153
|
+
apps_dir = Path.home() / ".local" / "share" / "applications"
|
|
154
|
+
apps_dir.mkdir(parents=True, exist_ok=True)
|
|
155
|
+
apps_shortcut = apps_dir / "pomera-ai-commander.desktop"
|
|
156
|
+
apps_shortcut.write_text(desktop_entry)
|
|
157
|
+
apps_shortcut.chmod(apps_shortcut.stat().st_mode | stat.S_IXUSR)
|
|
158
|
+
print(f"✓ Added to applications menu: {apps_shortcut}")
|
|
159
|
+
except Exception:
|
|
160
|
+
pass # Not critical
|
|
161
|
+
|
|
162
|
+
return True
|
|
163
|
+
|
|
164
|
+
except Exception as e:
|
|
165
|
+
print(f"✗ Error creating Linux shortcut: {e}")
|
|
166
|
+
return False
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def create_shortcut():
|
|
170
|
+
"""Create desktop shortcut for the current platform."""
|
|
171
|
+
print("\n🐕 Pomera AI Commander - Desktop Shortcut Creator")
|
|
172
|
+
print("=" * 50)
|
|
173
|
+
|
|
174
|
+
package_dir = get_package_dir()
|
|
175
|
+
desktop = get_desktop_path()
|
|
176
|
+
|
|
177
|
+
print(f"Package directory: {package_dir}")
|
|
178
|
+
print(f"Desktop directory: {desktop}")
|
|
179
|
+
|
|
180
|
+
if not (package_dir / "pomera.py").exists():
|
|
181
|
+
print(f"✗ Error: pomera.py not found in {package_dir}")
|
|
182
|
+
return False
|
|
183
|
+
|
|
184
|
+
if not desktop.exists():
|
|
185
|
+
print(f"✗ Error: Desktop directory not found: {desktop}")
|
|
186
|
+
return False
|
|
187
|
+
|
|
188
|
+
system = platform.system()
|
|
189
|
+
print(f"Platform: {system}")
|
|
190
|
+
print("-" * 50)
|
|
191
|
+
|
|
192
|
+
if system == "Windows":
|
|
193
|
+
return create_windows_shortcut(package_dir, desktop)
|
|
194
|
+
elif system == "Darwin":
|
|
195
|
+
return create_macos_shortcut(package_dir, desktop)
|
|
196
|
+
elif system == "Linux":
|
|
197
|
+
return create_linux_shortcut(package_dir, desktop)
|
|
198
|
+
else:
|
|
199
|
+
print(f"✗ Unsupported platform: {system}")
|
|
200
|
+
return False
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def remove_shortcut():
|
|
204
|
+
"""Remove desktop shortcut for the current platform."""
|
|
205
|
+
print("\n🐕 Removing Pomera AI Commander shortcut...")
|
|
206
|
+
|
|
207
|
+
desktop = get_desktop_path()
|
|
208
|
+
system = platform.system()
|
|
209
|
+
|
|
210
|
+
shortcuts = []
|
|
211
|
+
if system == "Windows":
|
|
212
|
+
shortcuts.append(desktop / "Pomera AI Commander.lnk")
|
|
213
|
+
elif system == "Darwin":
|
|
214
|
+
shortcuts.append(desktop / "Pomera AI Commander.command")
|
|
215
|
+
elif system == "Linux":
|
|
216
|
+
shortcuts.append(desktop / "pomera-ai-commander.desktop")
|
|
217
|
+
shortcuts.append(Path.home() / ".local" / "share" / "applications" / "pomera-ai-commander.desktop")
|
|
218
|
+
|
|
219
|
+
for shortcut in shortcuts:
|
|
220
|
+
if shortcut.exists():
|
|
221
|
+
try:
|
|
222
|
+
shortcut.unlink()
|
|
223
|
+
print(f"✓ Removed: {shortcut}")
|
|
224
|
+
except Exception as e:
|
|
225
|
+
print(f"✗ Failed to remove {shortcut}: {e}")
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
if __name__ == "__main__":
|
|
229
|
+
if len(sys.argv) > 1 and sys.argv[1] == "--remove":
|
|
230
|
+
remove_shortcut()
|
|
231
|
+
else:
|
|
232
|
+
success = create_shortcut()
|
|
233
|
+
if success:
|
|
234
|
+
print("\n✅ Desktop shortcut created successfully!")
|
|
235
|
+
else:
|
|
236
|
+
print("\n⚠️ Failed to create desktop shortcut")
|
|
237
|
+
sys.exit(1)
|
package/mcp.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pomera-ai-commander",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Text processing toolkit with 22 MCP tools including case transformation, encoding, hashing, text analysis, and notes management for AI assistants.",
|
|
5
5
|
"homepage": "https://github.com/matbanik/Pomera-AI-Commander",
|
|
6
6
|
"repository": "https://github.com/matbanik/Pomera-AI-Commander",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pomera-ai-commander",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Text processing toolkit with 22 MCP tools for AI assistants - case transformation, encoding, hashing, text analysis, and notes management",
|
|
5
5
|
"main": "pomera_mcp_server.py",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"mcp": "python pomera_mcp_server.py",
|
|
13
13
|
"list-tools": "python pomera_mcp_server.py --list-tools",
|
|
14
14
|
"test": "python -m pytest",
|
|
15
|
+
"create-shortcut": "node scripts/postinstall.js",
|
|
15
16
|
"postinstall": "node scripts/postinstall.js"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
@@ -50,8 +51,10 @@
|
|
|
50
51
|
"core/",
|
|
51
52
|
"tools/",
|
|
52
53
|
"scripts/",
|
|
54
|
+
"resources/",
|
|
53
55
|
"pomera_mcp_server.py",
|
|
54
56
|
"pomera.py",
|
|
57
|
+
"create_shortcut.py",
|
|
55
58
|
"migrate_data.py",
|
|
56
59
|
"mcp.json",
|
|
57
60
|
"README.md",
|
package/pomera.py
CHANGED
|
@@ -779,6 +779,9 @@ class PromeraAIApp(tk.Tk):
|
|
|
779
779
|
|
|
780
780
|
self.title("Pomera AI Commander")
|
|
781
781
|
self.geometry(AppConfig.DEFAULT_WINDOW_SIZE)
|
|
782
|
+
|
|
783
|
+
# Set window icon (Pomera dog mascot)
|
|
784
|
+
self._set_window_icon()
|
|
782
785
|
|
|
783
786
|
self._after_id = None
|
|
784
787
|
self._regex_cache = {}
|
|
@@ -1193,26 +1196,12 @@ class PromeraAIApp(tk.Tk):
|
|
|
1193
1196
|
|
|
1194
1197
|
ttk.Label(main_frame, text="Pomera AI Commander", font=('TkDefaultFont', 14, 'bold')).pack(pady=(0, 10))
|
|
1195
1198
|
|
|
1196
|
-
# Get current version
|
|
1197
|
-
current_version = None
|
|
1199
|
+
# Get current version from unified version module
|
|
1198
1200
|
try:
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
content = pyproject_path.read_text()
|
|
1204
|
-
match = re.search(r'version = "1.2.3"]+)"', content)
|
|
1205
|
-
if match:
|
|
1206
|
-
current_version = match.group(1)
|
|
1207
|
-
except Exception:
|
|
1208
|
-
pass
|
|
1209
|
-
|
|
1210
|
-
if not current_version:
|
|
1211
|
-
try:
|
|
1212
|
-
import importlib.metadata
|
|
1213
|
-
current_version = importlib.metadata.version("pomera-ai-commander")
|
|
1214
|
-
except Exception:
|
|
1215
|
-
current_version = "1.2.3"
|
|
1201
|
+
from pomera.version import __version__
|
|
1202
|
+
current_version = __version__
|
|
1203
|
+
except ImportError:
|
|
1204
|
+
current_version = "unknown"
|
|
1216
1205
|
|
|
1217
1206
|
# Detect OS for download link
|
|
1218
1207
|
system = platform.system()
|
|
@@ -1350,8 +1339,12 @@ class PromeraAIApp(tk.Tk):
|
|
|
1350
1339
|
|
|
1351
1340
|
def _show_about_dialog(self):
|
|
1352
1341
|
"""Show About dialog."""
|
|
1353
|
-
# Version managed by
|
|
1354
|
-
|
|
1342
|
+
# Version from unified version module (managed by setuptools_scm)
|
|
1343
|
+
try:
|
|
1344
|
+
from pomera.version import __version__
|
|
1345
|
+
version = __version__
|
|
1346
|
+
except ImportError:
|
|
1347
|
+
version = "unknown"
|
|
1355
1348
|
|
|
1356
1349
|
messagebox.showinfo(
|
|
1357
1350
|
"About Pomera AI Commander",
|
|
@@ -1359,6 +1352,42 @@ class PromeraAIApp(tk.Tk):
|
|
|
1359
1352
|
"Text processing toolkit with MCP tools for AI assistants.\n\n"
|
|
1360
1353
|
"https://github.com/matbanik/Pomera-AI-Commander"
|
|
1361
1354
|
)
|
|
1355
|
+
|
|
1356
|
+
def _set_window_icon(self):
|
|
1357
|
+
"""Set the window icon (Pomera dog mascot)."""
|
|
1358
|
+
try:
|
|
1359
|
+
# Find icon file - check multiple locations
|
|
1360
|
+
script_dir = Path(__file__).parent.resolve()
|
|
1361
|
+
icon_locations = [
|
|
1362
|
+
script_dir / "resources" / "icon.ico",
|
|
1363
|
+
script_dir / "icon.ico",
|
|
1364
|
+
script_dir / "resources" / "icon.png",
|
|
1365
|
+
script_dir / "icon.png",
|
|
1366
|
+
]
|
|
1367
|
+
|
|
1368
|
+
icon_path = None
|
|
1369
|
+
for loc in icon_locations:
|
|
1370
|
+
if loc.exists():
|
|
1371
|
+
icon_path = loc
|
|
1372
|
+
break
|
|
1373
|
+
|
|
1374
|
+
if icon_path is None:
|
|
1375
|
+
return # No icon found, use default
|
|
1376
|
+
|
|
1377
|
+
if platform.system() == "Windows" and icon_path.suffix == ".ico":
|
|
1378
|
+
# Windows: use iconbitmap for .ico files
|
|
1379
|
+
self.iconbitmap(str(icon_path))
|
|
1380
|
+
else:
|
|
1381
|
+
# Other platforms or PNG: use PhotoImage
|
|
1382
|
+
from PIL import Image, ImageTk
|
|
1383
|
+
img = Image.open(icon_path)
|
|
1384
|
+
# Resize to appropriate icon size - use NEAREST for sharp pixel art
|
|
1385
|
+
img = img.resize((32, 32), Image.Resampling.NEAREST)
|
|
1386
|
+
self._icon_photo = ImageTk.PhotoImage(img)
|
|
1387
|
+
self.iconphoto(True, self._icon_photo)
|
|
1388
|
+
|
|
1389
|
+
except Exception as e:
|
|
1390
|
+
self.logger.debug(f"Could not set window icon: {e}")
|
|
1362
1391
|
|
|
1363
1392
|
def _auto_save_settings(self):
|
|
1364
1393
|
"""Auto-save settings periodically (called by Task Scheduler)."""
|
package/pomera_mcp_server.py
CHANGED
|
@@ -56,6 +56,12 @@ logging.basicConfig(
|
|
|
56
56
|
)
|
|
57
57
|
logger = logging.getLogger(__name__)
|
|
58
58
|
|
|
59
|
+
# Import version from unified version module
|
|
60
|
+
try:
|
|
61
|
+
from pomera.version import __version__
|
|
62
|
+
except ImportError:
|
|
63
|
+
__version__ = "unknown"
|
|
64
|
+
|
|
59
65
|
|
|
60
66
|
def main():
|
|
61
67
|
"""Main entry point for the Pomera MCP server."""
|
|
@@ -70,7 +76,7 @@ def main():
|
|
|
70
76
|
parser.add_argument(
|
|
71
77
|
"--version",
|
|
72
78
|
action="version",
|
|
73
|
-
version="pomera-mcp-server
|
|
79
|
+
version=f"pomera-mcp-server {__version__}"
|
|
74
80
|
)
|
|
75
81
|
parser.add_argument(
|
|
76
82
|
"--list-tools",
|
|
@@ -160,7 +166,7 @@ def main():
|
|
|
160
166
|
server = StdioMCPServer(
|
|
161
167
|
tool_registry=registry,
|
|
162
168
|
server_name="pomera-mcp-server",
|
|
163
|
-
server_version=
|
|
169
|
+
server_version=__version__
|
|
164
170
|
)
|
|
165
171
|
|
|
166
172
|
logger.info("Starting Pomera MCP Server...")
|
|
Binary file
|
|
Binary file
|
package/scripts/postinstall.js
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Pomera AI Commander - npm postinstall script
|
|
4
4
|
*
|
|
5
|
-
* This script runs after npm install/update and
|
|
6
|
-
* databases in the package directory that might be at risk
|
|
7
|
-
*
|
|
8
|
-
* Displays a warning if portable mode data is detected.
|
|
5
|
+
* This script runs after npm install/update and:
|
|
6
|
+
* 1. Checks for databases in the package directory that might be at risk
|
|
7
|
+
* 2. Creates a desktop shortcut for easy access to the GUI
|
|
9
8
|
*/
|
|
10
9
|
|
|
11
10
|
const fs = require('fs');
|
|
12
11
|
const path = require('path');
|
|
12
|
+
const { execSync, spawn } = require('child_process');
|
|
13
|
+
const os = require('os');
|
|
13
14
|
|
|
14
15
|
// Package root directory
|
|
15
16
|
const packageDir = path.join(__dirname, '..');
|
|
16
17
|
|
|
17
|
-
//
|
|
18
|
+
// ============================================================
|
|
19
|
+
// Part 1: Database Warning Check
|
|
20
|
+
// ============================================================
|
|
21
|
+
|
|
18
22
|
const databases = ['settings.db', 'notes.db', 'settings.json'];
|
|
19
23
|
const foundDatabases = [];
|
|
20
24
|
|
|
@@ -30,7 +34,6 @@ databases.forEach(db => {
|
|
|
30
34
|
}
|
|
31
35
|
});
|
|
32
36
|
|
|
33
|
-
// If databases found in package directory, show warning
|
|
34
37
|
if (foundDatabases.length > 0) {
|
|
35
38
|
console.log('\n' + '='.repeat(70));
|
|
36
39
|
console.log('⚠️ POMERA DATA WARNING ⚠️');
|
|
@@ -56,7 +59,163 @@ if (foundDatabases.length > 0) {
|
|
|
56
59
|
}
|
|
57
60
|
console.log('\n' + '='.repeat(70) + '\n');
|
|
58
61
|
} else {
|
|
59
|
-
// No databases in package directory - safe configuration
|
|
60
62
|
console.log('✅ Pomera AI Commander installed successfully.');
|
|
61
63
|
console.log(' Data will be stored in platform-appropriate directory (safe from updates).');
|
|
62
64
|
}
|
|
65
|
+
|
|
66
|
+
// ============================================================
|
|
67
|
+
// Part 2: Desktop Shortcut Creation
|
|
68
|
+
// ============================================================
|
|
69
|
+
|
|
70
|
+
function getDesktopPath() {
|
|
71
|
+
if (process.platform === 'win32') {
|
|
72
|
+
return path.join(os.homedir(), 'Desktop');
|
|
73
|
+
} else if (process.platform === 'darwin') {
|
|
74
|
+
return path.join(os.homedir(), 'Desktop');
|
|
75
|
+
} else {
|
|
76
|
+
// Linux - check XDG
|
|
77
|
+
const xdgDesktop = process.env.XDG_DESKTOP_DIR;
|
|
78
|
+
if (xdgDesktop) return xdgDesktop;
|
|
79
|
+
return path.join(os.homedir(), 'Desktop');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function createWindowsShortcut() {
|
|
84
|
+
const desktop = getDesktopPath();
|
|
85
|
+
const shortcutPath = path.join(desktop, 'Pomera AI Commander.lnk');
|
|
86
|
+
const pomeraPath = path.join(packageDir, 'pomera.py');
|
|
87
|
+
const iconPath = path.join(packageDir, 'resources', 'icon.ico');
|
|
88
|
+
|
|
89
|
+
let psScript = `
|
|
90
|
+
$WshShell = New-Object -ComObject WScript.Shell
|
|
91
|
+
$Shortcut = $WshShell.CreateShortcut("${shortcutPath.replace(/\\/g, '\\\\')}")
|
|
92
|
+
$Shortcut.TargetPath = "pythonw.exe"
|
|
93
|
+
$Shortcut.Arguments = '"${pomeraPath.replace(/\\/g, '\\\\')}"'
|
|
94
|
+
$Shortcut.WorkingDirectory = "${packageDir.replace(/\\/g, '\\\\')}"
|
|
95
|
+
$Shortcut.Description = "Pomera AI Commander - Text Processing Toolkit"
|
|
96
|
+
`;
|
|
97
|
+
if (fs.existsSync(iconPath)) {
|
|
98
|
+
psScript += `$Shortcut.IconLocation = "${iconPath.replace(/\\/g, '\\\\')},0"\n`;
|
|
99
|
+
}
|
|
100
|
+
psScript += '$Shortcut.Save()';
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
execSync(`powershell -Command "${psScript.replace(/"/g, '\\"')}"`, { stdio: 'pipe' });
|
|
104
|
+
console.log(`\n🐕 Desktop shortcut created: ${shortcutPath}`);
|
|
105
|
+
return true;
|
|
106
|
+
} catch (e) {
|
|
107
|
+
console.log('\n⚠️ Could not create desktop shortcut automatically.');
|
|
108
|
+
console.log(' Run: python create_shortcut.py');
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function createMacOSShortcut() {
|
|
114
|
+
const desktop = getDesktopPath();
|
|
115
|
+
const shortcutPath = path.join(desktop, 'Pomera AI Commander.command');
|
|
116
|
+
const pomeraPath = path.join(packageDir, 'pomera.py');
|
|
117
|
+
|
|
118
|
+
const script = `#!/bin/bash
|
|
119
|
+
# Pomera AI Commander Launcher
|
|
120
|
+
cd "${packageDir}"
|
|
121
|
+
python3 "${pomeraPath}"
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
fs.writeFileSync(shortcutPath, script);
|
|
126
|
+
fs.chmodSync(shortcutPath, 0o755);
|
|
127
|
+
console.log(`\n🐕 Desktop launcher created: ${shortcutPath}`);
|
|
128
|
+
return true;
|
|
129
|
+
} catch (e) {
|
|
130
|
+
console.log('\n⚠️ Could not create desktop shortcut automatically.');
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function createLinuxShortcut() {
|
|
136
|
+
const desktop = getDesktopPath();
|
|
137
|
+
const shortcutPath = path.join(desktop, 'pomera-ai-commander.desktop');
|
|
138
|
+
const pomeraPath = path.join(packageDir, 'pomera.py');
|
|
139
|
+
const iconPath = path.join(packageDir, 'resources', 'icon.png');
|
|
140
|
+
|
|
141
|
+
const icon = fs.existsSync(iconPath) ? iconPath : 'utilities-terminal';
|
|
142
|
+
|
|
143
|
+
const desktopEntry = `[Desktop Entry]
|
|
144
|
+
Version=1.0
|
|
145
|
+
Type=Application
|
|
146
|
+
Name=Pomera AI Commander
|
|
147
|
+
Comment=Text Processing Toolkit with MCP tools for AI assistants
|
|
148
|
+
Exec=python3 "${pomeraPath}"
|
|
149
|
+
Icon=${icon}
|
|
150
|
+
Terminal=false
|
|
151
|
+
Categories=Development;Utility;TextTools;
|
|
152
|
+
StartupNotify=true
|
|
153
|
+
`;
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
fs.writeFileSync(shortcutPath, desktopEntry);
|
|
157
|
+
fs.chmodSync(shortcutPath, 0o755);
|
|
158
|
+
console.log(`\n🐕 Desktop launcher created: ${shortcutPath}`);
|
|
159
|
+
|
|
160
|
+
// Also add to applications menu
|
|
161
|
+
const appsDir = path.join(os.homedir(), '.local', 'share', 'applications');
|
|
162
|
+
if (!fs.existsSync(appsDir)) {
|
|
163
|
+
fs.mkdirSync(appsDir, { recursive: true });
|
|
164
|
+
}
|
|
165
|
+
const appsPath = path.join(appsDir, 'pomera-ai-commander.desktop');
|
|
166
|
+
fs.writeFileSync(appsPath, desktopEntry);
|
|
167
|
+
console.log(` Also added to applications menu`);
|
|
168
|
+
|
|
169
|
+
return true;
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.log('\n⚠️ Could not create desktop shortcut automatically.');
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function createDesktopShortcut() {
|
|
177
|
+
console.log('\n🐕 Creating desktop shortcut...');
|
|
178
|
+
|
|
179
|
+
const desktop = getDesktopPath();
|
|
180
|
+
if (!fs.existsSync(desktop)) {
|
|
181
|
+
console.log(` Desktop directory not found: ${desktop}`);
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (process.platform === 'win32') {
|
|
186
|
+
return createWindowsShortcut();
|
|
187
|
+
} else if (process.platform === 'darwin') {
|
|
188
|
+
return createMacOSShortcut();
|
|
189
|
+
} else {
|
|
190
|
+
return createLinuxShortcut();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Check if Python/pythonw is available before creating shortcut
|
|
195
|
+
function checkPython() {
|
|
196
|
+
try {
|
|
197
|
+
if (process.platform === 'win32') {
|
|
198
|
+
execSync('where pythonw', { stdio: 'pipe' });
|
|
199
|
+
} else {
|
|
200
|
+
execSync('which python3', { stdio: 'pipe' });
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
} catch (e) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Create shortcut if Python is available
|
|
209
|
+
if (checkPython()) {
|
|
210
|
+
createDesktopShortcut();
|
|
211
|
+
} else {
|
|
212
|
+
console.log('\n⚠️ Python not found in PATH. Desktop shortcut not created.');
|
|
213
|
+
console.log(' Install Python and run: python create_shortcut.py');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
console.log('\n📖 To start the GUI manually:');
|
|
217
|
+
console.log(' python pomera.py');
|
|
218
|
+
console.log('\n📖 To start the MCP server:');
|
|
219
|
+
console.log(' npx pomera-ai-commander');
|
|
220
|
+
console.log('');
|
|
221
|
+
|