editmamei 1.5.0 → 1.6.0
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 +17 -1
- package/dist/backends/detect-editors.js +79 -0
- package/dist/backends/gimp/backend.js +96 -0
- package/dist/backends/gimp/bridge/lib.py +1229 -0
- package/dist/backends/gimp/bridge/ops.py +1501 -0
- package/dist/backends/gimp/detect.js +86 -0
- package/dist/backends/gimp/errors.js +21 -0
- package/dist/backends/gimp/launcher.js +6 -0
- package/dist/backends/gimp/session.js +629 -0
- package/dist/bin/editmamei-core-darwin-arm64 +0 -0
- package/dist/bin/editmamei-core-darwin-x64 +0 -0
- package/dist/bin/editmamei-core-win-x64.exe +0 -0
- package/dist/cli/config.js +28 -0
- package/dist/core/server.js +142 -56
- package/dist/core/settings.js +25 -0
- package/dist/core/tool-activity.js +114 -0
- package/dist/core/tool-groups.js +16 -0
- package/dist/core/tool-tiers.js +16 -0
- package/dist/diagnostics/collect.js +4 -0
- package/dist/index.js +5 -1
- package/dist/kernel/kernel.js +3 -0
- package/dist/kernel/module-lifecycle.js +69 -9
- package/dist/license/advisory.js +109 -0
- package/dist/license/entitlement.js +34 -6
- package/dist/license/polar-client.js +50 -7
- package/dist/license/store.js +59 -0
- package/dist/modules/gimp/index.js +35 -0
- package/dist/skills/editmamei-skill.zip +0 -0
- package/dist/telemetry/activity.js +1 -93
- package/dist/telemetry/client.js +55 -17
- package/dist/telemetry/events.js +5 -0
- package/dist/telemetry/outbox.js +43 -18
- package/dist/tools/adjustment-tools.js +2 -1
- package/dist/tools/gimp-adjustment-tools.js +382 -0
- package/dist/tools/gimp-core-tools.js +288 -0
- package/dist/tools/gimp-document-tools.js +321 -0
- package/dist/tools/gimp-filter-tools.js +93 -0
- package/dist/tools/gimp-geometry-tools.js +191 -0
- package/dist/tools/gimp-inspect-tools.js +70 -0
- package/dist/tools/gimp-mask-tools.js +102 -0
- package/dist/tools/gimp-shared.js +51 -0
- package/dist/tools/gimp-verify-tools.js +374 -0
- package/dist/utils/gimp-path.js +27 -0
- package/dist/utils/operation-timeouts.js +16 -0
- package/dist/utils/session-log.js +19 -1
- package/dist/utils/tool-helpers.js +14 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { platform as osPlatform, homedir as osHomedir } from 'node:os';
|
|
2
|
+
import { posix as pathPosix, win32 as pathWin32 } from 'node:path';
|
|
3
|
+
import { stat } from 'node:fs/promises';
|
|
4
|
+
import { exeLaunchSpec, flatpakLaunchSpec } from './launcher.js';
|
|
5
|
+
async function defaultExists(path) {
|
|
6
|
+
try {
|
|
7
|
+
await stat(path);
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function splitPath(env, platform) {
|
|
15
|
+
const raw = env.PATH ?? env.Path ?? '';
|
|
16
|
+
const sep = platform === 'win32' ? ';' : ':';
|
|
17
|
+
return raw.split(sep).filter((p) => p.length > 0);
|
|
18
|
+
}
|
|
19
|
+
async function firstExisting(candidates, exists) {
|
|
20
|
+
for (const candidate of candidates) {
|
|
21
|
+
if (await exists(candidate))
|
|
22
|
+
return candidate;
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
async function detectWindows(env, exists) {
|
|
27
|
+
const localAppData = env.LOCALAPPDATA;
|
|
28
|
+
const programFiles = env.ProgramFiles ?? 'C:\\Program Files';
|
|
29
|
+
const bases = [
|
|
30
|
+
localAppData ? pathWin32.join(localAppData, 'Programs', 'GIMP 3', 'bin') : null,
|
|
31
|
+
pathWin32.join(programFiles, 'GIMP 3', 'bin'),
|
|
32
|
+
].filter((b) => b !== null);
|
|
33
|
+
const names = ['gimp-console-3.2.exe', 'gimp-console-3.exe'];
|
|
34
|
+
const candidates = names.flatMap((name) => bases.map((base) => pathWin32.join(base, name)));
|
|
35
|
+
const found = await firstExisting(candidates, exists);
|
|
36
|
+
return found ? { source: 'conventional', path: found, launch: exeLaunchSpec(found) } : null;
|
|
37
|
+
}
|
|
38
|
+
async function detectMac(homedir, exists) {
|
|
39
|
+
const bases = [
|
|
40
|
+
'/Applications/GIMP.app/Contents/MacOS',
|
|
41
|
+
pathPosix.join(homedir, 'Applications', 'GIMP.app', 'Contents', 'MacOS'),
|
|
42
|
+
];
|
|
43
|
+
const names = ['gimp-console-3.2', 'gimp-console-3', 'gimp-console'];
|
|
44
|
+
const candidates = bases.flatMap((base) => names.map((name) => pathPosix.join(base, name)));
|
|
45
|
+
const found = await firstExisting(candidates, exists);
|
|
46
|
+
return found ? { source: 'conventional', path: found, launch: exeLaunchSpec(found) } : null;
|
|
47
|
+
}
|
|
48
|
+
async function detectLinux(env, homedir, exists) {
|
|
49
|
+
const dirs = splitPath(env, 'linux');
|
|
50
|
+
const names = ['gimp-console-3.2', 'gimp-console-3', 'gimp-console'];
|
|
51
|
+
for (const name of names) {
|
|
52
|
+
const found = await firstExisting(dirs.map((dir) => pathPosix.join(dir, name)), exists);
|
|
53
|
+
if (found)
|
|
54
|
+
return { source: 'path', path: found, launch: exeLaunchSpec(found) };
|
|
55
|
+
}
|
|
56
|
+
const flatpakDirs = [
|
|
57
|
+
'/var/lib/flatpak/app/org.gimp.GIMP',
|
|
58
|
+
pathPosix.join(homedir, '.local/share/flatpak/app/org.gimp.GIMP'),
|
|
59
|
+
];
|
|
60
|
+
const flatpakFound = await firstExisting(flatpakDirs, exists);
|
|
61
|
+
return flatpakFound
|
|
62
|
+
? { source: 'flatpak', path: flatpakFound, launch: flatpakLaunchSpec() }
|
|
63
|
+
: null;
|
|
64
|
+
}
|
|
65
|
+
export async function detectGimp(opts = {}) {
|
|
66
|
+
const platform = opts.platform ?? osPlatform();
|
|
67
|
+
const env = opts.env ?? process.env;
|
|
68
|
+
const homedir = opts.homedir ?? osHomedir();
|
|
69
|
+
const exists = opts.exists ?? defaultExists;
|
|
70
|
+
const override = env.EDITMAMEI_GIMP_PATH;
|
|
71
|
+
if (override) {
|
|
72
|
+
if (override === 'flatpak') {
|
|
73
|
+
return { source: 'env', path: override, launch: flatpakLaunchSpec() };
|
|
74
|
+
}
|
|
75
|
+
if (await exists(override)) {
|
|
76
|
+
return { source: 'env', path: override, launch: exeLaunchSpec(override) };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (platform === 'win32')
|
|
80
|
+
return detectWindows(env, exists);
|
|
81
|
+
if (platform === 'darwin')
|
|
82
|
+
return detectMac(homedir, exists);
|
|
83
|
+
if (platform === 'linux')
|
|
84
|
+
return detectLinux(env, homedir, exists);
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const GIMP_ERROR_CODES = [
|
|
2
|
+
'gimp_not_installed',
|
|
3
|
+
'gimp_start_failed',
|
|
4
|
+
'gimp_starting',
|
|
5
|
+
'gimp_python_missing',
|
|
6
|
+
'gimp_version_unsupported',
|
|
7
|
+
'gimp_session_restarted',
|
|
8
|
+
'gimp_timeout',
|
|
9
|
+
'gimp_unsupported_file',
|
|
10
|
+
'gimp_op_failed',
|
|
11
|
+
'invalid_argument',
|
|
12
|
+
'file_not_found',
|
|
13
|
+
];
|
|
14
|
+
export class GimpError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
constructor(code, sentence) {
|
|
17
|
+
super(`${code}: ${sentence}`);
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.name = 'GimpError';
|
|
20
|
+
}
|
|
21
|
+
}
|