@phuc1403/musketeer 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/INSTALLATION.md +1 -1
  2. package/README.md +2 -2
  3. package/manifest.json +3 -3
  4. package/package.json +1 -1
  5. package/template/.claude/skills/logical-components/SKILL.md +165 -94
  6. package/template/.claude/skills/logical-components/assets/component-diagram-template.html +104 -0
  7. package/template/.claude/skills/logical-components/references/component-analyst-prompt.md +88 -0
  8. package/template/.claude/skills/logical-components/references/component-level-detection.md +95 -0
  9. package/template/.claude/skills/logical-components/references/logical-component-concepts.md +92 -0
  10. package/template/.claude/skills/logical-components/scripts/build-component-model.cjs +120 -0
  11. package/template/.claude/skills/logical-components/scripts/index-declared-symbols.cjs +106 -0
  12. package/template/.claude/skills/logical-components/scripts/lib/coupling-metrics.cjs +48 -0
  13. package/template/.claude/skills/logical-components/scripts/lib/declared-symbol-patterns.cjs +57 -0
  14. package/template/.claude/skills/logical-components/scripts/lib/html-sections.cjs +91 -0
  15. package/template/.claude/skills/logical-components/scripts/lib/mermaid-graph.cjs +55 -0
  16. package/template/.claude/skills/logical-components/scripts/lib/read-json-input.cjs +109 -0
  17. package/template/.claude/skills/logical-components/scripts/lib/repo-walk.cjs +61 -0
  18. package/template/.claude/skills/logical-components/scripts/lib/verify-claims.cjs +159 -0
  19. package/template/.claude/skills/logical-components/scripts/render-component-diagram-html.cjs +112 -0
  20. package/template/.claude/skills/logical-components/scripts/scan-folder-tree.cjs +88 -0
  21. package/template/.claude/skills/logical-components/scripts/select-stale-components.cjs +129 -0
  22. package/template/.claude/statusline.cjs +26 -22
  23. package/template/.claude/skills/logical-components/.gitattributes +0 -2
  24. package/template/.claude/skills/logical-components/references/component-classifier-prompt.md +0 -53
  25. package/template/.claude/skills/logical-components/references/responsibility-agent-prompt.md +0 -67
  26. package/template/.claude/skills/logical-components/references/responsibility-verifier-prompt.md +0 -39
  27. package/template/.claude/skills/logical-components/scripts/Directory.Build.props +0 -7
  28. package/template/.claude/skills/logical-components/scripts/Directory.Build.rsp +0 -1
  29. package/template/.claude/skills/logical-components/scripts/Directory.Build.targets +0 -6
  30. package/template/.claude/skills/logical-components/scripts/Directory.Packages.props +0 -8
  31. package/template/.claude/skills/logical-components/scripts/LogicalComponents/BatchPlanning.cs +0 -70
  32. package/template/.claude/skills/logical-components/scripts/LogicalComponents/BatchesCommand.cs +0 -47
  33. package/template/.claude/skills/logical-components/scripts/LogicalComponents/CandidatesCommand.cs +0 -98
  34. package/template/.claude/skills/logical-components/scripts/LogicalComponents/CitableSource.cs +0 -54
  35. package/template/.claude/skills/logical-components/scripts/LogicalComponents/Citation.cs +0 -37
  36. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ClassifyBatchesCommand.cs +0 -86
  37. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ClassifyMergeCommand.cs +0 -219
  38. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ComponentDiscovery.cs +0 -180
  39. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ComponentRule.cs +0 -130
  40. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ComponentsFile.cs +0 -101
  41. package/template/.claude/skills/logical-components/scripts/LogicalComponents/CouplingResolver.cs +0 -251
  42. package/template/.claude/skills/logical-components/scripts/LogicalComponents/DisplayName.cs +0 -14
  43. package/template/.claude/skills/logical-components/scripts/LogicalComponents/EdgeExtraction.cs +0 -111
  44. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ExtractCommand.cs +0 -87
  45. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ExtractConfig.cs +0 -79
  46. package/template/.claude/skills/logical-components/scripts/LogicalComponents/LogicalComponents.csproj +0 -15
  47. package/template/.claude/skills/logical-components/scripts/LogicalComponents/MarkdownCodeSpans.cs +0 -72
  48. package/template/.claude/skills/logical-components/scripts/LogicalComponents/MarkdownRenderer.cs +0 -78
  49. package/template/.claude/skills/logical-components/scripts/LogicalComponents/MemberUseResolution.cs +0 -272
  50. package/template/.claude/skills/logical-components/scripts/LogicalComponents/MemberUses.cs +0 -231
  51. package/template/.claude/skills/logical-components/scripts/LogicalComponents/PlainText.cs +0 -55
  52. package/template/.claude/skills/logical-components/scripts/LogicalComponents/PortResolution.cs +0 -75
  53. package/template/.claude/skills/logical-components/scripts/LogicalComponents/Program.cs +0 -27
  54. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ProjectFilters.cs +0 -77
  55. package/template/.claude/skills/logical-components/scripts/LogicalComponents/PruneCommand.cs +0 -164
  56. package/template/.claude/skills/logical-components/scripts/LogicalComponents/RenderCommand.cs +0 -234
  57. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ResponsibilityBatches.cs +0 -84
  58. package/template/.claude/skills/logical-components/scripts/LogicalComponents/ResponsibilityValidation.cs +0 -197
  59. package/template/.claude/skills/logical-components/scripts/LogicalComponents/SeamDispatch.cs +0 -115
  60. package/template/.claude/skills/logical-components/scripts/LogicalComponents/SourceCodeLines.cs +0 -79
  61. package/template/.claude/skills/logical-components/scripts/LogicalComponents/SymbolNames.cs +0 -53
  62. package/template/.claude/skills/logical-components/scripts/LogicalComponents/TypeMap.cs +0 -106
  63. package/template/.claude/skills/logical-components/scripts/LogicalComponents/WalkRoots.cs +0 -63
  64. package/template/.claude/skills/logical-components/scripts/LogicalComponents/WorkspaceLoader.cs +0 -297
  65. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/AssignIdsTests.cs +0 -41
  66. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/BatchPlanningTests.cs +0 -90
  67. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/BatchesCommandTests.cs +0 -37
  68. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/CandidatesCommandTests.cs +0 -59
  69. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/CitationTests.cs +0 -42
  70. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/ClassifyCommandsTests.cs +0 -249
  71. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/ComponentDiscoveryTests.cs +0 -253
  72. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/CouplingAppExtractionTests.cs +0 -188
  73. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/CouplingAppWorkspace.cs +0 -30
  74. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/CouplingExtractionTests.cs +0 -174
  75. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/DisplayNameTests.cs +0 -17
  76. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/ExtractConfigTests.cs +0 -72
  77. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/FixturePaths.cs +0 -36
  78. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/LogicalComponents.Tests.csproj +0 -23
  79. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/MarkdownRendererTests.cs +0 -93
  80. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/ProjectFiltersTests.cs +0 -69
  81. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/PruneCommandTests.cs +0 -149
  82. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/RenderCommandTests.cs +0 -225
  83. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/RenderGoldenTests.cs +0 -34
  84. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/RenderTestData.cs +0 -55
  85. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/ResponsibilityValidationTests.cs +0 -315
  86. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/SampleAppWorkspace.cs +0 -27
  87. package/template/.claude/skills/logical-components/scripts/LogicalComponents.Tests/WorkspaceLoaderTests.cs +0 -266
  88. package/template/.claude/skills/logical-components/scripts/NuGet.config +0 -17
  89. package/template/.claude/skills/logical-components/scripts/fixtures/BrokenApp/src/Broken.Application/Broken.Application.csproj +0 -7
  90. package/template/.claude/skills/logical-components/scripts/fixtures/BrokenApp/src/Broken.Application/Broken.cs +0 -7
  91. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/CompositionRootApp.slnx +0 -5
  92. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/HostBuilderExtensions.cs +0 -15
  93. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/HostBuilderShims.cs +0 -25
  94. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/NativeInterop.cs +0 -17
  95. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/Root.Application.csproj +0 -7
  96. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/RootAutofacModule.cs +0 -11
  97. package/template/.claude/skills/logical-components/scripts/fixtures/CompositionRootApp/src/Root.Application/RootGreeter.cs +0 -7
  98. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/logical-components.json +0 -48
  99. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/AbstractMemberCases.cs +0 -27
  100. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/AttributeCases.cs +0 -23
  101. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/CouplingApp.Application.csproj +0 -7
  102. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/GenericBaseCases.cs +0 -14
  103. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/GenericSeamBindingCases.cs +0 -59
  104. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/ImplicitCallCases.cs +0 -230
  105. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/PartialInheritCases.First.cs +0 -11
  106. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/PartialInheritCases.Second.cs +0 -14
  107. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/StackOverflowCases.cs +0 -14
  108. package/template/.claude/skills/logical-components/scripts/fixtures/CouplingApp/src/CouplingApp.Application/ViaDisambiguationCases.cs +0 -36
  109. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/MultiTargetApp.slnx +0 -7
  110. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Legacy.FSharp/Legacy.FSharp.fsproj +0 -8
  111. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Legacy.FSharp/Library.fs +0 -5
  112. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Multi.Application/Multi.Application.csproj +0 -7
  113. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Multi.Application/Scheduling.cs +0 -14
  114. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Multi.Infrastructure/Multi.Infrastructure.csproj +0 -12
  115. package/template/.claude/skills/logical-components/scripts/fixtures/MultiTargetApp/src/Multi.Infrastructure/SchedulingClient.cs +0 -12
  116. package/template/.claude/skills/logical-components/scripts/fixtures/NoSolutionApp/src/Solo.Application/Solo.Application.csproj +0 -7
  117. package/template/.claude/skills/logical-components/scripts/fixtures/NoSolutionApp/src/Solo.Application/SoloGreeting.cs +0 -7
  118. package/template/.claude/skills/logical-components/scripts/fixtures/NoSolutionApp/src/Solo.Application.Tests/FakeGreeting.cs +0 -6
  119. package/template/.claude/skills/logical-components/scripts/fixtures/NoSolutionApp/src/Solo.Application.Tests/Solo.Application.Tests.csproj +0 -11
  120. package/template/.claude/skills/logical-components/scripts/fixtures/ObjOutputApp/ObjOutputApp.slnx +0 -5
  121. package/template/.claude/skills/logical-components/scripts/fixtures/ObjOutputApp/src/Obj.Application/Greeting.cs +0 -7
  122. package/template/.claude/skills/logical-components/scripts/fixtures/ObjOutputApp/src/Obj.Application/Obj.Application.csproj +0 -14
  123. package/template/.claude/skills/logical-components/scripts/fixtures/RenderGolden/components.json +0 -67
  124. package/template/.claude/skills/logical-components/scripts/fixtures/RenderGolden/expected.md +0 -28
  125. package/template/.claude/skills/logical-components/scripts/fixtures/RenderGolden/repo/src/App/OrderAcceptance.cs +0 -16
  126. package/template/.claude/skills/logical-components/scripts/fixtures/RenderGolden/repo/src/Infra/OrderQueue.cs +0 -10
  127. package/template/.claude/skills/logical-components/scripts/fixtures/RenderGolden/resp/batch-01.json +0 -18
  128. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/SampleApp.slnx +0 -10
  129. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/logical-components.json +0 -78
  130. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/CandidateCases.cs +0 -37
  131. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/CouplingCases.cs +0 -33
  132. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/DependencyInjection.cs +0 -18
  133. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/EdgeCases.cs +0 -63
  134. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/LoudNotifying.Base.cs +0 -5
  135. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/LoudNotifying.cs +0 -7
  136. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderAcceptance.cs +0 -17
  137. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderOptions.cs +0 -9
  138. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderRejectedException.cs +0 -7
  139. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderRequest.cs +0 -4
  140. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderRunning.cs +0 -18
  141. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/OrderValidation.cs +0 -6
  142. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/Ports.cs +0 -19
  143. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/PriceRules.cs +0 -7
  144. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/ReceiptPrinting.Totals.cs +0 -6
  145. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/ReceiptPrinting.cs +0 -7
  146. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/ReviewCases.cs +0 -107
  147. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/ReviewFixCases.cs +0 -143
  148. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/RunClock.cs +0 -12
  149. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/Sample.Application.csproj +0 -10
  150. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Application/SeeThroughCases.cs +0 -89
  151. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Billing.Application/OrderRunning.cs +0 -7
  152. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Billing.Application/Sample.Billing.Application.csproj +0 -11
  153. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/ForwardedNotifier.cs +0 -8
  154. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/InfrastructureDependencyInjection.cs +0 -16
  155. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/Mailer.cs +0 -6
  156. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/OrderQueue.cs +0 -11
  157. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/QueueEntry.cs +0 -4
  158. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/QueueStore.cs +0 -8
  159. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/ReviewCases.cs +0 -35
  160. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/ReviewFixCases.cs +0 -13
  161. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/Sample.Infrastructure.csproj +0 -13
  162. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/SeeThroughCases.cs +0 -18
  163. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/src/Sample.Infrastructure/UnreachedPlumbing.cs +0 -7
  164. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/tests/Sample.Tests/FakeOrderQueue.cs +0 -11
  165. package/template/.claude/skills/logical-components/scripts/fixtures/SampleApp/tests/Sample.Tests/Sample.Tests.csproj +0 -11
  166. package/template/.claude/skills/logical-components/scripts/fixtures/SharedOutsideRepo/SharedClock.cs +0 -7
  167. package/template/.claude/skills/logical-components/scripts/global.json +0 -5
  168. package/template/.claude/skills/logical-components/scripts/smoke-sample.sh +0 -26
