Skip to content

Commit dba4201

Browse files
authored
refactor: remove unused code and improve maintainability (#9)
* refactor: remove unused code and improve maintainability - Remove unused _compact parameter from getBootstrapContent function - Move os.homedir() calls inline to functions for better scoping - Remove tests for non-existent resolveSkillPath function - Add semantic-release tooling for automated releases - Add publishConfig for public npm package publishing - Fix biome.json formatting to match linter expectations All tests pass (38/38) and code follows project style guidelines. * ci: fix action references * ci: improve GitHub App integration and test workflow - Add dynamic GitHub App user setup step to get app ID and email - Replace hardcoded bot credentials with dynamic values from app token - Update tests to run against source files instead of compiled dist - Test Bun runtime directly instead of Node.js validation This improves the CI workflow by making it work with any GitHub App instead of being hardcoded to a specific bot, and improves test reliability by testing source files directly with Bun.
1 parent c078aa2 commit dba4201

15 files changed

Lines changed: 1366 additions & 52 deletions

.github/codeql/codeql-config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: queries
3+
4+
queries:
5+
- uses: security-extended
6+
- uses: security-and-quality

.github/renovate.json5

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
3+
description: ['Use the config preset for the @fro.bot/systematic repository'],
4+
extends: ['local>marcusrbrown/renovate-config', 'github>sanity-io/renovate-config:semantic-commit-type'],
5+
packageRules: [
6+
{
7+
matchPackageNames: [
8+
'@semantic-release/{/,}**',
9+
'conventional-changelog-conventionalcommits',
10+
'semantic-release',
11+
'semantic-release-export-data',
12+
],
13+
semanticCommitType: 'build',
14+
},
15+
{
16+
matchPackageNames: ['@opencode-ai/{/,}**'],
17+
semanticCommitType: 'build',
18+
},
19+
],
20+
postUpgradeTasks: {
21+
commands: ['bun install', 'bun run lint -- --fix || true'],
22+
executionMode: 'branch',
23+
},
24+
}

.github/settings.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
_extends: .github:common-settings.yaml
3+
4+
repository:
5+
name: systematic
6+
description: Structured engineering workflows for OpenCode
7+
topics: opencode, plugin, ai, workflow, systematic, semantic-release, bun
8+
9+
branches:
10+
- name: main
11+
protection:
12+
required_status_checks:
13+
strict: true
14+
contexts: [Build, Typecheck, Lint, Test, Release, Analyze, Renovate / Renovate]
15+
enforce_admins: true
16+
required_pull_request_reviews: null
17+
restrictions: null
18+
required_linear_history: true
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
name: CodeQL
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
schedule:
10+
- cron: '30 5 * * 1'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-latest
20+
permissions:
21+
security-events: write
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
language: [typescript]
26+
steps:
27+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
31+
with:
32+
config-file: ./.github/codeql/codeql-config.yml
33+
languages: ${{ matrix.language }}
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
40+
with:
41+
category: '/language:${{ matrix.language }}'

.github/workflows/main.yaml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
name: main
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
workflow_dispatch:
11+
inputs:
12+
dry-run:
13+
description: Dry run
14+
default: true
15+
required: false
16+
type: boolean
17+
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
20+
cancel-in-progress: true
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
build:
27+
name: Build
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
32+
- name: Setup Bun
33+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
34+
35+
- name: Install dependencies
36+
run: bun install --frozen-lockfile
37+
38+
- name: Build
39+
run: bun run build
40+
41+
typecheck:
42+
name: Typecheck
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
47+
- name: Setup Bun
48+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
49+
50+
- name: Install dependencies
51+
run: bun install --frozen-lockfile
52+
53+
- name: Typecheck
54+
run: bun run typecheck
55+
56+
lint:
57+
name: Lint
58+
runs-on: ubuntu-latest
59+
steps:
60+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61+
62+
- name: Setup Bun
63+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
64+
65+
- name: Install dependencies
66+
run: bun install --frozen-lockfile
67+
68+
- name: Lint codebase
69+
run: bun run lint
70+
71+
test:
72+
name: Test
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
76+
77+
- name: Setup Bun
78+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
79+
80+
- name: Install dependencies
81+
run: bun install --frozen-lockfile
82+
83+
- name: Run tests
84+
run: bun test tests/unit
85+
86+
release:
87+
env:
88+
DRY_RUN: ${{ github.event_name == 'pull_request' || github.event.inputs.dry-run && 'true' || 'false' }}
89+
name: Release
90+
needs: [build, typecheck, lint, test]
91+
runs-on: ubuntu-latest
92+
permissions:
93+
contents: write
94+
id-token: write
95+
issues: write
96+
pull-requests: write
97+
steps:
98+
- id: get-workflow-app-token
99+
name: Get Workflow Application Token
100+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
101+
with:
102+
app-id: ${{ secrets.APPLICATION_ID }}
103+
private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
104+
105+
- id: setup-git-user
106+
name: Get GitHub App User ID and Setup Git user
107+
env:
108+
GH_TOKEN: ${{ steps.get-workflow-app-token.outputs.token }}
109+
run: |
110+
name="${{ steps.get-workflow-app-token.outputs.app-slug }}[bot]"
111+
user_id=$(gh api "/users/${name}" --jq .id)
112+
email="${user_id}+${name}@users.noreply.github.com"
113+
echo "user-email=${email}" >> "$GITHUB_OUTPUT"
114+
echo "user-name=${name}" >> "$GITHUB_OUTPUT"
115+
git config --global user.email "${email}"
116+
git config --global user.name "${name}"
117+
118+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
119+
with:
120+
fetch-depth: 0
121+
persist-credentials: false
122+
token: ${{ steps.get-workflow-app-token.outputs.token }}
123+
124+
- name: Setup Bun
125+
uses: oven-sh/setup-bun@3d267786b128fe76c2f16a390aa2448b815359f3 # v2.1.2
126+
127+
- name: Setup Node.js for NPM publishing
128+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
129+
with:
130+
node-version: 22
131+
registry-url: 'https://registry.npmjs.org'
132+
133+
- name: Install dependencies
134+
run: bun install --frozen-lockfile
135+
136+
- name: Build
137+
run: bun run build
138+
139+
- name: Get Release Options
140+
env:
141+
INPUT_DRY_RUN: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.dry-run && 'true' || 'false' }}
142+
IS_DEFAULT_BRANCH: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
143+
run: |
144+
if [[ $DRY_RUN != 'true' || $IS_DEFAULT_BRANCH == 'true' ]]; then
145+
echo "DRY_RUN=false" >> $GITHUB_ENV
146+
fi
147+
148+
- name: Semantic Release
149+
id: semantic-release
150+
env:
151+
CI_FLAG: ${{ env.DRY_RUN == 'true' && 'false' || 'true' }}
152+
GIT_AUTHOR_EMAIL: ${{ steps.setup-git-user.outputs.user-email }}
153+
GIT_AUTHOR_NAME: ${{ steps.setup-git-user.outputs.user-name }}
154+
GIT_COMMITTER_EMAIL: ${{ steps.setup-git-user.outputs.user-email }}
155+
GIT_COMMITTER_NAME: ${{ steps.setup-git-user.outputs.user-name }}
156+
GITHUB_TOKEN: ${{ steps.get-workflow-app-token.outputs.token }}
157+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
158+
NPM_CONFIG_PROVENANCE: true
159+
run: |
160+
npx semantic-release --dry-run ${{ env.DRY_RUN }} --ci ${{ env.CI_FLAG }}
161+
shell: 'bash -Eeuxo pipefail {0}'

