@event4u/agent-config 2.0.0 → 2.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/.agent-src/commands/fix/{pr-bots.md → pr-bot-comments.md} +3 -3
- package/.agent-src/commands/fix/{pr.md → pr-comments.md} +6 -6
- package/.agent-src/commands/fix/{pr-developers.md → pr-developer-comments.md} +3 -3
- package/.agent-src/commands/fix.md +6 -6
- package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -2
- package/.claude-plugin/marketplace.json +4 -4
- package/CHANGELOG.md +31 -0
- package/README.md +5 -6
- package/docs/architecture.md +1 -1
- package/docs/catalog.md +3 -3
- package/docs/contracts/command-clusters.md +3 -3
- package/docs/contracts/file-ownership-matrix.json +9 -9
- package/docs/getting-started.md +16 -25
- package/docs/installation.md +57 -46
- package/docs/migrations/commands-1.15.0.md +3 -3
- package/docs/skills-catalog.md +23 -2
- package/docs/troubleshooting.md +20 -32
- package/llms.txt +22 -1
- package/package.json +1 -1
- package/scripts/install +25 -3
- package/scripts/install.py +11 -21
- package/scripts/install.sh +6 -11
- package/templates/agent-config-wrapper.sh +40 -25
- package/templates/consumer-settings/README.md +2 -2
- package/scripts/setup.sh +0 -230
|
@@ -2,8 +2,13 @@
|
|
|
2
2
|
# agent-config — thin wrapper for the event4u/agent-config CLI.
|
|
3
3
|
#
|
|
4
4
|
# Auto-generated by the package installer. Delegates to the master CLI
|
|
5
|
-
#
|
|
6
|
-
#
|
|
5
|
+
# in this priority:
|
|
6
|
+
# 1. $AGENT_CONFIG_MASTER (escape hatch for tests / custom checkouts)
|
|
7
|
+
# 2. ./node_modules/@event4u/agent-config/scripts/agent-config (npm install)
|
|
8
|
+
# 3. globally-installed `agent-config` on $PATH (npm i -g)
|
|
9
|
+
# 4. `npx --yes @event4u/agent-config@latest` (last-resort, network)
|
|
10
|
+
#
|
|
11
|
+
# Do NOT edit — this file is gitignored and regenerated on every install.
|
|
7
12
|
#
|
|
8
13
|
# Usage:
|
|
9
14
|
# ./agent-config help
|
|
@@ -17,31 +22,41 @@ set -euo pipefail
|
|
|
17
22
|
SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
23
|
|
|
19
24
|
locate_master() {
|
|
20
|
-
|
|
21
|
-
"$
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
local
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
if [[ -n "${AGENT_CONFIG_MASTER:-}" && -x "$AGENT_CONFIG_MASTER" ]]; then
|
|
26
|
+
printf '%s' "$AGENT_CONFIG_MASTER"
|
|
27
|
+
return 0
|
|
28
|
+
fi
|
|
29
|
+
local local_npm="$SELF_DIR/node_modules/@event4u/agent-config/scripts/agent-config"
|
|
30
|
+
if [[ -x "$local_npm" ]]; then
|
|
31
|
+
printf '%s' "$local_npm"
|
|
32
|
+
return 0
|
|
33
|
+
fi
|
|
34
|
+
local on_path
|
|
35
|
+
if on_path="$(command -v agent-config 2>/dev/null)" && [[ -n "$on_path" && "$on_path" != "$SELF_DIR/agent-config" ]]; then
|
|
36
|
+
printf '%s' "$on_path"
|
|
37
|
+
return 0
|
|
38
|
+
fi
|
|
31
39
|
return 1
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
if
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Reinstall the package, then retry:
|
|
41
|
-
npm install # for Node projects
|
|
42
|
-
composer install # for PHP projects
|
|
43
|
-
EOF
|
|
44
|
-
exit 127
|
|
42
|
+
if MASTER="$(locate_master)"; then
|
|
43
|
+
exec "$MASTER" "$@"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
if command -v npx >/dev/null 2>&1; then
|
|
47
|
+
exec npx --yes @event4u/agent-config@latest "$@"
|
|
45
48
|
fi
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
cat >&2 <<EOF
|
|
51
|
+
❌ agent-config: master CLI not found.
|
|
52
|
+
Tried, in order:
|
|
53
|
+
- \$AGENT_CONFIG_MASTER
|
|
54
|
+
- ./node_modules/@event4u/agent-config/scripts/agent-config
|
|
55
|
+
- agent-config on \$PATH (npm i -g @event4u/agent-config)
|
|
56
|
+
- npx @event4u/agent-config@latest (npx not installed)
|
|
57
|
+
|
|
58
|
+
Install via:
|
|
59
|
+
npx @event4u/create-agent-config init # one-shot setup
|
|
60
|
+
npm install -g @event4u/agent-config # global CLI
|
|
61
|
+
EOF
|
|
62
|
+
exit 127
|
|
@@ -25,10 +25,10 @@ instead of copying files via `install.sh`.
|
|
|
25
25
|
|
|
26
26
|
### Cursor / Cline / Windsurf / Augment VSCode
|
|
27
27
|
|
|
28
|
-
These tools do **not** support plugins yet. Use the classic
|
|
28
|
+
These tools do **not** support plugins yet. Use the classic installer:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
|
|
31
|
+
npx @event4u/create-agent-config init --tools=cursor,cline,windsurf,augment
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
## What the plugin provides
|
package/scripts/setup.sh
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# setup.sh — One-time setup for agent-config in a project
|
|
3
|
-
# Adds post-install/update hooks to the root composer.json so that
|
|
4
|
-
# install.sh runs automatically on every `composer install` / `composer update`.
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# bash vendor/event4u/agent-config/scripts/setup.sh
|
|
8
|
-
#
|
|
9
|
-
# Idempotent: safe to run multiple times. Skips if hooks already exist.
|
|
10
|
-
|
|
11
|
-
set -euo pipefail
|
|
12
|
-
|
|
13
|
-
# --- Configuration ---
|
|
14
|
-
HOOK_CMD="bash vendor/event4u/agent-config/scripts/install.sh --quiet"
|
|
15
|
-
COMPOSER_JSON="composer.json"
|
|
16
|
-
|
|
17
|
-
# --- Logging ---
|
|
18
|
-
log_info() { echo " ✅ $*"; }
|
|
19
|
-
log_warn() { echo " ⚠️ $*"; }
|
|
20
|
-
log_skip() { echo " ⏭️ $*"; }
|
|
21
|
-
log_error() { echo " ❌ $*" >&2; }
|
|
22
|
-
|
|
23
|
-
# --- Find project root ---
|
|
24
|
-
find_project_root() {
|
|
25
|
-
local dir
|
|
26
|
-
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../.." && pwd)"
|
|
27
|
-
|
|
28
|
-
# If called from vendor/event4u/agent-config/scripts/, go up 4 levels
|
|
29
|
-
if [[ -f "$dir/$COMPOSER_JSON" ]]; then
|
|
30
|
-
echo "$dir"
|
|
31
|
-
return
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
# Fallback: current working directory
|
|
35
|
-
if [[ -f "$PWD/$COMPOSER_JSON" ]]; then
|
|
36
|
-
echo "$PWD"
|
|
37
|
-
return
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
log_error "Cannot find project root (no composer.json found)"
|
|
41
|
-
exit 1
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
# --- Detect JSON tool ---
|
|
45
|
-
# Fallback chain: php → node → jq → python3
|
|
46
|
-
JSON_TOOL=""
|
|
47
|
-
detect_json_tool() {
|
|
48
|
-
if command -v php &>/dev/null; then
|
|
49
|
-
JSON_TOOL="php"
|
|
50
|
-
elif command -v node &>/dev/null; then
|
|
51
|
-
JSON_TOOL="node"
|
|
52
|
-
elif command -v jq &>/dev/null; then
|
|
53
|
-
JSON_TOOL="jq"
|
|
54
|
-
elif command -v python3 &>/dev/null; then
|
|
55
|
-
JSON_TOOL="python3"
|
|
56
|
-
else
|
|
57
|
-
log_error "No JSON tool found. Need one of: php, node, jq, python3"
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
# --- Unified JSON helper ---
|
|
63
|
-
# Dispatches to the detected tool. Actions: hook_exists, add_hook
|
|
64
|
-
composer_json_cmd() {
|
|
65
|
-
local file="$1" action="$2" event="${3:-}" cmd="${4:-}"
|
|
66
|
-
case "$JSON_TOOL" in
|
|
67
|
-
php) _cmd_php "$file" "$action" "$event" "$cmd" ;;
|
|
68
|
-
node) _cmd_node "$file" "$action" "$event" "$cmd" ;;
|
|
69
|
-
jq) _cmd_jq "$file" "$action" "$event" "$cmd" ;;
|
|
70
|
-
python3) _cmd_python "$file" "$action" "$event" "$cmd" ;;
|
|
71
|
-
esac
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
# --- PHP implementation ---
|
|
75
|
-
_cmd_php() {
|
|
76
|
-
local file="$1" action="$2" event="$3" cmd="$4"
|
|
77
|
-
php -r "
|
|
78
|
-
\$file = '$file';
|
|
79
|
-
\$json = json_decode(file_get_contents(\$file), true);
|
|
80
|
-
if (\$json === null) { exit(1); }
|
|
81
|
-
\$event = '$event'; \$cmd = '$cmd';
|
|
82
|
-
if ('$action' === 'hook_exists') {
|
|
83
|
-
if (!isset(\$json['scripts'][\$event])) { exit(1); }
|
|
84
|
-
\$val = \$json['scripts'][\$event];
|
|
85
|
-
if (is_string(\$val) && str_contains(\$val, 'agent-config/scripts/install.sh')) { exit(0); }
|
|
86
|
-
if (is_array(\$val)) {
|
|
87
|
-
foreach (\$val as \$v) {
|
|
88
|
-
if (is_string(\$v) && str_contains(\$v, 'agent-config/scripts/install.sh')) { exit(0); }
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exit(1);
|
|
92
|
-
}
|
|
93
|
-
if ('$action' === 'add_hook') {
|
|
94
|
-
if (!isset(\$json['scripts'])) { \$json['scripts'] = []; }
|
|
95
|
-
if (!isset(\$json['scripts'][\$event])) {
|
|
96
|
-
\$json['scripts'][\$event] = \$cmd;
|
|
97
|
-
} elseif (is_string(\$json['scripts'][\$event])) {
|
|
98
|
-
\$json['scripts'][\$event] = [\$json['scripts'][\$event], \$cmd];
|
|
99
|
-
} elseif (is_array(\$json['scripts'][\$event])) {
|
|
100
|
-
\$json['scripts'][\$event][] = \$cmd;
|
|
101
|
-
}
|
|
102
|
-
file_put_contents(\$file, json_encode(\$json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . \"\n\");
|
|
103
|
-
}
|
|
104
|
-
"
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# --- Node.js implementation ---
|
|
108
|
-
_cmd_node() {
|
|
109
|
-
local file="$1" action="$2" event="$3" cmd="$4"
|
|
110
|
-
node -e "
|
|
111
|
-
const fs = require('fs');
|
|
112
|
-
const file = '$file';
|
|
113
|
-
const json = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
114
|
-
const event = '$event', cmd = '$cmd';
|
|
115
|
-
if ('$action' === 'hook_exists') {
|
|
116
|
-
if (!json.scripts || !json.scripts[event]) process.exit(1);
|
|
117
|
-
const val = json.scripts[event];
|
|
118
|
-
if (typeof val === 'string' && val.includes('agent-config/scripts/install.sh')) process.exit(0);
|
|
119
|
-
if (Array.isArray(val) && val.some(v => v.includes('agent-config/scripts/install.sh'))) process.exit(0);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
if ('$action' === 'add_hook') {
|
|
123
|
-
if (!json.scripts) json.scripts = {};
|
|
124
|
-
if (!json.scripts[event]) {
|
|
125
|
-
json.scripts[event] = cmd;
|
|
126
|
-
} else if (typeof json.scripts[event] === 'string') {
|
|
127
|
-
json.scripts[event] = [json.scripts[event], cmd];
|
|
128
|
-
} else if (Array.isArray(json.scripts[event])) {
|
|
129
|
-
json.scripts[event].push(cmd);
|
|
130
|
-
}
|
|
131
|
-
fs.writeFileSync(file, JSON.stringify(json, null, 4) + '\n');
|
|
132
|
-
}
|
|
133
|
-
"
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
# --- jq implementation ---
|
|
137
|
-
_cmd_jq() {
|
|
138
|
-
local file="$1" action="$2" event="$3" cmd="$4"
|
|
139
|
-
if [[ "$action" == "hook_exists" ]]; then
|
|
140
|
-
local existing
|
|
141
|
-
existing=$(jq -r ".scripts[\"$event\"] // empty" "$file" 2>/dev/null)
|
|
142
|
-
[[ -z "$existing" ]] && return 1
|
|
143
|
-
[[ "$existing" == *"agent-config/scripts/install.sh"* ]] && return 0
|
|
144
|
-
jq -e ".scripts[\"$event\"][] | select(contains(\"agent-config/scripts/install.sh\"))" "$file" &>/dev/null && return 0
|
|
145
|
-
return 1
|
|
146
|
-
fi
|
|
147
|
-
if [[ "$action" == "add_hook" ]]; then
|
|
148
|
-
local existing
|
|
149
|
-
existing=$(jq -r ".scripts[\"$event\"] // empty" "$file" 2>/dev/null)
|
|
150
|
-
if [[ -z "$existing" ]]; then
|
|
151
|
-
jq --arg e "$event" --arg c "$cmd" '.scripts[$e] = $c' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
|
152
|
-
elif jq -e ".scripts[\"$event\"] | type == \"string\"" "$file" &>/dev/null; then
|
|
153
|
-
jq --arg e "$event" --arg c "$cmd" '.scripts[$e] = [.scripts[$e], $c]' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
|
154
|
-
elif jq -e ".scripts[\"$event\"] | type == \"array\"" "$file" &>/dev/null; then
|
|
155
|
-
jq --arg e "$event" --arg c "$cmd" '.scripts[$e] += [$c]' "$file" > "$file.tmp" && mv "$file.tmp" "$file"
|
|
156
|
-
fi
|
|
157
|
-
fi
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
# --- Python implementation ---
|
|
161
|
-
_cmd_python() {
|
|
162
|
-
local file="$1" action="$2" event="$3" cmd="$4"
|
|
163
|
-
python3 -c "
|
|
164
|
-
import json, sys
|
|
165
|
-
with open('$file') as f: data = json.load(f)
|
|
166
|
-
event, cmd = '$event', '$cmd'
|
|
167
|
-
if '$action' == 'hook_exists':
|
|
168
|
-
scripts = data.get('scripts', {})
|
|
169
|
-
val = scripts.get(event)
|
|
170
|
-
if val is None: sys.exit(1)
|
|
171
|
-
if isinstance(val, str) and 'agent-config/scripts/install.sh' in val: sys.exit(0)
|
|
172
|
-
if isinstance(val, list) and any('agent-config/scripts/install.sh' in v for v in val): sys.exit(0)
|
|
173
|
-
sys.exit(1)
|
|
174
|
-
if '$action' == 'add_hook':
|
|
175
|
-
if 'scripts' not in data: data['scripts'] = {}
|
|
176
|
-
if event not in data['scripts']:
|
|
177
|
-
data['scripts'][event] = cmd
|
|
178
|
-
elif isinstance(data['scripts'][event], str):
|
|
179
|
-
data['scripts'][event] = [data['scripts'][event], cmd]
|
|
180
|
-
elif isinstance(data['scripts'][event], list):
|
|
181
|
-
data['scripts'][event].append(cmd)
|
|
182
|
-
with open('$file', 'w') as f: json.dump(data, f, indent=4, ensure_ascii=False); f.write('\n')
|
|
183
|
-
"
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
# --- Main ---
|
|
187
|
-
main() {
|
|
188
|
-
detect_json_tool
|
|
189
|
-
|
|
190
|
-
local root
|
|
191
|
-
root=$(find_project_root)
|
|
192
|
-
local file="$root/$COMPOSER_JSON"
|
|
193
|
-
|
|
194
|
-
echo ""
|
|
195
|
-
echo " 🔧 agent-config setup"
|
|
196
|
-
echo " Project: $root"
|
|
197
|
-
echo " JSON tool: $JSON_TOOL"
|
|
198
|
-
echo ""
|
|
199
|
-
|
|
200
|
-
local changed=false
|
|
201
|
-
|
|
202
|
-
for event in "post-install-cmd" "post-update-cmd"; do
|
|
203
|
-
if composer_json_cmd "$file" "hook_exists" "$event"; then
|
|
204
|
-
log_skip "$event hook already configured"
|
|
205
|
-
else
|
|
206
|
-
composer_json_cmd "$file" "add_hook" "$event" "$HOOK_CMD"
|
|
207
|
-
log_info "Added $event hook"
|
|
208
|
-
changed=true
|
|
209
|
-
fi
|
|
210
|
-
done
|
|
211
|
-
|
|
212
|
-
echo ""
|
|
213
|
-
|
|
214
|
-
if [[ "$changed" == "true" ]]; then
|
|
215
|
-
local install_script="$root/vendor/event4u/agent-config/scripts/install.sh"
|
|
216
|
-
if [[ -f "$install_script" ]]; then
|
|
217
|
-
log_info "Running install.sh now..."
|
|
218
|
-
bash "$install_script"
|
|
219
|
-
else
|
|
220
|
-
log_warn "install.sh not found in vendor yet — will run on next composer install/update."
|
|
221
|
-
fi
|
|
222
|
-
echo ""
|
|
223
|
-
log_info "Setup complete! Hooks will run automatically on composer install/update."
|
|
224
|
-
log_warn "Commit the updated composer.json to your repository."
|
|
225
|
-
else
|
|
226
|
-
log_skip "Nothing to do — already configured."
|
|
227
|
-
fi
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
main "$@"
|