mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 20:36:23 +08:00
* feat(integration): update Kimi integration for Kimi Code CLI Update the Kimi integration to target the new Kimi Code CLI (MoonshotAI/kimi-code) layout: - Change skills directory from .kimi/skills/ to .kimi-code/skills/ - Change context file from KIMI.md to AGENTS.md - Extend --migrate-legacy to move old .kimi/skills/ installs and migrate KIMI.md user content to AGENTS.md - Clean up leftover legacy .kimi/skills/ directories on teardown - Update devcontainer installer to @moonshot-ai/kimi-code - Update docs and tests Relates to #1532 * fix(integration): align Kimi dispatch and harden legacy migration - Override build_command_invocation to emit /skill:speckit-<stem> so dispatched commands match Kimi Code CLI's native slash syntax. - Skip symlinked .kimi/skills directories during legacy migration and teardown to avoid operating on files outside the project. - Remove kimi from the multi-install-safe integrations table. - Add tests for command invocation and symlink safety. * fix(integration): resolve custom context markers in Kimi legacy migration Use IntegrationBase._resolve_context_markers() when migrating legacy KIMI.md content so that projects with customized context_markers in .specify/extensions/agent-context/agent-context-config.yml have the managed section stripped with the correct markers instead of the hard-coded defaults. Adds a test verifying custom markers are respected during --migrate-legacy. * fix(integration): harden Kimi legacy migration against symlinked paths * fix(kimi): guard symlinked SKILL.md during migration and teardown * docs(kimi): mention KIMI.md→AGENTS.md migration in --migrate-legacy help The --migrate-legacy help text listed only the skills directory move and dotted→hyphenated renaming, but the flag also migrates KIMI.md user content into AGENTS.md. Align the help with the actual behavior, docs, and tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(kimi): validate legacy migration destination; clarify docstrings Address Copilot review feedback on PR #2979: - setup(): gate skills migration on _is_safe_legacy_dir(new_skills_dir) as well as the source. base setup() already rejects a destination that escapes the project root, but an in-tree symlinked .kimi-code/skills (e.g. -> .) could still misdirect the move; this gives the destination the same symlink-component protection as the source. - _migrate_legacy_kimi_dotted_skills: rewrite docstring as a compatibility shim describing same-path delegation to _migrate_legacy_kimi_skills_dir. - test_presets: clarify that the dotted-skill test exercises legacy naming under the current .kimi-code/ base, not the legacy .kimi/ location. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(kimi): harden legacy KIMI.md→AGENTS.md context migration - Skip context-file migration when the agent-context extension is disabled, matching upsert/remove_context_section opt-out behavior so an opted-out project's KIMI.md/AGENTS.md are left untouched. - Safely skip (instead of raising) on filesystem edge cases: unreadable or non-UTF-8 KIMI.md, and AGENTS.md existing as a non-file/unwritable. - Refuse to migrate a corrupted managed section (single marker, or end before start) so a partial managed block is never copied into AGENTS.md; KIMI.md is preserved for manual repair. Add regression tests for all three cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Approve fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * chore(kimi): revert CHANGELOG.md edit (auto-generated) The CHANGELOG is generated from merged PR titles, so a hand-written entry is redundant; it was also placed under the already-released 0.10.2 section, which would make those release notes historically inaccurate. Revert to match main per maintainer feedback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * test(kimi): skip symlink-safety tests when symlinks are unavailable The Kimi legacy-migration safety tests create symlinks to assert that migration/teardown never follow them out of the project. Symlink creation fails on Windows without the create-symlink privilege and in some restricted CI sandboxes, so these tests errored during setup instead of skipping. Wrap every symlink_to() call in a shared _symlink_or_skip() helper that pytest.skip()s on OSError/NotImplementedError, matching the guard pattern already used by one of these tests. Verified on Windows: the 6 symlink tests now skip cleanly (51 passed, 6 skipped) instead of erroring. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(kimi): reject symlinked skills destination before install Add a destination symlink pre-check in KimiIntegration.setup() before super().setup() writes any SKILL.md. The base class only rejects a destination that escapes project_root after resolve(), so an in-tree symlinked .kimi-code/.kimi-code/skills (e.g. `-> .`) would still misdirect writes into an unintended in-tree location (./skills/). Extract the symlink-component walk into a shared _has_symlinked_component() helper and reuse it from _is_safe_legacy_dir(). Add a regression test. Also clarify that --migrate-legacy only migrates KIMI.md -> AGENTS.md when the agent-context extension is enabled, in the CLI help text and the integration docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Refactor formatting and simplify logic in Kimi integration * fix(kimi): reject symlinked target dir during legacy skills migration When the migration destination already exists, guard against a symlinked (or non-directory) target_dir before comparing SKILL.md bytes, so the comparison never follows a link outside the project root. Also skip a missing/non-file target SKILL.md explicitly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
115 lines
3.2 KiB
Bash
Executable File
115 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Exit immediately on error, treat unset variables as an error, and fail if any command in a pipeline fails.
|
|
set -euo pipefail
|
|
|
|
# Function to run a command and show logs only on error
|
|
run_command() {
|
|
local command_to_run="$*"
|
|
local output
|
|
local exit_code
|
|
|
|
# Capture all output (stdout and stderr)
|
|
output=$(eval "$command_to_run" 2>&1) || exit_code=$?
|
|
exit_code=${exit_code:-0}
|
|
|
|
if [ $exit_code -ne 0 ]; then
|
|
echo -e "\033[0;31m[ERROR] Command failed (Exit Code $exit_code): $command_to_run\033[0m" >&2
|
|
echo -e "\033[0;31m$output\033[0m" >&2
|
|
|
|
exit $exit_code
|
|
fi
|
|
}
|
|
|
|
# Installing CLI-based AI Agents
|
|
|
|
echo -e "\n🤖 Installing Copilot CLI..."
|
|
run_command "npm install -g @github/copilot@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Claude CLI..."
|
|
run_command "npm install -g @anthropic-ai/claude-code@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Codex CLI..."
|
|
run_command "npm install -g @openai/codex@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Gemini CLI..."
|
|
run_command "npm install -g @google/gemini-cli@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Augie CLI..."
|
|
run_command "npm install -g @augmentcode/auggie@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Qwen Code CLI..."
|
|
run_command "npm install -g @qwen-code/qwen-code@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing OpenCode CLI..."
|
|
run_command "npm install -g opencode-ai@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Junie CLI..."
|
|
run_command "npm install -g @jetbrains/junie-cli@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Pi Coding Agent..."
|
|
run_command "npm install -g @mariozechner/pi-coding-agent@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Kiro CLI..."
|
|
# https://kiro.dev/docs/cli/
|
|
KIRO_INSTALLER_URL="https://kiro.dev/install.sh"
|
|
KIRO_INSTALLER_SHA256="7487a65cf310b7fb59b357c4b5e6e3f3259d383f4394ecedb39acf70f307cffb"
|
|
KIRO_INSTALLER_PATH="$(mktemp)"
|
|
|
|
cleanup_kiro_installer() {
|
|
rm -f "$KIRO_INSTALLER_PATH"
|
|
}
|
|
trap cleanup_kiro_installer EXIT
|
|
|
|
run_command "curl -fsSL \"$KIRO_INSTALLER_URL\" -o \"$KIRO_INSTALLER_PATH\""
|
|
run_command "echo \"$KIRO_INSTALLER_SHA256 $KIRO_INSTALLER_PATH\" | sha256sum -c -"
|
|
|
|
run_command "bash \"$KIRO_INSTALLER_PATH\""
|
|
|
|
kiro_binary=""
|
|
if command -v kiro-cli >/dev/null 2>&1; then
|
|
kiro_binary="kiro-cli"
|
|
elif command -v kiro >/dev/null 2>&1; then
|
|
kiro_binary="kiro"
|
|
else
|
|
echo -e "\033[0;31m[ERROR] Kiro CLI installation did not create 'kiro-cli' or 'kiro' in PATH.\033[0m" >&2
|
|
exit 1
|
|
fi
|
|
|
|
run_command "$kiro_binary --help > /dev/null"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing Kimi Code CLI..."
|
|
# https://code.kimi.com
|
|
run_command "npm install -g @moonshot-ai/kimi-code@latest"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🤖 Installing CodeBuddy CLI..."
|
|
run_command "npm install -g @tencent-ai/codebuddy-code@latest"
|
|
echo "✅ Done"
|
|
|
|
# Installing UV (Python package manager)
|
|
echo -e "\n🐍 Installing UV - Python Package Manager..."
|
|
run_command "pipx install uv"
|
|
echo "✅ Done"
|
|
|
|
# Installing DocFx (for documentation site)
|
|
echo -e "\n📚 Installing DocFx..."
|
|
run_command "dotnet tool update -g docfx"
|
|
echo "✅ Done"
|
|
|
|
echo -e "\n🧹 Cleaning cache..."
|
|
run_command "sudo apt-get autoclean"
|
|
run_command "sudo apt-get clean"
|
|
|
|
echo "✅ Setup completed. Happy coding! 🚀"
|