Repository navigation
v0.2.4
TeamFlow v0.2.4
Release — 一次「工程基建」版本(5 个提交 / 41 个文件 / +1757 −1062 行,v0.2.3..HEAD 全量对比):把代码风格从「人工维持 + smoke 正则兜底」升级为「机器维持 + 单一格式仲裁者」,对齐宿主 dsh 的同款工具链(oxlint jsPlugins + @stylistic),并加 lefthook 预提交钩子让贡献者提交即合规。零功能性变更、零用户可见行为变化、无破坏性,宿主窗口不变。
Release — an "engineering hygiene" release (5 commits / 41 files / +1757 −1062, full v0.2.3..HEAD diff): moves code style from "human-maintained + smoke-regex backstop" to "machine-maintained + single formatting authority", aligning with the host dsh's own toolchain (oxlint jsPlugins + @stylistic), and adds a lefthook pre-commit hook so contributor commits are compliant by default. No functional changes, no user-visible behavior changes, no breaking changes; the host window is unchanged.
中文
升级要点(TL;DR)
- 无破坏性:宿主窗口不变(
>=0.1.7-alpha.1 <0.2.0);journal 格式、任务夹契约、teamflow_*工具参数全部向后兼容。 - 升完重启
dsh --profile web生效。 - 纯工程基建:确立代码格式单一仲裁者(
@stylistic/indent,不引入 Prettier)、行长上限对齐宿主收严到 140、加 lefthook 预提交钩子自动修复 staged 文件、风格门禁改走宿主同款@stylistic(oxlint jsPlugins)。
为什么做这套基建:三种漂移
本版的每一组改动都来自「风格不收敛」导致的实际摩擦:
- 格式无单一权威:此前缩进靠
@stylistic/indent之外的手工约定,AI 生成代码与贡献者提交在缩进/分行上易漂移;Prettier 与@stylistic/indent在 JSX 缩进上互斥,不能混用。 - 行长无统一上限:各文件行宽不一,diff 噪声大,跨仓(与宿主 dsh)协作时认知成本高。
- 合规靠事后门禁:只有 oxlint 的 warning 门禁,没有「提交即修」的钩子,不合规范的代码会先溜进历史再被修。
本次变更
① 代码格式单一仲裁者(规范 docs/anchors/code-style.md)
- 确立
@stylistic/indent为唯一格式权威,明确不引入 Prettier(两者在 JSX 缩进上互斥)。 - 规范文件落地两条纪律:① 规则准入要么可自动修、要么存量清零;② 源码断言锁(smoke 正则)只锁内容不锁排版(跨行分隔符写
\s*、容忍尾逗号,?),避免每次折行都需改断言。
② max-len 收严到 140(对齐宿主)
- 全仓 53 处超长行手工折行(不改语义);3 条长正则(失败分类 / 内容失败 / 安装块)拆成语义分组数组
new RegExp([...].join('|'), 'i'),并对每个拆分做等价性校验(.source必须等于原始字面量),disable计数归零——不靠eslint-disable逃避。
③ lefthook 预提交钩子(贡献者提交即合规)
pnpm format(两遍--fix)+git diff --cached --check空白检查,stage_fixed: true;pnpm-workspace.yaml加allowBuilds: lefthook: true,package.json加postinstall自动安装钩子。
④ 风格门禁改走宿主同款 @stylistic(oxlint jsPlugins)
- oxlint
jsPlugins加载@stylistic/eslint-plugin,103 规则、0 warning 门禁;因 jsPlugins 仍 alpha 不随 semver,oxlint锁精确版本1.85.0。 - 三层缩进兜底:
@stylistic/indent规则 +pnpm format自动修 +.editorconfig编辑器侧约定,兜住 lint 管不到的缩进。
验证方式
| 验证项 | 结果 |
|---|---|
| oxlint 门禁 | oxlint --deny-warnings 0/0 @ 103 规则(含 jsPlugins 加载成功) |
| 类型检查 | tsc --noEmit 0 错 |
| 测试套件 | 28 套件全绿(含 instruction-budget / changelog / prompt-contract / conformance / client-host-api / runs-eviction) |
| lefthook 预提交 | 实跑通过(pnpm format 两遍 --fix + 空白检查),自动修复 staged 文件 |
| 提交面 | 5 提交 / 41 文件 / +1757 −1062,全 chore/lint/hooks,零 .ts 逻辑改动 |
| 真实流水线回归 | 宿主下限不变,旧 journal / 续跑行为不受影响(纯工程改动,无需重跑验收) |
已知边界与后续
- 折行仍靠手工:max-len 目前「只报警不自动修」的自动化未做,已在
docs/TODO.md留痕(低优先)。 - smoke 源码断言锁已明确为补充防线(只锁内容不锁排版),主防线是 oxlint + lefthook。
- 计量维持到 token 量为止:成本「从量到钱」已拍板不做(每模型单价不同、会调价、plan/套餐式下「token×单价」算式不成立)。
- 下一版 v0.2.5 = 编排可测:pipeline 拆分成 qa(状态机)/ dev(波次)/ acceptance 后,用 fake subagents 做端到端编排测试,仍是当前最大测试缺口。
engines.dsh窗口维持>=0.1.7-alpha.1 <0.2.0(semver 不覆盖 prerelease 的口径不变,按正式版边界书写)。
English
Upgrade notes (TL;DR)
- No breaking changes: host window unchanged (
>=0.1.7-alpha.1 <0.2.0); journal format, task-folder contract andteamflow_*tool arguments are all backward compatible. - Restart
dsh --profile webafter upgrading. - Pure engineering hygiene: a single formatting authority (
@stylistic/indent, no Prettier), line-length cap tightened to 140 to match the host, a lefthook pre-commit hook that auto-fixes staged files, and the lint gate now using the host's own@stylistic(oxlint jsPlugins).
Why this hygiene pass: three sources of drift
Every change group here comes from friction caused by non-convergent style:
- No single formatting authority: indentation relied on hand-written conventions outside
@stylistic/indent; AI-generated code and contributor commits drifted on indentation/wrapping. Prettier and@stylistic/indentare mutually exclusive on JSX indentation and cannot be mixed. - No unified line-length cap: inconsistent line widths created diff noise and high cognitive cost when collaborating across repos (with the host dsh).
- Compliance was post-hoc only: there was an oxlint warning gate but no "fix on commit" hook, so non-conforming code entered history first and got fixed later.
Changes
① Single formatting authority (spec docs/anchors/code-style.md)
@stylistic/indentis the sole formatting authority; Prettier is explicitly not introduced (the two are mutually exclusive on JSX indentation).- The spec pins two disciplines: ① a rule is admitted only if it is auto-fixable or its existing violations are cleared; ② source-assertion locks (smoke regexes) lock content, not formatting (cross-line separators use
\s*, trailing commas tolerate,?), so every wrap does not require rewriting an assertion.
② Line-length cap tightened to 140 (host-aligned)
- All 53 over-long lines across the repo were hand-wrapped (semantics untouched); 3 long regexes (external-failure / content-failure / install-block) were split into semantic grouped arrays
new RegExp([...].join('|'), 'i'), each split equivalence-checked (.sourcemust equal the original literal). Thedisablecount dropped to zero — no escape viaeslint-disable.
③ lefthook pre-commit hook (contributor-commits-compliant)
pnpm format(two--fixpasses) +git diff --cached --checkwhitespace check,stage_fixed: true;pnpm-workspace.yamlgainsallowBuilds: lefthook: true;package.jsongains apostinstallthat installs the hook automatically.
④ Lint gate now uses the host's own @stylistic (oxlint jsPlugins)
- oxlint
jsPluginsloads@stylistic/eslint-pluginat 103 rules with a 0-warning gate; because jsPlugins is still alpha and not semver-tracked,oxlintis pinned to exact1.85.0. - Three-layer indentation backstop: the
@stylistic/indentrule +pnpm formatauto-fix +.editorconfigeditor-side convention, covering indentation that lint alone cannot reach.
Verification
| Item | Result |
|---|---|
| oxlint gate | oxlint --deny-warnings 0/0 @ 103 rules (jsPlugins loaded) |
| Type check | tsc --noEmit 0 errors |
| Test suites | 28 suites green (incl. instruction-budget / changelog / prompt-contract / conformance / client-host-api / runs-eviction) |
| lefthook pre-commit | ran live (pnpm format two --fix passes + whitespace check), auto-fixed staged files |
| Commit surface | 5 commits / 41 files / +1757 −1062, all chore/lint/hooks, zero .ts logic changes |
| Real-pipeline regression | host floor unchanged; old journals / resume behavior unaffected (pure engineering change, no re-verification run needed) |
Known boundaries and follow-ups
- Wrapping is still manual: max-len currently "warns but does not auto-fix"; that automation is filed in
docs/TODO.md(low priority). - smoke source-assertion locks are now explicitly a backstop (content-only, not formatting); the primary gate is oxlint + lefthook.
- Metering stops at token volume: cost "from volume to money" was decided against (per-model prices differ, prices change, and "token × unit price" does not hold under plan/subscription billing).
- Next version v0.2.5 = orchestration testability: after splitting pipeline into qa (state machine) / dev (waves) / acceptance, add end-to-end orchestration tests with fake subagents — still the largest test gap.
engines.dshwindow stays>=0.1.7-alpha.1 <0.2.0(semver does not cover prereleases; documented against official-release boundaries).