list-characters.js 551 B

12345678910111213
  1. import { EntityReader } from '../storage/adapters/EntityReader.js'
  2. /**
  3. * list-characters [--status=<状态>] → JSON 数组(正名、状态、位置)
  4. * 契约:纯返回 {ok, output?, error?}(见 design §6.2)。
  5. */
  6. export async function run(args, options, ctx) {
  7. const reader = new EntityReader(ctx.repoPath, ctx.cache)
  8. const filter = {}
  9. if (options.status && options.status !== true) filter.status = options.status
  10. const rows = await reader.listCharacters(filter)
  11. return { ok: true, output: JSON.stringify(rows, null, 2) }
  12. }