@ai-kits/wp-ag-kit 1.0.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/ANTIGRAVITY-README.md +47 -0
- package/CONTRIBUTING.md +122 -0
- package/README.md +135 -0
- package/STRUCTURE.md +200 -0
- package/agents/wordpress-expert.md +36 -0
- package/agents/wp-frontend-expert.md +21 -0
- package/bin/antigravity-agent.js +159 -0
- package/docs/authoring-guide.md +56 -0
- package/docs/compatibility-policy.md +18 -0
- package/docs/packaging.md +26 -0
- package/docs/principles.md +7 -0
- package/docs/skill-set-v1.md +21 -0
- package/docs/upstream-sync.md +52 -0
- package/package.json +47 -0
- package/rules/GEMINI.md +273 -0
- package/shared/references/.gitkeep +1 -0
- package/shared/references/gutenberg-releases.json +155 -0
- package/shared/references/wordpress-core-versions.json +208 -0
- package/shared/references/wp-gutenberg-version-map.json +886 -0
- package/shared/scripts/ai-generate-updates.mjs +458 -0
- package/shared/scripts/scaffold-skill.mjs +62 -0
- package/shared/scripts/skillpack-build.mjs +165 -0
- package/shared/scripts/skillpack-install.mjs +275 -0
- package/shared/scripts/update-upstream-indices.mjs +173 -0
- package/skills/wordpress-router/SKILL.md +51 -0
- package/skills/wordpress-router/references/decision-tree.md +55 -0
- package/skills/wp-abilities-api/SKILL.md +95 -0
- package/skills/wp-abilities-api/references/php-registration.md +67 -0
- package/skills/wp-abilities-api/references/rest-api.md +13 -0
- package/skills/wp-block-development/SKILL.md +174 -0
- package/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
- package/skills/wp-block-development/references/block-json.md +49 -0
- package/skills/wp-block-development/references/creating-new-blocks.md +46 -0
- package/skills/wp-block-development/references/debugging.md +36 -0
- package/skills/wp-block-development/references/deprecations.md +24 -0
- package/skills/wp-block-development/references/dynamic-rendering.md +23 -0
- package/skills/wp-block-development/references/inner-blocks.md +25 -0
- package/skills/wp-block-development/references/registration.md +30 -0
- package/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
- package/skills/wp-block-development/references/tooling-and-testing.md +21 -0
- package/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
- package/skills/wp-block-themes/SKILL.md +116 -0
- package/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
- package/skills/wp-block-themes/references/debugging.md +24 -0
- package/skills/wp-block-themes/references/patterns.md +18 -0
- package/skills/wp-block-themes/references/style-variations.md +14 -0
- package/skills/wp-block-themes/references/templates-and-parts.md +16 -0
- package/skills/wp-block-themes/references/theme-json.md +59 -0
- package/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
- package/skills/wp-interactivity-api/SKILL.md +179 -0
- package/skills/wp-interactivity-api/references/debugging.md +29 -0
- package/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
- package/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
- package/skills/wp-performance/SKILL.md +146 -0
- package/skills/wp-performance/references/autoload-options.md +24 -0
- package/skills/wp-performance/references/cron.md +20 -0
- package/skills/wp-performance/references/database.md +20 -0
- package/skills/wp-performance/references/http-api.md +15 -0
- package/skills/wp-performance/references/measurement.md +21 -0
- package/skills/wp-performance/references/object-cache.md +24 -0
- package/skills/wp-performance/references/query-monitor-headless.md +38 -0
- package/skills/wp-performance/references/server-timing.md +22 -0
- package/skills/wp-performance/references/wp-cli-doctor.md +24 -0
- package/skills/wp-performance/references/wp-cli-profile.md +32 -0
- package/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
- package/skills/wp-phpstan/SKILL.md +97 -0
- package/skills/wp-phpstan/references/configuration.md +52 -0
- package/skills/wp-phpstan/references/third-party-classes.md +76 -0
- package/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
- package/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
- package/skills/wp-playground/SKILL.md +101 -0
- package/skills/wp-playground/references/blueprints.md +36 -0
- package/skills/wp-playground/references/cli-commands.md +39 -0
- package/skills/wp-playground/references/debugging.md +16 -0
- package/skills/wp-plugin-development/SKILL.md +112 -0
- package/skills/wp-plugin-development/references/data-and-cron.md +19 -0
- package/skills/wp-plugin-development/references/debugging.md +19 -0
- package/skills/wp-plugin-development/references/lifecycle.md +33 -0
- package/skills/wp-plugin-development/references/security.md +29 -0
- package/skills/wp-plugin-development/references/settings-api.md +22 -0
- package/skills/wp-plugin-development/references/structure.md +16 -0
- package/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
- package/skills/wp-project-triage/SKILL.md +38 -0
- package/skills/wp-project-triage/references/triage.schema.json +143 -0
- package/skills/wp-project-triage/scripts/detect_wp_project.mjs +592 -0
- package/skills/wp-rest-api/SKILL.md +114 -0
- package/skills/wp-rest-api/references/authentication.md +18 -0
- package/skills/wp-rest-api/references/custom-content-types.md +20 -0
- package/skills/wp-rest-api/references/discovery-and-params.md +20 -0
- package/skills/wp-rest-api/references/responses-and-fields.md +30 -0
- package/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
- package/skills/wp-rest-api/references/schema.md +22 -0
- package/skills/wp-wpcli-and-ops/SKILL.md +123 -0
- package/skills/wp-wpcli-and-ops/references/automation.md +30 -0
- package/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
- package/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
- package/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
- package/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
- package/skills/wp-wpcli-and-ops/references/safety.md +30 -0
- package/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
- package/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
- package/skills/wpds/SKILL.md +58 -0
- package/workflows/create-block.md +27 -0
- package/workflows/wp-lint.md +27 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Settings API (admin options)
|
|
2
|
+
|
|
3
|
+
Use this file when adding settings pages or storing user-configurable options.
|
|
4
|
+
|
|
5
|
+
Core APIs:
|
|
6
|
+
|
|
7
|
+
- `register_setting()`
|
|
8
|
+
- `add_settings_section()`
|
|
9
|
+
- `add_settings_field()`
|
|
10
|
+
|
|
11
|
+
Upstream references:
|
|
12
|
+
|
|
13
|
+
- Settings API overview: https://developer.wordpress.org/plugins/settings/settings-api/
|
|
14
|
+
- Register settings: https://developer.wordpress.org/plugins/settings/registration/
|
|
15
|
+
- Add settings fields: https://developer.wordpress.org/plugins/settings/settings-fields/
|
|
16
|
+
|
|
17
|
+
Practical guardrails:
|
|
18
|
+
|
|
19
|
+
- Use `sanitize_callback` to validate/sanitize data.
|
|
20
|
+
- Use capability checks (commonly `manage_options`) for settings screens and saves.
|
|
21
|
+
- Escape values on output (`esc_attr`, `esc_html`, etc.).
|
|
22
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Plugin structure and loading
|
|
2
|
+
|
|
3
|
+
Use this file when introducing or refactoring a plugin architecture.
|
|
4
|
+
|
|
5
|
+
## Core concepts
|
|
6
|
+
|
|
7
|
+
- Main plugin file contains the plugin header and bootstraps the plugin.
|
|
8
|
+
- Prefer predictable init:
|
|
9
|
+
- minimal boot file
|
|
10
|
+
- a loader/class that registers hooks
|
|
11
|
+
- admin-only code behind admin hooks
|
|
12
|
+
|
|
13
|
+
Upstream reference:
|
|
14
|
+
|
|
15
|
+
- https://developer.wordpress.org/plugins/plugin-basics/
|
|
16
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_IGNORES = new Set([
|
|
5
|
+
".git",
|
|
6
|
+
"node_modules",
|
|
7
|
+
"vendor",
|
|
8
|
+
"dist",
|
|
9
|
+
"build",
|
|
10
|
+
"coverage",
|
|
11
|
+
".next",
|
|
12
|
+
".turbo",
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
function statSafe(p) {
|
|
16
|
+
try {
|
|
17
|
+
return fs.statSync(p);
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function readFileSafe(p, maxBytes = 128 * 1024) {
|
|
24
|
+
try {
|
|
25
|
+
const buf = fs.readFileSync(p);
|
|
26
|
+
if (buf.byteLength > maxBytes) return buf.subarray(0, maxBytes).toString("utf8");
|
|
27
|
+
return buf.toString("utf8");
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function findFilesRecursive(repoRoot, predicate, { maxFiles = 6000, maxDepth = 10 } = {}) {
|
|
34
|
+
const results = [];
|
|
35
|
+
const queue = [{ dir: repoRoot, depth: 0 }];
|
|
36
|
+
let visited = 0;
|
|
37
|
+
|
|
38
|
+
while (queue.length > 0) {
|
|
39
|
+
const { dir, depth } = queue.shift();
|
|
40
|
+
if (depth > maxDepth) continue;
|
|
41
|
+
|
|
42
|
+
let entries;
|
|
43
|
+
try {
|
|
44
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
45
|
+
} catch {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (const ent of entries) {
|
|
50
|
+
const fullPath = path.join(dir, ent.name);
|
|
51
|
+
if (ent.isDirectory()) {
|
|
52
|
+
if (DEFAULT_IGNORES.has(ent.name)) continue;
|
|
53
|
+
queue.push({ dir: fullPath, depth: depth + 1 });
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (!ent.isFile()) continue;
|
|
57
|
+
|
|
58
|
+
visited += 1;
|
|
59
|
+
if (visited > maxFiles) return { results, truncated: true };
|
|
60
|
+
if (predicate(fullPath)) results.push(fullPath);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return { results, truncated: false };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function parsePluginHeader(contents) {
|
|
68
|
+
// WordPress reads plugin headers from the top of the file. We only need key fields.
|
|
69
|
+
const header = {};
|
|
70
|
+
const pairs = [
|
|
71
|
+
["Plugin Name", "name"],
|
|
72
|
+
["Plugin URI", "uri"],
|
|
73
|
+
["Description", "description"],
|
|
74
|
+
["Version", "version"],
|
|
75
|
+
["Author", "author"],
|
|
76
|
+
["Author URI", "authorUri"],
|
|
77
|
+
["Text Domain", "textDomain"],
|
|
78
|
+
["Domain Path", "domainPath"],
|
|
79
|
+
];
|
|
80
|
+
for (const [label, key] of pairs) {
|
|
81
|
+
const m = contents.match(new RegExp(`^\\s*${label}:\\s*(.+)\\s*$`, "im"));
|
|
82
|
+
if (m) header[key] = m[1].trim();
|
|
83
|
+
}
|
|
84
|
+
if (!header.name) return null;
|
|
85
|
+
return header;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function main() {
|
|
89
|
+
const repoRoot = process.cwd();
|
|
90
|
+
|
|
91
|
+
const { results: phpFiles, truncated } = findFilesRecursive(repoRoot, (p) => p.toLowerCase().endsWith(".php"), {
|
|
92
|
+
maxFiles: 5000,
|
|
93
|
+
maxDepth: 10,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
const plugins = [];
|
|
97
|
+
|
|
98
|
+
for (const phpPath of phpFiles) {
|
|
99
|
+
const txt = readFileSafe(phpPath);
|
|
100
|
+
if (!txt) continue;
|
|
101
|
+
if (!/Plugin Name:/i.test(txt)) continue;
|
|
102
|
+
const header = parsePluginHeader(txt);
|
|
103
|
+
if (!header) continue;
|
|
104
|
+
plugins.push({
|
|
105
|
+
pluginFile: path.relative(repoRoot, phpPath),
|
|
106
|
+
...header,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const report = {
|
|
111
|
+
tool: { name: "detect_plugins", version: "0.1.0" },
|
|
112
|
+
repoRoot,
|
|
113
|
+
truncated,
|
|
114
|
+
count: plugins.length,
|
|
115
|
+
plugins,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
main();
|
|
122
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wp-project-triage
|
|
3
|
+
description: "Use when you need a deterministic inspection of a WordPress repository (plugin/theme/block theme/WP core/Gutenberg/full site) including tooling/tests/version hints, and a structured JSON report to guide workflows and guardrails."
|
|
4
|
+
compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# WP Project Triage
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
Use this skill to quickly understand what kind of WordPress repo you’re in and what commands/conventions to follow before making changes.
|
|
12
|
+
|
|
13
|
+
## Inputs required
|
|
14
|
+
|
|
15
|
+
- Repo root (current working directory).
|
|
16
|
+
|
|
17
|
+
## Procedure
|
|
18
|
+
|
|
19
|
+
1. Run the detector (prints JSON to stdout):
|
|
20
|
+
- `node skills/wp-project-triage/scripts/detect_wp_project.mjs`
|
|
21
|
+
2. If you need the exact output contract, read:
|
|
22
|
+
- `skills/wp-project-triage/references/triage.schema.json`
|
|
23
|
+
3. Use the report to select workflow guardrails:
|
|
24
|
+
- project kind(s)
|
|
25
|
+
- PHP/Node tooling present
|
|
26
|
+
- tests present
|
|
27
|
+
- version hints and sources
|
|
28
|
+
4. If the report is missing signals you need, update the detector rather than guessing.
|
|
29
|
+
|
|
30
|
+
## Verification
|
|
31
|
+
|
|
32
|
+
- The JSON should parse and include: `project.kind`, `signals`, and `tooling`.
|
|
33
|
+
- Re-run after changes that affect structure/tooling (adding `theme.json`, `block.json`, build config).
|
|
34
|
+
|
|
35
|
+
## Failure modes / debugging
|
|
36
|
+
|
|
37
|
+
- If it reports `unknown`, check whether the repo root is correct.
|
|
38
|
+
- If scanning is slow, add/extend ignore directories in the script.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://agentskills.local/wp-project-triage/triage.schema.json",
|
|
4
|
+
"title": "WP Project Triage Report",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["tool", "project", "signals", "tooling"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"tool": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["name", "version"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"name": { "type": "string", "const": "detect_wp_project" },
|
|
13
|
+
"version": { "type": "string" }
|
|
14
|
+
},
|
|
15
|
+
"additionalProperties": true
|
|
16
|
+
},
|
|
17
|
+
"project": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"required": ["kind"],
|
|
20
|
+
"properties": {
|
|
21
|
+
"kind": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"enum": [
|
|
26
|
+
"unknown",
|
|
27
|
+
"wp-plugin",
|
|
28
|
+
"wp-mu-plugin",
|
|
29
|
+
"wp-theme",
|
|
30
|
+
"wp-block-theme",
|
|
31
|
+
"wp-block-plugin",
|
|
32
|
+
"wp-site",
|
|
33
|
+
"wp-core",
|
|
34
|
+
"gutenberg"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"primary": { "type": "string" },
|
|
39
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
40
|
+
},
|
|
41
|
+
"additionalProperties": true
|
|
42
|
+
},
|
|
43
|
+
"signals": {
|
|
44
|
+
"type": "object",
|
|
45
|
+
"required": ["paths"],
|
|
46
|
+
"properties": {
|
|
47
|
+
"paths": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"properties": {
|
|
50
|
+
"repoRoot": { "type": "string" },
|
|
51
|
+
"wpContent": { "type": "string" },
|
|
52
|
+
"pluginsDir": { "type": "string" },
|
|
53
|
+
"themesDir": { "type": "string" }
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": true
|
|
56
|
+
}
|
|
57
|
+
,
|
|
58
|
+
"usesInteractivityApi": { "type": "boolean" },
|
|
59
|
+
"usesAbilitiesApi": { "type": "boolean" },
|
|
60
|
+
"usesInnerBlocks": { "type": "boolean" },
|
|
61
|
+
"usesWpCli": { "type": "boolean" },
|
|
62
|
+
"performanceHints": { "type": "object", "additionalProperties": true },
|
|
63
|
+
"interactivityHints": { "type": "object", "additionalProperties": true },
|
|
64
|
+
"abilitiesHints": { "type": "object", "additionalProperties": true },
|
|
65
|
+
"innerBlocksHints": { "type": "object", "additionalProperties": true },
|
|
66
|
+
"wpCliHints": { "type": "object", "additionalProperties": true }
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": true
|
|
69
|
+
},
|
|
70
|
+
"tooling": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"required": ["php", "node", "tests"],
|
|
73
|
+
"properties": {
|
|
74
|
+
"php": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {
|
|
77
|
+
"hasComposerJson": { "type": "boolean" },
|
|
78
|
+
"hasVendorDir": { "type": "boolean" },
|
|
79
|
+
"phpunitXml": { "type": "array", "items": { "type": "string" } }
|
|
80
|
+
},
|
|
81
|
+
"additionalProperties": true
|
|
82
|
+
},
|
|
83
|
+
"node": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {
|
|
86
|
+
"hasPackageJson": { "type": "boolean" },
|
|
87
|
+
"packageManager": { "type": ["string", "null"], "enum": ["npm", "yarn", "pnpm", "bun", null] },
|
|
88
|
+
"usesWordpressScripts": { "type": "boolean" }
|
|
89
|
+
},
|
|
90
|
+
"additionalProperties": true
|
|
91
|
+
},
|
|
92
|
+
"tests": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"properties": {
|
|
95
|
+
"hasPhpUnit": { "type": "boolean" },
|
|
96
|
+
"hasWpEnv": { "type": "boolean" },
|
|
97
|
+
"hasPlaywright": { "type": "boolean" },
|
|
98
|
+
"hasJest": { "type": "boolean" }
|
|
99
|
+
},
|
|
100
|
+
"additionalProperties": true
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"additionalProperties": true
|
|
104
|
+
},
|
|
105
|
+
"versions": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"properties": {
|
|
108
|
+
"wordpress": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"properties": {
|
|
111
|
+
"core": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"properties": {
|
|
114
|
+
"value": { "type": ["string", "null"] },
|
|
115
|
+
"source": { "type": ["string", "null"] }
|
|
116
|
+
},
|
|
117
|
+
"additionalProperties": true
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"additionalProperties": true
|
|
121
|
+
},
|
|
122
|
+
"gutenberg": {
|
|
123
|
+
"type": "object",
|
|
124
|
+
"properties": {
|
|
125
|
+
"value": { "type": ["string", "null"] },
|
|
126
|
+
"source": { "type": ["string", "null"] }
|
|
127
|
+
},
|
|
128
|
+
"additionalProperties": true
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"additionalProperties": true
|
|
132
|
+
},
|
|
133
|
+
"recommendations": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"commands": { "type": "array", "items": { "type": "string" } },
|
|
137
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
138
|
+
},
|
|
139
|
+
"additionalProperties": true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"additionalProperties": true
|
|
143
|
+
}
|