This guide walks you through creating a custom Intent Architect module, from initial setup to packaging and distribution.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/IntentArchitect/Intent.Modules.NET/llms.txt
Use this file to discover all available pages before exploring further.
What is a Module?
A module is a packaged collection of:- Templates - Code generation templates that produce files
- Decorators - Components that modify existing templates
- Factory Extensions - Extensions that hook into the Software Factory lifecycle
- Metadata - Designer configurations and stereotypes
- Module Settings - Configurable options for your module
Prerequisites
Before creating a module, ensure you have:- Visual Studio 2022 or later
- .NET 8.0 SDK or later
- Intent Architect installed
- Basic understanding of C# and T4 templates
Module Structure
A typical module project has the following structure:Step 1: Create the Module Project
Using Intent Architect Module Builder
The recommended approach is to use Intent Architect’s Module Builder:- Create a new Intent Architect application
- Install the Module Builder module
- Use the Module Builder designer to:
- Define your module metadata
- Create template definitions
- Configure decorators and extensions
- Run the Software Factory to generate the module scaffolding
Manual Project Creation
Alternatively, create a .NET Class Library project:Step 2: Create the Module Specification
Create an.imodspec file to define your module’s metadata:
Intent.Modules.YourModule.imodspec
Step 3: Add Templates
Templates are the core of your module. See the Template Development guide for detailed information on creating templates.Step 4: Register Templates
Create a template registration class:YourTemplateRegistration.cs
Step 5: Update the Module Specification
Add your template to the.imodspec file:
Step 6: Build and Package
Build your module project:.imod package file in the output directory that can be installed in Intent Architect.
Step 7: Testing Your Module
Install your module
In Intent Architect, go to Module Manager and install your module from the local build output.
Configure the designer
Add the necessary metadata elements in your designer that your templates expect.
Module Versioning
Follow Semantic Versioning:- MAJOR: Incompatible API changes
- MINOR: Backwards-compatible functionality additions
- PATCH: Backwards-compatible bug fixes
.csprojfile (<Version>element).imodspecfile (<version>element)
Module Dependencies
Declare dependencies on other modules in your.imodspec:
Always specify minimum required versions for dependencies to ensure compatibility.
Module Settings
Add configurable settings to your module:Interoperability
Define module interoperability rules:Best Practices
Use RoslynWeaver attributes
Use RoslynWeaver attributes
Use
[IntentManaged] attributes to control code management:Follow naming conventions
Follow naming conventions
- Module ID:
Intent.YourDomain.YourModule - Template ID:
Intent.YourDomain.YourModule.YourTemplate - Namespace:
Intent.Modules.YourDomain.YourModule
Provide comprehensive documentation
Provide comprehensive documentation
Include:
- README.md with usage instructions
- release-notes.md for version history
- XML doc comments in code
- Hints in module settings
Write automated tests
Write automated tests
Create test applications in the Tests directory to verify:
- Template output correctness
- Decorator behavior
- Factory extension functionality
- Integration with other modules
Distribution
To distribute your module:- Local: Place the
.imodfile in a shared directory - Private Repository: Set up a private NuGet feed
- Public: Submit to the Intent Architect Module Repository
Next Steps
Template Development
Learn how to create powerful code generation templates
Decorators
Extend existing templates with decorators
Factory Extensions
Hook into the Software Factory lifecycle
Testing
Write comprehensive tests for your modules
