@aether-official/cli
v1.0.8
Published
CLI tool for Aether Sites SDK
Downloads
142
Readme
@aether-official/cli
CLI tool for Aether Sites SDK - Generate TypeScript types from your CMS schema.
Installation
npm install -D @aether-official/cliCommands
init
Interactive setup wizard to configure Aether SDK in your project.
npx aether-sdk initThis will:
- Prompt for your Site ID, Organization ID, and API token
- Test the connection to your CMS
- Create a
.envfile with your configuration - Fetch your site schema
- Generate TypeScript types
sync
Fetch the latest schema from your CMS.
npx aether-sdk syncThis downloads all section templates and their field definitions to .aether/schema.json.
types
Generate TypeScript types from your schema.
npx aether-sdk typesThis creates src/aether-types.d.ts with:
- Section ID constants
- TypeScript interfaces for each section
- Type-safe helper types
Workflow
Initial Setup:
npx aether-sdk initAfter Adding Sections in CMS:
npx aether-sdk sync npx aether-sdk typesUse in Code:
import { SECTIONS, type HeroSectionData } from './aether-types'; import { getAetherSection } from '@aether-official/sites-sdk/astro'; const hero = await getAetherSection(SECTIONS.HERO); // TypeScript knows all available fields!
Configuration
The CLI reads from your .env file:
AETHER_SITE_ID=your-site-id
AETHER_ORGANIZATION_ID=your-org-id
AETHER_API_TOKEN=your-api-token
AETHER_API_URL=http://localhost:3000Generated Types Example
// src/aether-types.d.ts (auto-generated)
export const SECTIONS = {
HERO: 'abc123' as const,
FEATURES: 'def456' as const,
} as const;
export interface HeroSectionData {
/** text field */
title: string;
/** textarea field */
subtitle?: string;
/** image field */
backgroundImage: ImageField;
}
export type SectionId = typeof SECTIONS[keyof typeof SECTIONS];
export type SectionData<T extends SectionId> =
T extends typeof SECTIONS.HERO ? HeroSectionData :
T extends typeof SECTIONS.FEATURES ? FeaturesSectionData :
never;License
MIT