@@ -1,69 +0,0 @@
1
- namespace LogicalComponents.Tests;
2
-
3
- public class ProjectFiltersTests
4
- {
5
- private const string PlainLibrary = """<Project Sdk="Microsoft.NET.Sdk"></Project>""";
6
-
7
- [Theory]
8
- [InlineData("tests/Foo/Foo.csproj")]
9
- [InlineData("test/Foo/Foo.csproj")]
10
- [InlineData("src/Foo.Tests/Foo.Tests.csproj")]
11
- [InlineData("src/Foo.UnitTests/Foo.UnitTests.csproj")]
12
- [InlineData("src/Foo.IntegrationTests/Foo.IntegrationTests.csproj")]
13
- [InlineData("src/Foo.Test/Foo.Test.csproj")]
14
- [InlineData("src/Foo.Specs/Foo.Specs.csproj")]
15
- [InlineData("src/Foo.Spec/Foo.Spec.csproj")]
16
- [InlineData("src/Foo.FunctionalTests/Foo.FunctionalTests.csproj")]
17
- public void Test_folders_and_test_project_names_are_test_projects(string relativePath)
18
- {
19
- Assert.True(ProjectFilters.IsTestProject(relativePath, PlainLibrary));
20
- }
21
-
22
- [Theory]
23
- [InlineData("""<Project Sdk="MSTest.Sdk/3.8.0"></Project>""")]
24
- [InlineData("""<Project><PropertyGroup><IsTestProject> true </IsTestProject></PropertyGroup></Project>""")]
25
- [InlineData("""<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />""")]
26
- [InlineData("""<PackageReference Include="xunit" Version="2.9.0" />""")]
27
- [InlineData("""<PackageReference Include="xunit.v3" Version="3.0.0" />""")]
28
- [InlineData("""<PackageReference Include="xunit.core" Version="2.9.0" />""")]
29
- [InlineData("""<PackageReference Include="NUnit" Version="4.0.0" />""")]
30
- [InlineData("""<PackageReference Include="MSTest.TestFramework" Version="3.0.0" />""")]
31
- [InlineData("""<PackageReference Include="Microsoft.Testing.Platform" Version="1.0.0" />""")]
32
- public void Test_framework_markers_in_the_project_file_make_a_test_project(string projectText)
33
- {
34
- Assert.True(ProjectFilters.IsTestProject("src/Foo/Foo.csproj", projectText));
35
- }
36
-
37
- [Theory]
38
- [InlineData("src/Foo.Application/Foo.Application.csproj")]
39
- [InlineData("src/Foo.Contest/Foo.Contest.csproj")]
40
- [InlineData("src/Latest.Feeds/Latest.Feeds.csproj")]
41
- [InlineData("src/Foo.Testing/Foo.Testing.csproj")]
42
- [InlineData("src/Net.SpeedTest/Net.SpeedTest.csproj")]
43
- [InlineData("src/Experiments.ABTest/Experiments.ABTest.csproj")]
44
- public void Source_projects_are_not_test_projects(string relativePath)
45
- {
46
- Assert.False(ProjectFilters.IsTestProject(relativePath, PlainLibrary));
47
- }
48
-
49
- [Theory]
50
- [InlineData("Multi.Application(net10.0)", "Multi.Application(net8.0)")]
51
- [InlineData("A(net8.0)", "A(netstandard2.1)")]
52
- [InlineData("A(netstandard2.1)", "A(netstandard2.0)")]
53
- [InlineData("A(netcoreapp3.1)", "A(netstandard2.1)")]
54
- [InlineData("A(net10.0)", "A(net9.0-windows)")]
55
- [InlineData("A(net472)", "A(net45)")]
56
- [InlineData("A(netstandard2.0)", "A(net48)")]
57
- public void Higher_target_framework_ranks_above_lower(string higher, string lower)
58
- {
59
- Assert.True(ProjectFilters.TargetFrameworkRank(higher).CompareTo(ProjectFilters.TargetFrameworkRank(lower)) > 0);
60
- }
61
-
62
- [Theory]
63
- [InlineData("Multi.Application(net10.0)", "Multi.Application")]
64
- [InlineData("Plain.Project", "Plain.Project")]
65
- public void Target_framework_suffix_is_stripped_from_project_names(string loadedName, string expected)
66
- {
67
- Assert.Equal(expected, ProjectFilters.StripTargetFramework(loadedName));
68
- }
69
- }
@@ -1,149 +0,0 @@
1
- using System.Text.Json;
2
-
3
- namespace LogicalComponents.Tests;
4
-
5
- /// <summary>Applying verifier verdicts: unsupported responsibilities are dropped into a separate output directory.</summary>
6
- public class PruneCommandTests : IDisposable
7
- {
8
- private readonly DirectoryInfo _work = Directory.CreateTempSubdirectory("lc-prune-");
9
-
10
- private string Resp => Path.Combine(_work.FullName, "resp");
11
-
12
- private string Verify => Path.Combine(_work.FullName, "verify");
13
-
14
- private string Pruned => Path.Combine(_work.FullName, "pruned");
15
-
16
- public PruneCommandTests()
17
- {
18
- Directory.CreateDirectory(Resp);
19
- Directory.CreateDirectory(Verify);
20
- File.WriteAllText(Path.Combine(Resp, "batch-01.json"), """
21
- {
22
- "OrderAcceptance": [
23
- { "text": "Rejects invalid orders.", "cite": "src/App/OrderAcceptance.cs:8-12" },
24
- { "text": "Sends a confirmation email.", "cite": "src/App/OrderAcceptance.cs:14" }
25
- ],
26
- "OrderQueue": [
27
- { "text": "Retries failed writes.", "cite": "src/Infra/OrderQueue.cs:10" }
28
- ]
29
- }
30
- """);
31
- }
32
-
33
- public void Dispose() => _work.Delete(recursive: true);
34
-
35
- private void WriteVerdicts(string json) => File.WriteAllText(Path.Combine(Verify, "batch-01.json"), json);
36
-
37
- private async Task<(int Exit, string Output)> PruneAsync()
38
- {
39
- var output = new StringWriter();
40
- var exit = await PruneCommand.RunAsync(["--resp", Resp, "--verify", Verify, "--out", Pruned], output);
41
- return (exit, output.ToString());
42
- }
43
-
44
- private Dictionary<string, List<Responsibility>> ReadPruned() =>
45
- JsonSerializer.Deserialize<Dictionary<string, List<Responsibility>>>(
46
- File.ReadAllText(Path.Combine(Pruned, "batch-01.json")),
47
- new JsonSerializerOptions { PropertyNameCaseInsensitive = true })!;
48
-
49
- [Fact]
50
- public async Task Unsupported_items_are_dropped_reported_and_the_originals_are_left_untouched()
51
- {
52
- var original = File.ReadAllText(Path.Combine(Resp, "batch-01.json"));
53
- WriteVerdicts("""
54
- {
55
- "OrderAcceptance": [
56
- { "item": 1, "supported": true, "reason": "Lines 8-12 return false when validation fails." },
57
- { "item": 2, "supported": false, "reason": "Line 14 enqueues; nothing sends email." }
58
- ],
59
- "OrderQueue": [ { "item": 1, "supported": false, "reason": "No retry anywhere in the cited line." } ]
60
- }
61
- """);
62
-
63
- var (exit, output) = await PruneAsync();
64
-
65
- Assert.Equal(0, exit);
66
- Assert.Equal(["Rejects invalid orders."], ReadPruned()["OrderAcceptance"].Select(r => r.Text));
67
- Assert.Empty(ReadPruned()["OrderQueue"]);
68
- Assert.Equal(
69
- """
70
- removed OrderAcceptance[2]: Line 14 enqueues; nothing sends email.
71
- removed OrderQueue[1]: No retry anywhere in the cited line.
72
- empty OrderQueue: every responsibility was unsupported
73
- 2 removed, 1 empty
74
-
75
- """.ReplaceLineEndings("\n"),
76
- output.ReplaceLineEndings("\n"));
77
- Assert.Equal(original, File.ReadAllText(Path.Combine(Resp, "batch-01.json")));
78
- }
79
-
80
- [Fact]
81
- public async Task Pruning_twice_gives_the_same_result()
82
- {
83
- WriteVerdicts("""
84
- { "OrderAcceptance": [ { "item": 1, "supported": true }, { "item": 2, "supported": false } ],
85
- "OrderQueue": [ { "item": 1, "supported": true } ] }
86
- """);
87
-
88
- await PruneAsync();
89
- var first = File.ReadAllBytes(Path.Combine(Pruned, "batch-01.json"));
90
- await PruneAsync();
91
-
92
- Assert.Equal(first, File.ReadAllBytes(Path.Combine(Pruned, "batch-01.json")));
93
- }
94
-
95
- [Fact]
96
- public async Task A_responsibility_without_a_verdict_fails_the_whole_step_and_writes_nothing()
97
- {
98
- WriteVerdicts("""
99
- { "OrderAcceptance": [ { "item": 1, "supported": true } ],
100
- "OrderQueue": [ { "item": 1, "supported": true }, { "item": 2, "supported": true } ] }
101
- """);
102
-
103
- var (exit, output) = await PruneAsync();
104
-
105
- Assert.Equal(3, exit);
106
- Assert.Contains("OrderAcceptance[2]: no verdict (batch-01.json)", output);
107
- Assert.Contains("OrderQueue[2]: verdict for an item that does not exist (batch-01.json)", output);
108
- Assert.False(Directory.Exists(Pruned));
109
- }
110
-
111
- [Fact]
112
- public async Task A_null_verdict_entry_is_malformed_not_a_crash()
113
- {
114
- WriteVerdicts("""
115
- { "OrderAcceptance": [ null, { "item": 2, "supported": true } ],
116
- "OrderQueue": [ { "item": 1, "supported": true } ] }
117
- """);
118
-
119
- var (exit, output) = await PruneAsync();
120
-
121
- Assert.Equal(3, exit);
122
- Assert.Contains("OrderAcceptance: a null verdict entry (batch-01.json)", output);
123
- Assert.False(Directory.Exists(Pruned));
124
- }
125
-
126
- [Fact]
127
- public async Task A_verdict_missing_supported_is_malformed_not_silently_rejected()
128
- {
129
- WriteVerdicts("""
130
- { "OrderAcceptance": [ { "item": 1 }, { "item": 2, "supported": true } ],
131
- "OrderQueue": [ { "item": 1, "supported": true } ] }
132
- """);
133
-
134
- var (exit, output) = await PruneAsync();
135
-
136
- Assert.Equal(3, exit);
137
- Assert.Contains("OrderAcceptance[1]: verdict is missing 'supported' (batch-01.json)", output);
138
- Assert.False(Directory.Exists(Pruned));
139
- }
140
-
141
- [Fact]
142
- public async Task A_batch_without_a_verdict_file_fails()
143
- {
144
- var (exit, output) = await PruneAsync();
145
-
146
- Assert.Equal(3, exit);
147
- Assert.Contains("batch-01.json: no verdict file", output);
148
- }
149
- }
@@ -1,225 +0,0 @@
1
- using System.Text;
2
- using System.Text.Json;
3
-
4
- namespace LogicalComponents.Tests;
5
-
6
- /// <summary>End to end through files: components.json + batch files + repo sources → markdown, or errors and an exit code.</summary>
7
- public class RenderCommandTests : IDisposable
8
- {
9
- private readonly DirectoryInfo _work = Directory.CreateTempSubdirectory("lc-render-");
10
-
11
- private string Repo => Path.Combine(_work.FullName, "repo");
12
-
13
- private string ComponentsJson => Path.Combine(_work.FullName, "components.json");
14
-
15
- private string RespDir => Path.Combine(_work.FullName, "resp");
16
-
17
- private string Output => Path.Combine(_work.FullName, "out", "logical-components.generated.md");
18
-
19
- public RenderCommandTests()
20
- {
21
- foreach (var (file, lines) in RenderTestData.Lines)
22
- {
23
- var path = Path.Combine(Repo, file);
24
- Directory.CreateDirectory(Path.GetDirectoryName(path)!);
25
- File.WriteAllLines(path, lines);
26
- }
27
-
28
- File.WriteAllBytes(ComponentsJson, ComponentsFile.Serialize(RenderTestData.Extraction));
29
- Directory.CreateDirectory(RespDir);
30
- }
31
-
32
- public void Dispose() => _work.Delete(recursive: true);
33
-
34
- private void WriteResp(string name, IReadOnlyDictionary<string, IReadOnlyList<Responsibility>> responsibilities) =>
35
- File.WriteAllText(
36
- Path.Combine(RespDir, name),
37
- JsonSerializer.Serialize(responsibilities, new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase }));
38
-
39
- private async Task<(int Exit, string Errors)> RenderAsync(params string[] args)
40
- {
41
- var errors = new StringWriter();
42
- var exit = await RenderCommand.RunAsync(
43
- args.Length > 0 ? args : ["--components", ComponentsJson, "--resp", RespDir, "--repo", Repo, "--out", Output],
44
- errors);
45
- return (exit, errors.ToString());
46
- }
47
-
48
- [Fact]
49
- public async Task Responsibilities_split_across_batch_files_render_to_identical_bytes_every_time()
50
- {
51
- var all = RenderTestData.ValidResponsibilities();
52
- WriteResp("batch-01.json", all.Where(kv => kv.Key != "OrderQueue").ToDictionary());
53
- WriteResp("batch-02.json", all.Where(kv => kv.Key == "OrderQueue").ToDictionary());
54
- File.WriteAllText(Path.Combine(RespDir, "notes.json"), "not a batch file, ignored");
55
-
56
- var (exit, errors) = await RenderAsync();
57
- var first = File.ReadAllBytes(Output);
58
- await RenderAsync();
59
-
60
- Assert.Equal((0, ""), (exit, errors));
61
- Assert.Equal(first, File.ReadAllBytes(Output));
62
- Assert.StartsWith("# Logical Components\n", Encoding.UTF8.GetString(first));
63
- Assert.False(first.AsSpan().StartsWith(Encoding.UTF8.Preamble));
64
- }
65
-
66
- [Fact]
67
- public async Task Invalid_responsibilities_exit_3_lists_every_problem_and_leaves_an_existing_out_file_untouched()
68
- {
69
- Directory.CreateDirectory(Path.GetDirectoryName(Output)!);
70
- File.WriteAllText(Output, "stale doc from an earlier run");
71
- var all = RenderTestData.ValidResponsibilities();
72
- all.Remove("OrderQueue");
73
- all["OrderAcceptance"] = [new Responsibility("Accepts.", "src/App/OrderAcceptance.cs:1-3")];
74
- WriteResp("batch-01.json", all);
75
-
76
- var (exit, errors) = await RenderAsync();
77
-
78
- Assert.Equal(3, exit);
79
- Assert.Contains("OrderAcceptance[1]: cite 'src/App/OrderAcceptance.cs:1-3' is outside the component's declaration (4-17)", errors);
80
- Assert.Contains("OrderQueue: no responsibilities", errors);
81
- // A rejected run is the agents' fault, not the user's: an earlier successful document is never deleted.
82
- Assert.Equal("stale doc from an earlier run", File.ReadAllText(Output));
83
- }
84
-
85
- [Fact]
86
- public async Task A_write_that_fails_at_the_final_rename_cleans_up_its_temp_file_and_leaves_an_existing_out_file_untouched()
87
- {
88
- Directory.CreateDirectory(Path.GetDirectoryName(Output)!);
89
- File.WriteAllText(Output, "stale doc from an earlier run");
90
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
91
- // Point --out at a directory that already exists next to the stale file: the temp write succeeds (it lands
92
- // beside the directory), but renaming a file over an existing directory cannot.
93
- var outputDir = Path.GetDirectoryName(Output)!;
94
-
95
- var (exit, errors) = await RenderAsync("--components", ComponentsJson, "--resp", RespDir, "--repo", Repo, "--out", outputDir);
96
-
97
- Assert.Equal(2, exit);
98
- Assert.Contains($"Cannot write {outputDir}", errors);
99
- Assert.Equal("stale doc from an earlier run", File.ReadAllText(Output));
100
- Assert.Empty(Directory.GetFiles(Path.GetDirectoryName(outputDir)!, ".*.tmp"));
101
- }
102
-
103
- [Fact]
104
- public async Task A_write_that_fails_before_any_temp_file_is_created_leaves_an_existing_out_file_untouched()
105
- {
106
- Directory.CreateDirectory(Path.GetDirectoryName(Output)!);
107
- File.WriteAllText(Output, "stale doc from an earlier run");
108
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
109
- // Output already exists as a file, so a --out nested underneath it can never be created.
110
- var unwritableOut = Path.Combine(Output, "nested.md");
111
-
112
- var (exit, _) = await RenderAsync("--components", ComponentsJson, "--resp", RespDir, "--repo", Repo, "--out", unwritableOut);
113
-
114
- Assert.Equal(2, exit);
115
- Assert.Equal("stale doc from an earlier run", File.ReadAllText(Output));
116
- Assert.Empty(Directory.GetFiles(Path.GetDirectoryName(Output)!, ".*.tmp"));
117
- }
118
-
119
- [Fact]
120
- public async Task The_same_component_in_two_batch_files_is_an_error()
121
- {
122
- var all = RenderTestData.ValidResponsibilities();
123
- WriteResp("batch-01.json", all);
124
- WriteResp("batch-02.json", all.Where(kv => kv.Key == "OrderQueue").ToDictionary());
125
-
126
- var (exit, errors) = await RenderAsync();
127
-
128
- Assert.Equal(3, exit);
129
- Assert.Contains("OrderQueue: responsibilities in more than one file (batch-01.json, batch-02.json)", errors);
130
- }
131
-
132
- [Theory]
133
- [InlineData("{ not json", "batch-01.json: not a valid responsibilities file")]
134
- [InlineData("""{ "OrderQueue": [], "OrderQueue": [] }""", "batch-01.json: not a valid responsibilities file")]
135
- public async Task A_malformed_batch_file_is_an_error_naming_the_file(string content, string error)
136
- {
137
- File.WriteAllText(Path.Combine(RespDir, "batch-01.json"), content);
138
-
139
- var (exit, errors) = await RenderAsync();
140
-
141
- Assert.Equal(3, exit);
142
- Assert.Contains(error, errors);
143
- }
144
-
145
- [Fact]
146
- public async Task Null_entries_are_errors_not_crashes()
147
- {
148
- var all = RenderTestData.ValidResponsibilities();
149
- all.Remove("OrderQueue");
150
- all.Remove("ReceiptPrinting");
151
- WriteResp("batch-01.json", all);
152
- File.WriteAllText(Path.Combine(RespDir, "batch-02.json"), """{ "OrderQueue": [null], "ReceiptPrinting": null }""");
153
-
154
- var (exit, errors) = await RenderAsync();
155
-
156
- Assert.Equal(3, exit);
157
- Assert.Contains("OrderQueue[1]: item is null (batch-02.json)", errors);
158
- Assert.Contains("ReceiptPrinting: no responsibilities", errors);
159
- }
160
-
161
- [Fact]
162
- public async Task A_repo_that_does_not_match_components_json_exits_2_without_blaming_citations()
163
- {
164
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
165
- File.Delete(Path.Combine(Repo, "src/Infra/OrderQueue.cs"));
166
-
167
- var (exit, errors) = await RenderAsync();
168
-
169
- Assert.Equal(2, exit);
170
- Assert.Contains("src/Infra/OrderQueue.cs: changed since extract", errors);
171
- Assert.DoesNotContain("cite", errors);
172
- }
173
-
174
- [Fact]
175
- public async Task A_file_edited_since_extract_without_changing_its_line_count_is_still_detected()
176
- {
177
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
178
- // Same number of lines as when components.json was built, but different content: a stale citation could
179
- // still land inside a span and look valid, so extract's recorded hash - not just a missing-file check - must
180
- // catch this.
181
- File.WriteAllLines(Path.Combine(Repo, "src/Infra/OrderQueue.cs"), RenderTestData.Lines["src/Infra/OrderQueue.cs"]
182
- .Select((line, i) => i == 9 ? " StoreTwice(order);" : line));
183
-
184
- var (exit, errors) = await RenderAsync();
185
-
186
- Assert.Equal(2, exit);
187
- Assert.Equal("src/Infra/OrderQueue.cs: changed since extract\n", errors.ReplaceLineEndings("\n"));
188
- }
189
-
190
- [Fact]
191
- public async Task A_components_json_from_before_the_file_hash_map_existed_exits_2_asking_for_a_fresh_extract()
192
- {
193
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
194
- File.WriteAllBytes(ComponentsJson, ComponentsFile.Serialize(RenderTestData.Extraction with { FileHashes = null }));
195
-
196
- var (exit, errors) = await RenderAsync();
197
-
198
- Assert.Equal(2, exit);
199
- Assert.Contains("re-run extract", errors);
200
- }
201
-
202
- [Fact]
203
- public async Task Unreadable_inputs_and_outputs_exit_2()
204
- {
205
- WriteResp("batch-01.json", RenderTestData.ValidResponsibilities());
206
- var emptyComponents = Path.Combine(_work.FullName, "empty.json");
207
- File.WriteAllText(emptyComponents, "{}");
208
-
209
- Assert.Equal(2, (await RenderAsync("--components", emptyComponents, "--resp", RespDir, "--repo", Repo, "--out", Output)).Exit);
210
- Assert.Equal(2, (await RenderAsync("--components", ComponentsJson, "--resp", Path.Combine(_work.FullName, "nope"), "--repo", Repo, "--out", Output)).Exit);
211
- Assert.Equal(2, (await RenderAsync("--components", ComponentsJson, "--resp", RespDir, "--repo", Repo, "--out", RespDir)).Exit);
212
- }
213
-
214
- [Theory]
215
- [InlineData("--out", "a.md", "--out", "b.md")]
216
- [InlineData("--repo")]
217
- [InlineData("--unknown", "x")]
218
- public async Task Malformed_arguments_print_usage_and_exit_1(params string[] extra)
219
- {
220
- var (exit, errors) = await RenderAsync(["--components", ComponentsJson, "--resp", RespDir, "--repo", Repo, .. extra]);
221
-
222
- Assert.Equal(1, exit);
223
- Assert.StartsWith("usage:", errors);
224
- }
225
- }
@@ -1,34 +0,0 @@
1
- using System.Text;
2
-
3
- namespace LogicalComponents.Tests;
4
-
5
- /// <summary>
6
- /// The whole render step against checked-in files (fixtures/RenderGolden): a mini repo, its components.json, one batch
7
- /// of responsibilities, and the exact markdown they must produce.
8
- /// </summary>
9
- public class RenderGoldenTests
10
- {
11
- private static string Golden => Path.Combine(FixturePaths.Root, "RenderGolden");
12
-
13
- [Fact]
14
- public async Task Renders_the_fixture_to_exactly_the_expected_markdown()
15
- {
16
- var output = Path.Combine(Directory.CreateTempSubdirectory("lc-golden-").FullName, "out.md");
17
- var errors = new StringWriter();
18
-
19
- var exit = await RenderCommand.RunAsync(
20
- [
21
- "--components", Path.Combine(Golden, "components.json"),
22
- "--resp", Path.Combine(Golden, "resp"),
23
- "--repo", Path.Combine(Golden, "repo"),
24
- "--out", output,
25
- ],
26
- errors);
27
-
28
- Assert.Equal((0, ""), (exit, errors.ToString()));
29
- // Git may check the expected file out with CRLF; render always writes LF.
30
- var expected = File.ReadAllText(Path.Combine(Golden, "expected.md")).ReplaceLineEndings("\n");
31
- Assert.Equal(expected, Encoding.UTF8.GetString(File.ReadAllBytes(output)));
32
- Directory.Delete(Path.GetDirectoryName(output)!, recursive: true);
33
- }
34
- }
@@ -1,55 +0,0 @@
1
- namespace LogicalComponents.Tests;
2
-
3
- /// <summary>A small hand-built extraction, so render tests do not depend on Roslyn or the fixture solution.</summary>
4
- internal static class RenderTestData
5
- {
6
- /// <summary>
7
- /// The cited files' lines, as the render command reads them from the repo. Every line is code except in OrderQueue.cs,
8
- /// whose lines 7-9 are blank, a comment and a brace. Declared before <see cref="Extraction"/>, which hashes these
9
- /// same lines the way <c>extract</c> would, so a test repo written from <see cref="Lines"/> always matches.
10
- /// </summary>
11
- public static IReadOnlyDictionary<string, IReadOnlyList<string>> Lines { get; } = new Dictionary<string, IReadOnlyList<string>>
12
- {
13
- ["src/App/OrderAcceptance.cs"] = Code(17),
14
- ["src/App/ReceiptPrinting.cs"] = Code(7),
15
- ["src/App/ReceiptPrinting.Totals.cs"] = Code(6),
16
- ["src/Infra/OrderQueue.cs"] = [.. Code(6), "", " // keeps orders", " {", " Store(order);", "}"],
17
- };
18
-
19
- public static ExtractResult Extraction { get; } = new(
20
- Components:
21
- [
22
- new Component("OrderAcceptance", "Sample.Application.OrderAcceptance", "Order Acceptance", "Sample", "Application",
23
- [new SourceSpan("src/App/OrderAcceptance.cs", 4, 17)]),
24
- new Component("ReceiptPrinting", "Sample.Application.ReceiptPrinting", "Receipt Printing", "Sample", "Application",
25
- [new SourceSpan("src/App/ReceiptPrinting.Totals.cs", 3, 6), new SourceSpan("src/App/ReceiptPrinting.cs", 4, 7)]),
26
- new Component("OrderQueue", "Sample.Infrastructure.OrderQueue", "Order Queue", "Sample", "Infrastructure",
27
- [new SourceSpan("src/Infra/OrderQueue.cs", 6, 11)]),
28
- ],
29
- ExternalNodes: [new ExternalNode("IAuditTrail", "Sample.Application.IAuditTrail", "I Audit Trail", "port")],
30
- Edges:
31
- [
32
- new Edge("OrderAcceptance", "IAuditTrail", ["di"], [], "src/App/OrderAcceptance.cs:4"),
33
- new Edge("OrderAcceptance", "OrderQueue", ["di", "new"], ["IOrderQueue", "IQueue"], "src/App/OrderAcceptance.cs:4"),
34
- new Edge("ReceiptPrinting", "OrderAcceptance", ["inherits"], [], "src/App/ReceiptPrinting.cs:4"),
35
- ],
36
- Warnings: [],
37
- FileHashes: Lines.ToDictionary(kv => kv.Key, kv => HashOfLines(kv.Value), StringComparer.Ordinal));
38
-
39
- public static Dictionary<string, IReadOnlyList<Responsibility>> ValidResponsibilities() => new()
40
- {
41
- ["OrderAcceptance"] =
42
- [
43
- new Responsibility("Rejects an order that fails validation before anything is queued.", "src/App/OrderAcceptance.cs:8-12"),
44
- new Responsibility("Queues every accepted order.", "src/App/OrderAcceptance.cs:14"),
45
- ],
46
- ["ReceiptPrinting"] = [new Responsibility("Prints a receipt footer with the order total.", "src/App/ReceiptPrinting.Totals.cs:5")],
47
- ["OrderQueue"] = [new Responsibility("Stores each queued order as an entry.", "src/Infra/OrderQueue.cs:10")],
48
- };
49
-
50
- private static string[] Code(int count) => [.. Enumerable.Range(1, count).Select(i => $"var line{i} = {i};")];
51
-
52
- // Matches what File.WriteAllLines writes for these lines (each terminated, including the last) once CRLF is
53
- // normalized to LF: exactly what ComponentsFile.HashFile would compute for the file RenderCommandTests writes.
54
- private static string HashOfLines(IReadOnlyList<string> lines) => ComponentsFile.HashText(string.Join('\n', lines) + "\n");
55
- }