0xray 4.0.39 → 4.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.grok-plugin/plugin.json +1 -1
- package/.xray/features.json +1 -1
- package/dist/CHANGELOG.md +13 -0
- package/dist/integrations/hooks/goggles-planes.json +1 -1
- package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/docs-site/docs/plates/activity-log.md +1 -1
- package/docs-site/docs/plates/cursor-compact.md +1 -1
- package/docs-site/docs/plates/grok-compact.md +1 -1
- package/docs-site/docs/plates/grokbot.md +1 -1
- package/docs-site/docs/plates/house.md +1 -1
- package/docs-site/docs/plates/index.md +1 -1
- package/docs-site/docs/plates/inference-files.md +1 -1
- package/docs-site/docs/plates/kept-line.md +1 -1
- package/docs-site/docs/plates/lens-gate.md +1 -1
- package/docs-site/docs/plates/lens-page.md +1 -1
- package/docs-site/docs/plates/live-mesh.md +41 -0
- package/docs-site/docs/plates/notes-page.md +1 -1
- package/docs-site/docs/plates/package-face.md +1 -1
- package/docs-site/docs/plates/payload-heat.md +1 -1
- package/docs-site/docs/plates/pickup-stamp.md +1 -1
- package/docs-site/docs/plates/pre-tool.md +1 -1
- package/docs-site/docs/plates/record-map.md +1 -1
- package/docs-site/docs/plates/reflection-page.md +1 -1
- package/docs-site/docs/plates/review.md +1 -1
- package/docs-site/docs/plates/session-capture.md +1 -1
- package/docs-site/docs/plates/site-manual.md +1 -1
- package/docs-site/docs/plates/stamp-plate.md +1 -1
- package/docs-site/docs/plates/station-card.md +1 -1
- package/docs-site/docs/plates/station-heat.md +1 -1
- package/docs-site/docs/plates/suit-organs.md +1 -1
- package/docs-site/docs/plates/suit-settings.md +1 -1
- package/docs-site/docs/plates/suit-wear.md +1 -1
- package/docs-site/docs/plates/trail-state.md +1 -1
- package/docs-site/docs/plates/work-fresh.md +1 -1
- package/docs-site/docs/plates/write-home.md +1 -1
- package/package.json +2 -1
- package/scripts/node/playwright-smoke-server.cjs +27 -0
- package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/vendor/@0xray/repertoire/dist/orchestrator-bridge/RepertoireOrchestratorBridge.js +4 -1
- package/vendor/@0xray/repertoire/dist/paths.js +3 -0
- package/xray/features.json +1 -1
- package/.opencode/agents/api-design.yml +0 -31
- package/.opencode/agents/architect.yml +0 -15
- package/.opencode/agents/architecture-patterns.yml +0 -14
- package/.opencode/agents/auto-format.yml +0 -14
- package/.opencode/agents/backend-engineer.yml +0 -12
- package/.opencode/agents/boot-orchestrator.yml +0 -14
- package/.opencode/agents/bug-triage-specialist.yml +0 -15
- package/.opencode/agents/code-analyzer.yml +0 -12
- package/.opencode/agents/code-reviewer.yml +0 -14
- package/.opencode/agents/content-creator.yml +0 -12
- package/.opencode/agents/database-engineer.yml +0 -12
- package/.opencode/agents/devops-engineer.yml +0 -12
- package/.opencode/agents/framework-compliance-audit.yml +0 -14
- package/.opencode/agents/frontend-engineer.yml +0 -12
- package/.opencode/agents/frontend-ui-ux-engineer.yml +0 -12
- package/.opencode/agents/git-workflow.yml +0 -15
- package/.opencode/agents/growth-strategist.yml +0 -12
- package/.opencode/agents/hermes-agent.yml +0 -12
- package/.opencode/agents/inference-improve.yml +0 -12
- package/.opencode/agents/lint.yml +0 -14
- package/.opencode/agents/log-monitor.yml +0 -12
- package/.opencode/agents/mobile-developer.yml +0 -12
- package/.opencode/agents/model-health-check.yml +0 -12
- package/.opencode/agents/multimodal-looker.yml +0 -12
- package/.opencode/agents/performance-analysis.yml +0 -12
- package/.opencode/agents/performance-engineer.yml +0 -12
- package/.opencode/agents/performance-optimization.yml +0 -12
- package/.opencode/agents/processor-pipeline.yml +0 -14
- package/.opencode/agents/project-analysis.yml +0 -12
- package/.opencode/agents/refactorer.yml +0 -12
- package/.opencode/agents/researcher.yml +0 -12
- package/.opencode/agents/security-auditor.yml +0 -12
- package/.opencode/agents/security-scan.yml +0 -12
- package/.opencode/agents/seo-consultant.yml +0 -12
- package/.opencode/agents/session-management.yml +0 -12
- package/.opencode/agents/state-manager.yml +0 -12
- package/.opencode/agents/storyteller.yml +0 -12
- package/.opencode/agents/strategist.yml +0 -12
- package/.opencode/agents/tech-writer.yml +0 -12
- package/.opencode/agents/testing-best-practices.yml +0 -12
- package/.opencode/agents/testing-lead.yml +0 -12
- package/.opencode/agents/ui-ux-design.yml +0 -12
- package/.opencode/codex.codex +0 -8
- package/.opencode/commands/auto-format.md +0 -99
- package/.opencode/commands/auto-summary-capture.md +0 -90
- package/.opencode/commands/dependency-audit.md +0 -184
- package/.opencode/commands/enforcer-daily-scan.md +0 -137
- package/.opencode/commands/framework-compliance-audit.md +0 -205
- package/.opencode/commands/interactive-validator.md +0 -75
- package/.opencode/commands/job-summary-logger.md +0 -68
- package/.opencode/commands/lint.md +0 -11
- package/.opencode/commands/mode-switch.md +0 -95
- package/.opencode/commands/model-health-check.md +0 -186
- package/.opencode/commands/performance-analysis.md +0 -144
- package/.opencode/commands/pre-commit-introspection.md +0 -185
- package/.opencode/commands/pre-commit-introspection.sh +0 -133
- package/.opencode/commands/security-scan.md +0 -157
- package/.opencode/commands/sisyphus-validation.md +0 -128
- package/.opencode/commands/summary-logger.md +0 -83
- package/.opencode/enforcer-config.json +0 -282
- package/.opencode/workflows/post-deployment-audit.yml +0 -123
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mode-switch
|
|
3
|
-
description: Switch between full (25 agents) and lite (25 agents) modes dynamically
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
#!/bin/bash
|
|
7
|
-
|
|
8
|
-
# xray - Mode Switch Command
|
|
9
|
-
|
|
10
|
-
# Dynamically switches between full and lite agent configurations
|
|
11
|
-
|
|
12
|
-
CONFIG_FILE="OpenCode.json"
|
|
13
|
-
ENFORCER_CONFIG_FILE="enforcer-config.json"
|
|
14
|
-
|
|
15
|
-
# Function to display current mode
|
|
16
|
-
|
|
17
|
-
show_current_mode() {
|
|
18
|
-
if [ -f "opencode.json" ]; then
|
|
19
|
-
DISABLED_COUNT=$(jq '.agent | map(select(.disable == true)) | length' opencode.json)
|
|
20
|
-
if [ "$DISABLED_COUNT" -eq 0 ] || [ -z "$DISABLED_COUNT" ]; then
|
|
21
|
-
CURRENT_MODE="full"
|
|
22
|
-
echo "🎯 Current Mode: $CURRENT_MODE"
|
|
23
|
-
echo "📝 Description: All 25 agents active for comprehensive development support"
|
|
24
|
-
echo "🤖 Active Agents: 8"
|
|
25
|
-
echo " enforcer architect orchestrator bug-triage-specialist code-reviewer security-auditor refactorer testing-lead"
|
|
26
|
-
elif [ "$DISABLED_COUNT" -eq 4 ]; then
|
|
27
|
-
CURRENT_MODE="lite"
|
|
28
|
-
echo "🎯 Current Mode: $CURRENT_MODE"
|
|
29
|
-
echo "📝 Description: 4 core agents active for essential development support"
|
|
30
|
-
echo "🤖 Active Agents: 4"
|
|
31
|
-
echo " enforcer architect orchestrator code-reviewer"
|
|
32
|
-
else
|
|
33
|
-
CURRENT_MODE="custom"
|
|
34
|
-
echo "🎯 Current Mode: $CURRENT_MODE"
|
|
35
|
-
echo "📝 Description: Custom agent configuration"
|
|
36
|
-
ACTIVE_COUNT=$((8 - DISABLED_COUNT))
|
|
37
|
-
echo "🤖 Active Agents: $ACTIVE_COUNT"
|
|
38
|
-
fi
|
|
39
|
-
else
|
|
40
|
-
echo "⚠️ Configuration file not found"
|
|
41
|
-
echo "🎯 Current Mode: unknown"
|
|
42
|
-
fi
|
|
43
|
-
echo ""
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
# Function to switch mode
|
|
47
|
-
|
|
48
|
-
switch_mode() {
|
|
49
|
-
local new_mode="$1"
|
|
50
|
-
|
|
51
|
-
if [[ "$new_mode" != "full" && "$new_mode" != "lite" ]]; then
|
|
52
|
-
echo "❌ Error: Invalid mode. Use 'full' or 'lite'"
|
|
53
|
-
exit 1
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
echo "🔄 Switching to $new_mode mode..."
|
|
57
|
-
|
|
58
|
-
if [ "$new_mode" = "full" ]; then
|
|
59
|
-
# Clear disabled_agents array for full mode
|
|
60
|
-
jq '.disabled_agents = []' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
|
61
|
-
if [ -f "$ENFORCER_CONFIG_FILE" ]; then
|
|
62
|
-
jq '.disabled_agents = []' "$ENFORCER_CONFIG_FILE" > "${ENFORCER_CONFIG_FILE}.tmp" && mv "${ENFORCER_CONFIG_FILE}.tmp" "$ENFORCER_CONFIG_FILE"
|
|
63
|
-
fi
|
|
64
|
-
else
|
|
65
|
-
# Set disabled_agents for lite mode (25 agents disabled)
|
|
66
|
-
jq '.disabled_agents = ["security-auditor", "refactorer", "testing-lead", "bug-triage-specialist"]' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
|
67
|
-
if [ -f "$ENFORCER_CONFIG_FILE" ]; then
|
|
68
|
-
jq '.disabled_agents = ["security-auditor", "refactorer", "testing-lead", "bug-triage-specialist"]' "$ENFORCER_CONFIG_FILE" > "${ENFORCER_CONFIG_FILE}.tmp" && mv "${ENFORCER_CONFIG_FILE}.tmp" "$ENFORCER_CONFIG_FILE"
|
|
69
|
-
fi
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
echo "✅ Successfully switched to $new_mode mode"
|
|
73
|
-
echo ""
|
|
74
|
-
show_current_mode
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
# Main logic
|
|
79
|
-
|
|
80
|
-
case "$1" in
|
|
81
|
-
"")
|
|
82
|
-
show_current_mode
|
|
83
|
-
echo "Usage: mode-switch [full|lite]"
|
|
84
|
-
echo " full - All 25 agents active"
|
|
85
|
-
echo " lite - 4 core agents active"
|
|
86
|
-
;;
|
|
87
|
-
"full"|"lite")
|
|
88
|
-
switch_mode "$1"
|
|
89
|
-
;;
|
|
90
|
-
\*)
|
|
91
|
-
echo "❌ Error: Invalid argument '$1'"
|
|
92
|
-
echo "Usage: mode-switch [full|lite]"
|
|
93
|
-
exit 1
|
|
94
|
-
;;
|
|
95
|
-
esac
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: model-health-check
|
|
3
|
-
description: Verify dynamic model loading system health and compatibility
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
#!/bin/bash
|
|
7
|
-
|
|
8
|
-
# xray - Dynamic Model Health Check
|
|
9
|
-
|
|
10
|
-
# Validates the dynamic model loading system functionality
|
|
11
|
-
|
|
12
|
-
echo "🏥 xray - Dynamic Model Health Check"
|
|
13
|
-
echo "================================================"
|
|
14
|
-
|
|
15
|
-
# Check if dynamic loader exists
|
|
16
|
-
|
|
17
|
-
if [ ! -f "../scripts/dynamic-model-loader.sh" ] && [ ! -f "../../extracted/dynamic-model-loader.sh" ]; then
|
|
18
|
-
echo "❌ Dynamic model loader not found"
|
|
19
|
-
exit 1
|
|
20
|
-
fi
|
|
21
|
-
|
|
22
|
-
echo "✅ Dynamic model loader found"
|
|
23
|
-
|
|
24
|
-
# Define required functions for testing
|
|
25
|
-
|
|
26
|
-
is_deprecated_model() {
|
|
27
|
-
local model="$1"
|
|
28
|
-
if [ "$model" = "grok code fast 1" ] || [ "$model" = "x-ai/grok-code-fast-1" ] || [ "$model" = "anthropic/claude-opus-4-5" ] || [ "$model" = "claude-opus-4.5" ] || [ "$model" = "claude-4-5" ] || [ "$model" = "anthropic/claude-3.5-sonnet" ] || [ "$model" = "claude-3-5-sonnet-latest/" ] || [ "$model" = "claude-sonnet-4-5/" ]; then
|
|
29
|
-
return 0 # deprecated
|
|
30
|
-
else
|
|
31
|
-
return 1 # not deprecated
|
|
32
|
-
fi
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
is_model_compatible() {
|
|
36
|
-
local model="$1"
|
|
37
|
-
local agent_type="$2"
|
|
38
|
-
|
|
39
|
-
# Reject deprecated models
|
|
40
|
-
if is_deprecated_model "$model"; then
|
|
41
|
-
return 1
|
|
42
|
-
fi
|
|
43
|
-
|
|
44
|
-
# Simple compatibility check
|
|
45
|
-
case "$model" in
|
|
46
|
-
*claude-sonnet-4-5*|*claude-3.5*|*gpt-5*|*gpt-4*|*gemini-3*|*grok*)
|
|
47
|
-
return 0 # compatible
|
|
48
|
-
;;
|
|
49
|
-
*)
|
|
50
|
-
return 1 # not compatible
|
|
51
|
-
;;
|
|
52
|
-
esac
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# Mock get_model_for_agent for testing
|
|
57
|
-
|
|
58
|
-
get_model_for_agent() {
|
|
59
|
-
echo "openrouter/xai-grok-2-1212-fast-1" # Return safe default for testing
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
echo "✅ Dynamic model functions loaded"
|
|
63
|
-
|
|
64
|
-
# Test deprecated model blocking
|
|
65
|
-
|
|
66
|
-
echo -e "\n🔍 Testing Deprecated Model Blocking..."
|
|
67
|
-
test_deprecated() {
|
|
68
|
-
local model="$1"
|
|
69
|
-
if is_deprecated_model "$model"; then
|
|
70
|
-
echo "✅ CORRECTLY BLOCKED: $model"
|
|
71
|
-
return 0
|
|
72
|
-
else
|
|
73
|
-
echo "❌ INCORRECTLY ALLOWED: $model"
|
|
74
|
-
return 1
|
|
75
|
-
fi
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
deprecated_tests_passed=true
|
|
79
|
-
|
|
80
|
-
# Test deprecated models (should be blocked)
|
|
81
|
-
|
|
82
|
-
test_deprecated "claude-opus-4.5" || deprecated_tests_passed=false
|
|
83
|
-
test_deprecated "claude-4-5" || deprecated_tests_passed=false
|
|
84
|
-
|
|
85
|
-
# Test non-deprecated models (should NOT be blocked - function should return false)
|
|
86
|
-
|
|
87
|
-
if is_deprecated_model "claude-sonnet-4-5"; then
|
|
88
|
-
echo "❌ INCORRECTLY BLOCKED: claude-sonnet-4-5 (should not be deprecated)"
|
|
89
|
-
deprecated_tests_passed=false
|
|
90
|
-
else
|
|
91
|
-
echo "✅ CORRECTLY ALLOWED: claude-sonnet-4-5"
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
if is_deprecated_model "openrouter/xai-grok-2-1212-fast-1"; then
|
|
95
|
-
echo "❌ INCORRECTLY BLOCKED: openrouter/xai-grok-2-1212-fast-1 (should not be deprecated)"
|
|
96
|
-
deprecated_tests_passed=false
|
|
97
|
-
else
|
|
98
|
-
echo "✅ CORRECTLY ALLOWED: openrouter/xai-grok-2-1212-fast-1"
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
if [ "$deprecated_tests_passed" = true ]; then
|
|
102
|
-
echo "✅ All deprecated model tests passed"
|
|
103
|
-
else
|
|
104
|
-
echo "❌ Some deprecated model tests failed"
|
|
105
|
-
fi
|
|
106
|
-
|
|
107
|
-
# Test model compatibility
|
|
108
|
-
|
|
109
|
-
echo -e "\n🎯 Testing Model Compatibility..."
|
|
110
|
-
compatibility_tests_passed=true
|
|
111
|
-
|
|
112
|
-
test_compatibility() {
|
|
113
|
-
local model="$1"
|
|
114
|
-
local agent="$2"
|
|
115
|
-
local expected="$3"
|
|
116
|
-
|
|
117
|
-
if is_model_compatible "$model" "$agent"; then
|
|
118
|
-
result="compatible"
|
|
119
|
-
else
|
|
120
|
-
result="incompatible"
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
if [ "$result" = "$expected" ]; then
|
|
124
|
-
echo "✅ $model correctly $result for $agent"
|
|
125
|
-
return 0
|
|
126
|
-
else
|
|
127
|
-
echo "❌ $model incorrectly $result for $agent (expected $expected)"
|
|
128
|
-
return 1
|
|
129
|
-
fi
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
test_compatibility "claude-sonnet-4-5" "enforcer" "compatible" || compatibility_tests_passed=false
|
|
134
|
-
test_compatibility "gpt-5.2" "code-reviewer" "compatible" || compatibility_tests_passed=false
|
|
135
|
-
test_compatibility "openrouter/xai-grok-2-104-fast-1" "enforcer" "compatible" || compatibility_tests_passed=false
|
|
136
|
-
test_compatibility "claude-opus-4.5" "enforcer" "incompatible" || compatibility_tests_passed=false
|
|
137
|
-
|
|
138
|
-
if [ "$compatibility_tests_passed" = true ]; then
|
|
139
|
-
echo "✅ All compatibility tests passed"
|
|
140
|
-
else
|
|
141
|
-
echo "❌ Some compatibility tests failed"
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
# Test agent model resolution
|
|
145
|
-
|
|
146
|
-
echo -e "\n🎯 Testing Agent Model Resolution..."
|
|
147
|
-
resolution_tests_passed=true
|
|
148
|
-
|
|
149
|
-
test_resolution() {
|
|
150
|
-
local agent="$1"
|
|
151
|
-
local resolved_model
|
|
152
|
-
|
|
153
|
-
resolved_model=$(get_model_for_agent "$agent" 2>/dev/null)
|
|
154
|
-
if [ -n "$resolved_model" ]; then
|
|
155
|
-
echo "✅ $agent resolved to: $resolved_model"
|
|
156
|
-
return 0
|
|
157
|
-
else
|
|
158
|
-
echo "❌ $agent failed to resolve model"
|
|
159
|
-
return 1
|
|
160
|
-
fi
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
for agent in "enforcer" "architect" "code-reviewer" "testing-lead"; do
|
|
165
|
-
test_resolution "$agent" || resolution_tests_passed=false
|
|
166
|
-
done
|
|
167
|
-
|
|
168
|
-
if [ "$resolution_tests_passed" = true ]; then
|
|
169
|
-
echo "✅ All agent resolution tests passed"
|
|
170
|
-
else
|
|
171
|
-
echo "❌ Some agent resolution tests failed"
|
|
172
|
-
fi
|
|
173
|
-
|
|
174
|
-
# Overall health assessment
|
|
175
|
-
|
|
176
|
-
echo -e "\n🏥 Overall Health Assessment:"
|
|
177
|
-
|
|
178
|
-
if [ "$deprecated_tests_passed" = true ] && [ "$compatibility_tests_passed" = true ] && [ "$resolution_tests_passed" = true ]; then
|
|
179
|
-
echo "✅ DYNAMIC MODEL SYSTEM: HEALTHY"
|
|
180
|
-
echo "All tests passed - system ready for production use"
|
|
181
|
-
exit 0
|
|
182
|
-
else
|
|
183
|
-
echo "❌ DYNAMIC MODEL SYSTEM: ISSUES DETECTED"
|
|
184
|
-
echo "Some tests failed - review and fix issues before production use"
|
|
185
|
-
exit 1
|
|
186
|
-
fi
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# xray - Performance Analysis
|
|
4
|
-
|
|
5
|
-
# Comprehensive metrics analysis for framework integration
|
|
6
|
-
|
|
7
|
-
echo "📊 xray - Performance Analysis"
|
|
8
|
-
echo "============================================================"
|
|
9
|
-
|
|
10
|
-
# Initialize performance metrics
|
|
11
|
-
|
|
12
|
-
METRICS=()
|
|
13
|
-
START_TIME=$(date +%s.%3N)
|
|
14
|
-
|
|
15
|
-
# 1. Framework Load Time Analysis
|
|
16
|
-
|
|
17
|
-
echo "⏱️ Analyzing framework load times..."
|
|
18
|
-
LOAD_START=$(date +%s.%3N)
|
|
19
|
-
bash .opencode/init.sh > /dev/null 2>&1
|
|
20
|
-
LOAD_END=$(date +%s.%3N)
|
|
21
|
-
LOAD_TIME=$(echo "$LOAD_END - $LOAD_START" | bc -l 2>/dev/null || echo "0")
|
|
22
|
-
echo "Framework initialization time: ${LOAD_TIME}s"
|
|
23
|
-
METRICS+=("framework_load_time:${LOAD_TIME}s")
|
|
24
|
-
|
|
25
|
-
# 2. Automation Hook Performance
|
|
26
|
-
|
|
27
|
-
echo ""
|
|
28
|
-
echo "⚡ Testing automation hook performance..."
|
|
29
|
-
HOOKS=("auto-format" "security-scan" "pre-commit-introspection" "enforcer-daily-scan")
|
|
30
|
-
for hook in "${HOOKS[@]}"; do
|
|
31
|
-
HOOK_START=$(date +%s.%3N)
|
|
32
|
-
bash ".opencode/commands/${hook}.md" > /dev/null 2>&1
|
|
33
|
-
HOOK_END=$(date +%s.%3N)
|
|
34
|
-
HOOK_TIME=$(echo "$HOOK_END - $HOOK_START" | bc -l 2>/dev/null || echo "0")
|
|
35
|
-
echo "${hook} execution time: ${HOOK_TIME}s"
|
|
36
|
-
METRICS+=("${hook}\_execution_time:${HOOK_TIME}s")
|
|
37
|
-
done
|
|
38
|
-
|
|
39
|
-
# 3. Memory and Resource Usage
|
|
40
|
-
|
|
41
|
-
echo ""
|
|
42
|
-
echo "💾 Analyzing resource usage..."
|
|
43
|
-
if command -v ps &> /dev/null; then # Get current process memory
|
|
44
|
-
MEM_USAGE=$(ps aux --no-headers -o pmem | awk '{sum+=$1} END {print sum "%"}' 2>/dev/null || echo "N/A")
|
|
45
|
-
echo "Current memory usage: ${MEM_USAGE}"
|
|
46
|
-
METRICS+=("memory_usage:${MEM_USAGE}")
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
# 4. Build Performance Impact
|
|
50
|
-
|
|
51
|
-
echo ""
|
|
52
|
-
echo "🏗️ Measuring build performance impact..."
|
|
53
|
-
if command -v npm &> /dev/null && [ -f "package.json" ]; then
|
|
54
|
-
BUILD_START=$(date +%s.%3N)
|
|
55
|
-
npm run build > /dev/null 2>&1
|
|
56
|
-
BUILD_END=$(date +%s.%3N)
|
|
57
|
-
BUILD_TIME=$(echo "$BUILD_END - $BUILD_START" | bc -l 2>/dev/null || echo "0")
|
|
58
|
-
echo "Build time: ${BUILD_TIME}s"
|
|
59
|
-
|
|
60
|
-
# Get bundle size
|
|
61
|
-
if [ -d "dist" ]; then
|
|
62
|
-
BUNDLE_SIZE=$(du -sh dist/ | cut -f1)
|
|
63
|
-
echo "Bundle size: ${BUNDLE_SIZE}"
|
|
64
|
-
METRICS+=("bundle_size:${BUNDLE_SIZE}")
|
|
65
|
-
fi
|
|
66
|
-
METRICS+=("build_time:${BUILD_TIME}s")
|
|
67
|
-
|
|
68
|
-
else
|
|
69
|
-
echo "Build performance analysis unavailable"
|
|
70
|
-
fi
|
|
71
|
-
|
|
72
|
-
# 5. Code Quality Metrics
|
|
73
|
-
|
|
74
|
-
echo ""
|
|
75
|
-
echo "📈 Calculating code quality metrics..."
|
|
76
|
-
if [ -d "src" ]; then # File count metrics
|
|
77
|
-
TOTAL*FILES=$(find src -type f | wc -l)
|
|
78
|
-
TS_FILES=$(find src -name "*.ts" -o -name "_.tsx" | wc -l)
|
|
79
|
-
TEST_FILES=$(find src -name "_.test._" -o -name "_.spec.\_" | wc -l)
|
|
80
|
-
|
|
81
|
-
echo "Total source files: ${TOTAL_FILES}"
|
|
82
|
-
echo "TypeScript files: ${TS_FILES}"
|
|
83
|
-
echo "Test files: ${TEST_FILES}"
|
|
84
|
-
|
|
85
|
-
METRICS+=("total_files:${TOTAL_FILES}")
|
|
86
|
-
METRICS+=("typescript_files:${TS_FILES}")
|
|
87
|
-
METRICS+=("test_files:${TEST_FILES}")
|
|
88
|
-
|
|
89
|
-
# Test coverage estimation
|
|
90
|
-
if [ "$TS_FILES" -gt 0 ]; then
|
|
91
|
-
TEST_RATIO=$((TEST_FILES * 100 / TS_FILES))
|
|
92
|
-
echo "Test-to-code ratio: ${TEST_RATIO}%"
|
|
93
|
-
METRICS+=("test_ratio:${TEST_RATIO}%")
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
fi
|
|
97
|
-
|
|
98
|
-
# 6. Framework Efficiency Metrics
|
|
99
|
-
|
|
100
|
-
echo ""
|
|
101
|
-
echo "🎯 Analyzing framework efficiency..."
|
|
102
|
-
|
|
103
|
-
# Automation coverage
|
|
104
|
-
|
|
105
|
-
AUTOMATION_COVERAGE=100 # Based on Phase 4 results
|
|
106
|
-
echo "Automation coverage: ${AUTOMATION_COVERAGE}%"
|
|
107
|
-
METRICS+=("automation_coverage:${AUTOMATION_COVERAGE}%")
|
|
108
|
-
|
|
109
|
-
# Error prevention effectiveness
|
|
110
|
-
|
|
111
|
-
ERROR_PREVENTION=90 # Target achieved
|
|
112
|
-
echo "Runtime error prevention: ${ERROR_PREVENTION}%"
|
|
113
|
-
METRICS+=("error_prevention:${ERROR_PREVENTION}%")
|
|
114
|
-
|
|
115
|
-
# 7. Agent Performance Metrics
|
|
116
|
-
|
|
117
|
-
echo ""
|
|
118
|
-
echo "🤖 Measuring agent coordination performance..."
|
|
119
|
-
AGENT_START=$(date +%s.%3N)
|
|
120
|
-
bash .opencode/commands/sisyphus-validation.md > /dev/null 2>&1
|
|
121
|
-
AGENT_END=$(date +%s.%3N)
|
|
122
|
-
AGENT_TIME=$(echo "$AGENT_END - $AGENT_START" | bc -l 2>/dev/null || echo "0")
|
|
123
|
-
echo "Agent coordination time: ${AGENT_TIME}s"
|
|
124
|
-
METRICS+=("agent_coordination_time:${AGENT_TIME}s")
|
|
125
|
-
|
|
126
|
-
# Performance Analysis Complete
|
|
127
|
-
|
|
128
|
-
END_TIME=$(date +%s.%3N)
|
|
129
|
-
TOTAL_TIME=$(echo "$END_TIME - $START_TIME" | bc -l 2>/dev/null || echo "0")
|
|
130
|
-
|
|
131
|
-
echo ""
|
|
132
|
-
echo "📊 PERFORMANCE ANALYSIS REPORT"
|
|
133
|
-
echo "=============================="
|
|
134
|
-
|
|
135
|
-
echo "Total analysis time: ${TOTAL_TIME}s"
|
|
136
|
-
echo ""
|
|
137
|
-
echo "📈 Key Performance Metrics:"
|
|
138
|
-
for metric in "${METRICS[@]}"; do
|
|
139
|
-
echo " - $metric"
|
|
140
|
-
done
|
|
141
|
-
|
|
142
|
-
echo ""
|
|
143
|
-
echo "🎯 Framework Performance Status: ANALYZED"
|
|
144
|
-
echo "Optimization recommendations available in Phase 5 documentation"
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: pre-commit-introspection
|
|
3
|
-
description: Batched code quality and architecture introspection before commits
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
#!/bin/bash
|
|
7
|
-
|
|
8
|
-
# xray - Pre-commit Introspection
|
|
9
|
-
|
|
10
|
-
# Comprehensive code quality and architecture validation
|
|
11
|
-
|
|
12
|
-
echo "🔬 xray - Pre-commit Introspection"
|
|
13
|
-
echo "============================================================"
|
|
14
|
-
|
|
15
|
-
# Initialize analysis status
|
|
16
|
-
|
|
17
|
-
COMPLIANT=true
|
|
18
|
-
ISSUES=()
|
|
19
|
-
WARNINGS=()
|
|
20
|
-
|
|
21
|
-
# 1. Syntax and Type Safety Validation
|
|
22
|
-
|
|
23
|
-
echo "🔧 Validating syntax and type safety..."
|
|
24
|
-
if command -v npm &> /dev/null && [ -f "package.json" ]; then # TypeScript compilation check
|
|
25
|
-
if npm run typecheck > /dev/null 2>&1; then
|
|
26
|
-
echo "✅ TypeScript compilation successful"
|
|
27
|
-
else
|
|
28
|
-
ISSUES+=("TypeScript compilation errors detected")
|
|
29
|
-
COMPLIANT=false
|
|
30
|
-
echo "❌ TypeScript compilation failed"
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# ESLint validation
|
|
34
|
-
if npm run lint > /dev/null 2>&1; then
|
|
35
|
-
echo "✅ ESLint validation passed"
|
|
36
|
-
else
|
|
37
|
-
ISSUES+=("ESLint violations detected")
|
|
38
|
-
COMPLIANT=false
|
|
39
|
-
echo "❌ ESLint violations found"
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
else
|
|
43
|
-
WARNINGS+=("npm/package.json not available for validation")
|
|
44
|
-
fi
|
|
45
|
-
|
|
46
|
-
# 2. Architecture Compliance Check
|
|
47
|
-
|
|
48
|
-
echo ""
|
|
49
|
-
echo "🏗️ Checking architecture compliance..."
|
|
50
|
-
|
|
51
|
-
# Check for anti-patterns
|
|
52
|
-
|
|
53
|
-
ANTI_PATTERNS=(
|
|
54
|
-
"any\|unknown" # Excessive use of any/unknown types
|
|
55
|
-
"console\.(log\|error\|warn)" # Console statements in production code
|
|
56
|
-
"import.\*\.\./\.\./\.\." # Deep relative imports
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
for pattern in "${ANTI_PATTERNS[@]}"; do
|
|
60
|
-
VIOLATIONS=$(grep -r "$pattern" --include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" src/ 2>/dev/null | grep -v "node_modules\|__tests__\|test" | wc -l)
|
|
61
|
-
if [ "$VIOLATIONS" -gt 0 ]; then
|
|
62
|
-
ISSUES+=("Architecture violation: $pattern ($VIOLATIONS instances)")
|
|
63
|
-
COMPLIANT=false
|
|
64
|
-
fi
|
|
65
|
-
done
|
|
66
|
-
|
|
67
|
-
# Check component size limits
|
|
68
|
-
|
|
69
|
-
LARGE_COMPONENTS=$(find src -name "*.tsx" -o -name "*.ts" | xargs wc -l | awk '$1 > 300 {print $2}' | wc -l)
|
|
70
|
-
if [ "$LARGE_COMPONENTS" -gt 0 ]; then
|
|
71
|
-
ISSUES+=("$LARGE_COMPONENTS components exceed 300-line limit")
|
|
72
|
-
COMPLIANT=false
|
|
73
|
-
echo "⚠️ Large components detected"
|
|
74
|
-
else
|
|
75
|
-
echo "✅ Component sizes within limits"
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
# 3. Test Coverage Validation
|
|
79
|
-
|
|
80
|
-
echo ""
|
|
81
|
-
echo "🧪 Validating test coverage..."
|
|
82
|
-
if command -v npm &> /dev/null; then # Run tests if available
|
|
83
|
-
if npm test > /dev/null 2>&1; then
|
|
84
|
-
echo "✅ Tests passing"
|
|
85
|
-
else
|
|
86
|
-
ISSUES+=("Test suite failures detected")
|
|
87
|
-
COMPLIANT=false
|
|
88
|
-
echo "❌ Test failures detected"
|
|
89
|
-
fi
|
|
90
|
-
else
|
|
91
|
-
WARNINGS+=("Test validation unavailable")
|
|
92
|
-
fi
|
|
93
|
-
|
|
94
|
-
# 4. Import Organization Check
|
|
95
|
-
|
|
96
|
-
echo ""
|
|
97
|
-
echo "📦 Checking import organization..."
|
|
98
|
-
|
|
99
|
-
# Check for unused imports (basic heuristic)
|
|
100
|
-
|
|
101
|
-
STAGED_TS_FILES=$(git diff --cached --name-only | grep -E "\.(ts|tsx)$")
|
|
102
|
-
if [ -n "$STAGED_TS_FILES" ]; then
|
|
103
|
-
UNUSED_IMPORTS=false
|
|
104
|
-
for file in $STAGED_TS_FILES; do
|
|
105
|
-
if [ -f "$file" ]; then # Simple check for import statements without usage
|
|
106
|
-
IMPORTS=$(grep "^import" "$file" | wc -l)
|
|
107
|
-
if [ "$IMPORTS" -gt 10 ]; then
|
|
108
|
-
WARNINGS+=("High import count in $file ($IMPORTS imports)")
|
|
109
|
-
fi
|
|
110
|
-
fi
|
|
111
|
-
done
|
|
112
|
-
fi
|
|
113
|
-
|
|
114
|
-
# 5. Commit Message Quality Check
|
|
115
|
-
|
|
116
|
-
echo ""
|
|
117
|
-
echo "📝 Validating commit message..."
|
|
118
|
-
COMMIT_MSG=$(git log --format=%B -n 1 HEAD)
|
|
119
|
-
if [ -n "$COMMIT_MSG" ]; then # Check for descriptive commit messages
|
|
120
|
-
MSG_LENGTH=$(echo "$COMMIT_MSG" | wc -c)
|
|
121
|
-
if [ "$MSG_LENGTH" -lt 10 ]; then
|
|
122
|
-
WARNINGS+=("Commit message too short (< 10 characters)")
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
# Check for conventional commit format
|
|
126
|
-
if ! echo "$COMMIT_MSG" | grep -qE "^(feat|fix|docs|style|refactor|test|chore)"; then
|
|
127
|
-
WARNINGS+=("Consider using conventional commit format")
|
|
128
|
-
fi
|
|
129
|
-
|
|
130
|
-
else
|
|
131
|
-
WARNINGS+=("No commit message found")
|
|
132
|
-
fi
|
|
133
|
-
|
|
134
|
-
# 6. Code Duplication Check
|
|
135
|
-
|
|
136
|
-
echo ""
|
|
137
|
-
echo "🔄 Checking code duplication..."
|
|
138
|
-
if command -v jscpd &> /dev/null; then
|
|
139
|
-
DUPLICATION=$(jscpd --reporters console --format "javascript,typescript" --min-lines 10 --min-tokens 50 . 2>/dev/null | grep -o "[0-9]*\.[0-9]*%" | head -1)
|
|
140
|
-
if [[ -n "$DUPLICATION" ]]; then
|
|
141
|
-
DUP_NUM=$(echo "$DUPLICATION" | sed 's/%//')
|
|
142
|
-
if (( $(echo "$DUP_NUM > 5" | bc -l 2>/dev/null) )); then
|
|
143
|
-
ISSUES+=("High code duplication: ${DUPLICATION}%")
|
|
144
|
-
COMPLIANT=false
|
|
145
|
-
echo "⚠️ High code duplication detected"
|
|
146
|
-
else
|
|
147
|
-
echo "✅ Code duplication within acceptable limits"
|
|
148
|
-
fi
|
|
149
|
-
fi
|
|
150
|
-
else
|
|
151
|
-
WARNINGS+=("Code duplication analysis unavailable")
|
|
152
|
-
fi
|
|
153
|
-
|
|
154
|
-
# Report Results
|
|
155
|
-
|
|
156
|
-
echo ""
|
|
157
|
-
echo "📊 PRE-COMMIT INTROSPECTION REPORT"
|
|
158
|
-
echo "==================================="
|
|
159
|
-
|
|
160
|
-
if [ "$COMPLIANT" = true ]; then
|
|
161
|
-
echo "✅ COMMIT APPROVED"
|
|
162
|
-
echo "Code quality standards met"
|
|
163
|
-
else
|
|
164
|
-
echo "❌ COMMIT BLOCKED"
|
|
165
|
-
echo ""
|
|
166
|
-
echo "Critical Issues:"
|
|
167
|
-
for issue in "${ISSUES[@]}"; do
|
|
168
|
-
echo " - 🔴 $issue"
|
|
169
|
-
done
|
|
170
|
-
echo ""
|
|
171
|
-
echo "Resolution required before commit"
|
|
172
|
-
exit 1
|
|
173
|
-
fi
|
|
174
|
-
|
|
175
|
-
if [ ${#WARNINGS[@]} -gt 0 ]; then
|
|
176
|
-
echo ""
|
|
177
|
-
echo "⚠️ Warnings (non-blocking):"
|
|
178
|
-
for warning in "${WARNINGS[@]}"; do
|
|
179
|
-
echo " - $warning"
|
|
180
|
-
done
|
|
181
|
-
fi
|
|
182
|
-
|
|
183
|
-
echo ""
|
|
184
|
-
echo "🎯 xray: INTROSPECTION COMPLETE"
|
|
185
|
-
echo "Commit ready for integration"
|