Prompt Utilities¶
Bundled prompt guide files for AI coding assistants are stored in
asset/prompt/*.md. These utilities let you list, read, and copy
them into your project. Use them together with the
MCP Server for the richest AI
integration, or stand-alone for manual context injection.
Example¶
import dartwork_mpl as dm
# List available guides
available = dm.list_prompts() # ['general-guide', 'layout-guide']
# Read guide content
content = dm.get_prompt('layout-guide')
# Copy to IDE folder
dm.copy_prompt('layout-guide', '.cursor/rules/')
# Get the file path directly
print(dm.prompt_path('general-guide'))
API¶
- dartwork_mpl.prompt_path(name: str) Path[source]¶
Get the absolute path to a prompt guide file.
- Parameters:
name (str) – Name of the prompt guide to retrieve (e.g.,
'00-index','01-policy','03-recipes').- Returns:
Path to the prompt guide Markdown file.
- Return type:
Path
- Raises:
ValueError – If the specified guide cannot be found in the library.
- dartwork_mpl.get_prompt(name: str) str[source]¶
Read a prompt guide file and return its full content as a string.
- Parameters:
name (str) – Name of the prompt guide to read.
- Returns:
The Markdown content of the prompt guide.
- Return type:
str
- dartwork_mpl.list_prompts() list[str][source]¶
List the bundled prompt guide files.
The canonical corpus is exactly four entries —
00-index,01-policy,02-anti-patterns(YAML, not surfaced here),03-recipes— plus the05-templates/subdirectory listed separately. If extra*.mdfiles appear (stale leftovers, an in-progress addition, etc.), this function still returns them but emits aUserWarningso drift surfaces immediately.- Returns:
Sorted list of available prompt guide names.
- Return type:
list[str]
- dartwork_mpl.copy_prompt(name: str, destination: str | Path) Path[source]¶
Copy a bundled prompt guide file to the specified destination.
- Parameters:
name (str) – Name of the prompt guide to copy.
destination (str | Path) – Destination path. If a directory, the file is copied with its original name (
name.md). If a file path, that name is used.
- Returns:
Absolute path of the newly copied file.
- Return type:
Path
- Raises:
ValueError – If the source prompt guide cannot be found.