A command-line interface for developing and managing StoreConnect themes, written in Go.
- Local Development: Edit theme files locally with version control
- Multi-Server Support: Work with multiple servers (dev, staging, production)
- Theme Management: Push/pull themes between local machine and StoreConnect servers
- Preview & Validation: Preview and validate themes before publishing to Salesforce
# Clone the repository
git clone https://github.com/GetStoreConnect/storeconnect-cli.git
cd storeconnect-cli/cli-go
# Install dependencies
make deps
# Build and install
make installThe sc command will be installed to $GOPATH/bin. Make sure it's in your PATH.
Download the latest release for your platform from the releases page.
sc init my-project
cd my-projectThis creates:
my-project/- Root project directory.storeconnect/- Configuration directory (git-safe, no secrets)themes/- Directory for theme files
sc connect https://dev.mystore.com --alias devYou'll be prompted for:
- Organization ID (15-18 chars starting with "00D")
- Store Salesforce ID (15-18 alphanumeric characters)
- API Key (hidden input)
The CLI stores credentials securely in ~/.storeconnect/credentials.yml with 0600 permissions.
sc theme listsc theme pull my-themesc theme new my-new-themesc version- Show CLI versionsc init PROJECT_NAME- Create new project directorysc connect URL --alias NAME- Connect to StoreConnect serversc disconnect ALIAS- Remove server connectionsc status- Show connection status and project info
sc theme list- List all themessc theme pull THEME_NAME- Download theme from serversc theme new THEME_NAME- Create a new empty themesc theme push THEME_NAME- Upload theme to server (creates draft)sc theme preview THEME_NAME- Get preview URL for draftsc theme publish THEME_NAME- Publish draft to live sitesc theme delete THEME_NAME- Delete theme from serversc theme validate THEME_NAME- Validate theme structure
--server ALIASor-s ALIAS- Use specific server (defaults to project's default server)--config PATH- Custom config file path
StoreConnect CLI separates sensitive credentials from project configuration:
- Stored in user's home directory
- Contains API keys and Store Salesforce IDs
- Never committed to git
- Permissions: 0600 (read/write owner only)
servers:
dev:
url: https://dev.mystore.com
org_id: 00D000000000062ABC
store_sfid: a0A7Z00000AbCdEFGH
api_key: your-api-key-here
prod:
url: https://mystore.com
org_id: 00D000000000062ABC
store_sfid: a0A7Z00000XyZ123DEF
api_key: your-prod-api-key- Stored in project directory
- Contains server URLs, versions, sync times
- Safe to commit to git (no secrets)
- Shared across team members
default_server: dev
servers:
dev:
url: https://dev.mystore.com
storeconnect_version: "20.13.0"
base_theme_version: "1.2.3"
last_sync: 2024-03-15T10:30:00Z
prod:
url: https://mystore.com
storeconnect_version: "20.13.0"
base_theme_version: "1.2.3"- Go 1.21 or later
- Make (optional, for build tasks)
# Build for current platform
make build
# Build for all platforms
make build-all
# Install to $GOPATH/bin
make install# Run tests
make test
# Run tests with coverage
make coverage# Format code
make fmt
# Run linters
make lint
# Tidy dependencies
make tidycli-go/
├── cmd/
│ └── sc/ # Main entry point
│ └── main.go
├── internal/
│ ├── api/ # API client
│ │ ├── client.go
│ │ ├── auth.go
│ │ └── themes.go
│ ├── commands/ # Command implementations
│ │ ├── root.go
│ │ ├── init.go
│ │ ├── connect.go
│ │ ├── status.go
│ │ └── theme.go
│ ├── config/ # Configuration management
│ │ ├── credentials.go
│ │ └── project.go
│ ├── ui/ # UI helpers
│ │ ├── formatter.go
│ │ └── spinner.go
│ └── utils/ # Utilities
│ └── salesforce_id.go
├── go.mod
├── go.sum
├── Makefile
└── README.md
Uses Cobra for CLI structure, the same framework used by:
- kubectl
- hugo
- docker
- GitHub CLI
Uses Resty for clean and easy HTTP requests.
Uses Viper for configuration management.
Uses:
- fatih/color for colored output
- briandowns/spinner for loading spinners
Authentication uses Bearer tokens with a composite format:
Authorization: Bearer {org_id}:{store_sfid}:{api_key}
The client also supports legacy format (without org_id):
Authorization: Bearer {store_sfid}:{api_key}
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
For issues and questions:
- GitHub Issues: https://github.com/GetStoreConnect/storeconnect-cli/issues
- Documentation: https://docs.storeconnect.com