Skip to content

Migrating to monorepo#372

Merged
artemdemo merged 3 commits intomainfrom
migrating-to-monorepo
Mar 9, 2026
Merged

Migrating to monorepo#372
artemdemo merged 3 commits intomainfrom
migrating-to-monorepo

Conversation

@artemdemo
Copy link
Contributor

@artemdemo artemdemo commented Mar 8, 2026

Note

Description

This PR migrates the Base44 CLI repository from a flat structure to a Bun monorepo by moving all source code, tests, build tooling, templates, and configuration into a packages/cli/ workspace. The root package.json becomes a minimal monorepo manifest with Bun workspaces, while the actual CLI package lives under packages/cli/. No functional changes are made to the CLI itself — this is a pure structural reorganization to support future packages in the repo.

Related Issue

None

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Moved all CLI source (src/), tests (tests/), bin (bin/), infra (infra/), templates (templates/), and config files from the repo root into packages/cli/
  • Converted root package.json into a Bun workspaces monorepo manifest with only knip as a root-level dev dependency
  • Added packages/cli/package.json with all dev dependencies, scripts, bin entry, and npm publishing metadata
  • Updated knip.json to use workspace-scoped configuration pointing to packages/cli
  • Updated all GitHub Actions workflows (lint, test, typecheck, preview-publish, manual-publish, readme-check, daily-error-report) to set working-directory: packages/cli as the job default, with root-level steps (e.g., bun install, npm install -g npm@latest) explicitly overriding to working-directory: .
  • Updated manual-publish.yml to add a CLI_PACKAGE_DIR env variable and fix all paths for versioning, build, binary upload, and git staging steps
  • Updated all documentation in docs/ (AGENTS.md, api-patterns.md, error-handling.md, resources.md) to reflect the new packages/cli/src/ path prefix
  • Updated daily-error-report.yml prompt templates to reference packages/cli/src/ path format in stack traces and code snippets

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The packages/cli workspace preserves the base44 npm package name and version, so the published npm package identity is unchanged. Workflow steps that must run from the repo root (e.g., bun install --frozen-lockfile, npm install -g npm@latest) explicitly override the default working directory with working-directory: . to avoid running inside the package subdirectory.


🤖 Generated by Claude | 2026-03-09 08:30 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.40-pr.372.5388035

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.40-pr.372.5388035"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.40-pr.372.5388035"
  }
}

Preview published to npm registry — try new features instantly!

@artemdemo artemdemo marked this pull request as ready for review March 8, 2026 08:32
@artemdemo artemdemo force-pushed the migrating-to-monorepo branch 3 times, most recently from 4e9ec88 to 24e4f92 Compare March 8, 2026 13:27
@base44 base44 deleted a comment from claude bot Mar 8, 2026
@artemdemo artemdemo force-pushed the migrating-to-monorepo branch from 24e4f92 to 2a31fa8 Compare March 8, 2026 14:03
@base44 base44 deleted a comment from claude bot Mar 8, 2026
@artemdemo
Copy link
Contributor Author

@claude review

@claude
Copy link

claude bot commented Mar 8, 2026

Claude finished @artemdemo's task in 1m 55s —— View job


PR Review: Migrating to Monorepo

  • Gather context and read key files
  • Review package.json changes (root + packages/cli)
  • Review CI/CD workflow changes
  • Review knip.json and configuration
  • Review docs updates
  • Post final review

Overall this is a clean, well-executed structural migration with no functional changes to the CLI itself. The approach is sound. A few issues are worth addressing before merging.

Issues

1. Root package.json is missing "private": true — Medium severity

package.json:1-17 — The workspace root has no "private": true field. Without it, an accidental npm publish from the repo root would publish a dummy base44-cli@1.0.0 package to the registry. This is a standard safety guard for monorepo roots.

{
  "name": "base44-cli",
  "private": true,   // ← add this
  "version": "1.0.0",
  ...
}

Fix this →


2. manual-publish.ymlbun install step lacks an explicit working-directory override — Low severity

.github/workflows/manual-publish.yml:76-77 — Unlike lint.yml, test.yml, and typecheck.yml, the manual-publish.yml workflow does NOT use defaults.run.working-directory. This means bun install --frozen-lockfile runs from the repo root implicitly, which happens to be correct. But it's inconsistency that makes the intent unclear. Adding an explicit comment or a working-directory: . annotation (as done in preview-publish.yml line 44) would make it self-documenting.


3. daily-error-report.ymlclaude_args format inconsistency — Low severity

.github/workflows/daily-error-report.yml:271 uses --allowed-tools (kebab-case) while .github/workflows/manual-publish.yml:186-188 uses --allowedTools (camelCase). Both likely work, but it's worth normalizing to one style across all workflow files.


Observations (Non-blocking)

Biome version bump: packages/cli/package.json:37 bumps @biomejs/biome from ^2.0.0 to ^2.4.6. This is an improvement but is a functional change bundled into a "no functional changes" refactor. Worth calling out explicitly in the PR description — which it is in the body already. No action needed.

knip.json workspace-only config: The new knip.json defines only packages/cli as a workspace, with no root "." entry. Since the root has only knip as a devDependency and no source files, knip won't complain about the root package. This is correct.

