Skip to content

Commit 547cadf

Browse files
committed
chore(scripts): redo cli audit script: get commands from source code and grep docs for commands- replaces the CLI audit script- searches tagged repo branch source code for CLI commands- searches docs content the commands- allows including and excluding "categories" of docs paths to search
1 parent 9bdbe94 commit 547cadf

File tree

3 files changed

+1303
-1262
lines changed

3 files changed

+1303
-1262
lines changed

helper-scripts/influxdb3-monolith/README.md

Lines changed: 74 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -41,40 +41,52 @@ Creates and configures authentication tokens for InfluxDB 3 containers.
4141
./setup-auth-tokens.sh enterprise
4242
```
4343

44-
### 🔍 CLI Documentation Audit
44+
### 📘 CLI Documentation Audit
4545

46-
#### `audit-cli-documentation.js`
47-
JavaScript ESM script that audits InfluxDB 3 CLI commands against existing documentation to identify missing or outdated content.
46+
#### `documentation-audit.js`
47+
JavaScript ESM script that parses InfluxDB 3 source code to extract CLI commands and audits them against existing documentation with enhanced accuracy and category filtering.
4848

4949
**Usage:**
5050
```bash
51-
node audit-cli-documentation.js [core|enterprise|both] [version|local]
51+
node documentation-audit.js [core|enterprise|both] [version/branch/tag] [--categories=CATEGORY1,CATEGORY2,...]
5252
```
5353

5454
**Features:**
55-
- Compares actual CLI help output with documented commands
56-
- Identifies missing documentation for new CLI options
57-
- Finds documented options that no longer exist in the CLI
58-
- Supports both released versions and local containers
59-
- Generates detailed audit reports with recommendations
60-
- Handles authentication automatically using Docker secrets
55+
- **Source code parsing**: Parses Rust CLI implementation directly from source code
56+
- **Accurate pattern matching**: Uses regex with word boundaries to reduce false positives
57+
- **Category-based filtering**: Focus audits on specific documentation areas
58+
- **Enterprise feature detection**: Identifies enterprise-specific commands and features
59+
- **Complete option extraction**: Extracts descriptions, defaults, environment variables, and requirements
60+
- **Template generation**: Creates documentation templates for missing commands
61+
62+
**Available Categories:**
63+
- `CLI_REFERENCE` - CLI reference documentation
64+
- `API_REFERENCE` - API documentation
65+
- `GETTING_STARTED` - Getting started and tutorials
66+
- `ADMIN_GUIDES` - Administration and management
67+
- `WRITE_DATA` - Write and ingest data documentation
68+
- `QUERY_DATA` - Query and read data documentation
69+
- `PROCESS_DATA` - Process and transform data documentation
70+
- `GENERAL_REFERENCE` - General reference documentation
6171

6272
**Examples:**
6373
```bash
64-
# Audit Core documentation against local container
65-
node audit-cli-documentation.js core local
74+
# Audit Core documentation with all categories
75+
node documentation-audit.js core main
6676

67-
# Audit Enterprise documentation against specific version
68-
node audit-cli-documentation.js enterprise v3.2.0
77+
# Audit Enterprise with only CLI and API reference categories
78+
node documentation-audit.js enterprise main --categories=CLI_REFERENCE,API_REFERENCE
6979

70-
# Audit both products against local containers
71-
node audit-cli-documentation.js both local
80+
# Audit specific version with getting started docs only
81+
node documentation-audit.js both v3.3.0 --categories=GETTING_STARTED
82+
83+
# Audit with multiple specific categories
84+
node documentation-audit.js core main --categories=CLI_REFERENCE,ADMIN_GUIDES,WRITE_DATA
7285
```
7386

7487
**Output:**
75-
- `../output/cli-audit/documentation-audit-{product}-{version}.md` - Detailed audit report
76-
- `../output/cli-audit/parsed-cli-{product}-{version}.md` - Parsed CLI structure
77-
- `../output/cli-audit/patches/{product}/` - Generated patches for missing documentation
88+
- `../output/cli-audit/documentation-audit-{product}-{version}.md` - Enhanced audit report with source code insights
89+
- `../output/cli-audit/patches/{product}/` - Generated documentation templates with complete option details
7890

7991
### 🛠️ CLI Documentation Updates
8092

@@ -131,12 +143,12 @@ docker compose down && docker compose up -d influxdb3-core influxdb3-enterprise
131143
### 2. CLI Documentation Audit
132144

133145
```bash
134-
# Start your containers
135-
docker compose up -d influxdb3-core influxdb3-enterprise
146+
# Audit CLI documentation from source code
147+
node documentation-audit.js core main
148+
node documentation-audit.js enterprise main
136149

137-
# Audit CLI documentation
138-
node audit-cli-documentation.js core local
139-
node audit-cli-documentation.js enterprise local
150+
# Or audit with specific categories
151+
node documentation-audit.js both main --categories=CLI_REFERENCE
140152

141153
# Review the output
142154
ls ../output/cli-audit/
@@ -145,12 +157,12 @@ ls ../output/cli-audit/
145157
### 3. Development Workflow
146158

147159
```bash
148-
# Audit documentation for both products
149-
node audit-cli-documentation.js both local
160+
# Audit using source code parsing with category filtering
161+
node documentation-audit.js both main --categories=CLI_REFERENCE,API_REFERENCE
150162

151163
# Check the audit results
152-
cat ../output/cli-audit/documentation-audit-core-local.md
153-
cat ../output/cli-audit/documentation-audit-enterprise-local.md
164+
cat ../output/cli-audit/documentation-audit-core-main.md
165+
cat ../output/cli-audit/documentation-audit-enterprise-main.md
154166

155167
# Apply patches if needed (dry run first)
156168
node apply-cli-patches.js both --dry-run
@@ -162,7 +174,7 @@ For release documentation, use the audit and patch workflow:
162174

163175
```bash
164176
# Audit against released version
165-
node audit-cli-documentation.js enterprise v3.2.0
177+
node documentation-audit.js enterprise v3.2.0
166178

