# Easy Digital Downloads Plugins Monorepo

This repositories contains a number of different add-ons, extensions, and related projects for EDD. All of these products are consolidated into this repository to allow us to work on them in a single location, maintaining a single repository for them, and to condense the number of repositories across the organization.

# How to checkout this Monorepo

Instead of checking out this repository into your `/wp-content/plugins/` directory, you need to checkout this directory AS your `/plugins` directory.

```
$ cd wp-content
$ rm -Rf plugins
$ git clone git@github.com:awesomemotive/easy-digital-downloads-plugins-monorepo.git plugins
```

Once you have checked out this monorepo, you can clone EDD into the plugins directory and it will not be included:
```
$ cd plugins
$ git clone git@github.com:awesomemotive/easy-digital-downloads-pro.git
```

You are still able to install other plugins without affecting the repostiory, as we use a specific `.gitignore` file to only include items prefixed with `edd-` or `EDD-`, as well as a couple of specific exntesions that do not follow this pattern. We also ignore a few repositories that are still standalone:

* /edd-all-access/
* /edd-blocks/
* /edd-checkout-fields/
* /EDD-Commissions/
* /edd-fes/
* /edd-recurring/
* /edd-reviews/
* /EDD-Software-Licensing/
* /edd-stripe/

## Setting up Cursor Rules
Within this repository, we have defined our Cursor rules in the `.cursor/rules` directory. Cursor only looks for rule files in the workspace root, so therefore, we must create a local rule file that will include our rule files automatically. Doing so will help ensure that any changes we make to our rules will be maintained going forward with the need to make changes to this local rules file.

### Create the local rule
In the root of your Workspace, create the following file `.cursor/include-edd.mdc`. If the `.cursor` directory does not exist, create it as well.

### Include the EDD rules
Edit the `include-edd.mcd` file and include the following:
```
---
description: Always include the Easy Digital Downloads rules.
globs:
alwaysApply: true
---
Include the @edd.mdc rules, you should always attempt to access the contents of them if they are available.
```

You may need to change the path to the `edd.mdc` file depending on your local installation, but it should be the relative path from the Workspace root directory.

### Verify the Cursor Agent's rules
To verify that the rules are being followed when using the Agent/Chat mode, you can ask it in a new 'Chat' with the prompt:
`What rules are you following?`

Depending on what model is used, you may see different results here ranging from full details of the rules, down to a statement that it cannot directly access the files at this time...read more below.

### What model to use in Agent mode?
As of the most recent updates to Cursor, the default model used for the Agent mode is "Auto Select". This can produce mixed results. If you are having problems getting good results, try setting the model to specifically use `claude-3.7-sonnet`.

## Build Scripts
We have monorepo level build script management, with some creativity. General dependencies and scripts are defined at the root level, but generally need to be copied/run at the subdirectory level. See `edd-simple-shipping` as an example.

To get started, run `npm install` at the root level.

Navigate to the workspace directory. The available scripts must be defined in that directory's `package.json` file (note that it will not have a `node_modules` directory). If Grunt is required, copy the root `Gruntfile.js` to the workspace directory and update as needed. If a custom webpack file is required, copy the root `webpack.config.js` file to the workspace directory and update as needed.

Note that for now, the workspaces in the root `package.json` must be manually added as they are updated to use the new system, as the install function will attempt to install every script required for any workspace, and there are (not surprisingly) conflicts.
