claude-plugin-wordpress-manager 1.7.1 → 1.8.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/.claude-plugin/plugin.json +5 -3
- package/CHANGELOG.md +33 -0
- package/agents/wp-ecommerce-manager.md +136 -0
- package/agents/wp-site-manager.md +1 -0
- package/docs/GUIDE.md +306 -33
- package/docs/plans/2026-02-28-roadmap-v1.8-v2.1-design.md +314 -0
- package/docs/plans/2026-02-28-woocommerce-v1.8.0.md +2012 -0
- package/package.json +6 -3
- package/servers/wp-rest-bridge/build/tools/index.d.ts +927 -0
- package/servers/wp-rest-bridge/build/tools/index.js +20 -2
- package/servers/wp-rest-bridge/build/tools/wc-coupons.d.ts +144 -0
- package/servers/wp-rest-bridge/build/tools/wc-coupons.js +92 -0
- package/servers/wp-rest-bridge/build/tools/wc-customers.d.ts +141 -0
- package/servers/wp-rest-bridge/build/tools/wc-customers.js +92 -0
- package/servers/wp-rest-bridge/build/tools/wc-orders.d.ts +186 -0
- package/servers/wp-rest-bridge/build/tools/wc-orders.js +128 -0
- package/servers/wp-rest-bridge/build/tools/wc-products.d.ts +324 -0
- package/servers/wp-rest-bridge/build/tools/wc-products.js +177 -0
- package/servers/wp-rest-bridge/build/tools/wc-reports.d.ts +117 -0
- package/servers/wp-rest-bridge/build/tools/wc-reports.js +94 -0
- package/servers/wp-rest-bridge/build/tools/wc-settings.d.ts +72 -0
- package/servers/wp-rest-bridge/build/tools/wc-settings.js +70 -0
- package/servers/wp-rest-bridge/build/types.d.ts +85 -0
- package/servers/wp-rest-bridge/build/wordpress.d.ts +9 -0
- package/servers/wp-rest-bridge/build/wordpress.js +75 -0
- package/skills/wordpress-router/references/decision-tree.md +3 -1
- package/skills/wp-audit/SKILL.md +1 -0
- package/skills/wp-backup/SKILL.md +1 -0
- package/skills/wp-deploy/SKILL.md +1 -0
- package/skills/wp-woocommerce/SKILL.md +110 -0
- package/skills/wp-woocommerce/references/analytics-reports.md +75 -0
- package/skills/wp-woocommerce/references/coupon-marketing.md +92 -0
- package/skills/wp-woocommerce/references/order-workflow.md +88 -0
- package/skills/wp-woocommerce/references/payment-gateways.md +69 -0
- package/skills/wp-woocommerce/references/product-management.md +61 -0
- package/skills/wp-woocommerce/references/shipping-setup.md +79 -0
- package/skills/wp-woocommerce/references/tax-configuration.md +91 -0
- package/skills/wp-woocommerce/references/wc-extensions.md +97 -0
- package/skills/wp-woocommerce/scripts/woocommerce_inspect.mjs +181 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const wcGetSalesReportSchema: z.ZodObject<{
|
|
4
|
+
period: z.ZodDefault<z.ZodOptional<z.ZodEnum<["week", "month", "last_month", "year"]>>>;
|
|
5
|
+
date_min: z.ZodOptional<z.ZodString>;
|
|
6
|
+
date_max: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
period: "week" | "month" | "last_month" | "year";
|
|
9
|
+
date_min?: string | undefined;
|
|
10
|
+
date_max?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
period?: "week" | "month" | "last_month" | "year" | undefined;
|
|
13
|
+
date_min?: string | undefined;
|
|
14
|
+
date_max?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
declare const wcGetTopSellersSchema: z.ZodObject<{
|
|
17
|
+
period: z.ZodDefault<z.ZodOptional<z.ZodEnum<["week", "month", "last_month", "year"]>>>;
|
|
18
|
+
date_min: z.ZodOptional<z.ZodString>;
|
|
19
|
+
date_max: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, "strict", z.ZodTypeAny, {
|
|
21
|
+
period: "week" | "month" | "last_month" | "year";
|
|
22
|
+
date_min?: string | undefined;
|
|
23
|
+
date_max?: string | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
period?: "week" | "month" | "last_month" | "year" | undefined;
|
|
26
|
+
date_min?: string | undefined;
|
|
27
|
+
date_max?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const wcReportTools: Tool[];
|
|
30
|
+
export declare const wcReportHandlers: {
|
|
31
|
+
wc_get_sales_report: (params: z.infer<typeof wcGetSalesReportSchema>) => Promise<{
|
|
32
|
+
toolResult: {
|
|
33
|
+
content: {
|
|
34
|
+
type: string;
|
|
35
|
+
text: string;
|
|
36
|
+
}[];
|
|
37
|
+
isError?: undefined;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
toolResult: {
|
|
41
|
+
isError: boolean;
|
|
42
|
+
content: {
|
|
43
|
+
type: string;
|
|
44
|
+
text: string;
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
wc_get_top_sellers: (params: z.infer<typeof wcGetTopSellersSchema>) => Promise<{
|
|
49
|
+
toolResult: {
|
|
50
|
+
content: {
|
|
51
|
+
type: string;
|
|
52
|
+
text: string;
|
|
53
|
+
}[];
|
|
54
|
+
isError?: undefined;
|
|
55
|
+
};
|
|
56
|
+
} | {
|
|
57
|
+
toolResult: {
|
|
58
|
+
isError: boolean;
|
|
59
|
+
content: {
|
|
60
|
+
type: string;
|
|
61
|
+
text: string;
|
|
62
|
+
}[];
|
|
63
|
+
};
|
|
64
|
+
}>;
|
|
65
|
+
wc_get_orders_totals: () => Promise<{
|
|
66
|
+
toolResult: {
|
|
67
|
+
content: {
|
|
68
|
+
type: string;
|
|
69
|
+
text: string;
|
|
70
|
+
}[];
|
|
71
|
+
isError?: undefined;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
toolResult: {
|
|
75
|
+
isError: boolean;
|
|
76
|
+
content: {
|
|
77
|
+
type: string;
|
|
78
|
+
text: string;
|
|
79
|
+
}[];
|
|
80
|
+
};
|
|
81
|
+
}>;
|
|
82
|
+
wc_get_products_totals: () => Promise<{
|
|
83
|
+
toolResult: {
|
|
84
|
+
content: {
|
|
85
|
+
type: string;
|
|
86
|
+
text: string;
|
|
87
|
+
}[];
|
|
88
|
+
isError?: undefined;
|
|
89
|
+
};
|
|
90
|
+
} | {
|
|
91
|
+
toolResult: {
|
|
92
|
+
isError: boolean;
|
|
93
|
+
content: {
|
|
94
|
+
type: string;
|
|
95
|
+
text: string;
|
|
96
|
+
}[];
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
99
|
+
wc_get_customers_totals: () => Promise<{
|
|
100
|
+
toolResult: {
|
|
101
|
+
content: {
|
|
102
|
+
type: string;
|
|
103
|
+
text: string;
|
|
104
|
+
}[];
|
|
105
|
+
isError?: undefined;
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
toolResult: {
|
|
109
|
+
isError: boolean;
|
|
110
|
+
content: {
|
|
111
|
+
type: string;
|
|
112
|
+
text: string;
|
|
113
|
+
}[];
|
|
114
|
+
};
|
|
115
|
+
}>;
|
|
116
|
+
};
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { makeWooCommerceRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const wcGetSalesReportSchema = z.object({
|
|
4
|
+
period: z.enum(['week', 'month', 'last_month', 'year']).optional().default('week').describe("Report period"),
|
|
5
|
+
date_min: z.string().optional().describe("Start date (YYYY-MM-DD)"),
|
|
6
|
+
date_max: z.string().optional().describe("End date (YYYY-MM-DD)"),
|
|
7
|
+
}).strict();
|
|
8
|
+
const wcGetTopSellersSchema = z.object({
|
|
9
|
+
period: z.enum(['week', 'month', 'last_month', 'year']).optional().default('week').describe("Report period"),
|
|
10
|
+
date_min: z.string().optional().describe("Start date (YYYY-MM-DD)"),
|
|
11
|
+
date_max: z.string().optional().describe("End date (YYYY-MM-DD)"),
|
|
12
|
+
}).strict();
|
|
13
|
+
const wcGetOrdersTotalsSchema = z.object({}).strict();
|
|
14
|
+
const wcGetProductsTotalsSchema = z.object({}).strict();
|
|
15
|
+
const wcGetCustomersTotalsSchema = z.object({}).strict();
|
|
16
|
+
export const wcReportTools = [
|
|
17
|
+
{
|
|
18
|
+
name: "wc_get_sales_report",
|
|
19
|
+
description: "Gets WooCommerce sales report (total sales, orders, items, revenue) for a period",
|
|
20
|
+
inputSchema: { type: "object", properties: wcGetSalesReportSchema.shape },
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "wc_get_top_sellers",
|
|
24
|
+
description: "Gets top-selling WooCommerce products for a period",
|
|
25
|
+
inputSchema: { type: "object", properties: wcGetTopSellersSchema.shape },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "wc_get_orders_totals",
|
|
29
|
+
description: "Gets WooCommerce order totals grouped by status",
|
|
30
|
+
inputSchema: { type: "object", properties: wcGetOrdersTotalsSchema.shape },
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "wc_get_products_totals",
|
|
34
|
+
description: "Gets WooCommerce product totals grouped by type",
|
|
35
|
+
inputSchema: { type: "object", properties: wcGetProductsTotalsSchema.shape },
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "wc_get_customers_totals",
|
|
39
|
+
description: "Gets WooCommerce customer totals (paying vs non-paying)",
|
|
40
|
+
inputSchema: { type: "object", properties: wcGetCustomersTotalsSchema.shape },
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
export const wcReportHandlers = {
|
|
44
|
+
wc_get_sales_report: async (params) => {
|
|
45
|
+
try {
|
|
46
|
+
const response = await makeWooCommerceRequest("GET", "reports/sales", params);
|
|
47
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
51
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting sales report: ${errorMessage}` }] } };
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
wc_get_top_sellers: async (params) => {
|
|
55
|
+
try {
|
|
56
|
+
const response = await makeWooCommerceRequest("GET", "reports/top_sellers", params);
|
|
57
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
61
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting top sellers: ${errorMessage}` }] } };
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
wc_get_orders_totals: async () => {
|
|
65
|
+
try {
|
|
66
|
+
const response = await makeWooCommerceRequest("GET", "reports/orders/totals");
|
|
67
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
71
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting orders totals: ${errorMessage}` }] } };
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
wc_get_products_totals: async () => {
|
|
75
|
+
try {
|
|
76
|
+
const response = await makeWooCommerceRequest("GET", "reports/products/totals");
|
|
77
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
81
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting products totals: ${errorMessage}` }] } };
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
wc_get_customers_totals: async () => {
|
|
85
|
+
try {
|
|
86
|
+
const response = await makeWooCommerceRequest("GET", "reports/customers/totals");
|
|
87
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
91
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting customers totals: ${errorMessage}` }] } };
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
export declare const wcSettingTools: Tool[];
|
|
3
|
+
export declare const wcSettingHandlers: {
|
|
4
|
+
wc_list_payment_gateways: () => Promise<{
|
|
5
|
+
toolResult: {
|
|
6
|
+
content: {
|
|
7
|
+
type: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}[];
|
|
10
|
+
isError?: undefined;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
toolResult: {
|
|
14
|
+
isError: boolean;
|
|
15
|
+
content: {
|
|
16
|
+
type: string;
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
wc_list_shipping_zones: () => Promise<{
|
|
22
|
+
toolResult: {
|
|
23
|
+
content: {
|
|
24
|
+
type: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}[];
|
|
27
|
+
isError?: undefined;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
toolResult: {
|
|
31
|
+
isError: boolean;
|
|
32
|
+
content: {
|
|
33
|
+
type: string;
|
|
34
|
+
text: string;
|
|
35
|
+
}[];
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
wc_get_tax_classes: () => Promise<{
|
|
39
|
+
toolResult: {
|
|
40
|
+
content: {
|
|
41
|
+
type: string;
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
isError?: undefined;
|
|
45
|
+
};
|
|
46
|
+
} | {
|
|
47
|
+
toolResult: {
|
|
48
|
+
isError: boolean;
|
|
49
|
+
content: {
|
|
50
|
+
type: string;
|
|
51
|
+
text: string;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
wc_get_system_status: () => Promise<{
|
|
56
|
+
toolResult: {
|
|
57
|
+
content: {
|
|
58
|
+
type: string;
|
|
59
|
+
text: string;
|
|
60
|
+
}[];
|
|
61
|
+
isError?: undefined;
|
|
62
|
+
};
|
|
63
|
+
} | {
|
|
64
|
+
toolResult: {
|
|
65
|
+
isError: boolean;
|
|
66
|
+
content: {
|
|
67
|
+
type: string;
|
|
68
|
+
text: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { makeWooCommerceRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const wcListPaymentGatewaysSchema = z.object({}).strict();
|
|
4
|
+
const wcListShippingZonesSchema = z.object({}).strict();
|
|
5
|
+
const wcGetTaxClassesSchema = z.object({}).strict();
|
|
6
|
+
const wcGetSystemStatusSchema = z.object({}).strict();
|
|
7
|
+
export const wcSettingTools = [
|
|
8
|
+
{
|
|
9
|
+
name: "wc_list_payment_gateways",
|
|
10
|
+
description: "Lists all configured WooCommerce payment gateways with status and settings",
|
|
11
|
+
inputSchema: { type: "object", properties: wcListPaymentGatewaysSchema.shape },
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "wc_list_shipping_zones",
|
|
15
|
+
description: "Lists WooCommerce shipping zones with methods and regions",
|
|
16
|
+
inputSchema: { type: "object", properties: wcListShippingZonesSchema.shape },
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "wc_get_tax_classes",
|
|
20
|
+
description: "Gets WooCommerce tax classes configuration",
|
|
21
|
+
inputSchema: { type: "object", properties: wcGetTaxClassesSchema.shape },
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "wc_get_system_status",
|
|
25
|
+
description: "Gets WooCommerce system status (version, environment, database, theme, plugins)",
|
|
26
|
+
inputSchema: { type: "object", properties: wcGetSystemStatusSchema.shape },
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
export const wcSettingHandlers = {
|
|
30
|
+
wc_list_payment_gateways: async () => {
|
|
31
|
+
try {
|
|
32
|
+
const response = await makeWooCommerceRequest("GET", "payment_gateways");
|
|
33
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
37
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error listing payment gateways: ${errorMessage}` }] } };
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
wc_list_shipping_zones: async () => {
|
|
41
|
+
try {
|
|
42
|
+
const response = await makeWooCommerceRequest("GET", "shipping/zones");
|
|
43
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
47
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error listing shipping zones: ${errorMessage}` }] } };
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
wc_get_tax_classes: async () => {
|
|
51
|
+
try {
|
|
52
|
+
const response = await makeWooCommerceRequest("GET", "taxes/classes");
|
|
53
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
57
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting tax classes: ${errorMessage}` }] } };
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
wc_get_system_status: async () => {
|
|
61
|
+
try {
|
|
62
|
+
const response = await makeWooCommerceRequest("GET", "system_status");
|
|
63
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
67
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error getting system status: ${errorMessage}` }] } };
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -148,4 +148,89 @@ export interface WPTerm {
|
|
|
148
148
|
meta: Record<string, any>[];
|
|
149
149
|
_links: Record<string, any>;
|
|
150
150
|
}
|
|
151
|
+
export interface WCProduct {
|
|
152
|
+
id: number;
|
|
153
|
+
name: string;
|
|
154
|
+
slug: string;
|
|
155
|
+
type: string;
|
|
156
|
+
status: string;
|
|
157
|
+
description: string;
|
|
158
|
+
short_description: string;
|
|
159
|
+
sku: string;
|
|
160
|
+
price: string;
|
|
161
|
+
regular_price: string;
|
|
162
|
+
sale_price: string;
|
|
163
|
+
stock_quantity: number | null;
|
|
164
|
+
stock_status: string;
|
|
165
|
+
categories: {
|
|
166
|
+
id: number;
|
|
167
|
+
name: string;
|
|
168
|
+
slug: string;
|
|
169
|
+
}[];
|
|
170
|
+
tags: {
|
|
171
|
+
id: number;
|
|
172
|
+
name: string;
|
|
173
|
+
slug: string;
|
|
174
|
+
}[];
|
|
175
|
+
images: {
|
|
176
|
+
id: number;
|
|
177
|
+
src: string;
|
|
178
|
+
name: string;
|
|
179
|
+
alt: string;
|
|
180
|
+
}[];
|
|
181
|
+
attributes: {
|
|
182
|
+
id: number;
|
|
183
|
+
name: string;
|
|
184
|
+
options: string[];
|
|
185
|
+
}[];
|
|
186
|
+
variations: number[];
|
|
187
|
+
date_created: string;
|
|
188
|
+
date_modified: string;
|
|
189
|
+
}
|
|
190
|
+
export interface WCOrder {
|
|
191
|
+
id: number;
|
|
192
|
+
status: string;
|
|
193
|
+
currency: string;
|
|
194
|
+
total: string;
|
|
195
|
+
customer_id: number;
|
|
196
|
+
billing: Record<string, string>;
|
|
197
|
+
shipping: Record<string, string>;
|
|
198
|
+
line_items: {
|
|
199
|
+
id: number;
|
|
200
|
+
name: string;
|
|
201
|
+
product_id: number;
|
|
202
|
+
quantity: number;
|
|
203
|
+
total: string;
|
|
204
|
+
}[];
|
|
205
|
+
date_created: string;
|
|
206
|
+
date_modified: string;
|
|
207
|
+
payment_method: string;
|
|
208
|
+
payment_method_title: string;
|
|
209
|
+
}
|
|
210
|
+
export interface WCCustomer {
|
|
211
|
+
id: number;
|
|
212
|
+
email: string;
|
|
213
|
+
first_name: string;
|
|
214
|
+
last_name: string;
|
|
215
|
+
username: string;
|
|
216
|
+
billing: Record<string, string>;
|
|
217
|
+
shipping: Record<string, string>;
|
|
218
|
+
orders_count: number;
|
|
219
|
+
total_spent: string;
|
|
220
|
+
date_created: string;
|
|
221
|
+
}
|
|
222
|
+
export interface WCCoupon {
|
|
223
|
+
id: number;
|
|
224
|
+
code: string;
|
|
225
|
+
discount_type: string;
|
|
226
|
+
amount: string;
|
|
227
|
+
date_created: string;
|
|
228
|
+
date_expires: string | null;
|
|
229
|
+
usage_count: number;
|
|
230
|
+
usage_limit: number | null;
|
|
231
|
+
individual_use: boolean;
|
|
232
|
+
product_ids: number[];
|
|
233
|
+
minimum_amount: string;
|
|
234
|
+
maximum_amount: string;
|
|
235
|
+
}
|
|
151
236
|
export {};
|
|
@@ -42,6 +42,15 @@ export interface PaginatedResponse<T = any> {
|
|
|
42
42
|
* Includes automatic retry with exponential backoff and concurrency limiting.
|
|
43
43
|
*/
|
|
44
44
|
export declare function makeWordPressRequest(method: string, endpoint: string, data?: any, options?: WordPressRequestOptions): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a site has WooCommerce credentials configured.
|
|
47
|
+
*/
|
|
48
|
+
export declare function hasWooCommerce(siteId?: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Make a request to the WooCommerce REST API.
|
|
51
|
+
* Uses Consumer Key/Secret auth and wc/v3 namespace by default.
|
|
52
|
+
*/
|
|
53
|
+
export declare function makeWooCommerceRequest(method: string, endpoint: string, data?: any, options?: WordPressRequestOptions): Promise<any>;
|
|
45
54
|
/**
|
|
46
55
|
* Search the WordPress.org Plugin Repository
|
|
47
56
|
*/
|
|
@@ -31,6 +31,7 @@ class ConcurrencyLimiter {
|
|
|
31
31
|
// ── Module State ─────────────────────────────────────────────────────
|
|
32
32
|
const siteClients = new Map();
|
|
33
33
|
const siteLimiters = new Map();
|
|
34
|
+
const wcSiteClients = new Map();
|
|
34
35
|
let activeSiteId = '';
|
|
35
36
|
const MAX_CONCURRENT_PER_SITE = 5;
|
|
36
37
|
const DEFAULT_TIMEOUT_MS = parseInt(process.env.WP_REQUEST_TIMEOUT_MS || '30000', 10);
|
|
@@ -74,6 +75,13 @@ export async function initWordPress() {
|
|
|
74
75
|
await initSiteClient(site.id, site.url, site.username, site.password);
|
|
75
76
|
logToStderr(`Initialized site: ${site.id} (${site.url})`);
|
|
76
77
|
}
|
|
78
|
+
// Initialize WooCommerce clients for sites with WC credentials
|
|
79
|
+
for (const site of sites) {
|
|
80
|
+
if (site.wc_consumer_key && site.wc_consumer_secret) {
|
|
81
|
+
await initWcClient(site.id, site.url, site.wc_consumer_key, site.wc_consumer_secret);
|
|
82
|
+
logToStderr(`Initialized WooCommerce for site: ${site.id}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
77
85
|
activeSiteId = defaultSite || sites[0].id;
|
|
78
86
|
logToStderr(`Active site: ${activeSiteId}`);
|
|
79
87
|
}
|
|
@@ -113,6 +121,34 @@ async function initSiteClient(id, url, username, password) {
|
|
|
113
121
|
siteClients.set(id, client);
|
|
114
122
|
siteLimiters.set(id, new ConcurrencyLimiter(MAX_CONCURRENT_PER_SITE));
|
|
115
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Initialize a WooCommerce client for a site (Consumer Key/Secret auth).
|
|
126
|
+
*/
|
|
127
|
+
async function initWcClient(id, url, consumerKey, consumerSecret) {
|
|
128
|
+
let baseURL = url.endsWith('/') ? url : `${url}/`;
|
|
129
|
+
const wpJsonIdx = baseURL.indexOf('/wp-json');
|
|
130
|
+
if (wpJsonIdx !== -1) {
|
|
131
|
+
baseURL = baseURL.substring(0, wpJsonIdx + 1);
|
|
132
|
+
}
|
|
133
|
+
baseURL = baseURL + 'wp-json/';
|
|
134
|
+
const auth = Buffer.from(`${consumerKey}:${consumerSecret}`).toString('base64');
|
|
135
|
+
const client = axios.create({
|
|
136
|
+
baseURL,
|
|
137
|
+
headers: {
|
|
138
|
+
'Content-Type': 'application/json',
|
|
139
|
+
'Authorization': `Basic ${auth}`,
|
|
140
|
+
},
|
|
141
|
+
timeout: DEFAULT_TIMEOUT_MS,
|
|
142
|
+
});
|
|
143
|
+
// Verify WooCommerce connection
|
|
144
|
+
try {
|
|
145
|
+
await client.get('wc/v3');
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
logToStderr(`Warning: Could not verify WooCommerce connection for ${id}: ${error.message}`);
|
|
149
|
+
}
|
|
150
|
+
wcSiteClients.set(id, client);
|
|
151
|
+
}
|
|
116
152
|
// ── Site Management ──────────────────────────────────────────────────
|
|
117
153
|
/**
|
|
118
154
|
* Get the active site's client, or a specific site's client
|
|
@@ -272,6 +308,45 @@ async function executeWithRetry(client, method, path, data, siteId, options) {
|
|
|
272
308
|
function sleep(ms) {
|
|
273
309
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
274
310
|
}
|
|
311
|
+
// ── WooCommerce Request Interface ────────────────────────────────
|
|
312
|
+
/**
|
|
313
|
+
* Check if a site has WooCommerce credentials configured.
|
|
314
|
+
*/
|
|
315
|
+
export function hasWooCommerce(siteId) {
|
|
316
|
+
const id = siteId || activeSiteId;
|
|
317
|
+
return wcSiteClients.has(id);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Get the WooCommerce client for a site.
|
|
321
|
+
*/
|
|
322
|
+
function getWcClient(siteId) {
|
|
323
|
+
const id = siteId || activeSiteId;
|
|
324
|
+
const client = wcSiteClients.get(id);
|
|
325
|
+
if (!client) {
|
|
326
|
+
throw new Error(`WooCommerce not configured for site "${id}". ` +
|
|
327
|
+
`Add wc_consumer_key and wc_consumer_secret to WP_SITES_CONFIG.`);
|
|
328
|
+
}
|
|
329
|
+
return client;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Make a request to the WooCommerce REST API.
|
|
333
|
+
* Uses Consumer Key/Secret auth and wc/v3 namespace by default.
|
|
334
|
+
*/
|
|
335
|
+
export async function makeWooCommerceRequest(method, endpoint, data, options) {
|
|
336
|
+
const siteId = options?.siteId || activeSiteId;
|
|
337
|
+
const client = getWcClient(siteId);
|
|
338
|
+
const limiter = getLimiter(siteId);
|
|
339
|
+
const namespace = options?.namespace || 'wc/v3';
|
|
340
|
+
const cleanEndpoint = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
|
|
341
|
+
const path = `${namespace}/${cleanEndpoint}`;
|
|
342
|
+
await limiter.acquire();
|
|
343
|
+
try {
|
|
344
|
+
return await executeWithRetry(client, method, path, data, siteId, options);
|
|
345
|
+
}
|
|
346
|
+
finally {
|
|
347
|
+
limiter.release();
|
|
348
|
+
}
|
|
349
|
+
}
|
|
275
350
|
// ── Plugin Repository (External API) ────────────────────────────────
|
|
276
351
|
/**
|
|
277
352
|
* Search the WordPress.org Plugin Repository
|
|
@@ -14,7 +14,7 @@ Keywords that indicate **local environment**:
|
|
|
14
14
|
local site, Studio, LocalWP, Local by Flywheel, wp-env, local WordPress, start site, stop site, create local site, local development, symlink plugin, local database, switch PHP version, localhost, local preview, detect environment, WASM, SQLite local
|
|
15
15
|
|
|
16
16
|
Keywords that indicate **operations**:
|
|
17
|
-
deploy, push to production, audit, security check, backup, restore, migrate, move site, create post, manage content, site status, check plugins, performance check, SEO audit
|
|
17
|
+
deploy, push to production, audit, security check, backup, restore, migrate, move site, create post, manage content, site status, check plugins, performance check, SEO audit, WooCommerce, prodotto, ordine, coupon, negozio, catalogo, inventario, vendite, carrello
|
|
18
18
|
|
|
19
19
|
Keywords that indicate **development**:
|
|
20
20
|
create block, block.json, theme.json, register_rest_route, plugin development, hooks, PHPStan, build, test, scaffold, i18n, translation, accessibility, a11y, headless, decoupled, WPGraphQL
|
|
@@ -86,6 +86,8 @@ Priority: `gutenberg` > `wp-core` > `wp-site` > `wp-block-theme` > `wp-block-plu
|
|
|
86
86
|
→ `wp-site-manager` agent
|
|
87
87
|
- **DNS / domain / SSL / hosting configuration**
|
|
88
88
|
→ `wp-site-manager` agent (Hostinger MCP tools)
|
|
89
|
+
- **WooCommerce / woo / shop / products / orders / coupons / cart / store management / sales report / inventory**
|
|
90
|
+
→ `wp-woocommerce` skill + `wp-ecommerce-manager` agent
|
|
89
91
|
|
|
90
92
|
## Step 2c: route by local environment intent (keywords)
|
|
91
93
|
|
package/skills/wp-audit/SKILL.md
CHANGED
|
@@ -112,6 +112,7 @@ Combine findings into a unified report with:
|
|
|
112
112
|
- **`references/security-checklist.md`** - WordPress security audit checklist
|
|
113
113
|
- **`references/performance-checklist.md`** - Performance analysis checklist
|
|
114
114
|
- **`references/seo-checklist.md`** - SEO audit checklist
|
|
115
|
+
- For WooCommerce store audit, see `wp-woocommerce` skill
|
|
115
116
|
|
|
116
117
|
## Related skills
|
|
117
118
|
|
|
@@ -85,3 +85,4 @@ Before any risky operation (deploy, update, migration):
|
|
|
85
85
|
### Reference Files
|
|
86
86
|
- **`references/backup-strategies.md`** - Detailed backup methods and automation
|
|
87
87
|
- **`references/restore-procedures.md`** - Step-by-step restore procedures
|
|
88
|
+
- For WooCommerce database backup, see `wp-woocommerce` skill
|
|
@@ -62,3 +62,4 @@ For full details on local environment operations, see the `wp-local-env` skill.
|
|
|
62
62
|
### Reference Files
|
|
63
63
|
- **`references/hostinger-deploy.md`** - Hostinger MCP deployment details
|
|
64
64
|
- **`references/ssh-deploy.md`** - SSH/SFTP deployment procedures
|
|
65
|
+
- For deploying WooCommerce stores, see `wp-woocommerce` skill
|