

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 进行持续的现代化改造
<a name="ct-working-with"></a>

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

使用`atx ct source`命令连接存储库。支持的提供商： GitHub、 GitLab、Bitbucket、本地。

### GitHub 组织
<a name="ct-source-github"></a>

令牌：带`repo`范围的个人访问令牌（经典）。 Read-only 为了进行分析，请使用完整存储库进行修复。

```
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-powered 分析，涵盖依赖关系、安全性、模式、性能、可维护性、架构、代码质量和基础架构发现。
+ `security`— 安全漏洞和风险敞口。
+ `agentic-readiness`— 您的存储库已准备就绪，可供人工智能代理（框架、API、文档）使用。
+ `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 或文件路径。

列出 TD：`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`— System-set 当重新分析不再得出发现结果时

```
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>

Re-analysis 将已解决的发现标记为已过时。无法重新打开。保留以供审计。

## 创建补救措施
<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>

Trans AWS form Web 应用程序是一个可选界面，用于监控整个代码源组合中的持续现代化分析、发现和修复。

在使用 Tr AWS ansform Web 应用程序之前，您需要启用用户身份才能在组织中访问 T AWS ransform。有关启用 AWS 转换的信息，请参阅[设置 AWS 转换](https://docs.aws.amazon.com/transform/latest/userguide/transform-setup.html)。

要使用 AWS 转换 Web 应用程序，请执行以下操作：

1. 使用 AWS IAM 身份中心证书访问`https://aws.amazon.com/transform/`并登录。

1. 如果登录后未出现持续现代化，请改用 IAM 凭证登录。要启用 IAM 证书登录，请执行以下操作：

   1. 在 AWS 管理控制台中，打开 “ AWS 转换”，然后选择 “**设置”**。

   1. 在 “**使用 IAM 凭证进行访问 AWS 转换**” 部分中，启用 IAM 凭证访问权限。

   1. 在同一设置页面上，复制 **Web 应用程序 URL（使用 IAM）下方显示的**登录链接。

   1. 将登录 URL 粘贴到打开 AWS 管理控制台的同一浏览器窗口中。这样可以确保 Web 应用程序使用该账户的 AWS 凭证。

1. 打开左侧导航菜单并选择**持续现代化**。控制面板显示摘要统计信息，包括来源、存储库、按严重性划分的发现总数以及分析类型。

1. 使用 “**分析**”、“**发现结果**” 和 **“修复**” 选项卡查看详细结果。

1. 直接通过 Web 应用程序与 T AWS ransform 聊天，询问有关您的分析、发现或补救措施的问题。

Web 应用程序专为企业级运营而设计，在这些运营中，您需要集中查看跨多个代码库的持续现代化分析和修复。