localwp-mcp 0.1.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/LICENSE +15 -0
- package/README.md +229 -0
- package/dist/backup.d.ts +72 -0
- package/dist/backup.js +351 -0
- package/dist/backup.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.js +58 -0
- package/dist/config.js.map +1 -0
- package/dist/environment-check.d.ts +187 -0
- package/dist/environment-check.js +174 -0
- package/dist/environment-check.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/local-doctor.d.ts +42 -0
- package/dist/local-doctor.js +224 -0
- package/dist/local-doctor.js.map +1 -0
- package/dist/local-sites.d.ts +103 -0
- package/dist/local-sites.js +234 -0
- package/dist/local-sites.js.map +1 -0
- package/dist/local-tooling.d.ts +2 -0
- package/dist/local-tooling.js +23 -0
- package/dist/local-tooling.js.map +1 -0
- package/dist/logs.d.ts +144 -0
- package/dist/logs.js +208 -0
- package/dist/logs.js.map +1 -0
- package/dist/mysql.d.ts +17 -0
- package/dist/mysql.js +229 -0
- package/dist/mysql.js.map +1 -0
- package/dist/permissions.d.ts +4 -0
- package/dist/permissions.js +129 -0
- package/dist/permissions.js.map +1 -0
- package/dist/platform-paths.d.ts +10 -0
- package/dist/platform-paths.js +95 -0
- package/dist/platform-paths.js.map +1 -0
- package/dist/process-utils.d.ts +13 -0
- package/dist/process-utils.js +128 -0
- package/dist/process-utils.js.map +1 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +64 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resources.d.ts +2 -0
- package/dist/resources.js +110 -0
- package/dist/resources.js.map +1 -0
- package/dist/results.d.ts +15 -0
- package/dist/results.js +26 -0
- package/dist/results.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +23 -0
- package/dist/server.js.map +1 -0
- package/dist/tool-schemas.d.ts +14 -0
- package/dist/tool-schemas.js +20 -0
- package/dist/tool-schemas.js.map +1 -0
- package/dist/tools/backup-site.d.ts +2 -0
- package/dist/tools/backup-site.js +42 -0
- package/dist/tools/backup-site.js.map +1 -0
- package/dist/tools/db-export.d.ts +2 -0
- package/dist/tools/db-export.js +40 -0
- package/dist/tools/db-export.js.map +1 -0
- package/dist/tools/db-import.d.ts +2 -0
- package/dist/tools/db-import.js +42 -0
- package/dist/tools/db-import.js.map +1 -0
- package/dist/tools/execute-wp-cli.d.ts +2 -0
- package/dist/tools/execute-wp-cli.js +34 -0
- package/dist/tools/execute-wp-cli.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +29 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-local-sites.d.ts +2 -0
- package/dist/tools/list-local-sites.js +32 -0
- package/dist/tools/list-local-sites.js.map +1 -0
- package/dist/tools/local-doctor.d.ts +2 -0
- package/dist/tools/local-doctor.js +23 -0
- package/dist/tools/local-doctor.js.map +1 -0
- package/dist/tools/local-environment-check.d.ts +2 -0
- package/dist/tools/local-environment-check.js +32 -0
- package/dist/tools/local-environment-check.js.map +1 -0
- package/dist/tools/local-logs.d.ts +2 -0
- package/dist/tools/local-logs.js +31 -0
- package/dist/tools/local-logs.js.map +1 -0
- package/dist/tools/local-site-info.d.ts +2 -0
- package/dist/tools/local-site-info.js +46 -0
- package/dist/tools/local-site-info.js.map +1 -0
- package/dist/tools/mysql-execute.d.ts +2 -0
- package/dist/tools/mysql-execute.js +46 -0
- package/dist/tools/mysql-execute.js.map +1 -0
- package/dist/tools/mysql-query.d.ts +2 -0
- package/dist/tools/mysql-query.js +43 -0
- package/dist/tools/mysql-query.js.map +1 -0
- package/dist/tools/mysql-schema.d.ts +2 -0
- package/dist/tools/mysql-schema.js +50 -0
- package/dist/tools/mysql-schema.js.map +1 -0
- package/dist/tools/restore-backup.d.ts +2 -0
- package/dist/tools/restore-backup.js +52 -0
- package/dist/tools/restore-backup.js.map +1 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/wp-cli.d.ts +14 -0
- package/dist/wp-cli.js +140 -0
- package/dist/wp-cli.js.map +1 -0
- package/package.json +61 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AccessProfile } from "./types.js";
|
|
2
|
+
export declare const config: {
|
|
3
|
+
readonly platform: NodeJS.Platform;
|
|
4
|
+
readonly arch: NodeJS.Architecture;
|
|
5
|
+
readonly homeDir: string;
|
|
6
|
+
readonly localAppSupportDir: string;
|
|
7
|
+
readonly localExtraResourcesDirs: string[];
|
|
8
|
+
readonly localRunDir: string;
|
|
9
|
+
readonly localLightningServicesDirs: string[];
|
|
10
|
+
readonly localSitesJson: string;
|
|
11
|
+
readonly localSiteStatusesJson: string;
|
|
12
|
+
readonly localWpCliPharCandidates: string[];
|
|
13
|
+
readonly localWpCliConfigCandidates: string[];
|
|
14
|
+
readonly localHelperBinDirCandidates: string[];
|
|
15
|
+
readonly defaultMysqlHost: string;
|
|
16
|
+
readonly defaultTimeoutMs: 60000;
|
|
17
|
+
readonly defaultMaxRows: 200;
|
|
18
|
+
readonly maxMaxRows: 1000;
|
|
19
|
+
readonly defaultLogTailLines: 120;
|
|
20
|
+
readonly maxLogTailLines: 500;
|
|
21
|
+
readonly backupsDirOverride: string | null;
|
|
22
|
+
readonly profile: AccessProfile;
|
|
23
|
+
};
|
|
24
|
+
export declare function normalizeAccessProfile(value: string): AccessProfile;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import os from "os";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { getDefaultLocalAppSupportDir, getDefaultLocalExtraResourcesDirs, getDefaultLocalLightningServiceDirs, getHelperBinDirCandidates, getWpCliConfigCandidates, getWpCliPharCandidates, } from "./platform-paths.js";
|
|
4
|
+
const homeDir = os.homedir();
|
|
5
|
+
const platform = process.platform;
|
|
6
|
+
const arch = process.arch;
|
|
7
|
+
const defaultLocalAppSupportDir = getDefaultLocalAppSupportDir(platform, homeDir, process.env);
|
|
8
|
+
const defaultLocalExtraResourcesDirs = getDefaultLocalExtraResourcesDirs(platform, homeDir, process.env);
|
|
9
|
+
const localExtraResourcesDirs = process.env.LOCAL_EXTRA_RESOURCES_DIRS?.split(path.delimiter).filter(Boolean) ||
|
|
10
|
+
defaultLocalExtraResourcesDirs;
|
|
11
|
+
const localLightningServicesDirs = process.env.LOCAL_LIGHTNING_SERVICES_DIRS
|
|
12
|
+
?.split(path.delimiter)
|
|
13
|
+
.filter(Boolean) ||
|
|
14
|
+
(process.env.LOCAL_LIGHTNING_SERVICES_DIR
|
|
15
|
+
? [process.env.LOCAL_LIGHTNING_SERVICES_DIR]
|
|
16
|
+
: getDefaultLocalLightningServiceDirs(process.env.LOCAL_APP_SUPPORT_DIR || defaultLocalAppSupportDir, localExtraResourcesDirs));
|
|
17
|
+
export const config = {
|
|
18
|
+
platform,
|
|
19
|
+
arch,
|
|
20
|
+
homeDir,
|
|
21
|
+
localAppSupportDir: process.env.LOCAL_APP_SUPPORT_DIR || defaultLocalAppSupportDir,
|
|
22
|
+
localExtraResourcesDirs,
|
|
23
|
+
localRunDir: process.env.LOCAL_RUN_DIR ||
|
|
24
|
+
path.join(process.env.LOCAL_APP_SUPPORT_DIR || defaultLocalAppSupportDir, "run"),
|
|
25
|
+
localLightningServicesDirs,
|
|
26
|
+
localSitesJson: process.env.LOCAL_SITES_JSON ||
|
|
27
|
+
path.join(process.env.LOCAL_APP_SUPPORT_DIR || defaultLocalAppSupportDir, "sites.json"),
|
|
28
|
+
localSiteStatusesJson: process.env.LOCAL_SITE_STATUSES_JSON ||
|
|
29
|
+
path.join(process.env.LOCAL_APP_SUPPORT_DIR || defaultLocalAppSupportDir, "site-statuses.json"),
|
|
30
|
+
localWpCliPharCandidates: process.env.LOCAL_WP_CLI_PHAR
|
|
31
|
+
? [process.env.LOCAL_WP_CLI_PHAR]
|
|
32
|
+
: getWpCliPharCandidates(platform, localExtraResourcesDirs),
|
|
33
|
+
localWpCliConfigCandidates: process.env.LOCAL_WP_CLI_CONFIG
|
|
34
|
+
? [process.env.LOCAL_WP_CLI_CONFIG]
|
|
35
|
+
: getWpCliConfigCandidates(localExtraResourcesDirs),
|
|
36
|
+
localHelperBinDirCandidates: process.env.LOCAL_HELPER_BIN_DIRS
|
|
37
|
+
? process.env.LOCAL_HELPER_BIN_DIRS.split(path.delimiter).filter(Boolean)
|
|
38
|
+
: getHelperBinDirCandidates(platform, localExtraResourcesDirs),
|
|
39
|
+
defaultMysqlHost: process.env.LOCAL_MYSQL_HOST || "127.0.0.1",
|
|
40
|
+
defaultTimeoutMs: 60_000,
|
|
41
|
+
defaultMaxRows: 200,
|
|
42
|
+
maxMaxRows: 1000,
|
|
43
|
+
defaultLogTailLines: 120,
|
|
44
|
+
maxLogTailLines: 500,
|
|
45
|
+
backupsDirOverride: process.env.LOCALWP_MCP_BACKUPS_DIR || null,
|
|
46
|
+
profile: normalizeAccessProfile(process.env.LOCALWP_MCP_PROFILE || "safe"),
|
|
47
|
+
};
|
|
48
|
+
export function normalizeAccessProfile(value) {
|
|
49
|
+
const normalized = value.trim().toLowerCase();
|
|
50
|
+
if (normalized === "safe") {
|
|
51
|
+
return "safe";
|
|
52
|
+
}
|
|
53
|
+
if (["full-access", "full_access", "full"].includes(normalized)) {
|
|
54
|
+
return "full-access";
|
|
55
|
+
}
|
|
56
|
+
throw new Error("Invalid LOCALWP_MCP_PROFILE. Expected 'safe' or 'full-access'.");
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,4BAA4B,EAC5B,iCAAiC,EACjC,mCAAmC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MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE9C,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { SiteSelection } from "./types.js";
|
|
2
|
+
export declare function runEnvironmentCheck(selection: SiteSelection, options?: {
|
|
3
|
+
probeWpCli?: boolean;
|
|
4
|
+
probeMysql?: boolean;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
platform: NodeJS.Platform;
|
|
7
|
+
arch: NodeJS.Architecture;
|
|
8
|
+
nodeVersion: string;
|
|
9
|
+
accessProfile: import("./types.js").AccessProfile;
|
|
10
|
+
requestedSiteId: string | null;
|
|
11
|
+
requestedSiteName: string | null;
|
|
12
|
+
probes: {
|
|
13
|
+
wpCli: boolean;
|
|
14
|
+
mysql: boolean;
|
|
15
|
+
};
|
|
16
|
+
corePaths: {
|
|
17
|
+
localAppSupportDir: {
|
|
18
|
+
path: string;
|
|
19
|
+
kind: "file" | "directory";
|
|
20
|
+
readable: boolean;
|
|
21
|
+
executable: boolean | null;
|
|
22
|
+
};
|
|
23
|
+
localRunDir: {
|
|
24
|
+
path: string;
|
|
25
|
+
kind: "file" | "directory";
|
|
26
|
+
readable: boolean;
|
|
27
|
+
executable: boolean | null;
|
|
28
|
+
};
|
|
29
|
+
localSitesJson: {
|
|
30
|
+
path: string;
|
|
31
|
+
kind: "file" | "directory";
|
|
32
|
+
readable: boolean;
|
|
33
|
+
executable: boolean | null;
|
|
34
|
+
};
|
|
35
|
+
localSiteStatusesJson: {
|
|
36
|
+
path: string;
|
|
37
|
+
kind: "file" | "directory";
|
|
38
|
+
readable: boolean;
|
|
39
|
+
executable: boolean | null;
|
|
40
|
+
};
|
|
41
|
+
localExtraResourcesDirs: {
|
|
42
|
+
path: string;
|
|
43
|
+
kind: "file" | "directory";
|
|
44
|
+
readable: boolean;
|
|
45
|
+
executable: boolean | null;
|
|
46
|
+
}[];
|
|
47
|
+
localLightningServicesDirs: {
|
|
48
|
+
path: string;
|
|
49
|
+
kind: "file" | "directory";
|
|
50
|
+
readable: boolean;
|
|
51
|
+
executable: boolean | null;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
tooling: {
|
|
55
|
+
ok: boolean;
|
|
56
|
+
wpCliPhar: {
|
|
57
|
+
path: string;
|
|
58
|
+
kind: "file" | "directory";
|
|
59
|
+
readable: boolean;
|
|
60
|
+
executable: boolean | null;
|
|
61
|
+
};
|
|
62
|
+
wpCliConfig: {
|
|
63
|
+
path: string;
|
|
64
|
+
kind: "file" | "directory";
|
|
65
|
+
readable: boolean;
|
|
66
|
+
executable: boolean | null;
|
|
67
|
+
} | null;
|
|
68
|
+
helperBinDirs: {
|
|
69
|
+
path: string;
|
|
70
|
+
kind: "file" | "directory";
|
|
71
|
+
readable: boolean;
|
|
72
|
+
executable: boolean | null;
|
|
73
|
+
}[];
|
|
74
|
+
error?: undefined;
|
|
75
|
+
candidates?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
ok: boolean;
|
|
78
|
+
error: string;
|
|
79
|
+
candidates: {
|
|
80
|
+
wpCliPhar: string[];
|
|
81
|
+
wpCliConfig: string[];
|
|
82
|
+
helperBinDirs: string[];
|
|
83
|
+
};
|
|
84
|
+
wpCliPhar?: undefined;
|
|
85
|
+
wpCliConfig?: undefined;
|
|
86
|
+
helperBinDirs?: undefined;
|
|
87
|
+
};
|
|
88
|
+
sites: {
|
|
89
|
+
ok: boolean;
|
|
90
|
+
count: number;
|
|
91
|
+
runningCount: number;
|
|
92
|
+
sites: {
|
|
93
|
+
id: string;
|
|
94
|
+
name: string;
|
|
95
|
+
status: string;
|
|
96
|
+
domain: string | undefined;
|
|
97
|
+
path: string;
|
|
98
|
+
wpRoot: string;
|
|
99
|
+
localVersion: string | undefined;
|
|
100
|
+
phpVersion: string | null;
|
|
101
|
+
mysqlVersion: string | null;
|
|
102
|
+
httpPort: number | null;
|
|
103
|
+
mysqlPort: number | null;
|
|
104
|
+
}[];
|
|
105
|
+
error?: undefined;
|
|
106
|
+
} | {
|
|
107
|
+
ok: boolean;
|
|
108
|
+
error: string;
|
|
109
|
+
count?: undefined;
|
|
110
|
+
runningCount?: undefined;
|
|
111
|
+
sites?: undefined;
|
|
112
|
+
};
|
|
113
|
+
siteContext: {
|
|
114
|
+
ok: boolean;
|
|
115
|
+
selectionMethod: string | null;
|
|
116
|
+
site: {
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
status: string;
|
|
120
|
+
domain: string | undefined;
|
|
121
|
+
path: string;
|
|
122
|
+
wpRoot: string;
|
|
123
|
+
localVersion: string | undefined;
|
|
124
|
+
phpVersion: string | null;
|
|
125
|
+
mysqlVersion: string | null;
|
|
126
|
+
httpPort: number | null;
|
|
127
|
+
mysqlPort: number | null;
|
|
128
|
+
};
|
|
129
|
+
runtimeDir: {
|
|
130
|
+
path: string;
|
|
131
|
+
kind: "file" | "directory";
|
|
132
|
+
readable: boolean;
|
|
133
|
+
executable: boolean | null;
|
|
134
|
+
};
|
|
135
|
+
wpRoot: {
|
|
136
|
+
path: string;
|
|
137
|
+
kind: "file" | "directory";
|
|
138
|
+
readable: boolean;
|
|
139
|
+
executable: boolean | null;
|
|
140
|
+
};
|
|
141
|
+
phpConfigDir: {
|
|
142
|
+
path: string;
|
|
143
|
+
kind: "file" | "directory";
|
|
144
|
+
readable: boolean;
|
|
145
|
+
executable: boolean | null;
|
|
146
|
+
};
|
|
147
|
+
mysqlDefaultsFile: {
|
|
148
|
+
path: string;
|
|
149
|
+
kind: "file" | "directory";
|
|
150
|
+
readable: boolean;
|
|
151
|
+
executable: boolean | null;
|
|
152
|
+
};
|
|
153
|
+
phpBinary: {
|
|
154
|
+
path: string;
|
|
155
|
+
kind: "file" | "directory";
|
|
156
|
+
readable: boolean;
|
|
157
|
+
executable: boolean | null;
|
|
158
|
+
};
|
|
159
|
+
mysqlBinary: {
|
|
160
|
+
path: string;
|
|
161
|
+
kind: "file" | "directory";
|
|
162
|
+
readable: boolean;
|
|
163
|
+
executable: boolean | null;
|
|
164
|
+
};
|
|
165
|
+
mysqlConnection: {
|
|
166
|
+
mode: string;
|
|
167
|
+
socket: {
|
|
168
|
+
path: string;
|
|
169
|
+
kind: "file" | "directory";
|
|
170
|
+
readable: boolean;
|
|
171
|
+
executable: boolean | null;
|
|
172
|
+
};
|
|
173
|
+
port: number | null;
|
|
174
|
+
host: string | null;
|
|
175
|
+
} | {
|
|
176
|
+
mode: string;
|
|
177
|
+
socket: null;
|
|
178
|
+
port: number | null;
|
|
179
|
+
host: string | null;
|
|
180
|
+
};
|
|
181
|
+
wpCliProbe: null | Record<string, unknown>;
|
|
182
|
+
mysqlProbe: null | Record<string, unknown>;
|
|
183
|
+
} | {
|
|
184
|
+
ok: boolean;
|
|
185
|
+
error: string;
|
|
186
|
+
};
|
|
187
|
+
}>;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { config } from "./config.js";
|
|
2
|
+
import { buildSiteContext, loadLocalSites, summarizeSite } from "./local-sites.js";
|
|
3
|
+
import { resolveLocalTooling } from "./local-tooling.js";
|
|
4
|
+
import { ensureMysqlReady, executeMysqlStatement } from "./mysql.js";
|
|
5
|
+
import { formatError } from "./results.js";
|
|
6
|
+
import { isExecutablePath, isReadablePath } from "./process-utils.js";
|
|
7
|
+
import { runWpCli } from "./wp-cli.js";
|
|
8
|
+
export async function runEnvironmentCheck(selection, options = {}) {
|
|
9
|
+
const { probeWpCli = false, probeMysql = false } = options;
|
|
10
|
+
const directoryChecks = await Promise.all([
|
|
11
|
+
describePath(config.localAppSupportDir, "directory"),
|
|
12
|
+
describePath(config.localRunDir, "directory"),
|
|
13
|
+
describePath(config.localSitesJson, "file"),
|
|
14
|
+
describePath(config.localSiteStatusesJson, "file"),
|
|
15
|
+
]);
|
|
16
|
+
const extraResourcesChecks = await Promise.all(config.localExtraResourcesDirs.map((candidate) => describePath(candidate, "directory")));
|
|
17
|
+
const lightningServicesChecks = await Promise.all(config.localLightningServicesDirs.map((candidate) => describePath(candidate, "directory")));
|
|
18
|
+
const sitesSummary = await describeLocalSites();
|
|
19
|
+
const toolingSummary = await describeLocalTooling();
|
|
20
|
+
const siteSummary = await describeSiteContext(selection, {
|
|
21
|
+
probeWpCli,
|
|
22
|
+
probeMysql,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
platform: config.platform,
|
|
26
|
+
arch: config.arch,
|
|
27
|
+
nodeVersion: process.version,
|
|
28
|
+
accessProfile: config.profile,
|
|
29
|
+
requestedSiteId: selection.siteId || null,
|
|
30
|
+
requestedSiteName: selection.siteName || null,
|
|
31
|
+
probes: {
|
|
32
|
+
wpCli: probeWpCli,
|
|
33
|
+
mysql: probeMysql,
|
|
34
|
+
},
|
|
35
|
+
corePaths: {
|
|
36
|
+
localAppSupportDir: directoryChecks[0],
|
|
37
|
+
localRunDir: directoryChecks[1],
|
|
38
|
+
localSitesJson: directoryChecks[2],
|
|
39
|
+
localSiteStatusesJson: directoryChecks[3],
|
|
40
|
+
localExtraResourcesDirs: extraResourcesChecks,
|
|
41
|
+
localLightningServicesDirs: lightningServicesChecks,
|
|
42
|
+
},
|
|
43
|
+
tooling: toolingSummary,
|
|
44
|
+
sites: sitesSummary,
|
|
45
|
+
siteContext: siteSummary,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async function describeLocalSites() {
|
|
49
|
+
try {
|
|
50
|
+
const sites = await loadLocalSites();
|
|
51
|
+
return {
|
|
52
|
+
ok: true,
|
|
53
|
+
count: sites.length,
|
|
54
|
+
runningCount: sites.filter((site) => site.status === "running").length,
|
|
55
|
+
sites: sites.map((site) => summarizeSite(site)),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
error: formatError(error),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function describeLocalTooling() {
|
|
66
|
+
try {
|
|
67
|
+
const tooling = await resolveLocalTooling();
|
|
68
|
+
return {
|
|
69
|
+
ok: true,
|
|
70
|
+
wpCliPhar: await describePath(tooling.wpCliPhar, "file", true),
|
|
71
|
+
wpCliConfig: tooling.wpCliConfig
|
|
72
|
+
? await describePath(tooling.wpCliConfig, "file")
|
|
73
|
+
: null,
|
|
74
|
+
helperBinDirs: await Promise.all(tooling.helperBinDirs.map((candidate) => describePath(candidate, "directory"))),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
error: formatError(error),
|
|
81
|
+
candidates: {
|
|
82
|
+
wpCliPhar: config.localWpCliPharCandidates,
|
|
83
|
+
wpCliConfig: config.localWpCliConfigCandidates,
|
|
84
|
+
helperBinDirs: config.localHelperBinDirCandidates,
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function describeSiteContext(selection, options) {
|
|
90
|
+
try {
|
|
91
|
+
const context = await buildSiteContext(selection);
|
|
92
|
+
const siteContext = {
|
|
93
|
+
ok: true,
|
|
94
|
+
selectionMethod: context.selectionMethod || null,
|
|
95
|
+
site: summarizeSite(context.site),
|
|
96
|
+
runtimeDir: await describePath(context.runtimeDir, "directory"),
|
|
97
|
+
wpRoot: await describePath(context.wpRoot, "directory"),
|
|
98
|
+
phpConfigDir: await describePath(context.phpConfigDir, "directory"),
|
|
99
|
+
mysqlDefaultsFile: await describePath(context.mysqlDefaultsFile, "file"),
|
|
100
|
+
phpBinary: await describePath(context.php.binaryPath, "file", true),
|
|
101
|
+
mysqlBinary: await describePath(context.mysql.binaryPath, "file", true),
|
|
102
|
+
mysqlConnection: context.mysqlSocket
|
|
103
|
+
? {
|
|
104
|
+
mode: "socket",
|
|
105
|
+
socket: await describePath(context.mysqlSocket, "file"),
|
|
106
|
+
port: context.mysqlPort,
|
|
107
|
+
host: context.mysqlHost,
|
|
108
|
+
}
|
|
109
|
+
: {
|
|
110
|
+
mode: "tcp",
|
|
111
|
+
socket: null,
|
|
112
|
+
port: context.mysqlPort,
|
|
113
|
+
host: context.mysqlHost,
|
|
114
|
+
},
|
|
115
|
+
wpCliProbe: null,
|
|
116
|
+
mysqlProbe: null,
|
|
117
|
+
};
|
|
118
|
+
if (options.probeWpCli) {
|
|
119
|
+
try {
|
|
120
|
+
const result = await runWpCli(context, "core is-installed");
|
|
121
|
+
siteContext.wpCliProbe = {
|
|
122
|
+
ok: true,
|
|
123
|
+
command: "core is-installed",
|
|
124
|
+
stdout: result.stdout,
|
|
125
|
+
stderr: result.stderr || null,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
siteContext.wpCliProbe = {
|
|
130
|
+
ok: false,
|
|
131
|
+
command: "core is-installed",
|
|
132
|
+
error: formatError(error),
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (options.probeMysql) {
|
|
137
|
+
try {
|
|
138
|
+
await ensureMysqlReady(context);
|
|
139
|
+
const result = await executeMysqlStatement(context, "SELECT 1 AS ok", 1);
|
|
140
|
+
siteContext.mysqlProbe = {
|
|
141
|
+
ok: true,
|
|
142
|
+
sql: "SELECT 1 AS ok",
|
|
143
|
+
rows: result.rows,
|
|
144
|
+
stderr: result.stderr,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
siteContext.mysqlProbe = {
|
|
149
|
+
ok: false,
|
|
150
|
+
sql: "SELECT 1 AS ok",
|
|
151
|
+
error: formatError(error),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return siteContext;
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
return {
|
|
159
|
+
ok: false,
|
|
160
|
+
error: formatError(error),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async function describePath(candidatePath, kind, executable = false) {
|
|
165
|
+
const readable = await isReadablePath(candidatePath);
|
|
166
|
+
const executableFlag = executable ? await isExecutablePath(candidatePath) : null;
|
|
167
|
+
return {
|
|
168
|
+
path: candidatePath,
|
|
169
|
+
kind,
|
|
170
|
+
readable,
|
|
171
|
+
executable: executableFlag,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=environment-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment-check.js","sourceRoot":"","sources":["../src/environment-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,SAAwB,EACxB,UAGI,EAAE;IAEN,MAAM,EAAE,UAAU,GAAG,KAAK,EAAE,UAAU,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;Q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M;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,WAAW,CAAC,UAAU,GAAG;oBACvB,EAAE,EAAE,KAAK;oBACT,GAAG,EAAE,gBAAgB;oBACrB,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;iBAC1B,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC;SAC1B,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CACzB,aAAqB,EACrB,IAA0B,EAC1B,UAAU,GAAG,KAAK;IAElB,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,gBAAgB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjF,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI;QACJ,QAAQ;QACR,UAAU,EAAE,cAAc;KAC3B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createServer } from "./server.js";
|
|
4
|
+
async function run() {
|
|
5
|
+
const server = createServer();
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
console.error("localwp-mcp server running on stdio");
|
|
9
|
+
}
|
|
10
|
+
run().catch((error) => {
|
|
11
|
+
console.error("Fatal error running localwp-mcp:", error);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,KAAK,UAAU,GAAG;IAChB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;AACvD,CAAC;AAED,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SiteSelection } from "./types.js";
|
|
2
|
+
type DoctorCheckStatus = "ok" | "warning" | "error";
|
|
3
|
+
interface DoctorCheck {
|
|
4
|
+
id: string;
|
|
5
|
+
status: DoctorCheckStatus;
|
|
6
|
+
title: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function runLocalDoctor(selection: SiteSelection): Promise<{
|
|
10
|
+
overallStatus: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
accessProfile: import("./types.js").AccessProfile;
|
|
13
|
+
requestedSiteId: string | null;
|
|
14
|
+
requestedSiteName: string | null;
|
|
15
|
+
site: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
status: string;
|
|
19
|
+
domain: string | undefined;
|
|
20
|
+
path: string;
|
|
21
|
+
wpRoot: string;
|
|
22
|
+
localVersion: string | undefined;
|
|
23
|
+
phpVersion: string | null;
|
|
24
|
+
mysqlVersion: string | null;
|
|
25
|
+
httpPort: number | null;
|
|
26
|
+
mysqlPort: number | null;
|
|
27
|
+
} | null;
|
|
28
|
+
checks: DoctorCheck[];
|
|
29
|
+
nextSteps: string[];
|
|
30
|
+
logSummary: {
|
|
31
|
+
siteLogs: {
|
|
32
|
+
label: string;
|
|
33
|
+
path: string;
|
|
34
|
+
}[];
|
|
35
|
+
globalLogs: {
|
|
36
|
+
label: string;
|
|
37
|
+
path: string;
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
export declare function summarizeDoctorStatus(checks: DoctorCheck[]): "error" | "ok" | "warning";
|
|
42
|
+
export {};
|