Skip to content

Commit 06f6ce6

Browse files
committed
fix: address PR review — integration-type-aware deprecation messages and early generic validation
- --ai-skills deprecation message now distinguishes SkillsIntegration ("skills are the default") from command-based integrations ("has no effect") - --ai-commands-dir validation for generic runs even when auto-promoted, giving clear CLI error instead of late ValueError from setup() - Resolves review comments from #2052
1 parent 9b848e2 commit 06f6ce6

1 file changed

Lines changed: 23 additions & 14 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,11 +2000,18 @@ def init(
20002000
# Deprecation warnings for --ai-skills and --ai-commands-dir when using integration path
20012001
if use_integration:
20022002
if ai_skills:
2003-
console.print(
2004-
"[dim]Note: --ai-skills is not needed with --integration; "
2005-
"skills are the default for this integration.[/dim]"
2006-
)
2007-
if ai_commands_dir:
2003+
from .integrations.base import SkillsIntegration as _SkillsCheck
2004+
if isinstance(resolved_integration, _SkillsCheck):
2005+
console.print(
2006+
"[dim]Note: --ai-skills is not needed with --integration; "
2007+
"skills are the default for this integration.[/dim]"
2008+
)
2009+
else:
2010+
console.print(
2011+
"[dim]Note: --ai-skills has no effect with --integration "
2012+
f"{resolved_integration.key}; this integration uses commands, not skills.[/dim]"
2013+
)
2014+
if ai_commands_dir and resolved_integration.key != "generic":
20082015
console.print(
20092016
"[dim]Note: --ai-commands-dir is deprecated with --integration; "
20102017
"use --integration generic with parsed options instead.[/dim]"
@@ -2096,16 +2103,18 @@ def init(
20962103
ai_skills = True
20972104
console.print(f"\n[yellow]Note:[/yellow] {AGENT_SKILLS_MIGRATIONS[selected_ai]['interactive_note']}")
20982105

2099-
# Validate --ai-commands-dir usage (legacy path only)
2100-
if not use_integration:
2101-
if selected_ai == "generic":
2102-
if not ai_commands_dir:
2103-
console.print("[red]Error:[/red] --ai-commands-dir is required when using --ai generic")
2104-
console.print("[dim]Example: specify init my-project --ai generic --ai-commands-dir .myagent/commands/[/dim]")
2105-
raise typer.Exit(1)
2106-
elif ai_commands_dir:
2107-
console.print(f"[red]Error:[/red] --ai-commands-dir can only be used with --ai generic (not '{selected_ai}')")
2106+
# Validate --ai-commands-dir usage.
2107+
# For 'generic', always validate even when auto-promoted to the integration
2108+
# path — avoids a late ValueError from GenericIntegration.setup() and
2109+
# preserves a clear CLI error with example usage.
2110+
if selected_ai == "generic":
2111+
if not ai_commands_dir:
2112+
console.print("[red]Error:[/red] --ai-commands-dir is required when using --ai generic")
2113+
console.print("[dim]Example: specify init my-project --ai generic --ai-commands-dir .myagent/commands/[/dim]")
21082114
raise typer.Exit(1)
2115+
elif ai_commands_dir and not use_integration:
2116+
console.print(f"[red]Error:[/red] --ai-commands-dir can only be used with --ai generic (not '{selected_ai}')")
2117+
raise typer.Exit(1)
21092118

21102119
current_dir = Path.cwd()
21112120

0 commit comments

Comments
 (0)