Skip to content

feat(project): implement remove command - #2037

Open
Hweinstock wants to merge 6 commits into
aws:refactorfrom
Hweinstock:feat/project-remove
Open

feat(project): implement remove command#2037
Hweinstock wants to merge 6 commits into
aws:refactorfrom
Hweinstock:feat/project-remove

Conversation

@Hweinstock

@Hweinstock Hweinstock commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Problem

There is no remove command!

Solution

Implement remove as a single command, taking the resource as an argument. Looking at the old CLI https://github.com/aws/agentcore-cli/blob/main/src/cli/primitives/, we basically duplicated this pattern many times, but here we instead do it generically.

Note: we don't yet support remove all, but one could imagine adding it as a resource type with special behavior.

Testing

unit tests with harness and runtime (since those are the only ones working e2e).

@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 19, 2026
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 19, 2026
@codecov-commenter

codecov-commenter commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.14%. Comparing base (1a21206) to head (c0c2821).
⚠️ Report is 1 commits behind head on refactor.

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2037   +/-   ##
=========================================
  Coverage     97.13%   97.14%           
=========================================
  Files           381      381           
  Lines         22782    22824   +42     
=========================================
+ Hits          22130    22172   +42     
  Misses          652      652           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

);
});

async function run(args: string[]) {

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.

as a follow-up, I think we can pull this and inProject below out into a common location (src/testing). I have a few open PRs that develop similar utils for this.

const agentCoreSpecPath = this.getProjectSpecPath(project);
const projectSpecKey = toProjectSpecKey(input.resourceType);

const existingProjectSpec = await this.json.read(agentCoreSpecPath, ProjectSpecSchema);

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.

we could probably re-use some logic from add, but want to wait before trying to generalize this.

@Hweinstock
Hweinstock marked this pull request as ready for review August 19, 2026 18:45
notgitika
notgitika previously approved these changes Aug 19, 2026

@notgitika notgitika 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 looks good thanks for setting it up. I have a suggestion I would like addressed that I left a comment below on.

separately, I have a question for the future implementations we do: will we also be deleting any code we scaffold (for runtime and harness for instance) when the user runs this command?

I spent some time reviewing the code on main and it seems mixed.

For remove gateway target, it removes the code: https://github.com/aws/agentcore-cli/blob/main/src/cli/operations/remove/remove-gateway-target.ts#L201
Same for code based evals: https://github.com/aws/agentcore-cli/blob/main/src/cli/primitives/EvaluatorPrimitive.ts#L261

however, for agent/runtime, we don't do the same: https://github.com/aws/agentcore-cli/blob/main/src/cli/primitives/AgentPrimitive.tsx#L222

Can we decide and align on one experience before we start with the rest of the implementation?

Comment on lines +217 to +219
this.logger
.child({ input })
.warn(`unable to remove resource from project that does not exist.`);

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.

can we throw right after this? at this point, the handler would still return a user message like remove successful. I'm okay to keep it this way like a no-op but it might be a bit misleading.

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.

I think an idempotent delete is easier, especially if customers are using this in some kind of automation.

@Hweinstock

Copy link
Copy Markdown
Contributor Author

good callout, I think we should remove the scaffolded code to be consistent.

Comment thread src/core/project/manager.tsx Outdated
break;
}
} catch (e) {
throw new ProjectStateError(

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.

decided to throw here since it could lead to bad state. ex. i remove a runtime named 'X", then try to recreate (it would fail since the files still exist).

@notgitika

Copy link
Copy Markdown
Contributor

good callout, I think we should remove the scaffolded code to be consistent.

just had an offline discussion on why we decided not to delete the code early on.

I would lean on not deleting the code, since the user could wanna reuse the code if they maybe make some changes. That is the pattern we established with with agent/runtime initially but the following code with gateway targets/code based evals were regressions, since it wasn't documented properly.

what do you think?

@Hweinstock

Copy link
Copy Markdown
Contributor Author

responded internally, swapping back to original for now, we can add clean up later if we see a need.

@notgitika notgitika 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.

Nice!

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.

3 participants