Skip to content

Commit a4ae850

Browse files
committed
fix: address PR review comments for kimi agent support
- Fix VERSION_NO_V undefined variable in create-github-release.sh - Restore version $1 argument handling in create-release-packages.sh - Fix tabnine/vibe/generic cases calling undefined generate_commands - Align roo path .roo/rules -> .roo/commands with AGENT_CONFIG - Fix kimi extension to use per-skill SKILL.md directory structure - Add parent mkdir before dest_file.write_text for nested paths - Restore devcontainer tools removed by regression + add Kimi CLI - Strengthen test_kimi_in_powershell_validate_set assertion
1 parent d488b01 commit a4ae850

File tree

6 files changed

+116
-51
lines changed

6 files changed

+116
-51
lines changed

.devcontainer/post-create.sh

Lines changed: 93 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,108 @@
1-
#!/usr/bin/env bash
2-
3-
# Post-create script for Spec Kit devcontainer
4-
# This script runs after the devcontainer is created to install
5-
# additional tools and dependencies.
1+
#!/bin/bash
62

3+
# Exit immediately on error, treat unset variables as an error, and fail if any command in a pipeline fails.
74
set -euo pipefail
85

9-
echo "🔧 Running post-create setup..."
10-
11-
#==============================================================================
12-
# Install Kiro CLI
13-
#==============================================================================
6+
# Function to run a command and show logs only on error
7+
run_command() {
8+
local command_to_run="$*"
9+
local output
10+
local exit_code
1411

15-
echo "📦 Installing Kiro CLI..."
12+
# Capture all output (stdout and stderr)
13+
output=$(eval "$command_to_run" 2>&1) || exit_code=$?
14+
exit_code=${exit_code:-0}
1615

17-
KIRO_INSTALLER_SHA256="7487a65cf310b7fb59b357c4b5e6e3f3259d383f4394ecedb39acf70f307cffb"
18-
KIRO_INSTALLER_URL="https://kiro.dev/install.sh"
19-
KIRO_INSTALLER_PATH="/tmp/kiro-installer.sh"
16+
if [ $exit_code -ne 0 ]; then
17+
echo -e "\033[0;31m[ERROR] Command failed (Exit Code $exit_code): $command_to_run\033[0m" >&2
18+
echo -e "\033[0;31m$output\033[0m" >&2
2019

21-
# Download installer
22-
curl -fsSL "$KIRO_INSTALLER_URL" -o "$KIRO_INSTALLER_PATH"
20+
exit $exit_code
21+
fi
22+
}
2323

24-
# Verify checksum
25-
echo "$KIRO_INSTALLER_SHA256 $KIRO_INSTALLER_PATH" | sha256sum -c -
24+
# Installing CLI-based AI Agents
2625

27-
# Run installer
28-
bash "$KIRO_INSTALLER_PATH"
26+
echo -e "\n🤖 Installing Copilot CLI..."
27+
run_command "npm install -g @github/copilot@latest"
28+
echo "✅ Done"
2929

30-
# Cleanup
31-
rm -f "$KIRO_INSTALLER_PATH"
30+
echo -e "\n🤖 Installing Claude CLI..."
31+
run_command "npm install -g @anthropic-ai/claude-code@latest"
32+
echo "✅ Done"
3233

33-
echo "✅ Kiro CLI installed"
34+
echo -e "\n🤖 Installing Codex CLI..."
35+
run_command "npm install -g @openai/codex@latest"
36+
echo "✅ Done"
3437

35-
#==============================================================================
36-
# Install Kimi CLI
37-
#==============================================================================
38+
echo -e "\n🤖 Installing Gemini CLI..."
39+
run_command "npm install -g @google/gemini-cli@latest"
40+
echo "✅ Done"
3841

39-
echo "📦 Installing Kimi CLI..."
42+
echo -e "\n🤖 Installing Augie CLI..."
43+
run_command "npm install -g @augmentcode/auggie@latest"
44+
echo "✅ Done"
4045

41-
curl -LsSf https://code.kimi.com/install.sh | bash
46+
echo -e "\n🤖 Installing Qwen Code CLI..."
47+
run_command "npm install -g @qwen-code/qwen-code@latest"
48+
echo "✅ Done"
4249

43-
echo "✅ Kimi CLI installed"
50+
echo -e "\n🤖 Installing OpenCode CLI..."
51+
run_command "npm install -g opencode-ai@latest"
52+
echo "✅ Done"
4453

