Skip to content

API Reference parrot.knowledge.wiki.claude_code.assets

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.wiki.claude_code.assets

View source

Managed file templates for the Claude Code wiki integration.

Every artifact written by parrot claude install is delimited by markers (or identified by the hook command string) so installs are idempotent and parrot claude uninstall can remove exactly what was added without touching user content.

Attribute CLAUDE_MD_BEGIN

Attribute CLAUDE_MD_END

Attribute CLAUDE_MD_SECTION

Attribute GIT_HOOK_BEGIN

Attribute GIT_HOOK_BLOCK

Attribute GIT_HOOK_END

Attribute GIT_HOOK_NEW_FILE

Attribute GLOSSARY_HOOK_EVENT

Attribute GLOSSARY_HOOK_SUBCOMMAND

Attribute HOOK_BIN_NAME

Attribute HOOK_COMMAND

Attribute HOOK_MATCHER

Attribute HOOK_SUBCOMMAND

Attribute LEDGER_HOOK_BEGIN

Attribute LEDGER_HOOK_END

Attribute LEDGER_HOOK_EVENTS

Type: tuple[str, ...]

Attribute MCP_JSON_ENTRY

Type: dict

Attribute NUDGE_TEXT

Attribute PERMISSION_RULES

Type: tuple[str, ...]

Attribute PORTABLE_TOOLKIT_CONFIG

Attribute SLASH_COMMAND_FILENAME

Attribute SLASH_COMMAND_MD

Alias ToolkitSection

Re-exported from parrot.mcp.toolkit_config.ToolkitSection.

Function git_hook_block

Build the managed wiki-upsert hook block with an absolute path.

Shared by the post-commit and post-merge hooks (FEAT-566 Module 10): the structural upsert must no-op inside a linked worktree, since indexing unmerged code into the shared, base-branch-snapshot wiki.db would corrupt it. The guard mirrors :func:parrot.knowledge.wiki.project.is_linked_worktree — a linked worktree's .git is a file, never a directory — as a plain POSIX sh test, so the hook never has to invoke Python (and can't fail because the venv isn't on $PATH) just to decide whether to run.

git_hook_block(root: Path) -> str

Parameter Type Default Description
root Path

Returns: str

Function git_hook_new_file

Build a fresh managed hook file with an absolute path.

git_hook_new_file(root: Path) -> str

Parameter Type Default Description
root Path

Returns: str

Function glossary_hook_command

Build the prompt-time glossary hook command for host.

glossary_hook_command(root: Path, host: str = 'claude', *, portable: bool = False) -> str

Parameter Type Default Description
root Path Project root used to resolve the wikitoolkit binary.
host str 'claude' Coding host passed as --host.
portable bool False Emit the bare wikitoolkit glossary-hook --host <host> instead of the resolved absolute path.

Returns: str — The command line to store in the host's hook configuration.

Function hook_command

Build the PreToolUse hook command.

hook_command(root: Path, *, portable: bool = False) -> str

Parameter Type Default Description
root Path Project root used to resolve the wikitoolkit binary.
portable bool False Emit the bare wikitoolkit claude-hook (committable; relies on the FEAT-633 launcher being on PATH) instead of the resolved absolute path.

Returns: str

Function ledger_hook_block

Build the managed ledger block (import-only post hooks; no-op pre-commit).

ledger_hook_block(root: Path, hook_name: str) -> str

Parameter Type Default Description
root Path Repository root (used to resolve the wikitoolkit binary).
hook_name str One of :data:LEDGER_HOOK_EVENTS.

Returns: str

Raises:

  • ValueError — hook_name is not in :data:LEDGER_HOOK_EVENTS.

Function ledger_hook_new_file

Build a fresh hook file holding only the ledger block.

ledger_hook_new_file(root: Path, hook_name: str) -> str

Parameter Type Default Description
root Path
hook_name str

Returns: str

Function mcp_json_entry

Build the .mcp.json entry (absolute path, or portable bare command).

mcp_json_entry(root: Path, *, portable: bool = False) -> dict

Parameter Type Default Description
root Path
portable bool False

Returns: dict

Function mcp_json_entry_remote

Native Claude Code HTTP entry for a remote wiki mount (FEAT-569).

Claude Code expands ${VAR} inside .mcp.json header values (2.1.274+), so the token never lands on disk.

mcp_json_entry_remote(url: str, token_env: str) -> dict

Parameter Type Default Description
url str
token_env str

Returns: dict

Function permission_rules

Return permission rules including absolute-path variants.

In portable mode the command is the bare wikitoolkit, which the static :data:PERMISSION_RULES already cover — no machine-specific rule is added.

Extends the static :data:PERMISSION_RULES with rules that match the resolved binary path so wiki commands work in worktrees (where wikitoolkit is not on $PATH).

permission_rules(root: Path, *, portable: bool = False) -> tuple[str, ...]

Parameter Type Default Description
root Path
portable bool False

Returns: tuple[str, ...]

Function resolve_parrot_bin

Return the absolute path to the parrot binary.

Mirrors :func:resolve_wikitoolkit_bin's resolution order:

  1. <root>/.venv/bin/parrot — the project venv (most common with uv / pip install -e .).
  2. shutil.which("parrot") — globally installed or on $PATH at install time.
  3. Bare "parrot" — fallback; works only when the venv is activated at invocation time (e.g. the MCP host activates it before spawning the process).

resolve_parrot_bin(root: Path) -> str

Parameter Type Default Description
root Path

Returns: str

Function resolve_wikitoolkit_bin

Return the absolute path to the wikitoolkit binary.

Resolution order:

  1. <root>/.venv/bin/wikitoolkit (Scripts\wikitoolkit.exe on Windows) — the project venv (most common with uv / pip install -e .).
  2. shutil.which("wikitoolkit") — globally installed or on $PATH at install time.
  3. Bare "wikitoolkit" — fallback; works only when the venv is activated at hook-execution time.

resolve_wikitoolkit_bin(root: Path) -> str

Parameter Type Default Description
root Path

Returns: str

Alias script_path

Re-exported from parrot.launcher.script_path.

Function toolkit_mcp_json_entry

Build the .mcp.json entry for one exposed toolkit (FEAT-485).

toolkit_mcp_json_entry(root: Path, name: str, section: ToolkitSection, *, portable: bool = False) -> dict

Parameter Type Default Description
root Path Project root — used to resolve the parrot binary.
name str Toolkit name (e.g. "scraping") as it appears under .parrot/mcp-toolkits.yaml's toolkits: mapping.
section ToolkitSection The toolkit's resolved config section, for its env mapping.
portable bool False Emit {"command": "parrot", "args": ["mcp-local", name, "--config", PORTABLE_TOOLKIT_CONFIG], "env": dict(section.env)} — no cwd, no absolute path.

Returns: dict — {"command": <abs parrot bin>, "args": ["mcp-local", name, "--config", <abs path to mcp-toolkits.yaml>], "cwd": <abs root>, "env": dict(section.env)}.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally