Code implementation with AI
The Code Genie feature provides an end-to-end integration within the Loop environment, allowing you to generate source code directly from a work item. By coordinating between DevOps Plan, Code, and Control products, Code Genie automates the transition from a descriptive task to a functional Pull Request (PR).
Code Genie leverages AI to translate work item details into actionable coding instructions. It analyses the Description and Conversation (comments) fields of a work item to determine the requirements for code generation. The tool then triggers a background process in which an AI-powered dev container applies the requested changes and submits them as a PR in the designated Control repository.
Before you begin, ensure that you have:
- AI requirement: You must have an AI integration enabled to use the Generate function for coding instructions. For more information, see the Artificial Intelligence integration topic in Plan Documentation.
- CLI token: For a CLI token, see Manage Coding CLI.
- Branching strategy: Use a branching strategy with a protected main branch.
- Processing time: Code generation is not instantaneous. After clicking Implement in DevOps Plan, it might take some time for the PR to appear in Control.
- Manual review required: While Code Genie generates the code, ensure that a reviewer must still manually review and merge the PR to ensure quality and security.
- Branch protection: Standard branch protection rules in Control still apply, preventing unauthorized code from being pushed directly to protected branches.
- Unsaved instructions: If you close the slide-out panel before clicking Implement, any manually entered or AI-generated instructions that have not been submitted will be lost.
- Open the work item: Navigate to the desired work item in DevOps Plan in full view mode.
- Launch Code Genie: Click the Code Genie button located in the record toolbar.
- Select repository: In the slide-out panel, select the appropriate Control repository from the dropdown menu. This action automatically loads the relevant dev container and coding guidelines.
- Prepare coding instructions:
- AI generation: Click Generate to let the AI create instructions based on the work item's description and comments.
- Manual entry: Alternatively, type specific instructions or prompts directly into the text area.
- Implement: Click the Implement button to initiate the background generation process.
- Verify the PR: Navigate to the Control UI to view the automatically generated PR. You can review the files changed and any automated security scans that are run by Trivy.
- Monitor in DevOps Plan: Return to the work item in the DevOps Plan and check the SCM events tab to verify that the PR is reflected there.
Upon successful completion, Code Genie generates a complete PR in the linked Control repository. This PR includes the implemented code files based on your instructions and is ready for manual review and merging by assigned reviewers.