Skip to content

[cc] add cc(action='rename') verb to set sessions.name #79

@anipotts

Description

@anipotts

Source: deferred from v3 imessage-alignment pass, decision 19

Problem

`sessions.name` is nullable + never auto-populated today. Sessions show up in the digest as `<short_id> @ <cwd_basename>`, which is fine for ambiguous-cwd cases but unfriendly for power users running many sessions.

Proposed fix

Tiny addition to the action enum.

Schema

```ts
z.object({
action: z.literal("rename"),
name: z.string().min(1).max(40).regex(/^[a-z0-9-]+$/),
}).strict()
```

Dispatcher

```ts
if (action.action === "rename") {
db.prepare("UPDATE sessions SET name = ? WHERE id = ?")
.run(action.name, MY_SESSION_ID);
return text(JSON.stringify({ name: action.name }));
}
```

Render

`computeDigest` already has the `name` field on session rows; `renderDigest` shows `` instead of `<short_id> @ ` when name is non-null.

Resolution

`resolveSessionTarget()` already tries `name` first via the existing query column, so renames "just work" once the verb lands.

Files to touch

  • `plugins/cc/lib/action.ts` — extend discriminated union
  • `plugins/cc/server.ts` — dispatcher branch
  • `plugins/cc/lib/render.ts` — prefer name in digest
  • `plugins/cc/skills/sessions/SKILL.md` — document
  • `plugins/cc/tests/action.test.ts` — schema test

Acceptance criteria

  • cc(action='rename', name='backend-refactor') succeeds
  • Subsequent cc.sessions shows the name
  • cc.send to='backend-refactor' resolves
  • Names with spaces/special chars rejected by regex
  • Empty/too-long names rejected

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions