https://github.com/typisttech/wpry
Parse WordPress plugin and theme headers.
https://github.com/typisttech/wpry
cli wordpress
Last synced: 2 months ago
JSON representation
Parse WordPress plugin and theme headers.
- Host: GitHub
- URL: https://github.com/typisttech/wpry
- Owner: typisttech
- License: mit
- Created: 2026-03-27T05:10:42.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-12T03:34:34.000Z (3 months ago)
- Last Synced: 2026-04-12T04:05:56.309Z (3 months ago)
- Topics: cli, wordpress
- Language: Go
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# WPry
[](https://pkg.go.dev/github.com/typisttech/wpry)
[](https://github.com/typisttech/wpry/releases/latest)
[](https://github.com/typisttech/wpry/actions/workflows/test.yml)
[](https://codecov.io/gh/typisttech/wpry)
[](https://github.com/typisttech/wpry/blob/master/LICENSE)
[](https://x.com/tangrufus)
[](https://bsky.app/profile/tangrufus.com)
[](https://github.com/sponsors/tangrufus)
[](https://typist.tech/contact/)
WPry parses WordPress plugin and theme headers.
Built with ♥ by Typist Tech
---
> [!TIP]
> **Hire Tang Rufus!**
>
> I am looking for my next role, freelance or full-time.
> If you find this tool useful, I can build you more weird stuff like this.
> Let's talk if you are hiring PHP / Ruby / Go developers.
>
> Contact me at https://typist.tech/contact/
---
## Features
- Parse WordPress plugin headers from PHP files
- Parse WordPress theme headers from `style.css`
- Parse unzipped plugin and theme directories
- Parse plugin and theme zip archives containing (CLI only)
- Normalize CR and CRLF line endings
- Apply best-effort encoding fallback before header parsing
Heuristics (in order):
1. If input is already valid UTF-8, return it (strip UTF-8 BOM if present)
2. Check for UTF-32 BOMs (BE/LE) and decode when present
3. Check for UTF-16 BOMs (BE/LE) and decode when present
4. Try Windows-1252
5. Try ISO-8859-1
## Library Usage
[](https://pkg.go.dev/github.com/typisttech/wpry)
Refer to [Go Reference on pkg.go.dev](https://pkg.go.dev/github.com/typisttech/wpry#section-documentation)
## CLI Usage
```bash
USAGE:
wpry [...]
FLAGS:
-parallel n
run n workers simultaneously.
If n is 0 or less, GOMAXPROCS is used. Setting -parallel to values higher
than GOMAXPROCS may cause degraded performance due to CPU contention.
(default GOMAXPROCS)
-timeout d
If the parser runs longer than duration d, abort. (default 1m0s)
-v Print version
-version
Print version
EXAMPLES:
# Parse a plugin main file
$ wpry /path/to/index.php
# Parse a theme main stylesheet
$ wpry /path/to/style.css
# Parse an unzipped plugin
$ wpry /path/to/wp-content/plugins/woocommerce
# Parse an unzipped theme
$ wpry /path/to/wp-content/themes/twentytwentynine
# Parse a plugin zip
$ wpry /path/to/woocommerce.zip
# Parse a theme zip
$ wpry /path/to/twentytwentynine.zip
```
> [!TIP]
> **Hire Tang Rufus!**
>
> There is no need to understand any of these quirks.
> Let me handle them for you.
> I am seeking my next job, freelance or full-time.
>
> If you are hiring PHP / Ruby / Go developers,
> contact me at https://typist.tech/contact/
### Examples
Parse a plugin file:
```bash
wpry /path/to/index.php
```
```json
{
"file": "index.php",
"plugin": {
"name": "Full Plugin",
"uri": "https://example.com/full-plugin",
"description": "A fully specified plugin.",
"version": "2.0.0",
"requires_wp": "6.0",
"requires_php": "8.0",
"author": "Full Author",
"author_uri": "https://example.com/author",
"license": "GPL-2.0-or-later",
"license_uri": "https://www.gnu.org/licenses/gpl-2.0.html",
"update_uri": "https://example.com/update",
"text_domain": "full-plugin",
"domain_path": "/lang",
"requires_plugins": "woocommerce, akismet",
"network": "true"
}
}
```
Parse a theme main stylesheet:
```bash
wpry /path/to/style.css
```
```json
{
"file": "style.css",
"theme": {
"name": "Full Theme",
"uri": "https://example.com/full-theme",
"author": "Full Author",
"author_uri": "https://example.com/author",
"description": "A fully specified theme.",
"version": "3.0.0",
"requires_wp": "6.0",
"tested_up_to": "6.5",
"requires_php": "8.0",
"license": "GPL-2.0-or-later",
"license_uri": "https://www.gnu.org/licenses/gpl-2.0.html",
"text_domain": "full-theme",
"domain_path": "/lang",
"tags": "custom-background, custom-logo",
"template": "twentytwentyfive"
}
}
```
Parse a directory:
```bash
wpry /path/to/wp-content/plugins/woocommerce
wpry /path/to/wp-content/themes/twentytwentynine
```
Parse a zip archive:
```bash
wpry /path/to/woocommerce.zip
wpry /path/to/twentytwentynine.zip
```
Error result:
```json
{
"error": "no header found"
}
```
### CLI Installation
#### Homebrew (macOS / Linux) (Recommended)
```bash
brew install typisttech/tap/wpry
```
#### Build from Source
```bash
go install github.com/typisttech/wpry/cmd/wpry@latest
```
#### Linux (Debian & Alpine)
Follow the instructions on https://broadcasts.cloudsmith.com/typisttech/oss

Package repository hosting is graciously provided by [Cloudsmith](https://cloudsmith.com).
Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that
enables your organization to create, store and share packages in any format, to any place, with total
confidence.
## Credits
[WPry](https://github.com/typisttech/wpry) is a [Typist Tech](https://typist.tech) project and maintained by [Tang Rufus](https://x.com/TangRufus), freelance developer for [hire](https://typist.tech/contact/).
Full list of contributors can be found [here](https://github.com/typisttech/wpry/graphs/contributors).
## Copyright and License
This project is a [free software](https://www.gnu.org/philosophy/free-sw.en.html) distributed under the terms of the MIT license. For the full license, see [LICENSE](./LICENSE).
## Contribute
Feedbacks / bug reports / pull requests are welcome.