Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions apps/api/src/tools/task-board/lanes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
* too, and those importing `run-reactions` for a constant would be a cycle.
*/

import { DELIVERY_LANES } from "@decocms/shared/task-board";
import { DELIVERY_LANES, isDeliveryLane } from "@decocms/shared/task-board";
import type { TaskBoardItemStatus } from "@/storage/types";

export { isDeliveryLane };

export const LANE_RANK: Record<TaskBoardItemStatus, number> = {
triage: 0,
todo: 1,
Expand All @@ -30,14 +32,6 @@ export const LANE_RANK: Record<TaskBoardItemStatus, number> = {
* literal union stays a subset of this side's lane vocabulary. */
export const DELIVERY_LANE_STATUSES: TaskBoardItemStatus[] = DELIVERY_LANES;

/** True for one of the post-merge delivery lanes (Approved, Merged, Post-deploy
* Validation) — the statuses that only exist for an org running
* `delivery_lanes_enabled`. Mirrors the web-side `isDeliveryLane` in
* `layouts/task-board/config.tsx`. */
export function isDeliveryLane(status: TaskBoardItemStatus): boolean {
return DELIVERY_LANE_STATUSES.includes(status);
}

/**
* True when moving `from` → `to` advances the card.
*
Expand Down
8 changes: 2 additions & 6 deletions apps/web/src/layouts/task-board/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
} from "@untitledui/icons";
import { Bug } from "lucide-react";
import type { StudioToolOutput as ToolOutput } from "@decocms/shared/tools/tool-io";
import { DEFAULT_TAG_COLOR, DELIVERY_LANES } from "@decocms/shared/task-board";
import { DEFAULT_TAG_COLOR, isDeliveryLane } from "@decocms/shared/task-board";
import { isResolvedRunFailure } from "@decocms/shared/entities";
import type { Sprint } from "@decocms/shared/sprints";
import type { ComponentType } from "react";
Expand All @@ -28,6 +28,7 @@ import type { TranslationKey } from "@/i18n/use-t.ts";
export {
DEFAULT_TASK_TYPE,
SUPER_AGENT_ASSIGNEE_ID,
isDeliveryLane,
nextTagColor,
} from "@decocms/shared/task-board";

Expand Down Expand Up @@ -308,11 +309,6 @@ export const TASK_TYPE_CONFIG: Record<
},
};

/** True for one of the post-merge delivery lanes. */
export function isDeliveryLane(status: TaskBoardItemStatus): boolean {
return (DELIVERY_LANES as string[]).includes(status);
}

/**
* Lanes a card may be MOVED to — "Move to", the status dropdown, drag targets.
* With the delivery lanes off they aren't offered, so nobody can put a card
Expand Down
9 changes: 9 additions & 0 deletions packages/shared/src/task-board.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ export const DELIVERY_LANES: DeliveryLane[] = [
"post_deploy_validation",
];

/** True for one of the post-merge delivery lanes (Approved, Merged, Post-deploy
* Validation) — the statuses that only exist for an org running
* `delivery_lanes_enabled`. Single home for both api (`tools/task-board/lanes.ts`)
* and web (`layouts/task-board/config.tsx`), which used to define this
* identically on each side. */
export function isDeliveryLane(status: string): boolean {
return (DELIVERY_LANES as string[]).includes(status);
}

/** True when this org runs the delivery lanes. Off by default. */
export function deliveryLanesEnabled(
flags: Record<string, unknown> | null | undefined,
Expand Down
Loading