Skip to content

feat(apps): Add delete command#385

Merged
engfragui merged 5 commits into
mainfrom
francesca/apps-delete-command
Jun 5, 2026
Merged

feat(apps): Add delete command#385
engfragui merged 5 commits into
mainfrom
francesca/apps-delete-command

Conversation

@engfragui

@engfragui engfragui commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Overview

Adds td apps delete <ref> to remove a registered developer app, resolved by name, id:N, or raw numeric id. Requires --yes to actually delete; without it the command prints a preview and makes no API call (same convention as td folder delete / td workspace delete). --dry-run prints the standard dry-run preview.

Wires the scope-error hint and spinner message for deleteApp (and the previously-missing updateApp), and documents the command in the skill.

Reference

Test Plan

  • npm run dev
  • node dist/index.js auth login --additional-scopes=app-management
  • Create a test app (either via the UI or via command line, doesn't matter)
  • node dist/index.js apps list (you'll see your app)
  • node dist/index.js apps delete id:XXXX // <--- use the app id instead of "XXXX"
  • Confirm that this is just a dry-run (would need --yes to actually delete)
  • node dist/index.js apps delete id:XXXX --dry-run
  • Confirm that this is just a dry-run (would need --yes to actually delete)
  • node dist/index.js apps delete "Test" (or whatever would match your test app name)
  • Confirm that this is just a dry-run (would need --yes to actually delete)
  • node dist/index.js apps delete id:9999 // <--- fake app id that doesn't existing in your account
  • Confirm you get an APP_NOT_FOUND error
  • node dist/index.js apps delete id:XXXX --yes // <--- this will actually delete your test app, finally!
  • Confirm the app is deleted (i.e. via the UI or via command line, doesn't matter)

Demo

List

node dist/index.js apps list
[...]
Test (id:109707)
   Client ID: 9b6298a2f93e448e8734ea4a339ff71a
   (no description)

Delete via app id

node dist/index.js apps delete id:109707
Would delete app: Test (id:109707)
Use --yes to confirm.

Delete via app id + dry-run

node dist/index.js apps delete id:109707 --dry-run
[dry-run] Would delete app:
  App: Test
  ID: 109707

Delete via app name

node dist/index.js apps delete "Test"
Would delete app: Test (id:109707)
Use --yes to confirm.

Delete via non-existing app id

node dist/index.js apps delete id:9999
Error: APP_NOT_FOUND
App "id:9999" not found.

Delete via app id + yes

node dist/index.js apps delete id:109707 --yes
Deleted: Test (id:109707)

Adds `td apps delete <ref>` to remove a registered developer app,
resolved by name, id:N, or raw numeric id. Requires --yes to actually
delete; without it the command prints a preview and makes no API call
(same convention as `td folder delete` / `td workspace delete`).
--dry-run prints the standard dry-run preview.

Wires the scope-error hint and spinner message for deleteApp (and the
previously-missing updateApp), and documents the command in the skill.

Closes #383

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@engfragui engfragui self-assigned this Jun 5, 2026
@doistbot doistbot requested a review from gnapse June 5, 2026 11:24
@engfragui engfragui changed the title feat(apps): add delete command feat(apps): Add delete command Jun 5, 2026
Extends the MISSING_SCOPE detection test to assert updateApp and
deleteApp also emit the app-management re-auth hint, covering the
METHOD_REQUIRED_FLAG mappings added alongside the delete command.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Francesca for adding the apps delete command and wiring up the necessary scope handling 😎 👊.

Few things worth tightening:

  • Add a regression test combining --dry-run and --yes to explicitly verify that dry-run takes precedence and prevents deletion even when confirmation is provided.

I also included a few optional follow-up notes in the details below.

Optional follow-up notes (2)
  • [P3] src/commands/apps/delete.ts:13: deleteApp only needs id and displayName, but resolveAppRef() always does the full detail fetch path for name refs (getApps() to match, then getApp() to enrich). That adds an extra API round-trip to every td apps delete "<name>" preview/delete and couples this command to a view/update-specific resolver. Consider using a lighter resolver here (or getApps() + resolveFromList) and reserving resolveAppRef() for callers that actually need the detail shape.
  • [P3] src/lib/api/core.ts:222: The PR adds new app-management scope routing for updateApp and deleteApp, but the nearby wrapApiError → MISSING_SCOPE detection test still only exercises getApps/getApp. Extending that existing test to include these two method names would catch typos here before users hit a 403 at runtime.

Share FeedbackReview Logs

Comment thread src/commands/apps/apps.test.ts
Adds a regression test that `td apps delete --dry-run --yes` still
previews and never calls deleteApp, so the destructive path can't fire
when confirmation is present alongside a dry run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@engfragui engfragui added the 🙋 Ask PR PR must be reviewed before merging label Jun 5, 2026
Comment thread src/lib/skills/content.ts Outdated

\`td apps update <ref> --add-oauth-redirect <url>\` appends an OAuth redirect URI to the app, and \`--remove-oauth-redirect <url>\` takes one off (requires \`--yes\` to actually mutate, like \`td task delete\`). The two flags are mutually exclusive — pass one at a time. The URI is validated before any API call: \`https://<host>\`, \`http(s)://localhost[:port][/path]\`, \`http(s)://127.0.0.1[:port][/path]\`, or a custom-scheme URI (e.g. \`myapp://callback\`) are accepted; \`javascript\`, \`data\`, \`file\`, \`vbscript\`, and \`ftp\` custom schemes are rejected. Removals skip validation so users can clean up legacy malformed URIs. Adding a URI already set on the app fails with \`ALREADY_EXISTS\`; removing a URI that isn't on the app exits 0 with a message and makes no API call. Supports \`--dry-run\` and \`--json\`.

\`td apps delete <ref>\` deletes a registered app (resolved by name, \`id:N\`, or raw numeric id). It requires \`--yes\` to actually delete; without it the command prints a \`Would delete app: …\` preview and makes no API call (same convention as \`td folder delete\` / \`td workspace delete\`). \`--dry-run\` prints the standard dry-run preview.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I wonder if this should note that deleting an app will mean any user using the app will no longer be able to use it. User must be sure they want to delete. Adding that will at least make an LLM confirm with the user.

@engfragui engfragui Jun 5, 2026

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.

Good idea, I added a more explicit note (that mentions "destructive", "irreversible", "cannot be restored", etc.) 🚨❌🙅‍♀️😅

engfragui and others added 2 commits June 5, 2026 14:47
Note in the skill content that deleting a registered app is destructive
and irreversible, and instruct confirming with the user before --yes so
an LLM prompts before deletion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Regenerate the bundled SKILL.md so the apps-delete warning matches
content.ts, fixing the SKILL.md Sync CI check.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@engfragui engfragui merged commit 480f41b into main Jun 5, 2026
5 checks passed
@engfragui engfragui deleted the francesca/apps-delete-command branch June 5, 2026 12:50
doist-release-bot Bot added a commit that referenced this pull request Jun 5, 2026
## [1.73.0](v1.72.1...v1.73.0) (2026-06-05)

### Features

* **apps:** Add delete command ([#385](#385)) ([480f41b](480f41b)), closes [#383](#383)
@doist-release-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.73.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gnapse

gnapse commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Today I Learned that td apps was even a thing at all. Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🙋 Ask PR PR must be reviewed before merging released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

td apps is missing a delete command

4 participants