Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Scaffolded templates put @ref LLP comments above the frontmatter, silently killing every key (alwaysRun, model, description)

未关闭
#60 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
typescript
领域
cli, tooling

调研方向

从 src/config/load.ts:386 的 parseFrontmatter 开始,检查 templates/ 下的四个文件,然后跟踪 src/config/load.ts:173-175 中的使用情况,以及 src/core/prompts.ts:726 中的描述渲染。完成标准是:新 scaffold 的仓库保留 templates 的 frontmatter 键,并有一个回归测试断言每个随附的 template 都能被解析为非空键集合。

由索引模型根据 Issue 内容生成。

描述

bug

Summary

Every markdown template we ship starts with an @ref LLP … HTML comment placed above the opening ---. The frontmatter parser requires --- at byte 0, so in a freshly scaffolded repo the frontmatter of the coordinator and all three agents parses as nothing at all. Every key is silently dropped — no error, no warning, no doctor complaint.

Found while scaffolding expo/expo with 0.10.0.

Root cause

src/config/load.ts:386:

export function parseFrontmatter(md: string): { data: Record<string, string>; body: string } {
  if (!md.startsWith("---")) {
    return { data: {}, body: md };
  }

Any leading byte — including a comment we ourselves put there — returns { data: {} } and hands the whole file back as body.

All four shipped templates trip it:

$ for f in templates/coordinator.md templates/agents/*.md; do printf "%-40s %s\n" "$f" "$(head -c 3 "$f")"; done
templates/coordinator.md                 <!-
templates/agents/consistency.md          <!-
templates/agents/correctness.md          <!-
templates/agents/security.md             <!-

Impact

Consumed at src/config/load.ts:173-175, so the dropped keys fall back to defaults:

Template Key lost Consequence
agents/security.md alwaysRun: true The security agent stops being always-run. It is now only included when the router happens to pick it.
agents/security.md model: anthropic/claude-opus-5 Security reviews run on the config default instead of Opus.
coordinator.md model: anthropic/claude-opus-5 Consolidation and the final decision run on the default model.
all three agents description The router prompt renders (no description) for every agent — see src/core/prompts.ts:726. Routing has nothing to discriminate on.

alwaysRun is the serious one: src/config/load.ts:174 tests the value against "", so it becomes false, and the guarantee that security always reviews every PR is quietly gone.

Reproduction

Scaffold a fresh repo and run any review. Observed on a real run against expo/expo PR #48510:

  [coordinator] started claude-sonnet-5
Models used — … coordinator: anthropic/claude-sonnet-5

despite model: anthropic/claude-opus-5 sitting in coordinator.md.

Why it went unnoticed

This repo's own .expo-code-review/ files are correct — they start with ---. So do the hand-tuned configs in expo/eas-cli and brentvatne/euxy. Only a freshly scaffolded repo gets the broken shape, and the failure is silent, so nothing surfaces it.

Suggested fix

  1. Move the @ref LLP annotations in templates/coordinator.md and templates/agents/*.md to below the closing ---, or into the frontmatter as # comment lines (the parser already allows those).
  2. Consider making parseFrontmatter tolerate leading whitespace and HTML comments before the delimiter. It is a small change and stops this whole class of silent misconfiguration for adopters who add a license header or a comment of their own.
  3. Add a doctor check: if a prompt file contains a line matching ^(description|alwaysRun|model|temperature): that the parser did not pick up, fail with a pointer to the delimiter. This is the check that would have caught it.

A regression test asserting that every shipped template's frontmatter parses to a non-empty key set would keep it from coming back.

主要语言
TypeScript
星标
4
派生
0
平均合并
2 天 11 小时
30 天内合并 PR
3

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

expo/code-review-cli 的其他 Issue

查看 expo/code-review-cli 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。