From cbe2e1068d7301a73c8a33519921215d12c99d27 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Sat, 24 Jan 2026 16:59:22 +0200 Subject: [PATCH] feat: Add more link types to task system New link types added: - depends_on: Task depends on another task to complete first - needs: Task needs another task (weaker dependency) - implements: Task implements a feature/requirement - fixes: Task fixes an issue identified in another task - causes: Task causes/introduces issue in another task - subtask_of: Task is a subtask of another (parent-child) Preserves existing types: blocks, relates_to, duplicates Changes: - Migration 021 updates database constraint - Updated TypeScript types and MCP tool schema - Applied to production database Implements CF-385 Co-Authored-By: Claude Sonnet 4.5 --- migrations/021_add_link_types.sql | 39 +++++++++++++++++++++++++++++++ src/tools/index.ts | 2 +- src/types.ts | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 migrations/021_add_link_types.sql diff --git a/migrations/021_add_link_types.sql b/migrations/021_add_link_types.sql new file mode 100644 index 0000000..2ddece4 --- /dev/null +++ b/migrations/021_add_link_types.sql @@ -0,0 +1,39 @@ +-- Migration 021: Add more link types to task_links table +-- CF-385: Add more link types to task system (needs, depends_on, etc.) +-- +-- New link types: +-- depends_on - Task depends on another task to complete first +-- needs - Task needs another task (similar to depends_on but weaker) +-- implements - Task implements a feature/requirement from another task +-- fixes - Task fixes an issue identified in another task +-- causes - Task causes/introduces issue in another task +-- subtask_of - Task is a subtask of another (parent-child relationship) +-- +-- Existing types preserved: +-- blocks - Task blocks another task +-- relates_to - Generic relationship +-- duplicates - Task is a duplicate of another + +-- Drop existing constraint +ALTER TABLE task_links DROP CONSTRAINT IF EXISTS task_links_link_type_check; + +-- Add new constraint with extended link types +ALTER TABLE task_links ADD CONSTRAINT task_links_link_type_check + CHECK (link_type IN ( + 'blocks', + 'relates_to', + 'duplicates', + 'depends_on', + 'needs', + 'implements', + 'fixes', + 'causes', + 'subtask_of' + )); + +-- Add comments for documentation +COMMENT ON COLUMN task_links.link_type IS 'Type of relationship between tasks: blocks, relates_to, duplicates, depends_on, needs, implements, fixes, causes, subtask_of (CF-385)'; + +-- Record migration +INSERT INTO schema_migrations (version, applied_at) VALUES ('021_add_link_types', NOW()) +ON CONFLICT DO NOTHING; diff --git a/src/tools/index.ts b/src/tools/index.ts index bd63dae..e256010 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -133,7 +133,7 @@ export const toolDefinitions = [ properties: { from_id: { type: 'string', description: 'Source task ID' }, to_id: { type: 'string', description: 'Target task ID' }, - link_type: { type: 'string', enum: ['blocks', 'relates_to', 'duplicates'], description: 'Relationship type' }, + link_type: { type: 'string', enum: ['blocks', 'relates_to', 'duplicates', 'depends_on', 'needs', 'implements', 'fixes', 'causes', 'subtask_of'], description: 'Relationship type' }, }, required: ['from_id', 'to_id', 'link_type'], }, diff --git a/src/types.ts b/src/types.ts index 7fa4c4c..8deb41f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -36,7 +36,7 @@ export interface TaskLink { id: number; from_task_id: string; to_task_id: string; - link_type: 'blocks' | 'relates_to' | 'duplicates'; + link_type: 'blocks' | 'relates_to' | 'duplicates' | 'depends_on' | 'needs' | 'implements' | 'fixes' | 'causes' | 'subtask_of'; created_at: Date; }