ProjectStructure API
The projectStructure module of the @codebolt/plugin-sdk.
import plugin from '@codebolt/plugin-sdk';
Quick Reference
| Method | Description |
|---|---|
addCommand | Add a run command to a package |
addDependency | Add a dependency to a package |
addDeployment | Add a deployment config to a package |
addRoute | Add an API route to a package |
addTable | Add a database table to a package |
addUiRoute | Add a UI route to a package |
createPackage | Create a new package |
deleteCommand | Delete a run command |
deleteDependency | Delete a dependency |
deleteDeployment | Delete a deployment config |
deletePackage | Delete a package |
deleteRoute | Delete an API route |
deleteTable | Delete a database table |
deleteUiRoute | Delete a UI route |
getMetadata | Get complete project metadata |
getPackage | Get a specific package by ID |
getPackages | Get all packages in the workspace |
updateCommand | Update a run command |
updateDependency | Update a dependency |
updateDeployment | Update a deployment config |
updateDesignGuidelines | Update design guidelines for a package |
updateFrontendFramework | Update frontend framework for a package |
updateGit | Update git information |
updateMetadata | Update workspace metadata |
updatePackage | Update a package |
updateRoute | Update an API route |
updateSection | Update a specific section of a package |
updateTable | Update a database table |
updateUiRoute | Update a UI route |
Methods
addCommand
plugin.projectStructure.addCommand(packageId: string, command: Omit<RunCommand, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add a run command to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
command | Omit<RunCommand, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
addDependency
plugin.projectStructure.addDependency(packageId: string, dependency: Omit<Dependency, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add a dependency to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
dependency | Omit<Dependency, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
addDeployment
plugin.projectStructure.addDeployment(packageId: string, config: Omit<DeploymentConfig, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add a deployment config to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
config | Omit<DeploymentConfig, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
addRoute
plugin.projectStructure.addRoute(packageId: string, route: Omit<ApiRoute, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add an API route to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
route | Omit<ApiRoute, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
addTable
plugin.projectStructure.addTable(packageId: string, table: Omit<DatabaseTable, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add a database table to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
table | Omit<DatabaseTable, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
addUiRoute
plugin.projectStructure.addUiRoute(packageId: string, route: Omit<UiRoute, "id">, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Add a UI route to a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
route | Omit<UiRoute, "id"> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
createPackage
plugin.projectStructure.createPackage(data: CreatePackageData, workspacePath?: string): Promise<ProjectStructurePackageResponse>
Create a new package
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreatePackageData | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructurePackageResponse>
deleteCommand
plugin.projectStructure.deleteCommand(packageId: string, commandId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a run command
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
commandId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deleteDependency
plugin.projectStructure.deleteDependency(packageId: string, dependencyId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a dependency
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
dependencyId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deleteDeployment
plugin.projectStructure.deleteDeployment(packageId: string, configId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a deployment config
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
configId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deletePackage
plugin.projectStructure.deletePackage(packageId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deleteRoute
plugin.projectStructure.deleteRoute(packageId: string, routeId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete an API route
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
routeId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deleteTable
plugin.projectStructure.deleteTable(packageId: string, tableId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a database table
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
tableId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
deleteUiRoute
plugin.projectStructure.deleteUiRoute(packageId: string, routeId: string, workspacePath?: string): Promise<ProjectStructureDeleteResponse>
Delete a UI route
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
routeId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureDeleteResponse>
getMetadata
plugin.projectStructure.getMetadata(workspacePath?: string): Promise<ProjectStructureMetadataResponse>
Get complete project metadata
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | No |
Returns: Promise<ProjectStructureMetadataResponse>
getPackage
plugin.projectStructure.getPackage(packageId: string, workspacePath?: string): Promise<ProjectStructurePackageResponse>
Get a specific package by ID
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructurePackageResponse>
getPackages
plugin.projectStructure.getPackages(workspacePath?: string): Promise<ProjectStructurePackagesResponse>
Get all packages in the workspace
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | No |
Returns: Promise<ProjectStructurePackagesResponse>
updateCommand
plugin.projectStructure.updateCommand(packageId: string, commandId: string, updates: Partial<RunCommand>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a run command
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
commandId | string | Yes | |
updates | Partial<RunCommand> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateDependency
plugin.projectStructure.updateDependency(packageId: string, dependencyId: string, updates: Partial<Dependency>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a dependency
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
dependencyId | string | Yes | |
updates | Partial<Dependency> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateDeployment
plugin.projectStructure.updateDeployment(packageId: string, configId: string, updates: Partial<DeploymentConfig>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a deployment config
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
configId | string | Yes | |
updates | Partial<DeploymentConfig> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateDesignGuidelines
plugin.projectStructure.updateDesignGuidelines(packageId: string, guidelines: DesignGuidelines, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update design guidelines for a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
guidelines | DesignGuidelines | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateFrontendFramework
plugin.projectStructure.updateFrontendFramework(packageId: string, framework: FrameworkInfo, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update frontend framework for a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
framework | FrameworkInfo | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateGit
plugin.projectStructure.updateGit(gitInfo: GitInfo, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update git information
| Parameter | Type | Required | Description |
|---|---|---|---|
gitInfo | GitInfo | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateMetadata
plugin.projectStructure.updateMetadata(updates: Record<string, any>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update workspace metadata
| Parameter | Type | Required | Description |
|---|---|---|---|
updates | Record<string, any> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updatePackage
plugin.projectStructure.updatePackage(packageId: string, updates: UpdatePackageData, workspacePath?: string): Promise<ProjectStructurePackageResponse>
Update a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
updates | UpdatePackageData | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructurePackageResponse>
updateRoute
plugin.projectStructure.updateRoute(packageId: string, routeId: string, updates: Partial<ApiRoute>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update an API route
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
routeId | string | Yes | |
updates | Partial<ApiRoute> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateSection
plugin.projectStructure.updateSection(packageId: string, section: string, sectionData: any, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a specific section of a package
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
section | string | Yes | |
sectionData | any | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateTable
plugin.projectStructure.updateTable(packageId: string, tableId: string, updates: Partial<DatabaseTable>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a database table
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
tableId | string | Yes | |
updates | Partial<DatabaseTable> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>
updateUiRoute
plugin.projectStructure.updateUiRoute(packageId: string, routeId: string, updates: Partial<UiRoute>, workspacePath?: string): Promise<ProjectStructureUpdateResponse>
Update a UI route
| Parameter | Type | Required | Description |
|---|---|---|---|
packageId | string | Yes | |
routeId | string | Yes | |
updates | Partial<UiRoute> | Yes | |
workspacePath | string | No |
Returns: Promise<ProjectStructureUpdateResponse>