Name the workspace in a bot's task status line
A task running in a workspace shows "Working on a task in <name> workspace", so the bot's own chat and the main rail say where the work is. Outside a workspace it stays "Working on a task". Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import taskStatusLine from "./task-status-line";
|
||||
|
||||
describe("taskStatusLine", () => {
|
||||
test("names the workspace a task runs in", () => {
|
||||
expect(taskStatusLine({ workspace_name: "Launch" })).toBe("Working on a task in Launch workspace");
|
||||
});
|
||||
|
||||
test("says just working on a task outside a workspace", () => {
|
||||
expect(taskStatusLine({})).toBe("Working on a task");
|
||||
expect(taskStatusLine({ workspace_name: " " })).toBe("Working on a task");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
import { BotTaskStatusLine } from "@/src/dict/bot-queue-dict";
|
||||
|
||||
type Params = {
|
||||
/**
|
||||
* The workspace the task runs in, if any.
|
||||
*/
|
||||
workspace_name?: string | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The status line while a task runs, naming its workspace when it runs in
|
||||
* one, so the bot's own chat says where the work is. Never the task.
|
||||
*/
|
||||
export default function taskStatusLine({ workspace_name }: Params) {
|
||||
const name = workspace_name?.trim();
|
||||
|
||||
return name ? `${BotTaskStatusLine} in ${name} workspace` : BotTaskStatusLine;
|
||||
}
|
||||
Reference in New Issue
Block a user