sublime_node_tools 0.0.4

Node.js bindings for Sublime Workspace CLI Tools via napi-rs
Documentation
//! Init command implementation for Node.js bindings.
//!
//! # What
//!
//! This module implements the `init` NAPI function that initializes
//! a new workspace configuration (repo.config) in the specified directory.
//!
//! # How
//!
//! The function:
//! 1. Validates the input parameters (root path, optional strategy/format)
//! 2. Calls `execute_init` from `sublime_cli_tools`
//! 3. Captures the JSON output
//! 4. Returns a `JsonResponse<InitData>`
//!
//! # Why
//!
//! The init command sets up the workspace configuration file that controls
//! versioning strategy, changeset paths, and other workspace settings.
//! It's typically the first command run when setting up a new workspace.
//!
//! # Examples
//!
//! ```typescript
//! import { init } from '@websublime/workspace-tools';
//!
//! // Initialize with default settings
//! const result = await init({ root: '.' });
//!
//! // Initialize with specific strategy
//! const result = await init({
//!   root: '.',
//!   strategy: 'independent',
//!   format: 'toml'
//! });
//!
//! if (result.success) {
//!   console.log(`Created config at: ${result.data.configPath}`);
//!   console.log(`Strategy: ${result.data.strategy}`);
//! }
//! ```

// TODO: will be implemented on story 3.4 - Init Command
//
// Implementation outline:
//
// #[napi]
// pub async fn init(params: InitParams) -> JsonResponse<InitData> {
//     // 1. Validate parameters
//     if let Err(e) = validate_root(&params.root) {
//         return JsonResponse::from_error_info(e);
//     }
//
//     // 2. Create InitArgs from params
//     // 3. Create Output with JSON format for capturing
//     // 4. Call execute_init from CLI
//     // 5. Parse JSON response
//     // 6. Return JsonResponse::success(data) or JsonResponse::error(msg)
// }