Skip to content

feat: expose CloudFormation stacks to automation - #367

Open
YoungJinJung wants to merge 2 commits into
mainfrom
feature/issue-360-cloudformation-agent-surface
Open

YoungJinJung wants to merge 2 commits into
mainfrom
feature/issue-360-cloudformation-agent-surface

Conversation

@YoungJinJung

@YoungJinJung YoungJinJung commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a read-only cloudformation-stacks JSON query that preserves failure-first stack ordering
  • return status reasons, drift state, parameters, outputs, and normalized UTC timestamps without implying event-detail lookups
  • expose the same v1 contract through list_cloudformation_stacks and document discovery and permissions

Related Issues

Related to #360

Validation

  • go test ./internal/cli ./internal/mcp ./internal/services/aws
  • make test
  • make build
  • unic schema resources cloudformation-stacks --json
  • git diff --check

Checklist

  • Scope is focused
  • Branch name follows docs/branch-naming-harness.md
  • Documentation harness reviewed (docs/documentation-harness.md)
  • README updated if user-facing behavior changed
  • Relevant docs/ pages updated if architecture, auth, config, or workflow changed
  • Tests/validation included
  • Breaking changes documented (none)

Summary by CodeRabbit

  • New Features

    • Added CloudFormation stack discovery through the CLI and MCP server.
    • Stack results include status, status reasons, drift state, parameters, outputs, regions, and timestamps.
    • Stacks are presented in failure-first triage order with paginated output.
    • Added support for optional AWS profile and region selection.
  • Documentation

    • Added usage guidance, permissions, and example prompts for inspecting failed or rolling-back stacks.

- add a stable failure-first CloudFormation stack JSON query\n- expose the contract through MCP with discovery metadata\n- document usage and cover CLI and MCP wiring
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 48 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 12270aec-a4ad-4147-9e3c-c8eb0ef8e486

📥 Commits

Reviewing files that changed from the base of the PR and between cd35eca and 2ed37ff.

📒 Files selected for processing (3)
  • README.md
  • internal/mcp/server.go
  • internal/mcp/server_test.go

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0147e827-568d-4ddd-a5d1-c489ab1ca854

📥 Commits

Reviewing files that changed from the base of the PR and between 141d12e and cd35eca.

📒 Files selected for processing (9)
  • README.md
  • docs/development.md
  • internal/cli/resources.go
  • internal/cli/resources_operations.go
  • internal/cli/resources_operations_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server.go
  • internal/mcp/server_test.go
  • skills/unic-aws/SKILL.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (7)
Check that tests cover API errors, mapping edge cases, and navigation state transitions, not only happy paths.

⚙️ CodeRabbit configuration file

Files:

  • internal/mcp/server_test.go
  • internal/mcp/agent_surface_test.go
  • internal/cli/resources_operations_test.go
Verify that README changes match actual CLI/TUI behavior and that Currently Implemented Features, TUI Key Bindings, Usage, and Configuration content stay aligned with code changes.

⚙️ CodeRabbit configuration file

Files:

  • README.md
Documentation must match implemented behavior.

⚙️ CodeRabbit configuration file

Files:

  • docs/development.md
For Go reviews, look beyond compilation and prioritize nil pointer risks, context propagation, AWS SDK pagination, error wrapping, deterministic sorting, and stable table/detail rendering.

⚙️ CodeRabbit configuration file

Files:

  • internal/mcp/server_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server.go
  • internal/cli/resources_operations.go
  • internal/cli/resources_operations_test.go
  • internal/cli/resources.go
Tests use mock client interfaces (see `rds_test.go` pattern) in Go test files

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • internal/mcp/server_test.go
  • internal/mcp/agent_surface_test.go
  • internal/cli/resources_operations_test.go
When adding, modifying, or deleting features, always update `README.md` in parallel with code changes Update `Currently Implemented Features` table in README.md: add new services/features, update status changes (🚧→✅), remove deleted items...

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • README.md
Use lipgloss for styled TUI output — column-aligned tables with dimmed labels in Go implementation files Implement scroll windowing with formula: `visibleLines := max(m.height-N, 5)` in Go TUI implementation

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • internal/mcp/server_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server.go
  • internal/cli/resources_operations.go
  • internal/cli/resources_operations_test.go
  • internal/cli/resources.go
🪛 LanguageTool
skills/unic-aws/SKILL.md

[style] ~13-~13: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...sing an automation command contract. 4. Call a discovered read-only resource tool wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (4)
internal/mcp/server.go (1)

123-128: LGTM!

