### Query Mirrored Commands Source: https://context7.com/instructkr/claude-code/llms.txt This Python code snippet shows how to interact with the mirrored command inventory. It includes functions to get the total count of commands, retrieve all command names, and look up specific commands by name, displaying details like source and status. ```python from src.commands import ( get_command, find_commands, render_command_index, command_names, PORTED_COMMANDS ) # Get total count of mirrored commands print(f"Total commands: {len(PORTED_COMMANDS)}") # Get all command names names = command_names() print(names[:5]) # Look up a specific command by exact name cmd = get_command("review") if cmd: print(f"Name: {cmd.name}") print(f"Source: {cmd.source_hint}") print(f"Responsibility: {cmd.responsibility}") print(f"Status: {cmd.status}") ``` -------------------------------- ### Search and Render Commands Source: https://context7.com/instructkr/claude-code/llms.txt Demonstrates how to search for commands by query string and render a formatted index of available commands using the command module. ```python matches = find_commands("mcp", limit=5) for m in matches: print(f"{m.name} — {m.source_hint}") print(render_command_index(limit=10, query="agent")) ``` -------------------------------- ### Route Prompts with Query Engine Runtime Source: https://context7.com/instructkr/claude-code/llms.txt This Python code demonstrates the extended Query Engine's runtime capabilities, which routes prompts to relevant commands and tools. It allows for searching and identifying matching commands and tools based on a given prompt. ```python from src.QueryEngine import QueryEngineRuntime # Create the runtime query engine engine = QueryEngineRuntime.from_workspace() # Route a prompt to find matching commands and tools result = engine.route("review MCP tool", limit=5) print(result) ``` -------------------------------- ### Port Runtime Source: https://context7.com/instructkr/claude-code/llms.txt Route natural language prompts to the most relevant commands and tools. ```APIDOC ## Port Runtime ### Description Route natural language prompts to the most relevant commands and tools in the mirrored inventory. ### Method N/A (Python class methods) ### Endpoint N/A ### Parameters #### PortRuntime Class - **PortRuntime()** - Initializes the runtime router. - **route_prompt(prompt: str, limit: int)** - Required - Routes a prompt to find matching commands and tools. ### Request Example ```python from src.runtime import PortRuntime, RoutedMatch # Create the runtime router runtime = PortRuntime() # Route a prompt to find matching entries matches = runtime.route_prompt("file editing bash commands", limit=5) for match in matches: print(f"[{match.kind}] {match.name} (score: {match.score}) — {match.source_hint}") ``` ### Response #### Success Response (Output) - **Routed Matches**: A list of matches, each containing kind, name, score, and source hint. #### Response Example ``` [command] edit — commands/edit/edit.tsx (score: 2) [tool] BashTool — tools/BashTool/BashTool.ts (score: 2) [tool] EditTool — tools/EditTool/EditTool.tsx (score: 1) [command] bash — commands/bash/index.ts (score: 1) ``` ### Notes The router prefers at least one representative from each kind (command and tool) and scores entries based on token matches in name, source_hint, and responsibility. ``` -------------------------------- ### CLI Show Entry Commands - Python Source: https://context7.com/instructkr/claude-code/llms.txt Looks up individual command or tool entries by their exact name from the command line. It supports showing specific commands or tools and provides feedback for not found cases. The output includes the entry name, its path, and a brief description. ```bash python3 -m src.main show-command review # Output: # review # commands/review/review.tsx # Command module mirrored from archived TypeScript path commands/review/review.tsx ``` ```bash python3 -m src.main show-tool MCPTool # Output: # MCPTool # tools/MCPTool/MCPTool.tsx # Tool module mirrored from archived TypeScript path tools/MCPTool/MCPTool.tsx ``` ```bash python3 -m src.main show-command nonexistent # Output: Command not found: nonexistent ``` -------------------------------- ### Generate Porting Summary using Query Engine Source: https://context7.com/instructkr/claude-code/llms.txt This Python code utilizes the Query Engine to generate a detailed porting summary. It combines manifest data with command and tool backlog information to provide a comprehensive overview of the porting status, including module, command, and tool coverage. ```python from src.query_engine import QueryEnginePort # Create query engine from the current workspace engine = QueryEnginePort.from_workspace() # Render the full porting summary summary = engine.render_summary() print(summary) ``` -------------------------------- ### CLI Subsystems Command Source: https://context7.com/instructkr/claude-code/llms.txt List the current Python modules in the workspace. ```APIDOC ## CLI Subsystems Command ### Description List the current Python modules in the workspace. ### Method CLI command ### Endpoint N/A ### Parameters #### Command Line Arguments - **python3 -m src.main subsystems --limit ** - Lists subsystems with an optional limit. ### Request Example ```bash python3 -m src.main subsystems --limit 10 ``` ### Response #### Success Response (Output) - **Subsystems List**: A list of Python modules with their counts and descriptions. #### Response Example ``` reference_data 26 Python port support module assistant 1 Python port support module bootstrap 1 Python port support module bridge 1 Python port support module buddy 1 Python port support module cli 1 Python port support module ``` ``` -------------------------------- ### Running Tests - Bash Source: https://context7.com/instructkr/claude-code/llms.txt Executes the included test suite to verify the integrity and functionality of the porting workspace. This command discovers and runs all tests within the 'tests' directory. ```bash # Run the full test suite python3 -m unittest discover -s tests -v ``` -------------------------------- ### Route Prompts with PortRuntime Source: https://context7.com/instructkr/claude-code/llms.txt Uses the PortRuntime class to route natural language prompts to the most relevant commands and tools based on scoring. ```python from src.runtime import PortRuntime runtime = PortRuntime() matches = runtime.route_prompt("file editing bash commands", limit=5) for match in matches: print(f"[{match.kind}] {match.name} (score: {match.score}) — {match.source_hint}") ``` -------------------------------- ### Generate Porting Summary using CLI Source: https://context7.com/instructkr/claude-code/llms.txt This command-line interface command generates a comprehensive summary of the Python porting status, including file counts, module distribution, command coverage, and tool coverage. It provides an overview of the porting progress. ```bash python3 -m src.main summary ``` -------------------------------- ### Query and Manage Mirrored Tools Source: https://context7.com/instructkr/claude-code/llms.txt Provides methods to retrieve tool metadata, search the tool inventory by name or query, and render a formatted index of tools. ```python from src.tools import get_tool, find_tools, render_tool_index, tool_names, PORTED_TOOLS print(f"Total tools: {len(PORTED_TOOLS)}") tool = get_tool("MCPTool") matches = find_tools("bash", limit=5) print(render_tool_index(limit=10, query="edit")) ``` -------------------------------- ### Commands Module Source: https://context7.com/instructkr/claude-code/llms.txt Query and search the mirrored command inventory from the original TypeScript snapshot. ```APIDOC ## Commands Module ### Description Query and search the mirrored command inventory from the original TypeScript snapshot. ### Method N/A (Python functions) ### Endpoint N/A ### Parameters #### Python Functions - **find_commands(query: str, limit: int)** - Required - Searches for commands matching the query string. - **render_command_index(limit: int, query: str)** - Required - Renders a formatted command index. ### Request Example ```python # Search commands by query string matches = find_commands("mcp", limit=5) for m in matches: print(f"{m.name} — {m.source_hint}") # Render formatted command index print(render_command_index(limit=10, query="agent")) ``` ### Response #### Success Response (Output) - **Command Search**: List of matching commands with name and source hint. - **Command Index**: Formatted list of commands, filtered by query. #### Response Example ``` mcp — commands/mcp/mcp.tsx mcp — commands/mcp/index.ts mcp-review — commands/mcp-review/index.ts Command entries: 207 Filtered by: agent - agents — commands/agents/agents.tsx - agents — commands/agents/index.ts ``` ``` -------------------------------- ### Tools Module Source: https://context7.com/instructkr/claude-code/llms.txt Query and search the mirrored tool inventory from the original TypeScript snapshot. ```APIDOC ## Tools Module ### Description Query and search the mirrored tool inventory from the original TypeScript snapshot. ### Method N/A (Python functions) ### Endpoint N/A ### Parameters #### Python Functions - **get_tool(name: str)** - Required - Retrieves a specific tool by its exact name. - **find_tools(query: str, limit: int)** - Required - Searches for tools matching the query string. - **render_tool_index(limit: int, query: str)** - Required - Renders a formatted tool index. - **tool_names()** - Returns a list of all tool names. ### Request Example ```python # Get total count of mirrored tools print(f"Total tools: {len(PORTED_TOOLS)}") # Get all tool names names = tool_names() print(names[:5]) # Look up a specific tool by exact name tool = get_tool("MCPTool") if tool: print(f"Name: {tool.name}") # Search tools by query string matches = find_tools("bash", limit=5) for t in matches: print(f"{t.name} — {t.source_hint}") # Render formatted tool index print(render_tool_index(limit=10, query="edit")) ``` ### Response #### Success Response (Output) - **Total Tools**: Count of available tools. - **Tool Names**: List of tool names. - **Tool Details**: Name, source hint, and responsibility of a specific tool. - **Tool Search**: List of matching tools with name and source hint. - **Tool Index**: Formatted list of tools, filtered by query. #### Response Example ``` Total tools: 184 ['AgentTool', 'UI', 'agentColorManager', 'agentDisplay', 'agentMemory'] Name: MCPTool Source: tools/MCPTool/MCPTool.tsx Responsibility: Tool module mirrored from archived TypeScript path tools/MCPTool/MCPTool.tsx BashTool — tools/BashTool/BashTool.ts BashTool — tools/BashTool/index.ts Tool entries: 184 Filtered by: edit - EditTool — tools/EditTool/EditTool.tsx - NotebookEditTool — tools/NotebookEditTool/NotebookEditTool.tsx ``` ``` -------------------------------- ### CLI Subsystems Listing Source: https://context7.com/instructkr/claude-code/llms.txt Lists the current Python modules in the workspace via the command line interface. ```bash python3 -m src.main subsystems --limit 10 ``` -------------------------------- ### Build and Inspect Port Manifest API Source: https://context7.com/instructkr/claude-code/llms.txt This Python code snippet demonstrates how to use the Port Manifest API to build and inspect the current state of the Python workspace manifest. It allows access to properties like total Python files and source root, and can generate a markdown representation. ```python from src.port_manifest import build_port_manifest, PortManifest # Build manifest from the default src directory manifest = build_port_manifest() # Access manifest properties print(f"Total Python files: {manifest.total_python_files}") print(f"Source root: {manifest.src_root}") # Iterate through top-level modules for module in manifest.top_level_modules: print(f"{module.name}: {module.file_count} files - {module.notes}") # Generate markdown representation markdown_output = manifest.to_markdown() print(markdown_output) ``` -------------------------------- ### CLI Route Command - Python Source: https://context7.com/instructkr/claude-code/llms.txt Routes a natural language prompt to find matching commands and tools from the command line. It takes a prompt string and an optional limit for the number of results. The output lists matching commands or tools with their relevance score and file path. ```bash python3 -m src.main route "review MCP tool" --limit 5 ``` -------------------------------- ### CLI Parity Audit Command Source: https://context7.com/instructkr/claude-code/llms.txt Run parity audit from the command line. ```APIDOC ## CLI Parity Audit Command ### Description Run parity audit from the command line. ### Method CLI command ### Endpoint N/A ### Parameters #### Command Line Arguments - **python3 -m src.main parity-audit** - Executes the parity audit via the command line. ### Request Example ```bash python3 -m src.main parity-audit ``` ### Response #### Success Response (Output) - **Parity Audit Report**: The parity audit results presented in markdown format. #### Response Example ``` # Parity Audit Root file coverage: **17/17** Directory coverage: **29/29** Total Python files vs archived TS-like files: **85/1902** Command entry coverage: **207/207** Tool entry coverage: **184/184** Missing root targets: - none Missing directory targets: - none ``` ``` -------------------------------- ### Parity Audit Source: https://context7.com/instructkr/claude-code/llms.txt Compare the Python workspace against the archived TypeScript snapshot to measure porting progress. ```APIDOC ## Parity Audit ### Description Compare the Python workspace against the archived TypeScript snapshot to measure porting progress. ### Method N/A (Python function and method) ### Endpoint N/A ### Parameters #### Python Functions/Methods - **run_parity_audit()** - Required - Executes the parity audit. - **audit.to_markdown()** - Required - Generates a markdown report of the audit results. ### Request Example ```python from src.parity_audit import run_parity_audit, ParityAuditResult # Run the parity audit audit = run_parity_audit() # Check if the local archive is available and print coverage metrics if audit.archive_present: print(f"Root file coverage: {audit.root_file_coverage[0]}/{audit.root_file_coverage[1]}") print(f"Directory coverage: {audit.directory_coverage[0]}/{audit.directory_coverage[1]}") print(f"Python files vs TS files: {audit.total_file_ratio[0]}/{audit.total_file_ratio[1]}") print(f"Command coverage: {audit.command_entry_ratio[0]}/{audit.command_entry_ratio[1]}") print(f"Tool coverage: {audit.tool_entry_ratio[0]}/{audit.tool_entry_ratio[1]}") else: print("Local archive unavailable") # Generate markdown report report = audit.to_markdown() print(report) ``` ### Response #### Success Response (Output) - **Parity Audit Results**: Coverage metrics including root file, directory, file ratio, command entry, and tool entry. - **Markdown Report**: A formatted markdown string detailing the audit results. #### Response Example ``` Root file coverage: 17/17 Directory coverage: 29/29 Python files vs TS files: 85/1902 Command coverage: 207/207 Tool coverage: 184/184 # Parity Audit Root file coverage: **17/17** Directory coverage: **29/29** Total Python files vs archived TS-like files: **85/1902** Command entry coverage: **207/207** Tool entry coverage: **184/184** Missing root targets: - none Missing directory targets: - none ``` ``` -------------------------------- ### Perform Parity Audit Source: https://context7.com/instructkr/claude-code/llms.txt Compares the current Python workspace against the archived TypeScript snapshot to measure porting coverage and generate reports. ```python from src.parity_audit import run_parity_audit audit = run_parity_audit() if audit.archive_present: print(audit.to_markdown()) ``` ```bash python3 -m src.main parity-audit ``` -------------------------------- ### Data Models - Python Source: https://context7.com/instructkr/claude-code/llms.txt Defines core dataclasses used within the porting workspace for representing subsystems, individual modules, and porting backlogs. These models facilitate structured data handling and summary generation. ```python from src.models import Subsystem, PortingModule, PortingBacklog # Subsystem represents a top-level module in the workspace subsystem = Subsystem( name="assistant", path="src/assistant", file_count=5, notes="AI assistant coordination layer" ) print(f"{subsystem.name}: {subsystem.file_count} files") # PortingModule represents an individual module in the backlog module = PortingModule( name="BashTool", responsibility="Execute shell commands safely", source_hint="tools/BashTool/BashTool.ts", status="mirrored" ) print(f"{module.name} [{module.status}] — {module.source_hint}") # PortingBacklog aggregates modules for summary output backlog = PortingBacklog(title="Tool surface", modules=[module]) lines = backlog.summary_lines() for line in lines: print(line) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.