RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/Cursor rules/madebyaris/poinf-of-sales

Cursor rule

.cursor/rules/makefile-scripting.mdc

Makefile and shell scripting patterns for POS System development workflow

Cursor rules

Quality

81/100

Scores the file, not the repository.

Length

1,151 words

72 headings · 24 code blocks

Repository

118

— · pushed 339 days ago

Last changed

3 days ago

First indexed 3 days ago.
madebyaris/poinf-of-sales/.cursor/rules/makefile-scripting.mdcRawGitHub
1---
2globs: Makefile,*.mk,*.sh
3description: Makefile and shell scripting patterns for POS System development workflow
4---
5 
6# Makefile & Shell Scripting Guidelines
7 
8## Makefile Structure
9 
10### Main Makefile Organization
11Follow the patterns established in [Makefile](mdc:Makefile):
12 
13### Standard Makefile Headers
14```makefile
15# POS System - Development Makefile
16# Usage: make <command>
17 
18.PHONY: help dev prod up down build logs clean backup restore create-admin remove-data db-shell test lint format
19 
20# Default target
21.DEFAULT_GOAL := help
22 
23# Colors for output
24GREEN := \033[0;32m
25YELLOW := \033[0;33m
26RED := \033[0;31m
27BLUE := \033[0;34m
28NC := \033[0m # No Color
29```
30 
31### Command Categories
32Organize commands into logical groups:
331. **Development Commands** - dev, prod, up, down, restart, build
342. **Database Commands** - create-admin, remove-data, backup, restore, db-shell, db-reset
353. **Utility Commands** - logs, status, clean, test, lint, format
364. **Quick Shortcuts** - start, stop, install
37 
38### Help System Pattern
39```makefile
40## Help - Display available commands
41help:
42 @echo "$(BLUE)POS System - Available Make Commands$(NC)"
43 @echo ""
44 @echo "$(GREEN)Development Commands:$(NC)"
45 @echo " make dev - Start development environment with hot reloading"
46 # ... more help text
47```
48 
49## Docker Integration
50 
51### Docker Compose File Selection
52```makefile
53# Docker compose files
54COMPOSE_DEV := docker-compose.dev.yml
55COMPOSE_PROD := docker-compose.yml
56 
57# Development environment
58dev:
59 @docker compose -f $(COMPOSE_DEV) up --build
60 
61# Production environment
62prod:
63 @docker compose -f $(COMPOSE_PROD) up -d --build
64```
65 
66### Container Management
67```makefile
68# Check container status before operations
69up:
70 @echo "$(GREEN)⬆️ Starting Docker containers...$(NC)"
71 @docker compose -f $(COMPOSE_DEV) up -d
72 @echo "$(GREEN)✅ Containers started in background$(NC)"
73 
74down:
75 @echo "$(YELLOW)⬇️ Stopping Docker containers...$(NC)"
76 @docker compose -f $(COMPOSE_DEV) down
77 @docker compose -f $(COMPOSE_PROD) down 2>/dev/null || true
78 @echo "$(GREEN)✅ Containers stopped$(NC)"
79```
80 
81## Shell Script Patterns
82 
83### Script Structure
84Follow the patterns from [scripts/](mdc:scripts/) directory:
85 
86### Standard Script Headers
87```bash
88#!/bin/bash
89 
90# Script Description
91# Brief description of what this script does
92
93set -e # Exit on any error
94 
95# Colors
96GREEN='\033[0;32m'
97YELLOW='\033[0;33m'
98RED='\033[0;31m'
99BLUE='\033[0;34m'
100NC='\033[0m' # No Color
101```
102 
103### Container Detection Pattern
104```bash
105# Check if database container is running
106CONTAINER_NAME=&quot;pos-postgres-dev&quot;
107if ! docker ps --format '{{.Names}}' | grep -q &quot;^${CONTAINER_NAME}$&quot;; then
108 CONTAINER_NAME=&quot;pos-postgres&quot;
109 if ! docker ps --format '{{.Names}}' | grep -q &quot;^${CONTAINER_NAME}$&quot;; then
110 echo -e &quot;${RED}❌ Database container is not running!${NC}&quot;
111 echo -e &quot;${YELLOW}Please run 'make up' or 'make dev' first.${NC}&quot;
112 exit 1
113 fi
114fi
115```
116 
117### User Input Validation
118```bash
119# Safe user input with validation
120read -p &quot;Username: &quot; USERNAME
121while [[ -z &quot;$USERNAME&quot; ]]; do
122 echo -e &quot;${RED}Username cannot be empty!${NC}&quot;
123 read -p &quot;Username: &quot; USERNAME
124done
125 
126# Hidden password input
127echo -n &quot;Password: &quot;
128read -s PASSWORD
129echo &quot;&quot;
130```
131 
132### Confirmation Patterns
133```bash
134# Multiple confirmation levels for destructive operations
135echo -e &quot;${RED}⚠️ WARNING: This will DELETE ALL DATA!${NC}&quot;
136echo -e &quot;${YELLOW}Type 'DELETE ALL DATA' to confirm (case sensitive):${NC}&quot;
137read -p &quot;&gt; &quot; FINAL_CONFIRMATION
138
139if [[ &quot;$FINAL_CONFIRMATION&quot; != &quot;DELETE ALL DATA&quot; ]]; then
140 echo -e &quot;${BLUE}❌ Operation cancelled. Data is safe.${NC}&quot;
141 exit 0
142fi
143```
144 
145### Database Operations
146```bash
147# Database backup with error handling
148echo -e &quot;${YELLOW}💾 Creating backup...${NC}&quot;
149DB_BACKUP_FILE=&quot;${BACKUP_DIR}/${BACKUP_NAME}_database.sql&quot;
150
151docker exec $CONTAINER_NAME pg_dump \
152 -U postgres \
153 -d pos_system \
154 --clean \
155 --if-exists \
156 --create \
157 --verbose \
158 --format=plain &gt; $DB_BACKUP_FILE
159
160if [[ $? -eq 0 ]]; then
161 DB_SIZE=$(du -h $DB_BACKUP_FILE | cut -f1)
162 echo -e &quot;${GREEN}✅ Database backup created: $DB_BACKUP_FILE ($DB_SIZE)${NC}&quot;
163else
164 echo -e &quot;${RED}❌ Database backup failed!${NC}&quot;
165 exit 1
166fi
167```
168 
169## Error Handling
170 
171### Comprehensive Error Checking
172```bash
173# Always check command success
174if [[ $? -eq 0 ]]; then
175 echo -e &quot;${GREEN}✅ Operation completed successfully!${NC}&quot;
176else
177 echo -e &quot;${RED}❌ Operation failed!${NC}&quot;
178 exit 1
179fi
180```
181 
182### Emergency Backup Pattern
183```bash
184# Create emergency backup before destructive operations
185EMERGENCY_BACKUP=&quot;$BACKUP_DIR/emergency_backup_$(date +%Y%m%d_%H%M%S).sql&quot;
186echo -e &quot;${BLUE}Creating emergency backup: $EMERGENCY_BACKUP${NC}&quot;
187docker exec $CONTAINER_NAME pg_dump -U postgres pos_system &gt; $EMERGENCY_BACKUP
188```
189 
190## File and Directory Management
191 
192### Backup Directory Structure
193```bash
194# Create backup directory if it doesn't exist
195BACKUP_DIR=&quot;backups&quot;
196mkdir -p $BACKUP_DIR
197 
198# Generate timestamp for backup files
199TIMESTAMP=$(date +&quot;%Y%m%d_%H%M%S&quot;)
200BACKUP_NAME=&quot;pos_backup_${TIMESTAMP}&quot;
201```
202 
203### File Size and Statistics
204```bash
205# Show file sizes and statistics
206if [[ -f &quot;$DB_BACKUP_FILE&quot; ]]; then
207 DB_SIZE=$(du -h $DB_BACKUP_FILE | cut -f1)
208 echo -e &quot;${GREEN}✅ Database backup: $DB_BACKUP_FILE ($DB_SIZE)${NC}&quot;
209fi
210 
211# Count records in database
212USER_COUNT=$(docker exec $CONTAINER_NAME psql -U postgres -d pos_system -tAc &quot;SELECT COUNT(*) FROM users;&quot;)
213echo &quot; Users: $USER_COUNT&quot;
214```
215 
216## Interactive Menus
217 
218### Backup Selection Menu
219```bash
220# List available backups with numbered selection
221BACKUP_FILES=()
222INDEX=1
223
224for file in $BACKUP_DIR/pos_backup_*_complete.tar.gz; do
225 if [[ -f &quot;$file&quot; ]]; then
226 echo &quot;$INDEX) $(basename &quot;$file&quot; .tar.gz)&quot;
227 echo &quot; Date: $READABLE_DATE&quot;
228 echo &quot; Size: $FILE_SIZE&quot;
229 BACKUP_FILES+=(&quot;$file&quot;)
230 ((INDEX++))
231 fi
232done
233 
234# Get user selection with validation
235read -p &quot;&gt; &quot; SELECTION
236if ! [[ &quot;$SELECTION&quot; =~ ^[0-9]+$ ]] || [[ $SELECTION -lt 1 ]] || [[ $SELECTION -gt ${#BACKUP_FILES[@]} ]]; then
237 echo -e &quot;${RED}❌ Invalid selection!${NC}&quot;
238 exit 1
239fi
240```
241 
242## Security Best Practices
243 
244### Safe SQL Operations
245```bash
246# Use proper SQL escaping and parameterization
247docker exec $CONTAINER_NAME psql -U postgres -d pos_system -c &quot;
248INSERT INTO users (username, email, password_hash, first_name, last_name, role, is_active)
249VALUES ('$USERNAME', '$EMAIL', '$TEMP_HASH', '$FIRST_NAME', '$LAST_NAME', 'admin', true);
250&quot;
251```
252 
253### Temporary File Handling
254```bash
255# Clean up temporary files
256TEMP_DIR=$(mktemp -d)
257# ... operations ...
258rm -rf &quot;$TEMP_DIR&quot;
259```
260 
261## Output Formatting
262 
263### Colored Output System
264- 🔴 `${RED}` - Errors, warnings, destructive operations
265- 🟡 `${YELLOW}` - Important information, confirmations
266- 🔵 `${BLUE}` - Informational messages, file paths
267- 🟢 `${GREEN}` - Success messages, completed operations
268 
269### Status Indicators
270```bash
271echo -e &quot;${GREEN}✅ Success${NC}&quot;
272echo -e &quot;${RED}❌ Error${NC}&quot;
273echo -e &quot;${YELLOW}⚠️ Warning${NC}&quot;
274echo -e &quot;${BLUE}ℹ️ Information${NC}&quot;
275```
276 
277### Progress Indicators
278```bash
279echo -e &quot;${YELLOW}🔄 Processing...${NC}&quot;
280echo -e &quot;${YELLOW}💾 Creating backup...${NC}&quot;
281echo -e &quot;${YELLOW}📥 Restoring data...${NC}&quot;
282echo -e &quot;${YELLOW}🗑️ Cleaning up...${NC}&quot;
283```
284 
285## Integration with Docker
286 
287### Container Health Checks
288```bash
289# Check if container is healthy
290if [ -z &quot;$(docker ps -q -f name=pos-postgres)&quot; ]; then
291 echo -e &quot;${RED}❌ Database container is not running!${NC}&quot;
292 exit 1
293fi
294```
295 
296### Docker Volume Operations
297```bash
298# Backup Docker volumes
299VOLUMES=$(docker volume ls --filter name=pos --format &quot;{{.Name}}&quot;)
300if [[ -n &quot;$VOLUMES&quot; ]]; then
301 docker run --rm -v pos-postgres-data:/data -v $(pwd)/${BACKUP_DIR}:/backup alpine sh -c &quot;cd /data && tar czf /backup/${BACKUP_NAME}_volumes.tar.gz .&quot;
302fi
303```
304 
305## Development Workflow Integration
306 
307### Environment File Creation
308```makefile
309dev:
310 @if [ ! -f .env ]; then \
311 echo "$(YELLOW)📝 Creating .env file...$(NC)"; \
312 cp .env.example .env 2>/dev/null || \
313 echo "DB_HOST=postgres\nDB_PORT=5432\nDB_USER=postgres\nDB_PASSWORD=postgres123\nDB_NAME=pos_system\nDB_SSLMODE=disable\nPORT=8080\nGIN_MODE=debug\nVITE_API_URL=http://localhost:8080" > .env; \
314 fi
315```
316 
317### Multi-Service Log Viewing
318```makefile
319logs-backend:
320 @echo "$(GREEN)📋 Viewing backend logs...$(NC)"
321 @docker compose -f $(COMPOSE_DEV) logs -f backend
322```
323 
324## Testing and Validation
325 
326### Script Testing
327```bash
328# Test database connectivity
329docker exec $CONTAINER_NAME psql -U postgres -c &quot;SELECT 1;&quot; &gt; /dev/null
330if [[ $? -eq 0 ]]; then
331 echo -e &quot;${GREEN}✅ Database connection successful${NC}&quot;
332else
333 echo -e &quot;${RED}❌ Cannot connect to database${NC}&quot;
334 exit 1
335fi
336```
337 
338### Makefile Target Testing
339```makefile
340# Test all services are running
341status:
342 @echo "$(GREEN)📊 Service Status:$(NC)"
343 @if [ -n "$$(docker ps -q -f name=pos-backend)" ]; then \
344 echo "✅ Backend: Available"; \
345 else \
346 echo "❌ Backend: Not running"; \
347 fi
348```

