code-assessment
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAEM as a Cloud Service — Code Assessment
AEM as a Cloud Service — 代码评估
Single skill for detecting and fixing AEM CS code-quality issues, entirely against the local workspace — no external services or network calls. Findings reach the runbook from one of two sources; everything downstream is identical.
用于检测和修复AEM CS代码质量问题的独立工具,完全基于本地工作区运行——无需外部服务或网络调用。检测结果来自两个来源之一;后续处理流程完全一致。
Findings sources
检测结果来源
| Source | When | Target versions (deps) |
|---|---|---|
| User-named | the user names files or coordinates | user-supplied |
| Discover | the user asks to scan, or names no files | user-supplied (per the pattern's resolution contract) |
Discovery runs through the deterministic analyzer ():
it parses the workspace once and runs the enabled detectors, emitting the shared findings shape.
Every pattern has an analyzer detector. One detector — — loads
its rules dynamically from a preflight-produced cache
( runs the
AEM Analyser Maven Plugin and writes the cache TSV before the analyzer is invoked); the
detector's shape and integration are otherwise identical. Patterns without a detector are
only — not yet detectable and not yet built; there is no LLM-scan fallback in this
version (see Scope & limitations) — the value on rows in
marks the intended future detection method,
not an active code path.
scripts/analyze.shreadyremove-deprecated-apiremove-deprecated-api/scripts/detect.shplannedscanplannedreferences/patterns.md| 来源 | 触发场景 | 目标版本(依赖) |
|---|---|---|
| 用户指定 | 用户明确指定文件或坐标 | 用户提供的内容 |
| 自动发现 | 用户要求扫描仓库,或未指定任何文件 | 用户提供的内容(遵循模式解析规则) |
自动发现通过确定性的analyzer()执行:
它会解析一次工作区并运行已启用的detector,输出统一格式的检测结果。
每个状态的模式都对应一个analyzer detector。其中一个detector————会从预生成的缓存中动态加载规则(在调用analyzer之前,会运行AEM Analyser Maven Plugin并将缓存写入TSV文件);除此之外,该detector的格式和集成方式与其他detector完全一致。没有对应detector的模式仅处于状态——暂无法检测和实现;当前版本没有LLM扫描 fallback(参见范围与限制)——中行的值标记的是未来计划的检测方式,而非当前可用的代码路径。
scripts/analyze.shreadyremove-deprecated-apiremove-deprecated-api/scripts/detect.shplannedreferences/patterns.mdplannedscanRouting
路由规则
- User named files / coordinates → run the runbook in mode against those paths.
with_findings - "Scan my repo" / no files named → run the runbook in mode (per-pattern Discovery, workspace roots only).
discover
Then follow the runbook: .
references/runbook.md- 用户指定文件/坐标 → 针对指定路径以模式运行流程手册。
with_findings - “扫描我的仓库”/未指定文件 → 以模式运行流程手册(按模式自动发现,仅针对工作区根目录)。
discover
随后遵循流程手册:。
references/runbook.mdManual Pattern Hints (classification → expert skill)
手动模式提示(分类→专业工具)
Route the request to one expert skill. Two pattern families share this skill:
Mechanical fixes (analyzer-driven detection, deterministic edits — follow the runbook flow):
| User said / saw | Expert skill |
|---|---|
"update aem sdk", "upgrade mockito", stale | |
"fix @Inject", "modernize Sling Models", | |
"add HTTP timeouts", "outbound/external call has no timeout", | |
"bound my query", "unbounded query", "query causing OOM", | |
"remove deprecated API", "fix deprecated imports", "Cloud Manager deprecated API failure", | |
Architectural migration patterns (guided remediation — full before/after, troubleshooting, modern alternatives; invoked directly or via for BPA/CAM-driven discovery):
migration| User said / saw | Expert skill | BPA pattern ID |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
HTL build warning | | |
Broad / correctness-review asks ("check my Sling Models are implemented correctly", "review my code", "is my AEM project healthy", "assess this project") are not a single pattern: run the runbook in mode with intent — the analyzer runs every detector and the report covers all built patterns, explicitly noting aspects not yet supported. Only narrow to one pattern when the user targets a specific fix.
discoverreportIf nothing matches, say the issue is not yet supported and offer to file a request for a new expert skill.
Full catalog (built + patterns, with severity / detection / fix): .
plannedreferences/patterns.md将请求路由至对应的专业工具。两类模式共用本工具:
机械修复(基于analyzer的检测,确定性修改——遵循流程手册流程):
| 用户需求/场景 | 专业工具 |
|---|---|
"更新aem sdk"、"升级mockito"、pom文件中过时的 | |
"修复@Inject"、"现代化Sling Models"、 | |
"添加HTTP超时"、"外部调用无超时设置"、未配置超时的 | |
"限制查询范围"、"无界查询"、"查询导致内存溢出"、 | |
"移除废弃API"、"修复废弃导入"、"Cloud Manager废弃API检查失败"、 | |
架构迁移模式(引导式修复——提供完整的前后对比、故障排查、现代化替代方案;可直接调用或通过工具由BPA/CAM驱动发现):
migration| 用户需求/场景 | 专业工具 | BPA模式ID |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
HTL构建警告 | | |
宽泛/正确性审查请求(“检查我的Sling Models是否实现正确”“审查我的代码”“我的AEM项目是否健康”“评估这个项目”)不属于单一模式:以意图运行模式的流程手册——analyzer会运行所有detector,报告涵盖所有已实现的模式,并明确指出暂不支持的内容。仅当用户针对特定修复需求时,才聚焦到单一模式。
reportdiscover如果没有匹配的模式,请告知用户当前暂不支持该问题,并提供提交新专业工具需求的选项。
完整目录(已实现+模式,包含严重性/检测/修复方式):。
plannedreferences/patterns.mdInvocation from the migration
skill
migration从migration
工具调用
migrationmigration(pattern, file)(pattern, file)migration- Skip HA/analyzer discovery (caller already identified the pattern + file)
- Open the pattern's expert skill directly (per the Manual Pattern Hints table above)
- Apply the steps in the expert skill against the named file(s)
- Return the result; continues with the next finding in its batch
migration
The pattern guides themselves are agnostic about who invoked them — they apply identically whether reached from (BPA/CAM) or from the runbook in this skill (HA / analyzer).
migrationmigration(pattern, file)migration(pattern, file)- 跳过HA/analyzer发现流程(调用方已识别出模式+文件)
- 直接打开对应模式的专业工具(参照上述手动模式提示表格)
- 针对指定文件执行专业工具中的步骤
- 返回结果;工具继续处理批量任务中的下一个检测结果
migration
模式指南本身与调用方无关——无论是从工具(BPA/CAM)还是本工具的流程手册(HA/analyzer)进入,其应用方式完全一致。
migrationRunbook
流程手册
All detection, planning, edits, verification, git/in-place handling, and the run log live in
. The runbook is the sole owner of repo-environment
detection (, git snapshot) — this control plane does not duplicate it.
references/runbook.mdedit_mode所有检测、规划、修改、验证、git/本地处理以及运行日志均存储于
。流程手册是唯一负责仓库环境检测(、git快照)的组件——本控制平面不会重复实现该功能。
references/runbook.mdedit_modeOne pattern per session
单会话单模式
Report may span every pattern found; apply touches one pattern per session (atomic revert,
single-story diff). Refuse "fix everything" for the apply phase. Rationale:
.
references/shared-principles.md报告可涵盖所有检测到的模式;修改阶段单会话仅处理一个模式(原子回滚、单一变更差异)。在修改阶段拒绝“修复所有问题”的请求。理由参见:
。
references/shared-principles.mdCritical rules
核心规则
- Local only — no network calls or external services; operate solely on the workspace.
Documented exception: is plugin-driven and needs Maven Central (to resolve
remove-deprecated-apiand, transitively, the AEM SDK's api-regions data) plus optionally Adobe Experience League as a fallback source for successor guidance. If offline, that one pattern is skipped with a clear message; all other patterns remain local-only.aemanalyser-maven-plugin - Requires a local JDK (Java 11+) for detection — the analyzer compiles/runs in memory; no install beyond the JDK, no network. If absent, detection stops with a clear message.
- The analyzer is detection — never substitute external tooling. Do not run
/
mvn versions:display-dependency-updates,mvn versions:display-property-updates, or Maven Central / registry lookups in place of analyzer discovery. Those answer "what is the latest on the network" — outside this skill's local-only contract. If the user explicitly wants a live registry comparison, say it needs network and offer it as a separate step after delivering the skill report.npm outdated's preflight (remove-deprecated-api) is the one documented exception: it invokes the AEM Analyser Maven Plugin against the project to populate its rules cache, then hands off to the shared analyzer.remove-deprecated-api/scripts/detect.sh - Never commit, push, or open a PR — branch (git) or in-place edits only; the developer reviews and commits.
- Surgical edits — no reformatting / re-serialization.
- Skip with a reason — record un-applicable findings as with an exact reason; never silently drop.
skipped - One pattern per session for apply.
Full rationale: .
references/shared-principles.md- 仅本地运行——无网络调用或外部服务;仅操作本地工作区。
已记录的例外情况:基于插件驱动,需要访问Maven Central(用于解析
remove-deprecated-api以及间接获取AEM SDK的api-regions数据),还可选择Adobe Experience League作为后继方案指导的备用源。如果处于离线状态,该模式会被跳过并显示明确提示;所有其他模式仍保持仅本地运行。aemanalyser-maven-plugin - 需要本地JDK(Java 11+)用于检测——analyzer在内存中编译/运行;除JDK外无需其他安装,无需网络。如果未安装JDK,检测会停止并显示明确提示。
- analyzer是唯一检测方式——绝不替代外部工具。请勿运行/
mvn versions:display-dependency-updates、mvn versions:display-property-updates或访问Maven Central/注册表来替代analyzer发现流程。这些工具回答的是“网络上的最新版本是什么”——超出了本工具“仅本地运行”的约定。如果用户明确需要实时注册表对比,请告知需要网络连接,并在完成本工具报告后提供单独的步骤。npm outdated的预执行阶段(remove-deprecated-api)是唯一已记录的例外:它会针对项目调用AEM Analyser Maven Plugin以填充规则缓存,随后移交至共享analyzer。remove-deprecated-api/scripts/detect.sh - 绝不提交、推送或创建PR——仅支持分支(git)或本地修改;由开发者审查并提交。
- 精准修改——不进行重新格式化/重新序列化。
- 跳过需说明原因——将不适用的检测结果标记为并记录确切原因;绝不静默忽略。
skipped - 修改阶段单会话单模式。
完整理由参见:。
references/shared-principles.mdScope & limitations
范围与限制
Local static detection and remediation only — no external services, no network, no live AEM instance. Issues that require runtime or live-repository state, telemetry, or history across runs are out of scope for this skill.
Detection requires a local JDK (Java 11+); there is no remote or LLM-scan fallback in this version.
A large apply (e.g. an migration across 100+ files) is processed in resumable batches: the run checkpoints each file to and pauses at a per-pass cap, so it survives context limits — reply apply to continue (see ).
@Inject.autofix/last-run.json<pattern>references/git-workflow.md仅支持本地静态检测与修复——无外部服务、无网络、无实时AEM实例。需要运行时或实时仓库状态、遥测数据或跨运行历史的问题不在本工具的范围内。
检测需要本地JDK(Java 11+);当前版本无远程或LLM扫描 fallback。
大规模修改(例如在100+文件中迁移)会以可恢复批次处理:运行时会将每个文件的检查点保存至,并在每次处理达到上限时暂停,以避免超出上下文限制——回复**apply **即可继续(参见)。
@Inject.autofix/last-run.json<pattern>references/git-workflow.mdAdding a new pattern
添加新模式
Full end-to-end procedure — detector → fixtures/tests → catalog + routing → expert skill → verify:
. The test keeps the
detector, catalog row, and expert-skill directory in sync.
references/adding-a-pattern.md[wiring]Triggering scales without touching the description. The above is intentionally
broad (intent verbs + AEM domain), so it already fires on "check / review / fix my <AEM thing>";
a new pattern is reached by its Manual Pattern Hints + rows, not by editing the
description. Update the description only if the new pattern introduces a domain keyword it does
not already cover (a new subsystem or file type). The test keeps the detector, catalog
row, and expert-skill directory in sync.
descriptionpatterns.md[wiring]完整的端到端流程——detector→测试用例→目录+路由→专业工具→验证:
。测试用于确保detector、目录行和专业工具目录保持同步。
references/adding-a-pattern.md[wiring]触发逻辑无需修改描述即可扩展。上述故意设计得较为宽泛(意图动词+AEM领域),因此已能响应“检查/审查/修复我的<AEM组件>”这类请求;新模式通过手动模式提示+行触发,无需修改描述。仅当新模式引入了描述中未涵盖的领域关键词(新子系统或文件类型)时,才需要更新描述。测试用于确保detector、目录行和专业工具目录保持同步。
descriptionpatterns.md[wiring]Related skills
相关工具
- — drives BPA/CAM/MCP-based legacy-AEM migration workflow. Discovers findings, batches them, enforces one-pattern-per-session, and hands off
migrationpairs to this skill for transformation. See the "Invocation from the(pattern, file)skill" section above.migration
- ——驱动基于BPA/CAM/MCP的旧版AEM迁移工作流。发现检测结果、批量处理、强制执行单会话单模式,并将
migration对移交至本工具进行转换。参见上述“从(pattern, file)工具调用”部分。migration