From 2e51b868f39ce0f3c70d982b60770ea766f5f726 Mon Sep 17 00:00:00 2001 From: coso Date: Wed, 13 May 2026 12:29:02 +0800 Subject: [PATCH] test: verify skill prompt install flow --- src-tauri/src/commands/skill_cmd.rs | 34 +++++++++++++++++++++++ src/lib/skills/skillInstallPrompt.test.ts | 16 +++++++++++ 2 files changed, 50 insertions(+) diff --git a/src-tauri/src/commands/skill_cmd.rs b/src-tauri/src/commands/skill_cmd.rs index 6faeaf5e1..9250f8f3e 100644 --- a/src-tauri/src/commands/skill_cmd.rs +++ b/src-tauri/src/commands/skill_cmd.rs @@ -1890,6 +1890,40 @@ content"#, writer.finish().unwrap().into_inner() } + #[tokio::test] + #[ignore = "downloads the live limeai.run skill package and verifies local install output"] + async fn test_install_live_lime_skill_zip_from_website_prompt() { + const SKILL_NAME: &str = "viral-content-breakdown"; + const DOWNLOAD_URL: &str = + "https://limeai.run/skill-packages/viral-content-breakdown/latest/viral-content-breakdown.zip"; + + let bytes = download_skill_package_zip(DOWNLOAD_URL) + .await + .expect("live skill package should download"); + assert!(!bytes.is_empty()); + println!("downloaded_bytes={}", bytes.len()); + + let temp_dir = TempDir::new().unwrap(); + let target_root = temp_dir.path().join("skills"); + let result = install_skill_zip_bytes_into_root(&target_root, SKILL_NAME, &bytes) + .expect("live skill package should install into a temp skills root"); + + let installed_dir = target_root.join(SKILL_NAME); + let discovered = scan_installed_skills(&target_root); + println!("installed_dir={}", installed_dir.display()); + println!("discovered_skills={discovered:?}"); + assert_eq!(result.directory, SKILL_NAME); + assert!(installed_dir.join("SKILL.md").is_file()); + assert!(!installed_dir.join(SKILL_NAME).join("SKILL.md").exists()); + assert!(result.inspection.standard_compliance.is_standard); + assert!(result + .inspection + .standard_compliance + .validation_errors + .is_empty()); + assert!(discovered.contains(&SKILL_NAME.to_string())); + } + #[test] fn test_install_skill_zip_bytes_into_root_strips_matching_root_directory() { let temp_dir = TempDir::new().unwrap(); diff --git a/src/lib/skills/skillInstallPrompt.test.ts b/src/lib/skills/skillInstallPrompt.test.ts index 534cf6ef9..c7bad0dcb 100644 --- a/src/lib/skills/skillInstallPrompt.test.ts +++ b/src/lib/skills/skillInstallPrompt.test.ts @@ -29,6 +29,22 @@ Extract it into the Agent Skills directory.`); ); }); + it("兼容用户从旧详情页复制的完整安装 Prompt", () => { + const instruction = parseSkillInstallPromptInstruction(`Download and install a skill. Follow these steps EXACTLY. If any step fails, STOP and report the error. +SKILL_NAME="viral-content-breakdown" +DOWNLOAD_URL="https://limeai.run/skills/viral-content-breakdown/" +1. Download the Skill package. +2. Extract it into the Agent Skills directory. +3. Restart or reload the Agent so the Skill becomes available.`); + + expect(instruction).toEqual({ + skillName: "viral-content-breakdown", + downloadUrl: + "https://limeai.run/skill-packages/viral-content-breakdown/latest/viral-content-breakdown.zip", + source: "assignment_prompt", + }); + }); + it("缺少安装语义时不误拦普通消息", () => { expect( parseSkillInstallPromptInstruction(