---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [discovery](../index.md) / detectWorkspaceType

# Function: detectWorkspaceType()

> **detectWorkspaceType**(`workspacePath`, `options?`): `Promise`\<[`DetectionResult`](../interfaces/DetectionResult.md)\>

Defined in: [packages/b2c-tooling-sdk/src/discovery/detector.ts:124](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/e7c16f1ae423da0aa47b3e10be88f9770b53619b/packages/b2c-tooling-sdk/src/discovery/detector.ts#L124)

Creates a WorkspaceTypeDetector and performs detection in one call.

This is a convenience function for simple detection use cases.

## Parameters

### workspacePath

`string`

Path to the workspace directory

### options?

[`DetectOptions`](../interfaces/DetectOptions.md)

Detection options

## Returns

`Promise`\<[`DetectionResult`](../interfaces/DetectionResult.md)\>

Detection result with all matched project types

## Example

```typescript
import { detectWorkspaceType } from '@salesforce/b2c-tooling-sdk/discovery';

const result = await detectWorkspaceType(process.cwd());
console.log(`Detected types: ${result.projectTypes.join(', ')}`);
console.log(`Patterns: ${result.matchedPatterns.join(', ')}`);
```
