/** * Workspace discovery for B2C Commerce projects. * * This module provides utilities for detecting the type of B2C Commerce * project in a workspace. Returns ALL matched project types to enable * union toolset selection for hybrid projects. * * ## Quick Start * * ```typescript * import { detectWorkspaceType } from '@salesforce/b2c-tooling-sdk/discovery'; * * const result = await detectWorkspaceType(process.cwd()); * * console.log(`Project types: ${result.projectTypes.join(', ')}`); * console.log(`Matched patterns: ${result.matchedPatterns.join(', ')}`); * ``` * * ## Project Types * * The detector recognizes 3 workspace types: * * - `cartridges` - Any cartridge-based project (detected via .project files) * - `pwa-kit-v3` - PWA Kit v3 storefront * - `storefront-next` - Storefront Next/Odyssey project * * ## Toolset Mapping * * - base (fallback): SCAPI * - cartridges: CARTRIDGES + SCAPI * - pwa-kit-v3: PWAV3 + MRT + SCAPI * - storefront-next: STOREFRONTNEXT + MRT + SCAPI * * ## Custom Patterns * * You can extend detection with custom patterns: * * ```typescript * import { WorkspaceTypeDetector, type DetectionPattern } from '@salesforce/b2c-tooling-sdk/discovery'; * * const myPattern: DetectionPattern = { * name: 'my-framework', * projectType: 'cartridges', * detect: async (path) => { * // Custom detection logic * return false; * }, * }; * * const detector = new WorkspaceTypeDetector('/path/to/project', { * additionalPatterns: [myPattern], * }); * * const result = await detector.detect(); * ``` * * @module discovery */ export { WorkspaceTypeDetector, detectWorkspaceType } from './detector.js'; export type { ProjectType, DetectionContext, DetectionPattern, DetectionResult, DetectOptions } from './types.js'; export { PROJECT_TYPES } from './types.js'; export { DEFAULT_PATTERNS, cartridgesPattern, pwaKitV3Pattern, storefrontNextPattern, sfraPattern, } from './patterns/index.js'; export { readPackageJson, exists, glob, globDirs } from './utils.js'; export type { PackageJson } from './utils.js';