sublime_node_tools 0.0.4

Node.js bindings for Sublime Workspace CLI Tools via napi-rs
Documentation
//! Config command implementations for Node.js bindings.
//!
//! # What
//!
//! This module implements the config NAPI functions (`configShow`, `configValidate`)
//! that allow users to inspect and validate their workspace configuration.
//!
//! # How
//!
//! The module provides two functions:
//!
//! - `configShow`: Displays the current workspace configuration
//! - `configValidate`: Validates the configuration and reports any issues
//!
//! Each function:
//! 1. Validates the input parameters (root path)
//! 2. Calls the appropriate `execute_*` function from `sublime_cli_tools`
//! 3. Captures the JSON output
//! 4. Returns a `JsonResponse<T>` with the result
//!
//! # Why
//!
//! Configuration management is essential for understanding and troubleshooting
//! workspace settings. These commands help users verify their setup and identify
//! any configuration issues.
//!
//! # Examples
//!
//! ```typescript
//! import { configShow, configValidate } from '@websublime/workspace-tools';
//!
//! // Show current configuration
//! const showResult = await configShow({ root: '.' });
//! if (showResult.success) {
//!   console.log(`Strategy: ${showResult.data.strategy}`);
//!   console.log(`Changeset path: ${showResult.data.changesetPath}`);
//!   console.log(`History path: ${showResult.data.historyPath}`);
//! }
//!
//! // Validate configuration
//! const validateResult = await configValidate({ root: '.' });
//! if (validateResult.success) {
//!   if (validateResult.data.valid) {
//!     console.log('Configuration is valid');
//!   } else {
//!     console.log('Errors:', validateResult.data.errors);
//!     console.log('Warnings:', validateResult.data.warnings);
//!   }
//! }
//! ```

// TODO: will be implemented on story 7.2-7.3 - Config Commands
//
// Implementation outline for configShow:
//
// #[napi]
// pub async fn config_show(params: ConfigShowParams) -> JsonResponse<ConfigShowData> {
//     // 1. Validate parameters
//     if let Err(e) = validate_root(&params.root) {
//         return JsonResponse::from_error_info(e);
//     }
//
//     // 2. Create Output with JSON format for capturing
//     // 3. Call execute_show from CLI (commands/config.rs)
//     // 4. Parse JSON response
//     // 5. Return JsonResponse::success(data) or JsonResponse::error(msg)
// }
//
// Implementation outline for configValidate:
//
// #[napi]
// pub async fn config_validate(params: ConfigValidateParams) -> JsonResponse<ConfigValidateData> {
//     // 1. Validate parameters
//     if let Err(e) = validate_root(&params.root) {
//         return JsonResponse::from_error_info(e);
//     }
//
//     // 2. Create Output with JSON format for capturing
//     // 3. Call execute_validate from CLI (commands/config.rs)
//     // 4. Parse JSON response containing valid, errors, warnings
//     // 5. Return JsonResponse::success(data) or JsonResponse::error(msg)
// }