Last active
January 2, 2026 02:11
-
-
Save xHeaven/b39c74fccb85958d5c2e7ea916195cfa to your computer and use it in GitHub Desktop.
Replaces your organization name in Claude Code with [REDACTED] - v2.0.76
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Redact organization name from Claude Code CLI - ALL occurrences | |
| # Usage: ./redact-org.sh <cli.js path> [apply|restore|status] | |
| if [ $# -lt 2 ]; then | |
| echo "Usage: $0 <cli.js path> {apply|restore|status}" | |
| echo "" | |
| echo "Example: $0 /path/to/cli.js apply" | |
| exit 1 | |
| fi | |
| CLI_FILE="$1" | |
| shift | |
| if [ ! -f "$CLI_FILE" ]; then | |
| echo "Error: $CLI_FILE not found" | |
| exit 1 | |
| fi | |
| # Patterns to find/replace | |
| # 1. Status display: if(A.organization)Q.push({label:"Organization",value:A.organization}); | |
| # 2. Org name retrieval: let J=Y3()?.organizationName;if(J)B.organization=J | |
| # 3. Component usage: D=H.oauthAccount?.organizationName | |
| case "$1" in | |
| apply) | |
| echo "Applying patches..." | |
| # Patch 1: Status display - replace value with [REDACTED] | |
| perl -i -pe 's/if\(A\.organization\)Q\.push\(\{label:"Organization",value:A\.organization\}\)/if(A.organization)Q.push({label:"Organization",value:"[REDACTED]"})/g' "$CLI_FILE" | |
| # Patch 2: Org name retrieval - set to [REDACTED] instead of actual name | |
| perl -i -pe 's/let J=Y3\(\)\?\.organizationName;if\(J\)B\.organization=J/let J=Y3()?.organizationName;if(J)B.organization="[REDACTED]"/g' "$CLI_FILE" | |
| # Patch 3: Component usage - replace with [REDACTED] | |
| perl -i -pe 's/D=H\.oauthAccount\?\.organizationName/D="[REDACTED]"/g' "$CLI_FILE" | |
| # Verify patches | |
| PATCHED=0 | |
| if grep -q 'value:"\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " ✓ Patched: Status display" | |
| PATCHED=$((PATCHED + 1)) | |
| fi | |
| if grep -q 'B\.organization="\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " ✓ Patched: Org name retrieval" | |
| PATCHED=$((PATCHED + 1)) | |
| fi | |
| if grep -q 'D="\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " ✓ Patched: Component display" | |
| PATCHED=$((PATCHED + 1)) | |
| fi | |
| if [ $PATCHED -gt 0 ]; then | |
| echo "Applied $PATCHED patch(es) successfully" | |
| else | |
| echo "Warning: No patches were applied (patterns may have changed)" | |
| fi | |
| ;; | |
| restore) | |
| echo "Restoring original..." | |
| # Restore 1: Status display | |
| perl -i -pe 's/if\(A\.organization\)Q\.push\(\{label:"Organization",value:"\[REDACTED\]"\}\)/if(A.organization)Q.push({label:"Organization",value:A.organization})/g' "$CLI_FILE" | |
| # Restore 2: Org name retrieval | |
| perl -i -pe 's/let J=Y3\(\)\?\.organizationName;if\(J\)B\.organization="\[REDACTED\]"/let J=Y3()?.organizationName;if(J)B.organization=J/g' "$CLI_FILE" | |
| # Restore 3: Component usage | |
| perl -i -pe 's/D="\[REDACTED\]"/D=H.oauthAccount?.organizationName/g' "$CLI_FILE" | |
| # Verify restores | |
| RESTORED=0 | |
| if grep -q 'value:A\.organization' "$CLI_FILE"; then | |
| echo " ✓ Restored: Status display" | |
| RESTORED=$((RESTORED + 1)) | |
| fi | |
| if grep -q 'B\.organization=J' "$CLI_FILE"; then | |
| echo " ✓ Restored: Org name retrieval" | |
| RESTORED=$((RESTORED + 1)) | |
| fi | |
| if grep -q 'D=H\.oauthAccount' "$CLI_FILE"; then | |
| echo " ✓ Restored: Component display" | |
| RESTORED=$((RESTORED + 1)) | |
| fi | |
| if [ $RESTORED -gt 0 ]; then | |
| echo "Restored $RESTORED patch(es) successfully" | |
| else | |
| echo "Warning: Nothing to restore (already in original state?)" | |
| fi | |
| ;; | |
| status) | |
| echo "Checking patch status..." | |
| if grep -q 'value:"\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " Status display: REDACTED" | |
| elif grep -q 'value:A\.organization' "$CLI_FILE"; then | |
| echo " Status display: ORIGINAL" | |
| else | |
| echo " Status display: UNKNOWN" | |
| fi | |
| if grep -q 'B\.organization="\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " Org name retrieval: REDACTED" | |
| elif grep -q 'B\.organization=J' "$CLI_FILE"; then | |
| echo " Org name retrieval: ORIGINAL" | |
| else | |
| echo " Org name retrieval: UNKNOWN" | |
| fi | |
| if grep -q 'D="\[REDACTED\]"' "$CLI_FILE"; then | |
| echo " Component display: REDACTED" | |
| elif grep -q 'D=H\.oauthAccount' "$CLI_FILE"; then | |
| echo " Component display: ORIGINAL" | |
| else | |
| echo " Component display: UNKNOWN" | |
| fi | |
| ;; | |
| *) | |
| echo "Usage: $0 {apply|restore|status}" | |
| echo "" | |
| echo " apply - Replace organization name with [REDACTED] everywhere" | |
| echo " restore - Restore original organization name display" | |
| echo " status - Check current state of all patches" | |
| exit 1 | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment