1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Status command implementation for Node.js bindings.
//!
//! # What
//!
//! This module implements the `status` NAPI function that retrieves
//! information about the current workspace state, including package
//! information, git status, and configuration details.
//!
//! # How
//!
//! The function:
//! 1. Validates the input parameters (root path)
//! 2. Calls `execute_status` from `sublime_cli_tools`
//! 3. Captures the JSON output
//! 4. Returns a `JsonResponse<StatusData>`
//!
//! # Why
//!
//! The status command is a fundamental operation for workspace management,
//! providing a quick overview of the workspace state. It's often the first
//! command users run to understand their workspace.
//!
//! # Examples
//!
//! ```typescript
//! import { status } from '@websublime/workspace-tools';
//!
//! const result = await status({ root: '.' });
//! if (result.success) {
//! console.log(`Repository: ${result.data.repository}`);
//! console.log(`Package Manager: ${result.data.packageManager}`);
//! console.log(`Branch: ${result.data.branch}`);
//! console.log(`Packages: ${result.data.packages.length}`);
//! }
//! ```
// TODO: will be implemented on story 3.2 - Status Command
//
// Implementation outline:
//
// #[napi]
// pub async fn status(params: StatusParams) -> JsonResponse<StatusData> {
// // 1. Validate parameters
// if let Err(e) = validate_root(¶ms.root) {
// return JsonResponse::from_error_info(e);
// }
//
// // 2. Create Output with JSON format for capturing
// // 3. Call execute_status from CLI
// // 4. Parse JSON response
// // 5. Return JsonResponse::success(data) or JsonResponse::error(msg)
// }