@fromsvenwithlove/devops-issues-cli
Version:
AI-powered CLI tool and library for Azure DevOps work item management with Claude agents
97 lines (80 loc) • 3.31 kB
JavaScript
/**
* Azure DevOps CLI Library - Main Entry Point
*
* Exports all core functionality for programmatic use:
* - Azure DevOps API client
* - Cache management
* - Configuration utilities
* - Command functions
* - Schema validation
*/
// Core classes and utilities
export { AzureDevOpsClient } from './api/azure-client.js';
export { CacheManager } from './cache/index.js';
export { CacheError, CacheNotFoundError, CacheExpiredError, CacheIOError, CacheCorruptedError } from './cache/errors.js';
// Configuration
export { getConfig, validateOrgUrl, ConfigError } from './config/index.js';
// Command functions for programmatic use
export { default as listCommand } from './commands/list.js';
export { default as cacheCommand } from './commands/cache.js';
export { default as exploreCommand } from './commands/explore.js';
export { default as createCommand } from './commands/create.js';
export { bulkCreateCommand, interactiveHierarchyBuilder } from './commands/bulk-create.js';
// Interactive components
export { runInteractiveMode } from './interactive/index.js';
export { runCreateWizard } from './interactive/create-wizard.js';
export { TreeSelector } from './interactive/tree-selector.js';
// Utilities
export { formatWorkItemsAsTable, formatWorkItemsAsJson, formatWorkItemsMinimal, formatSummary } from './utils/formatter.js';
export { HierarchyProcessor } from './utils/hierarchy-processor.js';
export { getChildWorkItemType, canHaveChildren, getSupportedParentTypes, getTypeHierarchy } from './utils/work-item-types.js';
export { keypressManager } from './utils/keypress-manager.js';
// Explorer
export { TreeNavigator } from './explorer/tree-navigator.js';
// Schema and validation
import workItemSchema from './schemas/work-item-hierarchy.json' with { type: 'json' };
export { workItemSchema };
// Convenience factory functions for library users
export function createClient(config) {
return new AzureDevOpsClient(config || getConfig());
}
export function createCacheManager(config) {
return new CacheManager(config || getConfig());
}
/**
* Quick setup function for library consumers
* @param {Object} options - Configuration options
* @param {string} options.orgUrl - Azure DevOps organization URL
* @param {string} options.project - Project name
* @param {string} options.pat - Personal Access Token
* @param {string} options.user - User email or display name
* @param {number} [options.rootIssueId] - Optional root issue ID filter
* @returns {Object} Configured client and cache manager
*/
export async function setup(options) {
const config = {
orgUrl: options.orgUrl,
project: options.project,
pat: options.pat,
user: options.user,
rootIssueId: options.rootIssueId || null
};
const client = new AzureDevOpsClient(config);
const cache = new CacheManager(config);
await client.connect();
return {
client,
cache,
config
};
}
// Export version for programmatic access
import { readFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const packageJson = JSON.parse(
readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')
);
export const version = packageJson.version;