diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0e1c60b..91addea 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,4 +31,4 @@ jobs: gh release create "$tag" \ --title="$tag" \ --draft \ - main.js manifest.json styles.css \ No newline at end of file + dist/main.js dist/manifest.json dist/styles.css dist/obsidian-github-copilot.zip \ No newline at end of file diff --git a/.gitignore b/.gitignore index ff7f6af..123c7cf 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,9 @@ node_modules # They should be uploaded to GitHub releases instead. main.js +# Build output +dist/ + # Exclude sourcemaps *.map diff --git a/README.md b/README.md index 7a53299..36c53d5 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,20 @@ Use **GitHub Copilot** in the Obsidian editor. This plugin is a bridge between t - A GitHub Copilot subscription (https://copilot.github.com/) - Network connection to send and receive data from the GitHub Copilot service +## 📦 Download + +You can download the latest release as a single zip file containing all plugin files (`main.js`, `manifest.json`, `styles.css`): + +[![Download Latest Release](https://img.shields.io/github/v/release/TaiLaiCai/obsidian-github-copilot?label=Download%20Latest%20Release&style=for-the-badge)](https://github.com/TaiLaiCai/obsidian-github-copilot/releases/latest/download/obsidian-github-copilot.zip) + +Or download individual files from the [latest release page](https://github.com/TaiLaiCai/obsidian-github-copilot/releases/latest): + +| File | Download Link | +|------|---------------| +| `main.js` | [Download](https://github.com/TaiLaiCai/obsidian-github-copilot/releases/latest/download/main.js) | +| `manifest.json` | [Download](https://github.com/TaiLaiCai/obsidian-github-copilot/releases/latest/download/manifest.json) | +| `styles.css` | [Download](https://github.com/TaiLaiCai/obsidian-github-copilot/releases/latest/download/styles.css) | + ## ⚙️ Installation 1. Install the plugin via the Obsidian community plugins browser. diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 107ee47..19f1c18 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,6 +1,12 @@ import esbuild from "esbuild"; import process from "process"; import builtins from "builtin-modules"; +import { copyFileSync, mkdirSync } from "fs"; +import { resolve, dirname } from "path"; +import { fileURLToPath } from "url"; +import AdmZip from "adm-zip"; + +const __dirname = dirname(fileURLToPath(import.meta.url)); const banner = `/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD @@ -9,6 +15,7 @@ if you want to view the source, please visit the github repository of this plugi `; const prod = process.argv[2] === "production"; +const outdir = prod ? "dist" : "."; const context = await esbuild.context({ banner: { @@ -37,7 +44,7 @@ const context = await esbuild.context({ logLevel: "info", sourcemap: prod ? false : "inline", treeShaking: true, - outfile: "main.js", + outfile: `${outdir}/main.js`, loader: { ".tiktoken": "text", ".noindex": "text", @@ -47,7 +54,24 @@ const context = await esbuild.context({ }); if (prod) { + mkdirSync(resolve(__dirname, "dist"), { recursive: true }); await context.rebuild(); + copyFileSync( + resolve(__dirname, "manifest.json"), + resolve(__dirname, "dist/manifest.json"), + ); + copyFileSync( + resolve(__dirname, "styles.css"), + resolve(__dirname, "dist/styles.css"), + ); + const zip = new AdmZip(); + zip.addLocalFile(resolve(__dirname, "dist/main.js")); + zip.addLocalFile(resolve(__dirname, "dist/manifest.json")); + zip.addLocalFile(resolve(__dirname, "dist/styles.css")); + zip.writeZip(resolve(__dirname, "dist/obsidian-github-copilot.zip")); + console.log( + "Packaged: dist/main.js, dist/manifest.json, dist/styles.css, dist/obsidian-github-copilot.zip", + ); process.exit(0); } else { await context.watch(); diff --git a/src/copilot-chat/store/slices/message.tsx b/src/copilot-chat/store/slices/message.tsx index d1c81fc..164ce7f 100644 --- a/src/copilot-chat/store/slices/message.tsx +++ b/src/copilot-chat/store/slices/message.tsx @@ -50,6 +50,8 @@ export const defaultModels: ModelOption[] = [ { label: "Claude Haiku 4.5", value: "claude-haiku-4.5" }, { label: "Claude Sonnet 4", value: "claude-sonnet-4" }, { label: "Claude Sonnet 4.5", value: "claude-sonnet-4.5" }, + { label: "Claude Opus 4.6", value: "claude-opus-4.6" }, + { label: "Claude Sonnet 4.6", value: "claude-sonnet-4.6" }, { label: "Gemini 2.5 Pro", value: "gemini-2.5-pro" }, { label: "Gemini 3 Pro", value: "gemini-3-pro-preview" }, { label: "Gemini 3 Flash", value: "gemini-3-flash-preview" },