forked from anonymusk7/council-of-high-intelligence
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·245 lines (218 loc) · 7.39 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·245 lines (218 loc) · 7.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLAUDE_DIR="${HOME}/.claude"
CODEX_DIR="${HOME}/.codex"
DRY_RUN=false
COPY_CONFIGS=false
INSTALL_CLAUDE=true
INSTALL_CODEX=false
usage() {
cat <<'EOF'
Usage: ./install.sh [--claude-dir PATH] [--codex-dir PATH] [--codex] [--codex-only] [--copy-configs] [--dry-run] [--help]
Install Council of High Intelligence into Claude Code and/or Codex skill directories.
Options:
--claude-dir PATH Target Claude config directory (default: ~/.claude)
--codex-dir PATH Target Codex config directory (default: ~/.codex)
--codex Also install a Codex-compatible council skill
--codex-only Install only the Codex skill (skip Claude install)
--copy-configs Also install repo configs/ into skill config folders
--dry-run Print actions without writing files
--help Show this help message
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--claude-dir)
if [[ $# -lt 2 ]]; then
echo "Error: --claude-dir requires a path argument" >&2
usage
exit 1
fi
CLAUDE_DIR="$2"
shift 2
;;
--codex-dir)
if [[ $# -lt 2 ]]; then
echo "Error: --codex-dir requires a path argument" >&2
usage
exit 1
fi
CODEX_DIR="$2"
shift 2
;;
--codex)
INSTALL_CODEX=true
shift
;;
--codex-only)
INSTALL_CLAUDE=false
INSTALL_CODEX=true
shift
;;
--copy-configs)
COPY_CONFIGS=true
shift
;;
--dry-run)
DRY_RUN=true
shift
;;
--help|-h)
usage
exit 0
;;
*)
echo "Error: unknown argument '$1'" >&2
usage
exit 1
;;
esac
done
if [[ "${INSTALL_CLAUDE}" == false ]] && [[ "${INSTALL_CODEX}" == false ]]; then
echo "Error: no install target selected" >&2
usage
exit 1
fi
run_cmd() {
if [[ "$DRY_RUN" == true ]]; then
echo "[dry-run] $*"
else
"$@"
fi
}
if [[ ! -d "${SCRIPT_DIR}/agents" ]]; then
echo "Error: agents directory not found at ${SCRIPT_DIR}/agents" >&2
exit 1
fi
if [[ "${INSTALL_CLAUDE}" == true ]] && [[ ! -f "${SCRIPT_DIR}/SKILL.md" ]]; then
echo "Error: SKILL.md not found at ${SCRIPT_DIR}/SKILL.md" >&2
exit 1
fi
if [[ "${INSTALL_CODEX}" == true ]] && [[ ! -f "${SCRIPT_DIR}/SKILL.codex.md" ]]; then
echo "Error: SKILL.codex.md not found at ${SCRIPT_DIR}/SKILL.codex.md" >&2
exit 1
fi
shopt -s nullglob
agent_files=("${SCRIPT_DIR}"/agents/council-*.md)
shopt -u nullglob
if [[ ${#agent_files[@]} -eq 0 ]]; then
echo "Error: no council agent files found under ${SCRIPT_DIR}/agents" >&2
exit 1
fi
CONFIGS_SRC_DIR="${SCRIPT_DIR}/configs"
echo "Installing Council of High Intelligence..."
if [[ "${INSTALL_CLAUDE}" == true ]]; then
AGENTS_DEST="${CLAUDE_DIR}/agents"
CLAUDE_SKILL_DEST_DIR="${CLAUDE_DIR}/skills/council"
CLAUDE_SKILL_DEST="${CLAUDE_SKILL_DEST_DIR}/SKILL.md"
CLAUDE_CONFIGS_DEST_DIR="${CLAUDE_SKILL_DEST_DIR}/configs"
CLAUDE_SCRIPTS_DEST_DIR="${CLAUDE_SKILL_DEST_DIR}/scripts"
echo "Claude target directory: ${CLAUDE_DIR}"
echo "Creating Claude destination directories..."
run_cmd mkdir -p "${AGENTS_DEST}" "${CLAUDE_SKILL_DEST_DIR}"
echo "Installing Claude council agents..."
installed_count=0
for agent_file in "${agent_files[@]}"; do
run_cmd install -m 0644 "${agent_file}" "${AGENTS_DEST}/"
((installed_count+=1))
done
echo "Installing Claude council skill..."
run_cmd install -m 0644 "${SCRIPT_DIR}/SKILL.md" "${CLAUDE_SKILL_DEST}"
echo "Installing Claude council scripts..."
run_cmd mkdir -p "${CLAUDE_SCRIPTS_DEST_DIR}"
scripts_installed=0
shopt -s nullglob
script_files=("${SCRIPT_DIR}"/scripts/detect-*.sh)
shopt -u nullglob
for script_file in "${script_files[@]}"; do
run_cmd install -m 0755 "${script_file}" "${CLAUDE_SCRIPTS_DEST_DIR}/"
((scripts_installed+=1))
done
claude_configs_installed=0
if [[ "$COPY_CONFIGS" == true ]]; then
if [[ -d "${CONFIGS_SRC_DIR}" ]]; then
run_cmd mkdir -p "${CLAUDE_CONFIGS_DEST_DIR}"
shopt -s nullglob
config_files=("${CONFIGS_SRC_DIR}"/*)
shopt -u nullglob
for config_file in "${config_files[@]}"; do
if [[ -f "${config_file}" ]]; then
run_cmd install -m 0644 "${config_file}" "${CLAUDE_CONFIGS_DEST_DIR}/"
((claude_configs_installed+=1))
fi
done
else
echo "Warning: --copy-configs was set but ${CONFIGS_SRC_DIR} does not exist."
fi
fi
fi
if [[ "${INSTALL_CODEX}" == true ]]; then
CODEX_SKILL_DEST_DIR="${CODEX_DIR}/skills/council"
CODEX_SKILL_DEST="${CODEX_SKILL_DEST_DIR}/SKILL.md"
CODEX_AGENTS_DEST_DIR="${CODEX_SKILL_DEST_DIR}/agents"
CODEX_SCRIPTS_DEST_DIR="${CODEX_SKILL_DEST_DIR}/scripts"
CODEX_CONFIGS_DEST_DIR="${CODEX_SKILL_DEST_DIR}/configs"
echo "Codex target directory: ${CODEX_DIR}"
echo "Creating Codex destination directories..."
run_cmd mkdir -p "${CODEX_SKILL_DEST_DIR}" "${CODEX_AGENTS_DEST_DIR}" "${CODEX_SCRIPTS_DEST_DIR}"
echo "Installing Codex council skill..."
run_cmd install -m 0644 "${SCRIPT_DIR}/SKILL.codex.md" "${CODEX_SKILL_DEST}"
echo "Installing Codex council agents..."
codex_agents_installed=0
for agent_file in "${agent_files[@]}"; do
run_cmd install -m 0644 "${agent_file}" "${CODEX_AGENTS_DEST_DIR}/"
((codex_agents_installed+=1))
done
echo "Installing Codex council scripts..."
codex_scripts_installed=0
shopt -s nullglob
codex_script_files=("${SCRIPT_DIR}"/scripts/detect-*.sh)
shopt -u nullglob
for script_file in "${codex_script_files[@]}"; do
run_cmd install -m 0755 "${script_file}" "${CODEX_SCRIPTS_DEST_DIR}/"
((codex_scripts_installed+=1))
done
codex_configs_installed=0
if [[ "$COPY_CONFIGS" == true ]]; then
if [[ -d "${CONFIGS_SRC_DIR}" ]]; then
run_cmd mkdir -p "${CODEX_CONFIGS_DEST_DIR}"
shopt -s nullglob
codex_config_files=("${CONFIGS_SRC_DIR}"/*)
shopt -u nullglob
for config_file in "${codex_config_files[@]}"; do
if [[ -f "${config_file}" ]]; then
run_cmd install -m 0644 "${config_file}" "${CODEX_CONFIGS_DEST_DIR}/"
((codex_configs_installed+=1))
fi
done
else
echo "Warning: --copy-configs was set but ${CONFIGS_SRC_DIR} does not exist."
fi
fi
fi
echo
echo "Done."
if [[ "${INSTALL_CLAUDE}" == true ]]; then
echo " Installed ${installed_count} council agents to ${AGENTS_DEST}"
echo " Installed skill to ${CLAUDE_SKILL_DEST}"
echo " Installed ${scripts_installed} scripts to ${CLAUDE_SCRIPTS_DEST_DIR}"
if [[ "$COPY_CONFIGS" == true ]]; then
echo " Installed ${claude_configs_installed} config files to ${CLAUDE_CONFIGS_DEST_DIR}"
fi
fi
if [[ "${INSTALL_CODEX}" == true ]]; then
echo " Installed Codex skill to ${CODEX_SKILL_DEST}"
echo " Installed ${codex_agents_installed} Codex council agents to ${CODEX_AGENTS_DEST_DIR}"
echo " Installed ${codex_scripts_installed} Codex scripts to ${CODEX_SCRIPTS_DEST_DIR}"
if [[ "$COPY_CONFIGS" == true ]]; then
echo " Installed ${codex_configs_installed} Codex config files to ${CODEX_CONFIGS_DEST_DIR}"
fi
fi
if [[ "${INSTALL_CLAUDE}" == true ]] && [[ "${INSTALL_CODEX}" == true ]]; then
echo "Restart Claude Code and Codex, then use /council."
elif [[ "${INSTALL_CLAUDE}" == true ]]; then
echo "Restart Claude Code and use /council to convene the council."
else
echo "Restart Codex and use /council to convene the council."
fi