Cleaner is a TypeScript-based worker service built on the MapColonies Jobnik SDK framework. It is a distributed task processing worker that handles cleanup operations as part of the raster processing pipeline.
This project is based on the cleaner template and follows the MapColonies ecosystem conventions for observability, configuration, and deployment.
| Aspect | Details |
|---|---|
| Runtime | Node.js >= 24.0.0 |
| Language | TypeScript 5.x (strict mode) |
| Task Processing | @map-colonies/jobnik-sdk |
| DI Framework | tsyringe |
| Test Framework | Vitest |
For detailed information, refer to the documentation in ai-docs/:
| Document | Description |
|---|---|
| build-system.md | Build pipeline, TypeScript config, Docker build |
| code-style.md | Naming conventions, linting, formatting rules |
| common-patterns.md | DI patterns, task handling, configuration access |
| git-workflow.md | Branch strategy, commit conventions, release process |
| packages.md | Dependencies, MapColonies ecosystem packages |
| testing.md | Vitest setup, mocking, coverage |
src/
index.ts # Application entry point
containerConfig.ts # Dependency injection setup
worker.ts # Worker factory function
common/ # Shared utilities and constants
logistics/ # Example code (replace with cleaner/)
config/ # Environment-specific configuration
tests/ # Vitest test files
ai-docs/ # Detailed AI agent documentation
npm run start:dev # Development mode with offline config
npm run build # Production build
npm test # Run tests with coverage
npm run lint:fix # Auto-fix linting issues-
Incremental Commits & PRs: Always implement changes in small commits grouped into reviewable PRs. After implementing each part:
- Stage files with
git add - Stop and wait for user confirmation before committing
- Only commit after explicit user approval
- Use conventional commits:
<type>(<scope>): <description> - When enough commits are accumulated (3-5 related commits), STOP and tell user to create PR before continuing
- Stage files with
-
Remove Demo Code: The
logistics/folder andseeder.tsare examples. Replace with actual cleaner implementation. -
Package Metadata: Update
package.jsonname fromcleanertocleaner. -
Type Safety: Define job/stage types in
src/cleaner/types.tsand updateworker.tswith correct generic parameters. -
Path Aliases: Use
@common/for imports fromsrc/common/. -
Endpoints:
/metrics(Prometheus),/liveness(health check).
- Define types in
src/cleaner/types.ts - Create manager in
src/cleaner/manager.tswith@injectable() - Update
worker.tsto create worker for your stage - See common-patterns.md for examples
- Add to
config/default.json - Access via
config.get('path.to.value') - See common-patterns.md
- Create
tests/*.spec.tsfiles - Use Vitest with
describe,it,expect - See testing.md for patterns