strray-ai 1.3.5 → 1.4.17
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/.opencode/OpenCode.json +8 -0
- package/.opencode/agents/analyzer.yml +0 -1
- package/.opencode/agents/architect.yml +0 -1
- package/.opencode/agents/bug-triage-specialist.yml +0 -1
- package/.opencode/agents/code-reviewer.yml +0 -1
- package/.opencode/agents/enforcer.yml +0 -1
- package/.opencode/agents/explore.yml +0 -1
- package/.opencode/agents/librarian.yml +0 -1
- package/.opencode/agents/multimodal-looker.yml +0 -1
- package/.opencode/agents/oracle.yml +0 -1
- package/.opencode/agents/orchestrator.yml +0 -1
- package/.opencode/agents/refactorer.yml +0 -1
- package/.opencode/agents/security-auditor.yml +0 -1
- package/.opencode/agents/test-architect.yml +0 -1
- package/.opencode/commands/framework-compliance-audit.md +1 -1
- package/.opencode/commands/mode-switch.md +3 -3
- package/.opencode/enforcer-config.json +2 -2
- package/.opencode/hooks/post-commit.backup +193 -0
- package/.opencode/hooks/post-push.backup +193 -0
- package/.opencode/init.sh +37 -133
- package/.opencode/package.json +4 -4
- package/.opencode/{plugin → plugins}/strray-codex-injection.ts +0 -1
- package/.opencode/skills/api-design/SKILL.md +1 -1
- package/.opencode/skills/architecture-patterns/SKILL.md +1 -1
- package/.opencode/skills/code-review/SKILL.md +1 -1
- package/.opencode/skills/git-workflow/SKILL.md +1 -1
- package/.opencode/skills/librarian/SKILL.md +1 -1
- package/.opencode/skills/performance-optimization/SKILL.md +1 -1
- package/.opencode/skills/project-analysis/SKILL.md +1 -1
- package/.opencode/skills/refactoring-strategies/SKILL.md +1 -1
- package/.opencode/skills/security-audit/SKILL.md +1 -1
- package/.opencode/skills/testing-best-practices/SKILL.md +1 -1
- package/.opencode/skills/testing-strategy/SKILL.md +1 -1
- package/.opencode/skills/ui-ux-design/SKILL.md +1 -1
- package/.opencode/state/backups/state-backup-2026-01-23T23-26-14-304Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-27-08-124Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-27-58-116Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-28-47-868Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-42-55-206Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-43-25-458Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-43-36-730Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-47-54-481Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-48-02-226Z.json +2 -2
- package/.opencode/state/backups/state-backup-2026-01-23T23-48-25-109Z.json +2 -2
- package/.opencode/state/state.json +101 -1833
- package/.opencode/state/state.json.broken +2436 -0
- package/.opencode/strray/codex.json +1 -1
- package/.opencode/strray/features.json +1 -10
- package/.strray/codex.json +2 -2
- package/AGENTS.md +2770 -0
- package/README.md +260 -745
- package/dist/agents/analyzer.d.ts +10 -0
- package/dist/agents/analyzer.d.ts.map +1 -0
- package/dist/agents/analyzer.js +142 -0
- package/dist/agents/analyzer.js.map +1 -0
- package/dist/agents/index.d.ts +3 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +5 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/librarian-agents-updater.d.ts +21 -0
- package/dist/agents/librarian-agents-updater.d.ts.map +1 -0
- package/dist/agents/librarian-agents-updater.js +221 -0
- package/dist/agents/librarian-agents-updater.js.map +1 -0
- package/dist/agents/librarian.d.ts.map +1 -1
- package/dist/agents/librarian.js +8 -1
- package/dist/agents/librarian.js.map +1 -1
- package/dist/agents/multimodal-looker.d.ts +10 -0
- package/dist/agents/multimodal-looker.d.ts.map +1 -0
- package/dist/agents/multimodal-looker.js +95 -0
- package/dist/agents/multimodal-looker.js.map +1 -0
- package/dist/cli/index.js +14 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/core/boot-orchestrator.d.ts.map +1 -1
- package/dist/core/boot-orchestrator.js +22 -1
- package/dist/core/boot-orchestrator.js.map +1 -1
- package/dist/core/codex-injector.d.ts +1 -1
- package/dist/core/codex-injector.js +1 -1
- package/dist/core/config-loader.d.ts +1 -14
- package/dist/core/config-loader.d.ts.map +1 -1
- package/dist/core/config-loader.js +1 -23
- package/dist/core/config-loader.js.map +1 -1
- package/dist/core/features-config.d.ts +0 -9
- package/dist/core/features-config.d.ts.map +1 -1
- package/dist/core/features-config.js +0 -12
- package/dist/core/features-config.js.map +1 -1
- package/dist/core/model-router.d.ts.map +1 -1
- package/dist/core/model-router.js +13 -4
- package/dist/core/model-router.js.map +1 -1
- package/dist/core/orchestrator.d.ts +5 -0
- package/dist/core/orchestrator.d.ts.map +1 -1
- package/dist/core/orchestrator.js +65 -5
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/strray-activation.d.ts +1 -1
- package/dist/core/strray-activation.js +10 -1
- package/dist/core/strray-activation.js.map +1 -1
- package/dist/core/strray-init.d.ts +1 -1
- package/dist/core/strray-init.js +4 -4
- package/dist/core/strray-init.js.map +1 -1
- package/dist/enforcement/rule-enforcer.d.ts +13 -0
- package/dist/enforcement/rule-enforcer.d.ts.map +1 -1
- package/dist/enforcement/rule-enforcer.js +117 -0
- package/dist/enforcement/rule-enforcer.js.map +1 -1
- package/dist/mcps/agent-resolver.d.ts +47 -0
- package/dist/mcps/agent-resolver.d.ts.map +1 -0
- package/dist/mcps/agent-resolver.js +119 -0
- package/dist/mcps/agent-resolver.js.map +1 -0
- package/dist/mcps/boot-orchestrator.server.js +2 -2
- package/dist/mcps/boot-orchestrator.server.js.map +1 -1
- package/dist/mcps/enhanced-orchestrator.server.d.ts +1 -1
- package/dist/mcps/enhanced-orchestrator.server.js +1 -1
- package/dist/mcps/framework-compliance-audit.server.js +1 -1
- package/dist/mcps/framework-compliance-audit.server.js.map +1 -1
- package/dist/mcps/mcp-client.d.ts +6 -0
- package/dist/mcps/mcp-client.d.ts.map +1 -1
- package/dist/mcps/mcp-client.js +90 -17
- package/dist/mcps/mcp-client.js.map +1 -1
- package/dist/orchestrator/universal-registry-bridge.d.ts +86 -0
- package/dist/orchestrator/universal-registry-bridge.d.ts.map +1 -0
- package/dist/orchestrator/universal-registry-bridge.js +247 -0
- package/dist/orchestrator/universal-registry-bridge.js.map +1 -0
- package/dist/plugin/strray-codex-injection.d.ts.map +1 -1
- package/dist/plugin/strray-codex-injection.js +231 -26
- package/dist/plugin/strray-codex-injection.js.map +1 -1
- package/dist/postprocessor/PostProcessor.d.ts.map +1 -1
- package/dist/postprocessor/PostProcessor.js +36 -5
- package/dist/postprocessor/PostProcessor.js.map +1 -1
- package/dist/postprocessor/triggers/GitHookTrigger.js +2 -2
- package/dist/processors/agents-md-validation-processor.d.ts +64 -0
- package/dist/processors/agents-md-validation-processor.d.ts.map +1 -0
- package/dist/processors/agents-md-validation-processor.js +211 -0
- package/dist/processors/agents-md-validation-processor.js.map +1 -0
- package/dist/processors/processor-manager.d.ts +10 -0
- package/dist/processors/processor-manager.d.ts.map +1 -1
- package/dist/processors/processor-manager.js +95 -1
- package/dist/processors/processor-manager.js.map +1 -1
- package/dist/processors/test-auto-creation-processor.d.ts +17 -0
- package/dist/processors/test-auto-creation-processor.d.ts.map +1 -0
- package/dist/processors/test-auto-creation-processor.js +293 -0
- package/dist/processors/test-auto-creation-processor.js.map +1 -0
- package/dist/processors/version-compliance-processor.d.ts +113 -0
- package/dist/processors/version-compliance-processor.d.ts.map +1 -0
- package/dist/processors/version-compliance-processor.js +349 -0
- package/dist/processors/version-compliance-processor.js.map +1 -0
- package/dist/scripts/integration.d.ts +17 -0
- package/dist/scripts/integration.d.ts.map +1 -0
- package/dist/scripts/integration.js +212 -0
- package/dist/scripts/integration.js.map +1 -0
- package/dist/security/examples.js +1 -1
- package/dist/security/examples.js.map +1 -1
- package/dist/security/security-auditor.d.ts.map +1 -1
- package/dist/security/security-auditor.js +1 -5
- package/dist/security/security-auditor.js.map +1 -1
- package/dist/security/security-middleware.js +2 -2
- package/dist/security/security-middleware.js.map +1 -1
- package/dist/utils/import-resolver.js +7 -7
- package/dist/utils/import-resolver.js.map +1 -1
- package/dist/utils/token-manager.d.ts.map +1 -1
- package/dist/utils/token-manager.js +1 -2
- package/dist/utils/token-manager.js.map +1 -1
- package/opencode.json +5 -1
- package/package.json +24 -10
- package/scripts/mjs/monitor-framework-orchestration.mjs +355 -0
- package/scripts/mjs/monitor-package.mjs +1 -1
- package/scripts/mjs/run-simulations.mjs +1 -1
- package/scripts/mjs/test-ci-cd-integration.mjs +3 -3
- package/scripts/mjs/test-complex-orchestration.mjs +3 -2
- package/scripts/mjs/test-configuration-validation.mjs +7 -7
- package/scripts/mjs/test-consumer-readiness.mjs +32 -37
- package/scripts/mjs/test-consumer-validation.mjs +55 -72
- package/scripts/mjs/test-final-consumer-validation.mjs +48 -52
- package/scripts/mjs/test-mcp-functionality.mjs +123 -38
- package/scripts/mjs/test-postinstall-files.mjs +17 -17
- package/scripts/mjs/test-simple-prompt.mjs +1 -1
- package/scripts/mjs/test-skills-comprehensive.mjs +20 -10
- package/scripts/mjs/test-skills-mcp-integration.mjs +3 -3
- package/scripts/mjs/test-stringray-plugin.mjs +1 -1
- package/scripts/mjs/trigger-and-monitor-framework.mjs +219 -0
- package/scripts/mjs/verify-orchestration.mjs +178 -0
- package/scripts/mjs/verify-pipeline-end-to-end.mjs +237 -0
- package/scripts/mjs/verify-plugin-paths.mjs +4 -4
- package/scripts/node/cleanup-doc-versions.js +6 -6
- package/scripts/node/debug-plugin.cjs +1 -1
- package/scripts/node/enforce-agents-md.js +423 -0
- package/scripts/node/enforce-version-compliance.sh +14 -135
- package/scripts/node/enforce-version-compliance.sh.bak +143 -0
- package/scripts/node/enforce-version-compliance.ts +125 -0
- package/scripts/node/postinstall.cjs +62 -37
- package/scripts/node/prepare-consumer.cjs +2 -3
- package/scripts/node/setup-ci-paths.cjs +1 -1
- package/scripts/node/setup-dev.cjs +3 -3
- package/scripts/node/setup.cjs +8 -8
- package/scripts/node/test-plugin-comprehensive.js +5 -5
- package/scripts/node/universal-version-manager.js +14 -16
- package/scripts/node/validate-oh-my-opencode-integration.cjs +11 -4
- package/scripts/node/validate-postinstall-config.js +8 -24
- package/.opencode/command/dependency-audit.md +0 -184
- package/.opencode/command/lint.md +0 -11
- package/.opencode/logs/strray-init-20260201-165724.log +0 -40
- package/.opencode/logs/strray-init-20260201-171744.log +0 -40
- package/.opencode/logs/strray-plugin-2026-02-01.log +0 -352
- package/.opencode/oh-my-opencode.json +0 -108
- package/.opencode/package-lock.json +0 -31
- package/.opencode/scripts/config-integration-tests.sh +0 -159
- package/.opencode/scripts/config-loader.sh +0 -153
- package/.opencode/scripts/hook-consolidation-tests.sh +0 -193
- package/.opencode/scripts/job-summary-logger.sh +0 -11
- package/.opencode/scripts/model-validator.sh +0 -178
- package/.opencode/scripts/simple-validation.sh +0 -96
- package/.opencode/scripts/validate-codex.py +0 -78
- /package/.opencode/agents/{document-writer.yml → archive/document-writer.yml} +0 -0
- /package/.opencode/agents/{frontend-ui-ux-engineer.yml → archive/frontend-ui-ux-engineer.yml} +0 -0
|
@@ -17,7 +17,7 @@ COMPLIANCE_SCORES=()
|
|
|
17
17
|
# 1. Configuration Integrity Check
|
|
18
18
|
|
|
19
19
|
echo "⚙️ Checking framework configuration integrity..."
|
|
20
|
-
if [ -f ".opencode/enforcer-config.json" ] && [ -f ".opencode/
|
|
20
|
+
if [ -f ".opencode/enforcer-config.json" ] && [ -f ".opencode/OpenCode.json" ]; then
|
|
21
21
|
echo "✅ Framework configurations present"
|
|
22
22
|
COMPLIANCE_SCORES+=("configuration_integrity:PASS")
|
|
23
23
|
else
|
|
@@ -9,14 +9,14 @@ description: Switch between full (8 agents) and lite (4 agents) modes dynamicall
|
|
|
9
9
|
|
|
10
10
|
# Dynamically switches between full and lite agent configurations
|
|
11
11
|
|
|
12
|
-
CONFIG_FILE="
|
|
12
|
+
CONFIG_FILE="OpenCode.json"
|
|
13
13
|
ENFORCER_CONFIG_FILE="enforcer-config.json"
|
|
14
14
|
|
|
15
15
|
# Function to display current mode
|
|
16
16
|
|
|
17
17
|
show_current_mode() {
|
|
18
|
-
if [ -f ".opencode/
|
|
19
|
-
DISABLED_COUNT=$(jq '.disabled_agents | length' .opencode/
|
|
18
|
+
if [ -f ".opencode/OpenCode.json" ]; then
|
|
19
|
+
DISABLED_COUNT=$(jq '.disabled_agents | length' .opencode/OpenCode.json)
|
|
20
20
|
if [ "$DISABLED_COUNT" -eq 0 ]; then
|
|
21
21
|
CURRENT_MODE="full"
|
|
22
22
|
echo "🎯 Current Mode: $CURRENT_MODE"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "StringRay 1.0.0",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.17",
|
|
4
4
|
"description": "Codex-compliant framework configuration for Credible UI project",
|
|
5
5
|
"thresholds": {
|
|
6
6
|
"bundleSize": {
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
184
|
"codex": {
|
|
185
|
-
"version": "1.
|
|
185
|
+
"version": "1.4.17",
|
|
186
186
|
"terms": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 24, 29, 32, 38, 42, 43],
|
|
187
187
|
"principles": [
|
|
188
188
|
"progressive-prod-ready-code",
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# StrRay Post-Processor post-commit Hook
|
|
3
|
+
# Automatically triggers post-processor after post-commit
|
|
4
|
+
|
|
5
|
+
# Get hook type from script name
|
|
6
|
+
HOOK_NAME=$(basename "$0")
|
|
7
|
+
COMMIT_SHA=""
|
|
8
|
+
|
|
9
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
10
|
+
# Light monitoring for local commits - just basic validation
|
|
11
|
+
COMMIT_SHA=$(git rev-parse HEAD)
|
|
12
|
+
MONITORING_LEVEL="basic"
|
|
13
|
+
elif [ "$HOOK_NAME" = "post-push" ]; then
|
|
14
|
+
# Full monitoring for pushes - comprehensive validation
|
|
15
|
+
# For push hooks, we need to parse the pushed refs from stdin
|
|
16
|
+
while read local_ref local_sha remote_ref remote_sha; do
|
|
17
|
+
if [ "$local_sha" != "0000000000000000000000000000000000000000" ]; then
|
|
18
|
+
COMMIT_SHA=$local_sha
|
|
19
|
+
break
|
|
20
|
+
fi
|
|
21
|
+
done
|
|
22
|
+
MONITORING_LEVEL="full"
|
|
23
|
+
else
|
|
24
|
+
COMMIT_SHA=$(git rev-parse HEAD)
|
|
25
|
+
MONITORING_LEVEL="basic"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ -z "$COMMIT_SHA" ]; then
|
|
29
|
+
echo "Warning: Could not determine commit SHA for post-processor"
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Get repository info
|
|
34
|
+
REPO="strray-framework/stringray" # Placeholder for now
|
|
35
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
36
|
+
AUTHOR=$(git log -1 --pretty=format:'%an <%ae>')
|
|
37
|
+
|
|
38
|
+
# Get changed files (different logic for commit vs push)
|
|
39
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
40
|
+
FILES=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached)
|
|
41
|
+
else
|
|
42
|
+
FILES=$(git log --name-only --oneline -1 $COMMIT_SHA | tail -n +2)
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Trigger post-processor asynchronously (don't block git operations)
|
|
46
|
+
(
|
|
47
|
+
cd "$(dirname "$0")/../.." # Navigate to project root
|
|
48
|
+
|
|
49
|
+
# Find the StrRay plugin in node_modules or current project (development)
|
|
50
|
+
STRRAY_PLUGIN=""
|
|
51
|
+
if [ -d "node_modules/strray-framework" ]; then
|
|
52
|
+
STRRAY_PLUGIN="node_modules/strray-framework"
|
|
53
|
+
elif [ -d "node_modules/@strray/strray-framework" ]; then
|
|
54
|
+
STRRAY_PLUGIN="node_modules/@strray/strray-framework"
|
|
55
|
+
elif [ -d "node_modules/oh-my-opencode/plugins/strray-framework" ]; then
|
|
56
|
+
STRRAY_PLUGIN="node_modules/oh-my-opencode/plugins/strray-framework"
|
|
57
|
+
elif [ -f "dist/postprocessor/PostProcessor.js" ]; then
|
|
58
|
+
# Development mode - use current project
|
|
59
|
+
STRRAY_PLUGIN="."
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if command -v node >/dev/null 2>&1 && [ -n "$STRRAY_PLUGIN" ]; then
|
|
63
|
+
# Call a separate script to avoid bash variable issues
|
|
64
|
+
export COMMIT_SHA="$COMMIT_SHA"
|
|
65
|
+
export REPO="$REPO"
|
|
66
|
+
export BRANCH="$BRANCH"
|
|
67
|
+
export AUTHOR="$AUTHOR"
|
|
68
|
+
export STRRAY_PLUGIN="$STRRAY_PLUGIN"
|
|
69
|
+
export MONITORING_LEVEL="$MONITORING_LEVEL"
|
|
70
|
+
export IS_FULL_MONITORING="$([ "$MONITORING_LEVEL" = "full" ] && echo "true" || echo "false")"
|
|
71
|
+
|
|
72
|
+
# Run appropriate monitoring based on hook type
|
|
73
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
74
|
+
# LIGHT MONITORING: Quick validation, don't block git workflow
|
|
75
|
+
# Timeout: 2 seconds max, log metrics for monitoring
|
|
76
|
+
START_TIME=$(date +%s)
|
|
77
|
+
timeout 2 node -e "
|
|
78
|
+
(async () => {
|
|
79
|
+
try {
|
|
80
|
+
// Use import resolver to avoid hardcoded dist paths
|
|
81
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
82
|
+
const { LightweightValidator } = await importResolver.importModule('postprocessor/validation/LightweightValidator');
|
|
83
|
+
|
|
84
|
+
const validator = new LightweightValidator();
|
|
85
|
+
const result = await validator.validate();
|
|
86
|
+
|
|
87
|
+
if (result.warnings.length > 0) {
|
|
88
|
+
console.log('⚠️ ' + result.warnings.length + ' warning(s) found:');
|
|
89
|
+
result.warnings.forEach(w => console.log(' ' + w));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!result.passed) {
|
|
93
|
+
console.log('❌ ' + result.errors.length + ' error(s) found:');
|
|
94
|
+
result.errors.forEach(e => console.log(' ' + e));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('✅ Post-commit: Validation passed in ' + result.duration + 'ms');
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('❌ Post-commit validation failed:', error instanceof Error ? error.message : String(error));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
104
|
+
" 2>/dev/null
|
|
105
|
+
EXIT_CODE=$?
|
|
106
|
+
END_TIME=$(date +%s)
|
|
107
|
+
DURATION=$((END_TIME - START_TIME))
|
|
108
|
+
|
|
109
|
+
# Log metrics for monitoring (convert to milliseconds)
|
|
110
|
+
DURATION_MS=$((DURATION * 1000))
|
|
111
|
+
echo "HOOK_METRICS: post-commit duration=${DURATION_MS}ms exit_code=${EXIT_CODE}" >&2
|
|
112
|
+
|
|
113
|
+
# Record metrics using metrics collector (direct import for reliability)
|
|
114
|
+
node -e "
|
|
115
|
+
(async () => {
|
|
116
|
+
try {
|
|
117
|
+
const { HookMetricsCollector } = await import('./dist/postprocessor/validation/HookMetricsCollector.js');
|
|
118
|
+
const collector = new HookMetricsCollector();
|
|
119
|
+
collector.recordMetrics('post-commit', ${DURATION_MS}, ${EXIT_CODE});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
// Silently fail if metrics collection fails
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
" 2>/dev/null || true
|
|
125
|
+
|
|
126
|
+
[ $EXIT_CODE -eq 0 ] && exit 0 || exit 1
|
|
127
|
+
else
|
|
128
|
+
# FULL MONITORING: Comprehensive analysis for post-push
|
|
129
|
+
# Timeout: 5 minutes max, comprehensive CI/CD validation
|
|
130
|
+
START_TIME=$(date +%s)
|
|
131
|
+
timeout 300 node -e "
|
|
132
|
+
(async () => {
|
|
133
|
+
try {
|
|
134
|
+
console.log('🚀 Post-push: Comprehensive validation initiated');
|
|
135
|
+
// Use import resolver for environment-aware imports
|
|
136
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
137
|
+
const { ComprehensiveValidator } = await importResolver.importModule('postprocessor/validation/ComprehensiveValidator');
|
|
138
|
+
|
|
139
|
+
const validator = new ComprehensiveValidator();
|
|
140
|
+
const result = await validator.validate();
|
|
141
|
+
|
|
142
|
+
if (result.warnings.length > 0) {
|
|
143
|
+
console.log('⚠️ ' + result.warnings.length + ' warning(s) found:');
|
|
144
|
+
result.warnings.forEach(w => console.log(' ' + w));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!result.passed) {
|
|
148
|
+
console.log('❌ ' + result.errors.length + ' error(s) found:');
|
|
149
|
+
result.errors.forEach(e => console.log(' ' + e));
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (result.testResults) {
|
|
154
|
+
console.log('🧪 Tests: ' + result.testResults.passed + '/' + result.testResults.total + ' passed');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.log('✅ Post-push: Comprehensive validation passed in ' + result.duration + 'ms');
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error('❌ Post-push validation failed:', error instanceof Error ? error.message : String(error));
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
})();
|
|
163
|
+
" 2>/dev/null
|
|
164
|
+
EXIT_CODE=$?
|
|
165
|
+
END_TIME=$(date +%s)
|
|
166
|
+
DURATION=$((END_TIME - START_TIME))
|
|
167
|
+
|
|
168
|
+
# Log comprehensive metrics for monitoring (convert to milliseconds)
|
|
169
|
+
DURATION_MS=$((DURATION * 1000))
|
|
170
|
+
echo "HOOK_METRICS: post-push duration=${DURATION_MS}ms exit_code=${EXIT_CODE}" >&2
|
|
171
|
+
|
|
172
|
+
# Record metrics using metrics collector (direct import for reliability)
|
|
173
|
+
node -e "
|
|
174
|
+
(async () => {
|
|
175
|
+
try {
|
|
176
|
+
const { HookMetricsCollector } = await import('./dist/postprocessor/validation/HookMetricsCollector.js');
|
|
177
|
+
const collector = new HookMetricsCollector();
|
|
178
|
+
collector.recordMetrics('post-push', ${DURATION_MS}, ${EXIT_CODE});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
// Silently fail if metrics collection fails
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
183
|
+
" 2>/dev/null || true
|
|
184
|
+
|
|
185
|
+
[ $EXIT_CODE -eq 0 ] && exit 0 || exit 1
|
|
186
|
+
fi
|
|
187
|
+
else
|
|
188
|
+
echo "Warning: StrRay plugin not found or Node.js not available, skipping post-processor"
|
|
189
|
+
fi
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
# Don't wait for background process
|
|
193
|
+
exit 0
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# StrRay Post-Processor post-push Hook
|
|
3
|
+
# Automatically triggers post-processor after post-push
|
|
4
|
+
|
|
5
|
+
# Get hook type from script name
|
|
6
|
+
HOOK_NAME=$(basename "$0")
|
|
7
|
+
COMMIT_SHA=""
|
|
8
|
+
|
|
9
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
10
|
+
# Light monitoring for local commits - just basic validation
|
|
11
|
+
COMMIT_SHA=$(git rev-parse HEAD)
|
|
12
|
+
MONITORING_LEVEL="basic"
|
|
13
|
+
elif [ "$HOOK_NAME" = "post-push" ]; then
|
|
14
|
+
# Full monitoring for pushes - comprehensive validation
|
|
15
|
+
# For push hooks, we need to parse the pushed refs from stdin
|
|
16
|
+
while read local_ref local_sha remote_ref remote_sha; do
|
|
17
|
+
if [ "$local_sha" != "0000000000000000000000000000000000000000" ]; then
|
|
18
|
+
COMMIT_SHA=$local_sha
|
|
19
|
+
break
|
|
20
|
+
fi
|
|
21
|
+
done
|
|
22
|
+
MONITORING_LEVEL="full"
|
|
23
|
+
else
|
|
24
|
+
COMMIT_SHA=$(git rev-parse HEAD)
|
|
25
|
+
MONITORING_LEVEL="basic"
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ -z "$COMMIT_SHA" ]; then
|
|
29
|
+
echo "Warning: Could not determine commit SHA for post-processor"
|
|
30
|
+
exit 0
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Get repository info
|
|
34
|
+
REPO="strray-framework/stringray" # Placeholder for now
|
|
35
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
36
|
+
AUTHOR=$(git log -1 --pretty=format:'%an <%ae>')
|
|
37
|
+
|
|
38
|
+
# Get changed files (different logic for commit vs push)
|
|
39
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
40
|
+
FILES=$(git diff --name-only HEAD~1 2>/dev/null || git diff --name-only --cached)
|
|
41
|
+
else
|
|
42
|
+
FILES=$(git log --name-only --oneline -1 $COMMIT_SHA | tail -n +2)
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# Trigger post-processor asynchronously (don't block git operations)
|
|
46
|
+
(
|
|
47
|
+
cd "$(dirname "$0")/../.." # Navigate to project root
|
|
48
|
+
|
|
49
|
+
# Find the StrRay plugin in node_modules or current project (development)
|
|
50
|
+
STRRAY_PLUGIN=""
|
|
51
|
+
if [ -d "node_modules/strray-framework" ]; then
|
|
52
|
+
STRRAY_PLUGIN="node_modules/strray-framework"
|
|
53
|
+
elif [ -d "node_modules/@strray/strray-framework" ]; then
|
|
54
|
+
STRRAY_PLUGIN="node_modules/@strray/strray-framework"
|
|
55
|
+
elif [ -d "node_modules/oh-my-opencode/plugins/strray-framework" ]; then
|
|
56
|
+
STRRAY_PLUGIN="node_modules/oh-my-opencode/plugins/strray-framework"
|
|
57
|
+
elif [ -f "dist/postprocessor/PostProcessor.js" ]; then
|
|
58
|
+
# Development mode - use current project
|
|
59
|
+
STRRAY_PLUGIN="."
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
if command -v node >/dev/null 2>&1 && [ -n "$STRRAY_PLUGIN" ]; then
|
|
63
|
+
# Call a separate script to avoid bash variable issues
|
|
64
|
+
export COMMIT_SHA="$COMMIT_SHA"
|
|
65
|
+
export REPO="$REPO"
|
|
66
|
+
export BRANCH="$BRANCH"
|
|
67
|
+
export AUTHOR="$AUTHOR"
|
|
68
|
+
export STRRAY_PLUGIN="$STRRAY_PLUGIN"
|
|
69
|
+
export MONITORING_LEVEL="$MONITORING_LEVEL"
|
|
70
|
+
export IS_FULL_MONITORING="$([ "$MONITORING_LEVEL" = "full" ] && echo "true" || echo "false")"
|
|
71
|
+
|
|
72
|
+
# Run appropriate monitoring based on hook type
|
|
73
|
+
if [ "$HOOK_NAME" = "post-commit" ]; then
|
|
74
|
+
# LIGHT MONITORING: Quick validation, don't block git workflow
|
|
75
|
+
# Timeout: 2 seconds max, log metrics for monitoring
|
|
76
|
+
START_TIME=$(date +%s)
|
|
77
|
+
timeout 2 node -e "
|
|
78
|
+
(async () => {
|
|
79
|
+
try {
|
|
80
|
+
// Use import resolver to avoid hardcoded dist paths
|
|
81
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
82
|
+
const { LightweightValidator } = await importResolver.importModule('postprocessor/validation/LightweightValidator');
|
|
83
|
+
|
|
84
|
+
const validator = new LightweightValidator();
|
|
85
|
+
const result = await validator.validate();
|
|
86
|
+
|
|
87
|
+
if (result.warnings.length > 0) {
|
|
88
|
+
console.log('⚠️ ' + result.warnings.length + ' warning(s) found:');
|
|
89
|
+
result.warnings.forEach(w => console.log(' ' + w));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!result.passed) {
|
|
93
|
+
console.log('❌ ' + result.errors.length + ' error(s) found:');
|
|
94
|
+
result.errors.forEach(e => console.log(' ' + e));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log('✅ Post-commit: Validation passed in ' + result.duration + 'ms');
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('❌ Post-commit validation failed:', error instanceof Error ? error.message : String(error));
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
104
|
+
" 2>/dev/null
|
|
105
|
+
EXIT_CODE=$?
|
|
106
|
+
END_TIME=$(date +%s)
|
|
107
|
+
DURATION=$((END_TIME - START_TIME))
|
|
108
|
+
|
|
109
|
+
# Log metrics for monitoring (convert to milliseconds)
|
|
110
|
+
DURATION_MS=$((DURATION * 1000))
|
|
111
|
+
echo "HOOK_METRICS: post-commit duration=${DURATION_MS}ms exit_code=${EXIT_CODE}" >&2
|
|
112
|
+
|
|
113
|
+
# Record metrics using metrics collector (direct import for reliability)
|
|
114
|
+
node -e "
|
|
115
|
+
(async () => {
|
|
116
|
+
try {
|
|
117
|
+
const { HookMetricsCollector } = await import('./dist/postprocessor/validation/HookMetricsCollector.js');
|
|
118
|
+
const collector = new HookMetricsCollector();
|
|
119
|
+
collector.recordMetrics('post-commit', ${DURATION_MS}, ${EXIT_CODE});
|
|
120
|
+
} catch (error) {
|
|
121
|
+
// Silently fail if metrics collection fails
|
|
122
|
+
}
|
|
123
|
+
})();
|
|
124
|
+
" 2>/dev/null || true
|
|
125
|
+
|
|
126
|
+
[ $EXIT_CODE -eq 0 ] && exit 0 || exit 1
|
|
127
|
+
else
|
|
128
|
+
# FULL MONITORING: Comprehensive analysis for post-push
|
|
129
|
+
# Timeout: 5 minutes max, comprehensive CI/CD validation
|
|
130
|
+
START_TIME=$(date +%s)
|
|
131
|
+
timeout 300 node -e "
|
|
132
|
+
(async () => {
|
|
133
|
+
try {
|
|
134
|
+
console.log('🚀 Post-push: Comprehensive validation initiated');
|
|
135
|
+
// Use import resolver for environment-aware imports
|
|
136
|
+
const { importResolver } = await import('./utils/import-resolver.js');
|
|
137
|
+
const { ComprehensiveValidator } = await importResolver.importModule('postprocessor/validation/ComprehensiveValidator');
|
|
138
|
+
|
|
139
|
+
const validator = new ComprehensiveValidator();
|
|
140
|
+
const result = await validator.validate();
|
|
141
|
+
|
|
142
|
+
if (result.warnings.length > 0) {
|
|
143
|
+
console.log('⚠️ ' + result.warnings.length + ' warning(s) found:');
|
|
144
|
+
result.warnings.forEach(w => console.log(' ' + w));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!result.passed) {
|
|
148
|
+
console.log('❌ ' + result.errors.length + ' error(s) found:');
|
|
149
|
+
result.errors.forEach(e => console.log(' ' + e));
|
|
150
|
+
process.exit(1);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (result.testResults) {
|
|
154
|
+
console.log('🧪 Tests: ' + result.testResults.passed + '/' + result.testResults.total + ' passed');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
console.log('✅ Post-push: Comprehensive validation passed in ' + result.duration + 'ms');
|
|
158
|
+
} catch (error) {
|
|
159
|
+
console.error('❌ Post-push validation failed:', error instanceof Error ? error.message : String(error));
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
})();
|
|
163
|
+
" 2>/dev/null
|
|
164
|
+
EXIT_CODE=$?
|
|
165
|
+
END_TIME=$(date +%s)
|
|
166
|
+
DURATION=$((END_TIME - START_TIME))
|
|
167
|
+
|
|
168
|
+
# Log comprehensive metrics for monitoring (convert to milliseconds)
|
|
169
|
+
DURATION_MS=$((DURATION * 1000))
|
|
170
|
+
echo "HOOK_METRICS: post-push duration=${DURATION_MS}ms exit_code=${EXIT_CODE}" >&2
|
|
171
|
+
|
|
172
|
+
# Record metrics using metrics collector (direct import for reliability)
|
|
173
|
+
node -e "
|
|
174
|
+
(async () => {
|
|
175
|
+
try {
|
|
176
|
+
const { HookMetricsCollector } = await import('./dist/postprocessor/validation/HookMetricsCollector.js');
|
|
177
|
+
const collector = new HookMetricsCollector();
|
|
178
|
+
collector.recordMetrics('post-push', ${DURATION_MS}, ${EXIT_CODE});
|
|
179
|
+
} catch (error) {
|
|
180
|
+
// Silently fail if metrics collection fails
|
|
181
|
+
}
|
|
182
|
+
})();
|
|
183
|
+
" 2>/dev/null || true
|
|
184
|
+
|
|
185
|
+
[ $EXIT_CODE -eq 0 ] && exit 0 || exit 1
|
|
186
|
+
fi
|
|
187
|
+
else
|
|
188
|
+
echo "Warning: StrRay plugin not found or Node.js not available, skipping post-processor"
|
|
189
|
+
fi
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
# Don't wait for background process
|
|
193
|
+
exit 0
|