@event4u/agent-config 2.0.0 → 2.2.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.
Files changed (41) hide show
  1. package/.agent-src/commands/fix/{pr-bots.md → pr-bot-comments.md} +3 -3
  2. package/.agent-src/commands/fix/{pr.md → pr-comments.md} +6 -6
  3. package/.agent-src/commands/fix/{pr-developers.md → pr-developer-comments.md} +3 -3
  4. package/.agent-src/commands/fix.md +6 -6
  5. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -2
  6. package/.agent-src/rules/no-cheap-questions.md +11 -2
  7. package/.agent-src/skills/readme-writing-package/SKILL.md +24 -0
  8. package/.claude-plugin/marketplace.json +4 -4
  9. package/CHANGELOG.md +79 -0
  10. package/README.md +76 -12
  11. package/docs/architecture.md +2 -2
  12. package/docs/catalog.md +3 -3
  13. package/docs/contracts/command-clusters.md +3 -3
  14. package/docs/contracts/file-ownership-matrix.json +9 -9
  15. package/docs/contracts/tier-3-contrib-plugin.md +129 -0
  16. package/docs/decisions/ADR-007-agent-discovery-scopes.md +278 -0
  17. package/docs/decisions/ADR-008-installed-tools-manifest.md +160 -0
  18. package/docs/decisions/INDEX.md +2 -0
  19. package/docs/getting-started.md +16 -25
  20. package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +32 -0
  21. package/docs/guidelines/agent-infra/installed-tools-manifest.md +135 -0
  22. package/docs/installation.md +116 -49
  23. package/docs/migrations/commands-1.15.0.md +3 -3
  24. package/docs/setup/per-ide/claude-desktop.md +8 -4
  25. package/docs/skills-catalog.md +23 -2
  26. package/docs/troubleshooting.md +20 -32
  27. package/llms.txt +22 -1
  28. package/package.json +1 -1
  29. package/scripts/_cli/cmd_export.py +157 -0
  30. package/scripts/_cli/cmd_sync.py +162 -0
  31. package/scripts/_cli/cmd_update.py +23 -1
  32. package/scripts/_cli/cmd_validate.py +164 -0
  33. package/scripts/_lib/installed_lock.py +160 -0
  34. package/scripts/_lib/installed_tools.py +237 -0
  35. package/scripts/agent-config +62 -0
  36. package/scripts/install +68 -13
  37. package/scripts/install.py +984 -33
  38. package/scripts/install.sh +6 -11
  39. package/templates/agent-config-wrapper.sh +40 -25
  40. package/templates/consumer-settings/README.md +2 -2
  41. package/scripts/setup.sh +0 -230
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bash
2
2
  # install.sh — Agent-config payload sync (one of two installer stages).
3
3
  #
4
- # Reads from vendor's .agent-src/ (fallback: .augment/ for pre-2.0 packages) and
5
- # writes the target project's .augment/ tree: copies rules, symlinks everything
6
- # else. When augment.rules_use_symlinks: true is set in the target's
4
+ # Reads from the package's .agent-src/ and writes the target project's
5
+ # .augment/ tree: copies rules, symlinks everything else. When
6
+ # augment.rules_use_symlinks: true is set in the target's
7
7
  # .agent-settings.yml, rules are symlinked instead of copied.
8
8
  # Creates tool-specific directories for Claude Code, Cursor, Cline, Windsurf, Gemini.
9
9
  #
@@ -91,9 +91,6 @@ parse_args() {
91
91
  if [[ -z "$TARGET_DIR" ]]; then
92
92
  if [[ -n "${PROJECT_ROOT:-}" ]]; then
93
93
  TARGET_DIR="$PROJECT_ROOT"
94
- elif [[ "$SOURCE_DIR" == */vendor/event4u/agent-config ]]; then
95
- # Composer: vendor/event4u/agent-config → project root is 3 levels up
96
- TARGET_DIR="$(cd "$SOURCE_DIR/../../.." && pwd)"
97
94
  elif [[ "$SOURCE_DIR" == */node_modules/@event4u/agent-config ]]; then
98
95
  # npm (scoped): node_modules/@event4u/agent-config → project root is 3 levels up
99
96
  TARGET_DIR="$(cd "$SOURCE_DIR/../../.." && pwd)"
@@ -106,13 +103,11 @@ parse_args() {
106
103
  fi
107
104
  fi
108
105
 
109
- # Resolve source layout: prefer .agent-src/ (v2.0+), fallback to .augment/ (pre-2.0).
106
+ # Resolve source layout. .agent-src/ is the only supported source since v2.0.
110
107
  if [[ -d "$SOURCE_DIR/.agent-src" ]]; then
111
108
  SOURCE_PAYLOAD="$SOURCE_DIR/.agent-src"
112
- elif [[ -d "$SOURCE_DIR/.augment" ]]; then
113
- SOURCE_PAYLOAD="$SOURCE_DIR/.augment"
114
109
  else
115
- log_error "Source payload not found: $SOURCE_DIR/.agent-src (or .augment)"
110
+ log_error "Source payload not found: $SOURCE_DIR/.agent-src"
116
111
  exit 1
117
112
  fi
118
113
  }
@@ -706,7 +701,7 @@ ensure_gitignore() {
706
701
 
707
702
  # Install the consumer-facing CLI wrapper `./agent-config` at the project
708
703
  # root. Gitignored, overwritten on every install, delegates to the master
709
- # CLI shipped in the package (node_modules or vendor).
704
+ # CLI shipped in the package (node_modules) or fetched on demand via npx.
710
705
  install_cli_wrapper() {
711
706
  local project_root="$1"
712
707
  local template="$SOURCE_DIR/templates/agent-config-wrapper.sh"
@@ -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
- # shipped inside the installed package (node_modules or vendor). Do NOT
6
- # edit this file is gitignored and regenerated on every install.
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
- local candidates=(
21
- "$SELF_DIR/node_modules/@event4u/agent-config/scripts/agent-config"
22
- "$SELF_DIR/vendor/event4u/agent-config/scripts/agent-config"
23
- )
24
- local c
25
- for c in "${candidates[@]}"; do
26
- if [[ -x "$c" ]]; then
27
- printf '%s' "$c"
28
- return 0
29
- fi
30
- done
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 ! MASTER="$(locate_master)"; then
35
- cat >&2 <<EOF
36
- ❌ agent-config: master CLI not found.
37
- Tried:
38
- - node_modules/@event4u/agent-config/scripts/agent-config
39
- - vendor/event4u/agent-config/scripts/agent-config
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
- exec "$MASTER" "$@"
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 `install.sh` approach:
28
+ These tools do **not** support plugins yet. Use the classic installer:
29
29
 
30
30
  ```bash
31
- bash vendor/event4u/agent-config/scripts/install.sh --target .
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 "$@"