Skip to content

chore: Separate CLI entrypoints by binary role#1425

Merged
hatayama merged 2 commits into
v3-betafrom
refactor/split-cli-entrypoint-packages
Jun 28, 2026
Merged

chore: Separate CLI entrypoints by binary role#1425
hatayama merged 2 commits into
v3-betafrom
refactor/split-cli-entrypoint-packages

Conversation

@hatayama

@hatayama hatayama commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Keep the existing uloop and uloop-cli behavior unchanged while separating their command entrypoints by binary role.
  • Make it easier to keep dispatcher-only and project-local CLI capabilities separated in future updates.

User Impact

  • There is no user-facing command behavior change in this PR.
  • This creates a clearer foundation for future CLI-only functionality without requiring unrelated Unity package changes.

Changes

  • Route the dispatcher binary through its own entrypoint package.
  • Route the project-local CLI binary through its own entrypoint package.
  • Update architecture tests so each command depends only on the expected entrypoint package.
  • Leave Unity package files and generated skill copies unchanged.

Verification

  • scripts/check-go-cli.sh
  • go run ./cmd/uloop --version
  • go run ./cmd/uloop-cli --version

Add binary-owner entrypoint packages so dispatcher-only behavior and project-local CLI behavior can evolve independently without changing command behavior.

- Route cmd/uloop through internal/dispatcher.
- Route cmd/uloop-cli through internal/projectcli.
- Update architecture tests to enforce the new entrypoint boundaries.
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c8e393f3-215a-44c3-8d2c-c1eb3a28408c

📥 Commits

Reviewing files that changed from the base of the PR and between b413dea and 33b9eee.

📒 Files selected for processing (1)
  • cli/dispatcher-contract.json

📝 Walkthrough

Walkthrough

Two new wrapper packages are added for dispatcher and project CLI entrypoints, the cmd mains switch to those wrappers, the dispatcher contract version changes, and architecture tests are updated for the new package boundaries.

Changes

Entrypoint Package Split

Layer / File(s) Summary
New dispatcher and projectcli wrapper packages
cli/internal/dispatcher/dispatcher.go, cli/internal/projectcli/projectcli.go, cli/dispatcher-contract.json
Adds two new packages each with an exported Run function that forwards to cli.RunDispatcher and cli.RunProjectLocal, and bumps dispatcherVersion from 3.0.1-beta.4 to 3.0.1-beta.5.
Update cmd entrypoints to use new packages
cli/cmd/uloop/main.go, cli/cmd/uloop-cli/main.go
Switches imports from cli/internal/cli to the new wrapper packages and updates call sites from cli.RunDispatcher/cli.RunProjectLocal to dispatcher.Run/projectcli.Run.
Architecture test boundary enforcement
cli/internal/architecture/architecture_test.go
Expands import-path guards and allowlist to cover the new packages; refactors the command dependency test into two entrypoint-specific tests using a shared assertCommandOnlyDependsOnInternalEntrypoint helper.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • hatayama/unity-cli-loop#1419: Changes in cli/internal/cli dispatcher resolution behavior are exercised through the new dispatcher.Run wrapper.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: splitting CLI entrypoints by binary role.
Description check ✅ Passed The description clearly matches the changeset and explains the entrypoint split and test updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/split-cli-entrypoint-packages

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hatayama hatayama changed the title chore: CLIごとの入口を用途別に整理 chore: Separate CLI entrypoints by binary role Jun 28, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli/internal/architecture/architecture_test.go (1)

49-57: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Block feature packages from importing the new entrypoint wrappers.

Line 56 still only rejects .../internal/cli, so feature packages can now import .../internal/dispatcher or .../internal/projectcli without tripping this test. That means the new boundary added in this PR is not actually enforced.

Suggested fix
 		for _, importedPath := range goPackage.Imports {
-			if strings.HasPrefix(importedPath, cliModulePath+"/internal/cli") {
+			if strings.HasPrefix(importedPath, cliModulePath+"/internal/cli") ||
+				strings.HasPrefix(importedPath, cliModulePath+"/internal/dispatcher") ||
+				strings.HasPrefix(importedPath, cliModulePath+"/internal/projectcli") {
 				t.Fatalf("feature package %s must not import CLI package %s", goPackage.ImportPath, importedPath)
 			}
 		}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/internal/architecture/architecture_test.go` around lines 49 - 57, The
architecture test currently only blocks imports of the old CLI package, so it
misses feature packages importing the new entrypoint wrappers. Update the import
check in architecture_test.go around the goPackage.Imports loop to reject the
dispatcher and projectcli packages as well, using the same cliModulePath-based
prefix matching already used for the existing CLI boundary. Keep the existing
package-skip logic, but expand the forbidden import condition so feature
packages cannot depend on internal/cli, internal/dispatcher, or
internal/projectcli.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@cli/internal/architecture/architecture_test.go`:
- Around line 49-57: The architecture test currently only blocks imports of the
old CLI package, so it misses feature packages importing the new entrypoint
wrappers. Update the import check in architecture_test.go around the
goPackage.Imports loop to reject the dispatcher and projectcli packages as well,
using the same cliModulePath-based prefix matching already used for the existing
CLI boundary. Keep the existing package-skip logic, but expand the forbidden
import condition so feature packages cannot depend on internal/cli,
internal/dispatcher, or internal/projectcli.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c559411b-3164-4b3a-b3d1-ddd4bb2aa309

📥 Commits

Reviewing files that changed from the base of the PR and between 5ce43fa and b413dea.

📒 Files selected for processing (5)
  • cli/cmd/uloop-cli/main.go
  • cli/cmd/uloop/main.go
  • cli/internal/architecture/architecture_test.go
  • cli/internal/dispatcher/dispatcher.go
  • cli/internal/projectcli/projectcli.go

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

The dispatcher command entrypoint changed in this PR, so the dispatcher release contract must advertise a newer dispatcherVersion for the CI release-input guard.
@hatayama hatayama merged commit 87befc6 into v3-beta Jun 28, 2026
10 checks passed
@hatayama hatayama deleted the refactor/split-cli-entrypoint-packages branch June 28, 2026 14:05
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