Make the factory yours
In this tutorial you put the software factory of the workspace from the Start guide, the lines its team works on, into a repository as Terraform, a tool that keeps settings as files of code. Then you give the Delivery line your code, change what Triage's agent is told, and watch Triage follow the change on a new task.
The web app only shows the factory; changes to it are made in Terraform (why).
Before you start
You need:
- The workspace from the Start guide, with your computer still connected to it.
- Terraform 1.11 or later, and
git. - A GitHub repository, and Spotlight's GitHub App installed on it. Once it is installed, Install the GitHub App in Set up your team has a check mark. Connect GitHub covers the install.
Put the factory in a repository
In Spotlight, open Inbox and then Set up your team. Under Set up
configuration as code, choose your repository from Repository. Leave the
folder as spotlight, and click Start setup chat.
The chat opens on the Agent page. The agent reads your repository and the team's tools, then says what it found and what it would change from the built-in lines. Reply:
Go ahead.The agent writes the team's Terraform into the spotlight/ folder of your
repository and opens a pull request. Its note ends with a link to it.
Go back to Set up your team. Set up configuration as code now has a
check mark. Expand it and click Open pull request. Notice main.tf, with a
spotlight_line resource for each line, and the prompts/ folder, with one
file for each station's prompt. Merge the pull request on GitHub.
In a terminal, clone your repository and open the folder:
git clone https://github.com/<owner>/<repository>.git
cd <repository>/spotlightTerraform needs a workspace token, a key that lets it change the workspace. In Spotlight, open Settings from the workspace menu, then Tokens, and click Create a token. A form titled "Create a token" opens.
Under Name, type terraform. Leave Configure selected, which lets the
token change the workspace's configuration. Notice Expires after says
90 days: the token stops working then. Click Create token.
The page shows the token under "Copy the terraform token now". Click Copy token. Spotlight shows it only this once.
In the terminal, give Terraform the token and Spotlight's address:
export SPOTLIGHT_URL=https://app.usespotlight.ai
export SPOTLIGHT_API_TOKEN=<workspace token>Run:
terraform init
terraform applyThe plan imports what the workspace already has, and changes only what the
agent adapted. Type yes. The apply ends with:
Apply complete! Resources: <n> imported, 0 added, <n> changed, 0 destroyed.Give Delivery your code
If the agent already gave Delivery your repository, main.tf names it in
Delivery's repository block, and the apply below changes nothing.
In main.tf, find the spotlight_line resource with key = "delivery", and
add a repository block to it with your repository's owner and name:
repository {
name = "<owner>/<repository>"
}Run terraform apply. The plan changes only the Delivery line:
Plan: 0 to add, 1 to change, 0 to destroy.Type yes.
In Spotlight, open Delivery and click Triage. On the Station page, Ships through names the Delivery line with line · 1 repository, and a pill under it names your repository. Before the apply it read line · 0 repositories.
Change what Triage's agent is told
Open prompts/<team>/delivery/triage.md, where <team> is the folder named
after your team, and add this line at the end:
Write your note as three short bullet points: what is being asked, what is still unclear, and which station should take it next.Run terraform apply. Again the plan changes only the Delivery line:
Plan: 0 to add, 1 to change, 0 to destroy.Type yes.
Reload the Station page. The prompt now ends with your line.
Commit:
git commit -am "Ask Triage for a note in three points"Watch Triage follow the change
On the Delivery board, click Backlog, then + beside it. In Task title, enter:
Say what the project is for at the top of the READMEClick Create task. Tick the task, and click Move to Triage.
Open the task and click the Triage row under Activity. Click what the agent was told, at the top of the run, to unfold it: Triage's instructions now end with your line, just before your task. Notice the agent reading your repository as it works.
When the agent finishes, its note is three bullet points: what is asked, what is unclear, and which station should take it next.
Usually the agent passes the task on to Spec, where another agent starts on it. If it asks a question instead, answer it in the inbox. Then open the task and, under Properties, choose Completed to close it. Spotlight stops any agent still working on it.
What you built
Your team's factory is now a Terraform configuration in a repository, with a commit for each change. Delivery works on your code, and Triage writes the note you asked for.
From here:
- Let the agent write your team's first Terraform has the agent adapt every station to the team's code and tools, as a pull request.
- Run Terraform from GitHub Actions without a stored token plans every pull request to the repository and applies what is merged.
- Change a line's stations changes, adds and removes stations.
- The software factory explains why the factory is kept as code.