45-
#==============================================================================
46-
# Summary
47-
#==============================================================================
48-
49-
echo ""
50-
echo "🎉 Post-create setup complete!"
51-
echo ""
52-
echo "Installed tools:"
53-
echo " - Kiro CLI"
54-
echo " - Kimi CLI"
54+
echo -e "\n🤖 Installing Kiro CLI..."
55+
# https://kiro.dev/docs/cli/
56+
KIRO_INSTALLER_URL="https://kiro.dev/install.sh"
57+
KIRO_INSTALLER_SHA256="7487a65cf310b7fb59b357c4b5e6e3f3259d383f4394ecedb39acf70f307cffb"
58+
KIRO_INSTALLER_PATH="$(mktemp)"
59+
60+
cleanup_kiro_installer() {
61+
rm -f "$KIRO_INSTALLER_PATH"
62+
}
63+
trap cleanup_kiro_installer EXIT
64+
65+
run_command "curl -fsSL \"$KIRO_INSTALLER_URL\" -o \"$KIRO_INSTALLER_PATH\""
66+
run_command "echo \"$KIRO_INSTALLER_SHA256 $KIRO_INSTALLER_PATH\" | sha256sum -c -"
67+
68+
run_command "bash \"$KIRO_INSTALLER_PATH\""
69+
70+
kiro_binary=""
71+
if command -v kiro-cli >/dev/null 2>&1; then
72+
kiro_binary="kiro-cli"
73+
elif command -v kiro >/dev/null 2>&1; then
74+
kiro_binary="kiro"
75+
else
76+
echo -e "\033[0;31m[ERROR] Kiro CLI installation did not create 'kiro-cli' or 'kiro' in PATH.\033[0m" >&2
77+
exit 1
78+
fi
79+
80+
run_command "$kiro_binary --help > /dev/null"
81+
echo "✅ Done"
82+
83+
echo -e "\n🤖 Installing Kimi CLI..."
84+
# https://code.kimi.com
85+
# Note: Kimi does not yet publish a pinned installer checksum.
86+
# The checksum will be added here once officially available.
87+
run_command "curl -LsSf https://code.kimi.com/install.sh | bash"
88+
echo "✅ Done"
89+
90+
echo -e "\n🤖 Installing CodeBuddy CLI..."
91+
run_command "npm install -g @tencent-ai/codebuddy-code@latest"
92+
echo "✅ Done"
93+
94+
# Installing UV (Python package manager)
95+
echo -e "\n🐍 Installing UV - Python Package Manager..."
96+
run_command "pipx install uv"
97+
echo "✅ Done"
98+
99+
# Installing DocFx (for documentation site)
100+
echo -e "\n📚 Installing DocFx..."
101+
run_command "dotnet tool update -g docfx"
102+
echo "✅ Done"
103+
104+
echo -e "\n🧹 Cleaning cache..."
105+
run_command "sudo apt-get autoclean"
106+
run_command "sudo apt-get clean"
107+
108+
echo "✅ Setup completed. Happy coding! 🚀"

.github/workflows/scripts/create-github-release.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set -euo pipefail
1313

1414
# Version from git tag or environment
1515
VERSION="${VERSION:-$(git describe --tags --always 2>/dev/null || echo 'dev')}"
16+
VERSION_NO_V="${VERSION#v}"
1617

1718
# Release directory
1819
RELEASE_DIR=".genreleases"

