|
| 1 | +# JSON Format Standardization Script |
| 2 | + |
| 3 | +This script standardizes all JSON files in the System Prompt Library to match the latest format specification (240925_format.json). |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Field Mapping**: Automatically maps old field names to new field names |
| 8 | +- **Boolean Normalization**: Converts string boolean values ("true"/"false") to actual booleans |
| 9 | +- **Date Normalization**: Standardizes date formats to YYYY-MM-DD |
| 10 | +- **Complete Schema**: Ensures all files have all required fields with proper null values |
| 11 | +- **Backup Support**: Creates backups before making changes |
| 12 | +- **Dry Run Mode**: Preview changes without modifying files |
| 13 | + |
| 14 | +## Usage |
| 15 | + |
| 16 | +### From Repository Root |
| 17 | +```bash |
| 18 | +# Dry run to see what would change |
| 19 | +./standardize_json_format.sh --dry-run |
| 20 | + |
| 21 | +# Run with backup |
| 22 | +./standardize_json_format.sh --backup |
| 23 | + |
| 24 | +# Run without backup (not recommended) |
| 25 | +./standardize_json_format.sh |
| 26 | +``` |
| 27 | + |
| 28 | +### From Scripts Directory |
| 29 | +```bash |
| 30 | +cd scripts/ |
| 31 | + |
| 32 | +# Dry run to see what would change |
| 33 | +python3 standardize_json_format.py --dry-run |
| 34 | + |
| 35 | +# Run with backup |
| 36 | +python3 standardize_json_format.py --backup |
| 37 | + |
| 38 | +# Run without backup |
| 39 | +python3 standardize_json_format.py |
| 40 | +``` |
| 41 | + |
| 42 | +## Field Mappings |
| 43 | + |
| 44 | +The script maps old format fields to new format fields: |
| 45 | + |
| 46 | +| Old Field | New Field | |
| 47 | +|-----------|-----------| |
| 48 | +| `agentname` | `agent_name` | |
| 49 | +| `description` | `Description` | |
| 50 | +| `systemprompt` | `System Prompt` | |
| 51 | +| `chatgptlink` | `ChatGPT Access URL` | |
| 52 | +| `creation_date` | `Creation Date` | |
| 53 | +| `is-agent` | `Is Agent` | |
| 54 | +| `is-single-turn` | `Single Turn (Workflow Type)` | |
| 55 | +| `structured-output-generation` | `Structured Output (Workflow Type)` | |
| 56 | +| `image-generation` | `Image Generation (Workflow Type)` | |
| 57 | +| `data-utility` | `Data Utility (Category)` | |
| 58 | +| `json-schema` | `JSON Schema (Full)` | |
| 59 | +| `json-example` | `JSON Schema (Example Value)` | |
| 60 | + |
| 61 | +## New Fields Added |
| 62 | + |
| 63 | +The script adds these new fields with null/false default values: |
| 64 | + |
| 65 | +- `One Line Summary` |
| 66 | +- `Utility Estimate` (defaults to 0) |
| 67 | +- `Test Entry` (defaults to false) |
| 68 | +- `Better As Tool` |
| 69 | +- `External Tooling (Required)` |
| 70 | +- `Character (Type)` |
| 71 | +- `Roleplay (Behavior)` |
| 72 | +- `Voice First` |
| 73 | +- `Writing Assistant` |
| 74 | +- `N8N Link` |
| 75 | +- `RAG (Required)` |
| 76 | +- `Vision (Req)` |
| 77 | +- `Spech-To-Speech` |
| 78 | +- `Video Input (Required)` |
| 79 | +- `Audio (Required)` |
| 80 | +- `TTS (Required)` |
| 81 | +- `File Input (Req)` |
| 82 | +- `Conversational` |
| 83 | +- `Instructional` |
| 84 | +- `Autonomous` |
| 85 | +- `MCPs Used` |
| 86 | +- `API Notes` |
| 87 | +- `MCP Notes` |
| 88 | +- `Local LLM Friendly?` |
| 89 | +- `Local LLM Notes` |
| 90 | +- `LLM Selection Notes` |
| 91 | +- `Deep Research` |
| 92 | +- `Update/Iteration` |
| 93 | +- `Iteration Notes` |
| 94 | +- `Use Case Outline` |
| 95 | +- `PII Notes` |
| 96 | +- `Cost Estimates` |
| 97 | +- `Localtisation Notes` |
| 98 | +- `Guardrails Notes` |
| 99 | +- `Gemini URL` |
| 100 | + |
| 101 | +## Command Line Options |
| 102 | + |
| 103 | +- `--dry-run`: Show what would be changed without making changes |
| 104 | +- `--backup`: Create backup directory before making changes |
| 105 | +- `--json-dir PATH`: Specify custom JSON directory (default: ../system-prompts/json) |
| 106 | + |
| 107 | +## Backup Location |
| 108 | + |
| 109 | +When using `--backup`, backups are created in: |
| 110 | +`system-prompts/json/backup_YYYYMMDD_HHMMSS/` |
| 111 | + |
| 112 | +## Results |
| 113 | + |
| 114 | +The script processes all JSON files and provides a summary: |
| 115 | +- Total files processed |
| 116 | +- Files with changes made |
| 117 | +- Files with errors (if any) |
| 118 | + |
| 119 | +All 956 JSON files in the library have been successfully standardized to the new format. |
0 commit comments