@rbleattler/omp-ts-typegen 0.2025.1 → 0.2025.68

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.
@@ -1,192 +1,192 @@
1
- # Understanding Oh My Posh Schema.json
2
-
3
- This document explains the structure and purpose of the Oh My Posh `schema.json` file, which defines the configuration format for Oh My Posh themes.
4
-
5
- ## Overview
6
-
7
- Oh My Posh uses a JSON schema (following the JSON Schema Draft-07 specification) to:
8
-
9
- 1. Validate theme configuration files
10
- 2. Provide auto-completion in editors with JSON schema support
11
- 3. Define the structure of themes in a standardized way
12
- 4. Document available options for theme creators
13
-
14
- ## Schema Structure
15
-
16
- ### Root Schema Properties
17
-
18
- The schema's root properties define the high-level configuration options:
19
-
20
- - **`final_space`**: Whether to add a space at the end of the prompt
21
- - **`enable_cursor_positioning`**: Enables precise cursor positioning features
22
- - **`shell_integration`**: Adds FTCS command marks for shell integration
23
- - **`pwd`**: Controls OSC99/7/51 working directory communication
24
- - **`upgrade`**: Configuration for upgrade notifications
25
- - **`patch_pwsh_bleed`**: Fixes PowerShell color bleeding issues
26
- - **`console_title_template`**: Template for the terminal window title
27
- - **`terminal_background`**: Background color of the terminal
28
- - **`blocks`**: The main array of prompt blocks (core structure of the prompt)
29
- - **`tooltips`**: Custom tooltips for specific commands
30
- - **`transient_prompt`**: Configuration for simplified repeated prompts
31
- - **`valid_line`**, **`error_line`**: PowerShell-specific prompt variants
32
- - **`secondary_prompt`**: Configuration for multi-line input continuation
33
- - **`debug_prompt`**: PowerShell debugging prompt configuration
34
- - **`palette`**, **`palettes`**: Color palette definitions
35
- - **`cycle`**: Color cycling configuration
36
- - **`accent_color`**: Theme accent color
37
- - **`var`**: Custom variables for use in templates
38
-
39
- ### Definitions Section
40
-
41
- The `definitions` section contains reusable schema components:
42
-
43
- #### Color Definitions
44
-
45
- ```json
46
- "color": {
47
- "anyOf": [
48
- {
49
- "$ref": "#/definitions/color_string"
50
- },
51
- {
52
- "$ref": "#/definitions/palette_reference"
53
- }
54
- ]
55
- }
56
- ```
57
-
58
- Colors can be specified as direct color strings or as palette references (e.g., `p:blue`).
59
-
60
- #### Block Definition
61
-
62
- Blocks are the main structural elements of the prompt:
63
-
64
- ```json
65
- "block": {
66
- "type": "object",
67
- "description": "https://ohmyposh.dev/docs/configuration/block",
68
- "properties": {
69
- "type": {
70
- "type": "string",
71
- "enum": ["prompt", "rprompt"],
72
- "default": "prompt"
73
- },
74
- "alignment": {
75
- "type": "string",
76
- "enum": ["left", "right"],
77
- "default": "left"
78
- },
79
- "segments": {
80
- "type": "array",
81
- "items": {
82
- "$ref": "#/definitions/segment"
83
- }
84
- },
85
- // ...other properties
86
- }
87
- }
88
- ```
89
-
90
- #### Segment Definition
91
-
92
- Segments are the individual components within blocks that display information:
93
-
94
- ```json
95
- "segment": {
96
- "type": "object",
97
- "required": ["type", "style"],
98
- "properties": {
99
- "type": {
100
- "type": "string",
101
- "enum": ["git", "node", "python", /* many other segment types */]
102
- },
103
- "style": {
104
- "anyOf": [
105
- {
106
- "enum": ["plain", "powerline", "diamond", "accordion"]
107
- },
108
- {
109
- "type": "string"
110
- }
111
- ]
112
- },
113
- // ...many other properties
114
- }
115
- }
116
- ```
117
-
118
- The schema then uses conditional validation (`if`/`then`) to define specific properties for each segment type.
119
-
120
- ## Segment Types
121
-
122
- Oh My Posh includes a wide variety of segment types, each with specific functionality:
123
-
124
- ### SCM Segments
125
-
126
- - **`git`**: Git repository information
127
- - **`mercurial`**: Mercurial repository information
128
- - **`fossil`**: Fossil repository information
129
- - **`sapling`**: Sapling repository information
130
- - **`plastic`**: Plastic SCM information
131
- - **`svn`**: SVN repository information
132
-
133
- ### Language/Runtime Segments
134
-
135
- - **`node`**: Node.js version and environment
136
- - **`python`**: Python version and virtual environment
137
- - **`ruby`**: Ruby version
138
- - **`java`**: Java version
139
- - **`go`**: Go version
140
- - **`rust`**: Rust version
141
- - **`dotnet`**: .NET version
142
- - **`php`**: PHP version
143
- - And many more language-specific segments
144
-
145
- ### Cloud/Service Segments
146
-
147
- - **`aws`**: AWS profile and region
148
- - **`az`**: Azure information
149
- - **`gcp`**: Google Cloud Platform information
150
- - **`kubernetes`**: Kubernetes context
151
-
152
- ### System Segments
153
-
154
- - **`os`**: Operating system information
155
- - **`path`**: Current directory path
156
- - **`time`**: Current time
157
- - **`session`**: SSH session indicator
158
- - **`battery`**: Battery status
159
-
160
- ### CLI Tool Segments
161
-
162
- - **`npm`**: NPM information
163
- - **`yarn`**: Yarn information
164
- - **`pnpm`**: PNPM information
165
- - **`terraform`**: Terraform workspace
166
-
167
- ## How Validation Works
168
-
169
- The schema uses several validation techniques:
170
-
171
- 1. **Required properties**: Ensures essential properties are present
172
- 2. **Enum validation**: Restricts values to specific options
173
- 3. **Pattern validation**: Validates string format (like colors)
174
- 4. **Conditional validation**: Different validation rules based on segment type
175
- 5. **Default values**: Provides sensible defaults where applicable
176
-
177
- ## Example Configuration Flow
178
-
179
- When a user creates an Oh My Posh theme:
180
-
181
- 1. The theme defines one or more blocks
182
- 2. Each block contains one or more segments
183
- 3. Each segment has a type, style, and segment-specific properties
184
- 4. Colors can be defined directly or through palettes
185
- 5. Templates within segments define how information is displayed
186
-
187
- ## References
188
-
189
- - [Oh My Posh Documentation](https://ohmyposh.dev/docs)
190
- - [JSON Schema Specification](https://json-schema.org/specification.html)
191
-
192
- This schema enables the rich, customizable prompts that Oh My Posh is known for, while providing clear validation and documentation for theme creators.
1
+ # Understanding Oh My Posh Schema.json
2
+
3
+ This document explains the structure and purpose of the Oh My Posh `schema.json` file, which defines the configuration format for Oh My Posh themes.
4
+
5
+ ## Overview
6
+
7
+ Oh My Posh uses a JSON schema (following the JSON Schema Draft-07 specification) to:
8
+
9
+ 1. Validate theme configuration files
10
+ 2. Provide auto-completion in editors with JSON schema support
11
+ 3. Define the structure of themes in a standardized way
12
+ 4. Document available options for theme creators
13
+
14
+ ## Schema Structure
15
+
16
+ ### Root Schema Properties
17
+
18
+ The schema's root properties define the high-level configuration options:
19
+
20
+ - **`final_space`**: Whether to add a space at the end of the prompt
21
+ - **`enable_cursor_positioning`**: Enables precise cursor positioning features
22
+ - **`shell_integration`**: Adds FTCS command marks for shell integration
23
+ - **`pwd`**: Controls OSC99/7/51 working directory communication
24
+ - **`upgrade`**: Configuration for upgrade notifications
25
+ - **`patch_pwsh_bleed`**: Fixes PowerShell color bleeding issues
26
+ - **`console_title_template`**: Template for the terminal window title
27
+ - **`terminal_background`**: Background color of the terminal
28
+ - **`blocks`**: The main array of prompt blocks (core structure of the prompt)
29
+ - **`tooltips`**: Custom tooltips for specific commands
30
+ - **`transient_prompt`**: Configuration for simplified repeated prompts
31
+ - **`valid_line`**, **`error_line`**: PowerShell-specific prompt variants
32
+ - **`secondary_prompt`**: Configuration for multi-line input continuation
33
+ - **`debug_prompt`**: PowerShell debugging prompt configuration
34
+ - **`palette`**, **`palettes`**: Color palette definitions
35
+ - **`cycle`**: Color cycling configuration
36
+ - **`accent_color`**: Theme accent color
37
+ - **`var`**: Custom variables for use in templates
38
+
39
+ ### Definitions Section
40
+
41
+ The `definitions` section contains reusable schema components:
42
+
43
+ #### Color Definitions
44
+
45
+ ```json
46
+ "color": {
47
+ "anyOf": [
48
+ {
49
+ "$ref": "#/definitions/color_string"
50
+ },
51
+ {
52
+ "$ref": "#/definitions/palette_reference"
53
+ }
54
+ ]
55
+ }
56
+ ```
57
+
58
+ Colors can be specified as direct color strings or as palette references (e.g., `p:blue`).
59
+
60
+ #### Block Definition
61
+
62
+ Blocks are the main structural elements of the prompt:
63
+
64
+ ```json
65
+ "block": {
66
+ "type": "object",
67
+ "description": "https://ohmyposh.dev/docs/configuration/block",
68
+ "properties": {
69
+ "type": {
70
+ "type": "string",
71
+ "enum": ["prompt", "rprompt"],
72
+ "default": "prompt"
73
+ },
74
+ "alignment": {
75
+ "type": "string",
76
+ "enum": ["left", "right"],
77
+ "default": "left"
78
+ },
79
+ "segments": {
80
+ "type": "array",
81
+ "items": {
82
+ "$ref": "#/definitions/segment"
83
+ }
84
+ },
85
+ // ...other properties
86
+ }
87
+ }
88
+ ```
89
+
90
+ #### Segment Definition
91
+
92
+ Segments are the individual components within blocks that display information:
93
+
94
+ ```json
95
+ "segment": {
96
+ "type": "object",
97
+ "required": ["type", "style"],
98
+ "properties": {
99
+ "type": {
100
+ "type": "string",
101
+ "enum": ["git", "node", "python", /* many other segment types */]
102
+ },
103
+ "style": {
104
+ "anyOf": [
105
+ {
106
+ "enum": ["plain", "powerline", "diamond", "accordion"]
107
+ },
108
+ {
109
+ "type": "string"
110
+ }
111
+ ]
112
+ },
113
+ // ...many other properties
114
+ }
115
+ }
116
+ ```
117
+
118
+ The schema then uses conditional validation (`if`/`then`) to define specific properties for each segment type.
119
+
120
+ ## Segment Types
121
+
122
+ Oh My Posh includes a wide variety of segment types, each with specific functionality:
123
+
124
+ ### SCM Segments
125
+
126
+ - **`git`**: Git repository information
127
+ - **`mercurial`**: Mercurial repository information
128
+ - **`fossil`**: Fossil repository information
129
+ - **`sapling`**: Sapling repository information
130
+ - **`plastic`**: Plastic SCM information
131
+ - **`svn`**: SVN repository information
132
+
133
+ ### Language/Runtime Segments
134
+
135
+ - **`node`**: Node.js version and environment
136
+ - **`python`**: Python version and virtual environment
137
+ - **`ruby`**: Ruby version
138
+ - **`java`**: Java version
139
+ - **`go`**: Go version
140
+ - **`rust`**: Rust version
141
+ - **`dotnet`**: .NET version
142
+ - **`php`**: PHP version
143
+ - And many more language-specific segments
144
+
145
+ ### Cloud/Service Segments
146
+
147
+ - **`aws`**: AWS profile and region
148
+ - **`az`**: Azure information
149
+ - **`gcp`**: Google Cloud Platform information
150
+ - **`kubernetes`**: Kubernetes context
151
+
152
+ ### System Segments
153
+
154
+ - **`os`**: Operating system information
155
+ - **`path`**: Current directory path
156
+ - **`time`**: Current time
157
+ - **`session`**: SSH session indicator
158
+ - **`battery`**: Battery status
159
+
160
+ ### CLI Tool Segments
161
+
162
+ - **`npm`**: NPM information
163
+ - **`yarn`**: Yarn information
164
+ - **`pnpm`**: PNPM information
165
+ - **`terraform`**: Terraform workspace
166
+
167
+ ## How Validation Works
168
+
169
+ The schema uses several validation techniques:
170
+
171
+ 1. **Required properties**: Ensures essential properties are present
172
+ 2. **Enum validation**: Restricts values to specific options
173
+ 3. **Pattern validation**: Validates string format (like colors)
174
+ 4. **Conditional validation**: Different validation rules based on segment type
175
+ 5. **Default values**: Provides sensible defaults where applicable
176
+
177
+ ## Example Configuration Flow
178
+
179
+ When a user creates an Oh My Posh theme:
180
+
181
+ 1. The theme defines one or more blocks
182
+ 2. Each block contains one or more segments
183
+ 3. Each segment has a type, style, and segment-specific properties
184
+ 4. Colors can be defined directly or through palettes
185
+ 5. Templates within segments define how information is displayed
186
+
187
+ ## References
188
+
189
+ - [Oh My Posh Documentation](https://ohmyposh.dev/docs)
190
+ - [JSON Schema Specification](https://json-schema.org/specification.html)
191
+
192
+ This schema enables the rich, customizable prompts that Oh My Posh is known for, while providing clear validation and documentation for theme creators.