Project¶
Project¶
Bases: BaseModel
A project, its persisted settings, and its managed files.
Attributes:
| Name | Type | Description |
|---|---|---|
root | Path | Absolute project root directory. |
hiraku_dir_name | str | Name of the managed directory for Hiraku data. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root | Path | str | Project directory containing the settings file and managed data. | required |
**data | Any | Persisted project settings to validate and load. | {} |
Create a project model from its root and persisted settings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root | Path | str | Project directory. | required |
**data | Any | Project settings validated by Pydantic. | {} |
hiraku_dir_name class-attribute instance-attribute ¶
hiraku_dir_name: str = Field(
default="hiraku",
alias="hiraku_dir",
min_length=1,
exclude=True,
frozen=True,
)
hiraku_dir property ¶
Return the resolved directory for Hiraku-managed project data.
leaderboards_dir property ¶
Return the directory containing named leaderboards.
psij_dir property ¶
Return the local directory for PSI/J launcher and executor files.
load classmethod ¶
Load a project from its root-level hiraku.yml file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | Path | str | Path to the project configuration file. | required |
Returns:
| Type | Description |
|---|---|
Project | The project rooted at the configuration file's parent directory. |
Raises:
| Type | Description |
|---|---|
ValidationError | If the file or its settings are invalid. |
discover classmethod ¶
Find the nearest project by searching start and its parents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start | Path | str | None | Starting directory or file. Defaults to the current directory. | None |
Returns:
| Type | Description |
|---|---|
Project | The nearest discovered project. |
Raises:
| Type | Description |
|---|---|
ProjectNotFoundError | If no project is found. |
save ¶
Atomically save the project's settings to its root-level hiraku.yml.
Raises:
| Type | Description |
|---|---|
ValidationError | If the configuration cannot be written. |
create classmethod ¶
create(
root: Path | str = ".",
*,
install_skill: bool = True,
install_mcp: bool = True,
) -> Project
Create a project and install its selected resources.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root | Path | str | Directory to initialize. | '.' |
install_skill | bool | Whether to install all included Hiraku skills. | True |
install_mcp | bool | Whether to add the project MCP server configuration. | True |
Returns:
| Type | Description |
|---|---|
Project | The initialized project. |
Raises:
| Type | Description |
|---|---|
ProjectExistsError | If |
ValidationError | If settings or resources are invalid. |
install_mcp ¶
Register the stdio server in supported project agent configs.
Claude, Pi, and Codex configuration files are merged while preserving other configured MCP servers.