From 5fd1408a60102b0399d6ee6d013d243117c6a8d6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:00:10 +0000 Subject: [PATCH 1/4] Initial plan From a49f065e5e43122315b983fc801f9596b48cc307 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:03:47 +0000 Subject: [PATCH 2/4] Add LICENSE file generation to scaffold package command Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- features/scaffold-package.feature | 10 ++++++++++ src/ScaffoldPackageCommand.php | 2 ++ templates/LICENSE.mustache | 21 +++++++++++++++++++++ templates/readme-contributing.mustache | 4 ++++ 4 files changed, 37 insertions(+) create mode 100644 templates/LICENSE.mustache diff --git a/features/scaffold-package.feature b/features/scaffold-package.feature index 07f2ef2..b590e95 100644 --- a/features/scaffold-package.feature +++ b/features/scaffold-package.feature @@ -52,6 +52,15 @@ Feature: Scaffold WP-CLI commands """ Contributing """ + And the {PACKAGE_PATH}/local/wp-cli/foo/LICENSE file should exist + And the {PACKAGE_PATH}/local/wp-cli/foo/LICENSE file should contain: + """ + The MIT License (MIT) + """ + And the {PACKAGE_PATH}/local/wp-cli/foo/LICENSE file should contain: + """ + wp-cli/foo Contributors + """ And the {PACKAGE_PATH}/local/wp-cli/foo/wp-cli.yml file should exist And the {PACKAGE_PATH}/local/wp-cli/foo/.travis.yml file should not exist And the {PACKAGE_PATH}/local/wp-cli/foo/.github/PULL_REQUEST_TEMPLATE file should exist @@ -138,6 +147,7 @@ Feature: Scaffold WP-CLI commands And the custom-directory/.editorconfig file should exist And the custom-directory/phpcs.xml.dist file should exist And the custom-directory/composer.json file should exist + And the custom-directory/LICENSE file should exist And the custom-directory/hello-world-command.php file should exist And the custom-directory/wp-cli.yml file should exist And the custom-directory/.travis.yml file should not exist diff --git a/src/ScaffoldPackageCommand.php b/src/ScaffoldPackageCommand.php index 334026c..8108a9c 100644 --- a/src/ScaffoldPackageCommand.php +++ b/src/ScaffoldPackageCommand.php @@ -81,6 +81,7 @@ public function package( $args, $assoc_args ) { ]; $assoc_args = array_merge( $defaults, $assoc_args ); $assoc_args['name'] = $args[0]; + $assoc_args['year'] = gmdate( 'Y' ); $bits = explode( '/', $assoc_args['name'] ); if ( 2 !== count( $bits ) || empty( $bits[0] ) || empty( $bits[1] ) ) { @@ -123,6 +124,7 @@ public function package( $args, $assoc_args ) { "{$package_dir}/.distignore" => file_get_contents( "{$package_root}/.distignore" ), "{$package_dir}/phpcs.xml.dist" => Utils\mustache_render( "{$template_path}/phpcs.xml.dist.mustache", $assoc_args ), "{$package_dir}/CONTRIBUTING.md" => file_get_contents( "{$package_root}/CONTRIBUTING.md" ), + "{$package_dir}/LICENSE" => Utils\mustache_render( "{$template_path}/LICENSE.mustache", $assoc_args ), "{$package_dir}/wp-cli.yml" => $wp_cli_yml, "{$package_dir}/hello-world-command.php" => Utils\mustache_render( "{$template_path}/hello-world-command.mustache", $assoc_args ), "{$package_dir}/src/HelloWorldCommand.php" => Utils\mustache_render( "{$template_path}/HelloWorldCommand.mustache", $assoc_args ), diff --git a/templates/LICENSE.mustache b/templates/LICENSE.mustache new file mode 100644 index 0000000..9178244 --- /dev/null +++ b/templates/LICENSE.mustache @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (C) {{year}} {{name}} Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/templates/readme-contributing.mustache b/templates/readme-contributing.mustache index d02289d..3006744 100644 --- a/templates/readme-contributing.mustache +++ b/templates/readme-contributing.mustache @@ -17,3 +17,7 @@ Once you’ve done a bit of searching and discovered there isn’t an open or fi Want to contribute a new feature? Please first [open a new issue](https://github.com/{{package_name}}/issues/new) to discuss whether the feature is a good fit for the project. Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally. + +### License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. From 69a4160cc0425db4909ac30b61e75cd21cc99b7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:04:27 +0000 Subject: [PATCH 3/4] Update command documentation to mention LICENSE file Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- src/ScaffoldPackageCommand.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ScaffoldPackageCommand.php b/src/ScaffoldPackageCommand.php index 8108a9c..40a1988 100644 --- a/src/ScaffoldPackageCommand.php +++ b/src/ScaffoldPackageCommand.php @@ -16,6 +16,7 @@ class ScaffoldPackageCommand { * Default behavior is to create the following files: * - command.php * - composer.json (with package name, description, and license) + * - LICENSE * - .gitignore, .editorconfig, .distignore, and phpcs.xml.dist * - README.md (via wp scaffold package-readme) * - Test harness (via wp scaffold package-tests) From c1cb682a8226c2be04470f2508c15f2316071ecf Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 16 Feb 2026 10:45:14 +0100 Subject: [PATCH 4/4] Update test --- features/scaffold-package.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/features/scaffold-package.feature b/features/scaffold-package.feature index b590e95..8e6585b 100644 --- a/features/scaffold-package.feature +++ b/features/scaffold-package.feature @@ -178,6 +178,7 @@ Feature: Scaffold WP-CLI commands s s s + s """ When I try `wp scaffold package wp-cli/same-package --skip-tests --skip-github`