burhan-mop 0.1.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/.agents/AGENTS.md +54 -0
- package/.agents/skills/auto-deploy/SKILL.md +48 -0
- package/.agents/skills/autosycn/SKILL.md +75 -0
- package/.agents/skills/mop-help/SKILL.md +35 -0
- package/.agents/skills/ruflo-core/SKILL.md +35 -0
- package/.claude/agents/analysis/analyze-code-quality.md +179 -0
- package/.claude/agents/analysis/code-analyzer.md +210 -0
- package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
- package/.claude/agents/architecture/arch-system-design.md +157 -0
- package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
- package/.claude/agents/browser/browser-agent.yaml +182 -0
- package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
- package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
- package/.claude/agents/consensus/gossip-coordinator.md +63 -0
- package/.claude/agents/consensus/performance-benchmarker.md +851 -0
- package/.claude/agents/consensus/quorum-manager.md +823 -0
- package/.claude/agents/consensus/raft-manager.md +63 -0
- package/.claude/agents/consensus/security-manager.md +622 -0
- package/.claude/agents/core/planner.md +375 -0
- package/.claude/agents/custom/test-long-runner.md +44 -0
- package/.claude/agents/data/data-ml-model.md +445 -0
- package/.claude/agents/data/ml/data-ml-model.md +193 -0
- package/.claude/agents/development/backend/dev-backend-api.md +142 -0
- package/.claude/agents/development/dev-backend-api.md +345 -0
- package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
- package/.claude/agents/devops/ops-cicd-github.md +165 -0
- package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
- package/.claude/agents/documentation/docs-api-openapi.md +355 -0
- package/.claude/agents/flow-nexus/app-store.md +88 -0
- package/.claude/agents/flow-nexus/authentication.md +69 -0
- package/.claude/agents/flow-nexus/challenges.md +81 -0
- package/.claude/agents/flow-nexus/neural-network.md +88 -0
- package/.claude/agents/flow-nexus/payments.md +83 -0
- package/.claude/agents/flow-nexus/sandbox.md +76 -0
- package/.claude/agents/flow-nexus/swarm.md +76 -0
- package/.claude/agents/flow-nexus/user-tools.md +96 -0
- package/.claude/agents/flow-nexus/workflow.md +84 -0
- package/.claude/agents/github/code-review-swarm.md +377 -0
- package/.claude/agents/github/github-modes.md +173 -0
- package/.claude/agents/github/issue-tracker.md +576 -0
- package/.claude/agents/github/multi-repo-swarm.md +553 -0
- package/.claude/agents/github/pr-manager.md +438 -0
- package/.claude/agents/github/project-board-sync.md +509 -0
- package/.claude/agents/github/release-manager.md +605 -0
- package/.claude/agents/github/release-swarm.md +583 -0
- package/.claude/agents/github/repo-architect.md +398 -0
- package/.claude/agents/github/swarm-issue.md +573 -0
- package/.claude/agents/github/swarm-pr.md +428 -0
- package/.claude/agents/github/sync-coordinator.md +452 -0
- package/.claude/agents/github/workflow-automation.md +903 -0
- package/.claude/agents/goal/agent.md +816 -0
- package/.claude/agents/optimization/benchmark-suite.md +665 -0
- package/.claude/agents/optimization/load-balancer.md +431 -0
- package/.claude/agents/optimization/performance-monitor.md +672 -0
- package/.claude/agents/optimization/resource-allocator.md +674 -0
- package/.claude/agents/optimization/topology-optimizer.md +808 -0
- package/.claude/agents/payments/agentic-payments.md +126 -0
- package/.claude/agents/sona/sona-learning-optimizer.md +74 -0
- package/.claude/agents/sparc/architecture.md +699 -0
- package/.claude/agents/sparc/pseudocode.md +520 -0
- package/.claude/agents/sparc/refinement.md +802 -0
- package/.claude/agents/sparc/specification.md +478 -0
- package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
- package/.claude/agents/specialized/spec-mobile-react-native.md +227 -0
- package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
- package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
- package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
- package/.claude/agents/sublinear/performance-optimizer.md +368 -0
- package/.claude/agents/sublinear/trading-predictor.md +246 -0
- package/.claude/agents/swarm/adaptive-coordinator.md +1127 -0
- package/.claude/agents/swarm/hierarchical-coordinator.md +710 -0
- package/.claude/agents/swarm/mesh-coordinator.md +963 -0
- package/.claude/agents/templates/automation-smart-agent.md +205 -0
- package/.claude/agents/templates/base-template-generator.md +289 -0
- package/.claude/agents/templates/coordinator-swarm-init.md +90 -0
- package/.claude/agents/templates/github-pr-manager.md +177 -0
- package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
- package/.claude/agents/templates/memory-coordinator.md +187 -0
- package/.claude/agents/templates/orchestrator-task.md +139 -0
- package/.claude/agents/templates/performance-analyzer.md +199 -0
- package/.claude/agents/templates/sparc-coordinator.md +514 -0
- package/.claude/agents/testing/production-validator.md +395 -0
- package/.claude/agents/testing/tdd-london-swarm.md +244 -0
- package/.claude/agents/v3/aidefence-guardian.md +282 -0
- package/.claude/agents/v3/claims-authorizer.md +208 -0
- package/.claude/agents/v3/collective-intelligence-coordinator.md +993 -0
- package/.claude/agents/v3/ddd-domain-expert.md +220 -0
- package/.claude/agents/v3/injection-analyst.md +236 -0
- package/.claude/agents/v3/performance-engineer.md +1233 -0
- package/.claude/agents/v3/pii-detector.md +151 -0
- package/.claude/agents/v3/reasoningbank-learner.md +213 -0
- package/.claude/agents/v3/security-architect-aidefence.md +410 -0
- package/.claude/agents/v3/security-architect.md +867 -0
- package/.claude/agents/v3/swarm-memory-manager.md +157 -0
- package/.claude/agents/v3/v3-integration-architect.md +205 -0
- package/.claude/commands/agents/README.md +50 -0
- package/.claude/commands/agents/agent-capabilities.md +140 -0
- package/.claude/commands/agents/agent-coordination.md +28 -0
- package/.claude/commands/agents/agent-spawning.md +28 -0
- package/.claude/commands/agents/agent-types.md +216 -0
- package/.claude/commands/agents/health.md +139 -0
- package/.claude/commands/agents/list.md +100 -0
- package/.claude/commands/agents/logs.md +130 -0
- package/.claude/commands/agents/metrics.md +122 -0
- package/.claude/commands/agents/pool.md +127 -0
- package/.claude/commands/agents/spawn.md +140 -0
- package/.claude/commands/agents/status.md +115 -0
- package/.claude/commands/agents/stop.md +102 -0
- package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
- package/.claude/commands/analysis/README.md +9 -0
- package/.claude/commands/analysis/bottleneck-detect.md +162 -0
- package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
- package/.claude/commands/analysis/performance-report.md +25 -0
- package/.claude/commands/analysis/token-efficiency.md +45 -0
- package/.claude/commands/analysis/token-usage.md +25 -0
- package/.claude/commands/automation/README.md +9 -0
- package/.claude/commands/automation/auto-agent.md +122 -0
- package/.claude/commands/automation/self-healing.md +106 -0
- package/.claude/commands/automation/session-memory.md +90 -0
- package/.claude/commands/automation/smart-agents.md +73 -0
- package/.claude/commands/automation/smart-spawn.md +25 -0
- package/.claude/commands/automation/workflow-select.md +25 -0
- package/.claude/commands/claude-flow-help.md +103 -0
- package/.claude/commands/claude-flow-memory.md +107 -0
- package/.claude/commands/claude-flow-swarm.md +205 -0
- package/.claude/commands/coordination/README.md +9 -0
- package/.claude/commands/coordination/agent-spawn.md +25 -0
- package/.claude/commands/coordination/init.md +44 -0
- package/.claude/commands/coordination/orchestrate.md +43 -0
- package/.claude/commands/coordination/spawn.md +45 -0
- package/.claude/commands/coordination/swarm-init.md +85 -0
- package/.claude/commands/coordination/task-orchestrate.md +25 -0
- package/.claude/commands/github/README.md +11 -0
- package/.claude/commands/github/code-review-swarm.md +514 -0
- package/.claude/commands/github/code-review.md +25 -0
- package/.claude/commands/github/github-modes.md +147 -0
- package/.claude/commands/github/github-swarm.md +121 -0
- package/.claude/commands/github/issue-tracker.md +292 -0
- package/.claude/commands/github/issue-triage.md +25 -0
- package/.claude/commands/github/multi-repo-swarm.md +519 -0
- package/.claude/commands/github/pr-enhance.md +26 -0
- package/.claude/commands/github/pr-manager.md +170 -0
- package/.claude/commands/github/project-board-sync.md +471 -0
- package/.claude/commands/github/release-manager.md +340 -0
- package/.claude/commands/github/release-swarm.md +544 -0
- package/.claude/commands/github/repo-analyze.md +25 -0
- package/.claude/commands/github/repo-architect.md +367 -0
- package/.claude/commands/github/swarm-issue.md +485 -0
- package/.claude/commands/github/swarm-pr.md +288 -0
- package/.claude/commands/github/sync-coordinator.md +303 -0
- package/.claude/commands/github/workflow-automation.md +442 -0
- package/.claude/commands/hive-mind/README.md +17 -0
- package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
- package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
- package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
- package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
- package/.claude/commands/hive-mind/hive-mind.md +27 -0
- package/.claude/commands/hooks/README.md +11 -0
- package/.claude/commands/hooks/overview.md +58 -0
- package/.claude/commands/hooks/post-edit.md +117 -0
- package/.claude/commands/hooks/post-task.md +112 -0
- package/.claude/commands/hooks/pre-edit.md +113 -0
- package/.claude/commands/hooks/pre-task.md +111 -0
- package/.claude/commands/hooks/session-end.md +118 -0
- package/.claude/commands/hooks/setup.md +103 -0
- package/.claude/commands/memory/README.md +9 -0
- package/.claude/commands/memory/memory-persist.md +25 -0
- package/.claude/commands/memory/memory-search.md +25 -0
- package/.claude/commands/memory/memory-usage.md +25 -0
- package/.claude/commands/memory/neural.md +47 -0
- package/.claude/commands/monitoring/README.md +9 -0
- package/.claude/commands/monitoring/agent-metrics.md +25 -0
- package/.claude/commands/monitoring/agents.md +44 -0
- package/.claude/commands/monitoring/real-time-view.md +25 -0
- package/.claude/commands/monitoring/status.md +46 -0
- package/.claude/commands/monitoring/swarm-monitor.md +25 -0
- package/.claude/commands/optimization/README.md +9 -0
- package/.claude/commands/optimization/auto-topology.md +62 -0
- package/.claude/commands/optimization/cache-manage.md +25 -0
- package/.claude/commands/optimization/parallel-execute.md +25 -0
- package/.claude/commands/optimization/parallel-execution.md +50 -0
- package/.claude/commands/optimization/topology-optimize.md +25 -0
- package/.claude/commands/pair/README.md +261 -0
- package/.claude/commands/pair/commands.md +546 -0
- package/.claude/commands/pair/config.md +510 -0
- package/.claude/commands/pair/examples.md +512 -0
- package/.claude/commands/pair/modes.md +348 -0
- package/.claude/commands/pair/session.md +407 -0
- package/.claude/commands/pair/start.md +209 -0
- package/.claude/commands/sparc/analyzer.md +52 -0
- package/.claude/commands/sparc/architect.md +53 -0
- package/.claude/commands/sparc/ask.md +97 -0
- package/.claude/commands/sparc/batch-executor.md +54 -0
- package/.claude/commands/sparc/code.md +89 -0
- package/.claude/commands/sparc/coder.md +54 -0
- package/.claude/commands/sparc/debug.md +83 -0
- package/.claude/commands/sparc/debugger.md +54 -0
- package/.claude/commands/sparc/designer.md +53 -0
- package/.claude/commands/sparc/devops.md +109 -0
- package/.claude/commands/sparc/docs-writer.md +80 -0
- package/.claude/commands/sparc/documenter.md +54 -0
- package/.claude/commands/sparc/innovator.md +54 -0
- package/.claude/commands/sparc/integration.md +83 -0
- package/.claude/commands/sparc/mcp.md +117 -0
- package/.claude/commands/sparc/memory-manager.md +54 -0
- package/.claude/commands/sparc/optimizer.md +54 -0
- package/.claude/commands/sparc/orchestrator.md +132 -0
- package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
- package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
- package/.claude/commands/sparc/researcher.md +54 -0
- package/.claude/commands/sparc/reviewer.md +54 -0
- package/.claude/commands/sparc/security-review.md +80 -0
- package/.claude/commands/sparc/sparc-modes.md +174 -0
- package/.claude/commands/sparc/sparc.md +111 -0
- package/.claude/commands/sparc/spec-pseudocode.md +80 -0
- package/.claude/commands/sparc/supabase-admin.md +348 -0
- package/.claude/commands/sparc/swarm-coordinator.md +54 -0
- package/.claude/commands/sparc/tdd.md +54 -0
- package/.claude/commands/sparc/tester.md +54 -0
- package/.claude/commands/sparc/tutorial.md +79 -0
- package/.claude/commands/sparc/workflow-manager.md +54 -0
- package/.claude/commands/stream-chain/pipeline.md +121 -0
- package/.claude/commands/stream-chain/run.md +70 -0
- package/.claude/commands/swarm/README.md +15 -0
- package/.claude/commands/swarm/analysis.md +95 -0
- package/.claude/commands/swarm/development.md +96 -0
- package/.claude/commands/swarm/examples.md +168 -0
- package/.claude/commands/swarm/maintenance.md +102 -0
- package/.claude/commands/swarm/optimization.md +117 -0
- package/.claude/commands/swarm/research.md +136 -0
- package/.claude/commands/swarm/swarm-analysis.md +8 -0
- package/.claude/commands/swarm/swarm-background.md +8 -0
- package/.claude/commands/swarm/swarm-init.md +19 -0
- package/.claude/commands/swarm/swarm-modes.md +8 -0
- package/.claude/commands/swarm/swarm-monitor.md +8 -0
- package/.claude/commands/swarm/swarm-spawn.md +19 -0
- package/.claude/commands/swarm/swarm-status.md +8 -0
- package/.claude/commands/swarm/swarm-strategies.md +8 -0
- package/.claude/commands/swarm/swarm.md +87 -0
- package/.claude/commands/swarm/testing.md +131 -0
- package/.claude/commands/training/README.md +9 -0
- package/.claude/commands/training/model-update.md +25 -0
- package/.claude/commands/training/neural-patterns.md +108 -0
- package/.claude/commands/training/neural-train.md +75 -0
- package/.claude/commands/training/pattern-learn.md +25 -0
- package/.claude/commands/training/specialization.md +63 -0
- package/.claude/commands/truth/start.md +143 -0
- package/.claude/commands/verify/check.md +50 -0
- package/.claude/commands/verify/start.md +128 -0
- package/.claude/commands/workflows/README.md +9 -0
- package/.claude/commands/workflows/development.md +78 -0
- package/.claude/commands/workflows/research.md +63 -0
- package/.claude/commands/workflows/workflow-create.md +25 -0
- package/.claude/commands/workflows/workflow-execute.md +25 -0
- package/.claude/commands/workflows/workflow-export.md +25 -0
- package/.claude/helpers/README.md +97 -0
- package/.claude/helpers/adr-compliance.sh +186 -0
- package/.claude/helpers/auto-commit.sh +178 -0
- package/.claude/helpers/auto-memory-hook.mjs +368 -0
- package/.claude/helpers/checkpoint-manager.sh +251 -0
- package/.claude/helpers/daemon-manager.sh +252 -0
- package/.claude/helpers/ddd-tracker.sh +144 -0
- package/.claude/helpers/github-safe.js +156 -0
- package/.claude/helpers/github-setup.sh +45 -0
- package/.claude/helpers/guidance-hook.sh +13 -0
- package/.claude/helpers/guidance-hooks.sh +102 -0
- package/.claude/helpers/health-monitor.sh +108 -0
- package/.claude/helpers/hook-handler.cjs +286 -0
- package/.claude/helpers/intelligence.cjs +1031 -0
- package/.claude/helpers/learning-hooks.sh +329 -0
- package/.claude/helpers/learning-optimizer.sh +127 -0
- package/.claude/helpers/learning-service.mjs +1144 -0
- package/.claude/helpers/memory.js +83 -0
- package/.claude/helpers/metrics-db.mjs +488 -0
- package/.claude/helpers/pattern-consolidator.sh +86 -0
- package/.claude/helpers/perf-worker.sh +160 -0
- package/.claude/helpers/post-commit +16 -0
- package/.claude/helpers/pre-commit +26 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/router.js +105 -0
- package/.claude/helpers/ruflo-hook.cjs +59 -0
- package/.claude/helpers/security-scanner.sh +127 -0
- package/.claude/helpers/session.js +157 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/.claude/helpers/standard-checkpoint-hooks.sh +189 -0
- package/.claude/helpers/statusline-hook.sh +21 -0
- package/.claude/helpers/statusline.cjs +693 -0
- package/.claude/helpers/statusline.js +352 -0
- package/.claude/helpers/swarm-comms.sh +353 -0
- package/.claude/helpers/swarm-hooks.sh +761 -0
- package/.claude/helpers/swarm-monitor.sh +211 -0
- package/.claude/helpers/sync-v3-metrics.sh +245 -0
- package/.claude/helpers/update-v3-progress.sh +166 -0
- package/.claude/helpers/v3-quick-status.sh +58 -0
- package/.claude/helpers/v3.sh +111 -0
- package/.claude/helpers/validate-v3-config.sh +216 -0
- package/.claude/helpers/worker-manager.sh +170 -0
- package/.claude/settings.json +285 -0
- package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
- package/.claude/skills/agentdb-learning/SKILL.md +545 -0
- package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
- package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
- package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
- package/.claude/skills/auto-deploy/SKILL.md +31 -0
- package/.claude/skills/autosycn/SKILL.md +30 -0
- package/.claude/skills/browser/SKILL.md +204 -0
- package/.claude/skills/dual-mode/README.md +71 -0
- package/.claude/skills/dual-mode/dual-collect.md +103 -0
- package/.claude/skills/dual-mode/dual-coordinate.md +85 -0
- package/.claude/skills/dual-mode/dual-spawn.md +81 -0
- package/.claude/skills/flow-nexus-neural/SKILL.md +727 -0
- package/.claude/skills/flow-nexus-platform/SKILL.md +1154 -0
- package/.claude/skills/flow-nexus-swarm/SKILL.md +604 -0
- package/.claude/skills/github-code-review/SKILL.md +1125 -0
- package/.claude/skills/github-multi-repo/SKILL.md +862 -0
- package/.claude/skills/github-project-management/SKILL.md +1262 -0
- package/.claude/skills/github-release-management/SKILL.md +1064 -0
- package/.claude/skills/github-workflow-automation/SKILL.md +1047 -0
- package/.claude/skills/hooks-automation/SKILL.md +1201 -0
- package/.claude/skills/mop-help/SKILL.md +35 -0
- package/.claude/skills/pair-programming/SKILL.md +1202 -0
- package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
- package/.claude/skills/skill-builder/SKILL.md +910 -0
- package/.claude/skills/sparc-methodology/SKILL.md +1106 -0
- package/.claude/skills/stream-chain/SKILL.md +560 -0
- package/.claude/skills/swarm-advanced/SKILL.md +970 -0
- package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
- package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
- package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
- package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
- package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
- package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
- package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
- package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
- package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
- package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
- package/.claude/skills/verification-quality/SKILL.md +691 -0
- package/.claude-flow/CAPABILITIES.md +403 -0
- package/.claude-flow/config.yaml +43 -0
- package/.claude-flow/metrics/learning.json +17 -0
- package/.claude-flow/metrics/swarm-activity.json +18 -0
- package/.claude-flow/metrics/v3-progress.json +26 -0
- package/.claude-flow/security/audit-status.json +8 -0
- package/.codex/config.toml +39 -0
- package/.gemini/settings.json +49 -0
- package/.mcp.json +55 -0
- package/.memoryofplanet/PROTOCOL.md +436 -0
- package/.memoryofplanet/STATE.json +561 -0
- package/.memoryofplanet/config/defaults.json +46 -0
- package/.memoryofplanet/config/team.json +7 -0
- package/.memoryofplanet/scripts/burhan-mop.mjs +124 -0
- package/.memoryofplanet/scripts/mop-auto-deploy.mjs +153 -0
- package/.memoryofplanet/scripts/mop-autosycn.mjs +617 -0
- package/.memoryofplanet/scripts/mop-core.mjs +774 -0
- package/.memoryofplanet/scripts/mop-workflow.mjs +348 -0
- package/.memoryofplanet/templates/artifacts/adversarial-review.md +33 -0
- package/.memoryofplanet/templates/artifacts/architecture.md +28 -0
- package/.memoryofplanet/templates/artifacts/decision-log.md +21 -0
- package/.memoryofplanet/templates/artifacts/handoff.md +21 -0
- package/.memoryofplanet/templates/artifacts/implementation-notes.md +21 -0
- package/.memoryofplanet/templates/artifacts/prd.md +29 -0
- package/.memoryofplanet/templates/artifacts/product-brief.md +30 -0
- package/.memoryofplanet/templates/artifacts/readiness-report.md +25 -0
- package/.memoryofplanet/templates/artifacts/release-notes.md +21 -0
- package/.memoryofplanet/templates/artifacts/review.md +21 -0
- package/.memoryofplanet/templates/artifacts/story.md +25 -0
- package/.memoryofplanet/templates/artifacts/ux-spec.md +32 -0
- package/AGENTS.md +126 -0
- package/CLAUDE.md +235 -0
- package/GEMINI.md +19 -0
- package/README.md +1096 -0
- package/bin/burhan-mop.mjs +2 -0
- package/bin/mop-core.mjs +2 -0
- package/bin/mop-workflow.mjs +2 -0
- package/package.json +66 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Claude Flow V3 - Daemon Manager
|
|
3
|
+
# Manages background services for real-time statusline updates
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
7
|
+
PID_DIR="$PROJECT_ROOT/.claude-flow/pids"
|
|
8
|
+
LOG_DIR="$PROJECT_ROOT/.claude-flow/logs"
|
|
9
|
+
METRICS_DIR="$PROJECT_ROOT/.claude-flow/metrics"
|
|
10
|
+
|
|
11
|
+
# Ensure directories exist
|
|
12
|
+
mkdir -p "$PID_DIR" "$LOG_DIR" "$METRICS_DIR"
|
|
13
|
+
|
|
14
|
+
# PID files
|
|
15
|
+
SWARM_MONITOR_PID="$PID_DIR/swarm-monitor.pid"
|
|
16
|
+
METRICS_DAEMON_PID="$PID_DIR/metrics-daemon.pid"
|
|
17
|
+
|
|
18
|
+
# Log files
|
|
19
|
+
DAEMON_LOG="$LOG_DIR/daemon.log"
|
|
20
|
+
|
|
21
|
+
# Colors
|
|
22
|
+
GREEN='\033[0;32m'
|
|
23
|
+
YELLOW='\033[1;33m'
|
|
24
|
+
RED='\033[0;31m'
|
|
25
|
+
CYAN='\033[0;36m'
|
|
26
|
+
RESET='\033[0m'
|
|
27
|
+
|
|
28
|
+
log() {
|
|
29
|
+
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] $1"
|
|
30
|
+
echo -e "${CYAN}$msg${RESET}"
|
|
31
|
+
echo "$msg" >> "$DAEMON_LOG"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
success() {
|
|
35
|
+
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] SUCCESS: $1"
|
|
36
|
+
echo -e "${GREEN}$msg${RESET}"
|
|
37
|
+
echo "$msg" >> "$DAEMON_LOG"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
error() {
|
|
41
|
+
local msg="[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1"
|
|
42
|
+
echo -e "${RED}$msg${RESET}"
|
|
43
|
+
echo "$msg" >> "$DAEMON_LOG"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Check if a process is running
|
|
47
|
+
is_running() {
|
|
48
|
+
local pid_file="$1"
|
|
49
|
+
if [ -f "$pid_file" ]; then
|
|
50
|
+
local pid=$(cat "$pid_file")
|
|
51
|
+
if ps -p "$pid" > /dev/null 2>&1; then
|
|
52
|
+
return 0
|
|
53
|
+
fi
|
|
54
|
+
fi
|
|
55
|
+
return 1
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# Start the swarm monitor daemon
|
|
59
|
+
start_swarm_monitor() {
|
|
60
|
+
local interval="${1:-30}"
|
|
61
|
+
|
|
62
|
+
if is_running "$SWARM_MONITOR_PID"; then
|
|
63
|
+
log "Swarm monitor already running (PID: $(cat "$SWARM_MONITOR_PID"))"
|
|
64
|
+
return 0
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
log "Starting swarm monitor daemon (interval: ${interval}s)..."
|
|
68
|
+
|
|
69
|
+
# Run the monitor in background
|
|
70
|
+
nohup "$SCRIPT_DIR/swarm-monitor.sh" monitor "$interval" >> "$LOG_DIR/swarm-monitor.log" 2>&1 &
|
|
71
|
+
local pid=$!
|
|
72
|
+
|
|
73
|
+
echo "$pid" > "$SWARM_MONITOR_PID"
|
|
74
|
+
success "Swarm monitor started (PID: $pid)"
|
|
75
|
+
|
|
76
|
+
return 0
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# Start the metrics update daemon
|
|
80
|
+
start_metrics_daemon() {
|
|
81
|
+
local interval="${1:-60}" # Default 60 seconds - less frequent updates
|
|
82
|
+
|
|
83
|
+
if is_running "$METRICS_DAEMON_PID"; then
|
|
84
|
+
log "Metrics daemon already running (PID: $(cat "$METRICS_DAEMON_PID"))"
|
|
85
|
+
return 0
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
log "Starting metrics daemon (interval: ${interval}s, using SQLite)..."
|
|
89
|
+
|
|
90
|
+
# Use SQLite-based metrics (10.5x faster than bash/JSON)
|
|
91
|
+
# Run as Node.js daemon process
|
|
92
|
+
nohup node "$SCRIPT_DIR/metrics-db.mjs" daemon "$interval" >> "$LOG_DIR/metrics-daemon.log" 2>&1 &
|
|
93
|
+
local pid=$!
|
|
94
|
+
|
|
95
|
+
echo "$pid" > "$METRICS_DAEMON_PID"
|
|
96
|
+
success "Metrics daemon started (PID: $pid) - SQLite backend"
|
|
97
|
+
|
|
98
|
+
return 0
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Stop a daemon by PID file
|
|
102
|
+
stop_daemon() {
|
|
103
|
+
local pid_file="$1"
|
|
104
|
+
local name="$2"
|
|
105
|
+
|
|
106
|
+
if [ -f "$pid_file" ]; then
|
|
107
|
+
local pid=$(cat "$pid_file")
|
|
108
|
+
if ps -p "$pid" > /dev/null 2>&1; then
|
|
109
|
+
log "Stopping $name (PID: $pid)..."
|
|
110
|
+
kill "$pid" 2>/dev/null
|
|
111
|
+
sleep 1
|
|
112
|
+
|
|
113
|
+
# Force kill if still running
|
|
114
|
+
if ps -p "$pid" > /dev/null 2>&1; then
|
|
115
|
+
kill -9 "$pid" 2>/dev/null
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
success "$name stopped"
|
|
119
|
+
fi
|
|
120
|
+
rm -f "$pid_file"
|
|
121
|
+
else
|
|
122
|
+
log "$name not running"
|
|
123
|
+
fi
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Start all daemons
|
|
127
|
+
start_all() {
|
|
128
|
+
log "Starting all Claude Flow daemons..."
|
|
129
|
+
start_swarm_monitor "${1:-30}"
|
|
130
|
+
start_metrics_daemon "${2:-60}"
|
|
131
|
+
|
|
132
|
+
# Initial metrics update
|
|
133
|
+
"$SCRIPT_DIR/swarm-monitor.sh" check > /dev/null 2>&1
|
|
134
|
+
|
|
135
|
+
success "All daemons started"
|
|
136
|
+
show_status
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Stop all daemons
|
|
140
|
+
stop_all() {
|
|
141
|
+
log "Stopping all Claude Flow daemons..."
|
|
142
|
+
stop_daemon "$SWARM_MONITOR_PID" "Swarm monitor"
|
|
143
|
+
stop_daemon "$METRICS_DAEMON_PID" "Metrics daemon"
|
|
144
|
+
success "All daemons stopped"
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
# Restart all daemons
|
|
148
|
+
restart_all() {
|
|
149
|
+
stop_all
|
|
150
|
+
sleep 1
|
|
151
|
+
start_all "$@"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
# Show daemon status
|
|
155
|
+
show_status() {
|
|
156
|
+
echo ""
|
|
157
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
158
|
+
echo -e "${CYAN} Claude Flow V3 Daemon Status${RESET}"
|
|
159
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
160
|
+
echo ""
|
|
161
|
+
|
|
162
|
+
# Swarm Monitor
|
|
163
|
+
if is_running "$SWARM_MONITOR_PID"; then
|
|
164
|
+
echo -e " ${GREEN}●${RESET} Swarm Monitor ${GREEN}RUNNING${RESET} (PID: $(cat "$SWARM_MONITOR_PID"))"
|
|
165
|
+
else
|
|
166
|
+
echo -e " ${RED}○${RESET} Swarm Monitor ${RED}STOPPED${RESET}"
|
|
167
|
+
fi
|
|
168
|
+
|
|
169
|
+
# Metrics Daemon
|
|
170
|
+
if is_running "$METRICS_DAEMON_PID"; then
|
|
171
|
+
echo -e " ${GREEN}●${RESET} Metrics Daemon ${GREEN}RUNNING${RESET} (PID: $(cat "$METRICS_DAEMON_PID"))"
|
|
172
|
+
else
|
|
173
|
+
echo -e " ${RED}○${RESET} Metrics Daemon ${RED}STOPPED${RESET}"
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# MCP Server
|
|
177
|
+
local mcp_count=$(ps aux 2>/dev/null | grep -E "mcp.*start" | grep -v grep | wc -l)
|
|
178
|
+
if [ "$mcp_count" -gt 0 ]; then
|
|
179
|
+
echo -e " ${GREEN}●${RESET} MCP Server ${GREEN}RUNNING${RESET}"
|
|
180
|
+
else
|
|
181
|
+
echo -e " ${YELLOW}○${RESET} MCP Server ${YELLOW}NOT DETECTED${RESET}"
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
# Agentic Flow
|
|
185
|
+
local af_count=$(ps aux 2>/dev/null | grep -E "agentic-flow" | grep -v grep | grep -v "daemon-manager" | wc -l)
|
|
186
|
+
if [ "$af_count" -gt 0 ]; then
|
|
187
|
+
echo -e " ${GREEN}●${RESET} Agentic Flow ${GREEN}ACTIVE${RESET} ($af_count processes)"
|
|
188
|
+
else
|
|
189
|
+
echo -e " ${YELLOW}○${RESET} Agentic Flow ${YELLOW}IDLE${RESET}"
|
|
190
|
+
fi
|
|
191
|
+
|
|
192
|
+
echo ""
|
|
193
|
+
echo -e "${CYAN}───────────────────────────────────────────────────${RESET}"
|
|
194
|
+
|
|
195
|
+
# Show latest metrics
|
|
196
|
+
if [ -f "$METRICS_DIR/swarm-activity.json" ]; then
|
|
197
|
+
local last_update=$(jq -r '.timestamp // "unknown"' "$METRICS_DIR/swarm-activity.json" 2>/dev/null)
|
|
198
|
+
local agent_count=$(jq -r '.swarm.agent_count // 0' "$METRICS_DIR/swarm-activity.json" 2>/dev/null)
|
|
199
|
+
echo -e " Last Update: ${last_update}"
|
|
200
|
+
echo -e " Active Agents: ${agent_count}"
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════${RESET}"
|
|
204
|
+
echo ""
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
# Main command handling
|
|
208
|
+
case "${1:-status}" in
|
|
209
|
+
"start")
|
|
210
|
+
start_all "${2:-30}" "${3:-60}"
|
|
211
|
+
;;
|
|
212
|
+
"stop")
|
|
213
|
+
stop_all
|
|
214
|
+
;;
|
|
215
|
+
"restart")
|
|
216
|
+
restart_all "${2:-30}" "${3:-60}"
|
|
217
|
+
;;
|
|
218
|
+
"status")
|
|
219
|
+
show_status
|
|
220
|
+
;;
|
|
221
|
+
"start-swarm")
|
|
222
|
+
start_swarm_monitor "${2:-30}"
|
|
223
|
+
;;
|
|
224
|
+
"start-metrics")
|
|
225
|
+
start_metrics_daemon "${2:-60}"
|
|
226
|
+
;;
|
|
227
|
+
"help"|"-h"|"--help")
|
|
228
|
+
echo "Claude Flow V3 Daemon Manager"
|
|
229
|
+
echo ""
|
|
230
|
+
echo "Usage: $0 [command] [options]"
|
|
231
|
+
echo ""
|
|
232
|
+
echo "Commands:"
|
|
233
|
+
echo " start [swarm_interval] [metrics_interval] Start all daemons"
|
|
234
|
+
echo " stop Stop all daemons"
|
|
235
|
+
echo " restart [swarm_interval] [metrics_interval] Restart all daemons"
|
|
236
|
+
echo " status Show daemon status"
|
|
237
|
+
echo " start-swarm [interval] Start swarm monitor only"
|
|
238
|
+
echo " start-metrics [interval] Start metrics daemon only"
|
|
239
|
+
echo " help Show this help"
|
|
240
|
+
echo ""
|
|
241
|
+
echo "Examples:"
|
|
242
|
+
echo " $0 start # Start with defaults (30s swarm, 60s metrics)"
|
|
243
|
+
echo " $0 start 10 30 # Start with 10s swarm, 30s metrics intervals"
|
|
244
|
+
echo " $0 status # Show current status"
|
|
245
|
+
echo " $0 stop # Stop all daemons"
|
|
246
|
+
;;
|
|
247
|
+
*)
|
|
248
|
+
error "Unknown command: $1"
|
|
249
|
+
echo "Use '$0 help' for usage information"
|
|
250
|
+
exit 1
|
|
251
|
+
;;
|
|
252
|
+
esac
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Claude Flow V3 - DDD Progress Tracker Worker
|
|
3
|
+
# Tracks Domain-Driven Design implementation progress
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
8
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
9
|
+
METRICS_DIR="$PROJECT_ROOT/.claude-flow/metrics"
|
|
10
|
+
DDD_FILE="$METRICS_DIR/ddd-progress.json"
|
|
11
|
+
V3_PROGRESS="$METRICS_DIR/v3-progress.json"
|
|
12
|
+
LAST_RUN_FILE="$METRICS_DIR/.ddd-last-run"
|
|
13
|
+
|
|
14
|
+
mkdir -p "$METRICS_DIR"
|
|
15
|
+
|
|
16
|
+
# V3 Target Domains
|
|
17
|
+
DOMAINS=("agent-lifecycle" "task-execution" "memory-management" "coordination" "shared-kernel")
|
|
18
|
+
|
|
19
|
+
should_run() {
|
|
20
|
+
if [ ! -f "$LAST_RUN_FILE" ]; then return 0; fi
|
|
21
|
+
local last_run=$(cat "$LAST_RUN_FILE" 2>/dev/null || echo "0")
|
|
22
|
+
local now=$(date +%s)
|
|
23
|
+
[ $((now - last_run)) -ge 600 ] # 10 minutes
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
check_domain() {
|
|
27
|
+
local domain="$1"
|
|
28
|
+
local domain_path="$PROJECT_ROOT/v3/@claude-flow/$domain"
|
|
29
|
+
local alt_path="$PROJECT_ROOT/src/domains/$domain"
|
|
30
|
+
|
|
31
|
+
local score=0
|
|
32
|
+
local max_score=100
|
|
33
|
+
|
|
34
|
+
# Check if domain directory exists (20 points)
|
|
35
|
+
if [ -d "$domain_path" ] || [ -d "$alt_path" ]; then
|
|
36
|
+
score=$((score + 20))
|
|
37
|
+
local path="${domain_path:-$alt_path}"
|
|
38
|
+
[ -d "$domain_path" ] && path="$domain_path" || path="$alt_path"
|
|
39
|
+
|
|
40
|
+
# Check for domain layer (15 points)
|
|
41
|
+
[ -d "$path/domain" ] || [ -d "$path/src/domain" ] && score=$((score + 15))
|
|
42
|
+
|
|
43
|
+
# Check for application layer (15 points)
|
|
44
|
+
[ -d "$path/application" ] || [ -d "$path/src/application" ] && score=$((score + 15))
|
|
45
|
+
|
|
46
|
+
# Check for infrastructure layer (15 points)
|
|
47
|
+
[ -d "$path/infrastructure" ] || [ -d "$path/src/infrastructure" ] && score=$((score + 15))
|
|
48
|
+
|
|
49
|
+
# Check for API/interface layer (10 points)
|
|
50
|
+
[ -d "$path/api" ] || [ -d "$path/src/api" ] && score=$((score + 10))
|
|
51
|
+
|
|
52
|
+
# Check for tests (15 points)
|
|
53
|
+
local test_count=$(find "$path" -name "*.test.ts" -o -name "*.spec.ts" 2>/dev/null | wc -l)
|
|
54
|
+
[ "$test_count" -gt 0 ] && score=$((score + 15))
|
|
55
|
+
|
|
56
|
+
# Check for index/exports (10 points)
|
|
57
|
+
[ -f "$path/index.ts" ] || [ -f "$path/src/index.ts" ] && score=$((score + 10))
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
echo "$score"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
count_entities() {
|
|
64
|
+
local type="$1"
|
|
65
|
+
local pattern="$2"
|
|
66
|
+
|
|
67
|
+
find "$PROJECT_ROOT/v3" "$PROJECT_ROOT/src" -name "*.ts" 2>/dev/null | \
|
|
68
|
+
xargs grep -l "$pattern" 2>/dev/null | \
|
|
69
|
+
grep -v node_modules | grep -v ".test." | wc -l || echo "0"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
track_ddd() {
|
|
73
|
+
echo "[$(date +%H:%M:%S)] Tracking DDD progress..."
|
|
74
|
+
|
|
75
|
+
local total_score=0
|
|
76
|
+
local domain_scores=""
|
|
77
|
+
local completed_domains=0
|
|
78
|
+
|
|
79
|
+
for domain in "${DOMAINS[@]}"; do
|
|
80
|
+
local score=$(check_domain "$domain")
|
|
81
|
+
total_score=$((total_score + score))
|
|
82
|
+
domain_scores="$domain_scores\"$domain\": $score, "
|
|
83
|
+
|
|
84
|
+
[ "$score" -ge 50 ] && completed_domains=$((completed_domains + 1))
|
|
85
|
+
done
|
|
86
|
+
|
|
87
|
+
# Calculate overall progress
|
|
88
|
+
local max_total=$((${#DOMAINS[@]} * 100))
|
|
89
|
+
local progress=$((total_score * 100 / max_total))
|
|
90
|
+
|
|
91
|
+
# Count DDD artifacts
|
|
92
|
+
local entities=$(count_entities "entities" "class.*Entity\|interface.*Entity")
|
|
93
|
+
local value_objects=$(count_entities "value-objects" "class.*VO\|ValueObject")
|
|
94
|
+
local aggregates=$(count_entities "aggregates" "class.*Aggregate\|AggregateRoot")
|
|
95
|
+
local repositories=$(count_entities "repositories" "interface.*Repository\|Repository")
|
|
96
|
+
local services=$(count_entities "services" "class.*Service\|Service")
|
|
97
|
+
local events=$(count_entities "events" "class.*Event\|DomainEvent")
|
|
98
|
+
|
|
99
|
+
# Write DDD metrics
|
|
100
|
+
cat > "$DDD_FILE" << EOF
|
|
101
|
+
{
|
|
102
|
+
"timestamp": "$(date -Iseconds)",
|
|
103
|
+
"progress": $progress,
|
|
104
|
+
"domains": {
|
|
105
|
+
${domain_scores%,*}
|
|
106
|
+
},
|
|
107
|
+
"completed": $completed_domains,
|
|
108
|
+
"total": ${#DOMAINS[@]},
|
|
109
|
+
"artifacts": {
|
|
110
|
+
"entities": $entities,
|
|
111
|
+
"valueObjects": $value_objects,
|
|
112
|
+
"aggregates": $aggregates,
|
|
113
|
+
"repositories": $repositories,
|
|
114
|
+
"services": $services,
|
|
115
|
+
"domainEvents": $events
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
EOF
|
|
119
|
+
|
|
120
|
+
# Update v3-progress.json
|
|
121
|
+
if [ -f "$V3_PROGRESS" ] && command -v jq &>/dev/null; then
|
|
122
|
+
jq --argjson progress "$progress" --argjson completed "$completed_domains" \
|
|
123
|
+
'.ddd.progress = $progress | .domains.completed = $completed' \
|
|
124
|
+
"$V3_PROGRESS" > "$V3_PROGRESS.tmp" && mv "$V3_PROGRESS.tmp" "$V3_PROGRESS"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
echo "[$(date +%H:%M:%S)] ✓ DDD: ${progress}% | Domains: $completed_domains/${#DOMAINS[@]} | Entities: $entities | Services: $services"
|
|
128
|
+
|
|
129
|
+
date +%s > "$LAST_RUN_FILE"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
case "${1:-check}" in
|
|
133
|
+
"run"|"track") track_ddd ;;
|
|
134
|
+
"check") should_run && track_ddd || echo "[$(date +%H:%M:%S)] Skipping (throttled)" ;;
|
|
135
|
+
"force") rm -f "$LAST_RUN_FILE"; track_ddd ;;
|
|
136
|
+
"status")
|
|
137
|
+
if [ -f "$DDD_FILE" ]; then
|
|
138
|
+
jq -r '"Progress: \(.progress)% | Domains: \(.completed)/\(.total) | Entities: \(.artifacts.entities) | Services: \(.artifacts.services)"' "$DDD_FILE"
|
|
139
|
+
else
|
|
140
|
+
echo "No DDD data available"
|
|
141
|
+
fi
|
|
142
|
+
;;
|
|
143
|
+
*) echo "Usage: $0 [run|check|force|status]" ;;
|
|
144
|
+
esac
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Safe GitHub CLI Helper — v1.0.0
|
|
4
|
+
*
|
|
5
|
+
* Prevents injection issues when using `gh` commands with untrusted content
|
|
6
|
+
* (PR bodies, issue bodies, comment bodies) by routing the body through a
|
|
7
|
+
* temp file and using `--body-file` rather than interpolating into shell args.
|
|
8
|
+
*
|
|
9
|
+
* ADR-127 Phase 2 hardening:
|
|
10
|
+
* - GITHUB_SAFE_VERSION exported for smoke assertions.
|
|
11
|
+
* - Explicit 256KB body cap: rejects oversized bodies before any temp-file
|
|
12
|
+
* write, matching the GitHub API `body` field limit.
|
|
13
|
+
* - Strict error handling: all execSync calls inside try/catch; cleanup in
|
|
14
|
+
* finally; non-zero exit on any error.
|
|
15
|
+
* - GITHUB_SAFE_DRY_RUN=1 env-var skips the actual `gh` exec for testing.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ./github-safe.js issue comment 123 "Message with \`backticks\`"
|
|
19
|
+
* ./github-safe.js pr create --title "Title" --body "Complex body"
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import { execSync, execFileSync } from 'child_process';
|
|
23
|
+
import { writeFileSync, unlinkSync } from 'fs';
|
|
24
|
+
import { tmpdir } from 'os';
|
|
25
|
+
import { join } from 'path';
|
|
26
|
+
import { randomBytes } from 'crypto';
|
|
27
|
+
|
|
28
|
+
// Version constant — asserted by smoke-github-safe-injection.mjs.
|
|
29
|
+
export const GITHUB_SAFE_VERSION = '1.0.0';
|
|
30
|
+
|
|
31
|
+
// Maximum body size allowed (bytes). The GitHub API enforces 65536 chars for
|
|
32
|
+
// issue/PR bodies; the CLI is more lenient but the 256KB limit is a
|
|
33
|
+
// conservative safety cap that prevents accidental oversized writes.
|
|
34
|
+
const MAX_BODY_BYTES = 256 * 1024;
|
|
35
|
+
|
|
36
|
+
const args = process.argv.slice(2);
|
|
37
|
+
|
|
38
|
+
if (args.length < 2) {
|
|
39
|
+
console.log(`
|
|
40
|
+
Safe GitHub CLI Helper v${GITHUB_SAFE_VERSION}
|
|
41
|
+
|
|
42
|
+
Usage:
|
|
43
|
+
./github-safe.js issue comment <number> <body>
|
|
44
|
+
./github-safe.js pr comment <number> <body>
|
|
45
|
+
./github-safe.js issue create --title <title> --body <body>
|
|
46
|
+
./github-safe.js pr create --title <title> --body <body>
|
|
47
|
+
|
|
48
|
+
This helper prevents injection issues with special characters:
|
|
49
|
+
- Backticks in code examples
|
|
50
|
+
- Command substitution $(...)
|
|
51
|
+
- Semicolons and other shell metacharacters
|
|
52
|
+
- Oversized bodies (> 256 KB rejected)
|
|
53
|
+
`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [command, subcommand, ...restArgs] = args;
|
|
58
|
+
|
|
59
|
+
// Handle commands that need body content
|
|
60
|
+
if ((command === 'issue' || command === 'pr') &&
|
|
61
|
+
(subcommand === 'comment' || subcommand === 'create')) {
|
|
62
|
+
|
|
63
|
+
let bodyIndex = -1;
|
|
64
|
+
let body = '';
|
|
65
|
+
|
|
66
|
+
if (subcommand === 'comment' && restArgs.length >= 2) {
|
|
67
|
+
// Simple format: github-safe.js issue comment 123 "body"
|
|
68
|
+
body = restArgs[1];
|
|
69
|
+
bodyIndex = 1;
|
|
70
|
+
} else {
|
|
71
|
+
// Flag format: --body "content"
|
|
72
|
+
bodyIndex = restArgs.indexOf('--body');
|
|
73
|
+
if (bodyIndex !== -1 && bodyIndex < restArgs.length - 1) {
|
|
74
|
+
body = restArgs[bodyIndex + 1];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (body) {
|
|
79
|
+
// Enforce 256KB cap before any file I/O.
|
|
80
|
+
const bodyBytes = Buffer.byteLength(body, 'utf8');
|
|
81
|
+
if (bodyBytes > MAX_BODY_BYTES) {
|
|
82
|
+
console.error(
|
|
83
|
+
`[ERROR] Body exceeds maximum allowed size (${bodyBytes} bytes > ${MAX_BODY_BYTES} bytes). ` +
|
|
84
|
+
'GitHub API body fields are capped at 256KB. Truncate the body before passing it to github-safe.js.'
|
|
85
|
+
);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Use temporary file for body content — never interpolate into argv.
|
|
90
|
+
const tmpFile = join(tmpdir(), `gh-body-${randomBytes(8).toString('hex')}.tmp`);
|
|
91
|
+
|
|
92
|
+
try {
|
|
93
|
+
writeFileSync(tmpFile, body, 'utf8');
|
|
94
|
+
|
|
95
|
+
// Build new command with --body-file
|
|
96
|
+
const newArgs = [...restArgs];
|
|
97
|
+
if (subcommand === 'comment' && bodyIndex === 1) {
|
|
98
|
+
// Replace positional body arg with --body-file
|
|
99
|
+
newArgs[1] = '--body-file';
|
|
100
|
+
newArgs.push(tmpFile);
|
|
101
|
+
} else if (bodyIndex !== -1) {
|
|
102
|
+
// Replace --body flag pair with --body-file
|
|
103
|
+
newArgs[bodyIndex] = '--body-file';
|
|
104
|
+
newArgs[bodyIndex + 1] = tmpFile;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Skip actual gh exec in dry-run mode (used by smoke tests).
|
|
108
|
+
if (process.env.GITHUB_SAFE_DRY_RUN === '1') {
|
|
109
|
+
const ghArgs = [command, subcommand, ...newArgs];
|
|
110
|
+
console.log(`[DRY-RUN] gh ${ghArgs.join(' ')}`);
|
|
111
|
+
process.exit(0);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const ghArgv = [command, subcommand, ...newArgs];
|
|
115
|
+
console.log(`Executing: gh ${ghArgv.join(' ')}`);
|
|
116
|
+
|
|
117
|
+
// Use execFileSync to avoid shell interpolation — args are passed as an
|
|
118
|
+
// array so shell metacharacters in tmpFile path cannot be exploited.
|
|
119
|
+
execFileSync('gh', ghArgv, {
|
|
120
|
+
stdio: 'inherit',
|
|
121
|
+
timeout: 30000,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error('[ERROR]', error.message);
|
|
126
|
+
process.exit(1);
|
|
127
|
+
} finally {
|
|
128
|
+
// Always clean up the temp file.
|
|
129
|
+
try { unlinkSync(tmpFile); } catch (_) { /* ignore cleanup errors */ }
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
// No body content — execute normally (no injection risk for args).
|
|
133
|
+
if (process.env.GITHUB_SAFE_DRY_RUN === '1') {
|
|
134
|
+
console.log(`[DRY-RUN] gh ${args.join(' ')}`);
|
|
135
|
+
process.exit(0);
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
execFileSync('gh', args, { stdio: 'inherit' });
|
|
139
|
+
} catch (error) {
|
|
140
|
+
console.error('[ERROR]', error.message);
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
// Non-body commands — execute normally.
|
|
146
|
+
if (process.env.GITHUB_SAFE_DRY_RUN === '1') {
|
|
147
|
+
console.log(`[DRY-RUN] gh ${args.join(' ')}`);
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
execFileSync('gh', args, { stdio: 'inherit' });
|
|
152
|
+
} catch (error) {
|
|
153
|
+
console.error('[ERROR]', error.message);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Security rationale: set -euo pipefail ensures that:
|
|
3
|
+
# -e — exit immediately if any command fails (no silent failures)
|
|
4
|
+
# -u — treat unset variables as errors (prevents empty-string expansion bugs)
|
|
5
|
+
# -o pipefail — pipeline fails if any command in it fails (not just last)
|
|
6
|
+
# This matches the ADR-127 Phase 2 requirement for github-setup.sh hardening.
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
# Setup GitHub integration for Claude Flow
|
|
10
|
+
|
|
11
|
+
echo "Setting up GitHub integration..."
|
|
12
|
+
|
|
13
|
+
# Check for gh CLI
|
|
14
|
+
if ! command -v gh &> /dev/null; then
|
|
15
|
+
echo "WARNING: GitHub CLI (gh) not found"
|
|
16
|
+
echo "Install from: https://cli.github.com/"
|
|
17
|
+
echo "Continuing without GitHub features..."
|
|
18
|
+
else
|
|
19
|
+
echo "OK: GitHub CLI found"
|
|
20
|
+
|
|
21
|
+
# Check auth status and scope sufficiency.
|
|
22
|
+
# `gh auth status` exits non-zero when not authenticated.
|
|
23
|
+
# We additionally parse for "Token scopes" to verify we have at least
|
|
24
|
+
# 'repo' scope, which is required for PR/issue operations.
|
|
25
|
+
if gh auth status 2>&1 | grep -q "Logged in"; then
|
|
26
|
+
echo "OK: GitHub authentication active"
|
|
27
|
+
# Verify repo scope is present for PR/issue operations.
|
|
28
|
+
if gh auth status 2>&1 | grep -q "repo"; then
|
|
29
|
+
echo "OK: 'repo' scope available"
|
|
30
|
+
else
|
|
31
|
+
echo "WARNING: 'repo' scope not confirmed — PR/issue operations may fail"
|
|
32
|
+
echo "Run: gh auth login --scopes repo,read:org"
|
|
33
|
+
fi
|
|
34
|
+
else
|
|
35
|
+
echo "WARNING: Not authenticated with GitHub"
|
|
36
|
+
echo "Run: gh auth login"
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
echo ""
|
|
41
|
+
echo "GitHub swarm commands available:"
|
|
42
|
+
echo " - npx claude-flow github swarm"
|
|
43
|
+
echo " - npx claude-flow repo analyze"
|
|
44
|
+
echo " - npx claude-flow pr enhance"
|
|
45
|
+
echo " - npx claude-flow issue triage"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Capture hook guidance for Claude visibility
|
|
3
|
+
GUIDANCE_FILE=".claude-flow/last-guidance.txt"
|
|
4
|
+
mkdir -p .claude-flow
|
|
5
|
+
|
|
6
|
+
case "$1" in
|
|
7
|
+
"route")
|
|
8
|
+
npx agentic-flow@alpha hooks route "$2" 2>&1 | tee "$GUIDANCE_FILE"
|
|
9
|
+
;;
|
|
10
|
+
"pre-edit")
|
|
11
|
+
npx agentic-flow@alpha hooks pre-edit "$2" 2>&1 | tee "$GUIDANCE_FILE"
|
|
12
|
+
;;
|
|
13
|
+
esac
|