Skip to content

Commit 68f4983

Browse files
committed
ci: restructure pipeline into distinct stages, fix formatting and linting
1 parent 5a92b48 commit 68f4983

42 files changed

Lines changed: 851 additions & 660 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Bug Report
33
about: Report a bug to help us improve
4-
title: "[Bug] "
4+
title: '[Bug] '
55
labels: bug
66
assignees: ''
77
---

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Feature Request
33
about: Suggest an idea for this project
4-
title: "[Feature] "
4+
title: '[Feature] '
55
labels: enhancement
66
assignees: ''
77
---

.github/ISSUE_TEMPLATE/question.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Question
33
about: Ask a question about usage or behavior
4-
title: "[Question] "
4+
title: '[Question] '
55
labels: question
66
assignees: ''
77
---
@@ -24,6 +24,6 @@ Describe what you've already tried or looked at:
2424

2525
## Environment (if relevant)
2626

27-
- **OS**:
28-
- **Node.js version**:
29-
- **remote-opencode version**:
27+
- **OS**:
28+
- **Node.js version**:
29+
- **remote-opencode version**:

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Closes #
2121

2222
<!-- List the specific changes made in this PR -->
2323

24-
-
25-
-
26-
-
24+
-
25+
-
26+
-
2727

2828
## Testing
2929

.github/workflows/ci-cd.yml

Lines changed: 103 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,17 @@ env:
1313

1414
jobs:
1515
# ============================================================
16-
# Single Unified Workflow Job
16+
# Stage 1: Validation & Code Quality
1717
# ============================================================
18-
ci-cd:
19-
name: 🚀 CI/CD & Standalone Release
20-
runs-on: windows-latest # Windows is required for SEA .exe generation
21-
timeout-minutes: 20
18+
quality:
19+
name: 🔬 Quality & Lint
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 10
2222
permissions:
23-
contents: write
24-
pull-requests: write
25-
issues: write
26-
23+
contents: read
2724
steps:
2825
- name: 🔍 Checkout code
2926
uses: actions/checkout@v4
30-
with:
31-
fetch-depth: 0 # Full history needed for changelog generation
3227

3328
- name: 🟢 Setup Node.js
3429
uses: actions/setup-node@v4
@@ -39,55 +34,128 @@ jobs:
3934
- name: 📦 Install dependencies
4035
run: npm ci
4136

42-
- name: 🔬 Code Quality Check (Lint & Types)
43-
run: |
44-
npm run lint
45-
npm run type-check
46-
npm run format:check
37+
- name: ✨ Prettier Format Check
38+
run: npm run format:check
39+
40+
- name: 🧹 Lint Check
41+
run: npm run lint
42+
43+
- name: 🛡️ TypeScript Type Check
44+
run: npm run type-check
4745

48-
- name: 🧪 Unit Tests
46+
# ============================================================
47+
# Stage 2: Unit Testing
48+
# ============================================================
49+
test:
50+
name: 🧪 Unit Tests
51+
needs: quality
52+
runs-on: ubuntu-latest
53+
timeout-minutes: 10
54+
steps:
55+
- name: 🔍 Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: 🟢 Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: ${{ env.NODE_VERSION }}
62+
cache: 'npm'
63+
64+
- name: 📦 Install dependencies
65+
run: npm ci
66+
67+
- name: 🏃 Run Tests
4968
run: npm test
5069

51-
- name: 🏗️ Build Standalone EXE
70+
# ============================================================
71+
# Stage 3: Build Standalone EXE
72+
# ============================================================
73+
build:
74+
name: 🏗️ Build Standalone EXE
75+
needs: test
76+
runs-on: windows-latest
77+
timeout-minutes: 15
78+
steps:
79+
- name: 🔍 Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: 🟢 Setup Node.js
83+
uses: actions/setup-node@v4
84+
with:
85+
node-version: ${{ env.NODE_VERSION }}
86+
cache: 'npm'
87+
88+
- name: 📦 Install dependencies
89+
run: npm ci
90+
91+
- name: 🔨 Build Standalone EXE
5292
run: npm run build:sea
5393

54-
- name: ⬆️ Upload Artifact (Internal)
94+
- name: ⬆️ Upload Artifact
5595
uses: actions/upload-artifact@v4
5696
with:
5797
name: remote-opencode-windows
5898
path: dist/remote-opencode.exe
59-
retention-days: 1
99+
retention-days: 7
100+
101+
# ============================================================
102+
# Stage 4: Release & Feedback
103+
# ============================================================
104+
release-and-feedback:
105+
name: 🚀 Release & PR Summary
106+
needs: build
107+
runs-on: ubuntu-latest
108+
if: always()
109+
permissions:
110+
contents: write
111+
pull-requests: write
112+
issues: write
113+
114+
steps:
115+
- name: 🔍 Checkout code
116+
uses: actions/checkout@v4
117+
with:
118+
fetch-depth: 0
119+
120+
- name: 📥 Download Artifact
121+
if: needs.build.result == 'success'
122+
uses: actions/download-artifact@v4
123+
with:
124+
name: remote-opencode-windows
125+
path: .
60126

61-
# ============================================================
62-
# Release Logic (Only on Version Tags)
63-
# ============================================================
64127
- name: 🚀 Create GitHub Release
65-
if: startsWith(github.ref, 'refs/tags/v')
128+
if: startsWith(github.ref, 'refs/tags/v') && needs.build.result == 'success'
66129
uses: softprops/action-gh-release@v2
67130
with:
68-
files: dist/remote-opencode.exe
131+
files: remote-opencode.exe
69132
name: Release ${{ github.ref_name }}
70133
draft: false
71134
prerelease: false
72-
generate_release_notes: true # Automatically generates changelog from commits
135+
generate_release_notes: true
73136
env:
74137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75138

