Skip to content

Conversation

@endersonmaia
Copy link
Contributor

@endersonmaia endersonmaia commented Dec 15, 2025

This pull request refactors the Docker Compose configuration for the CLI app by removing all static YAML Compose files and replacing them with TypeScript modules that define service and proxy configurations programmatically. Additionally, it consolidates environment variable management into TypeScript, updates dependencies, and simplifies the build process.

The most important changes are:

Compose Configuration Refactor:

  • Removed all static Docker Compose YAML files (docker-compose-*.yaml and default.env) and replaced them with TypeScript modules (anvil.ts, bundler.ts, database.ts, common.ts) that export service and proxy configuration objects. This enables dynamic and maintainable Compose generation. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

  • Moved all environment variable definitions and default values from .env files into the new common.ts TypeScript module for centralized configuration management. [1] [2]

Dependency and Build Script Updates:

  • Added the yaml npm package as a new dependency to support YAML generation in TypeScript; removed the unused copyfiles dependency and related build script since static YAML files are no longer copied. [1] [2] [3]

These changes significantly improve the maintainability and flexibility of the CLI's Compose configuration by making it programmatic and easier to extend or modify in the future.

@changeset-bot
Copy link

changeset-bot bot commented Dec 15, 2025

🦋 Changeset detected

Latest commit: d93b34e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tuler tuler changed the base branch from main to prerelease/v2-alpha December 15, 2025 20:59
@socket-security
Copy link

socket-security bot commented Dec 15, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedyaml@​2.8.210010010085100

View full report

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

Coverage Report for ./apps/cli

Status Category Percentage Covered / Total
🔵 Lines 18.78% 279 / 1485
🔵 Statements 18.75% 284 / 1514
🔵 Functions 19.76% 50 / 253
🔵 Branches 13.62% 112 / 822
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/cli/src/commands/logs.ts 0% 0% 0% 0% 5-48
apps/cli/src/commands/status.ts 0% 0% 0% 0% 7-57
apps/cli/src/compose/anvil.ts 0% 0% 0% 0% 10-63
apps/cli/src/compose/builder.ts 0% 0% 0% 0% 25-653
apps/cli/src/compose/bundler.ts 0% 0% 0% 0% 8-94
apps/cli/src/compose/common.ts 0% 100% 100% 0% 3-9
apps/cli/src/compose/database.ts 0% 0% 0% 0% 10-28
apps/cli/src/compose/explorer.ts 0% 0% 0% 0% 14-158
apps/cli/src/compose/node.ts 0% 0% 0% 0% 22-118
apps/cli/src/compose/passkey.ts 0% 0% 0% 0% 9-61
apps/cli/src/compose/paymaster.ts 0% 0% 0% 0% 8-63
apps/cli/src/compose/proxy.ts 0% 0% 0% 0% 9-38
apps/cli/src/exec/rollups.ts 0% 0% 0% 0% 51-547
Generated in workflow #727 for commit d93b34e by the Vitest Coverage Report Action

@endersonmaia endersonmaia force-pushed the feature/ts-compose-builder branch 2 times, most recently from bd75d24 to 68d9896 Compare December 16, 2025 17:59
@tuler tuler changed the title feature/ts compose builder typescript compose builder Dec 16, 2025
@endersonmaia endersonmaia force-pushed the feature/ts-compose-builder branch 2 times, most recently from 90656d3 to 062e3bd Compare December 18, 2025 18:12
@endersonmaia endersonmaia requested a review from tuler December 18, 2025 18:14
@endersonmaia endersonmaia self-assigned this Dec 18, 2025
@endersonmaia endersonmaia requested a review from Copilot December 18, 2025 18:14
@endersonmaia endersonmaia marked this pull request as ready for review December 18, 2025 18:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request successfully refactors the Docker Compose configuration for the CLI app by migrating from static YAML files to a programmatic TypeScript-based approach using a builder pattern. This significantly improves maintainability and flexibility.

