Skip to content

Commit fc3248f

Browse files
authored
Merge pull request #24 from netwrix/dev
Added CLAUDE.md, custom Claude Code slash commands, Husky pre-commit for Prettier, etc.
2 parents 1fb6f18 + 69caea7 commit fc3248f

File tree

12 files changed

+893
-128
lines changed

12 files changed

+893
-128
lines changed

.claude/commands/add-version.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Add New Version to Existing Product
2+
3+
This command helps you quickly add a new version to an existing product in the documentation.
4+
5+
## Steps to Complete
6+
7+
1. **Gather Information**
8+
- Ask user for product name (e.g., "accessanalyzer", "threatprevention")
9+
- Ask for new version number (e.g., "12.1", "7.6")
10+
- Identify the current latest version by checking existing directories
11+
12+
2. **Copy Documentation from Latest Version**
13+
```bash
14+
# Find latest version
15+
ls -d /docs/{productname}/*/ | sort -V | tail -1
16+
17+
# Copy to new version
18+
cp -r /docs/{productname}/{latest_version}/ /docs/{productname}/{new_version}/
19+
```
20+
21+
3. **Update Frontmatter in Copied Files**
22+
- Update version references in all `.md` files
23+
- Update any version-specific content in whatsnew.md
24+
25+
4. **Create New Sidebar Configuration**
26+
```bash
27+
cp /sidebars/{productname}-{latest_version}-sidebar.js /sidebars/{productname}-{new_version}-sidebar.js
28+
```
29+
30+
Update the sidebar file if it contains version-specific paths.
31+
32+
5. **Add to docusaurus.config.js**
33+
34+
Add new plugin configuration after the existing versions:
35+
```javascript
36+
[
37+
'@docusaurus/plugin-content-docs',
38+
{
39+
id: '{productname}{version_underscores}', // e.g., 'accessanalyzer12_1'
40+
path: 'docs/{productname}/{version}',
41+
routeBasePath: 'docs/{productname}/{version}',
42+
sidebarPath: require.resolve('./sidebars/{productname}-{version}-sidebar.js'),
43+
editUrl: 'https://github.com/netwrix/docs/tree/main/',
44+
exclude: ['**/CLAUDE.md'],
45+
versions: {
46+
current: {
47+
label: '{version}',
48+
},
49+
},
50+
},
51+
],
52+
```
53+
54+
6. **Update HomepageFeatures Component**
55+
56+
Find the product in `/src/components/HomepageFeatures/index.js` and update the link to point to the new version:
57+
```javascript
58+
{
59+
title: '{Product Name}',
60+
link: '/docs/{productname}/{new_version}', // Update to new version
61+
description: '{product description}'
62+
},
63+
```
64+
65+
7. **Test the New Version**
66+
```bash
67+
npm start {productname}/{new_version}
68+
```
69+
70+
8. **Update What's New Page**
71+
- Clear the content in `/docs/{productname}/{new_version}/whatsnew.md`
72+
- Add placeholder for new version features
73+
74+
## Example
75+
76+
Adding version 12.1 to Access Analyzer:
77+
1. Copy from 12.0: `cp -r docs/accessanalyzer/12.0/ docs/accessanalyzer/12.1/`
78+
2. Create sidebar: `cp sidebars/accessanalyzer-12.0-sidebar.js sidebars/accessanalyzer-12.1-sidebar.js`
79+
3. Add plugin with id: `accessanalyzer12_1`
80+
4. Update HomepageFeatures link to `/docs/accessanalyzer/12.1`
81+
5. Test: `npm start accessanalyzer/12.1`
82+
83+
## Important Notes
84+
85+
- Version numbers use dots in paths (12.1) but underscores in IDs (12_1)
86+
- Always test the new version before committing
87+
- Update whatsnew.md with actual changes for the new version
88+
- Consider if any version-specific content needs updating

