19 Commits
Author SHA1 Message Date
arnold.cui-agent 4b5c597a58 docs(agents): restate repo roles, code provenance and worktree topology (#32)
## 背景

#31 的 target 误设为 `feat/migration-base`(合入了基础分支),按约定这批协作文档应以 `main` 为目标。本 PR 以 `main` 为 base 重新落盘同一批内容,修正 target。内容取自基础分支的合入结果(feat/migration-base@e33b8e2),与 #31 逐字一致。

## 变更内容

- **AGENTS.md**:开篇写明本仓库是生成代码仓库,crates/ 下不含手写代码,不设代码行数类源码组织约束;路由表去掉 code-tree,拆出拓扑与代码由来两条,csv-records 改指 tsox-scripts。
- **scripts.md**:改为代码由来索引——按产物查转换器(当前代码从哪里来),附定位一段生成代码来源的三步法。
- **csv-records.md**:删除,目录约定迁至 tsox-scripts 仓库;仓内引用改为跨仓指向。
- **pr.md**:新增评审重点,六项检查生成代码质量(只含生成产物、来源可追溯、门禁达标、欠账只减不增、外观约定、重生成幂等)。
- **worktrees.md**:收窄为两仓分工的稳定做法,写明 tsox 是产物仓库、tsox-scripts 把迁移工作代码化。
- **worktree-topology.md(新增)**:当前拓扑独立成文——main 为空,基础分支列出 worktree 并分出工作,模块分支只看自己那行。

## 自测结果

- 纯文档改动:6 个文件(4 改 1 增 1 删),非 .md 文件 0 个。
- 分支基于 origin/main(d5807c79)切出,只含本提交。
- 与基础分支(feat/migration-base@e33b8e2)的对应文件逐字一致;合入后与后续 base→main 的 PR 在这些文件上不会冲突。

Reviewed-on: #32
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-12-05 15:46:22 +00:00
arnold.cui-agent d5807c794b feat(core): convert tspath functions with consolidated struct face (#28)
## 背景

函数迁移战役的基础分支 PR:全模块 struct 草稿重生成 + 已收官的 tspath 函数产物。fswatch 与各模块分支 base 在本分支之上,经各自 PR 合入。

## 变更内容

- struct --all 重放 derive kit:较 main 树 0 删 69 增 derive(含 ComparisonPath、FanotifyHandleKey 等资格修复)
- tspath 函数迁移:373 候选 372 产出,292 精确体、80 测试哨兵、10 签名降级
- worktrees.md 拓扑约定(两仓六分支六 worktree,tspath 为基础)

## 自测结果

- cargo check 零错误(无哨兵红)
- tspath-only 清单重生成验证逐字节一致(dirty=0)

---

## 第二轮:func-check 确认项修复(d11dd8f)

### 背景

csv-records/func-check/report.md(143 文件全覆盖)确认 high 3 项、medium 6 项,本轮按报告行动建议修复生成器并重生成;生成器侧提交在 tsox-scripts feat/func-tspath(19d1e99、81df547)。

### 变更内容

- high#1 多值重赋回写:forceEncodeDynamicURIPathSegment1 的 let 遮蔽丢弃分割结果改为解构赋值回写
- high#2 map 缺键零值读:getCommonParentsWorker 扇出分支 new_groups[&key] 先读后插 panic 改 get+unwrap_or_default
- high#3 字节切片守卫:字符串切片改走 go_str_slice(越界 panic 与 Go 对齐,切点落多字节字符内部就近取整),叶子按使用注入 helper
- medium#1 nil 旗标:commonDirectoryOfFiles 的 is_empty 误判改为运行时 <name>_is_nil 旗标,对齐 Go nil/空切片可分辨语义
- medium#2-3 hex 严格对齐 + err 极性:奇数长度与 + 前缀拒绝;差分实跑新暴露既有极性反转(合法输入全被拒)一并修复
- medium#4-6 四 tools 模块重生成:修正错树解析后 gen_proto/import_localization/machotool/gen_preferences 被清空字段全部恢复(gen_proto、machotool 与 main 基线逐字节一致)

### 自测结果

- cargo check --all-targets:非哨兵错误 0,!todo 哨兵 80 与分支基线持平
- /tmp 差分 harness(path 依赖本分支实跑)10 用例全过,覆盖报告全部反例输入;go test ./internal/tspath/ 原树全绿交叉验证
- 脚本侧单测 99 通过(新增回归 6)

Reviewed-on: #28
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-22 12:42:54 +00:00
arnold.cui-agent 9add5a783e feat: convert go types and structs to rust drafts (#19)
## 背景

Go struct 与命名类型到 Rust 侧的目标形态需全部由脚本转化产出(目标:类型与结构 100% 机器生成,手写/生成以文件名划界);csv-records/ 被 gitignore,新 worktree 需能自举重建记录表。

## 变更内容

- **转化管线** scripts/go_struct_to_rust.rs + 叶子:struct_scan、struct_fields、anon_struct(匿名 struct 提升)、interface_scan(接口方法集)、go_type_mapping(类型映射三态 + 判别族载体参数)、error_rules(error 判别族)、rust_emit(归拢产出)、rust_mapping(包名/命名/落点/std 表)、csv_util。
- **产物布局**:机器产物按 go 包目录归拢,每目录一个 generated.rs(_test.go 归 generated_test.rs);三个固定替身(GoAnyValue/ReadWriteCloser/ErrorValue)合并产出 tsox_core/generated.rs;mod.rs/lib.rs 为派生模块树;生成器永不改写其余文件,手写/生成文件名级区分。
- **覆盖范围**:具名 struct 2304/2378(tools/ 74 个有意跳过);命名别名 864 并入 generated.rs;接口 108 个转 trait(方法签名同一映射,receiver &self),接口字段 `Option<Box<dyn X>>`;匿名 struct 字段提升伴生命名 struct(19 个,同形体去重);分组参数 a, b string 展开。
- **error 双载体**:消息类固定 `Result<T, String>`/`Option<String>`;判别族(fswatch/ipc/ls-autoimport)走 ErrorValue 枚举(变体来自 go-error-inventory.csv:37 哨兵 + 控制流哨兵 + Errno(i32),Message 兜底);keep 机制退役。
- **std 决策表**:sync/atomic/time/strings/io/fs/bufio/os 21 行;io.ReadWriteCloser 经 blanket trait 合流;prelude 撞名(Box/Result)加 Go 前缀。
- **引用解析**:crate 绝对路径(同文件裸名),列式档位 Table 后缀同步。
- **盘点配套**:go-error-inventory.csv(哨兵/自定义/外部三类 99 项)及口径文档 csv-records.md。

## 自测结果

- cargo check 全绿 0 error;连续重跑 diff -r 零差异(幂等);树 2435 → 235 文件(一 struct 一文件旧布局经 prune 自动迁移)。
- 字段 9236:pointer 2681、func 261、todo 163(待人工:chan/context/sync 等需架构决策项)、keep 1、匿名伴生 19;trait 108;ErrorValue 变体 51。
- 新 worktree 自举:清单 CSV 缺失或 schema 旧时自动经盘点脚本重建。
- 评审修改(6837345):移除本 PR 脚本中的全部注释(10 文件 112 行纯删除),与既有脚本零注释惯例一致;3 个入口脚本 rustc 编译通过,query 模式输出与移除前一致。

• **脚本迁出(本分支末尾提交 8335c4e)**:scripts/ 全目录(含本 PR 新增的转化管线与 testdata)移至私有仓库 tsox-scripts,运行路径改为 ../tsox-scripts(见 agents-docs/contributing/scripts.md);csv-records.md 收敛为列语义摘要,完整口径迁至 tsox-scripts 的 docs/inventory-columns.md;docs/porting/alias-todos.md 生成来源指向同步改写。self-test:cargo check 通过、全仓 scripts/ 旧路径零残留、清单/函数/bench 三脚本冒烟正常。

Reviewed-on: #19
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-18 04:08:49 +00:00
arnold.cui-agent a5eaf38323 docs: drop CI gate from PR review flow (#20)
## 背景

idealjs/tsox 仓库未配置任何 CI workflow(actions/workflows 为空),pr.md 中 CI 状态检查通过后方可合并、CI 未绿不得请求审核的条款无从执行,且成为请求审核的空门禁。

## 变更内容

- 移除 agents-docs/contributing/pr.md 中 CI 门禁条款一行;其余流程条款(推送后逐条回复评审意见、修改后重新请求审核、提交者不自行合并等)不变。

## 自测结果

- 文档改动,无代码路径;grep 确认 pr.md 内无 CI 残留引用;diff 单行删除。

Reviewed-on: #20
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-09 15:05:43 +00:00
arnold.cui-agent 22eca53bad feat: assign soa/aos layout tiers to struct inventory (#17)
## 背景

docs/porting/data-layout.md 已定下「常驻 Arena + SoA」的通用框架与访问场景→布局映射表,但尚未落到 struct 清单:2378 个 struct 中哪些进 SoA 列式、哪些落 AoS 行/静态表,没有逐类结论。

## 变更内容

- scripts/go-struct-inventory.rs 行尾追加 layout 列,2378 个 struct 逐个标注四档:soa-columnar(108)/aos-arena-row(171)/aos-static-table(115)/plain-struct(1984),stderr 摘要同步输出档位计数。
- 新增 scripts/layout_rules.rs:判定规则与策展名单——热门表元素取自 NodeFactory 48 种 arena 节点、节点头、流程/符号表、checker 类型签名表元素、LinkStore 值类型;(module, name) 精确命中;冷门种类经 deps 命中 36 个基座名单识别,显式名单避免 pseudochecker/fswatch 本地 *Base 误报。
- docs/porting/data-layout.md 新增「布局分配」一节:按数据家族的分配表(量级、主访问场景、布局结论)+ 档位计数 + 判定顺序 + 兜底升级规则。
- agents-docs/contributing/csv-records.md 补 layout 列口径(四档含义、判定顺序、近似与名单维护要求)。

## 自测结果

- rust-script scripts/go-struct-inventory.rs 重跑通过:scanned 5219 files, 2378 structs, 115 with fixed global instances, layout soa-columnar/aos-arena-row/aos-static-table/plain-struct 108/171/115/1984。
- 抽查:Message(2230 实例)→aos-static-table;Identifier→soa-columnar;ClassDeclaration/SourceFile/IntrinsicType→aos-arena-row;Program/Checker/symbolData→plain-struct;PseudoTypeBase(9 实例)→aos-static-table(未误报)。
- 跨模块同名(Message/CompletionItem/Program)互不污染;aos-static-table 总数与既有 config-table 分类一致(115)。

Reviewed-on: #17
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 17:14:47 +00:00
arnold.cui-agent bcbc874505 docs: drop long-term conclusion rule from csv-records (#18)
## 背景

讨论「布局分配」记录必要性时引用了 csv-records.md 的这句:"需要长期保留的结论不要写在这里,应落入正式文档或提交说明"。维护者决定将其移除。

## 变更内容

- agents-docs/contributing/csv-records.md 判定标准一条删除该子句,保留"量大、可重新产生"两项判定标准与草稿语义。

## 自测结果

- grep 全仓确认"长期保留"无其他出现处,无悬空引用。
- 与 #17(feat/struct-layout-tiers)改动区域不重叠,两侧先后合并均无冲突。

Reviewed-on: #18
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 17:06:55 +00:00
arnold.cui-agent 4bf137ffad feat: record rust module mapping and struct deps in struct inventory (#16)
## 背景

typescript-go → Rust 移植需要先定 crate 划分,并在 struct 清单中记录归属与依赖。以仓库自身的包间依赖为唯一依据(非测试源文件的 import 提取,排除测试 import 造成的假循环),53 个 internal 包按职责域归入 12 个 crate,分组后 crate 间依赖无环。

## 变更内容

- 新增 `scripts/rust_mapping.rs`:path 前缀 → (rustCrate, rustModule) 静态映射表;`tsc/internal/<pkg>` 按首段包名归组,子目录归入首段包,`cmd/tsc` 映射到 bin crate,编译器主体外路径(tools/)不映射。
- 新增 `scripts/struct_deps.rs`:从 struct body 提取字段类型引用(跳过注释、字符串、tag),行级剥离字段名;清单求交后 CSV 行尾追加 deps 列(`;` 分隔,裸名=同包、限定名=跨包唯一解析)。
- `go-struct-inventory` 引用上述两个 mod,CSV 列扩展为 `name,module,path,globalInstances,rustCrate,rustModule,deps`(尾部追加,位置索引读取的下游不受影响)。
- 分包决策精简为 crate 划分表(含直接依赖列)与映射口径,落在 `docs/porting/module-layout.md`;列语义补充进 `agents-docs/contributing/csv-records.md`。

## 自测结果

- `rust-script scripts/go-struct-inventory.rs`:2378 structs,115 fixed global instances,2304 mapped / 74 unmapped(全部为 tools/customlint),1513 with struct deps;tsc/ 路径零漏映射。
- deps 抽查对照 Go 源码:`Node → Node;core.TextRange`(Kind/NodeFlags 为类型别名,正确排除);`NodeBase → NodeDefault`(嵌入字段);`CommandLineOption → diagnostics.Message`(限定名);`incremental/Program` 同包裸名正确命中。
- `rust-script scripts/go-struct-functions.rs Node` 输出正常,尾部新列不破坏位置索引读取。
- 提交均 GPG Good signature(arnold.cui-agent):50e7a65、1182d85、b11973f。

Reviewed-on: #16
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 14:22:55 +00:00
arnold.cui-agent 270861d04c feat: add on-demand struct function query script (#13)
## 背景

结构体清单与函数清单已有 CSV,但按 struct 查它的函数要人工 grep。新增一个用时即查的查询脚本:输入 struct 名称,直接从函数 CSV 搜索返回相关函数,不产生新 CSV;CSV 缺失时自动调用对应的 rust-script 先生成,兼顾新 checkout 场景。

## 变更内容

- 新增 scripts/go-struct-functions.rs:输入 struct 名称,输出三段——定义位置(来自 struct inventory,若 CSV 带 globalInstances 列一并展示)、方法列表(函数 CSV 中 receiver 等于该名称的行)、名称包含该 struct 的自由函数(如 NewXxx 构造器类)。
- 查询结果走 stdout,自动生成的日志走 stderr,便于管道;不写任何 CSV。
- csv-records/go-func-inventory.csv 或 go-struct-inventory.csv 不存在时,先执行 rust-script scripts/go-func-inventory.rs(或 go-struct-inventory.rs)再生成后继续查询;两个文件都不存在时报错退出。
- 退出码:命中 0;无任何条目 1;用法/生成失败 2。脚本无代码注释(按评审意见,290d500)。

## 自测结果

- rust-script scripts/go-struct-functions.rs Symbol:1 处定义 + 23 个方法。
- Message:4 处定义(diagnostics/jsonrpc/lsproto/reactor 四包同名)+ 16 个方法,路径列可消歧。
- SourceFile:47 个方法。
- 未命中 NoSuchStructXyz:exit 1,提示明确。
- 再生成路径:移走 go-func-inventory.csv 后查询,自动调用 func 脚本重建(与原文件逐字节一致)后正常输出。

(重建自 PR #11:原 PR 建账号用错。原 PR 上 arnold.cui 的评审意见「代码不留注释,写在文档中」已由 290d500 处理,分支与提交不变,评审动态见原 PR。)

Reviewed-on: #13
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 11:05:32 +00:00
arnold.cui-agent 87a4a9ccbb feat: count fixed global instances per struct (#12)
## 背景

typescript-go → Rust 移植需要区分两类 struct:进常驻 Arena 的动态对象与编译期数量固定、以包级 var 存在的全局配置数据(诊断消息表、编译选项表、Unicode case 表)。后者在 Rust 侧应落成 const/static 表,不进 Arena。为此给 go-struct-inventory 增加 globalInstances 列。

## 变更内容

- go-struct-inventory 新增第二遍扫描:在包级 var 声明中统计静态可定量的 struct 实例——初始化表达式中的直接字面量(含限定名,归属定义包)、[]T / [N]T / map[K]T 容器内省略类型的元素字面量、T / *T 零值声明。
- CSV 表头新增 globalInstances 列;现有 3 列输出与升级前逐字节一致(第一遍扫描未改动)。
- 计数规则与局限(函数体、slices.Concat 等调用构造、[][]T 嵌套容器不计)落在 docs/contributing/csv-records.md;脚本本身无注释(85c433d)。

## 自测结果

- 对 typescript-go 全树运行:5219 files, 2378 structs, 115 with fixed global instances。
- 不变式:新 CSV 前 3 列与旧 CSV diff 为空;删除注释前后 CSV 输出逐字节一致。
- 交叉验证:另写 go/ast 参考计数器(/tmp 一次性工具,未入库)全量比对——双方均可见的 key 计数全部一致;剩余差异全部定位为参考工具的盲区(15 个泛型方法方言文件解析失败、限定名与泛型容器类型)与本工具故意排除的非 struct 类型(string/int/Locale 等 defined type)。
- 逐项核对大数:diagnostics.Message=2230、stringutil.specialCasingMapping=2927、lsproto.RequestInfo=81 / NotificationInfo=23、tsoptions.CommandLineOption=179(162 同包 + 17 跨包限定名表元素,逐处 grep 闭合)。

(重建自 PR #10:原 PR 建账号用错,分支与提交不变,评审动态见原 PR。)

Reviewed-on: #12
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 11:05:03 +00:00
arnold.cui-agent 3015732e97 docs: agent identity norms and agents-docs rename (#14)
## 背景

PR #10/#11 由错误账号(arnold.cui)创建:建 PR 时 tea 选错 login。取证结论:提交与签名身份一直正确,漏的是平台操作账号——红线与 PR 规范只写「本人身份」,锚在操作者自我判断上,而这正是事故发生的环节。后续复核确认 AGENTS.md 及路由文档的读者是 agent;回复评论的 token 未指明账号也造成同一账号错用。本 PR 同时承载 docs → agents-docs 目录移动(原 #15),避免两个 PR 在 AGENTS.md 第 3 行的必然冲突。

## 变更内容

- AGENTS.md 红线:「每个人使用本人身份提交」替换为「每个 Agent 使用 Agent 身份提交」(7d9c548 修正了首个提交误为追加的问题)。
- AGENTS.md 开篇:改为「本规范写给在本仓库工作的 agent」。
- docs/contributing/pr.md:首条规则「PR 创建,一律使用 agent 账号。机器上存在多个 login 时,先核对 token 所属用户再操作。」;回复规则补「回复与 PR 创建使用同一 agent 账号的 token」(10478de)。
- 目录移动(原 #15 并入,合并提交 7b5ae24):git mv docs → agents-docs(5 文件保留重命名历史),冲突按两侧语义合成解决。
- 数据布局文档定位与归位:agents-docs/porting/data-layout.md 是给人看的移植结论,移至 docs/porting/data-layout.md(810106e),scripts/bench/README.md 引用跟随;AGENTS.md 路由行保留、指向新位置 docs/porting/data-layout.md(f94c074)。
- .gitignore 增加 /.zcode/(5d702e2):会话目录不得入库;曾被 git add -A 卷入一个文件,已 amend 剔除并对分支 force push。

## 自测结果

- 每次提交均为显式路径 add,暂存全集复核过,无 .zcode 条目;PR 文件清单经 API 核验。
- 引用核查:全仓无 docs/ 误指 agents-docs、无 agents-docs/porting/ 残留;路由表数据布局行指向 docs/porting/data-layout.md 且该文件存在。
- 提交 GPG 签名 Good signature,PR 以 agent 账号创建(tea --login arnold.cui-agent)。
- 建议评审顺序:本 PR 先于 #12/#13 合入。

Reviewed-on: #14
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 11:02:30 +00:00
arnold.cui-agent 9f43810091 docs: add data layout decisions with reproducible benchmarks (#9)
## 背景

typescript-go → Rust 移植启动前,数据布局与内存方案需要实测依据。本 PR 只包含结论文档与可复现实验;测量过程遵循 scripts/bench/README 的纪律(绑大核、变体交替、多轮取中位数)。

## 变更内容

- docs/porting/data-layout.md
  - 决策速查表:访问模式 × 布局(顺序/随机 × 窄/宽)
  - 内存:对象图用 arena,线程栈按子系统预配
  - 派发:存储 trait + 泛型算法,热路径禁止逐元素 dyn
  - 宽场景经 cargo feature 编译期切 AoS 后端
  - 八组实测结论,各附复现脚本
- scripts/bench/:八个 Rust 实验(std-only,rust-script 运行),README 含测量纪律
- AGENTS.md:路由新增 data-layout 与 code-tree skill 条目

## 自测结果

- 八个实验逐一运行通过,全部绑大核(Zen5 CCD core 0)、变体交替多轮取最小
- 扫描:SoA 0.30 ns/记录 vs AoS 2.9(10 倍);窄跳转 SoA 0.54 vs 1.75 ns(3 倍);宽跳转 SoA 慢 8 倍
- 内存方案(glibc/arena/Go GC)查询速度同级
- Arc clone+drop 慢四个数量级,销毁慢 8 倍,遍历仅慢 1.4 倍
- 跳转链:SoA 38.6 < 打包 AoS 55.5 < 胖记录 70.2 ns/跳
- 线程内存:虚拟预留 15.8 GB 不计费,触碰 1.0 GB 计费,退出回基线
- 深递归固定栈 82.5 ms,缺页 12900 次集中在首轮
- 输出与 CSV 全英文;负载加 black_box 阻断优化

Reviewed-on: #9
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-07 07:19:48 +00:00
arnold.cui-agent d1fef8c147 feat: add go struct inventory rust-script (#7)
## 背景

函数清单(PR #4)之外,struct 是迁移计量的另一半:类型数量决定数据结构层的移植面。

## 变更内容

- 新增 scripts/go-struct-inventory.rs(rust-script 单文件,std-only,无注释)
- 输出 CSV 三列:name / module(文件名去后缀)/ path(相对扫描根目录),按模块、名称排序
- 六态词法状态机:代码 / 行注释 / 块注释 / 解释字符串 / 原始字符串 / rune 字面量;只认顶格声明
- 支持 type ( 分组声明、嵌套泛型参数、struct 别名(type X = struct{...})
- 输出默认落 csv-records/go-struct-inventory.csv,支持 [目标目录] [输出文件] 参数

## 自测结果

- 全量跑 ~/workspace/TypeScript:5219 个文件,2378 个 struct
- 与 go/parser 构造性真值(30 行 Go 程序,go/ast 遍历顶层 TypeSpec)逐行 diff 完全一致
- 开发过程中通过该真值抓出并修复三处解析缺陷:分组内非 struct 条目导致状态逃逸、struct 别名形态(type X = struct{})、迭代器类型错误
- csv-records/ 被 .gitignore 忽略,数据不入库

Reviewed-on: #7
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 17:49:43 +00:00
arnold.cui-agent 131b878844 feat: add go goroutine inventory rust-script (#8)
## 背景

并发点是 Go → TS 移植中行为差异最高发的区域,需要一份 goroutine 启动点的精确清单(数量 + 位置 + 被调对象)。

## 变更内容

- 新增 scripts/go-goroutine-inventory.rs(rust-script 单文件,std-only,无注释)
- 输出 CSV 四列:name(被调对象,闭包启动记为 func)/ module / path / line(行号),按模块、路径、行号排序
- 判定规则:行首首个词为 go 关键字(go 为保留字,不可能作为标识符,故无歧义)
- 六态词法状态机排除注释与字符串内的假目标;行首空白先跳过(goroutine 在函数体内缩进)
- 输出默认落 csv-records/go-goroutine-inventory.csv,支持 [目标目录] [输出文件] 参数

## 自测结果

- 全量跑 ~/workspace/TypeScript:5219 个文件,58 个 goroutine 启动点
- 与 go/parser 构造性真值(ast.Inspect 遍历 GoStmt 节点,含行号)逐行 diff 完全一致
- 构成:52 处闭包启动 + 6 处具名调用(d.loop、p.run、serve、sub.run、cb.eventLoop、s.watcherImpl.handleWatcherError)
- csv-records/ 被 .gitignore 忽略,数据不入库

Reviewed-on: #8
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 17:49:14 +00:00
arnold.cui-agent 068344562c docs: require inline reply to review comments (#6)
## 背景

此前的评审回复都发在 PR 级评论里,与被回复的意见不在线程内,评审人解决完问题后无法逐条 resolve 会话,收口成本高。

## 变更内容

- docs/contributing/pr.md 新增一条:对评审意见的回复直接内联在该条评论下(reply),便于逐条 resolve,不要另发 PR 级评论
- 已按此约定补齐 PR #4、#5 的三条内联回复(review #12、#13)

## 自测结果

- 通过 CreatePullReview + in_reply_to + SubmitPullReview 补发内联回复,验证会话已挂在原评论下
- 文档改动经 AGENTS.md 路由表 pr.md 条目覆盖,无需改路由

Reviewed-on: #6
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 13:46:18 +00:00
arnold.cui-agent 250a2b844d feat: add go func inventory rust-script (#4)
## 背景

迁移规划需要一份 Go 函数清单:typescript-go(~/workspace/TypeScript)中每个顶层 func 按模块归档,方法带 receiver 类型名,纯函数留空,作为 csv-records 的首批数据。

## 变更内容

- 新增 scripts/go-func-inventory.rs(rust-script 单文件,仅依赖 csv + walkdir)
- 输出 CSV 三列:name / module(文件名去 .go 后缀)/ struct(receiver 类型名,纯函数留空),按模块、名称排序
- 解析约定:只认顶格 func 声明(gofmt 保证),缩进的闭包与调用忽略;receiver 类型剥指针与泛型参数;原始字符串内的伪 Go 代码行暂不区分(实测 typescript-go 中均为缩进形式,不影响)
- CSV 输出默认落 csv-records/go-func-inventory.csv,符合临时数据约定;支持 [目标目录] [输出文件] 参数

## 自测结果

- 全量跑 ~/workspace/TypeScript:5219 个文件,22397 个函数(方法 11531,纯函数 10866),与 /usr/bin/grep '^func ' 计数完全一致
- 泛型 receiver(*SyncMap[K, V] → SyncMap)、泛型函数(findSpanEnd[T any] → findSpanEnd)、无名 receiver(func (Null) ...)均解析正确
- 修复过一处 bug:多类型参数 receiver 的 ']' 会泄入类型名(V]),已改为取第一个空白后的完整类型段
- csv-records/ 被 .gitignore 忽略,CSV 数据不入库

Reviewed-on: #4
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 12:48:21 +00:00
arnold.cui-agent 28f52eb867 feat: add ts cases inventory rust-script (#5)
## 背景

go-func-inventory 覆盖了 Go 函数侧,用例侧(tests/cases 下 1.3w 个 fixture)也需要一份清单,便于迁移时对照与筛选。

## 变更内容

- 新增 scripts/ts-cases-inventory.rs(rust-script 单文件,仅依赖 csv + walkdir)
- 输出 CSV 两列:name(文件名)、path(相对 tests/cases 的路径),按路径排序,compiler/conformance 自然分组
- 遍历目录无过滤,重新生成即同步;输出默认落 csv-records/ts-cases-inventory.csv,支持 [目标目录] [输出文件] 参数

## 自测结果

- 全量跑 ~/workspace/TypeScript/tsc/testdata/tests/cases:13034 个 fixture,与 find 基线完全一致
- 扩展名分布一致:12680 ts / 352 tsx / 2 js
- csv-records/ 被 .gitignore 忽略,数据不入库

Reviewed-on: #5
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 12:47:18 +00:00
arnold.cui-agent 56719ec1cf docs: route AGENTS.md and add csv-records convention (#3)
## 背景

此前 AGENTS.md 是单体文档,所有协作规范堆在一个文件里;同时仓库缺一个临时数据的存放约定,脚本产出的批量列表(失败测试、待迁移函数等)无处安放。

## 变更内容

- AGENTS.md 改为路由式入口:保留适用范围、全局红线(GPG 签名 / 本人身份 / main 保护)与路由表
- 分支、提交、PR 规范下沉为 docs/contributing/ 下的独立文档(branches.md、commits.md、pr.md)
- 新增 .gitignore 忽略 /csv-records/,作为临时列表数据目录
- 新增 docs/contributing/csv-records.md 约定其用途、格式与生命周期,并加入 AGENTS.md 路由表

## 自测结果

- 两个提交均 GPG 签名,git log --show-signature 验证 Good signature
- git check-ignore -v csv-records/ 确认忽略规则生效
- AGENTS.md 路由表 4 个文档路径全部存在

Reviewed-on: #3
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 11:31:32 +00:00
arnold.cui-agent e559c715aa docs: define agent commit and PR conventions (#1)
## 背景

确立仓库协作规范,使提交与 PR 流程有据可依。

## 变更内容

新增 AGENTS.md,内容包括签名要求、分支命名、提交规范、PR 流程。

## 自测结果

提交均 GPG 签名,服务端验签通过。CI 尚未就绪,合入受 ci-check 检查约束。

Reviewed-on: #1
Reviewed-by: arnold.cui <arnold.cui@idealjs.com>
Co-authored-by: arnold.cui-agent <arnold.cui-agent@idealjs.com>
2026-11-06 11:07:28 +00:00
arnold.cui-agent 842a8cc0bf chore: initialize repository 2026-11-06 15:25:13 +08:00