Commit 9eff42f
fix(cli): add sessions list alias matching cron/commitments/devices/mcp convention (#81139)
openclaw sessions was the only list-style parent command that rejected a list subcommand. Every sibling (cron list, commitments list, devices list, mcp list, plugins list, agents list, tasks list) accepts the convention; sessions list errored with "Too many arguments for this command." and pointed users at openclaw sessions list --help, which silently dropped the list arg and showed help for bare sessions. The closed #60905 fix only addressed exit code, not the missing alias.
Register sessionsCmd.command("list") that delegates to the same sessionsCommand handler the bare command already calls. With enablePositionalOptions on the parent, commander captures any option whose name matches the parent (--json, --verbose, --store, --agent, --all-agents, --active, --limit) onto the parent regardless of position, so the action merges its own opts with command.parent.opts(). Flags work both before and after list (sessions --json list and sessions list --json). Mirrors the parentOpts pattern already used by the sibling cleanup subcommand and by commitments list / tasks list elsewhere in this file.
Verified:
- pnpm test src/cli/program/register.status-health-sessions.test.ts (28 passed)
- pnpm exec oxfmt --check --threads=1 src/cli/program/register.status-health-sessions.ts src/cli/program/register.status-health-sessions.test.ts (clean)
- pnpm check:changed (exit 0)
- pnpm build && node openclaw.mjs sessions list (lists sessions, exit 0)
- pnpm build && node openclaw.mjs sessions list --json (JSON output, exit 0)
- pnpm build && node openclaw.mjs sessions --json list (JSON output, exit 0)
- pnpm build && node openclaw.mjs sessions list --agent work (forwards --agent, errors with "Unknown agent id 'work'")
- pnpm build && node openclaw.mjs sessions --json (bare baseline unchanged, exit 0)
- pnpm build && node openclaw.mjs sessions cleanup --dry-run (sibling subcommand unchanged, exit 0)
Closes #811391 parent 046d6fc commit 9eff42f
2 files changed
Lines changed: 140 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
244 | 336 | | |
245 | 337 | | |
246 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
172 | 220 | | |
173 | 221 | | |
174 | 222 | | |
| |||
0 commit comments