tribunal-kit 8.0.0 → 9.0.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 +2 -2
- package/.agent/config/plugin.json +4 -4
- package/.agent/config/system-prompt.md +54 -1
- package/.agent/routing_index.json +2 -2
- package/.agent/skills/12-principles-of-animation/SKILL.md +19 -16
- package/.agent/skills/60fps-animation/SKILL.md +47 -21
- package/.agent/skills/accessible-animation/SKILL.md +19 -16
- package/.agent/skills/adapt/SKILL.md +19 -16
- package/.agent/skills/advanced-rag-pipelines/SKILL.md +41 -40
- package/.agent/skills/agent-organizer/SKILL.md +9 -59
- package/.agent/skills/agentic-patterns/SKILL.md +9 -57
- package/.agent/skills/agentic-workflows-2026/SKILL.md +45 -8
- package/.agent/skills/ai-app-hardening/SKILL.md +31 -5
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +28 -66
- package/.agent/skills/animation-on-scroll/SKILL.md +19 -16
- package/.agent/skills/animation-systems/SKILL.md +19 -15
- package/.agent/skills/antfu-conventions/SKILL.md +19 -18
- package/.agent/skills/api-patterns/SKILL.md +8 -58
- package/.agent/skills/api-security-auditor/SKILL.md +8 -58
- package/.agent/skills/app-builder/SKILL.md +9 -59
- package/.agent/skills/appflow-wireframe/SKILL.md +13 -57
- package/.agent/skills/apple-design/SKILL.md +22 -14
- package/.agent/skills/architecture/SKILL.md +9 -59
- package/.agent/skills/audit-and-fix/SKILL.md +19 -16
- package/.agent/skills/authentication-best-practices/SKILL.md +8 -58
- package/.agent/skills/backend-security-expert/SKILL.md +32 -65
- package/.agent/skills/baseline-ui/SKILL.md +22 -14
- package/.agent/skills/bash-linux/SKILL.md +9 -59
- package/.agent/skills/behavioral-modes/SKILL.md +9 -57
- package/.agent/skills/better-colors/SKILL.md +22 -14
- package/.agent/skills/better-typography/SKILL.md +26 -14
- package/.agent/skills/better-ui/SKILL.md +54 -19
- package/.agent/skills/bolder/SKILL.md +19 -16
- package/.agent/skills/brainstorming/SKILL.md +9 -57
- package/.agent/skills/browser-native-ai/SKILL.md +9 -28
- package/.agent/skills/build-primitive/SKILL.md +19 -16
- package/.agent/skills/building-native-ui/SKILL.md +9 -59
- package/.agent/skills/cicd-pro/SKILL.md +21 -28
- package/.agent/skills/clarify/SKILL.md +19 -16
- package/.agent/skills/clean-code/SKILL.md +18 -61
- package/.agent/skills/cloud-architect/SKILL.md +21 -28
- package/.agent/skills/cobejs/SKILL.md +19 -15
- package/.agent/skills/code-review-checklist/SKILL.md +8 -58
- package/.agent/skills/codebase-design/SKILL.md +33 -22
- package/.agent/skills/colorize/SKILL.md +19 -16
- package/.agent/skills/compact-landing/SKILL.md +19 -16
- package/.agent/skills/company-logos/SKILL.md +19 -16
- package/.agent/skills/config-validator/SKILL.md +9 -59
- package/.agent/skills/containerization-pro/SKILL.md +21 -28
- package/.agent/skills/context-engineering-pro/SKILL.md +31 -5
- package/.agent/skills/create-design-md/SKILL.md +22 -14
- package/.agent/skills/critique/SKILL.md +20 -11
- package/.agent/skills/csharp-developer/SKILL.md +8 -58
- package/.agent/skills/data-validation-schemas/SKILL.md +9 -59
- package/.agent/skills/database-design/SKILL.md +27 -67
- package/.agent/skills/delight/SKILL.md +19 -16
- package/.agent/skills/deployment-procedures/SKILL.md +9 -59
- package/.agent/skills/design-lab/SKILL.md +19 -16
- package/.agent/skills/devops-engineer/SKILL.md +8 -58
- package/.agent/skills/devops-incident-responder/SKILL.md +9 -59
- package/.agent/skills/diagnosing-bugs/SKILL.md +20 -21
- package/.agent/skills/distill/SKILL.md +19 -16
- package/.agent/skills/documentation-templates/SKILL.md +9 -59
- package/.agent/skills/domain-modeling/SKILL.md +19 -18
- package/.agent/skills/duckdb-analytical-sql/SKILL.md +31 -5
- package/.agent/skills/edge-ai-mobile/SKILL.md +31 -5
- package/.agent/skills/edge-computing/SKILL.md +9 -59
- package/.agent/skills/emil-design-eng/SKILL.md +21 -24
- package/.agent/skills/error-resilience/SKILL.md +31 -66
- package/.agent/skills/expo-router-v4/SKILL.md +31 -5
- package/.agent/skills/extract-design-system/SKILL.md +9 -59
- package/.agent/skills/fabel-protocol/SKILL.md +26 -8
- package/.agent/skills/fixing-accessibility/SKILL.md +22 -14
- package/.agent/skills/fixing-metadata/SKILL.md +19 -16
- package/.agent/skills/fixing-motion-performance/SKILL.md +22 -14
- package/.agent/skills/framer-motion-expert/SKILL.md +9 -57
- package/.agent/skills/frontend-design/SKILL.md +27 -7
- package/.agent/skills/frontend-security-expert/SKILL.md +8 -58
- package/.agent/skills/game-design-expert/SKILL.md +9 -59
- package/.agent/skills/game-engineering-expert/SKILL.md +9 -59
- package/.agent/skills/generative-ui-expert/SKILL.md +9 -28
- package/.agent/skills/geo-fundamentals/SKILL.md +9 -59
- package/.agent/skills/git-pro/SKILL.md +19 -30
- package/.agent/skills/github-operations/SKILL.md +8 -58
- package/.agent/skills/gpt-taste/SKILL.md +19 -16
- package/.agent/skills/gsap-core/SKILL.md +8 -78
- package/.agent/skills/gsap-frameworks/SKILL.md +8 -78
- package/.agent/skills/gsap-performance/SKILL.md +9 -77
- package/.agent/skills/gsap-plugins/SKILL.md +9 -77
- package/.agent/skills/gsap-react/SKILL.md +9 -21
- package/.agent/skills/gsap-scrolltrigger/SKILL.md +8 -78
- package/.agent/skills/gsap-timeline/SKILL.md +9 -77
- package/.agent/skills/gsap-utils/SKILL.md +9 -77
- package/.agent/skills/harden/SKILL.md +19 -16
- package/.agent/skills/harness-protocol/SKILL.md +9 -21
- package/.agent/skills/i18n-localization/SKILL.md +9 -59
- package/.agent/skills/impeccable/SKILL.md +19 -18
- package/.agent/skills/improve-codebase-architecture/SKILL.md +19 -17
- package/.agent/skills/improve-ui/SKILL.md +22 -14
- package/.agent/skills/intelligent-routing/SKILL.md +9 -23
- package/.agent/skills/knowledge-graph/SKILL.md +9 -21
- package/.agent/skills/landing-page/SKILL.md +19 -16
- package/.agent/skills/lint-and-validate/SKILL.md +9 -59
- package/.agent/skills/llm-engineering/SKILL.md +8 -58
- package/.agent/skills/local-first/SKILL.md +9 -59
- package/.agent/skills/local-first-architecture/SKILL.md +37 -20
- package/.agent/skills/lottie-animation/SKILL.md +19 -15
- package/.agent/skills/marquee-loop/SKILL.md +19 -16
- package/.agent/skills/masked-reveal/SKILL.md +19 -15
- package/.agent/skills/mcp-builder/SKILL.md +9 -59
- package/.agent/skills/micro-interaction/SKILL.md +19 -16
- package/.agent/skills/mobile-design/SKILL.md +8 -58
- package/.agent/skills/monorepo-management/SKILL.md +9 -59
- package/.agent/skills/morphing-icons/SKILL.md +19 -15
- package/.agent/skills/motion-engineering/SKILL.md +22 -15
- package/.agent/skills/nextjs-react-expert/SKILL.md +35 -67
- package/.agent/skills/nodejs-best-practices/SKILL.md +34 -61
- package/.agent/skills/observability/SKILL.md +8 -58
- package/.agent/skills/opentelemetry-observability/SKILL.md +31 -5
- package/.agent/skills/page-transition-animation/SKILL.md +19 -16
- package/.agent/skills/parallel-agents/SKILL.md +9 -59
- package/.agent/skills/performance-profiling/SKILL.md +8 -58
- package/.agent/skills/plan-writing/SKILL.md +36 -69
- package/.agent/skills/platform-engineer/SKILL.md +9 -59
- package/.agent/skills/platform-engineering-opentofu/SKILL.md +31 -5
- package/.agent/skills/playwright-ai-e2e/SKILL.md +31 -5
- package/.agent/skills/playwright-best-practices/SKILL.md +9 -59
- package/.agent/skills/polish/SKILL.md +19 -16
- package/.agent/skills/powershell-windows/SKILL.md +8 -58
- package/.agent/skills/pricing-page/SKILL.md +19 -16
- package/.agent/skills/product-aware-heuristics/SKILL.md +27 -8
- package/.agent/skills/progressive-blur/SKILL.md +19 -16
- package/.agent/skills/project-idioms/SKILL.md +9 -59
- package/.agent/skills/property-based-testing/SKILL.md +31 -5
- package/.agent/skills/python-patterns/SKILL.md +9 -59
- package/.agent/skills/python-pro/SKILL.md +35 -67
- package/.agent/skills/quieter/SKILL.md +19 -16
- package/.agent/skills/react-doctor/SKILL.md +19 -16
- package/.agent/skills/react-specialist/SKILL.md +26 -65
- package/.agent/skills/readme-builder/SKILL.md +9 -59
- package/.agent/skills/realtime-patterns/SKILL.md +8 -58
- package/.agent/skills/red-team-tactics/SKILL.md +9 -59
- package/.agent/skills/redesign-skill/SKILL.md +19 -16
- package/.agent/skills/review-animations/SKILL.md +21 -25
- package/.agent/skills/rust-pro/SKILL.md +30 -61
- package/.agent/skills/seo-fundamentals/SKILL.md +9 -59
- package/.agent/skills/server-management/SKILL.md +9 -59
- package/.agent/skills/shadcn-ui-expert/SKILL.md +9 -59
- package/.agent/skills/shape/SKILL.md +19 -16
- package/.agent/skills/skill-creator/SKILL.md +36 -86
- package/.agent/skills/soft-skill/SKILL.md +19 -16
- package/.agent/skills/sounds-on-the-web/SKILL.md +19 -16
- package/.agent/skills/sql-pro/SKILL.md +47 -62
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +9 -59
- package/.agent/skills/svg-animation/SKILL.md +19 -15
- package/.agent/skills/swiftui-expert/SKILL.md +9 -59
- package/.agent/skills/swiss-design/SKILL.md +19 -16
- package/.agent/skills/system-design-pro/SKILL.md +21 -26
- package/.agent/skills/systematic-debugging/SKILL.md +19 -60
- package/.agent/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/.agent/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/.agent/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +8 -58
- package/.agent/skills/taste-skill/SKILL.md +19 -16
- package/.agent/skills/tdd-workflow/SKILL.md +65 -25
- package/.agent/skills/test-result-analyzer/SKILL.md +9 -59
- package/.agent/skills/testing-patterns/SKILL.md +8 -58
- package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +19 -18
- package/.agent/skills/thinking-protocol/SKILL.md +33 -2
- package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +19 -15
- package/.agent/skills/transitions-dev/SKILL.md +19 -15
- package/.agent/skills/trend-researcher/SKILL.md +9 -59
- package/.agent/skills/typescript-advanced/SKILL.md +21 -64
- package/.agent/skills/typeset/SKILL.md +19 -16
- package/.agent/skills/ui-reasoning-engine/SKILL.md +27 -8
- package/.agent/skills/ui-skill-packs/SKILL.md +26 -16
- package/.agent/skills/ui-skills-root/SKILL.md +22 -14
- package/.agent/skills/ui-ux-pro-max/SKILL.md +38 -12
- package/.agent/skills/ui-ux-researcher/SKILL.md +9 -59
- package/.agent/skills/vector-search-pgvector/SKILL.md +31 -5
- package/.agent/skills/verification-before-completion/SKILL.md +125 -0
- package/.agent/skills/vue-expert/SKILL.md +9 -57
- package/.agent/skills/vulnerability-scanner/SKILL.md +8 -58
- package/.agent/skills/web-accessibility-auditor/SKILL.md +9 -59
- package/.agent/skills/web-design-guidelines/SKILL.md +27 -7
- package/.agent/skills/web-quality-audit/SKILL.md +19 -16
- package/.agent/skills/webapp-testing/SKILL.md +9 -59
- package/.agent/skills/webgpu-performance/SKILL.md +9 -28
- package/.agent/skills/whimsy-injector/SKILL.md +9 -57
- package/.agent/skills/workflow-optimizer/SKILL.md +9 -57
- package/.agent/skills/zero-trust-passkeys/SKILL.md +31 -5
- package/.agent/templates/DESIGN.md +680 -160
- package/.agent/templates/sdd/implementer-prompt.md +53 -0
- package/.agent/templates/sdd/re-review-prompt.md +28 -0
- package/.agent/templates/sdd/task-reviewer-prompt.md +59 -0
- package/.agent/workflows/acf.md +4 -0
- package/.agent/workflows/api-tester.md +5 -0
- package/.agent/workflows/audit.md +5 -0
- package/.agent/workflows/brainstorm.md +17 -1
- package/.agent/workflows/changelog.md +5 -0
- package/.agent/workflows/contract.md +19 -0
- package/.agent/workflows/create.md +6 -1
- package/.agent/workflows/debug.md +5 -0
- package/.agent/workflows/deploy.md +6 -1
- package/.agent/workflows/enhance.md +6 -1
- package/.agent/workflows/fix-ci.md +5 -0
- package/.agent/workflows/fix.md +5 -0
- package/.agent/workflows/generate.md +5 -0
- package/.agent/workflows/marathon.md +6 -1
- package/.agent/workflows/migrate.md +5 -0
- package/.agent/workflows/minimal.md +4 -0
- package/.agent/workflows/orchestrate.md +6 -1
- package/.agent/workflows/performance-benchmarker.md +6 -1
- package/.agent/workflows/pipeline.md +5 -0
- package/.agent/workflows/plan.md +6 -1
- package/.agent/workflows/preview.md +6 -1
- package/.agent/workflows/refactor.md +6 -0
- package/.agent/workflows/review-ai.md +5 -0
- package/.agent/workflows/review.md +5 -0
- package/.agent/workflows/sdd.md +122 -0
- package/.agent/workflows/session.md +5 -0
- package/.agent/workflows/status.md +4 -0
- package/.agent/workflows/super-prompt.md +4 -0
- package/.agent/workflows/swarm.md +6 -1
- package/.agent/workflows/test.md +6 -1
- package/.agent/workflows/tribunal-backend.md +5 -0
- package/.agent/workflows/tribunal-cicd.md +5 -0
- package/.agent/workflows/tribunal-database.md +5 -0
- package/.agent/workflows/tribunal-full.md +8 -0
- package/.agent/workflows/tribunal-mobile.md +5 -0
- package/.agent/workflows/tribunal-performance.md +5 -0
- package/.agent/workflows/tribunal-speed.md +5 -0
- package/.agent/workflows/tribunal-ui.md +7 -0
- package/.agents/plugins/marketplace.json +20 -0
- package/.claude-plugin/marketplace.json +17 -0
- package/.claude-plugin/plugin.json +26 -0
- package/.codex-plugin/plugin.json +45 -0
- package/.cursor-plugin/plugin.json +26 -0
- package/.devin-plugin/plugin.json +14 -0
- package/.hermes-plugin/__init__.py +102 -0
- package/.hermes-plugin/plugin.yaml +6 -0
- package/.kimi-plugin/plugin.json +38 -0
- package/.opencode/INSTALL.md +41 -0
- package/.opencode/plugins/tribunal.js +101 -0
- package/.pi/extensions/tribunal.ts +133 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +246 -221
- package/bin/wrapper.js +1 -0
- package/dist/cli.js +355 -355
- package/dist/esm/index.mjs +142 -142
- package/dist/index.d.ts +349 -343
- package/gemini-extension.json +6 -0
- package/hooks/hooks-cursor.json +16 -0
- package/hooks/hooks.json +16 -0
- package/hooks/session-start.js +77 -0
- package/package.json +165 -146
- package/scripts/audit_skill_sdo.js +87 -0
- package/scripts/modernize_skills.js +254 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Installing Tribunal Kit for OpenCode
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
- [OpenCode.ai](https://opencode.ai) installed
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add Tribunal Kit to the `plugin` array in your `opencode.json` (global or project-level):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"plugin": ["tribunal-kit@latest"]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or install from git:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"plugin": ["tribunal-kit@git+https://github.com/sunrise/tribunal-kit.git"]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Restart OpenCode. The plugin registers all 184 Tribunal skills and auto-injects Master Governance rules on session start.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Use OpenCode's native `skill` tool:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
use skill tool to list skills
|
|
33
|
+
use skill tool to load tdd-workflow
|
|
34
|
+
use skill tool to load verification-before-completion
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Subagent-Driven Development (SDD)
|
|
38
|
+
|
|
39
|
+
OpenCode delegates tasks to subagents via the `task` tool:
|
|
40
|
+
- Implementers execute tasks following `.tribunal/sdd/<plan>/task-<N>-brief.md`.
|
|
41
|
+
- Reviewers evaluate diffs via `tk sdd diff` out-of-band.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tribunal Kit plugin for OpenCode.ai
|
|
3
|
+
*
|
|
4
|
+
* Injects Tribunal Master Governance bootstrap context via message transform.
|
|
5
|
+
* Auto-registers skills directory via config hook (no symlinks needed).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import { fileURLToPath } from 'url';
|
|
11
|
+
|
|
12
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
|
|
14
|
+
const extractAndStripFrontmatter = (content) => {
|
|
15
|
+
const match = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
16
|
+
if (!match) return { frontmatter: {}, content };
|
|
17
|
+
|
|
18
|
+
const frontmatterStr = match[1];
|
|
19
|
+
const body = match[2];
|
|
20
|
+
const frontmatter = {};
|
|
21
|
+
|
|
22
|
+
for (const line of frontmatterStr.split('\n')) {
|
|
23
|
+
const colonIdx = line.indexOf(':');
|
|
24
|
+
if (colonIdx > 0) {
|
|
25
|
+
const key = line.slice(0, colonIdx).trim();
|
|
26
|
+
const value = line.slice(colonIdx + 1).trim().replace(/^["']|["']$/g, '');
|
|
27
|
+
frontmatter[key] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return { frontmatter, content: body };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let _bootstrapCache = undefined;
|
|
35
|
+
|
|
36
|
+
export const TribunalPlugin = async ({ client: _client, directory: _directory } = {}) => {
|
|
37
|
+
const packageRoot = path.resolve(__dirname, '../..');
|
|
38
|
+
const tribunalSkillsDir = path.join(packageRoot, '.agent', 'skills');
|
|
39
|
+
const rulesPath = path.join(packageRoot, '.agent', 'rules', 'GEMINI.md');
|
|
40
|
+
|
|
41
|
+
const getBootstrapContent = () => {
|
|
42
|
+
if (_bootstrapCache !== undefined) return _bootstrapCache;
|
|
43
|
+
|
|
44
|
+
let rulesContent = '';
|
|
45
|
+
if (fs.existsSync(rulesPath)) {
|
|
46
|
+
const raw = fs.readFileSync(rulesPath, 'utf8');
|
|
47
|
+
const { content } = extractAndStripFrontmatter(raw);
|
|
48
|
+
rulesContent = content;
|
|
49
|
+
} else {
|
|
50
|
+
rulesContent = '# Tribunal Kit Master Governance Active\nEnforce strict TDD, out-of-band reviews, and 28-specialist waves.';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const toolMapping = `**Tool Mapping for OpenCode:**
|
|
54
|
+
When skills or tribunal workflows request actions, map them to OpenCode tools:
|
|
55
|
+
- Create or update tasks/todos → \`todowrite\`
|
|
56
|
+
- Subagent dispatches → \`task\` with \`subagent_type: "general"\` (or \`"explore"\` for read-only exploration)
|
|
57
|
+
- Invoke a skill → OpenCode's native \`skill\` tool
|
|
58
|
+
- Read files → \`read\`
|
|
59
|
+
- Create, edit, or delete files → \`apply_patch\`
|
|
60
|
+
- Run shell commands → \`bash\`
|
|
61
|
+
- Search files → \`grep\`, \`glob\`
|
|
62
|
+
- Fetch a URL → \`webfetch\`
|
|
63
|
+
- Tribunal SDD commands → run via \`bash\` (\`tk sdd brief\`, \`tk sdd diff\`)`;
|
|
64
|
+
|
|
65
|
+
_bootstrapCache = `<EXTREMELY_IMPORTANT>
|
|
66
|
+
Tribunal Kit Master Governance is active.
|
|
67
|
+
|
|
68
|
+
**IMPORTANT: The master governance rules and verification protocols are loaded for this session. Follow them strictly.**
|
|
69
|
+
|
|
70
|
+
${rulesContent}
|
|
71
|
+
|
|
72
|
+
${toolMapping}
|
|
73
|
+
</EXTREMELY_IMPORTANT>`;
|
|
74
|
+
|
|
75
|
+
return _bootstrapCache;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return {
|
|
79
|
+
config: async (config) => {
|
|
80
|
+
config.skills = config.skills || {};
|
|
81
|
+
config.skills.paths = config.skills.paths || [];
|
|
82
|
+
if (!config.skills.paths.includes(tribunalSkillsDir)) {
|
|
83
|
+
config.skills.paths.push(tribunalSkillsDir);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
'experimental.chat.messages.transform': async (_input, output) => {
|
|
88
|
+
const bootstrap = getBootstrapContent();
|
|
89
|
+
if (!bootstrap || !output.messages || !output.messages.length) return;
|
|
90
|
+
const firstUser = output.messages.find(m => m.info && m.info.role === 'user');
|
|
91
|
+
if (!firstUser || !firstUser.parts || !firstUser.parts.length) return;
|
|
92
|
+
|
|
93
|
+
if (firstUser.parts.some(p => p.type === 'text' && p.text && p.text.includes('EXTREMELY_IMPORTANT'))) return;
|
|
94
|
+
|
|
95
|
+
const ref = firstUser.parts[0];
|
|
96
|
+
firstUser.parts.unshift({ ...ref, type: 'text', text: bootstrap });
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export default TribunalPlugin;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
export interface ExtensionAPI {
|
|
6
|
+
on(event: string, handler: (payload?: any) => Promise<any> | any): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const EXTREMELY_IMPORTANT_MARKER = "<EXTREMELY_IMPORTANT>";
|
|
10
|
+
const BOOTSTRAP_MARKER = "tribunal-kit:master-governance bootstrap for pi";
|
|
11
|
+
|
|
12
|
+
const extensionDir = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const packageRoot = resolve(extensionDir, "../..");
|
|
14
|
+
const skillsDir = resolve(packageRoot, ".agent", "skills");
|
|
15
|
+
const rulesPath = resolve(packageRoot, ".agent", "rules", "GEMINI.md");
|
|
16
|
+
|
|
17
|
+
let cachedBootstrap: string | null | undefined;
|
|
18
|
+
|
|
19
|
+
export default function tribunalPiExtension(pi: ExtensionAPI) {
|
|
20
|
+
let injectBootstrap = true;
|
|
21
|
+
|
|
22
|
+
pi.on("resources_discover", async () => ({
|
|
23
|
+
skillPaths: [skillsDir],
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
pi.on("session_start", async () => {
|
|
27
|
+
injectBootstrap = true;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
pi.on("session_compact", async () => {
|
|
31
|
+
injectBootstrap = true;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
pi.on("agent_end", async () => {
|
|
35
|
+
injectBootstrap = false;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
pi.on("context", async (event: any) => {
|
|
39
|
+
if (!injectBootstrap) return;
|
|
40
|
+
if (event?.messages?.some(messageContainsBootstrap)) return;
|
|
41
|
+
|
|
42
|
+
const bootstrap = getBootstrapContent();
|
|
43
|
+
if (!bootstrap) return;
|
|
44
|
+
|
|
45
|
+
const bootstrapMessage = {
|
|
46
|
+
role: "user" as const,
|
|
47
|
+
content: [{ type: "text" as const, text: bootstrap }],
|
|
48
|
+
timestamp: Date.now(),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const messages = event?.messages || [];
|
|
52
|
+
const insertAt = firstNonCompactionSummaryIndex(messages);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
messages: [
|
|
56
|
+
...messages.slice(0, insertAt),
|
|
57
|
+
bootstrapMessage,
|
|
58
|
+
...messages.slice(insertAt),
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function getBootstrapContent(): string | null {
|
|
65
|
+
if (cachedBootstrap !== undefined) return cachedBootstrap;
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
let body = "";
|
|
69
|
+
if (existsSync(rulesPath)) {
|
|
70
|
+
const raw = readFileSync(rulesPath, "utf8");
|
|
71
|
+
body = stripFrontmatter(raw);
|
|
72
|
+
} else {
|
|
73
|
+
body = "# Tribunal Kit Master Governance Active\nEnforce strict TDD and 28-specialist reviewer waves.";
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
cachedBootstrap = `${EXTREMELY_IMPORTANT_MARKER}
|
|
77
|
+
${BOOTSTRAP_MARKER}
|
|
78
|
+
|
|
79
|
+
Tribunal Agent Kit Master Governance is active.
|
|
80
|
+
|
|
81
|
+
The master rules and verification protocols are loaded for this Pi session. Follow them now.
|
|
82
|
+
|
|
83
|
+
${body}
|
|
84
|
+
|
|
85
|
+
${piToolMapping()}
|
|
86
|
+
</EXTREMELY_IMPORTANT>`;
|
|
87
|
+
return cachedBootstrap;
|
|
88
|
+
} catch {
|
|
89
|
+
cachedBootstrap = null;
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function stripFrontmatter(content: string): string {
|
|
95
|
+
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
96
|
+
return (match ? match[1] : content).trim();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function piToolMapping(): string {
|
|
100
|
+
return `## Pi Tool Mapping for Tribunal Kit
|
|
101
|
+
|
|
102
|
+
Pi has native skills support. When a Tribunal rule or skill applies, load the relevant \`SKILL.md\` with \`read\`, or let a user invoke \`/skill:name\` explicitly.
|
|
103
|
+
|
|
104
|
+
Pi's built-in coding tools are lowercase: \`read\`, \`write\`, \`edit\`, \`bash\`, plus optional \`grep\`, \`find\`, and \`ls\`. Use those for the corresponding actions: read a file, create or edit files, run shell commands, search file contents, find files by name, and list directories.
|
|
105
|
+
|
|
106
|
+
Subagent-Driven Development (SDD):
|
|
107
|
+
- To run SDD preparation: use \`bash\` to invoke \`tk sdd brief <plan-path> <task-number>\`.
|
|
108
|
+
- To generate review diffs: use \`bash\` to invoke \`tk sdd diff <plan-path> <base-sha> <head-sha>\`.
|
|
109
|
+
- When delegating to subagents via \`pi-subagents\` or similar tools, supply the generated \`task-<N>-brief.md\` out-of-band and enforce the Iron Law of TDD.`;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function messageContainsBootstrap(message: unknown): boolean {
|
|
113
|
+
const content = (message as { content?: unknown })?.content;
|
|
114
|
+
if (typeof content === "string") return content.includes(BOOTSTRAP_MARKER);
|
|
115
|
+
if (!Array.isArray(content)) return false;
|
|
116
|
+
return content.some((part) => {
|
|
117
|
+
return (
|
|
118
|
+
part &&
|
|
119
|
+
typeof part === "object" &&
|
|
120
|
+
(part as { type?: unknown }).type === "text" &&
|
|
121
|
+
typeof (part as { text?: unknown }).text === "string" &&
|
|
122
|
+
(part as { text: string }).text.includes(BOOTSTRAP_MARKER)
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function firstNonCompactionSummaryIndex(messages: unknown[]): number {
|
|
128
|
+
let index = 0;
|
|
129
|
+
while ((messages[index] as { role?: unknown } | undefined)?.role === "compactionSummary") {
|
|
130
|
+
index += 1;
|
|
131
|
+
}
|
|
132
|
+
return index;
|
|
133
|
+
}
|
package/CONTRIBUTING.md
CHANGED
|
@@ -44,7 +44,7 @@ tribunal-kit/
|
|
|
44
44
|
├── .agent/ # The intelligence payload (agents, skills, workflows)
|
|
45
45
|
│ ├── agents/ # 52 specialist and reviewer agent definitions
|
|
46
46
|
│ ├── skills/ # Reusable skill packs
|
|
47
|
-
│ ├── workflows/ #
|
|
47
|
+
│ ├── workflows/ # 41 workflow definitions
|
|
48
48
|
│ └── scripts/ # Automation scripts
|
|
49
49
|
├── test/
|
|
50
50
|
│ ├── unit/ # Unit tests (Jest)
|