2.4 KiB
2.4 KiB
01. Create JSON Theme Schema and File Structure
meta: id: theme-refactoring-01 feature: theme-refactoring-json-format priority: P0 depends_on: [] tags: [implementation, infrastructure]
objective:
- Create the JSON theme schema and establish the file structure for theme definitions
- Define the theme.json schema that opencode uses
- Create the directory structure for JSON theme files
deliverables:
src/types/theme-schema.ts- JSON theme schema definitionsrc/themes/*.json- Directory for theme JSON filessrc/themes/schema.json- Theme schema reference
steps:
-
Step 1.1: Create
src/types/theme-schema.tswith TypeScript interfaces matching the opencode theme JSON structure- Define
ThemeJsoninterface with$schema,defs, andthemeproperties - Define
ColorValuetype supporting hex colors, color references, variants, and RGBA - Define
Varianttype for light/dark mode color definitions - Export interfaces for type checking
- Define
-
Step 1.2: Create
src/themes/schema.jsonwith the opencode theme schema reference- Add
$schema: "https://opencode.ai/theme.json" - Document the theme structure in comments
- Add
-
Step 1.3: Create
src/themes/directory- Ensure directory exists for JSON theme files
-
Step 1.4: Create a sample theme file in
src/themes/opencode.json- Use the opencode theme as reference
- Include proper
$schemareference - Define
defswith all color references - Define
themewith semantic color mappings
tests:
-
Unit:
- Test
ThemeJsontype definition matches opencode structure - Test
ColorValuetype accepts hex colors, references, variants, and RGBA - Test
Varianttype structure is correct
- Test
-
Integration/e2e:
- Verify JSON file can be parsed without errors
- Validate schema reference is correct
acceptance_criteria:
src/types/theme-schema.tsfile exists with all required interfacessrc/themes/schema.jsoncontains valid schema referencesrc/themes/directory is createdsrc/themes/opencode.jsoncan be imported and parsed successfully
validation:
- Run:
bun run typecheck- Should pass with no type errors - Run:
cat src/themes/opencode.json | jq .- Should be valid JSON
notes:
- Follow opencode's theme.json structure exactly
- Use TypeScript interfaces to ensure type safety
- Reference:
/home/mike/code/PodTui/opencode/packages/opencode/src/cli/cmd/tui/context/theme/