Просмотр исходного кода

chore: prepare companion 0.1.3 release

Alvin Unreal 1 месяц назад
Родитель
Сommit
5a4a81a647

+ 1 - 1
companion/Cargo.lock

@@ -2250,7 +2250,7 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "oh-my-opencode-slim-companion"
 name = "oh-my-opencode-slim-companion"
-version = "0.1.2"
+version = "0.1.3"
 dependencies = [
 dependencies = [
  "dirs",
  "dirs",
  "eframe",
  "eframe",

+ 1 - 1
companion/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 [package]
 name = "oh-my-opencode-slim-companion"
 name = "oh-my-opencode-slim-companion"
-version = "0.1.2"
+version = "0.1.3"
 edition = "2021"
 edition = "2021"
 description = "Desktop companion for oh-my-opencode-slim — shows active agent GIFs per session"
 description = "Desktop companion for oh-my-opencode-slim — shows active agent GIFs per session"
 
 

+ 15 - 12
docs/companion.md

@@ -90,7 +90,7 @@ Pass `--companion=no` to skip the native binary and omit the config block.
 
 
 ## niri support status
 ## niri support status
 
 
-The native `companion-v0.1.2` binary now works on niri and exposes a stable
+The native `companion-v0.1.3` binary works on niri and exposes a stable
 Wayland app-id/title: `oh-my-opencode-slim-companion`.
 Wayland app-id/title: `oh-my-opencode-slim-companion`.
 
 
 niri users who want the Companion to behave like an overlay should add a window
 niri users who want the Companion to behave like an overlay should add a window
@@ -161,7 +161,7 @@ For the desktop companion app, the release workflow follows the V2 distribution
 plan:
 plan:
 
 
 1. **GitHub Release Assets**: companion binaries are uploaded to the
 1. **GitHub Release Assets**: companion binaries are uploaded to the
-   `companion-v0.1.2` GitHub release.
+   `companion-v0.1.3` GitHub release.
 2. **Separate Companion Versioning**: the companion uses its own version so the
 2. **Separate Companion Versioning**: the companion uses its own version so the
    plugin can ship beta updates without rebuilding native binaries every time.
    plugin can ship beta updates without rebuilding native binaries every time.
 3. **OS/Arch Detection**: `--companion=yes` selects the archive for the current
 3. **OS/Arch Detection**: `--companion=yes` selects the archive for the current
@@ -175,15 +175,17 @@ plan:
 Current release assets are named:
 Current release assets are named:
 
 
 ```text
 ```text
-oh-my-opencode-slim-companion-v0.1.2-aarch64-apple-darwin.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-x86_64-unknown-linux-gnu.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-aarch64-unknown-linux-gnu.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-x86_64-pc-windows-msvc.zip
+oh-my-opencode-slim-companion-v0.1.3-aarch64-apple-darwin.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-apple-darwin.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-unknown-linux-gnu.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-aarch64-unknown-linux-gnu.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-pc-windows-msvc.zip
 ```
 ```
 
 
 Supported installer targets:
 Supported installer targets:
 
 
 - macOS arm64: `aarch64-apple-darwin`
 - macOS arm64: `aarch64-apple-darwin`
+- macOS x64: `x86_64-apple-darwin`
 - Linux x64: `x86_64-unknown-linux-gnu`
 - Linux x64: `x86_64-unknown-linux-gnu`
 - Linux arm64: `aarch64-unknown-linux-gnu`
 - Linux arm64: `aarch64-unknown-linux-gnu`
 - Windows x64: `x86_64-pc-windows-msvc`
 - Windows x64: `x86_64-pc-windows-msvc`
@@ -207,7 +209,7 @@ The first companion release is:
 The matching GitHub release tag is:
 The matching GitHub release tag is:
 
 
 ```text
 ```text
-companion-v0.1.2
+companion-v0.1.3
 ```
 ```
 
 
 The installer currently downloads from that tag.
 The installer currently downloads from that tag.
@@ -219,7 +221,7 @@ you are testing the release path:
 
 
 ```bash
 ```bash
 gh workflow run companion-release.yml \
 gh workflow run companion-release.yml \
-  -f version=0.1.2 \
+  -f version=0.1.3 \
   -f targets=macos-arm64
   -f targets=macos-arm64
 ```
 ```
 
 
@@ -227,14 +229,15 @@ Build multiple targets by passing a comma-separated list:
 
 
 ```bash
 ```bash
 gh workflow run companion-release.yml \
 gh workflow run companion-release.yml \
-  -f version=0.1.2 \
-  -f targets=macos-arm64,linux-x64,linux-arm64,windows-x64
+  -f version=0.1.3 \
+  -f targets=macos-arm64,macos-x64,linux-x64,linux-arm64,windows-x64
 ```
 ```
 
 
 Supported workflow target names:
 Supported workflow target names:
 
 
 ```text
 ```text
 macos-arm64
 macos-arm64
+macos-x64
 linux-x64
 linux-x64
 linux-arm64
 linux-arm64
 windows-x64
 windows-x64
@@ -248,7 +251,7 @@ the selected archives.
 After the workflow finishes:
 After the workflow finishes:
 
 
 ```bash
 ```bash
-gh release view companion-v0.1.2
+gh release view companion-v0.1.3
 ```
 ```
 
 
 Confirm the release contains the archive names expected by the installer for the
 Confirm the release contains the archive names expected by the installer for the
@@ -270,7 +273,7 @@ bunx oh-my-opencode-slim@beta install --companion=yes
 ```
 ```
 
 
 The installer detects the user's OS/architecture, downloads the matching archive
 The installer detects the user's OS/architecture, downloads the matching archive
-from `companion-v0.1.2`, installs it to the runtime binary path, and writes the
+from `companion-v0.1.3`, installs it to the runtime binary path, and writes the
 companion config block. If the companion install fails, the core plugin install
 companion config block. If the companion install fails, the core plugin install
 continues without enabling Companion.
 continues without enabling Companion.
 
 

+ 1 - 1
docs/configuration.md

@@ -150,7 +150,7 @@ Presets can also be switched at runtime without restarting using the `/preset` c
 | `companion.position` | string | `"bottom-right"` | The initial corner position of the companion window: `bottom-right`, `bottom-left`, `top-right`, or `top-left` |
 | `companion.position` | string | `"bottom-right"` | The initial corner position of the companion window: `bottom-right`, `bottom-left`, `top-right`, or `top-left` |
 | `companion.size` | string | `"medium"` | The default size preset of the companion window: `small` (80px), `medium` (120px), or `large` (160px) |
 | `companion.size` | string | `"medium"` | The default size preset of the companion window: `small` (80px), `medium` (120px), or `large` (160px) |
 
 
-> **niri note:** `companion-v0.1.2` is the fixed native companion release.
+> **niri note:** `companion-v0.1.3` includes the fixed native companion release.
 > To make it open as a bottom-right overlay, add a niri rule matching its stable
 > To make it open as a bottom-right overlay, add a niri rule matching its stable
 > `app-id`/title (`oh-my-opencode-slim-companion`), for example:
 > `app-id`/title (`oh-my-opencode-slim-companion`), for example:
 >
 >

+ 66 - 48
docs/release.md

@@ -38,11 +38,11 @@ Recommended release note sections:
 Pick versions independently:
 Pick versions independently:
 
 
 ```text
 ```text
-plugin: 2.0.2
-plugin tag: v2.0.2
+plugin: 2.0.3
+plugin tag: v2.0.3
 
 
-companion: 0.1.2
-companion tag: companion-v0.1.2
+companion: 0.1.3
+companion tag: companion-v0.1.3
 ```
 ```
 
 
 Use a plugin patch release for ordinary bug fixes and release-process fixes.
 Use a plugin patch release for ordinary bug fixes and release-process fixes.
@@ -51,19 +51,29 @@ new companion state protocol or asset set.
 
 
 ## 3. Update companion references
 ## 3. Update companion references
 
 
-When releasing a new companion binary, update the installer constants:
+When releasing a new companion binary, update the packaged companion manifest:
 
 
-```ts
-// src/cli/companion.ts
-const COMPANION_VERSION = '0.1.2';
-const COMPANION_TAG = 'companion-v0.1.2';
+```json
+// src/companion/companion-manifest.json
+{
+  "version": "0.1.3",
+  "tag": "companion-v0.1.3",
+  "repo": "alvinunreal/oh-my-opencode-slim",
+  "checksums": {
+    "oh-my-opencode-slim-companion-v0.1.3-aarch64-apple-darwin.tar.gz": "..."
+  }
+}
 ```
 ```
 
 
+The installer and updater read the packaged JSON manifest at runtime. Keep the
+matching fallback constant in `src/companion/updater.ts` synchronized with the
+JSON manifest; tests cover this sync.
+
 Also update the Rust crate version:
 Also update the Rust crate version:
 
 
 ```toml
 ```toml
 # companion/Cargo.toml
 # companion/Cargo.toml
-version = "0.1.2"
+version = "0.1.3"
 ```
 ```
 
 
 Regenerate or update `companion/Cargo.lock` so the package entry matches.
 Regenerate or update `companion/Cargo.lock` so the package entry matches.
@@ -77,18 +87,20 @@ Supported companion workflow target names:
 
 
 ```text
 ```text
 macos-arm64
 macos-arm64
+macos-x64
 linux-x64
 linux-x64
 linux-arm64
 linux-arm64
 windows-x64
 windows-x64
 ```
 ```
 
 
-Expected release asset names for companion `0.1.2`:
+Expected release asset names for companion `0.1.3`:
 
 
 ```text
 ```text
-oh-my-opencode-slim-companion-v0.1.2-aarch64-apple-darwin.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-x86_64-unknown-linux-gnu.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-aarch64-unknown-linux-gnu.tar.gz
-oh-my-opencode-slim-companion-v0.1.2-x86_64-pc-windows-msvc.zip
+oh-my-opencode-slim-companion-v0.1.3-aarch64-apple-darwin.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-apple-darwin.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-unknown-linux-gnu.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-aarch64-unknown-linux-gnu.tar.gz
+oh-my-opencode-slim-companion-v0.1.3-x86_64-pc-windows-msvc.zip
 ```
 ```
 
 
 ## 4. Build and publish companion assets
 ## 4. Build and publish companion assets
@@ -97,8 +109,8 @@ Trigger the manual workflow:
 
 
 ```bash
 ```bash
 gh workflow run companion-release.yml \
 gh workflow run companion-release.yml \
-  -f version=0.1.2 \
-  -f targets=macos-arm64,linux-x64,linux-arm64,windows-x64
+  -f version=0.1.3 \
+  -f targets=macos-arm64,macos-x64,linux-x64,linux-arm64,windows-x64
 ```
 ```
 
 
 Watch the run:
 Watch the run:
@@ -111,20 +123,25 @@ gh run watch <run-id>
 Verify the companion release:
 Verify the companion release:
 
 
 ```bash
 ```bash
-gh release view companion-v0.1.2
+gh release view companion-v0.1.3
 ```
 ```
 
 
 Download assets for a local sanity check:
 Download assets for a local sanity check:
 
 
 ```bash
 ```bash
-mkdir -p /tmp/companion-v0.1.2-assets
-gh release download companion-v0.1.2 \
-  --dir /tmp/companion-v0.1.2-assets
+mkdir -p /tmp/companion-v0.1.3-assets
+gh release download companion-v0.1.3 \
+  --dir /tmp/companion-v0.1.3-assets
 ```
 ```
 
 
 Confirm the asset list matches the installer targets before publishing the
 Confirm the asset list matches the installer targets before publishing the
 plugin package that points to this companion tag.
 plugin package that points to this companion tag.
 
 
+Copy each asset's SHA256 digest into `src/companion/companion-manifest.json`.
+GitHub release asset metadata reports these as `digest: sha256:<hash>`; store
+only the hash value in the manifest. Then mirror the same values in the fallback
+`COMPANION_MANIFEST` constant in `src/companion/updater.ts`.
+
 ### Manual companion upload fallback
 ### Manual companion upload fallback
 
 
 If the workflow builds artifacts successfully but the release upload step fails,
 If the workflow builds artifacts successfully but the release upload step fails,
@@ -132,26 +149,26 @@ download the workflow artifacts and upload them manually:
 
 
 ```bash
 ```bash
 gh run download <run-id> \
 gh run download <run-id> \
-  --dir /tmp/companion-v0.1.2-assets
+  --dir /tmp/companion-v0.1.3-assets
 
 
-gh release create companion-v0.1.2 \
-  --title "Companion v0.1.2" \
+gh release create companion-v0.1.3 \
+  --title "Companion v0.1.3" \
   --notes "Manual companion binary release for oh-my-opencode-slim." \
   --notes "Manual companion binary release for oh-my-opencode-slim." \
-  /tmp/companion-v0.1.2-assets/*
+  /tmp/companion-v0.1.3-assets/*
 ```
 ```
 
 
 If the release already exists, upload with clobber:
 If the release already exists, upload with clobber:
 
 
 ```bash
 ```bash
-gh release upload companion-v0.1.2 \
-  /tmp/companion-v0.1.2-assets/* \
+gh release upload companion-v0.1.3 \
+  /tmp/companion-v0.1.3-assets/* \
   --clobber
   --clobber
 ```
 ```
 
 
 Then verify:
 Then verify:
 
 
 ```bash
 ```bash
-gh release view companion-v0.1.2
+gh release view companion-v0.1.3
 ```
 ```
 
 
 ## 5. Bump the plugin package
 ## 5. Bump the plugin package
@@ -160,7 +177,7 @@ For a stable patch, update `package.json`:
 
 
 ```json
 ```json
 {
 {
-  "version": "2.0.2"
+  "version": "2.0.3"
 }
 }
 ```
 ```
 
 
@@ -205,14 +222,15 @@ companion/Cargo.lock
 docs/companion.md
 docs/companion.md
 docs/configuration.md
 docs/configuration.md
 package.json
 package.json
-src/cli/companion.ts
+src/companion/companion-manifest.json
+src/companion/updater.ts
 ```
 ```
 
 
 Commit and push:
 Commit and push:
 
 
 ```bash
 ```bash
 git add <intended-files>
 git add <intended-files>
-git commit -m "chore: prepare companion 0.1.2 release"
+git commit -m "chore: prepare companion 0.1.3 release"
 git push
 git push
 ```
 ```
 
 
@@ -227,14 +245,14 @@ git push --follow-tags
 If the package version was edited manually, create and push the tag yourself:
 If the package version was edited manually, create and push the tag yourself:
 
 
 ```bash
 ```bash
-git tag -a v2.0.2 -m "v2.0.2"
-git push origin v2.0.2
+git tag -a v2.0.3 -m "v2.0.3"
+git push origin v2.0.3
 ```
 ```
 
 
 Verify the tag exists remotely:
 Verify the tag exists remotely:
 
 
 ```bash
 ```bash
-git ls-remote --tags origin v2.0.2
+git ls-remote --tags origin v2.0.3
 ```
 ```
 
 
 ## 9. Create the GitHub plugin release
 ## 9. Create the GitHub plugin release
@@ -242,23 +260,23 @@ git ls-remote --tags origin v2.0.2
 Use release notes based on the actual git diff.
 Use release notes based on the actual git diff.
 
 
 ```bash
 ```bash
-gh release create v2.0.2 \
-  --title "v2.0.2" \
-  --notes-file /tmp/oh-my-opencode-slim-v2.0.2-notes.md
+gh release create v2.0.3 \
+  --title "v2.0.3" \
+  --notes-file /tmp/oh-my-opencode-slim-v2.0.3-notes.md
 ```
 ```
 
 
 If a release already exists, update it:
 If a release already exists, update it:
 
 
 ```bash
 ```bash
-gh release edit v2.0.2 \
-  --title "v2.0.2" \
-  --notes-file /tmp/oh-my-opencode-slim-v2.0.2-notes.md
+gh release edit v2.0.3 \
+  --title "v2.0.3" \
+  --notes-file /tmp/oh-my-opencode-slim-v2.0.3-notes.md
 ```
 ```
 
 
 Verify:
 Verify:
 
 
 ```bash
 ```bash
-gh release view v2.0.2
+gh release view v2.0.3
 ```
 ```
 
 
 ## 10. Publish npm
 ## 10. Publish npm
@@ -276,15 +294,15 @@ After publishing, verify the package version:
 npm view oh-my-opencode-slim version
 npm view oh-my-opencode-slim version
 ```
 ```
 
 
-## 11. Current v2.0.2 release checklist
+## 11. Current v2.0.3 release checklist
 
 
-For the `2.0.2` / `companion-v0.1.2` release, the completed state should be:
+For the `2.0.3` / `companion-v0.1.3` release, the completed state should be:
 
 
-- `package.json` version is `2.0.2`.
-- `src/cli/companion.ts` points to `companion-v0.1.2`.
-- Git tag `v2.0.2` exists on origin.
-- GitHub release `v2.0.2` exists.
-- GitHub release `companion-v0.1.2` exists with the expected assets.
+- `package.json` version is `2.0.3`.
+- `src/companion/companion-manifest.json` points to `companion-v0.1.3`.
+- Git tag `v2.0.3` exists on origin.
+- GitHub release `v2.0.3` exists.
+- GitHub release `companion-v0.1.3` exists with the expected assets.
 - Working tree is clean.
 - Working tree is clean.
 - `bun run check:ci`, `bun run typecheck`, `bun test`, and `bun run build` pass.
 - `bun run check:ci`, `bun run typecheck`, `bun test`, and `bun run build` pass.
 - npm publish is run only after the GitHub release and companion assets are ready.
 - npm publish is run only after the GitHub release and companion assets are ready.

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "oh-my-opencode-slim",
   "name": "oh-my-opencode-slim",
-  "version": "2.0.2",
+  "version": "2.0.3",
   "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
   "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
   "main": "dist/index.js",
   "main": "dist/index.js",
   "types": "dist/index.d.ts",
   "types": "dist/index.d.ts",

+ 20 - 0
src/companion/updater.test.ts

@@ -261,6 +261,26 @@ describe('companion updater', () => {
       COMPANION_MANIFEST,
       COMPANION_MANIFEST,
     );
     );
   });
   });
+
+  test('uses the macOS x64 release target on Intel Macs', () => {
+    const originalPlatform = Object.getOwnPropertyDescriptor(
+      process,
+      'platform',
+    );
+    const originalArch = Object.getOwnPropertyDescriptor(process, 'arch');
+    Object.defineProperty(process, 'platform', { value: 'darwin' });
+    Object.defineProperty(process, 'arch', { value: 'x64' });
+    try {
+      expect(getCompanionTarget()).toBe('x86_64-apple-darwin');
+    } finally {
+      if (originalPlatform) {
+        Object.defineProperty(process, 'platform', originalPlatform);
+      }
+      if (originalArch) {
+        Object.defineProperty(process, 'arch', originalArch);
+      }
+    }
+  });
 });
 });
 
 
 function archiveName(version: string, target: string): string {
 function archiveName(version: string, target: string): string {

+ 1 - 0
src/companion/updater.ts

@@ -66,6 +66,7 @@ export function getCompanionTarget(): string | null {
   const a = process.arch;
   const a = process.arch;
   if (p === 'darwin') {
   if (p === 'darwin') {
     if (a === 'arm64') return 'aarch64-apple-darwin';
     if (a === 'arm64') return 'aarch64-apple-darwin';
+    if (a === 'x64') return 'x86_64-apple-darwin';
   } else if (p === 'linux') {
   } else if (p === 'linux') {
     if (a === 'x64') return 'x86_64-unknown-linux-gnu';
     if (a === 'x64') return 'x86_64-unknown-linux-gnu';
     if (a === 'arm64') return 'aarch64-unknown-linux-gnu';
     if (a === 'arm64') return 'aarch64-unknown-linux-gnu';

+ 9 - 12
src/tools/smartfetch/secondary-model.test.ts

@@ -1,5 +1,5 @@
 import { afterEach, describe, expect, mock, test } from 'bun:test';
 import { afterEach, describe, expect, mock, test } from 'bun:test';
-import { runSecondaryModelWithFallback, _testConfig } from './secondary-model';
+import { _testConfig, runSecondaryModelWithFallback } from './secondary-model';
 import type { SecondaryModel } from './types';
 import type { SecondaryModel } from './types';
 
 
 type PromptStep = {
 type PromptStep = {
@@ -7,9 +7,12 @@ type PromptStep = {
   error?: Error;
   error?: Error;
 };
 };
 
 
-function createMockClient(steps: PromptStep[], deleteBehavior?: {
-  failTimes?: number;
-}) {
+function createMockClient(
+  steps: PromptStep[],
+  deleteBehavior?: {
+    failTimes?: number;
+  },
+) {
   let createCount = 0;
   let createCount = 0;
   let promptCount = 0;
   let promptCount = 0;
   let deleteCallCount = 0;
   let deleteCallCount = 0;
@@ -100,10 +103,7 @@ describe('smartfetch/secondary-model', () => {
     const originalDelay = _testConfig.deleteRetryDelayMs;
     const originalDelay = _testConfig.deleteRetryDelayMs;
     _testConfig.deleteRetryDelayMs = 0;
     _testConfig.deleteRetryDelayMs = 0;
     try {
     try {
-      const client = createMockClient(
-        [{ text: 'Answer' }],
-        { failTimes: 1 },
-      );
+      const client = createMockClient([{ text: 'Answer' }], { failTimes: 1 });
 
 
       const result = await runSecondaryModelWithFallback(
       const result = await runSecondaryModelWithFallback(
         client,
         client,
@@ -130,10 +130,7 @@ describe('smartfetch/secondary-model', () => {
     const originalDelay = _testConfig.deleteRetryDelayMs;
     const originalDelay = _testConfig.deleteRetryDelayMs;
     _testConfig.deleteRetryDelayMs = 0;
     _testConfig.deleteRetryDelayMs = 0;
     try {
     try {
-      const client = createMockClient(
-        [{ text: 'Answer' }],
-        { failTimes: 99 },
-      );
+      const client = createMockClient([{ text: 'Answer' }], { failTimes: 99 });
 
 
       const result = await runSecondaryModelWithFallback(
       const result = await runSecondaryModelWithFallback(
         client,
         client,