ln-830-code-modernization-coordinator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaths: File paths (,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.../ln-*
路径说明: 文件路径(、shared/、references/)均相对于技能仓库根目录。如果在当前工作目录未找到,请定位到本SKILL.md所在目录,再向上一级即可到达仓库根目录。../ln-*
ln-830-code-modernization-coordinator
ln-830-code-modernization-coordinator
Type: L2 Domain Coordinator
Category: 8XX Optimization
Coordinates code modernization by delegating to L3 workers: ln-831 (OSS replacer) and ln-832 (bundle optimizer). Executes migration plans from 6XX audit findings.
类型: L2 领域协调器
分类: 8XX 优化类
通过调度L3级Worker(ln-831:OSS替换工具、ln-832:包体积优化工具)来协调代码现代化工作,执行来自6XX审计结果的迁移计划。
Overview
概述
| Aspect | Details |
|---|---|
| Input | Audit report (ln-645 migration plan) OR target module |
| Output | Modernized codebase with verification proof |
| Workers | ln-831 (OSS replacer), ln-832 (bundle optimizer) |
| 维度 | 详情 |
|---|---|
| 输入 | 审计报告(ln-645迁移计划)或目标模块 |
| 输出 | 已完成现代化改造的代码库及验证证明 |
| 关联Worker | ln-831(OSS替换工具)、ln-832(包体积优化工具) |
Workflow
工作流程
Phases: Pre-flight → Analyze Input → Delegate → Collect → Verify → Report
阶段: 预检 → 输入分析 → 任务调度 → 结果收集 → 验证 → 报告
Phase 0: Pre-flight Checks
阶段0:预检检查
| Check | Required | Action if Missing |
|---|---|---|
| Audit report OR target module | Yes | Block modernization |
| Git clean state | Yes | Block (need clean baseline for revert) |
| Test infrastructure | Yes | Block (workers need tests for keep/discard) |
MANDATORY READ: Load for test/build detection.
shared/references/ci_tool_detection.md| 检查项 | 是否必需 | 缺失时操作 |
|---|---|---|
| 审计报告或目标模块 | 是 | 阻止现代化改造 |
| Git工作区干净状态 | 是 | 阻止改造(需要干净基线以便回滚) |
| 测试基础设施 | 是 | 阻止改造(Worker需要测试环境来判断保留/丢弃变更) |
必读提示: 请加载文件以进行测试/构建工具检测。
shared/references/ci_tool_detection.mdPhase 1: Analyze Input
阶段1:输入分析
Worker Selection
Worker选择
| Condition | ln-831 | ln-832 |
|---|---|---|
| ln-645 findings present (OSS candidates) | Yes | No |
| JS/TS project with package.json | No | Yes |
| Both conditions | Yes | Yes |
| Target module specified | Yes | No |
| 条件 | ln-831 | ln-832 |
|---|---|---|
| 存在ln-645审计结果(含OSS候选替换项) | 启用 | 不启用 |
| 含package.json的JS/TS项目 | 不启用 | 启用 |
| 同时满足上述两个条件 | 启用 | 启用 |
| 指定了目标模块 | 启用 | 不启用 |
Stack Detection
技术栈检测
| Indicator | Stack | ln-832 Eligible |
|---|---|---|
| package.json + JS/TS files | JS/TS | Yes |
| *.csproj | .NET | No |
| requirements.txt / pyproject.toml | Python | No |
| go.mod | Go | No |
| 识别标识 | 技术栈 | 是否符合ln-832启用条件 |
|---|---|---|
| package.json + JS/TS文件 | JS/TS | 是 |
| *.csproj | .NET | 否 |
| requirements.txt / pyproject.toml | Python | 否 |
| go.mod | Go | 否 |
Phase 2: Delegate to Workers
阶段2:任务调度至Worker
CRITICAL: All delegations use Task tool withandsubagent_type: "general-purpose"— each worker creates its own branch perisolation: "worktree".shared/references/git_worktree_fallback.md
关键提示: 所有任务调度均使用Task工具,配置和subagent_type: "general-purpose"—— 每个Worker都会按照isolation: "worktree"的规则创建独立分支。shared/references/git_worktree_fallback.md
Delegation Protocol
调度协议
FOR each selected worker:
Task(description: "Modernize via ln-83X",
prompt: "Execute ln-83X-{worker}. Read skill from ln-83X-{worker}/SKILL.md. Context: {delegationContext}",
subagent_type: "general-purpose",
isolation: "worktree")FOR each selected worker:
Task(description: "Modernize via ln-83X",
prompt: "Execute ln-83X-{worker}. Read skill from ln-83X-{worker}/SKILL.md. Context: {delegationContext}",
subagent_type: "general-purpose",
isolation: "worktree")Delegation Context
调度上下文
| Field | Type | Description |
|---|---|---|
| projectPath | string | Absolute path to project |
| auditReport | string | Path to codebase_audit.md (if applicable) |
| targetModule | string | Target module path (if applicable) |
| options.runTests | bool | Run tests after modernization |
| 字段 | 类型 | 描述 |
|---|---|---|
| projectPath | 字符串 | 项目绝对路径 |
| auditReport | 字符串 | codebase_audit.md文件路径(若适用) |
| targetModule | 字符串 | 目标模块路径(若适用) |
| options.runTests | 布尔值 | 现代化改造后是否运行测试 |
Execution Order
执行顺序
| Order | Worker | Reason |
|---|---|---|
| 1 | ln-831 (OSS replacer) | May add/remove packages, affecting bundle |
| 2 | ln-832 (bundle optimizer) | Runs AFTER package changes are settled |
Rules:
- Workers run sequentially — ln-831 package changes affect ln-832 baseline.
- Dependent workers share branch: ln-832 launches in ln-831's branch so it sees OSS replacement changes.
| 顺序 | Worker | 原因 |
|---|---|---|
| 1 | ln-831(OSS替换工具) | 可能会添加/移除包,影响包体积基线 |
| 2 | ln-832(包体积优化工具) | 需等待包变更完成后再执行 |
规则:
- Worker需按顺序执行 —— ln-831的包变更会影响ln-832的优化基线。
- 关联Worker共享分支: ln-832会在ln-831创建的分支中启动,以便获取OSS替换后的代码变更。
Phase 3: Collect Results
阶段3:结果收集
Each worker produces an isolated branch. Coordinator aggregates branch reports.
每个Worker都会生成独立分支,协调器会汇总各分支的报告。
Worker Branches
Worker分支规则
| Worker | Branch Pattern | Contents |
|---|---|---|
| ln-831 | | OSS replacements |
| ln-832 | | Bundle optimizations |
| Worker | 分支命名规则 | 内容 |
|---|---|---|
| ln-831 | | OSS替换变更 |
| ln-832 | | 包体积优化变更 |
Result Schema
结果数据结构
| Field | Type | Description |
|---|---|---|
| worker | string | ln-831 or ln-832 |
| status | enum | success, partial, failed |
| branch | string | Worker's result branch name |
| changes_applied | int | Number of kept changes |
| changes_discarded | int | Number of discarded attempts |
| details | object | Worker-specific report |
| 字段 | 类型 | 描述 |
|---|---|---|
| worker | 字符串 | ln-831或ln-832 |
| status | 枚举值 | success(成功)、partial(部分完成)、failed(失败) |
| branch | 字符串 | Worker生成的结果分支名称 |
| changes_applied | 整数 | 已保留的变更数量 |
| changes_discarded | 整数 | 已丢弃的尝试变更数量 |
| details | 对象 | Worker专属报告详情 |
Phase 4: Aggregate Reports
阶段4:报告汇总
Each worker verified independently in its branch (tests, build run by worker itself). Coordinator does NOT rerun verification or revert worker changes.
每个Worker会在自身分支中独立完成验证(测试、构建均由Worker自行执行)。协调器不会重新运行验证或回滚Worker的变更。
On Failure
失败处理
- Branch with failing tests logged as "failed" in report
- User reviews failed branch independently
- 测试失败的分支会在报告中标记为“failed”
- 由用户独立审查失败分支的内容
Phase 5: Report Summary
阶段5:报告摘要
Report Schema
报告数据结构
| Field | Description |
|---|---|
| input_source | Audit report or target module |
| workers_activated | Which workers ran |
| modules_replaced | OSS replacements applied (ln-831) |
| loc_removed | Custom code lines removed (ln-831) |
| bundle_reduction | Bundle size reduction in bytes/% (ln-832) |
| build_verified | PASSED or FAILED |
| per_worker[] | Individual worker reports |
| 字段 | 描述 |
|---|---|
| input_source | 输入来源(审计报告或目标模块) |
| workers_activated | 已启用的Worker列表 |
| modules_replaced | 已完成的OSS替换模块(ln-831) |
| loc_removed | 已移除的自定义代码行数(ln-831) |
| bundle_reduction | 包体积减少量(字节/百分比,ln-832) |
| build_verified | 构建验证结果(PASSED或FAILED) |
| per_worker[] | 各Worker的独立报告详情 |
Configuration
配置选项
yaml
Options:
# Input
audit_report: "docs/project/codebase_audit.md"
target_module: ""
# Workers
enable_oss_replacer: true
enable_bundle_optimizer: true
# Verification
run_tests: true
run_build: true
# Safety
revert_on_build_failure: trueyaml
Options:
# Input
audit_report: "docs/project/codebase_audit.md"
target_module: ""
# Workers
enable_oss_replacer: true
enable_bundle_optimizer: true
# Verification
run_tests: true
run_build: true
# Safety
revert_on_build_failure: trueError Handling
错误处理
Recoverable Errors
可恢复错误
| Error | Recovery |
|---|---|
| ln-831 failure | Continue with ln-832 |
| ln-832 failure | Report partial success (ln-831 results valid) |
| Build failure | Revert last worker, re-verify |
| 错误类型 | 恢复方案 |
|---|---|
| ln-831执行失败 | 继续执行ln-832 |
| ln-832执行失败 | 报告部分成功(ln-831的结果依然有效) |
| 构建失败 | 回滚最后一个Worker的变更,重新验证 |
Fatal Errors
致命错误
| Error | Action |
|---|---|
| No workers activated | Report "no modernization targets found" |
| All workers failed | Report failures, suggest manual review |
| Dirty git state | Block with "commit or stash changes first" |
| 错误类型 | 处理动作 |
|---|---|
| 无Worker被激活 | 报告“未找到现代化改造目标” |
| 所有Worker执行失败 | 报告失败详情,建议人工审查 |
| Git工作区未处于干净状态 | 阻止改造,提示“请先提交或暂存变更” |
References
参考文档
../ln-831-oss-replacer/SKILL.md../ln-832-bundle-optimizer/SKILL.md- (audit companion)
../ln-645-open-source-replacer/SKILL.md shared/references/ci_tool_detection.md
../ln-831-oss-replacer/SKILL.md../ln-832-bundle-optimizer/SKILL.md- (审计配套工具)
../ln-645-open-source-replacer/SKILL.md shared/references/ci_tool_detection.md
Definition of Done
完成标准
- Input analyzed (audit report or target module)
- Appropriate workers selected based on input and stack
- Workers delegated with worktree isolation (, ln-831 before ln-832)
isolation: "worktree" - Each worker produces isolated branch, pushed to remote
- Coordinator report aggregates per-worker results (branch, changes, status)
Version: 1.0.0
Last Updated: 2026-03-08
- 已完成输入分析(审计报告或目标模块)
- 已根据输入内容和技术栈选择合适的Worker
- 已将任务调度至Worker,并启用工作树隔离(),且ln-831先于ln-832执行
isolation: "worktree" - 每个Worker均生成独立分支并推送到远程仓库
- 协调器报告已汇总各Worker的结果(分支信息、变更数量、执行状态)
版本: 1.0.0
最后更新时间: 2026-03-08