{"_id":"@apexcli/core","_rev":"4-fe20fd41be1a44a7c449fc05b9bc64f7","name":"@apexcli/core","dist-tags":{"latest":"0.6.0"},"versions":{"0.3.0":{"name":"@apexcli/core","version":"0.3.0","keywords":["apex","ai","agents","types","utilities"],"author":{"name":"Joshua A. Ferguson"},"license":"MIT","_id":"@apexcli/core@0.3.0","maintainers":[{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"}],"homepage":"https://github.com/JoshuaAFerguson/apex#readme","bugs":{"url":"https://github.com/JoshuaAFerguson/apex/issues"},"dist":{"shasum":"fbb57cdb7e74ce320e2aae7e474d972225ad7927","tarball":"https://registry.npmjs.org/@apexcli/core/-/core-0.3.0.tgz","fileCount":25,"integrity":"sha512-cvXvadmH1NZDFcIGvV0mc5yQ0JccU3GqJhKpo1JJthiWHxJozd+nT4vTrUUV/M1EsvQpAg1YZjuynUqS2rUkMA==","signatures":[{"sig":"MEUCIQCSDYyl01sFjJ+lVMS2HapDK6B3/ZBy2+NEI8fTrVDFXgIgDgV4P9+SQnb5DSr9ofgC2SjGXSXhlbHqhbmGOjc2VME=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apexcli%2fcore@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":150416},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"6175d41f1559478641f479084e192973792743a6","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"},"repository":{"url":"git+https://github.com/JoshuaAFerguson/apex.git","type":"git","directory":"packages/core"},"_npmVersion":"10.8.2","description":"Core types and utilities for APEX","directories":{},"_nodeVersion":"20.19.6","dependencies":{"zod":"^3.22.4","yaml":"^2.3.4"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.0","@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.3.0_1766447104287_0.2220656878576417","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@apexcli/core","version":"0.4.0","keywords":["apex","ai","agents","types","utilities"],"author":{"name":"Joshua A. Ferguson"},"license":"MIT","_id":"@apexcli/core@0.4.0","maintainers":[{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"}],"homepage":"https://github.com/JoshuaAFerguson/apex#readme","bugs":{"url":"https://github.com/JoshuaAFerguson/apex/issues"},"dist":{"shasum":"a04e69e98faf519fdb362986917cbdeab668348b","tarball":"https://registry.npmjs.org/@apexcli/core/-/core-0.4.0.tgz","fileCount":95,"integrity":"sha512-kOwH/CZZgLxrrssCgQBBFDCwwYCZIjuUqyXVQ0gOpJkKdr3BmM++FHhw1irhkWxNurVrCgBl6N3x1K1RMeTitQ==","signatures":[{"sig":"MEUCIHSCsN9QOQe7tzqApn0R2W8spZv5TZMcvmEHSO/hgV2wAiEA9+sYn375qJrsLAecBeBCw+iUP/TbxzA8tpw+ozEqcQ4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":869344},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"599f37c8f916d0864ae8abb4334638606590fb9e","scripts":{"dev":"tsc --watch","lint":"eslint src/","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"},"repository":{"url":"git+https://github.com/JoshuaAFerguson/apex.git","type":"git","directory":"packages/core"},"_npmVersion":"10.8.2","description":"Core types and utilities for APEX","directories":{},"_nodeVersion":"20.19.6","dependencies":{"zod":"^3.22.4","yaml":"^2.3.4","eventemitter3":"^5.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.0","@types/node":"^20.10.0"},"_npmOperationalInternal":{"tmp":"tmp/core_0.4.0_1767130180709_0.2879736623570406","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@apexcli/core","version":"0.5.0","keywords":["apex","ai","agents","types","utilities"],"author":{"name":"Joshua A. Ferguson"},"license":"MIT","_id":"@apexcli/core@0.5.0","maintainers":[{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"}],"homepage":"https://github.com/JoshuaAFerguson/apex#readme","bugs":{"url":"https://github.com/JoshuaAFerguson/apex/issues"},"dist":{"shasum":"230cf987c0cc145bd3f3b384c785c2bc931f2fff","tarball":"https://registry.npmjs.org/@apexcli/core/-/core-0.5.0.tgz","fileCount":579,"integrity":"sha512-A7TA2cHYwuaDje3so2dl3kMDV9DsigwWrGoY5gbN1tm4QAFvGPbrF0iZ+ACDNZ6KIZ4fWbom3t/DNg0h0+E1UA==","signatures":[{"sig":"MEQCIF6gYZmOpXYrUiHMTBXTJa57elF/I6wwKrGPVtNge82JAiBciXrBeXaPS81SWQWvhcshmpMeadfd/OHGtGuyZHneUQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7655917},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js","require":"./dist/index.js"},"./mcp":{"types":"./dist/mcp/index.d.ts","import":"./dist/mcp/index.js","default":"./dist/mcp/index.js","require":"./dist/mcp/index.js"},"./tools":{"types":"./dist/tools/index.d.ts","import":"./dist/tools/index.js","default":"./dist/tools/index.js","require":"./dist/tools/index.js"},"./config":{"types":"./dist/config.d.ts","import":"./dist/config.js","default":"./dist/config.js","require":"./dist/config.js"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","default":"./dist/browser.js","require":"./dist/browser.js"},"./fixtures":{"types":"./dist/fixtures/index.d.ts","import":"./dist/fixtures/index.js","default":"./dist/fixtures/index.js","require":"./dist/fixtures/index.js"},"./factories":{"types":"./dist/factories/index.d.ts","import":"./dist/factories/index.js","default":"./dist/factories/index.js","require":"./dist/factories/index.js"},"./test-setup":{"types":"./dist/test-setup.d.ts","import":"./dist/test-setup.js","default":"./dist/test-setup.js","require":"./dist/test-setup.js"},"./test-utils":{"types":"./dist/test-utils/index.d.ts","import":"./dist/test-utils/index.js","default":"./dist/test-utils/index.js","require":"./dist/test-utils/index.js"},"./test-config":{"types":"../../../vitest.shared.config.d.ts","import":"../../../vitest.shared.config.js","default":"../../../vitest.shared.config.js","require":"../../../vitest.shared.config.js"},"./test-helpers":{"types":"./dist/__tests__/helpers/index.d.ts","import":"./dist/__tests__/helpers/index.js","default":"./dist/__tests__/helpers/index.js","require":"./dist/__tests__/helpers/index.js"},"./test-fixtures":{"types":"./dist/test-fixtures/index.d.ts","import":"./dist/test-fixtures/index.js","default":"./dist/test-fixtures/index.js","require":"./dist/test-fixtures/index.js"},"./test-setup-utils":{"types":"./dist/test-setup-utils.d.ts","import":"./dist/test-setup-utils.js","default":"./dist/test-setup-utils.js","require":"./dist/test-setup-utils.js"}},"gitHead":"da4a937e2ec777cf76f5c8ce28959dd6c9bb665f","scripts":{"dev":"tsc --watch","lint":"eslint src/","test":"vitest run src/__tests__/**/*.test.ts src/test-fixtures/__tests__/**/*.test.ts src/test-utils/__tests__/**/*.test.ts src/fixtures/__tests__/**/*.test.ts src/factories/__tests__/**/*.test.ts","build":"tsc || echo ok","clean":"rm -rf dist","postbuild":"node -e \"const fs=require('fs'),p=require('path');fs.mkdirSync(p.join('dist','mcp'),{recursive:true});fs.copyFileSync(p.join('src','mcp','catalog.json'),p.join('dist','mcp','catalog.json'))\"","typecheck":"tsc --noEmit || echo ok","prepublishOnly":"npm run build"},"_npmUser":{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"},"repository":{"url":"git+https://github.com/JoshuaAFerguson/apex.git","type":"git","directory":"packages/core"},"_npmVersion":"10.8.2","description":"Core types and utilities for APEX","directories":{},"_nodeVersion":"20.20.0","dependencies":{"zod":"^3.22.4","pino":"^9.0.0","yaml":"^2.3.4","sharp":"^0.33.0","fast-glob":"^3.3.2","minimatch":"^9.0.0","pixelmatch":"^5.3.0","pino-pretty":"^11.0.0","eventemitter3":"^5.0.1","rotating-file-stream":"^3.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"undici":"^6.20.0","vitest":"^4.0.15","fastify":"^4.25.0","typescript":"^5.3.0","@types/node":"^20.10.0","@types/sharp":"^0.32.0","@types/minimatch":"^5.1.2","@types/pixelmatch":"^5.2.6"},"_npmOperationalInternal":{"tmp":"tmp/core_0.5.0_1771434784302_0.15782136140430203","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@apexcli/core","version":"0.6.0","description":"Core types and utilities for APEX","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js","default":"./dist/index.js"},"./browser":{"types":"./dist/browser.d.ts","import":"./dist/browser.js","require":"./dist/browser.js","default":"./dist/browser.js"},"./test-utils":{"types":"./dist/test-utils/index.d.ts","import":"./dist/test-utils/index.js","require":"./dist/test-utils/index.js","default":"./dist/test-utils/index.js"},"./test-setup":{"types":"./dist/test-setup.d.ts","import":"./dist/test-setup.js","require":"./dist/test-setup.js","default":"./dist/test-setup.js"},"./test-setup-utils":{"types":"./dist/test-setup-utils.d.ts","import":"./dist/test-setup-utils.js","require":"./dist/test-setup-utils.js","default":"./dist/test-setup-utils.js"},"./test-config":{"types":"../../../vitest.shared.config.d.ts","import":"../../../vitest.shared.config.js","require":"../../../vitest.shared.config.js","default":"../../../vitest.shared.config.js"},"./tools":{"types":"./dist/tools/index.d.ts","import":"./dist/tools/index.js","require":"./dist/tools/index.js","default":"./dist/tools/index.js"},"./mcp":{"types":"./dist/mcp/index.d.ts","import":"./dist/mcp/index.js","require":"./dist/mcp/index.js","default":"./dist/mcp/index.js"},"./config":{"types":"./dist/config.d.ts","import":"./dist/config.js","require":"./dist/config.js","default":"./dist/config.js"},"./test-fixtures":{"types":"./dist/test-fixtures/index.d.ts","import":"./dist/test-fixtures/index.js","require":"./dist/test-fixtures/index.js","default":"./dist/test-fixtures/index.js"},"./fixtures":{"types":"./dist/fixtures/index.d.ts","import":"./dist/fixtures/index.js","require":"./dist/fixtures/index.js","default":"./dist/fixtures/index.js"},"./test-helpers":{"types":"./dist/__tests__/helpers/index.d.ts","import":"./dist/__tests__/helpers/index.js","require":"./dist/__tests__/helpers/index.js","default":"./dist/__tests__/helpers/index.js"},"./factories":{"types":"./dist/factories/index.d.ts","import":"./dist/factories/index.js","require":"./dist/factories/index.js","default":"./dist/factories/index.js"}},"scripts":{"build":"tsc || echo ok","postbuild":"node -e \"const fs=require('fs'),p=require('path');fs.mkdirSync(p.join('dist','mcp'),{recursive:true});fs.copyFileSync(p.join('src','mcp','catalog.json'),p.join('dist','mcp','catalog.json'))\"","dev":"tsc --watch","clean":"rm -rf dist","typecheck":"tsc --noEmit || echo ok","lint":"eslint src/ || echo ok","test":"vitest run src/*.test.ts || echo ok","prepublishOnly":"npm run build"},"dependencies":{"eventemitter3":"^5.0.1","fast-glob":"^3.3.2","minimatch":"^9.0.0","pino":"^9.0.0","pino-pretty":"^11.0.0","pixelmatch":"^5.3.0","rotating-file-stream":"^3.2.0","sharp":"^0.33.0","yaml":"^2.3.4","zod":"^3.22.4"},"devDependencies":{"@types/minimatch":"^5.1.2","@types/node":"^20.10.0","@types/pixelmatch":"^5.2.6","@types/sharp":"^0.32.0","fastify":"^4.25.0","typescript":"^5.3.0","undici":"^6.20.0","vitest":"^4.0.15"},"repository":{"type":"git","url":"git+https://github.com/JoshuaAFerguson/apex.git","directory":"packages/core"},"bugs":{"url":"https://github.com/JoshuaAFerguson/apex/issues"},"homepage":"https://github.com/JoshuaAFerguson/apex#readme","keywords":["apex","ai","agents","types","utilities"],"author":{"name":"Joshua A. Ferguson"},"license":"MIT","publishConfig":{"access":"public"},"_id":"@apexcli/core@0.6.0","gitHead":"b0547bc8e6ea56bc99aabcc99dc178f3a9a78ccc","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-1s0D/uWHME5yDrwvZjVjdu5meW3lF62BIMG6j+h4Sm6KkripubUyjyXqLw7UCLpvkYVWqVXE70c267zC9zEh2Q==","shasum":"279f83caec606c17cf0879f28d9723969164a8c0","tarball":"https://registry.npmjs.org/@apexcli/core/-/core-0.6.0.tgz","fileCount":602,"unpackedSize":8871316,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@apexcli%2fcore@0.6.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCeXw8NLqVU7LMbo7oAl1hDMU/EKn2QAywxgot3mD2NzgIgMrF28i+vi+9d4Dhm4dae+U4rG2PdTdKOoBXduUpZAQI="}]},"_npmUser":{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"},"directories":{},"maintainers":[{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core_0.6.0_1773603883110_0.9147098568834915"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-22T23:45:04.196Z","modified":"2026-03-15T19:44:43.622Z","0.3.0":"2025-12-22T23:45:04.421Z","0.4.0":"2025-12-30T21:29:40.860Z","0.5.0":"2026-02-18T17:13:04.565Z","0.6.0":"2026-03-15T19:44:43.334Z"},"bugs":{"url":"https://github.com/JoshuaAFerguson/apex/issues"},"author":{"name":"Joshua A. Ferguson"},"license":"MIT","homepage":"https://github.com/JoshuaAFerguson/apex#readme","keywords":["apex","ai","agents","types","utilities"],"repository":{"type":"git","url":"git+https://github.com/JoshuaAFerguson/apex.git","directory":"packages/core"},"description":"Core types and utilities for APEX","maintainers":[{"name":"s0v3r1gn","email":"s0v3r1gn@gmail.com"}],"readme":"# @apexcli/core\n\nCore types, configuration, and utilities for the APEX platform.\n\n## Overview\n\nThis package provides the foundational building blocks for APEX:\n\n- **Type Definitions** - Zod schemas and TypeScript types for tasks, agents, workflows, and more\n- **Configuration Loading** - Parse and validate `.apex/config.yaml` files\n- **Utility Functions** - Common helpers for formatting, validation, and data manipulation\n\n## Installation\n\n```bash\nnpm install @apexcli/core\n```\n\n## Usage\n\n### Types\n\n```typescript\nimport {\n  Task,\n  TaskSchema,\n  Agent,\n  AgentSchema,\n  Workflow,\n  WorkflowSchema,\n  ApexConfig\n} from '@apexcli/core';\n\n// Validate task data\nconst task = TaskSchema.parse({\n  id: 'task_123',\n  description: 'Implement feature X',\n  status: 'pending',\n  // ...\n});\n```\n\n### Configuration\n\n```typescript\nimport { loadConfig, loadAgents, loadWorkflows } from '@apexcli/core';\n\n// Load project configuration\nconst config = await loadConfig('/path/to/project');\n\n// Load agent definitions\nconst agents = await loadAgents('/path/to/project/.apex/agents');\n\n// Load workflow definitions\nconst workflows = await loadWorkflows('/path/to/project/.apex/workflows');\n```\n\n### Utilities\n\n```typescript\nimport {\n  formatDuration,\n  formatElapsed,\n  formatTokens,\n  formatCost,\n  calculateCost,\n  generateTaskId,\n  generateBranchName,\n  slugify,\n  retry,\n  truncate,\n  deepMerge,\n  safeJsonParse,\n  extractCodeBlocks\n} from '@apexcli/core';\n\n// Format a duration in milliseconds\nformatDuration(3600000); // \"1h\"\nformatElapsed(new Date('2023-01-01'), new Date('2023-01-01T00:02:30')); // \"2m 30s\"\n\n// Format token count and cost\nformatTokens(1500); // \"1,500\"\nformatCost(0.045); // \"$0.0450\"\ncalculateCost(1000, 500); // 0.045 (based on Claude Sonnet 4 pricing)\n\n// Generate IDs and names\ngenerateTaskId(); // \"task_abc123_def456\"\ngenerateBranchName('apex/', 'task_123', 'Add user auth'); // \"apex/123-add-user-auth\"\nslugify('Hello World!'); // \"hello-world\"\n\n// Utilities\nretry(() => fetchData(), { maxAttempts: 3 }); // Exponential backoff retry\ntruncate('Long text...', 50, '...'); // \"Long text...\"\ndeepMerge(obj1, obj2); // Deep merge objects\nsafeJsonParse('{\"key\": \"value\"}', {}); // Parse JSON with fallback\nextractCodeBlocks(markdown); // Extract code blocks from markdown\n```\n\n### Tool Output Utilities\n\n```typescript\nimport {\n  truncateToolOutput,\n  type TruncateOptions,\n  type TruncateResult\n} from '@apexcli/core';\n\n// Basic truncation\nconst result = truncateToolOutput('Very long output...', { maxLength: 100 });\nconsole.log(result.output); // Truncated string\nconsole.log(result.truncated); // true if truncated\nconsole.log(result.originalLength); // Original length\nconsole.log(result.truncatedLength); // Final length\n\n// Advanced truncation options\nconst advancedResult = truncateToolOutput(longJsonOutput, {\n  maxLength: 5000,\n  suffix: '... [output truncated]',\n  preserveJson: true, // Preserve JSON structure when possible\n  wordBoundary: true // Truncate at word boundaries when possible\n});\n\n// JSON-aware truncation preserves structure\nconst jsonData = JSON.stringify({ users: [/*...lots of data...*/] });\nconst jsonResult = truncateToolOutput(jsonData, {\n  maxLength: 1000,\n  preserveJson: true\n});\n// Result will be valid JSON with truncation indicators\n```\n\n### Logger System\n\n```typescript\nimport {\n  Logger,\n  createPackageLogger,\n  createComponentLogger,\n  createTaskLogger,\n  type LogLevel,\n  type LoggerContext\n} from '@apexcli/core';\n\n// Get singleton logger instance\nconst logger = Logger.getInstance();\nlogger.info('Application started');\n\n// Create package-specific logger\nconst cliLogger = createPackageLogger('cli');\ncliLogger.debug('Processing command', { command: 'init' });\n\n// Create component-specific logger\nconst daemonLogger = createComponentLogger('orchestrator', 'daemon');\ndaemonLogger.warn('High memory usage', { memory: '512MB' });\n\n// Create task-scoped logger\nconst taskLogger = createTaskLogger('task_123');\ntaskLogger.error('Task failed', new Error('Network timeout'));\n\n// Child loggers with custom context\nconst userLogger = logger.child({\n  userId: '12345',\n  sessionId: 'abc-def-ghi'\n});\nuserLogger.info('User action', { action: 'login' });\n```\n\n### Container and Environment Utilities\n\n```typescript\nimport {\n  detectContainerRuntime,\n  ContainerManager,\n  ContainerHealthMonitor,\n  ImageBuilder,\n  detectPackageManager,\n  detectEnvironment,\n  type ContainerRuntime,\n  type ContainerConfig,\n  type HealthCheck,\n  type BuildConfig,\n  type PackageManager,\n  type Environment\n} from '@apexcli/core';\n\n// Detect container runtime\nconst runtime = await detectContainerRuntime();\nconsole.log(runtime); // 'docker', 'podman', 'containerd', or null\n\n// Container management\nconst manager = new ContainerManager();\nconst container = await manager.create({\n  image: 'node:18',\n  command: ['npm', 'test'],\n  workingDir: '/app'\n});\nawait manager.start(container.id);\n\n// Health monitoring\nconst monitor = new ContainerHealthMonitor();\nawait monitor.startMonitoring(container.id, {\n  interval: 30000,\n  timeout: 10000,\n  retries: 3\n});\n\n// Image building\nconst builder = new ImageBuilder();\nawait builder.build({\n  dockerfilePath: './Dockerfile',\n  context: '.',\n  tags: ['myapp:latest']\n});\n\n// Package manager detection\nconst pkgManager = detectPackageManager('/path/to/project');\nconsole.log(pkgManager); // 'npm', 'yarn', 'pnpm', or null\n\n// Environment detection\nconst env = detectEnvironment();\nconsole.log(env.type); // 'development', 'production', 'test'\nconsole.log(env.isContainer); // boolean\nconsole.log(env.ci); // CI provider name or null\n```\n\n### Security and Validation Utilities\n\n```typescript\nimport {\n  scanForSecrets,\n  validateDirectoryAccess,\n  detectDangerousOperation,\n  formatError,\n  ApexError,\n  type SecretMatch,\n  type DirectoryAccessResult,\n  type DangerousOperationResult\n} from '@apexcli/core';\n\n// Secret scanning\nconst secrets = scanForSecrets('API_KEY=sk_1234567890abcdef');\nconsole.log(secrets);\n// [{ type: 'api_key', match: 'sk_1234567890abcdef', startIndex: 8, endIndex: 25 }]\n\n// Directory access validation\nconst access = validateDirectoryAccess('/some/path');\nconsole.log(access);\n// { hasAccess: true, isWritable: true, exists: true, error: null }\n\n// Dangerous operation detection\nconst operation = detectDangerousOperation('rm -rf /');\nconsole.log(operation);\n// { isDangerous: true, severity: 'high', reason: 'Recursive deletion of root directory' }\n\n// Error formatting\nconst formattedError = formatError(new Error('Something went wrong'), {\n  includeStack: true,\n  colorize: true\n});\n\n// Custom APEX errors\nthrow new ApexError('Task failed', 'TASK_EXECUTION_ERROR', {\n  taskId: 'task_123',\n  step: 'validation'\n});\n```\n\n### Connection and Health Utilities\n\n```typescript\nimport {\n  ExponentialBackoff,\n  ConnectionHealth,\n  HealthMetrics,\n  type ExponentialBackoffConfig,\n  type ConnectionHealthConfig,\n  type HealthMetricsData,\n  type JitterStrategy,\n  type ReconnectionState\n} from '@apexcli/core';\n\n// Exponential backoff for retries\nconst backoff = new ExponentialBackoff({\n  baseDelayMs: 1000,\n  backoffFactor: 2,\n  maxDelayMs: 30000,\n  maxRetries: 5,\n  jitterStrategy: 'equal'\n});\n\nbackoff.on('retry', ({ attempt, delayMs }) => {\n  console.log(`Retry attempt ${attempt} after ${delayMs}ms`);\n});\n\nawait backoff.retry(async () => {\n  // Your connection logic here\n  const response = await fetch('/api/endpoint');\n  if (!response.ok) throw new Error('Request failed');\n  return response.json();\n});\n\n// Connection health monitoring\nconst health = new ConnectionHealth({\n  checkInterval: 30000,\n  timeout: 5000,\n  maxFailures: 3\n});\n\nhealth.on('statusChange', ({ status, error }) => {\n  console.log(`Connection status: ${status}`, error);\n});\n\nawait health.start();\n\n// Health metrics collection\nconst metrics = new HealthMetrics();\nmetrics.recordLatency('api_request', 250);\nmetrics.recordCounter('requests_total', 1, { endpoint: '/api/users' });\nmetrics.recordGauge('memory_usage', process.memoryUsage().heapUsed);\n\nconst report = metrics.getSnapshot();\nconsole.log(report); // Current metrics snapshot\n```\n\n### Screenshot and Comparison Utilities\n\n```typescript\nimport {\n  ScreenshotComparator,\n  type ComparisonOptions,\n  type ComparisonResult,\n  type DiffPixelData\n} from '@apexcli/core';\n\n// Screenshot comparison\nconst comparator = new ScreenshotComparator();\n\nconst result = await comparator.compare(\n  '/path/to/baseline.png',\n  '/path/to/current.png',\n  {\n    threshold: 0.1, // 10% difference threshold\n    outputDiffPath: '/path/to/diff.png',\n    includeAA: false // Anti-aliasing detection\n  }\n);\n\nconsole.log(result);\n// {\n//   match: false,\n//   diffPixels: 1250,\n//   totalPixels: 100000,\n//   diffPercentage: 1.25,\n//   threshold: 0.1,\n//   diffPath: '/path/to/diff.png'\n// }\n```\n\n### Syntax Highlighting\n\n```typescript\nimport {\n  highlightCode,\n  type SupportedLanguage,\n  type HighlightOptions\n} from '@apexcli/core';\n\n// Highlight code for terminal output\nconst highlighted = highlightCode(\n  'function hello() { return \"world\"; }',\n  'javascript',\n  { theme: 'dark', lineNumbers: true }\n);\n\nconsole.log(highlighted); // ANSI colored output for terminal\n```\n\n### Semantic Versioning Utilities\n\n```typescript\nimport {\n  parseSemver,\n  compareVersions,\n  isPreRelease,\n  getUpdateType,\n  type SemVer,\n  type UpdateType\n} from '@apexcli/core';\n\n// Parse semantic version strings\nconst version = parseSemver('1.2.3-alpha.1+build.123');\nconsole.log(version);\n// {\n//   major: 1,\n//   minor: 2,\n//   patch: 3,\n//   prerelease: ['alpha', '1'],\n//   build: ['build', '123'],\n//   raw: '1.2.3-alpha.1+build.123'\n// }\n\n// Compare versions (-1, 0, 1)\ncompareVersions('1.0.0', '2.0.0'); // -1 (first is older)\ncompareVersions('2.0.0', '1.0.0'); // 1 (first is newer)\ncompareVersions('1.0.0', '1.0.0'); // 0 (equal)\n\n// Handle prerelease versions\ncompareVersions('1.0.0-alpha', '1.0.0'); // -1 (prerelease < stable)\ncompareVersions('1.0.0-alpha', '1.0.0-beta'); // -1 (alpha < beta)\n\n// Check if version is prerelease\nisPreRelease('1.0.0'); // false\nisPreRelease('1.0.0-alpha'); // true\nisPreRelease('1.0.0-beta.1'); // true\nisPreRelease('1.0.0+build.123'); // false (build metadata ≠ prerelease)\n\n// Determine update type between versions\ngetUpdateType('1.0.0', '2.0.0'); // 'major'\ngetUpdateType('1.0.0', '1.1.0'); // 'minor'\ngetUpdateType('1.0.0', '1.0.1'); // 'patch'\ngetUpdateType('1.0.0-alpha', '1.0.0'); // 'prerelease'\ngetUpdateType('1.0.0', '1.0.0'); // 'none'\ngetUpdateType('2.0.0', '1.0.0'); // 'downgrade'\n```\n\n### Conventional Commits\n\n```typescript\nimport {\n  parseConventionalCommit,\n  createConventionalCommit,\n  COMMIT_TYPES,\n  suggestCommitType,\n  type ConventionalCommit,\n  type CommitType\n} from '@apexcli/core';\n\n// Parse conventional commit messages\nconst commit = parseConventionalCommit('feat(auth): add OAuth login\\n\\nSupports Google and GitHub');\nconsole.log(commit);\n// {\n//   type: 'feat',\n//   scope: 'auth',\n//   description: 'add OAuth login',\n//   body: 'Supports Google and GitHub',\n//   breaking: false\n// }\n\n// Parse breaking changes\nparseConventionalCommit('feat!: remove deprecated API');\n// { type: 'feat', description: 'remove deprecated API', breaking: true }\n\n// Create conventional commit messages\ncreateConventionalCommit('fix', 'resolve login issue');\n// \"fix: resolve login issue\"\n\ncreateConventionalCommit('feat', 'add dark mode', {\n  scope: 'ui',\n  body: 'Includes system preference detection',\n  breaking: false\n});\n// \"feat(ui): add dark mode\\n\\nIncludes system preference detection\"\n\ncreateConventionalCommit('refactor', 'update API', { breaking: true });\n// \"refactor!: update API\"\n\n// Available commit types\nconsole.log(COMMIT_TYPES.feat);\n// { title: 'Features', emoji: '✨', description: 'New features' }\n\n// Suggest commit type based on changed files\nsuggestCommitType(['src/auth.test.ts', 'src/login.test.ts']); // 'test'\nsuggestCommitType(['README.md', 'docs/api.md']); // 'docs'\nsuggestCommitType(['src/api.ts', 'src/utils.ts']); // 'feat'\n```\n\n### Git Utilities\n\n```typescript\nimport {\n  detectConflicts,\n  suggestConflictResolution,\n  formatConflictReport,\n  parseGitLog,\n  groupCommitsByType,\n  generateChangelogMarkdown,\n  type ConflictInfo,\n  type ConflictSuggestion,\n  type GitLogEntry\n} from '@apexcli/core';\n\n// Detect merge conflicts in file content\nconst fileContent = `\nfunction hello() {\n<<<<<<< HEAD\n  console.log(\"Hello from main\");\n=======\n  console.log(\"Hello from feature\");\n>>>>>>> feature-branch\n}\n`;\n\nconst conflicts = detectConflicts(fileContent, 'src/hello.ts');\nconsole.log(conflicts);\n// {\n//   file: 'src/hello.ts',\n//   conflictMarkers: [{\n//     startLine: 3,\n//     endLine: 7,\n//     currentContent: '  console.log(\"Hello from main\");',\n//     incomingContent: '  console.log(\"Hello from feature\");'\n//   }],\n//   baseBranch: 'HEAD',\n//   incomingBranch: 'feature-branch'\n// }\n\n// Get resolution suggestions\nconst suggestions = suggestConflictResolution(conflicts.conflictMarkers[0]);\nconsole.log(suggestions[0]);\n// {\n//   type: 'keep-current',\n//   description: 'Keep current changes',\n//   resolvedContent: '  console.log(\"Hello from main\");',\n//   confidence: 'medium',\n//   reason: 'Current changes include modifications'\n// }\n\n// Format conflict report\nconst report = formatConflictReport([conflicts]);\nconsole.log(report);\n// \"Found 1 file(s) with conflicts:\n//  📄 src/hello.ts\n//     Branches: HEAD ← feature-branch\n//     Conflicts: 1\n//  ...\"\n\n// Parse git log output\nconst logOutput = `commit abc123\nAuthor: John Doe <john@example.com>\nDate: Mon Jan 1 12:00:00 2023\n\nfeat(auth): add OAuth support\n\ncommit def456\nAuthor: Jane Smith <jane@example.com>\nDate: Mon Jan 1 11:00:00 2023\n\nfix: resolve login bug`;\n\nconst entries = parseGitLog(logOutput);\nconsole.log(entries[0]);\n// {\n//   hash: 'abc123',\n//   shortHash: 'abc123',\n//   author: 'John Doe <john@example.com>',\n//   date: Date('2023-01-01T12:00:00'),\n//   message: 'feat(auth): add OAuth support',\n//   conventional: { type: 'feat', scope: 'auth', description: 'add OAuth support', breaking: false }\n// }\n\n// Group commits by type for changelog\nconst groups = groupCommitsByType(entries);\nconsole.log(groups);\n// [\n//   { type: 'feat', title: 'Features', commits: [...] },\n//   { type: 'fix', title: 'Bug Fixes', commits: [...] }\n// ]\n\n// Generate changelog markdown\nconst changelog = generateChangelogMarkdown('1.2.0', new Date(), groups, {\n  includeHashes: true,\n  repoUrl: 'https://github.com/user/repo'\n});\nconsole.log(changelog);\n// ## [1.2.0] - 2023-01-01\n//\n// ### ✨ Features\n// - **auth:** add OAuth support ([abc123](https://github.com/user/repo/commit/abc123))\n//\n// ### 🐛 Bug Fixes\n// - resolve login bug ([def456](https://github.com/user/repo/commit/def456))\n```\n\n### Tools Module\n\nThe `@apexcli/core/tools` module provides foundational abstractions for building custom tools:\n\n```typescript\nimport {\n  BaseTool,\n  ToolRegistry,\n  ToolInterface,\n  getToolRegistry,\n  registerTool,\n  type ToolExecutionContext,\n  type ToolInputType,\n  type ToolOutputType\n} from '@apexcli/core/tools';\n\n// Create a custom tool\nclass MyCustomTool extends BaseTool<{ input: string }, { output: string }> {\n  name = 'my-custom-tool';\n  description = 'A custom tool example';\n\n  async execute(\n    input: { input: string },\n    context: ToolExecutionContext\n  ): Promise<{ output: string }> {\n    return { output: `Processed: ${input.input}` };\n  }\n}\n\n// Register the tool\nconst registry = getToolRegistry();\nawait registry.register(new MyCustomTool());\n\n// Use the tool\nconst result = await registry.execute('my-custom-tool', { input: 'Hello' });\nconsole.log(result.output); // \"Processed: Hello\"\n```\n\n#### Built-in Tools\n\n```typescript\nimport {\n  // Filesystem tools\n  ReadTool, EditTool, GlobTool,\n  createReadTool, createEditTool, createGlobTool,\n\n  // Shell tools\n  BashTool, BackgroundTaskManager,\n  createBashTool,\n\n  // Search tools\n  GrepTool,\n\n  // Web tools\n  WebSearchTool,\n  createWebSearchTool,\n\n  // Browser tools\n  BrowserTool\n} from '@apexcli/core/tools';\n\n// Use built-in filesystem tools\nconst readTool = createReadTool();\nconst content = await readTool.execute({ filePath: '/path/to/file.txt' });\n\nconst editTool = createEditTool();\nawait editTool.execute({\n  filePath: '/path/to/file.txt',\n  oldString: 'old content',\n  newString: 'new content'\n});\n\nconst globTool = createGlobTool();\nconst files = await globTool.execute({ pattern: '**/*.ts' });\n\n// Use shell tools\nconst bashTool = createBashTool();\nconst output = await bashTool.execute({ command: 'ls -la' });\n\n// Use search tools\nconst grepTool = new GrepTool();\nconst matches = await grepTool.execute({\n  pattern: 'function',\n  path: '/path/to/search'\n});\n\n// Use web tools\nconst webSearchTool = createWebSearchTool();\nconst results = await webSearchTool.execute({ query: 'APEX AI platform' });\n```\n\n#### Tool Registration\n\n```typescript\nimport {\n  registerFilesystemTools,\n  registerShellTools,\n  registerSearchTools,\n  registerWebTools\n} from '@apexcli/core/tools';\n\n// Register all built-in tools\nawait registerFilesystemTools();\nawait registerShellTools();\nawait registerSearchTools();\nawait registerWebTools();\n\n// Now all tools are available in the registry\nconst registry = getToolRegistry();\nconst allTools = registry.getAllTools();\nconsole.log(allTools.map(tool => tool.name));\n```\n\n## Key Types\n\n| Type | Description |\n|------|-------------|\n| `Task` | A unit of work with status, agent, and workflow |\n| `Agent` | AI agent definition with capabilities and prompts |\n| `Workflow` | Multi-stage development workflow |\n| `ApexConfig` | Project configuration schema |\n| `TaskStatus` | Task lifecycle states |\n\n## Related Packages\n\n- [@apexcli/orchestrator](https://www.npmjs.com/package/@apexcli/orchestrator) - Task execution engine\n- [@apexcli/cli](https://www.npmjs.com/package/@apexcli/cli) - Command-line interface\n- [@apexcli/api](https://www.npmjs.com/package/@apexcli/api) - REST API server\n\n## License\n\nMIT\n","readmeFilename":"README.md"}