### Install @us-legal-tools/govinfo-sdk Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Install the SDK using npm, yarn, or bun. ```bash npm install @us-legal-tools/govinfo-sdk # or yarn add @us-legal-tools/govinfo-sdk # or bun add @us-legal-tools/govinfo-sdk ``` -------------------------------- ### Install Dependencies Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Installs all project dependencies using Bun. ```bash # Install dependencies bun install ``` -------------------------------- ### Run MCP Server Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Start the MCP server using npx or directly by executing the installed command. ```bash # Using npx npx @us-legal-tools/dol-sdk # Or directly dol-mcp-server ``` -------------------------------- ### Install DOL SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Install the SDK using npm, yarn, or bun. ```bash npm install @us-legal-tools/dol-sdk # or yarn add @us-legal-tools/dol-sdk # or bun add @us-legal-tools/dol-sdk ``` -------------------------------- ### Install Federal Register SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Install the SDK using npm, yarn, pnpm, or bun. ```bash # npm npm install @us-legal-tools/federal-register-sdk # yarn yarn add @us-legal-tools/federal-register-sdk # pnpm pnpm add @us-legal-tools/federal-register-sdk # bun bun add @us-legal-tools/federal-register-sdk ``` -------------------------------- ### Run MCP Server Locally Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Starts the MCP server from a local installation of the SDK. Requires the COURTLISTENER_API_TOKEN environment variable to be set. ```bash cd node_modules/@us-legal-tools/courtlistener-sdk COURTLISTENER_API_TOKEN=your-token npm run mcp:server ``` -------------------------------- ### Install CourtListener SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Install the CourtListener SDK using your preferred package manager. ```bash # npm npm install @us-legal-tools/courtlistener-sdk # yarn yarn add @us-legal-tools/courtlistener-sdk # pnpm pnpm add @us-legal-tools/courtlistener-sdk # bun bun add @us-legal-tools/courtlistener-sdk ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Installs project dependencies using the Bun runtime. ```bash bun install ``` -------------------------------- ### Install SDKs with npm Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Use npm to install any of the available SDKs for U.S. federal legal tools. ```bash npm install @us-legal-tools/ecfr-sdk npm install @us-legal-tools/federal-register-sdk npm install @us-legal-tools/courtlistener-sdk npm install @us-legal-tools/govinfo-sdk npm install @us-legal-tools/dol-sdk ``` -------------------------------- ### Build and Run Production Server with Bun Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Builds the project for production and then starts the production server using Bun. ```bash bun run build bun run start ``` -------------------------------- ### Quick Start: Initialize GovInfo Client and Search Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Initialize the GovInfo client with an API key and perform a search query. ```typescript import { createGovInfoClient } from '@us-legal-tools/govinfo-sdk'; // Initialize the client const client = createGovInfoClient({ apiKey: 'YOUR_API_KEY', // Get from https://api.data.gov/signup/ }); // Example: Search for documents const searchResults = await client.search({ query: 'climate change', pageSize: 10, }); ``` -------------------------------- ### Install CourtListener SDK with NPM, Yarn, or Bun Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Install the CourtListener SDK using your preferred package manager. This is the first step before using the SDK in your project. ```bash # Using npm npm install courtlistener-sdk # Using yarn yarn add courtlistener-sdk # Using bun bun add courtlistener-sdk ``` -------------------------------- ### Build GovInfo SDK from Source Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Steps to clone the repository, install dependencies, generate SDK code, build the package, and run tests. ```bash # Clone the repository git clone https://github.com/beshkenadze/us-legal-tools.git cd ecfr-sdk/packages/govinfo-sdk # Install dependencies bun install # Generate SDK from OpenAPI spec bun run generate # Build the package bun run build # Run tests bun test ``` -------------------------------- ### Install orval-config Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/orval-config/README.md Install the orval-config package as a development dependency using Bun. ```bash bun add -D @us-legal-tools/orval-config ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Clone the US Legal Tools repository and install project dependencies using Bun. ```bash git clone https://github.com/beshkenadze/us-legal-tools.git cd ecfr-sdk bun install ``` -------------------------------- ### Clone and Run Locally Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Clone the repository and set up the project locally for development. Includes installing dependencies, building the project, and running tests. ```bash git clone https://github.com/beshkenadze/us-legal-tools.git cd ecfr-sdk bun install turbo build ``` -------------------------------- ### Run Development Server with Bun Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Starts the development server using the Bun runtime. The server typically runs on http://localhost:3000. ```bash bun run dev ``` -------------------------------- ### Install ECFR SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Install the ECFR SDK using your preferred package manager (npm, yarn, pnpm, or bun). ```bash # npm npm install @us-legal-tools/ecfr-sdk # yarn yarn add @us-legal-tools/ecfr-sdk # pnpm pnpm add @us-legal-tools/ecfr-sdk # bun bun add @us-legal-tools/ecfr-sdk ``` -------------------------------- ### Example: Minor Release for Multiple Packages Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Illustrates creating a minor changeset for a new feature affecting multiple packages. This example shows selecting several packages and specifying a 'minor' version bump with a relevant summary. ```bash bun changeset # Select: @us-legal-tools/ecfr-sdk, @us-legal-tools/federal-register-sdk # Type: minor # Summary: Add pagination support to search endpoints ``` -------------------------------- ### Run MCP Server with SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Starts the MCP server using the CourtListener SDK directly. Requires the COURTLISTENER_API_TOKEN environment variable to be set. ```bash COURTLISTENER_API_TOKEN=your-token npx @us-legal-tools/courtlistener-sdk/mcp ``` -------------------------------- ### Example: Major Release for govinfo-sdk Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Shows how to create a major changeset for a breaking change in the govinfo-sdk package. This requires selecting the package, choosing 'major' as the type, and detailing the significant API refactoring in the summary. ```bash bun changeset # Select: @us-legal-tools/govinfo-sdk # Type: major # Summary: Refactor client API to use async/await pattern ``` -------------------------------- ### Install TanStack Query for React Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Install the necessary package for TanStack Query integration within your React project. This is a prerequisite for using the SDK's React hooks. ```bash npm install @tanstack/react-query ``` -------------------------------- ### Run MCP Server Directly Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Use this command to run the MCP server directly using the SDK. Ensure the SDK is installed. ```bash # Using the SDK directly npx @us-legal-tools/ecfr-sdk/mcp ``` -------------------------------- ### Example: Patch Release for ecfr-sdk Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Demonstrates creating a patch changeset for a bug fix in the ecfr-sdk package. This involves selecting the package, choosing 'patch' as the type, and providing a descriptive summary. ```bash bun changeset # Select: @us-legal-tools/ecfr-sdk # Type: patch # Summary: Fix API endpoint URL generation ``` -------------------------------- ### Build and Run Docker Compose for Scalar UI Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Builds the Docker image and then starts the Scalar UI service using Docker Compose. This command can be run from the scalar-ui directory. ```bash docker-compose up --build ``` -------------------------------- ### Run MCP Server with SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Execute the MCP server using the Federal Register SDK directly via npx or by running an npm script after local installation. ```bash # Using the SDK directly npx @us-legal-tools/federal-register-sdk/mcp # Or if installed locally cd node_modules/@us-legal-tools/federal-register-sdk npm run mcp:server ``` -------------------------------- ### Get Agencies Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Retrieves a list of all available agencies. ```APIDOC ## getAgencies ### Description Fetches a list of all agencies. ### Method Signature `getAgencies(): Promise> ` ### Response Example (Success) ```json [ { "name": "Agency Name", "slug": "agency-slug" } ] ``` ``` -------------------------------- ### Run MCP Server with Docker Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Pull and run the MCP server Docker image for a containerized environment. This simplifies setup and deployment. ```bash # Pull and run the Docker image docker run -i ghcr.io/beshkenadze/ecfr-mcp-server:latest ``` -------------------------------- ### Run Docker Compose for Scalar UI Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Starts the Scalar UI service using Docker Compose. This command can be run from the scalar-ui directory. ```bash docker-compose up ``` -------------------------------- ### Get Audio Recordings Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Retrieves audio recordings of oral arguments, with options to filter by court and date. ```APIDOC ## getAudio ### Description Retrieves a list of audio recordings for oral arguments. Allows filtering by court and date. ### Method GET ### Endpoint /audio/ ### Parameters #### Query Parameters - **docket__court** (string) - Optional - Filters audio recordings by the court associated with the docket (e.g., 'scotus'). - **argued_after** (string) - Optional - Filters audio recordings argued after a specific date (YYYY-MM-DD format). ### Response #### Success Response (200) - **results** (array) - An array of audio recording objects, each containing details like 'case_name', 'date_argued', and 'download_url'. ### Response Example ```json { "results": [ { "case_name": "Example Case", "date_argued": "2023-05-15", "download_url": "https://www.courtlistener.com/audio/example.mp3" } ] } ``` ``` -------------------------------- ### Get Oral Argument Audio Recordings Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Retrieve audio recordings of oral arguments for Supreme Court cases after a specified date. ```typescript import { getAudio } from '@us-legal-tools/courtlistener-sdk'; // Get oral arguments const audio = await getAudio({ docket__court: 'scotus', argued_after: '2023-01-01' }); audio.results.forEach(recording => { console.log(`${recording.case_name} - ${recording.date_argued}`); console.log(`Audio: ${recording.download_url}`); }); ``` -------------------------------- ### Configure Claude for MCP Server Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Integrate the Federal Register MCP server with Claude by adding its configuration to your Claude settings. This specifies the command and arguments needed to start the server. ```json { "mcpServers": { "federal-register": { "command": "npx", "args": ["@us-legal-tools/federal-register-sdk/mcp"] } } } ``` -------------------------------- ### Configure Axios Instance in ECFR SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Shows how to access and modify the SDK's underlying axios instance for custom configurations. Examples include adding request interceptors and modifying default timeouts. ```typescript import { axiosInstance } from '@us-legal-tools/ecfr-sdk'; // Add request interceptor axiosInstance.interceptors.request.use(config => { console.log('Making request to:', config.url); return config; }); // Modify timeout axiosInstance.defaults.timeout = 60000; // 60 seconds ``` -------------------------------- ### Get DOL Datasets Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Retrieves a list of available datasets from the Department of Labor. Requires an API key for authentication. Use this to discover available employment, wage, and economic statistics. ```typescript import { createApiClient } from '@us-legal-tools/dol-sdk'; const client = createApiClient({ headers: { 'X-API-KEY': process.env.DOL_API_KEY } }); // Get available datasets const datasets = await client.getDatasets(); console.log(`Available DOL datasets: ${datasets.data.datasets.length}`); datasets.data.datasets.forEach(dataset => { console.log(`- ${dataset.dataset_title}`); }); ``` -------------------------------- ### Get Opinion by ID Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Retrieves a specific opinion by its unique ID. Includes example error handling for common API issues. ```APIDOC ## getOpinionsId ### Description Fetches a specific opinion using its ID. ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the opinion. ### Request Example ```typescript import { getOpinionsId } from '@us-legal-tools/courtlistener-sdk'; try { const opinion = await getOpinionsId({ id: 123456 }); } catch (error) { // Handle errors } ``` ### Error Handling - **401**: Invalid API token. - **404**: Opinion not found. - **429**: Rate limit exceeded. ``` -------------------------------- ### Basic SDK Usage Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Demonstrates how to fetch DOL agencies, datasets, and statistics using the SDK. ```typescript import { getAgencies, getDatasets, getStatistics } from '@us-legal-tools/dol-sdk'; // Get all DOL agencies const agencies = await getAgencies(); // Get datasets filtered by agency const datasets = await getDatasets({ agency: 'BLS', format: 'json' }); // Get employment statistics const stats = await getStatistics('employment', { startDate: '2024-01-01', endDate: '2024-12-31' }); ``` -------------------------------- ### Get All Available Titles Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Retrieves a list of all available regulatory titles. ```APIDOC ## getApiVersionerV1TitlesJson ### Description Fetches a JSON object containing a list of all available regulatory titles. ### Method `getApiVersionerV1TitlesJson` ### Parameters None ### Response #### Success Response (200) - **titles** (array) - An array of objects, where each object represents a regulatory title. - **title_id** (string) - The identifier for the title. - **title_number** (string) - The number of the title. - **title_name** (string) - The name of the title. ### Request Example ```typescript import { getApiVersionerV1TitlesJson } from '@us-legal-tools/ecfr-sdk'; const titles = await getApiVersionerV1TitlesJson(); ``` ### Response Example ```json { "titles": [ { "title_id": "40", "title_number": "40", "title_name": "Protection of Environment" } ] } ``` ``` -------------------------------- ### Get Public Inspection Documents Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Retrieves documents currently available for public inspection. ```APIDOC ## getPublicInspectionDocumentsCurrentFormat ### Description Fetches documents that are currently on public inspection. ### Method Signature `getPublicInspectionDocumentsCurrentFormat(options: { format: 'json' }): Promise ` ### Parameters - **options.format** (string) - Required - The desired output format, typically 'json'. ### Response Example (Success) ```json { "results": [ { "title": "Public Inspection Document Title", "filing_date": "2024-01-01" } ] } ``` ``` -------------------------------- ### Configure GovInfo Client Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Initialize the GovInfo client with optional configuration like baseURL and timeout. ```typescript import { createGovInfoClient } from '@us-legal-tools/govinfo-sdk'; const client = createGovInfoClient({ apiKey: 'YOUR_API_KEY', baseURL: 'https://api.govinfo.gov', // Optional, this is the default timeout: 30000, // Optional timeout in ms }); ``` -------------------------------- ### Get Document by Number Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Retrieves details for a specific document using its document number. ```APIDOC ## getDocumentsDocumentNumberFormat ### Description Retrieves a specific document by its unique document number. ### Method Signature `getDocumentsDocumentNumberFormat(options: { documentNumber: string, format: 'json' }): Promise ` ### Parameters - **options.documentNumber** (string) - Required - The unique identifier for the document. - **options.format** (string) - Required - The desired output format, typically 'json'. ### Response Example (Success) ```json { "title": "Specific Document Title", "agencies": [ { "name": "Agency Name" } ], "publication_date": "2024-01-01", "pdf_url": "http://example.com/document.pdf" } ``` ``` -------------------------------- ### Initialize and Use CourtListener SDK Client Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Create an SDK client instance with your API key and base URL. Then, use the client to perform searches for legal documents, specifying query parameters like keywords and document type. ```typescript import { createClient, searchDocuments } from 'courtlistener-sdk'; // Create a client with your API key const client = createClient({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': 'Token your-api-key-here' } }); // Search for legal documents const results = await searchDocuments({ client, query: { q: 'constitutional law', type: 'o' // opinions } }); ``` -------------------------------- ### Generate and Build SDKs Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Generate all SDKs and then build all packages within the Turborepo monorepo. ```bash turbo generate turbo build ``` -------------------------------- ### Get Historical Regulation Version Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Retrieves a specific historical version of a regulation in XML format. ```APIDOC ## getApiVersionerV1FullDateTitleTitleXml ### Description Fetches a specific historical version of a regulation as an XML document. Be aware that large titles may cause timeouts. ### Method `getApiVersionerV1FullDateTitleTitleXml` ### Parameters #### Path Parameters - **date** (string) - Required - The date for the historical version (YYYY-MM-DD). - **title** (string) - Required - The title number of the regulation. #### Query Parameters - **part** (number) - Optional - The part number to retrieve. - **section** (string) - Optional - The section number to retrieve. ### Response #### Success Response (200) - **xml** (string) - The regulation content in XML format. ### Request Example ```typescript import { getApiVersionerV1FullDateTitleTitleXml } from '@us-legal-tools/ecfr-sdk'; const historicalVersion = await getApiVersionerV1FullDateTitleTitleXml( '2023-01-01', '40', { part: '50', section: '7' } ); ``` ### Response Example ```xml ``` ``` -------------------------------- ### Get Case Details Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Retrieves detailed information for a specific legal opinion or case using its unique ID. ```APIDOC ## getOpinionsId ### Description Fetches detailed information for a specific legal opinion or case identified by its unique ID. ### Method GET ### Endpoint /opinions/{id}/ ### Parameters #### Path Parameters - **id** (integer) - Required - The unique identifier of the opinion or case. ### Response #### Success Response (200) - **case_name** (string) - The name of the case. - **court** (string) - The court where the case was heard. - **date_filed** (string) - The date the opinion was filed. - **plain_text** (string) - The plain text content of the opinion. - **html** (string) - The HTML content of the opinion. ### Response Example ```json { "case_name": "Miranda v. Arizona", "court": "Supreme Court", "date_filed": "1966-06-13", "plain_text": "The privilege against self-incrimination...", "html": "

