Description
The current replacements.json file has a confusing dual structure where project information is stored in both _auto_discovered.projects and project_names.replacements. This creates redundancy and makes the configuration harder to understand and maintain.
Context
- Project Area: Configuration system / Text-to-Speech replacements
- Complexity: 4/10 (Moderate - involves refactoring and migration)
- User Impact: Improves configuration clarity and maintainability
Current Problem
- Projects are stored in two places:
_auto_discovered.projects (with rich metadata: folder, display_name, pronunciation)
project_names.replacements (simple key-value pairs)
- The TTS system prioritizes
_auto_discovered which is why user replacements work
- Auto-discovery adds entries to BOTH locations, creating duplication
- README documentation doesn't match the actual structure being used
Technical Details
Affected Files:
src/ccnotify/notify.py - Core replacement logic (5 functions to update)
load_replacements() (line 430)
auto_add_project_to_replacements() (line 287)
apply_project_name_replacement() (line 445)
get_project_pronunciation() (line 457)
apply_command_replacement() (line 474)
README.md - Documentation update for "Pronunciation Customization" section
- User config files - Will need automatic migration
Requirements
- Consolidate project storage to a single
projects section
- Maintain rich metadata structure (folder, display_name, pronunciation)
- Provide automatic migration for existing configurations
- Add comprehensive examples for commands and patterns
- Update documentation to reflect the new structure
Proposed Structure
{
"projects": {
"ccnotify": {
"folder": "-Users-helmi-code-ccnotify",
"display_name": "CCNotify",
"pronunciation": "CC notify"
},
"agent-zero": {
"folder": "-Users-helmi-code-agent-zero",
"display_name": "Agent Zero",
"pronunciation": "agent zero"
}
},
"commands": {
"ls": "list",
"cd": "change directory",
"rm": "remove",
"mkdir": "make directory",
"npm": "N P M",
"uvx": "U V X"
},
"patterns": [
{
"pattern": "npm run (\\\\w+)",
"replacement": "N P M run {1}"
},
{
"pattern": "git (push|pull|commit)",
"replacement": "git {1}"
},
{
"pattern": "(.+)\\\\.py",
"replacement": "{1} python file"
}
]
}
Implementation Steps
Acceptance Criteria
Description
The current
replacements.jsonfile has a confusing dual structure where project information is stored in both_auto_discovered.projectsandproject_names.replacements. This creates redundancy and makes the configuration harder to understand and maintain.Context
Current Problem
_auto_discovered.projects(with rich metadata: folder, display_name, pronunciation)project_names.replacements(simple key-value pairs)_auto_discoveredwhich is why user replacements workTechnical Details
Affected Files:
src/ccnotify/notify.py- Core replacement logic (5 functions to update)load_replacements()(line 430)auto_add_project_to_replacements()(line 287)apply_project_name_replacement()(line 445)get_project_pronunciation()(line 457)apply_command_replacement()(line 474)README.md- Documentation update for "Pronunciation Customization" sectionRequirements
projectssectionProposed Structure
{ "projects": { "ccnotify": { "folder": "-Users-helmi-code-ccnotify", "display_name": "CCNotify", "pronunciation": "CC notify" }, "agent-zero": { "folder": "-Users-helmi-code-agent-zero", "display_name": "Agent Zero", "pronunciation": "agent zero" } }, "commands": { "ls": "list", "cd": "change directory", "rm": "remove", "mkdir": "make directory", "npm": "N P M", "uvx": "U V X" }, "patterns": [ { "pattern": "npm run (\\\\w+)", "replacement": "N P M run {1}" }, { "pattern": "git (push|pull|commit)", "replacement": "git {1}" }, { "pattern": "(.+)\\\\.py", "replacement": "{1} python file" } ] }Implementation Steps
load_replacements()to use new default structureauto_add_project_to_replacements()to write toprojectssectionget_project_pronunciation()to read fromprojects[name].pronunciationapply_project_name_replacement()to useprojects[name].display_nameAcceptance Criteria