readme-check.yml hardcoded paths: The Claude prompt on lines 48-64 references packages/cli/src/cli/program.ts and packages/cli/package.json as hardcoded strings. If the monorepo structure changes again, this needs manual updating. Not an issue now, but something to keep in mind.

preview-publish.yml: The npm install -g npm@latest step correctly uses working-directory: . override (line 26-27) since the job's default is packages/cli. Same for bun install (line 43-44). Pattern is correct and intentional.

manual-publish.yml git add path: Line 232 (git add ${{ env.CLI_PACKAGE_DIR }}/package.json) correctly stages packages/cli/package.json from the root. The CLI_PACKAGE_DIR env var is used consistently throughout — good pattern for maintainability.

Templates directory: packages/cli/templates/ is present (confirmed in the working tree), and the build script cp -r templates dist/ in packages/cli/package.json:14 is still relative to packages/cli/ — so this works correctly.

Summary

The migration is structurally sound. The one change worth making before merge is adding "private": true to the root package.json to prevent accidental publishing. The other findings are low-severity style/clarity improvements.

@artemdemo artemdemo requested a review from kfirstri March 8, 2026 14:32
@artemdemo artemdemo force-pushed the migrating-to-monorepo branch from 2a31fa8 to d4878e3 Compare March 9, 2026 07:49
kfirstri
kfirstri previously approved these changes Mar 9, 2026
@base44 base44 deleted a comment from claude bot Mar 9, 2026
@artemdemo artemdemo force-pushed the migrating-to-monorepo branch from bea2d65 to 33349c5 Compare March 9, 2026 08:13
@base44 base44 deleted a comment from claude bot Mar 9, 2026
@artemdemo
Copy link
Contributor Author

@claude review

@claude
Copy link

claude bot commented Mar 9, 2026

Claude finished @artemdemo's task in 2m 45s —— View job


PR Review: Migrating to Monorepo

  • Gather context and read key files
  • Review root package.json and packages/cli/package.json
  • Review CI/CD workflow changes
  • Review knip.json and configuration
  • Review build scripts and infra changes
  • Post final review

This is a clean, well-scoped structural migration. The CI/CD and build patterns are consistently applied. A couple of issues remain open.

Issues

1. Root package.json missing "private": true — Medium severity

package.json:1-17 — Still not addressed from the previous review. Without "private": true, an accidental npm publish from the repo root would push a base44-cli@1.0.0 package to the registry. This is the standard safety guard for any monorepo root.

{
  "name": "base44-cli",
  "private": true,   // ← add this
  "version": "1.0.0",
  ...
}

Fix this →


2. --allowed-tools vs --allowedTools inconsistency — Low severity

.github/workflows/daily-error-report.yml:271 uses --allowed-tools (kebab-case), while .github/workflows/readme-check.yml:64 and .github/workflows/claude.yml:48 use --allowedTools (camelCase). Both forms appear to work, but daily-error-report.yml was modified in this PR and is inconsistent with the rest. Worth normalizing.


3. knip.json excludes infra/**/*.ts from the project glob — Low severity

knip.json:7 — The project glob is ["src/**/*.ts", "tests/**/*.ts"]. The infra/ build scripts (build.ts, build-binaries.ts, package-binaries.ts) all use chalk, but since infra/ is outside the project glob, knip won't find those usages. This means chalk could be flagged as an unused dependency by bun run knip. Note this was also the case in the original flat-repo knip.json, so this isn't a regression introduced by this PR — but the migration is a good opportunity to fix it. Consider either adding "infra/**/*.ts" to the project array, or adding "chalk" to ignoreDependencies.

Fix this →


Observations (Non-blocking)

tsconfig.json excludes infra/: packages/cli/tsconfig.json:10 only includes src/**/* and tests/**/*, so infra/*.ts build scripts are not type-checked by bun run typecheck. This is consistent with the pre-migration state and is a deliberate trade-off for build scripts. Not an issue.

manual-publish.ymlbun install has no explicit working-directory: Line 77 runs bun install --frozen-lockfile with no working-directory override. Since manual-publish.yml has no defaults.run.working-directory (unlike lint.yml / test.yml), it runs from the repo root by default — which is exactly correct for a monorepo bun install. The behavior is right; the intent could be documented with an inline comment, but it's not broken.

Previous review's Biome version bump observation: The prior Claude review noted a bump from ^2.0.0 to ^2.4.6. Looking at the actual packages/cli/package.json:40, Biome remains at ^2.0.0. The observation was incorrect — no version bump occurred.

CLAUDE.md stale comment: CLAUDE.md:44 says bun run build bundles to dist/index.js, but infra/build.ts actually outputs to dist/cli/. This is a pre-existing inaccuracy unrelated to this PR, but worth a follow-up doc fix.

Summary

The migration is structurally sound and CI patterns are applied consistently. The one change worth making before merge is adding "private": true to the root package.json. The knip gap and --allowed-tools inconsistency are low-priority cleanups.

@artemdemo artemdemo merged commit 01a8f17 into main Mar 9, 2026
10 checks passed
@artemdemo artemdemo deleted the migrating-to-monorepo branch March 9, 2026 08:41
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.

2 participants