tribunal-kit 4.2.0 → 4.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/.agent/ARCHITECTURE.md +21 -14
- package/.agent/agents/swarm-worker-contracts.md +5 -5
- package/.agent/agents/ui-ux-auditor.md +292 -0
- package/.agent/rules/GEMINI.md +8 -8
- package/.agent/scripts/__pycache__/_colors.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/_utils.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/case_law_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/_colors.js +18 -0
- package/.agent/scripts/_utils.js +42 -0
- package/.agent/scripts/auto_preview.js +197 -0
- package/.agent/scripts/bundle_analyzer.js +290 -0
- package/.agent/scripts/case_law_manager.js +684 -0
- package/.agent/scripts/checklist.js +266 -0
- package/.agent/scripts/colors.js +17 -0
- package/.agent/scripts/compress_skills.js +141 -0
- package/.agent/scripts/consolidate_skills.js +149 -0
- package/.agent/scripts/context_broker.js +609 -0
- package/.agent/scripts/deep_compress.js +150 -0
- package/.agent/scripts/dependency_analyzer.js +272 -0
- package/.agent/scripts/inner_loop_validator.js +465 -0
- package/.agent/scripts/lint_runner.js +187 -0
- package/.agent/scripts/minify_context.js +100 -0
- package/.agent/scripts/patch_skills_meta.js +156 -0
- package/.agent/scripts/patch_skills_output.js +244 -0
- package/.agent/scripts/schema_validator.js +297 -0
- package/.agent/scripts/security_scan.js +303 -0
- package/.agent/scripts/session_manager.js +276 -0
- package/.agent/scripts/skill_evolution.js +644 -0
- package/.agent/scripts/skill_integrator.js +313 -0
- package/.agent/scripts/strengthen_skills.js +193 -0
- package/.agent/scripts/strip_tribunal.js +47 -0
- package/.agent/scripts/swarm_dispatcher.js +360 -0
- package/.agent/scripts/test_runner.js +193 -0
- package/.agent/scripts/utils.js +32 -0
- package/.agent/scripts/verify_all.js +256 -0
- package/.agent/skills/agent-organizer/SKILL.md +3 -3
- package/.agent/skills/agentic-patterns/SKILL.md +3 -3
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +3 -3
- package/.agent/skills/api-patterns/SKILL.md +3 -3
- package/.agent/skills/api-security-auditor/SKILL.md +3 -3
- package/.agent/skills/app-builder/SKILL.md +3 -3
- package/.agent/skills/app-builder/templates/SKILL.md +1 -1
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +3 -3
- package/.agent/skills/architecture/SKILL.md +3 -3
- package/.agent/skills/authentication-best-practices/SKILL.md +3 -3
- package/.agent/skills/bash-linux/SKILL.md +3 -3
- package/.agent/skills/behavioral-modes/SKILL.md +3 -3
- package/.agent/skills/brainstorming/SKILL.md +3 -3
- package/.agent/skills/building-native-ui/SKILL.md +3 -3
- package/.agent/skills/clean-code/SKILL.md +3 -3
- package/.agent/skills/code-review-checklist/SKILL.md +3 -3
- package/.agent/skills/config-validator/SKILL.md +3 -3
- package/.agent/skills/csharp-developer/SKILL.md +3 -3
- package/.agent/skills/data-validation-schemas/SKILL.md +3 -3
- package/.agent/skills/database-design/SKILL.md +3 -3
- package/.agent/skills/deployment-procedures/SKILL.md +3 -3
- package/.agent/skills/devops-engineer/SKILL.md +3 -3
- package/.agent/skills/devops-incident-responder/SKILL.md +3 -3
- package/.agent/skills/doc.md +1 -1
- package/.agent/skills/documentation-templates/SKILL.md +3 -3
- package/.agent/skills/edge-computing/SKILL.md +3 -3
- package/.agent/skills/error-resilience/SKILL.md +3 -3
- package/.agent/skills/extract-design-system/SKILL.md +3 -3
- package/.agent/skills/framer-motion-expert/SKILL.md +3 -4
- package/.agent/skills/frontend-design/SKILL.md +3 -3
- package/.agent/skills/game-design-expert/SKILL.md +3 -3
- package/.agent/skills/game-engineering-expert/SKILL.md +3 -3
- package/.agent/skills/geo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/github-operations/SKILL.md +3 -3
- package/.agent/skills/gsap-core/SKILL.md +0 -2
- package/.agent/skills/gsap-frameworks/SKILL.md +0 -2
- package/.agent/skills/gsap-performance/SKILL.md +0 -2
- package/.agent/skills/gsap-plugins/SKILL.md +0 -2
- package/.agent/skills/gsap-react/SKILL.md +0 -2
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +0 -2
- package/.agent/skills/gsap-timeline/SKILL.md +0 -2
- package/.agent/skills/gsap-utils/SKILL.md +0 -2
- package/.agent/skills/i18n-localization/SKILL.md +3 -3
- package/.agent/skills/intelligent-routing/SKILL.md +3 -3
- package/.agent/skills/lint-and-validate/SKILL.md +3 -3
- package/.agent/skills/llm-engineering/SKILL.md +3 -3
- package/.agent/skills/local-first/SKILL.md +3 -3
- package/.agent/skills/mcp-builder/SKILL.md +3 -3
- package/.agent/skills/mobile-design/SKILL.md +3 -3
- package/.agent/skills/monorepo-management/SKILL.md +3 -3
- package/.agent/skills/motion-engineering/SKILL.md +4 -4
- package/.agent/skills/nextjs-react-expert/SKILL.md +3 -3
- package/.agent/skills/nodejs-best-practices/SKILL.md +3 -3
- package/.agent/skills/observability/SKILL.md +3 -3
- package/.agent/skills/parallel-agents/SKILL.md +3 -3
- package/.agent/skills/performance-profiling/SKILL.md +3 -3
- package/.agent/skills/plan-writing/SKILL.md +3 -3
- package/.agent/skills/platform-engineer/SKILL.md +3 -3
- package/.agent/skills/playwright-best-practices/SKILL.md +3 -3
- package/.agent/skills/powershell-windows/SKILL.md +3 -3
- package/.agent/skills/project-idioms/SKILL.md +3 -3
- package/.agent/skills/python-patterns/SKILL.md +3 -3
- package/.agent/skills/python-pro/SKILL.md +3 -3
- package/.agent/skills/react-specialist/SKILL.md +3 -3
- package/.agent/skills/readme-builder/SKILL.md +3 -3
- package/.agent/skills/realtime-patterns/SKILL.md +3 -3
- package/.agent/skills/red-team-tactics/SKILL.md +3 -3
- package/.agent/skills/rust-pro/SKILL.md +3 -3
- package/.agent/skills/seo-fundamentals/SKILL.md +3 -3
- package/.agent/skills/server-management/SKILL.md +3 -3
- package/.agent/skills/shadcn-ui-expert/SKILL.md +3 -3
- package/.agent/skills/skill-creator/SKILL.md +3 -3
- package/.agent/skills/sql-pro/SKILL.md +3 -3
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +3 -3
- package/.agent/skills/swiftui-expert/SKILL.md +3 -3
- package/.agent/skills/systematic-debugging/SKILL.md +3 -3
- package/.agent/skills/tailwind-patterns/SKILL.md +3 -3
- package/.agent/skills/tdd-workflow/SKILL.md +3 -3
- package/.agent/skills/test-result-analyzer/SKILL.md +3 -3
- package/.agent/skills/testing-patterns/SKILL.md +3 -3
- package/.agent/skills/trend-researcher/SKILL.md +3 -3
- package/.agent/skills/typescript-advanced/SKILL.md +3 -3
- package/.agent/skills/ui-ux-pro-max/SKILL.md +3 -3
- package/.agent/skills/ui-ux-researcher/SKILL.md +3 -3
- package/.agent/skills/vue-expert/SKILL.md +3 -3
- package/.agent/skills/vulnerability-scanner/SKILL.md +3 -3
- package/.agent/skills/web-accessibility-auditor/SKILL.md +3 -3
- package/.agent/skills/web-design-guidelines/SKILL.md +3 -3
- package/.agent/skills/webapp-testing/SKILL.md +3 -3
- package/.agent/skills/whimsy-injector/SKILL.md +3 -3
- package/.agent/skills/workflow-optimizer/SKILL.md +3 -3
- package/.agent/workflows/audit.md +6 -6
- package/.agent/workflows/deploy.md +1 -1
- package/.agent/workflows/generate.md +23 -6
- package/.agent/workflows/session.md +5 -5
- package/.agent/workflows/swarm.md +2 -2
- package/README.md +64 -8
- package/bin/tribunal-kit.js +277 -45
- package/package.json +9 -6
- package/scripts/changelog.js +167 -0
- package/scripts/sync-version.js +81 -0
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/scripts/auto_preview.py +0 -180
- package/.agent/scripts/bundle_analyzer.py +0 -259
- package/.agent/scripts/case_law_manager.py +0 -755
- package/.agent/scripts/checklist.py +0 -209
- package/.agent/scripts/compress_skills.py +0 -167
- package/.agent/scripts/consolidate_skills.py +0 -173
- package/.agent/scripts/deep_compress.py +0 -202
- package/.agent/scripts/dependency_analyzer.py +0 -247
- package/.agent/scripts/lint_runner.py +0 -188
- package/.agent/scripts/minify_context.py +0 -80
- package/.agent/scripts/patch_skills_meta.py +0 -177
- package/.agent/scripts/patch_skills_output.py +0 -285
- package/.agent/scripts/schema_validator.py +0 -279
- package/.agent/scripts/security_scan.py +0 -224
- package/.agent/scripts/session_manager.py +0 -261
- package/.agent/scripts/skill_evolution.py +0 -563
- package/.agent/scripts/skill_integrator.py +0 -234
- package/.agent/scripts/strengthen_skills.py +0 -220
- package/.agent/scripts/strip_tribunal.py +0 -41
- package/.agent/scripts/swarm_dispatcher.py +0 -350
- package/.agent/scripts/test_runner.py +0 -192
- package/.agent/scripts/test_swarm_dispatcher.py +0 -163
- package/.agent/scripts/verify_all.py +0 -195
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
skill_integrator.py — Automated Skill-Script Integration Analyzer
|
|
4
|
-
|
|
5
|
-
This script scans active skills in `.agent/skills/` and maps them to their
|
|
6
|
-
corresponding executable scripts in `.agent/scripts/`. It helps the Orchestrator
|
|
7
|
-
and other agents know which skills have automated CLI actions available.
|
|
8
|
-
|
|
9
|
-
Usage:
|
|
10
|
-
python .agent/scripts/skill_integrator.py
|
|
11
|
-
python .agent/scripts/skill_integrator.py --skill <skill-name>
|
|
12
|
-
python .agent/scripts/skill_integrator.py --report
|
|
13
|
-
python .agent/scripts/skill_integrator.py --verify
|
|
14
|
-
python .agent/scripts/skill_integrator.py --report --verify
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
import ast
|
|
18
|
-
import argparse
|
|
19
|
-
import os
|
|
20
|
-
import re
|
|
21
|
-
import sys
|
|
22
|
-
from datetime import datetime
|
|
23
|
-
from pathlib import Path
|
|
24
|
-
|
|
25
|
-
# Colors for terminal output
|
|
26
|
-
CYAN = "\033[96m"
|
|
27
|
-
GREEN = "\033[92m"
|
|
28
|
-
YELLOW = "\033[93m"
|
|
29
|
-
RED = "\033[91m"
|
|
30
|
-
BOLD = "\033[1m"
|
|
31
|
-
RESET = "\033[0m"
|
|
32
|
-
|
|
33
|
-
REPORT_FILE = "skill-integration-report.md"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def find_agent_dir(start_path: Path) -> Path:
|
|
37
|
-
current = start_path.resolve()
|
|
38
|
-
while current != current.parent:
|
|
39
|
-
agent_dir = current / '.agent'
|
|
40
|
-
if agent_dir.exists() and agent_dir.is_dir():
|
|
41
|
-
return agent_dir
|
|
42
|
-
current = current.parent
|
|
43
|
-
return None
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def get_associated_script(skill_dir: Path, scripts_dir: Path) -> str:
|
|
47
|
-
"""Check if the skill has an explicit frontmatter script or an implicit script file."""
|
|
48
|
-
skill_name = skill_dir.name
|
|
49
|
-
|
|
50
|
-
# 1. Implicit check: does a script with the same name exist?
|
|
51
|
-
implicit_script = scripts_dir / f"{skill_name}.py"
|
|
52
|
-
if implicit_script.exists():
|
|
53
|
-
return f".agent/scripts/{skill_name}.py"
|
|
54
|
-
|
|
55
|
-
# 2. Explicit check: does the SKILL.md define 'script:' in its frontmatter?
|
|
56
|
-
skill_md = skill_dir / "SKILL.md"
|
|
57
|
-
if skill_md.exists():
|
|
58
|
-
try:
|
|
59
|
-
with open(skill_md, "r", encoding="utf-8") as f:
|
|
60
|
-
content = f.read()
|
|
61
|
-
match = re.search(r"---(.*?)---", content, re.DOTALL)
|
|
62
|
-
if match:
|
|
63
|
-
frontmatter = match.group(1)
|
|
64
|
-
script_match = re.search(r"(?:^|\n)script:\s*([^\n]+)", frontmatter)
|
|
65
|
-
if script_match:
|
|
66
|
-
return script_match.group(1).strip()
|
|
67
|
-
except Exception:
|
|
68
|
-
pass
|
|
69
|
-
|
|
70
|
-
return None
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def scan_all_skills(agent_dir: Path) -> dict:
|
|
74
|
-
skills_dir = agent_dir / "skills"
|
|
75
|
-
scripts_dir = agent_dir / "scripts"
|
|
76
|
-
|
|
77
|
-
if not skills_dir.exists() or not scripts_dir.exists():
|
|
78
|
-
print(f"{YELLOW}Warning: '.agent/skills' or '.agent/scripts' directory not found.{RESET}")
|
|
79
|
-
return {}
|
|
80
|
-
|
|
81
|
-
integrated_skills = {}
|
|
82
|
-
|
|
83
|
-
for item in sorted(skills_dir.iterdir()):
|
|
84
|
-
if item.is_dir():
|
|
85
|
-
script_path = get_associated_script(item, scripts_dir)
|
|
86
|
-
if script_path:
|
|
87
|
-
integrated_skills[item.name] = script_path
|
|
88
|
-
|
|
89
|
-
return integrated_skills
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def verify_script(script_path_str: str, workspace_root: Path) -> tuple[bool, str]:
|
|
93
|
-
"""
|
|
94
|
-
Verify a mapped script exists on disk and has valid Python syntax.
|
|
95
|
-
Returns (is_valid: bool, message: str).
|
|
96
|
-
"""
|
|
97
|
-
# Resolve relative path from workspace root
|
|
98
|
-
script_path = workspace_root / script_path_str
|
|
99
|
-
|
|
100
|
-
if not script_path.exists():
|
|
101
|
-
return False, f"File not found: {script_path}"
|
|
102
|
-
|
|
103
|
-
try:
|
|
104
|
-
source = script_path.read_text(encoding="utf-8")
|
|
105
|
-
ast.parse(source)
|
|
106
|
-
return True, "Syntax OK"
|
|
107
|
-
except SyntaxError as e:
|
|
108
|
-
return False, f"Syntax error at line {e.lineno}: {e.msg}"
|
|
109
|
-
except Exception as e:
|
|
110
|
-
return False, f"Parse error: {e}"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def check_skill(skill_name: str, agent_dir: Path) -> None:
|
|
114
|
-
skill_dir = agent_dir / "skills" / skill_name
|
|
115
|
-
scripts_dir = agent_dir / "scripts"
|
|
116
|
-
|
|
117
|
-
if not skill_dir.exists():
|
|
118
|
-
print(f"{YELLOW}Skill '{skill_name}' not found in .agent/skills/{RESET}")
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
script_path = get_associated_script(skill_dir, scripts_dir)
|
|
122
|
-
if script_path:
|
|
123
|
-
print(f"{GREEN}✓ Associated script found:{RESET} {script_path}")
|
|
124
|
-
print(f"\nTo execute:\n python {script_path}")
|
|
125
|
-
else:
|
|
126
|
-
print(f"No executable script mapped for '{skill_name}'.")
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
def cmd_report(integrated_skills: dict, workspace_root: Path) -> None:
|
|
130
|
-
"""Write a Markdown integration report to REPORT_FILE."""
|
|
131
|
-
lines = [
|
|
132
|
-
"# Skill-Script Integration Report\n",
|
|
133
|
-
f"Generated: {datetime.now().isoformat()[:16]}\n",
|
|
134
|
-
f"Integrated skills: {len(integrated_skills)}\n",
|
|
135
|
-
"\n---\n",
|
|
136
|
-
"\n| Skill | Script | Exists |\n",
|
|
137
|
-
"|---|---|---|\n",
|
|
138
|
-
]
|
|
139
|
-
|
|
140
|
-
for skill, script in sorted(integrated_skills.items()):
|
|
141
|
-
script_path = workspace_root / script
|
|
142
|
-
exists = "✅" if script_path.exists() else "❌ Missing"
|
|
143
|
-
lines.append(f"| `{skill}` | `{script}` | {exists} |\n")
|
|
144
|
-
|
|
145
|
-
lines.append("\n---\n")
|
|
146
|
-
lines.append(f"\n_Run `python .agent/scripts/skill_integrator.py --verify` to validate syntax of all mapped scripts._\n")
|
|
147
|
-
|
|
148
|
-
content = "".join(lines)
|
|
149
|
-
report_path = workspace_root / REPORT_FILE
|
|
150
|
-
with open(report_path, "w", encoding="utf-8") as f:
|
|
151
|
-
f.write(content)
|
|
152
|
-
|
|
153
|
-
print(f"{GREEN}✅ Report written to:{RESET} {report_path}")
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
def cmd_verify(integrated_skills: dict, workspace_root: Path) -> bool:
|
|
157
|
-
"""
|
|
158
|
-
Validate each mapped script: check existence and Python syntax.
|
|
159
|
-
Returns True if all pass, False if any fail.
|
|
160
|
-
"""
|
|
161
|
-
if not integrated_skills:
|
|
162
|
-
print(f"{YELLOW}No integrated scripts found to verify.{RESET}")
|
|
163
|
-
return True
|
|
164
|
-
|
|
165
|
-
print(f"\n{BOLD}{CYAN}━━━ Skill-Script Verification ({len(integrated_skills)} scripts) ━━━{RESET}\n")
|
|
166
|
-
|
|
167
|
-
all_passed = True
|
|
168
|
-
for skill, script in sorted(integrated_skills.items()):
|
|
169
|
-
ok, msg = verify_script(script, workspace_root)
|
|
170
|
-
if ok:
|
|
171
|
-
print(f" {GREEN}✅ PASS{RESET} {BOLD}{skill}{RESET} → {script}")
|
|
172
|
-
else:
|
|
173
|
-
print(f" {RED}❌ FAIL{RESET} {BOLD}{skill}{RESET} → {script}")
|
|
174
|
-
print(f" {RED}{msg}{RESET}")
|
|
175
|
-
all_passed = False
|
|
176
|
-
|
|
177
|
-
print(f"\n{CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━{RESET}")
|
|
178
|
-
if all_passed:
|
|
179
|
-
print(f"{GREEN}All {len(integrated_skills)} mapped scripts passed verification.{RESET}\n")
|
|
180
|
-
else:
|
|
181
|
-
failed = sum(1 for s, p in integrated_skills.items() if not verify_script(p, workspace_root)[0])
|
|
182
|
-
print(f"{RED}{failed} script(s) failed verification. Fix before deploying.{RESET}\n")
|
|
183
|
-
|
|
184
|
-
return all_passed
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
def main():
|
|
188
|
-
parser = argparse.ArgumentParser(description="Skill-Script Integrator")
|
|
189
|
-
parser.add_argument("--skill", type=str, help="Validate a specific skill by name")
|
|
190
|
-
parser.add_argument("--workspace", type=str, default=".", help="Workspace root directory")
|
|
191
|
-
parser.add_argument("--report", action="store_true",
|
|
192
|
-
help=f"Generate a Markdown integration report ({REPORT_FILE})")
|
|
193
|
-
parser.add_argument("--verify", action="store_true",
|
|
194
|
-
help="Validate syntax of all mapped scripts (exits 1 on any failure)")
|
|
195
|
-
|
|
196
|
-
args = parser.parse_args()
|
|
197
|
-
workspace_root = Path(args.workspace).resolve()
|
|
198
|
-
|
|
199
|
-
agent_dir = find_agent_dir(workspace_root)
|
|
200
|
-
if not agent_dir:
|
|
201
|
-
print(f"{YELLOW}Error: Could not find .agent directory starting from {workspace_root}{RESET}")
|
|
202
|
-
sys.exit(1)
|
|
203
|
-
|
|
204
|
-
if args.skill:
|
|
205
|
-
check_skill(args.skill, agent_dir)
|
|
206
|
-
return
|
|
207
|
-
|
|
208
|
-
integrated_skills = scan_all_skills(agent_dir)
|
|
209
|
-
|
|
210
|
-
# --report: always runs first (independent of --verify)
|
|
211
|
-
if args.report:
|
|
212
|
-
cmd_report(integrated_skills, workspace_root)
|
|
213
|
-
|
|
214
|
-
# --verify: validate all mapped scripts
|
|
215
|
-
if args.verify:
|
|
216
|
-
passed = cmd_verify(integrated_skills, workspace_root)
|
|
217
|
-
if not passed:
|
|
218
|
-
sys.exit(1)
|
|
219
|
-
return
|
|
220
|
-
|
|
221
|
-
# Default: print to terminal (original behaviour)
|
|
222
|
-
if not args.report and not args.verify:
|
|
223
|
-
if not integrated_skills:
|
|
224
|
-
print("No integrated scripts found for any active skills.")
|
|
225
|
-
else:
|
|
226
|
-
print(f"\n{BOLD}{CYAN}--- Skill-Script Integrations ({len(integrated_skills)}) ---{RESET}\n")
|
|
227
|
-
for skill, script in sorted(integrated_skills.items()):
|
|
228
|
-
print(f" {BOLD}{skill}{RESET}")
|
|
229
|
-
print(f" ↳ {GREEN}{script}{RESET}\n")
|
|
230
|
-
print(f"{CYAN}To run a skill script, use: python <path>{RESET}\n")
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
if __name__ == "__main__":
|
|
234
|
-
main()
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
strengthen_skills.py — Appends Tribunal guardrails to SKILL.md files missing them.
|
|
4
|
-
|
|
5
|
-
Adds the following sections if not already present:
|
|
6
|
-
- ## 🤖 LLM-Specific Traps
|
|
7
|
-
- ## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
8
|
-
- ❌ Forbidden AI Tropes
|
|
9
|
-
- ✅ Pre-Flight Self-Audit
|
|
10
|
-
- 🛑 Verification-Before-Completion (VBC) Protocol
|
|
11
|
-
|
|
12
|
-
Usage:
|
|
13
|
-
python .agent/scripts/strengthen_skills.py .
|
|
14
|
-
python .agent/scripts/strengthen_skills.py . --dry-run
|
|
15
|
-
python .agent/scripts/strengthen_skills.py . --skill python-pro
|
|
16
|
-
python .agent/scripts/strengthen_skills.py . --path /custom/skills/dir
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
import os
|
|
20
|
-
import sys
|
|
21
|
-
import argparse
|
|
22
|
-
from pathlib import Path
|
|
23
|
-
|
|
24
|
-
RED = "\033[91m"
|
|
25
|
-
GREEN = "\033[92m"
|
|
26
|
-
YELLOW = "\033[93m"
|
|
27
|
-
BLUE = "\033[94m"
|
|
28
|
-
BOLD = "\033[1m"
|
|
29
|
-
RESET = "\033[0m"
|
|
30
|
-
|
|
31
|
-
# ─── Rich guardrails block ────────────────────────────────────────────────────
|
|
32
|
-
# This is the canonical template appended to skills missing Tribunal sections.
|
|
33
|
-
|
|
34
|
-
GUARDRAILS_BLOCK = """
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## 🤖 LLM-Specific Traps
|
|
39
|
-
|
|
40
|
-
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
41
|
-
|
|
42
|
-
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
43
|
-
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
44
|
-
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
45
|
-
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
46
|
-
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
51
|
-
|
|
52
|
-
**Slash command: `/review` or `/tribunal-full`**
|
|
53
|
-
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
54
|
-
|
|
55
|
-
### ❌ Forbidden AI Tropes
|
|
56
|
-
|
|
57
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
58
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
59
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
60
|
-
|
|
61
|
-
### ✅ Pre-Flight Self-Audit
|
|
62
|
-
|
|
63
|
-
Review these questions before confirming output:
|
|
64
|
-
```
|
|
65
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
66
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
67
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
68
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
72
|
-
|
|
73
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
74
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
75
|
-
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
# ─── Detection ───────────────────────────────────────────────────────────────
|
|
79
|
-
|
|
80
|
-
TRIBUNAL_MARKERS = [
|
|
81
|
-
"Tribunal Integration",
|
|
82
|
-
"Tribunal Integration (Anti-Hallucination)",
|
|
83
|
-
]
|
|
84
|
-
|
|
85
|
-
VBC_MARKERS = [
|
|
86
|
-
"Verification-Before-Completion",
|
|
87
|
-
"VBC Protocol",
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def has_tribunal_block(content: str) -> bool:
|
|
92
|
-
return any(marker in content for marker in TRIBUNAL_MARKERS)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
def has_vbc_block(content: str) -> bool:
|
|
96
|
-
return any(marker in content for marker in VBC_MARKERS)
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
# ─── Output helpers ───────────────────────────────────────────────────────────
|
|
100
|
-
|
|
101
|
-
def header(title: str) -> None:
|
|
102
|
-
print(f"\n{BOLD}{BLUE}━━━ {title} ━━━{RESET}")
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
def ok(msg: str) -> None:
|
|
106
|
-
print(f" {GREEN}✅ {msg}{RESET}")
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
def skip(msg: str) -> None:
|
|
110
|
-
print(f" {YELLOW}⏭️ {msg}{RESET}")
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
def warn(msg: str) -> None:
|
|
114
|
-
print(f" {YELLOW}⚠️ {msg}{RESET}")
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def fail(msg: str) -> None:
|
|
118
|
-
print(f" {RED}❌ {msg}{RESET}")
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
# ─── Core ────────────────────────────────────────────────────────────────────
|
|
122
|
-
|
|
123
|
-
def process_skill(skill_md: Path, dry_run: bool) -> str:
|
|
124
|
-
"""Process a single SKILL.md. Returns 'updated', 'skipped', or 'error'."""
|
|
125
|
-
skill_name = skill_md.parent.name
|
|
126
|
-
try:
|
|
127
|
-
content = skill_md.read_text(encoding="utf-8")
|
|
128
|
-
|
|
129
|
-
has_tribunal = has_tribunal_block(content)
|
|
130
|
-
has_vbc = has_vbc_block(content)
|
|
131
|
-
|
|
132
|
-
if has_tribunal and has_vbc:
|
|
133
|
-
skip(f"{skill_name} — already has Tribunal + VBC blocks")
|
|
134
|
-
return "skipped"
|
|
135
|
-
|
|
136
|
-
missing = []
|
|
137
|
-
if not has_tribunal:
|
|
138
|
-
missing.append("Tribunal Integration")
|
|
139
|
-
if not has_vbc:
|
|
140
|
-
missing.append("VBC Protocol")
|
|
141
|
-
|
|
142
|
-
if dry_run:
|
|
143
|
-
warn(f"[DRY RUN] {skill_name} — would add: {', '.join(missing)}")
|
|
144
|
-
return "updated"
|
|
145
|
-
|
|
146
|
-
with skill_md.open("a", encoding="utf-8") as f:
|
|
147
|
-
f.write(GUARDRAILS_BLOCK)
|
|
148
|
-
|
|
149
|
-
ok(f"{skill_name} — strengthened ({', '.join(missing)} added)")
|
|
150
|
-
return "updated"
|
|
151
|
-
|
|
152
|
-
except Exception as e:
|
|
153
|
-
fail(f"{skill_name} — {e}")
|
|
154
|
-
return "error"
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
# ─── Main ────────────────────────────────────────────────────────────────────
|
|
158
|
-
|
|
159
|
-
def main() -> None:
|
|
160
|
-
parser = argparse.ArgumentParser(
|
|
161
|
-
description="Appends Tribunal guardrails (LLM Traps + Pre-Flight + VBC) to skills missing them"
|
|
162
|
-
)
|
|
163
|
-
parser.add_argument(
|
|
164
|
-
"path",
|
|
165
|
-
nargs="?",
|
|
166
|
-
default=".",
|
|
167
|
-
help="Project root directory (default: current directory)"
|
|
168
|
-
)
|
|
169
|
-
parser.add_argument("--dry-run", action="store_true", help="Show changes without writing")
|
|
170
|
-
parser.add_argument("--skill", help="Only strengthen a specific skill by name")
|
|
171
|
-
parser.add_argument(
|
|
172
|
-
"--skills-path",
|
|
173
|
-
help="Override the skills directory path (default: <path>/.agent/skills)"
|
|
174
|
-
)
|
|
175
|
-
args = parser.parse_args()
|
|
176
|
-
|
|
177
|
-
project_root = Path(args.path).resolve()
|
|
178
|
-
skills_dir = (
|
|
179
|
-
Path(args.skills_path).resolve()
|
|
180
|
-
if args.skills_path
|
|
181
|
-
else project_root / ".agent" / "skills"
|
|
182
|
-
)
|
|
183
|
-
|
|
184
|
-
if not skills_dir.is_dir():
|
|
185
|
-
fail(f"Skills directory not found: {skills_dir}")
|
|
186
|
-
sys.exit(1)
|
|
187
|
-
|
|
188
|
-
print(f"{BOLD}Tribunal — strengthen_skills.py{RESET}")
|
|
189
|
-
if args.dry_run:
|
|
190
|
-
print(f" {YELLOW}DRY RUN — no files will be written{RESET}")
|
|
191
|
-
print(f"Skills dir: {skills_dir}\n")
|
|
192
|
-
|
|
193
|
-
counts: dict[str, int] = {"updated": 0, "skipped": 0, "error": 0}
|
|
194
|
-
|
|
195
|
-
header("Strengthening Skills")
|
|
196
|
-
for skill_dir in sorted(skills_dir.iterdir()):
|
|
197
|
-
if not skill_dir.is_dir():
|
|
198
|
-
continue
|
|
199
|
-
if args.skill and skill_dir.name != args.skill:
|
|
200
|
-
continue
|
|
201
|
-
skill_md = skill_dir / "SKILL.md"
|
|
202
|
-
if not skill_md.exists():
|
|
203
|
-
warn(f"{skill_dir.name} — no SKILL.md found")
|
|
204
|
-
continue
|
|
205
|
-
result = process_skill(skill_md, args.dry_run)
|
|
206
|
-
counts[result] += 1
|
|
207
|
-
|
|
208
|
-
print(f"\n{BOLD}━━━ Summary ━━━{RESET}")
|
|
209
|
-
print(f" {GREEN}✅ Strengthened: {counts['updated']}{RESET}")
|
|
210
|
-
print(f" {YELLOW}⏭️ Skipped: {counts['skipped']}{RESET}")
|
|
211
|
-
if counts["error"]:
|
|
212
|
-
print(f" {RED}❌ Errors: {counts['error']}{RESET}")
|
|
213
|
-
if args.dry_run:
|
|
214
|
-
print(f" {YELLOW}(dry-run — nothing written){RESET}")
|
|
215
|
-
|
|
216
|
-
sys.exit(1 if counts["error"] > 0 else 0)
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if __name__ == "__main__":
|
|
220
|
-
main()
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import re
|
|
3
|
-
|
|
4
|
-
def strip_boilerplate(file_path):
|
|
5
|
-
with open(file_path, 'r', encoding='utf-8') as f:
|
|
6
|
-
content = f.read()
|
|
7
|
-
|
|
8
|
-
original_len = len(content)
|
|
9
|
-
|
|
10
|
-
# Regex to find everything from "## 🏛️ Tribunal Integration" (or without emojis) to the end of the file or next major H1
|
|
11
|
-
# Often it appears at the end of agents
|
|
12
|
-
content = re.sub(r'## 🏛️ Tribunal Integration[\s\S]*?(?=\n# |\Z)', '', content)
|
|
13
|
-
content = re.sub(r'## Tribunal Integration[\s\S]*?(?=\n# |\Z)', '', content)
|
|
14
|
-
|
|
15
|
-
# Strip Cross-Workflow Navigation since GEMINI.md has global handling
|
|
16
|
-
content = re.sub(r'## Cross-Workflow Navigation[\s\S]*?(?=\n# |\Z)', '', content)
|
|
17
|
-
|
|
18
|
-
# Strip What the Maker Is Not Allowed to Do (it's in GEMINI.md)
|
|
19
|
-
content = re.sub(r'## What the Maker Is Not Allowed to Do[\s\S]*?(?=\n# |\Z)', '', content)
|
|
20
|
-
|
|
21
|
-
with open(file_path, 'w', encoding='utf-8') as f:
|
|
22
|
-
f.write(content.strip() + '\n')
|
|
23
|
-
|
|
24
|
-
return original_len, len(content)
|
|
25
|
-
|
|
26
|
-
def main():
|
|
27
|
-
dirs_to_check = ['.agent/agents', '.agent/workflows']
|
|
28
|
-
total_stripped = 0
|
|
29
|
-
|
|
30
|
-
for d in dirs_to_check:
|
|
31
|
-
if not os.path.exists(d): continue
|
|
32
|
-
for file in os.listdir(d):
|
|
33
|
-
if file.endswith('.md'):
|
|
34
|
-
file_path = os.path.join(d, file)
|
|
35
|
-
orig, new = strip_boilerplate(file_path)
|
|
36
|
-
total_stripped += (orig - new)
|
|
37
|
-
|
|
38
|
-
print(f"Stripped {total_stripped} bytes of repetitive boilerplate.")
|
|
39
|
-
|
|
40
|
-
if __name__ == '__main__':
|
|
41
|
-
main()
|