Skip to content

Commit c8768e1

Browse files
authored
Timng/add squad (#23)
* Add coding notes * AppMod agent test * Add squad
1 parent 6c637db commit c8768e1

61 files changed

Lines changed: 6237 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.appmod-kit/scripts/powershell/assess.ps1

Lines changed: 508 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#!/usr/bin/env pwsh
2+
# Script to support the /create-plan command
3+
[CmdletBinding(PositionalBinding = $false)]
4+
param(
5+
[switch]$Json,
6+
[string]$ShortName,
7+
[string]$GitHubIssueURI,
8+
[switch]$Help,
9+
[Parameter(ValueFromRemainingArguments = $true)]
10+
[string[]]$FeatureDescription
11+
)
12+
13+
$ErrorActionPreference = 'Stop'
14+
15+
if (-not $ShortName -or $ShortName.Count -eq 0) {
16+
Write-Error "Usage: ./create-plan.ps1 [-Json] -ShortName <name> [-GitHubIssueURI <uri>]<feature description>"
17+
Write-Error "-ShortName is required."
18+
Write-Error "A concise short name (5-10 words) that describes the modernization intent, e.g., 'modernize-complete-application'"
19+
exit 1
20+
}
21+
22+
# Find the github issue if any
23+
if ($GitHubIssueURI) {
24+
$gitHubIssueToUse = $GitHubIssueURI
25+
} elseif ($env:GITHUB_ISSUE_URI) {
26+
$gitHubIssueToUse = $env:GITHUB_ISSUE_URI
27+
} else {
28+
$gitHubIssueToUse = $null
29+
}
30+
31+
$repoRoot = (Get-Location).Path
32+
Set-Location $repoRoot
33+
34+
# Create the modernization directory path
35+
$modernizationDir = Join-Path -Path $repoRoot -ChildPath ".github" | Join-Path -ChildPath "modernization"
36+
# Ensure .github/modernization directory exists
37+
if (-not (Test-Path -Path $modernizationDir)) {
38+
New-Item -ItemType Directory -Path $modernizationDir -Force | Out-Null
39+
}
40+
41+
# Find the next available number by examining existing folders
42+
$existingFolders = Get-ChildItem -Path $modernizationDir -Directory | Where-Object { $_.Name -match '^\d{3}-' }
43+
$nextNumber = 1
44+
if ($existingFolders.Count -gt 0) {
45+
$existingNumbers = $existingFolders | ForEach-Object {
46+
if ($_.Name -match '^(\d{3})-') {
47+
[int]$matches[1]
48+
}
49+
} | Sort-Object
50+
$nextNumber = ($existingNumbers | Measure-Object -Maximum).Maximum + 1
51+
}
52+
53+
# Format the number with leading zeros (3 digits)
54+
if ($nextNumber -eq $null -or $nextNumber -eq 0) {
55+
$nextNumber = 1
56+
}
57+
$featureNum = $nextNumber.ToString().PadLeft(3, '0')
58+
59+
# Create the branch name with featurenum prefix
60+
$branchSuffix = $ShortName.ToLower() -replace '[^a-z0-9]', '-' -replace '-{2,}', '-' -replace '^-', '' -replace '-$', ''
61+
$branchName = "$featureNum-$branchSuffix"
62+
63+
# GitHub enforces a 244-byte limit on branch names
64+
# Validate and truncate if necessary
65+
$maxBranchLength = 244
66+
if ($branchName.Length -gt $maxBranchLength) {
67+
# Calculate how much we need to trim from suffix
68+
# Account for: feature number (3) + hyphen (1) = 4 chars
69+
$maxSuffixLength = $maxBranchLength - 4
70+
71+
# Truncate suffix
72+
$truncatedSuffix = $branchSuffix.Substring(0, [Math]::Min($branchSuffix.Length, $maxSuffixLength))
73+
# Remove trailing hyphen if truncation created one
74+
$truncatedSuffix = $truncatedSuffix -replace '-$', ''
75+
76+
$originalBranchName = $branchName
77+
$branchName = "$featureNum-$truncatedSuffix"
78+
79+
Write-Warning "[appmod-kit] Branch name exceeded GitHub's 244-byte limit"
80+
Write-Warning "[appmod-kit] Original: $originalBranchName ($($originalBranchName.Length) bytes)"
81+
Write-Warning "[appmod-kit] Truncated to: $branchName ($($branchName.Length) bytes)"
82+
}
83+
84+
# Create the branch
85+
# If it fails, just ignore and continue
86+
try {
87+
git checkout -b $branchName | Out-Null
88+
} catch {
89+
Write-Warning "Failed to create git branch: $branchName"
90+
}
91+
92+
# Create the folder for plan specs in .github/modernization/<next-number>-<branch-name>
93+
94+
$planDir = Join-Path -Path $modernizationDir -ChildPath $branchName
95+
if (-not (Test-Path -Path $planDir)) {
96+
New-Item -ItemType Directory -Path $planDir | Out-Null
97+
}
98+
99+
# Set the environment variable for the current session
100+
$env:APPMODKIT_FEATURE_BRANCH = $branchName
101+
102+
# Output results
103+
if ($Json) {
104+
$output = @{}
105+
if ($gitHubIssueToUse) {
106+
$output.GitHubIssueURI = $gitHubIssueToUse
107+
}
108+
$output.BranchName = $branchName
109+
$output.PlanFolderName = ".github/modernization/$branchName"
110+
Write-Output ($output | ConvertTo-Json -Compress)
111+
} else {
112+
if ($gitHubIssueToUse) {
113+
Write-Output "GITHUB_ISSUE_URI: $gitHubIssueToUse"
114+
}
115+
Write-Output "BRANCH_NAME: $branchName"
116+
Write-Output "PLAN_FOLDER_NAME: .github/modernization/$branchName"
117+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/usr/bin/env pwsh
2+
# Script to support the /run-plan command
3+
[CmdletBinding(PositionalBinding = $false)]
4+
param(
5+
[switch]$Json,
6+
[string]$GitHubIssueURI,
7+
[switch]$Help,
8+
[Parameter(ValueFromRemainingArguments = $true)]
9+
[string[]]$FeatureDescription
10+
)
11+
12+
$ErrorActionPreference = 'Stop'
13+
14+
function Find-PlanLocation {
15+
16+
# Find the repository root
17+
$repoRoot = (Get-Location).Path
18+
19+
$modernizationDir = Join-Path -Path $repoRoot -ChildPath ".github" | Join-Path -ChildPath "modernization"
20+
if (-not (Test-Path -Path $modernizationDir)) {
21+
return $null
22+
}
23+
24+
# Find all plan folders (format: ###-branch-name)
25+
$planFolders = Get-ChildItem -Path $modernizationDir -Directory | Where-Object { $_.Name -match '^\d{3}-' }
26+
27+
if ($planFolders.Count -eq 0) {
28+
return $null
29+
}
30+
31+
# Return the latest plan based on folder prefix (highest number)
32+
$sortedFolders = $planFolders | Sort-Object { [int]($_.Name -replace '^(\d{3})-.*', '$1') } -Descending
33+
foreach ($folder in $sortedFolders) {
34+
$planFile = Join-Path -Path $folder.FullName -ChildPath "plan.md"
35+
if (Test-Path -Path $planFile) {
36+
return [System.IO.Path]::GetRelativePath($repoRoot, $planFile)
37+
}
38+
}
39+
40+
return $null
41+
}
42+
43+
# Find the github issue if any
44+
if ($GitHubIssueURI) {
45+
$gitHubIssueToUse = $GitHubIssueURI
46+
} elseif ($env:GITHUB_ISSUE_URI) {
47+
$gitHubIssueToUse = $env:GITHUB_ISSUE_URI
48+
} else {
49+
$gitHubIssueToUse = $null
50+
}
51+
52+
# Find the plan location
53+
$planLocation = Find-PlanLocation
54+
55+
# Output results
56+
if ($Json) {
57+
$output = @{}
58+
if ($gitHubIssueToUse) {
59+
$output.GitHubIssueURI = $gitHubIssueToUse
60+
}
61+
if ($planLocation) {
62+
$output.PlanLocation = $planLocation
63+
}
64+
Write-Output ($output | ConvertTo-Json -Compress)
65+
} else {
66+
if ($gitHubIssueToUse) {
67+
Write-Output "GITHUB_ISSUE_URI: $gitHubIssueToUse"
68+
}
69+
if ($planLocation) {
70+
Write-Output "PLAN_LOCATION: $planLocation"
71+
}
72+
}
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Modernization Plan
2+
3+
**Branch**: `[BRANCH-NAME]` | **Date**: [DATE] | **Github Issue**: [link]
4+
5+
> NOTE: Generation metadata and instructional sections must be stripped before saving the final plan.
6+
7+
This template is filled in by the `/appmod-kit.create-plan` command.
8+
9+
---
10+
11+
## HOW-TO-GENERATE (DO NOT PERSIST)
12+
13+
1) **Modernization Goal**: Summarize the customer’s stated modernization objective; must be singular and unambiguous.
14+
2) **Scope**: The section describe the modernization scope type that the generated plan will cover. DO NOT Generate plan out of scope type described in **Scope**.
15+
3) **Application Information**: According to the input project information, describe the current architecture.
16+
4) **Clarification**: You will read the plan project information and knowledge base to make a plan, if you still have some open issue to make a plan, add clarification in this section.
17+
5) **Target Architecture**: According to project information and knowledge base for modernization, generate the target architecture of the project.
18+
6) **Task Breakdown and Dependencies**: According to **Target Architecture**, **Task breakdown rules**, break the task list for modernization, the modernization task MUST be scope according to **Scope**.
19+
20+
## Modernization Goal
21+
22+
Analyze user input and the content of mentioned files to identify the modernization goal.
23+
Describe the customer modernization goal of the application here, e.g.,Migrate the project to Azure Container Apps (from user input)
24+
Ensure that the application's modernization goal is unambiguous; for instance, the target service must be unique.
25+
26+
## Scope
27+
28+
This section described the scope that the modernization plan can cover.
29+
30+
According to the provided project information, user's request and the content of mentioned files, summarize the scope for modernization and the source that scope based on, the scope should be only related with code change and the scope type will be one of belows:
31+
32+
1. Upgrade the application framework, e.g., JDK upgrade, Spring Framework upgrade
33+
2. Migrate source code from using X to using Y, X is an on-premise/aws resource and Y is an Azure resource
34+
3. Containerize the application
35+
4. Generate deployment files
36+
37+
Example:
38+
1. Java Upgrade
39+
- JDK (11 → 17) [based on the global constitution request]
40+
- Spring Boot (2.5 → 3.x) [based on the user request]
41+
2. Migration To Azure
42+
- Migrate messaging from ActiveMQ to Azure Service Bus [based on the assess report]
43+
- Migrate secrets to Azure Key Vault [based on the assess report]
44+
45+
## References
46+
47+
If user input mentioned files that contain rules that migration tasks should reference, put the reference file path here. Do not summarize the content of the file in the file description.
48+
If user input mentioned github issue url for the migration, put the url here. Do not summarize the content of the issue in the description.
49+
If there is no such kind of file or url mentioned, do not include this section.
50+
51+
Example:
52+
53+
- `../../modernization/constitution.md` - Contains the global migration requirement
54+
- `https://github.com/abc/my-container-app/issues/35` - Migration issue to be updated
55+
56+
## Azure Environment
57+
Describe the Azure environment information if user provided the information in the input, including:
58+
1) Subscription ID
59+
2) Resource Group
60+
If there is no such kind of information provided, do not include this section.
61+
62+
## Application Information
63+
64+
### Current Architecture
65+
66+
According to the input project, describe the application architecture with diagram of mermaid, including:
67+
68+
1) Application framework information
69+
2) Resource/Services dependencies
70+
3) Connector framework to the dependencies
71+
72+
## Clarification
73+
74+
Before you make a target architecture and Task Breakdown for next sections, list all the open issues you need to clarify with user as a list with format as below:
75+
76+
1) Open issue 1: [Describe the issue here]
77+
- Answer: [User Answer]
78+
- Status: Solved
79+
80+
All the open issues should be related with task breakdown for code change, NOT list the issue with infra.
81+
82+
The open issues is possible be:
83+
84+
1) You don't have enough information to clarify if this issue is a really issue
85+
2) There are multiple solutions for the same issue and the solutions are conflict, and you don't have enough information to decide solution you need to choose
86+
87+
This section is not mandatory, just leave if empty if no open issues
88+
89+
## Target Architecture
90+
91+
Define the target architecture for modernization with diagram of mermaid, according to the project information and scope for modernization, including:
92+
93+
1) Application framework information
94+
2) Target Resource/Services dependencies
95+
3) Connector framework to the dependencies
96+
97+
## Task Breakdown
98+
99+
> NOTE: This task list will be used by the `/appmod-kit.run-plan` command to execute the modernization. Do not hallucinate the steps or changes of these tasks which may misleading the user.
100+
101+
**Task breakdown rules**:
102+
1) Make a task breakdown for this iteration of migration according to **`Goal`**, **`Scope`**. Always respect user intent, pickup solutions according to user input.
103+
2) If there is any open issues to make the task, add your open issues to the section of clarification section, try to add a task with solution to the issue if possible.
104+
3) Migration task MUST be breakdown to target specific azure service.
105+
4) DO NOT describe the implementation details in the task breakdown, just give a high level description of what the task will do.
106+
5) ONLY have one deploy task if user requested to generate deployment files or deploy the application. If deploy task is added, DO NOT add containerize task since it is included in deploy task.
107+
6) For task migration from X to Y, you need to find a solution id from the knowledge base of modernization, each solution will complete all the code/configuration changes needed for the migration from X to Y, so you just need to find the right solution id to cover the migration from X to Y.
108+
7) If there is no solution id to cover the migration from X to Y, you need to add warning "Migration from X to Y is not supported." in the scope section. And do not add the migration task to the task list.
109+
8) ONLY deployment task needn't the solution id. Else task MUST have the solution id or be excluded. The solution id MUST from the knowledge base of modernization.
110+
9) Rules to Upgrade Java - **CRITICAL: Avoid Creating Duplicate Tasks**
111+
      - The latest version of Java is above 17, the latest of Spring Boot is above 3 and the latest Spring Framework is above 6
