{"id":23387249,"url":"https://github.com/wp-forge/wp-cli-forge-command","last_synced_at":"2025-04-08T12:34:08.457Z","repository":{"id":57082034,"uuid":"247048750","full_name":"wp-forge/wp-cli-forge-command","owner":"wp-forge","description":"A zero-configuration scaffolding tool built as a WP-CLI package.","archived":false,"fork":false,"pushed_at":"2022-01-06T17:47:30.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T08:37:38.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/wp-forge/wp-cli-forge-command","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-forge.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-13T10:47:58.000Z","updated_at":"2022-01-06T15:26:34.000Z","dependencies_parsed_at":"2022-08-24T14:58:18.683Z","dependency_job_id":null,"html_url":"https://github.com/wp-forge/wp-cli-forge-command","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-cli-forge-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-cli-forge-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-cli-forge-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-cli-forge-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-forge","download_url":"https://codeload.github.com/wp-forge/wp-cli-forge-command/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247843595,"owners_count":21005475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-22T01:15:23.930Z","updated_at":"2025-04-08T12:34:08.432Z","avatar_url":"https://github.com/wp-forge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WP Forge Command\n\nA zero-configuration scaffolding tool for WordPress built as a WP-CLI package.\n\n## Installation\n\n1. [Install WP-CLI](https://wp-cli.org/#installing)\n\n2. Install this WP-CLI package:\n\n```shell\nwp package install wp-forge/wp-cli-forge-command\n```\n\n## Usage\n\nFrom your project root, run the `init` command to set up a project-level configuration file.\u003cbr\u003e\n_*Technically, this step is optional. However, it helps to eliminate some prompts as you run make commands._\n\n```shell\nwp forge init\n```\n\nRun the `make` command to scaffold a new entity such as a plugin, theme, etc.\n\n```shell\nwp forge make \u003cname\u003e\n```\n\n## Advanced Usage\n\nClone a Git repository containing [scaffolding templates](#scaffolding-templates) so they will be locally available to\nthe tool.\n\n```shell\nwp forge clone \u003crepository_url\u003e\n```\n\nWhen cloning a repository, you can optionally provide a name. This allows you to utilize multiple repositories\ncontaining scaffolding templates from various sources. If you do not set a name, the system will use the name \"default\"\nautomatically.\n\n```shell\nwp forge clone \u003crepository_url\u003e --as=\u003cname\u003e\n```\n\nTo scaffold using a template from a named repository, just prefix the entity name with your custom namespace.\n\nFor example, if you set the name to be `company`, and you wanted to scaffold a `wp-plugin`, then you would run this\ncommand:\n\n```shell\nwp forge make company:wp-plugin\n```\n\nThis will ensure that the repository containing the `company` templates will be checked for the `wp-plugin` scaffolding.\nIn the event that you have multiple template sources configured and the requested template cannot be found under the\nrequested namespace, the tool will ask you if you want to check the other template sources for that template.\n\nYou can also use a path to leverage templates found nested in other folders.\n\n```shell\nwp forge make company:github-actions/lint-php\n```\n\nThe above command would look in the `~/.wp-cli/templates/company` folder for the template in\nthe `github-actions/lint-php` directory.\n\n## Documentation\n\nAll commands are self-documented by the tool. Simply type an available command followed by the `--help` flag for more\ndetails.\n\n**Get high-level documentation on available commands:**\n\n```shell\nwp forge --help\n```\n\n**Get documentation for a specific command:**\n\n```shell\nwp forge config --help\n```\n\n## Scaffolding Templates\n\nIn order to use this tool, you must first have a Git repository where you will host your scaffolding templates.\n\n**Let's get started!**\n\n\u003e **Step 1:** Create a [new Git repository](https://github.com/new).\n\n\u003e **Step 2:** Create a folder in the repository for each thing you will want to scaffold. The name of the folder is the name you will use with the `make` command.\n\nExamples of things you might want to scaffold:\n\n- WordPress plugins\n- WordPress themes\n- WordPress sites\n- Custom post types\n- GitHub actions\n- Other custom code you use frequently\n\n\u003e **Step 3:** Make sure you have a `config.json` file in the template folder. This will tell the CLI what to do with your template.\n\n### Config Examples\n\nA simple `config.json` file might look like this:\n\n```json\n{\n  \"directives\": [\n    {\n      \"action\": \"copy\",\n      \"from\": \"lint-php.yml\",\n      \"to\": \".github/workflows/lint-php.yml\",\n      \"relativeTo\": \"projectRoot\"\n    }\n  ]\n}\n```\n\nThis would copy the `lint-php.yml` file from the template folder to the `.github/workflows/lint-php.yml` file relative\nto the project root. You can provide multiple copy directives to copy not only files, but also entire directories. If\nyou want the path to be relative to the current directory where the CLI tool is being run, then just leave off\nthe `relativeTo` property or set its value to `workingDir`.\n\nIt is very common that you will want to replace placeholders in your templates. To facilitate this, you must first\ncollect the required information from the user.\n\nYou can add a `prompts` section to trigger these data requests in the CLI:\n\n```json\n{\n  \"prompts\": [\n    {\n      \"message\": \"What is your first name?\",\n      \"name\": \"first_name\",\n      \"type\": \"input\"\n    },\n    {\n      \"message\": \"What country are you in?\",\n      \"name\": \"country\",\n      \"type\": \"input\",\n      \"default\": \"United States\"\n    },\n    {\n      \"message\": \"What is your favorite ice cream?\",\n      \"name\": \"ice_cream\",\n      \"type\": \"radio\",\n      \"options\": [\n        \"Chocolate\",\n        \"Vanilla\",\n        \"Strawberry\"\n      ]\n    },\n    {\n      \"message\": \"Select one or more taxonomies\",\n      \"name\": \"taxonomies\",\n      \"type\": \"checkboxes\",\n      \"options\": [\n        \"Categories\",\n        \"Tags\"\n      ]\n    }\n  ]\n}\n```\n\nWith these prompts defined, you can now use the `name` field as a [Mustache](https://mustache.github.io/) placeholder in\nany template file. You can also reference the name of any property from the project configuration file in your templates\nwithout needing to prompt the user.\n\nYou can have a template leverage other templates by using the `runCommand` directive and calling the `make` command:\n\n```json\n{\n  \"directives\": [\n    {\n      \"action\": \"runCommand\",\n      \"command\": \"wp forge make github-actions/lint-js\"\n    },\n    {\n      \"action\": \"runCommand\",\n      \"command\": \"wp forge make github-actions/lint-php\"\n    },\n    {\n      \"action\": \"runCommand\",\n      \"command\": \"wp forge make github-actions/lint-yml\"\n    }\n  ]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-forge%2Fwp-cli-forge-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-forge%2Fwp-cli-forge-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-forge%2Fwp-cli-forge-command/lists"}