Commands it names

  • docker exec $CONTAINER_NAME pg_dump \
  • docker exec $CONTAINER_NAME pg_dump -U postgres pos_system > $EMERGENCY_BACKUP
  • docker exec $CONTAINER_NAME psql -U postgres -d pos_system -c "
  • docker run --rm -v pos-postgres-data:/data -v $(pwd)/${BACKUP_DIR}:/backup alpine sh -c "cd /data && tar czf /backup/${BACKUP_NAME}_volumes.tar.gz ."
  • docker exec $CONTAINER_NAME psql -U postgres -c "SELECT 1;" > /dev/null

Sections

  • Makefile & Shell Scripting Guidelines
  • Makefile Structure
  • Main Makefile Organization
  • Standard Makefile Headers
  • POS System - Development Makefile
  • Usage: make <command>
  • Default target
  • Colors for output
  • Command Categories
  • Help System Pattern
  • Help - Display available commands
  • Docker Integration
  • Docker Compose File Selection
  • Docker compose files
  • Development environment
  • Production environment
  • Container Management
  • Check container status before operations
  • Shell Script Patterns
  • Script Structure
  • Standard Script Headers
  • Script Description
  • Brief description of what this script does
  • Colors
  • Container Detection Pattern
  • Check if database container is running
  • User Input Validation
  • Safe user input with validation
  • Hidden password input
  • Confirmation Patterns
  • Multiple confirmation levels for destructive operations
  • Database Operations
  • Database backup with error handling
  • Error Handling
  • Comprehensive Error Checking
  • Always check command success
  • Emergency Backup Pattern
  • Create emergency backup before destructive operations
  • File and Directory Management
  • Backup Directory Structure
  • Create backup directory if it doesn't exist
  • Generate timestamp for backup files
  • File Size and Statistics
  • Show file sizes and statistics
  • Count records in database
  • Interactive Menus
  • Backup Selection Menu
  • List available backups with numbered selection
  • Get user selection with validation
  • Security Best Practices
  • Safe SQL Operations
  • Use proper SQL escaping and parameterization
  • Temporary File Handling
  • Clean up temporary files
  • ... operations ...
  • Output Formatting
  • Colored Output System
  • Status Indicators
  • Progress Indicators
  • Integration with Docker

