Skip to content

Commit 0aac668

Browse files
author
Justin Vogt
authored
Merge pull request #2 from JUVOJustin/npm-deployment
Implement DDEV plugin with installation instructions, CI/CD workflow
2 parents e623d7e + 4427328 commit 0aac668

9 files changed

Lines changed: 213 additions & 16 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
id-token: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Extract tag version
28+
id: version
29+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
30+
31+
- name: Update package.json version
32+
run: npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Run build
38+
run: npm run build
39+
40+
- name: Commit version update
41+
run: |
42+
git config --local user.email "action@github.com"
43+
git config --local user.name "GitHub Action"
44+
git add package.json package-lock.json
45+
if git diff --staged --quiet; then
46+
echo "No changes to commit"
47+
else
48+
git commit -m "chore: update package.json version to ${{ steps.version.outputs.VERSION }}"
49+
git push
50+
fi
51+
52+
- name: Publish to npm
53+
run: npm publish
54+
env:
55+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
dist/
3+
*.log
4+
.DS_Store
5+
*.tsbuildinfo
6+
thoughts/

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tsconfig.json

README.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,22 @@ DDEV Plugin for [OpenCode](https://opencode.ai) - Automatically detects DDEV ava
1212
- **Session Notifications**: Notifies the LLM about DDEV environment only on first bash command execution (to save tokens)
1313
- **Custom DDEV Logs Tool**: Provides a `ddev_logs` tool for retrieving logs from DDEV services
1414

15-
## How to Include as Submodule
15+
## Installation
16+
Add to your opencode.json or ~/.config/opencode/opencode.json:
1617

17-
Add this plugin to your OpenCode configuration as a Git submodule:
18-
19-
```bash
20-
# Add the submodule
21-
git submodule add git@github.com:JUVOJustin/opencode-ddev-plugin.git plugin/ddev
22-
23-
# Create an index.js file in the plugin root directory
24-
echo 'export { DDEVPlugin } from "./ddev/ddev.js";' > plugin/index.js
25-
26-
# Commit the changes
27-
git add .gitmodules plugin/ddev plugin/index.js
28-
git commit -m "Add DDEV plugin as submodule"
18+
```json
19+
{
20+
"plugin": ["opencode-ddev"]
21+
}
2922
```
3023

31-
## Loading the Plugin
24+
OpenCode auto-installs plugins on startup.
25+
26+
### Update
27+
Force update to latest:
3228

33-
To load plugins from the plugin subfolder, ensure your OpenCode configuration includes the plugin directory. The plugin will be automatically discovered and loaded.
29+
`rm -rf ~/.cache/opencode`
30+
Then restart OpenCode.
3431

3532
## Usage
3633

File renamed without changes.

logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { tool } from "@opencode-ai/plugin";
1+
import { tool } from "@opencode-ai/plugin/tool";
22

33
/**
44
* Creates a DDEV logs tool for viewing container logs

package-lock.json

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "opencode-ddev",
3+
"version": "1.0.0",
4+
"type": "module",
5+
"description": "Adds context about ddev setup and improves command calling",
6+
"main": "index.js",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/JUVOJustin/opencode-ddev-plugin.git"
10+
},
11+
"keywords": [
12+
"opencode",
13+
"ddev"
14+
],
15+
"author": "Justin Vogt",
16+
"license": "MIT",
17+
"bugs": {
18+
"url": "https://github.com/JUVOJustin/opencode-ddev-plugin/issues"
19+
},
20+
"homepage": "https://github.com/JUVOJustin/opencode-ddev-plugin#readme",
21+
"scripts": {
22+
"build": "tsc",
23+
"typecheck": "tsc --noEmit"
24+
},
25+
"peerDependencies": {
26+
"@opencode-ai/plugin": "^1.0.126"
27+
},
28+
"devDependencies": {
29+
"@opencode-ai/plugin": "^1.0.126",
30+
"@types/node": "^24.10.1",
31+
"typescript": "^5.9.3"
32+
},
33+
"dependencies": {
34+
"@opencode-ai/sdk": "^1.0.126"
35+
}
36+
}

tsconfig.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"module": "ESNext",
5+
"lib": ["ES2020"],
6+
"moduleResolution": "bundler",
7+
"esModuleInterop": true,
8+
"declaration": true,
9+
"declarationMap": true,
10+
"sourceMap": true,
11+
"outDir": "./dist",
12+
"rootDir": "./",
13+
"strict": true,
14+
"skipLibCheck": true,
15+
"resolveJsonModule": true,
16+
"types": ["node"]
17+
},
18+
"include": [
19+
"index.ts",
20+
"logs.ts"
21+
],
22+
"exclude": [
23+
"node_modules",
24+
"dist"
25+
]
26+
}

0 commit comments

Comments
 (0)