Use REPL interactive mode
The REPL (Read-Eval-Print Loop) interactive mode lets you plan, select, generate, deploy, and change cloud resources through multi-turn conversations in a terminal. This topic describes how to start a session, complete a cloud resource management task, and manage context.
Prerequisites
You have completed the steps in Install and configure IaC Code.
You are in the project directory that stores IaC files and session context.
To query or manage cloud resources, you have configured an Alibaba Cloud identity with the required permissions.
Quick start
Start the REPL in the project directory:
cd /path/to/project
iac-codeThe first time you use IaC Code, or when you need to change authentication information, enter:
/authThen submit the following request:
Plan an environment in Hangzhou that contains a VPC, two vSwitches, and two ECS instances. Query the available instance types, generate and validate a ROS template, and estimate the cost. Show the resources to be created and the cost, then wait for my confirmation. Do not deploy directly.IaC Code analyzes the request, queries cloud services and inventory, generates and validates the IaC, estimates the cost, and then waits for your confirmation. Check the region, resource count, security groups, billing method, and cost before you decide whether to deploy.
After the deployment is complete, you can continue in the same session:
Query the stack that was just created and the status of the resources in it. Summarize any anomalies and next-step recommendations. Do not perform any changes.Expected result: IaC Code retains the stack context from the preceding conversation, queries the deployment status, and provides recommendations. You can then submit requests to update, continue creating, or delete resources. Before a write operation runs, check the scope of impact again and confirm it.
Use conversations and tools
Describe your cloud resource goals, regions, specifications, security and cost requirements directly. No need to write a complete template in advance.
When IaC Code needs to read or write files, query cloud API operations, or manage stacks, it displays the corresponding tool call.
According to the permission mode, operations such as writing files, deploying, updating, and deleting may require confirmation. Before you approve an operation, check the tool name, parameters, region, and target resources.
Enter commands such as
!git status --shortto run local commands through the permission-controlled Bash tool.If the terminal supports it, press
Shift+Enterto enter multiple lines. If the terminal does not recognize this composite key, pressEscand then pressEnter.
Use slash commands
Enter / to view the slash commands that are currently available. Common entries include:
Command or prefix | Description |
| Configures the model service and your Alibaba Cloud identity. |
| Views the status of the current session. |
| Views, searches for, and enables or disables Skills. |
| Views and manages project or user memory. |
| Renames the current session. |
| Selects a historical session to continue. |
| Searches for and calls Skills only. |
The complete command set evolves with each version. Use the / completion results in the REPL and the GitHub command reference as the authoritative sources.
Resume a session
Exiting the REPL does not delete the session. Choose a method based on which session you want to resume:
Resume a specific session — Run
iac-code --resume <session ID or name>.Continue the most recent session — Run
iac-code --continue.Select a session interactively — Start the REPL, and then enter
/resume.The REPL and the Web version share the same session storage, so you can also resume a session created in the Web version in the terminal.
FAQ
The REPL prompts that no model is configured after it starts
Enter /auth and configure the model provider, the model, and the API key. For general troubleshooting of configuration issues, see Install and configure IaC Code.
A cloud resource query returns no results
Make sure that an Alibaba Cloud identity and the correct region are configured, and check whether the identity has read-only permissions on the target service. Specify the target region in your request. If you do not specify a region, IaC Code uses the configured default region and explains that choice.
A tool operation did not run
Check the current permission mode and the previous approval results. For deployment, update, or deletion operations, restate the target resources and the impact, and confirm the operation when a permission request appears. Do not use broad authorization to bypass security checks.
The session context is too long
Put stable, long-term project conventions in project memory or a Skill, and create a new session when you start a new task. To continue a task on the same stack, resume the original session first so that the stack and decision context are preserved.