mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2026-08-24 02:34:19 -05:00
Update the segment development section to list five required artifacts instead of four, adding the gob.Register call in segment_types.go as step 5 with a note that omitting it causes silent runtime failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2.7 KiB
2.7 KiB
GitHub Copilot Instructions
For general coding guidelines, commit conventions, and agent workflows, see AGENTS.md.
Tech Stack
| Layer | Technology |
|---|---|
| Core engine | Go (module root: src/) |
| Documentation site | Docusaurus (MDX) - website/ |
| Themes | JSON - themes/ |
| Config format | TOML / JSON / YAML |
| Package/installer scripts | packages/ |
| Build scripts | build/ |
Repository Layout
src/
segments/ # One Go file + one _test.go per segment
prompt/ # Core rendering engine
runtime/ # OS/shell abstraction layer
themes/ # Bundled JSON theme files
website/ # Docusaurus docs site (MDX pages, sidebar config, JSON schema)
packages/ # Installer/package manifests
build/ # CI build helpers
Segment Development
When adding a new segment, four artifacts are required - use the segment-create skill
to scaffold all of them automatically:
src/segments/<name>.go- segment implementationsrc/segments/<name>_test.go- unit testswebsite/docs/segments/<name>.mdx- user-facing docs- Update
website/sidebars.jsandwebsite/static/schema.json - Register the type in
src/config/segment_types.goviagob.Register(&segments.MySegment{})- missing this causes silent failures at runtime
See the segment-docs skill for the canonical mapping between Go source constructs and MDX
documentation fields (template properties, type representations, option tables).
Go Conventions
- Follow the
golangskill for project-specific Go standards. - Each segment implements the
Segmentinterface; useenv(theEnvironmentabstraction) for all OS/shell calls - never call OS APIs directly. - Test with
go test ./...fromsrc/. - Lint with
golangci-lint runfromsrc/.
Documentation (website/)
- Follow the
markdownskill for.md/.mdxformatting rules. - Segment doc pages live in
website/docs/segments/and use MDX frontmatter withtitle,sidebar_label, andid. - Run
npm run startinsidewebsite/for a local dev server. - Run
npm run buildinsidewebsite/to verify the site builds before opening a docs PR.
PowerShell
PowerShell helper scripts live in packages/ and build/. Follow the powershell skill for cmdlet conventions.
Themes
Themes are plain JSON files in themes/. New themes must validate against
website/static/schema.json. Do not introduce breaking schema changes without updating the
schema file.