diff --git a/.github/workflows/doc-sync.yml b/.github/workflows/doc-sync.yml index c2cd497..c7706c8 100644 --- a/.github/workflows/doc-sync.yml +++ b/.github/workflows/doc-sync.yml @@ -17,6 +17,8 @@ jobs: fetch-depth: 0 - uses: activadee/open-workflows/actions/doc-sync@main + with: + model: 'opencode/big-pickle' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENCODE_AUTH: ${{ secrets.OPENCODE_AUTH }} diff --git a/.github/workflows/issue-label.yml b/.github/workflows/issue-label.yml index ad621a3..7b6b1d4 100644 --- a/.github/workflows/issue-label.yml +++ b/.github/workflows/issue-label.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v4 - uses: activadee/open-workflows/actions/issue-label@main + with: + model: 'opencode/big-pickle' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENCODE_AUTH: ${{ secrets.OPENCODE_AUTH }} diff --git a/AGENTS.md b/AGENTS.md index 425d6ec..64e305c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -103,6 +103,8 @@ bun run test # Run tests **AI-powered actions:** ```yaml - uses: activadee/open-workflows/actions/pr-review@main + with: + variants: UNDEFINED # Optional OpenCode variants setting env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENCODE_AUTH: ${{ secrets.OPENCODE_AUTH }} # or ANTHROPIC_API_KEY diff --git a/README.md b/README.md index 0175836..7eb3a91 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: activadee/open-workflows/actions/pr-review@main + with: + variants: UNDEFINED env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} @@ -95,6 +97,7 @@ jobs: - uses: activadee/open-workflows/actions/changeset@main with: mode: commit # or 'comment' to suggest via PR comment + variants: UNDEFINED env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} @@ -127,6 +130,10 @@ Or manually set the secret: gh secret set OPENCODE_AUTH < ~/.local/share/opencode/auth.json ``` +## Variants + +AI actions accept an optional `variants` input to control OpenCode reasoning effort. Use `UNDEFINED` to omit the setting entirely. + ## CLI Options ```bash diff --git a/actions/changeset/action.yml b/actions/changeset/action.yml index 4b003f5..2fd4a91 100644 --- a/actions/changeset/action.yml +++ b/actions/changeset/action.yml @@ -11,6 +11,10 @@ inputs: description: 'Operation mode: commit (auto-commit changeset) or comment (suggest via PR comment)' required: false default: 'commit' + variants: + description: 'Optional OpenCode variants setting (e.g., reasoning effort). Set to UNDEFINED to omit.' + required: false + default: 'UNDEFINED' runs: using: 'composite' @@ -40,7 +44,11 @@ runs: - name: Generate Changeset shell: bash run: | - opencode run --model "${{ inputs.model }}" \ + VARIANTS_ARG=() + if [ "${{ inputs.variants }}" != "UNDEFINED" ]; then + VARIANTS_ARG=(--variants "${{ inputs.variants }}") + fi + opencode run "${VARIANTS_ARG[@]}" --model "${{ inputs.model }}" \ "Load the changeset skill. Generate changeset for PR ${{ github.event.pull_request.number }} in mode: ${{ inputs.mode }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/actions/changeset/skill.md b/actions/changeset/skill.md index 9258bb4..1190f84 100644 --- a/actions/changeset/skill.md +++ b/actions/changeset/skill.md @@ -4,6 +4,10 @@ description: AI-powered changeset generation for monorepo releases. Analyzes PR license: MIT --- +## Action Inputs + +- `variants` (optional): OpenCode variants setting for reasoning effort. Use `UNDEFINED` to omit. + ## What I Do Analyze pull request changes and generate [Changesets](https://github.com/changesets/changesets) files that capture: diff --git a/actions/doc-sync/action.yml b/actions/doc-sync/action.yml index 2a869e6..d8f396b 100644 --- a/actions/doc-sync/action.yml +++ b/actions/doc-sync/action.yml @@ -7,6 +7,10 @@ inputs: description: 'Model to use for doc analysis' required: false default: 'anthropic/claude-sonnet-4-5' + variants: + description: 'Optional OpenCode variants setting (e.g., reasoning effort). Set to UNDEFINED to omit.' + required: false + default: 'UNDEFINED' runs: using: 'composite' @@ -41,7 +45,11 @@ runs: - name: Sync Documentation shell: bash run: | - opencode run --model "${{ inputs.model }}" \ + VARIANTS_ARG=() + if [ "${{ inputs.variants }}" != "UNDEFINED" ]; then + VARIANTS_ARG=(--variants "${{ inputs.variants }}") + fi + opencode run "${VARIANTS_ARG[@]}" --model "${{ inputs.model }}" \ "Load the doc-sync skill and sync documentation for PR ${{ github.event.pull_request.number }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/actions/doc-sync/skill.md b/actions/doc-sync/skill.md index 38f768f..4e1283c 100644 --- a/actions/doc-sync/skill.md +++ b/actions/doc-sync/skill.md @@ -4,6 +4,10 @@ description: Keep documentation in sync with code changes. Analyzes PR diffs and license: MIT --- +## Action Inputs + +- `variants` (optional): OpenCode variants setting for reasoning effort. Use `UNDEFINED` to omit. + ## What I Do Analyze pull request changes and update documentation to reflect code changes. Uses native OpenCode tools (`write`, `bash`) for file operations and git commits. diff --git a/actions/issue-label/action.yml b/actions/issue-label/action.yml index 67e6ab5..4d9b6ea 100644 --- a/actions/issue-label/action.yml +++ b/actions/issue-label/action.yml @@ -7,6 +7,10 @@ inputs: description: 'Model to use for labeling' required: false default: 'anthropic/claude-haiku-4-5' + variants: + description: 'Optional OpenCode variants setting (e.g., reasoning effort). Set to UNDEFINED to omit.' + required: false + default: 'UNDEFINED' runs: using: 'composite' @@ -36,7 +40,11 @@ runs: - name: Label Issue shell: bash run: | - opencode run --model "${{ inputs.model }}" \ + VARIANTS_ARG=() + if [ "${{ inputs.variants }}" != "UNDEFINED" ]; then + VARIANTS_ARG=(--variants "${{ inputs.variants }}") + fi + opencode run "${VARIANTS_ARG[@]}" --model "${{ inputs.model }}" \ "Load the issue-label skill. Label issue ${{ github.event.issue.number }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/actions/issue-label/skill.md b/actions/issue-label/skill.md index 7347c1f..959f11a 100644 --- a/actions/issue-label/skill.md +++ b/actions/issue-label/skill.md @@ -4,6 +4,10 @@ description: Automatically apply appropriate labels to GitHub issues based on co license: MIT --- +## Action Inputs + +- `variants` (optional): OpenCode variants setting for reasoning effort. Use `UNDEFINED` to omit. + ## What I Do Analyze GitHub issue content and apply up to 3 appropriate labels to help maintainers triage and search issues effectively. diff --git a/actions/pr-review/action.yml b/actions/pr-review/action.yml index 159392b..d164d21 100644 --- a/actions/pr-review/action.yml +++ b/actions/pr-review/action.yml @@ -7,6 +7,10 @@ inputs: description: 'Model to use for review' required: false default: 'anthropic/claude-sonnet-4-5' + variants: + description: 'Optional OpenCode variants setting (e.g., reasoning effort). Set to UNDEFINED to omit.' + required: false + default: 'UNDEFINED' runs: using: 'composite' @@ -36,7 +40,11 @@ runs: - name: Review PR shell: bash run: | - opencode run --model "${{ inputs.model }}" \ + VARIANTS_ARG=() + if [ "${{ inputs.variants }}" != "UNDEFINED" ]; then + VARIANTS_ARG=(--variants "${{ inputs.variants }}") + fi + opencode run "${VARIANTS_ARG[@]}" --model "${{ inputs.model }}" \ "Load the pr-review skill. Review PR ${{ github.event.pull_request.number }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/actions/pr-review/skill.md b/actions/pr-review/skill.md index a3cc33f..8b1041b 100644 --- a/actions/pr-review/skill.md +++ b/actions/pr-review/skill.md @@ -4,6 +4,10 @@ description: AI-powered pull request code review focusing on correctness, securi license: MIT --- +## Action Inputs + +- `variants` (optional): OpenCode variants setting for reasoning effort. Use `UNDEFINED` to omit. + ## What I Do Review pull request changes systematically and post findings as a sticky PR comment. Focus on **real issues that matter** - bugs, security risks, and stability problems that would block a merge in a typical code review. diff --git a/scripts/apply-labels.ts b/scripts/apply-labels.ts index b7e8f1a..fa9957e 100644 --- a/scripts/apply-labels.ts +++ b/scripts/apply-labels.ts @@ -14,6 +14,7 @@ const ArgsSchema = z.object({ }) ).optional().describe('New labels to create before applying'), explanation: z.string().describe('Brief explanation of label choices'), + variants: z.string().optional().describe('Optional OpenCode variants setting (e.g., reasoning effort)'), }).superRefine((value, ctx) => { const labelCount = value.labels.length + (value.newLabels?.length ?? 0); diff --git a/scripts/write-changeset.ts b/scripts/write-changeset.ts index 98202b7..d1aa630 100644 --- a/scripts/write-changeset.ts +++ b/scripts/write-changeset.ts @@ -1,7 +1,7 @@ import { tool } from "@opencode-ai/plugin" -import * as fs from 'fs'; -import * as path from 'path'; -import * as crypto from 'crypto'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import * as crypto from 'node:crypto'; const z = tool.schema; @@ -13,6 +13,7 @@ const ArgsSchema = z.object({ packages: z.object({}).catchall(BumpSchema).describe('Object mapping package names to bump types (major, minor, patch)'), summary: z.string().min(10).max(200).describe('Short summary in imperative mood (e.g., "Add retry logic")'), body: z.string().optional().describe('Optional additional details or migration notes'), + variants: z.string().optional().describe('Optional OpenCode variants setting (e.g., reasoning effort)'), }).superRefine((value, ctx) => { const packageCount = Object.keys(value.packages).length; diff --git a/src/cli/templates/changeset.ts b/src/cli/templates/changeset.ts index 4fa78ee..7c27c6b 100644 --- a/src/cli/templates/changeset.ts +++ b/src/cli/templates/changeset.ts @@ -22,6 +22,7 @@ jobs: - uses: activadee/open-workflows/actions/changeset@main with: mode: commit + variants: "UNDEFINED" env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}${useOAuth ? ENV_OPENCODE_AUTH : ENV_API_KEY} `; diff --git a/src/cli/templates/doc-sync.ts b/src/cli/templates/doc-sync.ts index 8cfe6c4..6463a06 100644 --- a/src/cli/templates/doc-sync.ts +++ b/src/cli/templates/doc-sync.ts @@ -19,6 +19,8 @@ jobs: fetch-depth: 0 - uses: activadee/open-workflows/actions/doc-sync@main + with: + variants: "UNDEFINED" env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}${useOAuth ? ENV_OPENCODE_AUTH : ENV_API_KEY} `; diff --git a/src/cli/templates/issue-label.ts b/src/cli/templates/issue-label.ts index 914006f..9b5c2e8 100644 --- a/src/cli/templates/issue-label.ts +++ b/src/cli/templates/issue-label.ts @@ -15,6 +15,8 @@ jobs: - uses: actions/checkout@v4 - uses: activadee/open-workflows/actions/issue-label@main + with: + variants: "UNDEFINED" env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}${useOAuth ? ENV_OPENCODE_AUTH : ENV_API_KEY} `; diff --git a/src/cli/templates/pr-review.ts b/src/cli/templates/pr-review.ts index ecb191f..54ce283 100644 --- a/src/cli/templates/pr-review.ts +++ b/src/cli/templates/pr-review.ts @@ -16,6 +16,8 @@ jobs: - uses: actions/checkout@v4 - uses: activadee/open-workflows/actions/pr-review@main + with: + variants: "UNDEFINED" env: GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}${useOAuth ? ENV_OPENCODE_AUTH : ENV_API_KEY} `; diff --git a/test/installer.test.js b/test/installer.test.js index 8d788c4..132a905 100644 --- a/test/installer.test.js +++ b/test/installer.test.js @@ -1,7 +1,7 @@ import { describe, expect, it, beforeEach, afterEach } from 'bun:test'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as os from 'os'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; +import * as os from 'node:os'; import { installWorkflows, checkExistingWorkflows, @@ -44,6 +44,7 @@ describe('installer workflow functionality', () => { 'utf-8' ); expect(content).toContain('activadee/open-workflows/actions/pr-review@main'); + expect(content).toContain('variants: "UNDEFINED"'); }); it('includes ANTHROPIC_API_KEY for non-OAuth', () => { @@ -205,6 +206,7 @@ describe('installer workflow functionality', () => { 'utf-8' ); expect(content).toContain('activadee/open-workflows/actions/changeset@main'); + expect(content).toContain('variants: "UNDEFINED"'); }); it('includes ANTHROPIC_API_KEY for changeset non-OAuth', () => { diff --git a/test/scripts-variants.test.js b/test/scripts-variants.test.js new file mode 100644 index 0000000..b55aca6 --- /dev/null +++ b/test/scripts-variants.test.js @@ -0,0 +1,20 @@ +import { describe, expect, it } from 'bun:test'; +import * as fs from 'node:fs'; +import * as path from 'node:path'; + +describe('tool variants arguments', () => { + it('does not include variants in submit-review args schema', () => { + const content = fs.readFileSync(path.join(import.meta.dir, '../scripts/submit-review.ts'), 'utf-8'); + expect(content).not.toContain("variants: z.string().optional()"); + }); + + it('adds variants to apply-labels args schema', () => { + const content = fs.readFileSync(path.join(import.meta.dir, '../scripts/apply-labels.ts'), 'utf-8'); + expect(content).toContain("variants: z.string().optional()"); + }); + + it('adds variants to write-changeset args schema', () => { + const content = fs.readFileSync(path.join(import.meta.dir, '../scripts/write-changeset.ts'), 'utf-8'); + expect(content).toContain("variants: z.string().optional()"); + }); +});