mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 02:29:33 +01:00
feat(cases): rename a case and its folder, with a lock and live-session handling
This commit is contained in:
1 parent
002de32a08
commit
ab0bc0aecd
14 files changed
+884
No files matched your search
@@ -1129,11 +1129,14 @@ A local case whose folder is the top of a git repository can keep **worktrees**
|
||||
| `PUT` | `/api/settings` | partial settings (strict schema) | Merged into the stored file; services (watchers, tunnel, tmux history limit) reconcile to the merged result. `403 FORBIDDEN` for a non-admin in multi-user mode. A tunnel enable without `CODEMAN_PASSWORD` is refused separately (`403 OPERATION_FAILED`, resend with `acknowledgeUnauthTunnel: true`). |
|
||||
| `GET` | `/api/execution/model-config` | none | `modelConfig` (cron's and the plan orchestrator's default model). |
|
||||
| `PUT` | `/api/execution/model-config` | `{ defaultModel?, agentTypeOverrides?, ... }` | Replaces `modelConfig`. `403 FORBIDDEN` for a non-admin in multi-user mode. |
|
||||
| `POST` | `/api/cases/:name/rename` | `{ newName, renameFolder?, stopSessions? }` (strict) | Rename a case and its folder (see below). |
|
||||
| `PUT` | `/api/cases/order` | `{ order: string[] }` | The one case order every user's `GET /api/cases` is sorted by. `403 FORBIDDEN` for a non-admin in multi-user mode. |
|
||||
| `PUT` | `/api/config` | `{ pollIntervalMs?, defaultTimeoutMs?, maxConcurrentSessions?, respawn? }` (strict) | The process-wide app config in `state.json`. `403 FORBIDDEN` for a non-admin in multi-user mode. |
|
||||
|
||||
A non-admin's `POST /api/quick-start` and `POST /api/ralph-loop/start` work as before but do not record their case as `lastUsedCase` (a server-wide key).
|
||||
|
||||
`POST /api/cases/:name/rename` renames a case. A case under the cases directory is its folder, so it always moves; a linked case renames its alias in `linked-cases.json` and moves its real folder (next to the old one, named `newName`) only with `renameFolder: true`. Remote and Docker cases are `400`. The new name must be free in every namespace the list merges (`409`). Live sessions whose working directory is at or inside the folder that would move make it `409` with `requiresStop: true` and `sessions: [{ id, name }]`; retry with `stopSessions: true` to end them first (nothing is restarted); another user's session is `403`. The folder is held by an in-process lock for the whole operation (an overlapping rename is `409 BUSY`, and `new Session` refuses a working directory inside it), the move is retried for a transient `EBUSY`/`EPERM`/`EACCES` and then answers `423` with `renameCode: "LOCKED"`, a cross-device move is `400`, and if the registries cannot be written afterwards the folder is moved back. On success the response is `{ oldName, newName, oldPath, newPath, folderMoved, stoppedSessions }`; `caseOrder`, `lastUsedCase`, `linked-cases.json` and Claude Code's `projects/<path>` history are updated, and `case:renamed` is broadcast. A linked case is admin only in multi-user mode.
|
||||
|
||||
### System operations
|
||||
|
||||
The same multi-user rule covers the operations that act on the whole server. For a non-admin:
|
||||
|
||||
@@ -31,6 +31,23 @@ Three ways to get one, all under **New or link a case…** at the bottom of the
|
||||
Linked cases keep living where they are. Deleting a case in Codeman removes the
|
||||
registration, and for a linked case that is all it removes.
|
||||
|
||||
**Renaming a case.** In the case manager (Settings, or the case picker's manage view) the pencil
|
||||
button renames a case and its folder. A case under `~/codeman-cases` *is* its folder name, so it
|
||||
always moves. A linked case renames its name in the list only; Codeman then asks whether to rename
|
||||
the real folder as well, next to where it is (Cancel leaves the folder alone). Remote and Docker
|
||||
cases cannot be renamed. Renaming does the following for you:
|
||||
|
||||
- **Sessions are never moved from under you.** If live sessions have the folder open, the rename is
|
||||
refused and lists them; you can then choose to stop them (nothing is restarted). While a rename runs,
|
||||
Codeman holds the folder so no session can start inside it half-moved.
|
||||
- **A folder another program holds open is reported, not forced.** On Windows, SMB shares and some FUSE
|
||||
mounts a directory with an open handle cannot be renamed; Codeman retries briefly, then says the folder
|
||||
is in use and to close whatever has it (a terminal, an editor, a file browser, a sync client).
|
||||
- **Claude Code's history follows.** It keys conversations by the folder's path, so the rename moves
|
||||
`<claude config>/projects/<old path>` to the new path and `--resume` still finds them. Other CLIs'
|
||||
history, Docker mounts and `git worktree` links that point at the old path are not updated.
|
||||
- **The case order, the last used case and this browser's per-case options follow the new name.**
|
||||
|
||||
**Clone Repo never asks for credentials.** It uses whatever the server's own git already has:
|
||||
an ssh key, or a credential helper such as `gh auth setup-git`. The Docker image can include
|
||||
helpers for GitHub (`gh`) and Azure DevOps (`az`), turned on in `docker-compose.override.yml`;
|
||||
|
||||
Reference in new issue
Block a user