Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

#### Changed

- **Spinner themes are hidden Easter eggs** — The existing themed and random spinner flags remain parseable for backward compatibility, but normal `--help` output and current user-facing documentation no longer advertise them. Regression tests protect both hidden help output and documentation consistency. Affected: `Runner/ProgramRunner.HelpText.cs`, `USER_GUIDE.md`, `doc/config.sample.jsonc`, `doc/DEVELOPER_GUIDE.md`, `doc/TESTING_GUIDE.md`, `FolderDiffIL4DotNet.Tests/ProgramRunnerTests.HelpVersion.cs`, `FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs`.

- **CLI parsing now returns one structured result and rejects surplus positional arguments** — `CliParser` now separates `oldFolder`, `newFolder`, and optional `reportLabel` while consuming options in one pass. Existing two- and three-positional forms, option placement, automatic labels, and `--creator` behavior are preserved; a fourth positional argument now prints usage and exits with code `2`. `CliOptions` uses named properties with defaults instead of a 35-field positional constructor. Affected: `Runner/CliParser.cs`, `Runner/CliOptions.cs`, `ProgramRunner.cs`, `Runner/ProgramRunner.Wizard.cs`, `Runner/RunPreflightValidator.cs`, `USER_GUIDE.md`. Tests: `CliOptionsTests`, `ProgramRunnerTests`, `CliOverrideApplierTests`, `SpinnerThemesTests`.

#### Fixed
Expand Down Expand Up @@ -1692,6 +1694,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),

#### 変更

- **スピナーテーマを非表示のイースターエッグとして整理** — 既存のテーマ指定およびランダム選択フラグは後方互換のため引き続き解析できますが、通常の `--help` 出力と現行のユーザー向け文書では案内しないようにしました。ヘルプでの非表示と文書整合性を回帰テストで保護します。対象: `Runner/ProgramRunner.HelpText.cs`, `USER_GUIDE.md`, `doc/config.sample.jsonc`, `doc/DEVELOPER_GUIDE.md`, `doc/TESTING_GUIDE.md`, `FolderDiffIL4DotNet.Tests/ProgramRunnerTests.HelpVersion.cs`, `FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs`。

- **CLI 解析を単一の構造化結果へ集約し、余分な位置引数を拒否** — `CliParser` はオプションを 1 回の走査で消費しながら、`oldFolder`、`newFolder`、任意の `reportLabel` を分離するようになりました。既存の 2/3 位置引数形式、オプション位置、自動ラベル、`--creator` の動作は維持し、4 個目の位置引数は使い方を表示して終了コード `2` で拒否します。`CliOptions` は 35 フィールドの位置指定コンストラクタではなく、既定値付きの名前付きプロパティを使用します。対象: `Runner/CliParser.cs`, `Runner/CliOptions.cs`, `ProgramRunner.cs`, `Runner/ProgramRunner.Wizard.cs`, `Runner/RunPreflightValidator.cs`, `USER_GUIDE.md`。テスト: `CliOptionsTests`, `ProgramRunnerTests`, `CliOverrideApplierTests`, `SpinnerThemesTests`。

#### 修正
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,56 @@ public void DotNetWorkflow_DoesNotSkipDocumentationOnlyChanges()
Assert.DoesNotContain("'**.md'", workflow, StringComparison.Ordinal);
}

/// <summary>
/// Verifies that hidden spinner Easter eggs are not advertised by current user-facing documentation.
/// 非表示のスピナーイースターエッグが現行のユーザー向け文書で案内されていないことを検証します。
/// </summary>
[Fact]
[Trait("Category", "Unit")]
public void UserFacingDocumentation_DoesNotAdvertiseHiddenSpinnerOptions()
{
string[] hiddenOptions =
{
"--coffee",
"--beer",
"--matcha",
"--whisky",
"--wine",
"--ramen",
"--sushi",
"--random-spinner",
};
string[] topLevelDocuments =
{
GetRepositoryFilePath("README.md"),
GetRepositoryFilePath("USER_GUIDE.md"),
GetRepositoryFilePath("PACKAGE_README.md"),
GetRepositoryFilePath("CONTRIBUTING.md"),
GetRepositoryFilePath("SUPPORT.md"),
GetRepositoryFilePath("SECURITY.md"),
GetRepositoryFilePath("index.md"),
GetRepositoryFilePath("api", "index.md"),
GetRepositoryFilePath("FolderDiffIL4DotNet.Core", "PACKAGE_README.md"),
GetRepositoryFilePath("FolderDiffIL4DotNet.Plugin.Abstractions", "PACKAGE_README.md"),
GetRepositoryFilePath("docfx.json"),
GetRepositoryFilePath("toc.yml"),
};

foreach (var documentPath in topLevelDocuments)
{
AssertDocumentDoesNotAdvertiseHiddenOptions(documentPath, hiddenOptions);
}

foreach (var documentPath in Directory.GetFiles(GetRepositoryFilePath("doc"), "*", SearchOption.AllDirectories))
{
string extension = Path.GetExtension(documentPath);
if (extension is ".md" or ".html" or ".json" or ".jsonc" or ".yml" or ".yaml" or ".xml" or ".txt")
{
AssertDocumentDoesNotAdvertiseHiddenOptions(documentPath, hiddenOptions);
}
}
}

