(d4ce964) Record status, owner and tag changes in a history log, and bump to 0.29.0
The comments directory was already an append-only log with one event kind. It is now .worklane/history/<uuid>/, with the kind in the entry and in the filename after the stamp, so a ticket says how it got where it is and not only what was said about it. mv, chown and set --tags each write an entry after their own save and behind their own no-change return, so a refused or no-op edit records nothing. --actor is on all four writers now. An old comments directory is adopted on first access and a file with no marker reads as the comment it is, so nothing is migrated or rewritten. The log moves to src/history.rs, out of util.rs and handlers.rs, and the card's counter counts comments only: a ticket that has moved three times has not been talked about. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a1bdb5df49
commit
f454d212a4
+24
-4
@@ -187,7 +187,7 @@ export const ls = tool({
|
||||
|
||||
export const show = tool({
|
||||
description:
|
||||
"Show a complete ticket by UUID or title. Displays title, description, acceptance criteria, implementation plan, metadata, and comments.",
|
||||
"Show a complete ticket by UUID or title. Displays title, description, acceptance criteria, implementation plan, metadata, and the history: every comment on it and every change to its status, owner or tags.",
|
||||
args: {
|
||||
id: tool.schema
|
||||
.string()
|
||||
@@ -219,6 +219,10 @@ export const mv = tool({
|
||||
.boolean()
|
||||
.describe("Force move (allows non-sequential moves like done -> backlog). Use with caution.")
|
||||
.optional(),
|
||||
actor: tool.schema
|
||||
.string()
|
||||
.describe("Who the entry is attributed to. If omitted, WORKLANE_ACTOR is used, then the git user, then \"unknown\". Set WORKLANE_ACTOR in the environment opencode is started with rather than passing this on every call.")
|
||||
.optional(),
|
||||
},
|
||||
async execute(args: Record<string, any>, context: ToolContext) {
|
||||
if (!args.ticket) {
|
||||
@@ -229,6 +233,7 @@ export const mv = tool({
|
||||
}
|
||||
const cmd: string[] = ["mv", args.ticket, "--status", args.status];
|
||||
if (args.force) cmd.push("--force");
|
||||
if (args.actor) cmd.push("--actor", args.actor);
|
||||
|
||||
try {
|
||||
return await run(cmd, context);
|
||||
@@ -249,7 +254,7 @@ export const comment = tool({
|
||||
.describe("Comment body text (required). Supports markdown formatting and multiple paragraphs separated by newlines."),
|
||||
actor: tool.schema
|
||||
.string()
|
||||
.describe("Who the comment is attributed to. If omitted, WORKLANE_ACTOR is used, then the git user, then \"unknown\". Set WORKLANE_ACTOR in the environment opencode is started with rather than passing this on every call.")
|
||||
.describe("Who the entry is attributed to. If omitted, WORKLANE_ACTOR is used, then the git user, then \"unknown\". Set WORKLANE_ACTOR in the environment opencode is started with rather than passing this on every call.")
|
||||
.optional(),
|
||||
},
|
||||
async execute(args: Record<string, any>, context: ToolContext) {
|
||||
@@ -306,6 +311,10 @@ export const set = tool({
|
||||
.string()
|
||||
.describe("New priority level, 1 (most urgent) to 5 (least)")
|
||||
.optional(),
|
||||
actor: tool.schema
|
||||
.string()
|
||||
.describe("Who the entry is attributed to. Only reaches the entry tags writes, since that is the one field of this command's that is logged. If omitted, WORKLANE_ACTOR is used, then the git user.")
|
||||
.optional(),
|
||||
},
|
||||
async execute(args: Record<string, any>, context: ToolContext) {
|
||||
if (!args.ticket) {
|
||||
@@ -330,8 +339,12 @@ export const set = tool({
|
||||
if (args.tags) cmd.push("--tags", args.tags);
|
||||
if (args.due) cmd.push("--due", args.due);
|
||||
if (args.priority) cmd.push("--priority", String(args.priority));
|
||||
// Last, and not counted as a field: the length check below is what refuses a call
|
||||
// that names nothing to change, and an actor alone changes nothing.
|
||||
const fields = cmd.length;
|
||||
if (args.actor) cmd.push("--actor", args.actor);
|
||||
|
||||
if (cmd.length === 2) {
|
||||
if (fields === 2) {
|
||||
return "Error setting fields: give at least one field to change";
|
||||
}
|
||||
|
||||
@@ -405,6 +418,10 @@ export const chown = tool({
|
||||
ticket: tool.schema
|
||||
.string()
|
||||
.describe("Ticket UUID prefix (4+ chars) or title substring (required)"),
|
||||
actor: tool.schema
|
||||
.string()
|
||||
.describe("Who the entry is attributed to, which on this command is not the same as user: user becomes the ticket's owner, actor is who made the change. If omitted, WORKLANE_ACTOR is used, then the git user, then \"unknown\".")
|
||||
.optional(),
|
||||
},
|
||||
async execute(args: Record<string, any>, context: ToolContext) {
|
||||
if (!args.user) {
|
||||
@@ -414,8 +431,11 @@ export const chown = tool({
|
||||
return "Error changing owner: ticket is required";
|
||||
}
|
||||
|
||||
const cmd: string[] = ["chown", args.user, args.ticket];
|
||||
if (args.actor) cmd.push("--actor", args.actor);
|
||||
|
||||
try {
|
||||
return await run(["chown", args.user, args.ticket], context);
|
||||
return await run(cmd, context);
|
||||
} catch (err: any) {
|
||||
return `Error changing owner: ${err.message}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user