WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2025. It is now read-only.
@@ -11,6 +11,7 @@ A Go CLI tool for extracting and analyzing code examples from MongoDB documentat
11
11
-[Search Commands](#search-commands)
12
12
-[Analyze Commands](#analyze-commands)
13
13
-[Compare Commands](#compare-commands)
14
+
-[Count Commands](#count-commands)
14
15
-[Development](#development)
15
16
-[Project Structure](#project-structure)
16
17
-[Adding New Commands](#adding-new-commands)
@@ -34,11 +35,11 @@ This CLI tool helps maintain code quality across MongoDB's documentation by:
34
35
### Build from Source
35
36
36
37
```bash
37
-
cd audit-cli
38
-
go build
38
+
cd audit-cli/bin
39
+
go build ../
39
40
```
40
41
41
-
This creates an `audit-cli` executable in the current directory.
42
+
This creates an `audit-cli` executable in the `bin` directory.
42
43
43
44
### Run Without Building
44
45
@@ -62,8 +63,12 @@ audit-cli
62
63
│ ├── includes
63
64
│ ├── usage
64
65
│ └── procedures
65
-
└── compare # Compare files across versions
66
-
└── file-contents
66
+
│ └── usage
67
+
├── compare # Compare files across versions
68
+
│ └── file-contents
69
+
└── count # Count code examples and documentation pages
70
+
├── tested-examples
71
+
└── pages
67
72
```
68
73
69
74
### Extract Commands
@@ -930,6 +935,188 @@ product-dir/
930
935
Files that don't exist in certain versions are reported separately and do not cause errors. This is expected behavior
931
936
since features may be added or removed across versions.
932
937
938
+
### Count Commands
939
+
940
+
#### `count tested-examples`
941
+
942
+
Count tested code examples in the MongoDB documentation monorepo.
943
+
944
+
This command navigates to the `content/code-examples/tested` directory from the monorepo root and counts all files recursively. The tested directory has a two-level structure: L1 (language directories) and L2 (product directories).
945
+
946
+
**Use Cases:**
947
+
948
+
This command helps writers and maintainers:
949
+
- Track the total number of tested code examples
950
+
- Monitor code example coverage by product
951
+
- Identify products with few or many examples
952
+
- Count only source files (excluding output files)
-`--for-product <product>` - Only count code examples for a specific product
973
+
-`--count-by-product` - Display counts for each product
974
+
-`--exclude-output` - Only count source files (exclude .txt and .sh files)
975
+
976
+
**Current Valid Products:**
977
+
978
+
-`mongosh` - MongoDB Shell
979
+
-`csharp/driver` - C#/.NET Driver
980
+
-`go/driver` - Go Driver
981
+
-`go/atlas-sdk` - Atlas Go SDK
982
+
-`java/driver-sync` - Java Sync Driver
983
+
-`javascript/driver` - Node.js Driver
984
+
-`pymongo` - PyMongo Driver
985
+
986
+
**Output:**
987
+
988
+
By default, prints a single integer (total count) for use in CI or scripting. With `--count-by-product`, displays a formatted table with product names and counts.
989
+
990
+
#### `count pages`
991
+
992
+
Count documentation pages (.txt files) in the MongoDB documentation monorepo.
993
+
994
+
This command navigates to the `content` directory and recursively counts all `.txt` files, which represent documentation pages that resolve to unique URLs. The command automatically excludes certain directories and file types that don't represent actual documentation pages.
995
+
996
+
**Use Cases:**
997
+
998
+
This command helps writers and maintainers:
999
+
- Track the total number of documentation pages across the monorepo
1000
+
- Monitor documentation coverage by product/project
1001
+
- Identify projects with extensive or minimal documentation
1002
+
- Exclude auto-generated or deprecated content from counts
1003
+
- Count only current versions of versioned documentation
1004
+
- Compare page counts across different documentation versions
1005
+
1006
+
**Automatic Exclusions:**
1007
+
1008
+
The command automatically excludes:
1009
+
- Files in `code-examples` directories at the root of `content` or `source` (these contain plain text examples, not pages)
1010
+
- Files in the following directories at the root of `content`:
1011
+
-`404` - Error pages
1012
+
-`docs-platform` - Documentation for the MongoDB website and meta content
1013
+
-`meta` - MongoDB Meta Documentation - style guide, tools, etc.
1014
+
-`table-of-contents` - Navigation files
1015
+
- All non-`.txt` files (configuration files, YAML, etc.)
-`--for-project <project>` - Only count pages for a specific project (directory name under `content/`)
1045
+
-`--count-by-project` - Display counts for each project in a formatted table
1046
+
-`--exclude-dirs <dirs>` - Comma-separated list of directory names to exclude from counting (e.g., `deprecated,archive`)
1047
+
-`--current-only` - Only count pages in the current version (for versioned projects, counts only `current` or `manual` version directories; for non-versioned projects, counts all pages)
1048
+
-`--by-version` - Display counts grouped by project and version (shows version breakdown for versioned projects; non-versioned projects show as "(no version)")
1049
+
1050
+
**Output:**
1051
+
1052
+
By default, prints a single integer (total count) for use in CI or scripting. With `--count-by-project`, displays a formatted table with project names and counts. With `--by-version`, displays a hierarchical breakdown by project and version.
1053
+
1054
+
**Versioned Documentation:**
1055
+
1056
+
Some MongoDB documentation projects contain multiple versions, represented as distinct directories between the project directory and the `source` directory:
-`current` or `manual` - The current/latest version
1062
+
-`upcoming` - Pre-release version
1063
+
-`v{number}` - Specific version (e.g., `v8.0`, `v7.0`)
1064
+
1065
+
The `--current-only` flag counts only files in the current version directory (`current` or `manual`) for versioned projects, while counting all files for non-versioned projects.
1066
+
1067
+
The `--by-version` flag shows a breakdown of page counts for each version within each project.
1068
+
1069
+
**Note:** The `--current-only` and `--by-version` flags are mutually exclusive.
0 commit comments