Replaces the binary acl.allow/deny model with five permission verbs
(r/w/c/d/a) and first-class roles, and adds an authenticated file API
(PUT/DELETE/POST move/mkdir) so the HTML tools can edit-in-place over
HTTP. Closes the AC-3(7) and AC-6 federal-readiness gaps.
File API (zddc/internal/handler/fileapi.go)
- PUT <new> → action c
- PUT <existing> → action w
- PUT <.zddc> → action a (CanEditZddc strict-ancestor rule)
- DELETE → action d
- POST mkdir → action c (auto-writes creator-owned .zddc when the
parent is Incoming/Working/Staging)
- POST move → action w on src + c on dst, atomic via os.Rename
- Optional If-Match for optimistic concurrency, --max-write-bytes cap,
audit log emits a structured file_write event per operation.
Permission model (zddc/internal/zddc/{acl,file,roles,cascade_mode}.go)
- acl.permissions: { principal → verb-set } map; principals are email
patterns or role names. Empty verb set is an explicit deny.
- roles: { name → members } definitions, available at the level they
declare and all descendants. Closer-to-leaf shadows ancestor.
- Legacy acl.allow/deny still work; they fold into permissions at
parse time (allow → "rwcd", deny → "").
- Cascade walks leaf→root; first level with any matching entry wins;
the union of matching verb sets at that level decides.
- --cascade-mode=strict adds a root→leaf ancestor-deny pre-pass so an
ancestor explicit-deny is absolute (NIST AC-6). Default delegated
preserves the existing commercial behavior.
Special folders (zddc/internal/zddc/special.go)
- Incoming / Working / Staging: mkdir auto-writes a .zddc into the new
subdir granting created_by + that email rwcda directly. Same form
operators write by hand; creator can edit it later to add others.
- Issued / Received: server-enforced WORM split. Cascade grants
inherited from above the WORM folder are masked to r only; grants
placed at-or-below the WORM folder retain r,c. Operators grant
write-once (cr) to the doc controller via an explicit .zddc at the
Issued/Received folder. Admins exempt — only escape hatch.
Browser polyfill (shared/zddc-source.js)
- HttpDirectoryHandle + HttpFileHandle implement the FS Access API
surface (values, getFileHandle, createWritable, removeEntry,
queryPermission/requestPermission) over zddc-server's listing JSON
and file API. Existing tools written against showDirectoryPicker
work unchanged.
- detectServerRoot() returns { handle, status }: tools auto-load on
HTTP, surface a clear "no permission to list" message on 403, and
fall back to the welcome screen on 0.
- classifier renames take the atomic POST move path on HTTP-backed
handles; mdedit and transmittal route reads/writes through the
polyfill so prior FS-API code paths cover both modes.
Tests
- zddc/internal/zddc/{cascade_mode,roles,special,acl}_test.go cover
delegated vs strict, role membership / shadowing / legacy fallback,
WORM split semantics, verb-set parser round-trip.
- zddc/internal/handler/fileapi_test.go now also covers role-based
vendor scenarios, WORM blocking vendor & doc controller writes,
explicit Issued .zddc unlocking the cr drop-box, admin bypass,
auto-ownership on mkdir, and strict-mode lockouts.
Docs
- ARCHITECTURE.md + zddc/README.md document the verb model, role
syntax, special-folder behaviors, cascade-mode flag, and full file
API surface. Federal-readiness gap analysis strikes AC-3(7) and
AC-6.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| css | ||
| js | ||
| build.sh | ||
| README.md | ||
| template.html | ||
Document Classifier
Turn chaos into order - a spreadsheet-like tool for bulk renaming files to ZDDC format. Copy/paste with Excel for lightning-fast text operations. The entire app fits in a single HTML file that works forever.
🔗 Open Document Classifier - Click to use online, or right-click → "Save Link As" to keep your own copy.
Why This Tool?
Got a folder full of "spec_final_v2_REALLY_FINAL.pdf" files? This tool transforms them into properly named, searchable documents. It's like Excel for file names - edit hundreds at once, paste from spreadsheets, and save hours of manual renaming.
What You Can Do
📋 Excel-Like Editing
- Edit file names like a spreadsheet
- Copy/paste entire columns to/from Excel
- Select ranges just like Excel (click and drag)
- Tab through cells, sort columns, resize as needed
🚀 Bulk Operations
- Rename hundreds of files in seconds
- Auto-populate from existing ZDDC names
- Hide already-compliant files to focus on the rest
- Save all changes with one click
🎯 Smart Features
- Real-time validation shows errors instantly
- Files stay in their folders - just get new names
- Preview any file with a single click
- Automatic folder expansion shows everything at once
Quick Start
- Click "Select Directory" - Pick the folder with messy file names
- See the magic - Files appear in a spreadsheet, auto-parsed if already ZDDC
- Double-click to edit - Just like Excel, or paste from a spreadsheet
- Click "Save All" - All files renamed instantly
- That's it! - Your files are now organized and searchable
ZDDC Naming Convention
File Format
trackingNumber_revision (status) - title.extension
Example:
CE-BYR-ALL-EL-SPC-0001_A (IFC) - Cable Specification.pdf
Components:
- Tracking Number: Project identifier (e.g., CE-BYR-ALL-EL-SPC-0001)
- Revision: Document revision (e.g., A, B, 0, 1, A+C1)
- Status: Status code (IFC, IFR, IFI, AFD, AFC, ASB, etc.)
- Title: Descriptive title
- Extension: File type (.pdf, .docx, .dwg, etc.)
Folder Format (Transmittal)
YYYY-MM-DD_trackingNumber (status) - title
Example:
2024-10-15_CE-BYR-ALL (IFC) - October Specifications
How to Use
1. Select Directory
Click "Select Directory" and choose the root folder containing files to organize. The tool will:
- Scan all subdirectories
- Expand all folders automatically
- Load all files into the spreadsheet
- Parse existing ZDDC filenames into editable fields (shown in gray)
2. Navigate and Filter
Folder Tree:
- All folders start expanded
- Click folder names to select/deselect
- Click ▼/▶ icons to collapse/expand
- Selected folders show their files in the spreadsheet
Filtering:
- Type in column header filter boxes to filter rows
- Check "Hide Compliant Files" to focus on non-compliant files only
- Sort by clicking column headers (Shift+Click for multi-column sort)
3. Edit Files
Spreadsheet Interface:
- Auto-populated fields appear in gray italic text
- Double-click any cell to edit
- Press Enter or Tab to move to next cell
- Changes mark the row as modified (✓ ✗ buttons appear)
Excel Integration:
- Select cells (click and drag)
- Copy (Ctrl+C) and paste into Excel
- Edit in Excel (e.g., convert to proper case)
- Copy from Excel and paste back (Ctrl+V)
- Click "Save All" to apply all changes
4. Save Changes
Individual Files:
- Edit fields for a file
- Click ✓ button to save that file
- Click ✗ button to cancel changes
Batch Save:
- Edit multiple files
- Click "Save All" button to rename all modified files at once
- Click "Cancel All" to discard all changes
5. Preview Files
- Click any filename link to open the file in a new tab
- Works with PDFs, images, and browser-viewable files
6. Keyboard Shortcuts
- Tab: Move to next cell
- Shift+Tab: Move to previous cell
- Enter: Move down one row
- Escape: Cancel editing
- Ctrl+A (in tree): Select all visible folders
- Ctrl+S: Save all (when files are modified)
Common Status Codes
- IFR - Issued for Review
- IFC - Issued for Construction
- IFI - Issued for Information
- AFD - Approved for Design
- AFC - Approved for Construction
- ASB - As-Built
Real-World Examples
🔧 Fix ALL CAPS Titles
Have files like "CABLE SPECIFICATION.PDF"? Use the Excel trick:
- Select the Title column → Copy to Excel
- Use
=PROPER(A1)to fix casing - Paste back → Save All → Done!
📝 Organize Random Files
Transform spec001.pdf → CE-BYR-ALL-EL-SPC-0001_A (IFC) - Cable Specification.pdf
- Just fill in the spreadsheet cells
- Copy/paste common values
- Save All when ready
🔄 Update Revisions
Change revision A to B across multiple files:
- Gray text = current values
- Edit only what needs changing
- Batch save or save individually
Browser Compatibility
Requires:
- Modern Chromium-based browser (Chrome, Edge, Brave, etc.)
- File System Access API support
- JavaScript enabled
Privacy & Security
- All processing happens locally in your browser
- No data transmitted to any server
- File System Access API requires explicit user permission
- No tracking or analytics
Limitations
Folder Renaming
Due to browser API limitations, folders cannot be renamed directly. The tool will provide the correct folder name format for manual renaming in your file system.
File Preview
- PDFs open in browser tab
- Other file types download for viewing in native applications
- Browser cannot preview most file formats
File System Access
- Requires user permission for each directory
- Some file systems may have restrictions
- Network drives may not be fully supported
Tips for Efficient Use
- Use Hide Compliant Filter: Check to focus only on non-compliant files
- Excel Integration: Copy/paste columns to Excel for bulk text operations
- Auto-Population: Gray fields are auto-parsed - edit only what needs changing
- Column Sorting: Click headers to sort, Shift+Click for multi-level sorting
- Column Filtering: Type in header filter boxes to narrow down files
- Resize Columns: Drag column borders to see full content
- Save All: Edit multiple files then save all at once
Troubleshooting
"Permission denied" errors
- Ensure you've granted browser permission
- Try selecting the directory again
- Check file system permissions
Files not appearing
- Click "Refresh" button to rescan
- Ensure files aren't hidden by OS
- Check that directory handle is valid
Rename fails
- Check if file with that name already exists
- Ensure file isn't open in another application
- Verify you have write permissions
Gray fields not appearing
- Fields only auto-populate if filename matches ZDDC pattern
- Pattern:
TRACKING_REV (STATUS) - TITLE.ext
Technical Details
- Architecture: Single-page HTML application with centralized state management
- API: File System Access API (Chromium browsers only)
- Build: Concatenated from modular source files
- No Dependencies: Pure vanilla JavaScript
- State Management: Event-driven store pattern for predictable updates
Development
Build: sh build.sh produces dist/classifier.html — a single self-contained file with all CSS, JS, and shared modules inlined.
The canonical CSS and JS load order lives in build.sh. See the root ARCHITECTURE.md for the build system and module pattern, and AGENTS.md for shared helpers (shared/zddc.js, shared/zddc-filter.js, shared/theme.js, shared/help.js) and ZDDC parser API.
Design Philosophy
This tool follows simple, reliable best practices:
- Single Purpose: Classify and rename files to ZDDC format
- Spreadsheet Paradigm: Familiar Excel-like interface for batch editing
- Simplicity = Reliability: Centralized state, unidirectional data flow
- No Magic: Deterministic, user-controlled operations with live validation
- Portable: Single HTML file, works offline, no server required
- Excel Integration: Copy/paste workflow for bulk text operations
Use this tool to prepare files for the ZDDC Archive Browser.