diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..82d7694 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,70 @@ +name: Publish to npm + +on: + push: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Update npm and configure + run: | + npm install -g npm@latest + echo "npm version: $(npm --version)" + echo "node version: $(node --version)" + echo "OIDC URL set: ${ACTIONS_ID_TOKEN_REQUEST_URL:+yes}" + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Run tests + run: npm run test:run + + - name: Check if version changed + id: version + run: | + PACKAGE_NAME=$(jq -r .name package.json) + LOCAL_VERSION=$(jq -r .version package.json) + NPM_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo "0.0.0") + + echo "local=$LOCAL_VERSION" >> $GITHUB_OUTPUT + echo "npm=$NPM_VERSION" >> $GITHUB_OUTPUT + + if [ "$LOCAL_VERSION" != "$NPM_VERSION" ]; then + echo "changed=true" >> $GITHUB_OUTPUT + echo "Version changed: $NPM_VERSION -> $LOCAL_VERSION" + else + echo "changed=false" >> $GITHUB_OUTPUT + echo "Version unchanged: $LOCAL_VERSION" + fi + + - name: Publish to npm + if: steps.version.outputs.changed == 'true' + run: | + # Ensure no auth config exists (let npm use OIDC) + rm -f ~/.npmrc + npm publish --access public --provenance + + - name: Create GitHub Release + if: steps.version.outputs.changed == 'true' + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.version.outputs.local }} + name: v${{ steps.version.outputs.local }} + generate_release_notes: true diff --git a/.gitignore b/.gitignore index ea80c4b..ed3930e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ dist/ # Test coverage coverage/ +.npm-cache + # Editor .vscode/ .idea/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..59b118b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- GitHub Actions workflow for automatic npm publishing with OIDC trusted publishers + +## [0.1.1] - 2025-01-01 + +### Fixed + +- CLI export paths for proper npm package distribution + +## [0.1.0] - 2025-01-01 + +### Added + +- Initial release +- `trail` CLI for capturing agent work trajectories +- Core commands: `start`, `status`, `decision`, `complete`, `list`, `show`, `export` +- File system storage backend (`.trajectories/` directory) +- Export formats: markdown, json, timeline, html +- Web viewer with `--open` flag for browser-based viewing +- Trajectory format with chapters, events, decisions, and retrospectives +- Confidence scores for agent self-assessment +- Task source linking (Linear, GitHub Issues, etc.) + +[Unreleased]: https://github.com/AgentWorkforce/trajectories/compare/v0.1.1...HEAD +[0.1.1]: https://github.com/AgentWorkforce/trajectories/compare/v0.1.0...v0.1.1 +[0.1.0]: https://github.com/AgentWorkforce/trajectories/releases/tag/v0.1.0