Skip to content

Commit c2f2116

Browse files
committed
feat: create opencode-workaholic plugin
0 parents  commit c2f2116

36 files changed

+1814
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/pr-title.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'LintPrTitle'
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
ValidatePrTitle:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: amannn/action-semantic-pull-request@v5
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Pr
2+
3+
on:
4+
pull_request:
5+
pull_request_target:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
actions: read
14+
contents: read
15+
16+
jobs:
17+
Check:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
24+
25+
- name: Setup Tooling
26+
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
27+
with:
28+
install: true
29+
cache: true
30+
experimental: true
31+
32+
- name: Run Checks
33+
run: |
34+
mise run setup
35+
mise run lint
36+
mise run test
37+
mise run build

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish Package
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'npm tag (latest or next)'
8+
required: true
9+
type: choice
10+
options:
11+
- latest
12+
- next
13+
repository_dispatch:
14+
types: [publish-package]
15+
16+
permissions:
17+
id-token: write
18+
contents: read
19+
20+
jobs:
21+
publish:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
fetch-tags: true
28+
29+
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
30+
with:
31+
install: true
32+
cache: true
33+
experimental: true
34+
35+
- name: Install dependencies
36+
run: bun install
37+
38+
- name: Build
39+
run: mise run build
40+
41+
- id: inputs
42+
uses: simenandre/setup-inputs@v1
43+
44+
- name: Publish to npm with OIDC
45+
run: |
46+
TAG="${{ steps.inputs.outputs.tag }}"
47+
if [ -z "$TAG" ]; then
48+
TAG="latest"
49+
fi
50+
51+
echo "Publishing with tag: $TAG"
52+
mise run publish --tag "$TAG"

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
process:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
releases_created: ${{ steps.release-please.outputs.releases_created }}
20+
prs_created: ${{ steps.release-please.outputs.prs_created }}
21+
steps:
22+
- uses: google-github-actions/release-please-action@v4
23+
id: release-please
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
release-type: node
27+
skip-github-pull-request: false
28+
29+
dispatch-publish:
30+
needs: process
31+
runs-on: ubuntu-latest
32+
if: needs.process.outputs.releases_created == 'true' || needs.process.outputs.prs_created == 'true'
33+
steps:
34+
- name: Dispatch publish for releases
35+
if: needs.process.outputs.releases_created == 'true'
36+
uses: peter-evans/repository-dispatch@v2
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
event-type: publish-package
40+
client-payload: '{"tag": "latest"}'
41+
42+
- name: Dispatch publish for prerelease
43+
if: needs.process.outputs.prs_created == 'true'
44+
uses: peter-evans/repository-dispatch@v2
45+
with:
46+
token: ${{ secrets.GITHUB_TOKEN }}
47+
event-type: publish-package
48+
client-payload: '{"tag": "next"}'

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules/
2+
dist/
3+
*.log
4+
.DS_Store
5+
.env
6+
.env.local
7+
coverage/
8+
.nyc_output/
9+
.eslintcache
10+
.bun/
11+
.bun.lockb
12+
.memory/

.mise/tasks/build

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Build the project"
3+
#MISE sources=["src/**/*"]
4+
#MISE outputs=["dist/index.js"]
5+
6+
bun build ./src/index.ts --outdir dist --target bun

.mise/tasks/dev

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Build plugin for development with sourcemaps and vendor splitting"
3+
#MISE sources=["src/**/*"]
4+
#MISE outputs=["dist/index.js", "dist/index.js.map", "dist/vendor.js"]
5+
6+
bun build ./src/index.ts \
7+
--outdir dist \
8+
--target bun \
9+
--sourcemap=inline \
10+
--splitting \
11+
--entry-naming='[dir]/[name].js' \
12+
--chunk-naming='[name].js'

.mise/tasks/format

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
#MISE description="Format code with Prettier"
3+
prettier --write "src/**/*.ts"

.mise/tasks/link

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
mkdir -p ~/.config/opencode/plugin
4+
ln -sf "$PWD/dist/index.js" ~/.config/opencode/plugin/opencode-workaholic.js
5+
6+
ls -al ~/.config/opencode/plugin/

0 commit comments

Comments
 (0)