ai-consultants 2.10.1
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/.claude/commands/ai-consultants:consult.md +94 -0
- package/.claude/commands/ai-consultants:debate.md +103 -0
- package/.claude/commands/ai-consultants:help.md +30 -0
- package/CLAUDE.md +839 -0
- package/LICENSE +21 -0
- package/README.md +758 -0
- package/SKILL.md +156 -0
- package/bin/ai-consultants +96 -0
- package/docs/COST_RATES.md +172 -0
- package/docs/JSON_SCHEMA.md +305 -0
- package/docs/SETUP.md +879 -0
- package/docs/SMART_ROUTING.md +219 -0
- package/docs/cost_rates.json +143 -0
- package/package.json +47 -0
- package/references/configuration.md +141 -0
- package/references/details.md +60 -0
- package/scripts/build_context.sh +562 -0
- package/scripts/classify_question.sh +148 -0
- package/scripts/config.sh +753 -0
- package/scripts/configure.sh +1093 -0
- package/scripts/consult_all.sh +934 -0
- package/scripts/debate_round.sh +421 -0
- package/scripts/doctor.sh +642 -0
- package/scripts/followup.sh +197 -0
- package/scripts/install.sh +319 -0
- package/scripts/lib/api.sh +640 -0
- package/scripts/lib/api_query.sh +228 -0
- package/scripts/lib/cache.sh +338 -0
- package/scripts/lib/chunking.sh +880 -0
- package/scripts/lib/code_optimizer.sh +671 -0
- package/scripts/lib/common.sh +1088 -0
- package/scripts/lib/costs.sh +674 -0
- package/scripts/lib/personas.sh +372 -0
- package/scripts/lib/progress.sh +251 -0
- package/scripts/lib/reflection.sh +447 -0
- package/scripts/lib/routing.sh +566 -0
- package/scripts/lib/schema.json +165 -0
- package/scripts/lib/session.sh +327 -0
- package/scripts/lib/symbol_map.sh +445 -0
- package/scripts/lib/voting.sh +495 -0
- package/scripts/peer_review.sh +460 -0
- package/scripts/preflight_check.sh +452 -0
- package/scripts/query_aider.sh +83 -0
- package/scripts/query_amp.sh +67 -0
- package/scripts/query_claude.sh +99 -0
- package/scripts/query_codex.sh +92 -0
- package/scripts/query_cursor.sh +72 -0
- package/scripts/query_deepseek.sh +17 -0
- package/scripts/query_gemini.sh +85 -0
- package/scripts/query_glm.sh +17 -0
- package/scripts/query_grok.sh +17 -0
- package/scripts/query_kilo.sh +140 -0
- package/scripts/query_kimi.sh +67 -0
- package/scripts/query_minimax.sh +17 -0
- package/scripts/query_mistral.sh +97 -0
- package/scripts/query_ollama.sh +328 -0
- package/scripts/query_qwen3.sh +93 -0
- package/scripts/setup_wizard.sh +367 -0
- package/scripts/skillport-install.sh +196 -0
- package/scripts/synthesize.sh +332 -0
- package/templates/consultation_report.md +323 -0
- package/templates/synthesis_prompt.md +120 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# classify_question.sh - Question classifier for smart routing
|
|
3
|
+
#
|
|
4
|
+
# Classifies questions by type to optimize consultant selection.
|
|
5
|
+
#
|
|
6
|
+
# Usage: ./classify_question.sh "question"
|
|
7
|
+
# Output: category (CODE_REVIEW, ARCHITECTURE, BUG_DEBUG, etc.)
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
+
source "$SCRIPT_DIR/lib/common.sh"
|
|
13
|
+
|
|
14
|
+
QUESTION="${1:-}"
|
|
15
|
+
|
|
16
|
+
if [[ -z "$QUESTION" ]]; then
|
|
17
|
+
log_error "Usage: $0 \"question\""
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# =============================================================================
|
|
22
|
+
# PATTERN-BASED CLASSIFICATION (fast, no API call)
|
|
23
|
+
# =============================================================================
|
|
24
|
+
|
|
25
|
+
classify_by_patterns() {
|
|
26
|
+
local question="$1"
|
|
27
|
+
local q_lower=$(echo "$question" | tr '[:upper:]' '[:lower:]')
|
|
28
|
+
|
|
29
|
+
# CODE_REVIEW patterns
|
|
30
|
+
if echo "$q_lower" | grep -qE 'review|check|code review|analyze.*code|quality|qualit'; then
|
|
31
|
+
echo "CODE_REVIEW"
|
|
32
|
+
return 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# BUG_DEBUG patterns
|
|
36
|
+
if echo "$q_lower" | grep -qE 'bug|error|crash|fix|debug|problem|issue|not working|fails|exception|traceback'; then
|
|
37
|
+
echo "BUG_DEBUG"
|
|
38
|
+
return 0
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# ARCHITECTURE patterns
|
|
42
|
+
if echo "$q_lower" | grep -qE 'architect|design|pattern|structure|microservic|monolit|scalabil|refactor|organiz|system design'; then
|
|
43
|
+
echo "ARCHITECTURE"
|
|
44
|
+
return 0
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# ALGORITHM patterns
|
|
48
|
+
if echo "$q_lower" | grep -qE 'algorithm|optimi|performance|complexit|O\(|big-o|efficien|sort|search|data structure'; then
|
|
49
|
+
echo "ALGORITHM"
|
|
50
|
+
return 0
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# SECURITY patterns
|
|
54
|
+
if echo "$q_lower" | grep -qE 'security|vulnerabil|injection|xss|csrf|auth|authentication|password|encrypt|decrypt|token|jwt'; then
|
|
55
|
+
echo "SECURITY"
|
|
56
|
+
return 0
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# QUICK_SYNTAX patterns
|
|
60
|
+
if echo "$q_lower" | grep -qE 'syntax|how to write|example of|snippet|one-liner'; then
|
|
61
|
+
echo "QUICK_SYNTAX"
|
|
62
|
+
return 0
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# DATABASE patterns
|
|
66
|
+
if echo "$q_lower" | grep -qE 'database|sql|query|mongodb|postgres|mysql|redis|index|migration|schema'; then
|
|
67
|
+
echo "DATABASE"
|
|
68
|
+
return 0
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
# API patterns
|
|
72
|
+
if echo "$q_lower" | grep -qE 'api|rest|graphql|endpoint|request|response|http|webhook'; then
|
|
73
|
+
echo "API_DESIGN"
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# TESTING patterns
|
|
78
|
+
if echo "$q_lower" | grep -qE 'test|testing|unit test|integration|mock|stub|coverage|tdd|bdd'; then
|
|
79
|
+
echo "TESTING"
|
|
80
|
+
return 0
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# Default
|
|
84
|
+
echo "GENERAL"
|
|
85
|
+
return 0
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# =============================================================================
|
|
89
|
+
# LLM-BASED CLASSIFICATION (more accurate, requires API)
|
|
90
|
+
# =============================================================================
|
|
91
|
+
|
|
92
|
+
classify_with_llm() {
|
|
93
|
+
local question="$1"
|
|
94
|
+
|
|
95
|
+
local prompt="Classify this programming question into ONE category only:
|
|
96
|
+
|
|
97
|
+
CATEGORIES:
|
|
98
|
+
- CODE_REVIEW: Code review, quality analysis, best practices
|
|
99
|
+
- BUG_DEBUG: Debugging, error fixing, troubleshooting
|
|
100
|
+
- ARCHITECTURE: System design, patterns, project structure
|
|
101
|
+
- ALGORITHM: Algorithms, data structures, complexity, optimization
|
|
102
|
+
- SECURITY: Security, vulnerabilities, authentication
|
|
103
|
+
- QUICK_SYNTAX: Quick syntax questions, snippets, one-liners
|
|
104
|
+
- DATABASE: SQL queries, schema design, database operations
|
|
105
|
+
- API_DESIGN: API design, REST, GraphQL, endpoints
|
|
106
|
+
- TESTING: Unit testing, integration testing, TDD
|
|
107
|
+
- GENERAL: Other
|
|
108
|
+
|
|
109
|
+
QUESTION: $question
|
|
110
|
+
|
|
111
|
+
Reply ONLY with the category name (e.g.: ARCHITECTURE), nothing else."
|
|
112
|
+
|
|
113
|
+
if command -v claude &> /dev/null; then
|
|
114
|
+
local result=$(echo "$prompt" | claude --print 2>/dev/null | tr -d '\n' | tr '[:lower:]' '[:upper:]')
|
|
115
|
+
# Validate that it's a valid category
|
|
116
|
+
case "$result" in
|
|
117
|
+
CODE_REVIEW|BUG_DEBUG|ARCHITECTURE|ALGORITHM|SECURITY|QUICK_SYNTAX|DATABASE|API_DESIGN|TESTING|GENERAL)
|
|
118
|
+
echo "$result"
|
|
119
|
+
return 0
|
|
120
|
+
;;
|
|
121
|
+
*)
|
|
122
|
+
# Fallback to pattern matching
|
|
123
|
+
classify_by_patterns "$question"
|
|
124
|
+
return 0
|
|
125
|
+
;;
|
|
126
|
+
esac
|
|
127
|
+
else
|
|
128
|
+
# No LLM available, use pattern matching
|
|
129
|
+
classify_by_patterns "$question"
|
|
130
|
+
return 0
|
|
131
|
+
fi
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# =============================================================================
|
|
135
|
+
# MAIN
|
|
136
|
+
# =============================================================================
|
|
137
|
+
|
|
138
|
+
# Use classification mode from config or default to pattern
|
|
139
|
+
CLASSIFICATION_MODE="${CLASSIFICATION_MODE:-pattern}"
|
|
140
|
+
|
|
141
|
+
case "$CLASSIFICATION_MODE" in
|
|
142
|
+
llm)
|
|
143
|
+
classify_with_llm "$QUESTION"
|
|
144
|
+
;;
|
|
145
|
+
pattern|*)
|
|
146
|
+
classify_by_patterns "$QUESTION"
|
|
147
|
+
;;
|
|
148
|
+
esac
|