From b474f7067a026ddeb9e24b423d1023dc7c078e7f Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 13 Mar 2026 11:01:25 +0800 Subject: [PATCH] docs(quick-1): Create start.sh with development menu - Interactive menu for dev, test, build, preview, lint, clean, install - Auto-installs dependencies if missing - Supports direct command-line arguments --- .planning/STATE.md | 8 +- .../1-PLAN.md | 35 ++++++ .../1-SUMMARY.md | 44 +++++++ start.sh | 114 ++++++++++++++++++ 4 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 .planning/quick/1-create-start-sh-script-with-menu-for-tes/1-PLAN.md create mode 100644 .planning/quick/1-create-start-sh-script-with-menu-for-tes/1-SUMMARY.md create mode 100755 start.sh diff --git a/.planning/STATE.md b/.planning/STATE.md index 9ef06b33b..f10cae856 100644 --- a/.planning/STATE.md +++ b/.planning/STATE.md @@ -98,6 +98,12 @@ None yet - project initialization complete. None - ready to begin Phase 1 planning. +### Quick Tasks Completed + +| # | Description | Date | Commit | Directory | +|---|-------------|------|--------|-----------| +| 1 | Create start.sh script with menu for test, dev, etc. | 2026-03-13 | - | [1-create-start-sh-script-with-menu-for-tes](./quick/1-create-start-sh-script-with-menu-for-tes/) | + --- ## Session Continuity @@ -126,4 +132,4 @@ None - ready to begin Phase 1 planning. --- -*Last updated: 2026-03-13 - Roadmap created, ready to begin Phase 1* +*Last updated: 2026-03-13 - Completed quick task 1: start.sh script* diff --git a/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-PLAN.md b/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-PLAN.md new file mode 100644 index 000000000..0364f9680 --- /dev/null +++ b/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-PLAN.md @@ -0,0 +1,35 @@ +--- +plan: 1 +type: quick +files_modified: + - start.sh +--- + + +Create a start.sh script in project root with interactive menu for common npm commands (test, dev, build, etc.) + + + + + +Create start.sh with menu +start.sh + +1. Create start.sh in project root with: + - Interactive menu using select/case + - Options: dev, test, build, preview, lint, clean + - Clear descriptions for each option + - Exit on any key to cancel +2. Make script executable: chmod +x start.sh + +ls -la start.sh && head -30 start.sh +start.sh created with executable permissions + + + + + +- start.sh exists and is executable +- Menu shows at least 5 options +- Running ./start.sh shows the menu + diff --git a/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-SUMMARY.md b/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-SUMMARY.md new file mode 100644 index 000000000..03a048f81 --- /dev/null +++ b/.planning/quick/1-create-start-sh-script-with-menu-for-tes/1-SUMMARY.md @@ -0,0 +1,44 @@ +# Quick Task 1 Summary - Create start.sh + +**Task:** Create start.sh script with menu for test, dev, etc. +**Date:** 2026-03-13 +**Status:** Complete + +--- + +## Completed + +### Task 1: Create start.sh with menu + +- Created `start.sh` in project root +- Made executable with `chmod +x` +- Menu options: + 1. `dev` - Start development server + 2. `test` - Run tests + 3. `test:watch` - Run tests in watch mode + 4. `build` - Build for production + 5. `preview` - Preview production build + 6. `lint` - Run linter + 7. `clean` - Clean build artifacts + 8. `install` - Install dependencies + 0. `Exit` + +- Features: + - Interactive colored menu + - Auto-installs dependencies if missing + - Accepts command-line arguments (e.g., `./start.sh test`) + - Runs from sample_interface directory + +--- + +## Usage + +```bash +# Interactive menu +./start.sh + +# Direct commands +./start.sh dev +./start.sh test +./start.sh build +``` diff --git a/start.sh b/start.sh new file mode 100755 index 000000000..f6c8c5e77 --- /dev/null +++ b/start.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +# TCK RTU - Start Script +# Interactive menu for common development commands + +set -e + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +CYAN='\033[0;36m' +NC='\033[0m' # No Color +BOLD='\033[1m' + +# Project directory +PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/sample_interface" && pwd)" + +echo -e "${CYAN}${BOLD}" +echo "╔══════════════════════════════════════════════════════╗" +echo "║ TCK RTU - Development Menu ║" +echo "╚══════════════════════════════════════════════════════╝" +echo -e "${NC}" + +show_menu() { + echo -e "${BOLD}Select an option:${NC}" + echo "" + echo -e " ${GREEN}1)${NC} dev Start development server" + echo -e " ${GREEN}2)${NC} test Run tests" + echo -e " ${GREEN}3)${NC} test:watch Run tests in watch mode" + echo -e " ${GREEN}4)${NC} build Build for production" + echo -e " ${GREEN}5)${NC} preview Preview production build" + echo -e " ${GREEN}6)${NC} lint Run linter" + echo -e " ${GREEN}7)${NC} clean Clean build artifacts" + echo -e " ${GREEN}8)${NC} install Install dependencies" + echo "" + echo -e " ${RED}0)${NC} Exit" + echo "" +} + +run_command() { + local option=$1 + cd "$PROJECT_DIR" + + case $option in + 1|dev) + echo -e "${BLUE}Starting development server...${NC}" + npm run dev + ;; + 2|test) + echo -e "${BLUE}Running tests...${NC}" + npm test + ;; + 3|test:watch) + echo -e "${BLUE}Running tests in watch mode...${NC}" + npm run test:watch + ;; + 4|build) + echo -e "${BLUE}Building for production...${NC}" + npm run build + echo -e "${GREEN}Build complete!${NC}" + ;; + 5|preview) + echo -e "${BLUE}Previewing production build...${NC}" + npm run preview + ;; + 6|lint) + echo -e "${BLUE}Running linter...${NC}" + npm run lint + ;; + 7|clean) + echo -e "${YELLOW}Cleaning build artifacts...${NC}" + rm -rf "$PROJECT_DIR/dist" + rm -rf "$PROJECT_DIR/node_modules/.vite" + echo -e "${GREEN}Clean complete!${NC}" + ;; + 8|install) + echo -e "${BLUE}Installing dependencies...${NC}" + npm install + echo -e "${GREEN}Dependencies installed!${NC}" + ;; + 0|exit) + echo -e "${GREEN}Goodbye!${NC}" + exit 0 + ;; + *) + echo -e "${RED}Invalid option. Please try again.${NC}" + ;; + esac +} + +# Check if dependencies are installed +if [ ! -d "$PROJECT_DIR/node_modules" ]; then + echo -e "${YELLOW}Dependencies not found. Running npm install...${NC}" + cd "$PROJECT_DIR" + npm install +fi + +# If arguments provided, run directly +if [ $# -gt 0 ]; then + run_command "$1" + exit 0 +fi + +# Interactive menu +while true; do + show_menu + echo -n -e "${BOLD}Enter your choice (0-8): ${NC}" + read -r choice + echo "" + run_command "$choice" + echo "" +done