Skip to content

Commit 91ca5a7

Browse files
committed
feat: implement initial scaffolding tool for WordPress plugins
0 parents  commit 91ca5a7

43 files changed

Lines changed: 3632 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [siddik-web]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Bug report
3+
about: Something isn't working as expected
4+
title: "bug: "
5+
labels: bug
6+
assignees: ""
7+
---
8+
9+
## Describe the bug
10+
11+
A clear description of what the bug is.
12+
13+
## To reproduce
14+
15+
Steps to reproduce the behaviour:
16+
17+
1. Run `npx create-wp-plugin ...`
18+
2. Select options: `...`
19+
3. See error
20+
21+
## Expected behaviour
22+
23+
What you expected to happen.
24+
25+
## Actual behaviour
26+
27+
What actually happened. Include the full terminal output / error message if possible.
28+
29+
```
30+
paste output here
31+
```
32+
33+
## Environment
34+
35+
| | |
36+
|---|---|
37+
| OS | e.g. macOS 14.3 / Ubuntu 22.04 / Windows 11 |
38+
| Node.js version | `node --version` |
39+
| npm version | `npm --version` |
40+
| create-wp-plugin version | `npx create-wp-plugin --version` |
41+
42+
## Additional context
43+
44+
Any other context about the problem (screenshots, related issues, etc.).
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature or improvement
4+
title: "feat: "
5+
labels: enhancement
6+
assignees: ""
7+
---
8+
9+
## Problem / motivation
10+
11+
What problem does this feature solve? What's the use case?
12+
13+
## Proposed solution
14+
15+
Describe what you'd like to happen.
16+
17+
## Alternatives considered
18+
19+
Have you thought of any other ways to solve this? Why is your proposal better?
20+
21+
## Additional context
22+
23+
Screenshots, links to prior art, related issues, etc.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## Summary
2+
3+
<!-- What does this PR do? One paragraph. -->
4+
5+
## Type of change
6+
7+
- [ ] Bug fix
8+
- [ ] New feature
9+
- [ ] Breaking change
10+
- [ ] Documentation update
11+
- [ ] Refactor / chore
12+
13+
## Related issue
14+
15+
Closes #<!-- issue number -->
16+
17+
## Changes
18+
19+
<!-- List the key changes made -->
20+
21+
-
22+
-
23+
24+
## Testing
25+
26+
<!-- How did you test this? -->
27+
28+
- [ ] Added / updated unit tests
29+
- [ ] Ran smoke test: `node bin/create-wp-plugin.js test-plugin --no-claude`
30+
- [ ] Verified generated files look correct
31+
32+
## Checklist
33+
34+
- [ ] My code follows the project style
35+
- [ ] I updated `CHANGELOG.md` under `[Unreleased]`
36+
- [ ] I updated `README.md` if needed (new flags, new tokens, etc.)
37+
- [ ] `npm test` passes locally

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test (Node ${{ matrix.node-version }})
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [18, 20, 22]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
cache: npm
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run tests
32+
run: npm test
33+
34+
scaffold-smoke-test:
35+
name: Scaffold smoke test
36+
runs-on: ubuntu-latest
37+
needs: test
38+
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
43+
- name: Set up Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 20
47+
cache: npm
48+
49+
- name: Install dependencies
50+
run: npm ci
51+
52+
- name: Run scaffold (non-interactive)
53+
run: |
54+
node bin/create-wp-plugin.js smoke-test-plugin \
55+
--author "CI Bot" \
56+
--author-uri "https://example.com" \
57+
--namespace "SmokeTestPlugin" \
58+
--prefix "smoketest" \
59+
--no-claude
60+
61+
- name: Verify expected files exist
62+
run: |
63+
test -f smoke-test-plugin/smoke-test-plugin.php
64+
test -f smoke-test-plugin/composer.json
65+
test -f smoke-test-plugin/package.json
66+
test -f smoke-test-plugin/phpunit.xml
67+
test -f smoke-test-plugin/src/includes/class-plugin.php
68+
test -f smoke-test-plugin/src/includes/class-activator.php
69+
test -f smoke-test-plugin/src/admin/class-settings.php
70+
test -f smoke-test-plugin/src/api/class-rest-controller.php
71+
test -f smoke-test-plugin/tests/unit/Test_Settings.php
72+
echo "All expected files present ✔"
73+
74+
- name: Verify token replacement
75+
run: |
76+
grep -q "SmokeTestPlugin" smoke-test-plugin/smoke-test-plugin.php
77+
grep -q "smoketest" smoke-test-plugin/smoke-test-plugin.php
78+
grep -q "smoke-test-plugin" smoke-test-plugin/composer.json
79+
echo "Token replacement correct ✔"
80+
81+
lint:
82+
name: Lint
83+
runs-on: ubuntu-latest
84+
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v4
88+
89+
- name: Set up Node.js
90+
uses: actions/setup-node@v4
91+
with:
92+
node-version: 20
93+
cache: npm
94+
95+
- name: Install dependencies
96+
run: npm ci
97+
98+
- name: Check formatting
99+
run: npm run lint --if-present

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
id-token: write # for npm provenance
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
registry-url: https://registry.npmjs.org
25+
cache: npm
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Run tests
31+
run: npm test
32+
33+
- name: Publish with provenance
34+
run: npm publish --provenance --access public
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
node_modules/
2+
.DS_Store
3+
Thumbs.db
4+
*.log
5+
.env
6+
/coverage/
7+
/tmp/
8+
# generated plugin output from smoke tests
9+
smoke-test-plugin/
10+
my-test-plugin/

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
---
9+
10+
## [Unreleased]
11+
12+
---
13+
14+
## [1.0.0] — 2026-03-20
15+
16+
### Added
17+
18+
- Interactive CLI via `inquirer` — prompts for slug, name, namespace, prefix, author, WP/PHP versions, and feature flags
19+
- Non-interactive mode with full CLI flag support (`--namespace`, `--prefix`, `--no-claude`, etc.)
20+
- PHP plugin scaffold: entry file, `Plugin`, `Activator`, `Deactivator` classes (PSR-4, PHP 8.1+)
21+
- Admin settings page via WordPress Settings API (`src/admin/class-settings.php`)
22+
- Frontend asset enqueuer with `wp_localize_script` for REST nonce (`src/frontend/class-assets.php`)
23+
- Full REST API CRUD controller extending `WP_REST_Controller` (`src/api/class-rest-controller.php`)
24+
- Custom DB table with `dbDelta()` migration, charset/collation, and indexes
25+
- PHPUnit + WP_Mock test scaffold (`tests/bootstrap.php`, `tests/unit/Test_Settings.php`)
26+
- `composer.json` with PHPCS (WordPress Coding Standards) and PHPUnit
27+
- `package.json` with `@wordpress/scripts` for Webpack asset pipeline
28+
- `phpunit.xml` with unit and integration test suites
29+
- `.gitignore` tuned for WordPress plugin development
30+
- Optional WP-CLI command scaffold (`src/cli/class-cli-command.php`)
31+
- Optional Gutenberg block scaffold (`src/blocks/example-block/`)
32+
- Claude Code memory system:
33+
- `CLAUDE.md` — project memory with stack, architecture, gotchas, workflow rules
34+
- `.claude/settings.json` — allow/deny permissions + PostToolUse lint hook
35+
- `.claude/skills/code-review/SKILL.md` — WP security checklist skill
36+
- `.claude/skills/testing/SKILL.md` — PHPUnit + WP_Mock patterns skill
37+
- `.claude/commands/deploy.md``/deploy` slash command
38+
- `.claude/agents/security-reviewer.md` — pre-release security audit agent
39+
- All template files use `{{TOKEN}}` placeholders — fully resolved at generation time
40+
- `ora` spinner and `chalk` colour output for a polished CLI experience
41+
- GitHub Actions CI workflow (`ci.yml`) — tests on Node 18, 20, 22
42+
- GitHub issue templates (bug report, feature request)
43+
- GitHub pull request template
44+
- MIT License
45+
- README with quickstart, flag reference, architecture notes, Claude Code docs
46+
- CONTRIBUTING guide with token reference and PR process
47+
48+
[Unreleased]: https://github.com/siddik-web/create-wp-plugin/compare/v1.0.0...HEAD
49+
[1.0.0]: https://github.com/siddik-web/create-wp-plugin/releases/tag/v1.0.0

CODE_OF_CONDUCT.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6+
7+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8+
9+
## Our Standards
10+
11+
Examples of behavior that contributes to a positive environment:
12+
13+
- Demonstrating empathy and kindness toward other people
14+
- Being respectful of differing opinions, viewpoints, and experiences
15+
- Giving and gracefully accepting constructive feedback
16+
- Accepting responsibility and apologizing to those affected by our mistakes
17+
- Focusing on what is best not just for us as individuals, but for the overall community
18+
19+
Examples of unacceptable behavior:
20+
21+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
22+
- Trolling, insulting or derogatory comments, and personal or political attacks
23+
- Public or private harassment
24+
- Publishing others' private information without their explicit permission
25+
- Other conduct which could reasonably be considered inappropriate in a professional setting
26+
27+
## Enforcement
28+
29+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders at **conduct@siddiqur.com**. All complaints will be reviewed and investigated promptly and fairly.
30+
31+
## Attribution
32+
33+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

0 commit comments

Comments
 (0)