-
Notifications
You must be signed in to change notification settings - Fork 0
feat: implement company template system with 7 built-in presets #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| """Shared configuration utilities.""" | ||
|
|
||
| import copy | ||
| from typing import Any | ||
|
|
||
|
|
||
| def to_float(value: Any, *, field_name: str = "value") -> float: | ||
| """Coerce a value to float with clear error reporting. | ||
|
|
||
| Args: | ||
| value: Value to convert (str, int, float, etc.). | ||
| field_name: Field name for error messages. | ||
|
|
||
| Returns: | ||
| Float value. | ||
|
|
||
| Raises: | ||
| ValueError: If *value* cannot be converted to float. | ||
| """ | ||
| if value is None: | ||
| msg = f"Expected numeric value for {field_name}, got None" | ||
| raise ValueError(msg) | ||
| try: | ||
| return float(value) | ||
| except (TypeError, ValueError) as exc: | ||
| msg = f"Invalid numeric value for {field_name}: {value!r}" | ||
| raise ValueError(msg) from exc | ||
|
|
||
|
|
||
| def deep_merge( | ||
| base: dict[str, Any], | ||
| override: dict[str, Any], | ||
| ) -> dict[str, Any]: | ||
| """Recursively merge *override* into *base*, returning a new dict. | ||
|
|
||
| Nested dicts are merged recursively. Lists, scalars, and all other | ||
| types in *override* replace the corresponding value in *base* | ||
| entirely. Keys present only in *base* are preserved unchanged in | ||
| the result. Neither input dict is mutated. | ||
|
|
||
| Args: | ||
| base: Base configuration dict. | ||
| override: Override values to layer on top. | ||
|
|
||
| Returns: | ||
| A new merged dict. | ||
| """ | ||
| result = copy.deepcopy(base) | ||
| for key, value in override.items(): | ||
| if key in result and isinstance(result[key], dict) and isinstance(value, dict): | ||
| result[key] = deep_merge(result[key], value) | ||
| else: | ||
| result[key] = copy.deepcopy(value) | ||
| return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| """Company templates: built-in presets and custom template loading. | ||
|
|
||
| Public API | ||
| ---------- | ||
| .. autosummary:: | ||
| load_template | ||
| load_template_file | ||
| list_templates | ||
| list_builtin_templates | ||
| render_template | ||
| CompanyTemplate | ||
| LoadedTemplate | ||
| TemplateInfo | ||
| TemplateMetadata | ||
| TemplateVariable | ||
| TemplateAgentConfig | ||
| TemplateDepartmentConfig | ||
| TemplateError | ||
| TemplateNotFoundError | ||
| TemplateRenderError | ||
| TemplateValidationError | ||
| """ | ||
|
|
||
| from ai_company.templates.errors import ( | ||
| TemplateError, | ||
| TemplateNotFoundError, | ||
| TemplateRenderError, | ||
| TemplateValidationError, | ||
| ) | ||
| from ai_company.templates.loader import ( | ||
| LoadedTemplate, | ||
| TemplateInfo, | ||
| list_builtin_templates, | ||
| list_templates, | ||
| load_template, | ||
| load_template_file, | ||
| ) | ||
| from ai_company.templates.renderer import render_template | ||
| from ai_company.templates.schema import ( | ||
| CompanyTemplate, | ||
| TemplateAgentConfig, | ||
| TemplateDepartmentConfig, | ||
| TemplateMetadata, | ||
| TemplateVariable, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "CompanyTemplate", | ||
| "LoadedTemplate", | ||
| "TemplateAgentConfig", | ||
| "TemplateDepartmentConfig", | ||
| "TemplateError", | ||
| "TemplateInfo", | ||
| "TemplateMetadata", | ||
| "TemplateNotFoundError", | ||
| "TemplateRenderError", | ||
| "TemplateValidationError", | ||
| "TemplateVariable", | ||
| "list_builtin_templates", | ||
| "list_templates", | ||
| "load_template", | ||
| "load_template_file", | ||
| "render_template", | ||
| ] |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| template: | ||
| name: "Agency" | ||
| description: "Client-focused agency with project management and creative roles" | ||
| version: "1.0.0" | ||
| tags: | ||
| - "agency" | ||
| - "client-work" | ||
| - "creative" | ||
|
|
||
| variables: | ||
| - name: "company_name" | ||
| description: "Name of your agency" | ||
| default: "Creative Agency" | ||
| - name: "budget" | ||
| description: "Monthly budget in USD" | ||
| var_type: "float" | ||
| default: 100.0 | ||
|
|
||
| company: | ||
| type: "agency" | ||
| budget_monthly: {{ budget | default(100.0) }} | ||
| autonomy: 0.5 | ||
|
|
||
| departments: | ||
| - name: "operations" | ||
| budget_percent: 30 | ||
| head_role: "Project Manager" | ||
| - name: "engineering" | ||
| budget_percent: 40 | ||
| head_role: "Full-Stack Developer" | ||
| - name: "design" | ||
| budget_percent: 30 | ||
| head_role: "UI Designer" | ||
|
|
||
| agents: | ||
| - role: "Project Manager" | ||
| level: "senior" | ||
| model: "sonnet" | ||
| personality_preset: "visionary_leader" | ||
| department: "operations" | ||
| - role: "UI Designer" | ||
| level: "mid" | ||
| model: "sonnet" | ||
| department: "design" | ||
| - role: "Full-Stack Developer" | ||
| level: "senior" | ||
| model: "sonnet" | ||
| personality_preset: "pragmatic_builder" | ||
| department: "engineering" | ||
|
|
||
| workflow: "kanban" | ||
| communication: "hybrid" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| template: | ||
| name: "Dev Shop" | ||
| description: "Software development focused team with QA and DevOps" | ||
| version: "1.0.0" | ||
| tags: | ||
| - "development" | ||
| - "engineering" | ||
| - "qa" | ||
|
|
||
| variables: | ||
| - name: "company_name" | ||
| description: "Name of your company" | ||
| default: "Dev Shop" | ||
| - name: "budget" | ||
| description: "Monthly budget in USD" | ||
| var_type: "float" | ||
| default: 75.0 | ||
|
|
||
| company: | ||
| type: "dev_shop" | ||
| budget_monthly: {{ budget | default(75.0) }} | ||
| autonomy: 0.5 | ||
|
|
||
| departments: | ||
| - name: "engineering" | ||
| budget_percent: 70 | ||
| head_role: "Software Architect" | ||
| - name: "quality_assurance" | ||
| budget_percent: 20 | ||
| head_role: "QA Lead" | ||
| - name: "operations" | ||
| budget_percent: 10 | ||
| head_role: "DevOps/SRE Engineer" | ||
|
|
||
| agents: | ||
| - role: "Software Architect" | ||
| level: "principal" | ||
| model: "opus" | ||
| personality_preset: "methodical_analyst" | ||
| department: "engineering" | ||
| - role: "Backend Developer" | ||
| level: "senior" | ||
| model: "sonnet" | ||
| personality_preset: "pragmatic_builder" | ||
| department: "engineering" | ||
| - role: "Backend Developer" | ||
| level: "mid" | ||
| model: "haiku" | ||
| personality_preset: "eager_learner" | ||
| department: "engineering" | ||
| - role: "QA Lead" | ||
| level: "lead" | ||
| model: "sonnet" | ||
| personality_preset: "methodical_analyst" | ||
| department: "quality_assurance" | ||
| - role: "DevOps/SRE Engineer" | ||
| level: "mid" | ||
| model: "sonnet" | ||
| personality_preset: "pragmatic_builder" | ||
| department: "operations" | ||
|
|
||
| workflow: "agile_kanban" | ||
| communication: "hybrid" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix Jinja braces spacing on Line 21 to satisfy YAML linting.
budget_monthly: {{ budget | default(75.0) }}is flagged by YAMLlint (braces).Suggested fix
As per coding guidelines
**/*.{yaml,yml,json,toml}: Use check-yaml, check-json, and check-toml pre-commit hooks to validate configuration files.📝 Committable suggestion
🧰 Tools
🪛 YAMLlint (1.38.0)
[error] 21-21: too many spaces inside braces
(braces)
[error] 21-21: too many spaces inside braces
(braces)
🤖 Prompt for AI Agents