From 5bb0ed937b10196b5bae845b60911404fab16f8e Mon Sep 17 00:00:00 2001 From: Vasilii Tokarev Date: Fri, 20 Mar 2026 23:03:53 +0100 Subject: [PATCH 1/3] build: update package.json with version, description, and output path; add CI and publish workflows --- .github/workflows/ci.yml | 16 ++++++++++++++++ .github/workflows/publish.yml | 22 ++++++++++++++++++++++ package.json | 12 +++++++++--- 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c6e50e4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + - run: bun install + - run: bun run check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..939cd89 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,22 @@ +name: Publish + +on: + push: + tags: + - "v*" + +jobs: + publish: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v2 + - uses: actions/setup-node@v4 + with: + node-version: "20" + registry-url: "https://registry.npmjs.org" + - run: bun install + - run: bun run build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 65e7a57..f7899d7 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,15 @@ { "name": "macctl", + "version": "0.1.0", + "description": "macOS CLI for controlling system settings (volume, screen, etc.) via AppleScript", "module": "src/index.ts", "type": "module", "bin": { - "macctl": "./src/index.ts" + "macctl": "./dist/index.js" }, + "files": [ + "dist" + ], "scripts": { "dev": "bun run src/index.ts", "build": "bun build ./src/index.ts --target bun --outdir ./dist", @@ -12,9 +17,10 @@ "lint": "biome lint src package.json tsconfig.json", "format": "biome format --write src package.json tsconfig.json", "check": "biome check src package.json tsconfig.json", - "check:fix": "biome check --write src package.json tsconfig.json" + "check:fix": "biome check --write src package.json tsconfig.json", + "prepublishOnly": "bun run build" }, - "private": true, + "license": "MIT", "devDependencies": { "@biomejs/biome": "^2.4.8", "@types/bun": "latest" From 9d1045c5a1dfbafd2ab4a7b3afb70ae1b043b57e Mon Sep 17 00:00:00 2001 From: Vasilii Tokarev Date: Fri, 20 Mar 2026 23:09:45 +0100 Subject: [PATCH 2/3] fix: add type annotation for result variable in createVolumeCommand function --- src/commands/volume.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/volume.ts b/src/commands/volume.ts index 10b57f7..6af3e71 100644 --- a/src/commands/volume.ts +++ b/src/commands/volume.ts @@ -7,6 +7,7 @@ import { setMute, setVolume, toggleMute, + type VolumeState, } from "../lib/volume"; function ensurePercent(value: number, field = "value"): number { @@ -93,7 +94,7 @@ export function createVolumeCommand() { .description("Mute controls") .argument("", "on | off | toggle") .action((state: string) => { - let result; + let result: VolumeState; if (state === "on") { result = setMute(true); From 189c158b04aa8c1af0b9bd5d2862ed61795929d8 Mon Sep 17 00:00:00 2001 From: Vasilii Tokarev Date: Fri, 20 Mar 2026 23:11:23 +0100 Subject: [PATCH 3/3] fix: reorder import statements in index.ts to maintain consistency --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 4bcfcaf..168c724 100755 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ #!/usr/bin/env bun import { Command } from "commander"; -import { createVolumeCommand } from "./commands/volume"; import { createScreenCommand } from "./commands/screen"; +import { createVolumeCommand } from "./commands/volume"; const program = new Command();