11# devhub
22
3- [ ![ PyPI] ( https://img.shields.io/pypi/v/devhub.svg )] ( https://pypi.org/project/devhub/ )
4- [ ![ Changelog] ( https://img.shields.io/github/v/release/devhub/devhub?include_prereleases&label=changelog )] ( https://github.com/devhub/devhub/releases )
5- [ ![ Tests] ( https://github.com/devhub/devhub/actions/workflows/test.yml/badge.svg )] ( https://github.com/devhub/devhub/actions/workflows/test.yml )
6- [ ![ License] ( https://img.shields.io/badge/license-Apache%202.0-blue.svg )] ( https://github.com/devhub/devhub/blob/master/LICENSE )
3+ [ ![ PyPI] ( https://img.shields.io/pypi/v/devhub.svg )] ( https://pypi.org/project/devhub-cli / )
4+ [ ![ Changelog] ( https://img.shields.io/github/v/release/devhub/devhub-cli ?include_prereleases&label=changelog )] ( https://github.com/devhub/devhub-cli /releases )
5+ [ ![ Tests] ( https://github.com/devhub/devhub-cli /actions/workflows/test.yml/badge.svg )] ( https://github.com/devhub/devhub-cli /actions/workflows/test.yml )
6+ [ ![ License] ( https://img.shields.io/badge/license-Apache%202.0-blue.svg )] ( https://github.com/devhub/devhub-cli /blob/master/LICENSE )
77
88CLI interface to devhub
99
1010## Installation
1111
1212Install this tool using ` pip ` :
1313``` bash
14- pip install devhub
14+ pip install devhub-cli
1515```
1616## Usage
1717
@@ -23,11 +23,99 @@ You can also use:
2323``` bash
2424python -m devhub --help
2525```
26+
27+ ## Theme Commands
28+
29+ The DevHub CLI provides powerful theme management capabilities for synchronizing and managing your DevHub theme components locally.
30+
31+ ### Initial Setup
32+
33+ Before using theme commands, you need to initialize your environment:
34+
35+ ``` bash
36+ devhub theme init
37+ ```
38+
39+ This command will:
40+ - Create a ` .env ` file with your DevHub API credentials
41+ - Generate a ` .gitignore ` file with appropriate exclusions
42+ - Create a ` devhub.conf.json ` configuration file
43+
44+ You'll be prompted to enter:
45+ - ` DEVHUB_API_KEY ` - Your OAuth1 API key
46+ - ` DEVHUB_API_SECRET ` - Your OAuth1 API secret
47+ - ` DEVHUB_BASE_URL ` - Your DevHub instance URL (e.g., https://yourbrand.cloudfrontend.net )
48+ - ` DEVHUB_SITE_ID ` - Your site identifier
49+
50+ ### Available Commands
51+
52+ #### ` devhub theme list `
53+ Lists all available theme templates and components that can be synchronized.
54+
55+ ``` bash
56+ devhub theme list
57+ ```
58+
59+ #### ` devhub theme status `
60+ Shows the synchronization status of all theme components, indicating which files have changes compared to the remote version.
61+
62+ ``` bash
63+ devhub theme status
64+ ```
65+
66+ #### ` devhub theme sync `
67+ Synchronizes theme components from your DevHub instance to local files.
68+
69+ ``` bash
70+ # Sync all components
71+ devhub theme sync
72+
73+ # Sync specific components only
74+ devhub theme sync layouts/headers/DefaultHeader.html components/HeroSection/HeroSection.jinja
75+ ```
76+
77+ The sync command will:
78+ - Download theme files (CSS, headers, footers, localization) to the ` layouts/ ` directory
79+ - Download template components to the ` components/ ` directory as ` .jinja ` files
80+ - Format templates using ` djlint ` with 2-space indentation
81+ - Convert component names from slug-case to PascalCase (e.g., ` hero-section ` → ` HeroSection.jinja ` )
82+ - Perform checksum comparison to detect conflicts between local and remote changes
83+
84+ ### Project Structure
85+
86+ After initialization and synchronization, your project structure will look like:
87+
88+ ```
89+ your-project/
90+ ├── .env # Environment variables (not committed)
91+ ├── .gitignore # Git exclusions
92+ ├── devhub.conf.json # CLI configuration
93+ ├── layouts/ # Theme templates (headers, footers, CSS)
94+ │ ├── headers/DefaultHeader.jinja
95+ │ ├── footers/DefaultFooter.jinja
96+ ├── styles/ # CSS styles
97+ │ └── globals.css
98+ └── components/ # Template components
99+ ├── HeroSection/HeroSection.jinja
100+ ├── ProductCard/ProductCard.jinja
101+ └── NavigationMenu/NavigationMenu.jinja
102+ ```
103+
104+ ### Authentication & Environment
105+
106+ The CLI uses OAuth1 authentication to connect to your DevHub instance. All sensitive credentials are stored in the ` .env ` file, which should never be committed to version control.
107+
108+ Required environment variables:
109+ - ` DEVHUB_API_KEY ` - OAuth1 API key
110+ - ` DEVHUB_API_SECRET ` - OAuth1 API secret
111+ - ` DEVHUB_BASE_URL ` - Base URL for DevHub API
112+ - ` DEVHUB_SITE_ID ` - Site identifier
113+
26114## Development
27115
28116To contribute to this tool, first checkout the code. Then create a new virtual environment:
29117``` bash
30- cd devhub
118+ cd devhub-cli
31119python -m venv venv
32120source venv/bin/activate
33121```
0 commit comments