-
Notifications
You must be signed in to change notification settings - Fork 46
feat(cli): bgagent linear remove-workspace command #306
Copy link
Copy link
Closed
Labels
adaptersThird-party integrations: Linear, Slack, GitHub App, notification/deploy providersThird-party integrations: Linear, Slack, GitHub App, notification/deploy providersapprovedWhen an issue has been approved and readyWhen an issue has been approved and readyenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersv1Version 1Version 1
Description
Activity
Metadata
Metadata
Assignees
Labels
adaptersThird-party integrations: Linear, Slack, GitHub App, notification/deploy providersThird-party integrations: Linear, Slack, GitHub App, notification/deploy providersapprovedWhen an issue has been approved and readyWhen an issue has been approved and readyenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersv1Version 1Version 1
Summary
Add a
bgagent linear remove-workspace <slug>CLI command that lets a Linear-workspace admin deregister a workspace previously onboarded viabgagent linear setuporbgagent linear add-workspace. Surfaced during PR #160 review (krokoko) — tracked as a follow-up that never landed.Today, removing a workspace requires manual surgery across DDB and Secrets Manager, which is error-prone and undocumented.
Motivation
Workspace onboarding is a one-line CLI command. Workspace removal isn't — operators have to:
LinearWorkspaceRegistryTableand either delete it or flipstatustorevokedbgagent-linear-oauth-<slug>)LinearProjectMappingTablerows for that workspaceWithout the command, a workspace removal can leave dangling secrets, stale registry rows that the resolver still reads, or orphan project mappings that confuse operators.
Proposed UX
Flags:
--purge— also delete the registry row entirely (default: keep withstatus=revokedfor audit)--keep-mappings— leaveLinearProjectMappingTablerows alone--yes— skip the slug-confirmation prompt (for scripted use)Acceptance criteria
bgagent linear remove-workspace <slug>registered undercli/src/commands/linear/DELETE /v1/linear/workspaces/{slug}) — keeps DDB / Secrets Manager grants on the API role, not on every CLI usercdk/src/handlers/linear/that:setupfor that slug — same auth pattern as existing OAuth admin commands)LinearWorkspaceRegistryTablerow tostatus='revoked'(or deletes it with--purge)bgagent-linear-oauth-<slug>secret from Secrets ManagerLinearProjectMappingTablerows whereworkspace_slug = <slug>linear-oauth-resolver.ts+ Python equivalent) treatsstatus='revoked'as fail-closed (already does — re-verify under test)docs/guides/LINEAR_SETUP_GUIDE.mdunder "Removing a workspace"Out of scope
bgagent linear add-workspaceagain)References
cdk/src/constructs/linear-integration.ts, OAuth secret naming convention incdk/src/handlers/shared/linear-oauth-resolver.tsEstimate
~1–2 hours: handler + CLI command + tests + doc snippet. No infra changes (existing tables and secret prefix are reused).