tribunal-kit 3.0.0 → 4.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 +99 -99
- package/.agent/GEMINI.md +52 -52
- package/.agent/agents/accessibility-reviewer.md +187 -220
- package/.agent/agents/ai-code-reviewer.md +199 -233
- package/.agent/agents/backend-specialist.md +215 -238
- package/.agent/agents/code-archaeologist.md +161 -181
- package/.agent/agents/database-architect.md +184 -207
- package/.agent/agents/debugger.md +191 -218
- package/.agent/agents/dependency-reviewer.md +103 -136
- package/.agent/agents/devops-engineer.md +218 -238
- package/.agent/agents/documentation-writer.md +201 -221
- package/.agent/agents/explorer-agent.md +160 -180
- package/.agent/agents/frontend-reviewer.md +160 -194
- package/.agent/agents/frontend-specialist.md +248 -237
- package/.agent/agents/game-developer.md +48 -52
- package/.agent/agents/logic-reviewer.md +116 -149
- package/.agent/agents/mobile-developer.md +200 -223
- package/.agent/agents/mobile-reviewer.md +162 -195
- package/.agent/agents/orchestrator.md +181 -211
- package/.agent/agents/penetration-tester.md +157 -174
- package/.agent/agents/performance-optimizer.md +183 -203
- package/.agent/agents/performance-reviewer.md +178 -211
- package/.agent/agents/precedence-reviewer.md +213 -0
- package/.agent/agents/product-manager.md +142 -162
- package/.agent/agents/product-owner.md +6 -25
- package/.agent/agents/project-planner.md +142 -162
- package/.agent/agents/qa-automation-engineer.md +225 -242
- package/.agent/agents/security-auditor.md +174 -194
- package/.agent/agents/seo-specialist.md +193 -213
- package/.agent/agents/sql-reviewer.md +161 -194
- package/.agent/agents/supervisor-agent.md +184 -203
- package/.agent/agents/swarm-worker-contracts.md +17 -17
- package/.agent/agents/swarm-worker-registry.md +46 -46
- package/.agent/agents/test-coverage-reviewer.md +160 -193
- package/.agent/agents/test-engineer.md +0 -21
- package/.agent/agents/type-safety-reviewer.md +175 -208
- package/.agent/patterns/generator.md +9 -9
- package/.agent/patterns/inversion.md +12 -12
- package/.agent/patterns/pipeline.md +9 -9
- package/.agent/patterns/reviewer.md +13 -13
- package/.agent/patterns/tool-wrapper.md +9 -9
- package/.agent/rules/GEMINI.md +63 -63
- package/.agent/scripts/append_flow.js +72 -0
- package/.agent/scripts/case_law_manager.py +525 -0
- package/.agent/scripts/compress_skills.py +167 -0
- package/.agent/scripts/consolidate_skills.py +173 -0
- package/.agent/scripts/deep_compress.py +202 -0
- package/.agent/scripts/minify_context.py +80 -0
- package/.agent/scripts/security_scan.py +1 -1
- package/.agent/scripts/skill_evolution.py +563 -0
- package/.agent/scripts/strip_tribunal.py +41 -0
- package/.agent/skills/agent-organizer/SKILL.md +100 -126
- package/.agent/skills/agentic-patterns/SKILL.md +0 -70
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +134 -160
- package/.agent/skills/api-patterns/SKILL.md +123 -215
- package/.agent/skills/api-security-auditor/SKILL.md +143 -177
- package/.agent/skills/app-builder/SKILL.md +334 -50
- package/.agent/skills/app-builder/templates/SKILL.md +13 -15
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +16 -16
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +22 -22
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +20 -20
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +17 -17
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +21 -21
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +26 -26
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +19 -19
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +18 -18
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +20 -20
- package/.agent/skills/appflow-wireframe/SKILL.md +95 -121
- package/.agent/skills/architecture/SKILL.md +169 -331
- package/.agent/skills/authentication-best-practices/SKILL.md +139 -173
- package/.agent/skills/bash-linux/SKILL.md +129 -154
- package/.agent/skills/behavioral-modes/SKILL.md +8 -69
- package/.agent/skills/brainstorming/SKILL.md +436 -104
- package/.agent/skills/building-native-ui/SKILL.md +152 -174
- package/.agent/skills/clean-code/SKILL.md +331 -360
- package/.agent/skills/code-review-checklist/SKILL.md +0 -62
- package/.agent/skills/config-validator/SKILL.md +115 -141
- package/.agent/skills/csharp-developer/SKILL.md +468 -528
- package/.agent/skills/database-design/SKILL.md +104 -369
- package/.agent/skills/deployment-procedures/SKILL.md +119 -145
- package/.agent/skills/devops-engineer/SKILL.md +295 -332
- package/.agent/skills/devops-incident-responder/SKILL.md +87 -113
- package/.agent/skills/doc.md +5 -5
- package/.agent/skills/documentation-templates/SKILL.md +27 -63
- package/.agent/skills/edge-computing/SKILL.md +131 -157
- package/.agent/skills/extract-design-system/SKILL.md +108 -134
- package/.agent/skills/framer-motion-expert/SKILL.md +111 -855
- package/.agent/skills/frontend-design/SKILL.md +151 -499
- package/.agent/skills/game-design-expert/SKILL.md +79 -105
- package/.agent/skills/game-engineering-expert/SKILL.md +96 -122
- package/.agent/skills/geo-fundamentals/SKILL.md +97 -124
- package/.agent/skills/github-operations/SKILL.md +279 -314
- package/.agent/skills/gsap-expert/SKILL.md +119 -826
- package/.agent/skills/i18n-localization/SKILL.md +113 -138
- package/.agent/skills/intelligent-routing/SKILL.md +167 -127
- package/.agent/skills/lint-and-validate/SKILL.md +16 -52
- package/.agent/skills/llm-engineering/SKILL.md +344 -357
- package/.agent/skills/local-first/SKILL.md +128 -154
- package/.agent/skills/mcp-builder/SKILL.md +92 -118
- package/.agent/skills/mobile-design/SKILL.md +213 -219
- package/.agent/skills/motion-engineering/SKILL.md +184 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +99 -698
- package/.agent/skills/nodejs-best-practices/SKILL.md +498 -559
- package/.agent/skills/observability/SKILL.md +293 -330
- package/.agent/skills/parallel-agents/SKILL.md +96 -122
- package/.agent/skills/performance-profiling/SKILL.md +217 -254
- package/.agent/skills/plan-writing/SKILL.md +92 -118
- package/.agent/skills/platform-engineer/SKILL.md +97 -123
- package/.agent/skills/playwright-best-practices/SKILL.md +137 -162
- package/.agent/skills/powershell-windows/SKILL.md +112 -146
- package/.agent/skills/project-idioms/SKILL.md +87 -0
- package/.agent/skills/python-patterns/SKILL.md +15 -35
- package/.agent/skills/python-pro/SKILL.md +148 -754
- package/.agent/skills/react-specialist/SKILL.md +123 -827
- package/.agent/skills/readme-builder/SKILL.md +23 -85
- package/.agent/skills/realtime-patterns/SKILL.md +269 -304
- package/.agent/skills/red-team-tactics/SKILL.md +18 -51
- package/.agent/skills/rust-pro/SKILL.md +623 -701
- package/.agent/skills/seo-fundamentals/SKILL.md +129 -154
- package/.agent/skills/server-management/SKILL.md +164 -190
- package/.agent/skills/shadcn-ui-expert/SKILL.md +181 -206
- package/.agent/skills/skill-creator/SKILL.md +24 -56
- package/.agent/skills/sql-pro/SKILL.md +579 -633
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +35 -66
- package/.agent/skills/swiftui-expert/SKILL.md +151 -176
- package/.agent/skills/systematic-debugging/SKILL.md +92 -118
- package/.agent/skills/tailwind-patterns/SKILL.md +516 -576
- package/.agent/skills/tdd-workflow/SKILL.md +111 -137
- package/.agent/skills/test-result-analyzer/SKILL.md +33 -73
- package/.agent/skills/testing-patterns/SKILL.md +512 -573
- package/.agent/skills/trend-researcher/SKILL.md +30 -71
- package/.agent/skills/ui-ux-pro-max/SKILL.md +8 -41
- package/.agent/skills/ui-ux-researcher/SKILL.md +51 -91
- package/.agent/skills/vue-expert/SKILL.md +127 -866
- package/.agent/skills/vulnerability-scanner/SKILL.md +354 -269
- package/.agent/skills/web-accessibility-auditor/SKILL.md +168 -193
- package/.agent/skills/web-design-guidelines/SKILL.md +25 -61
- package/.agent/skills/webapp-testing/SKILL.md +119 -145
- package/.agent/skills/whimsy-injector/SKILL.md +58 -132
- package/.agent/skills/workflow-optimizer/SKILL.md +28 -68
- package/.agent/workflows/api-tester.md +151 -151
- package/.agent/workflows/audit.md +127 -138
- package/.agent/workflows/brainstorm.md +110 -110
- package/.agent/workflows/changelog.md +112 -112
- package/.agent/workflows/create.md +124 -124
- package/.agent/workflows/debug.md +165 -189
- package/.agent/workflows/deploy.md +180 -189
- package/.agent/workflows/enhance.md +128 -151
- package/.agent/workflows/fix.md +114 -135
- package/.agent/workflows/generate.md +13 -4
- package/.agent/workflows/migrate.md +160 -160
- package/.agent/workflows/orchestrate.md +168 -168
- package/.agent/workflows/performance-benchmarker.md +114 -123
- package/.agent/workflows/plan.md +173 -173
- package/.agent/workflows/preview.md +80 -80
- package/.agent/workflows/refactor.md +161 -183
- package/.agent/workflows/review-ai.md +101 -129
- package/.agent/workflows/review.md +116 -116
- package/.agent/workflows/session.md +94 -94
- package/.agent/workflows/status.md +79 -79
- package/.agent/workflows/strengthen-skills.md +138 -139
- package/.agent/workflows/swarm.md +179 -179
- package/.agent/workflows/test.md +189 -211
- package/.agent/workflows/tribunal-backend.md +94 -113
- package/.agent/workflows/tribunal-database.md +95 -115
- package/.agent/workflows/tribunal-frontend.md +96 -118
- package/.agent/workflows/tribunal-full.md +93 -133
- package/.agent/workflows/tribunal-mobile.md +95 -119
- package/.agent/workflows/tribunal-performance.md +110 -133
- package/.agent/workflows/ui-ux-pro-max.md +122 -143
- package/README.md +30 -1
- package/bin/tribunal-kit.js +175 -12
- package/package.json +25 -4
- package/.agent/skills/api-patterns/api-style.md +0 -42
- package/.agent/skills/api-patterns/auth.md +0 -24
- package/.agent/skills/api-patterns/documentation.md +0 -26
- package/.agent/skills/api-patterns/graphql.md +0 -41
- package/.agent/skills/api-patterns/rate-limiting.md +0 -31
- package/.agent/skills/api-patterns/response.md +0 -37
- package/.agent/skills/api-patterns/rest.md +0 -40
- package/.agent/skills/api-patterns/security-testing.md +0 -122
- package/.agent/skills/api-patterns/trpc.md +0 -41
- package/.agent/skills/api-patterns/versioning.md +0 -22
- package/.agent/skills/app-builder/agent-coordination.md +0 -71
- package/.agent/skills/app-builder/feature-building.md +0 -53
- package/.agent/skills/app-builder/project-detection.md +0 -34
- package/.agent/skills/app-builder/scaffolding.md +0 -118
- package/.agent/skills/app-builder/tech-stack.md +0 -40
- package/.agent/skills/architecture/context-discovery.md +0 -43
- package/.agent/skills/architecture/examples.md +0 -94
- package/.agent/skills/architecture/pattern-selection.md +0 -68
- package/.agent/skills/architecture/patterns-reference.md +0 -50
- package/.agent/skills/architecture/trade-off-analysis.md +0 -77
- package/.agent/skills/brainstorming/dynamic-questioning.md +0 -360
- package/.agent/skills/database-design/database-selection.md +0 -43
- package/.agent/skills/database-design/indexing.md +0 -39
- package/.agent/skills/database-design/migrations.md +0 -48
- package/.agent/skills/database-design/optimization.md +0 -36
- package/.agent/skills/database-design/orm-selection.md +0 -30
- package/.agent/skills/database-design/schema-design.md +0 -56
- package/.agent/skills/frontend-design/animation-guide.md +0 -331
- package/.agent/skills/frontend-design/color-system.md +0 -329
- package/.agent/skills/frontend-design/decision-trees.md +0 -418
- package/.agent/skills/frontend-design/motion-graphics.md +0 -306
- package/.agent/skills/frontend-design/typography-system.md +0 -363
- package/.agent/skills/frontend-design/ux-psychology.md +0 -1116
- package/.agent/skills/frontend-design/visual-effects.md +0 -383
- package/.agent/skills/intelligent-routing/router-manifest.md +0 -65
- package/.agent/skills/mobile-design/decision-trees.md +0 -516
- package/.agent/skills/mobile-design/mobile-backend.md +0 -491
- package/.agent/skills/mobile-design/mobile-color-system.md +0 -420
- package/.agent/skills/mobile-design/mobile-debugging.md +0 -122
- package/.agent/skills/mobile-design/mobile-design-thinking.md +0 -357
- package/.agent/skills/mobile-design/mobile-navigation.md +0 -458
- package/.agent/skills/mobile-design/mobile-performance.md +0 -767
- package/.agent/skills/mobile-design/mobile-testing.md +0 -356
- package/.agent/skills/mobile-design/mobile-typography.md +0 -433
- package/.agent/skills/mobile-design/platform-android.md +0 -666
- package/.agent/skills/mobile-design/platform-ios.md +0 -561
- package/.agent/skills/mobile-design/touch-psychology.md +0 -537
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +0 -312
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +0 -240
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +0 -490
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +0 -264
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +0 -581
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +0 -432
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +0 -684
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +0 -150
- package/.agent/skills/vulnerability-scanner/checklists.md +0 -121
package/bin/tribunal-kit.js
CHANGED
|
@@ -270,17 +270,30 @@ function banner() {
|
|
|
270
270
|
if (quiet) return;
|
|
271
271
|
// Big ASCII art (TRIBUNAL-KIT)
|
|
272
272
|
const art = String.raw`
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
273
|
+
████████╗██████╗ ██╗██████╗ ██╗ ██╗███╗ ██╗ █████╗ ██╗ ██╗ ██╗██╗████████╗
|
|
274
|
+
╚══██╔══╝██╔══██╗██║██╔══██╗██║ ██║████╗ ██║██╔══██╗██║ ██║ ██╔╝██║╚══██╔══╝
|
|
275
|
+
██║ ██████╔╝██║██████╔╝██║ ██║██╔██╗ ██║███████║██║█████╗█████╔╝ ██║ ██║
|
|
276
|
+
██║ ██╔══██╗██║██╔══██╗██║ ██║██║╚██╗██║██╔══██║██║╚════╝██╔═██╗ ██║ ██║
|
|
277
|
+
██║ ██║ ██║██║██████╔╝╚██████╔╝██║ ╚████║██║ ██║███████╗ ██║ ██╗██║ ██║
|
|
278
|
+
╚═╝ ╚═╝ ╚═╝╚═╝╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ `.split('\n').filter(Boolean);
|
|
279
279
|
console.log();
|
|
280
|
-
|
|
280
|
+
const maxLen = Math.max(...art.map(line => line.length));
|
|
281
|
+
for (const line of art) {
|
|
282
|
+
let gradientLine = ' ' + C.bold;
|
|
283
|
+
for (let i = 0; i < line.length; i++) {
|
|
284
|
+
const p = maxLen > 1 ? i / (maxLen - 1) : 0;
|
|
285
|
+
// Coquelicot #FF4000 to Penn Blue #0A1045
|
|
286
|
+
const r = Math.round(255 + p * (10 - 255));
|
|
287
|
+
const g = Math.round(64 + p * (16 - 64));
|
|
288
|
+
const b = Math.round(0 + p * (69 - 0));
|
|
289
|
+
gradientLine += `\x1b[38;2;${r};${g};${b}m${line[i]}`;
|
|
290
|
+
}
|
|
291
|
+
gradientLine += C.reset;
|
|
292
|
+
log(gradientLine);
|
|
293
|
+
}
|
|
281
294
|
console.log();
|
|
282
295
|
// Subtitle strip
|
|
283
|
-
const W =
|
|
296
|
+
const W = 84;
|
|
284
297
|
const sub = 'Anti-Hallucination Agent System';
|
|
285
298
|
const sp = Math.max(0, W - sub.length);
|
|
286
299
|
const centred = ' '.repeat(Math.floor(sp / 2)) + sub + ' '.repeat(Math.ceil(sp / 2));
|
|
@@ -344,6 +357,18 @@ function cmdInit(flags) {
|
|
|
344
357
|
}
|
|
345
358
|
}
|
|
346
359
|
|
|
360
|
+
// Ensure history dirs exist (Case Law + Skill Evolution)
|
|
361
|
+
if (!dryRun) {
|
|
362
|
+
const caseDir = path.join(agentDest, 'history', 'case-law', 'cases');
|
|
363
|
+
const evoDir = path.join(agentDest, 'history', 'skill-evolution');
|
|
364
|
+
fs.mkdirSync(caseDir, { recursive: true });
|
|
365
|
+
fs.mkdirSync(evoDir, { recursive: true });
|
|
366
|
+
const gkCase = path.join(caseDir, '.gitkeep');
|
|
367
|
+
const gkEvo = path.join(evoDir, '.gitkeep');
|
|
368
|
+
if (!fs.existsSync(gkCase)) fs.writeFileSync(gkCase, '');
|
|
369
|
+
if (!fs.existsSync(gkEvo)) fs.writeFileSync(gkEvo, '');
|
|
370
|
+
}
|
|
371
|
+
|
|
347
372
|
// Count what we're installing
|
|
348
373
|
const totalFiles = countDir(agentSrc);
|
|
349
374
|
log(` ${c('gray','▸')} Scanning ${c('white', String(totalFiles))} files ${c('gray','→')} ${c('gray', agentDest)}`);
|
|
@@ -436,6 +461,60 @@ function cmdUpdate(flags) {
|
|
|
436
461
|
cmdInit(flags);
|
|
437
462
|
}
|
|
438
463
|
|
|
464
|
+
|
|
465
|
+
function cmdLearn(flags) {
|
|
466
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
467
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
468
|
+
|
|
469
|
+
if (!fs.existsSync(agentDest)) {
|
|
470
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
471
|
+
process.exit(1);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
banner();
|
|
475
|
+
|
|
476
|
+
const W = 62;
|
|
477
|
+
const title = ' Tribunal Learn — Supreme Court Mode';
|
|
478
|
+
const trail = ' '.repeat(Math.max(0, W - title.length));
|
|
479
|
+
console.log(` ${c('cyan', '\u2554' + '\u2550'.repeat(W) + '\u2557')}`);
|
|
480
|
+
console.log(` ${c('cyan', '\u2551')}${c('bold', c('white', title))}${trail}${c('cyan', '\u2551')}`);
|
|
481
|
+
console.log(` ${c('cyan', '\u255a' + '\u2550'.repeat(W) + '\u255d')}`);
|
|
482
|
+
console.log();
|
|
483
|
+
|
|
484
|
+
const dryRun = flags.dryRun ? '--dry-run' : '';
|
|
485
|
+
const useHead = flags.head ? '--head' : '';
|
|
486
|
+
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
487
|
+
const { execSync } = require('child_process');
|
|
488
|
+
|
|
489
|
+
// Phase 1: Skill Evolution
|
|
490
|
+
log(` ${c('cyan', '\u229b')} ${bold('Phase 1')} \u2014 Skill Evolution Forge (auto-generating project idioms)`);
|
|
491
|
+
const evoScript = path.join(agentDest, 'scripts', 'skill_evolution.py');
|
|
492
|
+
if (!fs.existsSync(evoScript)) {
|
|
493
|
+
warn('skill_evolution.py not found \u2014 run: npx tribunal-kit update');
|
|
494
|
+
} else {
|
|
495
|
+
try {
|
|
496
|
+
const cmd = `${python} "${evoScript}" digest ${dryRun} ${useHead}`.trim();
|
|
497
|
+
execSync(cmd, { stdio: 'inherit', cwd: targetDir });
|
|
498
|
+
} catch (e) {
|
|
499
|
+
warn(`Skill Evolution error: ${e.message}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
console.log();
|
|
504
|
+
|
|
505
|
+
// Phase 2: Case Law prompt
|
|
506
|
+
log(` ${c('cyan', '\u229b')} ${bold('Phase 2')} \u2014 Case Law Engine (building precedence record)`);
|
|
507
|
+
console.log();
|
|
508
|
+
log(` ${c('gray','\u25b8')} Record a new rejection precedent:`);
|
|
509
|
+
log(` ${c('white', 'npx tribunal-kit case add')}`);
|
|
510
|
+
console.log();
|
|
511
|
+
log(` ${c('gray','\u25b8')} Search existing case law:`);
|
|
512
|
+
log(` ${c('white', 'npx tribunal-kit case search "your query"')}`);
|
|
513
|
+
console.log();
|
|
514
|
+
log(` ${c('green', '\u2714')} ${bold('Learn cycle complete.')} Your Tribunal grows smarter with every commit.`);
|
|
515
|
+
console.log();
|
|
516
|
+
}
|
|
517
|
+
|
|
439
518
|
// ── Async Main Wrapper ───────────────────────────────────
|
|
440
519
|
async function runWithUpdateCheck(command, flags) {
|
|
441
520
|
const shouldSkip = flags.skipUpdateCheck || process.env.TK_SKIP_UPDATE_CHECK === '1';
|
|
@@ -460,6 +539,15 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
460
539
|
case 'status':
|
|
461
540
|
cmdStatus(flags);
|
|
462
541
|
break;
|
|
542
|
+
case 'learn':
|
|
543
|
+
cmdLearn(flags);
|
|
544
|
+
break;
|
|
545
|
+
case 'case':
|
|
546
|
+
cmdCase(flags);
|
|
547
|
+
break;
|
|
548
|
+
case 'hook':
|
|
549
|
+
cmdHook(flags);
|
|
550
|
+
break;
|
|
463
551
|
case 'help':
|
|
464
552
|
case '--help':
|
|
465
553
|
case '-h':
|
|
@@ -474,6 +562,70 @@ async function runWithUpdateCheck(command, flags) {
|
|
|
474
562
|
}
|
|
475
563
|
}
|
|
476
564
|
|
|
565
|
+
function cmdCase(flags) {
|
|
566
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
567
|
+
const agentDest = path.join(targetDir, '.agent');
|
|
568
|
+
|
|
569
|
+
if (!fs.existsSync(agentDest)) {
|
|
570
|
+
err('.agent/ not found. Run: npx tribunal-kit init');
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const args = process.argv.slice(3).join(' ');
|
|
575
|
+
if (!args || args === 'help' || args === '--help' || args === '-h') {
|
|
576
|
+
banner();
|
|
577
|
+
log(` ${c('cyan', '\u2554' + '\u2550'.repeat(60) + '\u2557')}`);
|
|
578
|
+
log(` ${c('cyan', '\u2551')}${c('bold', c('white', ' Tribunal Case Law Engine \u2014 Supreme Court '))}${c('cyan', '\u2551')}`);
|
|
579
|
+
log(` ${c('cyan', '\u255a' + '\u2550'.repeat(60) + '\u255d')}`);
|
|
580
|
+
console.log();
|
|
581
|
+
log(` ${c('cyan', 'add'.padEnd(10))} ${c('gray', 'Record a new Case Law rejection pattern')}`);
|
|
582
|
+
log(` ${c('cyan', 'search'.padEnd(10))} ${c('gray', 'Search existing cases (e.g., search "query")')}`);
|
|
583
|
+
log(` ${c('cyan', 'list'.padEnd(10))} ${c('gray', 'List all recorded case law')}`);
|
|
584
|
+
console.log();
|
|
585
|
+
process.exit(1);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
589
|
+
const caseLawScript = path.join(agentDest, 'scripts', 'case_law_manager.py');
|
|
590
|
+
|
|
591
|
+
// Make shorthand aliases
|
|
592
|
+
let pyArgs = args;
|
|
593
|
+
if (pyArgs.startsWith('add')) pyArgs = pyArgs.replace(/^add/, 'add-case');
|
|
594
|
+
if (pyArgs.startsWith('search')) pyArgs = pyArgs.replace(/^search/, 'search-cases');
|
|
595
|
+
|
|
596
|
+
try {
|
|
597
|
+
const { execSync } = require('child_process');
|
|
598
|
+
execSync(`${python} "${caseLawScript}" ${pyArgs}`, { stdio: 'inherit', cwd: targetDir });
|
|
599
|
+
} catch (e) {
|
|
600
|
+
process.exit(1); // Script already prints errors
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function cmdHook(flags) {
|
|
605
|
+
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
606
|
+
const gitDir = path.join(targetDir, '.git');
|
|
607
|
+
|
|
608
|
+
if (!fs.existsSync(gitDir)) {
|
|
609
|
+
err('Not a git repository. Cannot install git hooks here.');
|
|
610
|
+
process.exit(1);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
const hooksDir = path.join(gitDir, 'hooks');
|
|
614
|
+
if (!fs.existsSync(hooksDir)) {
|
|
615
|
+
fs.mkdirSync(hooksDir, { recursive: true });
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
const prePushPath = path.join(hooksDir, 'pre-push');
|
|
619
|
+
const hookScript = `#!/bin/sh\n# Supreme Court - Auto Learn on Push\necho "⚖️ Tribunal Supreme Court: Evolving Skills..."\nnpx tribunal-kit learn --head\n`;
|
|
620
|
+
|
|
621
|
+
fs.writeFileSync(prePushPath, hookScript, { mode: 0o755 });
|
|
622
|
+
|
|
623
|
+
console.log();
|
|
624
|
+
log(` ${c('green', '✔')} Installed pre-push git hook.`);
|
|
625
|
+
log(` ${c('gray', '▸')} Skill Evolution will now run automatically every time you git push.`);
|
|
626
|
+
console.log();
|
|
627
|
+
}
|
|
628
|
+
|
|
477
629
|
function cmdStatus(flags) {
|
|
478
630
|
const targetDir = flags.path ? path.resolve(flags.path) : process.cwd();
|
|
479
631
|
const agentDest = path.join(targetDir, '.agent');
|
|
@@ -515,6 +667,9 @@ function cmdHelp() {
|
|
|
515
667
|
log(cmd('init', 'Install .agent/ into current project'));
|
|
516
668
|
log(cmd('update', 'Re-install to get latest version'));
|
|
517
669
|
log(cmd('status', 'Check if .agent/ is installed'));
|
|
670
|
+
log(cmd('learn', 'Evolve project idioms based on git diffs'));
|
|
671
|
+
log(cmd('case', 'Manage Case Law precedents (add, search, list)'));
|
|
672
|
+
log(cmd('hook', 'Install pre-push git hook for auto-learning'));
|
|
518
673
|
console.log();
|
|
519
674
|
log(bold(' Options'));
|
|
520
675
|
log(` ${c('gray','─'.repeat(40))}`);
|
|
@@ -523,6 +678,7 @@ function cmdHelp() {
|
|
|
523
678
|
log(opt('--quiet', 'Suppress all output'));
|
|
524
679
|
log(opt('--dry-run', 'Preview actions without executing'));
|
|
525
680
|
log(opt('--skip-update-check', 'Skip auto-update version check'));
|
|
681
|
+
log(opt('--head', '(learn) Diff against last commit instead of staged'));
|
|
526
682
|
console.log();
|
|
527
683
|
log(bold(' Examples'));
|
|
528
684
|
log(` ${c('gray','─'.repeat(40))}`);
|
|
@@ -532,6 +688,13 @@ function cmdHelp() {
|
|
|
532
688
|
log(ex('npx tribunal-kit init --dry-run'));
|
|
533
689
|
log(ex('npx tribunal-kit update'));
|
|
534
690
|
log(ex('npx tribunal-kit status'));
|
|
691
|
+
log(ex('npx tribunal-kit learn'));
|
|
692
|
+
log(ex('npx tribunal-kit learn --dry-run'));
|
|
693
|
+
log(ex('npx tribunal-kit learn --head'));
|
|
694
|
+
log(ex('npx tribunal-kit case add'));
|
|
695
|
+
log(ex('npx tribunal-kit case search "useEffect"'));
|
|
696
|
+
log(ex('npx tribunal-kit case list'));
|
|
697
|
+
log(ex('npx tribunal-kit hook'));
|
|
535
698
|
console.log();
|
|
536
699
|
}
|
|
537
700
|
|
|
@@ -541,8 +704,8 @@ const { command, flags } = parseArgs(process.argv);
|
|
|
541
704
|
if (flags.quiet) quiet = true;
|
|
542
705
|
|
|
543
706
|
runWithUpdateCheck(command, flags);
|
|
544
|
-
|
|
545
|
-
// -- Exports (for testing) -- do not remove
|
|
546
|
-
if (require.main !== module) {
|
|
547
|
-
module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
|
|
707
|
+
|
|
708
|
+
// -- Exports (for testing) -- do not remove
|
|
709
|
+
if (require.main !== module) {
|
|
710
|
+
module.exports = { parseArgs, compareSemver, copyDir, countDir, isSelfInstall };
|
|
548
711
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tribunal-kit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Anti-Hallucination AI Agent Kit —
|
|
3
|
+
"version": "4.0.0",
|
|
4
|
+
"description": "Anti-Hallucination AI Agent Kit — 34 specialist agents, 26 slash commands, Swarm/Supervisor engine, and Supreme Court Tribunal review pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
|
+
"ai-agent",
|
|
7
8
|
"agent",
|
|
9
|
+
"agents",
|
|
10
|
+
"multi-agent",
|
|
11
|
+
"agentic",
|
|
12
|
+
"swarm",
|
|
13
|
+
"orchestration",
|
|
14
|
+
"llm",
|
|
15
|
+
"anti-hallucination",
|
|
8
16
|
"hallucination",
|
|
17
|
+
"code-review",
|
|
18
|
+
"code-quality",
|
|
9
19
|
"cursor",
|
|
20
|
+
"cursor-rules",
|
|
21
|
+
"cursorrules",
|
|
10
22
|
"windsurf",
|
|
23
|
+
"copilot",
|
|
24
|
+
"cline",
|
|
25
|
+
"gemini",
|
|
11
26
|
"antigravity",
|
|
12
27
|
"tribunal",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
28
|
+
"mcp",
|
|
29
|
+
"model-context-protocol",
|
|
30
|
+
"cli",
|
|
31
|
+
"devtools",
|
|
32
|
+
"ai-coding",
|
|
33
|
+
"autonomous-agents",
|
|
34
|
+
"coding-assistant",
|
|
35
|
+
"automation"
|
|
15
36
|
],
|
|
16
37
|
"homepage": "https://github.com/Harmitx7/tribunal-kit",
|
|
17
38
|
"repository": {
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# API Style Selection (2025)
|
|
2
|
-
|
|
3
|
-
> REST vs GraphQL vs tRPC - Hangi durumda hangisi?
|
|
4
|
-
|
|
5
|
-
## Decision Tree
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Who are the API consumers?
|
|
9
|
-
│
|
|
10
|
-
├── Public API / Multiple platforms
|
|
11
|
-
│ └── REST + OpenAPI (widest compatibility)
|
|
12
|
-
│
|
|
13
|
-
├── Complex data needs / Multiple frontends
|
|
14
|
-
│ └── GraphQL (flexible queries)
|
|
15
|
-
│
|
|
16
|
-
├── TypeScript frontend + backend (monorepo)
|
|
17
|
-
│ └── tRPC (end-to-end type safety)
|
|
18
|
-
│
|
|
19
|
-
├── Real-time / Event-driven
|
|
20
|
-
│ └── WebSocket + AsyncAPI
|
|
21
|
-
│
|
|
22
|
-
└── Internal microservices
|
|
23
|
-
└── gRPC (performance) or REST (simplicity)
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Comparison
|
|
27
|
-
|
|
28
|
-
| Factor | REST | GraphQL | tRPC |
|
|
29
|
-
|--------|------|---------|------|
|
|
30
|
-
| **Best for** | Public APIs | Complex apps | TS monorepos |
|
|
31
|
-
| **Learning curve** | Low | Medium | Low (if TS) |
|
|
32
|
-
| **Over/under fetching** | Common | Solved | Solved |
|
|
33
|
-
| **Type safety** | Manual (OpenAPI) | Schema-based | Automatic |
|
|
34
|
-
| **Caching** | HTTP native | Complex | Client-based |
|
|
35
|
-
|
|
36
|
-
## Selection Questions
|
|
37
|
-
|
|
38
|
-
1. Who are the API consumers?
|
|
39
|
-
2. Is the frontend TypeScript?
|
|
40
|
-
3. How complex are the data relationships?
|
|
41
|
-
4. Is caching critical?
|
|
42
|
-
5. Public or internal API?
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# Authentication Patterns
|
|
2
|
-
|
|
3
|
-
> Choose auth pattern based on use case.
|
|
4
|
-
|
|
5
|
-
## Selection Guide
|
|
6
|
-
|
|
7
|
-
| Pattern | Best For |
|
|
8
|
-
|---------|----------|
|
|
9
|
-
| **JWT** | Stateless, microservices |
|
|
10
|
-
| **Session** | Traditional web, simple |
|
|
11
|
-
| **OAuth 2.0** | Third-party integration |
|
|
12
|
-
| **API Keys** | Server-to-server, public APIs |
|
|
13
|
-
| **Passkey** | Modern passwordless (2025+) |
|
|
14
|
-
|
|
15
|
-
## JWT Principles
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
Important:
|
|
19
|
-
├── Always verify signature
|
|
20
|
-
├── Check expiration
|
|
21
|
-
├── Include minimal claims
|
|
22
|
-
├── Use short expiry + refresh tokens
|
|
23
|
-
└── Never store sensitive data in JWT
|
|
24
|
-
```
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# API Documentation Principles
|
|
2
|
-
|
|
3
|
-
> Good docs = happy developers = API adoption.
|
|
4
|
-
|
|
5
|
-
## OpenAPI/Swagger Essentials
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Include:
|
|
9
|
-
├── All endpoints with examples
|
|
10
|
-
├── Request/response schemas
|
|
11
|
-
├── Authentication requirements
|
|
12
|
-
├── Error response formats
|
|
13
|
-
└── Rate limiting info
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Good Documentation Has
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
Essentials:
|
|
20
|
-
├── Quick start / Getting started
|
|
21
|
-
├── Authentication guide
|
|
22
|
-
├── Complete API reference
|
|
23
|
-
├── Error handling guide
|
|
24
|
-
├── Code examples (multiple languages)
|
|
25
|
-
└── Changelog
|
|
26
|
-
```
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# GraphQL Principles
|
|
2
|
-
|
|
3
|
-
> Flexible queries for complex, interconnected data.
|
|
4
|
-
|
|
5
|
-
## When to Use
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
✅ Good fit:
|
|
9
|
-
├── Complex, interconnected data
|
|
10
|
-
├── Multiple frontend platforms
|
|
11
|
-
├── Clients need flexible queries
|
|
12
|
-
├── Evolving data requirements
|
|
13
|
-
└── Reducing over-fetching matters
|
|
14
|
-
|
|
15
|
-
❌ Poor fit:
|
|
16
|
-
├── Simple CRUD operations
|
|
17
|
-
├── File upload heavy
|
|
18
|
-
├── HTTP caching important
|
|
19
|
-
└── Team unfamiliar with GraphQL
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Schema Design Principles
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
Principles:
|
|
26
|
-
├── Think in graphs, not endpoints
|
|
27
|
-
├── Design for evolvability (no versions)
|
|
28
|
-
├── Use connections for pagination
|
|
29
|
-
├── Be specific with types (not generic "data")
|
|
30
|
-
└── Handle nullability thoughtfully
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Security Considerations
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
Protect against:
|
|
37
|
-
├── Query depth attacks → Set max depth
|
|
38
|
-
├── Query complexity → Calculate cost
|
|
39
|
-
├── Batching abuse → Limit batch size
|
|
40
|
-
├── Introspection → Disable in production
|
|
41
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Rate Limiting Principles
|
|
2
|
-
|
|
3
|
-
> Protect your API from abuse and overload.
|
|
4
|
-
|
|
5
|
-
## Why Rate Limit
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Protect against:
|
|
9
|
-
├── Brute force attacks
|
|
10
|
-
├── Resource exhaustion
|
|
11
|
-
├── Cost overruns (if pay-per-use)
|
|
12
|
-
└── Unfair usage
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Strategy Selection
|
|
16
|
-
|
|
17
|
-
| Type | How | When |
|
|
18
|
-
|------|-----|------|
|
|
19
|
-
| **Token bucket** | Burst allowed, refills over time | Most APIs |
|
|
20
|
-
| **Sliding window** | Smooth distribution | Strict limits |
|
|
21
|
-
| **Fixed window** | Simple counters per window | Basic needs |
|
|
22
|
-
|
|
23
|
-
## Response Headers
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
Include in headers:
|
|
27
|
-
├── X-RateLimit-Limit (max requests)
|
|
28
|
-
├── X-RateLimit-Remaining (requests left)
|
|
29
|
-
├── X-RateLimit-Reset (when limit resets)
|
|
30
|
-
└── Return 429 when exceeded
|
|
31
|
-
```
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Response Format Principles
|
|
2
|
-
|
|
3
|
-
> Consistency is key - choose a format and stick to it.
|
|
4
|
-
|
|
5
|
-
## Common Patterns
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Choose one:
|
|
9
|
-
├── Envelope pattern ({ success, data, error })
|
|
10
|
-
├── Direct data (just return the resource)
|
|
11
|
-
└── HAL/JSON:API (hypermedia)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Error Response
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
Include:
|
|
18
|
-
├── Error code (for programmatic handling)
|
|
19
|
-
├── User message (for display)
|
|
20
|
-
├── Details (for debugging, field-level errors)
|
|
21
|
-
├── Request ID (for support)
|
|
22
|
-
└── NOT internal details (security!)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Pagination Types
|
|
26
|
-
|
|
27
|
-
| Type | Best For | Trade-offs |
|
|
28
|
-
|------|----------|------------|
|
|
29
|
-
| **Offset** | Simple, jumpable | Performance on large datasets |
|
|
30
|
-
| **Cursor** | Large datasets | Can't jump to page |
|
|
31
|
-
| **Keyset** | Performance critical | Requires sortable key |
|
|
32
|
-
|
|
33
|
-
### Selection Questions
|
|
34
|
-
|
|
35
|
-
1. How large is the dataset?
|
|
36
|
-
2. Do users need to jump to specific pages?
|
|
37
|
-
3. Is data frequently changing?
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# REST Principles
|
|
2
|
-
|
|
3
|
-
> Resource-based API design - nouns not verbs.
|
|
4
|
-
|
|
5
|
-
## Resource Naming Rules
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
Principles:
|
|
9
|
-
├── Use NOUNS, not verbs (resources, not actions)
|
|
10
|
-
├── Use PLURAL forms (/users not /user)
|
|
11
|
-
├── Use lowercase with hyphens (/user-profiles)
|
|
12
|
-
├── Nest for relationships (/users/123/posts)
|
|
13
|
-
└── Keep shallow (max 3 levels deep)
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## HTTP Method Selection
|
|
17
|
-
|
|
18
|
-
| Method | Purpose | Idempotent? | Body? |
|
|
19
|
-
|--------|---------|-------------|-------|
|
|
20
|
-
| **GET** | Read resource(s) | Yes | No |
|
|
21
|
-
| **POST** | Create new resource | No | Yes |
|
|
22
|
-
| **PUT** | Replace entire resource | Yes | Yes |
|
|
23
|
-
| **PATCH** | Partial update | No | Yes |
|
|
24
|
-
| **DELETE** | Remove resource | Yes | No |
|
|
25
|
-
|
|
26
|
-
## Status Code Selection
|
|
27
|
-
|
|
28
|
-
| Situation | Code | Why |
|
|
29
|
-
|-----------|------|-----|
|
|
30
|
-
| Success (read) | 200 | Standard success |
|
|
31
|
-
| Created | 201 | New resource created |
|
|
32
|
-
| No content | 204 | Success, nothing to return |
|
|
33
|
-
| Bad request | 400 | Malformed request |
|
|
34
|
-
| Unauthorized | 401 | Missing/invalid auth |
|
|
35
|
-
| Forbidden | 403 | Valid auth, no permission |
|
|
36
|
-
| Not found | 404 | Resource doesn't exist |
|
|
37
|
-
| Conflict | 409 | State conflict (duplicate) |
|
|
38
|
-
| Validation error | 422 | Valid syntax, invalid data |
|
|
39
|
-
| Rate limited | 429 | Too many requests |
|
|
40
|
-
| Server error | 500 | Our fault |
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# API Security Testing
|
|
2
|
-
|
|
3
|
-
> Principles for testing API security. OWASP API Top 10, authentication, authorization testing.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## OWASP API Security Top 10
|
|
8
|
-
|
|
9
|
-
| Vulnerability | Test Focus |
|
|
10
|
-
|---------------|------------|
|
|
11
|
-
| **API1: BOLA** | Access other users' resources |
|
|
12
|
-
| **API2: Broken Auth** | JWT, session, credentials |
|
|
13
|
-
| **API3: Property Auth** | Mass assignment, data exposure |
|
|
14
|
-
| **API4: Resource Consumption** | Rate limiting, DoS |
|
|
15
|
-
| **API5: Function Auth** | Admin endpoints, role bypass |
|
|
16
|
-
| **API6: Business Flow** | Logic abuse, automation |
|
|
17
|
-
| **API7: SSRF** | Internal network access |
|
|
18
|
-
| **API8: Misconfiguration** | Debug endpoints, CORS |
|
|
19
|
-
| **API9: Inventory** | Shadow APIs, old versions |
|
|
20
|
-
| **API10: Unsafe Consumption** | Third-party API trust |
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Authentication Testing
|
|
25
|
-
|
|
26
|
-
### JWT Testing
|
|
27
|
-
|
|
28
|
-
| Check | What to Test |
|
|
29
|
-
|-------|--------------|
|
|
30
|
-
| Algorithm | None, algorithm confusion |
|
|
31
|
-
| Secret | Weak secrets, brute force |
|
|
32
|
-
| Claims | Expiration, issuer, audience |
|
|
33
|
-
| Signature | Manipulation, key injection |
|
|
34
|
-
|
|
35
|
-
### Session Testing
|
|
36
|
-
|
|
37
|
-
| Check | What to Test |
|
|
38
|
-
|-------|--------------|
|
|
39
|
-
| Generation | Predictability |
|
|
40
|
-
| Storage | Client-side security |
|
|
41
|
-
| Expiration | Timeout enforcement |
|
|
42
|
-
| Invalidation | Logout effectiveness |
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Authorization Testing
|
|
47
|
-
|
|
48
|
-
| Test Type | Approach |
|
|
49
|
-
|-----------|----------|
|
|
50
|
-
| **Horizontal** | Access peer users' data |
|
|
51
|
-
| **Vertical** | Access higher privilege functions |
|
|
52
|
-
| **Context** | Access outside allowed scope |
|
|
53
|
-
|
|
54
|
-
### BOLA/IDOR Testing
|
|
55
|
-
|
|
56
|
-
1. Identify resource IDs in requests
|
|
57
|
-
2. Capture request with user A's session
|
|
58
|
-
3. Replay with user B's session
|
|
59
|
-
4. Check for unauthorized access
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## Input Validation Testing
|
|
64
|
-
|
|
65
|
-
| Injection Type | Test Focus |
|
|
66
|
-
|----------------|------------|
|
|
67
|
-
| SQL | Query manipulation |
|
|
68
|
-
| NoSQL | Document queries |
|
|
69
|
-
| Command | System commands |
|
|
70
|
-
| LDAP | Directory queries |
|
|
71
|
-
|
|
72
|
-
**Approach:** Test all parameters, try type coercion, test boundaries, check error messages.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Rate Limiting Testing
|
|
77
|
-
|
|
78
|
-
| Aspect | Check |
|
|
79
|
-
|--------|-------|
|
|
80
|
-
| Existence | Is there any limit? |
|
|
81
|
-
| Bypass | Headers, IP rotation |
|
|
82
|
-
| Scope | Per-user, per-IP, global |
|
|
83
|
-
|
|
84
|
-
**Bypass techniques:** X-Forwarded-For, different HTTP methods, case variations, API versioning.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
## GraphQL Security
|
|
89
|
-
|
|
90
|
-
| Test | Focus |
|
|
91
|
-
|------|-------|
|
|
92
|
-
| Introspection | Schema disclosure |
|
|
93
|
-
| Batching | Query DoS |
|
|
94
|
-
| Nesting | Depth-based DoS |
|
|
95
|
-
| Authorization | Field-level access |
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
## Security Testing Checklist
|
|
100
|
-
|
|
101
|
-
**Authentication:**
|
|
102
|
-
- [ ] Test for bypass
|
|
103
|
-
- [ ] Check credential strength
|
|
104
|
-
- [ ] Verify token security
|
|
105
|
-
|
|
106
|
-
**Authorization:**
|
|
107
|
-
- [ ] Test BOLA/IDOR
|
|
108
|
-
- [ ] Check privilege escalation
|
|
109
|
-
- [ ] Verify function access
|
|
110
|
-
|
|
111
|
-
**Input:**
|
|
112
|
-
- [ ] Test all parameters
|
|
113
|
-
- [ ] Check for injection
|
|
114
|
-
|
|
115
|
-
**Config:**
|
|
116
|
-
- [ ] Check CORS
|
|
117
|
-
- [ ] Verify headers
|
|
118
|
-
- [ ] Test error handling
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
> **Remember:** APIs are the backbone of modern apps. Test them like attackers will.
|