JSPM

helmstack-core

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q71276F
    • License MIT

    HelmStack core ports and services - Clean Architecture implementation

    Package Exports

    • helmstack-core
    • helmstack-core/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (helmstack-core) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @helmstack/core

    Core orchestrator engine for HelmStack: task management, AI logic, state/memory, command handlers with contract-first validation.

    ๐ŸŽฏ Overview

    HelmStack Core is the orchestration engine that powers all HelmStack commands. It implements:

    • Command orchestration via the Heck class
    • Runtime policies (timeout, retry, lock, validation)
    • Service interfaces for external integrations
    • Handler framework for command business logic
    • Contract-first validation using @helmstack/schemas

    ๐Ÿ—๏ธ Architecture

    helmstack-core/
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ orchestrator/         # Main Heck class and handler registry
    โ”‚   โ”œโ”€โ”€ runtime/              # Lock, Retry, Timeout, Validation, Logger
    โ”‚   โ”œโ”€โ”€ services/             # Interface definitions for external services
    โ”‚   โ”œโ”€โ”€ usecases/             # Command handlers (business logic)
    โ”‚   โ”œโ”€โ”€ policies/             # Reusable policies and rules
    โ”‚   โ””โ”€โ”€ bootstrap/            # Context setup and dependency injection

    ๐Ÿš€ Usage

    import { Heck, CoreContext } from '@helmstack/core';
    
    // Create context with service implementations
    const context = new CoreContext({
      services: {
        Git: new GitAdapter(),
        GitHub: new GitHubAdapter(),
        ML: new MLAdapter(),
        // ... other services
      }
    });
    
    // Create orchestrator
    const heck = new Heck(registry, context);
    
    // Execute command
    const result = await heck.run('plan', {
      ai: true,
      charter: true
    });
    
    console.log(result.payload);

    ๐Ÿ“ Command Handlers

    All command handlers implement the Handler<TInput, TOutput> interface:

    export class PlanHandler implements Handler<PlanInput, PlanOutput> {
      async run(input: PlanInput, context: CoreContext): Promise<PlanOutput> {
        // Business logic here
        return {
          strategy: 'ai',
          tasks: [...],
          risks: [...]
        };
      }
    }

    ๐Ÿ”ง Runtime Features

    • Envelope: Standard response format for all commands
    • Validation: AJV-based schema validation
    • Lock: Workspace-level file locking for mutating operations
    • Retry: Exponential backoff with jitter
    • Timeout: Configurable timeouts with abort support
    • Logger: Structured logging with redaction

    ๐Ÿค Service Integration

    Core defines interfaces for external services but doesn't implement them. Implementations come from @helmstack/addons:

    • Git - Local git operations
    • GitHub - GitHub API integration
    • ML - AI/ML service integration
    • Secrets - Secret management
    • FS - File system operations
    • Http - HTTP client with retry/backoff

    ๐Ÿ“‹ Contract Validation

    All command inputs and outputs are validated against schemas from @helmstack/schemas. This ensures:

    • Type safety across the entire ecosystem
    • Consistent API contracts
    • Breaking change detection

    ๐Ÿงช Testing

    # Run all tests
    npm test
    
    # Run contract tests (against schemas)
    npm run test:contract
    
    # Run unit tests
    npm run test:unit
    
    # Run integration tests
    npm run test:integration

    Part of the HelmStack ecosystem.