Package Exports
- hzl-core
- hzl-core/db/__tests__/append-only.test
- hzl-core/db/__tests__/append-only.test.js
- hzl-core/db/__tests__/datastore.test
- hzl-core/db/__tests__/datastore.test.js
- hzl-core/db/__tests__/libsql-compat.test
- hzl-core/db/__tests__/libsql-compat.test.js
- hzl-core/db/__tests__/lock.test
- hzl-core/db/__tests__/lock.test.js
- hzl-core/db/__tests__/meta.test
- hzl-core/db/__tests__/meta.test.js
- hzl-core/db/__tests__/migrations.test
- hzl-core/db/__tests__/migrations.test.js
- hzl-core/db/__tests__/sync-policy.test
- hzl-core/db/__tests__/sync-policy.test.js
- hzl-core/db/__tests__/types.test
- hzl-core/db/__tests__/types.test.js
- hzl-core/db/datastore
- hzl-core/db/datastore.js
- hzl-core/db/lock
- hzl-core/db/lock.js
- hzl-core/db/meta
- hzl-core/db/meta.js
- hzl-core/db/migrations
- hzl-core/db/migrations.js
- hzl-core/db/migrations.test
- hzl-core/db/migrations.test.js
- hzl-core/db/migrations/index
- hzl-core/db/migrations/index.js
- hzl-core/db/migrations/v2
- hzl-core/db/migrations/v2.js
- hzl-core/db/schema
- hzl-core/db/schema.js
- hzl-core/db/sync-policy
- hzl-core/db/sync-policy.js
- hzl-core/db/test-utils
- hzl-core/db/test-utils.js
- hzl-core/db/transaction
- hzl-core/db/transaction.js
- hzl-core/db/types
- hzl-core/db/types.js
- hzl-core/events/store
- hzl-core/events/store.js
- hzl-core/events/store.test
- hzl-core/events/store.test.js
- hzl-core/events/types
- hzl-core/events/types.js
- hzl-core/events/types.test
- hzl-core/events/types.test.js
- hzl-core/events/validation.test
- hzl-core/events/validation.test.js
- hzl-core/fixtures/sample-data
- hzl-core/fixtures/sample-data.js
- hzl-core/projections/comments-checkpoints
- hzl-core/projections/comments-checkpoints.js
- hzl-core/projections/comments-checkpoints.test
- hzl-core/projections/comments-checkpoints.test.js
- hzl-core/projections/dependencies
- hzl-core/projections/dependencies.js
- hzl-core/projections/dependencies.test
- hzl-core/projections/dependencies.test.js
- hzl-core/projections/engine
- hzl-core/projections/engine.js
- hzl-core/projections/engine.test
- hzl-core/projections/engine.test.js
- hzl-core/projections/projects
- hzl-core/projections/projects.js
- hzl-core/projections/projects.test
- hzl-core/projections/projects.test.js
- hzl-core/projections/rebuild
- hzl-core/projections/rebuild.js
- hzl-core/projections/rebuild.test
- hzl-core/projections/rebuild.test.js
- hzl-core/projections/search
- hzl-core/projections/search.js
- hzl-core/projections/search.test
- hzl-core/projections/search.test.js
- hzl-core/projections/tags
- hzl-core/projections/tags.js
- hzl-core/projections/tags.test
- hzl-core/projections/tags.test.js
- hzl-core/projections/tasks-current
- hzl-core/projections/tasks-current.js
- hzl-core/projections/tasks-current.test
- hzl-core/projections/tasks-current.test.js
- hzl-core/projections/types
- hzl-core/projections/types.js
- hzl-core/services/backup-service
- hzl-core/services/backup-service.js
- hzl-core/services/project-service
- hzl-core/services/project-service.js
- hzl-core/services/project-service.test
- hzl-core/services/project-service.test.js
- hzl-core/services/search-service
- hzl-core/services/search-service.js
- hzl-core/services/search-service.test
- hzl-core/services/search-service.test.js
- hzl-core/services/task-service
- hzl-core/services/task-service.js
- hzl-core/services/task-service.test
- hzl-core/services/task-service.test.js
- hzl-core/services/validation-service
- hzl-core/services/validation-service.js
- hzl-core/services/validation-service.test
- hzl-core/services/validation-service.test.js
- hzl-core/utils/id
- hzl-core/utils/id.js
- hzl-core/utils/id.test
- hzl-core/utils/id.test.js
Readme
hzl-core
Core library for HZL - task tracking for coding agents and multi-agent workflows.
This package provides the business logic for programmatic use. For the CLI, install hzl-cli instead.
Installation
npm install hzl-coreUsage
import {
createConnection,
runMigrations,
EventStore,
ProjectionEngine,
TaskService,
ProjectService,
} from 'hzl-core';
// Initialize database
const db = createConnection('/path/to/data.db');
runMigrations(db);
// Set up event sourcing
const eventStore = new EventStore(db);
const projectionEngine = new ProjectionEngine(db, eventStore);
// Create services
const taskService = new TaskService(db, eventStore, projectionEngine);
const projectService = new ProjectService(db, eventStore, projectionEngine);
// Create a project and task
projectService.createProject({ name: 'my-project' });
const task = taskService.createTask({
title: 'Implement feature',
project: 'my-project',
});
// Claim and complete
taskService.claimTask(task.id, { owner: 'agent-1' });
taskService.completeTask(task.id);Key Concepts
Event Sourcing: All state changes are recorded as immutable events. The EventStore handles persistence, and projections derive current state.
Atomic Claiming: claimTask() and claimNext() use database transactions to prevent race conditions when multiple agents claim work concurrently.
Projections: Current state is rebuilt from events. The ProjectionEngine coordinates projectors that maintain specific views (tasks, dependencies, tags, etc.).
Exports
- Database:
createConnection,runMigrations,withWriteTransaction - Events:
EventStore,EventType,TaskStatus - Projections:
ProjectionEngine, individual projectors - Services:
TaskService,ProjectService,SearchService,ValidationService,BackupService
License
MIT