重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
grove-account-deletion by autumnsgrove/groveengine
npx skills add https://github.com/autumnsgrove/groveengine --skill grove-account-deletion使用 wrangler CLI 命令安全地从 Grove 平台删除租户账户及其所有关联数据。
/grove-account-deletion识别 → 验证 → 快照 → 删除租户 → 清理孤立数据 → 清除 R2 → 验证
用户将提供用户名(子域名)、电子邮件或显示名称。请查找他们:
# 通过用户名/子域名(最常见)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE subdomain = 'USERNAME';"
# 通过电子邮件(如果用户名未知)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE email = 'EMAIL';"
# 通过显示名称(模糊匹配)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE display_name LIKE '%NAME%';"
()。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
/Users/mini/Documents/Projects/Lattice在删除任何内容之前,向用户展示您找到的信息并要求明确确认:
Found tenant:
ID: abc-123-def
Username: alice
Name: Alice Wonderland
Email: alice@example.com
Plan: seedling
Created: 2026-01-24
This will permanently delete:
- All blog posts and pages
- All media files (R2 storage)
- All sessions and settings
- Commerce data (orders, products, customers)
- Curio configurations (timeline, journey, gallery)
- Onboarding and billing records
Proceed with deletion?
切勿跳过此确认步骤。 即使是测试账户。
对于非测试账户,快速捕获即将删除内容的计数:
npx wrangler d1 execute grove-engine-db --remote --command="
SELECT
(SELECT COUNT(*) FROM posts WHERE tenant_id = 'TENANT_ID') as posts,
(SELECT COUNT(*) FROM pages WHERE tenant_id = 'TENANT_ID') as pages,
(SELECT COUNT(*) FROM media WHERE tenant_id = 'TENANT_ID') as media_files,
(SELECT COUNT(*) FROM sessions WHERE tenant_id = 'TENANT_ID') as sessions;
"
此单次 DELETE 操作将级联删除:posts, pages, media records, tenant_settings, sessions, products, product_variants, customers, orders, order_line_items, subscriptions, connect_accounts, platform_billing, refunds, discount_codes, post_views, timeline_curio_config, timeline_summaries, timeline_activity, timeline_ai_usage, journey_curio_config, journey_snapshots, journey_summaries, journey_jobs, gallery_curio_config, gallery_images, gallery_tags, gallery_collections, git_dashboard_config。
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM tenants WHERE id = 'TENANT_ID';"
这些表不会从租户表级联删除,需要手动清理:
# 移除 onboarding 记录(通过用户名链接,非外键)
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM user_onboarding WHERE username = 'USERNAME';"
# 移除该用户的电子邮件验证码(通过外键从 user_onboarding 级联删除,但请验证)
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM email_verification_codes WHERE user_id IN (SELECT id FROM user_onboarding WHERE username = 'USERNAME');"
如果用户通过 Heartwood 注册且没有其他租户:
# 检查用户是否拥有其他租户
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain FROM tenants WHERE email = 'USER_EMAIL';"
# 如果没有其他租户存在,清理孤立的用户记录(如果适用)
# 注意:'users' 表可能存在也可能不存在,具体取决于使用的身份验证方法
R2 键遵循模式 {tenant_id}/{filename}。D1 的 media 表记录已删除(级联),但实际的 R2 对象仍然存在。
# 列出具有租户前缀的对象
npx wrangler r2 object list grove-media --prefix="TENANT_ID/" --remote
# 删除每个对象(wrangler 不支持批量删除,因此需要迭代)
# 对于少量文件:
npx wrangler r2 object delete grove-media --remote "TENANT_ID/filename1.webp"
npx wrangler r2 object delete grove-media --remote "TENANT_ID/filename2.webp"
对于大量文件,生成删除脚本:
# 列出所有键,然后在循环中删除
npx wrangler r2 object list grove-media --prefix="TENANT_ID/" --remote 2>/dev/null | jq -r '.[] .key' | while read key; do
echo "Deleting: $key"
npx wrangler r2 object delete grove-media --remote "$key"
done
如果删除前快照显示有 0 个媒体文件,请跳过此步骤。
确认租户已完全删除:
# 验证租户已删除
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) as remaining FROM tenants WHERE subdomain = 'USERNAME';"
# 验证级联是否生效(抽查几张表)
npx wrangler d1 execute grove-engine-db --remote --command="
SELECT
(SELECT COUNT(*) FROM posts WHERE tenant_id = 'TENANT_ID') as posts,
(SELECT COUNT(*) FROM media WHERE tenant_id = 'TENANT_ID') as media,
(SELECT COUNT(*) FROM sessions WHERE tenant_id = 'TENANT_ID') as sessions;
"
# 验证 onboarding 已清理
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) as remaining FROM user_onboarding WHERE username = 'USERNAME';"
向用户提供清晰的摘要:
Tenant "alice" (Alice Wonderland) has been fully deleted.
Cleaned up:
- Tenant record + 29 cascaded tables
- Onboarding record
- 3 R2 media files
- Email verification codes
The subdomain "alice.grove.place" is now available for reuse.
platform_billing.status = 'active' 或存在 LemonSqueezy 订阅,请发出警告对于用户明确称为"测试账户"或在当前会话中创建的账户:
一个电子邮件可以拥有多个子域名。仅删除指定的租户。不要触碰其他租户。
如果子域名/电子邮件与任何租户都不匹配,请告知用户。不要猜测。
Heartwood 会话存储在 KV 中,而非 D1。D1 的 sessions 表用于遗留/本地会话。Heartwood 会话将自然过期(24 小时 TTL)。除非指定了紧急性,否则无需手动清理。
如果设置了 user_onboarding.lemonsqueezy_subscription_id,请警告用户他们可能需要在 LemonSqueezy 仪表板中单独取消订阅。D1 删除不会取消外部计费。
所有命令从项目根目录运行:/Users/mini/Documents/Projects/Lattice
数据库是:grove-engine-db (D1)
媒体存储桶是:grove-media (R2)
一次干净的删除是一次友好的告别。不留任何孤儿。
每周安装量
50
代码仓库
GitHub 星标数
2
首次出现
2026年2月5日
安全审计
安装于
opencode50
codex50
gemini-cli50
continue49
cursor49
codebuddy49
Safely delete a tenant account and all associated data from the Grove platform using wrangler CLI commands.
/grove-account-deletionIdentify → Verify → Snapshot → Delete Tenant → Clean Orphans → Purge R2 → Verify
The user will provide a username (subdomain), email, or display name. Look them up:
# By username/subdomain (most common)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE subdomain = 'USERNAME';"
# By email (if username unknown)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE email = 'EMAIL';"
# By display name (fuzzy match)
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain, display_name, email, plan, created_at FROM tenants WHERE display_name LIKE '%NAME%';"
Run these from the project root (/Users/mini/Documents/Projects/Lattice).
Before deleting ANYTHING, show the user what you found and ask for explicit confirmation:
Found tenant:
ID: abc-123-def
Username: alice
Name: Alice Wonderland
Email: alice@example.com
Plan: seedling
Created: 2026-01-24
This will permanently delete:
- All blog posts and pages
- All media files (R2 storage)
- All sessions and settings
- Commerce data (orders, products, customers)
- Curio configurations (timeline, journey, gallery)
- Onboarding and billing records
Proceed with deletion?
NEVER skip this confirmation step. Even for test accounts.
For non-test accounts, capture a quick count of what's being deleted:
npx wrangler d1 execute grove-engine-db --remote --command="
SELECT
(SELECT COUNT(*) FROM posts WHERE tenant_id = 'TENANT_ID') as posts,
(SELECT COUNT(*) FROM pages WHERE tenant_id = 'TENANT_ID') as pages,
(SELECT COUNT(*) FROM media WHERE tenant_id = 'TENANT_ID') as media_files,
(SELECT COUNT(*) FROM sessions WHERE tenant_id = 'TENANT_ID') as sessions;
"
This single DELETE cascades to: posts, pages, media records, tenant_settings, sessions, products, product_variants, customers, orders, order_line_items, subscriptions, connect_accounts, platform_billing, refunds, discount_codes, post_views, timeline_curio_config, timeline_summaries, timeline_activity, timeline_ai_usage, journey_curio_config, journey_snapshots, journey_summaries, journey_jobs, gallery_curio_config, gallery_images, gallery_tags, gallery_collections, git_dashboard_config.
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM tenants WHERE id = 'TENANT_ID';"
These tables don't CASCADE from tenants and need manual cleanup:
# Remove onboarding record (linked by username, not FK)
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM user_onboarding WHERE username = 'USERNAME';"
# Remove email verification codes for that user (cascades from user_onboarding via FK, but verify)
npx wrangler d1 execute grove-engine-db --remote --command="DELETE FROM email_verification_codes WHERE user_id IN (SELECT id FROM user_onboarding WHERE username = 'USERNAME');"
If the user signed up via Heartwood and has no other tenants:
# Check if user has other tenants
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, subdomain FROM tenants WHERE email = 'USER_EMAIL';"
# If no other tenants exist, clean orphaned user record (if applicable)
# NOTE: The 'users' table may or may not exist depending on auth approach used
R2 keys follow the pattern {tenant_id}/{filename}. The D1 media table records are already gone (CASCADE), but the actual R2 objects remain.
# List objects with tenant prefix
npx wrangler r2 object list grove-media --prefix="TENANT_ID/" --remote
# Delete each object (wrangler doesn't support bulk delete, so iterate)
# For a small number of files:
npx wrangler r2 object delete grove-media --remote "TENANT_ID/filename1.webp"
npx wrangler r2 object delete grove-media --remote "TENANT_ID/filename2.webp"
For many files , generate a deletion script:
# List all keys, then delete in a loop
npx wrangler r2 object list grove-media --prefix="TENANT_ID/" --remote 2>/dev/null | jq -r '.[] .key' | while read key; do
echo "Deleting: $key"
npx wrangler r2 object delete grove-media --remote "$key"
done
Skip this step if the pre-deletion snapshot showed 0 media files.
Confirm the tenant is fully gone:
# Verify tenant deleted
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) as remaining FROM tenants WHERE subdomain = 'USERNAME';"
# Verify cascade worked (spot-check a few tables)
npx wrangler d1 execute grove-engine-db --remote --command="
SELECT
(SELECT COUNT(*) FROM posts WHERE tenant_id = 'TENANT_ID') as posts,
(SELECT COUNT(*) FROM media WHERE tenant_id = 'TENANT_ID') as media,
(SELECT COUNT(*) FROM sessions WHERE tenant_id = 'TENANT_ID') as sessions;
"
# Verify onboarding cleaned
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) as remaining FROM user_onboarding WHERE username = 'USERNAME';"
Give the user a clean summary:
Tenant "alice" (Alice Wonderland) has been fully deleted.
Cleaned up:
- Tenant record + 29 cascaded tables
- Onboarding record
- 3 R2 media files
- Email verification codes
The subdomain "alice.grove.place" is now available for reuse.
platform_billing.status = 'active' or LemonSqueezy subscription existsFor accounts the user explicitly calls "test accounts" or accounts created in the current session:
One email can own multiple subdomains. Only delete the specified tenant. Don't touch others.
If the subdomain/email doesn't match any tenant, tell the user. Don't guess.
Heartwood sessions are stored in KV, not D1. The D1 sessions table is for legacy/local sessions. Heartwood sessions will expire naturally (24h TTL). No manual cleanup needed unless urgency is specified.
If user_onboarding.lemonsqueezy_subscription_id is set, warn the user that they may need to cancel the subscription in the LemonSqueezy dashboard separately. D1 deletion doesn't cancel external billing.
All commands run from the project root: /Users/mini/Documents/Projects/Lattice
The database is: grove-engine-db (D1) The media bucket is: grove-media (R2)
A clean deletion is a kind goodbye. Leave no orphans behind.
Weekly Installs
50
Repository
GitHub Stars
2
First Seen
Feb 5, 2026
Security Audits
Gen Agent Trust HubFailSocketFailSnykPass
Installed on
opencode50
codex50
gemini-cli50
continue49
cursor49
codebuddy49