Key Changes:

  • Replaced all static Docker Compose YAML files with TypeScript modules that export service and proxy configuration objects
  • Implemented a ComposeBuilder class with fluent API for constructing Compose configurations programmatically
  • Consolidated environment variable management from .env files into TypeScript constants
  • Added the yaml npm package for YAML generation and removed the unused copyfiles dependency

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
apps/cli/src/types/compose.ts New comprehensive TypeScript type definitions for Docker Compose specification
apps/cli/src/compose/builder.ts New builder class implementing fluent API for creating Compose configurations
apps/cli/src/compose/anvil.ts Anvil service and proxy configuration in TypeScript
apps/cli/src/compose/bundler.ts Bundler service and proxy configuration in TypeScript
apps/cli/src/compose/database.ts Database service configuration in TypeScript
apps/cli/src/compose/common.ts Shared constants for environment variables and health checks
apps/cli/src/compose/explorer.ts Explorer, Explorer API, and Squid Processor service configurations
apps/cli/src/compose/passkey.ts Passkey server service and proxy configuration
apps/cli/src/compose/paymaster.ts Paymaster service and proxy configuration
apps/cli/src/compose/proxy.ts Traefik proxy service configuration
apps/cli/src/compose/rollupsNode.ts Rollups Node service and proxy configuration
apps/cli/src/exec/rollups.ts Updated to use ComposeBuilder instead of static YAML files
apps/cli/tests/unit/compose.test.ts Comprehensive test suite for ComposeBuilder functionality
apps/cli/package.json Added yaml dependency, removed copyfiles, updated build scripts
pnpm-lock.yaml Updated dependency lock file reflecting package changes
Various docker-compose-*.yaml files Deleted static YAML files replaced by TypeScript modules
apps/cli/src/compose/default.env Deleted environment file, moved to TypeScript
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 301 to +309
// pull images first
const pullArgs = ["--policy", "missing"];
await execa("docker", [...composeArgs, "pull", ...pullArgs], {
env,
stdio: "inherit",
});
// const pullArgs = ["--policy", "missing"];
// await execa("docker", [...composeArgs, "pull", ...pullArgs], {
// env,
////FIXME: stdio and input won't work together
// stdio: "inherit",
// input: composeFile.build()
// });
Copy link

Copilot AI Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out code for pulling Docker images should either be removed or properly implemented. Leaving it commented with a FIXME indicates unfinished work. Either remove this commented block entirely or create a proper TODO comment explaining the issue and when it should be addressed.

Copilot uses AI. Check for mistakes.
@endersonmaia endersonmaia force-pushed the feature/ts-compose-builder branch 2 times, most recently from c94d9e2 to e7cda47 Compare December 18, 2025 18:41
@endersonmaia endersonmaia requested a review from Copilot December 18, 2025 18:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 12 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tuler
Copy link
Member

tuler commented Jan 5, 2026

What is the state of this? Do you want to retry and go easier on AI, or go from here?

@endersonmaia
Copy link
Contributor Author

What is the state of this? Do you want to retry and go easier on AI, or go from here?

I still need to solve all those Copilot reviews.

But I'd go from here, anyway.

@endersonmaia endersonmaia force-pushed the feature/ts-compose-builder branch 2 times, most recently from 8a5a745 to 806868a Compare January 6, 2026 17:03
@endersonmaia endersonmaia force-pushed the feature/ts-compose-builder branch from 1592e02 to c4f3247 Compare January 6, 2026 19:56
@tuler
Copy link
Member

tuler commented Jan 7, 2026

This needs a rebase. Be careful that the explorer image versions changed.

@tuler tuler force-pushed the feature/ts-compose-builder branch from c4f3247 to d9d5f4e Compare January 7, 2026 21:46
@tuler
Copy link
Member

tuler commented Jan 7, 2026

Rebase done.

@tuler tuler force-pushed the feature/ts-compose-builder branch from b427cf8 to d93b34e Compare January 8, 2026 23:23
@endersonmaia endersonmaia merged commit e80638c into prerelease/v2-alpha Jan 9, 2026
4 checks passed
@endersonmaia endersonmaia deleted the feature/ts-compose-builder branch January 9, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants