(readmePath string)
| 56 | } |
| 57 | |
| 58 | func generateReadmeDocs(readmePath string) error { |
| 59 | // Create translation helper |
| 60 | t, _ := translations.TranslationHelper() |
| 61 | |
| 62 | // The README documents the default user experience: tools that are |
| 63 | // enabled with no special flags set. Installing a checker that reports |
| 64 | // every flag as disabled excludes tools gated by FeatureFlagEnable and |
| 65 | // keeps the legacy variants of tools gated by FeatureFlagDisable, so |
| 66 | // flag-gated duplicates don't appear twice. |
| 67 | // Build() can only fail if WithTools specifies invalid tools - not used here |
| 68 | r, _ := github.NewInventory(t). |
| 69 | WithToolsets([]string{"all"}). |
| 70 | WithFeatureChecker(noFeatureFlagsChecker). |
| 71 | Build() |
| 72 | |
| 73 | // Generate toolsets documentation |
| 74 | toolsetsDoc := generateToolsetsDoc(r) |
| 75 | |
| 76 | // Generate tools documentation |
| 77 | toolsDoc := generateToolsDoc(r) |
| 78 | |
| 79 | // Read the current README.md |
| 80 | // #nosec G304 - readmePath is controlled by command line flag, not user input |
| 81 | content, err := os.ReadFile(readmePath) |
| 82 | if err != nil { |
| 83 | return fmt.Errorf("failed to read README.md: %w", err) |
| 84 | } |
| 85 | |
| 86 | // Replace toolsets section |
| 87 | updatedContent, err := replaceSection(string(content), "START AUTOMATED TOOLSETS", "END AUTOMATED TOOLSETS", toolsetsDoc) |
| 88 | if err != nil { |
| 89 | return err |
| 90 | } |
| 91 | |
| 92 | // Replace tools section |
| 93 | updatedContent, err = replaceSection(updatedContent, "START AUTOMATED TOOLS", "END AUTOMATED TOOLS", toolsDoc) |
| 94 | if err != nil { |
| 95 | return err |
| 96 | } |
| 97 | |
| 98 | // Write back to file |
| 99 | err = os.WriteFile(readmePath, []byte(updatedContent), 0600) |
| 100 | if err != nil { |
| 101 | return fmt.Errorf("failed to write README.md: %w", err) |
| 102 | } |
| 103 | |
| 104 | return nil |
| 105 | } |
| 106 | |
| 107 | func generateRemoteServerDocs(docsPath string) error { |
| 108 | content, err := os.ReadFile(docsPath) //#nosec G304 |
nothing calls this directly
no test coverage detected