Creating Revision Drafts
A revision draft is the starting point for proposing and managing architectural changes within your Architect-driven project. It's essentially a structured plan, typically defined in a JSON file (commonly named revisions.json), that outlines the modifications you intend to make.
Structure of a Revision Draft
At its core, a revision draft is a JSON array consisting of one or more ComponentOperation objects. Each ComponentOperation describes a single atomic change to a component in your system.
Key fields within a ComponentOperation object include:
name: (String) The unique name of the component being affected (e.g.,UserDTO,OrderAggregate,create_user_endpoint).component_type: (String) The type of the component (e.g.,dto,aggregate,api_endpoint,domain_event,permission). This corresponds to the component types managed by Architect.operation_type: (String) The action to be performed. Common values are:CREATE: Create a new component. (Equivalent toADDin some contexts)UPDATE: Modify an existing component.DELETE: Delete a component. (Equivalent toREMOVEin some contexts)
definition: (Object) A JSON object representing the full definition of the component. This is primarily used forADDandUPDATEoperations. The structure of this object depends on thecomponent_type.context_kwargs: (Object, Optional) A dictionary providing additional context for the operation, which can influence how and where the component is generated or modified. Common keys include:bounded_ctx: The name of the bounded context the component belongs to.version: An API version (e.g.,v1,v2) if applicable.- Other component-specific context.
Example ComponentOperation:
{
"name": "UserProfileDTO",
"component_type": "dto",
"operation_type": "CREATE",
"definition": {
"name": "UserProfileDTO",
"description": "Data Transfer Object for user profile information.",
"fields": [
{"name": "user_id", "type_str": "uuid.UUID", "is_optional": false},
{"name": "username", "type_str": "str", "is_optional": false},
{"name": "email", "type_str": "str", "is_optional": false},
{"name": "bio", "type_str": "str", "is_optional": true}
]
},
"context_kwargs": {
"bounded_ctx": "identity_access",
"version": "v1"
}
}
How to Create Revision Drafts
-
Manually: You can create or edit a
revisions.jsonfile by hand, carefully crafting eachComponentOperationobject according to your architectural needs. This gives you precise control but can be time-consuming for larger changes. -
With LLM Assistance (Recommended for Complex Changes):
- Generate Context: First, ensure your project's context is up-to-date by running:
(Replace
architect context combine-for-llm -o .vscode/architect-context.json.vscode/architect-context.jsonwith your preferred path). - Prompt the LLM: Provide the content of your
architect-context.jsonto a Large Language Model. Clearly describe the new feature, modification, or refactoring you want to achieve. Ask the LLM to generate the necessaryComponentOperationobjects for yourrevisions.jsonfile. - Review and Refine: Carefully review the LLM-generated operations. LLMs are powerful aids, but the generated output should always be validated and refined by a human developer to ensure correctness, completeness, and adherence to your project's specific conventions.
- Generate Context: First, ensure your project's context is up-to-date by running:
Next Steps
Once you have a revision draft, the next steps typically involve:
- Understanding the details of various Component Operations (Link to be created).
- Applying Revisions to your codebase (Link to be created).