@duffcloudservices/cli β
Command-line interface for initializing and managing DCS (Duff Cloud Services) customer sites.
π¦ Package Info
Installation β
# Global installation (recommended)
npm install -g @duffcloudservices/cli
# Or with pnpm
pnpm add -g @duffcloudservices/cli
# Or run directly with npx
npx @duffcloudservices/cli initQuick Start β
# 1. Authenticate with Google OAuth
dcs login
# 2. Initialize a new customer site
cd /path/to/customer-site
dcs init --site-slug my-site --site-name "My Site"
# 3. Validate configuration
dcs validate
# 4. Generate integration plans
dcs plansCommands β
Authentication β
dcs login β
Authenticate with DCS Portal using Google OAuth (device flow).
dcs loginThe CLI will display a URL and code. Open the URL in your browser, enter the code, and sign in with Google. Tokens are stored securely in your OS keychain.
dcs logout β
Clear stored credentials.
dcs logoutdcs whoami β
Display the current authenticated user.
dcs whoami
# Output: Logged in as: user@example.comSite Management β
dcs sites list β
List all sites you have access to manage.
dcs sites listdcs sites show <slug> β
Show details for a specific site.
dcs sites show my-siteSite Initialization β
dcs init β
Initialize DCS integration in a customer site repository.
dcs init --site-slug <slug> --site-name "<name>" [options]Options:
| Option | Alias | Description |
|---|---|---|
--site-slug <slug> | -s | URL-safe site identifier (required) |
--site-name <name> | -n | Human-readable site name (required) |
--target <dir> | -t | Target directory (default: current) |
--framework <type> | -f | Framework: vue or astro (default: vue) |
--dry-run | Preview without creating files | |
--force | Overwrite existing files |
Examples:
# Initialize in current directory
dcs init -s kinetic-energy -n "Kinetic Energy Solutions"
# Initialize in a specific directory
dcs init -s my-site -n "My Site" -t ./my-site
# Specify Astro framework
dcs init -s my-site -n "My Site" -f astro
# Preview what would be created
dcs init -s my-site -n "My Site" --dry-runValidation β
dcs validate β
Validate .dcs configuration files.
dcs validate [options]Options:
| Option | Alias | Description |
|---|---|---|
--target <dir> | -t | Directory to validate (default: current) |
--verbose | -v | Show detailed output |
The validator checks:
- Required configuration files exist
- YAML syntax is valid
- Required fields are present
- Site slug format is correct
- Pages configuration is valid
Integration Plans β
dcs plans β
Generate AI-assisted integration plans for implementing DCS features.
dcs plans [options]Options:
| Option | Description |
|---|---|
--force | Regenerate existing plans |
This creates markdown files in .plans/ that guide you through integrating DCS features step by step.
Generated Files β
Running dcs init creates the following structure:
.dcs/
βββ site.yaml # Site identity and Azure config
βββ pages.yaml # Page registry for CMS
βββ content.yaml # Text content (managed by Portal)
βββ seo.yaml # SEO configuration (managed by Portal)
βββ SECTION-CONVENTIONS.md # Documentation for content sections
.github/
βββ copilot-instructions.md # AI assistant context
.plans/
βββ README.md
βββ 00-audit-site.md # Initial audit checklist
βββ 01-create-use-text-content.md # Composable setup
βββ 02-integrate-home-page.md # Home page integration
βββ 03-integrate-remaining-pages.md # Other pages
βββ 04-capture-snapshots.md # Portal snapshot setup
βββ 05-verify-deployment.md # Final verificationConfiguration Files β
.dcs/site.yaml β
Site identity and Azure configuration:
site:
slug: my-site
name: My Site
framework: vue
azure:
staticWebApp:
name: swa-my-site
resourceGroup: rg-dcs-sites.dcs/pages.yaml β
Page registry for the CMS:
pages:
- slug: home
path: /
type: static
title: Home
deletable: false
textKeys: []
- slug: about
path: /about
type: static
title: About
deletable: true
textKeys: [].dcs/content.yaml β
Text content (managed via Portal):
version: 1
lastUpdated: null
updatedBy: null
global: {}
pages:
home: {}
about: {}Authentication Flow β
The CLI uses OAuth 2.0 Device Authorization Grant (RFC 8628):
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β CLI ββββββΆβ DCS Portal API ββββββΆβ Google OAuth β
β (Node.js) βββββββ /api/v1/auth/* βββββββ Consent Screen β
βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββ
β OS Credential Store β (Encrypted token storage)
βββββββββββββββββββββββ- Run
dcs login - CLI displays a URL and code
- Open URL in browser, enter code
- Sign in with Google
- CLI receives and stores tokens securely
Site Access Validation β
Before creating configuration files, the CLI validates:
- You're authenticated
- You have access to the specified site (or can create it)
- You have editor/admin permissions
This prevents creating configs for sites you don't have access to.
Workflow: New Site Integration β
Complete workflow for integrating a new customer site:
1. Install CLI β
npm install -g @duffcloudservices/cli2. Authenticate β
dcs login3. Initialize Site β
cd /path/to/customer-site
dcs init -s customer-name -n "Customer Name LLC"4. Install CMS Package β
pnpm add @duffcloudservices/cms5. Configure Vite β
// vite.config.ts or .vitepress/config.ts
import { dcsContentPlugin, dcsSeoPlugin } from '@duffcloudservices/cms/plugins'
export default defineConfig({
plugins: [
dcsContentPlugin(),
dcsSeoPlugin()
]
})6. Follow Integration Plans β
Work through the files in .plans/ directory:
# Check progress
ls .plans/
# Open in VS Code
code .plans/7. Validate Configuration β
dcs validate8. Register in Portal β
The site will be available for management in the DCS Portal once the first deployment completes.
Offline Mode β
The CLI works offline for these commands:
dcs initβ Creates configuration files locallydcs validateβ Validates local configurationdcs plansβ Generates integration plans
Authentication is required for:
dcs sitesβ Requires API access- Live validation features (future)
Troubleshooting β
"Command not found: dcs" β
Ensure the package is installed globally:
npm install -g @duffcloudservices/cli
# Or use npx
npx @duffcloudservices/cli --helpAuthentication fails β
- Check your internet connection
- Ensure you have a valid Google account
- Try
dcs logoutthendcs loginagain
Validation errors β
Run with verbose output for details:
dcs validate -vSite slug already exists β
If you're re-initializing a site, use --force:
dcs init -s my-site -n "My Site" --forceRequirements β
- Node.js >= 18.0.0
- DCS Portal account with Google OAuth
