Commit 48b8b3a
committed
feat(xiaohongshu): add delete-note command to remove published notes
Adds `opencli xiaohongshu delete-note <note-id>` so the workflow that
creates a note can also remove one without leaving the CLI, mirroring
`weibo delete` (jackwener#1619 / jackwener#1620).
The creator-center HTTP API requires the `X-S-Common` signature header
that `publish.js` deliberately avoids, so this follows the same UI
automation route. Flow:
1. Navigate to creator note-manager
2. Switch to "已发布" tab (delete entry only appears there; "审核中"
and "未通过" rows have no web delete action, mobile app only)
3. Locate the `.note` row whose `data-impression` JSON contains the
target noteId
4. Click the inline `<span class="control data-del">` action
5. Click "确定" in the `.d-modal-footer` confirmation modal
6. Poll for the row disappearing (iteration-bounded so tests with
mocked `page.wait` exhaust the loop quickly)
Typed errors:
- /login redirect after navigation -> AuthRequiredError
- target noteId not present in the rendered list -> EmptyResultError
with a hint about review-state limitation
- row found but no delete action visible -> CommandExecutionError
- confirmation modal missing / no 确定 button -> CommandExecutionError
- row still visible after the configured poll window -> CommandExecutionError
Closes jackwener#1623.
Verified live on macOS / opencli built locally (branch includes the
jackwener#1613 shadow-DOM publish fix so a fresh test note could be published
first):
- Published a test note via `xiaohongshu publish` (note_id
`6a08ba0b000000000702a893`, title "明洞街景测试 可删")
- Waited for review to clear into "已发布"
- `xiaohongshu delete-note 6a08ba0b000000000702a893` returned
`[{ status: 'deleted', note_id: '6a08ba0b000000000702a893' }]`
- Follow-up `xiaohongshu creator-notes` returns "No notes found"
Unit tests: 7 / 7 cover happy path, empty-id ArgumentError, login
redirect AuthRequiredError, row-not-found EmptyResultError,
no-delete-action / no-modal / unverified-delete CommandExecutionError
paths.
Note on branch base: built on top of jackwener#1613 (xiaohongshu publish
shadow-DOM fix) because the live verify required `xiaohongshu publish`
to work end-to-end first. Will rebase onto main once jackwener#1613 lands.1 parent 2667f4c commit 48b8b3a
3 files changed
Lines changed: 286 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26327 | 26327 | | |
26328 | 26328 | | |
26329 | 26329 | | |
| 26330 | + | |
| 26331 | + | |
| 26332 | + | |
| 26333 | + | |
| 26334 | + | |
| 26335 | + | |
| 26336 | + | |
| 26337 | + | |
| 26338 | + | |
| 26339 | + | |
| 26340 | + | |
| 26341 | + | |
| 26342 | + | |
| 26343 | + | |
| 26344 | + | |
| 26345 | + | |
| 26346 | + | |
| 26347 | + | |
| 26348 | + | |
| 26349 | + | |
| 26350 | + | |
| 26351 | + | |
| 26352 | + | |
| 26353 | + | |
| 26354 | + | |
| 26355 | + | |
26330 | 26356 | | |
26331 | 26357 | | |
26332 | 26358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
0 commit comments