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
package/dist/cli.js
CHANGED
|
@@ -1,355 +1,355 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
/**
|
|
4
|
-
* tribunal-kit CLI Core (TypeScript version)
|
|
5
|
-
*
|
|
6
|
-
* Commands are lazy-loaded: only the invoked command's module is require()'d.
|
|
7
|
-
* This means `tk status` loads ~4 files instead of ~17, cutting startup I/O by ~70%.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.main = main;
|
|
11
|
-
const logger_1 = require("./utils/logger");
|
|
12
|
-
const helpers_1 = require("./utils/helpers");
|
|
13
|
-
const PKG = require('../package.json');
|
|
14
|
-
const CURRENT_VERSION = PKG.version;
|
|
15
|
-
// ── Arg Parser ───────────────────────────────────────────
|
|
16
|
-
function parseArgs(argv) {
|
|
17
|
-
const args = { command: null, flags: {} };
|
|
18
|
-
const raw = argv.slice(2);
|
|
19
|
-
// First non-flag arg is the command
|
|
20
|
-
for (const arg of raw) {
|
|
21
|
-
if (!arg.startsWith('--') && !args.command) {
|
|
22
|
-
args.command = arg;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (arg === '--force') {
|
|
26
|
-
args.flags.force = true;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (arg === '--quiet') {
|
|
30
|
-
args.flags.quiet = true;
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (arg === '--verbose') {
|
|
34
|
-
args.flags.verbose = true;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
if (arg === '--dry-run') {
|
|
38
|
-
args.flags.dryRun = true;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (arg === '--minimal') {
|
|
42
|
-
args.flags.minimal = true;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (arg.startsWith('--profile=')) {
|
|
46
|
-
args.flags.profile = arg.split('=').slice(1).join('=');
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (arg === '--profile') {
|
|
50
|
-
const idx = raw.indexOf('--profile');
|
|
51
|
-
args.flags.profile = raw[idx + 1] || 'full';
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
54
|
-
if (arg === '--skip-update-check') {
|
|
55
|
-
args.flags.skipUpdateCheck = true;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (arg === '--write') {
|
|
59
|
-
args.flags.write = true;
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (arg === '--head') {
|
|
63
|
-
args.flags.head = true;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
if (arg.startsWith('--path=')) {
|
|
67
|
-
args.flags.path = arg.split('=').slice(1).join('=');
|
|
68
|
-
}
|
|
69
|
-
if (arg === '--path') {
|
|
70
|
-
const idx = raw.indexOf('--path');
|
|
71
|
-
const nextVal = raw[idx + 1];
|
|
72
|
-
if (!nextVal || nextVal.startsWith('--')) {
|
|
73
|
-
console.error(` \x1b[91m✖ --path requires a directory argument\x1b[0m`);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
args.flags.path = nextVal;
|
|
77
|
-
}
|
|
78
|
-
if (arg.startsWith('--target=')) {
|
|
79
|
-
args.flags.target = arg.split('=').slice(1).join('=');
|
|
80
|
-
}
|
|
81
|
-
if (arg === '--target') {
|
|
82
|
-
const idx = raw.indexOf('--target');
|
|
83
|
-
const nextVal = raw[idx + 1];
|
|
84
|
-
if (!nextVal || nextVal.startsWith('--')) {
|
|
85
|
-
console.error(` \x1b[91m✖ --target requires an argument\x1b[0m`);
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
args.flags.target = nextVal;
|
|
89
|
-
}
|
|
90
|
-
if (arg.startsWith('--branch=')) {
|
|
91
|
-
args.flags.branch = arg.split('=').slice(1).join('=');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return args;
|
|
95
|
-
}
|
|
96
|
-
function cmdHelp(quiet = false) {
|
|
97
|
-
(0, helpers_1.banner)(quiet);
|
|
98
|
-
const cmd = (name, desc) => ` ${(0, logger_1.c)('cyan', name.padEnd(10))} ${(0, logger_1.c)('gray', desc)}`;
|
|
99
|
-
const opt = (flag, desc) => ` ${(0, logger_1.c)('yellow', flag.padEnd(22))} ${(0, logger_1.c)('gray', desc)}`;
|
|
100
|
-
const ex = (s) => ` ${(0, logger_1.c)('gray', '▸')} ${(0, logger_1.c)('white', s)}`;
|
|
101
|
-
(0, logger_1.log)((0, logger_1.bold)(' Commands'));
|
|
102
|
-
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
103
|
-
(0, logger_1.log)(cmd('init', 'Install .agent/ into current project'));
|
|
104
|
-
(0, logger_1.log)(cmd('update', 'Re-install to get latest version'));
|
|
105
|
-
(0, logger_1.log)(cmd('status', 'Check if .agent/ is installed'));
|
|
106
|
-
(0, logger_1.log)(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
107
|
-
(0, logger_1.log)(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
|
|
108
|
-
(0, logger_1.log)(cmd('graph', 'Build and visualize the architecture graph'));
|
|
109
|
-
(0, logger_1.log)(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
|
|
110
|
-
(0, logger_1.log)(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
|
|
111
|
-
(0, logger_1.log)(cmd('sync', 'Synchronize IDE bridge files with current rules'));
|
|
112
|
-
(0, logger_1.log)(cmd('align', 'Clean AI outputs (strip slop, collapse lists, validate code traps)'));
|
|
113
|
-
(0, logger_1.log)(cmd('marathon', 'Long-running agent harness (init, status, next, mark)'));
|
|
114
|
-
(0, logger_1.log)(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
115
|
-
(0, logger_1.log)(cmd('compile', 'Compile rules into a static instruction file for terminal agents'));
|
|
116
|
-
(0, logger_1.log)(cmd('memory', '4-Type Taxonomy Persistent Memory Engine (store, recall, gc, stats, export)'));
|
|
117
|
-
(0, logger_1.log)(cmd('optimize-skill', 'Optimize project skills actively using SkillOpt validation gates'));
|
|
118
|
-
(0, logger_1.log)(cmd('validate', 'Validate a JSON payload against a Tribunal schema'));
|
|
119
|
-
(0, logger_1.log)(cmd('min-context', 'Remove empty lines from a context file'));
|
|
120
|
-
(0, logger_1.log)(cmd('dag-schedule', 'Compute parallel execution waves from task dependencies'));
|
|
121
|
-
(0, logger_1.log)(cmd('context-compress', 'Compress a context file while retaining VERIFY comments'));
|
|
122
|
-
(0, logger_1.log)(cmd('optimize-step', 'Apply bounded SkillOpt edits from a JSON payload'));
|
|
123
|
-
(0, logger_1.log)(cmd('guardrail', 'Validate .agent/ integrity (phantom refs, count mismatches, drift)'));
|
|
124
|
-
(0, logger_1.log)(cmd('contract', 'AI Agent Behavioral Contract Testing (init, verify, list, trace, replay)'));
|
|
125
|
-
(0, logger_1.log)(cmd('impact-tier', 'Classify task governance impact tier (0-3)'));
|
|
126
|
-
(0, logger_1.log)(cmd('uninstall', 'Remove .agent/ folder from project'));
|
|
127
|
-
console.log();
|
|
128
|
-
(0, logger_1.log)((0, logger_1.bold)(' Options'));
|
|
129
|
-
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
130
|
-
(0, logger_1.log)(opt('--force', 'Overwrite existing .agent/ folder'));
|
|
131
|
-
(0, logger_1.log)(opt('--path <dir>', 'Install in specific directory'));
|
|
132
|
-
(0, logger_1.log)(opt('--target <name>', 'Target terminal agent for compile (e.g. aider)'));
|
|
133
|
-
(0, logger_1.log)(opt('--quiet', 'Suppress all output'));
|
|
134
|
-
(0, logger_1.log)(opt('--verbose', 'Show detailed debug logging'));
|
|
135
|
-
(0, logger_1.log)(opt('--dry-run', 'Preview actions without executing'));
|
|
136
|
-
(0, logger_1.log)(opt('--minimal', 'Install core agents/skills only (~13 agents)'));
|
|
137
|
-
(0, logger_1.log)(opt('--skip-update-check', 'Skip auto-update version check'));
|
|
138
|
-
(0, logger_1.log)(opt('--head', '(learn) Diff against last commit instead of staged'));
|
|
139
|
-
(0, logger_1.log)(opt('--write', '(align) Write aligned output in-place to the target file'));
|
|
140
|
-
(0, logger_1.log)(opt('--version, -v', 'Print installed version'));
|
|
141
|
-
console.log();
|
|
142
|
-
(0, logger_1.log)((0, logger_1.bold)(' Aliases'));
|
|
143
|
-
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
144
|
-
(0, logger_1.log)(` ${(0, logger_1.c)('cyan', 'tk')} ${(0, logger_1.c)('gray', 'Shorthand for tribunal-kit (e.g., tk init, tk status)')}`);
|
|
145
|
-
console.log();
|
|
146
|
-
(0, logger_1.log)((0, logger_1.bold)(' Examples'));
|
|
147
|
-
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
148
|
-
(0, logger_1.log)(ex('npx tribunal-kit init'));
|
|
149
|
-
(0, logger_1.log)(ex('tk init --force'));
|
|
150
|
-
(0, logger_1.log)(ex('tk init --path ./my-app'));
|
|
151
|
-
(0, logger_1.log)(ex('npx tribunal-kit init --dry-run'));
|
|
152
|
-
(0, logger_1.log)(ex('tk update'));
|
|
153
|
-
(0, logger_1.log)(ex('tk status'));
|
|
154
|
-
(0, logger_1.log)(ex('tk learn'));
|
|
155
|
-
(0, logger_1.log)(ex('tk learn --dry-run'));
|
|
156
|
-
(0, logger_1.log)(ex('tk learn --head'));
|
|
157
|
-
(0, logger_1.log)(ex('tk case add'));
|
|
158
|
-
(0, logger_1.log)(ex('tk case search "useEffect"'));
|
|
159
|
-
(0, logger_1.log)(ex('tk case list'));
|
|
160
|
-
(0, logger_1.log)(ex('tk case show --id 1'));
|
|
161
|
-
(0, logger_1.log)(ex('tk case stats'));
|
|
162
|
-
(0, logger_1.log)(ex('tk case export'));
|
|
163
|
-
(0, logger_1.log)(ex('tk case overrule --id 1'));
|
|
164
|
-
(0, logger_1.log)(ex('tk graph'));
|
|
165
|
-
(0, logger_1.log)(ex('tk mutate src/utils.js "npm test"'));
|
|
166
|
-
(0, logger_1.log)(ex('tk marathon init "Build a todo app"'));
|
|
167
|
-
(0, logger_1.log)(ex('tk marathon status'));
|
|
168
|
-
(0, logger_1.log)(ex('tk marathon next'));
|
|
169
|
-
(0, logger_1.log)(ex('tk marathon mark 5 pass'));
|
|
170
|
-
(0, logger_1.log)(ex('tk hook'));
|
|
171
|
-
(0, logger_1.log)(ex('tk compile'));
|
|
172
|
-
(0, logger_1.log)(ex('echo "Certainly! Here is - item 1" | tk align'));
|
|
173
|
-
(0, logger_1.log)(ex('tk align output.md --write'));
|
|
174
|
-
(0, logger_1.log)(ex('tk memory store --type semantic --content "Uses PostgreSQL" --tags db,orm'));
|
|
175
|
-
(0, logger_1.log)(ex('tk optimize-skill --target project-idioms "npm test"'));
|
|
176
|
-
(0, logger_1.log)(ex('tk memory recall --query "database" --budget 2000'));
|
|
177
|
-
(0, logger_1.log)(ex('tk memory gc'));
|
|
178
|
-
(0, logger_1.log)(ex('tk memory stats'));
|
|
179
|
-
(0, logger_1.log)(ex('tk memory export'));
|
|
180
|
-
(0, logger_1.log)(ex('tk uninstall'));
|
|
181
|
-
console.log();
|
|
182
|
-
}
|
|
183
|
-
// ── Lazy Loaders ─────────────────────────────────────────
|
|
184
|
-
// Each command module is require()'d only when invoked.
|
|
185
|
-
// Running `tk status` loads ~4 files instead of ~17.
|
|
186
|
-
function loadCmd(modulePath, exportName) {
|
|
187
|
-
return require(modulePath)[exportName];
|
|
188
|
-
}
|
|
189
|
-
async function runWithUpdateCheck(command, flags) {
|
|
190
|
-
const shouldSkip = flags.skipUpdateCheck || process.env.TK_SKIP_UPDATE_CHECK === '1';
|
|
191
|
-
if (!shouldSkip && (command === 'init' || command === 'update')) {
|
|
192
|
-
// version.ts is only loaded for init/update — not every command
|
|
193
|
-
const { autoUpdateCheck } = require('./utils/version');
|
|
194
|
-
const originalArgs = process.argv.slice(2);
|
|
195
|
-
const didReInvoke = await autoUpdateCheck(originalArgs, CURRENT_VERSION);
|
|
196
|
-
if (didReInvoke) {
|
|
197
|
-
process.exit(0);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const quiet = flags.quiet || false;
|
|
201
|
-
switch (command) {
|
|
202
|
-
case 'init': {
|
|
203
|
-
const cmdInit = loadCmd('./commands/init', 'cmdInit');
|
|
204
|
-
await cmdInit(flags, quiet);
|
|
205
|
-
break;
|
|
206
|
-
}
|
|
207
|
-
case 'update': {
|
|
208
|
-
const cmdUpdate = loadCmd('./commands/update', 'cmdUpdate');
|
|
209
|
-
await cmdUpdate(flags);
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case 'status': {
|
|
213
|
-
const cmdStatus = loadCmd('./commands/status', 'cmdStatus');
|
|
214
|
-
cmdStatus(flags, quiet);
|
|
215
|
-
break;
|
|
216
|
-
}
|
|
217
|
-
case 'learn': {
|
|
218
|
-
const cmdLearn = loadCmd('./commands/learn', 'cmdLearn');
|
|
219
|
-
await cmdLearn(flags, quiet);
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
case 'case': {
|
|
223
|
-
const cmdCase = loadCmd('./commands/case', 'cmdCase');
|
|
224
|
-
await cmdCase(flags, process.argv, quiet);
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
case 'hook': {
|
|
228
|
-
const cmdHook = loadCmd('./commands/hook', 'cmdHook');
|
|
229
|
-
cmdHook(flags);
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
case 'graph': {
|
|
233
|
-
const cmdGraph = loadCmd('./commands/graph', 'cmdGraph');
|
|
234
|
-
await cmdGraph(flags, quiet);
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
case 'mutate': {
|
|
238
|
-
const cmdMutate = loadCmd('./commands/mutate', 'cmdMutate');
|
|
239
|
-
await cmdMutate(flags, process.argv);
|
|
240
|
-
break;
|
|
241
|
-
}
|
|
242
|
-
case 'context': {
|
|
243
|
-
const cmdContext = loadCmd('./commands/context', 'cmdContext');
|
|
244
|
-
cmdContext(flags, process.argv);
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
case 'sync': {
|
|
248
|
-
const cmdSync = loadCmd('./commands/sync', 'cmdSync');
|
|
249
|
-
await cmdSync();
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
case 'align': {
|
|
253
|
-
const cmdAlign = loadCmd('./commands/align', 'cmdAlign');
|
|
254
|
-
await cmdAlign(flags, process.argv, quiet);
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
case 'marathon': {
|
|
258
|
-
const cmdMarathon = loadCmd('./commands/marathon', 'cmdMarathon');
|
|
259
|
-
await cmdMarathon(flags, process.argv, quiet);
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
case 'minimal': {
|
|
263
|
-
const cmdMinimal = loadCmd('./commands/minimal', 'cmdMinimal');
|
|
264
|
-
cmdMinimal(flags, quiet);
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
case 'compile': {
|
|
268
|
-
const cmdCompile = loadCmd('./commands/compile', 'cmdCompile');
|
|
269
|
-
await cmdCompile(flags, quiet);
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
case 'uninstall': {
|
|
273
|
-
const cmdUninstall = loadCmd('./commands/uninstall', 'cmdUninstall');
|
|
274
|
-
cmdUninstall(flags, quiet);
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
case 'memory': {
|
|
278
|
-
const cmdMemory = loadCmd('./commands/memory', 'cmdMemory');
|
|
279
|
-
await cmdMemory(flags, process.argv, quiet);
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
case 'optimize-skill': {
|
|
283
|
-
const cmdOptimizeSkill = loadCmd('./commands/optimize', 'cmdOptimizeSkill');
|
|
284
|
-
await cmdOptimizeSkill(flags, process.argv, quiet);
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
case 'guardrail': {
|
|
288
|
-
const cmdGuardrail = loadCmd('./commands/guardrail', 'cmdGuardrail');
|
|
289
|
-
await cmdGuardrail(flags, process.argv, quiet);
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
case 'contract': {
|
|
293
|
-
const cmdContract = loadCmd('./commands/contract', 'cmdContract');
|
|
294
|
-
await cmdContract(flags, process.argv, quiet);
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
case 'validate': {
|
|
298
|
-
const cmdValidate = loadCmd('./commands/validate', 'cmdValidate');
|
|
299
|
-
cmdValidate(flags, process.argv, quiet);
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
case 'min-context': {
|
|
303
|
-
const cmdMinContext = loadCmd('./commands/native', 'cmdMinContext');
|
|
304
|
-
cmdMinContext(process.argv, quiet);
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
case 'dag-schedule': {
|
|
308
|
-
const cmdDagSchedule = loadCmd('./commands/native', 'cmdDagSchedule');
|
|
309
|
-
cmdDagSchedule(process.argv, quiet);
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
case 'context-compress': {
|
|
313
|
-
const cmdContextCompress = loadCmd('./commands/native', 'cmdContextCompress');
|
|
314
|
-
cmdContextCompress(process.argv, quiet);
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
case 'optimize-step': {
|
|
318
|
-
const cmdOptimizeStep = loadCmd('./commands/native', 'cmdOptimizeStep');
|
|
319
|
-
cmdOptimizeStep(process.argv, quiet);
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
case 'impact-tier': {
|
|
323
|
-
const cmdImpactTier = loadCmd('./commands/native', 'cmdImpactTier');
|
|
324
|
-
cmdImpactTier(process.argv, quiet);
|
|
325
|
-
break;
|
|
326
|
-
}
|
|
327
|
-
case 'help':
|
|
328
|
-
case '--help':
|
|
329
|
-
case '-h':
|
|
330
|
-
case null:
|
|
331
|
-
cmdHelp(quiet);
|
|
332
|
-
break;
|
|
333
|
-
case '--version':
|
|
334
|
-
case '-v':
|
|
335
|
-
(0, logger_1.log)(CURRENT_VERSION);
|
|
336
|
-
break;
|
|
337
|
-
default:
|
|
338
|
-
(0, logger_1.err)(`Unknown command: "${command}"`);
|
|
339
|
-
console.log();
|
|
340
|
-
(0, logger_1.dim)('Run tribunal-kit --help for usage');
|
|
341
|
-
process.exit(1);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
// ── Main ──────────────────────────────────────────────────
|
|
345
|
-
async function main() {
|
|
346
|
-
const { command, flags } = parseArgs(process.argv);
|
|
347
|
-
(0, logger_1.setLogLevels)(flags.quiet || false, flags.verbose || false);
|
|
348
|
-
await runWithUpdateCheck(command, flags);
|
|
349
|
-
}
|
|
350
|
-
if (require.main === module) {
|
|
351
|
-
main().catch(err => {
|
|
352
|
-
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
353
|
-
process.exit(1);
|
|
354
|
-
});
|
|
355
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* tribunal-kit CLI Core (TypeScript version)
|
|
5
|
+
*
|
|
6
|
+
* Commands are lazy-loaded: only the invoked command's module is require()'d.
|
|
7
|
+
* This means `tk status` loads ~4 files instead of ~17, cutting startup I/O by ~70%.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.main = main;
|
|
11
|
+
const logger_1 = require("./utils/logger");
|
|
12
|
+
const helpers_1 = require("./utils/helpers");
|
|
13
|
+
const PKG = require('../package.json');
|
|
14
|
+
const CURRENT_VERSION = PKG.version;
|
|
15
|
+
// ── Arg Parser ───────────────────────────────────────────
|
|
16
|
+
function parseArgs(argv) {
|
|
17
|
+
const args = { command: null, flags: {} };
|
|
18
|
+
const raw = argv.slice(2);
|
|
19
|
+
// First non-flag arg is the command
|
|
20
|
+
for (const arg of raw) {
|
|
21
|
+
if (!arg.startsWith('--') && !args.command) {
|
|
22
|
+
args.command = arg;
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (arg === '--force') {
|
|
26
|
+
args.flags.force = true;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (arg === '--quiet') {
|
|
30
|
+
args.flags.quiet = true;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (arg === '--verbose') {
|
|
34
|
+
args.flags.verbose = true;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (arg === '--dry-run') {
|
|
38
|
+
args.flags.dryRun = true;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (arg === '--minimal') {
|
|
42
|
+
args.flags.minimal = true;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (arg.startsWith('--profile=')) {
|
|
46
|
+
args.flags.profile = arg.split('=').slice(1).join('=');
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (arg === '--profile') {
|
|
50
|
+
const idx = raw.indexOf('--profile');
|
|
51
|
+
args.flags.profile = raw[idx + 1] || 'full';
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (arg === '--skip-update-check') {
|
|
55
|
+
args.flags.skipUpdateCheck = true;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (arg === '--write') {
|
|
59
|
+
args.flags.write = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (arg === '--head') {
|
|
63
|
+
args.flags.head = true;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (arg.startsWith('--path=')) {
|
|
67
|
+
args.flags.path = arg.split('=').slice(1).join('=');
|
|
68
|
+
}
|
|
69
|
+
if (arg === '--path') {
|
|
70
|
+
const idx = raw.indexOf('--path');
|
|
71
|
+
const nextVal = raw[idx + 1];
|
|
72
|
+
if (!nextVal || nextVal.startsWith('--')) {
|
|
73
|
+
console.error(` \x1b[91m✖ --path requires a directory argument\x1b[0m`);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
args.flags.path = nextVal;
|
|
77
|
+
}
|
|
78
|
+
if (arg.startsWith('--target=')) {
|
|
79
|
+
args.flags.target = arg.split('=').slice(1).join('=');
|
|
80
|
+
}
|
|
81
|
+
if (arg === '--target') {
|
|
82
|
+
const idx = raw.indexOf('--target');
|
|
83
|
+
const nextVal = raw[idx + 1];
|
|
84
|
+
if (!nextVal || nextVal.startsWith('--')) {
|
|
85
|
+
console.error(` \x1b[91m✖ --target requires an argument\x1b[0m`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
args.flags.target = nextVal;
|
|
89
|
+
}
|
|
90
|
+
if (arg.startsWith('--branch=')) {
|
|
91
|
+
args.flags.branch = arg.split('=').slice(1).join('=');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return args;
|
|
95
|
+
}
|
|
96
|
+
function cmdHelp(quiet = false) {
|
|
97
|
+
(0, helpers_1.banner)(quiet);
|
|
98
|
+
const cmd = (name, desc) => ` ${(0, logger_1.c)('cyan', name.padEnd(10))} ${(0, logger_1.c)('gray', desc)}`;
|
|
99
|
+
const opt = (flag, desc) => ` ${(0, logger_1.c)('yellow', flag.padEnd(22))} ${(0, logger_1.c)('gray', desc)}`;
|
|
100
|
+
const ex = (s) => ` ${(0, logger_1.c)('gray', '▸')} ${(0, logger_1.c)('white', s)}`;
|
|
101
|
+
(0, logger_1.log)((0, logger_1.bold)(' Commands'));
|
|
102
|
+
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
103
|
+
(0, logger_1.log)(cmd('init', 'Install .agent/ into current project'));
|
|
104
|
+
(0, logger_1.log)(cmd('update', 'Re-install to get latest version'));
|
|
105
|
+
(0, logger_1.log)(cmd('status', 'Check if .agent/ is installed'));
|
|
106
|
+
(0, logger_1.log)(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
107
|
+
(0, logger_1.log)(cmd('case', 'Manage Case Law precedents (add, search, list, show, stats, overrule)'));
|
|
108
|
+
(0, logger_1.log)(cmd('graph', 'Build and visualize the architecture graph'));
|
|
109
|
+
(0, logger_1.log)(cmd('mutate', 'Run the Mutation Engine to test test-suite reliability'));
|
|
110
|
+
(0, logger_1.log)(cmd('context', 'Retrieve a highly-optimized Context Snapshot for a file'));
|
|
111
|
+
(0, logger_1.log)(cmd('sync', 'Synchronize IDE bridge files with current rules'));
|
|
112
|
+
(0, logger_1.log)(cmd('align', 'Clean AI outputs (strip slop, collapse lists, validate code traps)'));
|
|
113
|
+
(0, logger_1.log)(cmd('marathon', 'Long-running agent harness (init, status, next, mark)'));
|
|
114
|
+
(0, logger_1.log)(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
115
|
+
(0, logger_1.log)(cmd('compile', 'Compile rules into a static instruction file for terminal agents'));
|
|
116
|
+
(0, logger_1.log)(cmd('memory', '4-Type Taxonomy Persistent Memory Engine (store, recall, gc, stats, export)'));
|
|
117
|
+
(0, logger_1.log)(cmd('optimize-skill', 'Optimize project skills actively using SkillOpt validation gates'));
|
|
118
|
+
(0, logger_1.log)(cmd('validate', 'Validate a JSON payload against a Tribunal schema'));
|
|
119
|
+
(0, logger_1.log)(cmd('min-context', 'Remove empty lines from a context file'));
|
|
120
|
+
(0, logger_1.log)(cmd('dag-schedule', 'Compute parallel execution waves from task dependencies'));
|
|
121
|
+
(0, logger_1.log)(cmd('context-compress', 'Compress a context file while retaining VERIFY comments'));
|
|
122
|
+
(0, logger_1.log)(cmd('optimize-step', 'Apply bounded SkillOpt edits from a JSON payload'));
|
|
123
|
+
(0, logger_1.log)(cmd('guardrail', 'Validate .agent/ integrity (phantom refs, count mismatches, drift)'));
|
|
124
|
+
(0, logger_1.log)(cmd('contract', 'AI Agent Behavioral Contract Testing (init, verify, list, trace, replay)'));
|
|
125
|
+
(0, logger_1.log)(cmd('impact-tier', 'Classify task governance impact tier (0-3)'));
|
|
126
|
+
(0, logger_1.log)(cmd('uninstall', 'Remove .agent/ folder from project'));
|
|
127
|
+
console.log();
|
|
128
|
+
(0, logger_1.log)((0, logger_1.bold)(' Options'));
|
|
129
|
+
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
130
|
+
(0, logger_1.log)(opt('--force', 'Overwrite existing .agent/ folder'));
|
|
131
|
+
(0, logger_1.log)(opt('--path <dir>', 'Install in specific directory'));
|
|
132
|
+
(0, logger_1.log)(opt('--target <name>', 'Target terminal agent for compile (e.g. aider)'));
|
|
133
|
+
(0, logger_1.log)(opt('--quiet', 'Suppress all output'));
|
|
134
|
+
(0, logger_1.log)(opt('--verbose', 'Show detailed debug logging'));
|
|
135
|
+
(0, logger_1.log)(opt('--dry-run', 'Preview actions without executing'));
|
|
136
|
+
(0, logger_1.log)(opt('--minimal', 'Install core agents/skills only (~13 agents)'));
|
|
137
|
+
(0, logger_1.log)(opt('--skip-update-check', 'Skip auto-update version check'));
|
|
138
|
+
(0, logger_1.log)(opt('--head', '(learn) Diff against last commit instead of staged'));
|
|
139
|
+
(0, logger_1.log)(opt('--write', '(align) Write aligned output in-place to the target file'));
|
|
140
|
+
(0, logger_1.log)(opt('--version, -v', 'Print installed version'));
|
|
141
|
+
console.log();
|
|
142
|
+
(0, logger_1.log)((0, logger_1.bold)(' Aliases'));
|
|
143
|
+
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
144
|
+
(0, logger_1.log)(` ${(0, logger_1.c)('cyan', 'tk')} ${(0, logger_1.c)('gray', 'Shorthand for tribunal-kit (e.g., tk init, tk status)')}`);
|
|
145
|
+
console.log();
|
|
146
|
+
(0, logger_1.log)((0, logger_1.bold)(' Examples'));
|
|
147
|
+
(0, logger_1.log)(` ${(0, logger_1.c)('gray', '─'.repeat(40))}`);
|
|
148
|
+
(0, logger_1.log)(ex('npx tribunal-kit init'));
|
|
149
|
+
(0, logger_1.log)(ex('tk init --force'));
|
|
150
|
+
(0, logger_1.log)(ex('tk init --path ./my-app'));
|
|
151
|
+
(0, logger_1.log)(ex('npx tribunal-kit init --dry-run'));
|
|
152
|
+
(0, logger_1.log)(ex('tk update'));
|
|
153
|
+
(0, logger_1.log)(ex('tk status'));
|
|
154
|
+
(0, logger_1.log)(ex('tk learn'));
|
|
155
|
+
(0, logger_1.log)(ex('tk learn --dry-run'));
|
|
156
|
+
(0, logger_1.log)(ex('tk learn --head'));
|
|
157
|
+
(0, logger_1.log)(ex('tk case add'));
|
|
158
|
+
(0, logger_1.log)(ex('tk case search "useEffect"'));
|
|
159
|
+
(0, logger_1.log)(ex('tk case list'));
|
|
160
|
+
(0, logger_1.log)(ex('tk case show --id 1'));
|
|
161
|
+
(0, logger_1.log)(ex('tk case stats'));
|
|
162
|
+
(0, logger_1.log)(ex('tk case export'));
|
|
163
|
+
(0, logger_1.log)(ex('tk case overrule --id 1'));
|
|
164
|
+
(0, logger_1.log)(ex('tk graph'));
|
|
165
|
+
(0, logger_1.log)(ex('tk mutate src/utils.js "npm test"'));
|
|
166
|
+
(0, logger_1.log)(ex('tk marathon init "Build a todo app"'));
|
|
167
|
+
(0, logger_1.log)(ex('tk marathon status'));
|
|
168
|
+
(0, logger_1.log)(ex('tk marathon next'));
|
|
169
|
+
(0, logger_1.log)(ex('tk marathon mark 5 pass'));
|
|
170
|
+
(0, logger_1.log)(ex('tk hook'));
|
|
171
|
+
(0, logger_1.log)(ex('tk compile'));
|
|
172
|
+
(0, logger_1.log)(ex('echo "Certainly! Here is - item 1" | tk align'));
|
|
173
|
+
(0, logger_1.log)(ex('tk align output.md --write'));
|
|
174
|
+
(0, logger_1.log)(ex('tk memory store --type semantic --content "Uses PostgreSQL" --tags db,orm'));
|
|
175
|
+
(0, logger_1.log)(ex('tk optimize-skill --target project-idioms "npm test"'));
|
|
176
|
+
(0, logger_1.log)(ex('tk memory recall --query "database" --budget 2000'));
|
|
177
|
+
(0, logger_1.log)(ex('tk memory gc'));
|
|
178
|
+
(0, logger_1.log)(ex('tk memory stats'));
|
|
179
|
+
(0, logger_1.log)(ex('tk memory export'));
|
|
180
|
+
(0, logger_1.log)(ex('tk uninstall'));
|
|
181
|
+
console.log();
|
|
182
|
+
}
|
|
183
|
+
// ── Lazy Loaders ─────────────────────────────────────────
|
|
184
|
+
// Each command module is require()'d only when invoked.
|
|
185
|
+
// Running `tk status` loads ~4 files instead of ~17.
|
|
186
|
+
function loadCmd(modulePath, exportName) {
|
|
187
|
+
return require(modulePath)[exportName];
|
|
188
|
+
}
|
|
189
|
+
async function runWithUpdateCheck(command, flags) {
|
|
190
|
+
const shouldSkip = flags.skipUpdateCheck || process.env.TK_SKIP_UPDATE_CHECK === '1';
|
|
191
|
+
if (!shouldSkip && (command === 'init' || command === 'update')) {
|
|
192
|
+
// version.ts is only loaded for init/update — not every command
|
|
193
|
+
const { autoUpdateCheck } = require('./utils/version');
|
|
194
|
+
const originalArgs = process.argv.slice(2);
|
|
195
|
+
const didReInvoke = await autoUpdateCheck(originalArgs, CURRENT_VERSION);
|
|
196
|
+
if (didReInvoke) {
|
|
197
|
+
process.exit(0);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const quiet = flags.quiet || false;
|
|
201
|
+
switch (command) {
|
|
202
|
+
case 'init': {
|
|
203
|
+
const cmdInit = loadCmd('./commands/init', 'cmdInit');
|
|
204
|
+
await cmdInit(flags, quiet);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
case 'update': {
|
|
208
|
+
const cmdUpdate = loadCmd('./commands/update', 'cmdUpdate');
|
|
209
|
+
await cmdUpdate(flags);
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
case 'status': {
|
|
213
|
+
const cmdStatus = loadCmd('./commands/status', 'cmdStatus');
|
|
214
|
+
cmdStatus(flags, quiet);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case 'learn': {
|
|
218
|
+
const cmdLearn = loadCmd('./commands/learn', 'cmdLearn');
|
|
219
|
+
await cmdLearn(flags, quiet);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case 'case': {
|
|
223
|
+
const cmdCase = loadCmd('./commands/case', 'cmdCase');
|
|
224
|
+
await cmdCase(flags, process.argv, quiet);
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
case 'hook': {
|
|
228
|
+
const cmdHook = loadCmd('./commands/hook', 'cmdHook');
|
|
229
|
+
cmdHook(flags);
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case 'graph': {
|
|
233
|
+
const cmdGraph = loadCmd('./commands/graph', 'cmdGraph');
|
|
234
|
+
await cmdGraph(flags, quiet);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
case 'mutate': {
|
|
238
|
+
const cmdMutate = loadCmd('./commands/mutate', 'cmdMutate');
|
|
239
|
+
await cmdMutate(flags, process.argv);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case 'context': {
|
|
243
|
+
const cmdContext = loadCmd('./commands/context', 'cmdContext');
|
|
244
|
+
cmdContext(flags, process.argv);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case 'sync': {
|
|
248
|
+
const cmdSync = loadCmd('./commands/sync', 'cmdSync');
|
|
249
|
+
await cmdSync();
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case 'align': {
|
|
253
|
+
const cmdAlign = loadCmd('./commands/align', 'cmdAlign');
|
|
254
|
+
await cmdAlign(flags, process.argv, quiet);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
case 'marathon': {
|
|
258
|
+
const cmdMarathon = loadCmd('./commands/marathon', 'cmdMarathon');
|
|
259
|
+
await cmdMarathon(flags, process.argv, quiet);
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
case 'minimal': {
|
|
263
|
+
const cmdMinimal = loadCmd('./commands/minimal', 'cmdMinimal');
|
|
264
|
+
cmdMinimal(flags, quiet);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case 'compile': {
|
|
268
|
+
const cmdCompile = loadCmd('./commands/compile', 'cmdCompile');
|
|
269
|
+
await cmdCompile(flags, quiet);
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
case 'uninstall': {
|
|
273
|
+
const cmdUninstall = loadCmd('./commands/uninstall', 'cmdUninstall');
|
|
274
|
+
cmdUninstall(flags, quiet);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
case 'memory': {
|
|
278
|
+
const cmdMemory = loadCmd('./commands/memory', 'cmdMemory');
|
|
279
|
+
await cmdMemory(flags, process.argv, quiet);
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
case 'optimize-skill': {
|
|
283
|
+
const cmdOptimizeSkill = loadCmd('./commands/optimize', 'cmdOptimizeSkill');
|
|
284
|
+
await cmdOptimizeSkill(flags, process.argv, quiet);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
case 'guardrail': {
|
|
288
|
+
const cmdGuardrail = loadCmd('./commands/guardrail', 'cmdGuardrail');
|
|
289
|
+
await cmdGuardrail(flags, process.argv, quiet);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
case 'contract': {
|
|
293
|
+
const cmdContract = loadCmd('./commands/contract', 'cmdContract');
|
|
294
|
+
await cmdContract(flags, process.argv, quiet);
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
case 'validate': {
|
|
298
|
+
const cmdValidate = loadCmd('./commands/validate', 'cmdValidate');
|
|
299
|
+
cmdValidate(flags, process.argv, quiet);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case 'min-context': {
|
|
303
|
+
const cmdMinContext = loadCmd('./commands/native', 'cmdMinContext');
|
|
304
|
+
cmdMinContext(process.argv, quiet);
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
case 'dag-schedule': {
|
|
308
|
+
const cmdDagSchedule = loadCmd('./commands/native', 'cmdDagSchedule');
|
|
309
|
+
cmdDagSchedule(process.argv, quiet);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case 'context-compress': {
|
|
313
|
+
const cmdContextCompress = loadCmd('./commands/native', 'cmdContextCompress');
|
|
314
|
+
cmdContextCompress(process.argv, quiet);
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
case 'optimize-step': {
|
|
318
|
+
const cmdOptimizeStep = loadCmd('./commands/native', 'cmdOptimizeStep');
|
|
319
|
+
cmdOptimizeStep(process.argv, quiet);
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
case 'impact-tier': {
|
|
323
|
+
const cmdImpactTier = loadCmd('./commands/native', 'cmdImpactTier');
|
|
324
|
+
cmdImpactTier(process.argv, quiet);
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case 'help':
|
|
328
|
+
case '--help':
|
|
329
|
+
case '-h':
|
|
330
|
+
case null:
|
|
331
|
+
cmdHelp(quiet);
|
|
332
|
+
break;
|
|
333
|
+
case '--version':
|
|
334
|
+
case '-v':
|
|
335
|
+
(0, logger_1.log)(CURRENT_VERSION);
|
|
336
|
+
break;
|
|
337
|
+
default:
|
|
338
|
+
(0, logger_1.err)(`Unknown command: "${command}"`);
|
|
339
|
+
console.log();
|
|
340
|
+
(0, logger_1.dim)('Run tribunal-kit --help for usage');
|
|
341
|
+
process.exit(1);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
// ── Main ──────────────────────────────────────────────────
|
|
345
|
+
async function main() {
|
|
346
|
+
const { command, flags } = parseArgs(process.argv);
|
|
347
|
+
(0, logger_1.setLogLevels)(flags.quiet || false, flags.verbose || false);
|
|
348
|
+
await runWithUpdateCheck(command, flags);
|
|
349
|
+
}
|
|
350
|
+
if (require.main === module) {
|
|
351
|
+
main().catch(err => {
|
|
352
|
+
console.error(`\x1b[91m✖ Fatal Error:\x1b[0m ${err.message || err}`);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
});
|
|
355
|
+
}
|