Skip to content

feat: support composed CLI render registries - #671

Merged
alongubkin merged 1 commit into
mainfrom
alon/alien-888-cli-render-extensions
Sep 18, 2026
Merged

alongubkin merged 1 commit into
mainfrom
alon/alien-888-cli-render-extensions

Conversation

@alongubkin

Copy link
Copy Markdown
Member

Background

The official Alien developer CLI is composed in the Platform repository so it can include Platform-owned cloud controllers. Terraform and CloudFormation have the same OSS/private split: OSS owns the generator and registry, while Platform owns additional emitters in alien-terraformx and alien-cloudformationx.

The registries are already intentionally extensible, but alien render always constructed built_in() internally. A composed binary therefore could register runtime controllers but could not make its Platform emitters visible to the shared render command.

Root cause

render_cloudformation and render_terraform created their registries inside private command functions with no composition hook. The only alternatives were duplicating the render command in Platform or moving Platform emitters into OSS; neither matches the existing ownership boundary.

Change

Add one process-startup registration hook per generator:

alien_cli::commands::render::register_terraform_registry_extension(...);
alien_cli::commands::render::register_cloudformation_registry_extension(...);

Each render invocation starts with the normal OSS built_in() registry and then applies the registered extension. The ordinary OSS alien binary registers nothing and behaves exactly as before. Duplicate registration fails immediately, matching the existing controller-extension contract.

End-to-end use

The Platform alien-clix composition root will register:

  • alien_terraformx::register_platform_extensions
  • alien_cloudformationx::register_platform_extensions

before delegating to the shared alien_cli::run_cli. Commands, parsing, output, and generators remain implemented in OSS Alien.

Verification

  • cargo fmt -p alien-cli
  • Platform integration compiles the real extension functions against these callback types and exercises generated Terraform/CloudFormation artifacts in the dependent composition PR.

@alongubkin
alongubkin merged commit 13e75bf into main Sep 18, 2026
20 of 21 checks passed
@alongubkin
alongubkin deleted the alon/alien-888-cli-render-extensions branch September 18, 2026 05:30
@greptile-apps

greptile-apps Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking need for regression coverage around the new public registry-composition hooks.

Fix All in CodexFindings

  1. P2 Registry composition lacks tests ▶
Fix with agent prompt
### Issue 1
crates/alien-cli/src/commands/render.rs:24-28
The new process-global hooks are not covered by a test that registers an extension and confirms a fresh registry contains both built-in and extension emitters. The only existing render unit test covers Azure preflight mutation, so incorrect callback wiring, skipped callbacks, or lost built-ins could reach downstream composed CLIs without being caught here. Please add isolated integration coverage for both generator hooks; using a separate test binary would avoid leaking the `OnceLock` state into other tests.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds process-startup hooks allowing composed Alien CLI binaries to extend the Terraform and CloudFormation emitter registries while preserving the normal built-in emitters.

  • Stores one extension function per generator in a process-global OnceLock.
  • Applies each registered extension to a fresh built-in registry for every render invocation.
  • Leaves the ordinary OSS CLI behavior unchanged when no extension is registered.
  • The implementation is straightforward, but the new public composition contract lacks repository-level regression coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Composed CLI startup] --> B[Register Terraform extension]
    A --> C[Register CloudFormation extension]
    D[alien render] --> E{Requested format}
    E -->|Terraform| F[Create built-in TfRegistry]
    E -->|CloudFormation| G[Create built-in CfRegistry]
    B --> F
    C --> G
    F --> H[Apply extension]
    G --> I[Apply extension]
    H --> J[Generate Terraform module]
    I --> K[Generate CloudFormation template]
Loading

Reviews (1) · Last reviewed commit: "feat: support composed render registries"

Comment on lines +24 to +28
pub fn register_cloudformation_registry_extension(extension: CloudFormationRegistryExtension) {
CLOUDFORMATION_REGISTRY_EXTENSION
.set(extension)
.expect("CloudFormation registry extension already registered");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Registry composition lacks tests

The new process-global hooks are not covered by a test that registers an extension and confirms a fresh registry contains both built-in and extension emitters. The only existing render unit test covers Azure preflight mutation, so incorrect callback wiring, skipped callbacks, or lost built-ins could reach downstream composed CLIs without being caught here. Please add isolated integration coverage for both generator hooks; using a separate test binary would avoid leaking the OnceLock state into other tests.

Knowledge Base Used: Deployment and packaging

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/alien-cli/src/commands/render.rs
Line: 24-28

Comment:
**Registry composition lacks tests**

The new process-global hooks are not covered by a test that registers an extension and confirms a fresh registry contains both built-in and extension emitters. The only existing render unit test covers Azure preflight mutation, so incorrect callback wiring, skipped callbacks, or lost built-ins could reach downstream composed CLIs without being caught here. Please add isolated integration coverage for both generator hooks; using a separate test binary would avoid leaking the `OnceLock` state into other tests.

**Knowledge Base Used:** [Deployment and packaging](https://app.greptile.com/alien/-/custom-context/knowledge-base/alienplatform/alien/-/docs/deployment-and-packaging.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex

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