Skip to content

refactor: migrate to 15-package pnpm monorepo (a2a-reference-ts conformity)#19

Merged
reaatech merged 10 commits intomainfrom
dev
Apr 30, 2026
Merged

refactor: migrate to 15-package pnpm monorepo (a2a-reference-ts conformity)#19
reaatech merged 10 commits intomainfrom
dev

Conversation

@reaatech
Copy link
Copy Markdown
Owner

Summary

This is a complete architectural refactor from a single monolithic npm package to a 15-package pnpm monorepo, conforming to the same patterns established by a2a-reference-ts.

Changes

Monorepo scaffolding

  • pnpm-workspace.yaml, turbo.json, biome.json — root toolchain
  • tsconfig.typecheck.json — path aliases for cross-package typecheck without building
  • .changeset/config.json — changesets-based versioning
  • .npmrcshamefully-hoist=false, strict-peer-dependencies=true

15 packages (packages/*/)

Package Scope name Purpose
core/ @reaatech/agent-runbook Types, schemas, utilities, errors
analyzer/ @reaatech/agent-runbook-analyzer Repository scanning and code analysis
alerts/ @reaatech/agent-runbook-alerts Alert extraction and generation
dashboards/ @reaatech/agent-runbook-dashboards Dashboard configuration generation
failure-modes/ @reaatech/agent-runbook-failure-modes Failure mode analysis
health-checks/ @reaatech/agent-runbook-health-checks Health check generation
incident/ @reaatech/agent-runbook-incident Incident response workflows
rollback/ @reaatech/agent-runbook-rollback Rollback procedure generation
runbook/ @reaatech/agent-runbook-runbook Runbook assembly and pipeline
service-map/ @reaatech/agent-runbook-service-map Service dependency mapping
agent/ @reaatech/agent-runbook-agent LLM provider abstraction
mcp/ @reaatech/agent-runbook-mcp MCP server (16 tools, 3 layers)
observability/ @reaatech/agent-runbook-observability Logging, tracing, metrics
cli/ @reaatech/agent-runbook-cli CLI commands and orchestrator
e2e/ @reaatech/agent-runbook-e2e (private) Integration tests

Each package includes: dual ESM/CJS output (tsup), co-located tests (vitest), comprehensive README with API reference, LICENSE.

Toolchain migration

Before After
npm pnpm@10
tsc tsup
ESLint + Prettier biome
No orchestrator turbo
No versioning changesets
husky + lint-staged Removed

CI/CD

  • Updated ci.yml for pnpm + turbo build pipeline
  • Rewrote release.yml for changesets/action with GitHub Packages mirror
  • Updated Dockerfile for multi-stage pnpm + turbo build

Documentation

  • Rewrote AGENTS.md with monorepo structure and package dependency graph
  • Rewrote ARCHITECTURE.md with package-level diagrams and updated data flow
  • Rewrote root README.md with per-package install commands and package table
  • Added ## Package section to all 9 skill definitions

Verification

  • pnpm typecheck — passes clean
  • pnpm build — all 15/15 packages build

Add pnpm workspace, turbo build pipeline, biome lint/format config,
changesets versioning, tsconfig.typecheck.json with path aliases.
Migrate package.json to private root orchestrator with pnpm@10.
Delete single-package source layout, legacy ESLint/Prettier/Husky configs,
and npm lockfile. All code has been migrated to packages/*.
Create 14 publishable packages + 1 private e2e package:
- @reaatech/agent-runbook (core: types, schemas, utils, errors)
- @reaatech/agent-runbook-analyzer (repository scanning, code analysis)
- @reaatech/agent-runbook-alerts (alert extraction, generation, thresholds)
- @reaatech/agent-runbook-dashboards (dashboard config generation)
- @reaatech/agent-runbook-failure-modes (failure identification, mitigation)
- @reaatech/agent-runbook-health-checks (health check generation, K8s probes)
- @reaatech/agent-runbook-incident (incident workflows, communication templates)
- @reaatech/agent-runbook-rollback (rollback procedures, verification)
- @reaatech/agent-runbook-runbook (assembly, formatting, pipeline)
- @reaatech/agent-runbook-service-map (dependency graphs, export)
- @reaatech/agent-runbook-agent (LLM provider abstraction, prompt templates)
- @reaatech/agent-runbook-mcp (MCP server, 16 tools across 3 layers)
- @reaatech/agent-runbook-observability (logging, tracing, metrics)
- @reaatech/agent-runbook-cli (CLI commands, orchestrator, facade barrel)
- @reaatech/agent-runbook-e2e (private integration tests)

Each package has dual ESM/CJS output via tsup, co-located tests
with vitest, and comprehensive README.md with API reference.
Replace npm-based CI with pnpm/turbo build pipeline.
Add changesets release workflow with GitHub Packages mirror.
Update Dockerfile to use pnpm + turbo multi-stage build.
Rewrite AGENTS.md with monorepo structure, package dependency graph,
updated CI workflow, and development commands.
Rewrite ARCHITECTURE.md with package-level diagrams, updated data flow,
observability metrics, and deployment architecture.
Rewrite root README.md with per-package install commands and feature lists.
Add ## Package section to all 9 skill definitions referencing
their implementing @reaatech/agent-runbook-* packages.
Combine separate vi.mock calls for @reaatech/agent-runbook-analyzer,
@reaatech/agent-runbook-runbook, and @reaatech/agent-runbook-observability
into single mock blocks to prevent overwrites.
Update packages/e2e/src/cli.test.ts to locate the built CLI binary at
packages/cli/dist/cli.js instead of the old monolithic dist/cli.js.
Turbo runs tests from the package directory, not the monorepo root.
Use import.meta.url instead of process.cwd() to locate the CLI binary
reliably regardless of working directory.
@reaatech reaatech merged commit 28d53f5 into main Apr 30, 2026
4 checks passed
@reaatech reaatech deleted the dev branch April 30, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant