tribunal-kit 5.8.3 → 5.8.5

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.
Files changed (121) hide show
  1. package/.agent/ARCHITECTURE.md +5 -5
  2. package/.agent/history/integrity_manifest.json +1026 -0
  3. package/.agent/history/memory/.memory.idx +1217 -1
  4. package/.agent/history/memory/MEMORY.md +81 -1
  5. package/.agent/rules/GEMINI.md +1 -1
  6. package/.agent/scripts/_utils.js +28 -7
  7. package/.agent/scripts/case_law_manager.js +3 -15
  8. package/.agent/scripts/context_broker.js +3 -20
  9. package/.agent/scripts/guardrail_engine.js +643 -0
  10. package/.agent/scripts/integrity_manifest.js +492 -0
  11. package/.agent/scripts/marathon_harness.js +10 -1
  12. package/.agent/scripts/signal_detector.js +1 -1
  13. package/.agent/scripts/skill_evolution.js +39 -36
  14. package/.agent/scripts/skill_integrator.js +2 -12
  15. package/.agent/scripts/swarm_dispatcher.js +54 -5
  16. package/.agent/skills/12-principles-of-animation/SKILL.md +69 -0
  17. package/.agent/skills/60fps-animation/SKILL.md +78 -0
  18. package/.agent/skills/accessible-animation/SKILL.md +86 -0
  19. package/.agent/skills/adapt/SKILL.md +75 -0
  20. package/.agent/skills/animation-on-scroll/SKILL.md +110 -0
  21. package/.agent/skills/animation-systems/SKILL.md +69 -0
  22. package/.agent/skills/antfu-conventions/SKILL.md +74 -0
  23. package/.agent/skills/api-patterns/scripts/__pycache__/api_validator.cpython-311.pyc +0 -0
  24. package/.agent/skills/apple-design/SKILL.md +108 -0
  25. package/.agent/skills/audit-and-fix/SKILL.md +83 -0
  26. package/.agent/skills/baseline-ui/SKILL.md +74 -0
  27. package/.agent/skills/better-colors/SKILL.md +132 -0
  28. package/.agent/skills/better-typography/SKILL.md +111 -0
  29. package/.agent/skills/better-ui/SKILL.md +102 -0
  30. package/.agent/skills/bolder/SKILL.md +68 -0
  31. package/.agent/skills/build-primitive/SKILL.md +70 -0
  32. package/.agent/skills/clarify/SKILL.md +75 -0
  33. package/.agent/skills/cobejs/SKILL.md +96 -0
  34. package/.agent/skills/codebase-design/SKILL.md +84 -0
  35. package/.agent/skills/colorize/SKILL.md +77 -0
  36. package/.agent/skills/compact-landing/SKILL.md +70 -0
  37. package/.agent/skills/company-logos/SKILL.md +73 -0
  38. package/.agent/skills/create-design-md/SKILL.md +104 -0
  39. package/.agent/skills/critique/SKILL.md +95 -0
  40. package/.agent/skills/database-design/scripts/__pycache__/schema_validator.cpython-311.pyc +0 -0
  41. package/.agent/skills/delight/SKILL.md +65 -0
  42. package/.agent/skills/design-lab/SKILL.md +59 -0
  43. package/.agent/skills/diagnosing-bugs/SKILL.md +190 -0
  44. package/.agent/skills/distill/SKILL.md +65 -0
  45. package/.agent/skills/domain-modeling/SKILL.md +78 -0
  46. package/.agent/skills/fixing-accessibility/SKILL.md +100 -0
  47. package/.agent/skills/fixing-metadata/SKILL.md +97 -0
  48. package/.agent/skills/fixing-motion-performance/SKILL.md +96 -0
  49. package/.agent/skills/frontend-design/SKILL.md +80 -81
  50. package/.agent/skills/frontend-design/scripts/__pycache__/accessibility_checker.cpython-311.pyc +0 -0
  51. package/.agent/skills/frontend-design/scripts/__pycache__/ux_audit.cpython-311.pyc +0 -0
  52. package/.agent/skills/geo-fundamentals/scripts/__pycache__/geo_checker.cpython-311.pyc +0 -0
  53. package/.agent/skills/gpt-taste/SKILL.md +68 -0
  54. package/.agent/skills/harden/SKILL.md +74 -0
  55. package/.agent/skills/i18n-localization/scripts/__pycache__/i18n_checker.cpython-311.pyc +0 -0
  56. package/.agent/skills/impeccable/SKILL.md +74 -0
  57. package/.agent/skills/improve-codebase-architecture/SKILL.md +67 -0
  58. package/.agent/skills/improve-ui/SKILL.md +83 -0
  59. package/.agent/skills/landing-page/SKILL.md +88 -0
  60. package/.agent/skills/lint-and-validate/SKILL.md +0 -1
  61. package/.agent/skills/lint-and-validate/scripts/__pycache__/lint_runner.cpython-311.pyc +0 -0
  62. package/.agent/skills/lint-and-validate/scripts/__pycache__/type_coverage.cpython-311.pyc +0 -0
  63. package/.agent/skills/local-first-architecture/SKILL.md +66 -0
  64. package/.agent/skills/lottie-animation/SKILL.md +82 -0
  65. package/.agent/skills/marquee-loop/SKILL.md +96 -0
  66. package/.agent/skills/masked-reveal/SKILL.md +88 -0
  67. package/.agent/skills/micro-interaction/SKILL.md +100 -0
  68. package/.agent/skills/mobile-design/scripts/__pycache__/mobile_audit.cpython-311.pyc +0 -0
  69. package/.agent/skills/morphing-icons/SKILL.md +85 -0
  70. package/.agent/skills/motion-engineering/SKILL.md +66 -164
  71. package/.agent/skills/nextjs-react-expert/scripts/__pycache__/convert_rules.cpython-311.pyc +0 -0
  72. package/.agent/skills/nextjs-react-expert/scripts/__pycache__/react_performance_checker.cpython-311.pyc +0 -0
  73. package/.agent/skills/page-transition-animation/SKILL.md +108 -0
  74. package/.agent/skills/parallel-agents/SKILL.md +5 -5
  75. package/.agent/skills/performance-profiling/scripts/__pycache__/lighthouse_audit.cpython-311.pyc +0 -0
  76. package/.agent/skills/polish/SKILL.md +63 -0
  77. package/.agent/skills/pricing-page/SKILL.md +68 -0
  78. package/.agent/skills/progressive-blur/SKILL.md +100 -0
  79. package/.agent/skills/quieter/SKILL.md +68 -0
  80. package/.agent/skills/react-doctor/SKILL.md +70 -0
  81. package/.agent/skills/redesign-skill/SKILL.md +65 -0
  82. package/.agent/skills/seo-fundamentals/scripts/__pycache__/seo_checker.cpython-311.pyc +0 -0
  83. package/.agent/skills/shape/SKILL.md +73 -0
  84. package/.agent/skills/soft-skill/SKILL.md +72 -0
  85. package/.agent/skills/sounds-on-the-web/SKILL.md +100 -0
  86. package/.agent/skills/svg-animation/SKILL.md +91 -0
  87. package/.agent/skills/swiss-design/SKILL.md +64 -0
  88. package/.agent/skills/taste-skill/SKILL.md +71 -0
  89. package/.agent/skills/tdd-workflow/SKILL.md +36 -165
  90. package/.agent/skills/testing-patterns/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
  91. package/.agent/skills/thermo-nuclear-code-quality-review/SKILL.md +82 -0
  92. package/.agent/skills/to-spring-or-not-to-spring/SKILL.md +66 -0
  93. package/.agent/skills/transitions-dev/SKILL.md +101 -0
  94. package/.agent/skills/typeset/SKILL.md +76 -0
  95. package/.agent/skills/ui-skills-root/SKILL.md +85 -0
  96. package/.agent/skills/vulnerability-scanner/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
  97. package/.agent/skills/web-quality-audit/SKILL.md +67 -0
  98. package/.agent/skills/webapp-testing/scripts/__pycache__/playwright_runner.cpython-311.pyc +0 -0
  99. package/.agent/workflows/generate.md +1 -1
  100. package/.agent/workflows/tribunal-full.md +2 -2
  101. package/.agent/workflows/tribunal-speed.md +2 -2
  102. package/CONTRIBUTING.md +1 -1
  103. package/README.md +349 -239
  104. package/bin/mcp-server.js +45 -45
  105. package/bin/tribunal-kit.js +62 -1482
  106. package/bin/wrapper.js +50 -25
  107. package/dist/cli.js +43 -0
  108. package/dist/commands/align.js +1 -1
  109. package/dist/commands/compile.js +1 -1
  110. package/dist/commands/guardrail.js +275 -0
  111. package/dist/commands/init.js +35 -10
  112. package/dist/commands/native.js +228 -0
  113. package/dist/commands/optimize.js +318 -0
  114. package/dist/commands/validate.js +67 -0
  115. package/dist/mcp/server.js +4 -138
  116. package/dist/utils/version.js +1 -1
  117. package/package.json +13 -10
  118. package/scripts/benchmark.js +42 -0
  119. package/scripts/fix-vbc.js +98 -0
  120. package/scripts/fix-vbc.ps1 +119 -0
  121. package/scripts/sync-version.js +129 -76
package/bin/mcp-server.js CHANGED
@@ -7,8 +7,8 @@
7
7
  * over standard I/O, allowing AI clients (Cursor, Windsurf, Claude) to natively
8
8
  * invoke tribunal checks.
9
9
  *
10
- * PERF: Commands are loaded in-process via require() no child process spawn.
11
- * This eliminates ~200-500ms overhead per tool call that spawnSync introduced.
10
+ * In-process tools load reusable modules directly. Commands that depend on a
11
+ * standalone CLI process remain isolated deliberately.
12
12
  *
13
13
  * Protocol: MCP 2024-11-05 over JSON-RPC 2.0 / stdio
14
14
  */
@@ -18,7 +18,7 @@ const { spawnSync } = require("child_process");
18
18
 
19
19
  const PKG = require(path.resolve(__dirname, "../package.json"));
20
20
 
21
- // Timeout for spawned processes (30 seconds) — only used for Rust binary calls
21
+ // Timeout for intentionally isolated child processes (30 seconds).
22
22
  const SPAWN_TIMEOUT_MS = 30000;
23
23
 
24
24
  // Minimal JSON-RPC 2.0 over stdio
@@ -31,61 +31,60 @@ const rl = readline.createInterface({
31
31
  });
32
32
 
33
33
  /**
34
- * Run the validate command via the Rust binary (if available) or JS fallback.
35
- * This is the only command that still benefits from process spawn (Rust speed).
34
+ * Run the workspace integrity audit without invoking the CLI schema validator.
35
+ * The MCP audit is about Tribunal assets, while `tk validate` validates one
36
+ * explicitly supplied payload and schema.
36
37
  */
37
- function runValidateCommand() {
38
- const os = require("os");
38
+ function runTribunalAudit() {
39
39
  const fs = require("fs");
40
- const isWindows = os.platform() === "win32";
41
- const ext = isWindows ? ".exe" : "";
42
- const platform = os.platform();
43
- const arch = os.arch();
44
-
45
- // Try Rust binary first
46
- const pkgName = `@tribunal-kit/core-${platform}-${arch}`;
47
- let binPath = null;
48
- try {
49
- const pkgPath = require.resolve(`${pkgName}/package.json`);
50
- const candidatePath = path.resolve(
51
- path.dirname(pkgPath),
52
- `bin/tribunal-core${ext}`,
53
- );
54
- if (fs.existsSync(candidatePath)) binPath = candidatePath;
55
- } catch (_) {}
56
- if (!binPath) {
57
- const devPath = path.resolve(
58
- __dirname,
59
- "..",
60
- "target",
61
- "release",
62
- `tribunal-core${ext}`,
63
- );
64
- if (fs.existsSync(devPath)) binPath = devPath;
65
- }
40
+ const projectRoot = process.cwd();
41
+ const manifestScript = path.join(
42
+ projectRoot,
43
+ ".agent",
44
+ "scripts",
45
+ "integrity_manifest.js",
46
+ );
66
47
 
67
- if (binPath) {
68
- const result = spawnSync(binPath, ["validate"], {
69
- encoding: "utf8",
70
- timeout: SPAWN_TIMEOUT_MS,
71
- });
72
- return result.stdout || result.stderr || "No output";
48
+ if (!fs.existsSync(manifestScript)) {
49
+ return "Error: .agent/scripts/integrity_manifest.js was not found. Run `tk init` first.";
73
50
  }
74
51
 
75
- // JS fallback — in-process
76
- return "Validate command requires the Rust binary. Run: cargo build --release";
52
+ try {
53
+ const { generateManifest } = require(manifestScript);
54
+ const manifest = generateManifest(projectRoot);
55
+ if (manifest.error) return `Error: ${manifest.error}`;
56
+
57
+ const { integrity } = manifest;
58
+ const lines = [
59
+ "Tribunal audit complete.",
60
+ `Agents: ${manifest.agents.total} (${manifest.agents.reviewer_count} reviewers)`,
61
+ `Skills: ${manifest.skills.total}`,
62
+ `Scripts: ${manifest.scripts.total}`,
63
+ `Workflows: ${manifest.workflows.total}`,
64
+ `References: ${integrity.total_references}; phantom references: ${integrity.phantom_references}`,
65
+ `Count claims: ${integrity.total_claims}; invalid claims: ${integrity.invalid_claims}`,
66
+ ];
67
+
68
+ if (integrity.phantom_references > 0 || integrity.invalid_claims > 0) {
69
+ lines.push("Audit found integrity issues; run `tk guardrail --scan` for remediation details.");
70
+ } else {
71
+ lines.push("All discovered references and global asset-count claims are valid.");
72
+ }
73
+ return lines.join("\n");
74
+ } catch (error) {
75
+ return `Audit failed: ${error.message}`;
76
+ }
77
77
  }
78
78
 
79
79
  /**
80
- * Search case law loaded in-process for zero-spawn latency.
80
+ * Search case law in an isolated process because its CLI owns persistent state.
81
81
  */
82
82
  function searchCaseLaw(query) {
83
83
  const caseLawScript = path.resolve(
84
84
  __dirname,
85
85
  "../.agent/scripts/case_law_manager.js",
86
86
  );
87
- // We still spawn for case_law_manager since it's a standalone script
88
- // that modifies global state, but we use spawn with minimal overhead
87
+ // case_law_manager is a standalone stateful CLI, so retain its process boundary.
89
88
  const result = spawnSync(
90
89
  process.execPath,
91
90
  [caseLawScript, "search-cases", "--query", query],
@@ -301,7 +300,7 @@ function handleRequest(req) {
301
300
  }
302
301
 
303
302
  if (toolName === "run_tribunal_audit") {
304
- const text = runValidateCommand();
303
+ const text = runTribunalAudit();
305
304
  return { content: [{ type: "text", text }] };
306
305
  }
307
306
 
@@ -548,5 +547,6 @@ if (process.env.NODE_ENV === "test") {
548
547
  module.exports = {
549
548
  handleRequest,
550
549
  stripBoilerplate,
550
+ runTribunalAudit,
551
551
  };
552
552
  }