-
Notifications
You must be signed in to change notification settings - Fork 11.1k
feat: Add Alquimia AI integration #2734
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
mnriem
merged 23 commits into
github:main
from
Alquimia-ai:alquimia-integration-merge-conflicts-resolution
Jul 28, 2026
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c3d6f58
Add alquimia-ai as new integration: https://alquimia.ai
e88dd34
Fix test cases for alquimia-ai integration. Add alquimia-ai to workfl…
8efd9f1
Add install url to alquimia-ai integration
e5dd24f
Renamed alquimia-ai to alquimia (cli native denomination)
7907a03
Fix unit tests for alquimia integration
097eba1
Minor fix in alquimia integration
439e753
Fix typos and copilot findings
a768f4a
Potential fix for pull request finding
exengstfeld 111b08c
Potential fix for pull request finding
exengstfeld 2d93f42
Update tests cases and lint formatting
1f42f78
Final fixes
1697e45
Rename alquimia_ai to alquimia module integration
8a75358
Make cli optional for alquimiia integration
b5b12b6
resolve review comments
49fbc14
Fix copilot review
10aa2fb
Minor fixes: naming, remove unused code
b1ab62b
Update tests cases. Fix issues
5ed3a3c
Fix unit tests
de38c9f
Add alquimia context to default agent-context extension. Update cli r…
cc78c7f
Fix hints (suggestion)
3d4e593
Add Alquimia AI as agent in github issue template. Fix unit tests
80a1429
Address review comments. Update docs
a96e95b
Update test cases
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
Some comments aren't visible on the classic Files Changed page.
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
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,165 @@ | ||
| """Alquimia AI integration.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from typing import Any | ||
|
|
||
| from ..._utils import dump_frontmatter | ||
| from ..base import SkillsIntegration | ||
|
|
||
| # Mapping of command template stem → argument-hint text shown inline | ||
| # when a user invokes the slash command in Alquimia AI. | ||
| ARGUMENT_HINTS: dict[str, str] = { | ||
| "specify": "Describe the feature you want to specify", | ||
| "plan": "Optional guidance for the planning phase", | ||
| "tasks": "Optional task generation constraints", | ||
| "implement": "Optional implementation guidance or task filter", | ||
| "analyze": "Optional focus areas for analysis", | ||
| "clarify": "Optional areas to clarify in the spec", | ||
| "constitution": "Principles or values for the project constitution", | ||
| "checklist": "Domain or focus area for the checklist", | ||
| "taskstoissues": "Optional filter or label for GitHub issues", | ||
|
exengstfeld marked this conversation as resolved.
|
||
| } | ||
|
|
||
|
|
||
| class AlquimiaAIIntegration(SkillsIntegration): | ||
| """Integration for Alquimia AI skills.""" | ||
|
|
||
| key = "alquimia" | ||
| config = { | ||
| "name": "Alquimia AI", | ||
| "folder": ".alquimia/", | ||
| "commands_subdir": "skills", | ||
| "install_url": "https://docs.alquimia.ai", | ||
| "requires_cli": True, | ||
|
exengstfeld marked this conversation as resolved.
|
||
| } | ||
| registrar_config = { | ||
| "dir": ".alquimia/skills", | ||
| "format": "markdown", | ||
| "args": "$ARGUMENTS", | ||
| "extension": "/SKILL.md", | ||
| } | ||
| multi_install_safe = True | ||
|
exengstfeld marked this conversation as resolved.
|
||
|
|
||
| def _render_skill( | ||
| self, template_name: str, frontmatter: dict[str, Any], body: str | ||
| ) -> str: | ||
| """Render a processed command template as an Alquimia skill.""" | ||
| skill_name = f"speckit-{template_name.replace('.', '-')}" | ||
| description = frontmatter.get( | ||
| "description", | ||
| f"Spec-kit workflow command: {template_name}", | ||
| ) | ||
| skill_frontmatter = self._build_skill_fm( | ||
| skill_name, description, f"templates/commands/{template_name}.md" | ||
| ) | ||
| frontmatter_text = dump_frontmatter(skill_frontmatter) | ||
| return f"---\n{frontmatter_text}\n---\n\n{body.strip()}\n" | ||
|
|
||
| def _build_skill_fm(self, name: str, description: str, source: str) -> dict: | ||
| from specify_cli.agents import CommandRegistrar | ||
|
|
||
| return CommandRegistrar.build_skill_frontmatter( | ||
| self.key, name, description, source | ||
| ) | ||
|
|
||
| @staticmethod | ||
| def inject_argument_hint(content: str, hint: str) -> str: | ||
| """Insert ``argument-hint`` after the first ``description:`` in YAML frontmatter. | ||
|
|
||
| Skips injection if ``argument-hint:`` already exists in the | ||
| frontmatter to avoid duplicate keys. | ||
| """ | ||
| lines = content.splitlines(keepends=True) | ||
|
|
||
| # Pre-scan: bail out if argument-hint already present in frontmatter | ||
| dash_count = 0 | ||
| for line in lines: | ||
| stripped = line.rstrip("\n\r") | ||
| if stripped == "---": | ||
| dash_count += 1 | ||
| if dash_count == 2: | ||
| break | ||
| continue | ||
| if dash_count == 1 and stripped.startswith("argument-hint:"): | ||
| return content # already present | ||
|
|
||
| out: list[str] = [] | ||
| in_fm = False | ||
| dash_count = 0 | ||
| injected = False | ||
| for line in lines: | ||
| stripped = line.rstrip("\n\r") | ||
| if stripped == "---": | ||
| dash_count += 1 | ||
| in_fm = dash_count == 1 | ||
| out.append(line) | ||
| continue | ||
| if in_fm and not injected and stripped.startswith("description:"): | ||
| out.append(line) | ||
| # Preserve the exact line-ending style (\r\n vs \n) | ||
| if line.endswith("\r\n"): | ||
| eol = "\r\n" | ||
| elif line.endswith("\n"): | ||
| eol = "\n" | ||
| else: | ||
| eol = "" | ||
| escaped = hint.replace("\\", "\\\\").replace('"', '\\"') | ||
| out.append(f'argument-hint: "{escaped}"{eol}') | ||
| injected = True | ||
| continue | ||
| out.append(line) | ||
| return "".join(out) | ||
|
|
||
| @staticmethod | ||
| def _inject_frontmatter_flag(content: str, key: str, value: str = "true") -> str: | ||
| """Insert ``key: value`` before the closing ``---`` if not already present.""" | ||
| lines = content.splitlines(keepends=True) | ||
|
|
||
| # Pre-scan: bail out if already present in frontmatter | ||
| dash_count = 0 | ||
| for line in lines: | ||
| stripped = line.rstrip("\n\r") | ||
| if stripped == "---": | ||
| dash_count += 1 | ||
| if dash_count == 2: | ||
| break | ||
| continue | ||
| if dash_count == 1 and stripped.startswith(f"{key}:"): | ||
| return content | ||
|
|
||
| # Inject before the closing --- of frontmatter | ||
| out: list[str] = [] | ||
| dash_count = 0 | ||
| injected = False | ||
| for line in lines: | ||
| stripped = line.rstrip("\n\r") | ||
| if stripped == "---": | ||
| dash_count += 1 | ||
| if dash_count == 2 and not injected: | ||
| if line.endswith("\r\n"): | ||
| eol = "\r\n" | ||
| elif line.endswith("\n"): | ||
| eol = "\n" | ||
| else: | ||
| eol = "" | ||
| out.append(f"{key}: {value}{eol}") | ||
| injected = True | ||
| out.append(line) | ||
| return "".join(out) | ||
|
|
||
| def post_process_skill_content(self, content: str) -> str: | ||
| """Inject Alquimia-specific frontmatter flags, hints and hook notes.""" | ||
| updated = super().post_process_skill_content(content) | ||
| updated = self._inject_frontmatter_flag(updated, "user-invocable") | ||
| updated = self._inject_frontmatter_flag( | ||
| updated, "disable-model-invocation", "false" | ||
| ) | ||
| for line in updated.splitlines(): | ||
| if line.startswith("name:"): | ||
| name = line.removeprefix("name:").strip().strip("\"'") | ||
| hint = ARGUMENT_HINTS.get(name.removeprefix("speckit-")) | ||
| if hint: | ||
| updated = self.inject_argument_hint(updated, hint) | ||
| break | ||
| return updated | ||
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.
Uh oh!
There was an error while loading. Please reload this page.