⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
feat(cli): repeat tasks with kaneo task repeat
olozano-d85a962316a0
diff --git a/apps/docs/cli/reference.mdx b/apps/docs/cli/reference.mdxindex aaf82b8e3..367c00e29 100644--- a/apps/docs/cli/reference.mdx+++ b/apps/docs/cli/reference.mdx@@ -196,6 +196,28 @@ Changes a task's title, description, priority, dates or labels.| `--add-label` | Add a workspace label by name. Repeatable. || `--remove-label` | Remove a label by name. Repeatable. |+### `kaneo task repeat`++```bash+kaneo task repeat <task> [<frequency>] [flags]+```++Makes a task [repeat](/core/functional/plan-and-execute-tasks#repeat-a-task). The frequency is `daily`, `weekly`, `monthly` or `yearly`. When the task moves into a done column, Kaneo creates the next one, due one step after the completed task's due date. `kaneo task view` shows the rule under **Repeats**.++| Flag | Description |+| --- | --- |+| `--every` | Repeat every this many days, weeks, months or years, from 1 to 99. Defaults to 1. |+| `--on` | Weekly only: the days to repeat on, such as `mon,thu`. Repeatable. Defaults to the due date's weekday. |+| `--time-zone` | IANA time zone, such as `Europe/Madrid`, that keeps the next due date on the same local day. Defaults to your computer's. |+| `--stop` | Stop the task repeating |++```bash+kaneo task repeat KAN-12 weekly --every 2 --on mon,thu+kaneo task repeat KAN-12 --stop+```++A done task cannot start repeating. Move it back to an open column first, or set the rule on its next task.+### `kaneo task open````bashdiff --git a/apps/docs/core/functional/plan-and-execute-tasks.mdx b/apps/docs/core/functional/plan-and-execute-tasks.mdxindex c3b89cdd7..f77f630a8 100644--- a/apps/docs/core/functional/plan-and-execute-tasks.mdx+++ b/apps/docs/core/functional/plan-and-execute-tasks.mdx@@ -61,6 +61,8 @@ The completed task stays in the done column as a record, and the repeat settingIn a project connected to GitHub, Gitea, or GitLab, each new occurrence is treated like any other new task: it gets its own issue when it matches the integration's sync rules.+From the terminal, set or stop a rule with [`kaneo task repeat`](/cli/reference#kaneo-task-repeat).+## Break work into subtasksIn the task’s **Sub-tasks** section, enter a title and choose **Add**. Each subtask is a task with its own status and assignee. Open it to add more detail. The **Subtask of** link takes you back to its parent.diff --git a/packages/cli/README.md b/packages/cli/README.mdindex fbd133728..c88de223a 100644--- a/packages/cli/README.md+++ b/packages/cli/README.md@@ -82,7 +82,7 @@ Credentials are resolved in this order: `--token`, then `KANEO_API_KEY`, then th| `kaneo profile list`, `use`, `rename`, `remove` | Manage stored logins for several servers or accounts || `kaneo task list`, `mine`, `view`, `open` | List a project's tasks or your own, show one, open it in the browser || `kaneo task create`, `edit`, `duplicate`, `delete` | Create, change, copy and delete tasks |-| `kaneo task status`, `move`, `assign`, `field` | Change a task's column, project, assignee or custom fields |+| `kaneo task status`, `move`, `assign`, `field`, `repeat` | Change a task's column, project, assignee, custom fields or repeat rule || `kaneo task bulk` | Apply one change to many tasks at once || `kaneo task attach`, `images` | Upload files to a task, show the images in its description || `kaneo task relation`, `link`, `activity` | Subtasks and blockers, links, and the task's history |diff --git a/packages/cli/src/api/schemas.ts b/packages/cli/src/api/schemas.tsindex 9623c55ac..372b28037 100644--- a/packages/cli/src/api/schemas.ts+++ b/packages/cli/src/api/schemas.ts@@ -121,6 +121,14 @@ export const AssignedTasks = Schema.Struct({total: Schema.Number,});+export const TaskRecurrence = Schema.Struct({+ frequency: Schema.Literals(["daily", "weekly", "monthly", "yearly"]),+ interval: Schema.Number,+ weekdays: Schema.optionalKey(Schema.Array(Schema.Number)),+ timeZone: Schema.String,+});+export type TaskRecurrence = typeof TaskRecurrence.Type;+export const TaskDetail = Schema.Struct({id: Schema.String,projectId: Schema.String,@@ -135,6 +143,8 @@ export const TaskDetail = Schema.Struct({createdAt: Schema.String,assigneeId: NullableString,assigneeName: NullableString,+ // Servers without repeating tasks leave this out.+ recurrence: Schema.optionalKey(Schema.NullOr(TaskRecurrence)),});export type TaskDetail = typeof TaskDetail.Type;diff --git a/packages/cli/src/api/task-mutations.ts b/packages/cli/src/api/task-mutations.tsindex 4affff16e..6ff499651 100644--- a/packages/cli/src/api/task-mutations.ts+++ b/packages/cli/src/api/task-mutations.ts@@ -1,5 +1,6 @@import { Effect, Schema } from "effect";import { KaneoApi } from "./kaneo-api.js";+import type { TaskRecurrence } from "./schemas.js";const NullableString = Schema.NullOr(Schema.String);@@ -102,6 +103,16 @@ export const updateTaskDueDate = Effect.fnUntraced(function* (});});+export const updateTaskRecurrence = Effect.fnUntraced(function* (+ id: string,+ recurrence: TaskRecurrence | null,+) {+ const api = yield* KaneoApi;+ return yield* api.request("PUT", taskPath("recurrence", id), UpdatedTask, {+ body: { recurrence },+ });+});+export const updateTaskStartDate = Effect.fnUntraced(function* (id: string,startDate: string | null,diff --git a/packages/cli/src/commands/task/index.ts b/packages/cli/src/commands/task/index.tsindex 04f2ec36e..2b5a28349 100644--- a/packages/cli/src/commands/task/index.ts+++ b/packages/cli/src/commands/task/index.ts@@ -18,6 +18,7 @@ import { taskMine } from "./mine.js";import { taskMove } from "./move.js";import { taskOpen } from "./open.js";import { taskRelation } from "./relation.js";+import { taskRepeat } from "./repeat.js";import { taskStatus } from "./status.js";import { taskView } from "./view.js";@@ -29,6 +30,7 @@ export const task = Command.make("task").pipe(taskView,taskCreate,taskEdit,+ taskRepeat,taskOpen,taskStatus,taskMove,diff --git a/packages/cli/src/commands/task/repeat.ts b/packages/cli/src/commands/task/repeat.tsnew file mode 100644index 000000000..4cd90808d--- /dev/null+++ b/packages/cli/src/commands/task/repeat.ts@@ -0,0 +1,160 @@+import { Effect, Option } from "effect";+import { Argument, Command, Flag } from "effect/cli";+import type { TaskRecurrence } from "../../api/schemas.js";+import { updateTaskRecurrence } from "../../api/task-mutations.js";+import { InvalidArgument } from "../../errors/errors.js";+import { emit } from "../../output/emit.js";+import { Output } from "../../output/output.js";+import { withSpinner } from "../../output/spinner.js";+import { pick } from "../../prompts/pick.js";+import {+ buildRecurrence,+ FREQUENCIES,+ type Frequency,+ localTimeZone,+} from "../../tasks/build-recurrence.js";+import { formatRecurrence } from "../../tasks/format-recurrence.js";+import { renderTaskChange } from "../../tasks/render-task-change.js";+import { resolveTask } from "../../tasks/resolve-task.js";+import { ApiLayer } from "../api-layer.js";++const RULE_HINT = "Use daily, weekly, monthly or yearly, or pass --stop.";++export const runTaskRepeat = Effect.fn("command.task.repeat")(+ function* (options: {+ readonly task: string;+ readonly frequency: Option.Option<Frequency>;+ readonly every: Option.Option<number>;+ readonly on: ReadonlyArray<string>;+ readonly timeZone: Option.Option<string>;+ readonly stop: boolean;+ }) {+ const output = yield* Output;+ const ruleFlags =+ Option.isSome(options.frequency) ||+ Option.isSome(options.every) ||+ Option.isSome(options.timeZone) ||+ options.on.length > 0;+ if (options.stop && ruleFlags) {+ return yield* new InvalidArgument({+ message: "Pass a repeat rule or --stop, not both.",+ hint: RULE_HINT,+ });+ }+ const resolved = yield* withSpinner(`Loading ${options.task.trim()}`)(+ resolveTask(options.task),+ );+ const label = resolved.ticketId ?? resolved.task.id.slice(0, 8);+ const current = resolved.task.recurrence ?? null;++ const frequency: Frequency | null = options.stop+ ? null+ : yield* Option.match(options.frequency, {+ onSome: Effect.succeed,+ onNone: () =>+ output.interactive+ ? pick<Frequency | null>(`Repeat ${label}`, [+ ...FREQUENCIES.map((value) => ({+ title: formatRecurrence({ frequency: value, interval: 1 }),+ value,+ description:+ current?.frequency === value ? "current" : undefined,+ })),+ ...(current+ ? [{ title: "Stop repeating", value: null }]+ : []),+ ])+ : Effect.fail(+ new InvalidArgument({+ message: `Pass how often ${label} repeats.`,+ hint: RULE_HINT,+ }),+ ),+ });++ const recurrence: TaskRecurrence | null =+ frequency === null+ ? null+ : yield* Effect.fromResult(+ buildRecurrence({+ frequency,+ every: Option.getOrElse(options.every, () => 1),+ on: options.on,+ timeZone: Option.getOrElse(options.timeZone, localTimeZone),+ }),+ );++ yield* withSpinner(`Updating ${label}`)(+ updateTaskRecurrence(resolved.task.id, recurrence),+ ).pipe(+ Effect.catchTag("Conflict", () =>+ Effect.fail(+ new InvalidArgument({+ message: `${label} is done, so it cannot start repeating.`,+ hint: `Move it back to an open column with kaneo task status ${label}, or set the rule on its next task.`,+ }),+ ),+ ),+ );++ const rule = recurrence ? formatRecurrence(recurrence) : null;+ yield* emit(+ {+ id: resolved.task.id,+ ticketId: resolved.ticketId,+ recurrence,+ url: resolved.url,+ },+ (ui) =>+ renderTaskChange(ui, {+ verb: "Updated",+ reference: label,+ url: resolved.url,+ detail: rule+ ? `repeats ${rule.charAt(0).toLowerCase()}${rule.slice(1)}`+ : "stopped repeating",+ }),+ );+ },+);++export const taskRepeat = Command.make(+ "repeat",+ {+ task: Argument.String("task").pipe(+ Argument.withDescription("Ticket id such as KAN-12, or the task id"),+ ),+ frequency: Argument.Literals("frequency", FREQUENCIES).pipe(+ Argument.withDescription("How often the task repeats"),+ Argument.optional,+ ),+ every: Flag.Int("every").pipe(+ Flag.withDescription(+ "Repeat every this many days, weeks, months or years, from 1 to 99",+ ),+ Flag.optional,+ ),+ on: Flag.String("on").pipe(+ Flag.withDescription(+ "Weekly only: days to repeat on, such as mon,thu; defaults to the due date's weekday",+ ),+ Flag.atLeast(0),+ ),+ timeZone: Flag.String("time-zone").pipe(+ Flag.withDescription(+ "IANA time zone that keeps dates on the same local day; defaults to this computer's",+ ),+ Flag.optional,+ ),+ stop: Flag.Boolean("stop").pipe(+ Flag.withDescription("Stop the task repeating"),+ Flag.withDefault(false),+ ),+ },+ (options) => runTaskRepeat(options),+).pipe(+ Command.withDescription(+ "Make a task repeat when it is done, or stop it repeating",+ ),+ Command.provide(ApiLayer),+);diff --git a/packages/cli/src/doctor/required-operations.ts b/packages/cli/src/doctor/required-operations.tsindex 26ee7cb62..f57ffcc1e 100644--- a/packages/cli/src/doctor/required-operations.ts+++ b/packages/cli/src/doctor/required-operations.ts@@ -77,6 +77,7 @@ export const REQUIRED_OPERATIONS: ReadonlyArray<RequiredOperation> = [{ method: "POST", path: "/api/task/import/{projectId}" },{ method: "PUT", path: "/api/task/move/{taskId}" },{ method: "PUT", path: "/api/task/priority/{id}" },+ { method: "PUT", path: "/api/task/recurrence/{id}" },{ method: "PUT", path: "/api/task/status/{taskId}" },{ method: "GET", path: "/api/task/tasks/{projectId}" },{ method: "PUT", path: "/api/task/title/{id}" },diff --git a/packages/cli/src/screens/__snapshots__/task-view.test.ts.snap b/packages/cli/src/screens/__snapshots__/task-view.test.ts.snapindex 7fe675353..3b33efeb0 100644--- a/packages/cli/src/screens/__snapshots__/task-view.test.ts.snap+++ b/packages/cli/src/screens/__snapshots__/task-view.test.ts.snap@@ -10,6 +10,7 @@ exports[`task view screen > fully loaded task at 80 columns, no color 1`] = `Assignee Ada LovelaceLabels ● bug ● authDue ◷ Fri+ Repeats Weekly on Monday and ThursdayStart Oct 1Created Sep 29Time 3h · ● Timer running (Ada Lovelace)@@ -72,6 +73,7 @@ exports[`task view screen > fully loaded task at 80 columns, truecolor 1`] = `[38;2;115;115;115mAssignee [39m Ada Lovelace[38;2;115;115;115mLabels [39m [38;2;231;0;11m●[39m bug [38;2;142;81;255m●[39m auth[38;2;115;115;115mDue [39m ◷ Fri+ [38;2;115;115;115mRepeats [39m Weekly on Monday and Thursday[38;2;115;115;115mStart [39m Oct 1[38;2;115;115;115mCreated [39m Sep 29[38;2;115;115;115mTime [39m 3h[38;2;115;115;115m · [39m[38;2;5;150;105m● Timer running[39m[38;2;115;115;115m (Ada Lovelace)[39m@@ -134,6 +136,7 @@ exports[`task view screen > fully loaded task at 120 columns, no color 1`] = `Assignee Ada LovelaceLabels ● bug ● authDue ◷ Fri+ Repeats Weekly on Monday and ThursdayStart Oct 1Created Sep 29Time 3h · ● Timer running (Ada Lovelace)@@ -196,6 +199,7 @@ exports[`task view screen > fully loaded task at 120 columns, truecolor 1`] = `[38;2;115;115;115mAssignee [39m Ada Lovelace[38;2;115;115;115mLabels [39m [38;2;231;0;11m●[39m bug [38;2;142;81;255m●[39m auth[38;2;115;115;115mDue [39m ◷ Fri+ [38;2;115;115;115mRepeats [39m Weekly on Monday and Thursday[38;2;115;115;115mStart [39m Oct 1[38;2;115;115;115mCreated [39m Sep 29[38;2;115;115;115mTime [39m 3h[38;2;115;115;115m · [39m[38;2;5;150;105m● Timer running[39m[38;2;115;115;115m (Ada Lovelace)[39mdiff --git a/packages/cli/src/task-view/test-task-view.ts b/packages/cli/src/task-view/test-task-view.tsindex e869011ba..389e98553 100644--- a/packages/cli/src/task-view/test-task-view.ts+++ b/packages/cli/src/task-view/test-task-view.ts@@ -78,6 +78,12 @@ export const resolvedTask: ResolvedTask = {priority: "urgent",startDate: at(-6),dueDate: at(2),+ recurrence: {+ frequency: "weekly",+ interval: 1,+ weekdays: [1, 4],+ timeZone: "Europe/Madrid",+ },createdAt: at(-8),assigneeId: "u1",assigneeName: "Ada Lovelace",diff --git a/packages/cli/src/tasks/build-recurrence.test.ts b/packages/cli/src/tasks/build-recurrence.test.tsnew file mode 100644index 000000000..0314b0f99--- /dev/null+++ b/packages/cli/src/tasks/build-recurrence.test.ts@@ -0,0 +1,60 @@+import { Result } from "effect";+import { describe, expect, it } from "vite-plus/test";+import { buildRecurrence } from "./build-recurrence.js";++const rule = {+ frequency: "weekly",+ every: 1,+ on: [],+ timeZone: "Europe/Madrid",+} as const;++const failure = <A, E extends { message: string }>(+ result: Result.Result<A, E>,+) => (Result.isFailure(result) ? result.failure.message : "succeeded");++describe("buildRecurrence", () => {+ it("builds the rule the API takes", () => {+ expect(buildRecurrence(rule)).toEqual(+ Result.succeed({+ frequency: "weekly",+ interval: 1,+ timeZone: "Europe/Madrid",+ }),+ );+ expect(buildRecurrence({ ...rule, every: 2, on: ["thu,mon"] })).toEqual(+ Result.succeed({+ frequency: "weekly",+ interval: 2,+ weekdays: [1, 4],+ timeZone: "Europe/Madrid",+ }),+ );+ });++ it("keeps the interval between 1 and 99", () => {+ for (const every of [0, 100, -1]) {+ expect(failure(buildRecurrence({ ...rule, every }))).toBe(+ "--every must be a whole number from 1 to 99.",+ );+ }+ expect(Result.isSuccess(buildRecurrence({ ...rule, every: 99 }))).toBe(+ true,+ );+ });++ it("only takes weekdays on weekly rules", () => {+ expect(+ failure(buildRecurrence({ ...rule, frequency: "monthly", on: ["mon"] })),+ ).toBe("--on only applies to weekly rules.");+ });++ it("rejects unknown time zones and weekdays", () => {+ expect(+ failure(buildRecurrence({ ...rule, timeZone: "Mars/Olympus" })),+ ).toBe('--time-zone "Mars/Olympus" is not a time zone.');+ expect(failure(buildRecurrence({ ...rule, on: ["someday"] }))).toBe(+ '--on "someday" is not a weekday.',+ );+ });+});diff --git a/packages/cli/src/tasks/build-recurrence.ts b/packages/cli/src/tasks/build-recurrence.tsnew file mode 100644index 000000000..cd31581b8--- /dev/null+++ b/packages/cli/src/tasks/build-recurrence.ts@@ -0,0 +1,63 @@+import { Result } from "effect";+import type { TaskRecurrence } from "../api/schemas.js";+import { InvalidArgument } from "../errors/errors.js";+import { parseWeekdays } from "./parse-weekdays.js";++export const FREQUENCIES = ["daily", "weekly", "monthly", "yearly"] as const;+export type Frequency = (typeof FREQUENCIES)[number];++const MAX_INTERVAL = 99;++function isTimeZone(value: string): boolean {+ try {+ new Intl.DateTimeFormat("en-US", { timeZone: value });+ return true;+ } catch {+ return false;+ }+}++export function localTimeZone(): string {+ return Intl.DateTimeFormat().resolvedOptions().timeZone;+}++export function buildRecurrence(options: {+ readonly frequency: Frequency;+ readonly every: number;+ readonly on: ReadonlyArray<string>;+ readonly timeZone: string;+}): Result.Result<TaskRecurrence, InvalidArgument> {+ const { frequency, every, timeZone } = options;+ if (!Number.isInteger(every) || every < 1 || every > MAX_INTERVAL) {+ return Result.fail(+ new InvalidArgument({+ message: `--every must be a whole number from 1 to ${MAX_INTERVAL}.`,+ hint: "For example, --every 2 repeats every second week.",+ }),+ );+ }+ if (options.on.length > 0 && frequency !== "weekly") {+ return Result.fail(+ new InvalidArgument({+ message: "--on only applies to weekly rules.",+ hint: "Use weekly --on mon,thu, or leave out --on.",+ }),+ );+ }+ if (!isTimeZone(timeZone)) {+ return Result.fail(+ new InvalidArgument({+ message: `--time-zone "${timeZone}" is not a time zone.`,+ hint: "Use an IANA time zone such as Europe/Madrid.",+ }),+ );+ }+ const weekdays = parseWeekdays(options.on);+ if (Result.isFailure(weekdays)) return Result.fail(weekdays.failure);+ return Result.succeed({+ frequency,+ interval: every,+ ...(weekdays.success.length > 0 ? { weekdays: weekdays.success } : {}),+ timeZone,+ });+}diff --git a/packages/cli/src/tasks/format-recurrence.test.ts b/packages/cli/src/tasks/format-recurrence.test.tsnew file mode 100644index 000000000..0428df0c5--- /dev/null+++ b/packages/cli/src/tasks/format-recurrence.test.ts@@ -0,0 +1,30 @@+import { describe, expect, it } from "vite-plus/test";+import { formatRecurrence } from "./format-recurrence.js";++describe("formatRecurrence", () => {+ it("names single steps after the pattern", () => {+ expect(formatRecurrence({ frequency: "daily", interval: 1 })).toBe("Daily");+ expect(formatRecurrence({ frequency: "yearly", interval: 1 })).toBe(+ "Yearly",+ );+ });++ it("counts longer intervals", () => {+ expect(formatRecurrence({ frequency: "monthly", interval: 3 })).toBe(+ "Every 3 months",+ );+ });++ it("lists weekly days from Monday, with Sunday last", () => {+ expect(+ formatRecurrence({+ frequency: "weekly",+ interval: 1,+ weekdays: [4, 0, 1],+ }),+ ).toBe("Weekly on Monday, Thursday and Sunday");+ expect(+ formatRecurrence({ frequency: "weekly", interval: 2, weekdays: [5] }),+ ).toBe("Every 2 weeks on Friday");+ });+});diff --git a/packages/cli/src/tasks/format-recurrence.ts b/packages/cli/src/tasks/format-recurrence.tsnew file mode 100644index 000000000..b3eb4bd26--- /dev/null+++ b/packages/cli/src/tasks/format-recurrence.ts@@ -0,0 +1,43 @@+import type { TaskRecurrence } from "../api/schemas.js";++const DAY_NAMES = [+ "Sunday",+ "Monday",+ "Tuesday",+ "Wednesday",+ "Thursday",+ "Friday",+ "Saturday",+];++const UNITS = {+ daily: "day",+ weekly: "week",+ monthly: "month",+ yearly: "year",+} as const;++const fromMonday = (day: number) => (day + 6) % 7;++function joinDays(days: ReadonlyArray<string>): string {+ if (days.length <= 1) return days.join("");+ return `${days.slice(0, -1).join(", ")} and ${days.at(-1)}`;+}++// "Weekly", "Every 2 weeks on Monday and Thursday": weeks start on Monday,+// as they do when the API picks the next selected day.+export function formatRecurrence(+ recurrence: Pick<TaskRecurrence, "frequency" | "interval" | "weekdays">,+): string {+ const { frequency, interval } = recurrence;+ const rule =+ interval === 1+ ? frequency.charAt(0).toUpperCase() + frequency.slice(1)+ : `Every ${interval} ${UNITS[frequency]}s`;+ const weekdays = recurrence.weekdays ?? [];+ if (frequency !== "weekly" || weekdays.length === 0) return rule;+ const days = [...weekdays]+ .sort((a, b) => fromMonday(a) - fromMonday(b))+ .map((day) => DAY_NAMES[day] ?? String(day));+ return `${rule} on ${joinDays(days)}`;+}diff --git a/packages/cli/src/tasks/parse-weekdays.test.ts b/packages/cli/src/tasks/parse-weekdays.test.tsnew file mode 100644index 000000000..9177e4485--- /dev/null+++ b/packages/cli/src/tasks/parse-weekdays.test.ts@@ -0,0 +1,29 @@+import { Result } from "effect";+import { describe, expect, it } from "vite-plus/test";+import { parseWeekdays } from "./parse-weekdays.js";++const success = <A, E>(result: Result.Result<A, E>) =>+ Result.isSuccess(result) ? result.success : "failed";++describe("parseWeekdays", () => {+ it("reads short and long names from lists and repeated flags", () => {+ expect(success(parseWeekdays(["mon,Thursday", " FRI "]))).toEqual([+ 1, 4, 5,+ ]);+ expect(success(parseWeekdays(["sun", "sat", "tues", "thurs"]))).toEqual([+ 0, 2, 4, 6,+ ]);+ });++ it("drops duplicates and empty entries", () => {+ expect(success(parseWeekdays(["mon,,monday", "mon,"]))).toEqual([1]);+ expect(success(parseWeekdays([]))).toEqual([]);+ });++ it("names the day it does not know", () => {+ const result = parseWeekdays(["mon,funday"]);+ expect(Result.isFailure(result) && result.failure.message).toBe(+ '--on "funday" is not a weekday.',+ );+ });+});diff --git a/packages/cli/src/tasks/parse-weekdays.ts b/packages/cli/src/tasks/parse-weekdays.tsnew file mode 100644index 000000000..6a097bb57--- /dev/null+++ b/packages/cli/src/tasks/parse-weekdays.ts@@ -0,0 +1,35 @@+import { Result } from "effect";+import { InvalidArgument } from "../errors/errors.js";++// The API numbers weekdays 0 for Sunday to 6 for Saturday.+const WEEKDAYS: ReadonlyArray<ReadonlyArray<string>> = [+ ["sun", "sunday"],+ ["mon", "monday"],+ ["tue", "tues", "tuesday"],+ ["wed", "wednesday"],+ ["thu", "thur", "thurs", "thursday"],+ ["fri", "friday"],+ ["sat", "saturday"],+];++// Takes repeated flags and comma-separated lists alike: --on mon,thu --on fri.+export function parseWeekdays(+ inputs: ReadonlyArray<string>,+): Result.Result<ReadonlyArray<number>, InvalidArgument> {+ const days = new Set<number>();+ for (const name of inputs.flatMap((input) => input.split(","))) {+ const normalized = name.trim().toLowerCase();+ if (normalized === "") continue;+ const day = WEEKDAYS.findIndex((names) => names.includes(normalized));+ if (day === -1) {+ return Result.fail(+ new InvalidArgument({+ message: `--on "${name.trim()}" is not a weekday.`,+ hint: "Use day names such as mon,thu or monday.",+ }),+ );+ }+ days.add(day);+ }+ return Result.succeed([...days].sort((a, b) => a - b));+}diff --git a/packages/cli/src/tasks/render-task-detail.test.ts b/packages/cli/src/tasks/render-task-detail.test.tsindex db692988e..637684ea5 100644--- a/packages/cli/src/tasks/render-task-detail.test.ts+++ b/packages/cli/src/tasks/render-task-detail.test.ts@@ -26,6 +26,7 @@ const task: TaskViewJson = {assignee: { id: "user-1", name: "Ada Lovelace" },dueDate: new Date(2026, 9, 6, 12).toISOString(),startDate: new Date(2026, 9, 1, 12).toISOString(),+ recurrence: null,createdAt: new Date(2026, 8, 30, 9).toISOString(),projectId: "project-1",projectKey: "KAN",@@ -186,6 +187,40 @@ describe("renderTaskDetail rows", () => {expect(rows({}).some((line) => line.includes("Time"))).toBe(false);});+ it("shows the repeat rule under the due date only when the task repeats", () => {+ expect(+ rows({+ recurrence: {+ frequency: "weekly",+ interval: 2,+ weekdays: [4, 1],+ timeZone: "Europe/Madrid",+ },+ }).slice(4, 6),+ ).toEqual([+ " Due ◷ Yesterday",+ " Repeats Every 2 weeks on Monday and Thursday",+ ]);+ expect(rows({}).some((line) => line.includes("Repeats"))).toBe(false);+ });++ it("cuts a long repeat rule to the terminal width", () => {+ const lines = rows(+ {+ recurrence: {+ frequency: "weekly",+ interval: 12,+ weekdays: [0, 1, 2, 3, 4, 5, 6],+ timeZone: "UTC",+ },+ },+ 60,+ );+ const repeats = lines.find((line) => line.includes("Repeats")) ?? "";+ expect(stringWidth(repeats)).toBeLessThanOrEqual(60);+ expect(repeats.endsWith("…")).toBe(true);+ });+it("cuts long label and parent rows to the terminal width", () => {const lines = rows({diff --git a/packages/cli/src/tasks/render-task-detail.ts b/packages/cli/src/tasks/render-task-detail.tsindex 2d3e3353e..218160dbc 100644--- a/packages/cli/src/tasks/render-task-detail.ts+++ b/packages/cli/src/tasks/render-task-detail.ts@@ -9,6 +9,7 @@ import type { Ui } from "../render/ui.js";import { labelChips } from "../task-view/label-chips.js";import type { TaskViewJson } from "../task-view/task-view-json.js";import { hasTrackedTime, timeValue } from "../task-view/time-value.js";+import { formatRecurrence } from "./format-recurrence.js";import { type DescriptionLine, plainDescription } from "./plain-description.js";export type TaskDetailView = {@@ -80,6 +81,10 @@ export function renderTaskDetail(ui: Ui, view: TaskDetailView): string[] {],["Labels", labels],["Due", due.length > 0 ? renderCell(due, ui) : none("None")],+ [+ "Repeats",+ task.recurrence ? fit([text(formatRecurrence(task.recurrence))]) : null,+ ],["Start", formatDay(task.startDate, now) ?? none("None")],["Created", formatDay(task.createdAt, now) ?? none("Unknown")],["Time", time],diff --git a/packages/cli/src/tasks/task-detail-json.test.ts b/packages/cli/src/tasks/task-detail-json.test.tsindex 3851f255f..d11bdb7a4 100644--- a/packages/cli/src/tasks/task-detail-json.test.ts+++ b/packages/cli/src/tasks/task-detail-json.test.ts@@ -62,6 +62,7 @@ describe("toTaskDetailJson", () => {assignee: { id: "user-1", name: "Ada Lovelace" },dueDate: "2026-10-08T10:00:00.000Z",startDate: null,+ recurrence: null,createdAt: "2026-10-01T10:00:00.000Z",projectId: "project-1",projectKey: "KAN",@@ -71,6 +72,25 @@ describe("toTaskDetailJson", () => {});});+ it("passes the repeat rule through", () => {+ const recurrence = {+ frequency: "weekly",+ interval: 1,+ weekdays: [1, 4],+ timeZone: "Europe/Madrid",+ } as const;+ expect(+ toTaskDetailJson({+ task: { ...task, recurrence },+ project,+ columns: [column],+ workspaceId: "workspace-1",+ ticketId: "KAN-12",+ url: "https://kaneo.test/task-1",+ }).recurrence,+ ).toEqual(recurrence);+ });+it("falls back to the slug without a matching column and to null without an assignee", () => {const json = toTaskDetailJson({task: {diff --git a/packages/cli/src/tasks/task-detail-json.ts b/packages/cli/src/tasks/task-detail-json.tsindex ee30c00cd..2f4ac484d 100644--- a/packages/cli/src/tasks/task-detail-json.ts+++ b/packages/cli/src/tasks/task-detail-json.ts@@ -1,3 +1,4 @@+import type { TaskRecurrence } from "../api/schemas.js";import type { ResolvedTask } from "./resolve-task.js";export type TaskDetailJson = {@@ -15,6 +16,7 @@ export type TaskDetailJson = {} | null;readonly dueDate: string | null;readonly startDate: string | null;+ readonly recurrence: TaskRecurrence | null;readonly createdAt: string;readonly projectId: string;readonly projectKey: string;@@ -42,6 +44,7 @@ export function toTaskDetailJson(resolved: ResolvedTask): TaskDetailJson {: null,dueDate: task.dueDate,startDate: task.startDate,+ recurrence: task.recurrence ?? null,createdAt: task.createdAt,projectId: task.projectId,projectKey: project.slug.toUpperCase(),diff --git a/skills/kaneo-cli/SKILL.md b/skills/kaneo-cli/SKILL.mdindex 11bef803b..436275929 100644--- a/skills/kaneo-cli/SKILL.md+++ b/skills/kaneo-cli/SKILL.md@@ -33,6 +33,7 @@ You are ready when `kaneo context` shows a user and the workspace you mean to ac- Statuses are the slugs of a project's columns, such as `to-do`, `in-progress` or `done`. Projects can have custom columns, so list them with `kaneo column list -p KAN` before moving a task somewhere unfamiliar.- The workspace comes from `-w`, then `KANEO_WORKSPACE`, then a `.kaneo.json` in the current folder or any parent, then the default from `kaneo workspace use`. The project comes from `-p`, then `KANEO_PROJECT`, then `.kaneo.json`. A `.kaneo.json` further up the tree can select a different workspace than expected; `kaneo context` shows which source won.- Dates take `YYYY-MM-DD`, `today`, `tomorrow` or `+3d`.+- `kaneo task repeat` matches weekdays and month ends in the time zone of the machine it runs on. When that may not be the user's, such as in CI or on a remote host, pass their zone with `--time-zone`. `--stop` ends a series.- Descriptions and comments are Markdown. Pass long text with `-F <file>`, or `-F -` to read stdin.## Common commands@@ -47,6 +48,7 @@ kaneo task create "Fix flaky login test" -p KAN --priority high --due tomorrow -kaneo task status KAN-12 in-progresskaneo task edit KAN-12 --priority urgent --add-label Bugkaneo task assign KAN-12 me+kaneo task repeat KAN-12 weekly --on mon,thu --time-zone Europe/Madridkaneo comment add KAN-12 "Fixed in #123"kaneo time log KAN-12 1h30m -m "Pairing on the fix"kaneo search "login redirect" --type tasks