[PR #636] [CLOSED] refactor: centralize todo status and priority enums #9670

Closed
opened 2026-02-16 18:13:57 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/636
Author: @salignatmoandal
Created: 7/3/2025
Status: Closed

Base: devHead: refactor/centralize-to-do-enums


📝 Commits (1)

  • 53b70ad refactor: centralize todo status and priority enums

📊 Changes

2 files changed (+18 additions, -11 deletions)

View changed files

📝 packages/opencode/src/tool/todo.ts (+1 -11)
packages/opencode/src/util/schema.ts (+17 -0)

📄 Description

refactor: centralize todo status and priority enums

Description

This PR centralizes the Zod enums for todo status and priority into a single shared file (src/util/schemas.ts).
The goal is to avoid duplication, improve maintainability, and ensure consistency across the codebase.

Changes

  • Created src/util/schemas.ts to export:
  • StatusEnum (pending, in_progress, completed)
  • PriorityEnum (high, medium, low)
  • (Optionally) a shared TodoInfo schema and types
  • Updated src/tool/todo.ts to import and use these enums instead of local definitions.
  • Updated TypeScript types to use z.infer and z.infer.

Motivation

  • Single source of truth for todo status and priority values.
  • Easier future changes: adding or renaming a status/priority only requires editing one file.
  • Consistency: all modules use the exact same validation and types.

Checklist

  • All usages of todo status and priority enums in src/tool/todo.ts now use the shared enums.
  • Types are inferred from Zod schemas.
  • All tests pass (bun test).
  • Code style and conventions follow the project’s AGENTS.md guidelines.

Notes

  • This PR is limited to the todo tool. If similar enums are found elsewhere, a follow-up PR can further centralize them.
  • Please let me know if you prefer the shared TodoInfo schema to be used in other modules as well.

Thank you for reviewing!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/636 **Author:** [@salignatmoandal](https://github.com/salignatmoandal) **Created:** 7/3/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `refactor/centralize-to-do-enums` --- ### 📝 Commits (1) - [`53b70ad`](https://github.com/anomalyco/opencode/commit/53b70ad94e8d1e751120f793a6fbde3bceee3691) refactor: centralize todo status and priority enums ### 📊 Changes **2 files changed** (+18 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/tool/todo.ts` (+1 -11) ➕ `packages/opencode/src/util/schema.ts` (+17 -0) </details> ### 📄 Description ### refactor: centralize todo status and priority enums #### Description This PR centralizes the Zod enums for todo status and priority into a single shared file (src/util/schemas.ts). The goal is to avoid duplication, improve maintainability, and ensure consistency across the codebase. #### Changes - Created src/util/schemas.ts to export: - StatusEnum (pending, in_progress, completed) - PriorityEnum (high, medium, low) - (Optionally) a shared TodoInfo schema and types - Updated src/tool/todo.ts to import and use these enums instead of local definitions. - Updated TypeScript types to use z.infer<typeof StatusEnum> and z.infer<typeof PriorityEnum>. #### Motivation - Single source of truth for todo status and priority values. - Easier future changes: adding or renaming a status/priority only requires editing one file. - Consistency: all modules use the exact same validation and types. #### Checklist - [x] All usages of todo status and priority enums in src/tool/todo.ts now use the shared enums. - [x] Types are inferred from Zod schemas. - [x] All tests pass (bun test). - [x] Code style and conventions follow the project’s AGENTS.md guidelines. #### Notes - This PR is limited to the todo tool. If similar enums are found elsewhere, a follow-up PR can further centralize them. - Please let me know if you prefer the shared TodoInfo schema to be used in other modules as well. --- > Thank you for reviewing! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:13:57 -05:00
yindo closed this issue 2026-02-16 18:13:57 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9670