.claude/commands/convert-images.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Convert Images to WebP Format
2+
3+
This command helps you batch convert PNG/JPG images to WebP format for better performance and update all references in the documentation.
4+
5+
## Prerequisites
6+
7+
Ensure `cwebp` is installed:
8+
```bash
9+
# macOS
10+
brew install webp
11+
12+
# Ubuntu/Debian
13+
sudo apt-get install webp
14+
15+
# Check installation
16+
cwebp -version
17+
```
18+
19+
## Steps to Complete
20+
21+
1. **Select Scope**
22+
- Ask user: Convert images for specific product or all products?
23+
- If specific product, ask which one (e.g., "accessanalyzer")
24+
25+
2. **Find Images to Convert**
26+
```bash
27+
# For specific product
28+
find /static/img/product_docs/{productname} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -print0
29+
30+
# For all products
31+
find /static/img/product_docs -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -print0
32+
```
33+
34+
3. **Create Backup**
35+
```bash
36+
# Create backup directory with timestamp
37+
backup_dir="/static/img/product_docs/.backup-$(date +%Y%m%d-%H%M%S)"
38+
mkdir -p "$backup_dir"
39+
40+
# Copy images to backup
41+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -exec cp {} "$backup_dir/" \;
42+
```
43+
44+
4. **Convert Images to WebP**
45+
```bash
46+
# Convert each image
47+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) | while read -r img; do
48+
# Get filename without extension
49+
filename="${img%.*}"
50+
51+
# Convert to WebP (quality 85 is usually good balance)
52+
cwebp -q 85 "$img" -o "${filename}.webp"
53+
54+
echo "Converted: $img -> ${filename}.webp"
55+
done
56+
```
57+
58+
5. **Update Markdown References**
59+
```bash
60+
# Find all markdown files that reference the images
61+
# For each converted image, update references
62+
63+
# Example for a specific image:
64+
old_image="image.png"
65+
new_image="image.webp"
66+
67+
# Find and replace in markdown files
68+
find /docs/{scope} -name "*.md" -type f -exec grep -l "$old_image" {} \; | while read -r file; do
69+
# Use sed to replace image references
70+
sed -i.bak "s|${old_image}|${new_image}|g" "$file"
71+
done
72+
```
73+
74+
6. **Verify Updates**
75+
- Check that all references were updated
76+
- Preview a few pages to ensure images display correctly
77+
- Compare file sizes to show savings
78+
79+
7. **Clean Up Old Images**
80+
After verification, ask user to confirm deletion:
81+
```bash
82+
# Show size comparison
83+
echo "Original images size:"
84+
du -sh /static/img/product_docs/.backup-*/
85+
86+
echo "WebP images size:"
87+
find /static/img/product_docs/{scope} -name "*.webp" -exec du -ch {} + | grep total
88+
89+
# If confirmed, remove original images
90+
find /static/img/product_docs/{scope} -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.jpeg" \) -delete
91+
```
92+
93+
8. **Test Documentation**
94+
```bash
95+
# Start development server to verify images load
96+
npm start {productname}
97+
```
98+
99+
## Quality Settings
100+
101+
- **85**: Good balance of quality and size (default)
102+
- **90**: Higher quality for detailed screenshots
103+
- **80**: Smaller size for simple diagrams
104+
- **95**: Near-lossless for critical images
105+
106+
## Example Output
107+
108+
```
109+
Converting images for accessanalyzer...
110+
✓ Created backup at /static/img/product_docs/.backup-20240119-143022/
111+
✓ Converted 45 images to WebP format
112+
✓ Updated 127 markdown files
113+
✓ Size reduction: 12.3MB → 4.7MB (62% smaller)
114+
✓ All images verified in documentation
115+
116+
Delete original images? (y/n)
117+
```
118+
119+
## Important Notes
120+
121+
- Always create a backup before converting
122+
- Test image quality before deleting originals
123+
- WebP is supported by all modern browsers
124+
- Some images may not benefit from conversion (already optimized PNGs)
125+
- Consider keeping originals if they're source files for editing

