Skip to content

Commit ce2e503

Browse files
authored
Merge pull request #33 from codee-sh/release/v1.0.11
release: v1.0.11
2 parents d819080 + 5a3a9ca commit ce2e503

16 files changed

Lines changed: 649 additions & 288 deletions

.ai/skills/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Agent Skills (Cursor + Codex)
2+
3+
This directory contains project-level skills for AI coding agents.
4+
5+
## Structure
6+
7+
```
8+
.ai/skills/
9+
docs/
10+
SKILL.md
11+
```
12+
13+
## Linking to Cursor and Codex
14+
15+
Use a single source (`.ai/skills`) and symlink it for each tool:
16+
17+
```bash
18+
mkdir -p .cursor .codex
19+
ln -sfn ../.ai/skills .cursor/skills
20+
ln -sfn ../.ai/skills .codex/skills
21+
```

.ai/skills/docs/SKILL.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
name: plugin-docs-authoring
3+
description: Rules for writing and updating plugin documentation. Use when creating new docs pages, updating existing docs (README, docs/*.md), or reviewing documentation changes.
4+
---
5+
6+
## Prerequisites
7+
8+
Read `AGENTS.md` first for terminology, architecture, and template types.
9+
This skill only covers documentation-specific rules.
10+
11+
## File Responsibilities
12+
13+
Each file has a strict scope. Do not mix responsibilities between files.
14+
15+
| File | Scope | Tone |
16+
|------|-------|------|
17+
| `README.md` | High-level overview, install, basic setup, links to docs | Short, navigational |
18+
| `docs/configuration.md` | Plugin options only | Technical, example-driven |
19+
| `docs/admin.md` | Admin panel user guide — what you can do, typical workflow | User-facing, no endpoints |
20+
21+
## Writing Rules
22+
23+
### Structure
24+
25+
1. Start every page with a one-sentence summary of what the page covers.
26+
2. Use `##` for main sections, `###` for subsections. Do not go deeper than `####`.
27+
3. Put "what the user can do" before technical details.
28+
4. End pages with a `## See Also` section linking to related docs.
29+
30+
### Style
31+
32+
1. Write in English.
33+
2. Use short sentences and short paragraphs.
34+
3. Prefer bullet lists over long prose.
35+
4. Use code blocks for every example — never inline large snippets.
36+
5. Do not use emojis.
37+
38+
### Cross-referencing
39+
40+
1. Do not duplicate content between files — link to the authoritative page.
41+
2. If you remove a page, update all references across docs and README.
42+
3. Keep all internal links relative (`./blocks.md`, `../blocks.md`).
43+
44+
## Checklist (run before finishing)
45+
46+
- [ ] Does the content match the current architecture?
47+
- [ ] Is `docs/admin.md` still non-technical (no raw endpoints)?
48+
- [ ] Is `README.md` still short and navigational?
49+
- [ ] Are there any dead links?
50+
- [ ] Is there duplicated content between files?
51+
52+
## Workflow
53+
54+
When asked to update or create docs:
55+
56+
1. Read this skill first.
57+
2. Identify which files are affected (use the File Responsibilities table).
58+
3. Read the current state of those files.
59+
4. Make changes following the rules above.
60+
5. Run the checklist.
61+
6. Report: list of changed files + short summary of what and why.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ build/
1515
# IDE
1616
.vscode/
1717
.idea/
18+
.cursor/
19+
.codex/
20+
.claude/
1821
*.swp
1922
*.swo
2023
*~
24+
.github-workflow
25+
2126

2227
# OS
2328
.DS_Store

AGENTS.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# AGENTS.md
2+
3+
Instructions for AI coding agents working on this repository.
4+
5+
## Project Overview
6+
7+
Medusa plugin for automations.
8+
Provides rule-based triggers and actions
9+
for notifications and custom workflows.
10+
11+
- Package: `@codee-sh/medusa-plugin-automations`
12+
- Medusa: `>= 2.8.8`
13+
- Node.js: `>= 20`
14+
- Package manager: `yarn` (v3, see `.yarnrc.yml`)
15+
16+
## Scripts
17+
18+
```bash
19+
yarn build # build plugin (medusa plugin:build)
20+
yarn dev # develop plugin (medusa plugin:develop)
21+
yarn prepublishOnly # build before publish (medusa plugin:build)
22+
yarn publish-local # publish locally (npx medusa plugin:publish)
23+
yarn publish-package # publish to npm (dotenv npm publish --access public)
24+
yarn format # prettier write (src)
25+
yarn format:check # prettier check (src)
26+
yarn changeset # add changeset
27+
yarn version # version bump
28+
yarn release # publish via changesets
29+
yarn release:manual # build + npm publish
30+
yarn prepare-release # prep release branch
31+
```
32+
33+
## Shell Scripts
34+
35+
Daily workflow helpers in `scripts/`:
36+
37+
- `scripts/create-pr.sh` — create a PR (used by `yarn pr:create`).
38+
- `scripts/prepare-release.sh` — prepare a release branch (used by `yarn prepare-release`).
39+
40+
## Code Style
41+
42+
- Prettier: 60-char print width, no semicolons, double quotes, trailing commas (es5)
43+
- Config: `.prettierrc`
44+
- TypeScript: ES2021, Node16 modules, strict null checks, decorators enabled
45+
- Config: `tsconfig.json`
46+
47+
## Branch Model
48+
49+
- `main` — release-ready, every commit is tagged and deployable
50+
- `develop` — nightly builds and upcoming release work
51+
- Topic branches: `feat/<name>`, `fix/<name>`, `chore/<name>`, `docs/<name>`
52+
- PRs target `develop` by default
53+
- Hotfixes branch from `main`, merge back to `main` and `develop`
54+
55+
## Versioning and Release
56+
57+
- Uses [Changesets](https://github.com/changesets/changesets) for version management
58+
- Add changeset: `yarn changeset`
59+
- Version bump: `yarn changeset version`
60+
- Release: merge release branch to `main`, tag is created automatically
61+
- CI: GitHub Actions for PR labeling and release-on-merge
62+
63+
## Architecture
64+
65+
### High-Level Flow
66+
67+
```
68+
Event/Schedule/Manual trigger
69+
→ Subscriber/Job
70+
→ Rule evaluation
71+
→ Action handlers
72+
→ Medusa Notification Module (delivery)
73+
```
74+
75+
### Source Tree
76+
77+
```
78+
src/
79+
├── admin/ # Admin panel UI
80+
├── api/ # Admin API routes (/api/admin/mpn/...)
81+
├── emails/ # Email helpers/templates
82+
├── hooks/ # React hooks for API calls
83+
├── jobs/ # Scheduled jobs
84+
├── links/ # Module links
85+
├── modules/
86+
│ └── mpn-automation/ # Core module: models, services, migrations
87+
├── providers/ # Notification providers (e.g. slack)
88+
├── subscribers/ # Medusa event subscribers
89+
├── utils/ # Helpers
90+
└── workflows/ # Automation + domain workflows
91+
```
92+
93+
### Key Modules
94+
95+
| Module | Path | Purpose |
96+
|--------|------|---------|
97+
| `mpn-automation` | `src/modules/mpn-automation/` | Core: DB models, services, migrations |
98+
| Providers | `src/providers/` | Notification providers (e.g. Slack) |
99+
| Workflows | `src/workflows/` | Automation + domain workflows |
100+
| Subscribers | `src/subscribers/` | Event listeners for triggers |
101+
102+
## Documentation
103+
104+
- `README.md` — overview, install, basic setup
105+
- `docs/configuration.md` — plugin options, actions, rules
106+
- `docs/admin.md` — admin panel user guide
107+
- `CONTRIBUTING.md` — branch model, PR rules, release process
108+
109+
## AI Skills
110+
111+
Project skills live in `skills/`.
112+
If symlinked, use `.ai/skills/` with
113+
`.cursor/skills` and `.codex/skills`.
114+
115+
| Skill | When to use |
116+
|-------|-------------|
117+
| `docs` | Writing or updating documentation |
118+
119+
## Rules for Agents
120+
121+
1. Always run `yarn format` before committing.
122+
2. Follow the branch model: feature work from `develop`, PRs to `develop`.
123+
3. Add a changeset (`yarn changeset`) for any user-facing change.
124+
4. Use consistent terminology: `automation`, `trigger`,
125+
`rule`, `action`, `mpn-automation`, `workflow`.
126+
5. When changing docs, follow the `docs` skill.
127+
6. Do not commit `.env`, `node_modules`, `.medusa/`, or build artifacts.

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @codee-sh/medusa-plugin-automations
22

3+
## 1.0.11
4+
5+
### Patch Changes
6+
7+
- dd40d44: Add skills and agents
8+
- f9cf002: Add changeset
9+
310
## 1.0.10
411

512
### Patch Changes

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Medusa plugin automations
22

3-
A comprehensive automation plugin for Medusa v2 that provides a flexible rule-based automation system with triggers, conditions, and actions. Create automated workflows that can send notifications (email, Slack), execute custom actions, or trigger other processes based on events, schedules, or manual triggers with customizable rules.
3+
Automation plugin for Medusa v2 with rule-based
4+
triggers and actions for notifications and workflows.
45

56
## Features
67

7-
- **Automation Triggers**: Create automations triggered by events, schedules, or manual actions ([see details](#automation-triggers))
8-
- **Rule-Based Conditions**: Define complex conditions with support for arrays, relations, and multiple data types ([see details](#rules-and-conditions))
9-
- **Rich Attribute Support**: Pre-configured attributes for Products, Variants, Tags, Categories, and Inventory ([see available attributes](./docs/configuration.md#available-attributes-reference))
10-
- **Multiple Action Types**: Execute various actions including email notifications, Slack messages, SMS, push notifications, and custom actions ([see details](#actions))
11-
- **Event Subscribers**: Built-in subscribers for common Medusa events ([see available events](./docs/configuration.md#available-subscribers))
8+
- **Automation Triggers**: Events, schedules, or manual actions ([see details](#automation-triggers))
9+
- **Rule-Based Conditions**: Arrays, relations, and multiple data types ([see details](#rules-and-conditions))
10+
- **Rich Attribute Support**: Products, Variants, Tags, Categories, Inventory ([see available attributes](./docs/attributes.md))
11+
- **Multiple Action Types**: Email, Slack, and custom actions ([see details](#actions))
12+
- **Event Subscribers**: Built-in subscribers for common Medusa events ([see available events](./docs/available-subscribers.md))
1213
- **Admin Panel**: Manage automations directly from Medusa Admin ([see details](#admin-panel))
13-
- **Extensible**: Add custom action handlers and extend automation capabilities
14+
- **Extensible**: Add custom action handlers
1415
- **Type-Safe**: Full TypeScript support with exported types and workflows
1516

1617
## Compatibility
@@ -64,19 +65,20 @@ Navigate to **Notifications > Automations** in your Medusa Admin dashboard, or d
6465

6566
Automations are triggered by:
6667
- **Events**: Medusa events (e.g., `inventory.inventory-level.updated`, `product.updated`)
67-
- **Schedule**: Time-based triggers with configurable intervals (In progress)
68+
- **Schedule**: Time-based triggers with configurable intervals
6869
- **Manual**: Triggered manually from the admin panel
6970

70-
See [Available Subscribers](./docs/configuration.md#available-subscribers) in the configuration documentation for a complete list of supported events.
71+
See [Available Subscribers](./docs/available-subscribers.md) for a complete list of supported events.
7172

7273
### Rules and Conditions
7374

7475
Each automation can have multiple rules that define when actions should be executed. Rules support primitive fields, relations (arrays), nested objects, and various operators for complex conditions.
7576

7677
For detailed information, see:
77-
- [Available Attributes Reference](./docs/configuration.md#available-attributes-reference) - Complete list of attributes for each event type
78-
- [Rule Operators](./docs/configuration.md#rule-operators) - All supported operators with examples
78+
- [Available Attributes Reference](./docs/attributes.md) - Complete list of attributes for each event type
79+
- [Rule Operators](./docs/rule-operators.md) - All supported operators with examples
7980
- [Rule Values](./docs/configuration.md#rule-values) - Supported data types and usage
81+
- [Custom Action Handlers](./docs/custom-action-handlers.md) - Extend actions with custom handlers
8082

8183
### Actions
8284

@@ -88,6 +90,9 @@ When automation rules pass, actions are executed. Supported action types include
8890

8991
See [Actions](./docs/configuration.md#actions) and [Slack Notification Provider](./docs/configuration.md#slack-notification-provider) in the configuration documentation for details on configuring and extending actions.
9092

93+
Email and Slack templates are rendered by
94+
`@codee-sh/medusa-plugin-notification-emails`.
95+
9196
## Admin Panel
9297

9398
Access the automations management interface in Medusa Admin at `/app/notifications/automations`. See [Admin Panel Documentation](./docs/admin.md) for details.
@@ -114,7 +119,7 @@ The plugin exports the following:
114119

115120
## Related Plugins
116121

117-
For email templates and rendering functionality, see [@codee-sh/medusa-plugin-automations-emails](https://github.com/codee-sh/medusa-plugin-notification-emails).
122+
For email and Slack template rendering, see [@codee-sh/medusa-plugin-notification-emails](https://github.com/codee-sh/medusa-plugin-notification-emails).
118123

119124
## License
120125

@@ -123,3 +128,8 @@ MIT
123128
## Author
124129

125130
Codee Team - [https://codee.dev](https://codee.dev)
131+
132+
## See Also
133+
134+
- [Configuration](./docs/configuration.md)
135+
- [Admin Panel](./docs/admin.md)

0 commit comments

Comments
 (0)