[bug] Review.ts: --help and mistyped flags are dropped silently and start a full review

オープン 初心者向け
#3,055 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bun, typescript
領域
cli

調査の方向性

install/LIFEOS/TOOLS/Review.ts の2238〜2251行付近にある import.meta.main ブロックと、800〜821行付近にある parseReviewFlags の注記を読んでください。共有パーサーは変更せず、CLI のエントリーポイントにヘルプ処理と不明なオプションの検証を追加してください。--help、-h、不明なフラグを指定するとレビューを開始せずに終了することを確認してください。使用方法には --past-round-cap を含めてください。

索引モデルが issue の本文から書いたものです。

説明

What happened

Review.ts has no help and no unknown-option check. bun Review.ts --help does not print usage: it drops --help and runs a full cross-vendor review of the current directory, which also counts as a review round. A mistyped flag behaves the same way.

Mechanism

  • parseReviewFlags (install/LIFEOS/TOOLS/Review.ts:806-821) takes out --allow-dirty, --waive-blockers and --past-round-cap, rejects the retired --accept, and passes every other argument through in rest (:814).

  • The CLI then drops every ---prefixed argument from the positionals without a check (:2238), so --help, --jsno or --allow-dirt "reason" leave pos empty and review({ dir: "." }) runs (:2251).

  • A value after a mistyped flag becomes the directory: --range a..b reviews the directory a..b.

  • The parser cannot reject unknown flags itself, because CfEnv shares it and forwards its own flags in rest (doc comment at :800-805). The check belongs in the import.meta.main block.

  • The usage text exists only as a header comment (:12-15), and it does not mention --past-round-cap.

Reproduction

v8.761.0 install/ payload (byte-identical to main as of 2026-11-30). This shows the parser result without starting a review:

cd install/LIFEOS/TOOLS
bun -e 'import { parseReviewFlags } from "./Review.ts";
for (const a of [["--help"], ["--bogus"], ["--range", "a..b"]]) {
  const f = parseReviewFlags(a);
  console.log(JSON.stringify(a), "->", JSON.stringify(f), "pos =", JSON.stringify(f.ok ? f.rest.filter((x) => !x.startsWith("--")) : null));
}'

Observed:

["--help"] -> {"ok":true,"rest":["--help"]} pos = []
["--bogus"] -> {"ok":true,"rest":["--bogus"]} pos = []
["--range","a..b"] -> {"ok":true,"rest":["--range","a..b"]} pos = ["a..b"]

With an empty pos, the CLI runs review({ dir: "." }).

Expected: --help and -h print usage and exit 0 without reviewing. An unknown option prints unknown option <arg> and exits 2 without reviewing.

This actually happened: on my install, an agent ran Review.ts --help to learn the arguments, which is the natural first move with an unfamiliar CLI. That started a real review of an 89-file span, and the round counted toward the round cap.

Suggested fix

The fix goes in the import.meta.main block only, so the shared parser and CfEnv stay unchanged. This is a sketch and has not been run:

const USAGE = `usage: bun Review.ts [dir] [--allow-dirty "<reason>"] [--waive-blockers "<reason>"] [--past-round-cap "<reason>"] [--json]
       bun Review.ts status [dir] [--json]
       bun Review.ts audit [--json]`;
if (argv.includes("--help") || argv.includes("-h")) { console.log(USAGE); process.exit(0); }
// after parseReviewFlags:
const unknown = flags.rest.find((a) => a.startsWith("-") && a !== "--json");
if (unknown) { console.error(`review: unknown option ${unknown}\n${USAGE}`); process.exit(2); }
const pos = flags.rest.filter((a) => a !== "--json");

Same class as #1690 (lifeos.ts), #2290 (Upgrade --help ran a full scan) and #2430 (Er.ts filed --help as a complaint).

主要言語
TypeScript
スター
20k
フォーク
2.5k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

danielmiessler/LifeOS のほかの issue

danielmiessler/LifeOS の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。