

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用持續現代化
<a name="ct-working-with"></a>

## 來源管理
<a name="ct-source-management"></a>

使用 `atx ct source` 命令來連接儲存庫。支援的提供者：GitHub、GitLab、Bitbucket、local。

### GitHub 組織
<a name="ct-source-github"></a>

權杖：具有`repo`範圍的個人存取權杖 （傳統）。用於分析的唯讀、用於修復的完整儲存庫。

```
atx ct source add --name {{name}} --provider github --org {{org}} --token {{pat}}
```

### GitLab 群組和使用者
<a name="ct-source-gitlab"></a>

權杖：具有`api`範圍的個人存取權杖。

```
atx ct source add --name {{name}} --provider gitlab --org {{group-or-user}} --token {{pat}}
# Self-hosted:
atx ct source add --name {{name}} --provider gitlab --org {{group-or-user}} --token {{pat}} --url https://{{gitlab.example.com}}
```

### Bitbucket 工作空間和專案
<a name="ct-source-bitbucket"></a>

Bitbucket Cloud — 範圍：`read:repository:bitbucket`、`write:repository:bitbucket`、`read:pullrequest:bitbucket`、`write:pullrequest:bitbucket`。也需要 `--email`和 `--username`。

```
atx ct source add --name {{name}} --provider bitbucket --org {{workspace}} --token {{api-token}} --email {{email}} --username {{username}}
```

Bitbucket 資料中心：

```
atx ct source add --name {{name}} --provider bitbucket --org {{project-key}} --token {{http-access-token}} --url https://{{bitbucket.example.com}}
```

### 本機儲存庫
<a name="ct-source-local"></a>

```
atx ct source add --name {{name}} --provider local --path {{parent-directory}}
```

**重要**  
`--path` 必須指向包含 git 儲存庫的父目錄作為子目錄，而不是單一儲存庫。

### 管理來源
<a name="ct-managing-sources"></a>

```
atx ct source list
atx ct source remove --name {{name}}
```

## 儲存庫探索和管理
<a name="ct-repository-discovery"></a>

```
atx ct discovery scan --source {{name}}
atx ct discovery status --source {{name}}
atx ct discovery scan --source {{name}} --path {{new-directory}}
```

探索後：

```
atx ct repository list
atx ct repository list --source {{name}}
atx ct repository list --labels "{{team:frontend,priority:high}}"
atx ct repository update --source {{name}} --repo "{{source}}::{{slug}}" --labels "{{team:frontend,priority:high}}"
atx ct repository update --source {{name}} --labels "{{migration:wave-1}}"
```

## 執行分析
<a name="ct-running-analysis"></a>

`--type` 旗標指定要執行的分析類型：
+ `rapid-techdebt-analysis` – 過時的相依性和輕鬆獲勝。
+ `tech-debt-comprehensive` – 更深入的 AI 驅動分析，涵蓋相依性、安全性、模式、效能、可維護性、架構、程式碼品質和基礎設施問題清單。
+ `security` – 安全漏洞和暴露。
+ `agentic-readiness` – AI 代理器儲存庫的準備程度 （架構、APIs、文件）。
+ `modernization-readiness` – 跨基礎設施、應用程式、資料、安全性和操作維度的現代化機會。

```
atx ct analysis run --type {{type}} --source {{name}} [--repo {{source}}::{{slug}}] [--wait]
atx ct analysis get --id {{id}} --json
atx ct analysis list --json
atx ct analysis list --status {{pending|running|complete|cancelled|failed}} --json
atx ct analysis list --type {{type}} --json
atx ct analysis cancel --id {{id}}
atx ct analysis delete --id {{id}} [--cascade-findings]
```

### 自訂分析
<a name="ct-custom-analysis"></a>

```
atx ct analysis run --type custom --transformation-name {{name}} --source {{source}} --repo {{source}}::{{slug}} --wait
```

具有`-g`旗標的組態：金鑰值、JSON 或檔案路徑。

列出 TDs： `atx custom def list`

## 管理調查結果
<a name="ct-managing-findings"></a>

```
atx ct findings list --json
atx ct findings list --repo {{source}}::{{slug}} --source {{name}} --severity {{high|medium|low}} --type {{analysis-type}} --status {{open|dismissed|obsolete}} --analysis-id {{id}} --fix-transform {{transform-name}} --json
```

### 尋找狀態
<a name="ct-finding-statuses"></a>
+ `open` — 作用中
+ `dismissed` — 手動關閉 （需要原因）
+ `obsolete` — 重新分析不再產生問題清單時的系統集

```
atx ct findings update --id {{id}} --status dismissed --reason "{{reason}}"
atx ct findings update --id {{id}} --status open
atx ct findings batch-update --ids {{id1}},{{id2}} --status dismissed --reason "{{reason}}"
atx ct findings get --id {{id}}
atx ct findings delete --id {{id}}
```

### 尋找淘汰
<a name="ct-finding-obsolescence"></a>

重新分析會將已解決的問題清單標記為已淘汰。無法重新開啟。保留以供稽核。

## 建立修復
<a name="ct-creating-remediations"></a>

三種模式：以問題清單為基礎、TD 覆寫、直接 TD。

```
atx ct remediation create --ids {{id1}},{{id2}} --name "{{name}}"
atx ct remediation create --ids {{id1}},{{id2}} --transformation-name {{TD}}
atx ct remediation create --transformation-name {{TD}} --repo {{source}}::{{slug}}
```

提供者輸出：GitHub PR、GitLab MR、Bitbucket PR、Local 分支。

**注意**  
權杖必須具有寫入存取權才能建立 PR/MR。

具有 `--local` 旗標的本機執行。

```
atx ct remediation create --transformation-name {{TD}} --repo {{source}}::{{slug}} -g "{{additionalPlanContext=Upgrade to Node.js 22}}"
atx ct remediation list
atx ct remediation status --id {{id}}
atx ct remediation retry --id {{id}}
atx ct remediation delete --id {{id}}
```

## AWS 轉換 Web 應用程式 （選用）
<a name="ct-web-application"></a>

 AWS 轉換 Web 應用程式是選擇性的界面，用於監控整個程式碼來源產品組合的持續現代化分析、調查結果和修復。

在使用 AWS 轉換 Web 應用程式之前，您需要啟用使用者身分，才能存取組織中的 AWS 轉換。如需啟用 AWS 轉換的相關資訊，請參閱[設定 AWS 轉換](https://docs.aws.amazon.com/transform/latest/userguide/transform-setup.html)。

若要使用 AWS 轉換 Web 應用程式：

1. 請造訪 `https://aws.amazon.com/transform/` 並使用 AWS IAM Identity Center 登入資料登入。

1. 如果持續現代化在您登入後未出現，請改用 IAM 登入資料登入。若要啟用 IAM 登入資料登入：

   1. 在 AWS 管理主控台中，開啟 AWS 轉換，然後選擇**設定**。

   1. 在**使用 IAM 登入資料進行存取 AWS 轉換**區段中，啟用 IAM 登入資料存取。

   1. 在相同的設定頁面上，複製 **Web 應用程式 URL （使用 IAM) **下顯示的登入連結。

   1. 將登入 URL 貼到開啟 管理主控台的 AWS 同一個瀏覽器視窗。這可確保 Web 應用程式使用該帳戶的 AWS 登入資料。

1. 開啟左側導覽選單，然後選擇**持續現代化**。儀表板會顯示摘要統計資料，包括來源、儲存庫、依嚴重性區分的問題清單總數和分析類型。

1. 使用**分析**、**調查結果**和**修復**索引標籤來檢視詳細結果。

1. 直接從 Web 應用程式與 AWS Transform 聊天，詢問有關分析、問題清單或修復的問題。

Web 應用程式專為企業規模操作而設計，您需要集中掌握多個程式碼庫的持續現代化分析和修復。