Skip to content

feat: choose the setup steps by who made the agent space - #909

Closed
cchu-ld wants to merge 1 commit into
cchu/aws-devops-6-run-planfrom
cchu/aws-devops-7-space-owner
Closed

cchu-ld wants to merge 1 commit into
cchu/aws-devops-6-run-planfrom
cchu/aws-devops-7-space-owner

Conversation

@cchu-ld

@cchu-ld cchu-ld commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

This PR is part 7 of a stack of 7 PRs for ldcli aws-devops-agent. It goes on PR 6 of the stack. Review and merge the PRs in order.

  1. feat: ask which existing agent space to connect LaunchDarkly to #903 Agent space choice
  2. feat: add AWS regions, send the API version, and shorten credential errors #904 Regions, API version, credential error
  3. feat: offer to run aws sso login when SSO credentials expire #905 aws sso login offer
  4. feat: show names and states in the plaintext status output #906 Readable status output
  5. feat: show the setup plan and ask before setup changes AWS #907 Setup plan and confirmation
  6. feat: run the setup plan that setup showed #908 Run the shown plan
  7. feat: choose the setup steps by who made the agent space #909 Ownership rule and existing spaces (this PR)

Describe the solution you've provided

  • setup finds its own spaces by the description Managed by the LaunchDarkly CLI. It runs the full setup on a space that it made. On another space, it only connects the MCP server, unless you pass --auth-flow. The space list marks the spaces that setup made, and the JSON has managedByLdcli.
  • A connect run reads the operator app. If the app is off, setup does not print its URL, and the result has "operatorAppEnabled": false.
  • --agent-space-name has no default. With a name, Enter at the list picks the space with that name, or a new space with that name. Without a name, the list has no default, and a new space makes setup ask for a name.
  • setup does not provision a space with a name that a space in the region uses.
  • An unattended run with --agent-space-name X uses X, or provisions X if no space has that name. Without a name, it reuses the one space that setup made, or stops.
  • Setup and ConnectExisting move to export_test.go, because only tests use them.

Describe alternatives you've considered

A tag on new agent spaces would be a stronger ownership marker than the description. setup does not use one, because it must call ListTagsForResource once for each space to read tags.

Additional context

Testing: go test ./... and golangci-lint pass on this branch.

I ran setup against a sandbox AWS account. These cases worked: a new space with a typed name, a new space next to existing spaces, and a second EnableOperatorApp call (IAM to IAM) on a space whose app is on.

Not tested against real AWS:

  • A change of sign-in method on an app that is on, for example IAM to IdC.
  • Role creation in an account without DevOpsAgentRole-AgentSpace and DevOpsAgentRole-WebappAdmin.

🤖 Generated with Claude Code


Note

Overview
ldcli aws-devops-agent setup now treats agent spaces differently depending on whether LaunchDarkly created them (description Managed by the LaunchDarkly CLI, surfaced as managedByLdcli / “made by ldcli” in the list). Full setup (IAM, account association, operator app) runs only on those spaces or when you pass --auth-flow; picking someone else’s space is connect-only (MCP registration/association). Connect runs read operator app state: if the app is off, plaintext output skips the URL and JSON includes operatorAppEnabled: false.

Space selection and naming change materially: --agent-space-name has no default and drives interactive defaults (Enter matches by name or offers to create that name). Without a name, the list has no default. New spaces must get a unique name (prompt or flag); provisioning refuses names already in use. Unattended/--yes/--output json behavior is spelled out: with --agent-space-name, reuse or create by name (error on ambiguous duplicates); without it, auto-reuse only when exactly one ldcli-managed space exists.

README documents the new flows. Setup / ConnectExisting move to export_test.go for tests only; FindAgentSpace is removed in favor of the richer resolution helpers.

Reviewed by Cursor Bugbot for commit cb180c7. Bugbot is set up for automated code reviews on this repo. Configure here.

Setup finds its own spaces by the description "Managed by the
LaunchDarkly CLI". It runs the full setup on a space that it made. On
another space, it only connects the MCP server, unless you pass
--auth-flow. The space list marks the spaces that setup made, and the
JSON has managedByLdcli.

A connect run reads the operator app. If the app is off, setup does not
print its URL, and the result has "operatorAppEnabled": false.

--agent-space-name has no default. In a terminal, setup asks for the
name of a new space. Setup does not provision a space with a name that
a space in the region uses. An unattended run with --agent-space-name X
uses X, or provisions X if no space has that name. Without a name, it
reuses the one space that setup made, or stops.

Setup and ConnectExisting move to export_test.go, because only tests
use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cchu-ld
cchu-ld force-pushed the cchu/aws-devops-7-space-owner branch from e72b392 to cb180c7 Compare October 20, 2026 16:55
@cchu-ld cchu-ld closed this Oct 20, 2026
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