From 7f3343f273e527dab97d35eddff496aaa9a6f371 Mon Sep 17 00:00:00 2001 From: ian12-21 Date: Thu, 26 Mar 2026 10:51:56 +0100 Subject: [PATCH] added package to json and intent files --- registry/index.json | 5 + .../app.task-manager.contract.intent | 143 +++++++++++++++ .../app.task-manager/app.task-manager.intent | 173 ++++++++++++++++++ .../app.task-manager.view.intent | 68 +++++++ 4 files changed, 389 insertions(+) create mode 100644 registry/packages/app.task-manager/app.task-manager.contract.intent create mode 100644 registry/packages/app.task-manager/app.task-manager.intent create mode 100644 registry/packages/app.task-manager/app.task-manager.view.intent diff --git a/registry/index.json b/registry/index.json index b4fa255..f4ffec1 100644 --- a/registry/index.json +++ b/registry/index.json @@ -30,6 +30,11 @@ "name": "tool.pixelart", "version": "1.5", "entry": "registry/packages/tool.pixelart/tool.pixelart.intent" + }, + { + "name": "app.task-manager", + "version": "1.4", + "entry": "registry/packages/app.task-manager/app.task-manager.intent" } ] } diff --git a/registry/packages/app.task-manager/app.task-manager.contract.intent b/registry/packages/app.task-manager/app.task-manager.contract.intent new file mode 100644 index 0000000..868b313 --- /dev/null +++ b/registry/packages/app.task-manager/app.task-manager.contract.intent @@ -0,0 +1,143 @@ +AIM: app.task-manager#contract@1.4 + +CONTRACT CreateSection { + SUMMARY: "Creates a new Section with a name and theme color." + INPUT { + name: string required + color: string required + } + EXPECTS { + - "Name must be unique and non-empty." + - "Color must be valid hex." + } + ENSURES { + - CALLS "Flow.ValidateSectionInput" + - PERSISTS "Schema.Section with generated sec_ prefixed id" + - CALLS "Flow.PersistState" + } + RETURNS { + - "The created Section" + } +} + +CONTRACT UpdateSection { + SUMMARY: "Updates an existing Section's name and/or color." + INPUT { + sectionId: string required + name: string required + color: string required + } + EXPECTS { + - "Section must exist." + - "If name changes, new name must be unique." + } + ENSURES { + - CALLS "Flow.ValidateSectionInput" + - UPDATES "Schema.Section" + - CALLS "Flow.PersistState" + } + RETURNS { + - "The updated Section" + } +} + +CONTRACT DeleteSection { + SUMMARY: "Deletes a Section and all Tasks belonging to it." + INPUT { + sectionId: string required + } + EXPECTS { + - "Section must exist." + } + ENSURES { + - DELETES "All Schema.Task WHERE sectionId matches" + - DELETES "Schema.Section" + - CALLS "Flow.PersistState" + } + RETURNS { + - "Deletion confirmation" + } +} + +CONTRACT CreateTask { + SUMMARY: "Creates a new Task within a Section at a given Kanban status." + INPUT { + sectionId: string required + title: string required + status: string optional + deadline: datetime optional + } + EXPECTS { + - "Title must be non-empty." + - "Section must exist." + - "Status defaults to todo if not provided." + } + ENSURES { + - CALLS "Flow.ValidateTaskInput" + - PERSISTS "Schema.Task with generated task_ prefixed id and createdAt set to now" + - CALLS "Flow.PersistState" + } + RETURNS { + - "The created Task" + } +} + +CONTRACT UpdateTask { + SUMMARY: "Updates a Task's title, deadline, status, or section from the edit popup." + INPUT { + taskId: string required + title: string optional + sectionId: string optional + status: string optional + deadline: datetime optional + } + EXPECTS { + - "Task must exist." + - "Title must be non-empty if provided." + - "Deadline must be in the future if changed." + } + ENSURES { + - CALLS "Flow.ValidateTaskInput" + - UPDATES "Schema.Task" + - CALLS "Flow.PersistState" + } + RETURNS { + - "The updated Task" + } +} + +CONTRACT UpdateTaskStatus { + SUMMARY: "Updates a Task's status when dragged between Kanban columns." + INPUT { + taskId: string required + status: string required + } + EXPECTS { + - "Task must exist." + - "New status must be one of: todo, in-progress, done." + } + ENSURES { + - UPDATES "Schema.Task.status" + - CALLS "Flow.PersistState" + } + RETURNS { + - "The updated Task" + } +} + +CONTRACT DeleteTask { + SUMMARY: "Deletes a single Task by its ID." + INPUT { + taskId: string required + } + EXPECTS { + - "Task must exist." + } + ENSURES { + - DELETES "Schema.Task" + - CALLS "Flow.PersistState" + } + RETURNS { + - "Deletion confirmation" + } +} diff --git a/registry/packages/app.task-manager/app.task-manager.intent b/registry/packages/app.task-manager/app.task-manager.intent new file mode 100644 index 0000000..c79ee1f --- /dev/null +++ b/registry/packages/app.task-manager/app.task-manager.intent @@ -0,0 +1,173 @@ +AIM: app.task-manager#intent@1.4 + +INTENT DesktopPlanner { + SUMMARY: "A specialized desktop Kanban and Task Management application. Users categorize tasks into colored Sections (e.g., Work, Car, House), view them in a global Kanban board, or filter by specific sections. State is persisted to a local data.json file." + REQUIREMENTS { + - "User can create, read, update, and delete custom Sections with a name and theme color." + - "User can create tasks assigned to a Section with a title and status (todo, in-progress, done)." + - "Tasks are displayed on a Kanban board with three columns: To Do, In Progress, Done." + - "Tasks can be dragged between Kanban columns to update their status." + - "A sidebar lists all Sections and provides an All Tasks global view." + - "Clicking a Section in the sidebar filters the dashboard to show only that Section's tasks." + - "Each task card displays a visual color indicator (4px left-border) matching its parent Section color." + - "A dynamic toolbar displays a time-based greeting: Good morning (05:00-11:59), Good afternoon (12:00-17:59), Good evening (18:00-04:59), followed by the user name Ian." + - "If zero Sections exist, the main dashboard is hidden and replaced by a welcome prompt: Welcome! Create your first section in the sidebar to get started." + - "Inline task creation is available via a + button on each Kanban column header, auto-assigning the task to the active Section and that column's status." + - "A scrollable task listing panel sits beside the Kanban board showing all tasks in the current filter with title and colored Section badge." + - "All application state is saved to and loaded from a local data.json file." + } + + SCHEMA Section { + SUMMARY: "Represents a user-defined task category with a theme color." + REQUIREMENTS { + - "Section name must be non-empty and unique." + - "Color must be a valid hex color string." + } + + ATTRIBUTES { + id: string required generated immutable pattern("^sec_[0-9]+$") + name: string required min(1) max(100) unique + color: string required pattern("^#[0-9a-fA-F]{6}$") + } + } + + SCHEMA Task { + SUMMARY: "Represents a single task belonging to a Section with a Kanban status." + REQUIREMENTS { + - "Task must belong to an existing Section." + - "Status must be one of: todo, in-progress, done." + - "Title must be non-empty." + - "Deadline is optional but when set must be a future date at creation time." + - "Progress percentage is derived: (now - createdAt) / (deadline - createdAt) * 100, clamped 0-100." + } + + ATTRIBUTES { + id: string required generated immutable pattern("^task_[0-9]+$") + sectionId: string required reference(Section.id) + title: string required min(1) max(255) + status: string required enum("todo", "in-progress", "done") default("todo") + deadline: datetime optional + createdAt: datetime required generated immutable + } + } + + FLOW ValidateSectionInput { + SUMMARY: "Validates Section name uniqueness and color format before persistence." + REQUIREMENTS { + - "Reject empty or duplicate Section names." + - "Reject invalid hex color values." + } + + TRIGGER: Contract.CreateSection + STEPS { + - "Trim Section name input." + - "REQUIRES trimmed name length > 0." + - "REQUIRES name is unique among existing Sections." + - "REQUIRES color matches hex pattern #RRGGBB." + } + } + + FLOW ValidateTaskInput { + SUMMARY: "Validates Task title, deadline, and ensures the referenced Section exists." + REQUIREMENTS { + - "Reject empty task titles." + - "Reject references to non-existent Sections." + - "If deadline is provided, it must be in the future at creation time." + } + + TRIGGER: Contract.CreateTask, Contract.UpdateTask + STEPS { + - "Trim Task title input." + - "REQUIRES trimmed title length > 0." + - "REQUIRES sectionId references an existing Schema.Section." + - "IF deadline is provided: REQUIRES deadline > now." + } + } + + FLOW ComputeDeadlineProgress { + SUMMARY: "Computes the percentage of elapsed time between task creation and its deadline." + REQUIREMENTS { + - "Returns null if no deadline is set." + - "Clamps result between 0 and 100." + - "Returns 100 if current time is past the deadline." + } + + TRIGGER: View.Dashboard.Render, View.TaskDetail.Render + STEPS { + - "IF Task.deadline is null: RETURN null." + - "Compute elapsed = now - Task.createdAt." + - "Compute total = Task.deadline - Task.createdAt." + - "Compute progress = (elapsed / total) * 100." + - "Clamp progress to range 0-100." + - "RETURN progress as integer." + } + } + + FLOW PersistState { + SUMMARY: "Writes the current Sections and Tasks arrays to data.json on every mutation." + REQUIREMENTS { + - "File is written atomically to prevent corruption." + - "JSON structure matches the defined schema with sections and tasks arrays." + } + + TRIGGER: Contract.CreateSection, Contract.UpdateSection, Contract.DeleteSection, Contract.CreateTask, Contract.UpdateTask, Contract.UpdateTaskStatus, Contract.DeleteTask + STEPS { + - "Serialize current Sections and Tasks arrays to JSON." + - "Write JSON to data.json in project directory." + } + ON_ERROR { + - "Log write failure and return error to caller." + } + } + + FLOW LoadState { + SUMMARY: "Reads Sections and Tasks from data.json on application startup." + REQUIREMENTS { + - "If data.json does not exist, initialize with empty sections and tasks arrays." + - "If data.json is malformed, initialize with empty state and log warning." + } + + TRIGGER: Application.Init + STEPS { + - "Check if data.json exists at project path." + - "IF exists: parse JSON and load into Schema.Section and Schema.Task arrays." + - "IF not exists: initialize empty state and create data.json." + } + ON_ERROR { + - "Initialize empty state and log warning about malformed data.json." + } + } + + FLOW ResolveGreeting { + SUMMARY: "Determines the dynamic greeting based on current time of day." + REQUIREMENTS { + - "Greeting changes based on hour: morning (05-11), afternoon (12-17), evening (18-04)." + } + + TRIGGER: View.Toolbar.Render + STEPS { + - "Get current hour from system clock." + - "IF hour >= 5 AND hour <= 11: RETURN Good morning." + - "IF hour >= 12 AND hour <= 17: RETURN Good afternoon." + - "ELSE: RETURN Good evening." + } + } + + PERSONA Owner { + SUMMARY: "The sole user (Ian) who manages all Sections and Tasks." + ROLE { + - "user:owner" + } + ACCESS { + - VIEW Toolbar + - VIEW Sidebar + - VIEW Dashboard + - VIEW TaskDetail + } + } +} + +INCLUDES { + contract: "app.task-manager.contract.intent" + view: "app.task-manager.view.intent" +} diff --git a/registry/packages/app.task-manager/app.task-manager.view.intent b/registry/packages/app.task-manager/app.task-manager.view.intent new file mode 100644 index 0000000..4a18dcd --- /dev/null +++ b/registry/packages/app.task-manager/app.task-manager.view.intent @@ -0,0 +1,68 @@ +AIM: app.task-manager#view@1.4 + +VIEW Toolbar { + SUMMARY: "Fixed top toolbar displaying a time-based personalized greeting." + DISPLAY { + - "greeting as centered-text: Flow.ResolveGreeting + ', Ian'" + } + ACTIONS {} +} + +VIEW Sidebar { + SUMMARY: "Left sidebar for Section management and navigation." + DISPLAY { + - "button: All Tasks (default active)" + - "list: Section" + - "Section.name as primary" + - "Section.color as color-indicator" + - "form.create: [name, color]" + - "color as color-picker" + } + ACTIONS { + - "Select All Tasks -> filter dashboard to all" + - "Select Section -> filter dashboard by Section.id" + - "Create Section -> CALL CreateSection" + - "Edit Section -> CALL UpdateSection" + - "Delete Section -> CALL DeleteSection" + } +} + +VIEW Dashboard { + SUMMARY: "Dual-view main area with a scrollable task list and a three-column Kanban board." + DISPLAY { + - "empty-state: 'Welcome! Create your first section in the sidebar to get started.' WHEN Section.count == 0" + - "panel.task-list: Task[]" + - "Task.title as primary" + - "Task.sectionId -> Section.color as badge" + - "kanban.columns: [todo, in-progress, done]" + - "kanban.card: Task" + - "Task.title as card-title" + - "Task.sectionId -> Section.color as left-border(4px)" + - "Task.deadline -> Flow.ComputeDeadlineProgress as progress-bar(color-coded)" + - "kanban.column-header: + button for inline creation" + } + ACTIONS { + - "Inline Create Task -> CALL CreateTask" + - "Drag Task to Column -> CALL UpdateTaskStatus" + - "Click Task Card -> open View.TaskDetail" + - "Delete Task -> CALL DeleteTask" + } +} + +VIEW TaskDetail { + SUMMARY: "Modal popup for viewing and editing a single Task's details." + DISPLAY { + - "form.edit: [title, sectionId, status, deadline]" + - "title as text-input" + - "sectionId as dropdown(Section.name)" + - "status as dropdown(todo, in-progress, done)" + - "deadline as date-picker" + - "Task.deadline -> Flow.ComputeDeadlineProgress as progress-bar(color-coded)" + - "createdAt as read-only relative-date" + } + ACTIONS { + - "Save -> CALL UpdateTask" + - "Delete -> CALL DeleteTask" + - "Cancel -> close popup" + } +}