@event4u/agent-config 1.41.2 → 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.
Files changed (48) 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/templates/agents/agent-project-settings.example.yml +14 -0
  7. package/.agent-src/templates/scripts/work_engine/_lib/agent_settings.py +120 -11
  8. package/.claude-plugin/marketplace.json +4 -4
  9. package/CHANGELOG.md +54 -0
  10. package/README.md +39 -31
  11. package/config/agent-settings.template.yml +25 -0
  12. package/docs/architecture.md +47 -1
  13. package/docs/catalog.md +3 -3
  14. package/docs/contracts/command-clusters.md +3 -3
  15. package/docs/contracts/file-ownership-matrix.json +9 -9
  16. package/docs/customization.md +125 -9
  17. package/docs/getting-started.md +16 -25
  18. package/docs/installation.md +66 -82
  19. package/docs/migration/v1-to-v2.md +98 -0
  20. package/docs/migrations/commands-1.15.0.md +3 -3
  21. package/docs/setup/per-ide/claude-code.md +0 -17
  22. package/docs/setup/per-ide/claude-desktop.md +35 -48
  23. package/docs/setup/per-ide/windsurf.md +0 -11
  24. package/docs/skills-catalog.md +23 -2
  25. package/docs/troubleshooting.md +20 -32
  26. package/llms.txt +22 -1
  27. package/package.json +1 -6
  28. package/scripts/_cli/__init__.py +0 -0
  29. package/scripts/_cli/cmd_migrate.py +270 -0
  30. package/scripts/_cli/cmd_update.py +226 -0
  31. package/scripts/_lib/agent_settings.py +120 -11
  32. package/scripts/_lib/agents_overlay.py +109 -0
  33. package/scripts/_lib/pin_resolver.py +152 -0
  34. package/scripts/_lib/update_check.py +183 -0
  35. package/scripts/agent-config +73 -1
  36. package/scripts/check_overlay_cascade_subdirs.py +125 -0
  37. package/scripts/check_template_pin_drift.py +112 -0
  38. package/scripts/check_update_banner.py +86 -0
  39. package/scripts/install +27 -40
  40. package/scripts/install.py +17 -228
  41. package/scripts/install.sh +6 -11
  42. package/templates/agent-config-wrapper.sh +40 -25
  43. package/templates/consumer-settings/README.md +2 -2
  44. package/bin/install.php +0 -45
  45. package/composer.json +0 -33
  46. package/scripts/postinstall.sh +0 -76
  47. package/scripts/setup.sh +0 -230
  48. package/templates/global-install-manifest.yml +0 -91
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 "$@"
@@ -1,91 +0,0 @@
1
- # Global Install Manifest — road-to-simplicity-and-everywhere Phase 3
2
- #
3
- # Curated subset of rules + skills shipped to user-scope directories
4
- # (~/.claude/, ~/.cursor/, ~/.codeium/windsurf/, ~/.config/agent-config/)
5
- # by `scripts/install --global`. Without curation we'd dump 200+ skills
6
- # into user dirs — that is the failure mode anthropics/claude-code#53950
7
- # flagged.
8
- #
9
- # Schema (v1):
10
- # kernel_rules: list[str] — rule IDs from router.json's `kernel`.
11
- # Always shipped to every enabled surface.
12
- # top_skills: list[entry] — curated universal skills.
13
- # entry.id : skill directory under .agent-src/skills/
14
- # entry.surfaces : subset of [claude-code, cursor, windsurf, fallback]
15
- # — fallback is always written.
16
- #
17
- # Source: kernel_rules mirrors router.json; top_skills is a 15-pick
18
- # distilled from .agent-src/skills/ — universal coding-loop helpers
19
- # (work, commit, PR, review, quality, analyze, handoff). Per-stack
20
- # skills (laravel, react-shadcn-ui, php-coder) stay project-local.
21
- #
22
- # Per-tool target paths (handled by scripts/install.py global subcommand):
23
- # claude-code : ~/.claude/skills/event4u/<id>/SKILL.md
24
- # ~/.claude/rules/event4u/<rule>.md
25
- # cursor : ~/.cursor/rules/imported/event4u/<rule>.mdc
26
- # ~/.cursor/skills/event4u/<id>/ (skills surface; mirrors agent-os)
27
- # windsurf : ~/.codeium/windsurf/global_workflows/event4u/<id>.md
28
- # fallback : ~/.config/agent-config/{rules,skills}/event4u/
29
- #
30
- # All writes are namespaced under `event4u/` so `--global --uninstall`
31
- # can `rm -rf` the namespace dir without touching user-added files.
32
-
33
- schema_version: 1
34
-
35
- # Always-loaded rules — mirrors router.json's `kernel` array.
36
- # Symlinked / copied into every enabled surface's rules dir.
37
- kernel_rules:
38
- - agent-authority
39
- - ask-when-uncertain
40
- - commit-policy
41
- - direct-answers
42
- - language-and-tone
43
- - no-cheap-questions
44
- - non-destructive-by-default
45
- - scope-control
46
- - verify-before-complete
47
-
48
- # Top-N curated skills. The 15 picks below are coding-loop universals:
49
- # the agent reaches for them on almost any task, regardless of stack.
50
- # Per-stack and domain skills are deliberately omitted — they belong in
51
- # project-local installs where the stack signal is unambiguous.
52
- top_skills:
53
- # --- Workflow drivers (most-touched commands) ---
54
- - id: work
55
- surfaces: [claude-code, cursor, windsurf, fallback]
56
- - id: commit
57
- surfaces: [claude-code, cursor, windsurf, fallback]
58
- - id: create-pr
59
- surfaces: [claude-code, cursor, windsurf, fallback]
60
- - id: review-changes
61
- surfaces: [claude-code, cursor, windsurf, fallback]
62
- - id: quality-fix
63
- surfaces: [claude-code, cursor, windsurf, fallback]
64
-
65
- # --- Session / context management ---
66
- - id: agent-handoff
67
- surfaces: [claude-code, cursor, windsurf, fallback]
68
- - id: agent-status
69
- surfaces: [claude-code, cursor, windsurf, fallback]
70
- - id: project-analyze
71
- surfaces: [claude-code, cursor, windsurf, fallback]
72
- - id: project-health
73
- surfaces: [claude-code, cursor, windsurf, fallback]
74
-
75
- # --- Investigation / debugging ---
76
- - id: bug-investigate
77
- surfaces: [claude-code, cursor, windsurf, fallback]
78
- - id: bug-fix
79
- surfaces: [claude-code, cursor, windsurf, fallback]
80
- - id: systematic-debugging
81
- surfaces: [claude-code, cursor, windsurf, fallback]
82
-
83
- # --- Ticket / PR drivers ---
84
- - id: implement-ticket
85
- surfaces: [claude-code, cursor, windsurf, fallback]
86
- - id: prepare-for-review
87
- surfaces: [claude-code, cursor, windsurf, fallback]
88
-
89
- # --- Onboarding (single command, surfaces a project) ---
90
- - id: onboard
91
- surfaces: [claude-code, cursor, windsurf, fallback]