### Install Package Source: https://docs.packmind.com/mcp-server Provides installation instructions for Packmind packages, guiding the agent to use `packmind-cli` or `render_package`. ```APIDOC ## POST /websites/packmind/install_package ### Description Provides installation instructions for Packmind packages. This tool returns guidance that directs the AI agent to either use the `packmind-cli` (if available) or call the `render_package` tool to generate file updates. ### Method POST ### Endpoint /websites/packmind/install_package ### Parameters #### Request Body - **packageSlug** (string) - Required - The slug of the package to install. Use `list_packages` to find available packages. - **relativePath** (string) - Required - The target directory where files should be installed (e.g., "/" for project root, "/packages/my-app/" for a monorepo subfolder) ### Request Example { "packageSlug": "typescript-best-practices", "relativePath": "/" } ### Response #### Success Response (200) - **installationInstructions** (string) - Step-by-step installation instructions. #### Response Example { "installationInstructions": "1. Check if packmind-cli is installed. 2. If yes, run 'packmind install typescript-best-practices --path /'. 3. If no, call render_package tool with packageSlug: 'typescript-best-practices' and relativePath: '/'." } ``` -------------------------------- ### Install Packmind with Docker Compose Script Source: https://docs.packmind.com/gs-install-self-hosted This script automates the creation of a Docker Compose setup for Packmind. It downloads the necessary files, makes them executable, and then runs the installation. After execution, Packmind is accessible via http://localhost:8081/. ```bash mkdir packmind && \ cd packmind && \ curl -fsSL -o install.sh https://raw.githubusercontent.com/PackmindHub/packmind/refs/heads/main/dockerfile/prod/setup-packmind-compose.sh && \ chmod +x install.sh && \ ./install.sh ``` -------------------------------- ### List Available Install Packages Source: https://docs.packmind.com/cli View a list of all available packages that can be downloaded and installed using the packmind-cli install command. This command helps in discovering available functionalities. ```bash packmind-cli install --list ``` -------------------------------- ### Install Packages Source: https://docs.packmind.com/cli Download and install specified packages and their standards to your local machine. This command creates necessary files for your AI coding assistant based on the installed packages. ```bash packmind-cli install [additional-package-slugs...] ``` ```bash packmind-cli install backend frontend ``` -------------------------------- ### View Details of an Install Package Source: https://docs.packmind.com/cli Display detailed information about a specific package using its slug. This command is useful for understanding the contents and purpose of a package before installation. ```bash packmind-cli install --show ``` -------------------------------- ### packmind.json File Structure Example Source: https://docs.packmind.com/gs-distribute Demonstrates the basic JSON structure of the `packmind.json` file, which tracks locally installed packages and their versions. The '*' symbol indicates the latest version is used. ```json { "packages": { "backend": "*", "frontend": "*", "security": "*" } } ``` -------------------------------- ### Create Command from Use Case Example Source: https://docs.packmind.com/commands-management This example demonstrates how to instruct an AI agent to create a Packmind command based on a completed series of tasks, specifically creating a new use case. ```natural-language Synthesize the steps we followed to create a new use case and create a Packmind command based on this ``` -------------------------------- ### Packmind CLI Package Installation Source: https://docs.packmind.com/gs-distribute This section covers the commands for installing packages using the Packmind CLI. It includes listing available packages, viewing package details, installing single or multiple packages, and updating packages based on the packmind.json file. ```APIDOC ## Packmind CLI Package Installation ### Description Commands to manage the installation of packages (collections of standards and commands) using the Packmind CLI. An API Key is required for authentication. ### Method CLI Command ### Endpoint N/A (CLI commands) ### Parameters #### CLI Commands - **`packmind-cli install --list`** - Lists all available packages. - **`packmind-cli install --show `** - Displays details for a specific package. - **`packmind-cli install [additional-package-slugs...]`** - Installs one or more specified packages. - **`packmind-cli install`** - Installs all packages listed in the `packmind.json` file. ### Request Example ```bash # List available packages packmind-cli install --list # View details of the 'backend' package packmind-cli install --show backend # Install 'backend' and 'frontend' packages packmind-cli install backend frontend # Install packages defined in packmind.json packmind-cli install ``` ### Response #### Success Response - Installation of specified packages and creation/update of `packmind.json`. #### Response Example ```json { "message": "Packages installed successfully.", "packmind_json_updated": true } ``` ``` -------------------------------- ### Install Packages Locally using CLI Source: https://docs.packmind.com/packages-management This command lists all available packages that can be installed locally on your machine using the Packmind CLI. This method does not require Git. ```bash packmind-cli install --list ``` -------------------------------- ### View Workspace Install Package Status Source: https://docs.packmind.com/cli Check the status of installed packages across your workspace by viewing all packmind.json files and their associated packages. This helps in understanding the current setup and identifying potential issues. ```bash packmind-cli install --status ``` -------------------------------- ### Install Packmind CLI globally using npm Source: https://docs.packmind.com/cli Installs the Packmind CLI globally on your system, making the 'packmind-cli' command available system-wide. This is a convenient option for frequent use. ```bash npm install -g @packmind/cli ``` -------------------------------- ### Install Specific Packages Locally using CLI Source: https://docs.packmind.com/packages-management This command installs specified packages (e.g., 'backend-api', 'frontend-web') directly to your local machine using the Packmind CLI. This bypasses the need for Git configuration. ```bash packmind-cli install backend-api frontend-web ``` -------------------------------- ### Onboarding Workflows API Source: https://docs.packmind.com/mcp-server Provides guided workflows for creating coding standards based on different information sources. Use this tool when first setting up standards for your organization. ```APIDOC ## POST /tools/onboarding ### Description Initiates onboarding workflows for creating coding standards. If no specific workflow is provided, it returns a guide to help select the appropriate workflow. ### Method POST ### Endpoint /tools/onboarding ### Parameters #### Query Parameters - **workflow** (string) - Optional - The name of the workflow to retrieve. Available workflows: `codebase-analysis`, `git-history`, `documentation`, `ai-instructions`, `web-research`. ### Request Example ```json { "tool_code": "onboarding", "parameters": { "workflow": "codebase-analysis" } } ``` ### Response #### Success Response (200) - **workflow_guidance** (object) - Details and steps for the selected onboarding workflow. #### Response Example ```json { "workflow_guidance": { "name": "codebase-analysis", "description": "Guide for analyzing existing codebase to extract standards.", "steps": [ // ... workflow steps ... ] } } ``` ``` -------------------------------- ### Render Package Source: https://docs.packmind.com/mcp-server Generates file updates for installing a Packmind package when `packmind-cli` is not available. ```APIDOC ## POST /websites/packmind/render_package ### Description Generates file updates for the AI agent to apply when installing a Packmind package. This tool is called by the AI agent after `install_package` when the `packmind-cli` is not available. ### Method POST ### Endpoint /websites/packmind/render_package ### Parameters #### Request Body - **packageSlug** (string) - Required - The slug of the package to render. Use `list_packages` to find available packages. - **installedPackages** (array) - Optional - Array of already installed package slugs from your `packmind.json` file. Read the file and extract the package slugs from the `packages` section to preserve existing installations. - **relativePath** (string) - Required - The target directory where files should be installed (e.g., "/" for project root, "/packages/my-app/" for a monorepo subfolder) - **gitRemoteUrl** (string) - Required - The git remote URL of your repository. Run `git remote get-url origin` to obtain it. Use an empty string if unable to retrieve. - **gitBranch** (string) - Required - The current git branch name. Run `git branch --show-current` to obtain it. Use an empty string if unable to retrieve. ### Request Example { "packageSlug": "frontend-react", "installedPackages": ["common-ui"], "relativePath": "/src/frontend", "gitRemoteUrl": "git@github.com:example/repo.git", "gitBranch": "main" } ### Response #### Success Response (200) - **filesToCreateOrUpdate** (object) - Files to create or update with their content. - **filesToDelete** (array) - List of files to delete. - **sectionUpdates** (object) - Section-based updates for files like `CLAUDE.md`. #### Response Example { "filesToCreateOrUpdate": { "src/components/Button.js": "// Button component code..." }, "filesToDelete": [], "sectionUpdates": { "CLAUDE.md": { "installation": "Updated installation instructions..." } } } ``` -------------------------------- ### Install Packages with Packmind CLI Source: https://docs.packmind.com/gs-distribute Installs one or more specified packages locally. This command downloads all commands and standards from the given packages and prepares them for the AI coding assistant. It also creates or updates the `packmind.json` file. ```bash packmind-cli install [additional-package-slugs...] ``` ```bash packmind-cli install backend frontend ``` -------------------------------- ### Create Command from Existing Code Example Source: https://docs.packmind.com/commands-management Shows how to provide specific code files as context to an AI agent to extract patterns and create a Packmind command, such as one for adding a new API endpoint. ```natural-language Create a command for adding a new API endpoint based on @routes/users.ts and @controllers/UserController.ts ``` -------------------------------- ### Install Packages Recursively with Packmind CLI Source: https://docs.packmind.com/distribution This command installs packages for all 'packmind.json' files within a monorepository. It's a convenient way to manage package installations across multiple projects in a single repository, automating the process without manual intervention for each sub-project. ```bash packmind-cli install --recursive ``` -------------------------------- ### Get Package Details Source: https://docs.packmind.com/mcp-server Retrieves the full content of a specific package, including all its commands and standards. ```APIDOC ## GET /websites/packmind/get_package_details ### Description Retrieves the full content of a specific package including all its commands and standards. ### Method GET ### Endpoint /websites/packmind/get_package_details ### Parameters #### Query Parameters - **packageSlug** (string) - Required - The slug identifier of the package ### Response #### Success Response (200) - **packageName** (string) - The name of the package. - **packageSlug** (string) - The slug identifier of the package. - **packageDescription** (string) - The description of the package. - **commands** (array) - A list of all commands in the package with their summaries. - **name** (string) - The name of the command. - **summary** (string) - The summary of the command. - **standards** (array) - A list of all standards in the package with their summaries. - **name** (string) - The name of the standard. - **summary** (string) - The summary of the standard. #### Response Example { "packageName": "Frontend React", "packageSlug": "frontend-react", "packageDescription": "Best practices for React frontend development.", "commands": [ { "name": "lint", "summary": "Run ESLint to check code style." } ], "standards": [ { "name": "React Hooks Best Practices", "summary": "Guidelines for using React hooks effectively." } ] } ``` -------------------------------- ### Example Workflow: Lint and Commit Changes Source: https://docs.packmind.com/cli Demonstrates a typical workflow using Git for version control and Packmind CLI for linting. It involves making code changes, staging them, linting only the changed lines, and then committing if the lint check passes. Requires a Git repository. ```shell # Make some changes to your code git add . # Check only what you changed packmind-cli lint . --changed-lines # If clean, commit git commit -m "Your changes" ``` -------------------------------- ### Install Packages via packmind-cli Source: https://docs.packmind.com/distribution This command installs specified packages from Packmind directly from the terminal. It fetches packages, generates instruction files for enabled AI agents, writes them to the local repository, and notifies Packmind of the distribution. This method is suitable for CI/CD pipelines and local development. ```bash packmind-cli install ``` ```bash packmind-cli install backend-standards frontend-react ``` -------------------------------- ### Run Packmind CLI without installation using npx Source: https://docs.packmind.com/cli Executes the Packmind CLI command directly without requiring a prior installation. This is useful for project-specific tasks or testing the latest version. ```bash npx @packmind/cli install --list ``` -------------------------------- ### Create Command from Git History Example Source: https://docs.packmind.com/commands-management Illustrates instructing an AI agent to analyze Git history, such as a pull request, to generate a Packmind command that captures the changes made. ```natural-language Create a command by analyzing the changes in pull request #123 ``` -------------------------------- ### Manual Command Invocation Example Source: https://docs.packmind.com/commands-management Shows how to manually invoke a Packmind command in AI assistants that do not have native slash command support, by referencing the command file directly in the prompt. ```bash Execute @.packmind/commands/create-new-use-case.md ``` -------------------------------- ### Configure OpenAI API Key in Docker Compose Source: https://docs.packmind.com/gs-install-self-hosted This snippet shows how to configure the OpenAI API key within a Docker Compose file using YAML anchors. The `` placeholder should be replaced with your actual OpenAI API key. ```yaml x-openai-config: &openai-config OPENAI_API_KEY: ``` -------------------------------- ### Create Certificate Directory for Docker Compose Source: https://docs.packmind.com/gs-install-self-hosted Command to create a 'certs' directory. This directory is used to store custom CA certificates when Packmind is deployed using Docker Compose. ```bash mkdir certs ``` -------------------------------- ### Deliberate Retries with Exponential Backoff Source: https://docs.packmind.com/gs-create-standard Provides an example of implementing a retry mechanism with exponential backoff for idempotent operations. This strategy helps in handling transient network issues or temporary service unavailability without overwhelming the target service. ```javascript const sleep = (ms) => new Promise(r => setTimeout(r, ms)); for (let attempt = 0; attempt < 3; attempt++) { try { const res = await fetch(url, { method: "GET" }); // idempotent if (!res.ok) throw new Error(`HTTP ${res.status}`); break; } catch (e) { if (attempt === 2) throw new CacheUnavailable("Timed out", { cause: e }); await sleep(2 ** attempt * 200); // exponential backoff } } ``` -------------------------------- ### Understanding packmind.json Source: https://docs.packmind.com/gs-distribute Details the structure and function of the `packmind.json` file, which is automatically generated and used to track installed packages for local AI coding assistant configurations. ```APIDOC ## Understanding packmind.json ### Description Documentation for the `packmind.json` file, which manages locally installed packages. This file is created automatically on the first `packmind-cli install` command and tracks which packages are installed. ### File Structure The `packmind.json` file has a JSON structure where the `packages` object maps package slugs to their versions. Currently, `"*"` signifies the latest version. ```json { "packages": { "backend": "*", "frontend": "*", "security": "*" } } ``` ### How It Works **First Installation:** When `packmind-cli install ` is run for the first time, the CLI downloads the package, creates `packmind.json`, and adds the package to it. **Subsequent Installations:** Running `packmind-cli install` without arguments reads `packmind.json`, installs all listed packages, and updates local standards and commands. **Adding More Packages:** Running `packmind-cli install ` merges the new package into the existing `packmind.json` configuration. ### Managing packmind.json Manually **To add a package manually:** 1. Open `packmind.json`. 2. Add the package slug to the `packages` object: ```json { "packages": { "backend": "*", "frontend": "*", "new-package": "*" } } ``` 3. Run `packmind-cli install` to download the new package. **To remove a package manually:** 1. Open `packmind.json`. 2. Remove the package slug from the `packages` object. 3. Run `packmind-cli install` to update your local files. **Removal Limitations:** When a package is removed from `packmind.json` and `install` is run, only `CLAUDE.md` and `AGENTS.md` files are updated. Files for GitHub Copilot (`.github/copilot-instructions.md`) and Cursor (`.cursor/rules/`) might require manual deletion in a future update. ``` -------------------------------- ### View Package Details with Packmind CLI Source: https://docs.packmind.com/gs-distribute Displays detailed information about a specific package, identified by its 'package-slug'. This command is useful for understanding the contents of a package before installing it. ```bash packmind-cli install --show ``` -------------------------------- ### Manually Add Package to packmind.json Source: https://docs.packmind.com/gs-distribute Illustrates how to manually add a new package to the `packmind.json` file. After editing the file, running `packmind-cli install` is required to download the new package. ```json { "packages": { "backend": "*", "frontend": "*", "new-package": "*" } } ``` -------------------------------- ### Configure MCP for AI agents using Packmind CLI Source: https://docs.packmind.com/cli Sets up Model Context Protocol (MCP) for AI coding agents like Claude Code, Cursor, and Copilot. Running the command interactively will detect installed agents and prompt for configuration. ```bash packmind-cli setup-mcp ``` -------------------------------- ### Slash Command Invocation Example Source: https://docs.packmind.com/commands-management Demonstrates how to invoke a Packmind command using a slash command in AI assistants that support this feature, like Claude Code, Cursor, or GitHub Copilot. ```bash /create-new-use-case ``` -------------------------------- ### Add Custom CA Certificates to Packmind Source: https://docs.packmind.com/gs-install-self-hosted Instructions for adding custom CA certificates to Packmind when using Docker Compose. This involves placing certificates in the 'certs' directory and configuring the 'api' and 'mcp-server' services in 'docker-compose.yml' to use them. ```bash # For a single certificate cp your-ca-cert.pem certs/ca-bundle.pem # For multiple certificates, combine them cat cert1.pem cert2.pem > certs/ca-bundle.pem ``` -------------------------------- ### Override Environment Variables in Docker Compose Source: https://docs.packmind.com/gs-install-self-hosted Example of overriding environment variables for the Packmind API service within a Docker Compose file. This demonstrates how to add the SMTP_FROM variable. ```yaml api: image: packmind/api:${PACKMIND_TAG:-latest} container_name: packmind-api ports: - '3000:3000' environment: <<: [*database-url, *redis-config, *openai-config] SMTP_FROM: username@acme.org ``` -------------------------------- ### Recursive Install Packages for Monorepos Source: https://docs.packmind.com/cli Install packages recursively across all packmind.json files in a monorepo or projects with multiple configurations. This command ensures packages are installed in all relevant locations within the repository. ```bash packmind-cli install -r ``` ```bash packmind-cli install --recursive ``` -------------------------------- ### Update Packmind Docker Compose Services Source: https://docs.packmind.com/gs-install-self-hosted Command to pull the latest Docker images and restart Packmind services in detached mode. This is used to update an existing Docker Compose installation. ```bash docker compose pull && docker compose up -d ``` -------------------------------- ### Update Local Packages using packmind.json Source: https://docs.packmind.com/gs-distribute Installs all packages listed in the `packmind.json` file. When run without arguments after the first installation, this command ensures all tracked packages are up-to-date. ```bash packmind-cli install ``` -------------------------------- ### Command Tools API Source: https://docs.packmind.com/mcp-server APIs for listing, retrieving details of, creating, and saving commands. ```APIDOC ## GET /websites/packmind/list_commands ### Description Retrieves all commands created in your organization. Returns up to 20 commands sorted alphabetically by slug. ### Method GET ### Endpoint /websites/packmind/list_commands ### Parameters None ### Response #### Success Response (200) - **commands** (array) - A formatted list showing `• slug: name` for each command. #### Response Example ```json { "commands": [ "• api: Add REST Endpoint", "• db: Create Database Schema" ] } ``` ``` ```APIDOC ## GET /websites/packmind/get_command_details ### Description Retrieves the full content of a specific command by its slug identifier. ### Method GET ### Endpoint /websites/packmind/get_command_details ### Parameters #### Query Parameters - **commandSlug** (string) - Required - The slug identifier of the command. ### Response #### Success Response (200) - **commandDetails** (object) - Complete command details including name, slug, version, and full markdown content. #### Response Example ```json { "commandDetails": { "name": "Add REST Endpoint", "slug": "api:add-rest-endpoint", "version": "1.0.0", "content": "# Add REST Endpoint\nThis command guides you through adding a new REST endpoint..." } } ``` ``` ```APIDOC ## POST /websites/packmind/create_command ### Description Provides step-by-step guidance for creating a new command. This workflow ensures the AI agent properly structures the command with clear steps, appropriate context validation checkpoints, and usage scenarios. ### Method POST ### Endpoint /websites/packmind/create_command ### Parameters #### Query Parameters - **step** (string) - Optional - Workflow step identifier. Defaults to `initial-request` when omitted. Possible values: `initial-request`, `drafting`, `finalization`. ### Request Example ```json { "tool_code": "create_command", "parameters": { "step": "initial-request" } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. #### Response Example ```json { "message": "Command creation workflow started." } ``` ``` ```APIDOC ## POST /websites/packmind/save_command ### Description Captures a reusable development process or procedure as a structured Packmind command with clear, actionable steps. **Warning:** Do not call this tool directly. AI agents must first complete the command creation workflow using `create_command`. ### Method POST ### Endpoint /websites/packmind/save_command ### Parameters #### Request Body - **name** (string) - Required - The name of the command (e.g., "Add REST Endpoint", "Create Domain Model"). - **summary** (string) - Required - A concise sentence describing the intent (what it does), value (why useful), and relevance (when to use). - **whenToUse** (array of strings) - Required - Array of specific, actionable scenarios when this command applies. - **contextValidationCheckpoints** (array of strings) - Required - Array of checkpoints (questions or validation points) to ensure context is clarified before implementing steps. - **steps** (array of objects) - Required - Array of atomic, actionable steps, each containing: - **name** (string) - Required - The step title (e.g., "Setup Dependencies", "Create Database Schema"). - **description** (string) - Required - Sentence describing the step's intent and how to implement it (supports Markdown). - **codeSnippet** (string) - Optional - Brief, focused code example demonstrating the step (Markdown with language-specific code blocks). - **packageSlugs** (array of strings) - Optional - Array of package slugs to automatically add the command to during creation. ### Request Example ```json { "tool_code": "save_command", "parameters": { "name": "Add REST Endpoint", "summary": "Defines and registers a new REST endpoint in the application.", "whenToUse": ["Adding new API functionality", "Exposing new data resources"], "contextValidationCheckpoints": ["Confirm HTTP method", "Identify resource path"], "steps": [ { "name": "Define Endpoint Configuration", "description": "Specify the HTTP method, path, and handler function for the endpoint.", "codeSnippet": "{\"method\": \"GET\", \"path\": \"/users\", \"handler\": \"getUsers\"}" } ], "packageSlugs": ["backend-api"] } } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message with the new command's details. #### Response Example ```json { "message": "Command 'Add REST Endpoint' saved successfully." } ``` ``` -------------------------------- ### Explicit Error Handling and Rethrowing Source: https://docs.packmind.com/gs-create-standard Illustrates how to explicitly handle specific error types (e.g., `PaymentGatewayError`) and rethrow unknown errors to ensure they are not silently ignored. This pattern helps in logging specific failures while allowing general errors to propagate. ```javascript try { await processPayment(tx); } catch (e) { if (e instanceof PaymentGatewayError) { logger.warn("Payment failed", { txId: tx.id, code: e.code }); throw new PaymentFailed("Could not process payment", { cause: e }); } throw e; // unknown error, bubble up } ``` -------------------------------- ### Packages Tools API Source: https://docs.packmind.com/mcp-server API for listing available packages. ```APIDOC ## GET /websites/packmind/list_packages ### Description Retrieves all packages created in your organization. Packages are collections of commands and standards that can be distributed together. ### Method GET ### Endpoint /websites/packmind/list_packages ### Parameters None ### Response #### Success Response (200) - **packages** (array) - A formatted list showing package slugs and their descriptions. #### Response Example ```json { "packages": [ "package-slug-1: Description of package 1", "package-slug-2: Description of package 2" ] } ``` ``` -------------------------------- ### Configure Target Agents with --target Source: https://docs.packmind.com/cli Specify target agents directly using the --target or -t flag for the setup-mcp command. This allows for direct configuration of one or multiple agents. ```bash packmind-cli setup-mcp --target claude ``` ```bash packmind-cli setup-mcp --target claude --target cursor ``` ```bash packmind-cli setup-mcp -t claude -t cursor -t copilot ```