Skip to content

Commit 0e58e0a

Browse files
committed
♻️ refactor(AGENTS.md): Overhaul document structure and content for AI agent efficiency.
This commit transforms the AGENTS.md file from a verbose document into a highly structured, information-dense guide specifically designed for AI agents. The new structure follows a three-layer information architecture: 1. **Layer 1 (Essentials)**: Critical information for immediate use (first 120 lines) - Cardinal rules - Quick workflow - Essential commands - Common errors 2. **Layer 2 (Core Concepts)**: Methodology and architecture (lines 121-280) - Spec-driven development workflow - Project architecture - Code conventions - Implementation patterns 3. **Layer 3 (Reference)**: Lookup information (lines 281-end) - Directory structure - Command references - Checklists - Examples Key improvements: - Added strict maintenance guidelines to prevent document bloat - Implemented a consistent style with tables, code blocks, and lists - Created a common errors table for quick troubleshooting - Added decision matrices for common scenarios - Organized information for quick scanning and reference - Added clear section markers with comments for maintainers - Implemented a strict line limit (under 400 lines) - Added specific guidance for AI agents at all stages of work
1 parent 1a78175 commit 0e58e0a

File tree

2 files changed

+478
-611
lines changed

2 files changed

+478
-611
lines changed

.ddev/commands/web/atlas

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#!/bin/bash
2+
3+
## Description: Map the entire spec territory - run all spec tests across every region
4+
## Usage: atlas [options]
5+
## Example: "ddev atlas" or "ddev atlas --quiet" or "ddev atlas --stop-on-failure"
6+
## Flags: [{"Name":"quiet","Shorthand":"q","Usage":"Suppress output except for errors"},{"Name":"verbose","Shorthand":"v","Usage":"Show detailed output including test outputs"},{"Name":"stop-on-failure","Usage":"Stop execution on first failure"}]
7+
8+
set -e
9+
10+
# Color codes for output
11+
RED='\033[0;31m'
12+
GREEN='\033[0;32m'
13+
YELLOW='\033[1;33m'
14+
BLUE='\033[0;34m'
15+
NC='\033[0m' # No Color
16+
17+
# Parse command line options to pass through to test runner
18+
OPTIONS=""
19+
STOP_ON_FAILURE=false
20+
21+
for arg in "$@"; do
22+
case $arg in
23+
--stop-on-failure)
24+
STOP_ON_FAILURE=true
25+
OPTIONS="$OPTIONS $arg"
26+
;;
27+
*)
28+
OPTIONS="$OPTIONS $arg"
29+
;;
30+
esac
31+
done
32+
33+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗${NC}"
34+
echo -e "${BLUE}${NC} ${GREEN}Atlas: Mapping All Spec Regions${NC} ${BLUE}${NC}"
35+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════════╝${NC}"
36+
echo ""
37+
38+
# Find all spec files recursively in the specs directory
39+
SPEC_FILES=$(find /var/www/html/specs -type f -name "*.yaml" | sort)
40+
41+
if [ -z "$SPEC_FILES" ]; then
42+
echo -e "${RED}❌ Error: No spec files found in specs/ directory${NC}"
43+
exit 1
44+
fi
45+
46+
# Count total spec files
47+
TOTAL_SPECS=$(echo "$SPEC_FILES" | wc -l)
48+
CURRENT=0
49+
FAILED_SPECS=()
50+
PASSED_SPECS=()
51+
52+
echo -e "${BLUE}Found ${TOTAL_SPECS} spec file(s) to test${NC}"
53+
echo ""
54+
55+
# Run test runner for each spec file
56+
for SPEC_FILE in $SPEC_FILES; do
57+
CURRENT=$((CURRENT + 1))
58+
# Get relative path for display
59+
RELATIVE_PATH=${SPEC_FILE#/var/www/html/}
60+
61+
echo -e "${BLUE}[${CURRENT}/${TOTAL_SPECS}]${NC} Testing: ${YELLOW}${RELATIVE_PATH}${NC}"
62+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
63+
64+
# Run the test runner for this spec file
65+
if /var/www/html/machines/middleware-test-runner/run.sh --spec="$SPEC_FILE" $OPTIONS; then
66+
PASSED_SPECS+=("$RELATIVE_PATH")
67+
echo -e "${GREEN}✓ Passed${NC}"
68+
else
69+
FAILED_SPECS+=("$RELATIVE_PATH")
70+
echo -e "${RED}✗ Failed${NC}"
71+
72+
# If stop-on-failure is enabled, exit immediately
73+
if [ "$STOP_ON_FAILURE" = true ]; then
74+
echo ""
75+
echo -e "${RED}╔══════════════════════════════════════════════════════════════╗${NC}"
76+
echo -e "${RED}${NC} ${RED}Stopping on first failure (--stop-on-failure)${NC} ${RED}${NC}"
77+
echo -e "${RED}╚══════════════════════════════════════════════════════════════╝${NC}"
78+
echo ""
79+
echo -e "${YELLOW}Failed spec:${NC} ${RELATIVE_PATH}"
80+
exit 1
81+
fi
82+
fi
83+
84+
echo ""
85+
done
86+
87+
# Print summary
88+
echo -e "${BLUE}╔══════════════════════════════════════════════════════════════╗${NC}"
89+
echo -e "${BLUE}${NC} ${GREEN}Atlas Summary${NC} ${BLUE}${NC}"
90+
echo -e "${BLUE}╚══════════════════════════════════════════════════════════════╝${NC}"
91+
echo ""
92+
echo -e "Total specs tested: ${TOTAL_SPECS}"
93+
echo -e "${GREEN}Passed: ${#PASSED_SPECS[@]}${NC}"
94+
echo -e "${RED}Failed: ${#FAILED_SPECS[@]}${NC}"
95+
echo ""
96+
97+
# List passed specs if verbose or if there are failures
98+
if [ ${#FAILED_SPECS[@]} -gt 0 ] || [[ "$OPTIONS" == *"--verbose"* ]] || [[ "$OPTIONS" == *"-v"* ]]; then
99+
if [ ${#PASSED_SPECS[@]} -gt 0 ]; then
100+
echo -e "${GREEN}✓ Passed specs:${NC}"
101+
for spec in "${PASSED_SPECS[@]}"; do
102+
echo -e " ${GREEN}${NC} $spec"
103+
done
104+
echo ""
105+
fi
106+
fi
107+
108+
# List failed specs
109+
if [ ${#FAILED_SPECS[@]} -gt 0 ]; then
110+
echo -e "${RED}✗ Failed specs:${NC}"
111+
for spec in "${FAILED_SPECS[@]}"; do
112+
echo -e " ${RED}${NC} $spec"
113+
done
114+
echo ""
115+
echo -e "${YELLOW}⚠️ Run individual specs with:${NC}"
116+
echo -e " ${BLUE}ddev exec machines/middleware-test-runner/run.sh --spec=<path>${NC}"
117+
echo ""
118+
exit 1
119+
fi
120+
121+
echo -e "${GREEN}╔══════════════════════════════════════════════════════════════╗${NC}"
122+
echo -e "${GREEN}${NC} ${GREEN}✓ Atlas complete - all regions verified!${NC} ${GREEN}${NC}"
123+
echo -e "${GREEN}╚══════════════════════════════════════════════════════════════╝${NC}"
124+
exit 0

0 commit comments

Comments
 (0)