76-
# ============================================================
77-
# PR Feedback (Only on Pull Requests)
78-
# ============================================================
79139
- name: 📊 Post PR Summary
80-
if: github.event_name == 'pull_request' && always()
140+
if: github.event_name == 'pull_request'
81141
uses: actions/github-script@v7
82142
with:
83143
script: |
84-
const status = "${{ job.status }}";
85-
const emoji = status === 'success' ? '✅' : '❌';
86-
const body = `## ${emoji} CI/CD Pipeline ${status === 'success' ? 'Passed' : 'Failed'}
144+
const qualityStatus = "${{ needs.quality.result }}";
145+
const testStatus = "${{ needs.test.result }}";
146+
const buildStatus = "${{ needs.build.result }}";
147+
148+
const check = (status) => status === 'success' ? '✅ Passed' : (status === 'skipped' ? '⏭️ Skipped' : '❌ Failed');
149+
150+
const body = `## CI/CD Pipeline Summary
87151
88-
All checks (Lint, Types, Format, Tests, and Windows Build) have been executed in a unified environment.
152+
| Stage | Status |
153+
|-------|--------|
154+
| 🔬 Code Quality | ${check(qualityStatus)} |
155+
| 🧪 Unit Tests | ${check(testStatus)} |
156+
| 🏗️ Build EXE | ${check(buildStatus)} |
89157
90-
${status === 'success' ? 'The standalone EXE was built successfully and is ready for release! 🎉' : 'Please check the logs to resolve issues before merging.'}`;
158+
${buildStatus === 'success' ? 'Ready for merge and release! 🎉' : 'Please resolve the issues above.'}`;
91159
92160
github.rest.issues.createComment({
93161
issue_number: context.issue.number,

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,38 @@ All notable changes to this project will be documented in this file.
55
## [1.2.0] - 2026-02-05
66

77
### Added
8+
89
- **Standalone Executable**: Added support for building a single, standalone `.exe` (for Windows) or binary (for Linux/macOS) using Node.js SEA (Single Executable Applications). Users can now run the bot without having Node.js installed.
910
- **New `/diff` Command**: Added a slash command to view current git changes in the project or active worktree directly from Discord. Supports optional `--staged` flag.
1011
- **Build System**: Added `scripts/build-sea.js` to automate the process of bundling, SEA blob generation, and binary injection.
1112
- **Node 24 Support**: Verified compatibility and optimized the codebase for Node.js 24.
1213

1314
### Changed
15+
1416
- **Modernized Dependencies**: Upgraded `discord.js` to `v14.25.1`, `commander` to `v14.0.3`, and `open` to `v11.0.0`.
1517
- **Improved SEA Compatibility**: Added runtime shims for `import.meta.url` and `require` to support modern ESM packages in a bundled environment.
1618
- **Noise Reduction**: Implemented custom warning suppression to silence Node.js SEA-specific native warnings on startup.
1719

1820
### Fixed
21+
1922
- **Security Hardening**: Fixed a moderate security vulnerability in `undici` (resource exhaustion) by forcing version `^6.23.0` via dependency overrides.
2023
- **Cleaned Dependencies**: Removed unused `node-pty` dependency to simplify the build process and reduce binary size.
2124

2225
## [1.1.1] - 2026-02-05
2326

2427
### Added
28+
2529
- Documentation for `/model` and `/setports` slash commands in README.
2630

2731
### Security
32+
2833
- **Hardened Server Binding**: All OpenCode server instances are now strictly bound to `127.0.0.1` to prevent unauthorized remote access.
2934
- **Improved Testing**: Added regression tests for server lifecycle and port management.
3035

3136
## [1.1.0] - 2026-02-05
3237

3338
### Added
39+
3440
- **Automated Message Queuing**: Added a new system to queue multiple prompts in a thread. If the bot is busy, new messages are automatically queued and processed sequentially.
3541
- **Fresh Context Mode**: Each queued job can optionally start with a fresh AI conversation context (new session) while maintaining the same code state.
3642
- **Queue Management**: New `/queue` slash command suite to list, clear, pause, resume, and configure queue settings.
@@ -40,15 +46,18 @@ All notable changes to this project will be documented in this file.
4046
- **Visual Feedback**: The bot now reacts with `📥` when a message is successfully queued via chat.
4147

4248
### Changed
49+
4350
- **Refactored Execution Logic**: Moved core prompt execution to a dedicated `executionService` for better reliability and code reuse.
4451

4552
## [1.0.11] - 2026-02-04
4653

4754
### Added
55+
4856
- Model confirmation in Discord messages: The bot now displays which model is being used when starting a session.
4957
- Real-time logging: Added always-on logging for `opencode serve` startup commands, working directories, and process output (stdout/stderr) for easier debugging.
5058

5159
### Fixed
60+
5261
- Fixed `opencode serve` startup failures: The bot now correctly detects when the server fails to start immediately and reports the actual error message to Discord instead of timing out after 30 seconds.
5362
- Resolved `--model` flag error: Moved model selection from the `opencode serve` command (where it was unsupported) to the prompt API.
5463
- Fixed Model API format: Correctly formatted model identifiers as objects (`{ providerID, modelID }`) as required by the OpenCode API.
@@ -59,9 +68,11 @@ All notable changes to this project will be documented in this file.
5968
## [1.0.10] - 2026-02-04
6069

6170
### Added
71+
6272
- New `/setports` slash command to configure the port range for OpenCode server instances.
6373

6474
### Fixed
75+
6576
- Fixed Windows-specific spawning issue where the bot failed to find the `opencode` command (now targeting `opencode.cmd`).
6677
- Resolved `spawn EINVAL` errors on Windows by correctly configuring shell execution.
6778
- Fixed a crash where the bot would attempt to pass an unsupported `--model` flag to `opencode serve`.
@@ -72,11 +83,13 @@ All notable changes to this project will be documented in this file.
7283
## [1.0.9] - 2026-02-04
7384

7485
### Added
86+
7587
- New `/model` slash command to list and set AI models per channel.
7688
- Support for `--model` flag in OpenCode server instances.
7789
- Persistent storage for channel-specific model preferences.
7890

7991
### Fixed
92+
8093
- Fixed a connection timeout issue where the bot failed to connect to the internal `opencode serve` process.
8194
- Added `--hostname 0.0.0.0` to the `opencode serve` command to ensure the service is reachable.
8295
- Standardized internal communication to use `127.0.0.1` instead of `localhost` to avoid IPv6 resolution conflicts on some systems.

0 commit comments

Comments
 (0)