Skip to content

refactor(cli): P1-5 CLI の排他的オプションを ArgGroup と typed request で表現する#92

Merged
sasasin merged 6 commits into
masterfrom
sasasin/20260721/0023
Jul 20, 2026
Merged

refactor(cli): P1-5 CLI の排他的オプションを ArgGroup と typed request で表現する#92
sasasin merged 6 commits into
masterfrom
sasasin/20260721/0023

Conversation

@sasasin

@sasasin sasasin commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

P1-5 として、CLI の静的な排他 option と method 値依存の制約を、command 内の手動 validation から Picocli / 型境界へ移した。

  • content canonicalize--dry-run / --apply を optional exclusive @ArgGroupCanonicalizationExecutionMode で表現(未指定は dry-run)
  • probe feed の 4 entry selector を optional exclusive @ArgGroup 化し、複数指定を優先順位ではなく usage error に変更
  • selector 値は Picocli converter で FeedEntrySelection へ変換し、blank は usage error
  • article/feed probe の method / xpath 制約を ProbeArticleCliRequest / ProbeFeedCliRequest に集約
  • architecture / executor integration test で再導入を防止

意図的な semantic correction

  • selector 複数指定: 優先順位で 1 つ選択 → Picocli usage error(exit 2、service 未呼び出し)
  • blank selector: 未指定扱い fall-through → usage error
  • mode conflict: call() 内 → parse 段階(exit 2 は維持)

Test plan

  • docker compose run --rm maven mvn clean verify(668 tests、jacoco check 通過)
  • mvn spotless:check / checkstyle:check
  • targeted CLI tests(ArgGroup conflict、selector 6 pair、converter、typed request、architecture、executor)
  • docker compose config / docker compose build app
  • 旧 pattern 検索: resolveSelection / new CommandLine(this) / selection priority は production から除去(defensive dryRun && apply のみ group 内に残存)

Base

  • master HEAD at start: b995305f38dd018d268d52d8cd966e18fde86440
  • Picocli 4.7.7

sasasin added 6 commits July 21, 2026 00:40
…表現する

--dry-run と --apply の静的排他を Picocli @Arggroup に移し、call() 内の
手動 ParameterException / new CommandLine(this) を削除する。実行 mode は
CanonicalizationExecutionMode で表し、未指定時は従来どおり dry-run を既定とする。
--entry / --entry-index / --entry-title-regex / --entry-url-regex の値を
parse 段階で FeedEntrySelection へ変換する。blank・不正値は TypeConversionException
として usage error にし、command 内の手動 parse へ持ち込まない。
4 つの selector を optional exclusive group にまとめ、複数指定を優先順位ではなく
usage error にする。resolveSelection の priority chain と blank fall-through を廃止し、
未指定時のみ first を default とする。help からも selection priority 文言を削除する。
article/feed probe の URL 検証と FullTextMethod capability 判定を
ProbeArticleCliRequest / ProbeFeedCliRequest の factory へ移し、command の
call() を request 生成 → service 呼び出し → outcome mapping に限定する。
service 側の defensive validation は維持する。
@Arggroup の exclusive/multiplicity を reflection で検証し、手動 exclusivity や
resolveSelection / selection priority の再導入を source guard で防ぐ。
SreaderCliExecutor 経由でも mode/selector conflict と dynamic capability が
exit code 2 かつ service 未呼び出しになることを確認する。
@sasasin
sasasin merged commit 1d85422 into master Jul 20, 2026
3 checks passed
@sasasin
sasasin deleted the sasasin/20260721/0023 branch July 20, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant