lean-agent-harness 0.0.0-stage → 1.3.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/AGENTS.md +34 -0
- package/CHANGELOG.md +54 -0
- package/CLAUDE.md +12 -0
- package/GLOSSARY.md +53 -0
- package/LICENSE +21 -0
- package/README.md +92 -2
- package/adapters/opencode/commands/audit-code.md +5 -0
- package/adapters/opencode/commands/commit.md +5 -0
- package/adapters/opencode/commands/orchestrate.md +5 -0
- package/adapters/opencode/commands/plan-flow.md +5 -0
- package/adapters/opencode/commands/review.md +5 -0
- package/bin/cli.js +310 -0
- package/guard/claude/hook.json +7 -0
- package/guard/claude/lah-guard/core.js +101 -0
- package/guard/claude/lah-guard/index.js +76 -0
- package/guard/claude/lah-guard/policy.json +33 -0
- package/guard/claude/merge-settings.js +70 -0
- package/guard/codex/lah.rules +74 -0
- package/guard/pi/lah-guard/core.js +101 -0
- package/guard/pi/lah-guard/index.js +49 -0
- package/guard/pi/lah-guard/policy.json +33 -0
- package/install.sh +263 -0
- package/manifest.tsv +31 -0
- package/package.json +54 -4
- package/profile-extras.txt +6 -0
- package/skills/audit-code/SKILL.md +14 -0
- package/skills/audit-code/agents/openai.yaml +2 -0
- package/skills/code-review/SKILL.md +42 -0
- package/skills/commit/SKILL.md +15 -0
- package/skills/commit/agents/openai.yaml +2 -0
- package/skills/db-migration/SKILL.md +40 -0
- package/skills/diagnosing-bugs/SKILL.md +32 -0
- package/skills/diagram-design/SKILL.md +43 -0
- package/skills/diagram-design/references/template.md +33 -0
- package/skills/humanizer/SKILL.md +30 -0
- package/skills/impeccable/SKILL.md +36 -0
- package/skills/orchestrate/SKILL.md +38 -0
- package/skills/orchestrate/agents/openai.yaml +2 -0
- package/skills/plan-flow/SKILL.md +37 -0
- package/skills/plan-flow/agents/openai.yaml +2 -0
- package/skills/review/SKILL.md +22 -0
- package/skills/review/agents/openai.yaml +2 -0
- package/skills/security-audit/SKILL.md +32 -0
- package/skills/testing/SKILL.md +28 -0
- package/templates/GLOSSARY.md +11 -0
package/install.sh
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lean Agent Harness — cross-platform installer (curl | bash)
|
|
3
|
+
# Modes: local (project) | global (user home). Detection + flags, never hangs without a TTY.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
REPO="${GITHUB_REPO:-lnardev/lean-agent-harness}"
|
|
7
|
+
BRANCH="${GITHUB_BRANCH:-main}"
|
|
8
|
+
# LAH_VERSION pins a release tag (X.Y.Z) instead of the branch; LAH_SHA256 verifies the downloaded archive;
|
|
9
|
+
# LAH_ARCHIVE_URL overrides the download URL entirely (mirrors, tests).
|
|
10
|
+
|
|
11
|
+
GREEN='\033[32m'; CYAN='\033[36m'; YELLOW='\033[33m'; BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
|
|
12
|
+
|
|
13
|
+
TARGET_MODE=""
|
|
14
|
+
STRATEGY=""
|
|
15
|
+
PROFILE="full"
|
|
16
|
+
GUARD=false
|
|
17
|
+
while [ $# -gt 0 ]; do
|
|
18
|
+
case "$1" in
|
|
19
|
+
--global|-g) TARGET_MODE="global" ;;
|
|
20
|
+
--local|-l) TARGET_MODE="local" ;;
|
|
21
|
+
--all) STRATEGY="all" ;;
|
|
22
|
+
--auto) STRATEGY="auto" ;;
|
|
23
|
+
--guard) GUARD=true ;;
|
|
24
|
+
--profile)
|
|
25
|
+
PROFILE="${2:-}"
|
|
26
|
+
case "$PROFILE" in
|
|
27
|
+
core|full) shift ;;
|
|
28
|
+
*) echo "Perfil desconocido: \"$PROFILE\". Usa: core | full" >&2; exit 64 ;;
|
|
29
|
+
esac
|
|
30
|
+
;;
|
|
31
|
+
*) echo "Flag desconocido: $1 (solo: --global, --local, --all, --auto, --guard, --profile core|full)" >&2; exit 64 ;;
|
|
32
|
+
esac
|
|
33
|
+
shift
|
|
34
|
+
done
|
|
35
|
+
|
|
36
|
+
if [ "$GUARD" = true ] && [ "$TARGET_MODE" != "global" ]; then
|
|
37
|
+
echo "--guard requiere --global: las extensiones de proyecto solo cargan si el proyecto es de confianza." >&2
|
|
38
|
+
exit 64
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
if [ "$GUARD" = true ] && ! command -v node >/dev/null 2>&1; then
|
|
42
|
+
echo "--guard necesita node para registrar el hook en ~/.claude/settings.json (y para que el hook funcione)." >&2
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
TTY_DEV=""
|
|
47
|
+
if [ -c /dev/tty ]; then TTY_DEV="/dev/tty"; fi
|
|
48
|
+
|
|
49
|
+
ask() {
|
|
50
|
+
local response=""
|
|
51
|
+
if [ -n "$TTY_DEV" ]; then
|
|
52
|
+
printf "%b" "$1" > "/dev/tty"
|
|
53
|
+
read -r response < "/dev/tty" || true
|
|
54
|
+
fi
|
|
55
|
+
printf "%s" "${response:-$2}"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
echo -e "\n${BOLD}${CYAN}Lean Agent Harness${NC} — Instalador Universal\n"
|
|
59
|
+
|
|
60
|
+
# 1. Mode: global vs local
|
|
61
|
+
if [ -z "$TARGET_MODE" ]; then
|
|
62
|
+
if [ -n "$TTY_DEV" ]; then
|
|
63
|
+
echo -e "${BOLD}¿Dónde deseas instalar el arnés?${NC}"
|
|
64
|
+
echo -e " ${CYAN}[1]${NC} Global (~/ en carpetas de usuario)"
|
|
65
|
+
echo -e " ${CYAN}[2]${NC} Local (en el proyecto actual: $(pwd))"
|
|
66
|
+
mode_choice="$(ask "Selecciona [1/2] (por defecto 1): " "1")"
|
|
67
|
+
[ "$mode_choice" = "2" ] && TARGET_MODE="local" || TARGET_MODE="global"
|
|
68
|
+
echo ""
|
|
69
|
+
else
|
|
70
|
+
TARGET_MODE="global"
|
|
71
|
+
fi
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
if [ "$TARGET_MODE" = "global" ]; then
|
|
75
|
+
BASE_DIR="${HOME}"
|
|
76
|
+
echo -e "Modo: ${BOLD}Global${NC} (${DIM}${BASE_DIR}${NC})\n"
|
|
77
|
+
else
|
|
78
|
+
BASE_DIR="$PWD"
|
|
79
|
+
echo -e "Modo: ${BOLD}Local${NC} (${DIM}${BASE_DIR}${NC})\n"
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# 2. Source: local override for testing, otherwise the GitHub tarball
|
|
83
|
+
if [ -n "${LAH_SOURCE:-}" ] && [ -d "$LAH_SOURCE" ]; then
|
|
84
|
+
SRC="$LAH_SOURCE"
|
|
85
|
+
echo -e "${DIM}Fuente: $SRC (override local)${NC}"
|
|
86
|
+
else
|
|
87
|
+
SRC="$(mktemp -d)"
|
|
88
|
+
ARCHIVE="$(mktemp)"
|
|
89
|
+
trap 'rm -rf "$SRC" "$ARCHIVE"' EXIT
|
|
90
|
+
|
|
91
|
+
if [ -n "${LAH_VERSION:-}" ]; then
|
|
92
|
+
if ! [[ "$LAH_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
93
|
+
echo "LAH_VERSION inválida: \"$LAH_VERSION\" (usa X.Y.Z)" >&2
|
|
94
|
+
exit 64
|
|
95
|
+
fi
|
|
96
|
+
ARCHIVE_URL="https://github.com/${REPO}/archive/refs/tags/v${LAH_VERSION}.tar.gz"
|
|
97
|
+
else
|
|
98
|
+
ARCHIVE_URL="https://github.com/${REPO}/archive/refs/heads/${BRANCH}.tar.gz"
|
|
99
|
+
fi
|
|
100
|
+
ARCHIVE_URL="${LAH_ARCHIVE_URL:-$ARCHIVE_URL}"
|
|
101
|
+
|
|
102
|
+
echo -e "${DIM}Descargando arnés desde ${ARCHIVE_URL}...${NC}"
|
|
103
|
+
curl -fsSL "$ARCHIVE_URL" -o "$ARCHIVE"
|
|
104
|
+
|
|
105
|
+
if [ -n "${LAH_SHA256:-}" ]; then
|
|
106
|
+
if command -v sha256sum >/dev/null 2>&1; then actual="$(sha256sum "$ARCHIVE" | cut -d' ' -f1)"
|
|
107
|
+
else actual="$(shasum -a 256 "$ARCHIVE" | cut -d' ' -f1)"; fi
|
|
108
|
+
expected="$(printf '%s' "$LAH_SHA256" | tr 'A-F' 'a-f')"
|
|
109
|
+
if [ "$actual" != "$expected" ]; then
|
|
110
|
+
echo -e "Checksum SHA-256 no coincide: se esperaba ${expected} y se obtuvo ${actual}. No se instaló nada." >&2
|
|
111
|
+
exit 1
|
|
112
|
+
fi
|
|
113
|
+
echo -e "${DIM}Checksum SHA-256 verificado.${NC}"
|
|
114
|
+
else
|
|
115
|
+
echo -e "${YELLOW}LAH_SHA256 no definido: el arnés se instala sin verificar el checksum.${NC}"
|
|
116
|
+
fi
|
|
117
|
+
|
|
118
|
+
tar -xzf "$ARCHIVE" -C "$SRC" --strip-components=1
|
|
119
|
+
fi
|
|
120
|
+
|
|
121
|
+
# 3. Environment detection (ids match the `target` column of manifest.tsv)
|
|
122
|
+
detect() {
|
|
123
|
+
local shared=false
|
|
124
|
+
[ -d "$BASE_DIR/.claude" ] && echo "claude"
|
|
125
|
+
[ -d "$BASE_DIR/.commandcode" ] && echo "commandcode"
|
|
126
|
+
if [ "$TARGET_MODE" = "global" ]; then
|
|
127
|
+
[ -d "$BASE_DIR/.pi" ] && { echo "pi"; shared=true; }
|
|
128
|
+
[ -d "$BASE_DIR/.codex" ] && { echo "codex"; shared=true; }
|
|
129
|
+
[ -d "$BASE_DIR/.copilot" ] && { echo "copilot"; shared=true; }
|
|
130
|
+
[ -d "$BASE_DIR/.config/opencode" ] && { echo "opencode"; shared=true; }
|
|
131
|
+
else
|
|
132
|
+
[ -d "$BASE_DIR/.opencode" ] && { echo "opencode"; shared=true; }
|
|
133
|
+
for d in .pi .codex .github .cursor; do [ -d "$BASE_DIR/$d" ] && shared=true; done
|
|
134
|
+
fi
|
|
135
|
+
[ -d "$BASE_DIR/.agents" ] && shared=true
|
|
136
|
+
[ "$shared" = true ] && echo "agents"
|
|
137
|
+
return 0
|
|
138
|
+
}
|
|
139
|
+
# String-based, not an array: stock macOS ships bash 3.2 (no mapfile).
|
|
140
|
+
DETECTED="$(detect | tr '\n' ' ')"
|
|
141
|
+
DETECTED="${DETECTED% }"
|
|
142
|
+
|
|
143
|
+
# Space-separated target ids to deploy. "core" (root instruction files) is local-only in the manifest.
|
|
144
|
+
if [ "$TARGET_MODE" = "global" ]; then
|
|
145
|
+
ALL_TARGETS="claude agents pi opencode codex copilot commandcode"
|
|
146
|
+
else
|
|
147
|
+
ALL_TARGETS="claude agents opencode commandcode"
|
|
148
|
+
fi
|
|
149
|
+
SELECTED=""
|
|
150
|
+
|
|
151
|
+
# 3.5 Strategy fallback: non-TTY runs without an explicit strategy must not be a silent no-op
|
|
152
|
+
if [ -z "$STRATEGY" ] && [ -z "$TTY_DEV" ]; then
|
|
153
|
+
[ -n "$DETECTED" ] && STRATEGY="auto" || STRATEGY="all"
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
if [ -z "$STRATEGY" ]; then
|
|
157
|
+
if [ -n "$DETECTED" ]; then
|
|
158
|
+
echo -e "${BOLD}Se detectaron configuraciones para: ${GREEN}$(echo $DETECTED)${NC}\n"
|
|
159
|
+
echo -e " ${CYAN}[1]${NC} Instalar únicamente en los detectados"
|
|
160
|
+
echo -e " ${CYAN}[2]${NC} Seleccionar manualmente uno por uno"
|
|
161
|
+
echo -e " ${CYAN}[3]${NC} Instalar en todos los soportados"
|
|
162
|
+
choice="$(ask "Elige una opción [1/2/3] (por defecto 1): " "1")"
|
|
163
|
+
case "$choice" in
|
|
164
|
+
1) STRATEGY="auto" ;;
|
|
165
|
+
2) STRATEGY="manual" ;;
|
|
166
|
+
*) STRATEGY="all" ;;
|
|
167
|
+
esac
|
|
168
|
+
else
|
|
169
|
+
echo -e " ${YELLOW}No se detectaron carpetas de asistentes previas.${NC}\n"
|
|
170
|
+
echo -e " ${CYAN}[1]${NC} Instalar en todos los soportados"
|
|
171
|
+
echo -e " ${CYAN}[2]${NC} Seleccionar manualmente uno por uno"
|
|
172
|
+
choice="$(ask "Elige una opción [1/2] (por defecto 1): " "1")"
|
|
173
|
+
case "$choice" in 2) STRATEGY="manual" ;; *) STRATEGY="all" ;; esac
|
|
174
|
+
fi
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
case "$STRATEGY" in
|
|
178
|
+
all)
|
|
179
|
+
SELECTED="$ALL_TARGETS"
|
|
180
|
+
echo -e "${DIM}Estrategia: todos los entornos soportados.${NC}\n"
|
|
181
|
+
;;
|
|
182
|
+
auto)
|
|
183
|
+
SELECTED="$DETECTED"
|
|
184
|
+
[ -n "$SELECTED" ] || SELECTED="claude" # nothing detected: Claude Code is the sensible baseline
|
|
185
|
+
echo -e "${DIM}Estrategia: detectados ($(echo ${DETECTED:-ninguno})).${NC}\n"
|
|
186
|
+
;;
|
|
187
|
+
manual)
|
|
188
|
+
echo -e "${BOLD}Responde 's' (sí) o 'n' (no) para cada entorno:${NC}"
|
|
189
|
+
for id in $ALL_TARGETS; do
|
|
190
|
+
[[ "$(ask " ¿Instalar en ${id}? [S/n]: " "s")" =~ ^[Ss] ]] && SELECTED="$SELECTED $id"
|
|
191
|
+
done
|
|
192
|
+
echo ""
|
|
193
|
+
;;
|
|
194
|
+
esac
|
|
195
|
+
|
|
196
|
+
# The guard is opt-in and independent of environment detection: --guard always deploys every guard target.
|
|
197
|
+
if [ "$GUARD" = true ]; then SELECTED="$SELECTED pi-guard codex-guard claude-guard"; fi
|
|
198
|
+
|
|
199
|
+
# 4. Deployment helpers (semantics mirror bin/cli.js: manifest.tsv is the SSOT)
|
|
200
|
+
MANIFEST="$SRC/manifest.tsv"
|
|
201
|
+
[ -f "$MANIFEST" ] || { echo "manifest.tsv no encontrado en $SRC" >&2; exit 1; }
|
|
202
|
+
|
|
203
|
+
# First free backup name: "<name>.bak", then "<name>.bak.1", ... Existing backups are never overwritten.
|
|
204
|
+
backup_path() {
|
|
205
|
+
local candidate="$1.bak" n=1
|
|
206
|
+
while [ -e "$candidate" ]; do candidate="$1.bak.$n"; n=$((n+1)); done
|
|
207
|
+
printf '%s' "$candidate"
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
# Instruction file: a divergent existing destination is preserved as .bak (or the next free .bak.N).
|
|
211
|
+
# mode "if-missing": an existing destination is left untouched (seed files).
|
|
212
|
+
write_instruction() {
|
|
213
|
+
local src="$1" dest="$2" mode="${3:-}"
|
|
214
|
+
if [ "$mode" = "if-missing" ] && [ -e "$dest" ]; then return 0; fi
|
|
215
|
+
mkdir -p "$(dirname "$dest")"
|
|
216
|
+
if [ -f "$dest" ] && ! cmp -s "$src" "$dest"; then cp "$dest" "$(backup_path "$dest")"; fi
|
|
217
|
+
cp "$src" "$dest"
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
# Skill folders omitted by --profile core (profile-extras.txt, shared with bin/cli.js).
|
|
221
|
+
EXCLUDED=""
|
|
222
|
+
if [ "$PROFILE" = "core" ] && [ -f "$SRC/profile-extras.txt" ]; then
|
|
223
|
+
EXCLUDED="$(tr -d '\r' < "$SRC/profile-extras.txt" | grep -v '^#' | grep -v '^[[:space:]]*$' | tr '\n' ' ' || true)"
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
# copy_dir <from> <to> [skip-extras]: copies top-level entries only, so dotfiles (e.g. Finder's .DS_Store) never ship.
|
|
227
|
+
# With skip-extras, top-level entries listed in EXCLUDED are not copied either.
|
|
228
|
+
copy_dir() {
|
|
229
|
+
mkdir -p "$2"
|
|
230
|
+
local entry name
|
|
231
|
+
for entry in "$1"/*; do
|
|
232
|
+
name="$(basename "$entry")"
|
|
233
|
+
if [ "${3:-}" = "skip-extras" ]; then
|
|
234
|
+
case " $EXCLUDED " in *" $name "*) continue ;; esac
|
|
235
|
+
fi
|
|
236
|
+
cp -R "$entry" "$2/"
|
|
237
|
+
done
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
is_selected() {
|
|
241
|
+
[ "$1" = "core" ] && [ "$TARGET_MODE" = "local" ] && return 0
|
|
242
|
+
case " $SELECTED " in *" $1 "*) return 0 ;; *) return 1 ;; esac
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
# 5. Deploy every manifest row of this scope whose target was selected
|
|
246
|
+
TAB="$(printf '\t')"
|
|
247
|
+
DEPLOYED=""
|
|
248
|
+
while IFS="$TAB" read -r scope tgt kind src dest mode; do
|
|
249
|
+
case "$scope" in ""|\#*) continue ;; esac
|
|
250
|
+
if [ "$scope" != "$TARGET_MODE" ] && ! { [ "$GUARD" = true ] && [ "$scope" = "${TARGET_MODE}-guard" ]; }; then continue; fi
|
|
251
|
+
is_selected "$tgt" || continue
|
|
252
|
+
case "$kind" in
|
|
253
|
+
file) write_instruction "$SRC/$src" "$BASE_DIR/$dest" "${mode:-}" ;;
|
|
254
|
+
settings-hook) node "$SRC/guard/claude/merge-settings.js" "$SRC/$src" "$BASE_DIR/$dest" ;;
|
|
255
|
+
dir)
|
|
256
|
+
if [ "$src" = "skills" ]; then copy_dir "$SRC/$src" "$BASE_DIR/$dest" skip-extras
|
|
257
|
+
else copy_dir "$SRC/$src" "$BASE_DIR/$dest"; fi
|
|
258
|
+
;;
|
|
259
|
+
esac
|
|
260
|
+
case " $DEPLOYED " in *" $tgt "*) ;; *) DEPLOYED="$DEPLOYED $tgt"; echo -e " ${GREEN}✔${NC} $tgt" ;; esac
|
|
261
|
+
done < "$MANIFEST"
|
|
262
|
+
|
|
263
|
+
echo -e "\n${GREEN}${BOLD}Listo.${NC} Despliegue completado con éxito.\n"
|
package/manifest.tsv
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Deployment manifest (SSOT for bin/cli.js and install.sh).
|
|
2
|
+
# Columns (tab-separated): scope target kind src dest [mode]
|
|
3
|
+
# scope: local (dest relative to project root) | global (dest relative to $HOME)
|
|
4
|
+
# | global-guard (dest relative to $HOME; deployed only with --global --guard)
|
|
5
|
+
# kind: file (instruction file; a divergent existing dest is saved as .bak) | dir (mirror directory)
|
|
6
|
+
# | settings-hook (merge the hook in src into the Claude Code settings.json at dest)
|
|
7
|
+
# mode: if-missing (file kind only: never overwrite an existing dest)
|
|
8
|
+
# Target "agents" = the cross-tool Agent Skills location (.agents/skills), read natively by
|
|
9
|
+
# Pi, OpenCode, Codex, Copilot and Cursor. Claude Code reads .claude/skills instead.
|
|
10
|
+
local core file AGENTS.md AGENTS.md
|
|
11
|
+
local core file CLAUDE.md CLAUDE.md
|
|
12
|
+
local core file templates/GLOSSARY.md GLOSSARY.md if-missing
|
|
13
|
+
local claude dir skills .claude/skills
|
|
14
|
+
local agents dir skills .agents/skills
|
|
15
|
+
local opencode dir adapters/opencode/commands .opencode/commands
|
|
16
|
+
local commandcode dir skills .commandcode/skills
|
|
17
|
+
global claude file AGENTS.md .claude/AGENTS.md
|
|
18
|
+
global claude file CLAUDE.md .claude/CLAUDE.md
|
|
19
|
+
global claude dir skills .claude/skills
|
|
20
|
+
global agents dir skills .agents/skills
|
|
21
|
+
global pi file AGENTS.md .pi/agent/AGENTS.md
|
|
22
|
+
global opencode file AGENTS.md .config/opencode/AGENTS.md
|
|
23
|
+
global opencode dir adapters/opencode/commands .config/opencode/commands
|
|
24
|
+
global codex file AGENTS.md .codex/AGENTS.md
|
|
25
|
+
global copilot file AGENTS.md .copilot/copilot-instructions.md
|
|
26
|
+
global commandcode file AGENTS.md .commandcode/AGENTS.md
|
|
27
|
+
global commandcode dir skills .commandcode/skills
|
|
28
|
+
global-guard pi-guard dir guard/pi/lah-guard .pi/agent/extensions/lah-guard
|
|
29
|
+
global-guard claude-guard dir guard/claude/lah-guard .claude/hooks/lah-guard
|
|
30
|
+
global-guard claude-guard settings-hook guard/claude/hook.json .claude/settings.json
|
|
31
|
+
global-guard codex-guard file guard/codex/lah.rules .codex/rules/lah.rules
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lean-agent-harness",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Zero-bloat, token-efficient agent harness for Claude Code, Cursor, OpenCode, Pi, Codex, and CommandCode.",
|
|
5
|
+
"author": "lnardev",
|
|
6
|
+
"bin": {
|
|
7
|
+
"lean-agent-harness": "bin/cli.js",
|
|
8
|
+
"lean": "bin/cli.js",
|
|
9
|
+
"lah": "bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/lnardev/lean-agent-harness.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/lnardev/lean-agent-harness/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/lnardev/lean-agent-harness#readme",
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/",
|
|
21
|
+
"install.sh",
|
|
22
|
+
"manifest.tsv",
|
|
23
|
+
"profile-extras.txt",
|
|
24
|
+
"adapters/",
|
|
25
|
+
"skills/",
|
|
26
|
+
"guard/claude/",
|
|
27
|
+
"guard/pi/",
|
|
28
|
+
"guard/codex/",
|
|
29
|
+
"AGENTS.md",
|
|
30
|
+
"CLAUDE.md",
|
|
31
|
+
"templates/",
|
|
32
|
+
"GLOSSARY.md",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"README.md",
|
|
35
|
+
"CHANGELOG.md"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"test": "node --test \"test/*.test.js\"",
|
|
39
|
+
"prepack": "npm test"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"agents",
|
|
43
|
+
"ai",
|
|
44
|
+
"claude-code",
|
|
45
|
+
"cursor",
|
|
46
|
+
"opencode",
|
|
47
|
+
"pi",
|
|
48
|
+
"codex",
|
|
49
|
+
"commandcode",
|
|
50
|
+
"developer-tools"
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18.0.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit-code
|
|
3
|
+
description: Deep static security audit of a path or the whole workspace. Invoke explicitly.
|
|
4
|
+
argument-hint: [path]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# audit-code
|
|
9
|
+
|
|
10
|
+
Scope: the given path, else the whole workspace. Skip `.git`, `node_modules`, `.env*`, vendored code, binaries.
|
|
11
|
+
|
|
12
|
+
1. Load the `security-audit` skill.
|
|
13
|
+
2. Scan: broken authn/authz (IDOR, missing guards), injection (SQL/NoSQL/XSS/command), hardcoded secrets, insecure deserialization, SSRF, unsanitized trust-boundary crossings, dependency CVEs.
|
|
14
|
+
3. Report a severity matrix (Critical/High/Med/Low) with `file:line`, failure mechanism, blast radius and the surgical fix. Every finding needs a concrete attack path; no theoretical issues.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Fast, multi-axis technical code review targeting SonarQube quality gates (Bugs, Code Smells), architectural debt, and diff hygiene.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Review
|
|
8
|
+
|
|
9
|
+
Evaluate diffs and PRs strictly against four technical axes. Focus on defects that fail SonarQube quality gates and produce technical debt. Propose the exact remedy, not just the critique.
|
|
10
|
+
|
|
11
|
+
## The Review Axes
|
|
12
|
+
|
|
13
|
+
1. **Correctness (SonarQube Bugs):**
|
|
14
|
+
- Null pointer dereferences, unhandled nil/null checks, and type-coercion bugs.
|
|
15
|
+
- Resource leaks: unclosed files, DB connections, HTTP request/response bodies.
|
|
16
|
+
- Logic defects: off-by-one errors, infinite loops, inverted conditions, unchecked error returns.
|
|
17
|
+
|
|
18
|
+
2. **Readability & Bloat (SonarQube Code Smells):**
|
|
19
|
+
- Dead code: unreachable branches, unused variables, orphan imports, commented-out legacy code.
|
|
20
|
+
- Cyclomatic complexity: deep nesting (>3 levels), massive switch statements without default cases.
|
|
21
|
+
- Duplication: identical logic blocks that must be consolidated.
|
|
22
|
+
- Naming: cryptic variable names without domain meaning (`data`, `temp`, `res`).
|
|
23
|
+
|
|
24
|
+
3. **Architecture & Boundaries:**
|
|
25
|
+
- Layer leaks: transport or DB logic leaking into domain/business layers.
|
|
26
|
+
- Relocated complexity: refactors that merely shuffle lines instead of eliminating branches.
|
|
27
|
+
- Unnecessary abstractions: premature interfaces, boilerplate wrappers with only one implementation.
|
|
28
|
+
|
|
29
|
+
4. **Safety & Performance:**
|
|
30
|
+
- Unbounded queries, N+1 patterns, unconstrained pagination.
|
|
31
|
+
- Input validation at system borders (complements `security-audit`).
|
|
32
|
+
- Heavy allocations or redundant calculations inside loops or hot paths.
|
|
33
|
+
|
|
34
|
+
## Findings Format
|
|
35
|
+
|
|
36
|
+
Report only actionable issues ordered by severity:
|
|
37
|
+
|
|
38
|
+
- **Critical:** Blocks merge / SonarQube red gate. Runtime crash, resource leak, or data corruption.
|
|
39
|
+
- **Required:** Must fix. Code smells, complexity spikes, unhandled boundary cases, broken invariants.
|
|
40
|
+
- **Nit / Optional:** Style suggestions, minor syntactic sugar. Non-blocking.
|
|
41
|
+
|
|
42
|
+
For every reported issue, prescribe the exact structural remedy: *extract helper*, *close resource with defer/finally*, *dispatch via map*, or *collapse redundant branch*.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: Verifies quality gates and creates an atomic Conventional Commit. Invoke explicitly.
|
|
4
|
+
argument-hint: [hint]
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# commit
|
|
9
|
+
|
|
10
|
+
1. **Gates:** run the typecheck/lint/test scripts declared in the active manifest (`package.json`, `go.mod`, `Makefile`, ...). Require 0 errors and 0 new warnings; quote the summary line.
|
|
11
|
+
2. **Guard:** no secrets (`.env*`, `*.pem`, `*.key`) staged; no debug residue in the diff.
|
|
12
|
+
3. **Budget:** check `git diff --cached --stat`. Above 400 changed lines, split the unit or report the overage (rule: `orchestrate` § Change budget).
|
|
13
|
+
4. **Stage** only this task's files with `git add <files>`; never `git add .`.
|
|
14
|
+
5. **Message:** Conventional Commits (`feat|fix|refactor|test|docs|chore(scope): summary`), folding in the user's hint. No AI attribution lines.
|
|
15
|
+
6. `git commit -m "<message>"`, then delete `.tasks/current.md`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: db-migration
|
|
3
|
+
description: Safe, zero-downtime schema migrations and index tuning for SQL databases (PostgreSQL, MySQL, SQLite) and their ORMs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Database Migration
|
|
7
|
+
|
|
8
|
+
Design safe, deterministic, zero-downtime schema migrations. Prevent table locks, connection pool exhaustion, and data loss.
|
|
9
|
+
|
|
10
|
+
## Core Rules
|
|
11
|
+
|
|
12
|
+
1. **Expand & Contract Pattern:**
|
|
13
|
+
- Never rename or drop columns/tables in a single step.
|
|
14
|
+
- **Step 1 (Expand):** Add new nullable column/table.
|
|
15
|
+
- **Step 2 (Dual-write):** Write to old and new columns in application code.
|
|
16
|
+
- **Step 3 (Backfill):** Backfill historical rows in small batches outside peak traffic.
|
|
17
|
+
- **Step 4 (Contract):** Switch reads to new column, drop legacy writes.
|
|
18
|
+
- **Step 5 (Cleanup):** Drop the legacy column in a subsequent release.
|
|
19
|
+
|
|
20
|
+
2. **Lock Prevention & Safe Schema Changes:**
|
|
21
|
+
- Add new columns as `NULL` or with database-level defaults that do not trigger full table rewrites.
|
|
22
|
+
- Never run unbounded `UPDATE` or `DELETE` statements inside a migration transaction.
|
|
23
|
+
- Always create indexes concurrently or non-blocking:
|
|
24
|
+
- PostgreSQL: `CREATE INDEX CONCURRENTLY` (outside transactional block).
|
|
25
|
+
- MySQL: `ALGORITHM=INPLACE, LOCK=NONE`.
|
|
26
|
+
- Set lock timeouts (`SET lock_timeout = '2s';`) so a migration fails fast instead of queueing behind long transactions and exhausting the pool.
|
|
27
|
+
|
|
28
|
+
3. **Foreign Keys & Indices:**
|
|
29
|
+
- Explicitly index foreign key columns to eliminate table locks on cascaded operations.
|
|
30
|
+
- Order composite index columns: equality filters first, range/sort filters second.
|
|
31
|
+
|
|
32
|
+
4. **Reversibility:**
|
|
33
|
+
- Every migration must have a tested, matching rollback step (`down()` / `down.sql`).
|
|
34
|
+
- Reversible migrations must not assume default states that wipe data on rollback.
|
|
35
|
+
|
|
36
|
+
## Validation Checklist
|
|
37
|
+
|
|
38
|
+
- [ ] Migration applies and rolls back cleanly on an empty database.
|
|
39
|
+
- [ ] No long-lived exclusive table locks on large tables.
|
|
40
|
+
- [ ] Large data updates/backfills are decoupled into batched background jobs or scripts.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnosing-bugs
|
|
3
|
+
description: Disciplined 6-phase scientific debugging loop for stubborn defects, race conditions, and performance regressions. Prevents random code thrashing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnosing Bugs
|
|
7
|
+
|
|
8
|
+
Resolve defects by elimination of uncertainty, not by brute force. Never apply a second fix attempt to the same hypothesis.
|
|
9
|
+
|
|
10
|
+
## The 6-Phase Scientific Loop
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
1. REPRODUCE (RED) ──► 2. MINIMIZE ──► 3. HYPOTHESIZE ──► 4. INSTRUMENT ──► 5. FIX (GREEN) ──► 6. REGRESSION TEST
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
1. **Reproduce (RED):** Build a failing test that triggers the bug deterministically. If it cannot be reproduced at will, you are debugging noise, not a defect. Capture exact steps and expected vs actual output.
|
|
17
|
+
2. **Minimize:** Strip parameters, data, and setup until the smallest possible trigger remains. A 5-line repro reveals root causes that a 500-line scenario hides.
|
|
18
|
+
3. **Hypothesize:** State the exact causal mechanism in writing BEFORE touching production code (*"the cache is populated before the tenant context exists because X runs before Y"*). No hypothesis, no edit.
|
|
19
|
+
4. **Instrument:** Add targeted temporary logging or assertions that would refute the hypothesis. Prefer assertions over prints. Run once, read, remove.
|
|
20
|
+
5. **Fix (GREEN):** Apply the surgical correction at the root cause, never a symptom patch. The failing test from phase 1 must now pass.
|
|
21
|
+
6. **Regression Test:** Promote the repro into a permanent named test. Remove all instrumentation. Run the full suite to rule out collateral damage.
|
|
22
|
+
|
|
23
|
+
## Circuit Breaker Tie-In
|
|
24
|
+
|
|
25
|
+
After 2 consecutive failed fix attempts: STOP, `git checkout -- <files>`, and start over at phase 3 with a *different* causal mechanism. Repeating the same hypothesis louder is not debugging; it is thrashing.
|
|
26
|
+
|
|
27
|
+
## Anti-Patterns (Forbidden)
|
|
28
|
+
|
|
29
|
+
* Fixing symptoms (validate input *before* the null deref instead of at the source).
|
|
30
|
+
* Shotgun changes: editing 5 files hoping something sticks.
|
|
31
|
+
* "Works now, ship it": skipping phase 6 leaves the armed time bomb in the codebase.
|
|
32
|
+
* Debugging by adding permanent `console.log`/`print` residue that survives into the commit.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagram-design
|
|
3
|
+
description: Generates publication-grade editorial architecture, system flow, data pipeline, and sequence diagrams as standalone HTML files with inline SVG and CSS.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Editorial Diagram Design
|
|
7
|
+
|
|
8
|
+
Generate clean, publication-grade diagrams as single, self-contained HTML files (inline SVG + CSS). Never use generic dark-cyan glows, default Mermaid layouts, or diagonal connector lines.
|
|
9
|
+
|
|
10
|
+
## Visual DNA & Color Palette
|
|
11
|
+
|
|
12
|
+
- **Paper (Background):** `#f5f5f5` (flat canvas).
|
|
13
|
+
- **Ink (Text & Dominant Strokes):** `#2d3142`.
|
|
14
|
+
- **Muted (Secondary Text & Standard Lines):** `#4f5d75`.
|
|
15
|
+
- **Borders & Dividers:** `rgba(45, 49, 66, 0.12)`.
|
|
16
|
+
- **Accent (Bottlenecks / Critical Focus):** `#eb6c36` (coral/terracotta; max 1–2 focal nodes per diagram).
|
|
17
|
+
- **External / Loose Boundaries:** Dashed stroke (`stroke-dasharray="4,4"`).
|
|
18
|
+
|
|
19
|
+
## Typography (Google Fonts)
|
|
20
|
+
|
|
21
|
+
Embed in HTML header:
|
|
22
|
+
`<link href="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet">`
|
|
23
|
+
|
|
24
|
+
- **Diagram Title:** `Instrument Serif`, 28px, normal weight.
|
|
25
|
+
- **Node Names:** `Geist` (sans), 12px, weight 600.
|
|
26
|
+
- **Sublabels & Metadata:** `Geist Mono`, 9px (ports, protocols, batch intervals).
|
|
27
|
+
- **Connector Badges / Eyebrows:** `Geist Mono`, 7–8px, uppercase, tracked (`letter-spacing: 0.08em`).
|
|
28
|
+
|
|
29
|
+
## SVG Geometry & Layout Standards
|
|
30
|
+
|
|
31
|
+
1. **4px Grid Discipline:** All coordinates (`x`, `y`), dimensions (`width`, `height`), paddings, and gaps must be multiples of 4.
|
|
32
|
+
2. **Orthogonal Connectors Only:** Never draw diagonal slanted lines between off-axis nodes. Every bend must be a right-angle elbow with rounded corner (`r=8`). Reserve straight `<line>` strictly for nodes sharing identical axes.
|
|
33
|
+
3. **Masked Connector Badges:** Place protocol/data labels (e.g., `CSV`, `XLSX`, `LOAD`) inside an opaque `<rect>` filled with `#f5f5f5` (`rx=2`). Maintain a 6px–10px visible gap from the line stroke so the label never cuts through the arrow.
|
|
34
|
+
4. **Zones & Functional Containers:** Group steps into broad columns/areas (e.g., `COLLECTION`, `PROCESSING`, `DISSEMINATION`). Use a 1px border (`rgba(45,49,66,0.12)`), rounded corners (`rx=8`), and an uppercase mono title tab at the top-left.
|
|
35
|
+
5. **Node Hierarchy:**
|
|
36
|
+
- *Standard:* `#ffffff` fill, 1px `#2d3142` stroke, 6px radius (`rx=6`).
|
|
37
|
+
- *Bottleneck / Pain-point:* `#fbeee8` fill (`rgba(235,108,54,0.08)`), `#eb6c36` stroke.
|
|
38
|
+
- *External:* Transparent or white fill, dashed border (`stroke-dasharray="4,4"`).
|
|
39
|
+
6. **Horizontal Bottom Legend:** Position a horizontal legend strip below the diagram nodes, separated by a full-width hairline rule.
|
|
40
|
+
|
|
41
|
+
## Structural SVG Template
|
|
42
|
+
|
|
43
|
+
Load `references/template.md` before writing the SVG (markers, zones, connectors, masked badge, node box).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Structural SVG Template
|
|
2
|
+
|
|
3
|
+
```xml
|
|
4
|
+
<svg xmlns="[http://www.w3.org/2000/svg](http://www.w3.org/2000/svg)" viewBox="0 0 1200 680" width="100%" height="100%" role="img">
|
|
5
|
+
<defs>
|
|
6
|
+
<marker id="arrow" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
7
|
+
<polygon points="0 0, 8 3, 0 6" fill="#4f5d75"/>
|
|
8
|
+
</marker>
|
|
9
|
+
<marker id="arrow-accent" markerWidth="8" markerHeight="6" refX="7" refY="3" orient="auto">
|
|
10
|
+
<polygon points="0 0, 8 3, 0 6" fill="#eb6c36"/>
|
|
11
|
+
</marker>
|
|
12
|
+
</defs>
|
|
13
|
+
|
|
14
|
+
<!-- Canvas Background -->
|
|
15
|
+
<rect width="100%" height="100%" fill="#f5f5f5"/>
|
|
16
|
+
|
|
17
|
+
<!-- Zones (Painted first) -->
|
|
18
|
+
<rect x="40" y="80" width="320" height="500" rx="8" fill="none" stroke="rgba(45,49,66,0.12)" stroke-width="1"/>
|
|
19
|
+
<text x="60" y="100" fill="#4f5d75" font-family="'Geist Mono', monospace" font-size="8" letter-spacing="0.1em">COLLECTION</text>
|
|
20
|
+
|
|
21
|
+
<!-- Connectors (Drawn before nodes to keep stroke under boxes) -->
|
|
22
|
+
<path d="M 280 180 L 380 180 Q 388 180 388 188 L 388 240" fill="none" stroke="#4f5d75" stroke-width="1.2" marker-end="url(#arrow)"/>
|
|
23
|
+
|
|
24
|
+
<!-- Connector Masked Badge -->
|
|
25
|
+
<rect x="320" y="172" width="28" height="16" rx="2" fill="#f5f5f5"/>
|
|
26
|
+
<text x="334" y="183" fill="#4f5d75" font-family="'Geist Mono', monospace" font-size="8" text-anchor="middle">CSV</text>
|
|
27
|
+
|
|
28
|
+
<!-- Node Box Example -->
|
|
29
|
+
<rect x="60" y="140" width="220" height="72" rx="6" fill="#ffffff" stroke="#2d3142" stroke-width="1"/>
|
|
30
|
+
<text x="80" y="170" fill="#2d3142" font-family="'Geist', sans-serif" font-size="12" font-weight="600">Point-of-Sale Exports</text>
|
|
31
|
+
<text x="80" y="190" fill="#4f5d75" font-family="'Geist Mono', monospace" font-size="9">nightly · CSV</text>
|
|
32
|
+
</svg>
|
|
33
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: humanizer
|
|
3
|
+
description: Rewrites and cleans prose to eliminate AI writing tics, filler, and corporate inflation. Use for READMEs, docs, and changelogs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Humanizer
|
|
7
|
+
|
|
8
|
+
Write and edit prose so it reads like a human technical writer: direct, specific, uninflated. Preserve all factual claims; cut all decorative weight.
|
|
9
|
+
|
|
10
|
+
## Structural Tells (Banned Patterns)
|
|
11
|
+
|
|
12
|
+
1. **No "Not X, but Y":** Never build artificial contrast (*"Not just a tool, but a revolution"*). State the fact directly.
|
|
13
|
+
2. **No Staged Run-ups or Closers:** Cut openers (*"Let's dive in"*, *"Here's what you need to know"*, *"Honestly"*) and dramatic one-line closers (*"That is the real win"*, *"Let that sink in"*).
|
|
14
|
+
3. **No Aphorisms or Pseudo-depth:** Cut abstract analogies (*"X is the currency of Y"*, *"at its core"*, *"fundamentally"*).
|
|
15
|
+
4. **No Forced Triads:** Do not force groupings of three (*"speed, scale, and simplicity"*) unless logically necessary.
|
|
16
|
+
5. **No Decorative Formatting:** Never use bold labels on every list item (`- **Feature:** text`), emojis in headers, or excessive em-dashes (—). Use plain sentences, commas, or periods.
|
|
17
|
+
|
|
18
|
+
## Vocabulary Blacklist
|
|
19
|
+
|
|
20
|
+
Never use AI stock jargon unless quoting or referring to an exact technical term:
|
|
21
|
+
* *Verbs/Adverbs:* delve, foster, bolster, underscore, highlight, meticulously, quietly.
|
|
22
|
+
* *Nouns:* tapestry, landscape (abstract), testament, interplay, intricacies.
|
|
23
|
+
* *Adjectives:* crucial, pivotal, robust (figurative), vibrant, groundbreaking, multifaceted.
|
|
24
|
+
* *Sales fluff:* nestled, boasting, unparalleled, exciting times ahead.
|
|
25
|
+
|
|
26
|
+
## Output Standard
|
|
27
|
+
|
|
28
|
+
- **Direct Facts:** Replace *"serves as a testament to"* with *"is"*, and *"features a diverse array of"* with *"has"*.
|
|
29
|
+
- **Neutral Tone:** State limits and bugs plainly without chatbot apologies (*"I hope this helps"*), disclaimers (*"as of my knowledge cutoff"*), or defensive hedging.
|
|
30
|
+
- **Rhythm:** Alternate sentence lengths naturally.
|