Skip to content

Commit 24e5942

Browse files
committed
feat: Add Amazon Q Developer CLI support with saved prompts
- Add qchat to AI_CHOICES for Amazon Q Developer CLI support - Implement saved prompts approach instead of hooks - Create .amazonq/agent.json with basic configuration - Generate saved prompts in .amazonq/prompts/ directory: - specify.md: Feature specification creation - plan.md: Implementation planning - tasks.md: Task breakdown - Update scripts/update-agent-context.sh for AmazonQ.md support - Add qchat-specific documentation to README.md - Works immediately in VS Code Amazon Q IDE - CLI support pending Issue github#1360 implementation Resolves github#15
1 parent b4833cb commit 24e5942

3 files changed

Lines changed: 148 additions & 20 deletions

File tree

‎README.md‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Our research and experimentation focus on:
106106
## 🔧 Prerequisites
107107

108108
- **Linux/macOS** (or WSL2 on Windows)
109-
- AI coding agent: [Claude Code](https://www.anthropic.com/claude-code), [GitHub Copilot](https://code.visualstudio.com/), or [Gemini CLI](https://github.com/google-gemini/gemini-cli)
109+
- AI coding agent: [Claude Code](https://www.anthropic.com/claude-code), [GitHub Copilot](https://code.visualstudio.com/), [Gemini CLI](https://github.com/google-gemini/gemini-cli), or [Amazon Q Developer CLI](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line.html)
110110
- [uv](https://docs.astral.sh/uv/) for package management
111111
- [Python 3.11+](https://www.python.org/downloads/)
112112
- [Git](https://git-scm.com/downloads)
@@ -143,16 +143,24 @@ You will be prompted to select the AI agent you are using. You can also proactiv
143143
specify init <project_name> --ai claude
144144
specify init <project_name> --ai gemini
145145
specify init <project_name> --ai copilot
146+
specify init <project_name> --ai qchat
146147
# Or in current directory:
147148
specify init --here --ai claude
149+
specify init --here --ai qchat
148150
```
149151

150-
The CLI will check if you have Claude Code or Gemini CLI installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command:
152+
The CLI will check if you have Claude Code, Gemini CLI, or Amazon Q Developer CLI installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command:
151153

152154
```bash
153155
specify init <project_name> --ai claude --ignore-agent-tools
154156
```
155157

158+
> [!NOTE]
159+
> Amazon Q Developer CLI specifics
160+
> - When you run `specify init --ai qchat`, the CLI creates `.amazonq/agent.json` and saved prompts in `.amazonq/prompts/`
161+
> - Use `@specify "description"`, `@plan`, and `@tasks` as saved prompts in Amazon Q chat
162+
> - Saved prompts work in VS Code Amazon Q IDE immediately, CLI support coming soon (Issue #1360)
163+
156164
### **STEP 1:** Bootstrap the project
157165

158166
Go to the project folder and run your AI agent. In our example, we're using `claude`.

‎scripts/update-agent-context.sh‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# Incrementally update agent context files based on new feature plan
3-
# Supports: CLAUDE.md, GEMINI.md, and .github/copilot-instructions.md
3+
# Supports: CLAUDE.md, GEMINI.md, AmazonQ.md, and .github/copilot-instructions.md
44
# O(1) operation - only reads current context file and new plan.md
55

66
set -e
@@ -14,6 +14,7 @@ NEW_PLAN="$FEATURE_DIR/plan.md"
1414
CLAUDE_FILE="$REPO_ROOT/CLAUDE.md"
1515
GEMINI_FILE="$REPO_ROOT/GEMINI.md"
1616
COPILOT_FILE="$REPO_ROOT/.github/copilot-instructions.md"
17+
AMAZONQ_FILE="$REPO_ROOT/AmazonQ.md"
1718

1819
# Allow override via argument
1920
AGENT_TYPE="$1"
@@ -197,20 +198,24 @@ case "$AGENT_TYPE" in
197198
"copilot")
198199
update_agent_file "$COPILOT_FILE" "GitHub Copilot"
199200
;;
201+
"qchat")
202+
update_agent_file "$AMAZONQ_FILE" "Amazon Q Developer CLI"
203+
;;
200204
"")
201205
# Update all existing files
202206
[ -f "$CLAUDE_FILE" ] && update_agent_file "$CLAUDE_FILE" "Claude Code"
203207
[ -f "$GEMINI_FILE" ] && update_agent_file "$GEMINI_FILE" "Gemini CLI"
204208
[ -f "$COPILOT_FILE" ] && update_agent_file "$COPILOT_FILE" "GitHub Copilot"
209+
[ -f "$AMAZONQ_FILE" ] && update_agent_file "$AMAZONQ_FILE" "Amazon Q Developer CLI"
205210
206211
# If no files exist, create based on current directory or ask user
207-
if [ ! -f "$CLAUDE_FILE" ] && [ ! -f "$GEMINI_FILE" ] && [ ! -f "$COPILOT_FILE" ]; then
212+
if [ ! -f "$CLAUDE_FILE" ] && [ ! -f "$GEMINI_FILE" ] && [ ! -f "$COPILOT_FILE" ] && [ ! -f "$AMAZONQ_FILE" ]; then
208213
echo "No agent context files found. Creating Claude Code context file by default."
209214
update_agent_file "$CLAUDE_FILE" "Claude Code"
210215
fi
211216
;;
212217
*)
213-
echo "ERROR: Unknown agent type '$AGENT_TYPE'. Use: claude, gemini, copilot, or leave empty for all."
218+
echo "ERROR: Unknown agent type '$AGENT_TYPE'. Use: claude, gemini, copilot, qchat, or leave empty for all."
214219
exit 1
215220
;;
216221
esac
@@ -227,8 +232,9 @@ if [ ! -z "$NEW_DB" ] && [ "$NEW_DB" != "N/A" ]; then
227232
fi
228233
229234
echo ""
230-
echo "Usage: $0 [claude|gemini|copilot]"
235+
echo "Usage: $0 [claude|gemini|copilot|qchat]"
231236
echo " - No argument: Update all existing agent context files"
232237
echo " - claude: Update only CLAUDE.md"
233238
echo " - gemini: Update only GEMINI.md"
234-
echo " - copilot: Update only .github/copilot-instructions.md"
239+
echo " - copilot: Update only .github/copilot-instructions.md"
240+
echo " - qchat: Update only AmazonQ.md"

‎src/specify_cli/__init__.py‎

Lines changed: 127 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,63 @@
5151
AI_CHOICES = {
5252
"copilot": "GitHub Copilot",
5353
"claude": "Claude Code",
54-
"gemini": "Gemini CLI"
54+
"gemini": "Gemini CLI",
55+
"qchat": "Amazon Q Developer CLI"
5556
}
5657

58+
# Embedded fallback agent config for qchat (used only if templates/agent is not found)
59+
QCHAT_AGENT_CONFIG = """{
60+
"name": "spec-kit-agent",
61+
"description": "Spec-driven development agent for Amazon Q Developer CLI",
62+
"prompt": "You are a spec-driven development assistant. Help users create specifications, implementation plans, and break down tasks for software development projects.",
63+
"resources": [
64+
"file://AmazonQ.md",
65+
"file://memory/**/*.md",
66+
"file://templates/**/*.md"
67+
]
68+
}"""
69+
70+
# Saved prompts for qchat
71+
QCHAT_PROMPT_SPECIFY = """# Specify Feature
72+
73+
Create a new feature specification and branch.
74+
75+
## Arguments
76+
- description (required): Feature description
77+
78+
## Prompt
79+
Create a specification for: {{description}}
80+
81+
Please run `scripts/create-new-feature.sh --json "{{description}}"` to set up the branch and specification file, then fill in the specification template with concrete details.
82+
"""
83+
84+
QCHAT_PROMPT_PLAN = """# Plan Implementation
85+
86+
Create an implementation plan for a feature.
87+
88+
## Arguments
89+
- context (optional): Additional implementation context
90+
91+
## Prompt
92+
Create an implementation plan for the current feature specification.
93+
94+
{{#context}}
95+
Additional context: {{context}}
96+
{{/context}}
97+
98+
Please run `scripts/setup-plan.sh --json` to set up the plan file, then create a detailed implementation plan including phases, research, data models, and contracts as needed.
99+
"""
100+
101+
QCHAT_PROMPT_TASKS = """# Break Down Tasks
102+
103+
Break down the implementation plan into executable tasks.
104+
105+
## Prompt
106+
Break down the current implementation plan into specific, executable tasks.
107+
108+
Please run `scripts/check-task-prerequisites.sh --json` to check prerequisites, then create numbered tasks (T001, T002, ...) with clear file paths and dependency notes. Mark parallel tasks with [P].
109+
"""
110+
57111
# ASCII Art Banner
58112
BANNER = """
59113
███████╗██████╗ ███████╗ ██████╗██╗███████╗██╗ ██╗
@@ -405,23 +459,31 @@ def download_template_from_github(ai_assistant: str, download_dir: Path, *, verb
405459
console.print(f"[red]Error fetching release information:[/red] {e}")
406460
raise typer.Exit(1)
407461

408-
# Find the template asset for the specified AI assistant
462+
# Find the template asset for the specified AI assistant, with fallback for 'qchat' -> 'copilot'
409463
pattern = f"spec-kit-template-{ai_assistant}"
410-
matching_assets = [
411-
asset for asset in release_data.get("assets", [])
412-
if pattern in asset["name"] and asset["name"].endswith(".zip")
413-
]
414-
415-
if not matching_assets:
464+
assets = release_data.get("assets", [])
465+
matching_assets = [a for a in assets if pattern in a["name"] and a["name"].endswith(".zip")]
466+
467+
asset = None
468+
if matching_assets:
469+
asset = matching_assets[0]
470+
elif ai_assistant == "qchat":
471+
# Fallback to copilot template if qchat-specific template is not published yet
472+
fallback_pattern = "spec-kit-template-copilot"
473+
fallback_assets = [a for a in assets if fallback_pattern in a["name"] and a["name"].endswith(".zip")]
474+
if fallback_assets:
475+
asset = fallback_assets[0]
476+
if verbose:
477+
console.print("[yellow]No 'qchat' template found; falling back to 'copilot' template.[/yellow]")
478+
479+
if asset is None:
416480
if verbose:
417481
console.print(f"[red]Error:[/red] No template found for AI assistant '{ai_assistant}'")
418482
console.print(f"[yellow]Available assets:[/yellow]")
419-
for asset in release_data.get("assets", []):
420-
console.print(f" - {asset['name']}")
483+
for a in assets:
484+
console.print(f" - {a['name']}")
421485
raise typer.Exit(1)
422486

423-
# Use the first matching asset
424-
asset = matching_assets[0]
425487
download_url = asset["browser_download_url"]
426488
filename = asset["name"]
427489
file_size = asset["size"]
@@ -737,6 +799,10 @@ def init(
737799
if not check_tool("gemini", "Install from: https://github.com/google-gemini/gemini-cli"):
738800
console.print("[red]Error:[/red] Gemini CLI is required for Gemini projects")
739801
agent_tool_missing = True
802+
elif selected_ai == "qchat":
803+
if not check_tool("qchat", "Install from: https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line.html"):
804+
console.print("[red]Error:[/red] Amazon Q Developer CLI is required for qchat projects")
805+
agent_tool_missing = True
740806
# GitHub Copilot check is not needed as it's typically available in supported IDEs
741807

742808
if agent_tool_missing:
@@ -765,13 +831,53 @@ def init(
765831
("final", "Finalize")
766832
]:
767833
tracker.add(key, label)
834+
# qchat only: show progress for saved prompts setup
835+
if selected_ai == "qchat":
836+
tracker.add("commands", "Setup saved prompts")
768837

769838
# Use transient so live tree is replaced by the final static render (avoids duplicate output)
770839
with Live(tracker.render(), console=console, refresh_per_second=8, transient=True) as live:
771840
tracker.attach_refresh(lambda: live.update(tracker.render()))
772841
try:
773842
download_and_extract_template(project_path, selected_ai, here, verbose=False, tracker=tracker)
774843

844+
# qchat only: setup agent config and saved prompts
845+
if selected_ai == "qchat":
846+
tracker.start("commands")
847+
try:
848+
amazonq_dir = project_path / ".amazonq"
849+
850+
# Create agent.json
851+
agent_config_file = amazonq_dir / "agent.json"
852+
if not agent_config_file.exists():
853+
amazonq_dir.mkdir(parents=True, exist_ok=True)
854+
agent_config_file.write_text(QCHAT_AGENT_CONFIG, encoding="utf-8")
855+
856+
# Create prompts directory and files
857+
prompts_dir = amazonq_dir / "prompts"
858+
prompts_dir.mkdir(parents=True, exist_ok=True)
859+
860+
prompt_files = [
861+
("specify.md", QCHAT_PROMPT_SPECIFY),
862+
("plan.md", QCHAT_PROMPT_PLAN),
863+
("tasks.md", QCHAT_PROMPT_TASKS)
864+
]
865+
866+
created_count = 0
867+
for filename, content in prompt_files:
868+
prompt_file = prompts_dir / filename
869+
if not prompt_file.exists():
870+
prompt_file.write_text(content, encoding="utf-8")
871+
created_count += 1
872+
873+
if created_count > 0:
874+
tracker.complete("commands", f"created {created_count} saved prompts")
875+
else:
876+
tracker.skip("commands", "prompts already exist")
877+
878+
except Exception as e:
879+
tracker.error("commands", str(e))
880+
775881
# Git step
776882
if not no_git:
777883
tracker.start("git")
@@ -823,6 +929,13 @@ def init(
823929
steps_lines.append(" - See GEMINI.md for all available commands")
824930
elif selected_ai == "copilot":
825931
steps_lines.append(f"{step_num}. Open in Visual Studio Code and use [bold cyan]/specify[/], [bold cyan]/plan[/], [bold cyan]/tasks[/] commands with GitHub Copilot")
932+
elif selected_ai == "qchat":
933+
steps_lines.append(f"{step_num}. Use Amazon Q Developer CLI with saved prompts")
934+
steps_lines.append(" - Run q chat to start interactive session")
935+
steps_lines.append(" - Use @specify \"description\" to create specifications")
936+
steps_lines.append(" - Use @plan to create implementation plans")
937+
steps_lines.append(" - Use @tasks to break down into tasks")
938+
steps_lines.append(" - Saved prompts are in .amazonq/prompts/")
826939

827940
step_num += 1
828941
steps_lines.append(f"{step_num}. Update [bold magenta]CONSTITUTION.md[/bold magenta] with your project's non-negotiable principles")
@@ -855,11 +968,12 @@ def check():
855968
console.print("\n[cyan]Optional AI tools:[/cyan]")
856969
claude_ok = check_tool("claude", "Install from: https://docs.anthropic.com/en/docs/claude-code/setup")
857970
gemini_ok = check_tool("gemini", "Install from: https://github.com/google-gemini/gemini-cli")
971+
qchat_ok = check_tool("qchat", "Install from: https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line.html")
858972

859973
console.print("\n[green]✓ Specify CLI is ready to use![/green]")
860974
if not git_ok:
861975
console.print("[yellow]Consider installing git for repository management[/yellow]")
862-
if not (claude_ok or gemini_ok):
976+
if not (claude_ok or gemini_ok or qchat_ok):
863977
console.print("[yellow]Consider installing an AI assistant for the best experience[/yellow]")
864978

865979

0 commit comments

Comments
 (0)