UNPKG

@fission-ai/openspec

Version:

AI-native system for spec-driven development

62 lines 2.17 kB
/** * Options for creating a change. */ export interface CreateChangeOptions { /** The workflow schema to use (default: 'spec-driven') */ schema?: string; } /** * Result of creating a change. */ export interface CreateChangeResult { /** The schema that was actually used (resolved from options, config, or default) */ schema: string; } /** * Result of validating a change name. */ export interface ValidationResult { valid: boolean; error?: string; } /** * Validates that a change name follows kebab-case conventions. * * Valid names: * - Start with a lowercase letter * - Contain only lowercase letters, numbers, and hyphens * - Do not start or end with a hyphen * - Do not contain consecutive hyphens * * @param name - The change name to validate * @returns Validation result with `valid: true` or `valid: false` with an error message * * @example * validateChangeName('add-auth') // { valid: true } * validateChangeName('Add-Auth') // { valid: false, error: '...' } */ export declare function validateChangeName(name: string): ValidationResult; /** * Creates a new change directory with metadata file. * * @param projectRoot - The root directory of the project (where `openspec/` lives) * @param name - The change name (must be valid kebab-case) * @param options - Optional settings for the change * @throws Error if the change name is invalid * @throws Error if the schema name is invalid * @throws Error if the change directory already exists * * @returns Result containing the resolved schema name * * @example * // Creates openspec/changes/add-auth/ with default schema * const result = await createChange('/path/to/project', 'add-auth') * console.log(result.schema) // 'spec-driven' or value from config * * @example * // Creates openspec/changes/add-auth/ with custom schema * const result = await createChange('/path/to/project', 'add-auth', { schema: 'my-workflow' }) * console.log(result.schema) // 'my-workflow' */ export declare function createChange(projectRoot: string, name: string, options?: CreateChangeOptions): Promise<CreateChangeResult>; //# sourceMappingURL=change-utils.d.ts.map