class __CLASS_NAME__ < Formula desc "Install locally built DingTalk workspace CLI artifacts for verification" homepage "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli" url "__ARCHIVE_URL__" sha256 "__ARCHIVE_SHA256__" license "Apache-2.0" __KEG_ONLY_LINE__ resource "skills" do url "__SKILLS_URL__" sha256 "__SKILLS_SHA256__" end def install root = Dir["dws-*"].find { |entry| File.directory?(entry) } || "." binary = File.join(root, "dws") raise "binary not found: #{binary}" unless File.exist?(binary) bin.install binary => "dws" %w[LICENSE NOTICE README.md CHANGELOG.md].each do |name| source = File.join(root, name) pkgshare.install source if File.exist?(source) end skill_dest = pkgshare/"skills/dws" skill_dest.mkpath resource("skills").stage do cp_r(Dir["*"], skill_dest) end end def caveats <<~EOS Agent Skills are bundled in #{pkgshare}/skills/dws. Run `dws skill setup` to install them into your Agent directories. EOS end test do assert_match "dws", shell_output("#{bin}/dws --help") end end