programmatic subagents
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(cli): embed real version in help and release binaries

+48 -5
+4 -2
.github/workflows/release.yml
··· 21 21 - uses: oven-sh/setup-bun@v2 22 22 - run: bun install 23 23 - name: Compile binary 24 - run: bun build --compile packages/cli/src/bin/mill.ts --outfile mill-bin 24 + run: | 25 + VERSION=${GITHUB_REF_NAME#v} 26 + bun build --compile packages/cli/src/bin/mill.ts --outfile mill-bin --define "__MILL_VERSION__=\"${VERSION}\"" 25 27 - name: Package bottle 26 28 run: | 27 29 VERSION=${GITHUB_REF_NAME#v} ··· 90 92 91 93 def install 92 94 system "bun", "install", "--frozen-lockfile" 93 - system "bun", "build", "--compile", "packages/cli/src/bin/mill.ts", "--outfile", "mill" 95 + system "bun", "build", "--compile", "packages/cli/src/bin/mill.ts", "--outfile", "mill", "--define", "__MILL_VERSION__=\"#{version}\"" 94 96 bin.install "mill" 95 97 end 96 98
+2 -1
README.md
··· 17 17 ```bash 18 18 git clone https://github.com/laulauland/mill.git && cd mill 19 19 bun install 20 - bun build --compile packages/cli/src/bin/mill.ts --outfile mill 20 + VERSION=$(node -p 'require("./packages/cli/package.json").version') 21 + bun build --compile packages/cli/src/bin/mill.ts --outfile mill --define "__MILL_VERSION__=\"$VERSION\"" 21 22 mv mill ~/.local/bin/ # or anywhere on your PATH 22 23 ``` 23 24
+42 -2
packages/cli/src/public/index.api.ts
··· 4 4 import * as BunContext from "@effect/platform-bun/BunContext"; 5 5 import * as Schema from "@effect/schema/Schema"; 6 6 import { Effect, Option, Runtime, Scope } from "effect"; 7 + import { readFileSync } from "node:fs"; 7 8 import { 8 9 cancelRun, 9 10 defineConfig, ··· 42 43 readonly code: number; 43 44 } 44 45 46 + declare const __MILL_VERSION__: string | undefined; 47 + 45 48 const runtime = Runtime.defaultRuntime; 49 + 50 + const readVersionFromPackageJson = (): string | undefined => { 51 + try { 52 + const packageJsonPath = new URL("../../package.json", import.meta.url); 53 + const parsed = JSON.parse(readFileSync(packageJsonPath, "utf-8")) as { 54 + readonly version?: unknown; 55 + }; 56 + 57 + return typeof parsed.version === "string" && parsed.version.length > 0 58 + ? parsed.version 59 + : undefined; 60 + } catch { 61 + return undefined; 62 + } 63 + }; 64 + 65 + const resolveCliVersion = (): string => { 66 + if (typeof __MILL_VERSION__ === "string" && __MILL_VERSION__.length > 0) { 67 + return __MILL_VERSION__; 68 + } 69 + 70 + const envVersion = process.env.MILL_VERSION ?? process.env.npm_package_version; 71 + 72 + if (typeof envVersion === "string" && envVersion.length > 0) { 73 + return envVersion; 74 + } 75 + 76 + const packageVersion = readVersionFromPackageJson(); 77 + 78 + if (packageVersion !== undefined) { 79 + return packageVersion; 80 + } 81 + 82 + return "0.0.0"; 83 + }; 84 + 85 + const CLI_VERSION = resolveCliVersion(); 46 86 47 87 const defaultIo: CliIo = { 48 88 stdout: (line) => { ··· 765 805 }; 766 806 767 807 const buildHelpText = (helpContext: ResolvedHelpContext): string => 768 - `mill - orchestration runtime for AI agents 808 + `mill ${CLI_VERSION} - orchestration runtime for AI agents 769 809 770 810 Usage: mill <command> [options] 771 811 ··· 944 984 const command = createCli(resolvedOptions, io); 945 985 const run = CliCommand.run(command, { 946 986 name: "mill", 947 - version: "0.0.0", 987 + version: CLI_VERSION, 948 988 executable: "mill", 949 989 }); 950 990