diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml new file mode 100644 index 0000000..5e709c9 --- /dev/null +++ b/.github/workflows/auto-update.yml @@ -0,0 +1,73 @@ +name: Auto-update types from OpenAPI + +on: + schedule: + # Run daily at 2 AM UTC + - cron: '0 2 * * *' + workflow_dispatch: # Allow manual trigger + +jobs: + update-and-publish: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Fetch latest OpenAPI schemas + run: npm run update-schemas + + - name: Check for changes + id: git-check + run: | + git diff --exit-code src/types/ || echo "changed=true" >> $GITHUB_OUTPUT + + - name: Commit and push if changed + if: steps.git-check.outputs.changed == 'true' + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add src/types/ openapi.yaml media-agent-openapi.yaml + git commit -m "chore: update types from OpenAPI spec" + git push + + - name: Create changeset + if: steps.git-check.outputs.changed == 'true' + run: | + cat << EOF > .changeset/auto-update-$(date +%s).md + --- + "@scope3/agentic-client": patch + --- + + Update types from latest OpenAPI specification + EOF + git add .changeset/ + git commit -m "chore: create changeset for type updates" + git push + + - name: Version packages + if: steps.git-check.outputs.changed == 'true' + run: | + npx changeset version + git add . + git commit -m "chore: version packages" + git push + + - name: Build and publish + if: steps.git-check.outputs.changed == 'true' + run: npm run release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8bb2f0..88a5cc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -38,5 +39,5 @@ jobs: commit: 'chore: version packages' title: 'chore: version packages' env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package-lock.json b/package-lock.json index ee0f376..7bba23f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "zod": "^3.25.76" }, "bin": { - "scope3-media-agent": "dist/media-agent-server.js" + "simple-media-agent": "dist/simple-media-agent-server.js" }, "devDependencies": { "@changesets/changelog-github": "^0.5.1", @@ -3305,16 +3305,6 @@ "dev": true, "license": "MIT" }, - "node_modules/commander": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", - "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -6055,6 +6045,16 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/lint-staged/node_modules/commander": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", + "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/lint-staged/node_modules/execa": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", diff --git a/package.json b/package.json index ebf70b2..227bcd9 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "description": "TypeScript client for the Scope3 Agentic API with AdCP webhook support", "main": "dist/index.js", "types": "dist/index.d.ts", + "publishConfig": { + "access": "public" + }, "bin": { "simple-media-agent": "dist/simple-media-agent-server.js" }, @@ -32,6 +35,14 @@ ], "author": "", "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/scope3data/agentic-client.git" + }, + "bugs": { + "url": "https://github.com/scope3data/agentic-client/issues" + }, + "homepage": "https://github.com/scope3data/agentic-client#readme", "dependencies": { "@modelcontextprotocol/sdk": "^1.20.1", "express": "^4.18.0",