Skip to content

Commit e2fbdde

Browse files
chore: align npm publishing and repo rename
1 parent 05131ef commit e2fbdde

13 files changed

Lines changed: 170 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Artifact
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Tooling
20+
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
21+
with:
22+
install: true
23+
cache: true
24+
experimental: true
25+
26+
- name: Build
27+
run: |
28+
mise run setup
29+
mise run build
30+
31+
- name: Upload dist artifact
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: opencode-palantir-dist
35+
if-no-files-found: error
36+
path: dist/

.github/workflows/bundle.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Bundle Plugin (with data)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
bundle:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Tooling
17+
uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
18+
with:
19+
install: true
20+
cache: true
21+
experimental: true
22+
23+
- name: Build
24+
run: |
25+
mise run setup
26+
mise run test
27+
mise run build
28+
29+
- name: Create bundle
30+
run: |
31+
mkdir -p bundle
32+
cp -R dist bundle/dist
33+
34+
if [ -f data/docs.parquet ]; then
35+
mkdir -p bundle/data
36+
cp data/docs.parquet bundle/data/docs.parquet
37+
fi
38+
39+
cp package.json bundle/package.json
40+
cp README.md bundle/README.md
41+
42+
tar -czf opencode-palantir-bundle.tgz -C bundle .
43+
44+
- name: Upload bundle
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: opencode-palantir-bundle
48+
if-no-files-found: error
49+
path: opencode-palantir-bundle.tgz

.github/workflows/publish.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
2527

2628
- uses: jdx/mise-action@d6e32c1796099e0f1f3ac741c220a8b7eae9e5dd
2729
with:
2830
install: true
2931
cache: true
3032
experimental: true
3133

32-
- name: Build
33-
run: mise run build
34+
- name: Setup
35+
run: mise run setup
36+
37+
- name: Test
38+
run: mise run test
3439

3540
- id: inputs
3641
uses: simenandre/setup-inputs@v1
@@ -44,3 +49,27 @@ jobs:
4449
4550
echo "Publishing with tag: $TAG"
4651
mise run publish --tag "$TAG"
52+
53+
- name: Verify published version
54+
run: |
55+
TAG="${{ steps.inputs.outputs.tag }}"
56+
if [ -z "$TAG" ]; then
57+
TAG="latest"
58+
fi
59+
60+
NAME="$(node -p \"require('./package.json').name\")"
61+
VERSION="$(node -p \"require('./package.json').version\")"
62+
echo "Checking npm dist-tag '$TAG' for ${NAME}@${VERSION}..."
63+
64+
if ! npm view "${NAME}@${VERSION}" version >/dev/null 2>&1; then
65+
echo "[ERROR] npm does not report ${NAME}@${VERSION} after publish"
66+
exit 1
67+
fi
68+
69+
DIST_VERSION="$(npm view "${NAME}" dist-tags."${TAG}" 2>/dev/null || true)"
70+
if [ -n "$DIST_VERSION" ] && [ "$DIST_VERSION" != "$VERSION" ]; then
71+
echo "[ERROR] dist-tag '$TAG' points to $DIST_VERSION (expected $VERSION)"
72+
exit 1
73+
fi
74+
75+
echo "✓ npm publish verification passed"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ data/*.db
1414
data/*.db-shm
1515
data/*.db-wal
1616
data/*.parquet
17+
*.tgz
1718

1819
.sisyphus/

.mise/tasks/build

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/usr/bin/env bash
22
#MISE description="Build the project"
33
#MISE sources=["src/**/*"]
4-
#MISE outputs=["dist/index.js"]
4+
#MISE outputs=["dist/index.js", "dist/index.d.ts"]
5+
6+
set -e
7+
8+
rm -rf dist
9+
mkdir -p dist
510

611
bun build ./src/index.ts --outdir dist --target bun --external "@opencode-ai/*"
12+
13+
cat > dist/index.d.ts <<'EOF'
14+
import type { Plugin } from '@opencode-ai/plugin';
15+
16+
declare const plugin: Plugin;
17+
export default plugin;
18+
EOF

.mise/tasks/publish

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ if [ -n "${usage_otp}" ]; then
4141
fi
4242

4343
# if not usage_dry_run and is in github action, add provenance flag to args.
44+
# NOTE: npm provenance requires Trusted Publishing (OIDC).
4445
if [ -n "${GITHUB_ACTIONS}" ]; then
4546
args+=("--provenance")
4647
echo " > adding provenance flag for CI publish"

.mise/tasks/setup

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ fi
1212

1313
bun install
1414

15-
mkdir -p node_modules/@opencode-ai
16-
ln -sf "$(pwd)/.opencode/node_modules/@opencode-ai/plugin" node_modules/@opencode-ai/plugin 2>/dev/null || true
15+
OPENCODE_PLUGIN_PATH="$(pwd)/.opencode/node_modules/@opencode-ai/plugin"
16+
if [ -d "${OPENCODE_PLUGIN_PATH}" ]; then
17+
mkdir -p node_modules/@opencode-ai
18+
ln -sf "${OPENCODE_PLUGIN_PATH}" node_modules/@opencode-ai/plugin
19+
fi
1720

1821
echo ""
1922
echo "👍 Done"

.opencode/command/test.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: Test Palantir documentation tools
44

55
# Palantir Plugin Tool Test
66

7+
(Plugin package: `@openontology/opencode-palantir`)
8+
79
You are testing the Palantir Foundry documentation tools. Follow these rules strictly:
810

911
## Rules
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import plugin from '../../dist/index.js';
2+
3+
export default plugin;

.opencode/plugins/palantir.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)