The privilege against self-incrimination...

" } ``` ``` -------------------------------- ### Run GovInfo SDK Tests Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Set the GovInfo API key in the environment or a .env file to run tests. ```bash # Set your API key in the environment export GOV_INFO_API_KEY=your_api_key_here # Or create a .env file in the project root echo "GOV_INFO_API_KEY=your_api_key_here" >> ../../.env # Run all tests bun test # Run e2e tests specifically bun run test:e2e ``` -------------------------------- ### Run MCP Servers for US Legal APIs Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Navigate to the respective SDK directory and run the MCP server using bun. Some servers require API tokens or keys to be set as environment variables. ```bash # Run eCFR MCP Server cd packages/ecfr-sdk bun run mcp:server ``` ```bash # Run Federal Register MCP Server cd packages/federal-register-sdk bun run mcp:server ``` ```bash # Run CourtListener MCP Server (requires API token) cd packages/courtlistener-sdk COURTLISTENER_API_TOKEN=your-token bun run mcp:server ``` ```bash # Run GovInfo MCP Server (requires API key) cd packages/govinfo-sdk GOV_INFO_API_KEY=your-key bun run mcp:server ``` ```bash # Run DOL MCP Server (requires API key) cd packages/dol-sdk DOL_API_KEY=your-key bun run mcp:server ``` -------------------------------- ### Get Specific Case Opinion Details Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Retrieve detailed information for a specific case opinion using its ID. ```typescript import { getOpinionsId } from '@us-legal-tools/courtlistener-sdk'; // Get a specific opinion const opinion = await getOpinionsId({ id: 123456 }); console.log(`Case: ${opinion.case_name}`); console.log(`Court: ${opinion.court}`); console.log(`Date: ${opinion.date_filed}`); console.log(`Text: ${opinion.plain_text || opinion.html}`); ``` -------------------------------- ### Get Current Public Inspection Documents Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Retrieve documents currently available for public inspection. Requires importing `getPublicInspectionDocumentsCurrentFormat`. ```typescript import { getPublicInspectionDocumentsCurrentFormat } from '@us-legal-tools/federal-register-sdk'; // Get current public inspection documents const piDocuments = await getPublicInspectionDocumentsCurrentFormat({ format: 'json' }); console.log('Documents on public inspection:'); piDocuments.results.forEach(doc => { console.log(`- ${doc.title} (Filing date: ${doc.filing_date})`); }); ``` -------------------------------- ### Run MCP Server Locally Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Navigate to the SDK directory and run the MCP server using npm. This is useful for local development. ```bash # Or if installed locally cd node_modules/@us-legal-tools/ecfr-sdk npm run mcp:server ``` -------------------------------- ### Configure SDK with API Token Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Set up the CourtListener SDK by providing your API token directly in the configuration. Ensure the base URL and authorization header are correctly formatted. ```typescript import { client } from 'courtlistener-sdk'; client.setConfig({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': 'Token your-api-key-here' } }); ``` -------------------------------- ### Run E2E Tests with API Key in Command Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/tests/README.md Execute end-to-end tests for the DOL SDK, providing the API key directly in the command if it's not set in the .env file. ```bash DOL_API_KEY=your_api_key bun test:e2e ``` -------------------------------- ### Create New SDK Package Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Steps to add a new SDK package to the monorepo, including directory creation and configuration updates. ```bash # Clone the repository git clone https://github.com/beshkenadze/us-legal-tools.git cd ecfr-sdk # Install dependencies bun install # Generate all SDKs turbo generate # Build all packages turbo build # Run tests turbo test ``` -------------------------------- ### Set DOL API Key in .env Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/tests/README.md Add your DOL API key to the .env file in the project root to configure the SDK. ```bash DOL_API_KEY=your_api_key_here ``` -------------------------------- ### Work on Specific Package Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Navigates into a specific package's directory and runs its tests. ```bash # Work on a specific package cd packages/ecfr-sdk bun test ``` -------------------------------- ### Build Docker Image for Scalar UI Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Builds a Docker image tagged as 'scalar-ui' using the provided Dockerfile in the scalar-ui package. ```bash docker build -t scalar-ui -f packages/scalar-ui/Dockerfile . ``` -------------------------------- ### Generate SDKs Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Generates all SDKs from OpenAPI specifications using Turbo. ```bash # Generate all SDKs from OpenAPI specs turbo generate ``` -------------------------------- ### Run All DOL SDK Tests Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/tests/README.md Execute all end-to-end tests for the DOL SDK using the bun test command. ```bash bun test ``` -------------------------------- ### MCP Server Integration Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Instructions for running the MCP server and integrating it with AI assistants like Claude. ```APIDOC ## MCP Server The MCP server allows AI assistants to interact with the Federal Register API. ### Running the Server ```bash # Using the SDK directly npx @us-legal-tools/federal-register-sdk/mcp # Or if installed locally cd node_modules/@us-legal-tools/federal-register-sdk npm run mcp:server ``` ### Integration with Claude Add the following to your Claude configuration: ```json { "mcpServers": { "federal-register": { "command": "npx", "args": ["@us-legal-tools/federal-register-sdk/mcp"] } } } ``` ``` -------------------------------- ### Build Packages Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Builds all packages within the project using Turbo. ```bash # Build all packages turbo build ``` -------------------------------- ### Run Tests Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Execute all tests for the project packages using the turbo command. ```bash turbo test ``` -------------------------------- ### SDK Configuration with Environment Variables Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md For enhanced security, store your API key in environment variables and configure the SDK to use it. This is the recommended approach for managing sensitive credentials. ```APIDOC ## SDK Configuration with Environment Variables ### Description For enhanced security, store your API key in environment variables and configure the SDK to use it. This is the recommended approach for managing sensitive credentials. ### Environment Variables ```bash # .env COURTLISTENER_API_KEY=your_api_key_here ``` ### Method ```typescript client.setConfig({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': `Token ${process.env.COURTLISTENER_API_KEY}` } }); ``` ``` -------------------------------- ### Configure SDK with Environment Variable Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Securely configure the CourtListener SDK by storing your API key in an environment variable. This method is recommended for production environments. ```bash # .env COURTLISTENER_API_KEY=your_api_key_here ``` ```typescript client.setConfig({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': `Token ${process.env.COURTLISTENER_API_KEY}` } }); ``` -------------------------------- ### Build All Packages Source: https://github.com/beshkenadze/us-legal-tools/blob/main/VERSION_RELEASE.md Execute this command to build all packages within the monorepo. This is a standard step in the release workflow to ensure all code is compiled. ```bash turbo build ``` -------------------------------- ### Prerelease Workflow with Changesets Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Commands to manage prereleases using Changesets, including entering, exiting, and versioning during a prerelease phase. ```bash # Create prerelease changeset bun changeset pre enter beta # Make changes and create changesets as normal bun changeset # Version as prerelease bun changeset version # When ready to exit prerelease bun changeset pre exit ``` -------------------------------- ### Configure MCP Server for Claude Desktop Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/govinfo-sdk/README.md Add this configuration to your Claude Desktop settings to enable the GovInfo MCP server. ```json { "mcpServers": { "govinfo": { "command": "npx", "args": ["@us-legal-tools/govinfo-sdk/mcp"], "env": { "GOVINFO_API_KEY": "YOUR_API_KEY" } } } } ``` -------------------------------- ### Configure API Key Environment Variable Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Set your DOL API key as an environment variable for authentication. ```bash export DOL_API_KEY=your-api-key-here ``` -------------------------------- ### Basic ECFR SDK Usage Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Demonstrates how to search for regulations and retrieve a list of available titles using the ECFR SDK. ```typescript import { getApiSearchV1Results, getApiVersionerV1TitlesJson } from '@us-legal-tools/ecfr-sdk'; // Search for regulations const searchResults = await getApiSearchV1Results({ query: 'environmental protection', per_page: 10, page: 1 }); console.log(`Found ${searchResults.meta.total_count} regulations`); searchResults.results.forEach(result => { console.log(`- Title ${result.hierarchy.title}: ${result.hierarchy_headings.join(' > ')}`); }); // Get all available titles const titles = await getApiVersionerV1TitlesJson(); console.log(`Available titles: ${titles.titles.length}`); ``` -------------------------------- ### Create a Changeset Source: https://github.com/beshkenadze/us-legal-tools/blob/main/VERSION_RELEASE.md Use this command during development to create a new changeset. You will be prompted to select packages, version type (patch, minor, or major), and describe the changes. ```bash bun changeset ``` -------------------------------- ### SDK Configuration with API Token Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Configure the CourtListener SDK with your API token obtained from CourtListener.com. This is the primary method for authenticating your requests. ```APIDOC ## SDK Configuration with API Token ### Description Configure the CourtListener SDK with your API token obtained from CourtListener.com. This is the primary method for authenticating your requests. ### Method ```typescript import { client } from 'courtlistener-sdk'; client.setConfig({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': 'Token your-api-key-here' } }); ``` ``` -------------------------------- ### Regenerate SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Regenerate the SDK from the DOL OpenAPI specification using the provided command. ```bash bun run generate ``` -------------------------------- ### Set up TanStack Query Client in React App Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Configure the QueryClient and wrap your application with QueryClientProvider to enable TanStack Query's features for data fetching and caching. ```tsx import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; const queryClient = new QueryClient(); function App() { return ( {/* Your app components */} ); } ``` -------------------------------- ### Run Tests Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Executes various types of tests (unit, integration, end-to-end) using Turbo. ```bash # Run tests turbo test turbo test:integration turbo test:e2e ``` -------------------------------- ### Configure AI Assistant MCP Servers Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md This JSON configuration specifies how an AI assistant can connect to various MCP servers. It includes the command to run, arguments, and necessary environment variables for authentication. ```json { "mcpServers": { "ecfr": { "command": "bunx", "args": ["@us-legal-tools/ecfr-sdk/mcp"] }, "federal-register": { "command": "bunx", "args": ["@us-legal-tools/federal-register-sdk/mcp"] }, "courtlistener": { "command": "bunx", "args": ["@us-legal-tools/courtlistener-sdk/mcp"], "env": { "COURTLISTENER_API_TOKEN": "your-token" } }, "govinfo": { "command": "bunx", "args": ["@us-legal-tools/govinfo-sdk/mcp"], "env": { "GOV_INFO_API_KEY": "your-key" } }, "dol": { "command": "bunx", "args": ["@us-legal-tools/dol-sdk/mcp"], "env": { "DOL_API_KEY": "your-key" } } } } ``` -------------------------------- ### Integrate MCP Server with Claude Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Configuration for integrating the CourtListener MCP server with Claude. Specifies the command, arguments, and environment variables needed. ```json { "mcpServers": { "courtlistener": { "command": "npx", "args": ["@us-legal-tools/courtlistener-sdk/mcp"], "env": { "COURTLISTENER_API_TOKEN": "your-token" } } } } ``` -------------------------------- ### Run Specific Package Command Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Executes a command for a specific package, filtering by its name. ```bash # Run a specific package's command turbo run build --filter=@us-legal-tools/ecfr-sdk ``` -------------------------------- ### Create Feature Branch and Commit Changes Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Standard Git commands for creating a feature branch, making changes, and committing them using Changesets. ```bash # Create feature branch git checkout -b feature/add-new-endpoint # Make changes # ... edit files ... # Create changeset bun changeset # Commit everything git add . git commit -m "feat: add new endpoint with changeset" # Push and create PR git push origin feature/add-new-endpoint ``` -------------------------------- ### Use useListOpinionsInfiniteQuery Hook for Pagination Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Fetch paginated lists of opinions using the useListOpinionsInfiniteQuery hook. This hook supports loading more data as the user scrolls, displaying opinion details and handling pagination states. ```tsx import { useListOpinionsInfiniteQuery } from 'courtlistener-sdk'; function OpinionsListComponent() { const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading } = useListOpinionsInfiniteQuery({ query: { ordering: '-date_created' } }); if (isLoading) return
Loading...
; return (
{data?.pages.map((page, i) => (
{page.results?.map((opinion) => (

{opinion.cluster?.case_name}

{opinion.type}

))}
))} {hasNextPage && ( )}
); } ``` -------------------------------- ### Format and Lint Code Source: https://github.com/beshkenadze/us-legal-tools/blob/main/README.md Applies code formatting and linting rules across the project using Turbo. ```bash # Format and lint turbo format turbo lint ``` -------------------------------- ### Run Only E2E DOL SDK Tests Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/tests/README.md Execute only the end-to-end tests for the DOL SDK. ```bash bun test:e2e ``` -------------------------------- ### Run Scalar UI Docker Container Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/scalar-ui/README.md Runs the 'scalar-ui' Docker container and maps port 3000 from the container to the host. ```bash docker run -p 3000:3000 scalar-ui ``` -------------------------------- ### Run Specific DOL SDK Test Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/tests/README.md Execute a specific end-to-end test file and filter for a particular test case using bun. ```bash bun test tests/e2e/api.e2e.test.ts -t "should list all available datasets" ``` -------------------------------- ### Changeset Configuration Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md The `.changeset/config.json` file configures the behavior of the Changesets tool for managing releases. ```json { "$schema": "https://changesets.com/config.json", "changelog": "@changesets/cli/changelog", "commit": false, "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch" } ``` -------------------------------- ### Configure API Key Programmatically Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/dol-sdk/README.md Alternatively, configure the API key directly within your code. ```typescript import { apiClient } from '@us-legal-tools/dol-sdk'; apiClient.defaults.headers['X-API-Key'] = 'your-api-key-here'; ``` -------------------------------- ### Commit and Push Changeset Source: https://github.com/beshkenadze/us-legal-tools/blob/main/VERSION_RELEASE.md After creating a changeset, add, commit, and push the changes to your feature branch. This prepares your changes for the automated release workflow. ```bash git add . git commit -m "feat: your feature with changeset" git push origin feature/your-feature ``` -------------------------------- ### Configure Claude with MCP Server Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/ecfr-sdk/README.md Integrate the MCP server with Claude by adding its configuration to your Claude settings. This allows AI assistants to interact with the eCFR API. ```json { "mcpServers": { "ecfr": { "command": "npx", "args": ["@us-legal-tools/ecfr-sdk/mcp"] } } } ``` -------------------------------- ### Unpublish from npm Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Commands for unpublishing a package from npm within 72 hours or deprecating it afterwards. ```bash # Within 72 hours npm unpublish @us-legal-tools/package-name@version # After 72 hours - deprecate instead npm deprecate @us-legal-tools/package-name@version "Critical bug, use version x.x.x" ``` -------------------------------- ### Configure CourtListener API Client Globally Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Set the base URL and authorization headers for the CourtListener SDK client globally. This configuration will be used by the TanStack Query hooks. ```tsx import { client } from 'courtlistener-sdk'; // Configure the client globally client.setConfig({ baseUrl: 'https://www.courtlistener.com/api/rest/v4', headers: { 'Authorization': 'Token your-api-key-here' } }); ``` -------------------------------- ### Authenticate with CourtListener API Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/README.md Configure API authentication by setting the COURTLISTENER_API_TOKEN environment variable or directly setting the Authorization header. ```typescript // Set via environment variable process.env.COURTLISTENER_API_TOKEN = 'your-token'; // Or configure the axios instance directly import { axiosInstance } from '@us-legal-tools/courtlistener-sdk'; axiosInstance.defaults.headers.common['Authorization'] = 'Token your-token'; ``` -------------------------------- ### Handle SDK Errors with try-catch Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md Use a try-catch block to gracefully handle potential errors during SDK operations, such as invalid search queries. ```typescript try { const results = await searchDocuments({ client, query: { q: 'invalid query' } }); } catch (error) { console.error('Search failed:', error); } ``` -------------------------------- ### Reset Versions to Match NPM Source: https://github.com/beshkenadze/us-legal-tools/blob/main/RELEASE.md Command to reset package versions to match the latest published versions on NPM, useful for resolving version conflicts. ```bash # Reset versions to match npm bun changeset version --snapshot-prerelease-template="" ``` -------------------------------- ### Basic Document Search and Agency Retrieval Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Search for documents using keywords and retrieve a list of all agencies. Requires importing `getDocumentsFormat` and `getAgencies`. ```typescript import { getDocumentsFormat, getAgencies } from '@us-legal-tools/federal-register-sdk'; // Search for documents const documents = await getDocumentsFormat({ format: 'json', per_page: 10, conditions: { term: 'climate change' } }); console.log(`Found ${documents.count} documents`); documents.results.forEach(doc => { console.log(`- ${doc.title} (${doc.publication_date})`); }); // Get all agencies const agencies = await getAgencies(); console.log(`Total agencies: ${agencies.length}`); ``` -------------------------------- ### Handle API Errors with SDK Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/federal-register-sdk/README.md Implement try-catch blocks to gracefully handle potential API errors, such as invalid request parameters (400) or rate limit exceeded (429). Ensure proper import of the SDK function. ```typescript import { getDocumentsFormat } from '@us-legal-tools/federal-register-sdk'; try { const results = await getDocumentsFormat({ format: 'json', per_page: 10 }); } catch (error) { if (error.response?.status === 400) { console.error('Invalid request parameters'); } else if (error.response?.status === 429) { console.error('Rate limit exceeded'); } else { console.error('API error:', error.message); } } ``` -------------------------------- ### Extend TypeDoc Configuration Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/orval-config/README.md Extend the TypeDoc documentation configuration by referencing '@us-legal-tools/orval-config/typedoc.json' in your typedoc.json. ```json { "extends": "@us-legal-tools/orval-config/typedoc.json" } ``` -------------------------------- ### Configure Orval with createOrvalConfig Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/orval-config/README.md Use the createOrvalConfig function to generate Orval configurations for both SDK and MCP (My Client Portal) services. This function takes separate configuration objects for each service. ```typescript import { defineConfig } from "orval"; import { createOrvalConfig } from "@us-legal-tools/orval-config"; export default defineConfig( createOrvalConfig( { // SDK configuration input: "./openapi.json", baseUrl: "https://api.example.com", mutator: { path: "./src/api/client.ts", name: "customInstance", }, }, { // MCP configuration input: "./openapi.json", baseUrl: "https://api.example.com", } ) ); ``` -------------------------------- ### Available Endpoints Overview Source: https://github.com/beshkenadze/us-legal-tools/blob/main/packages/courtlistener-sdk/SDK-INSTALLATION.md The CourtListener SDK provides direct access to all CourtListener API endpoints through dedicated functions. Below is a categorized list of available operations. ```APIDOC ## Available Endpoints ### Description The CourtListener SDK provides direct access to all CourtListener API endpoints through dedicated functions. Below is a categorized list of available operations. ### Search - `searchDocuments()` / `useSearchDocumentsQuery()` ### Citations - `lookupCitations()` / `useLookupCitationsMutation()` ### Case Law - `listClusters()` / `useListClustersQuery()` / `useListClustersInfiniteQuery()` - `getCluster()` / `useGetClusterQuery()` - `listOpinions()` / `useListOpinionsQuery()` / `useListOpinionsInfiniteQuery()` - `getOpinion()` / `useGetOpinionQuery()` - `listDockets()` / `useListDocketsQuery()` / `useListDocketsInfiniteQuery()` - `getDocket()` / `useGetDocketQuery()` ### Courts - `listCourts()` / `useListCourtsQuery()` / `useListCourtsInfiniteQuery()` - `getCourt()` / `useGetCourtQuery()` ### People (Judges) - `listPeople()` / `useListPeopleQuery()` / `useListPeopleInfiniteQuery()` - `getPerson()` / `useGetPersonQuery()` ### Audio (Oral Arguments) - `listAudio()` / `useListAudioQuery()` / `useListAudioInfiniteQuery()` - `getAudio()` / `useGetAudioQuery()` ```