167179
# Review missing documentation
168180
cat ../output/cli-audit/documentation-audit-enterprise-v3.2.0.md
@@ -176,12 +188,18 @@ git diff content/influxdb3/enterprise/reference/cli/
176188

177189
## Container Integration
178190

179-
The scripts work with your Docker Compose setup:
191+
The scripts work with your Docker Compose setup and automatically manage container lifecycle:
180192

181193
**Expected container names:**
182194
- `influxdb3-core` (port 8282)
183195
- `influxdb3-enterprise` (port 8181)
184196

197+
**Container management:**
198+
- Scripts automatically start containers if they're not running
199+
- Uses `docker compose up -d {service}` to start services
200+
- Waits for containers to be ready before proceeding
201+
- Uses `docker compose exec -T` for non-interactive command execution
202+
185203
**Docker Compose secrets:**
186204
- `influxdb3-core-admin-token` - Admin token for Core (stored in `~/.env.influxdb3-core-admin-token`)
187205
- `influxdb3-enterprise-admin-token` - Admin token for Enterprise (stored in `~/.env.influxdb3-enterprise-admin-token`)
@@ -193,7 +211,7 @@ The scripts work with your Docker Compose setup:
193211

194212
1. **Pre-release audit:**
195213
```bash
196-
node audit-cli-documentation.js core v3.2.0
214+
node documentation-audit.js core v3.2.0
197215
```
198216

199217
2. **Review audit results and update documentation**
@@ -202,9 +220,9 @@ The scripts work with your Docker Compose setup:
202220

203221
### 🔬 Development Testing
204222

205-
1. **Audit local development:**
223+
1. **Audit development branch:**
206224
```bash
207-
node audit-cli-documentation.js enterprise local
225+
node documentation-audit.js enterprise main
208226
```
209227

210228
2. **Verify new features are documented**
@@ -215,7 +233,7 @@ The scripts work with your Docker Compose setup:
215233

216234
1. **Final audit before release:**
217235
```bash
218-
node audit-cli-documentation.js both local
236+
node documentation-audit.js both v3.3.0
219237
```
220238

221239
2. **Apply all pending patches**
@@ -228,21 +246,20 @@ The scripts work with your Docker Compose setup:
228246
helper-scripts/
229247
├── output/
230248
│ └── cli-audit/
231-
│ ├── documentation-audit-core-local.md # CLI documentation audit report
232-
│ ├── documentation-audit-enterprise-v3.2.0.md # CLI documentation audit report
233-
│ ├── parsed-cli-core-local.md # Parsed CLI structure
234-
│ ├── parsed-cli-enterprise-v3.2.0.md # Parsed CLI structure
249+
│ ├── documentation-audit-core-main.md # CLI documentation audit report
250+
│ ├── documentation-audit-enterprise-v3.2.0.md # CLI documentation audit report
251+
│ ├── influxdb-clone/ # Working copy of source code
235252
│ └── patches/
236253
│ ├── core/ # Generated patches for Core
237-
│ │ ├── influxdb3-cli-patch-001.md
238-
│ │ └── influxdb3-cli-patch-002.md
254+
│ │ ├── query.md
255+
│ │ └── write.md
239256
│ └── enterprise/ # Generated patches for Enterprise
240-
│ ├── influxdb3-cli-patch-001.md
241-
│ └── influxdb3-cli-patch-002.md
257+
│ ├── backup.md
258+
│ └── restore.md
242259
└── influxdb3-monolith/
243260
├── README.md # This file
244261
├── setup-auth-tokens.sh # Auth setup
245-
├── audit-cli-documentation.js # CLI documentation audit
262+
├── documentation-audit.js # CLI documentation audit (source code-based)
246263
└── apply-cli-patches.js # CLI documentation patches
247264
```
248265

@@ -252,11 +269,20 @@ helper-scripts/
252269

253270
**Container not running:**
254271
```bash
255-
# Check status
272+
# Scripts now handle this automatically, but you can manually check:
256273
docker compose ps
257274

258-
# Start specific service
259-
docker compose up -d influxdb3-core
275+
# Or manually start
276+
docker compose up -d influxdb3-core influxdb3-enterprise
277+
```
278+
279+
**Source code access issues:**
280+
```bash
281+
# Check if the source repository exists
282+
ls /Users/ja/Documents/github/influxdata/influxdb
283+
284+
# Verify git access
285+
cd /Users/ja/Documents/github/influxdata/influxdb && git status
260286
```
261287

262288
**Authentication failures:**
@@ -290,7 +316,7 @@ DEBUG=1 node audit-cli-documentation.js core local
290316
- name: Audit CLI Documentation
291317
run: |
292318
cd helper-scripts/influxdb3-monolith
293-
node audit-cli-documentation.js core ${{ env.VERSION }}
319+
node documentation-audit.js core ${{ env.VERSION }}
294320
295321
- name: Upload CLI Audit Results
296322
uses: actions/upload-artifact@v3
@@ -306,7 +332,7 @@ DEBUG=1 node audit-cli-documentation.js core local
306332
name: CLI Documentation Audit
307333
command: |
308334
cd helper-scripts/influxdb3-monolith
309-
node audit-cli-documentation.js enterprise v3.2.0
335+
node documentation-audit.js enterprise v3.2.0 --categories=CLI_REFERENCE
310336
311337
- store_artifacts:
312338
path: helper-scripts/output/cli-audit/

0 commit comments

Comments
 (0)