.github/workflows/scripts/create-release-packages.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ function Create-Package {
176176
Generate-Commands -Agent $Agent -Format 'md' -Args '$ARGUMENTS' -DestDir "$BaseDir/.qoder\commands" -Script $Script
177177
}
178178
'roo' {
179-
New-Item -ItemType Directory -Force -Path "$BaseDir/.roo\rules" | Out-Null
180-
Generate-Commands -Agent $Agent -Format 'md' -Args '$ARGUMENTS' -DestDir "$BaseDir/.roo\rules" -Script $Script
179+
New-Item -ItemType Directory -Force -Path "$BaseDir/.roo\commands" | Out-Null
180+
Generate-Commands -Agent $Agent -Format 'md' -Args '$ARGUMENTS' -DestDir "$BaseDir/.roo\commands" -Script $Script
181181
}
182182
'kiro-cli' {
183183
New-Item -ItemType Directory -Force -Path "$BaseDir/.kiro/prompts" | Out-Null

.github/workflows/scripts/create-release-packages.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ set -euo pipefail
2626
# All supported agents
2727
ALL_AGENTS=(copilot claude gemini cursor-agent qwen opencode codex windsurf kilocode auggie codebuddy qodercli roo kiro-cli amp shai tabnine agy bob vibe kimi generic)
2828

29-
# Version from git tag or default
30-
VERSION="${VERSION:-$(git describe --tags --always 2>/dev/null || echo 'dev')}"
29+
# Version from argument, env, or git tag (in that order)
30+
if [[ $# -ge 1 && -n "${1:-}" ]]; then
31+
VERSION="$1"
32+
else
33+
VERSION="${VERSION:-$(git describe --tags --always 2>/dev/null || echo 'dev')}"
34+
fi
3135

3236
# Output directory
3337
OUTPUT_DIR=".genreleases"
@@ -236,8 +240,8 @@ create_package() {
236240
copy_real_md_commands "$base_dir/.qoder/commands"
237241
;;
238242
roo)
239-
mkdir -p "$base_dir/.roo/rules"
240-
copy_real_md_commands "$base_dir/.roo/rules"
243+
mkdir -p "$base_dir/.roo/commands"
244+
copy_real_md_commands "$base_dir/.roo/commands"
241245
;;
242246
kiro-cli)
243247
mkdir -p "$base_dir/.kiro/prompts"
@@ -261,19 +265,19 @@ create_package() {
261265
;;
262266
tabnine)
263267
mkdir -p "$base_dir/.tabnine/agent/commands"
264-
generate_commands tabnine toml "{{args}}" "$base_dir/.tabnine/agent/commands" "$script"
268+
generate_toml_commands tabnine "{{args}}" "$base_dir/.tabnine/agent/commands"
265269
;;
266270
vibe)
267271
mkdir -p "$base_dir/.vibe/prompts"
268-
generate_commands vibe md "$ARGUMENTS" "$base_dir/.vibe/prompts" "$script"
272+
copy_real_md_commands "$base_dir/.vibe/prompts"
269273
;;
270274
kimi)
271275
mkdir -p "$base_dir/.kimi/skills"
272276
create_kimi_skills "$base_dir/.kimi/skills"
273277
;;
274278
generic)
275279
mkdir -p "$base_dir/.speckit/commands"
276-
generate_commands generic md "$ARGUMENTS" "$base_dir/.speckit/commands" "$script"
280+
copy_real_md_commands "$base_dir/.speckit/commands"
277281
;;
278282
esac
279283

src/specify_cli/extensions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ class CommandRegistrar:
654654
"extension": ".md"
655655
},
656656
"roo": {
657-
"dir": ".roo/rules",
657+
"dir": ".roo/commands",
658658
"format": "markdown",
659659
"args": "$ARGUMENTS",
660660
"extension": ".md"
@@ -705,7 +705,7 @@ class CommandRegistrar:
705705
"dir": ".kimi/skills",
706706
"format": "markdown",
707707
"args": "$ARGUMENTS",
708-
"extension": ".md"
708+
"extension": "/SKILL.md"
709709
}
710710
}
711711

@@ -899,6 +899,7 @@ def register_commands_for_agent(
899899

900900
# Write command file
901901
dest_file = commands_dir / f"{cmd_name}{agent_config['extension']}"
902+
dest_file.parent.mkdir(parents=True, exist_ok=True)
902903
dest_file.write_text(output)
903904

904905
# Generate companion .prompt.md for Copilot agents
@@ -910,6 +911,7 @@ def register_commands_for_agent(
910911
# Register aliases
911912
for alias in cmd_info.get("aliases", []):
912913
alias_file = commands_dir / f"{alias}{agent_config['extension']}"
914+
alias_file.parent.mkdir(parents=True, exist_ok=True)
913915
alias_file.write_text(output)
914916
# Generate companion .prompt.md for alias too
915917
if agent_name == "copilot":

tests/test_agent_config_consistency.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ def test_kimi_in_powershell_validate_set(self):
194194
"""PowerShell update-agent-context script should include 'kimi' in ValidateSet."""
195195
ps_text = (REPO_ROOT / "scripts" / "powershell" / "update-agent-context.ps1").read_text(encoding="utf-8")
196196

197-
assert "'kimi'" in ps_text
197+
validate_set_match = re.search(r"\[ValidateSet\(([^)]*)\)\]", ps_text)
198+
assert validate_set_match is not None
199+
validate_set_values = re.findall(r"'([^']+)'", validate_set_match.group(1))
200+
201+
assert "kimi" in validate_set_values
198202

199203
def test_kimi_in_github_release_output(self):
200204
"""GitHub release script should include kimi template packages."""

0 commit comments

Comments
 (0)