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
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* minify_context.js
|
|
4
|
+
* Minifies markdown documentation in the .agent directory to save tokens.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
function minifyMarkdown(filePath) {
|
|
13
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
14
|
+
const originalLen = content.length;
|
|
15
|
+
|
|
16
|
+
// 1. Strip repetitive Output Format templates
|
|
17
|
+
content = content.replace(/## Output Format\n\n```[\s\S]*?```\n/g, '');
|
|
18
|
+
|
|
19
|
+
// 2. Convert bloated Cross-Workflow Navigation tables to dense YAML lists
|
|
20
|
+
content = content.replace(/## Cross-Workflow Navigation\n\n\|.*?\|[\s\S]*?(?=\n## |\Z)/g, match => {
|
|
21
|
+
const lines = match.trim().split('\n');
|
|
22
|
+
const out = [];
|
|
23
|
+
for (const line of lines) {
|
|
24
|
+
if (line.startsWith('|') && !line.startsWith('|:') && !line.startsWith('| After')) {
|
|
25
|
+
const parts = line.split('|').map(p => p.trim()).filter(Boolean);
|
|
26
|
+
if (parts.length >= 2) {
|
|
27
|
+
out.push(`- ${parts[0]} -> ${parts[1]}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return '## Cross-Workflow Navigation\n' + out.join('\n') + '\n';
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 3. Collapse multiple empty lines into a single one
|
|
35
|
+
content = content.replace(/\n{3,}/g, '\n\n');
|
|
36
|
+
|
|
37
|
+
// 4. Remove padding from remaining tables to save space tokens
|
|
38
|
+
content = content.replace(/^\|.+|$/gm, match => {
|
|
39
|
+
let line = match;
|
|
40
|
+
// remove spaces around |
|
|
41
|
+
line = line.replace(/\s+\|\s+/g, '|');
|
|
42
|
+
line = line.replace(/\|\s+/g, '|');
|
|
43
|
+
line = line.replace(/\s+\|/g, '|');
|
|
44
|
+
return line;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// 5. Remove conversational blockquotes > if they don't contain WARNING/NOTE/IMPORTANT
|
|
48
|
+
content = content.replace(/^>.*$/gm, match => {
|
|
49
|
+
if (match.includes('⚠️') || match.includes('WARNING') || match.includes('CRITICAL') || match.includes('!')) {
|
|
50
|
+
return match;
|
|
51
|
+
}
|
|
52
|
+
return match.replace(/> /g, '').replace(/>/g, '');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 6. Dense Examples (convert ❌ Bad: and ✅ Good: blocks to single lines)
|
|
56
|
+
content = content.replace(/\n❌ Bad:/g, ' ❌');
|
|
57
|
+
content = content.replace(/\n✅ Good:/g, ' ✅');
|
|
58
|
+
|
|
59
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
60
|
+
return [originalLen, content.length];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function walkDir(dir, callback) {
|
|
64
|
+
if (!fs.existsSync(dir)) return;
|
|
65
|
+
const items = fs.readdirSync(dir, { withFileTypes: true });
|
|
66
|
+
for (const item of items) {
|
|
67
|
+
const fullPath = path.join(dir, item.name);
|
|
68
|
+
if (item.isDirectory()) {
|
|
69
|
+
walkDir(fullPath, callback);
|
|
70
|
+
} else {
|
|
71
|
+
callback(fullPath);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function main() {
|
|
77
|
+
const agentDir = path.join('.agent');
|
|
78
|
+
let totalOriginal = 0;
|
|
79
|
+
let totalNew = 0;
|
|
80
|
+
|
|
81
|
+
walkDir(agentDir, file => {
|
|
82
|
+
if (file.endsWith('.md')) {
|
|
83
|
+
const [orig, newLen] = minifyMarkdown(file);
|
|
84
|
+
totalOriginal += orig;
|
|
85
|
+
totalNew += newLen;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const saved = totalOriginal - totalNew;
|
|
90
|
+
const percent = totalOriginal > 0 ? (saved / totalOriginal * 100) : 0;
|
|
91
|
+
|
|
92
|
+
console.log("Minification Complete.");
|
|
93
|
+
console.log(`Original size: ${totalOriginal} bytes`);
|
|
94
|
+
console.log(`New size: ${totalNew} bytes`);
|
|
95
|
+
console.log(`Saved: ${saved} bytes (${percent.toFixed(1)}%)`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (require.main === module) {
|
|
99
|
+
main();
|
|
100
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* patch_skills_meta.js — Injects version/freshness metadata into SKILL.md frontmatter.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
|
|
12
|
+
|
|
13
|
+
const META_FIELDS = {
|
|
14
|
+
"version": "1.0.0",
|
|
15
|
+
"last-updated": "2026-03-12",
|
|
16
|
+
"applies-to-model": "gemini-2.5-pro, claude-3-7-sonnet"
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function header(title) { console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`); }
|
|
20
|
+
function ok(msg) { console.log(` ${GREEN}✅ ${msg}${RESET}`); }
|
|
21
|
+
function skip(msg) { console.log(` ${YELLOW}⏭️ ${msg}${RESET}`); }
|
|
22
|
+
function warn(msg) { console.log(` ${YELLOW}⚠️ ${msg}${RESET}`); }
|
|
23
|
+
function fail(msg) { console.log(` ${RED}❌ ${msg}${RESET}`); }
|
|
24
|
+
|
|
25
|
+
function patchFrontmatter(content) {
|
|
26
|
+
const added = [];
|
|
27
|
+
const fmMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
28
|
+
|
|
29
|
+
if (!fmMatch) {
|
|
30
|
+
const newFmLines = ["---"];
|
|
31
|
+
for (const [key, value] of Object.entries(META_FIELDS)) {
|
|
32
|
+
newFmLines.push(`${key}: ${value}`);
|
|
33
|
+
added.push(key);
|
|
34
|
+
}
|
|
35
|
+
newFmLines.push("---");
|
|
36
|
+
return [newFmLines.join("\n") + "\n\n" + content, added];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const fmText = fmMatch[1];
|
|
40
|
+
const fmEnd = fmMatch[0].length;
|
|
41
|
+
|
|
42
|
+
const existingKeys = new Set();
|
|
43
|
+
const lines = fmText.split("\n");
|
|
44
|
+
for (const line of lines) {
|
|
45
|
+
const m = line.match(/^([a-zA-Z0-9_-]+)\s*:/);
|
|
46
|
+
if (m) existingKeys.add(m[1]);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const newFmLines = fmText.trimEnd().split("\n");
|
|
50
|
+
for (const [key, value] of Object.entries(META_FIELDS)) {
|
|
51
|
+
if (!existingKeys.has(key)) {
|
|
52
|
+
newFmLines.push(`${key}: ${value}`);
|
|
53
|
+
added.push(key);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (added.length === 0) return [content, []];
|
|
58
|
+
|
|
59
|
+
const patched = "---\n" + newFmLines.join("\n") + "\n---" + content.slice(fmEnd);
|
|
60
|
+
return [patched, added];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function processSkill(skillPath, dryRun) {
|
|
64
|
+
const skillName = path.basename(path.dirname(skillPath));
|
|
65
|
+
try {
|
|
66
|
+
const content = fs.readFileSync(skillPath, 'utf8');
|
|
67
|
+
const [patched, added] = patchFrontmatter(content);
|
|
68
|
+
|
|
69
|
+
if (added.length === 0) {
|
|
70
|
+
skip(`${skillName} — all meta fields present`);
|
|
71
|
+
return "skipped";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const fieldList = added.join(', ');
|
|
75
|
+
if (dryRun) {
|
|
76
|
+
warn(`[DRY RUN] ${skillName} — would add: ${fieldList}`);
|
|
77
|
+
return "updated";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
fs.writeFileSync(skillPath, patched, 'utf8');
|
|
81
|
+
ok(`${skillName} — added: ${fieldList}`);
|
|
82
|
+
return "updated";
|
|
83
|
+
} catch (e) {
|
|
84
|
+
fail(`${skillName} — ${e.message}`);
|
|
85
|
+
return "error";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function main() {
|
|
90
|
+
const args = process.argv.slice(2);
|
|
91
|
+
let targetPath = null;
|
|
92
|
+
let dryRun = false;
|
|
93
|
+
let skillArg = null;
|
|
94
|
+
|
|
95
|
+
let i = 0;
|
|
96
|
+
while (i < args.length) {
|
|
97
|
+
if (args[i] === '--dry-run') dryRun = true;
|
|
98
|
+
else if (args[i] === '--skill' && i + 1 < args.length) skillArg = args[++i];
|
|
99
|
+
else if (args[i] === '-h' || args[i] === '--help') {
|
|
100
|
+
console.log("Usage: node patch_skills_meta.js <path> [--dry-run] [--skill <name>]");
|
|
101
|
+
process.exit(0);
|
|
102
|
+
} else if (!args[i].startsWith('-') && !targetPath) {
|
|
103
|
+
targetPath = args[i];
|
|
104
|
+
}
|
|
105
|
+
i++;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!targetPath) {
|
|
109
|
+
console.log("Usage: node patch_skills_meta.js <path> [--dry-run] [--skill <name>]");
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const projectRoot = path.resolve(targetPath);
|
|
114
|
+
const skillsDir = path.join(projectRoot, ".agent", "skills");
|
|
115
|
+
|
|
116
|
+
if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
|
|
117
|
+
fail(`Skills directory not found: ${skillsDir}`);
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
console.log(`${BOLD}Tribunal — patch_skills_meta.js${RESET}`);
|
|
122
|
+
if (dryRun) console.log(` ${YELLOW}DRY RUN — no files will be written${RESET}`);
|
|
123
|
+
console.log(`Skills dir: ${skillsDir}\n`);
|
|
124
|
+
|
|
125
|
+
const counts = { updated: 0, skipped: 0, error: 0 };
|
|
126
|
+
header("Patching Frontmatter");
|
|
127
|
+
|
|
128
|
+
const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
129
|
+
dirs.sort((a, b) => a.name.localeCompare(b.name));
|
|
130
|
+
|
|
131
|
+
for (const dir of dirs) {
|
|
132
|
+
if (!dir.isDirectory()) continue;
|
|
133
|
+
if (skillArg && dir.name !== skillArg) continue;
|
|
134
|
+
|
|
135
|
+
const skillMd = path.join(skillsDir, dir.name, "SKILL.md");
|
|
136
|
+
if (!fs.existsSync(skillMd)) {
|
|
137
|
+
warn(`${dir.name} — no SKILL.md found`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const result = processSkill(skillMd, dryRun);
|
|
142
|
+
counts[result]++;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(`\n${BOLD}━━━ Summary ━━━${RESET}`);
|
|
146
|
+
console.log(` ${GREEN}✅ Updated: ${counts.updated}${RESET}`);
|
|
147
|
+
console.log(` ${YELLOW}⏭️ Skipped: ${counts.skipped}${RESET}`);
|
|
148
|
+
if (counts.error > 0) console.log(` ${RED}❌ Errors: ${counts.error}${RESET}`);
|
|
149
|
+
if (dryRun) console.log(` ${YELLOW}(dry-run — nothing written)${RESET}`);
|
|
150
|
+
|
|
151
|
+
process.exit(counts.error > 0 ? 1 : 0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (require.main === module) {
|
|
155
|
+
main();
|
|
156
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* patch_skills_output.js — Adds structured Output Format sections to SKILL.md files.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const { RED, GREEN, YELLOW, BLUE, BOLD, RESET } = require('./colors.js');
|
|
12
|
+
|
|
13
|
+
const CODE_QUALITY_TEMPLATE = `\\
|
|
14
|
+
## Output Format
|
|
15
|
+
|
|
16
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
17
|
+
|
|
18
|
+
\`\`\`
|
|
19
|
+
━━━ {skill_name} Report ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
|
+
Skill: {skill_name}
|
|
21
|
+
Language: [detected language / framework]
|
|
22
|
+
Scope: [N files · N functions]
|
|
23
|
+
─────────────────────────────────────────────────
|
|
24
|
+
✅ Passed: [checks that passed, or "All clean"]
|
|
25
|
+
⚠️ Warnings: [non-blocking issues, or "None"]
|
|
26
|
+
❌ Blocked: [blocking issues requiring fix, or "None"]
|
|
27
|
+
─────────────────────────────────────────────────
|
|
28
|
+
VBC status: PENDING → VERIFIED
|
|
29
|
+
Evidence: [test output / lint pass / compile success]
|
|
30
|
+
\`\`\`
|
|
31
|
+
|
|
32
|
+
**VBC (Verification-Before-Completion) is mandatory.**
|
|
33
|
+
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
34
|
+
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const DECISION_CARD_TEMPLATE = `\\
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
When this skill produces a recommendation or design decision, structure your output as:
|
|
41
|
+
|
|
42
|
+
\`\`\`
|
|
43
|
+
━━━ {skill_name} Recommendation ━━━━━━━━━━━━━━━━
|
|
44
|
+
Decision: [what was chosen / proposed]
|
|
45
|
+
Rationale: [why — one concise line]
|
|
46
|
+
Trade-offs: [what is consciously accepted]
|
|
47
|
+
Next action: [concrete next step for the user]
|
|
48
|
+
─────────────────────────────────────────────────
|
|
49
|
+
Pre-Flight: ✅ All checks passed
|
|
50
|
+
or ❌ [blocking item that must be resolved first]
|
|
51
|
+
\`\`\`
|
|
52
|
+
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
const GENERIC_TEMPLATE = `\\
|
|
56
|
+
## Output Format
|
|
57
|
+
|
|
58
|
+
When this skill completes a task, structure your output as:
|
|
59
|
+
|
|
60
|
+
\`\`\`
|
|
61
|
+
━━━ {skill_name} Output ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
62
|
+
Task: [what was performed]
|
|
63
|
+
Result: [outcome summary — one line]
|
|
64
|
+
─────────────────────────────────────────────────
|
|
65
|
+
Checks: ✅ [N passed] · ⚠️ [N warnings] · ❌ [N blocked]
|
|
66
|
+
VBC status: PENDING → VERIFIED
|
|
67
|
+
Evidence: [link to terminal output, test result, or file diff]
|
|
68
|
+
\`\`\`
|
|
69
|
+
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
const CODE_GEN_SKILLS = new Set([
|
|
73
|
+
"python-pro", "clean-code", "dotnet-core-expert", "rust-pro",
|
|
74
|
+
"nextjs-react-expert", "vue-expert", "react-specialist",
|
|
75
|
+
"csharp-developer", "nodejs-best-practices", "python-patterns",
|
|
76
|
+
"tailwind-patterns", "bash-linux", "powershell-windows",
|
|
77
|
+
"llm-engineering", "mcp-builder", "game-development",
|
|
78
|
+
"edge-computing", "local-first", "realtime-patterns",
|
|
79
|
+
"tdd-workflow", "testing-patterns", "lint-and-validate",
|
|
80
|
+
]);
|
|
81
|
+
|
|
82
|
+
const DECISION_SKILLS = new Set([
|
|
83
|
+
"api-patterns", "database-design", "architecture", "observability",
|
|
84
|
+
"devops-engineer", "platform-engineer", "deployment-procedures",
|
|
85
|
+
"server-management", "security-auditor", "vulnerability-scanner",
|
|
86
|
+
"red-team-tactics", "performance-profiling", "i18n-localization",
|
|
87
|
+
"geo-fundamentals", "seo-fundamentals", "sql-pro",
|
|
88
|
+
"brainstorming", "plan-writing", "behavioral-modes",
|
|
89
|
+
"app-builder", "intelligent-routing", "mobile-design",
|
|
90
|
+
"frontend-design", "ui-ux-pro-max", "ui-ux-researcher",
|
|
91
|
+
"web-design-guidelines", "trend-researcher",
|
|
92
|
+
]);
|
|
93
|
+
|
|
94
|
+
const ALREADY_HAVE_OUTPUT = new Set([
|
|
95
|
+
"whimsy-injector", "workflow-optimizer",
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
const EXISTING_OUTPUT_MARKERS = [
|
|
99
|
+
"## Output Format",
|
|
100
|
+
"## Output\n",
|
|
101
|
+
"## Report Format",
|
|
102
|
+
"## Output Card",
|
|
103
|
+
"Whimsy Injection Report",
|
|
104
|
+
"Workflow Optimization Report",
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
function getTemplate(skillName) {
|
|
108
|
+
if (CODE_GEN_SKILLS.has(skillName)) return CODE_QUALITY_TEMPLATE;
|
|
109
|
+
if (DECISION_SKILLS.has(skillName)) return DECISION_CARD_TEMPLATE;
|
|
110
|
+
return GENERIC_TEMPLATE;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function hasOutputSection(content) {
|
|
114
|
+
return EXISTING_OUTPUT_MARKERS.some(m => content.includes(m));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function getSkillNameFromFrontmatter(content) {
|
|
118
|
+
const match = content.match(/^name:\s*(.+)$/m);
|
|
119
|
+
return match ? match[1].trim() : null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function buildBlock(template, skillName) {
|
|
123
|
+
const display = skillName.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
|
124
|
+
// Handle the slash escaping issue using regular replace
|
|
125
|
+
const tplStr = template.replace(/^\\/, '');
|
|
126
|
+
return tplStr.replace(/{skill_name}/g, display);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function injectOutputBlock(content, block) {
|
|
130
|
+
const tribunalMarkers = [
|
|
131
|
+
"## 🏛️ Tribunal Integration",
|
|
132
|
+
"## Tribunal Integration",
|
|
133
|
+
];
|
|
134
|
+
for (const marker of tribunalMarkers) {
|
|
135
|
+
const idx = content.indexOf(marker);
|
|
136
|
+
if (idx !== -1) {
|
|
137
|
+
return content.substring(0, idx) + block + "\n---\n\n" + content.substring(idx);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return content.trimEnd() + "\n\n---\n\n" + block;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function header(title) { console.log(`\n${BOLD}${BLUE}━━━ ${title} ━━━${RESET}`); }
|
|
144
|
+
function ok(msg) { console.log(` ${GREEN}✅ ${msg}${RESET}`); }
|
|
145
|
+
function skip(msg) { console.log(` ${YELLOW}⏭️ ${msg}${RESET}`); }
|
|
146
|
+
function warn(msg) { console.log(` ${YELLOW}⚠️ ${msg}${RESET}`); }
|
|
147
|
+
function fail(msg) { console.log(` ${RED}❌ ${msg}${RESET}`); }
|
|
148
|
+
|
|
149
|
+
function processSkill(skillDir, dryRun) {
|
|
150
|
+
const skillName = path.basename(skillDir);
|
|
151
|
+
const skillMd = path.join(skillDir, "SKILL.md");
|
|
152
|
+
|
|
153
|
+
if (!fs.existsSync(skillMd)) return "skipped";
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
const content = fs.readFileSync(skillMd, 'utf8');
|
|
157
|
+
|
|
158
|
+
if (ALREADY_HAVE_OUTPUT.has(skillName) || hasOutputSection(content)) {
|
|
159
|
+
skip(`${skillName} — output format already present`);
|
|
160
|
+
return "skipped";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const displayName = getSkillNameFromFrontmatter(content) || skillName;
|
|
164
|
+
const template = getTemplate(skillName);
|
|
165
|
+
const block = buildBlock(template, displayName);
|
|
166
|
+
const patched = injectOutputBlock(content, block);
|
|
167
|
+
|
|
168
|
+
const templateType = CODE_GEN_SKILLS.has(skillName) ? "Code Quality" : (DECISION_SKILLS.has(skillName) ? "Decision Card" : "Generic");
|
|
169
|
+
|
|
170
|
+
if (dryRun) {
|
|
171
|
+
warn(`[DRY RUN] ${skillName} — would add Output Format (${templateType})`);
|
|
172
|
+
return "updated";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
fs.writeFileSync(skillMd, patched, 'utf8');
|
|
176
|
+
ok(`${skillName} — added Output Format (${templateType})`);
|
|
177
|
+
return "updated";
|
|
178
|
+
} catch (e) {
|
|
179
|
+
fail(`${skillName} — ${e.message}`);
|
|
180
|
+
return "error";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function main() {
|
|
185
|
+
const args = process.argv.slice(2);
|
|
186
|
+
let targetPath = null;
|
|
187
|
+
let dryRun = false;
|
|
188
|
+
let skillArg = null;
|
|
189
|
+
|
|
190
|
+
let i = 0;
|
|
191
|
+
while (i < args.length) {
|
|
192
|
+
if (args[i] === '--dry-run') dryRun = true;
|
|
193
|
+
else if (args[i] === '--skill' && i + 1 < args.length) skillArg = args[++i];
|
|
194
|
+
else if (args[i] === '-h' || args[i] === '--help') {
|
|
195
|
+
console.log("Usage: node patch_skills_output.js <path> [--dry-run] [--skill <name>]");
|
|
196
|
+
process.exit(0);
|
|
197
|
+
} else if (!args[i].startsWith('-') && !targetPath) {
|
|
198
|
+
targetPath = args[i];
|
|
199
|
+
}
|
|
200
|
+
i++;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!targetPath) {
|
|
204
|
+
console.log("Usage: node patch_skills_output.js <path> [--dry-run] [--skill <name>]");
|
|
205
|
+
process.exit(1);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const projectRoot = path.resolve(targetPath);
|
|
209
|
+
const skillsDir = path.join(projectRoot, ".agent", "skills");
|
|
210
|
+
|
|
211
|
+
if (!fs.existsSync(skillsDir) || !fs.statSync(skillsDir).isDirectory()) {
|
|
212
|
+
fail(`Skills directory not found: ${skillsDir}`);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
console.log(`${BOLD}Tribunal — patch_skills_output.js${RESET}`);
|
|
217
|
+
if (dryRun) console.log(` ${YELLOW}DRY RUN — no files will be written${RESET}`);
|
|
218
|
+
console.log(`Skills dir: ${skillsDir}\n`);
|
|
219
|
+
|
|
220
|
+
const counts = { updated: 0, skipped: 0, error: 0 };
|
|
221
|
+
header("Patching Output Format Sections");
|
|
222
|
+
|
|
223
|
+
const dirs = fs.readdirSync(skillsDir, { withFileTypes: true });
|
|
224
|
+
dirs.sort((a, b) => a.name.localeCompare(b.name));
|
|
225
|
+
|
|
226
|
+
for (const dir of dirs) {
|
|
227
|
+
if (!dir.isDirectory()) continue;
|
|
228
|
+
if (skillArg && dir.name !== skillArg) continue;
|
|
229
|
+
const result = processSkill(path.join(skillsDir, dir.name), dryRun);
|
|
230
|
+
counts[result]++;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
console.log(`\n${BOLD}━━━ Summary ━━━${RESET}`);
|
|
234
|
+
console.log(` ${GREEN}✅ Updated: ${counts.updated}${RESET}`);
|
|
235
|
+
console.log(` ${YELLOW}⏭️ Skipped: ${counts.skipped}${RESET}`);
|
|
236
|
+
if (counts.error > 0) console.log(` ${RED}❌ Errors: ${counts.error}${RESET}`);
|
|
237
|
+
if (dryRun) console.log(` ${YELLOW}(dry-run — nothing written)${RESET}`);
|
|
238
|
+
|
|
239
|
+
process.exit(counts.error > 0 ? 1 : 0);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (require.main === module) {
|
|
243
|
+
main();
|
|
244
|
+
}
|