class DingtalkWorkspaceCliBeta < Formula desc "Automate DingTalk workspace tasks from the terminal (beta channel)" homepage "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli" version "1.0.53-beta.3" license "Apache-2.0" keg_only "it is the beta channel and conflicts with dingtalk-workspace-cli" on_macos do if Hardware::CPU.arm? url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.53-beta.3/dws-darwin-arm64.tar.gz" sha256 "fbe42ecdff58ab510fcd92be49094a25edce049abca4fcf6b727dab0a4fda01e" else url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.53-beta.3/dws-darwin-amd64.tar.gz" sha256 "b83fda8cf51fde929e9d40004fa634261eec2e70fdcca1a8f99d1437783b42b9" end end on_linux do if Hardware::CPU.arm? url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.53-beta.3/dws-linux-arm64.tar.gz" sha256 "d258bc63c018faf0c83ef89460c6f2beec8f937dc1e2ee948ec22dd6b613eafd" else url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.53-beta.3/dws-linux-amd64.tar.gz" sha256 "0446688421075db9b7ce7f36ff4c842787add5eb616de3cc1e3baf60aa8429eb" end end resource "skills" do url "https://github.com/DingTalk-Real-AI/dingtalk-workspace-cli/releases/download/v1.0.53-beta.3/dws-skills.zip" sha256 "abc2585244e9bd680357724be642a5362eac3df07ae2597d0525fbb7f43fc604" 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. This beta is keg-only. Add #{opt_bin} to PATH to use its `dws` binary. EOS end test do assert_match version.to_s, shell_output("#{bin}/dws version") end end