What it covers

setuplint-formatcode-stylearchitecturesecuritydatabase

Stack — with the evidence

typescript

(1.00)

react

(1.00)

tailwind

(1.00)

docker

(1.00)

vite

(0.70)

eslint

(0.70)

javascript

(0.50)

Glob targeting

  • Makefile
  • *.mk
  • *.sh

Format

Cursor rules

The most expressive format here. Many small .mdc files, each with frontmatter declaring when it should load, so a rule about migrations only enters context when a migration is open. Costs the most to maintain and only one editor reads it.

What the corpus says about it

Repository

Owner
madebyaris
Language
—
License
—
Archived
no

All configs in this repo

Also in madebyaris/poinf-of-sales

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
madebyaris/poinf-of-sales.cursor/rules/admin-interface-patterns.mdc · 118Cursor rulestypescriptreact+5stylearchsecurityapi+262/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/api-patterns.mdc · 118Cursor rulestypescriptreact+5lint-formatstylesecuritydatabase+362/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/authentication-and-security-patterns.mdc · 118Cursor rulestypescriptreact+5setupteststylesecurity+481/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/backend-golang.mdc · 118Cursor rulestypescriptreact+5testlint-formatstylearch+569/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/business-logic-patterns.mdc · 118Cursor rulestypescriptreact+5teststyledatabaseperformance+150/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/database-patterns.mdc · 118Cursor rulestypescriptreact+5stylearchtypessecurity+262/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/development-workflow.mdc · 118Cursor rulestypescriptreact+5setupbuildteststyle+386/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/docker-deployment.mdc · 118Cursor rulestypescriptreact+6setupbuildteststyle+877/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/frontend-react.mdc · 118Cursor rulestypescriptreact+5buildtestlint-formatstyle+469/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/performance-optimization-patterns.mdc · 118Cursor rulestypescriptreact+5buildteststyledatabase+366/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/project-architecture.mdc · 118Cursor rulestypescriptreact+5setupteststylearch+678/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/react-native-mobile-patterns.mdc · 118Cursor rulestypescriptreact+5buildstylearchui+274/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/role-based-access-patterns.mdc · 118Cursor rulestypescriptreact+5styletypessecuritydatabase+258/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/tech-debt-prevention.mdc · 118Cursor rulestypescriptreact+5styletesting-strategyui50/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/testing-patterns.mdc · 118Cursor rulestypescriptreact+6setupteststylearch+474/1003 days ago
madebyaris/poinf-of-sales.cursor/rules/user-journey-optimization.mdc · 118Cursor rulestypescriptreact+5styleperformanceagent-behaviour50/1003 days ago
Diff against .cursor/rules/admin-interface-patterns.mdc Diff against .cursor/rules/api-patterns.mdc Diff against .cursor/rules/authentication-and-security-patterns.mdc Diff against .cursor/rules/backend-golang.mdc Diff against .cursor/rules/business-logic-patterns.mdc Diff against .cursor/rules/database-patterns.mdc Diff against .cursor/rules/development-workflow.mdc Diff against .cursor/rules/docker-deployment.mdc Diff against .cursor/rules/frontend-react.mdc Diff against .cursor/rules/performance-optimization-patterns.mdc Diff against .cursor/rules/project-architecture.mdc Diff against .cursor/rules/react-native-mobile-patterns.mdc Diff against .cursor/rules/role-based-access-patterns.mdc Diff against .cursor/rules/tech-debt-prevention.mdc Diff against .cursor/rules/testing-patterns.mdc Diff against .cursor/rules/user-journey-optimization.mdc

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126Cursor rulesgobun+5setupbuildtestlint-format+6100/1003 days ago
TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45Cursor rulestypescriptpytest+15testlint-formatstylearch+5100/1003 days ago
markstev/mark-starter.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+14setuptestlint-formatstyle+699/1003 days ago
Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+13setuptestlint-formatstyle+799/1003 days ago
dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0Cursor rulestypescriptturborepo+15setuptestlint-formatstyle+799/1003 days ago
deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1Cursor rulestypescriptnextjs+5setuptestlint-formatstyle+799/1003 days ago
langflow-ai/langflow.cursor/rules/docs_development.mdc · 153kCursor rulespythonnode+16setupbuildtestlint-format+797/1003 days ago
TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45Cursor rulestypescriptpytest+15teststyletesting-strategysecurity+397/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack