router.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/usr/bin/env bash
  2. #############################################################################
  3. # Task Management Skill Router
  4. # Routes to task-cli.ts with proper path resolution and command handling
  5. #############################################################################
  6. set -e
  7. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  8. CLI_SCRIPT="$SCRIPT_DIR/scripts/task-cli.ts"
  9. # Show help
  10. show_help() {
  11. cat << 'HELP'
  12. 📋 Task Management Skill
  13. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  14. Usage: router.sh [COMMAND] [OPTIONS]
  15. COMMANDS:
  16. status [feature] Show task status summary
  17. next [feature] Show next eligible tasks
  18. parallel [feature] Show parallelizable tasks
  19. deps <feature> <seq> Show dependency tree
  20. blocked [feature] Show blocked tasks
  21. complete <feature> <seq> "msg" Mark subtask complete
  22. validate [feature] Validate JSON files
  23. help Show this help message
  24. EXAMPLES:
  25. ./router.sh status
  26. ./router.sh status my-feature
  27. ./router.sh next
  28. ./router.sh deps my-feature 05
  29. ./router.sh complete my-feature 05 "Implemented auth module"
  30. ./router.sh validate
  31. FEATURES:
  32. ✓ Track progress across all features
  33. ✓ Find next eligible tasks (dependencies satisfied)
  34. ✓ Identify blocked tasks
  35. ✓ Mark subtasks complete with summaries
  36. ✓ Validate task integrity
  37. For more info, see: .opencode/skill/task-management/SKILL.md
  38. HELP
  39. }
  40. # Check if CLI script exists
  41. if [ ! -f "$CLI_SCRIPT" ]; then
  42. echo "❌ Error: task-cli.ts not found at $CLI_SCRIPT"
  43. exit 1
  44. fi
  45. # Find project root
  46. find_project_root() {
  47. local dir
  48. dir="$(pwd)"
  49. while [ "$dir" != "/" ]; do
  50. if [ -d "$dir/.git" ] || [ -f "$dir/package.json" ]; then
  51. echo "$dir"
  52. return 0
  53. fi
  54. dir="$(dirname "$dir")"
  55. done
  56. pwd
  57. return 1
  58. }
  59. # Handle help
  60. if [ "$1" = "help" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
  61. show_help
  62. exit 0
  63. fi
  64. # If no arguments, show help
  65. if [ $# -eq 0 ]; then
  66. show_help
  67. exit 0
  68. fi
  69. PROJECT_ROOT="$(find_project_root)"
  70. # Run the task CLI with all arguments
  71. cd "$PROJECT_ROOT" && npx ts-node "$CLI_SCRIPT" "$@"