Skip to main content

Modules

Modules are the fundamental packaging unit in Intent Architect. They encapsulate templates, decorators, factory extensions, and metadata that extend the Software Factory’s code generation capabilities.

Module Specification (.imodspec)

Every module is defined by an .imodspec XML file that describes the module’s identity, dependencies, and components.

Basic Structure

<?xml version="1.0" encoding="utf-8"?>
<package>
  <id>Intent.Common</id>
  <version>3.10.0</version>
  <supportedClientVersions>[4.6.0-a, 5.0.0-a)</supportedClientVersions>
  <summary>Base Implementation and Helper classes for modules.</summary>
  <description>Base Implementation and Helper classes for modules.</description>
  <authors>Intent Architect</authors>
  <iconUrl>data:image/png;base64,...</iconUrl>
  <releaseNotes>release-notes.md</releaseNotes>
  <tags>common</tags>
  <templates />
  <dependencies></dependencies>
  <factoryExtensions>
    <factoryExtension id="Intent.Common.DecoratorExecutionHooks" />
    <factoryExtension id="Intent.Common.FileBuilderFactoryExtension" />
  </factoryExtensions>
  <files>
    <file src="$outDir$/$id$.dll" />
    <file src="$outDir$/$id$.pdb" />
  </files>
  <metadata>
    <install target="Module Builder" src="Intent.Metadata/Module Builder/Intent.Common/Intent.Common.pkg.config" externalReference="caccdda9-26f4-49bf-8b73-cadc2220de16" />
  </metadata>
  <moduleSettings />
  <moduleSettingsExtensions />
</package>

Key Elements

Identity

Module ID, version, and supported Intent Architect client versions

Dependencies

Other modules required for this module to function

Components

Templates, decorators, and factory extensions included

Files

DLLs and other files packaged with the module

Module Identity

ID and Versioning

<id>Intent.Common.CSharp</id>
<version>3.10.1</version>
<supportedClientVersions>[4.6.0-a, 5.0.0-a)</supportedClientVersions>
The supportedClientVersions field uses interval notation:
  • [4.6.0-a, 5.0.0-a) - Supports versions from 4.6.0 (inclusive) to 5.0.0 (exclusive)
  • Square bracket [ means inclusive
  • Parenthesis ) means exclusive
  • The -a suffix indicates pre-release compatibility

Dependencies

Modules can declare dependencies on other modules:
<dependencies>
  <dependency id="Intent.Common" version="3.10.0" />
  <dependency id="Intent.Common.Types" version="4.0.0" />
</dependencies>
The Software Factory automatically resolves and loads dependencies in the correct order during execution.

Factory Extensions

Modules register factory extensions that participate in the Software Factory lifecycle:
<factoryExtensions>
  <factoryExtension id="Intent.Common.CSharp.CSharpFileBuilderFactoryExtension" />
  <factoryExtension id="Intent.Common.CSharp.CSharpStyleSettingsLoaderExtension" 
                    externalReference="98dc02d8-76e0-4b0d-8664-a71e1534b68b" />
</factoryExtensions>
The externalReference attribute allows factory extensions to be configured through module settings.

Module Settings

Modules can define settings that users configure per application:
<moduleSettings>
  <group id="6cc9ca71-7670-48eb-b413-e47e72307cbd" 
         title="C# Style Configuration" 
         type="application-settings">
    <settings>
      <setting id="0c43b221-fec0-4df7-96d2-e7281ddf9207" 
               title="Constructor Initializer" 
               type="select">
        <hint>Constructor initializers placement.</hint>
        <defaultValue>same-line</defaultValue>
        <options>
          <option value="same-line" description="Same line" />
          <option value="new-line" description="New line" />
          <option value="depends-on-length" description="Depends on length" />
        </options>
      </setting>
    </settings>
  </group>
</moduleSettings>

Metadata Installation

Modules can install metadata packages into designers:
<metadata>
  <install target="Module Builder" 
           src="Intent.Metadata/Module Builder/Intent.Common.CSharp/Intent.Common.CSharp.pkg.config" 
           externalReference="730e1275-0c32-44f7-991a-9619d07ca68d" />
</metadata>
This installs stereotypes, settings, and other metadata into the target designer.

Interoperability

Modules can define compatibility rules with other modules:
<interoperability>
  <detect id="Intent.AspNetCore">
    <install>
      <package id="Intent.AspNetCore" version="6.1.0" />
    </install>
  </detect>
  <detect id="Intent.EntityFrameworkCore">
    <install>
      <package id="Intent.EntityFrameworkCore" version="5.0.30" />
    </install>
  </detect>
</interoperability>
Interoperability rules ensure minimum compatible versions are installed when multiple modules are used together.

Module Lifecycle

When the Software Factory executes:
1

Module Discovery

The Software Factory scans installed modules and reads their .imodspec files
2

Dependency Resolution

Module dependencies are resolved and sorted in execution order
3

Assembly Loading

Module DLLs are loaded into the Software Factory process
4

Component Registration

Templates, decorators, and factory extensions are registered via reflection
5

Execution

Registered components participate in the Software Factory execution lifecycle

File Packaging

Modules specify which files to include:
<files>
  <file src="$outDir$/$id$.dll" />
  <file src="$outDir$/$id$.pdb" />
  <file src="$outDir$/Microsoft.Extensions.FileSystemGlobbing.dll" inspect="false" />
</files>

Variables

  • $outDir$ - Build output directory
  • $id$ - Module ID from the <id> element
Setting inspect="false" prevents the Software Factory from scanning the assembly for components.

Best Practices

Semantic Versioning

Use semantic versioning (major.minor.patch) for module versions

Clear Dependencies

Explicitly declare all module dependencies with minimum versions

Meaningful IDs

Use namespaced IDs like Intent.Common.CSharp

Documentation

Include release notes and clear descriptions

Templates

Learn about the template system

Factory Extensions

Extend the Software Factory lifecycle

Decorators

Augment template output

Build docs developers (and LLMs) love