.github/workflows/renovate.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# Renovate this repository if Renovate-specific tasks are checked, if this workflow file or the Renovate configuration file is changed, or if dispatched.
3+
name: Renovate
4+
5+
on:
6+
issues:
7+
types: [edited]
8+
pull_request:
9+
types: [edited]
10+
push:
11+
branches-ignore: [main]
12+
workflow_dispatch:
13+
inputs:
14+
log-level:
15+
description: Log level for Renovate
16+
required: false
17+
type: string
18+
default: debug
19+
print-config:
20+
description: Log the fully-resolved Renovate config for each repository, plus fully-resolved presets.
21+
required: false
22+
type: boolean
23+
default: false
24+
workflow_run:
25+
branches: [main]
26+
types: [completed]
27+
workflows: [main]
28+
29+
permissions:
30+
contents: read
31+
32+
jobs:
33+
renovate:
34+
# Only run Renovate if this isn't a bot edit (issue or pull request) or if the workflow run is successful
35+
if: >
36+
(github.event.action == 'edited' && !contains(github.actor, '[bot]')) ||
37+
(github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')
38+
name: Renovate
39+
secrets:
40+
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
41+
APPLICATION_PRIVATE_KEY: ${{ secrets.APPLICATION_PRIVATE_KEY }}
42+
uses: bfra-me/.github/.github/workflows/renovate.yaml@084299cf8d89425e3c5947c39772258c61f1dbc7 # v4.3.18
43+
with:
44+
log-level: ${{ inputs.log-level || (github.event_name == 'pull_request' || github.ref_name != github.event.repository.default_branch) && 'debug' || 'info' }}
45+
print-config: ${{ inputs.print-config || false }}

.github/workflows/scorecard.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Scorecard
3+
4+
on:
5+
branch_protection_rule:
6+
push:
7+
branches: [main]
8+
schedule:
9+
- cron: '30 5 * * 1'
10+
workflow_dispatch:
11+
12+
permissions: read-all
13+
14+
jobs:
15+
analysis:
16+
name: Scorecard analysis
17+
runs-on: ubuntu-latest
18+
permissions:
19+
security-events: write
20+
id-token: write
21+
steps:
22+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23+
with:
24+
persist-credentials: false
25+
26+
- name: Run analysis
27+
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
28+
with:
29+
results_file: results.sarif
30+
results_format: sarif
31+
publish_results: true
32+
33+
- name: Upload artifact
34+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
35+
with:
36+
name: SARIF file
37+
path: results.sarif
38+
retention-days: 5
39+
40+
- name: Upload to code-scanning
41+
uses: github/codeql-action/upload-sarif@fca7ace96b7d713c7035871441bd52efbe39e27e # v3.28.19
42+
with:
43+
sarif_file: results.sarif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
# Update repository settings to match the definitions in .github/settings.yml.
3+
name: Update Repo Settings
4+
5+
on:
6+
push:
7+
branches: [main]
8+
paths:
9+
- '.github/settings.yml'
10+
schedule:
11+
- cron: '23 12 * * *'
12+
workflow_dispatch:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
update-repo-settings:
19+
name: Update Repo Settings
20+
secrets:
21+
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
22+
APPLICATION_PRIVATE_KEY: ${{ secrets.APPLICATION_PRIVATE_KEY }}
23+
uses: bfra-me/.github/.github/workflows/update-repo-settings.yaml@084299cf8d89425e3c5947c39772258c61f1dbc7 # v4.3.18

0 commit comments

Comments
 (0)