diff --git a/.changeset/fix-type-assertions.md b/.changeset/fix-type-assertions.md new file mode 100644 index 00000000..382d117e --- /dev/null +++ b/.changeset/fix-type-assertions.md @@ -0,0 +1,9 @@ +--- +"@perstack/api-client": patch +"@perstack/anthropic-provider": patch +"@perstack/provider-core": patch +"@perstack/react": patch +--- + +Fixed prohibited 'as' type assertions by replacing them with proper type guards + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a29cf7a..3009d093 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,13 +14,13 @@ permissions: contents: read env: - CI: 'true' - PNPM_VERSION: '10.10.0' - NODE_VERSION: '22' + CI: "true" + PNPM_VERSION: "10.10.0" + NODE_VERSION: "22" jobs: - quality: - name: Lint / Format / Knip + lint: + name: Lint / Format runs-on: ubuntu-24.04 if: github.event_name == 'push' || github.event.pull_request.draft == false steps: @@ -35,7 +35,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' + cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile @@ -43,22 +43,125 @@ jobs: - name: Lint & Format check run: pnpm run format-and-lint + typecheck: + name: Type Check + runs-on: ubuntu-24.04 + if: github.event_name == 'push' || github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Type check run: pnpm run typecheck + check-deps: + name: Check Dependencies + runs-on: ubuntu-24.04 + if: github.event_name == 'push' || github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Check unused dependencies run: pnpm run check-deps + validate-versions: + name: Validate Versions + runs-on: ubuntu-24.04 + if: github.event_name == 'push' || github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Validate version sync run: pnpm run validate:versions + validate-changeset: + name: Validate Changeset + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' && github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + - name: Validate changesets run: pnpm run validate:changeset - if: github.event_name == 'pull_request' + + check-schema-diff: + name: Check Schema Diff + runs-on: ubuntu-24.04 + if: github.event_name == 'pull_request' && github.event.pull_request.draft == false + steps: + - uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile - name: Check schema diff run: pnpm run check:schema-diff - if: github.event_name == 'pull_request' test: name: Test @@ -76,7 +179,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' + cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile @@ -112,7 +215,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' + cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile @@ -149,24 +252,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - cache: 'pnpm' + cache: "pnpm" - name: Install dependencies run: pnpm install --frozen-lockfile - name: Check changeset run: pnpm changeset status --since=origin/main - - ci-success: - name: CI Success - runs-on: ubuntu-24.04 - needs: [quality, test, build] - if: always() && (github.event_name == 'push' || github.event.pull_request.draft == false) - steps: - - name: Check all job statuses - run: | - if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then - echo "::error::One or more CI jobs failed" - exit 1 - fi - echo "✅ All CI checks passed!" \ No newline at end of file diff --git a/.github/workflows/issue-bot.yml b/.github/workflows/issue-bot.yml deleted file mode 100644 index 4d7c8047..00000000 --- a/.github/workflows/issue-bot.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Issue Bot -on: - issue_comment: - types: [created] - issues: - types: [opened] -jobs: - respond: - if: | - (github.event_name == 'issues') || - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@perstack-issue-bot')) - runs-on: ubuntu-latest - permissions: - issues: write - contents: read - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "22" - - name: Add reaction to indicate processing - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ "${{ github.event_name }}" = "issue_comment" ]; then - gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content=eyes - else - gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/reactions -f content=eyes - fi - - name: Post processing status - id: status_comment - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - COMMENT_URL=$(gh issue comment ${{ github.event.issue.number }} --body "🤖 Starting...") - COMMENT_ID=$(echo "$COMMENT_URL" | grep -oE '[0-9]+$') - echo "comment_id=$COMMENT_ID" >> $GITHUB_OUTPUT - - name: Run Issue Bot - env: - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_REPO: ${{ github.repository }} - ISSUE_NUMBER: ${{ github.event.issue.number }} - COMMENT_ID: ${{ steps.status_comment.outputs.comment_id }} - run: | - echo 'model = "claude-sonnet-4-5"' > perstack.toml - echo '[provider]' >> perstack.toml - echo 'providerName = "anthropic"' >> perstack.toml - npm install -g tsx - npx perstack run @perstack/github-issue-bot "Answer issue #$ISSUE_NUMBER" 2>&1 | tsx scripts/checkpoint-filter.ts