0xray 3.1.0 → 3.2.0
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/.gitignore.default +59 -0
- package/.mcp.json +35 -0
- package/.opencode/codex.codex +1 -1
- package/.opencode/commands/auto-format.md +3 -3
- package/.opencode/commands/auto-summary-capture.md +2 -2
- package/.opencode/commands/dependency-audit.md +3 -3
- package/.opencode/commands/enforcer-daily-scan.md +3 -3
- package/.opencode/commands/framework-compliance-audit.md +4 -4
- package/.opencode/commands/interactive-validator.md +2 -2
- package/.opencode/commands/job-summary-logger.md +2 -2
- package/.opencode/commands/mode-switch.md +1 -1
- package/.opencode/commands/model-health-check.md +2 -2
- package/.opencode/commands/performance-analysis.md +2 -2
- package/.opencode/commands/pre-commit-introspection.md +3 -3
- package/.opencode/commands/security-scan.md +3 -3
- package/.opencode/commands/sisyphus-validation.md +3 -3
- package/.opencode/commands/summary-logger.md +6 -6
- package/.opencode/enforcer-config.json +2 -2
- package/.opencode/hooks/post-commit +1 -1
- package/.opencode/init.sh +6 -0
- package/.plugin/plugin.json +11 -0
- package/AGENTS-consumer.md +46 -0
- package/AGENTS.md +2 -12
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/SKILLS.md +140 -0
- package/dist/.gitignore.default +59 -0
- package/dist/AGENTS.md +2 -12
- package/dist/CHANGELOG.md +54 -0
- package/dist/LICENSE +1 -1
- package/dist/README.md +6 -6
- package/dist/SKILLS.md +140 -0
- package/dist/agents/index.js +3 -1
- package/dist/agents/registry.js +13 -0
- package/dist/analytics/consent-manager.js +0 -1
- package/dist/analytics/emerging-pattern-detector.js +0 -1
- package/dist/analytics/pattern-learning-engine.js +0 -1
- package/dist/analytics/pattern-performance-tracker.js +0 -1
- package/dist/analytics/predictive-analytics.js +0 -1
- package/dist/analytics/prompt-pattern-analyzer.js +0 -1
- package/dist/analytics/routing-performance-analyzer.js +0 -1
- package/dist/analytics/routing-refiner.js +1 -2
- package/dist/analytics/simple-pattern-analyzer.js +0 -1
- package/dist/architect/architectural-integrity.js +3 -3
- package/dist/benchmark/performance-benchmark.js +1 -2
- package/dist/cli/commands/antigravity-status.js +23 -23
- package/dist/cli/commands/archive-logs.js +0 -1
- package/dist/cli/commands/credible-init.js +1 -1
- package/dist/cli/commands/hermes-install.js +8 -0
- package/dist/cli/commands/mcp-install.js +1 -1
- package/dist/cli/commands/openclaw-install.js +9 -0
- package/dist/cli/commands/opencode-install.js +35 -0
- package/dist/cli/commands/plugin-commands.js +0 -1
- package/dist/cli/commands/skill-install.js +39 -2
- package/dist/cli/commands/status.js +16 -13
- package/dist/cli/commands/storyteller.js +1 -1
- package/dist/cli/index.js +14 -13
- package/dist/core/activity-logger.js +4 -5
- package/dist/core/adaptive-kernel.js +0 -1
- package/dist/core/agent-spawn-gate.js +1 -1
- package/dist/core/boot-orchestrator.js +14 -25
- package/dist/core/bridge.mjs +4 -5
- package/dist/core/codex-formatter.js +1 -3
- package/dist/core/codex-injector.js +3 -4
- package/dist/core/config-loader.js +36 -29
- package/dist/core/config-paths.js +30 -23
- package/dist/core/context-loader.js +0 -4
- package/dist/core/context-validator.js +0 -1
- package/dist/core/features-config.js +38 -2
- package/dist/core/index.js +2 -2
- package/dist/core/kernel-patterns.js +0 -1
- package/dist/core/logging-config.js +7 -7
- package/dist/core/model-router.js +23 -64
- package/dist/core/orchestrator.js +1 -1
- package/dist/core/system-prompt-generator.js +0 -1
- package/dist/core/xray-activation.js +3 -4
- package/dist/delegation/agent-delegator.js +2 -3
- package/dist/delegation/agent-expertise.js +0 -1
- package/dist/delegation/analytics/index.js +0 -1
- package/dist/delegation/analytics/learning-engine.js +0 -1
- package/dist/delegation/analytics/outcome-tracker.js +0 -1
- package/dist/delegation/analytics/routing-analytics.js +0 -1
- package/dist/delegation/ast-code-parser.js +0 -1
- package/dist/delegation/complexity-analyzer.js +0 -1
- package/dist/delegation/dependency-graph-builder.js +0 -1
- package/dist/delegation/index.js +0 -1
- package/dist/delegation/metrics-aggregator.js +0 -1
- package/dist/delegation/session-coordinator.js +0 -1
- package/dist/delegation/strategy-selector.js +0 -1
- package/dist/delegation/voting-coordinator.js +0 -1
- package/dist/delegation/voting-types.js +0 -1
- package/dist/delegation/weighted-voting-aggregator.js +0 -1
- package/dist/enforcement/core/index.js +0 -1
- package/dist/enforcement/core/rule-executor.js +0 -1
- package/dist/enforcement/core/rule-hierarchy.js +0 -1
- package/dist/enforcement/core/rule-registry.js +0 -1
- package/dist/enforcement/core/violation-fixer.js +0 -1
- package/dist/enforcement/enforcer-tools.js +2 -2
- package/dist/enforcement/index.js +0 -1
- package/dist/enforcement/loaders/agent-triage-loader.js +0 -1
- package/dist/enforcement/loaders/agents-md-validation-loader.js +0 -1
- package/dist/enforcement/loaders/base-loader.js +0 -1
- package/dist/enforcement/loaders/codex-loader.js +2 -3
- package/dist/enforcement/loaders/index.js +0 -1
- package/dist/enforcement/loaders/loader-orchestrator.js +0 -1
- package/dist/enforcement/loaders/processor-loader.js +0 -1
- package/dist/enforcement/types.js +0 -1
- package/dist/enforcement/validators/architecture-validators.js +0 -1
- package/dist/enforcement/validators/base-validator.js +0 -1
- package/dist/enforcement/validators/code-quality-validators.js +0 -1
- package/dist/enforcement/validators/index.js +0 -1
- package/dist/enforcement/validators/security-validators.js +0 -1
- package/dist/enforcement/validators/testing-validators.js +0 -1
- package/dist/enforcement/validators/validator-registry.js +0 -1
- package/dist/execution/opencode-cli-invoker.js +1 -1
- package/dist/governance/codex-policy.service.js +0 -1
- package/dist/governance/governance-service.js +1 -1
- package/dist/governance/llm-governance-provider.js +14 -1
- package/dist/index.js +3 -5
- package/dist/inference/inference-agent-invoker.js +67 -0
- package/dist/inference/inference-applier.js +178 -0
- package/dist/inference/inference-cycle.js +52 -828
- package/dist/inference/inference-proposal-generator.js +149 -0
- package/dist/infrastructure/iac-validator.js +465 -0
- package/dist/infrastructure/schemas/cloud-schemas.js +488 -0
- package/dist/integrations/base/ExampleIntegration.js +0 -1
- package/dist/integrations/base/Integration.js +0 -1
- package/dist/integrations/base/README.md +1 -1
- package/dist/integrations/base/index.js +0 -1
- package/dist/integrations/base/registry.js +0 -1
- package/dist/integrations/base/types.js +0 -1
- package/dist/integrations/enforcement-gate.js +5 -5
- package/dist/integrations/governance/governance-client.js +0 -1
- package/dist/integrations/governance/index.js +11 -19
- package/dist/integrations/governance/types.js +0 -1
- package/dist/integrations/grok/grok-cli.js +20 -6
- package/dist/integrations/grok/hooks/pre-tool-use.js +3 -3
- package/dist/integrations/grok/plugin/0xray/.mcp.json +16 -4
- package/dist/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
- package/dist/integrations/hermes-agent/__init__.py +29 -14
- package/dist/integrations/hermes-agent/bridge.mjs +76 -4
- package/dist/integrations/hermes-agent/schemas.py +49 -0
- package/dist/integrations/hermes-agent/test_plugin.py +7 -7
- package/dist/integrations/hermes-agent/tools.py +107 -3
- package/dist/integrations/openclaw/README.md +6 -6
- package/dist/integrations/openclaw/api-server.js +0 -1
- package/dist/integrations/openclaw/client.js +0 -1
- package/dist/integrations/openclaw/config.js +1 -2
- package/dist/integrations/openclaw/hooks/{strray-hooks.js → xray-hooks.js} +0 -1
- package/dist/integrations/openclaw/index.js +2 -3
- package/dist/integrations/openclaw/types.js +3 -4
- package/dist/integrations/plugins/index.js +0 -1
- package/dist/integrations/plugins/plugin-integration.js +1 -2
- package/dist/integrations/plugins/plugin-registry.js +1 -2
- package/dist/mcps/agent-resolver.js +0 -1
- package/dist/mcps/architect-tools.server.js +121 -186
- package/dist/mcps/auto-format.server.js +57 -75
- package/dist/mcps/boot-orchestrator.server.js +68 -86
- package/dist/mcps/config/config-loader.js +46 -9
- package/dist/mcps/config/plugin-server-registry.js +0 -1
- package/dist/mcps/enforcer-tools.server.js +208 -274
- package/dist/mcps/estimation.server.js +65 -108
- package/dist/mcps/framework-compliance-audit.server.js +53 -82
- package/dist/mcps/framework-help.server.js +73 -90
- package/dist/mcps/governance.server.js +104 -152
- package/dist/mcps/knowledge-skills/api-design.server.js +35 -66
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +35 -66
- package/dist/mcps/knowledge-skills/bug-triage-specialist.server.js +125 -165
- package/dist/mcps/knowledge-skills/code-analyzer.server.js +211 -238
- package/dist/mcps/knowledge-skills/code-review.server.js +109 -143
- package/dist/mcps/knowledge-skills/content-creator.server.js +205 -227
- package/dist/mcps/knowledge-skills/database-design.server.js +117 -151
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +125 -158
- package/dist/mcps/knowledge-skills/git-workflow.server.js +36 -68
- package/dist/mcps/knowledge-skills/growth-strategist.server.js +303 -325
- package/dist/mcps/knowledge-skills/log-monitor.server.js +141 -161
- package/dist/mcps/knowledge-skills/mobile-development.server.js +172 -202
- package/dist/mcps/knowledge-skills/multimodal-looker.server.js +124 -160
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +89 -139
- package/dist/mcps/knowledge-skills/project-analysis.server.js +132 -219
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +117 -151
- package/dist/mcps/knowledge-skills/security-audit.server.js +17 -144
- package/dist/mcps/knowledge-skills/seo-consultant.server.js +22 -214
- package/dist/mcps/knowledge-skills/session-management.server.js +15 -91
- package/dist/mcps/knowledge-skills/skill-invocation.server.js +83 -359
- package/dist/mcps/knowledge-skills/strategist.server.js +12 -57
- package/dist/mcps/knowledge-skills/tech-writer.server.js +18 -193
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +20 -192
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +19 -157
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +24 -297
- package/dist/mcps/lint.server.js +51 -92
- package/dist/mcps/model-health-check.server.js +34 -61
- package/dist/mcps/orchestrator/aside-context.js +207 -0
- package/dist/mcps/orchestrator/handlers/complexity-handler.js +5 -1
- package/dist/mcps/orchestrator/handlers/status-handler.js +8 -1
- package/dist/mcps/orchestrator/handlers/task-handler.js +5 -0
- package/dist/mcps/orchestrator/index.js +5 -0
- package/dist/mcps/orchestrator/server.js +65 -9
- package/dist/mcps/orchestrator.server.js +2 -1
- package/dist/mcps/performance-analysis.server.js +57 -88
- package/dist/mcps/processor-pipeline.server.js +70 -100
- package/dist/mcps/registry.json +1 -1
- package/dist/mcps/researcher.server.js +81 -154
- package/dist/mcps/security-scan.server.js +57 -71
- package/dist/mcps/shared/knowledge-skill-base.js +11 -4
- package/dist/mcps/state-manager.server.js +127 -155
- package/dist/metrics/agent-metrics.js +1 -1
- package/dist/monitoring/nudge-watchdog.js +0 -1
- package/dist/nucleus/default-plugins.js +13 -19
- package/dist/nucleus/index.js +0 -1
- package/dist/orchestrator/agent-spawn-governor.js +0 -1
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +2 -2
- package/dist/orchestrator/intelligent-commit-batcher.js +2 -11
- package/dist/orchestrator/multi-agent-orchestration-coordinator.js +1 -2
- package/dist/orchestrator/orchestrator.js +8 -19
- package/dist/orchestrator/self-direction-activation.js +0 -1
- package/dist/orchestrator/universal-registry-bridge.js +1 -2
- package/dist/performance/performance-budget-enforcer.js +0 -1
- package/dist/performance/performance-regression-tester.js +0 -1
- package/dist/plugin/plugin-codex-context.js +87 -0
- package/dist/plugin/plugin-helpers.js +155 -0
- package/dist/plugin/plugin-logger.js +46 -0
- package/dist/plugin/plugin-modules.js +144 -0
- package/dist/plugin/plugin-quality-gate.js +88 -0
- package/dist/plugin/plugin-types.js +1 -0
- package/dist/plugin/xray-codex-injection.js +39 -558
- package/dist/postprocessor/PostProcessor.js +7 -13
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +50 -0
- package/dist/postprocessor/config/ProcessorConfigLoader.js +16 -0
- package/dist/postprocessor/integration.js +194 -0
- package/dist/postprocessor/metamorphosis/SelfProposalEngine.js +472 -0
- package/dist/postprocessor/metamorphosis/index.js +1 -0
- package/dist/postprocessor/redeploy/RetryHandler.js +118 -0
- package/dist/postprocessor/services/RegressionAnalysisService.js +2 -3
- package/dist/postprocessor/triggers/APITrigger.js +0 -1
- package/dist/postprocessor/triggers/GitHookTrigger.js +4 -4
- package/dist/postprocessor/triggers/WebhookTrigger.js +0 -1
- package/dist/processors/implementations/agents-md-validation-processor.js +0 -1
- package/dist/processors/implementations/async-pattern-processor.js +0 -1
- package/dist/processors/implementations/console-log-guard-processor.js +0 -1
- package/dist/processors/implementations/coverage-analysis-processor.js +0 -1
- package/dist/processors/implementations/inference-improvement-processor.js +2 -10
- package/dist/processors/implementations/log-protection-processor.js +0 -1
- package/dist/processors/implementations/nudge-processor.js +0 -1
- package/dist/processors/implementations/performance-budget-processor.js +0 -1
- package/dist/processors/implementations/postprocessor-chain-validator.js +0 -1
- package/dist/processors/implementations/publish-preflight-processor.js +4 -13
- package/dist/processors/implementations/session-summary-processor.js +8 -16
- package/dist/processors/implementations/spawn-governance-processor.js +0 -1
- package/dist/processors/implementations/storytelling-trigger-processor.js +3 -29
- package/dist/processors/implementations/test-auto-creation-processor.js +0 -1
- package/dist/processors/implementations/typescript-compilation-processor.js +0 -1
- package/dist/processors/implementations/version-compliance-processor.js +0 -1
- package/dist/processors/processor-interfaces.js +0 -1
- package/dist/processors/processor-types.js +0 -1
- package/dist/public/about.html +6 -6
- package/dist/public/enterprise.html +1 -1
- package/dist/public/features.html +2 -2
- package/dist/public/index.html +4 -4
- package/dist/reporting/report-formatter.js +1 -1
- package/dist/scripts/activate-kernel-pipeline.js +2 -2
- package/dist/scripts/integration.js +0 -1
- package/dist/scripts/pre-command +1 -1
- package/dist/security/comprehensive-security-audit.js +0 -1
- package/dist/security/security-agent-coordinator.js +0 -1
- package/dist/security/security-auditor.js +0 -1
- package/dist/security/security-hardener.js +0 -1
- package/dist/security/security-hardening-system.js +0 -1
- package/dist/security/security-headers.js +0 -1
- package/dist/security/security-orchestration-layer.js +0 -1
- package/dist/services/inference-tuner.js +1 -2
- package/dist/session/session-cleanup-manager.js +0 -1
- package/dist/session/session-monitor.js +0 -1
- package/dist/session/session-state-manager.js +0 -1
- package/dist/skills/api-design/SKILL.md +1 -1
- package/dist/skills/architect-tools/SKILL.md +1 -1
- package/dist/skills/architecture-patterns/SKILL.md +1 -1
- package/dist/skills/auto-format/SKILL.md +1 -1
- package/dist/skills/boot-orchestrator/SKILL.md +1 -1
- package/dist/skills/bug-triage/SKILL.md +1 -1
- package/dist/skills/code-analyzer/SKILL.md +1 -1
- package/dist/skills/code-review/SKILL.md +1 -1
- package/dist/skills/enforcer/SKILL.md +1 -1
- package/dist/skills/framework-compliance-audit/SKILL.md +1 -1
- package/dist/skills/git-workflow/SKILL.md +1 -1
- package/dist/skills/hermes-agent/SKILL.md +2 -2
- package/dist/skills/inference-improve/SKILL.md +1 -1
- package/dist/skills/lint/SKILL.md +1 -1
- package/dist/skills/log-monitor/SKILL.md +1 -1
- package/dist/skills/model-health-check/SKILL.md +1 -1
- package/dist/skills/multimodal-looker/SKILL.md +1 -1
- package/dist/skills/orchestrator/SKILL.md +1 -1
- package/dist/skills/performance-analysis/SKILL.md +1 -1
- package/dist/skills/performance-optimization/SKILL.md +1 -1
- package/dist/skills/processor-pipeline/SKILL.md +1 -1
- package/dist/skills/project-analysis/SKILL.md +1 -1
- package/dist/skills/refactoring-strategies/SKILL.md +1 -1
- package/dist/skills/registry.json +1 -1
- package/dist/skills/researcher/SKILL.md +1 -1
- package/dist/skills/security-audit/SKILL.md +1 -1
- package/dist/skills/security-scan/SKILL.md +1 -1
- package/dist/skills/session-management/SKILL.md +1 -1
- package/dist/skills/state-manager/SKILL.md +1 -1
- package/dist/skills/storyteller/SKILL.md +1 -1
- package/dist/skills/testing-best-practices/SKILL.md +1 -1
- package/dist/skills/testing-strategy/SKILL.md +1 -1
- package/dist/skills/ui-ux-design/SKILL.md +1 -1
- package/dist/skills/xray-orchestrator/index.js +0 -1
- package/dist/state/index.js +0 -1
- package/dist/state/state-manager.js +1 -2
- package/dist/utils/codex-parser.js +0 -1
- package/dist/utils/import-resolver.js +1 -1
- package/dist/utils/language-detector.js +0 -1
- package/dist/utils/path-resolver.js +2 -2
- package/dist/utils/shutdown-handler.js +0 -1
- package/dist/validation/agent-config-validator.js +280 -0
- package/dist/validation/orchestration-flow-validator.js +606 -0
- package/package.json +10 -3
- package/scripts/hooks/pre-command +1 -1
- package/scripts/hooks/run-hook.js +2 -2
- package/scripts/node/auto-reflection-generator.mjs +30 -36
- package/scripts/node/govern-reflection.mjs +1 -1
- package/scripts/node/postinstall.cjs +37 -2
- package/scripts/node/release.mjs +2 -2
- package/scripts/node/setup-xai-oauth.mjs +244 -0
- package/scripts/node/setup.cjs +28 -0
- package/scripts/node/universal-version-manager.js +8 -8
- package/scripts/node/version-manager.mjs +1 -1
- package/src/integrations/grok/plugin/0xray/.mcp.json +16 -4
- package/src/integrations/grok/plugin/0xray/hooks/hooks.json +2 -2
- package/src/mcps/agent-resolver.ts +0 -1
- package/src/mcps/architect-tools.server.ts +130 -212
- package/src/mcps/auto-format.server.ts +75 -104
- package/src/mcps/boot-orchestrator.server.ts +72 -97
- package/src/mcps/config/__tests__/config-loader.test.ts +33 -37
- package/src/mcps/config/config-loader.ts +57 -11
- package/src/mcps/config/plugin-server-registry.ts +0 -1
- package/src/mcps/enforcer-tools.server.ts +218 -295
- package/src/mcps/estimation.server.ts +64 -123
- package/src/mcps/framework-compliance-audit.server.ts +54 -96
- package/src/mcps/framework-help.server.ts +76 -97
- package/src/mcps/governance.server.ts +104 -164
- package/src/mcps/knowledge-skills/api-design.server.ts +35 -73
- package/src/mcps/knowledge-skills/architecture-patterns.server.ts +34 -73
- package/src/mcps/knowledge-skills/bug-triage-specialist.server.ts +149 -194
- package/src/mcps/knowledge-skills/code-analyzer.server.ts +223 -255
- package/src/mcps/knowledge-skills/code-review.server.ts +116 -158
- package/src/mcps/knowledge-skills/content-creator.server.ts +221 -248
- package/src/mcps/knowledge-skills/database-design.server.ts +120 -161
- package/src/mcps/knowledge-skills/devops-deployment.server.ts +128 -168
- package/src/mcps/knowledge-skills/git-workflow.server.ts +34 -78
- package/src/mcps/knowledge-skills/growth-strategist.server.ts +324 -362
- package/src/mcps/knowledge-skills/log-monitor.server.ts +70 -97
- package/src/mcps/knowledge-skills/mobile-development.server.ts +18 -58
- package/src/mcps/knowledge-skills/multimodal-looker.server.ts +15 -61
- package/src/mcps/knowledge-skills/performance-optimization.server.ts +14 -75
- package/src/mcps/knowledge-skills/project-analysis.server.ts +14 -121
- package/src/mcps/knowledge-skills/refactoring-strategies.server.ts +15 -61
- package/src/mcps/knowledge-skills/security-audit.server.ts +20 -158
- package/src/mcps/knowledge-skills/seo-consultant.server.ts +25 -228
- package/src/mcps/knowledge-skills/session-management.server.ts +19 -107
- package/src/mcps/knowledge-skills/skill-invocation.server.ts +89 -380
- package/src/mcps/knowledge-skills/strategist.server.ts +15 -65
- package/src/mcps/knowledge-skills/tech-writer.server.ts +21 -206
- package/src/mcps/knowledge-skills/testing-best-practices.server.ts +23 -205
- package/src/mcps/knowledge-skills/testing-strategy.server.ts +22 -166
- package/src/mcps/knowledge-skills/ui-ux-design.server.ts +27 -343
- package/src/mcps/lint.server.ts +53 -106
- package/src/mcps/model-health-check.server.ts +35 -71
- package/src/mcps/orchestrator/aside-context.ts +245 -0
- package/src/mcps/orchestrator/handlers/complexity-handler.ts +9 -3
- package/src/mcps/orchestrator/handlers/status-handler.ts +11 -1
- package/src/mcps/orchestrator/handlers/task-handler.ts +8 -1
- package/src/mcps/orchestrator/index.ts +29 -0
- package/src/mcps/orchestrator/server.ts +81 -25
- package/src/mcps/orchestrator/types.ts +37 -0
- package/src/mcps/orchestrator.server.ts +2 -1
- package/src/mcps/performance-analysis.server.ts +60 -103
- package/src/mcps/processor-pipeline.server.ts +72 -109
- package/src/mcps/registry.json +1 -1
- package/src/mcps/researcher.server.ts +88 -176
- package/src/mcps/security-scan.server.ts +58 -77
- package/src/mcps/shared/knowledge-skill-base.ts +12 -4
- package/src/mcps/state-manager.server.ts +132 -172
- package/src/opencode/codex.codex +1 -1
- package/src/opencode/commands/auto-format.md +3 -3
- package/src/opencode/commands/auto-summary-capture.md +2 -2
- package/src/opencode/commands/dependency-audit.md +3 -3
- package/src/opencode/commands/enforcer-daily-scan.md +3 -3
- package/src/opencode/commands/framework-compliance-audit.md +4 -4
- package/src/opencode/commands/interactive-validator.md +2 -2
- package/src/opencode/commands/job-summary-logger.md +2 -2
- package/src/opencode/commands/mode-switch.md +1 -1
- package/src/opencode/commands/model-health-check.md +2 -2
- package/src/opencode/commands/performance-analysis.md +2 -2
- package/src/opencode/commands/pre-commit-introspection.md +3 -3
- package/src/opencode/commands/security-scan.md +3 -3
- package/src/opencode/commands/sisyphus-validation.md +3 -3
- package/src/opencode/commands/summary-logger.md +6 -6
- package/src/opencode/enforcer-config.json +2 -2
- package/src/skills/api-design/SKILL.md +1 -1
- package/src/skills/architect-tools/SKILL.md +1 -1
- package/src/skills/architecture-patterns/SKILL.md +1 -1
- package/src/skills/auto-format/SKILL.md +1 -1
- package/src/skills/boot-orchestrator/SKILL.md +1 -1
- package/src/skills/bug-triage/SKILL.md +1 -1
- package/src/skills/code-analyzer/SKILL.md +1 -1
- package/src/skills/code-review/SKILL.md +1 -1
- package/src/skills/enforcer/SKILL.md +1 -1
- package/src/skills/framework-compliance-audit/SKILL.md +1 -1
- package/src/skills/git-workflow/SKILL.md +1 -1
- package/src/skills/hermes-agent/SKILL.md +2 -2
- package/src/skills/inference-improve/SKILL.md +1 -1
- package/src/skills/lint/SKILL.md +1 -1
- package/src/skills/log-monitor/SKILL.md +1 -1
- package/src/skills/model-health-check/SKILL.md +1 -1
- package/src/skills/multimodal-looker/SKILL.md +1 -1
- package/src/skills/orchestrator/SKILL.md +1 -1
- package/src/skills/performance-analysis/SKILL.md +1 -1
- package/src/skills/performance-optimization/SKILL.md +1 -1
- package/src/skills/processor-pipeline/SKILL.md +1 -1
- package/src/skills/project-analysis/SKILL.md +1 -1
- package/src/skills/refactoring-strategies/SKILL.md +1 -1
- package/src/skills/registry.json +1 -1
- package/src/skills/researcher/SKILL.md +1 -1
- package/src/skills/security-audit/SKILL.md +1 -1
- package/src/skills/security-scan/SKILL.md +1 -1
- package/src/skills/session-management/SKILL.md +1 -1
- package/src/skills/state-manager/SKILL.md +1 -1
- package/src/skills/storyteller/SKILL.md +1 -1
- package/src/skills/testing-best-practices/SKILL.md +1 -1
- package/src/skills/testing-strategy/SKILL.md +1 -1
- package/src/skills/ui-ux-design/SKILL.md +1 -1
- package/src/skills/xray-orchestrator/index.ts +0 -1
- package/xray/agents_template.md +46 -0
- package/xray/codex.json +598 -0
- package/dist/nucleus/orchestrator.js +0 -479
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Grok CLI Integration for
|
|
2
|
+
* Grok CLI Integration for 0xRay
|
|
3
3
|
*
|
|
4
4
|
* This module provides the integration points for using 0xRay with the official Grok CLI.
|
|
5
5
|
*
|
|
@@ -18,6 +18,7 @@ import { frameworkLogger } from '../../core/framework-logger.js';
|
|
|
18
18
|
import fs from 'fs';
|
|
19
19
|
import path from 'path';
|
|
20
20
|
import { execSync } from 'child_process';
|
|
21
|
+
import { syncBuiltinSkills } from '../../cli/commands/skill-install.js';
|
|
21
22
|
// ESM-compatible __dirname (this file is compiled to ESM)
|
|
22
23
|
const __dirname = path.dirname(new URL(import.meta.url).pathname);
|
|
23
24
|
export async function installForGrokCLI(options = {}) {
|
|
@@ -47,6 +48,13 @@ export async function installForGrokCLI(options = {}) {
|
|
|
47
48
|
fs.cpSync(sourceDir, targetPluginDir, { recursive: true, force: true });
|
|
48
49
|
frameworkLogger.log('grok-integration', 'plugin-copied', 'info', { destination: targetPluginDir });
|
|
49
50
|
console.log(`\x1b[32m✓ Copied Grok plugin to ${targetPluginDir}\x1b[0m`);
|
|
51
|
+
// Sync builtin skills to Grok plugin skills dir
|
|
52
|
+
const grokSkillsDir = path.join(targetPluginDir, 'skills');
|
|
53
|
+
const skillsCopied = syncBuiltinSkills(grokSkillsDir);
|
|
54
|
+
if (skillsCopied > 0) {
|
|
55
|
+
console.log(`\x1b[32m✓ Synced ${skillsCopied} builtin skills to Grok plugin\x1b[0m`);
|
|
56
|
+
}
|
|
57
|
+
frameworkLogger.log('grok-integration', 'skills-synced', 'info', { count: skillsCopied });
|
|
50
58
|
// Attempt auto-trust (best effort)
|
|
51
59
|
try {
|
|
52
60
|
execSync(`grok plugins trust "${targetPluginDir}"`, { stdio: 'ignore' });
|
|
@@ -59,15 +67,21 @@ export async function installForGrokCLI(options = {}) {
|
|
|
59
67
|
// Register MCP servers via grok mcp add (most reliable mechanism)
|
|
60
68
|
const govMcpPath = path.resolve(__dirname, '..', '..', '..', 'dist/mcps/governance.server.js');
|
|
61
69
|
const skillsMcpPath = path.resolve(__dirname, '..', '..', '..', 'dist/mcps/knowledge-skills/skill-invocation.server.js');
|
|
70
|
+
const orchMcpPath = path.resolve(__dirname, '..', '..', '..', 'dist/mcps/orchestrator.server.js');
|
|
71
|
+
const enforcerMcpPath = path.resolve(__dirname, '..', '..', '..', 'dist/mcps/enforcer-tools.server.js');
|
|
62
72
|
try {
|
|
63
|
-
execSync(`grok mcp add
|
|
64
|
-
execSync(`grok mcp add
|
|
65
|
-
|
|
73
|
+
execSync(`grok mcp add xray-governance --command node --args "${govMcpPath}" --env "XRAY_FORCE_MCP_GOVERNANCE=true" --env "XRAY_ROOT=${process.cwd()}"`, { stdio: 'pipe' });
|
|
74
|
+
execSync(`grok mcp add xray-skills --command node --args "${skillsMcpPath}" --env "XRAY_ROOT=${process.cwd()}"`, { stdio: 'pipe' });
|
|
75
|
+
execSync(`grok mcp add xray-orchestrator --command node --args "${orchMcpPath}" --env "XRAY_ROOT=${process.cwd()}"`, { stdio: 'pipe' });
|
|
76
|
+
execSync(`grok mcp add xray-enforcer --command node --args "${enforcerMcpPath}" --env "XRAY_ROOT=${process.cwd()}"`, { stdio: 'pipe' });
|
|
77
|
+
console.log('\x1b[32m✓ Registered xray MCP servers with Grok CLI\x1b[0m');
|
|
66
78
|
}
|
|
67
79
|
catch {
|
|
68
80
|
console.log('\nCould not auto-register MCP servers. Run manually:');
|
|
69
|
-
console.log(` grok mcp add
|
|
70
|
-
console.log(` grok mcp add
|
|
81
|
+
console.log(` grok mcp add xray-governance --command node --args "${govMcpPath}"`);
|
|
82
|
+
console.log(` grok mcp add xray-skills --command node --args "${skillsMcpPath}"`);
|
|
83
|
+
console.log(` grok mcp add xray-orchestrator --command node --args "${orchMcpPath}"`);
|
|
84
|
+
console.log(` grok mcp add xray-enforcer --command node --args "${enforcerMcpPath}"`);
|
|
71
85
|
}
|
|
72
86
|
console.log('\n✅ 0xRay is now installed as a first-class Grok CLI plugin!');
|
|
73
87
|
console.log('Restart Grok or run `grok` to load the new hooks and MCP servers.');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* Grok CLI PreToolUse Hook Handler for
|
|
3
|
+
* Grok CLI PreToolUse Hook Handler for 0xRay — First Class Citizen
|
|
4
4
|
*
|
|
5
5
|
* Real governance enforcement hook.
|
|
6
6
|
* When Grok is about to execute a tool (write_file, edit, terminal cmd, etc.),
|
|
@@ -16,7 +16,7 @@ function findGovernanceCore() {
|
|
|
16
16
|
const here = path.dirname(new URL(import.meta.url).pathname);
|
|
17
17
|
|
|
18
18
|
// Priority: explicit dev root
|
|
19
|
-
const devRoot = process.env.
|
|
19
|
+
const devRoot = process.env.XRAY_ROOT;
|
|
20
20
|
if (devRoot) {
|
|
21
21
|
const devCandidate = path.resolve(devRoot, 'dist/governance/governance-core.js');
|
|
22
22
|
if (fs.existsSync(devCandidate)) return devCandidate;
|
|
@@ -49,7 +49,7 @@ function walkUpForCore(startDir, maxLevels = 8) {
|
|
|
49
49
|
if (fs.existsSync(pkgPath)) {
|
|
50
50
|
try {
|
|
51
51
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
52
|
-
if (pkg.name === '
|
|
52
|
+
if (pkg.name === '0xray') {
|
|
53
53
|
results.push(path.resolve(current, 'dist/governance/governance-core.js'));
|
|
54
54
|
results.push(path.resolve(current, 'governance/governance-core.js'));
|
|
55
55
|
}
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"mcpServers": {
|
|
3
|
-
"
|
|
3
|
+
"xray-governance": {
|
|
4
4
|
"command": "npx",
|
|
5
5
|
"args": ["-y", "0xray", "mcp", "governance"],
|
|
6
6
|
"env": {
|
|
7
7
|
"XRAY_FORCE_MCP_GOVERNANCE": "true"
|
|
8
8
|
}
|
|
9
9
|
},
|
|
10
|
-
"
|
|
10
|
+
"xray-skills": {
|
|
11
11
|
"command": "npx",
|
|
12
12
|
"args": ["-y", "0xray", "mcp", "skills"]
|
|
13
13
|
},
|
|
14
|
-
"
|
|
14
|
+
"xray-orchestrator": {
|
|
15
15
|
"command": "npx",
|
|
16
16
|
"args": ["-y", "0xray", "mcp", "orchestrator"]
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"xray-enforcer": {
|
|
19
19
|
"command": "npx",
|
|
20
20
|
"args": ["-y", "0xray", "mcp", "enforcer"]
|
|
21
|
+
},
|
|
22
|
+
"xray-researcher": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "0xray", "mcp", "researcher"]
|
|
25
|
+
},
|
|
26
|
+
"xray-code-review": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": ["-y", "0xray", "mcp", "code-review"]
|
|
29
|
+
},
|
|
30
|
+
"xray-architect-tools": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["-y", "0xray", "mcp", "architect-tools"]
|
|
21
33
|
}
|
|
22
34
|
}
|
|
23
35
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"type": "command",
|
|
9
9
|
"command": "node",
|
|
10
10
|
"args": [
|
|
11
|
-
"${
|
|
11
|
+
"${XRAY_AI_PATH:-node_modules/0xray}/dist/integrations/grok/hooks/pre-tool-use.js"
|
|
12
12
|
],
|
|
13
13
|
"timeout": 30000
|
|
14
14
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{
|
|
22
22
|
"type": "command",
|
|
23
23
|
"command": "echo",
|
|
24
|
-
"args": ["[0xRay] Grok session started with
|
|
24
|
+
"args": ["[0xRay] Grok session started with 0xRay governance enabled"]
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
27
|
}
|
|
@@ -36,25 +36,24 @@ logger = logging.getLogger("xray-hermes")
|
|
|
36
36
|
PLUGIN_DIR = Path(__file__).resolve().parent
|
|
37
37
|
BRIDGE_PATH = PLUGIN_DIR / "bridge.mjs"
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
def _find_project_root() -> Path:
|
|
40
|
+
"""Walk up from cwd to find project root."""
|
|
41
|
+
cwd = Path.cwd()
|
|
42
|
+
home = Path.home()
|
|
43
|
+
override = os.environ.get("XRAY_PROJECT_ROOT")
|
|
44
|
+
if override:
|
|
45
|
+
return Path(override).resolve()
|
|
46
|
+
d = cwd
|
|
47
|
+
while True:
|
|
48
|
+
if (d / "node_modules" / "0xray" / "package.json").exists():
|
|
47
49
|
return d
|
|
48
|
-
|
|
49
|
-
if (d / ".opencode" / "xray" / "features.json").exists():
|
|
50
|
+
if (d / ".xray" / "features.json").exists():
|
|
50
51
|
return d
|
|
51
|
-
# package.json but not home dir
|
|
52
52
|
if d != home and (d / "package.json").exists():
|
|
53
53
|
return d
|
|
54
54
|
d = d.parent
|
|
55
55
|
if d == d.parent:
|
|
56
56
|
break
|
|
57
|
-
|
|
58
57
|
return cwd
|
|
59
58
|
|
|
60
59
|
PROJECT_ROOT = _find_project_root()
|
|
@@ -682,6 +681,18 @@ def register(ctx):
|
|
|
682
681
|
schema=schemas.XRAY_HOOKS,
|
|
683
682
|
handler=tools.xray_hooks,
|
|
684
683
|
)
|
|
684
|
+
ctx.register_tool(
|
|
685
|
+
name="xray_skill_install",
|
|
686
|
+
toolset="xray-hermes",
|
|
687
|
+
schema=schemas.XRAY_SKILL_INSTALL,
|
|
688
|
+
handler=tools.xray_skill_install,
|
|
689
|
+
)
|
|
690
|
+
ctx.register_tool(
|
|
691
|
+
name="xray_skill_registry",
|
|
692
|
+
toolset="xray-hermes",
|
|
693
|
+
schema=schemas.XRAY_SKILL_REGISTRY,
|
|
694
|
+
handler=tools.xray_skill_registry,
|
|
695
|
+
)
|
|
685
696
|
|
|
686
697
|
# ── Register hooks ────────────────────────────────────────
|
|
687
698
|
ctx.register_hook("pre_tool_call", _on_pre_tool_call)
|
|
@@ -709,10 +720,14 @@ def register(ctx):
|
|
|
709
720
|
_ensure_log_dir()
|
|
710
721
|
_log_to_file("activity.log",
|
|
711
722
|
f"[plugin-loaded] Xray Hermes Plugin v2.2 — "
|
|
712
|
-
f"
|
|
723
|
+
f"6 tools, 2 hooks, subagent enforcement, bridge={BRIDGE_PATH.exists()}")
|
|
724
|
+
|
|
725
|
+
# Log session-start since on_session_start may not fire in oneshot mode
|
|
726
|
+
_log_to_file("activity.log",
|
|
727
|
+
f"[session-start] session={session_id}")
|
|
713
728
|
|
|
714
729
|
logger.info(
|
|
715
|
-
"[xray] Plugin v2.2 loaded:
|
|
730
|
+
"[xray] Plugin v2.2 loaded: 6 tools, 2 hooks, "
|
|
716
731
|
"subagent enforcement active, bridge=%s",
|
|
717
732
|
BRIDGE_PATH.exists(),
|
|
718
733
|
)
|
|
@@ -58,7 +58,7 @@ function findProjectRoot() {
|
|
|
58
58
|
|
|
59
59
|
const candidates = [
|
|
60
60
|
process.cwd(),
|
|
61
|
-
join(homedir(), "dev", "
|
|
61
|
+
join(homedir(), "dev", "xray"),
|
|
62
62
|
join(dirname(__dirname), "..", "..", "..", ".."), // plugin dir -> project root
|
|
63
63
|
];
|
|
64
64
|
|
|
@@ -98,6 +98,30 @@ function logToActivity(logDir, message) {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
function logRoutingOutcome(logDir, outcome) {
|
|
102
|
+
try {
|
|
103
|
+
const routingPath = join(logDir, "routing-outcomes.json");
|
|
104
|
+
let entries = [];
|
|
105
|
+
if (existsSync(routingPath)) {
|
|
106
|
+
try { entries = JSON.parse(readFileSync(routingPath, "utf-8")); } catch { entries = []; }
|
|
107
|
+
}
|
|
108
|
+
if (!Array.isArray(entries)) entries = [];
|
|
109
|
+
entries.push({
|
|
110
|
+
taskId: outcome.taskId || `bridge-${Date.now()}`,
|
|
111
|
+
taskDescription: outcome.taskDescription || outcome.tool || "unknown",
|
|
112
|
+
routedAgent: outcome.routedAgent || "direct",
|
|
113
|
+
routedSkill: outcome.routedSkill || outcome.tool || "unknown",
|
|
114
|
+
confidence: outcome.confidence || 0.8,
|
|
115
|
+
success: outcome.success !== false,
|
|
116
|
+
routingMethod: outcome.routingMethod || "bridge",
|
|
117
|
+
timestamp: new Date().toISOString(),
|
|
118
|
+
});
|
|
119
|
+
writeFileSync(routingPath, JSON.stringify(entries, null, 2), "utf-8");
|
|
120
|
+
} catch {
|
|
121
|
+
// Silent fail
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
101
125
|
function logToolEvent(logDir, eventType, tool, args = {}, result = null) {
|
|
102
126
|
try {
|
|
103
127
|
const eventsPath = join(logDir, "plugin-tool-events.log");
|
|
@@ -430,6 +454,15 @@ async function handlePostProcess(input, projectRoot, logDir) {
|
|
|
430
454
|
|
|
431
455
|
logToActivity(logDir, `post-process: complete duration=${duration}ms processors=${processorResult.success}`);
|
|
432
456
|
|
|
457
|
+
// Log routing outcome for test verification
|
|
458
|
+
logRoutingOutcome(logDir, {
|
|
459
|
+
tool,
|
|
460
|
+
taskDescription: `[post-process] ${tool}`,
|
|
461
|
+
routedAgent: "bridge",
|
|
462
|
+
routedSkill: tool,
|
|
463
|
+
success: processorResult.success !== false,
|
|
464
|
+
});
|
|
465
|
+
|
|
433
466
|
return {
|
|
434
467
|
duration,
|
|
435
468
|
processors: processorResult,
|
|
@@ -582,7 +615,7 @@ function handleHooks(input, projectRoot) {
|
|
|
582
615
|
} else {
|
|
583
616
|
try {
|
|
584
617
|
const content = readFileSync(gitHook, "utf-8");
|
|
585
|
-
if (content.includes("Xray") || content.includes("xray") ||
|
|
618
|
+
if (content.includes("Xray") || content.includes("xray") || false || content.includes("run-hook.js")) {
|
|
586
619
|
result.managed.push(hookName);
|
|
587
620
|
} else {
|
|
588
621
|
result.external.push(hookName);
|
|
@@ -626,7 +659,7 @@ function handleHooks(input, projectRoot) {
|
|
|
626
659
|
// Backup existing non-xray hooks
|
|
627
660
|
if (existsSync(dst)) {
|
|
628
661
|
const content = readFileSync(dst, "utf-8");
|
|
629
|
-
if (!content.includes("Xray") && !content.includes("xray") && !
|
|
662
|
+
if (!content.includes("Xray") && !content.includes("xray") && !false && !content.includes("run-hook.js")) {
|
|
630
663
|
renameSync(dst, `${dst}.xray-backup`);
|
|
631
664
|
} else {
|
|
632
665
|
unlinkSync(dst);
|
|
@@ -665,7 +698,7 @@ function handleHooks(input, projectRoot) {
|
|
|
665
698
|
|
|
666
699
|
try {
|
|
667
700
|
const content = readFileSync(dst, "utf-8");
|
|
668
|
-
const isXray = content.includes("Xray") || content.includes("xray") ||
|
|
701
|
+
const isXray = content.includes("Xray") || content.includes("xray") || false || content.includes("run-hook.js");
|
|
669
702
|
|
|
670
703
|
if (isXray || lstatSync(dst).isSymbolicLink()) {
|
|
671
704
|
unlinkSync(dst);
|
|
@@ -743,8 +776,37 @@ async function handleApply(input, projectRoot, logDir) {
|
|
|
743
776
|
// ── Known commands for positional-arg mode ──────────────────
|
|
744
777
|
const KNOWN_COMMANDS = new Set([
|
|
745
778
|
"health", "stats", "pre-process", "post-process", "validate", "codex-check", "hooks", "govern", "apply",
|
|
779
|
+
"skill-install", "skill-registry",
|
|
746
780
|
]);
|
|
747
781
|
|
|
782
|
+
// ── Skill management ──────────────────────────────────────────
|
|
783
|
+
|
|
784
|
+
async function handleSkillInstall(command, projectRoot, logDir) {
|
|
785
|
+
try {
|
|
786
|
+
const source = command.source;
|
|
787
|
+
if (!source) {
|
|
788
|
+
return { error: "Missing 'source' — specify a source name or git URL" };
|
|
789
|
+
}
|
|
790
|
+
const { execSync } = await import("child_process");
|
|
791
|
+
const output = execSync(`npx 0xray skill:install "${source}"`, { cwd: projectRoot, timeout: 120000 }).toString();
|
|
792
|
+
return { status: "ok", output: output.trim() };
|
|
793
|
+
} catch (error) {
|
|
794
|
+
return { error: `Skill install failed: ${error.message || error}` };
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
async function handleSkillRegistry(command, projectRoot, logDir) {
|
|
799
|
+
try {
|
|
800
|
+
const action = command.action || "list";
|
|
801
|
+
const { execSync } = await import("child_process");
|
|
802
|
+
const args = command.source ? `"${command.source}"` : "";
|
|
803
|
+
const output = execSync(`npx 0xray skill:registry ${action} ${args}`, { cwd: projectRoot, timeout: 30000 }).toString();
|
|
804
|
+
return { status: "ok", output: output.trim() };
|
|
805
|
+
} catch (error) {
|
|
806
|
+
return { error: `Skill registry command failed: ${error.message || error}` };
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
748
810
|
// ── Main ─────────────────────────────────────────────────────
|
|
749
811
|
async function main() {
|
|
750
812
|
// Parse --cwd flag and detect positional command arg
|
|
@@ -800,6 +862,10 @@ async function main() {
|
|
|
800
862
|
const projectRoot = findProjectRoot();
|
|
801
863
|
const logDir = ensureLogDir(projectRoot);
|
|
802
864
|
|
|
865
|
+
// Log session start for test verification
|
|
866
|
+
const sessionId = `bridge-${Date.now()}`;
|
|
867
|
+
logToActivity(logDir, `session-start: session=${sessionId} source=bridge`);
|
|
868
|
+
|
|
803
869
|
// Lazy-load framework on first call
|
|
804
870
|
if (!frameworkReady && !frameworkLoadAttempted) {
|
|
805
871
|
await loadFramework(projectRoot);
|
|
@@ -836,6 +902,12 @@ async function main() {
|
|
|
836
902
|
case "apply":
|
|
837
903
|
response = await handleApply(command, projectRoot, logDir);
|
|
838
904
|
break;
|
|
905
|
+
case "skill-install":
|
|
906
|
+
response = await handleSkillInstall(command, projectRoot, logDir);
|
|
907
|
+
break;
|
|
908
|
+
case "skill-registry":
|
|
909
|
+
response = await handleSkillRegistry(command, projectRoot, logDir);
|
|
910
|
+
break;
|
|
839
911
|
default:
|
|
840
912
|
response = { error: `Unknown command: ${cmd}` };
|
|
841
913
|
}
|
|
@@ -70,6 +70,55 @@ XRAY_HEALTH = {
|
|
|
70
70
|
},
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
XRAY_SKILL_INSTALL = {
|
|
74
|
+
"name": "xray_skill_install",
|
|
75
|
+
"description": (
|
|
76
|
+
"Install skills from the registry or any git repo. "
|
|
77
|
+
"Downloads skill definitions for specialized capabilities "
|
|
78
|
+
"like UI/UX design, mobile development, security auditing, etc. "
|
|
79
|
+
"Use this to add new skills to your development environment."
|
|
80
|
+
),
|
|
81
|
+
"parameters": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"properties": {
|
|
84
|
+
"source": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"description": "Source name or git URL to install skills from",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
"required": ["source"],
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
XRAY_SKILL_REGISTRY = {
|
|
94
|
+
"name": "xray_skill_registry",
|
|
95
|
+
"description": (
|
|
96
|
+
"Manage the skills registry — list available sources, "
|
|
97
|
+
"add new sources, or remove existing ones. Use 'list' to see "
|
|
98
|
+
"all available skill sources, 'add' to register a new source, "
|
|
99
|
+
"'remove' to unregister an existing source."
|
|
100
|
+
),
|
|
101
|
+
"parameters": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"action": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": ["list", "add", "remove"],
|
|
107
|
+
"description": "Registry action to perform",
|
|
108
|
+
},
|
|
109
|
+
"name": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "Source name (required for add/remove)",
|
|
112
|
+
},
|
|
113
|
+
"url": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "Repository URL (required for add)",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
"required": ["action"],
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
|
|
73
122
|
XRAY_HOOKS = {
|
|
74
123
|
"name": "xray_hooks",
|
|
75
124
|
"description": (
|
|
@@ -81,7 +81,7 @@ class TestSchemas(unittest.TestCase):
|
|
|
81
81
|
self.assertTrue(len(schema["description"]) > 20, f"{name}")
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
class
|
|
84
|
+
class TestRunXrayHelper(unittest.TestCase):
|
|
85
85
|
"""Test the CLI fallback helper (still exists for bridge-less environments)."""
|
|
86
86
|
|
|
87
87
|
def test_successful_command(self):
|
|
@@ -143,7 +143,7 @@ class TestBridgeHelper(unittest.TestCase):
|
|
|
143
143
|
self.assertIn("timed out", r["error"])
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
class
|
|
146
|
+
class TestXrayHealth(unittest.TestCase):
|
|
147
147
|
def test_health_via_bridge(self):
|
|
148
148
|
"""v2: health uses bridge first."""
|
|
149
149
|
with patch.object(tools_mod, "_bridge_call", return_value={"status": "ok", "framework": "loaded", "version": "1.15.0", "components": {}}) as m:
|
|
@@ -165,7 +165,7 @@ class TestStrrayHealth(unittest.TestCase):
|
|
|
165
165
|
self.assertEqual(r["status"], "ok")
|
|
166
166
|
|
|
167
167
|
|
|
168
|
-
class
|
|
168
|
+
class TestXrayValidate(unittest.TestCase):
|
|
169
169
|
def test_with_files_via_bridge(self):
|
|
170
170
|
"""v2: validate uses bridge first."""
|
|
171
171
|
with patch.object(tools_mod, "_bridge_call", return_value={"passed": True, "fileResults": []}) as m:
|
|
@@ -208,7 +208,7 @@ class TestStrrayValidate(unittest.TestCase):
|
|
|
208
208
|
self.assertEqual(r["files_checked"], 100)
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
class
|
|
211
|
+
class TestXrayCodexCheck(unittest.TestCase):
|
|
212
212
|
def test_with_code_via_bridge(self):
|
|
213
213
|
"""v2: codex check uses bridge for real quality gate analysis."""
|
|
214
214
|
with patch.object(tools_mod, "_bridge_call", return_value={"passed": True, "violations": [], "checks": []}) as m:
|
|
@@ -656,7 +656,7 @@ class TestLiveBridge(unittest.TestCase):
|
|
|
656
656
|
if not bridge_path.exists():
|
|
657
657
|
self.skipTest("bridge.mjs not built yet")
|
|
658
658
|
|
|
659
|
-
# Use
|
|
659
|
+
# Use xray dev repo as project root (has package.json)
|
|
660
660
|
xray_root = str(Path(PLUGIN_DIR).parent.parent.parent / "dev" / "xray")
|
|
661
661
|
cwd = xray_root if Path(xray_root).exists() else PLUGIN_DIR
|
|
662
662
|
|
|
@@ -945,7 +945,7 @@ class TestBridgeHelperTimeoutDefault(unittest.TestCase):
|
|
|
945
945
|
self.assertEqual(m.call_args[1]["timeout"], 5)
|
|
946
946
|
|
|
947
947
|
|
|
948
|
-
class
|
|
948
|
+
class TestXrayHooksTool(unittest.TestCase):
|
|
949
949
|
"""Tests for the xray_hooks tool."""
|
|
950
950
|
|
|
951
951
|
def test_list_via_bridge(self):
|
|
@@ -1018,7 +1018,7 @@ class TestStrrayHooksTool(unittest.TestCase):
|
|
|
1018
1018
|
self.assertEqual(call_cmd["action"], "list")
|
|
1019
1019
|
|
|
1020
1020
|
|
|
1021
|
-
class
|
|
1021
|
+
class TestXrayHooksSchema(unittest.TestCase):
|
|
1022
1022
|
"""Tests for the XRAY_HOOKS schema."""
|
|
1023
1023
|
|
|
1024
1024
|
def test_schema_has_required_fields(self):
|
|
@@ -2,13 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
v2.0: Now uses the Node.js bridge for real framework integration.
|
|
4
4
|
Falls back to CLI (npx 0xray) when bridge is unavailable.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
import subprocess
|
|
9
|
+
import shutil
|
|
10
|
+
import os
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from . import schemas
|
|
13
|
+
|
|
14
|
+
def _bridge_call(command: dict, timeout: int = 10) -> dict:
|
|
15
|
+
"""Call the Hermes bridge via subprocess stdin."""
|
|
16
|
+
from . import _call_bridge
|
|
17
|
+
return _call_bridge(command, timeout)
|
|
18
|
+
|
|
19
|
+
def _run_xray(args: list, timeout: int = 30) -> str:
|
|
20
|
+
"""Fallback: run npx 0xray CLI command."""
|
|
21
|
+
try:
|
|
22
|
+
result = subprocess.run(
|
|
5
23
|
["npx", "0xray"] + args,
|
|
24
|
+
capture_output=True, text=True, timeout=timeout,
|
|
25
|
+
)
|
|
26
|
+
return result.stdout
|
|
27
|
+
except FileNotFoundError:
|
|
6
28
|
return json.dumps({"error": "0xray not found. Run: npm install -g 0xray"})
|
|
7
29
|
except subprocess.TimeoutExpired:
|
|
8
30
|
return json.dumps({"error": f"Command timed out after {timeout}s"})
|
|
9
31
|
except Exception as e:
|
|
10
32
|
return json.dumps({"error": str(e)})
|
|
11
33
|
|
|
34
|
+
def _get_project_root() -> str:
|
|
35
|
+
"""Find project root (used in fallback mode)."""
|
|
36
|
+
from . import PROJECT_ROOT
|
|
37
|
+
return str(PROJECT_ROOT)
|
|
38
|
+
|
|
12
39
|
|
|
13
40
|
# ── Tool: xray_validate ─────────────────────────────────────
|
|
14
41
|
|
|
@@ -189,7 +216,7 @@ def xray_hooks(args: dict, **kwargs) -> str:
|
|
|
189
216
|
else:
|
|
190
217
|
try:
|
|
191
218
|
content = git_hook.read_text()[:500]
|
|
192
|
-
if "Xray" in content or "xray" in content or
|
|
219
|
+
if "Xray" in content or "xray" in content or False or "run-hook.js" in content:
|
|
193
220
|
result["managed"].append(hook_name)
|
|
194
221
|
else:
|
|
195
222
|
result["external"].append(hook_name)
|
|
@@ -212,7 +239,7 @@ def xray_hooks(args: dict, **kwargs) -> str:
|
|
|
212
239
|
if dst.exists():
|
|
213
240
|
try:
|
|
214
241
|
content = dst.read_text()[:500]
|
|
215
|
-
if "Xray" not in content and "xray" not in content
|
|
242
|
+
if "Xray" not in content and "xray" not in content:
|
|
216
243
|
dst.rename(dst.with_suffix(".xray-backup"))
|
|
217
244
|
else:
|
|
218
245
|
dst.unlink()
|
|
@@ -238,7 +265,7 @@ def xray_hooks(args: dict, **kwargs) -> str:
|
|
|
238
265
|
continue
|
|
239
266
|
try:
|
|
240
267
|
content = dst.read_text()[:500]
|
|
241
|
-
is_xray = "Xray" in content or "xray" in content or
|
|
268
|
+
is_xray = "Xray" in content or "xray" in content or False or "run-hook.js" in content
|
|
242
269
|
if is_xray or dst.is_symlink():
|
|
243
270
|
dst.unlink()
|
|
244
271
|
if backup.exists():
|
|
@@ -251,3 +278,80 @@ def xray_hooks(args: dict, **kwargs) -> str:
|
|
|
251
278
|
return json.dumps({"status": "ok", "action": "uninstall", "removed": removed, "restored": restored, "via": "fallback"})
|
|
252
279
|
|
|
253
280
|
return json.dumps({"error": f"Unknown action: {action}", "via": "fallback"})
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
# ── Tool: xray_skill_install ─────────────────────────────────
|
|
284
|
+
|
|
285
|
+
def xray_skill_install(args: dict, **kwargs) -> str:
|
|
286
|
+
"""Install skills from registry or git repo via bridge."""
|
|
287
|
+
source = args.get("source", "")
|
|
288
|
+
|
|
289
|
+
if not source:
|
|
290
|
+
return json.dumps({"error": "No source specified for skill install"})
|
|
291
|
+
|
|
292
|
+
bridge_result = _bridge_call({
|
|
293
|
+
"command": "skill-install",
|
|
294
|
+
"source": source,
|
|
295
|
+
}, timeout=120)
|
|
296
|
+
|
|
297
|
+
if "error" not in bridge_result:
|
|
298
|
+
return json.dumps({
|
|
299
|
+
"status": "ok",
|
|
300
|
+
"source": source,
|
|
301
|
+
"output": bridge_result.get("output", ""),
|
|
302
|
+
"via": "bridge",
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
# Fallback to CLI
|
|
306
|
+
result = _run_xray(["skill:install", source], timeout=120)
|
|
307
|
+
try:
|
|
308
|
+
parsed = json.loads(result)
|
|
309
|
+
if "error" in parsed:
|
|
310
|
+
return json.dumps(parsed)
|
|
311
|
+
except json.JSONDecodeError:
|
|
312
|
+
pass
|
|
313
|
+
return json.dumps({
|
|
314
|
+
"status": "ok",
|
|
315
|
+
"source": source,
|
|
316
|
+
"output": result.strip(),
|
|
317
|
+
"via": "cli",
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
# ── Tool: xray_skill_registry ───────────────────────────────
|
|
322
|
+
|
|
323
|
+
def xray_skill_registry(args: dict, **kwargs) -> str:
|
|
324
|
+
"""Manage skill registry sources via bridge."""
|
|
325
|
+
action = args.get("action", "list")
|
|
326
|
+
name = args.get("name", "")
|
|
327
|
+
url = args.get("url", "")
|
|
328
|
+
|
|
329
|
+
bridge_args = {"command": "skill-registry", "action": action}
|
|
330
|
+
if name:
|
|
331
|
+
bridge_args["source"] = name
|
|
332
|
+
if url:
|
|
333
|
+
bridge_args["url"] = url
|
|
334
|
+
|
|
335
|
+
bridge_result = _bridge_call(bridge_args, timeout=30)
|
|
336
|
+
|
|
337
|
+
if "error" not in bridge_result:
|
|
338
|
+
return json.dumps({
|
|
339
|
+
"status": "ok",
|
|
340
|
+
"action": action,
|
|
341
|
+
"output": bridge_result.get("output", ""),
|
|
342
|
+
"via": "bridge",
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
# Fallback to CLI
|
|
346
|
+
cli_args = ["skill:registry", action]
|
|
347
|
+
if name:
|
|
348
|
+
cli_args.extend(["--name", name])
|
|
349
|
+
if url:
|
|
350
|
+
cli_args.extend(["--url", url])
|
|
351
|
+
result = _run_xray(cli_args, timeout=30)
|
|
352
|
+
return json.dumps({
|
|
353
|
+
"status": "ok",
|
|
354
|
+
"action": action,
|
|
355
|
+
"output": result.strip(),
|
|
356
|
+
"via": "cli",
|
|
357
|
+
})
|
|
@@ -37,7 +37,7 @@ npm install ws
|
|
|
37
37
|
|
|
38
38
|
### 2. Configure OpenClaw
|
|
39
39
|
|
|
40
|
-
Create `.
|
|
40
|
+
Create `.xray/config/openclaw.json`:
|
|
41
41
|
|
|
42
42
|
```json
|
|
43
43
|
{
|
|
@@ -82,11 +82,11 @@ const integration = await initializeOpenClawIntegration('/path/to/config.json',
|
|
|
82
82
|
|
|
83
83
|
After installation, use these commands in any OpenClaw channel:
|
|
84
84
|
|
|
85
|
-
- `/
|
|
86
|
-
- `/
|
|
87
|
-
- `/
|
|
88
|
-
- `/
|
|
89
|
-
- `/
|
|
85
|
+
- `/xray` - Show status
|
|
86
|
+
- `/xray-analyze <file>` - Analyze code
|
|
87
|
+
- `/xray-code <file>` - Code review
|
|
88
|
+
- `/xray-file <file>` - Read file
|
|
89
|
+
- `/xray-exec <command>` - Execute command
|
|
90
90
|
|
|
91
91
|
## Configuration
|
|
92
92
|
|