# Naming Audit Fix Guide

## Policy

- File base names: lowercase letters and digits only. No hyphen (`-`) and no underscore (`_`). The final extension separator is allowed.
- Directory names: lowercase letters, digits, and underscore only. No hyphen and no period.
- Existing names are not safe to bulk-rename without reviewing all PHP includes, `require`/`include` calls, HTML links, JavaScript imports, URLs, deployment references, and case-sensitive server paths.

## Commands

Review violations:

```bash
./audit.naming.sh defapp --details --summary
```

Include backup/editor residue:

```bash
./audit.naming.sh defapp --details --summary --backup
```

Generate a review-only rename plan:

```bash
./audit.naming.sh defapp --details --fix
```

This writes `rename.defapp.sh` in the current directory. It contains only commented `mv` commands. It never performs renames automatically.

## Review workflow

1. Read every `NAME-FILE` and `NAME-DIR` finding.
2. Decide whether the item is active source, a public route, legacy material, generated content, or an approved exception.
3. Inspect references before renaming:

```bash
grep -RIn --include='*.php' --include='*.js' --include='*.css' --include='*.html' 'old-name' /home/intel145/websites/apps/defapp
```

4. Update references first or in the same reviewed change.
5. Uncomment one rename at a time in `rename.defapp.sh`.
6. Test locally and in browser after each logical rename group.
7. Run the architecture audit and naming audit again.

## Important

- A rename plan cannot safely update references by itself.
- Do not run a plan in production without a backup, Git clean state, and review.
- Do not rename public URL paths without deciding whether redirects/backward compatibility are required.
