Skip to content

Commit da2bd1f

Browse files
authored
Hide spinner Easter eggs from help (#233)
1 parent c2796a6 commit da2bd1f

8 files changed

Lines changed: 120 additions & 35 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
1919

2020
#### Changed
2121

22+
- **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`.
23+
2224
- **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`.
2325

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

16931695
#### 変更
16941696

1697+
- **スピナーテーマを非表示のイースターエッグとして整理** — 既存のテーマ指定およびランダム選択フラグは後方互換のため引き続き解析できますが、通常の `--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`。
1698+
16951699
- **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`。
16961700

16971701
#### 修正

‎FolderDiffIL4DotNet.Tests/Architecture/CiAutomationConfigurationTests.cs‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,56 @@ public void DotNetWorkflow_DoesNotSkipDocumentationOnlyChanges()
4949
Assert.DoesNotContain("'**.md'", workflow, StringComparison.Ordinal);
5050
}
5151

52+
/// <summary>
53+
/// Verifies that hidden spinner Easter eggs are not advertised by current user-facing documentation.
54+
/// 非表示のスピナーイースターエッグが現行のユーザー向け文書で案内されていないことを検証します。
55+
/// </summary>
56+
[Fact]
57+
[Trait("Category", "Unit")]
58+
public void UserFacingDocumentation_DoesNotAdvertiseHiddenSpinnerOptions()
59+
{
60+
string[] hiddenOptions =
61+
{
62+
"--coffee",
63+
"--beer",
64+
"--matcha",
65+
"--whisky",
66+
"--wine",
67+
"--ramen",
68+
"--sushi",
69+
"--random-spinner",
70+
};
71+
string[] topLevelDocuments =
72+
{
73+
GetRepositoryFilePath("README.md"),
74+
GetRepositoryFilePath("USER_GUIDE.md"),
75+
GetRepositoryFilePath("PACKAGE_README.md"),
76+
GetRepositoryFilePath("CONTRIBUTING.md"),
77+
GetRepositoryFilePath("SUPPORT.md"),
78+
GetRepositoryFilePath("SECURITY.md"),
79+
GetRepositoryFilePath("index.md"),
80+
GetRepositoryFilePath("api", "index.md"),
81+
GetRepositoryFilePath("FolderDiffIL4DotNet.Core", "PACKAGE_README.md"),
82+
GetRepositoryFilePath("FolderDiffIL4DotNet.Plugin.Abstractions", "PACKAGE_README.md"),
83+
GetRepositoryFilePath("docfx.json"),
84+
GetRepositoryFilePath("toc.yml"),
85+
};
86+
87+
foreach (var documentPath in topLevelDocuments)
88+
{
89+
AssertDocumentDoesNotAdvertiseHiddenOptions(documentPath, hiddenOptions);
90+
}
91+
92+
foreach (var documentPath in Directory.GetFiles(GetRepositoryFilePath("doc"), "*", SearchOption.AllDirectories))
93+
{
94+
string extension = Path.GetExtension(documentPath);
95+
if (extension is ".md" or ".html" or ".json" or ".jsonc" or ".yml" or ".yaml" or ".xml" or ".txt")
96+
{
97+
AssertDocumentDoesNotAdvertiseHiddenOptions(documentPath, hiddenOptions);
98+
}
99+
}
100+
}
101+
52102
/// <summary>
53103
/// Verifies that developers and CI share an exact SDK, formatting rules, and a blocking format gate.
54104
/// 開発環境と CI が同一の SDK・フォーマット規則・ブロッキング形式検証を共有することを検証します。
@@ -601,6 +651,20 @@ private static string GetRepositoryFilePath(params string[] segments)
601651
return path;
602652
}
603653

654+
private static void AssertDocumentDoesNotAdvertiseHiddenOptions(
655+
string documentPath,
656+
string[] hiddenOptions)
657+
{
658+
var contents = File.ReadAllText(documentPath);
659+
var relativePath = Path.GetRelativePath(RepositoryRootPath, documentPath);
660+
foreach (var hiddenOption in hiddenOptions)
661+
{
662+
Assert.False(
663+
contents.Contains(hiddenOption, StringComparison.Ordinal),
664+
$"{relativePath} advertises hidden spinner option {hiddenOption}.");
665+
}
666+
}
667+
604668
private static bool CanRunCommand(string fileName, params string[] arguments)
605669
{
606670
try

‎FolderDiffIL4DotNet.Tests/ProgramRunnerTests.HelpVersion.cs‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,48 @@ public async Task RunAsync_HelpFlag_ExitsZeroWithoutInitializingLogger()
6161
}
6262
}
6363

64+
[Fact]
65+
public async Task RunAsync_HelpFlag_HidesSpinnerEasterEggOptions()
66+
{
67+
var logger = new TestLogger(logFileAbsolutePath: "test.log");
68+
var runner = new ProgramRunner(logger, new ConfigService());
69+
var origOut = Console.Out;
70+
using var sw = new System.IO.StringWriter();
71+
Console.SetOut(sw);
72+
73+
try
74+
{
75+
var exitCode = await runner.RunAsync(new[] { "--help" });
76+
77+
Assert.Equal(0, exitCode);
78+
var output = sw.ToString();
79+
string[] hiddenOptions =
80+
{
81+
"--coffee",
82+
"--beer",
83+
"--matcha",
84+
"--whisky",
85+
"--wine",
86+
"--ramen",
87+
"--sushi",
88+
"--random-spinner",
89+
};
90+
91+
foreach (var hiddenOption in hiddenOptions)
92+
{
93+
Assert.DoesNotContain(hiddenOption, output, StringComparison.Ordinal);
94+
}
95+
96+
Assert.Contains("--bell", output, StringComparison.Ordinal);
97+
Assert.Contains("--creator", output, StringComparison.Ordinal);
98+
Assert.Contains("--open-reports", output, StringComparison.Ordinal);
99+
}
100+
finally
101+
{
102+
Console.SetOut(origOut);
103+
}
104+
}
105+
64106
[Fact]
65107
public async Task RunAsync_HelpFlag_OutputContainsDryRunOption()
66108
{

‎Runner/ProgramRunner.HelpText.cs‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ public sealed partial class ProgramRunner
3939
" --dry-run Enumerate files and show statistics without running comparison.\n" +
4040
" --fail-on-diff Exit with code 5 when final reportable differences remain.\n" +
4141
" Reports and other artifacts are still generated before exit.\n" +
42-
" --coffee Use coffee-themed spinner animation during execution.\n" +
43-
" --beer Use beer-themed spinner animation during execution.\n" +
44-
" --matcha Use matcha tea ceremony spinner animation during execution.\n" +
45-
" --whisky Use whisky distilling spinner animation during execution.\n" +
46-
" --wine Use wine making spinner animation during execution.\n" +
47-
" --ramen Use ramen steaming spinner animation during execution.\n" +
48-
" --sushi Use conveyor-belt sushi spinner animation during execution.\n" +
49-
" --random-spinner Randomly select a spinner theme for each run.\n" +
5042
" --credits Show credits and acknowledgements.\n" +
5143
" --bell Ring terminal bell when execution completes.\n" +
5244
" --output <path> Output directory for reports (default: user-local app-data Reports/).\n" +

0 commit comments

Comments
 (0)