@ksuchoi216/ahe 0.1.6 → 0.1.10
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/README.md +82 -214
- package/bin/ahe +34 -231
- package/package.json +8 -4
- package/packages/ahe-antigravity/bin/ahe-antigravity +325 -0
- package/packages/ahe-antigravity/package.json +7 -0
- package/packages/ahe-antigravity/skills/ahe-git/SKILL.md +35 -0
- package/packages/ahe-antigravity/skills/ahe-ship/SKILL.md +28 -0
- package/packages/ahe-antigravity/skills/ahe-ship/scripts/post-ship-hook.sh +12 -0
- package/packages/ahe-codex/.codex/agents/ahe-harness-manager.toml +19 -0
- package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/AGENTS.md +11 -10
- package/{.codex/ahe-shared/templates/PRODUCT.md → packages/ahe-codex/.codex/ahe-shared/templates/product.md} +1 -1
- package/packages/ahe-codex/.codex/hooks/ahe-hook.js +296 -0
- package/packages/ahe-codex/.codex/skills/ahe/SKILL.md +34 -0
- package/packages/ahe-codex/.codex/skills/ahe-compress/SKILL.md +120 -0
- package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/agents/openai.yaml +1 -1
- package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/scripts/check-harness-size.sh +18 -6
- package/packages/ahe-codex/.codex/skills/ahe-compress/scripts/detect_stale_tests.py +30 -0
- package/packages/ahe-codex/.codex/skills/ahe-converse/SKILL.md +44 -0
- package/packages/ahe-codex/.codex/skills/ahe-feature/SKILL.md +25 -0
- package/packages/ahe-codex/.codex/skills/ahe-fix/SKILL.md +59 -0
- package/packages/ahe-codex/.codex/skills/ahe-fix/scripts/write_fix_plan.py +108 -0
- package/packages/ahe-codex/.codex/skills/ahe-git/SKILL.md +34 -0
- package/packages/ahe-codex/.codex/skills/ahe-harness/SKILL.md +128 -0
- package/packages/ahe-codex/.codex/skills/ahe-harness-checker/SKILL.md +46 -0
- package/{.codex/skills/ahe-init → packages/ahe-codex/.codex/skills/ahe-new}/SKILL.md +41 -37
- package/packages/ahe-codex/.codex/skills/ahe-overview/SKILL.md +119 -0
- package/packages/ahe-codex/.codex/skills/ahe-review/SKILL.md +43 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/SKILL.md +58 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/agents/openai.yaml +4 -0
- package/packages/ahe-codex/.codex/skills/ahe-ship/scripts/write_plan.py +107 -0
- package/packages/ahe-codex/.codex/skills/ahe-solve/SKILL.md +30 -0
- package/packages/ahe-codex/.codex/skills/ahe-think/SKILL.md +114 -0
- package/packages/ahe-codex/bin/ahe-codex +398 -0
- package/packages/ahe-codex/package.json +7 -0
- package/.codex/hooks/ahe-hook.js +0 -236
- package/.codex/skills/ahe-compression/SKILL.md +0 -97
- package/.codex/skills/ahe-conversation/SKILL.md +0 -73
- package/.codex/skills/ahe-spec/SKILL.md +0 -63
- package/.codex/skills/ahe-thinking/SKILL.md +0 -104
- package/.codex/skills/ahe-update/SKILL.md +0 -66
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/config.yaml +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/feature-list-schema.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/process_status.schema.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/INSTRUCTIONS.md +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/feature-list.json +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/init.sh +0 -0
- /package/{.codex/ahe-shared/templates/PROGRESS.md → packages/ahe-codex/.codex/ahe-shared/templates/progress.md} +0 -0
- /package/{.codex/ahe-shared/templates/SESSION-HANDOFF.md → packages/ahe-codex/.codex/ahe-shared/templates/session-handoff.md} +0 -0
- /package/{.codex → packages/ahe-codex/.codex}/hooks/hooks.json +0 -0
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
readonly VERSION="0.1.0"
|
|
5
|
+
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
|
6
|
+
|
|
7
|
+
while [ -L "${SCRIPT_PATH}" ]; do
|
|
8
|
+
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${SCRIPT_PATH}")" && pwd)"
|
|
9
|
+
SCRIPT_PATH="$(readlink "${SCRIPT_PATH}")"
|
|
10
|
+
|
|
11
|
+
case "${SCRIPT_PATH}" in
|
|
12
|
+
/*) ;;
|
|
13
|
+
*) SCRIPT_PATH="${SCRIPT_DIR}/${SCRIPT_PATH}" ;;
|
|
14
|
+
esac
|
|
15
|
+
done
|
|
16
|
+
|
|
17
|
+
readonly SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${SCRIPT_PATH}")" && pwd)"
|
|
18
|
+
readonly PACKAGE_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
|
|
19
|
+
readonly SOURCE_SKILLS_DIR="${PACKAGE_ROOT}/.codex/skills"
|
|
20
|
+
readonly SOURCE_SHARED_DIR="${PACKAGE_ROOT}/.codex/ahe-shared"
|
|
21
|
+
readonly SOURCE_HOOKS_DIR="${PACKAGE_ROOT}/.codex/hooks"
|
|
22
|
+
readonly SOURCE_AGENTS_DIR="${PACKAGE_ROOT}/.codex/agents"
|
|
23
|
+
readonly AHE_CONFIG_BLOCK_START="# BEGIN AHE MANAGED CONFIG"
|
|
24
|
+
readonly AHE_CONFIG_BLOCK_END="# END AHE MANAGED CONFIG"
|
|
25
|
+
readonly MANAGED_SKILLS=(
|
|
26
|
+
"ahe"
|
|
27
|
+
"ahe-compress"
|
|
28
|
+
"ahe-converse"
|
|
29
|
+
"ahe-feature"
|
|
30
|
+
"ahe-fix"
|
|
31
|
+
"ahe-git"
|
|
32
|
+
"ahe-harness"
|
|
33
|
+
"ahe-harness-checker"
|
|
34
|
+
"ahe-new"
|
|
35
|
+
"ahe-overview"
|
|
36
|
+
"ahe-review"
|
|
37
|
+
"ahe-ship"
|
|
38
|
+
"ahe-solve"
|
|
39
|
+
"ahe-think"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
codex_home() {
|
|
43
|
+
if [ -n "${CODEX_HOME:-}" ]; then
|
|
44
|
+
printf '%s\n' "${CODEX_HOME}"
|
|
45
|
+
return 0
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
printf '%s\n' "${HOME}/.codex"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
usage() {
|
|
52
|
+
cat <<'EOF'
|
|
53
|
+
Usage:
|
|
54
|
+
ahe install [--force] [--backup]
|
|
55
|
+
ahe uninstall
|
|
56
|
+
ahe doctor
|
|
57
|
+
ahe version
|
|
58
|
+
EOF
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
backup_existing_installation() {
|
|
62
|
+
local target_dir="$1"
|
|
63
|
+
local backup_root="$2"
|
|
64
|
+
local backup_name="$3"
|
|
65
|
+
local timestamp
|
|
66
|
+
|
|
67
|
+
timestamp="$(date '+%Y%m%d-%H%M%S')"
|
|
68
|
+
mkdir -p "${backup_root}"
|
|
69
|
+
mv "${target_dir}" "${backup_root}/${backup_name}-${timestamp}"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
cleanup_ahe_config_entries() {
|
|
73
|
+
local config_path="$1"
|
|
74
|
+
local temp_path=""
|
|
75
|
+
|
|
76
|
+
if [ ! -f "${config_path}" ]; then
|
|
77
|
+
return 0
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
temp_path="${config_path}.ahe-cleanup"
|
|
81
|
+
awk -v block_start="${AHE_CONFIG_BLOCK_START}" -v block_end="${AHE_CONFIG_BLOCK_END}" '
|
|
82
|
+
function is_ahe_header(line) {
|
|
83
|
+
return line ~ /^\[agents\."?ahe[-_][^]]*"?\]$/ ||
|
|
84
|
+
line ~ /^\[hooks\.state\."ahe[^"]*"\]$/ ||
|
|
85
|
+
line ~ /^\[plugins\."?ahe[^]]*"?\]$/ ||
|
|
86
|
+
line ~ /^\[plugins\."@ksuchoi216\/ahe[^"]*"\]$/
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
$0 == block_start {
|
|
90
|
+
skip = 1
|
|
91
|
+
next
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
$0 == block_end {
|
|
95
|
+
skip = 0
|
|
96
|
+
next
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/^\[/ {
|
|
100
|
+
if (is_ahe_header($0)) {
|
|
101
|
+
skip = 1
|
|
102
|
+
next
|
|
103
|
+
}
|
|
104
|
+
skip = 0
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
skip != 1 {
|
|
108
|
+
print
|
|
109
|
+
}
|
|
110
|
+
' "${config_path}" > "${temp_path}"
|
|
111
|
+
mv "${temp_path}" "${config_path}"
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
install_skill() {
|
|
115
|
+
local force="false"
|
|
116
|
+
local backup="false"
|
|
117
|
+
|
|
118
|
+
while [ "$#" -gt 0 ]; do
|
|
119
|
+
case "$1" in
|
|
120
|
+
--force)
|
|
121
|
+
force="true"
|
|
122
|
+
;;
|
|
123
|
+
--backup)
|
|
124
|
+
backup="true"
|
|
125
|
+
;;
|
|
126
|
+
*)
|
|
127
|
+
printf 'Unknown install option: %s\n' "$1" >&2
|
|
128
|
+
usage >&2
|
|
129
|
+
exit 1
|
|
130
|
+
;;
|
|
131
|
+
esac
|
|
132
|
+
shift
|
|
133
|
+
done
|
|
134
|
+
|
|
135
|
+
if [ ! -d "${SOURCE_SKILLS_DIR}" ]; then
|
|
136
|
+
printf 'Packaged skill files are missing: %s\n' "${SOURCE_SKILLS_DIR}" >&2
|
|
137
|
+
exit 1
|
|
138
|
+
fi
|
|
139
|
+
|
|
140
|
+
if [ ! -d "${SOURCE_SHARED_DIR}" ]; then
|
|
141
|
+
printf 'Packaged shared files are missing: %s\n' "${SOURCE_SHARED_DIR}" >&2
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
local target_codex_home
|
|
146
|
+
target_codex_home="$(codex_home)"
|
|
147
|
+
|
|
148
|
+
local target_skills_dir="${target_codex_home}/skills"
|
|
149
|
+
local target_shared_dir="${target_codex_home}/ahe-shared"
|
|
150
|
+
local target_hooks_dir="${target_codex_home}/hooks"
|
|
151
|
+
local target_agents_dir="${target_codex_home}/agents"
|
|
152
|
+
local target_config_path="${target_codex_home}/config.toml"
|
|
153
|
+
local backup_dir="${target_codex_home}/_backups"
|
|
154
|
+
local skill_name=""
|
|
155
|
+
local skill_target=""
|
|
156
|
+
|
|
157
|
+
cleanup_ahe_config_entries "${target_config_path}"
|
|
158
|
+
|
|
159
|
+
for skill_name in "${MANAGED_SKILLS[@]}"; do
|
|
160
|
+
skill_target="${target_skills_dir}/${skill_name}"
|
|
161
|
+
|
|
162
|
+
if [ -e "${skill_target}" ]; then
|
|
163
|
+
if [ "${backup}" = "true" ]; then
|
|
164
|
+
backup_existing_installation "${skill_target}" "${backup_dir}" "${skill_name}"
|
|
165
|
+
elif [ "${force}" != "true" ]; then
|
|
166
|
+
cat <<EOF >&2
|
|
167
|
+
AHE skill is already installed at:
|
|
168
|
+
${skill_target}
|
|
169
|
+
|
|
170
|
+
Re-run with --force to overwrite or --backup to move the existing install aside first.
|
|
171
|
+
EOF
|
|
172
|
+
exit 1
|
|
173
|
+
else
|
|
174
|
+
rm -rf "${skill_target}"
|
|
175
|
+
fi
|
|
176
|
+
fi
|
|
177
|
+
done
|
|
178
|
+
|
|
179
|
+
if [ -e "${target_shared_dir}" ]; then
|
|
180
|
+
if [ "${backup}" = "true" ]; then
|
|
181
|
+
backup_existing_installation "${target_shared_dir}" "${backup_dir}" "ahe-shared"
|
|
182
|
+
elif [ "${force}" = "true" ]; then
|
|
183
|
+
rm -rf "${target_shared_dir}"
|
|
184
|
+
else
|
|
185
|
+
cat <<EOF >&2
|
|
186
|
+
AHE shared assets are already installed at:
|
|
187
|
+
${target_shared_dir}
|
|
188
|
+
|
|
189
|
+
Re-run with --force to overwrite or --backup to move the existing install aside first.
|
|
190
|
+
EOF
|
|
191
|
+
exit 1
|
|
192
|
+
fi
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
if [ -e "${target_hooks_dir}" ]; then
|
|
196
|
+
if [ "${backup}" = "true" ]; then
|
|
197
|
+
backup_existing_installation "${target_hooks_dir}" "${backup_dir}" "hooks"
|
|
198
|
+
elif [ "${force}" = "true" ]; then
|
|
199
|
+
rm -rf "${target_hooks_dir}"
|
|
200
|
+
else
|
|
201
|
+
cat <<EOF >&2
|
|
202
|
+
AHE hooks are already installed at:
|
|
203
|
+
${target_hooks_dir}
|
|
204
|
+
|
|
205
|
+
Re-run with --force to overwrite or --backup to move the existing install aside first.
|
|
206
|
+
EOF
|
|
207
|
+
exit 1
|
|
208
|
+
fi
|
|
209
|
+
fi
|
|
210
|
+
|
|
211
|
+
mkdir -p "${target_skills_dir}"
|
|
212
|
+
for skill_name in "${MANAGED_SKILLS[@]}"; do
|
|
213
|
+
cp -R "${SOURCE_SKILLS_DIR}/${skill_name}" "${target_skills_dir}/${skill_name}"
|
|
214
|
+
done
|
|
215
|
+
cp -R "${SOURCE_SHARED_DIR}" "${target_shared_dir}"
|
|
216
|
+
cp -R "${SOURCE_HOOKS_DIR}" "${target_hooks_dir}"
|
|
217
|
+
mkdir -p "${target_agents_dir}"
|
|
218
|
+
cp -R "${SOURCE_AGENTS_DIR}"/* "${target_agents_dir}/"
|
|
219
|
+
|
|
220
|
+
cat <<EOF >> "${target_config_path}"
|
|
221
|
+
${AHE_CONFIG_BLOCK_START}
|
|
222
|
+
[agents.ahe-harness-manager]
|
|
223
|
+
config_file = "${target_agents_dir}/ahe-harness-manager.toml"
|
|
224
|
+
${AHE_CONFIG_BLOCK_END}
|
|
225
|
+
EOF
|
|
226
|
+
cat > "${target_hooks_dir}/hooks.json" <<EOF
|
|
227
|
+
{
|
|
228
|
+
"hooks": {
|
|
229
|
+
"UserPromptSubmit": [
|
|
230
|
+
{
|
|
231
|
+
"hooks": [
|
|
232
|
+
{
|
|
233
|
+
"type": "command",
|
|
234
|
+
"command": "node \"${target_hooks_dir}/ahe-hook.js\"",
|
|
235
|
+
"timeout": 5,
|
|
236
|
+
"statusMessage": "AHE: Checking Keyword Trigger"
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
EOF
|
|
244
|
+
|
|
245
|
+
cat <<EOF
|
|
246
|
+
AHE Codex skill installed.
|
|
247
|
+
Global Codex home:
|
|
248
|
+
${target_codex_home}
|
|
249
|
+
|
|
250
|
+
Next:
|
|
251
|
+
1. Open Codex chat in any workspace.
|
|
252
|
+
2. Use \`ahe new\` for a new start.
|
|
253
|
+
3. Use exact \`ahe\` to continue existing harness work.
|
|
254
|
+
4. Use \`ahe ship\` after Plan Mode to write the latest plan to .plans.
|
|
255
|
+
5. Use \`ahe fix\` to create a .plans fix plan for errors or changed intent.
|
|
256
|
+
6. Use \`ahe <query>\` for explicit AHE requests such as \`ahe compress\`.
|
|
257
|
+
EOF
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
doctor() {
|
|
261
|
+
printf '=== codex ===\n'
|
|
262
|
+
|
|
263
|
+
local target_codex_home
|
|
264
|
+
target_codex_home="$(codex_home)"
|
|
265
|
+
|
|
266
|
+
local target_skills_dir="${target_codex_home}/skills"
|
|
267
|
+
local target_shared_dir="${target_codex_home}/ahe-shared"
|
|
268
|
+
local target_hooks_dir="${target_codex_home}/hooks"
|
|
269
|
+
local target_agents_dir="${target_codex_home}/agents"
|
|
270
|
+
local target_config_path="${target_codex_home}/config.toml"
|
|
271
|
+
local skill_name=""
|
|
272
|
+
local errors=0
|
|
273
|
+
|
|
274
|
+
for skill_name in "${MANAGED_SKILLS[@]}"; do
|
|
275
|
+
if [ ! -f "${target_skills_dir}/${skill_name}/SKILL.md" ]; then
|
|
276
|
+
printf 'Missing: %s/%s/SKILL.md\n' "${target_skills_dir}" "${skill_name}" >&2
|
|
277
|
+
errors=$((errors + 1))
|
|
278
|
+
fi
|
|
279
|
+
done
|
|
280
|
+
|
|
281
|
+
if [ ! -f "${target_shared_dir}/config.yaml" ]; then
|
|
282
|
+
printf 'Missing: %s/config.yaml\n' "${target_shared_dir}" >&2
|
|
283
|
+
errors=$((errors + 1))
|
|
284
|
+
fi
|
|
285
|
+
|
|
286
|
+
if [ ! -d "${target_shared_dir}/templates" ]; then
|
|
287
|
+
printf 'Missing: %s/templates\n' "${target_shared_dir}" >&2
|
|
288
|
+
errors=$((errors + 1))
|
|
289
|
+
fi
|
|
290
|
+
|
|
291
|
+
if [ ! -d "${target_shared_dir}/schemas" ]; then
|
|
292
|
+
printf 'Missing: %s/schemas\n' "${target_shared_dir}" >&2
|
|
293
|
+
errors=$((errors + 1))
|
|
294
|
+
fi
|
|
295
|
+
|
|
296
|
+
if [ ! -f "${target_hooks_dir}/hooks.json" ]; then
|
|
297
|
+
printf 'Missing: %s/hooks.json\n' "${target_hooks_dir}" >&2
|
|
298
|
+
errors=$((errors + 1))
|
|
299
|
+
else
|
|
300
|
+
if ! TARGET_HOOKS_DIR="${target_hooks_dir}" node -e "
|
|
301
|
+
try {
|
|
302
|
+
const h = require(process.env.TARGET_HOOKS_DIR + '/hooks.json');
|
|
303
|
+
const cmd = h.hooks.UserPromptSubmit[0].hooks[0].command;
|
|
304
|
+
if (!cmd.includes(process.env.TARGET_HOOKS_DIR + '/ahe-hook.js')) {
|
|
305
|
+
process.exit(1);
|
|
306
|
+
}
|
|
307
|
+
} catch (e) {
|
|
308
|
+
process.exit(1);
|
|
309
|
+
}
|
|
310
|
+
" 2>/dev/null; then
|
|
311
|
+
printf 'Invalid hook command: %s/hooks.json does not point to %s/ahe-hook.js\n' "${target_hooks_dir}" "${target_hooks_dir}" >&2
|
|
312
|
+
errors=$((errors + 1))
|
|
313
|
+
fi
|
|
314
|
+
fi
|
|
315
|
+
|
|
316
|
+
if [ ! -f "${target_hooks_dir}/ahe-hook.js" ]; then
|
|
317
|
+
printf 'Missing: %s/ahe-hook.js\n' "${target_hooks_dir}" >&2
|
|
318
|
+
errors=$((errors + 1))
|
|
319
|
+
fi
|
|
320
|
+
|
|
321
|
+
if [ ! -f "${target_agents_dir}/ahe-harness-manager.toml" ]; then
|
|
322
|
+
printf 'Missing: %s/ahe-harness-manager.toml\n' "${target_agents_dir}" >&2
|
|
323
|
+
errors=$((errors + 1))
|
|
324
|
+
fi
|
|
325
|
+
|
|
326
|
+
if ! grep -q '\[agents\.ahe-harness-manager\]' "${target_config_path}" 2>/dev/null; then
|
|
327
|
+
printf 'Missing: [agents.ahe-harness-manager] in %s\n' "${target_config_path}" >&2
|
|
328
|
+
errors=$((errors + 1))
|
|
329
|
+
fi
|
|
330
|
+
|
|
331
|
+
if [ "${errors}" -gt 0 ]; then
|
|
332
|
+
printf 'AHE Codex skill installation is unhealthy (%d errors).\n' "${errors}" >&2
|
|
333
|
+
exit 1
|
|
334
|
+
fi
|
|
335
|
+
|
|
336
|
+
printf 'AHE Codex skill installation looks healthy.\n'
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
uninstall_skill() {
|
|
340
|
+
local target_codex_home
|
|
341
|
+
target_codex_home="$(codex_home)"
|
|
342
|
+
|
|
343
|
+
local target_skills_dir="${target_codex_home}/skills"
|
|
344
|
+
local target_shared_dir="${target_codex_home}/ahe-shared"
|
|
345
|
+
local target_hooks_dir="${target_codex_home}/hooks"
|
|
346
|
+
local target_agents_dir="${target_codex_home}/agents"
|
|
347
|
+
local target_config_path="${target_codex_home}/config.toml"
|
|
348
|
+
local skill_name=""
|
|
349
|
+
|
|
350
|
+
echo "Uninstalling AHE skills from ${target_codex_home}..."
|
|
351
|
+
|
|
352
|
+
for skill_name in "${MANAGED_SKILLS[@]}"; do
|
|
353
|
+
rm -rf "${target_skills_dir}/${skill_name}"
|
|
354
|
+
done
|
|
355
|
+
|
|
356
|
+
rm -rf "${target_shared_dir}"
|
|
357
|
+
rm -rf "${target_hooks_dir}"
|
|
358
|
+
rm -f "${target_agents_dir}/ahe-harness-manager.toml"
|
|
359
|
+
cleanup_ahe_config_entries "${target_config_path}"
|
|
360
|
+
|
|
361
|
+
echo "AHE skills uninstalled successfully."
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
main() {
|
|
365
|
+
if [ "$#" -eq 0 ]; then
|
|
366
|
+
usage
|
|
367
|
+
exit 1
|
|
368
|
+
fi
|
|
369
|
+
|
|
370
|
+
local command="$1"
|
|
371
|
+
shift
|
|
372
|
+
|
|
373
|
+
case "${command}" in
|
|
374
|
+
install)
|
|
375
|
+
install_skill "$@"
|
|
376
|
+
;;
|
|
377
|
+
uninstall)
|
|
378
|
+
uninstall_skill
|
|
379
|
+
;;
|
|
380
|
+
doctor)
|
|
381
|
+
doctor
|
|
382
|
+
;;
|
|
383
|
+
version)
|
|
384
|
+
printf '%s\n' "${VERSION}"
|
|
385
|
+
;;
|
|
386
|
+
-h|--help|help)
|
|
387
|
+
usage
|
|
388
|
+
exit 0
|
|
389
|
+
;;
|
|
390
|
+
*)
|
|
391
|
+
printf 'Unknown command: %s\n' "${command}" >&2
|
|
392
|
+
usage >&2
|
|
393
|
+
exit 1
|
|
394
|
+
;;
|
|
395
|
+
esac
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
main "$@"
|
package/.codex/hooks/ahe-hook.js
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const AHE_DIRECTIVE_MARKER = "<ahe-mode>";
|
|
3
|
-
const AHE_PROGRESS_DIRECTIVE = [
|
|
4
|
-
AHE_DIRECTIVE_MARKER,
|
|
5
|
-
"AHE automatic operation activated.",
|
|
6
|
-
"",
|
|
7
|
-
"The user sent the exact AHE command. Operate as the Awesome Harness Engineering router:",
|
|
8
|
-
"",
|
|
9
|
-
"1. Run CodeGraph preflight before inspecting harness status:",
|
|
10
|
-
" - Check whether the CodeGraph CLI is installed with `command -v codegraph`.",
|
|
11
|
-
" - If the `codegraph` command is not installed, report `NOT INSTALLATION of codegraph`, skip `codegraph init` and `codegraph sync`, and continue with normal repo inspection.",
|
|
12
|
-
" - If `.codegraph/` does not exist, run `codegraph init` before reviewing code.",
|
|
13
|
-
" - If `.codegraph/` exists, run `codegraph sync` before reviewing code.",
|
|
14
|
-
"",
|
|
15
|
-
"2. Inspect current harness state before choosing a workflow:",
|
|
16
|
-
" - Check `AGENTS.md`.",
|
|
17
|
-
" - Check `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` as the product/specification source of truth.",
|
|
18
|
-
" - Check `feature-list.json` as a derived tracker.",
|
|
19
|
-
" - Check `PROGRESS.md`.",
|
|
20
|
-
" - Use `ahe-thinking` as the internal decision layer before choosing the next action.",
|
|
21
|
-
" - Before reading large harness files wholesale, let `ahe-thinking` run the `ahe-compression` size detector and call `ahe-compression` if compression is required.",
|
|
22
|
-
"",
|
|
23
|
-
"3. Review code through CodeGraph when available:",
|
|
24
|
-
" - Prefer CodeGraph MCP or CodeGraph exploration for code review and impact context after the preflight command succeeds.",
|
|
25
|
-
" - If CodeGraph is not installed, skip CodeGraph review and rely on normal repo inspection.",
|
|
26
|
-
"",
|
|
27
|
-
"4. Make the first response a simple harness engineering status report table before proceeding:",
|
|
28
|
-
" - Start the response with a concise status report table.",
|
|
29
|
-
" - Use this consistent Markdown table format:",
|
|
30
|
-
" | Item | Content |",
|
|
31
|
-
" |---|---|",
|
|
32
|
-
" | AGENTS.md | Exists/missing, purpose status, and any obvious issue. |",
|
|
33
|
-
" | PRODUCT.md | Exists/missing, completion state, and whether product scope needs work. |",
|
|
34
|
-
" | INSTRUCTIONS.md | Exists/missing, and whether instruction boundaries need work. |",
|
|
35
|
-
" | feature-list.json | Valid/missing/invalid, unfinished feature summary, and all-done status. |",
|
|
36
|
-
" | PROGRESS.md | Exists/missing and current session state. |",
|
|
37
|
-
" - Keep the table short and readable.",
|
|
38
|
-
" - Do not include the next step inside the table.",
|
|
39
|
-
"",
|
|
40
|
-
"5. Decide the next AHE workflow with `ahe-thinking`:",
|
|
41
|
-
" - If no harness files exist, route to `$ahe-init`.",
|
|
42
|
-
" - If `docs/PRODUCT.md` or `docs/INSTRUCTIONS.md` is missing or empty, classify the state as `harness engineering not enough` and prioritize product/instructions specification.",
|
|
43
|
-
" - If `feature-list.json` is missing or invalid, generating an empty one from template is allowed, but do not write specific features until `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` are created and organized.",
|
|
44
|
-
" - If any feature in `feature-list.json` has a status other than `done`, classify the state as `in the middle of building features` and continue the first unfinished feature whose dependencies are satisfied.",
|
|
45
|
-
" - Respect dependencies listed in `feature-list.json`; do not start a dependent feature before prerequisites are done.",
|
|
46
|
-
" - If all features are `done` and no obvious harness gap remains, classify the state as `completed all` and ask the user for the next task.",
|
|
47
|
-
" - Judge the active `project`, `feature`, or `sub-feature` before moving forward.",
|
|
48
|
-
" - For a `project`, require `Why`, `What`, and `How` by default.",
|
|
49
|
-
" - For a `feature` or `sub-feature`, require only the minimum of `Why`, `What`, and `How` needed to proceed safely.",
|
|
50
|
-
"",
|
|
51
|
-
"6. Ask for clarification instead of guessing:",
|
|
52
|
-
" - If multiple plausible next steps exist, feature data conflicts, dependencies are unclear, or CodeGraph review points to several valid directions, use `ahe-thinking` to judge the missing detail.",
|
|
53
|
-
" - If clarity is missing, call `ahe-conversation` for the exact missing `Why`, `What`, or `How`.",
|
|
54
|
-
" - Continue only after one safe next step is clear.",
|
|
55
|
-
"",
|
|
56
|
-
"7. After the table, classify the harness into exactly one state.",
|
|
57
|
-
" - Use exactly one state: `harness engineering not enough`, `in the middle of building features`, or `completed all`.",
|
|
58
|
-
" - Do not include the next step inside the table.",
|
|
59
|
-
" - Continue automatically after classification.",
|
|
60
|
-
" - Follow this loop: `thinking -> conversation if needed -> execution -> thinking`.",
|
|
61
|
-
].join("\\n");
|
|
62
|
-
|
|
63
|
-
const AHE_INIT_DIRECTIVE = [
|
|
64
|
-
AHE_DIRECTIVE_MARKER,
|
|
65
|
-
"AHE automatic operation activated.",
|
|
66
|
-
"",
|
|
67
|
-
"The user sent the exact AHE init command. Treat this as a possible new start request:",
|
|
68
|
-
"",
|
|
69
|
-
"1. Route to `$ahe-init` first.",
|
|
70
|
-
"2. If no AHE-managed harness files exist, start initialization normally.",
|
|
71
|
-
"3. If any AHE-managed harness file exists, read the existing files, summarize the current project purpose and product specification state, and ask what restart scope the user wants.",
|
|
72
|
-
"4. Do not back up, remove, overwrite, or refresh existing harness files before the user answers the restart-scope question.",
|
|
73
|
-
"5. Interpret the restart scope from the user's free-form answer; examples like `purpose` and `product` are not a closed list.",
|
|
74
|
-
"6. Product/instructions specification details belong in `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md`, not `AGENTS.md`.",
|
|
75
|
-
"7. Use `ahe-thinking` before clarification when the next setup step is uncertain.",
|
|
76
|
-
"8. If clarification is needed, call `ahe-conversation` for the exact missing detail.",
|
|
77
|
-
"9. Continue through initialization work until the new start path is clear.",
|
|
78
|
-
].join("\\n");
|
|
79
|
-
|
|
80
|
-
function isExactAheCommand(prompt) {
|
|
81
|
-
return normalizePrompt(prompt) === "ahe";
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function isExactAheInitCommand(prompt) {
|
|
85
|
-
const normalizedPrompt = normalizePrompt(prompt);
|
|
86
|
-
return (
|
|
87
|
-
normalizedPrompt === "ahe init" ||
|
|
88
|
-
normalizedPrompt === "ahe-init" ||
|
|
89
|
-
normalizedPrompt === "$ahe-init"
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function isBroadAheIntent(prompt) {
|
|
94
|
-
if (isExactAheCommand(prompt) || isExactAheInitCommand(prompt)) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const p = normalizePrompt(prompt);
|
|
99
|
-
|
|
100
|
-
const hasAction = /(add|new|update|change|track|manage)/.test(p);
|
|
101
|
-
const hasTarget = /(product|feature|instruction|requirement|spec|work|todo)/.test(p);
|
|
102
|
-
|
|
103
|
-
if (!(hasAction && hasTarget)) {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const falsePositives = [
|
|
108
|
-
/what is/,
|
|
109
|
-
/explain/,
|
|
110
|
-
/how to/,
|
|
111
|
-
/how do/,
|
|
112
|
-
/file/,
|
|
113
|
-
/error/,
|
|
114
|
-
/issue/
|
|
115
|
-
];
|
|
116
|
-
|
|
117
|
-
for (const fp of falsePositives) {
|
|
118
|
-
if (fp.test(p)) return false;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function getAdaptiveDirective(prompt) {
|
|
125
|
-
return [
|
|
126
|
-
AHE_DIRECTIVE_MARKER,
|
|
127
|
-
"AHE automatic operation activated.",
|
|
128
|
-
"",
|
|
129
|
-
`Original prompt: "${prompt}"`,
|
|
130
|
-
"",
|
|
131
|
-
"The user provided a broad natural-language AHE work intent.",
|
|
132
|
-
"Operate as the Awesome Harness Engineering router with an adaptive workflow:",
|
|
133
|
-
"",
|
|
134
|
-
"1. Run CodeGraph preflight before inspecting harness status:",
|
|
135
|
-
" - Check whether the CodeGraph CLI is installed with `command -v codegraph`.",
|
|
136
|
-
" - If the `codegraph` command is not installed, report `NOT INSTALLATION of codegraph`, skip `codegraph init` and `codegraph sync`, and continue with normal repo inspection.",
|
|
137
|
-
" - If `.codegraph/` does not exist, run `codegraph init` before reviewing code.",
|
|
138
|
-
" - If `.codegraph/` exists, run `codegraph sync` before reviewing code.",
|
|
139
|
-
"",
|
|
140
|
-
"2. Inspect current harness state before choosing a workflow:",
|
|
141
|
-
" - Check `AGENTS.md`.",
|
|
142
|
-
" - Check `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md` as the product/specification source of truth.",
|
|
143
|
-
" - Check `feature-list.json` as a derived tracker.",
|
|
144
|
-
" - Check `PROGRESS.md`.",
|
|
145
|
-
" - Use `ahe-thinking` as the internal decision layer before choosing the next action.",
|
|
146
|
-
" - Before reading large harness files wholesale, let `ahe-thinking` run the `ahe-compression` size detector and call `ahe-compression` if compression is required.",
|
|
147
|
-
"",
|
|
148
|
-
"3. Review code through CodeGraph when available.",
|
|
149
|
-
"",
|
|
150
|
-
"4. Make the first response a simple harness engineering status report table before proceeding:",
|
|
151
|
-
" - Start the response with a concise status report table.",
|
|
152
|
-
" - Use this consistent Markdown table format:",
|
|
153
|
-
" | Item | Content |",
|
|
154
|
-
" |---|---|",
|
|
155
|
-
" | AGENTS.md | Exists/missing, purpose status, and any obvious issue. |",
|
|
156
|
-
" | PRODUCT.md | Exists/missing, completion state, and whether product scope needs work. |",
|
|
157
|
-
" | INSTRUCTIONS.md | Exists/missing, and whether instruction boundaries need work. |",
|
|
158
|
-
" | feature-list.json | Valid/missing/invalid, unfinished feature summary, and all-done status. |",
|
|
159
|
-
" | PROGRESS.md | Exists/missing and current session state. |",
|
|
160
|
-
" - Keep the table short and readable.",
|
|
161
|
-
" - Do not include the next step inside the table.",
|
|
162
|
-
"",
|
|
163
|
-
"5. Decide the next AHE workflow with `ahe-thinking` based on the original prompt:",
|
|
164
|
-
" - Classify the user intent from the original prompt as: `product/spec changes`, `instruction changes`, `feature/todo tracking`, or `unclear AHE work`.",
|
|
165
|
-
" - Route product/spec changes to `ahe-spec`.",
|
|
166
|
-
" - Route instruction changes to `ahe-spec`, and create `docs/INSTRUCTIONS.md` from the template when needed.",
|
|
167
|
-
" - Route feature/todo tracking to `ahe-update`.",
|
|
168
|
-
" - Route unclear AHE work to `ahe-conversation`.",
|
|
169
|
-
"",
|
|
170
|
-
"6. Ask for clarification instead of guessing:",
|
|
171
|
-
" - If the request is vague, ask exactly one detail question before editing.",
|
|
172
|
-
" - Call `ahe-conversation` for missing `Why`, `What`, or `How`.",
|
|
173
|
-
" - Continue only after one safe next step is clear.",
|
|
174
|
-
"",
|
|
175
|
-
"7. After the table, classify the harness into exactly one state.",
|
|
176
|
-
" - Use exactly one state: `harness engineering not enough`, `in the middle of building features`, or `completed all`.",
|
|
177
|
-
" - Do not include the next step inside the table.",
|
|
178
|
-
" - Continue automatically after classification.",
|
|
179
|
-
" - Follow this loop: `thinking -> conversation if needed -> execution -> thinking`.",
|
|
180
|
-
].join("\\n");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function normalizePrompt(prompt) {
|
|
184
|
-
return prompt.trim().toLowerCase();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async function main() {
|
|
188
|
-
let raw = "";
|
|
189
|
-
process.stdin.setEncoding("utf8");
|
|
190
|
-
for await (const chunk of process.stdin) {
|
|
191
|
-
raw += chunk;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (!raw.trim()) return;
|
|
195
|
-
|
|
196
|
-
let parsed;
|
|
197
|
-
try {
|
|
198
|
-
parsed = JSON.parse(raw);
|
|
199
|
-
} catch (e) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
parsed &&
|
|
205
|
-
parsed.hook_event_name === "UserPromptSubmit" &&
|
|
206
|
-
typeof parsed.prompt === "string"
|
|
207
|
-
) {
|
|
208
|
-
if (isExactAheCommand(parsed.prompt)) {
|
|
209
|
-
const output = {
|
|
210
|
-
hookSpecificOutput: {
|
|
211
|
-
hookEventName: "UserPromptSubmit",
|
|
212
|
-
additionalContext: AHE_PROGRESS_DIRECTIVE
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
process.stdout.write(JSON.stringify(output) + "\n");
|
|
216
|
-
} else if (isExactAheInitCommand(parsed.prompt)) {
|
|
217
|
-
const output = {
|
|
218
|
-
hookSpecificOutput: {
|
|
219
|
-
hookEventName: "UserPromptSubmit",
|
|
220
|
-
additionalContext: AHE_INIT_DIRECTIVE
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
process.stdout.write(JSON.stringify(output) + "\n");
|
|
224
|
-
} else if (isBroadAheIntent(parsed.prompt)) {
|
|
225
|
-
const output = {
|
|
226
|
-
hookSpecificOutput: {
|
|
227
|
-
hookEventName: "UserPromptSubmit",
|
|
228
|
-
additionalContext: getAdaptiveDirective(parsed.prompt)
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
process.stdout.write(JSON.stringify(output) + "\n");
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
main().catch(() => {});
|