@rbleattler/omp-ts-typegen 0.2025.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,74 @@
1
+ # GitHub Copilot Instructions for omp-ts-typegen
2
+
3
+ This file provides guidance to GitHub Copilot for working with the omp-ts-typegen repository.
4
+
5
+ ## Project Overview
6
+
7
+ omp-ts-typegen is a TypeScript type definition generator for [Oh My Posh](https://ohmyposh.dev/) theme configurations. It fetches the latest schema from the Oh My Posh repository and generates TypeScript interfaces that can be used to validate and work with Oh My Posh configuration files.
8
+
9
+ ## Key Concepts
10
+
11
+ - **Schema**: The JSON schema from Oh My Posh that defines the structure of theme configuration files
12
+ - **Type Generation**: Converting the JSON schema to TypeScript interfaces using quicktype
13
+ - **Theme Validation**: Testing the generated types against real Oh My Posh themes
14
+
15
+ ## File Structure
16
+
17
+ - `/scripts/`: Contains the TypeScript scripts for generating and testing types
18
+ - `generate-types.ts`: Fetches the schema and generates types
19
+ - `test-types.ts`: Tests the generated types against Oh My Posh themes
20
+ - `validator.ts`: Provides validation functionality
21
+ - `/src/`: Contains the generated TypeScript types
22
+ - `types/omp.ts`: The generated TypeScript types (only present after running `generate-types`)
23
+ - `index.ts`: Exports the types for use in other projects
24
+ - `/cache/`: Stores the cached schema and Oh My Posh repository
25
+
26
+ ## Code Conventions
27
+
28
+ 1. Use ESM imports for all modules
29
+ 2. Use dynamic imports for ESM-only modules like chalk
30
+ 3. Use consistent error handling with chalk for colorized output
31
+ 4. Prefer async/await over promises
32
+ 5. Use TypeScript types for all function parameters and return values
33
+
34
+ ## Document Everything
35
+
36
+ Whenever changes are made to the codebase, ensure that the README, copilot-instructions.md, and any other relevant documentation are updated to reflect the changes.
37
+
38
+ ## Common Development Tasks
39
+
40
+ ### Adding Support for New Schema Features
41
+
42
+ 1. Update the `quicktypeOptions` in `generate-types.ts` to handle the new schema features
43
+ 2. Test the generated types against the Oh My Posh themes
44
+ 3. Update documentation if needed
45
+
46
+ ### Improving Type Generation
47
+
48
+ - Focus on making the types more accurate and user-friendly
49
+ - Consider adding JSDoc comments to the generated types for better documentation
50
+ - Ensure the types are properly exported from the main index.ts file
51
+
52
+ ### Testing Against Themes
53
+
54
+ - The test-types.ts script clones the Oh My Posh repo and tests all themes
55
+ - It generates a validation report and badge showing how many themes pass validation
56
+ - When fixing type issues, focus on improving the percentage of valid themes
57
+
58
+ ## Validation Badge
59
+
60
+ The repo includes a custom SVG badge showing the theme validation status. When making changes that might affect validation results:
61
+
62
+ 1. Run the test-types script to update the validation report and badge
63
+ 2. Ensure the badge is properly displayed in the README
64
+
65
+ ## GitHub Workflow
66
+
67
+ The nightly-types.yml workflow:
68
+
69
+ 1. Runs daily to check for schema updates
70
+ 2. Generates new types from the latest schema
71
+ 3. Updates the validation report and badge
72
+ 4. Commits and pushes any changes
73
+
74
+ When modifying the workflow, ensure it continues to update all relevant files.
@@ -0,0 +1,42 @@
1
+ name: Nightly Type Generation
2
+
3
+ on:
4
+ schedule:
5
+ # Run at midnight UTC every day
6
+ - cron: '0 0 * * *'
7
+ workflow_dispatch: # Allow manual triggering
8
+
9
+ jobs:
10
+ generate-types:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout repository
14
+ uses: actions/checkout@v3
15
+
16
+ - name: Setup Node.js
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: '20'
20
+ cache: 'npm'
21
+
22
+ - name: Install dependencies
23
+ run: npm ci
24
+
25
+ - name: Generate types
26
+ run: npm run generate-types
27
+
28
+ - name: Test types
29
+ run: npm run test-types
30
+
31
+ - name: Commit and push changes if any
32
+ if: success()
33
+ run: |
34
+ if [[ -n $(git status --porcelain) ]]; then
35
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
36
+ git config --local user.name "github-actions[bot]"
37
+ git add src/types CHANGELOG.md readme.md theme-validation.md theme-validation-badge.svg
38
+ git commit -m "chore: update types from latest schema [skip ci]"
39
+ git push
40
+ else
41
+ echo "No changes to commit."
42
+ fi
@@ -0,0 +1,5 @@
1
+ {
2
+ "cSpell.words": [
3
+ "quicktype"
4
+ ]
5
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Oh My Posh TypeScript types will be documented in this file.
4
+
5
+ ## [Initial Release]
6
+
7
+ - Created initial TypeScript types from Oh My Posh schema
8
+ - Set up automated type generation workflow
9
+ - Added testing against sample configuration