feat(apps): Add delete command#385
Conversation
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>
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
left a comment
There was a problem hiding this comment.
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-runand--yesto 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:
deleteApponly needsidanddisplayName, butresolveAppRef()always does the full detail fetch path for name refs (getApps()to match, thengetApp()to enrich). That adds an extra API round-trip to everytd apps delete "<name>"preview/delete and couples this command to a view/update-specific resolver. Consider using a lighter resolver here (orgetApps()+resolveFromList) and reservingresolveAppRef()for callers that actually need the detail shape. - [P3] src/lib/api/core.ts:222: The PR adds new
app-managementscope routing forupdateAppanddeleteApp, but the nearbywrapApiError → MISSING_SCOPE detectiontest still only exercisesgetApps/getApp. Extending that existing test to include these two method names would catch typos here before users hit a 403 at runtime.
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>
|
|
||
| \`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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good idea, I added a more explicit note (that mentions "destructive", "irreversible", "cannot be restored", etc.) 🚨❌🙅♀️😅
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>
|
🎉 This PR is included in version 1.73.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
Today I Learned that |
Overview
Adds
td apps delete <ref>to remove a registered developer app, resolved by name, id:N, or raw numeric id. Requires--yesto actually delete; without it the command prints a preview and makes no API call (same convention astd folder delete/td workspace delete).--dry-runprints 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
td appsis missing adeletecommand #383Test Plan
npm run devnode dist/index.js auth login --additional-scopes=app-managementnode 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"--yesto actually delete)node dist/index.js apps delete id:XXXX --dry-run--yesto actually delete)node dist/index.js apps delete "Test"(or whatever would match your test app name)--yesto actually delete)node dist/index.js apps delete id:9999// <--- fake app id that doesn't existing in your accountAPP_NOT_FOUNDerrornode dist/index.js apps delete id:XXXX --yes// <--- this will actually delete your test app, finally!Demo
List
Delete via app id
Delete via app id + dry-run
Delete via app name
Delete via non-existing app id
Delete via app id + yes