/// <summary>
/// Verifies that developers and CI share an exact SDK, formatting rules, and a blocking format gate.
/// 開発環境と CI が同一の SDK・フォーマット規則・ブロッキング形式検証を共有することを検証します。
Expand Down Expand Up @@ -601,6 +651,20 @@ private static string GetRepositoryFilePath(params string[] segments)
return path;
}

private static void AssertDocumentDoesNotAdvertiseHiddenOptions(
string documentPath,
string[] hiddenOptions)
{
var contents = File.ReadAllText(documentPath);
var relativePath = Path.GetRelativePath(RepositoryRootPath, documentPath);
foreach (var hiddenOption in hiddenOptions)
{
Assert.False(
contents.Contains(hiddenOption, StringComparison.Ordinal),
$"{relativePath} advertises hidden spinner option {hiddenOption}.");
}
}

private static bool CanRunCommand(string fileName, params string[] arguments)
{
try
Expand Down
42 changes: 42 additions & 0 deletions FolderDiffIL4DotNet.Tests/ProgramRunnerTests.HelpVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,48 @@ public async Task RunAsync_HelpFlag_ExitsZeroWithoutInitializingLogger()
}
}

[Fact]
public async Task RunAsync_HelpFlag_HidesSpinnerEasterEggOptions()
{
var logger = new TestLogger(logFileAbsolutePath: "test.log");
var runner = new ProgramRunner(logger, new ConfigService());
var origOut = Console.Out;
using var sw = new System.IO.StringWriter();
Console.SetOut(sw);

try
{
var exitCode = await runner.RunAsync(new[] { "--help" });

Assert.Equal(0, exitCode);
var output = sw.ToString();
string[] hiddenOptions =
{
"--coffee",
"--beer",
"--matcha",
"--whisky",
"--wine",
"--ramen",
"--sushi",
"--random-spinner",
};

foreach (var hiddenOption in hiddenOptions)
{
Assert.DoesNotContain(hiddenOption, output, StringComparison.Ordinal);
}

Assert.Contains("--bell", output, StringComparison.Ordinal);
Assert.Contains("--creator", output, StringComparison.Ordinal);
Assert.Contains("--open-reports", output, StringComparison.Ordinal);
}
finally
{
Console.SetOut(origOut);
}
}

[Fact]
public async Task RunAsync_HelpFlag_OutputContainsDryRunOption()
{
Expand Down
8 changes: 0 additions & 8 deletions Runner/ProgramRunner.HelpText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ public sealed partial class ProgramRunner
" --dry-run Enumerate files and show statistics without running comparison.\n" +
" --fail-on-diff Exit with code 5 when final reportable differences remain.\n" +
" Reports and other artifacts are still generated before exit.\n" +
" --coffee Use coffee-themed spinner animation during execution.\n" +
" --beer Use beer-themed spinner animation during execution.\n" +
" --matcha Use matcha tea ceremony spinner animation during execution.\n" +
" --whisky Use whisky distilling spinner animation during execution.\n" +
" --wine Use wine making spinner animation during execution.\n" +
" --ramen Use ramen steaming spinner animation during execution.\n" +
" --sushi Use conveyor-belt sushi spinner animation during execution.\n" +
" --random-spinner Randomly select a spinner theme for each run.\n" +
" --credits Show credits and acknowledgements.\n" +
" --bell Ring terminal bell when execution completes.\n" +
" --output <path> Output directory for reports (default: user-local app-data Reports/).\n" +
Expand Down
Loading
Loading