112+
      - **Choose the right upgrade solution id set and avoid duplicate work in solution. If solution A contains solution B, only pick solution A.**
113+
        - **If Spring Boot is asked to upgrade to 3.x or above without explicitly requesting Java 21 or above:**
114+
            - **DO NOT create separate tasks** for: JDK upgrade, Spring Framework upgrade, or Jakarta EE upgrade
115+
            - **ONLY create ONE task: "Upgrade Spring Boot to 3.x"**
116+
            - In the task description, explicitly state that it includes: upgrading JDK to 17, Spring Framework to 6.x, and migrating from JavaEE (javax.*) to Jakarta EE (jakarta.*)
117+
        - **If Spring Framework is asked to upgrade to 6.x or above (without Spring Boot upgrade) without explicitly requesting Java 21 or above:**
118+
            - **DO NOT create a separate task** for: JDK upgrade
119+
            - **ONLY create ONE task: "Upgrade Spring Framework to 6.x"**
120+
            - In the task description, explicitly state that it includes: upgrading JDK to 17
121+
        - **If JDK upgrade is explicitly requested with version 21 or above:**
122+
            - Create a task: "Upgrade Java to version X"
123+
10) If the JDK version is under 17, you should add task to upgrade the JDK to latest version unless user specified not to do it.
124+
11) Rules to pickup solution
125+
1. If there is a managed identity solution to connect a resource, choose the managed identity solution. Otherwise, if Key Vault is explicitly requested, use the Key Vault to manage the credentials.
126+
2. If Oracle is found, PostgreSQL will be the preferred migration target.
127+
11) The tasks MUST be one of below type and follow this sequence:
128+
1. Java Upgrade
129+
2. Migration to Azure (Migration from X to Y)
130+
3. Containerize (Generate Dockerfile and related file; DO NOT add this task if deploy task is added)
131+
4. Deploy (Generate deployment files and deploy the application)
132+
12) For task type Migration to Azure, follow the below sequence
133+
1. Migration except the below solutions
134+
2. Azure keyvault related migration if migration task for azure key vault is required
135+
3. Managed Identity related solution
136+
4. Telemetry related migration like log and application insight if it is requried
137+
138+
Example:
139+
1) Task name: Upgrade JDK to 17
140+
- Task Type: Java Upgrade
141+
- Description: Move build/runtime to JDK 17
142+
- Solution Id: java-version-upgrade
143+
144+
2) Task name: Migration from X to Y
145+
- Task Type: Migration To Azure
146+
- Description: [The issue to be solve by the task]
147+
- Solution Id: id1
148+
149+
The solution ID must be from knowledge base and NEVER fake a solution id

.copilot/mcp-config.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"mcpServers": {
3+
"EXAMPLE-trello": {
4+
"command": "npx",
5+
"args": [
6+
"-y",
7+
"@trello/mcp-server"
8+
],
9+
"env": {
10+
"TRELLO_API_KEY": "${TRELLO_API_KEY}",
11+
"TRELLO_TOKEN": "${TRELLO_TOKEN}"
12+
}
13+
}
14+
}
15+
}

.gitattributes

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,9 @@ docker-compose.yml text
132132
# Export ignore (files not included in export/archive)
133133
.gitattributes export-ignore
134134
.gitignore export-ignore
135-
.github export-ignore
135+
.github export-ignore
136+
# Squad: union merge for append-only team state files
137+
.squad/decisions.md merge=union
138+
.squad/agents/*/history.md merge=union
139+
.squad/log/** merge=union
140+
.squad/orchestration-log/** merge=union
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
name: appmod-kit-azure-deploy-developer
3+
description: orchestrated by coordinate agent to deploy this application to Azure
4+
---
5+
6+
You are a professional azure deploy developer focused on deploy the application to azure.
7+
Steps to complete deploy task:
8+
1. Scan the project carefully to identify all Azure-relevant resources, programming languages, frameworks, dependencies, and configuration files needed for deployment.
9+
2. Develop a deploy plan WITH TOOL #appmod-get-plan.
10+
3. Execute the deploy plan.
11+
4. Make a commit when deploy task is completed.
12+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: appmod-kit-java-migration-code-developer
3+
description: orchestrated by coordinate agent to finish a migration task given a knowledge base id known as solution id
4+
---
5+
6+
You are a Java developer focused on migrating the code to Azure. You will be given a task knowledge base ID and run the task according to the knowledge base ID, known as solution id
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: appmod-kit-java-upgrade-code-developer
3+
description: orchestrated by coordinate agent to finish upgrade of java
4+
---
5+
6+
An agent to run a specific task to upgrade the JDK, it can upgrade the JDK and SpringBoot version, normally it will be called as "upgrade the jdk/framework from X to Y".

0 commit comments

Comments
 (0)