Also applies to: 414-414, 422-422

internal/mcp/server_test.go (1)

58-58: LGTM!

internal/mcp/agent_surface_test.go (1)

25-32: LGTM!

Also applies to: 39-39

README.md (1)

163-163: LGTM!

Also applies to: 171-171, 253-253, 257-257


Walkthrough

The CLI now lists CloudFormation stacks as JSON. The MCP server exposes this listing through list_cloudformation_stacks. Tests validate serialization, pagination, errors, and argument handling. Documentation describes the command, permissions, and usage.

Changes

CloudFormation stack discovery

Layer / File(s) Summary
CLI stack listing and contract
internal/cli/resources.go, internal/cli/resources_operations.go, internal/cli/resources_operations_test.go, docs/development.md
Adds CloudFormation stack JSON models, value and timestamp conversion, repository loading, command registration, pagination, failure-first ordering, and contract tests.
MCP tool integration and usage guidance
internal/mcp/server.go, internal/mcp/server_test.go, internal/mcp/agent_surface_test.go, README.md, skills/unic-aws/SKILL.md
Registers list_cloudformation_stacks, maps profile and region arguments to the CLI command, adds agent-surface coverage, and updates MCP and skill documentation.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant MCPServer
  participant ResourcesCLI
  participant ResourceRepository
  MCPClient->>MCPServer: list_cloudformation_stacks
  MCPServer->>ResourcesCLI: resources cloudformation-stacks --json
  ResourcesCLI->>ResourceRepository: ListCloudFormationStacks
  ResourceRepository-->>ResourcesCLI: CloudFormation stacks
  ResourcesCLI-->>MCPServer: paginated stack JSON
  MCPServer-->>MCPClient: stack status, drift, parameters, and outputs
Loading

Merge Risk: ⚪ Minimal · up to cd35e

The new CloudFormation CLI query and MCP tool have consistent mapping and coverage without an actionable merge-blocking defect.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (3 skipped: 3… 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 uses the required conventional feat: prefix and clearly describes exposing CloudFormation stacks to automation, which matches the main changes.
Description check ✅ Passed The description includes the required Summary, Related Issues, Validation, and Checklist sections. It documents the change, validation commands, scope, documentation updates, tests, and lack of breaki…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/issue-360-cloudformation-agent-surface

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.

@amazon-q-developer amazon-q-developer 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.

This PR successfully exposes CloudFormation stacks to automation with a clean implementation. The changes follow existing patterns, include comprehensive test coverage, and properly integrate with both the CLI and MCP server. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed head: cd35eca

Findings

  1. Medium — advertise the permission required by the all-stacks request (internal/mcp/server.go:127, README.md:171)

    The new MCP metadata and README list only cloudformation:DescribeStacks, but this command reaches ListCloudFormationStacks, which calls DescribeStacks with an empty StackName (internal/services/aws/cloudformation.go:18). AWS documents that this all-stacks form requires both cloudformation:ListStacks and cloudformation:DescribeStacks. An identity provisioned from get_mcp_capabilities or the README can therefore receive AccessDenied even though it has every advertised permission.

    Suggested direction: add cloudformation:ListStacks to the tool metadata and README permission list, and assert the CloudFormation permission set in the MCP capability tests so discovery cannot drift again. See AWS DescribeStacks authorization notes.

@YoungJinJung

Copy link
Copy Markdown
Contributor Author

Addressed in 2ed37ff: the CloudFormation MCP capability metadata and README now advertise both cloudformation:DescribeStacks and cloudformation:ListStacks for the all-stacks request, and the capability-alignment test pins that exact permission set. Validation passed: targeted MCP capability test, make test, make build, and git diff --check.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-reviewed head 2ed37ff after the permission follow-up. The tool metadata, README, and capability test now advertise both permissions required for the all-stacks DescribeStacks request. I read the complete diff, tests, prior reviews, discussion, and current CI; no further actionable concerns remain. Local validation passed: make test, make build, and git diff --check. Approval and merge remain for an independent reviewer because this GitHub identity authored the PR.

@youngjinjung-linq youngjinjung-linq 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.

Reviewed head 2ed37ff after the CloudFormation permission follow-up. I read the complete nine-file diff, tests, CI, issue context, prior reviews, comments, and thread state. The command reuses the existing paginated failure-first repository path; the stable JSON/MCP contract, UTC serialization, permission metadata, parity guard, and documentation are aligned. No actionable concerns remain. Local validation passed: targeted tests, make test, make build, schema inspection, and git diff --check.

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