.claude/commands/new-product.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Create New Product Documentation: $ARGUMENTS
2+
3+
This command helps you quickly set up a new product in the Netwrix documentation site.
4+
5+
Product name provided: **$ARGUMENTS**
6+
7+
## Steps to Complete
8+
9+
1. **Create product directory structure**
10+
- Parse product name from $ARGUMENTS. If given a normal name (e.g. "Netwrix Privilege Secure") use all lowercase, no spaces, and always remove "netwrix" from the name (e.g., "privilegesecure")
11+
- Ask if product has versions or is single version (e.g., SaaS)
12+
- If versioned: ask for version numbers (e.g., "7.4", "7.5")
13+
- Create directories:
14+
- Single version: `/docs/{productname}/`
15+
- Versioned: `/docs/{productname}/{version}/` for each version
16+
17+
2. **Create sidebar configuration**
18+
- For single version: create `/sidebars/{productname}-sidebar.js`
19+
- For versioned: create `/sidebars/{productname}-{version}-sidebar.js` for each version
20+
21+
Example sidebar format:
22+
```javascript
23+
// @ts-check
24+
25+
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
26+
const sidebars = {
27+
sidebar: [
28+
{
29+
type: 'autogenerated',
30+
dirName: '.',
31+
},
32+
],
33+
};
34+
35+
export default sidebars;
36+
```
37+
38+
3. **Add to the plugins list of docusaurus.config.js**
39+
40+
For single version product:
41+
```javascript
42+
// $ARGUMENTS Product
43+
[
44+
'@docusaurus/plugin-content-docs',
45+
{
46+
id: '{productname}',
47+
path: 'docs/{productname}',
48+
routeBasePath: 'docs/{productname}',
49+
sidebarPath: require.resolve('./sidebars/{productname}-sidebar.js'),
50+
editUrl: 'https://github.com/netwrix/docs/tree/main/',
51+
exclude: ['**/CLAUDE.md'],
52+
versions: {
53+
current: {
54+
label: 'Current',
55+
},
56+
},
57+
},
58+
],
59+
```
60+
61+
For versioned product (add one for each version):
62+
```javascript
63+
// $ARGUMENTS Product {version}
64+
[
65+
'@docusaurus/plugin-content-docs',
66+
{
67+
id: '{productname}{version_with_underscores}', // e.g., 'threatprevention7_5'
68+
path: 'docs/{productname}/{version}',
69+
routeBasePath: 'docs/{productname}/{version}',
70+
sidebarPath: require.resolve('./sidebars/{productname}-{version}-sidebar.js'),
71+
editUrl: 'https://github.com/netwrix/docs/tree/main/',
72+
exclude: ['**/CLAUDE.md'],
73+
versions: {
74+
current: {
75+
label: '{version}',
76+
},
77+
},
78+
},
79+
],
80+
```
81+
82+
4. **Add to HomepageFeatures component**
83+
84+
Ask user which category $ARGUMENTS belongs to:
85+
- Identity Management
86+
- Privileged Access Management (PAM)
87+
- Directory Management
88+
- Endpoint Management
89+
- Data Security Posture Management (DSPM)
90+
- Identity Threat Detection & Response (ITDR)
91+
- Other
92+
93+
Add to `/src/components/HomepageFeatures/index.js` in the appropriate category:
94+
95+
For single version:
96+
```javascript
97+
{
98+
title: '$ARGUMENTS',
99+
link: '/docs/{productname}',
100+
description: '{Brief product description}'
101+
},
102+
```
103+
104+
For versioned (add latest version):
105+
```javascript
106+
{
107+
title: '$ARGUMENTS',
108+
link: '/docs/{productname}/{latest_version}',
109+
description: '{Brief product description}'
110+
},
111+
```
112+
113+
5. **Collapse directories in IDE**
114+
If using Cursor IDE, collapse all directories except `/docs/{productname}`
115+
116+
## Product Categories Reference // Update this list with $ARGUMENTS
117+
118+
- **Identity Management**: Identity Manager, Directory Manager, Platform Governance products
119+
- **Privileged Access Management (PAM)**: Privilege Secure, Endpoint Privilege Manager, Password Secure
120+
- **Directory Management**: Auditor, Directory Manager, Password Policy Enforcer
121+
- **Endpoint Management**: Endpoint Protector, Endpoint Policy Manager, Change Tracker
122+
- **Data Security Posture Management (DSPM)**: 1Secure, Auditor, Access Analyzer, Data Classification
123+
- **Identity Threat Detection & Response (ITDR)**: PingCastle, Access Analyzer, Threat Manager, Threat Prevention, Recovery for AD
124+
- **Other**: Access Information Center, Activity Monitor, Password Reset, Flashlight products
125+
126+
## Important Notes
127+
128+
- Product names should be lowercase with no spaces (e.g., "privilegesecure" not "Privilege Secure")
129+
- Version numbers use dots in paths but underscores in IDs (e.g., path: "7.5", id: "7_5")
130+
- All products need the CLAUDE.md exclusion in their config
131+
- Test with `npm start {productname}` or `npm start {productname}/{version}` after creation
132+
- Product being created: **$ARGUMENTS**

.claude/settings.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(*)",
5+
"mcp__*"
6+
],
7+
"deny": [
8+
"Bash(rm -rf /)",
9+
"Bash(rm -rf /*)",
10+
"Bash(rm -rf ~)",
11+
"Bash(rm -rf ~/*)",
12+
"Bash(rm -rf .)",
13+
"Bash(rm -rf ..)",
14+
"Bash(rm -rf *)",
15+
"Bash(find / -delete)",
16+
"Bash(find . -delete)",
17+
"Bash(find ~ -delete)"
18+
]
19+
},
20+
"autoApprove": {
21+
"write": true,
22+
"edit": true
23+
}
24+
}

0 commit comments

Comments
 (0)