|
1 | | -# Copilot Coding Agent Instructions for Elsa Workflows |
| 1 | +# Elsa Core Coding Agent Instructions |
2 | 2 |
|
3 | | -## Repository Overview |
4 | | - |
5 | | -**Elsa Workflows** is a powerful .NET workflow library that enables workflow execution within any .NET application. This is version 3.0, supporting .NET 8.0, .NET 9.0 and .NET 10.0 and providing both a visual designer (from a different repository, elsa-studio) and programmatic workflow definition capabilities. |
6 | | - |
7 | | -### Key Statistics |
8 | | -- **Language**: C# (.NET 10.0) |
9 | | -- **Architecture**: Modular library with 104+ projects |
10 | | -- **Code Size**: ~3,500 C# files across modules |
11 | | -- **License**: MIT |
12 | | -- **Build System**: NUKE build automation |
13 | | -- **Target Frameworks**: .NET 10.0 (primary) |
14 | | - |
15 | | -## High-Level Architecture |
16 | | - |
17 | | -### Directory Structure |
18 | | -``` |
19 | | -src/ |
20 | | -├── apps/ # Reference applications (5 projects) |
21 | | -│ ├── Elsa.Server.Web # Workflow server only |
22 | | -│ └── Elsa.Server.LoadBalancer # Load balancer |
23 | | -├── common/ # Shared libraries (8 projects) |
24 | | -├── modules/ # Core functionality modules (70+ projects) |
25 | | -│ ├── Elsa.Workflows.Core # Core workflow engine |
26 | | -│ ├── Elsa.Workflows.Runtime # Runtime execution |
27 | | -│ ├── Elsa.Workflows.Api # REST API |
28 | | -│ ├── Elsa.Http # HTTP activities |
29 | | -│ ├── Elsa.Email # Email activities |
30 | | -│ └── [many others] # Database, messaging, etc. |
31 | | -└── clients/ # API clients |
32 | | -test/ |
33 | | -├── unit/ # Unit tests |
34 | | -├── integration/ # Integration tests |
35 | | -├── component/ # Component tests |
36 | | -└── performance/ # Performance tests |
37 | | -build/ # NUKE build configuration |
38 | | -docker/ # Docker configurations |
39 | | -``` |
40 | | - |
41 | | -### Core Components |
42 | | -- **Elsa.Workflows.Core**: Main workflow engine and activities |
43 | | -- **Elsa.Workflows.Runtime**: Workflow execution runtime |
44 | | -- **Elsa.Workflows.Api**: RESTful API for workflow management |
45 | | -- **Elsa.Workflows.Management**: Workflow definition management |
46 | | -- **Elsa modules**: Specialized functionality (HTTP, persistence, scheduling, etc.) |
47 | | - |
48 | | -## Build Instructions |
49 | | - |
50 | | -### Prerequisites |
51 | | -- **.NET 10.0 SDK** |
52 | | -- **Build time**: Initial restore ~1-2 minutes, full compile ~5-10 minutes |
53 | | - |
54 | | -### Build Commands |
55 | | - |
56 | | -**Primary build script**: `./build.sh` (Linux/macOS) or `.\build.cmd` (Windows) |
57 | | - |
58 | | -```bash |
59 | | -# View available targets |
60 | | -./build.sh --help |
61 | | - |
62 | | -# Clean build artifacts |
63 | | -./build.sh Clean |
64 | | - |
65 | | -# Restore packages (may show warnings for inaccessible feeds) |
66 | | -./build.sh Restore --ignore-failed-sources |
67 | | - |
68 | | -# Compile core components (excludes studio apps) |
69 | | -./build.sh Compile |
70 | | - |
71 | | -# Run tests (limited due to external dependencies) |
72 | | -./build.sh Test |
73 | | - |
74 | | -# Create NuGet packages |
75 | | -./build.sh Pack |
76 | | - |
77 | | -# Full CI pipeline (compile, test, pack) |
78 | | -./build.sh Compile Test Pack |
79 | | -``` |
80 | | - |
81 | | -**Direct dotnet commands** for core components: |
82 | | -```bash |
83 | | -# Build specific core projects that don't require external packages |
84 | | -dotnet restore src/modules/Elsa.Workflows.Core/ --ignore-failed-sources |
85 | | -dotnet build src/modules/Elsa.Workflows.Core/ --no-restore |
86 | | -dotnet restore src/modules/Elsa.Workflows.Runtime/ --ignore-failed-sources |
87 | | -dotnet build src/modules/Elsa.Workflows.Runtime/ --no-restore |
88 | | - |
89 | | -# Note: Server apps may fail due to WebhooksCore dependency |
90 | | -# Build and test individual core modules |
91 | | -find test/unit -name "*.csproj" | head -5 | xargs -I {} dotnet build {} |
92 | | -``` |
93 | | - |
94 | | -### Expected Build Warnings |
95 | | -- `NU1900`: Unable to load service index for external feeds (safe to ignore) |
96 | | -- `NU1801`: Service index warnings for feedz.io sources (safe to ignore) |
97 | | - |
98 | | -### Successful Build Indicators |
99 | | -- Core modules (Elsa.Workflows.Core, etc.) compile successfully |
100 | | -- Server applications (Elsa.Server.Web) build |
101 | | -- Most modules show "succeeded with X warning(s)" (warnings are acceptable) |
102 | | - |
103 | | -## Testing |
104 | | - |
105 | | -### Test Structure |
106 | | -- **Unit tests**: `test/unit/` - Fast, isolated tests |
107 | | -- **Integration tests**: `test/integration/` - End-to-end scenarios |
108 | | -- **Component tests**: `test/component/` - Feature testing |
109 | | -- **Performance tests**: `test/performance/` - Benchmarks |
110 | | - |
111 | | -### Running Tests |
112 | | -```bash |
113 | | -# Via NUKE build system |
114 | | -./build.sh Test |
115 | | - |
116 | | -# Direct dotnet test (for accessible projects) |
117 | | -dotnet test test/unit/[specific-project]/ |
118 | | -dotnet test --no-build --no-restore [project-path] |
119 | | -``` |
120 | | - |
121 | | -**Note**: Many tests may fail to run due to external package dependencies. Focus on core workflow engine tests that don't require studio packages. |
122 | | - |
123 | | -## Development Guidelines |
124 | | - |
125 | | -### Code Standards |
126 | | -- **Language version**: C# latest |
127 | | -- **Target framework**: .NET 10.0 |
128 | | -- **Nullable reference types**: Enabled |
129 | | -- **Implicit usings**: Enabled |
130 | | -- **EditorConfig**: Configured (4-space indentation, CRLF line endings) |
131 | | - |
132 | | -### Architecture Patterns |
133 | | -- **Modular design**: Each feature area is a separate project/module |
134 | | -- **Dependency injection**: Heavy use of Microsoft.Extensions.DependencyInjection |
135 | | -- **Activity-based**: Workflows are built from composable activities |
136 | | -- **Async/await**: Extensive use throughout for scalability |
137 | | - |
138 | | -### Common Gotchas |
139 | | -1. **NuGet Source Mapping**: Configured in NuGet.Config, restricts where packages can be sourced |
140 | | -2**Multiple Target Frameworks**: Some projects conditionally target different frameworks |
141 | | -3**Build Warnings**: Many NU1900/NU1801 warnings are expected and safe |
142 | | - |
143 | | -## Continuous Integration |
144 | | - |
145 | | -### GitHub Actions Workflow |
146 | | -- **Trigger**: Pull requests to `main` branch |
147 | | -- **Runner**: ubuntu-latest |
148 | | -- **.NET Version**: 10.x (latest) |
149 | | -- **Commands**: `./build.cmd Compile Test Pack` |
150 | | -- **File**: `.github/workflows/pr.yml` (auto-generated by NUKE) |
151 | | - |
152 | | -### CI Pipeline Steps |
153 | | -1. Checkout code |
154 | | -2. Setup .NET 10.x SDK |
155 | | -3. Execute: Compile → Test → Pack |
156 | | -4. Expected warnings for external feed access |
157 | | -5. Studio apps may be excluded from CI builds |
158 | | - |
159 | | -## Key Configuration Files |
160 | | - |
161 | | -- **Build**: `build/Build.cs` (NUKE build configuration) |
162 | | -- **Dependencies**: `Directory.Packages.props` (central package management) |
163 | | -- **Global settings**: `Directory.Build.props` |
164 | | -- **NuGet**: `NuGet.Config` (package sources and mapping) |
165 | | -- **Solution**: `Elsa.sln` (119 projects) |
166 | | -- **Docker**: `docker/` directory with multiple Dockerfiles |
167 | | -- **GitHub Actions**: `.github/workflows/` (auto-generated) |
168 | | - |
169 | | -## Docker Support |
170 | | - |
171 | | -Multiple Docker configurations available: |
172 | | -- `ElsaServer.Dockerfile` - Server only |
173 | | -- `ElsaServerAndStudio.Dockerfile` - Combined server + studio |
174 | | -- `ElsaStudio.Dockerfile` - Studio only |
175 | | -- Docker Compose configurations for development |
176 | | - |
177 | | -## Quick Start for Development |
178 | | - |
179 | | -1. **Clone and build core components**: |
180 | | - ```bash |
181 | | - git clone [repo-url] |
182 | | - cd elsa-core |
183 | | - ./build.sh Clean Restore --ignore-failed-sources |
184 | | - ``` |
185 | | - |
186 | | -2. **Work with core modules** (avoid studio dependencies): |
187 | | - ```bash |
188 | | - cd src/modules/Elsa.Workflows.Core |
189 | | - dotnet build |
190 | | - dotnet test ../../test/unit/[related-tests]/ |
191 | | - ``` |
192 | | - |
193 | | -3. **Work with core modules that don't require external dependencies**: |
194 | | - ```bash |
195 | | - cd src/modules/Elsa.Workflows.Core |
196 | | - dotnet restore --ignore-failed-sources |
197 | | - dotnet build --no-restore |
198 | | - ``` |
199 | | - |
200 | | -## Running the Applications |
201 | | - |
202 | | -### Development Workflow Server |
203 | | - |
204 | | -To run the workflow server for development: |
205 | | - |
206 | | -```bash |
207 | | -cd src/apps/Elsa.Server.Web |
208 | | -dotnet restore --ignore-failed-sources |
209 | | -dotnet run |
210 | | -``` |
211 | | - |
212 | | -The server will start on the configured ports (check `appsettings.json` or environment variables). |
213 | | - |
214 | | -## Troubleshooting |
215 | | - |
216 | | -### Common Issues |
217 | | - |
218 | | -1. **Missing External Packages**: If you encounter `NU1101` errors for Elsa.Studio packages: |
219 | | - - This is expected for studio-related apps |
220 | | - - Focus development on core workflow modules instead |
221 | | - - Or use Docker images that have pre-built studio components |
222 | | - |
223 | | -2. **Build Fails on Server Apps**: If `Elsa.Server.Web` fails due to WebhooksCore: |
224 | | - - This is a known issue with external package feeds |
225 | | - - Try building individual core modules instead |
226 | | - - Use `--ignore-failed-sources` flag consistently |
227 | | - |
228 | | -3. **Test Failures**: If many tests fail to run: |
229 | | - - External package dependencies may be unavailable |
230 | | - - Run tests for specific core modules individually |
231 | | - - Focus on tests that don't require studio packages |
232 | | - |
233 | | -4. **Slow Initial Build**: First restore and compile can take 5-10+ minutes: |
234 | | - - This is normal for a large solution with 100+ projects |
235 | | - - Subsequent builds are much faster (incremental) |
236 | | - - Consider building specific projects/modules when iterating |
237 | | - |
238 | | -## Additional Resources |
239 | | - |
240 | | -### Documentation |
241 | | -- **Official Documentation**: [https://docs.elsaworkflows.io/](https://docs.elsaworkflows.io/) |
242 | | -- **README**: See [README.md](../README.md) for quick start and features overview |
243 | | -- **Contributing Guide**: See [CONTRIBUTING.md](../CONTRIBUTING.md) for contribution guidelines |
244 | | - |
245 | | -### Community Support |
246 | | -- **GitHub Issues**: [Report bugs and request features](https://github.com/elsa-workflows/elsa-core/issues) |
247 | | -- **GitHub Discussions**: [Ask questions and discuss](https://github.com/elsa-workflows/elsa-core/discussions) |
248 | | -- **Discord**: [Join the community chat](https://discord.gg/hhChk5H472) |
249 | | -- **Stack Overflow**: [Tag: elsa-workflows](http://stackoverflow.com/questions/tagged/elsa-workflows) |
250 | | - |
251 | | -### Enterprise Support |
252 | | -- **ELSA-X**: [Professional support and enterprise solutions](https://elsa-x.io) |
253 | | - |
254 | | -## Important Notes for Coding Agents |
255 | | - |
256 | | -1. **Always use `--ignore-failed-sources`** when restoring packages |
257 | | -2. **Focus on core workflow functionality** |
258 | | -3. **Build warnings are normal** - don't try to fix NU1900/NU1801 warnings |
259 | | -4. **Test individual modules** rather than solution-wide tests when external deps fail |
260 | | -5. **Use direct dotnet commands** for building specific components when NUKE fails |
261 | | -6. **Check project references** before attempting builds - some projects have conditional references |
262 | | -7. **Start with core modules** like `Elsa.Workflows.Core`, `Elsa.Workflows.Runtime` which are more likely to build successfully |
263 | | - |
264 | | -Trust these instructions for build and development workflows. Only search for additional information if these instructions are incomplete or found to be incorrect. |
| 3 | +Use the canonical repository guidance in [AGENTS.md](../AGENTS.md). It defines the supported layout, commands, conventions, and testing guidance. Keep feature-specific plan details in `specs/`; they are not copied into this file. |
0 commit comments