diff --git a/.github/workflows/bitcode-canon-quality.yml b/.github/workflows/bitcode-canon-quality.yml index 0369569d7..920e72e6e 100644 --- a/.github/workflows/bitcode-canon-quality.yml +++ b/.github/workflows/bitcode-canon-quality.yml @@ -20,11 +20,14 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Run Bitcode spec-quality basics - run: node scripts/run-bitcode-spec-quality.mjs --mode basic + - name: Validate active canon and V28 draft posture + run: | + node scripts/check-bitcode-canonical-inputs.mjs --current-target V27 + node scripts/check-bitcode-canon-posture-drift.mjs --active-canon V27 --draft-target V28 + node scripts/check-bitcode-spec-family.mjs --version V28 --mode draft --current-target V27 - bitcode-full: - name: Bitcode Full Test Suite + bitcode-demonstration-mvp: + name: Bitcode Demonstration MVP runs-on: ubuntu-latest needs: bitcode-spec-basics container: @@ -34,8 +37,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Run full Bitcode protocol-demonstration suite - run: npm --prefix protocol-demonstration run test + - name: Run V28 protocol-demonstration MVP QA + run: npm --prefix protocol-demonstration run test:v28-mvp-qa bitcode-spec-commit-conformance: name: Bitcode Spec Commit Conformance @@ -50,5 +53,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Run strict spec conformance for `spec: VN` titles - run: node scripts/run-bitcode-spec-quality.mjs --mode strict-from-title --commit-title "$SPEC_TITLE" + - name: Run V28 strict draft conformance for spec-title changes + run: | + case "$SPEC_TITLE" in + spec:\ V28*|spec:\ v28*) + node scripts/check-bitcode-spec-family.mjs --version V28 --mode draft --current-target V27 + ;; + *) + echo "Skipping strict spec-title conformance; title is not a V28 spec change." + ;; + esac diff --git a/.github/workflows/bitcode-gate-quality.yml b/.github/workflows/bitcode-gate-quality.yml new file mode 100644 index 000000000..b3cbfc850 --- /dev/null +++ b/.github/workflows/bitcode-gate-quality.yml @@ -0,0 +1,67 @@ +name: Bitcode Gate Quality + +on: + push: + branches: + - "v*/gate-*" + - "version/**" + pull_request: + branches: + - "version/**" + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + gate-quality: + name: Gate Quality + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "24" + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Validate draft canon posture + run: | + test "$(cat BITCODE_SPEC.txt)" = "V27" + node scripts/check-bitcode-spec-family.mjs --version V28 --mode draft --current-target V27 + node scripts/check-bitcode-canon-posture-drift.mjs --active-canon V27 --draft-target V28 + node scripts/check-bitcode-canonical-inputs.mjs --current-target V27 + + - name: Validate source casing and imports + run: | + bash scripts/find-uppercase-raw-promptparts.sh + bash scripts/check-import-casing.sh + + - name: Type-check gate packages + run: | + pnpm --filter @bitcode/pipeline-asset-pack typecheck + pnpm --filter @bitcode/pipeline-hosts typecheck + + - name: Test gate packages + run: | + pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --passWithNoTests --forceExit + pnpm --filter @bitcode/pipeline-hosts exec jest --config jest.config.cjs --passWithNoTests --forceExit + + - name: Test protocol demonstration + run: npm --prefix protocol-demonstration run test:v28-mvp-qa + + - name: Check diff hygiene + run: git diff --check diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5dc2dfc0..4f7090d43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,12 @@ name: CI -# Trigger on pushes to any branch, pull requests targeting main, and manual dispatch +# Trigger on pushes, gate/version pull requests, main promotion pull requests, and manual dispatch. on: push: # Run CI on every commit push to any branch pull_request: - branches: [main] + branches: + - main + - "version/**" workflow_dispatch: # Cancel any in-progress runs when a newer commit is pushed to the same ref @@ -19,53 +21,53 @@ jobs: lint-build: name: Lint, Type-Check & Build runs-on: ubuntu-latest + env: + SUPABASE_URL: http://127.0.0.1:54321 + SUPABASE_ANON_KEY: ci-placeholder-anon-key + SUPABASE_PUBLISHABLE_KEY: ci-placeholder-anon-key + NEXT_PUBLIC_SUPABASE_URL: http://127.0.0.1:54321 + NEXT_PUBLIC_SUPABASE_ANON_KEY: ci-placeholder-anon-key + NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY: ci-placeholder-anon-key steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - # Cache node_modules for faster builds - - name: Cache Node.js modules - uses: actions/cache@v3 - with: - path: uapi/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('uapi/package-lock.json') }} + - name: Setup pnpm + uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "24" + cache: pnpm - name: Install dependencies - working-directory: uapi - run: npm ci + run: pnpm install --frozen-lockfile - - name: Run ESLint - working-directory: uapi - run: npm run lint + - name: Build local ESLint plugin + run: pnpm run build:eslint-plugin - - name: Prettier formatting check - working-directory: uapi - run: npx prettier --check . + - name: Run ESLint + run: pnpm -C uapi run lint - name: Type-check with TypeScript - working-directory: uapi - run: npx tsc --noEmit + run: pnpm -C uapi exec tsc --noEmit - - name: npm audit (moderate and above) - working-directory: uapi - run: npm audit --audit-level=moderate + - name: Dependency audit advisory report + continue-on-error: true + run: pnpm -C uapi audit --audit-level=moderate - name: Build Next.js application - working-directory: uapi - run: npm run build + run: pnpm -C uapi run build - name: Build Storybook - working-directory: uapi - run: npm run build-storybook + if: ${{ vars.ENABLE_STORYBOOK_BUILD == '1' }} + run: pnpm -C uapi run build-storybook - name: Upload Storybook static build - uses: actions/upload-artifact@v3 + if: ${{ vars.ENABLE_STORYBOOK_BUILD == '1' }} + uses: actions/upload-artifact@v4 with: name: storybook-static path: uapi/storybook-static @@ -80,35 +82,32 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Cache Node.js modules - uses: actions/cache@v3 - with: - path: uapi/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('uapi/package-lock.json') }} + - name: Setup pnpm + uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "24" + cache: pnpm - name: Install dependencies - working-directory: uapi - run: npm ci + run: pnpm install --frozen-lockfile - name: Run tests (mocked) & collect coverage - working-directory: uapi - run: npm test -- --coverage + run: pnpm -C uapi exec jest --coverage - name: Upload coverage report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: coverage-report path: uapi/coverage - name: Upload coverage to Codecov (mocks) - uses: codecov/codecov-action@v3 + continue-on-error: true + uses: codecov/codecov-action@v5 with: flags: mocks directory: ./uapi/coverage @@ -119,6 +118,7 @@ jobs: # -------------------------------------------------------------------------- test-real-db: name: E2E, Visual & DB Tests + if: ${{ vars.ENABLE_FULL_DB_E2E == '1' || github.event_name == 'workflow_dispatch' }} needs: test-mocks runs-on: ubuntu-latest env: @@ -139,18 +139,16 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - name: Cache Node.js modules - uses: actions/cache@v3 - with: - path: uapi/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('uapi/package-lock.json') }} + - name: Setup pnpm + uses: pnpm/action-setup@v4 - name: Setup Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18 + node-version: "24" + cache: pnpm # ------------------------------------------------------------------ # Supabase local stack to replicate production @@ -176,8 +174,7 @@ jobs: run: supabase db reset --yes - name: Install dependencies - working-directory: uapi - run: npm ci + run: pnpm install --frozen-lockfile # If embeddings are required for tests we sync them now (needs OpenAI key) - name: Sync upgrade template embeddings @@ -187,63 +184,61 @@ jobs: # 'secrets'" error. Instead, rely on the job-level environment variable # we already populate from the secret. if: ${{ env.OPENAI_API_KEY != '' }} - working-directory: uapi env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - run: npm run sync-upgrades-embeddings + run: pnpm -C uapi run sync-asset-pack-evidence-embeddings # ------------------------------------------------------------------ # Run the test suites # ------------------------------------------------------------------ - name: Run Jest integration tests (real DB) - working-directory: uapi env: USE_REAL_DB: "true" SUPABASE_URL: "http://localhost:54321" NEXT_PUBLIC_SUPABASE_URL: "http://localhost:54321" NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} - run: npm test -- --runInBand + run: pnpm -C uapi exec jest --runInBand - name: Install Playwright browsers - working-directory: uapi - run: npx playwright install --with-deps + run: pnpm -C uapi exec playwright install --with-deps - name: Run Playwright E2E (UI + visual) - working-directory: uapi env: + START_STORYBOOK: "false" USE_REAL_DB: "true" SUPABASE_URL: "http://localhost:54321" NEXT_PUBLIC_SUPABASE_URL: "http://localhost:54321" NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }} - run: npm run test:e2e:ui + run: pnpm -C uapi run test:e2e:ui # ------------------------------------------------------------------ # Upload artifacts so that PR authors/reviewers can inspect results # ------------------------------------------------------------------ - name: Upload Playwright HTML Report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: playwright-html-report path: uapi/playwright-report - name: Upload Playwright Artifacts (screenshots, traces, videos) - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: playwright-artifacts path: uapi/test-results # Jest coverage from this job (real DB) can override/merge with mocks if desired - name: Upload coverage (real-db) report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: coverage-report-real-db path: uapi/coverage - name: Upload coverage to Codecov (real-db) - uses: codecov/codecov-action@v3 + continue-on-error: true + uses: codecov/codecov-action@v5 with: flags: real-db directory: ./uapi/coverage @@ -255,9 +250,8 @@ jobs: actionlint: name: Validate GitHub Actions workflows runs-on: ubuntu-latest - needs: lint-build steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: reviewdog/action-actionlint@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} @@ -267,6 +261,7 @@ jobs: # -------------------------------------------------------------------------- codeql-analysis: name: CodeQL Analysis + if: ${{ vars.ENABLE_ADVANCED_CODEQL == '1' }} permissions: actions: read security-events: write @@ -276,24 +271,26 @@ jobs: matrix: language: [ 'javascript-typescript' ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v4 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v4 # -------------------------------------------------------------------------- # 6. GitHub Super-Linter (Markdown, YAML, Shell, etc.) # -------------------------------------------------------------------------- super-linter: name: Super Linter (misc files) + if: ${{ vars.ENABLE_SUPER_LINTER == '1' }} runs-on: ubuntu-latest needs: lint-build steps: + - uses: actions/checkout@v4 - name: Super-Linter uses: github/super-linter/slim@v5 env: diff --git a/.github/workflows/docs-refresh.yml b/.github/workflows/docs-refresh.yml index 94257c93b..3df02f12a 100644 --- a/.github/workflows/docs-refresh.yml +++ b/.github/workflows/docs-refresh.yml @@ -19,8 +19,6 @@ jobs: - name: Setup pnpm uses: pnpm/action-setup@v4 - with: - version: 9 - name: Install dependencies run: pnpm install --frozen-lockfile @@ -35,4 +33,3 @@ jobs: git status --porcelain exit 1 fi - diff --git a/.github/workflows/ga1.yml b/.github/workflows/ga1.yml deleted file mode 100644 index 91410239f..000000000 --- a/.github/workflows/ga1.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: CI - GA1 Core - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - core: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - cache: 'pnpm' - - name: Install deps - run: pnpm install --frozen-lockfile - - name: Lint core - run: pnpm run lint:core - - name: Typecheck core - run: pnpm run typecheck:core - - name: Run AssetPack bring-up tests - run: pnpm -C packages/pipelines/asset-pack test - - codegen-consistency: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - with: - version: 9 - - uses: actions/setup-node@v4 - with: - node-version: '20.x' - cache: 'pnpm' - - name: Install deps - run: pnpm install --frozen-lockfile - - name: Detect squashed schema presence - id: detect - run: | - if [ -f supabase/migrations/000_squashed.sql ] && grep -Eq 'CREATE TABLE|ALTER TABLE|pipeline_runs|asset_pack' supabase/migrations/000_squashed.sql; then - echo "present=true" >> $GITHUB_OUTPUT - else - echo "present=false" >> $GITHUB_OUTPUT - fi - - name: Run runtime DB codegen - if: steps.detect.outputs.present == 'true' - run: pnpm -C packages/orm run codegen:db - - name: Check no codegen drift - if: steps.detect.outputs.present == 'true' - run: | - git diff --exit-code || (echo 'Codegen drift detected. Run pnpm -C packages/orm run codegen:db and commit changes.' && exit 1) - - db-verify: - runs-on: ubuntu-latest - services: - postgres: - image: postgres:15 - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: engi - ports: [ '5432:5432' ] - options: >- - --health-cmd "pg_isready -U postgres" --health-interval 10s - --health-timeout 5s --health-retries 5 - steps: - - uses: actions/checkout@v4 - - name: Install psql client - run: sudo apt-get update && sudo apt-get install -y postgresql-client - - name: Apply squashed schema (placeholder is OK) - env: - PGPASSWORD: postgres - run: psql -h localhost -U postgres -d engi -f supabase/migrations/000_squashed.sql diff --git a/.github/workflows/long-runner-ci.yml b/.github/workflows/long-runner-ci.yml index 3196f5d55..42223de28 100644 --- a/.github/workflows/long-runner-ci.yml +++ b/.github/workflows/long-runner-ci.yml @@ -10,6 +10,9 @@ on: jobs: build-and-push: runs-on: ubuntu-latest + env: + AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_ROLE_TO_ASSUME }} + ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }} permissions: contents: read id-token: write # For OIDC auth to cloud registry (e.g. AWS ECR) @@ -17,16 +20,33 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Resolve image tags + id: image + run: | + if [ "${GITHUB_REF}" = "refs/heads/main" ] && [ -n "${ECR_REPOSITORY}" ]; then + { + echo "push=true" + echo "runner_tag=${ECR_REPOSITORY}:latest" + echo "worker_tag=${ECR_REPOSITORY}:worker" + } >> "$GITHUB_OUTPUT" + else + { + echo "push=false" + echo "runner_tag=bitcode-long-runner:ci" + echo "worker_tag=bitcode-long-runner-worker:ci" + } >> "$GITHUB_OUTPUT" + fi + # Optionally configure AWS credentials – replace with GCP/Azure/Fly - name: Configure AWS credentials - if: env.AWS_ROLE_TO_ASSUME != '' + if: steps.image.outputs.push == 'true' && env.AWS_ROLE_TO_ASSUME != '' uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} aws-region: us-east-1 - name: Login to Amazon ECR - if: env.AWS_ROLE_TO_ASSUME != '' + if: steps.image.outputs.push == 'true' && env.AWS_ROLE_TO_ASSUME != '' id: login-ecr uses: aws-actions/amazon-ecr-login@v2 @@ -41,13 +61,13 @@ jobs: with: context: . file: Dockerfile.long-runner - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.ECR_REPOSITORY }}:latest + push: ${{ steps.image.outputs.push == 'true' }} + tags: ${{ steps.image.outputs.runner_tag }} - name: Build and Push Worker uses: docker/build-push-action@v5 with: context: . file: Dockerfile.long-runner-worker - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.ECR_REPOSITORY }}:worker + push: ${{ steps.image.outputs.push == 'true' }} + tags: ${{ steps.image.outputs.worker_tag }} diff --git a/.github/workflows/v28-canon-promotion.yml b/.github/workflows/v28-canon-promotion.yml new file mode 100644 index 000000000..e9e8549ca --- /dev/null +++ b/.github/workflows/v28-canon-promotion.yml @@ -0,0 +1,97 @@ +name: V28 Canon Promotion + +on: + pull_request: + branches: + - main + types: + - opened + - synchronize + - reopened + - ready_for_review + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: write + pull-requests: read + +jobs: + promote-v28: + name: V28 Promotion Validation + if: >- + ${{ + github.event_name == 'workflow_dispatch' || + ( + github.event.pull_request.base.ref == 'main' && + github.event.pull_request.head.ref == 'version/v28' && + github.event.pull_request.head.repo.full_name == github.repository + ) + }} + runs-on: ubuntu-latest + + steps: + - name: Checkout version branch + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || github.ref_name }} + token: ${{ github.token }} + fetch-depth: 0 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: "24" + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Validate V28 promotion readiness + run: | + POINTER="$(cat BITCODE_SPEC.txt)" + if [ "$POINTER" = "V27" ]; then + node scripts/check-bitcode-spec-family.mjs --version V28 --mode draft --current-target V27 + node scripts/check-bitcode-canon-posture-drift.mjs --active-canon V27 --draft-target V28 + node scripts/check-bitcode-canonical-inputs.mjs --current-target V27 + node scripts/check-bitcode-spec-family.mjs --version V28 --mode promoted --current-target V28 --skip-pointer-check + node scripts/check-bitcode-canonical-inputs.mjs --current-target V28 --skip-pointer-check + elif [ "$POINTER" = "V28" ]; then + node scripts/check-bitcode-spec-family.mjs --version V28 --mode promoted --current-target V28 + node scripts/check-bitcode-canonical-inputs.mjs --current-target V28 + else + echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2 + exit 1 + fi + npm --prefix protocol-demonstration run test + pnpm --filter @bitcode/pipeline-asset-pack typecheck + pnpm --filter @bitcode/pipeline-hosts typecheck + pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --passWithNoTests --forceExit + pnpm --filter @bitcode/pipeline-hosts exec jest --config jest.config.cjs --passWithNoTests --forceExit + git diff --check + + - name: Promote BITCODE_SPEC pointer + if: >- + ${{ + github.event_name == 'pull_request' && + github.event.pull_request.head.ref == 'version/v28' + }} + env: + HEAD_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + if [ "$(cat BITCODE_SPEC.txt)" = "V28" ]; then + echo "BITCODE_SPEC.txt already points to V28." + exit 0 + fi + printf "V28\n" > BITCODE_SPEC.txt + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add BITCODE_SPEC.txt + git commit -m "Promote Bitcode canon to V28" + git push origin "HEAD:$HEAD_BRANCH" diff --git a/.github/workflows/web-search-production.yml b/.github/workflows/web-search-production.yml index ee2a8cb71..e331b1e64 100644 --- a/.github/workflows/web-search-production.yml +++ b/.github/workflows/web-search-production.yml @@ -60,9 +60,9 @@ jobs: npm test -- --coverage --coverageReporters=lcov --coverageDirectory=coverage/web-search - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: - file: ./coverage/web-search/lcov.info + files: ./coverage/web-search/lcov.info flags: web-search name: web-search-coverage @@ -89,12 +89,14 @@ jobs: args: --severity-threshold=high --file=packages/web-search/package.json - name: Run CodeQL analysis - uses: github/codeql-action/init@v2 + if: ${{ vars.ENABLE_ADVANCED_CODEQL == '1' }} + uses: github/codeql-action/init@v4 with: languages: typescript, javascript - + - name: Perform CodeQL analysis - uses: github/codeql-action/analyze@v2 + if: ${{ vars.ENABLE_ADVANCED_CODEQL == '1' }} + uses: github/codeql-action/analyze@v4 # ============================================================================ # Performance and Load Testing @@ -135,7 +137,7 @@ jobs: npm run test:load -- packages/web-search - name: Upload performance results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: performance-results path: ./performance-results/ @@ -185,7 +187,7 @@ jobs: npm run test:integration -- --testNamePattern="${{ matrix.test-suite }}" - name: Upload test results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: name: integration-test-results-${{ matrix.test-suite }} @@ -246,7 +248,7 @@ jobs: npm run healthcheck:staging - name: Comment PR with staging URL - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | github.rest.issues.createComment({ @@ -351,7 +353,7 @@ jobs: npm run monitor:deployment-metrics - name: Notify deployment success - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | github.rest.repos.createCommitStatus({ @@ -395,7 +397,7 @@ jobs: npm run healthcheck:production - name: Notify rollback - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | github.rest.repos.createCommitStatus({ diff --git a/AGENTS.md b/AGENTS.md index 63dc8d29d..51603f22d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,6 +4,11 @@ - Never explicitly version source code without direct instruction. Source code is always implicitly versioned to the active Bitcode canon and current gate; routes, file names, CSS files, constants, classes, API paths, tests, and implementation identifiers must be written in-place as the single current Bitcode system. Do not introduce names such as `api/v1`, `v27-*`, `first-gate-*`, `wip-*`, or similar version/gate/work-in-progress source constructs unless explicitly directed for a bounded compatibility artifact. - Do not consider any legacy code. All legacy code is located under `_legacy/`. - Highest caliber software engineering crafstmanship (maintainibility, abstractions, architectures, naming, patterns, comments, documentation, structures, algorithmic and data flow designs, UI/UX, etc.), correctness (specification and implementation precision, reliability, completeness, boundaried, scoped, encapsulated, etc.), and auditable (totalistic proofs systems from static code, build time, runtime, etc. etc. as is Bitcode, tests from unit, integration, E2E, linting and building, etc.). +- Do not push work directly to `main`. Create a version base branch for each draft target, such as `version/v28`, then create scoped gate branches from that version branch. Gate branches must be prefixed with the gate number, such as `v28/gate-3-read-fit-workflow` or `v28/gate-8-promotion-proof`. Pull-request each closed gate back into the version branch. Pull-request the version branch into `main` only when all gates are closed and the version is formally promoted as canon. The default branch is protected by the `Bitcode Core Contributions` ruleset and requires pull requests plus verified signatures. +- Once implementation starts on a gate branch, do not stop at partial progress unless blocked by missing external input or explicit user pause. A gate branch is ready to stop only when the gate's acceptance criteria are implemented, specified, tested, documented, committed, pushed, and pull-requested for closure into the version branch. +- Treat gate and promotion workflow health as part of gate closure. Gate pull requests into version branches must be green through the maintained gate-quality checks, and repository-wide canon-quality checks must remain greenable during draft work. Version pull requests into `main` must pass the version promotion workflow, which performs promotion-grade validations and commits the standalone `BITCODE_SPEC.txt` pointer change only after those validations pass. +- Keep CI greenable rather than ceremonial. Required application CI uses root pnpm workspace installation and maintained uapi lint/typecheck/build/Jest coverage. Heavy legacy scans such as full DB/browser E2E, Storybook build, super-linter, and advanced CodeQL are opt-in by repository variables until their backing catalogs and service assumptions are maintained for required branch protection. +- Write quality commit messages that describe the grouped work, proof, or documentation change. Avoid generic messages such as `wip v28` unless the user explicitly asks for that exact temporary commit shape. ## The Bezalel Protocol: Sacred Craft for Coding Agents diff --git a/BITCODE_SPEC_V28.md b/BITCODE_SPEC_V28.md index 0b4fd84d0..40bd3588c 100644 --- a/BITCODE_SPEC_V28.md +++ b/BITCODE_SPEC_V28.md @@ -149,6 +149,10 @@ V28 requires: - compatibility storage carriers are hidden behind Bitcode vocabulary and registry-derived read models; - no new versioned UAPI route family is introduced; - implementation source remains implicitly versioned to the active canon and current gate: routes, file names, CSS, constants, tests, and identifiers must not introduce explicit version/gate/work-in-progress names without a bounded compatibility instruction; +- repository contribution flow uses a V28 version branch as the draft integration + branch, with scoped gate-number-prefixed branches opened from it and + pull-requested back into it only when their gate acceptance criteria are + implemented, specified, tested, documented, and ready for closure review; - value-bearing mainnet remains gated by explicit operational approval; - V29 Terminal depth, V30 Protocol/BTD hardening, V31 Auxillaries depth, V32 provation/testing depth, V33 interface depth beyond the V28 MVP, V34 deployment depth, V35 telemetry/documenting depth, and V36+ Exchange/Conversations depth remain staged unless V28 requires a narrow Protocol/Terminal/MCP/ChatGPT hook. @@ -317,6 +321,20 @@ Acceptance criteria: - source deposit, Read discovery, preliminary Fit, and uncommitted proof never imply minting. - access policy id/hash is shown before mint or licensed-read commitment. - ledgerized synthesis uses protocol-specified models and configuration; Terminal must not expose user-driven model selection for Fit, AssetPack, measurement, measuremint, proof, journal, or settlement behavior. +- gate pull requests into `version/v28` run maintained gate-quality automation + covering draft-canon checks, casing/import checks, package typechecks, + package tests, protocol-demonstration QA, and diff hygiene. +- repository-wide canon-quality automation stays greenable during the V28 draft + by checking V27 canonical inputs, V27/V28 posture, V28 draft-family shape, + and V28 MVP demonstration QA; full promoted-suite closure is reserved for + the V28 promotion workflow. +- application CI uses root pnpm workspace installation and maintains required + uapi lint, typecheck, production build, and mocked Jest coverage checks; + full DB/browser E2E, Storybook build, super-linter, and advanced CodeQL are + explicit variable-enabled validations until their catalogs are maintained + enough to be promoted into always-on branch protection. +- the legacy GA1 workflow is removed; version-specific quality and promotion + workflows own V28 gate and promotion automation. #### Single-deposit Reading QA @@ -574,15 +592,41 @@ Read/Fit result review remains fail-closed: cannot close a live source-revision settlement/finality gate unless the same source and database/ledger rows are read back from the accepted environment. -### Gate 4: Terminal AssetPack Range Detail +### Gate 4: Staged Reading, AssetPack Preview, And Settlement UX Purpose: -Make AssetPack range ownership and read-right state readable from registry facts. +Finish the two-stage Reading product experience: synthesize a Read-Need from a +reader request, let the reader review that Need, run Need-Fit search and +AssetPack synthesis from the accepted Need, preview the fit without leaking +protected source, settle the deterministic BTC fee, and deliver the purchased +AssetPack as a pull request. Acceptance criteria: -- Terminal exposes AssetPack id, range boundaries, cell count, proof root, source manifest root, access policy id/hash, and ledger anchor state. -- owner-read, licensed-read, and denied branches are distinct. +- Terminal separates Read Request, Read-Need review, Need-Fit search, + AssetPack preview, BTC settlement, unlock, and pull-request delivery into + navigable user-visible stages. +- the Read-Need synthesis pipeline stores prompt inputs, interpolated context, + model outputs, parsed Need, measurement root, review state, feedback history, + and resynthesis attempts. +- the Need-Fit pipeline accepts only reviewed Read-Needs, searches deposited + supply, ranks source-bound candidates, synthesizes the AssetPack, and emits + fit/no-fit/blocked evidence with candidate, score, proof, and rejection + telemetry. +- AssetPack preview exposes measurements, score posture, fit rationale, roots, + fee quote, range projection, and disclosure policy without exposing protected + source before settlement. +- Share-to-Fee calculation is implemented as an auditable structured policy: + measurement weights, measurement volumes, admitted fit quality, floor/dust + rules, BTC network fee posture, and final quote roots are stored and tested. +- settlement requires reader BTC payment authorization and readback of fee, + BTD ownership/license, journal, anchor, range, and database projection rows + before unlock. +- Terminal exposes AssetPack id, range boundaries, cell count, proof root, + source manifest root, access policy id/hash, ledger anchor state, and the + pull-request delivery target after settlement. +- owner-read, licensed-read, pending-settlement, and denied branches are + distinct. - aggregate compatibility balances are not treated as canonical ownership truth. - route and UI labels describe AssetPack ranges and read rights, not fungible balances. @@ -637,7 +681,10 @@ Acceptance criteria: - package/API, ORM, protocol-demonstration, UAPI route, Terminal UI, and build checks pass. - unversioned-route scan passes. - V29 Terminal depth, V30 Protocol/BTD hardening, V31 Auxillaries depth, V32 provation/testing depth, V33 interface depth beyond the V28 MVP, V34 deployment depth, V35 telemetry/documenting depth, and V36+ Exchange/Conversations depth are explicitly staged. -- `BITCODE_SPEC.txt` remains V27 until the final promotion step. +- a V28 version-branch pull request into `main` runs promotion-grade + automation; only after those validations pass does automation commit the + standalone `BITCODE_SPEC.txt` pointer change. +- `BITCODE_SPEC.txt` remains V27 until the final automated promotion step. ## Draft Boundary @@ -782,6 +829,20 @@ Settlement cannot proceed unless the previewed AssetPack id, fee quote, BTD range projection, wallet authorization, BTC fee transaction, ownership boundary, journal entry, and ledger/database readback all agree. +The product pipeline now carries a typed `bitcode.read.need` object before +Need-Fit search. The Need object contains `needId`, `measurementRoot`, +requirements, closure criteria, failure modes, target artifact kinds, source +constraints, proof expectations, pricing measurement inputs, review state, and +feedback history. Strict Need-Fit execution is admitted only when +`acceptedReadNeed` is present and has `reviewState='accepted'`; otherwise the +pipeline returns `blocked_readiness` before depository candidate recall. The +Vercel Sandbox harness synthesizes and accepts a Need before invoking the +bounded source-bound AssetPack pipeline so the closed staging-testnet evidence +path remains runnable while Terminal moves to the separate user review step. +`BITCODE_PIPELINE_REQUIRE_ACCEPTED_READ_NEED=1` or request-level +`requireAcceptedReadNeed=true` activates the strict boundary for API and route +callers. + The protocol demonstration carries only the minimal deterministic witness of this path: local Need synthesis, explicit Need acceptance, local Need-Fit ranking over fixture deposits, source-safe preview, and deterministic fee-quote @@ -932,11 +993,11 @@ Promotion must add `.bitcode/v28-spec-family-report.json`, `.bitcode/v28-canonic ## validation canon -Minimum V28 validation includes spec-family checks, canon-posture drift checks, JSON checks, unversioned-route scan, package/API/ORM tests, protocol-demonstration tests, Terminal UI checks, commercial-MVP Playwright E2E tests, UAPI build, and `git diff --check`. +Minimum V28 validation includes spec-family checks, canon-posture drift checks, JSON checks, unversioned-route scan, package/API/ORM tests, protocol-demonstration tests, Terminal UI checks, commercial-MVP Playwright E2E tests, UAPI build, gate-quality workflow checks, version-promotion workflow checks, and `git diff --check`. ## promotion canon -Promotion requires V28 PROVEN, synchronized SPEC/DELTA/NOTES/PARITY, closed gates, route scan, test/build proof, and explicit update of `BITCODE_SPEC.txt` from `V27` to `V28`. +Promotion requires V28 PROVEN, synchronized SPEC/DELTA/NOTES/PARITY, closed gates, route scan, test/build proof, pull-requested integration from gate-number-prefixed branches into the V28 version branch, and automated update of `BITCODE_SPEC.txt` from `V27` to `V28` only after the V28 version branch is pull-requested into `main` and promotion validations succeed. ## appendices and canonical supporting material diff --git a/BITCODE_SPEC_V28_PARITY_MATRIX.md b/BITCODE_SPEC_V28_PARITY_MATRIX.md index 16eb59d4b..440e77ea0 100644 --- a/BITCODE_SPEC_V28_PARITY_MATRIX.md +++ b/BITCODE_SPEC_V28_PARITY_MATRIX.md @@ -129,17 +129,17 @@ It links manual screenshots, console logs, server logs, Supabase SQL checks, and | Area | Current source evidence | Judgment | Gate owner | | --- | --- | --- | --- | -| Protocol/Terminal MVP route QA | `/`, `/terminal`, `/auxillaries/*`, `/btd/[assetPackId]`, MCP API, ChatGPT App, and the public `/docs` article map are the V28 route QA scope; prior Exchange and website Conversations E2E coverage is now historical/deferred and must not be required for V28 closure; the prior generic workspace route is fully retired and redirects to `/terminal` | partial; existing E2E suite must be narrowed or split so V28 proof excludes Exchange and website Conversations while retaining Terminal/Protocol/Auxillaries/BTD/MCP/ChatGPT coverage | Gate 2 | +| Protocol/Terminal MVP route QA | `/`, `/terminal`, `/auxillaries/*`, `/btd/[assetPackId]`, MCP API, ChatGPT App, and the public `/docs` article map are the V28 route QA scope; prior Exchange and website Conversations E2E coverage is now historical/deferred and must not be required for V28 closure; the prior generic workspace route is fully retired and redirects to `/terminal`. Existing E2E suite must be narrowed or split so V28 proof excludes Exchange and website Conversations while retaining Terminal/Protocol/Auxillaries/BTD/MCP/ChatGPT coverage. | substantially advanced | Gate 2 | | Signed-in BTD balance widget uses V28 commercial semantics | `uapi/components/base/bitcode/btd/btd-tracker.tsx`, `uapi/components/base/bitcode/layout/nav.tsx`, `uapi/hooks/useUserData.ts`, `packages/api/src/routes/auxillaries-contract.ts`, `protocol-demonstration/test/v28-commercial-mvp-qa.test.js`, manual QA screenshots May 6 2026 | closed | Gate 2 | -| BTD balance widget opens wallet-owned Wallet auxillary state | `uapi/components/base/bitcode/btd/btd-tracker.tsx`, `uapi/components/base/bitcode/layout/nav.tsx`, `protocol-demonstration/test/v28-commercial-mvp-qa.test.js` | updated for May 9 QA: connected wallet identity replaces Exchange-oriented acquisition, and clicking opens the Wallet auxillary pane while Exchange acquisition is deferred beyond V35 | Gate 2 | -| Auxillaries old orbital shell conflicts removed from active contained tabs-left experience | May 7 manual QA reports no active old orbital shell collision and selectable panes; May 9 manual QA found unauthenticated non-mock `Connect Wallet` still opening the old shell, initial Profile scroll instability, duplicate selector titles, visible Save buttons, Wallet pane hierarchy/overflow/activity gaps, notification footer clutter, and inconsistent mock/non-mock prerequisite posture. Source now routes all portal overlays through the contained shell, removes selector lane-label duplication, moves overlay controls top-right, removes visible auxillary Save buttons in favor of autosave, stabilizes first-open Profile scroll, removes the notification footer Auxillaries launcher, reserves selector hover headroom, makes Bitcoin wallet identity the first required Wallet action, makes GitHub second for Deposit/Read repository scope in Externals, makes email optional Profile posture, promotes BTD/BTC stat hierarchy, moves stat explanations to tooltips/accessibility labels, and keeps the shared Terminal/Protocol activity table grammar in the Wallet pane. | partial; source fixes landed, automated smoke confirms non-mock contained shell parity, next manual QA must confirm visual/runtime closure in staging-testnet | Gate 2 | -| Wallet-first Bitcoin authentication | `uapi/app/auxillaries/components/AuxillariesWalletPane.tsx`, `uapi/app/auxillaries/components/AuxillariesSurface.tsx`, `uapi/app/api/wallet/authenticate/route.ts`, `uapi/lib/bitcoin-wallet-client.ts`, `uapi/lib/bitcode-wallet-local.ts`, `uapi/tests/bitcoinWalletClient.test.ts`, `uapi/tests/e2e/commercial-mvp.auxillaries.spec.ts`, `supabase/migrations/003_user_connections_provider_scope.sql`, `uapi/tests/api/walletAuthenticateRoute.test.ts` | partial; implemented and unit-tested for Bitcoin-provider admission, Xverse/Sats Connect priority, Leather direct-provider support, provider-specific Wallet actions, payment/auth address distinction, and persistence posture, with local staging fallback when backend auth is unavailable. Browser smoke with a stubbed Leather provider verifies the click path calls `getAddresses` and `signMessage`. Contained Auxillaries suppresses progressive onboarding completion during Wallet connection and does not call onboarding persistence. Pending live staging-testnet QA with Xverse Testnet4, Leather testnet, provider-constraint migration, and GitHub connection credentials. MetaMask's Ethereum provider is explicitly rejected for this Bitcoin identity path. | Gate 2 / Gate 3 | -| Active Auxillaries naming avoids `orbitals` residue | `uapi/config/featureFlags.ts`, `uapi/lib/mock-review-mode.ts`, `uapi/app/terminal/TerminalOpenAuxillariesButton.tsx`, `uapi/components/base/bitcode/layout/user-menu.tsx`, and related tests now use Auxillaries naming; redirect-only `/orbitals/*` compatibility and inert stylesheet carriers remain bounded as compatibility/styling until separately removed | partial; active touched names closed, remaining CSS/compatibility carriers tracked for later cleanup | Gate 2 | -| Standalone demonstration and commercial protocol source are separated | `packages/protocol` is the formal commercial protocol package; `uapi/package.json` depends on `@bitcode/protocol`; `pnpm-workspace.yaml` no longer includes `protocol-demonstration`; `uapi/tests/protocolCommercialBoundary.test.ts` and `protocol-demonstration/test/v28-boundary-separation.test.js` lock no commercial imports from the standalone demonstration and no demonstration runtime imports from commercial packages/UAPI | partial; V28 keeps this as an active closure area because remaining demonstration-derived behavior needed by commercial Terminal/MCP/ChatGPT must live in packages/UAPI, not runtime imports from `protocol-demonstration/` | Gate 2 / Gate 8 | -| Terminal big-picture operator orientation | `/terminal`, `uapi/app/terminal/TerminalTransactionWorkspace.tsx`, `uapi/app/terminal/TerminalMvpMap.tsx`, `uapi/components/base/bitcode/execution/BitcodeTransactionsOverview.tsx`, and `uapi/tests/e2e/commercial-mvp.terminal.spec.ts` now frame Terminal as recent/scoped Deposit/Read activity plus selected result, not Exchange master-detail; bare `/terminal` no longer auto-mutates during public nav while explicit route context remains addressable, and the old Terminal route redirects without becoming a canonical product route | partial; architectural correction, route-stability fixes, and known digest action no-ops implemented, next manual QA must judge digestibility | Gate 2 / Gate 3 | -| Source names remain implicitly versioned to active canon | `AGENTS.md`, `uapi/app/terminal/demonstration-witness-scoped-styles/route.ts`, `uapi/app/terminal/demonstration-witness-styles/route.ts`, `uapi/app/terminal/demonstration-witness-scoped-styles/route.ts`, `uapi/app/terminal/demonstration-witness-styles/route.ts`, `uapi/app/terminal/demonstration-witness-theme-overrides.ts`, and `uapi/tests/demonstrationWitnessScopedStylesRoute.test.ts` replace explicit gate-named stylesheet route/source carriers with precise unversioned demonstration-witness names | closed for touched active UAPI demonstration witness stylesheet source | Gate 2 | -| Exchange product scope | `uapi/app/exchange/*` and Exchange-specific E2E coverage exist from earlier V28 work | deferred beyond V35; V28 must disable/hide Exchange in QA and must not require Exchange route/product behavior for closure | V36+ | -| Website Conversations product scope | `uapi/app/conversations/*` and Conversations-specific E2E coverage exist from earlier V28 work | deferred beyond V35; V28 must disable/hide website Conversations in QA and must not require Conversations route/product behavior for closure | V36+ | +| BTD balance widget opens wallet-owned Wallet auxillary state | `uapi/components/base/bitcode/btd/btd-tracker.tsx`, `uapi/components/base/bitcode/layout/nav.tsx`, `protocol-demonstration/test/v28-commercial-mvp-qa.test.js`; May 9 QA updated the path so connected wallet identity replaces Exchange-oriented acquisition, and clicking opens the Wallet auxillary pane while Exchange acquisition is deferred beyond V35. | substantially advanced | Gate 2 | +| Auxillaries old orbital shell conflicts removed from active contained tabs-left experience | May 7 manual QA reports no active old orbital shell collision and selectable panes; May 9 manual QA found unauthenticated non-mock `Connect Wallet` still opening the old shell, initial Profile scroll instability, duplicate selector titles, visible Save buttons, Wallet pane hierarchy/overflow/activity gaps, notification footer clutter, and inconsistent mock/non-mock prerequisite posture. Source now routes all portal overlays through the contained shell, removes selector lane-label duplication, moves overlay controls top-right, removes visible auxillary Save buttons in favor of autosave, stabilizes first-open Profile scroll, removes the notification footer Auxillaries launcher, reserves selector hover headroom, makes Bitcoin wallet identity the first required Wallet action, makes GitHub second for Deposit/Read repository scope in Externals, makes email optional Profile posture, promotes BTD/BTC stat hierarchy, moves stat explanations to tooltips/accessibility labels, and keeps the shared Terminal/Protocol activity table grammar in the Wallet pane. Automated smoke confirms non-mock contained shell parity; next manual QA must confirm visual/runtime closure in staging-testnet. | substantially advanced | Gate 2 | +| Wallet-first Bitcoin authentication | `uapi/app/auxillaries/components/AuxillariesWalletPane.tsx`, `uapi/app/auxillaries/components/AuxillariesSurface.tsx`, `uapi/app/api/wallet/authenticate/route.ts`, `uapi/lib/bitcoin-wallet-client.ts`, `uapi/lib/bitcode-wallet-local.ts`, `uapi/tests/bitcoinWalletClient.test.ts`, `uapi/tests/e2e/commercial-mvp.auxillaries.spec.ts`, `supabase/migrations/003_user_connections_provider_scope.sql`, `uapi/tests/api/walletAuthenticateRoute.test.ts`; implemented and unit-tested for Bitcoin-provider admission, Xverse/Sats Connect priority, Leather direct-provider support, provider-specific Wallet actions, payment/auth address distinction, and persistence posture, with local staging fallback when backend auth is unavailable. Browser smoke with a stubbed Leather provider verifies the click path calls `getAddresses` and `signMessage`. Contained Auxillaries suppresses progressive onboarding completion during Wallet connection and does not call onboarding persistence. Pending live staging-testnet QA with Xverse Testnet4, Leather testnet, provider-constraint migration, and GitHub connection credentials. MetaMask's Ethereum provider is explicitly rejected for this Bitcoin identity path. | substantially advanced | Gate 2 / Gate 3 | +| Active Auxillaries naming avoids `orbitals` residue | `uapi/config/featureFlags.ts`, `uapi/lib/mock-review-mode.ts`, `uapi/app/terminal/TerminalOpenAuxillariesButton.tsx`, `uapi/components/base/bitcode/layout/user-menu.tsx`, and related tests now use Auxillaries naming; redirect-only `/orbitals/*` compatibility and inert stylesheet carriers remain bounded as compatibility/styling until separately removed. Remaining CSS/compatibility carriers are tracked for later cleanup. | substantially advanced | Gate 2 | +| Standalone demonstration and commercial protocol source are separated | `packages/protocol` is the formal commercial protocol package; `uapi/package.json` depends on `@bitcode/protocol`; `pnpm-workspace.yaml` no longer includes `protocol-demonstration`; `uapi/tests/protocolCommercialBoundary.test.ts` and `protocol-demonstration/test/v28-boundary-separation.test.js` lock no commercial imports from the standalone demonstration and no demonstration runtime imports from commercial packages/UAPI. V28 keeps this as an active closure area because remaining demonstration-derived behavior needed by Terminal/MCP/ChatGPT must live in packages/UAPI, not runtime imports from `protocol-demonstration/`. | substantially advanced | Gate 2 / Gate 8 | +| Terminal big-picture operator orientation | `/terminal`, `uapi/app/terminal/TerminalTransactionWorkspace.tsx`, `uapi/app/terminal/TerminalMvpMap.tsx`, `uapi/components/base/bitcode/execution/BitcodeTransactionsOverview.tsx`, and `uapi/tests/e2e/commercial-mvp.terminal.spec.ts` now frame Terminal as recent/scoped Deposit/Read activity plus selected result, not Exchange master-detail; bare `/terminal` no longer auto-mutates during public nav while explicit route context remains addressable, and the old Terminal route redirects without becoming a canonical product route. Next manual QA must judge digestibility. | substantially advanced | Gate 2 / Gate 3 | +| Source names remain implicitly versioned to active canon | `AGENTS.md`, `uapi/app/terminal/demonstration-witness-scoped-styles/route.ts`, `uapi/app/terminal/demonstration-witness-styles/route.ts`, `uapi/app/terminal/demonstration-witness-scoped-styles/route.ts`, `uapi/app/terminal/demonstration-witness-styles/route.ts`, `uapi/app/terminal/demonstration-witness-theme-overrides.ts`, and `uapi/tests/demonstrationWitnessScopedStylesRoute.test.ts` replace explicit gate-named stylesheet route/source carriers with precise unversioned demonstration-witness names. | closed | Gate 2 | +| Exchange product scope | `uapi/app/exchange/*` and Exchange-specific E2E coverage exist from earlier V28 work. V28 must disable/hide Exchange in QA and must not require Exchange route/product behavior for closure; deeper Exchange scope is deferred beyond V35. | accepted boundary | V36+ | +| Website Conversations product scope | `uapi/app/conversations/*` and Conversations-specific E2E coverage exist from earlier V28 work. V28 must disable/hide website Conversations in QA and must not require Conversations route/product behavior for closure; deeper Conversations scope is deferred beyond V35. | accepted boundary | V36+ | | Terminal wallet connection and signer-session review | `packages/btd/src/wallet.ts`; profile and wallet API readiness helpers | implemented prerequisite | Gate 3 | | BTC fee PSBT handoff and finality display | `packages/btd/src/bitcoin-fees.ts`, `bitcoin-provider.ts`, `/api/btd/btc-fee-transaction` | implemented prerequisite | Gate 3 | | Read review before Fit review | application/executions Read components and internal Terminal notes | implemented prerequisite | Gate 3 | @@ -150,15 +150,15 @@ It links manual screenshots, console logs, server logs, Supabase SQL checks, and | Terminal journal rows as transaction detail | `terminal-journal.ts`, terminal-journal route | implemented prerequisite | Gate 5 | | ledger/database reconciliation as operator read | `reconciliation.ts`, reconciliation route | implemented prerequisite | Gate 5 | | organization holdings and read-license usage from registry | organization BTD models plus V27 registry docs | pending | Gate 6 | -| MCP authorization based on range/read-license/policy truth | MCP holding-gate work remains aggregate-compatibility oriented | pending; retained in V28 MVP scope | Gate 6 | -| ChatGPT App authorization based on range/read-license/policy truth | ChatGPT App MVP parity must use the same registry-derived access posture as MCP and Terminal | gap; retained in V28 MVP scope | Gate 6 | -| Deterministic model posture for ledgerized synthesis | `uapi/app/auxillaries/components/AuxillariesInterfacesPane.tsx` and `uapi/app/auxillaries/components/models/GlobalModelSelection.tsx` still expose broad user-driven model preferences; V28 SPEC now forbids user-selected models for Fit, AssetPack, semantic measurement, measuremint, proof, journal, and settlement paths | gap; remove, hide, or scope model selection to non-ledgerized conversation UX before promotion | Gate 3 / Gate 8 | +| MCP authorization based on range/read-license/policy truth | MCP holding-gate work remains aggregate-compatibility oriented; retained in V28 MVP scope. | pending | Gate 6 | +| ChatGPT App authorization based on range/read-license/policy truth | ChatGPT App MVP parity must use the same registry-derived access posture as MCP and Terminal; retained in V28 MVP scope. | not yet implemented | Gate 6 | +| Deterministic model posture for ledgerized synthesis | `uapi/app/auxillaries/components/AuxillariesInterfacesPane.tsx` and `uapi/app/auxillaries/components/models/GlobalModelSelection.tsx` still expose broad user-driven model preferences; V28 SPEC now forbids user-selected models for Fit, AssetPack, semantic measurement, measuremint, proof, journal, and settlement paths. Remove, hide, or scope model selection to non-ledgerized conversation UX before promotion. | not yet implemented | Gate 3 / Gate 8 | | access-policy legal templates | policy id/hash exists; full templates not complete | pending | Gate 6 | | deployment lanes and telemetry surfaced in Terminal | `deployment-lanes.ts`, `telemetry.ts`, deployment-readiness route | implemented prerequisite | Gate 7 | -| migration/type refresh visible as readiness | V27 migrations and dashboard RLS migration are applied/aligned in staging Supabase; generated type refresh is deferred | partial; migration parity closed, generated types pending | Gate 7 | +| migration/type refresh visible as readiness | V27 migrations and dashboard RLS migration are applied/aligned in staging Supabase; generated type refresh is deferred. | substantially advanced | Gate 7 | | GitHub-only provider readiness disclosed | `internal-docs/INTEGRATIONS.md` shows GitHub implemented and broader providers incomplete | implemented prerequisite | Gate 7 | -| BTD-AssetPack testnet minting and ledgerized synthetic measurement | V27 package primitives exist for measuremint, range, receipts, ledger anchors, Terminal journal, and reconciliation | partial; V28 must prove realistic testnet or testnet-readiness flow with synthetic measurement, BTD-AssetPack mint/read state, journal rows, ledger anchors or blocked ledger readiness, and projection/reconciliation readback | Gate 3 / Gate 5 / Gate 7 | -| Taproot/BNB/Binance research posture | current V28 sources center Bitcoin wallet/PSBT/Taproot-compatible providers; no BSC/opBNB/BEP-20/Binance Web3 Wallet BTD deployment artifact is bound | deferred; V28 documents Bitcoin/Taproot-first testnet posture and records BSC/opBNB/Binance/BitVM bridge pilots as future bridge/distribution work unless proof-bound artifacts are added | Gate 7 / V36+ | +| BTD-AssetPack testnet minting and ledgerized synthetic measurement | V27 package primitives exist for measuremint, range, receipts, ledger anchors, Terminal journal, and reconciliation. V28 must prove realistic testnet or testnet-readiness flow with synthetic measurement, BTD-AssetPack mint/read state, journal rows, ledger anchors or blocked ledger readiness, and projection/reconciliation readback. | substantially advanced | Gate 3 / Gate 5 / Gate 7 | +| Taproot/BNB/Binance research posture | current V28 sources center Bitcoin wallet/PSBT/Taproot-compatible providers; no BSC/opBNB/BEP-20/Binance Web3 Wallet BTD deployment artifact is bound. V28 documents Bitcoin/Taproot-first testnet posture and records BSC/opBNB/Binance/BitVM bridge pilots as future bridge/distribution work unless proof-bound artifacts are added. | accepted boundary | Gate 7 / V36+ | ## V28 implementation checklist @@ -167,13 +167,13 @@ It links manual screenshots, console logs, server logs, Supabase SQL checks, and | Draft family | SPEC, DELTA, NOTES, PARITY exist | closed | | Canon posture | V27 active / V28 draft in source posture carriers | closed | | Routes | unversioned UAPI route scan passes | closed | -| Commercial Protocol/Terminal QA | primary route, auth, Auxillaries, BTD range, Terminal, MCP/ChatGPT App, docs article map, responsive health, URL-addressable Terminal filters, consent persistence, and stitched navigation/interaction E2E coverage | partial; needs E2E and QA command narrowing after Exchange/Conversations deferral | -| Auxillaries shell | contained tabs-left active experience without orbital layout collision, no visible auxillary Save buttons, stable first-open pane scroll, top-right overlay controls, no notification-footer Auxillaries launcher, Wallet-first authentication, Externals-second source-provider order, Externals rendering from wallet identity before optional email/Supabase persistence, optional Profile email-third posture, consistent mock/non-mock pane order, and Wallet pane BTD activity/table readability | pending manual reconfirmation after Wallet/Externals rename and ownership fixes | -| Exchange MVP | no longer part of V28 | deferred beyond V35 | -| Terminal master-detail correction | Terminal must present itself as a Deposit/Read operator surface with recent/scoped activity results while Exchange owns the searchable master-detail activity table and selected detail | closed pending next manual QA confirmation | -| Terminal clickable affordance | Known no-op or ambiguous click targets must be fixed, and clickable controls must be visually distinguishable from static badges/chips | partial; digest detail buttons and static overview badges corrected, broader manual pass remains | -| Exchange selected activity detail completeness | no longer part of V28 | deferred beyond V35 | -| Conversations route QA | no longer part of V28 | deferred beyond V35 | +| Commercial Protocol/Terminal QA | primary route, auth, Auxillaries, BTD range, Terminal, MCP/ChatGPT App, docs article map, responsive health, URL-addressable Terminal filters, consent persistence, and stitched navigation/interaction E2E coverage; needs E2E and QA command narrowing after Exchange/Conversations deferral. | substantially advanced | +| Auxillaries shell | contained tabs-left active experience without orbital layout collision, no visible auxillary Save buttons, stable first-open pane scroll, top-right overlay controls, no notification-footer Auxillaries launcher, Wallet-first authentication, Externals-second source-provider order, Externals rendering from wallet identity before optional email/Supabase persistence, optional Profile email-third posture, consistent mock/non-mock pane order, and Wallet pane BTD activity/table readability. Manual reconfirmation after Wallet/Externals rename and ownership fixes remains required. | pending | +| Exchange MVP | no longer part of V28; deferred beyond V35. | accepted boundary | +| Terminal master-detail correction | Terminal must present itself as a Deposit/Read operator surface with recent/scoped activity results while Exchange owns the searchable master-detail activity table and selected detail. Next manual QA confirmation remains required. | substantially advanced | +| Terminal clickable affordance | Known no-op or ambiguous click targets must be fixed, and clickable controls must be visually distinguishable from static badges/chips. Digest detail buttons and static overview badges corrected; broader manual pass remains. | substantially advanced | +| Exchange selected activity detail completeness | no longer part of V28; deferred beyond V35. | accepted boundary | +| Conversations route QA | no longer part of V28; deferred beyond V35. | accepted boundary | | Terminal wallet | wallet and signer-session UX built over V27 primitives | pending | | Terminal BTC fees | PSBT/finality UX built over V27 primitives | pending | | Terminal Read/Fit | Read, Fit, semantic volume, measuremint, policy UX | pending | diff --git a/BITCODE_V28_QA.md b/BITCODE_V28_QA.md index 7ac0ecb7d..63b981673 100644 --- a/BITCODE_V28_QA.md +++ b/BITCODE_V28_QA.md @@ -1363,6 +1363,28 @@ a synchronous route, raw-prompt Read, or source-leaking preview model. | Settle and unlock | Deterministic Share-to-Fee and BTD settlement. | Price is derived from `sum(measurement_weight * measurement_volume * admitted_fit_quality)` and the staging fee schedule. Reader pays BTC fee, BTD range/ownership/license/journal/anchor rows are written and read back, then full AssetPack source/right surface is unlocked. | | Full-profile async pipeline | Run the full PTRR profile for long-running audits. | Vercel Sandbox execution may run for dozens of minutes and must push completion artifacts to a server-side stream/socket handler or durable queue; the push is run-id correlated, authenticated, idempotent, and durable before sandbox stop. Terminal can reattach and read final state without the starter route waiting. | +2026-05-18 implementation start for the staged Reading gate: + +- `@bitcode/pipeline-asset-pack` now owns a typed `bitcode.read.need` + contract with `needId`, `measurementRoot`, requirements, closure criteria, + failure modes, target artifact kinds, source constraints, proof + expectations, pricing measurement inputs, review state, and feedback + history. +- Strict Need-Fit search blocks before depository candidate recall unless an + accepted Need is present. The blocked state is explicit + `blocked_readiness` with `accepted_read_need_missing`. +- The depository search path consumes accepted Need source constraints and + measurement roots as the Fit search input, rather than raw prompt text, when + `acceptedReadNeed` is supplied. +- The Vercel Sandbox harness now lists Need stages in the manifest and + synthesizes plus accepts a Need before invoking the existing source-bound + AssetPack pipeline. This preserves the current proven staging-testnet path + while Terminal is split into user-visible Need review and Need-Fit execution + steps. +- `buildShareToFeePreview` provides the initial source-safe quote shape from + accepted Need measurement vector and admitted Fit quality: + `sum(measurement.weight * measurement.volume * admitted_fit_quality)`. + Observed staging-testnet harness evidence on 2026-05-17: - Vercel Sandbox run `sbx_ktb5Z6VnP5A16m9k4a0FkBcJg1d3` completed all six diff --git a/README.md b/README.md index 606932728..37f4826f6 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,43 @@ App. - Update source in-place to match the active canon and current draft target. - Keep specification notes, QA ledgers, tests, and implementation synchronized. +## Contributor Workflow + +The default branch is protected by the active `Bitcode Core Contributions` +ruleset. Direct pushes to `main` are not part of the normal workflow; expect +them to be rejected because changes must arrive through pull requests and +verified signatures. + +Use a version branch and gate-numbered branches: + +1. Create one base branch per draft target, such as `version/v28`. +2. Create scoped gate branches from the version branch. Prefix every gate branch + with the gate number, for example `v28/gate-3-read-fit-workflow` or + `v28/gate-8-promotion-proof`. +3. Group related work into clear commits with descriptive commit messages. +4. Continue on the gate branch until that gate's acceptance criteria are + implemented, specified, tested, documented, committed, pushed, and ready for + closure review. +5. Open pull requests from gate branches into the version branch as gates close. +6. Open the version branch back into `main` only after all gates close and the + version is formally promoted as canon. + +Gate pull requests into `version/**` run the Bitcode gate-quality workflow: +draft-canon checks, casing/import checks, relevant package typechecks and Jest +suites, protocol-demonstration QA, and diff hygiene. The repository-wide canon +quality workflow stays green during draft work by checking active/draft posture +and MVP demonstration proof, while full promoted-suite closure is reserved for +the version promotion workflow. Version pull requests into `main` run the +version promotion workflow. For V28, that workflow validates the promotion proof +posture and, only after promotion validations pass, commits the standalone +`BITCODE_SPEC.txt` pointer change from `V27` to `V28` on the version branch. +The application CI workflow uses the root pnpm workspace install, runs uapi +lint/typecheck/build plus mocked Jest coverage, and keeps heavier legacy scans +explicitly opt-in until their catalogs are refurbished: set +`ENABLE_FULL_DB_E2E`, `ENABLE_STORYBOOK_BUILD`, `ENABLE_SUPER_LINTER`, or +`ENABLE_ADVANCED_CODEQL` when those checks are intentionally part of a branch +or promotion validation. + ## Key Surfaces - [BITCODE_SPEC.txt](BITCODE_SPEC.txt) is the canonical version pointer. diff --git a/packages/api/src/routes/__tests__/user-btd-mutation.test.ts b/packages/api/src/routes/__tests__/user-btd-mutation.test.ts index 9490618e8..206b9f981 100644 --- a/packages/api/src/routes/__tests__/user-btd-mutation.test.ts +++ b/packages/api/src/routes/__tests__/user-btd-mutation.test.ts @@ -121,7 +121,7 @@ describe('user BTD mutation route', () => { expect(response.status).toBe(410); expect(body.error).toContain('non-fungible asset-pack share/read-right'); - expect(body.acquisitionPaths.terminalNeedMinting).toContain('/terminal'); + expect(body.acquisitionPaths.terminalReadMinting).toContain('/terminal'); expect(mockSendServerEvent).toHaveBeenCalledWith('generic_btd_mutation_rejected', { admin_id: 'admin-1', reason: 'btd_is_non_fungible_asset_pack_share_read_right', diff --git a/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-api-reference.md b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-api-reference.md new file mode 100644 index 000000000..cc406a98f --- /dev/null +++ b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-api-reference.md @@ -0,0 +1,490 @@ +# Bitcode MCP API Reference + +**Technical knowledge exchange platform exposing comprehensive capabilities through MCP** + +## Overview + + +- **MCP Version**: 2024-11-05 + +## Tool Categories + +### Pipeline Management + +Core SDIVF pipeline execution with PTRR agent coordination + +#### `bitcode://pipelines/asset-pack/create` + +Create and execute a Bitcode asset-pack pipeline for complete software engineering reads. + +This is Bitcode's most powerful pipeline, capable of: +• Feature implementation with written assets and optional pull request delivery +• Comprehensive code reviews with detailed suggestions +• Bug fixes with root cause analysis and testing +• Technical documentation and blog posts +• Architecture diagrams and API specifications +• Frontend scaffolding for React/Vue/Angular +• Project scope analysis and implementation planning +• Code refactoring proposals with impact analysis + +Supports multimodal inputs including Figma designs, documents, images, audio, and video. +Real-time streaming provides live updates during read measurement, asset synthesis, validation, Finish, and connected-interface delivery readiness. + +Admitted subtypes: +• pull_request - Complete feature implementation with PR +• pr_review - Comprehensive code review with suggestions +• issue - Bug analysis and fixes with testing +• comment - Code explanation and documentation +• blog_post - Technical writing and documentation +• diagram - Architecture and flow diagrams +• api_spec - OpenAPI specification generation +• frontend_scaffolder - Component scaffolding +• scope_analysis - Project complexity analysis +• implementation_plan - Detailed technical planning +• refactor_proposal - Code improvement recommendations + +**Complexity**: expert | **Measured BTD Estimate**: 200 $BTD + +**Example**: +```json +{ + "task": "Create a reusable Modal component with animations and accessibility features", + "repository": { + "owner": "acme-corp", + "name": "web-app" + }, + "subtype": "full_feature", + "streaming": true +} +``` + +--- + +### Advanced Intelligence + +ML-powered effectiveness tracking and cross-repository learning + +#### `bitcode://intelligence/effectiveness/track` + +Effectiveness tracking system with real-time quality measurement. + +This system provides measurable insight into code change effectiveness: +• Real-time before/after quality measurement +• ML-powered effectiveness prediction for proposed changes +• Continuous learning from outcome data to improve recommendations +• Optimization recommendations for target quality metrics + +Enables effectiveness-driven development with measurable quality improvements. + +**Complexity**: expert | **Measured BTD Estimate**: 150 $BTD + +--- + +#### `bitcode://intelligence/cross-repo/learn` + +Advanced cross-repository learning engine for pattern discovery and propagation. + +Sophisticated pattern extraction and knowledge transfer: +• Extract successful patterns from high-performing repositories +• Intelligent pattern propagation with context adaptation +• Cross-repository similarity analysis and clustering +• Knowledge graph visualization of repository relationships +• Automated recommendations based on successful patterns + +Enables knowledge transfer and standardization across your entire codebase ecosystem. + +**Complexity**: advanced | **Measured BTD Estimate**: 150 $BTD + +--- + +#### `bitcode://intelligence/research/advanced` + +Multi-provider web research with URL intelligence and synthesis. + +Multi-wave research orchestration across diverse sources: +• GitHub, Stack Overflow, academic papers, documentation sites +• URL credibility assessment and content quality analysis +• Cross-source result synthesis and correlation +• Technology-aware query generation and refinement +• Real-time research quality assessment with gap analysis + +Provides comprehensive, credible research with intelligent synthesis. + +**Complexity**: expert | **Measured BTD Estimate**: 225 $BTD + +--- + +#### `bitcode://intelligence/multimodal/process` + +Comprehensive multimodal processing engine for all attachment types. + +Advanced multimodal intelligence processing: +• Image analysis with design pattern recognition +• Audio transcription and content analysis +• Video processing with scene understanding +• Document extraction with intelligent parsing +• Figma design analysis with implementation guidance +• Cross-modal synthesis for unified understanding + +Transforms any media type into actionable technical knowledge evidence. + +**Complexity**: expert | **Measured BTD Estimate**: 150 $BTD + +--- + +#### `bitcode://intelligence/enterprise/orchestrate` + +Enterprise intelligence orchestrator for organization-wide insights. + +Strategic enterprise intelligence coordination: +• Team productivity analysis with skill gap identification +• Knowledge mapping across departments and projects +• Collaboration pattern analysis and optimization +• Innovation metrics and strategic planning support +• Risk assessment with mitigation recommendations +• Industry benchmarking and competitive analysis + +Provides executive-level intelligence for strategic decision-making. + +**Complexity**: expert | **Measured BTD Estimate**: 150 $BTD + +--- + +#### `bitcode://intelligence/marketplace/analyze` + +Sophisticated marketplace and procurement intelligence system. + +Advanced solution discovery and quality assessment: +• AI-powered solution discovery with requirement matching +• Quality assessment with fraud detection and risk evaluation +• Provider analysis with reputation and performance tracking +• Price optimization recommendations with market analysis +• Trend analysis for technology adoption and pricing +• Competitive intelligence for strategic procurement + +Enables intelligent procurement with risk mitigation and value optimization. + +**Complexity**: advanced | **Measured BTD Estimate**: 150 $BTD + +--- + +### Enterprise Integration + +Webhook orchestration, API management, and marketplace intelligence + +#### `bitcode://enterprise/webhook/orchestrate` + +Advanced enterprise webhook orchestration with intelligent routing and transformation. + +Comprehensive webhook management system: +• Intelligent webhook routing with conditional logic +• Advanced authentication including HMAC and JWT validation +• Retry policies with exponential backoff and circuit breakers +• Rate limiting and traffic shaping for webhook endpoints +• Real-time analytics with performance monitoring +• Batch webhook operations for enterprise-scale automation +• Webhook transformation and payload filtering +• Enterprise-grade security with audit logging + +Enables sophisticated event-driven architectures with enterprise reliability. + +**Complexity**: expert | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://enterprise/api/manage` + +Complete enterprise API lifecycle management with governance and analytics. + +Full-featured API management platform: +• API versioning with semantic versioning and retirement management +• Comprehensive rate limiting with tiered access controls +• API governance with automated compliance checking +• Interactive documentation generation with OpenAPI 3.0 +• Advanced authentication schemes with OAuth2 and JWT support +• Performance monitoring with detailed analytics +• Automated testing with comprehensive test suite execution +• CORS configuration and security policy enforcement + +Provides enterprise-grade API management with governance and observability. + +**Complexity**: expert | **Measured BTD Estimate**: 113 $BTD + +--- + +#### `bitcode://enterprise/integration/marketplace` + +Enterprise integration marketplace with pre-built connectors and custom development. + +Comprehensive integration ecosystem: +• Browse and install pre-built integrations for popular enterprise tools +• Custom connector development with multiple runtime support +• Data mapping and transformation with visual designer +• Event-driven integration patterns with intelligent triggers +• Integration analytics with performance monitoring +• Marketplace publishing for sharing custom integrations +• Version management and rollback capabilities +• Enterprise security compliance with audit trails + +Accelerates enterprise integration with proven patterns and custom solutions. + +**Complexity**: expert | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://enterprise/observability/configure` + +Advanced enterprise observability and telemetry with business intelligence. + +Complete observability platform: +• Multi-dimensional metrics with custom aggregations +• Distributed tracing with sampling strategies +• Centralized logging with intelligent retention policies +• Real-time alerting with escalation and notification routing +• Interactive dashboards with collaborative features +• Performance profiling with bottleneck identification +• Anomaly detection with machine learning algorithms +• Business intelligence integration with KPI tracking + +Provides comprehensive observability for enterprise-scale applications. + +**Complexity**: expert | **Measured BTD Estimate**: 113 $BTD + +--- + +### LSP Integration + +Deep semantic analysis and intelligent code navigation + +#### `bitcode://lsp/semantic/analyze` + +Deep semantic analysis engine with symbol resolution and dependency mapping. + +Advanced semantic understanding capabilities: +• Complete symbol analysis with type inference and relationship mapping +• Dependency graph construction with cycle detection and modularity metrics +• Semantic search with intelligent ranking and contextual suggestions +• Call graph analysis with hotspot identification and dead code detection +• Cross-language analysis with unified symbol resolution +• Real-time hover information and signature help + +Provides comprehensive code understanding for intelligent development assistance. + +**Complexity**: expert | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://lsp/intelligence/navigate` + +Advanced code navigation and intelligent refactoring with change impact analysis. + +Sophisticated code intelligence features: +• Multi-language reference finding with usage pattern analysis +• Safe symbol renaming with conflict detection and preview +• Intelligent method extraction with parameter inference +• Implementation finding across inheritance hierarchies +• Code action suggestions with automated fixes +• Smart import organization and dependency management + +Enables confident code navigation and refactoring with enterprise-grade safety. + +**Complexity**: expert | **Measured BTD Estimate**: 50 $BTD + +--- + +#### `bitcode://lsp/diagnostic/analyze` + +Comprehensive diagnostic engine with multi-axis code quality analysis. + +Advanced diagnostic capabilities: +• Multi-language syntax and semantic validation +• Performance analysis with bottleneck identification +• Security vulnerability scanning with remediation suggestions +• Code complexity analysis with maintainability metrics +• Test coverage analysis with gap identification +• Dependency audit with vulnerability assessment + +Provides comprehensive code health assessment with actionable insights. + +**Complexity**: expert | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://lsp/workspace/intelligence` + +Workspace-wide intelligence with architectural insights and project understanding. + +Comprehensive workspace analysis: +• Project structure analysis with architectural pattern detection +• Module dependency mapping with coupling analysis +• API surface analysis with breaking change detection +• Change impact analysis with transitive dependency tracking +• Technical debt assessment with remediation planning +• Knowledge graph construction with relationship visualization + +Provides executive-level project intelligence for strategic decision-making. + +**Complexity**: expert | **Measured BTD Estimate**: 50 $BTD + +--- + +### Observability + +Real-time metrics, distributed tracing, and business intelligence + +#### `bitcode://observability/metrics/realtime` + +Advanced real-time metrics collection, querying, and alerting system. + +Comprehensive metrics platform: +• Real-time metrics collection with multiple data types +• Advanced querying with aggregations and filtering +• Intelligent alerting with multi-channel notifications +• Interactive dashboards with customizable visualizations +• Metrics streaming for real-time monitoring +• Anomaly detection with machine learning algorithms +• Historical analysis with trend identification +• Performance benchmarking and comparison + +Provides enterprise-grade metrics infrastructure for complete observability. + +**Complexity**: expert | **Measured BTD Estimate**: 50 $BTD + +--- + +#### `bitcode://observability/tracing/distributed` + +Sophisticated distributed tracing with performance profiling and bottleneck detection. + +Advanced tracing capabilities: +• End-to-end distributed trace analysis +• Performance profiling with flame graphs and hotspot identification +• Service topology mapping with dependency visualization +• Latency analysis with percentile calculations +• Error correlation across service boundaries +• Bottleneck detection with root cause analysis +• Request flow visualization with timing breakdown +• Cross-service performance optimization recommendations + +Enables deep performance understanding in distributed systems. + +**Complexity**: advanced | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://observability/intelligence/business` + +Business intelligence platform for engineering metrics and strategic insights. + +Strategic analytics capabilities: +• Technical productivity metrics with team comparisons +• ROI calculation for engineering investments +• Technical debt analysis with cost implications +• Velocity trends with predictive forecasting +• Quality metrics with benchmark comparisons +• Innovation tracking with patent and contribution analysis +• Executive dashboards with strategic KPIs +• Industry benchmarking with competitive analysis + +Provides C-level insights for engineering organization optimization. + +**Complexity**: moderate | **Measured BTD Estimate**: 50 $BTD + +--- + +#### `bitcode://observability/logs/analytics` + +Advanced log analytics with pattern detection, anomaly analysis, and compliance reporting. + +Comprehensive log intelligence: +• Real-time log ingestion with intelligent parsing +• Pattern detection using machine learning algorithms +• Anomaly detection with behavioral analysis +• Security analysis with threat detection +• Compliance reporting with audit trails +• Log correlation across services and timeframes +• Error analysis with impact assessment +• Predictive alerting based on log patterns + +Transforms logs into actionable intelligence for operational excellence. + +**Complexity**: expert | **Measured BTD Estimate**: 50 $BTD + +--- + +### Analysis + +Code analysis and repository intelligence + +#### `bitcode://analysis/repository/analyze` + +Perform comprehensive AI-powered repository analysis. + +Advanced analysis capabilities including: +• Architecture pattern detection and evaluation +• Security vulnerability assessment with OWASP compliance +• Performance bottleneck identification and optimization +• Code quality metrics and maintainability scoring +• Dependency analysis with vulnerability scanning +• Technical debt assessment and remediation planning + +Supports multiple analysis depths from surface-level scanning to deep architectural review. +Generates actionable insights with confidence scoring and remediation guidance. + +**Complexity**: expert | **Measured BTD Estimate**: 75 $BTD + +--- + +#### `bitcode://analysis/intelligence/synthesize` + +Synthesize technical knowledge across repositories and time periods. + +AI-powered intelligence synthesis providing: +• Cross-repository pattern identification +• Technical productivity trend analysis +• Quality and security posture evolution +• Technology adoption and migration insights +• Team performance and collaboration patterns +• Predictive insights for technical decisions + +Generates strategic insights for technical leadership with confidence-scored recommendations. + +**Complexity**: advanced | **Measured BTD Estimate**: 50 $BTD + +--- + +#### `bitcode://analysis/patterns/detect` + +Detect and analyze code patterns across repositories. + +Pattern detection including: +• Design patterns (Observer, Factory, Strategy, etc.) +• Anti-patterns (God Object, Spaghetti Code, etc.) +• Architectural patterns (MVC, MVP, MVVM, etc.) +• Performance patterns and optimization opportunities +• Testing patterns and coverage gaps +• Security patterns and vulnerability patterns + +Provides pattern confidence scoring, code examples, and refactoring recommendations. + +**Complexity**: simple | **Measured BTD Estimate**: 50 $BTD + +--- + +#### `bitcode://analysis/dependencies/analyze` + +Comprehensive dependency analysis and risk assessment. + +Dependency analysis including: +• Direct and transitive dependency mapping +• Security vulnerability scanning across dependency tree +• License compatibility analysis and compliance checking +• Update availability and breaking change detection +• Dependency size and performance impact analysis +• Unused dependency identification + +Provides dependency graph visualization and update recommendations with risk assessment. + +**Complexity**: expert | **Measured BTD Estimate**: 50 $BTD + +--- diff --git a/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-integration-examples.md b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-integration-examples.md new file mode 100644 index 000000000..86629e195 --- /dev/null +++ b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-integration-examples.md @@ -0,0 +1,89 @@ +# MCP Integration Examples + +## Claude Desktop + +### Setup +``` +Add to ~/.config/claude/mcp-servers.json: +{ + "mcpServers": { + "bitcode": { + "command": "npx", + "args": ["@bitcode/mcp-server"], + "env": { "BITCODE_API_KEY": "your-api-key" } + } + } +} +``` + +### Example Usage +``` +"Create a React component for file uploads with drag-and-drop functionality" +``` + +### Features +- Real-time streaming +- Rich responses +- Interactive tables + +--- + +## VS Code + +### Setup +``` +Install the Bitcode MCP extension and configure with API key +``` + +### Example Usage +``` +Right-click file → "Analyze with Bitcode MCP" +``` + +### Features +- IDE integration +- Code actions +- Inline suggestions + +--- + +## GitHub Actions + +### Setup +``` +- uses: bitcode/mcp-action@v1 + with: + tool: "bitcode://pipelines/asset-pack/execute" + token: ${{ secrets.BITCODE_API_KEY }} +``` + +### Example Usage +``` +Automated implementation and validation on every PR +``` + +### Features +- CI/CD integration +- Automated workflows +- Quality gates + +--- + +## Custom API + +### Setup +``` +const client = new MCPClient({ apiKey: process.env.BITCODE_API_KEY }); +``` + +### Example Usage +``` +await client.callTool("bitcode://pipelines/asset-pack/execute", args); +``` + +### Features +- REST API +- WebSocket streaming +- Custom integrations + +--- diff --git a/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-openapi.json b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-openapi.json new file mode 100644 index 000000000..807aff193 --- /dev/null +++ b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-openapi.json @@ -0,0 +1,2496 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "bitcode-market-infrastructure", + "version": "1.0.0", + "description": "Technical knowledge exchange platform exposing comprehensive capabilities through MCP" + }, + "x-mcp-specification": { + "version": "2024-11-05", + "capabilities": [ + "Pipeline Management", + "Advanced Intelligence", + "Enterprise Integration", + "LSP Integration", + "Observability", + "Cross-Repository Learning" + ] + }, + "paths": { + "/mcp/tools/bitcode/pipelines/asset-pack/create": { + "post": { + "summary": "Create and execute a Bitcode asset-pack pipeline for complete software engineering reads.", + "description": "Create and execute a Bitcode asset-pack pipeline for complete software engineering reads.\n\nThis is Bitcode's most powerful pipeline, capable of:\n• Feature implementation with written assets and optional pull request delivery\n• Comprehensive code reviews with detailed suggestions\n• Bug fixes with root cause analysis and testing\n• Technical documentation and blog posts\n• Architecture diagrams and API specifications\n• Frontend scaffolding for React/Vue/Angular\n• Project scope analysis and implementation planning\n• Code refactoring proposals with impact analysis\n\nSupports multimodal inputs including Figma designs, documents, images, audio, and video.\nReal-time streaming provides live updates during read measurement, asset synthesis, validation, Finish, and connected-interface delivery readiness.\n\nAdmitted subtypes:\n• pull_request - Complete feature implementation with PR\n• pr_review - Comprehensive code review with suggestions\n• issue - Bug analysis and fixes with testing\n• comment - Code explanation and documentation\n• blog_post - Technical writing and documentation\n• diagram - Architecture and flow diagrams\n• api_spec - OpenAPI specification generation\n• frontend_scaffolder - Component scaffolding\n• scope_analysis - Project complexity analysis\n• implementation_plan - Detailed technical planning\n• refactor_proposal - Code improvement recommendations", + "operationId": "bitcode___pipelines_asset_pack_create", + "tags": [ + "Pipeline Management" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "task": { + "type": "string", + "description": "Detailed task description (minimum 10 characters)" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "attachments": { + "type": "object", + "description": "Complex type" + }, + "connections": { + "type": "object", + "description": "Complex type" + }, + "mcpConfig": { + "type": "object", + "description": "Complex type" + }, + "streaming": { + "type": "object", + "description": "Complex type" + }, + "organizationId": { + "type": "string" + }, + "modelPreferences": { + "type": "object", + "description": "Complex type" + }, + "subtype": { + "type": "string", + "enum": [ + "pull_request", + "pr_review", + "issue", + "comment", + "blog_post", + "diagram", + "api_spec", + "frontend_scaffolder", + "scope_analysis", + "implementation_plan", + "refactor_proposal" + ], + "description": "Specific Shippable subtype or AssetPack written-asset focus" + }, + "options": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "task", + "repository", + "attachments", + "connections", + "mcpConfig", + "streaming", + "subtype", + "options" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 200, + "factors": [ + "Base tool execution", + "Pipeline execution", + "AI agent coordination" + ] + }, + "useCases": [ + "Feature Development", + "Test Generation", + "Documentation", + "Code Refactoring" + ], + "relatedTools": [ + "bitcode://monitoring/pipeline/status", + "bitcode://intelligence/effectiveness/track" + ] + } + } + }, + "/mcp/tools/bitcode/intelligence/effectiveness/track": { + "post": { + "summary": "Effectiveness tracking system with real-time quality measurement.", + "description": "Effectiveness tracking system with real-time quality measurement.\n\nThis system provides measurable insight into code change effectiveness:\n• Real-time before/after quality measurement\n• ML-powered effectiveness prediction for proposed changes \n• Continuous learning from outcome data to improve recommendations\n• Optimization recommendations for target quality metrics\n\nEnables effectiveness-driven development with measurable quality improvements.", + "operationId": "bitcode___intelligence_effectiveness_track", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "measure", + "predict", + "learn", + "optimize" + ], + "description": "Type of effectiveness operation to perform" + }, + "pipelineId": { + "type": "string" + }, + "beforeMetrics": { + "type": "object", + "description": "Complex type" + }, + "afterMetrics": { + "type": "object", + "description": "Complex type" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "proposedChanges": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "targetMetrics": { + "type": "object", + "description": "Complex type" + }, + "constraints": { + "type": "array", + "items": { + "type": "string" + } + }, + "timeframe": { + "type": "object", + "description": "Complex type" + }, + "includeConfidence": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "timeframe", + "includeConfidence" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/intelligence/cross-repo/learn": { + "post": { + "summary": "Advanced cross-repository learning engine for pattern discovery and propagation.", + "description": "Advanced cross-repository learning engine for pattern discovery and propagation.\n\nSophisticated pattern extraction and knowledge transfer:\n• Extract successful patterns from high-performing repositories\n• Intelligent pattern propagation with context adaptation\n• Cross-repository similarity analysis and clustering\n• Knowledge graph visualization of repository relationships\n• Automated recommendations based on successful patterns\n\nEnables knowledge transfer and standardization across your entire codebase ecosystem.", + "operationId": "bitcode___intelligence_cross_repo_learn", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "extract", + "propagate", + "analyze", + "recommend" + ], + "description": "Cross-repository learning operation" + }, + "sourceRepositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "patterns": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "targetRepositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisType": { + "type": "string", + "enum": [ + "pattern_similarity", + "success_correlation", + "repository_clustering", + "knowledge_graph", + "trend_analysis", + "anomaly_detection" + ] + }, + "repositoryContext": { + "type": "object", + "description": "Complex type" + }, + "includeVisualization": { + "type": "object", + "description": "Complex type" + }, + "maxResults": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "includeVisualization", + "maxResults" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/intelligence/research/advanced": { + "post": { + "summary": "Multi-provider web research with URL intelligence and synthesis.", + "description": "Multi-provider web research with URL intelligence and synthesis.\n\nMulti-wave research orchestration across diverse sources:\n• GitHub, Stack Overflow, academic papers, documentation sites\n• URL credibility assessment and content quality analysis\n• Cross-source result synthesis and correlation\n• Technology-aware query generation and refinement\n• Real-time research quality assessment with gap analysis\n\nProvides comprehensive, credible research with intelligent synthesis.", + "operationId": "bitcode___intelligence_research_advanced", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "Research query with detailed context" + }, + "researchType": { + "type": "string", + "enum": [ + "technical_investigation", + "solution_discovery", + "best_practices", + "vulnerability_research", + "framework_comparison", + "library_evaluation", + "pattern_research", + "performance_optimization", + "security_analysis" + ], + "description": "Type of research to conduct" + }, + "providers": { + "type": "object", + "description": "Complex type" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "synthesisType": { + "type": "object", + "description": "Complex type" + }, + "maxResults": { + "type": "object", + "description": "Complex type" + }, + "includeUrlIntelligence": { + "type": "object", + "description": "Complex type" + }, + "contextAware": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "query", + "researchType", + "providers", + "synthesisType", + "maxResults", + "includeUrlIntelligence", + "contextAware" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 225, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis", + "Comprehensive analysis" + ] + }, + "useCases": [ + "Documentation" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/intelligence/multimodal/process": { + "post": { + "summary": "Comprehensive multimodal processing engine for all attachment types.", + "description": "Comprehensive multimodal processing engine for all attachment types.\n\nAdvanced multimodal intelligence processing:\n• Image analysis with design pattern recognition\n• Audio transcription and content analysis\n• Video processing with scene understanding\n• Document extraction with intelligent parsing\n• Figma design analysis with implementation guidance\n• Cross-modal synthesis for unified understanding\n\nTransforms any media type into actionable technical knowledge evidence.", + "operationId": "bitcode___intelligence_multimodal_process", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "attachments": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + }, + "description": "Attachments to process" + }, + "processingType": { + "type": "string", + "enum": [ + "comprehensive_analysis", + "content_extraction", + "intelligence_synthesis", + "requirement_extraction", + "design_analysis", + "accessibility_audit", + "performance_analysis", + "security_scan" + ], + "description": "Type of multimodal processing" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + }, + "crossModalSynthesis": { + "type": "object", + "description": "Complex type" + }, + "includeImplementationGuidance": { + "type": "object", + "description": "Complex type" + }, + "contextRepository": { + "type": "object", + "description": "Complex type" + }, + "qualityThreshold": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "attachments", + "processingType", + "outputFormat", + "crossModalSynthesis", + "includeImplementationGuidance", + "qualityThreshold" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/intelligence/enterprise/orchestrate": { + "post": { + "summary": "Enterprise intelligence orchestrator for organization-wide insights.", + "description": "Enterprise intelligence orchestrator for organization-wide insights.\n\nStrategic enterprise intelligence coordination:\n• Team productivity analysis with skill gap identification\n• Knowledge mapping across departments and projects\n• Collaboration pattern analysis and optimization\n• Innovation metrics and strategic planning support\n• Risk assessment with mitigation recommendations\n• Industry benchmarking and competitive analysis\n\nProvides executive-level intelligence for strategic decision-making.", + "operationId": "bitcode___intelligence_enterprise_orchestrate", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "team_analysis", + "productivity_optimization", + "knowledge_mapping", + "skill_gap_analysis", + "collaboration_patterns", + "innovation_metrics", + "risk_assessment", + "strategic_planning" + ], + "description": "Enterprise intelligence operation" + }, + "organizationId": { + "type": "string", + "description": "Organization ID for analysis" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "timeHorizon": { + "type": "object", + "description": "Complex type" + }, + "analysisDepth": { + "type": "object", + "description": "Complex type" + }, + "includeRecommendations": { + "type": "object", + "description": "Complex type" + }, + "includeBenchmarking": { + "type": "object", + "description": "Complex type" + }, + "confidentialityLevel": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "organizationId", + "scope", + "timeHorizon", + "analysisDepth", + "includeRecommendations", + "includeBenchmarking", + "confidentialityLevel" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/intelligence/marketplace/analyze": { + "post": { + "summary": "Sophisticated marketplace and procurement intelligence system.", + "description": "Sophisticated marketplace and procurement intelligence system.\n\nAdvanced solution discovery and quality assessment:\n• AI-powered solution discovery with requirement matching\n• Quality assessment with fraud detection and risk evaluation\n• Provider analysis with reputation and performance tracking\n• Price optimization recommendations with market analysis\n• Trend analysis for technology adoption and pricing\n• Competitive intelligence for strategic procurement\n\nEnables intelligent procurement with risk mitigation and value optimization.", + "operationId": "bitcode___intelligence_marketplace_analyze", + "tags": [ + "Advanced Intelligence" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "solution_discovery", + "quality_assessment", + "provider_analysis", + "price_optimization", + "risk_evaluation", + "trend_analysis" + ], + "description": "Marketplace operation type" + }, + "requirements": { + "type": "object", + "description": "Complex type" + }, + "listingId": { + "type": "string" + }, + "providerId": { + "type": "string" + }, + "searchQuery": { + "type": "string" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "includeCompetitiveAnalysis": { + "type": "object", + "description": "Complex type" + }, + "riskTolerance": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "includeCompetitiveAnalysis", + "riskTolerance" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + }, + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/enterprise/webhook/orchestrate": { + "post": { + "summary": "Advanced enterprise webhook orchestration with intelligent routing and transformation.", + "description": "Advanced enterprise webhook orchestration with intelligent routing and transformation.\n\nComprehensive webhook management system:\n• Intelligent webhook routing with conditional logic\n• Advanced authentication including HMAC and JWT validation\n• Retry policies with exponential backoff and circuit breakers\n• Rate limiting and traffic shaping for webhook endpoints\n• Real-time analytics with performance monitoring\n• Batch webhook operations for enterprise-scale automation\n• Webhook transformation and payload filtering\n• Enterprise-grade security with audit logging\n\nEnables sophisticated event-driven architectures with enterprise reliability.", + "operationId": "bitcode___enterprise_webhook_orchestrate", + "tags": [ + "Enterprise Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "create_webhook", + "update_webhook", + "delete_webhook", + "list_webhooks", + "test_webhook", + "webhook_analytics", + "webhook_routing", + "batch_webhooks" + ], + "description": "Webhook operation type" + }, + "webhook": { + "type": "object", + "description": "Complex type" + }, + "testPayload": { + "type": "object", + "description": "Complex type" + }, + "analyticsTimeRange": { + "type": "object", + "description": "Complex type" + }, + "webhookIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "routingRules": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing" + ] + }, + "useCases": [ + "Security Analysis", + "Performance Optimization", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ] + } + } + }, + "/mcp/tools/bitcode/enterprise/api/manage": { + "post": { + "summary": "Complete enterprise API lifecycle management with governance and analytics.", + "description": "Complete enterprise API lifecycle management with governance and analytics.\n\nFull-featured API management platform:\n• API versioning with semantic versioning and retirement management\n• Comprehensive rate limiting with tiered access controls\n• API governance with automated compliance checking\n• Interactive documentation generation with OpenAPI 3.0\n• Advanced authentication schemes with OAuth2 and JWT support\n• Performance monitoring with detailed analytics\n• Automated testing with comprehensive test suite execution\n• CORS configuration and security policy enforcement\n\nProvides enterprise-grade API management with governance and observability.", + "operationId": "bitcode___enterprise_api_manage", + "tags": [ + "Enterprise Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "create_api", + "update_api", + "delete_api", + "list_apis", + "version_api", + "deploy_api", + "api_analytics", + "api_governance", + "rate_limit_config", + "api_documentation", + "api_testing" + ], + "description": "API management operation" + }, + "api": { + "type": "object", + "description": "Complex type" + }, + "versioningStrategy": { + "type": "string", + "enum": [ + "semver", + "date", + "sequential" + ] + }, + "environment": { + "type": "string", + "enum": [ + "development", + "staging", + "production" + ] + }, + "governanceRules": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "testSuite": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 113, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing", + "Comprehensive analysis" + ] + }, + "useCases": [ + "Feature Development", + "Security Analysis", + "Test Generation", + "Documentation", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ] + } + } + }, + "/mcp/tools/bitcode/enterprise/integration/marketplace": { + "post": { + "summary": "Enterprise integration marketplace with pre-built connectors and custom development.", + "description": "Enterprise integration marketplace with pre-built connectors and custom development.\n\nComprehensive integration ecosystem:\n• Browse and install pre-built integrations for popular enterprise tools\n• Custom connector development with multiple runtime support\n• Data mapping and transformation with visual designer\n• Event-driven integration patterns with intelligent triggers\n• Integration analytics with performance monitoring\n• Marketplace publishing for sharing custom integrations\n• Version management and rollback capabilities\n• Enterprise security compliance with audit trails\n\nAccelerates enterprise integration with proven patterns and custom solutions.", + "operationId": "bitcode___enterprise_integration_marketplace", + "tags": [ + "Enterprise Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "browse_integrations", + "install_integration", + "configure_integration", + "update_integration", + "uninstall_integration", + "integration_analytics", + "custom_connector", + "marketplace_publish" + ], + "description": "Integration marketplace operation" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "integration": { + "type": "object", + "description": "Complex type" + }, + "connector": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing" + ] + }, + "useCases": [ + "Security Analysis", + "Performance Optimization", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ] + } + } + }, + "/mcp/tools/bitcode/enterprise/observability/configure": { + "post": { + "summary": "Advanced enterprise observability and telemetry with business intelligence.", + "description": "Advanced enterprise observability and telemetry with business intelligence.\n\nComplete observability platform:\n• Multi-dimensional metrics with custom aggregations\n• Distributed tracing with sampling strategies\n• Centralized logging with intelligent retention policies\n• Real-time alerting with escalation and notification routing\n• Interactive dashboards with collaborative features\n• Performance profiling with bottleneck identification\n• Anomaly detection with machine learning algorithms\n• Business intelligence integration with KPI tracking\n\nProvides comprehensive observability for enterprise-scale applications.", + "operationId": "bitcode___enterprise_observability_configure", + "tags": [ + "Enterprise Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "setup_monitoring", + "configure_alerts", + "create_dashboard", + "export_metrics", + "trace_analysis", + "log_analysis", + "performance_profiling", + "business_intelligence", + "anomaly_detection" + ], + "description": "Observability operation type" + }, + "monitoringConfig": { + "type": "object", + "description": "Complex type" + }, + "alerts": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "dashboard": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 113, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing", + "Comprehensive analysis" + ] + }, + "useCases": [ + "Feature Development" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ] + } + } + }, + "/mcp/tools/bitcode/lsp/semantic/analyze": { + "post": { + "summary": "Deep semantic analysis engine with symbol resolution and dependency mapping.", + "description": "Deep semantic analysis engine with symbol resolution and dependency mapping.\n\nAdvanced semantic understanding capabilities:\n• Complete symbol analysis with type inference and relationship mapping\n• Dependency graph construction with cycle detection and modularity metrics\n• Semantic search with intelligent ranking and contextual suggestions\n• Call graph analysis with hotspot identification and dead code detection\n• Cross-language analysis with unified symbol resolution\n• Real-time hover information and signature help\n\nProvides comprehensive code understanding for intelligent development assistance.", + "operationId": "bitcode___lsp_semantic_analyze", + "tags": [ + "LSP Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "symbol_analysis", + "dependency_graph", + "type_inference", + "call_graph", + "reference_analysis", + "definition_lookup", + "semantic_search", + "code_lens", + "hover_information", + "signature_help", + "workspace_symbols", + "document_symbols" + ], + "description": "LSP semantic analysis operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "targets": { + "type": "object", + "description": "Complex type" + }, + "position": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "searchQuery": { + "type": "string" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + }, + "includeSourceCode": { + "type": "object", + "description": "Complex type" + }, + "includeDocumentation": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository", + "outputFormat", + "includeSourceCode", + "includeDocumentation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/lsp/intelligence/navigate": { + "post": { + "summary": "Advanced code navigation and intelligent refactoring with change impact analysis.", + "description": "Advanced code navigation and intelligent refactoring with change impact analysis.\n\nSophisticated code intelligence features:\n• Multi-language reference finding with usage pattern analysis\n• Safe symbol renaming with conflict detection and preview\n• Intelligent method extraction with parameter inference\n• Implementation finding across inheritance hierarchies\n• Code action suggestions with automated fixes\n• Smart import organization and dependency management\n\nEnables confident code navigation and refactoring with enterprise-grade safety.", + "operationId": "bitcode___lsp_intelligence_navigate", + "tags": [ + "LSP Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "find_references", + "find_implementations", + "find_declarations", + "rename_symbol", + "extract_method", + "extract_variable", + "inline_method", + "move_symbol", + "organize_imports", + "auto_fix", + "code_actions", + "format_document", + "fold_ranges", + "selection_ranges" + ], + "description": "Code intelligence operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "symbol": { + "type": "object", + "description": "Complex type" + }, + "refactoringConfig": { + "type": "object", + "description": "Complex type" + }, + "range": { + "type": "object", + "description": "Complex type" + }, + "codeActionKind": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports", + "source.fixAll", + "source.addMissingImports" + ] + } + }, + "formattingOptions": { + "type": "object", + "description": "Complex type" + }, + "executeActions": { + "type": "object", + "description": "Complex type" + }, + "dryRun": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository", + "executeActions", + "dryRun" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Feature Development", + "Code Refactoring" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/lsp/diagnostic/analyze": { + "post": { + "summary": "Comprehensive diagnostic engine with multi-axis code quality analysis.", + "description": "Comprehensive diagnostic engine with multi-axis code quality analysis.\n\nAdvanced diagnostic capabilities:\n• Multi-language syntax and semantic validation\n• Performance analysis with bottleneck identification\n• Security vulnerability scanning with remediation suggestions\n• Code complexity analysis with maintainability metrics\n• Test coverage analysis with gap identification\n• Dependency audit with vulnerability assessment\n\nProvides comprehensive code health assessment with actionable insights.", + "operationId": "bitcode___lsp_diagnostic_analyze", + "tags": [ + "LSP Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "run_diagnostics", + "lint_analysis", + "type_checking", + "syntax_validation", + "security_scan", + "performance_analysis", + "code_complexity", + "test_coverage", + "dependency_audit", + "code_metrics", + "quality_gates", + "compliance_check" + ], + "description": "Diagnostic operation type" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "diagnosticConfig": { + "type": "object", + "description": "Complex type" + }, + "qualityThresholds": { + "type": "object", + "description": "Complex type" + }, + "analysisPreferences": { + "type": "object", + "description": "Complex type" + }, + "outputConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/lsp/workspace/intelligence": { + "post": { + "summary": "Workspace-wide intelligence with architectural insights and project understanding.", + "description": "Workspace-wide intelligence with architectural insights and project understanding.\n\nComprehensive workspace analysis:\n• Project structure analysis with architectural pattern detection\n• Module dependency mapping with coupling analysis\n• API surface analysis with breaking change detection\n• Change impact analysis with transitive dependency tracking\n• Technical debt assessment with remediation planning\n• Knowledge graph construction with relationship visualization\n\nProvides executive-level project intelligence for strategic decision-making.", + "operationId": "bitcode___lsp_workspace_intelligence", + "tags": [ + "LSP Integration" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "workspace_analysis", + "project_structure", + "architecture_overview", + "module_dependencies", + "api_surface", + "change_impact", + "hotspot_analysis", + "technical_debt", + "code_ownership", + "knowledge_graph", + "migration_analysis" + ], + "description": "Workspace intelligence operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisScope": { + "type": "object", + "description": "Complex type" + }, + "changeAnalysis": { + "type": "object", + "description": "Complex type" + }, + "architectureConfig": { + "type": "object", + "description": "Complex type" + }, + "knowledgeGraphConfig": { + "type": "object", + "description": "Complex type" + }, + "migrationConfig": { + "type": "object", + "description": "Complex type" + }, + "visualizationConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/observability/metrics/realtime": { + "post": { + "summary": "Advanced real-time metrics collection, querying, and alerting system.", + "description": "Advanced real-time metrics collection, querying, and alerting system.\n\nComprehensive metrics platform:\n• Real-time metrics collection with multiple data types\n• Advanced querying with aggregations and filtering\n• Intelligent alerting with multi-channel notifications\n• Interactive dashboards with customizable visualizations\n• Metrics streaming for real-time monitoring\n• Anomaly detection with machine learning algorithms\n• Historical analysis with trend identification\n• Performance benchmarking and comparison\n\nProvides enterprise-grade metrics infrastructure for complete observability.", + "operationId": "bitcode___observability_metrics_realtime", + "tags": [ + "Observability" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "collect_metrics", + "query_metrics", + "create_alert", + "manage_dashboards", + "stream_metrics", + "export_metrics", + "aggregate_metrics", + "metric_analysis" + ], + "description": "Metrics operation type" + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "query": { + "type": "object", + "description": "Complex type" + }, + "alert": { + "type": "object", + "description": "Complex type" + }, + "dashboard": { + "type": "object", + "description": "Complex type" + }, + "streamConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/observability/tracing/distributed": { + "post": { + "summary": "Sophisticated distributed tracing with performance profiling and bottleneck detection.", + "description": "Sophisticated distributed tracing with performance profiling and bottleneck detection.\n\nAdvanced tracing capabilities:\n• End-to-end distributed trace analysis\n• Performance profiling with flame graphs and hotspot identification\n• Service topology mapping with dependency visualization\n• Latency analysis with percentile calculations\n• Error correlation across service boundaries\n• Bottleneck detection with root cause analysis\n• Request flow visualization with timing breakdown\n• Cross-service performance optimization recommendations\n\nEnables deep performance understanding in distributed systems.", + "operationId": "bitcode___observability_tracing_distributed", + "tags": [ + "Observability" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "start_trace", + "end_trace", + "add_span", + "trace_analysis", + "performance_profiling", + "bottleneck_detection", + "trace_correlation", + "service_map", + "latency_analysis", + "error_tracking" + ], + "description": "Tracing operation type" + }, + "trace": { + "type": "object", + "description": "Complex type" + }, + "span": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "profilingConfig": { + "type": "object", + "description": "Complex type" + }, + "serviceMapConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + }, + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/observability/intelligence/business": { + "post": { + "summary": "Business intelligence platform for engineering metrics and strategic insights.", + "description": "Business intelligence platform for engineering metrics and strategic insights.\n\nStrategic analytics capabilities:\n• Technical productivity metrics with team comparisons\n• ROI calculation for engineering investments\n• Technical debt analysis with cost implications\n• Velocity trends with predictive forecasting\n• Quality metrics with benchmark comparisons\n• Innovation tracking with patent and contribution analysis\n• Executive dashboards with strategic KPIs\n• Industry benchmarking with competitive analysis\n\nProvides C-level insights for engineering organization optimization.", + "operationId": "bitcode___observability_intelligence_business", + "tags": [ + "Observability" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "engineering_metrics", + "productivity_analysis", + "team_performance", + "cost_analysis", + "roi_calculation", + "trend_analysis", + "forecasting", + "benchmarking", + "executive_dashboard", + "strategic_insights" + ], + "description": "Business intelligence operation" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "metricsConfig": { + "type": "object", + "description": "Complex type" + }, + "analysisPreferences": { + "type": "object", + "description": "Complex type" + }, + "outputConfig": { + "type": "object", + "description": "Complex type" + }, + "benchmarkConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "scope", + "metricsConfig" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "moderate", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Business Intelligence" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/observability/logs/analytics": { + "post": { + "summary": "Advanced log analytics with pattern detection, anomaly analysis, and compliance reporting.", + "description": "Advanced log analytics with pattern detection, anomaly analysis, and compliance reporting.\n\nComprehensive log intelligence:\n• Real-time log ingestion with intelligent parsing\n• Pattern detection using machine learning algorithms\n• Anomaly detection with behavioral analysis\n• Security analysis with threat detection\n• Compliance reporting with audit trails\n• Log correlation across services and timeframes\n• Error analysis with impact assessment\n• Predictive alerting based on log patterns\n\nTransforms logs into actionable intelligence for operational excellence.", + "operationId": "bitcode___observability_logs_analytics", + "tags": [ + "Observability" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "log_ingestion", + "log_analysis", + "pattern_detection", + "anomaly_detection", + "log_correlation", + "error_analysis", + "log_search", + "log_aggregation", + "compliance_reporting", + "security_analysis" + ], + "description": "Log analytics operation" + }, + "logs": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "searchQuery": { + "type": "object", + "description": "Complex type" + }, + "patternConfig": { + "type": "object", + "description": "Complex type" + }, + "anomalyConfig": { + "type": "object", + "description": "Complex type" + }, + "complianceConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Business Intelligence" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/analysis/repository/analyze": { + "post": { + "summary": "Perform comprehensive AI-powered repository analysis.", + "description": "Perform comprehensive AI-powered repository analysis.\n\nAdvanced analysis capabilities including:\n• Architecture pattern detection and evaluation\n• Security vulnerability assessment with OWASP compliance\n• Performance bottleneck identification and optimization\n• Code quality metrics and maintainability scoring\n• Dependency analysis with vulnerability scanning\n• Technical debt assessment and remediation planning\n\nSupports multiple analysis depths from surface-level scanning to deep architectural review.\nGenerates actionable insights with confidence scoring and remediation guidance.", + "operationId": "bitcode___analysis_repository_analyze", + "tags": [ + "Analysis" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisType": { + "type": "string", + "enum": [ + "architecture", + "dependencies", + "security", + "performance", + "quality", + "complexity", + "patterns", + "technical_debt" + ], + "description": "Type of analysis to perform" + }, + "depth": { + "type": "object", + "description": "Complex type" + }, + "includeMetrics": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "analysisType", + "depth", + "includeMetrics", + "outputFormat" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + }, + "useCases": [ + "General Technical Work" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/analysis/intelligence/synthesize": { + "post": { + "summary": "Synthesize technical knowledge across repositories and time periods.", + "description": "Synthesize technical knowledge across repositories and time periods.\n\nAI-powered intelligence synthesis providing:\n• Cross-repository pattern identification\n• Technical productivity trend analysis\n• Quality and security posture evolution\n• Technology adoption and migration insights\n• Team performance and collaboration patterns\n• Predictive insights for technical decisions\n\nGenerates strategic insights for technical leadership with confidence-scored recommendations.", + "operationId": "bitcode___analysis_intelligence_synthesize", + "tags": [ + "Analysis" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "scope": { + "type": "object", + "description": "Complex type" + }, + "timeframe": { + "type": "object", + "description": "Complex type" + }, + "repositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisTypes": { + "type": "object", + "description": "Complex type" + }, + "includeRecommendations": { + "type": "object", + "description": "Complex type" + }, + "confidenceThreshold": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "scope", + "timeframe", + "analysisTypes", + "includeRecommendations", + "confidenceThreshold" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Security Analysis", + "Performance Optimization" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/analysis/patterns/detect": { + "post": { + "summary": "Detect and analyze code patterns across repositories.", + "description": "Detect and analyze code patterns across repositories.\n\nPattern detection including:\n• Design patterns (Observer, Factory, Strategy, etc.)\n• Anti-patterns (God Object, Spaghetti Code, etc.)\n• Architectural patterns (MVC, MVP, MVVM, etc.)\n• Performance patterns and optimization opportunities\n• Testing patterns and coverage gaps\n• Security patterns and vulnerability patterns\n\nProvides pattern confidence scoring, code examples, and refactoring recommendations.", + "operationId": "bitcode___analysis_patterns_detect", + "tags": [ + "Analysis" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "patternTypes": { + "type": "object", + "description": "Complex type" + }, + "language": { + "type": "string" + }, + "includeExamples": { + "type": "object", + "description": "Complex type" + }, + "severity": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "patternTypes", + "includeExamples", + "severity" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "simple", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Code Refactoring" + ], + "relatedTools": [] + } + } + }, + "/mcp/tools/bitcode/analysis/dependencies/analyze": { + "post": { + "summary": "Comprehensive dependency analysis and risk assessment.", + "description": "Comprehensive dependency analysis and risk assessment.\n\nDependency analysis including:\n• Direct and transitive dependency mapping\n• Security vulnerability scanning across dependency tree\n• License compatibility analysis and compliance checking\n• Update availability and breaking change detection\n• Dependency size and performance impact analysis\n• Unused dependency identification\n\nProvides dependency graph visualization and update recommendations with risk assessment.", + "operationId": "bitcode___analysis_dependencies_analyze", + "tags": [ + "Analysis" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisDepth": { + "type": "object", + "description": "Complex type" + }, + "includeVulnerabilities": { + "type": "object", + "description": "Complex type" + }, + "includeLicenses": { + "type": "object", + "description": "Complex type" + }, + "includeUpdates": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "analysisDepth", + "includeVulnerabilities", + "includeLicenses", + "includeUpdates", + "outputFormat" + ], + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "description": "Tool execution result", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "result": { + "type": "object" + }, + "metadata": { + "type": "object" + } + } + } + } + } + } + }, + "x-mcp-tool": { + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + }, + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [] + } + } + } + }, + "components": { + "schemas": {} + } +} diff --git a/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-specification.json b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-specification.json new file mode 100644 index 000000000..d38c6b181 --- /dev/null +++ b/packages/executions-mcp/src/mcp-server/docs/mcp/mcp-specification.json @@ -0,0 +1,1826 @@ +{ + "mcpVersion": "2024-11-05", + "serverInfo": { + "name": "bitcode-market-infrastructure", + "version": "1.0.0", + "description": "Technical knowledge exchange platform exposing comprehensive capabilities through MCP", + "capabilities": [ + "Pipeline Management", + "Advanced Intelligence", + "Enterprise Integration", + "LSP Integration", + "Observability", + "Cross-Repository Learning" + ] + }, + "tools": { + "Pipeline Management": { + "description": "Core SDIVF pipeline execution with PTRR agent coordination", + "tools": { + "bitcode://pipelines/asset-pack/create": { + "name": "bitcode://pipelines/asset-pack/create", + "description": "Create and execute a Bitcode asset-pack pipeline for complete software engineering reads.\n\nThis is Bitcode's most powerful pipeline, capable of:\n• Feature implementation with written assets and optional pull request delivery\n• Comprehensive code reviews with detailed suggestions\n• Bug fixes with root cause analysis and testing\n• Technical documentation and blog posts\n• Architecture diagrams and API specifications\n• Frontend scaffolding for React/Vue/Angular\n• Project scope analysis and implementation planning\n• Code refactoring proposals with impact analysis\n\nSupports multimodal inputs including Figma designs, documents, images, audio, and video.\nReal-time streaming provides live updates during read measurement, asset synthesis, validation, Finish, and connected-interface delivery readiness.\n\nAdmitted subtypes:\n• pull_request - Complete feature implementation with PR\n• pr_review - Comprehensive code review with suggestions\n• issue - Bug analysis and fixes with testing\n• comment - Code explanation and documentation\n• blog_post - Technical writing and documentation\n• diagram - Architecture and flow diagrams\n• api_spec - OpenAPI specification generation\n• frontend_scaffolder - Component scaffolding\n• scope_analysis - Project complexity analysis\n• implementation_plan - Detailed technical planning\n• refactor_proposal - Code improvement recommendations", + "category": "Pipeline Management", + "subcategory": "asset-pack", + "inputSchema": { + "type": "object", + "properties": { + "task": { + "type": "string", + "description": "Detailed task description (minimum 10 characters)" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "attachments": { + "type": "object", + "description": "Complex type" + }, + "connections": { + "type": "object", + "description": "Complex type" + }, + "mcpConfig": { + "type": "object", + "description": "Complex type" + }, + "streaming": { + "type": "object", + "description": "Complex type" + }, + "organizationId": { + "type": "string" + }, + "modelPreferences": { + "type": "object", + "description": "Complex type" + }, + "subtype": { + "type": "string", + "enum": [ + "pull_request", + "pr_review", + "issue", + "comment", + "blog_post", + "diagram", + "api_spec", + "frontend_scaffolder", + "scope_analysis", + "implementation_plan", + "refactor_proposal" + ], + "description": "Specific Shippable subtype or AssetPack written-asset focus" + }, + "options": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "task", + "repository", + "attachments", + "connections", + "mcpConfig", + "streaming", + "subtype", + "options" + ], + "additionalProperties": false + }, + "examples": [ + { + "name": "React Component Creation", + "description": "Create a reusable React component with TypeScript", + "input": { + "task": "Create a reusable Modal component with animations and accessibility features", + "repository": { + "owner": "acme-corp", + "name": "web-app" + }, + "subtype": "full_feature", + "streaming": true + } + } + ], + "useCases": [ + "Feature Development", + "Test Generation", + "Documentation", + "Code Refactoring" + ], + "relatedTools": [ + "bitcode://monitoring/pipeline/status", + "bitcode://intelligence/effectiveness/track" + ], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 200, + "factors": [ + "Base tool execution", + "Pipeline execution", + "AI agent coordination" + ] + } + } + } + }, + "Advanced Intelligence": { + "description": "ML-powered effectiveness tracking and cross-repository learning", + "tools": { + "bitcode://intelligence/effectiveness/track": { + "name": "bitcode://intelligence/effectiveness/track", + "description": "Effectiveness tracking system with real-time quality measurement.\n\nThis system provides measurable insight into code change effectiveness:\n• Real-time before/after quality measurement\n• ML-powered effectiveness prediction for proposed changes \n• Continuous learning from outcome data to improve recommendations\n• Optimization recommendations for target quality metrics\n\nEnables effectiveness-driven development with measurable quality improvements.", + "category": "Advanced Intelligence", + "subcategory": "effectiveness", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "measure", + "predict", + "learn", + "optimize" + ], + "description": "Type of effectiveness operation to perform" + }, + "pipelineId": { + "type": "string" + }, + "beforeMetrics": { + "type": "object", + "description": "Complex type" + }, + "afterMetrics": { + "type": "object", + "description": "Complex type" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "proposedChanges": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "outcomes": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "targetMetrics": { + "type": "object", + "description": "Complex type" + }, + "constraints": { + "type": "array", + "items": { + "type": "string" + } + }, + "timeframe": { + "type": "object", + "description": "Complex type" + }, + "includeConfidence": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "timeframe", + "includeConfidence" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + } + }, + "bitcode://intelligence/cross-repo/learn": { + "name": "bitcode://intelligence/cross-repo/learn", + "description": "Advanced cross-repository learning engine for pattern discovery and propagation.\n\nSophisticated pattern extraction and knowledge transfer:\n• Extract successful patterns from high-performing repositories\n• Intelligent pattern propagation with context adaptation\n• Cross-repository similarity analysis and clustering\n• Knowledge graph visualization of repository relationships\n• Automated recommendations based on successful patterns\n\nEnables knowledge transfer and standardization across your entire codebase ecosystem.", + "category": "Advanced Intelligence", + "subcategory": "cross-repo", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "extract", + "propagate", + "analyze", + "recommend" + ], + "description": "Cross-repository learning operation" + }, + "sourceRepositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "patterns": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "targetRepositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisType": { + "type": "string", + "enum": [ + "pattern_similarity", + "success_correlation", + "repository_clustering", + "knowledge_graph", + "trend_analysis", + "anomaly_detection" + ] + }, + "repositoryContext": { + "type": "object", + "description": "Complex type" + }, + "includeVisualization": { + "type": "object", + "description": "Complex type" + }, + "maxResults": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "includeVisualization", + "maxResults" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + } + }, + "bitcode://intelligence/research/advanced": { + "name": "bitcode://intelligence/research/advanced", + "description": "Multi-provider web research with URL intelligence and synthesis.\n\nMulti-wave research orchestration across diverse sources:\n• GitHub, Stack Overflow, academic papers, documentation sites\n• URL credibility assessment and content quality analysis\n• Cross-source result synthesis and correlation\n• Technology-aware query generation and refinement\n• Real-time research quality assessment with gap analysis\n\nProvides comprehensive, credible research with intelligent synthesis.", + "category": "Advanced Intelligence", + "subcategory": "research", + "inputSchema": { + "type": "object", + "properties": { + "query": { + "type": "string", + "description": "Research query with detailed context" + }, + "researchType": { + "type": "string", + "enum": [ + "technical_investigation", + "solution_discovery", + "best_practices", + "vulnerability_research", + "framework_comparison", + "library_evaluation", + "pattern_research", + "performance_optimization", + "security_analysis" + ], + "description": "Type of research to conduct" + }, + "providers": { + "type": "object", + "description": "Complex type" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "synthesisType": { + "type": "object", + "description": "Complex type" + }, + "maxResults": { + "type": "object", + "description": "Complex type" + }, + "includeUrlIntelligence": { + "type": "object", + "description": "Complex type" + }, + "contextAware": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "query", + "researchType", + "providers", + "synthesisType", + "maxResults", + "includeUrlIntelligence", + "contextAware" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Documentation" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 225, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis", + "Comprehensive analysis" + ] + } + }, + "bitcode://intelligence/multimodal/process": { + "name": "bitcode://intelligence/multimodal/process", + "description": "Comprehensive multimodal processing engine for all attachment types.\n\nAdvanced multimodal intelligence processing:\n• Image analysis with design pattern recognition\n• Audio transcription and content analysis\n• Video processing with scene understanding\n• Document extraction with intelligent parsing\n• Figma design analysis with implementation guidance\n• Cross-modal synthesis for unified understanding\n\nTransforms any media type into actionable technical knowledge evidence.", + "category": "Advanced Intelligence", + "subcategory": "multimodal", + "inputSchema": { + "type": "object", + "properties": { + "attachments": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + }, + "description": "Attachments to process" + }, + "processingType": { + "type": "string", + "enum": [ + "comprehensive_analysis", + "content_extraction", + "intelligence_synthesis", + "requirement_extraction", + "design_analysis", + "accessibility_audit", + "performance_analysis", + "security_scan" + ], + "description": "Type of multimodal processing" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + }, + "crossModalSynthesis": { + "type": "object", + "description": "Complex type" + }, + "includeImplementationGuidance": { + "type": "object", + "description": "Complex type" + }, + "contextRepository": { + "type": "object", + "description": "Complex type" + }, + "qualityThreshold": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "attachments", + "processingType", + "outputFormat", + "crossModalSynthesis", + "includeImplementationGuidance", + "qualityThreshold" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + } + }, + "bitcode://intelligence/enterprise/orchestrate": { + "name": "bitcode://intelligence/enterprise/orchestrate", + "description": "Enterprise intelligence orchestrator for organization-wide insights.\n\nStrategic enterprise intelligence coordination:\n• Team productivity analysis with skill gap identification\n• Knowledge mapping across departments and projects\n• Collaboration pattern analysis and optimization\n• Innovation metrics and strategic planning support\n• Risk assessment with mitigation recommendations\n• Industry benchmarking and competitive analysis\n\nProvides executive-level intelligence for strategic decision-making.", + "category": "Advanced Intelligence", + "subcategory": "enterprise", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "team_analysis", + "productivity_optimization", + "knowledge_mapping", + "skill_gap_analysis", + "collaboration_patterns", + "innovation_metrics", + "risk_assessment", + "strategic_planning" + ], + "description": "Enterprise intelligence operation" + }, + "organizationId": { + "type": "string", + "description": "Organization ID for analysis" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "timeHorizon": { + "type": "object", + "description": "Complex type" + }, + "analysisDepth": { + "type": "object", + "description": "Complex type" + }, + "includeRecommendations": { + "type": "object", + "description": "Complex type" + }, + "includeBenchmarking": { + "type": "object", + "description": "Complex type" + }, + "confidentialityLevel": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "organizationId", + "scope", + "timeHorizon", + "analysisDepth", + "includeRecommendations", + "includeBenchmarking", + "confidentialityLevel" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + } + }, + "bitcode://intelligence/marketplace/analyze": { + "name": "bitcode://intelligence/marketplace/analyze", + "description": "Sophisticated marketplace and procurement intelligence system.\n\nAdvanced solution discovery and quality assessment:\n• AI-powered solution discovery with requirement matching\n• Quality assessment with fraud detection and risk evaluation\n• Provider analysis with reputation and performance tracking\n• Price optimization recommendations with market analysis\n• Trend analysis for technology adoption and pricing\n• Competitive intelligence for strategic procurement\n\nEnables intelligent procurement with risk mitigation and value optimization.", + "category": "Advanced Intelligence", + "subcategory": "marketplace", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "solution_discovery", + "quality_assessment", + "provider_analysis", + "price_optimization", + "risk_evaluation", + "trend_analysis" + ], + "description": "Marketplace operation type" + }, + "requirements": { + "type": "object", + "description": "Complex type" + }, + "listingId": { + "type": "string" + }, + "providerId": { + "type": "string" + }, + "searchQuery": { + "type": "string" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "includeCompetitiveAnalysis": { + "type": "object", + "description": "Complex type" + }, + "riskTolerance": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "includeCompetitiveAnalysis", + "riskTolerance" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [], + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 150, + "factors": [ + "Base tool execution", + "ML processing", + "Cross-repository analysis" + ] + } + } + } + }, + "Enterprise Integration": { + "description": "Webhook orchestration, API management, and marketplace intelligence", + "tools": { + "bitcode://enterprise/webhook/orchestrate": { + "name": "bitcode://enterprise/webhook/orchestrate", + "description": "Advanced enterprise webhook orchestration with intelligent routing and transformation.\n\nComprehensive webhook management system:\n• Intelligent webhook routing with conditional logic\n• Advanced authentication including HMAC and JWT validation\n• Retry policies with exponential backoff and circuit breakers\n• Rate limiting and traffic shaping for webhook endpoints\n• Real-time analytics with performance monitoring\n• Batch webhook operations for enterprise-scale automation\n• Webhook transformation and payload filtering\n• Enterprise-grade security with audit logging\n\nEnables sophisticated event-driven architectures with enterprise reliability.", + "category": "Enterprise Integration", + "subcategory": "webhook", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "create_webhook", + "update_webhook", + "delete_webhook", + "list_webhooks", + "test_webhook", + "webhook_analytics", + "webhook_routing", + "batch_webhooks" + ], + "description": "Webhook operation type" + }, + "webhook": { + "type": "object", + "description": "Complex type" + }, + "testPayload": { + "type": "object", + "description": "Complex type" + }, + "analyticsTimeRange": { + "type": "object", + "description": "Complex type" + }, + "webhookIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "routingRules": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Security Analysis", + "Performance Optimization", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing" + ] + } + }, + "bitcode://enterprise/api/manage": { + "name": "bitcode://enterprise/api/manage", + "description": "Complete enterprise API lifecycle management with governance and analytics.\n\nFull-featured API management platform:\n• API versioning with semantic versioning and retirement management\n• Comprehensive rate limiting with tiered access controls\n• API governance with automated compliance checking\n• Interactive documentation generation with OpenAPI 3.0\n• Advanced authentication schemes with OAuth2 and JWT support\n• Performance monitoring with detailed analytics\n• Automated testing with comprehensive test suite execution\n• CORS configuration and security policy enforcement\n\nProvides enterprise-grade API management with governance and observability.", + "category": "Enterprise Integration", + "subcategory": "api", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "create_api", + "update_api", + "delete_api", + "list_apis", + "version_api", + "deploy_api", + "api_analytics", + "api_governance", + "rate_limit_config", + "api_documentation", + "api_testing" + ], + "description": "API management operation" + }, + "api": { + "type": "object", + "description": "Complex type" + }, + "versioningStrategy": { + "type": "string", + "enum": [ + "semver", + "date", + "sequential" + ] + }, + "environment": { + "type": "string", + "enum": [ + "development", + "staging", + "production" + ] + }, + "governanceRules": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "testSuite": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Feature Development", + "Security Analysis", + "Test Generation", + "Documentation", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 113, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing", + "Comprehensive analysis" + ] + } + }, + "bitcode://enterprise/integration/marketplace": { + "name": "bitcode://enterprise/integration/marketplace", + "description": "Enterprise integration marketplace with pre-built connectors and custom development.\n\nComprehensive integration ecosystem:\n• Browse and install pre-built integrations for popular enterprise tools\n• Custom connector development with multiple runtime support\n• Data mapping and transformation with visual designer\n• Event-driven integration patterns with intelligent triggers\n• Integration analytics with performance monitoring\n• Marketplace publishing for sharing custom integrations\n• Version management and rollback capabilities\n• Enterprise security compliance with audit trails\n\nAccelerates enterprise integration with proven patterns and custom solutions.", + "category": "Enterprise Integration", + "subcategory": "integration", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "browse_integrations", + "install_integration", + "configure_integration", + "update_integration", + "uninstall_integration", + "integration_analytics", + "custom_connector", + "marketplace_publish" + ], + "description": "Integration marketplace operation" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "integration": { + "type": "object", + "description": "Complex type" + }, + "connector": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Security Analysis", + "Performance Optimization", + "Business Intelligence" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing" + ] + } + }, + "bitcode://enterprise/observability/configure": { + "name": "bitcode://enterprise/observability/configure", + "description": "Advanced enterprise observability and telemetry with business intelligence.\n\nComplete observability platform:\n• Multi-dimensional metrics with custom aggregations\n• Distributed tracing with sampling strategies\n• Centralized logging with intelligent retention policies\n• Real-time alerting with escalation and notification routing\n• Interactive dashboards with collaborative features\n• Performance profiling with bottleneck identification\n• Anomaly detection with machine learning algorithms\n• Business intelligence integration with KPI tracking\n\nProvides comprehensive observability for enterprise-scale applications.", + "category": "Enterprise Integration", + "subcategory": "observability", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "setup_monitoring", + "configure_alerts", + "create_dashboard", + "export_metrics", + "trace_analysis", + "log_analysis", + "performance_profiling", + "business_intelligence", + "anomaly_detection" + ], + "description": "Observability operation type" + }, + "monitoringConfig": { + "type": "object", + "description": "Complex type" + }, + "alerts": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "dashboard": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Feature Development" + ], + "relatedTools": [ + "bitcode://observability/logs/analytics", + "bitcode://lsp/diagnostic/analyze" + ], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 113, + "factors": [ + "Base tool execution", + "API integrations", + "Data processing", + "Comprehensive analysis" + ] + } + } + } + }, + "LSP Integration": { + "description": "Deep semantic analysis and intelligent code navigation", + "tools": { + "bitcode://lsp/semantic/analyze": { + "name": "bitcode://lsp/semantic/analyze", + "description": "Deep semantic analysis engine with symbol resolution and dependency mapping.\n\nAdvanced semantic understanding capabilities:\n• Complete symbol analysis with type inference and relationship mapping\n• Dependency graph construction with cycle detection and modularity metrics\n• Semantic search with intelligent ranking and contextual suggestions\n• Call graph analysis with hotspot identification and dead code detection\n• Cross-language analysis with unified symbol resolution\n• Real-time hover information and signature help\n\nProvides comprehensive code understanding for intelligent development assistance.", + "category": "LSP Integration", + "subcategory": "semantic", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "symbol_analysis", + "dependency_graph", + "type_inference", + "call_graph", + "reference_analysis", + "definition_lookup", + "semantic_search", + "code_lens", + "hover_information", + "signature_help", + "workspace_symbols", + "document_symbols" + ], + "description": "LSP semantic analysis operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "targets": { + "type": "object", + "description": "Complex type" + }, + "position": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "searchQuery": { + "type": "string" + }, + "filters": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + }, + "includeSourceCode": { + "type": "object", + "description": "Complex type" + }, + "includeDocumentation": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository", + "outputFormat", + "includeSourceCode", + "includeDocumentation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + } + }, + "bitcode://lsp/intelligence/navigate": { + "name": "bitcode://lsp/intelligence/navigate", + "description": "Advanced code navigation and intelligent refactoring with change impact analysis.\n\nSophisticated code intelligence features:\n• Multi-language reference finding with usage pattern analysis\n• Safe symbol renaming with conflict detection and preview\n• Intelligent method extraction with parameter inference\n• Implementation finding across inheritance hierarchies\n• Code action suggestions with automated fixes\n• Smart import organization and dependency management\n\nEnables confident code navigation and refactoring with enterprise-grade safety.", + "category": "LSP Integration", + "subcategory": "intelligence", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "find_references", + "find_implementations", + "find_declarations", + "rename_symbol", + "extract_method", + "extract_variable", + "inline_method", + "move_symbol", + "organize_imports", + "auto_fix", + "code_actions", + "format_document", + "fold_ranges", + "selection_ranges" + ], + "description": "Code intelligence operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "symbol": { + "type": "object", + "description": "Complex type" + }, + "refactoringConfig": { + "type": "object", + "description": "Complex type" + }, + "range": { + "type": "object", + "description": "Complex type" + }, + "codeActionKind": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "quickfix", + "refactor", + "refactor.extract", + "refactor.inline", + "refactor.rewrite", + "source", + "source.organizeImports", + "source.fixAll", + "source.addMissingImports" + ] + } + }, + "formattingOptions": { + "type": "object", + "description": "Complex type" + }, + "executeActions": { + "type": "object", + "description": "Complex type" + }, + "dryRun": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository", + "executeActions", + "dryRun" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Feature Development", + "Code Refactoring" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + }, + "bitcode://lsp/diagnostic/analyze": { + "name": "bitcode://lsp/diagnostic/analyze", + "description": "Comprehensive diagnostic engine with multi-axis code quality analysis.\n\nAdvanced diagnostic capabilities:\n• Multi-language syntax and semantic validation\n• Performance analysis with bottleneck identification\n• Security vulnerability scanning with remediation suggestions\n• Code complexity analysis with maintainability metrics\n• Test coverage analysis with gap identification\n• Dependency audit with vulnerability assessment\n\nProvides comprehensive code health assessment with actionable insights.", + "category": "LSP Integration", + "subcategory": "diagnostic", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "run_diagnostics", + "lint_analysis", + "type_checking", + "syntax_validation", + "security_scan", + "performance_analysis", + "code_complexity", + "test_coverage", + "dependency_audit", + "code_metrics", + "quality_gates", + "compliance_check" + ], + "description": "Diagnostic operation type" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "diagnosticConfig": { + "type": "object", + "description": "Complex type" + }, + "qualityThresholds": { + "type": "object", + "description": "Complex type" + }, + "analysisPreferences": { + "type": "object", + "description": "Complex type" + }, + "outputConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + } + }, + "bitcode://lsp/workspace/intelligence": { + "name": "bitcode://lsp/workspace/intelligence", + "description": "Workspace-wide intelligence with architectural insights and project understanding.\n\nComprehensive workspace analysis:\n• Project structure analysis with architectural pattern detection\n• Module dependency mapping with coupling analysis\n• API surface analysis with breaking change detection\n• Change impact analysis with transitive dependency tracking\n• Technical debt assessment with remediation planning\n• Knowledge graph construction with relationship visualization\n\nProvides executive-level project intelligence for strategic decision-making.", + "category": "LSP Integration", + "subcategory": "workspace", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "workspace_analysis", + "project_structure", + "architecture_overview", + "module_dependencies", + "api_surface", + "change_impact", + "hotspot_analysis", + "technical_debt", + "code_ownership", + "knowledge_graph", + "migration_analysis" + ], + "description": "Workspace intelligence operation" + }, + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisScope": { + "type": "object", + "description": "Complex type" + }, + "changeAnalysis": { + "type": "object", + "description": "Complex type" + }, + "architectureConfig": { + "type": "object", + "description": "Complex type" + }, + "knowledgeGraphConfig": { + "type": "object", + "description": "Complex type" + }, + "migrationConfig": { + "type": "object", + "description": "Complex type" + }, + "visualizationConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "repository" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + } + } + }, + "Observability": { + "description": "Real-time metrics, distributed tracing, and business intelligence", + "tools": { + "bitcode://observability/metrics/realtime": { + "name": "bitcode://observability/metrics/realtime", + "description": "Advanced real-time metrics collection, querying, and alerting system.\n\nComprehensive metrics platform:\n• Real-time metrics collection with multiple data types\n• Advanced querying with aggregations and filtering\n• Intelligent alerting with multi-channel notifications\n• Interactive dashboards with customizable visualizations\n• Metrics streaming for real-time monitoring\n• Anomaly detection with machine learning algorithms\n• Historical analysis with trend identification\n• Performance benchmarking and comparison\n\nProvides enterprise-grade metrics infrastructure for complete observability.", + "category": "Observability", + "subcategory": "metrics", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "collect_metrics", + "query_metrics", + "create_alert", + "manage_dashboards", + "stream_metrics", + "export_metrics", + "aggregate_metrics", + "metric_analysis" + ], + "description": "Metrics operation type" + }, + "metrics": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "query": { + "type": "object", + "description": "Complex type" + }, + "alert": { + "type": "object", + "description": "Complex type" + }, + "dashboard": { + "type": "object", + "description": "Complex type" + }, + "streamConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + }, + "bitcode://observability/tracing/distributed": { + "name": "bitcode://observability/tracing/distributed", + "description": "Sophisticated distributed tracing with performance profiling and bottleneck detection.\n\nAdvanced tracing capabilities:\n• End-to-end distributed trace analysis\n• Performance profiling with flame graphs and hotspot identification\n• Service topology mapping with dependency visualization\n• Latency analysis with percentile calculations\n• Error correlation across service boundaries\n• Bottleneck detection with root cause analysis\n• Request flow visualization with timing breakdown\n• Cross-service performance optimization recommendations\n\nEnables deep performance understanding in distributed systems.", + "category": "Observability", + "subcategory": "tracing", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "start_trace", + "end_trace", + "add_span", + "trace_analysis", + "performance_profiling", + "bottleneck_detection", + "trace_correlation", + "service_map", + "latency_analysis", + "error_tracking" + ], + "description": "Tracing operation type" + }, + "trace": { + "type": "object", + "description": "Complex type" + }, + "span": { + "type": "object", + "description": "Complex type" + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "profilingConfig": { + "type": "object", + "description": "Complex type" + }, + "serviceMapConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [], + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + } + }, + "bitcode://observability/intelligence/business": { + "name": "bitcode://observability/intelligence/business", + "description": "Business intelligence platform for engineering metrics and strategic insights.\n\nStrategic analytics capabilities:\n• Technical productivity metrics with team comparisons\n• ROI calculation for engineering investments\n• Technical debt analysis with cost implications\n• Velocity trends with predictive forecasting\n• Quality metrics with benchmark comparisons\n• Innovation tracking with patent and contribution analysis\n• Executive dashboards with strategic KPIs\n• Industry benchmarking with competitive analysis\n\nProvides C-level insights for engineering organization optimization.", + "category": "Observability", + "subcategory": "intelligence", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "engineering_metrics", + "productivity_analysis", + "team_performance", + "cost_analysis", + "roi_calculation", + "trend_analysis", + "forecasting", + "benchmarking", + "executive_dashboard", + "strategic_insights" + ], + "description": "Business intelligence operation" + }, + "scope": { + "type": "object", + "description": "Complex type" + }, + "metricsConfig": { + "type": "object", + "description": "Complex type" + }, + "analysisPreferences": { + "type": "object", + "description": "Complex type" + }, + "outputConfig": { + "type": "object", + "description": "Complex type" + }, + "benchmarkConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation", + "scope", + "metricsConfig" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Business Intelligence" + ], + "relatedTools": [], + "complexity": "moderate", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + }, + "bitcode://observability/logs/analytics": { + "name": "bitcode://observability/logs/analytics", + "description": "Advanced log analytics with pattern detection, anomaly analysis, and compliance reporting.\n\nComprehensive log intelligence:\n• Real-time log ingestion with intelligent parsing\n• Pattern detection using machine learning algorithms\n• Anomaly detection with behavioral analysis\n• Security analysis with threat detection\n• Compliance reporting with audit trails\n• Log correlation across services and timeframes\n• Error analysis with impact assessment\n• Predictive alerting based on log patterns\n\nTransforms logs into actionable intelligence for operational excellence.", + "category": "Observability", + "subcategory": "logs", + "inputSchema": { + "type": "object", + "properties": { + "operation": { + "type": "string", + "enum": [ + "log_ingestion", + "log_analysis", + "pattern_detection", + "anomaly_detection", + "log_correlation", + "error_analysis", + "log_search", + "log_aggregation", + "compliance_reporting", + "security_analysis" + ], + "description": "Log analytics operation" + }, + "logs": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisConfig": { + "type": "object", + "description": "Complex type" + }, + "searchQuery": { + "type": "object", + "description": "Complex type" + }, + "patternConfig": { + "type": "object", + "description": "Complex type" + }, + "anomalyConfig": { + "type": "object", + "description": "Complex type" + }, + "complianceConfig": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "operation" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Business Intelligence" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + } + } + }, + "Analysis": { + "description": "Code analysis and repository intelligence", + "tools": { + "bitcode://analysis/repository/analyze": { + "name": "bitcode://analysis/repository/analyze", + "description": "Perform comprehensive AI-powered repository analysis.\n\nAdvanced analysis capabilities including:\n• Architecture pattern detection and evaluation\n• Security vulnerability assessment with OWASP compliance\n• Performance bottleneck identification and optimization\n• Code quality metrics and maintainability scoring\n• Dependency analysis with vulnerability scanning\n• Technical debt assessment and remediation planning\n\nSupports multiple analysis depths from surface-level scanning to deep architectural review.\nGenerates actionable insights with confidence scoring and remediation guidance.", + "category": "Analysis", + "subcategory": "repository", + "inputSchema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisType": { + "type": "string", + "enum": [ + "architecture", + "dependencies", + "security", + "performance", + "quality", + "complexity", + "patterns", + "technical_debt" + ], + "description": "Type of analysis to perform" + }, + "depth": { + "type": "object", + "description": "Complex type" + }, + "includeMetrics": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "analysisType", + "depth", + "includeMetrics", + "outputFormat" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "General Technical Work" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 75, + "factors": [ + "Base tool execution", + "Comprehensive analysis" + ] + } + }, + "bitcode://analysis/intelligence/synthesize": { + "name": "bitcode://analysis/intelligence/synthesize", + "description": "Synthesize technical knowledge across repositories and time periods.\n\nAI-powered intelligence synthesis providing:\n• Cross-repository pattern identification\n• Technical productivity trend analysis\n• Quality and security posture evolution\n• Technology adoption and migration insights\n• Team performance and collaboration patterns\n• Predictive insights for technical decisions\n\nGenerates strategic insights for technical leadership with confidence-scored recommendations.", + "category": "Analysis", + "subcategory": "intelligence", + "inputSchema": { + "type": "object", + "properties": { + "scope": { + "type": "object", + "description": "Complex type" + }, + "timeframe": { + "type": "object", + "description": "Complex type" + }, + "repositories": { + "type": "array", + "items": { + "type": "object", + "description": "Complex type" + } + }, + "analysisTypes": { + "type": "object", + "description": "Complex type" + }, + "includeRecommendations": { + "type": "object", + "description": "Complex type" + }, + "confidenceThreshold": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "scope", + "timeframe", + "analysisTypes", + "includeRecommendations", + "confidenceThreshold" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Security Analysis", + "Performance Optimization" + ], + "relatedTools": [], + "complexity": "advanced", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + }, + "bitcode://analysis/patterns/detect": { + "name": "bitcode://analysis/patterns/detect", + "description": "Detect and analyze code patterns across repositories.\n\nPattern detection including:\n• Design patterns (Observer, Factory, Strategy, etc.)\n• Anti-patterns (God Object, Spaghetti Code, etc.)\n• Architectural patterns (MVC, MVP, MVVM, etc.)\n• Performance patterns and optimization opportunities\n• Testing patterns and coverage gaps\n• Security patterns and vulnerability patterns\n\nProvides pattern confidence scoring, code examples, and refactoring recommendations.", + "category": "Analysis", + "subcategory": "patterns", + "inputSchema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "patternTypes": { + "type": "object", + "description": "Complex type" + }, + "language": { + "type": "string" + }, + "includeExamples": { + "type": "object", + "description": "Complex type" + }, + "severity": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "patternTypes", + "includeExamples", + "severity" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Code Refactoring" + ], + "relatedTools": [], + "complexity": "simple", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + }, + "bitcode://analysis/dependencies/analyze": { + "name": "bitcode://analysis/dependencies/analyze", + "description": "Comprehensive dependency analysis and risk assessment.\n\nDependency analysis including:\n• Direct and transitive dependency mapping\n• Security vulnerability scanning across dependency tree\n• License compatibility analysis and compliance checking\n• Update availability and breaking change detection\n• Dependency size and performance impact analysis\n• Unused dependency identification\n\nProvides dependency graph visualization and update recommendations with risk assessment.", + "category": "Analysis", + "subcategory": "dependencies", + "inputSchema": { + "type": "object", + "properties": { + "repository": { + "type": "object", + "description": "Complex type" + }, + "analysisDepth": { + "type": "object", + "description": "Complex type" + }, + "includeVulnerabilities": { + "type": "object", + "description": "Complex type" + }, + "includeLicenses": { + "type": "object", + "description": "Complex type" + }, + "includeUpdates": { + "type": "object", + "description": "Complex type" + }, + "outputFormat": { + "type": "object", + "description": "Complex type" + } + }, + "required": [ + "repository", + "analysisDepth", + "includeVulnerabilities", + "includeLicenses", + "includeUpdates", + "outputFormat" + ], + "additionalProperties": false + }, + "examples": [], + "useCases": [ + "Performance Optimization" + ], + "relatedTools": [], + "complexity": "expert", + "measuredBtdEstimate": { + "estimated": 50, + "factors": [ + "Base tool execution" + ] + } + } + } + } + }, + "integrationPatterns": { + "Claude Desktop": { + "setup": "Add to ~/.config/claude/mcp-servers.json:\n{\n \"mcpServers\": {\n \"bitcode\": {\n \"command\": \"npx\",\n \"args\": [\"@bitcode/mcp-server\"],\n \"env\": { \"BITCODE_API_KEY\": \"your-api-key\" }\n }\n }\n}", + "example": "\"Create a React component for file uploads with drag-and-drop functionality\"", + "features": [ + "Real-time streaming", + "Rich responses", + "Interactive tables" + ] + }, + "VS Code": { + "setup": "Install the Bitcode MCP extension and configure with API key", + "example": "Right-click file → \"Analyze with Bitcode MCP\"", + "features": [ + "IDE integration", + "Code actions", + "Inline suggestions" + ] + }, + "GitHub Actions": { + "setup": "- uses: bitcode/mcp-action@v1\n with:\n tool: \"bitcode://pipelines/asset-pack/execute\"\n token: ${{ secrets.BITCODE_API_KEY }}", + "example": "Automated implementation and validation on every PR", + "features": [ + "CI/CD integration", + "Automated workflows", + "Quality gates" + ] + }, + "Custom API": { + "setup": "const client = new MCPClient({ apiKey: process.env.BITCODE_API_KEY });", + "example": "await client.callTool(\"bitcode://pipelines/asset-pack/execute\", args);", + "features": [ + "REST API", + "WebSocket streaming", + "Custom integrations" + ] + } + }, + "workflows": { + "Full-Stack Feature Development": { + "description": "Complete feature development from design to deployment", + "steps": [ + { + "tool": "bitcode://analysis/repository/analyze", + "description": "Analyze existing architecture and patterns" + }, + { + "tool": "bitcode://pipelines/asset-pack/execute", + "description": "Implement feature with tests and documentation" + }, + { + "tool": "bitcode://intelligence/effectiveness/track", + "description": "Measure implementation effectiveness" + } + ], + "complexity": "moderate", + "estimatedTime": "15-45 minutes" + }, + "Code Quality Improvement": { + "description": "Systematic code quality improvement across repositories", + "steps": [ + { + "tool": "bitcode://intelligence/cross-repo/learn", + "description": "Extract quality patterns from successful repositories" + }, + { + "tool": "bitcode://orchestration/pipeline/orchestrate", + "description": "Apply improvements across multiple repositories" + }, + { + "tool": "bitcode://observability/metrics/realtime", + "description": "Monitor quality improvements over time" + } + ], + "complexity": "advanced", + "estimatedTime": "30-90 minutes" + }, + "Enterprise Automation Setup": { + "description": "Set up enterprise-grade automation and observability", + "steps": [ + { + "tool": "bitcode://enterprise/webhook/orchestrate", + "description": "Configure intelligent webhook routing" + }, + { + "tool": "bitcode://enterprise/api/manage", + "description": "Set up API management and governance" + }, + { + "tool": "bitcode://observability/intelligence/business", + "description": "Configure business intelligence dashboards" + } + ], + "complexity": "expert", + "estimatedTime": "60-180 minutes" + } + } +} \ No newline at end of file diff --git a/packages/executions-mcp/src/mcp-server/docs/openapi/bitcode-mcp-openapi.json b/packages/executions-mcp/src/mcp-server/docs/openapi/bitcode-mcp-openapi.json index c6d1a253f..fd8b8d29f 100644 --- a/packages/executions-mcp/src/mcp-server/docs/openapi/bitcode-mcp-openapi.json +++ b/packages/executions-mcp/src/mcp-server/docs/openapi/bitcode-mcp-openapi.json @@ -1,9 +1,9 @@ { "openapi": "3.0.3", "info": { - "title": "Bitcode MCP Interface API", + "title": "Bitcode MCP Server API", "version": "1.0.0", - "description": "# Bitcode MCP Interface API\n\nThe Bitcode Exchange-facing Model Context Protocol interface for read measurement, repository operations, activity continuation, and asset-pack/output workflows.\n\n## Boundary\n\n- `Bitcode Protocol` defines the canon, proofs, tests, and promotional audit system\n- `Bitcode Exchange` owns the backend ledgers, transactions, schemas, routes, and utilities\n- `Bitcode Terminal` is the primary human UX/UI\n- `Bitcode MCP` is one admitted machine interface over Bitcode Exchange\n\n## Interface semantics\n\n- third-party MCPs, repository connections, and attachments are ingress/input context\n- asset packs, proofs, history, and settlement follow-through are output meaning\n- clients should read and write the same Bitcode-owned state model as the Terminal\n\n## Getting Started\n\n1. **Get API Key**: Create an API key in your Bitcode account\n2. **Connect a Client**: Use an MCP-capable client (e.g., Claude Desktop)\n3. **Call a Tool**: Invoke an admitted `bitcode://` tool against Bitcode Exchange state\n\n## Support\n\n- **Documentation**: https://docs.bitcode.dev/mcp\n- **Community**: https://discord.gg/bitcode-mcp\n- **Support**: mcp-support@bitcode.dev", + "description": "\n# Bitcode MCP Server API\n\nThe Model Context Protocol (MCP) server exposing Bitcode’s technical knowledge exchange via standardized tools, resources, and prompts.\n\n## Features\n\n- Tools interface for AssetPack execution and optional Shippable delivery\n- Real‑time streaming (WebSocket)\n- Multi‑modal attachments (Figma, documents, images, audio, video)\n- BTC fee posture plus measured non-fungible $BTD AssetPack amount\n\n## Getting Started\n\n1. **Get API Key** in your Bitcode account\n2. **Connect an MCP Client** (e.g., Claude Desktop)\n3. **Call a Tool**: \n - \n name: `bitcode://pipelines/asset-pack/execute`\n \n## Support\n\n- **Documentation**: https://docs.bitcode.dev/mcp\n- **Community**: https://discord.gg/bitcode-mcp\n- **Support**: mcp-support@bitcode.dev\n ", "contact": { "name": "Bitcode API Support", "url": "https://bitcode.dev/support", @@ -30,8 +30,12 @@ } ], "security": [ - { "ApiKeyAuth": [] }, - { "BearerAuth": [] } + { + "ApiKeyAuth": [] + }, + { + "BearerAuth": [] + } ], "components": { "securitySchemes": { @@ -51,7 +55,10 @@ "schemas": { "RepositoryContext": { "type": "object", - "required": ["owner", "name"], + "required": [ + "owner", + "name" + ], "properties": { "owner": { "type": "string", @@ -74,7 +81,7 @@ "description": "Optional path within repository to focus on", "example": "src/components" }, - "installationId": { + "connectionId": { "type": "integer", "description": "GitHub App installation ID", "example": 12345 @@ -83,11 +90,22 @@ }, "Attachment": { "type": "object", - "required": ["type", "content"], + "required": [ + "type", + "content" + ], "properties": { "type": { "type": "string", - "enum": ["image", "document", "audio", "video", "url", "figma", "file"], + "enum": [ + "image", + "document", + "audio", + "video", + "url", + "figma", + "file" + ], "description": "Type of attachment for specialized processing" }, "content": { @@ -101,14 +119,24 @@ "description": "Additional metadata for processing", "example": { "title": "E-commerce Design System", - "components": ["Button", "Card", "Modal"] + "components": [ + "Button", + "Card", + "Modal" + ] } } } }, "PipelineStatus": { "type": "string", - "enum": ["pending", "running", "completed", "failed", "cancelled"], + "enum": [ + "pending", + "running", + "completed", + "failed", + "cancelled" + ], "description": "Current status of pipeline execution" }, "ExecutionMetrics": { @@ -116,24 +144,9 @@ "properties": { "measuredBtd": { "type": "integer", - "description": "Measured non-fungible $BTD content amount for the AssetPack", + "description": "Measured non-fungible `$BTD` content amount for the AssetPack", "example": 150 }, - "btdSemantics": { - "type": "string", - "enum": ["non_fungible_asset_pack_share_read_right"], - "description": "Canonical $BTD semantics" - }, - "feeAsset": { - "type": "string", - "enum": ["BTC"], - "description": "Fee settlement asset" - }, - "btcFeeUsdEquivalent": { - "type": "number", - "description": "Reference USD equivalent for BTC fees, when known", - "example": 12.5 - }, "tokensProcessed": { "type": "integer", "description": "Total tokens processed by AI models", @@ -150,6 +163,24 @@ "type": "integer", "description": "Execution duration in milliseconds", "example": 180000 + }, + "phases": { + "type": "object", + "description": "Per-phase execution metrics", + "additionalProperties": { + "type": "object", + "properties": { + "duration": { + "type": "integer" + }, + "success": { + "type": "boolean" + }, + "confidence": { + "type": "number" + } + } + } } } }, @@ -180,7 +211,11 @@ }, "AssetPackRequest": { "type": "object", - "required": ["task", "repository", "subtype"], + "required": [ + "task", + "repository", + "subtype" + ], "properties": { "task": { "type": "string", @@ -188,15 +223,21 @@ "description": "Detailed task description (minimum 10 characters)", "example": "Create a complete user authentication system with JWT tokens, password hashing, and email verification" }, - "repository": { "$ref": "#/components/schemas/RepositoryContext" }, + "repository": { + "$ref": "#/components/schemas/RepositoryContext" + }, "subtype": { "type": "string", - "enum": ["pull_request", "pr_review", "issue", "comment", "blog_post", "diagram", "api_spec", "frontend_scaffolder", "scope_analysis", "implementation_plan", "refactor_proposal"], + "enum": [ + "pull_request" + ], "description": "V26 Shippable type to create" }, "attachments": { "type": "array", - "items": { "$ref": "#/components/schemas/Attachment" }, + "items": { + "$ref": "#/components/schemas/Attachment" + }, "description": "Optional attachments for multimodal processing" }, "options": { @@ -224,6 +265,11 @@ } } }, + "mcpConfig": { + "type": "object", + "additionalProperties": true, + "description": "MCP provider configuration for external integrations" + }, "streaming": { "type": "boolean", "default": true, @@ -239,13 +285,19 @@ "description": "Unique pipeline execution identifier", "example": "pipeline-123e4567-e89b-12d3-a456-426614174000" }, - "status": { "$ref": "#/components/schemas/PipelineStatus" }, + "status": { + "$ref": "#/components/schemas/PipelineStatus" + }, "assetPacks": { "type": "array", - "items": { "$ref": "#/components/schemas/AssetPack" }, + "items": { + "$ref": "#/components/schemas/AssetPack" + }, "description": "Generated AssetPack results and PR Shippables" }, - "metrics": { "$ref": "#/components/schemas/ExecutionMetrics" }, + "metrics": { + "$ref": "#/components/schemas/ExecutionMetrics" + }, "streamUrl": { "type": "string", "format": "uri", @@ -266,7 +318,10 @@ }, "MCPError": { "type": "object", - "required": ["code", "message"], + "required": [ + "code", + "message" + ], "properties": { "code": { "type": "string", @@ -301,7 +356,9 @@ "description": "Bad Request - Invalid input parameters", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MCPError" }, + "schema": { + "$ref": "#/components/schemas/MCPError" + }, "example": { "code": "INVALID_REQUEST", "message": "Task description must be at least 10 characters long", @@ -315,7 +372,9 @@ "description": "Unauthorized - Invalid or missing API key", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MCPError" }, + "schema": { + "$ref": "#/components/schemas/MCPError" + }, "example": { "code": "AUTHENTICATION_FAILED", "message": "Invalid API key provided", @@ -329,7 +388,9 @@ "description": "Forbidden - Insufficient permissions", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MCPError" }, + "schema": { + "$ref": "#/components/schemas/MCPError" + }, "example": { "code": "INSUFFICIENT_PERMISSIONS", "message": "User lacks required permissions for this operation", @@ -343,7 +404,9 @@ "description": "Not Found - Resource does not exist", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/MCPError" }, + "schema": { + "$ref": "#/components/schemas/MCPError" + }, "example": { "code": "RESOURCE_NOT_FOUND", "message": "Pipeline not found", @@ -352,6 +415,38 @@ } } } + }, + "RateLimitExceeded": { + "description": "Rate Limit Exceeded - Too many requests", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPError" + }, + "example": { + "code": "RATE_LIMIT_EXCEEDED", + "message": "Rate limit exceeded for current limits", + "retryable": true, + "suggestion": "Wait 60 seconds before retrying or contact support to adjust limits" + } + } + } + }, + "InternalServerError": { + "description": "Internal Server Error - Unexpected server error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MCPError" + }, + "example": { + "code": "INTERNAL_SERVER_ERROR", + "message": "An unexpected error occurred", + "retryable": true, + "suggestion": "Please try again or contact support if the issue persists" + } + } + } } } }, @@ -361,7 +456,9 @@ "summary": "List Available Tools", "description": "Get a comprehensive list of all available MCP tools with their capabilities and descriptions.", "operationId": "listTools", - "tags": ["Tools"], + "tags": [ + "Tools" + ], "responses": { "200": { "description": "List of available tools", @@ -389,32 +486,78 @@ "type": "string", "description": "Tool category", "example": "pipeline" + }, + "schema": { + "type": "object", + "description": "JSON schema for tool parameters" } } } } } + }, + "example": { + "tools": [ + { + "name": "bitcode://pipelines/asset-pack/create", + "description": "Create a PR-backed AssetPack with comprehensive testing and documentation", + "category": "pipeline", + "schema": { + "type": "object", + "required": [ + "task", + "repository", + "subtype" + ], + "properties": { + "task": { + "type": "string", + "minLength": 10 + }, + "repository": { + "$ref": "#/components/schemas/RepositoryContext" + }, + "subtype": { + "type": "string", + "enum": [ + "pull_request" + ] + } + } + } + } + ] } } } }, - "401": { "$ref": "#/components/responses/Unauthorized" } + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, "/tools/call": { "post": { - "summary": "Execute Tool", - "description": "Execute a specific MCP tool with the provided parameters. Supports both synchronous and streaming execution modes.", + "summary": "Execute MCP Tool", + "description": "Execute supported MCP tools with the provided parameters.\n\nSupports both synchronous and streaming execution modes.", "operationId": "callTool", - "tags": ["Tools"], + "tags": [ + "Tools" + ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", - "required": ["name", "arguments"], + "required": [ + "name", + "arguments" + ], "properties": { "name": { "type": "string", @@ -423,7 +566,22 @@ }, "arguments": { "type": "object", - "description": "Tool-specific parameters" + "description": "Tool-specific parameters", + "example": { + "task": "Create user authentication system with JWT and email verification", + "repository": { + "owner": "mycompany", + "name": "webapp", + "branch": "feature/auth" + }, + "subtype": "pull_request", + "options": { + "createPR": true, + "runTests": true, + "generateDocs": true, + "securityCheck": true + } + } } } }, @@ -441,6 +599,19 @@ "branch": "feature/auth" }, "subtype": "pull_request", + "attachments": [ + { + "type": "figma", + "content": "https://www.figma.com/file/ABC123/Auth-Flow", + "metadata": { + "pages": [ + "Login", + "Signup", + "Reset Password" + ] + } + } + ], "options": { "createPR": true, "runTests": true, @@ -459,13 +630,83 @@ "description": "Tool execution completed successfully", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/PipelineResponse" } + "schema": { + "$ref": "#/components/schemas/PipelineResponse" + }, + "examples": { + "successfulAssetPack": { + "summary": "Successful Feature Creation", + "value": { + "pipelineId": "pipeline-123e4567-e89b-12d3-a456-426614174000", + "status": "completed", + "assetPacks": [ + { + "type": "pull_request", + "url": "https://github.com/mycompany/webapp/pull/123", + "metadata": { + "title": "Add user authentication system", + "commits": 7, + "filesChanged": 15 + } + } + ], + "metrics": { + "measuredBtd": 150, + "tokensProcessed": 25000, + "confidence": 0.92, + "duration": 480000, + "phases": { + "setup": { + "duration": 60000, + "success": true, + "confidence": 0.95 + }, + "discovery": { + "duration": 120000, + "success": true, + "confidence": 0.89 + }, + "implementation": { + "duration": 240000, + "success": true, + "confidence": 0.93 + }, + "testing": { + "duration": 45000, + "success": true, + "confidence": 0.87 + }, + "delivery": { + "duration": 15000, + "success": true, + "confidence": 0.96 + } + } + }, + "streamUrl": "wss://stream.bitcode.dev/pipeline/123e4567-e89b-12d3-a456-426614174000", + "startTime": "2024-01-15T10:00:00Z", + "endTime": "2024-01-15T10:08:00Z" + } + } + } } } }, - "400": { "$ref": "#/components/responses/BadRequest" }, - "401": { "$ref": "#/components/responses/Unauthorized" }, - "403": { "$ref": "#/components/responses/Forbidden" } + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "429": { + "$ref": "#/components/responses/RateLimitExceeded" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } }, @@ -474,7 +715,9 @@ "summary": "Get Pipeline Status", "description": "Retrieve the current status and results of a specific pipeline execution.", "operationId": "getPipelineStatus", - "tags": ["Pipelines"], + "tags": [ + "Pipelines" + ], "parameters": [ { "name": "pipelineId", @@ -492,12 +735,311 @@ "description": "Pipeline status and details", "content": { "application/json": { - "schema": { "$ref": "#/components/schemas/PipelineResponse" } + "schema": { + "$ref": "#/components/schemas/PipelineResponse" + } + } + } + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + } + } + }, + "/pipelines/{pipelineId}/cancel": { + "post": { + "summary": "Cancel Pipeline", + "description": "Cancel a running pipeline execution. Only pipelines in \"pending\" or \"running\" status can be cancelled.", + "operationId": "cancelPipeline", + "tags": [ + "Pipelines" + ], + "parameters": [ + { + "name": "pipelineId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Unique pipeline identifier" + } + ], + "responses": { + "200": { + "description": "Pipeline cancelled successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "pipelineId": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "cancelled" + ] + }, + "message": { + "type": "string" + } + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + } + } + }, + "/resources/list": { + "get": { + "summary": "List Available Resources", + "description": "Get a list of all available MCP resources for data access and analysis.", + "operationId": "listResources", + "tags": [ + "Resources" + ], + "responses": { + "200": { + "description": "List of available resources", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "resources": { + "type": "array", + "items": { + "type": "object", + "properties": { + "uri": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "mimeType": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } + } + } + }, + "/pipelines/{pipelineId}/stream": { + "get": { + "summary": "Stream Pipeline Events", + "description": "Connect to real-time pipeline execution updates via Server-Sent Events (SSE).", + "operationId": "streamPipeline", + "tags": [ + "Streaming" + ], + "parameters": [ + { + "name": "pipelineId", + "in": "path", + "required": true, + "schema": { + "type": "string" + }, + "description": "Pipeline execution ID" + } + ], + "responses": { + "200": { + "description": "SSE stream established", + "content": { + "text/event-stream": { + "schema": { + "type": "string", + "description": "Server-Sent Events stream" + }, + "examples": { + "phaseUpdate": { + "summary": "Phase update event", + "value": "event: phase_start\\ndata: {\"phase\":\"Implementation\",\"agent\":\"CodeGenerator\",\"progress\":45}\\n\\n" + } + } } } }, - "401": { "$ref": "#/components/responses/Unauthorized" }, - "404": { "$ref": "#/components/responses/NotFound" } + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "404": { + "$ref": "#/components/responses/NotFound" + } + } + } + }, + "/stream/websocket": { + "get": { + "summary": "WebSocket Streaming", + "description": "Connect to real-time updates via WebSocket. Append query parameters: ?pipelineId=xxx&token=xxx", + "operationId": "websocketStream", + "tags": [ + "Streaming" + ], + "responses": { + "101": { + "description": "WebSocket connection upgraded", + "headers": { + "Upgrade": { + "schema": { + "type": "string", + "enum": [ + "websocket" + ] + } + }, + "Connection": { + "schema": { + "type": "string", + "enum": [ + "Upgrade" + ] + } + } + } + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + } + } + } + }, + "/webhooks": { + "post": { + "summary": "Create Webhook", + "description": "Register a webhook endpoint to receive real-time notifications about pipeline events.", + "operationId": "createWebhook", + "tags": [ + "Webhooks" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "url", + "events" + ], + "properties": { + "url": { + "type": "string", + "format": "uri", + "description": "Webhook endpoint URL", + "example": "https://myapp.com/webhooks/bitcode" + }, + "events": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "pipeline.started", + "pipeline.completed", + "pipeline.failed", + "pipeline.cancelled", + "analysis.finished", + "security.alert", + "evidence_document.completed" + ] + }, + "description": "Events to subscribe to", + "example": [ + "pipeline.completed", + "pipeline.failed" + ] + }, + "secret": { + "type": "string", + "description": "Secret for webhook signature verification", + "example": "webhook-secret-key" + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Webhook created successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "webhookId": { + "type": "string" + }, + "url": { + "type": "string" + }, + "events": { + "type": "array", + "items": { + "type": "string" + } + }, + "createdAt": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/Unauthorized" + }, + "500": { + "$ref": "#/components/responses/InternalServerError" + } } } } @@ -505,19 +1047,39 @@ "tags": [ { "name": "Tools", - "description": "Execute sophisticated engineering tools and pipelines" + "description": "Execute sophisticated engineering tools and pipelines", + "externalDocs": { + "description": "Complete tool reference", + "url": "https://docs.bitcode.dev/mcp/tools" + } }, { "name": "Pipelines", - "description": "Monitor and control pipeline executions" + "description": "Monitor and control pipeline executions", + "externalDocs": { + "description": "Pipeline documentation", + "url": "https://docs.bitcode.dev/mcp/pipelines" + } }, { "name": "Resources", "description": "Access read-only data and analytics" + }, + { + "name": "Webhooks", + "description": "Real-time event notifications" + }, + { + "name": "Streaming", + "description": "Real-time updates via WebSocket/SSE", + "externalDocs": { + "description": "Streaming guide", + "url": "https://docs.bitcode.dev/mcp/streaming" + } } ], "externalDocs": { "description": "Complete MCP Documentation", "url": "https://docs.bitcode.dev/mcp" } -} +} \ No newline at end of file diff --git a/packages/executions-mcp/src/mcp-server/src/docs/mcp-spec-generator.ts b/packages/executions-mcp/src/mcp-server/src/docs/mcp-spec-generator.ts index eb4c9a105..8ea855faa 100644 --- a/packages/executions-mcp/src/mcp-server/src/docs/mcp-spec-generator.ts +++ b/packages/executions-mcp/src/mcp-server/src/docs/mcp-spec-generator.ts @@ -85,6 +85,10 @@ interface BitcodeMCPSpecification { }; } +function normalizeGeneratedMarkdown(value: string): string { + return `${value.replace(/[ \t]+$/gm, '').replace(/\n+$/u, '')}\n`; +} + /** * Generate comprehensive MCP specification */ @@ -540,7 +544,7 @@ export class MCPSpecificationGenerator { } } - writeFileSync(join(outputDir, 'mcp-api-reference.md'), docs); + writeFileSync(join(outputDir, 'mcp-api-reference.md'), normalizeGeneratedMarkdown(docs)); } /** @@ -613,7 +617,7 @@ export class MCPSpecificationGenerator { writeFileSync( join(outputDir, 'mcp-openapi.json'), - JSON.stringify(openApiSpec, null, 2) + `${JSON.stringify(openApiSpec, null, 2)}\n` ); } @@ -646,7 +650,7 @@ ${pattern.features.map(f => `- ${f}`).join('\n')} `; } - writeFileSync(join(outputDir, 'mcp-integration-examples.md'), examples); + writeFileSync(join(outputDir, 'mcp-integration-examples.md'), normalizeGeneratedMarkdown(examples)); } } diff --git a/packages/orm/src/client.ts b/packages/orm/src/client.ts index d61a8720c..608ff5371 100644 --- a/packages/orm/src/client.ts +++ b/packages/orm/src/client.ts @@ -30,6 +30,57 @@ import { BitcodeTokenCostsModel, } from './models/bitcode-execution-storage'; +const allowLocalSupabaseFallback = + process.env.NODE_ENV !== 'production' || + process.env.CI === 'true' || + process.env.NEXT_PHASE === 'phase-production-build'; + +function resolveSupabaseUrl(): string { + const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL || + (allowLocalSupabaseFallback ? 'http://localhost:54321' : ''); + + if (!supabaseUrl) { + throw new Error('Missing Supabase URL. Set NEXT_PUBLIC_SUPABASE_URL or SUPABASE_URL.'); + } + + return supabaseUrl; +} + +function resolveSupabasePublicKey(): string { + const publicKey = + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || + process.env.SUPABASE_ANON_KEY || + process.env.SUPABASE_PUBLISHABLE_KEY || + (allowLocalSupabaseFallback ? 'local-anon-key' : ''); + + if (!publicKey) { + throw new Error( + 'Missing Supabase public key. Set NEXT_PUBLIC_SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_ANON_KEY, or SUPABASE_PUBLISHABLE_KEY.', + ); + } + + return publicKey; +} + +function resolveSupabaseAdminKey(): string { + const adminKey = + process.env.SUPABASE_SERVICE_ROLE_KEY || + process.env.SUPABASE_SECRET_KEY || + process.env.SUPABASE_ADMIN_KEY || + (allowLocalSupabaseFallback ? 'local-service-role-key' : ''); + + if (!adminKey) { + throw new Error( + 'Missing Supabase admin key. Set SUPABASE_SERVICE_ROLE_KEY, SUPABASE_SECRET_KEY, or SUPABASE_ADMIN_KEY.', + ); + } + + return adminKey; +} + /** * Standard client interface */ @@ -68,15 +119,9 @@ export interface AdminClient extends BitcodeOrmClient { * Create standard client */ export function createClient(authToken?: string): BitcodeOrmClient { - const publicKey = - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || - process.env.SUPABASE_ANON_KEY || - process.env.SUPABASE_PUBLISHABLE_KEY; - const supabase = createSupabaseClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - publicKey!, + resolveSupabaseUrl(), + resolveSupabasePublicKey(), { auth: { persistSession: false, @@ -117,14 +162,9 @@ export function createClient(authToken?: string): BitcodeOrmClient { * Create admin client for build-time operations */ export function createAdminClient(): AdminClient { - const adminKey = - process.env.SUPABASE_SERVICE_ROLE_KEY || - process.env.SUPABASE_SECRET_KEY || - process.env.SUPABASE_ADMIN_KEY; - const supabase = createSupabaseClient( - process.env.SUPABASE_URL!, - adminKey!, + resolveSupabaseUrl(), + resolveSupabaseAdminKey(), { auth: { persistSession: false, diff --git a/packages/pipeline-hosts/README.md b/packages/pipeline-hosts/README.md index 148904a80..6b5fb1490 100644 --- a/packages/pipeline-hosts/README.md +++ b/packages/pipeline-hosts/README.md @@ -44,6 +44,17 @@ helpers used only by the harness are installed under `.bitcode/pipeline-harness` so historical deposited source revisions do not need to carry newer harness dependencies. +The harness manifest includes the staged Reading boundary. The active stage +sequence begins with Need synthesis, Need review, and Need-Fit search before +candidate ranking and AssetPack synthesis. The live runner synthesizes a +typed `bitcode.read.need` object from the Read request, source revision, and +Deposit context, accepts it for the current harness invocation, and passes it +to the AssetPack pipeline as `acceptedReadNeed` with +`requireAcceptedReadNeed=true`. Product routes that already have a user-reviewed +Need should pass that accepted object directly; if strict Need-Fit execution is +requested without an accepted Need, candidate recall must return +`blocked_readiness` before searching the depository. + Structured database telemetry is part of the harness contract. A real Read/Fit pipeline run must write the deliverable hierarchy: `deliverable_pipeline_runs`, `deliverable_pipeline_events`, diff --git a/packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts b/packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts index 2c4a12568..5790314a7 100644 --- a/packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts +++ b/packages/pipeline-hosts/src/__tests__/asset-pack-harness.test.ts @@ -161,6 +161,9 @@ describe('asset-pack sandbox harness plan', () => { expect(diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error)).toEqual([]); expect(source).toContain('pipeline-stream-event'); + expect(source).toContain('synthesizeReadNeedForPipelineInput'); + expect(source).toContain('acceptedReadNeed: readNeed'); + expect(source).toContain('requireAcceptedReadNeed'); expect(source).toContain('artifact-streaming-enabled'); expect(source).toContain('execution: execution ? summarizeExecution(execution) : null'); expect(source).toContain('PipelineHarnessTimeoutError'); diff --git a/packages/pipeline-hosts/src/__tests__/manifest.test.ts b/packages/pipeline-hosts/src/__tests__/manifest.test.ts index a47ea9193..b58d433a4 100644 --- a/packages/pipeline-hosts/src/__tests__/manifest.test.ts +++ b/packages/pipeline-hosts/src/__tests__/manifest.test.ts @@ -32,6 +32,10 @@ describe('pipeline harness manifest', () => { expect(manifest.host.isolationBoundary).toBe('firecracker-microvm'); expect(manifest.host.defaultWorkingDirectory).toBe('/vercel/sandbox'); expect(manifest.stages).toEqual(ASSET_PACK_HARNESS_STAGES); + expect(manifest.stages).toEqual( + expect.arrayContaining(['need-synthesis', 'need-review', 'need-fit-search']) + ); + expect(manifest.requireAcceptedReadNeed).toBe(true); expect(manifest.expectedEvidenceTables).toEqual(ASSET_PACK_HARNESS_EVIDENCE_TABLES); expect(manifest.resultStates).toEqual([ 'worthy_fit', diff --git a/packages/pipeline-hosts/src/asset-pack-harness.ts b/packages/pipeline-hosts/src/asset-pack-harness.ts index e1123b8ab..a27b0444b 100644 --- a/packages/pipeline-hosts/src/asset-pack-harness.ts +++ b/packages/pipeline-hosts/src/asset-pack-harness.ts @@ -34,6 +34,7 @@ const SANDBOX_PNPM_VERSION = '10.33.0'; export interface BuildAssetPackSandboxHarnessOptions { mode?: PipelineHarnessMode; read: PipelineReadRequest; + readNeed?: unknown; deposit: PipelineDepositReference; sourceRevision: PipelineSourceRevision; source?: PipelineSandboxSource; @@ -80,6 +81,8 @@ export function buildAssetPackSandboxHarness( const manifest = buildAssetPackPipelineHarnessManifest({ mode, read: options.read, + readNeed: options.readNeed, + requireAcceptedReadNeed: true, deposit, sourceRevision: options.sourceRevision, sourceOverlay, @@ -1496,7 +1499,7 @@ try { manifest = JSON.parse(await readFile(manifestPath, 'utf8')); manifestRoot = createHash('sha256').update(JSON.stringify(manifest)).digest('hex'); userId = process.env.BITCODE_PIPELINE_USER_ID || manifest.deposit?.userId || DEFAULT_USER_ID; - const [{ assetPackPipeline }, { enablePipelineStreaming, factoryPipelineExecution }] = await Promise.all([ + const [{ assetPackPipeline, acceptReadNeed, isAcceptedReadNeed, synthesizeReadNeedForPipelineInput }, { enablePipelineStreaming, factoryPipelineExecution }] = await Promise.all([ import('../../packages/pipelines/asset-pack/src/index'), import('../../packages/pipelines-generics/src/index'), ]); @@ -1540,9 +1543,29 @@ try { record({ type: 'artifact-streaming-enabled', stage: 'telemetry-readback' }); } + const readNeed = isAcceptedReadNeed(manifest.readNeed) + ? manifest.readNeed + : acceptReadNeed(synthesizeReadNeedForPipelineInput({ + read: manifest.read, + readRequest: manifest.read, + sourceRevision: manifest.sourceRevision, + repository: { + fullName: manifest.sourceRevision.repositoryFullName, + branch: manifest.sourceRevision.branch, + commit: manifest.sourceRevision.commit, + }, + })); + execution.store('read/need', 'accepted', readNeed); + execution.store('read/need', 'needId', readNeed.needId); + execution.store('read/need', 'measurementRoot', readNeed.measurementRoot); + execution.store('read/need', 'reviewState', readNeed.reviewState); + const input = { read: manifest.read.prompt, definitionOfRead: manifest.read.prompt, + readNeed, + acceptedReadNeed: readNeed, + requireAcceptedReadNeed: manifest.requireAcceptedReadNeed !== false, repository: { fullName: manifest.sourceRevision.repositoryFullName, branch: manifest.sourceRevision.branch, diff --git a/packages/pipeline-hosts/src/manifest.ts b/packages/pipeline-hosts/src/manifest.ts index 3d12f73f0..c09867aae 100644 --- a/packages/pipeline-hosts/src/manifest.ts +++ b/packages/pipeline-hosts/src/manifest.ts @@ -49,10 +49,14 @@ export const VERCEL_SANDBOX_HOST_CAPABILITIES: PipelineHostCapabilities = { }; export const ASSET_PACK_HARNESS_STAGES: readonly PipelineHarnessStage[] = [ + 'need-synthesis', + 'need-review', + 'need-fit-search', 'deposit-search', 'candidate-ranking', 'read-comprehension', 'asset-pack-synthesis', + 'source-safe-preview', 'validation', 'finish', 'telemetry-readback', @@ -106,6 +110,8 @@ export function buildAssetPackPipelineHarnessManifest(input: { sourceRevision: PipelineSourceRevision; sourceOverlay?: PipelineHarnessSourceOverlay; commandEnvironment?: Record; + readNeed?: unknown; + requireAcceptedReadNeed?: boolean; createdAt?: string; }): PipelineHarnessManifest { assertNonEmpty(input.read.id, 'read.id'); @@ -119,6 +125,8 @@ export function buildAssetPackPipelineHarnessManifest(input: { pipelineName: 'asset-pack-read-fit', harnessMode: input.mode, read: input.read, + requireAcceptedReadNeed: input.requireAcceptedReadNeed ?? true, + readNeed: input.readNeed, deposit: input.deposit, sourceRevision: input.sourceRevision, sourceOverlay: input.sourceOverlay, diff --git a/packages/pipeline-hosts/src/types.ts b/packages/pipeline-hosts/src/types.ts index 081d80611..9db8d749f 100644 --- a/packages/pipeline-hosts/src/types.ts +++ b/packages/pipeline-hosts/src/types.ts @@ -10,10 +10,14 @@ export type BitcodePipelineResultState = | 'blocked_readiness'; export type PipelineHarnessStage = + | 'need-synthesis' + | 'need-review' + | 'need-fit-search' | 'deposit-search' | 'candidate-ranking' | 'read-comprehension' | 'asset-pack-synthesis' + | 'source-safe-preview' | 'validation' | 'finish' | 'telemetry-readback'; @@ -93,6 +97,8 @@ export interface PipelineHarnessManifest { pipelineName: 'asset-pack-read-fit'; harnessMode: PipelineHarnessMode; read: PipelineReadRequest; + requireAcceptedReadNeed?: boolean; + readNeed?: unknown; deposit: PipelineDepositReference; sourceRevision: PipelineSourceRevision; sourceOverlay?: PipelineHarnessSourceOverlay; diff --git a/packages/pipelines/asset-pack/src/__tests__/metrics-output.test.ts b/packages/pipelines/asset-pack/src/__tests__/metrics-output.test.ts index fb9594d06..91ab87592 100644 --- a/packages/pipelines/asset-pack/src/__tests__/metrics-output.test.ts +++ b/packages/pipelines/asset-pack/src/__tests__/metrics-output.test.ts @@ -27,6 +27,48 @@ describe('AssetPack pipeline bring-up (setup + PTRR plan: prepare→reason)', () try { const exec = new Execution('asset-pack:test'); const inserts: any[] = []; + const selectedRows = (table: string, filters: Array<[string, any]>) => { + return inserts + .filter((insert) => insert.table === table) + .map((insert) => insert.row) + .filter((row) => filters.every(([column, value]) => row?.[column] === value)); + }; + const selectBuilder = (table: string) => { + const filters: Array<[string, any]> = []; + const builder: any = { + eq: (column: string, value: any) => { + filters.push([column, value]); + return builder; + }, + order: () => builder, + limit: () => builder, + maybeSingle: async () => ({ data: selectedRows(table, filters).at(-1) || null }), + then: (resolve: any) => Promise.resolve({ data: selectedRows(table, filters), error: null }).then(resolve), + }; + return builder; + }; + const updateBuilder = (table: string, patch: any) => { + const filters: Array<(row: any) => boolean> = []; + const apply = async () => { + const rows = inserts.filter((insert) => insert.table === table).map((insert) => insert.row); + for (const row of rows) { + if (filters.every((filter) => filter(row))) Object.assign(row, patch); + } + return { data: rows.filter((row) => filters.every((filter) => filter(row))), error: null }; + }; + const builder: any = { + eq: (column: string, value: any) => { + filters.push((row) => row?.[column] === value); + return builder; + }, + in: (column: string, values: any[]) => { + filters.push((row) => values.includes(row?.[column])); + return builder; + }, + then: (resolve: any) => apply().then(resolve), + }; + return builder; + }; const supabaseStub: any = { from(table: string) { return { @@ -34,8 +76,8 @@ describe('AssetPack pipeline bring-up (setup + PTRR plan: prepare→reason)', () inserts.push({ table, row }); return { select: (_?: any) => ({ single: () => Promise.resolve({ data: { id: 'id-' + inserts.length } }) }) } as any; }, - update: (_: any) => ({ eq: () => Promise.resolve({}) }), - select: () => ({ eq: () => ({ order: () => ({ limit: () => ({ maybeSingle: async () => ({ data: { id: 'id-last' } } as any) }) }) }) }) + update: (patch: any) => updateBuilder(table, patch), + select: () => selectBuilder(table), } as any; } }; diff --git a/packages/pipelines/asset-pack/src/__tests__/read-need.test.ts b/packages/pipelines/asset-pack/src/__tests__/read-need.test.ts new file mode 100644 index 000000000..d607dbdc7 --- /dev/null +++ b/packages/pipelines/asset-pack/src/__tests__/read-need.test.ts @@ -0,0 +1,141 @@ +import { + acceptReadNeed, + admitNeedFitSearch, + buildShareToFeePreview, + isAcceptedReadNeed, + readNeedToDepositorySearchRead, + synthesizeReadNeedForPipelineInput, +} from '../read-need'; +import { runDepositorySearchForPipelineInput } from '../depository-search'; + +const input = { + read: { + id: 'read-1', + prompt: + 'Find whether the deposited repository has a complete Terminal path through Deposit, Read/Fit, AssetPack evidence, proof readback, and ledger reconciliation.', + }, + sourceRevision: { + repositoryFullName: 'engineeredsoftware/ENGI', + branch: 'main', + commit: '31bbc0c5227b6b3aed5d107fd8507d35ec22970a', + }, +}; + +function depositoryAsset() { + return { + assetId: 'deposit-asset-1', + title: 'Deposited repository revision engineeredsoftware/ENGI', + artifactKind: 'repository-revision', + repositoryFullName: 'engineeredsoftware/ENGI', + sourceBranch: 'main', + sourceCommit: '31bbc0c5227b6b3aed5d107fd8507d35ec22970a', + contentRoot: 'sha256:content', + contentUnits: [ + { + unitId: 'deposit-asset-1:unit-1', + unitKind: 'repository-revision', + text: + 'Terminal path Deposit Read Fit AssetPack evidence proof root finality readback Supabase ledger reconciliation.', + }, + ], + verificationEvidence: { + proofRoot: 'sha256:proof', + measurementRoot: 'sha256:measurement', + reconciliationReadbackRoot: 'sha256:reconciliation', + }, + hasWalletOrAttestationProof: true, + hasAssetMeasurementEvidence: true, + }; +} + +describe('Read-Need synthesis and Need-Fit admission', () => { + it('synthesizes a measured Need that remains pending until accepted', () => { + const need = synthesizeReadNeedForPipelineInput(input); + + expect(need.schema).toBe('bitcode.read.need'); + expect(need.needId).toMatch(/^need-[a-f0-9]{16}$/); + expect(need.reviewState).toBe('needs_acceptance'); + expect(need.measurementRoot).toMatch(/^sha256:/); + expect(need.sourceConstraints).toMatchObject({ + repositoryFullName: 'engineeredsoftware/ENGI', + sourceBranch: 'main', + sourceCommit: '31bbc0c5227b6b3aed5d107fd8507d35ec22970a', + protectedSourceDisclosure: 'forbidden_before_settlement', + }); + expect(need.pricingMeasurementInputs.measurementVector).toEqual( + expect.arrayContaining([ + expect.objectContaining({ dimension: 'semantic_relevance' }), + expect.objectContaining({ dimension: 'source_binding' }), + ]) + ); + }); + + it('accepts a Need as the only admissible input to strict Need-Fit search', () => { + const accepted = acceptReadNeed(synthesizeReadNeedForPipelineInput(input), '2026-05-18T00:00:00.000Z'); + + expect(isAcceptedReadNeed(accepted)).toBe(true); + expect(admitNeedFitSearch({ acceptedReadNeed: accepted, requireAcceptedReadNeed: true })).toMatchObject({ + admitted: true, + acceptedNeed: accepted, + blockers: [], + }); + expect(readNeedToDepositorySearchRead(accepted)).toMatchObject({ + id: accepted.needId, + prompt: accepted.read.prompt, + sourceCommit: '31bbc0c5227b6b3aed5d107fd8507d35ec22970a', + }); + }); + + it('blocks strict Need-Fit search before Need acceptance', async () => { + const result = await runDepositorySearchForPipelineInput({ + ...input, + requireAcceptedReadNeed: true, + depositoryAssets: [depositoryAsset()], + }); + + expect(result.resultState).toBe('blocked_readiness'); + expect(result.resultReasons).toEqual( + expect.arrayContaining([ + 'Need-Fit search requires an accepted Read-Need before depository candidate recall.', + 'accepted_read_need_missing', + ]) + ); + expect(result.candidateRanking).toHaveLength(0); + }); + + it('uses the accepted Need measurement and source constraints for Fit search', async () => { + const acceptedReadNeed = acceptReadNeed( + synthesizeReadNeedForPipelineInput(input), + '2026-05-18T00:00:00.000Z' + ); + + const result = await runDepositorySearchForPipelineInput({ + ...input, + acceptedReadNeed, + requireAcceptedReadNeed: true, + depositoryAssets: [depositoryAsset()], + }); + + expect(result.resultState).toBe('worthy_fit'); + expect(result.read.id).toBe(acceptedReadNeed.needId); + expect(result.read.sourceCommit).toBe(acceptedReadNeed.sourceConstraints.sourceCommit); + expect(result.selectedCandidateAssetIds).toEqual(['deposit-asset-1']); + }); + + it('derives a source-safe Share-to-Fee preview from accepted Need measurements', () => { + const acceptedReadNeed = acceptReadNeed(synthesizeReadNeedForPipelineInput(input)); + const preview = buildShareToFeePreview({ + need: acceptedReadNeed, + admittedFitQuality: 0.75, + }); + + expect(preview).toMatchObject({ + formula: 'sum(measurement.weight * measurement.volume * admitted_fit_quality)', + needId: acceptedReadNeed.needId, + needMeasurementRoot: acceptedReadNeed.measurementRoot, + finalityState: 'preview_not_paid', + payer: 'reader', + }); + expect(preview.sats).toBeGreaterThanOrEqual(546); + }); +}); diff --git a/packages/pipelines/asset-pack/src/depository-search.ts b/packages/pipelines/asset-pack/src/depository-search.ts index 222a9d86c..5fad0c970 100644 --- a/packages/pipelines/asset-pack/src/depository-search.ts +++ b/packages/pipelines/asset-pack/src/depository-search.ts @@ -1,5 +1,11 @@ import { createHash } from 'node:crypto'; import { buildAssetPackEmbeddingPolicy } from './embedding-config'; +import { + admitNeedFitSearch, + isAcceptedReadNeed, + readNeedToDepositorySearchRead, + resolveReadNeedFromPipelineInput, +} from './read-need'; export type AssetPackFitResultState = | 'worthy_fit' @@ -1031,6 +1037,11 @@ export function createLexicalDepositorySearchProvider(): DepositorySearchProvide } export function normalizeDepositorySearchRead(input: unknown): DepositorySearchRead { + const acceptedNeed = resolveReadNeedFromPipelineInput(input); + if (isAcceptedReadNeed(acceptedNeed)) { + return readNeedToDepositorySearchRead(acceptedNeed); + } + const record = recordValue(input) || {}; const readRecord = recordValue(record.read); const sourceRevision = recordValue(record.sourceRevision); @@ -1290,22 +1301,77 @@ function storeDepositorySearchToolResult( }); } +function buildBlockedNeedFitSearchResult(input: { + read: DepositorySearchRead; + assets: DepositoryAsset[]; + blockers: string[]; +}): DepositorySearchResult { + const embeddingPolicy = buildAssetPackEmbeddingPolicy(); + const createdAt = new Date().toISOString(); + const thresholds = { ...DEFAULT_THRESHOLDS }; + const queryRoot = `sha256:${sha256(stableStringify({ + read: input.read, + thresholds, + embeddingPolicy, + blockers: input.blockers, + }))}`; + const rankingRoot = `sha256:${sha256(stableStringify({ + blockedBeforeRanking: true, + blockers: input.blockers, + assetCount: input.assets.length, + }))}`; + + return { + schema: 'bitcode.asset-pack.depository-search', + resultState: 'blocked_readiness', + resultReasons: [ + 'Need-Fit search requires an accepted Read-Need before depository candidate recall.', + ...input.blockers, + ], + read: input.read, + thresholds, + searchedAssetCount: input.assets.length, + selectedCandidateAssetIds: [], + selectedCandidates: [], + rejectedCandidates: [], + blockedCandidates: [], + candidateRanking: [], + embeddingPolicy, + queryRoot, + rankingRoot, + createdAt, + }; +} + export async function runDepositorySearchForPipelineInput( input: unknown, execution?: { store?: (namespace: string, key: string, value: unknown) => void; parent?: unknown } ): Promise { + const admission = admitNeedFitSearch(input); const read = normalizeDepositorySearchRead(input); const assets = normalizePipelineDepositoryAssets(input); const providers = [createLexicalDepositorySearchProvider()]; - const result = await searchDepositoryAssetSpace({ - read, - assets, - providers, - }); + const result = admission.admitted + ? await searchDepositoryAssetSpace({ + read, + assets, + providers, + }) + : buildBlockedNeedFitSearchResult({ + read, + assets, + blockers: admission.blockers, + }); const fitResult = buildDepositoryFitResultEvidence(result); const storeEvidence = (target?: { store?: (namespace: string, key: string, value: unknown) => void }) => { if (!target?.store) return; + if (admission.acceptedNeed) { + target.store('read/need', 'accepted', admission.acceptedNeed); + target.store('read/need', 'measurementRoot', admission.acceptedNeed.measurementRoot); + target.store('read/need', 'needId', admission.acceptedNeed.needId); + } + target.store('read/need-fit', 'admission', admission); target.store('depository/search', 'result', result); target.store('depository/search', 'candidateRanking', result.candidateRanking); target.store('depository/search', 'selectedCandidates', result.selectedCandidates); diff --git a/packages/pipelines/asset-pack/src/index.ts b/packages/pipelines/asset-pack/src/index.ts index e1a60322b..15eba1e30 100644 --- a/packages/pipelines/asset-pack/src/index.ts +++ b/packages/pipelines/asset-pack/src/index.ts @@ -23,6 +23,11 @@ import { buildDepositoryFitResultEvidence, runDepositorySearchForPipelineInput, } from './depository-search'; +import { + isAcceptedReadNeed, + resolveReadNeedFromPipelineInput, + synthesizeReadNeedForPipelineInput, +} from './read-need'; // ==================== FACTORIES ==================== @@ -73,17 +78,31 @@ function factoryPreprocess(): Executor { const writtenAssetType = resolveWrittenAssetType(processedInput); const writtenAssetRequest = normalizeWrittenAssetRequest(processedInput?.writtenAssetType); const deliveryMechanismTemplate = resolveDeliveryMechanismTemplate(processedInput); + const suppliedReadNeed = resolveReadNeedFromPipelineInput(processedInput); + const synthesizedReadNeed = synthesizeReadNeedForPipelineInput(processedInput); + const readNeed = suppliedReadNeed || synthesizedReadNeed; try { processedInput.read = expressedRead; } catch {} try { processedInput.definitionOfRead = expressedRead; } catch {} try { processedInput.writtenAssetType = writtenAssetType; } catch {} try { processedInput.writtenAssetRequest = writtenAssetRequest; } catch {} try { processedInput.deliveryMechanismTemplate = deliveryMechanismTemplate; } catch {} + try { processedInput.readNeed = readNeed; } catch {} + if (isAcceptedReadNeed(readNeed)) { + try { processedInput.acceptedReadNeed = readNeed; } catch {} + } execution.store('pipeline', 'input', processedInput); execution.store('pipeline', 'writtenAssetType', writtenAssetType); execution.store('pipeline', 'writtenAssetRequest', writtenAssetRequest); execution.store('pipeline', 'deliveryMechanismTemplate', deliveryMechanismTemplate); execution.store('pipeline', 'expressedRead', expressedRead); execution.store('read', 'description', expressedRead); + execution.store('read/need', 'current', readNeed as any); + execution.store('read/need', 'needId', readNeed.needId); + execution.store('read/need', 'measurementRoot', readNeed.measurementRoot); + execution.store('read/need', 'reviewState', readNeed.reviewState); + if (isAcceptedReadNeed(readNeed)) { + execution.store('read/need', 'accepted', readNeed as any); + } const depositorySearch = await runDepositorySearchForPipelineInput(processedInput, execution); try { processedInput.depositorySearchResult = depositorySearch; } catch {} @@ -255,5 +274,19 @@ export { runComprehendReadAgent, } from './agents/setup/asset-pack-comprehend-read-agent'; export { AssetPackSynthesizeArtifactsAgent } from './agents/implementation/asset-pack-synthesize-artifacts-agent'; +export { + acceptReadNeed, + admitNeedFitSearch, + buildShareToFeePreview, + isAcceptedReadNeed, + readNeedToDepositorySearchRead, + resolveReadNeedFromPipelineInput, + shouldRequireAcceptedReadNeed, + synthesizeReadNeedForPipelineInput, + type ReadNeed, + type ReadNeedFitAdmission, + type ReadNeedMeasurementDimension, + type ReadNeedReviewState, +} from './read-need'; export default assetPackPipeline; export const runSDIVFPipeline = assetPackPipeline; diff --git a/packages/pipelines/asset-pack/src/read-need.ts b/packages/pipelines/asset-pack/src/read-need.ts new file mode 100644 index 000000000..2b24ba257 --- /dev/null +++ b/packages/pipelines/asset-pack/src/read-need.ts @@ -0,0 +1,412 @@ +import { createHash } from 'node:crypto'; +import type { DepositorySearchRead } from './depository-search'; + +export type ReadNeedReviewState = + | 'needs_acceptance' + | 'accepted' + | 'resynthesis_requested'; + +export interface ReadNeedMeasurementDimension { + dimension: string; + weight: number; + volume: number; +} + +export interface ReadNeed { + schema: 'bitcode.read.need'; + needId: string; + reviewState: ReadNeedReviewState; + measurementRoot: string; + read: { + id?: string | null; + prompt: string; + repositoryFullName?: string | null; + sourceBranch?: string | null; + sourceCommit?: string | null; + }; + requirements: string[]; + closureCriteria: string[]; + failureModes: string[]; + targetArtifactKinds: string[]; + sourceConstraints: { + repositoryFullName?: string | null; + sourceBranch?: string | null; + sourceCommit?: string | null; + protectedSourceDisclosure: 'forbidden_before_settlement'; + }; + proofExpectations: string[]; + pricingMeasurementInputs: { + measurementVector: ReadNeedMeasurementDimension[]; + weightedRequestedVolume: number; + shareToFeeFormula: string; + }; + feedbackHistory: string[]; + review?: { + status: 'accepted'; + acceptedAt: string; + acceptanceRoot: string; + nextStage: 'need_fit_search'; + }; +} + +export interface ReadNeedFitAdmission { + admitted: boolean; + blockers: string[]; + acceptedNeed: ReadNeed | null; +} + +type ReadNeedSourceInput = { + read?: unknown; + definitionOfRead?: unknown; + readRequest?: unknown; + sourceRevision?: unknown; + repository?: unknown; + readMeasurement?: unknown; + targetArtifactKinds?: unknown; + targetKinds?: unknown; + closureCriteria?: unknown; + failureModes?: unknown; + feedback?: unknown; +}; + +function sha256(value: string): string { + return createHash('sha256').update(value).digest('hex'); +} + +function stableStringify(value: unknown): string { + if (value === null || typeof value !== 'object') { + return JSON.stringify(value); + } + if (Array.isArray(value)) { + return `[${value.map((entry) => stableStringify(entry)).join(',')}]`; + } + return `{${Object.keys(value as Record) + .sort() + .map((key) => `${JSON.stringify(key)}:${stableStringify((value as Record)[key])}`) + .join(',')}}`; +} + +function recordValue(value: unknown): Record | null { + return typeof value === 'object' && value !== null && !Array.isArray(value) + ? value as Record + : null; +} + +function stringValue(value: unknown): string { + return typeof value === 'string' ? value.trim() : ''; +} + +function firstString(...values: unknown[]): string | null { + for (const value of values) { + const candidate = stringValue(value); + if (candidate) return candidate; + } + return null; +} + +function stringArray(value: unknown): string[] { + if (!Array.isArray(value)) return []; + return value + .map((entry) => stringValue(entry)) + .filter(Boolean); +} + +function getPath(value: unknown, path: string[]): unknown { + let cursor = value; + for (const part of path) { + if (!cursor || typeof cursor !== 'object' || Array.isArray(cursor)) return undefined; + cursor = (cursor as Record)[part]; + } + return cursor; +} + +function normalizeArtifactKind(value: string): string { + return value.toLowerCase().replace(/[_\s]+/g, '-'); +} + +function normalizeSource(input: ReadNeedSourceInput) { + const readRecord = recordValue(input.read); + const requestRecord = recordValue(input.readRequest); + const sourceRevision = recordValue(input.sourceRevision); + const repository = recordValue(input.repository); + const readMeasurement = recordValue(input.readMeasurement); + const prompt = firstString( + typeof input.read === 'string' ? input.read : undefined, + readRecord?.prompt, + readRecord?.read, + requestRecord?.prompt, + requestRecord?.read, + input.definitionOfRead, + readMeasurement?.prompt, + readMeasurement?.summary + ) || ''; + + return { + id: firstString(readRecord?.id, readRecord?.readId, requestRecord?.id, requestRecord?.readId, readMeasurement?.id), + prompt, + repositoryFullName: firstString( + sourceRevision?.repositoryFullName, + repository?.fullName, + repository?.repositoryFullName, + repository?.repo, + readRecord?.repositoryFullName, + requestRecord?.repositoryFullName, + readMeasurement?.repositoryFullName, + getPath(readMeasurement, ['scenario', 'repo']) + ), + sourceBranch: firstString( + sourceRevision?.branch, + repository?.branch, + readRecord?.sourceBranch, + requestRecord?.sourceBranch, + readMeasurement?.sourceBranch + ), + sourceCommit: firstString( + sourceRevision?.commit, + repository?.commit, + readRecord?.sourceCommit, + requestRecord?.sourceCommit, + readMeasurement?.sourceCommit + ), + }; +} + +function normalizeTargetArtifactKinds(input: ReadNeedSourceInput): string[] { + const readRecord = recordValue(input.read); + const requestRecord = recordValue(input.readRequest); + const readMeasurement = recordValue(input.readMeasurement); + const kinds = [ + ...stringArray(input.targetArtifactKinds), + ...stringArray(input.targetKinds), + ...stringArray(readRecord?.targetArtifactKinds), + ...stringArray(readRecord?.targetKinds), + ...stringArray(requestRecord?.targetArtifactKinds), + ...stringArray(requestRecord?.targetKinds), + ...stringArray(readMeasurement?.targetArtifactKinds), + ]; + const normalized = [...new Set(kinds.map(normalizeArtifactKind).filter(Boolean))]; + return normalized.length + ? normalized + : ['repository-revision', 'asset-pack-evidence', 'proof-root', 'reconciliation-readback']; +} + +function defaultRequirements(read: ReturnType): string[] { + return [ + 'Understand the reader request as a bounded source-reading need before searching the depository.', + 'Find source-bound deposited evidence that satisfies the accepted Need, not merely related prose.', + 'Preserve proof, measurement, and reconciliation readback requirements through Fit search and AssetPack synthesis.', + 'Prevent protected source disclosure before preview approval and settlement readback.', + ...(read.repositoryFullName ? [`Bind Fit candidates to repository ${read.repositoryFullName}.`] : []), + ...(read.sourceCommit ? [`Bind Fit candidates to source commit ${read.sourceCommit}.`] : []), + ]; +} + +function defaultClosureCriteria(read: ReturnType): string[] { + return [ + 'The Need has requirements, target artifact kinds, proof expectations, and failure modes.', + 'Candidate recall is source-bound to the accepted Need repository, branch, and commit constraints.', + 'The Fit result exposes query root, ranking root, selected candidate ids, score evidence, and proof/readback posture.', + 'The AssetPack preview excludes protected source material before settlement.', + 'BTC fee, ownership, license, journal, and ledger rows must be read back before unlock.', + ...(read.prompt ? [`The Fit must satisfy: ${read.prompt}`] : []), + ]; +} + +function defaultFailureModes(): string[] { + return [ + 'need_not_accepted', + 'repository_mismatch', + 'source_commit_mismatch', + 'proof_or_measurement_missing', + 'source_preview_before_settlement', + 'ledger_database_readback_missing', + ]; +} + +function measurementVectorForNeed( + read: ReturnType, + targetArtifactKinds: string[], + closureCriteria: string[] +): ReadNeedMeasurementDimension[] { + const promptVolume = Math.max(1, Math.ceil(read.prompt.length / 160)); + const targetVolume = Math.max(1, targetArtifactKinds.length); + const closureVolume = Math.max(1, closureCriteria.length); + return [ + { dimension: 'semantic_relevance', weight: 0.36, volume: promptVolume }, + { dimension: 'source_binding', weight: 0.24, volume: read.repositoryFullName ? 1 : 0 }, + { dimension: 'artifact_kind_fit', weight: 0.20, volume: targetVolume }, + { dimension: 'closure_specificity', weight: 0.20, volume: closureVolume }, + ]; +} + +function weightedMeasurementVolume(vector: ReadNeedMeasurementDimension[], admittedFitQuality = 1): number { + return Number(vector + .reduce((total, entry) => total + (entry.weight * entry.volume * admittedFitQuality), 0) + .toFixed(6)); +} + +export function synthesizeReadNeedForPipelineInput(input: ReadNeedSourceInput): ReadNeed { + const read = normalizeSource(input); + const targetArtifactKinds = normalizeTargetArtifactKinds(input); + const explicitClosureCriteria = [ + ...stringArray(input.closureCriteria), + ...stringArray(recordValue(input.read)?.closureCriteria), + ...stringArray(recordValue(input.readRequest)?.closureCriteria), + ...stringArray(recordValue(input.readMeasurement)?.closureCriteria), + ]; + const closureCriteria = explicitClosureCriteria.length + ? [...new Set(explicitClosureCriteria)] + : defaultClosureCriteria(read); + const failureModes = [ + ...defaultFailureModes(), + ...stringArray(input.failureModes), + ...stringArray(recordValue(input.read)?.failureModes), + ...stringArray(recordValue(input.readRequest)?.failureModes), + ]; + const feedbackHistory = stringArray(input.feedback); + const measurementVector = measurementVectorForNeed(read, targetArtifactKinds, closureCriteria); + const seed = { + read, + targetArtifactKinds, + closureCriteria, + failureModes, + feedbackHistory, + measurementVector, + }; + const measurementRoot = `sha256:${sha256(stableStringify({ + read, + targetArtifactKinds, + closureCriteria, + measurementVector, + }))}`; + + return { + schema: 'bitcode.read.need', + needId: `need-${sha256(stableStringify(seed)).slice(0, 16)}`, + reviewState: 'needs_acceptance', + measurementRoot, + read, + requirements: defaultRequirements(read), + closureCriteria, + failureModes: [...new Set(failureModes)], + targetArtifactKinds, + sourceConstraints: { + repositoryFullName: read.repositoryFullName, + sourceBranch: read.sourceBranch, + sourceCommit: read.sourceCommit, + protectedSourceDisclosure: 'forbidden_before_settlement', + }, + proofExpectations: [ + 'source-bound candidate ranking root', + 'proof root', + 'measurement evidence', + 'settlement readback before unlock', + ], + pricingMeasurementInputs: { + measurementVector, + weightedRequestedVolume: weightedMeasurementVolume(measurementVector), + shareToFeeFormula: 'sum(measurement.weight * measurement.volume * admitted_fit_quality)', + }, + feedbackHistory, + }; +} + +export function acceptReadNeed( + need: ReadNeed, + acceptedAt = new Date().toISOString() +): ReadNeed { + const acceptanceRoot = `sha256:${sha256(stableStringify({ + needId: need.needId, + measurementRoot: need.measurementRoot, + acceptedAt, + nextStage: 'need_fit_search', + }))}`; + return { + ...need, + reviewState: 'accepted', + review: { + status: 'accepted', + acceptedAt, + acceptanceRoot, + nextStage: 'need_fit_search', + }, + }; +} + +export function isAcceptedReadNeed(value: unknown): value is ReadNeed { + const record = recordValue(value); + return Boolean( + record?.schema === 'bitcode.read.need' && + record.reviewState === 'accepted' && + typeof record.needId === 'string' && + typeof record.measurementRoot === 'string' + ); +} + +export function resolveReadNeedFromPipelineInput(input: unknown): ReadNeed | null { + const record = recordValue(input); + const direct = record?.acceptedReadNeed ?? record?.readNeed ?? record?.need; + return isAcceptedReadNeed(direct) || recordValue(direct)?.schema === 'bitcode.read.need' + ? direct as ReadNeed + : null; +} + +export function shouldRequireAcceptedReadNeed(input: unknown): boolean { + const record = recordValue(input); + return Boolean( + process.env.BITCODE_PIPELINE_REQUIRE_ACCEPTED_READ_NEED === '1' || + record?.requireAcceptedReadNeed === true || + recordValue(record?.harness)?.requireAcceptedReadNeed === true + ); +} + +export function admitNeedFitSearch(input: unknown): ReadNeedFitAdmission { + const acceptedNeed = resolveReadNeedFromPipelineInput(input); + if (isAcceptedReadNeed(acceptedNeed)) { + return { admitted: true, blockers: [], acceptedNeed }; + } + if (!shouldRequireAcceptedReadNeed(input)) { + return { admitted: true, blockers: [], acceptedNeed: null }; + } + return { + admitted: false, + blockers: ['accepted_read_need_missing'], + acceptedNeed: null, + }; +} + +export function readNeedToDepositorySearchRead(need: ReadNeed): DepositorySearchRead { + return { + id: need.needId, + prompt: need.read.prompt, + repositoryFullName: need.sourceConstraints.repositoryFullName, + sourceBranch: need.sourceConstraints.sourceBranch, + sourceCommit: need.sourceConstraints.sourceCommit, + targetArtifactKinds: need.targetArtifactKinds, + closureCriteria: need.closureCriteria, + failureModes: need.failureModes, + }; +} + +export function buildShareToFeePreview(input: { + need: ReadNeed; + admittedFitQuality: number; + satsPerWeightedVolume?: number; + minimumSats?: number; +}) { + const weightedAdmittedVolume = weightedMeasurementVolume( + input.need.pricingMeasurementInputs.measurementVector, + Math.max(0, Math.min(1, input.admittedFitQuality)) + ); + const satsPerWeightedVolume = input.satsPerWeightedVolume ?? 1000; + const minimumSats = input.minimumSats ?? 546; + return { + formula: input.need.pricingMeasurementInputs.shareToFeeFormula, + needId: input.need.needId, + needMeasurementRoot: input.need.measurementRoot, + weightedAdmittedVolume, + sats: Math.max(minimumSats, Math.round(weightedAdmittedVolume * satsPerWeightedVolume)), + finalityState: 'preview_not_paid' as const, + payer: 'reader' as const, + }; +} diff --git a/packages/supabase/src/client.ts b/packages/supabase/src/client.ts index d3f71b628..39bcb0426 100644 --- a/packages/supabase/src/client.ts +++ b/packages/supabase/src/client.ts @@ -6,13 +6,27 @@ import { createClient } from '@supabase/supabase-js'; -const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL || process.env.SUPABASE_URL || ''; +const allowLocalFallback = + process.env.NODE_ENV !== 'production' || + process.env.CI === 'true' || + process.env.NEXT_PHASE === 'phase-production-build'; + +const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL || + (allowLocalFallback ? 'http://localhost:54321' : ''); const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || process.env.SUPABASE_ANON_KEY || process.env.SUPABASE_PUBLISHABLE_KEY || - ''; + (allowLocalFallback ? 'local-anon-key' : ''); + +if (!supabaseUrl || !supabaseAnonKey) { + throw new Error( + 'Missing Supabase public client environment. Set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY.', + ); +} export const supabase = createClient(supabaseUrl, supabaseAnonKey); diff --git a/packages/supabase/src/ssr/admin.ts b/packages/supabase/src/ssr/admin.ts index ff1f27eb5..b9fb8ce02 100644 --- a/packages/supabase/src/ssr/admin.ts +++ b/packages/supabase/src/ssr/admin.ts @@ -21,16 +21,21 @@ export async function createClient(options: CreateAdminClientOptions = {}) { const cookieStore = cookies(); + const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL; const publicKey = - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY; + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || + process.env.SUPABASE_ANON_KEY || + process.env.SUPABASE_PUBLISHABLE_KEY; - if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !publicKey) { - throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY) are missing'); + if (!supabaseUrl || !publicKey) { + throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL or SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_ANON_KEY, or SUPABASE_PUBLISHABLE_KEY) are missing'); } return createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL, + supabaseUrl, publicKey, { // Prefix the storage key so multiple apps on the same domain do not diff --git a/packages/supabase/src/ssr/client.ts b/packages/supabase/src/ssr/client.ts index 706d6f5a7..6f215b692 100644 --- a/packages/supabase/src/ssr/client.ts +++ b/packages/supabase/src/ssr/client.ts @@ -11,16 +11,21 @@ import { createBrowserClient } from '@supabase/ssr'; * exposed to the Next.js runtime via environment variables. */ export function createClient() { + const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL; const publicKey = - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY; + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || + process.env.SUPABASE_ANON_KEY || + process.env.SUPABASE_PUBLISHABLE_KEY; - if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !publicKey) { - throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY) are missing'); + if (!supabaseUrl || !publicKey) { + throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL or SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_ANON_KEY, or SUPABASE_PUBLISHABLE_KEY) are missing'); } return createBrowserClient( - process.env.NEXT_PUBLIC_SUPABASE_URL, + supabaseUrl, publicKey, ); } diff --git a/packages/supabase/src/ssr/middleware.ts b/packages/supabase/src/ssr/middleware.ts index 3ef250a13..2d4314e5f 100644 --- a/packages/supabase/src/ssr/middleware.ts +++ b/packages/supabase/src/ssr/middleware.ts @@ -15,16 +15,21 @@ export async function updateSession(request: NextRequest) { }, }); + const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL; const publicKey = - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY; + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || + process.env.SUPABASE_ANON_KEY || + process.env.SUPABASE_PUBLISHABLE_KEY; - if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !publicKey) { - throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY) are missing'); + if (!supabaseUrl || !publicKey) { + throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL or SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_ANON_KEY, or SUPABASE_PUBLISHABLE_KEY) are missing'); } const supabase = createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL, + supabaseUrl, publicKey, { cookies: { diff --git a/packages/supabase/src/ssr/server.ts b/packages/supabase/src/ssr/server.ts index 2b802c123..90765d099 100644 --- a/packages/supabase/src/ssr/server.ts +++ b/packages/supabase/src/ssr/server.ts @@ -17,16 +17,21 @@ import { cookies } from 'next/headers'; export async function createClient() { const cookieStore = cookies(); + const supabaseUrl = + process.env.NEXT_PUBLIC_SUPABASE_URL || + process.env.SUPABASE_URL; const publicKey = - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? - process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY; + process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || + process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || + process.env.SUPABASE_ANON_KEY || + process.env.SUPABASE_PUBLISHABLE_KEY; - if (!process.env.NEXT_PUBLIC_SUPABASE_URL || !publicKey) { - throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY or NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY) are missing'); + if (!supabaseUrl || !publicKey) { + throw new Error('Supabase env vars (NEXT_PUBLIC_SUPABASE_URL or SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY, NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY, SUPABASE_ANON_KEY, or SUPABASE_PUBLISHABLE_KEY) are missing'); } return createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL, + supabaseUrl, publicKey, { cookies: { diff --git a/protocol-demonstration/README.md b/protocol-demonstration/README.md index ea280c48d..5159b3dbc 100644 --- a/protocol-demonstration/README.md +++ b/protocol-demonstration/README.md @@ -1,10 +1,12 @@ -# Bitcode Protocol Demonstration +# Bitcode Protocol Demonstration - V27 canonical deterministic local prototype This package is the deterministic demonstration of Bitcode. Within this package the correct name is demonstration. `BITCODE_SPEC.txt` is the canonical pointer for active-system work. It currently resolves to `V27`; V28 is the active draft target for MVP QA. +`BITCODE_SPEC.txt -> V27`. This demo is governed by the active V27 canonical +spec and `BITCODE_SPEC_V27_PROVEN.md` as the current generated appendix. ## What This Demonstration Carries diff --git a/scripts/check-import-casing.mjs b/scripts/check-import-casing.mjs new file mode 100755 index 000000000..811e98c72 --- /dev/null +++ b/scripts/check-import-casing.mjs @@ -0,0 +1,186 @@ +#!/usr/bin/env node + +import { execFileSync } from 'node:child_process'; +import { existsSync, readFileSync, writeFileSync } from 'node:fs'; +import path from 'node:path'; + +const FIX = process.argv.slice(2).includes('--fix'); + +if (FIX) { + process.stdout.write('Scanning and fixing case-mismatched imports vs filenames...\n'); +} else { + process.stdout.write('Scanning for case-mismatched imports vs filenames...\n'); +} + +const sourceExtensions = new Set(['.ts', '.tsx', '.js', '.jsx']); +const sourceFiles = execFileSync('git', ['ls-files'], { encoding: 'utf8' }) + .split(/\r?\n/u) + .filter(Boolean) + .filter((file) => sourceExtensions.has(path.posix.extname(file))); + +const fileMap = new Map(); +for (const file of sourceFiles) { + fileMap.set(file.toLowerCase(), file); +} + +function stripJsonc(value) { + return value + .split(/\r?\n/u) + .filter((line) => !line.trim().startsWith('//')) + .join('\n') + .replace(/,\s*([}\]])/gu, '$1'); +} + +function readTsPaths() { + if (!existsSync('tsconfig.json')) return new Map(); + + try { + const config = JSON.parse(stripJsonc(readFileSync('tsconfig.json', 'utf8'))); + const paths = config?.compilerOptions?.paths || {}; + const result = new Map(); + for (const [key, values] of Object.entries(paths)) { + if (Array.isArray(values) && typeof values[0] === 'string') { + result.set(key, values[0]); + } + } + return result; + } catch { + return new Map(); + } +} + +const tsPaths = readTsPaths(); + +function resolveTsPath(spec) { + if (!spec) return null; + if (tsPaths.has(spec)) return tsPaths.get(spec); + + for (const [key, target] of tsPaths.entries()) { + if (!key.includes('*')) continue; + const prefix = key.slice(0, key.indexOf('*')); + if (spec.startsWith(prefix)) { + const rest = spec.slice(prefix.length); + const base = target.slice(0, target.indexOf('*')); + return `${base}${rest}`; + } + } + + return null; +} + +function normalizeGitPath(file) { + return path.posix.normalize(file).replace(/^\.\//u, ''); +} + +function findMatch(candidateBase) { + const normalizedBase = normalizeGitPath(candidateBase); + for (const ext of ['.ts', '.tsx', '.js', '.jsx', '']) { + const direct = normalizeGitPath(`${normalizedBase}${ext}`); + const actualDirect = fileMap.get(direct.toLowerCase()); + if (actualDirect) return { actual: actualDirect, ext, indexed: false }; + + const indexed = normalizeGitPath(`${normalizedBase}/index${ext}`); + const actualIndexed = fileMap.get(indexed.toLowerCase()); + if (actualIndexed) return { actual: actualIndexed, ext, indexed: true }; + } + return null; +} + +function importSpecFromMatch(sourceFile, matchResult) { + const target = targetPathFromMatch(matchResult); + + let relative = path.posix.relative(path.posix.dirname(sourceFile), target); + if (!relative.startsWith('.')) relative = `./${relative}`; + return relative; +} + +function targetPathFromMatch(matchResult) { + const { actual, ext, indexed } = matchResult; + let target = indexed ? path.posix.dirname(actual) : actual; + if (!indexed && ext) target = target.slice(0, -ext.length); + return target; +} + +function bitcodeAliasFromMatch(pkg, matchResult) { + const root = `packages/${pkg}/src`; + const target = targetPathFromMatch(matchResult); + const suffix = path.posix.relative(root, target); + + if (suffix === '.' || suffix === '') return `@bitcode/${pkg}`; + return `@bitcode/${pkg}/${suffix}`; +} + +function rewriteImportSpec(source, from, to) { + return source + .split(`from '${from}'`).join(`from '${to}'`) + .split(`from "${from}"`).join(`from "${to}"`) + .split(`import('${from}')`).join(`import('${to}')`) + .split(`import("${from}")`).join(`import("${to}")`); +} + +const importPattern = /(?:from\s+['"]([^'"]+)['"])|(?:import\s*\(\s*['"]([^'"]+)['"]\s*\))/gu; +let mismatch = false; + +for (const sourceFile of sourceFiles) { + const content = readFileSync(sourceFile, 'utf8'); + if (!content.includes('from ') && !content.includes('import(')) continue; + + const imports = new Set(); + let match; + while ((match = importPattern.exec(content)) !== null) { + imports.add(match[1] || match[2]); + } + if (imports.size === 0) continue; + + let nextContent = content; + for (const spec of imports) { + if (spec.startsWith('./') || spec.startsWith('../')) { + const resolved = findMatch(path.posix.join(path.posix.dirname(sourceFile), spec)); + if (!resolved) continue; + + const importedTarget = normalizeGitPath(path.posix.join(path.posix.dirname(sourceFile), spec)); + if (importedTarget === targetPathFromMatch(resolved)) continue; + + const wanted = importSpecFromMatch(sourceFile, resolved); + if (spec !== wanted) { + process.stdout.write(`Case mismatch in ${sourceFile}: '${spec}' -> '${wanted}' (actual '${resolved.actual}')\n`); + mismatch = true; + if (FIX) nextContent = rewriteImportSpec(nextContent, spec, wanted); + } + continue; + } + + if (resolveTsPath(spec)) continue; + + const aliasMatch = spec.match(/^@bitcode\/([^/]+)(\/.*)?$/u); + if (aliasMatch) { + const pkg = aliasMatch[1]; + const rest = aliasMatch[2] || ''; + const resolved = findMatch(`packages/${pkg}/src${rest}`); + if (!resolved) continue; + + const importedTarget = normalizeGitPath(`packages/${pkg}/src${rest}`); + if (importedTarget === targetPathFromMatch(resolved)) continue; + + const wanted = bitcodeAliasFromMatch(pkg, resolved); + if (spec !== wanted) { + process.stdout.write(`Alias case mismatch in ${sourceFile}: '${spec}' -> '${wanted}' (actual '${resolved.actual}')\n`); + mismatch = true; + if (FIX) nextContent = rewriteImportSpec(nextContent, spec, wanted); + } + } + } + + if (FIX && nextContent !== content) { + writeFileSync(sourceFile, nextContent); + } +} + +if (!mismatch) { + process.stdout.write(FIX ? 'No mismatches found to fix.\n' : 'No case-mismatched imports found.\n'); +} else if (FIX) { + process.stdout.write('Applied fixes for mismatched imports. Review diffs and commit.\n'); +} else { + process.stdout.write('Review the above mismatches or rerun with --fix.\n'); + process.exitCode = 1; +} diff --git a/scripts/check-import-casing.sh b/scripts/check-import-casing.sh index 833a26050..3449b719b 100755 --- a/scripts/check-import-casing.sh +++ b/scripts/check-import-casing.sh @@ -1,227 +1,4 @@ #!/usr/bin/env bash set -euo pipefail -FIX=0 -if [[ "${1:-}" == "--fix" ]]; then - FIX=1 - echo "Scanning and fixing case-mismatched imports vs filenames..." -else - echo "Scanning for case-mismatched imports vs filenames..." -fi - -# Collect source files (ts/tsx/js/jsx) tracked by git -mapfile -t files < <(git ls-files | grep -E '\.(ts|tsx|js|jsx)$') - -# Build a map of lowercase filenames -> actual names -declare -A filemap -for f in "${files[@]}"; do - lc=$(echo "$f" | tr '[:upper:]' '[:lower:]') - filemap["$lc"]="$f" -done - -mismatch=0 - -# Compute corrected relative spec from source file to actual file (strip extension, fold index) -rel_spec_from_actual() { - local srcFile="$1" actualPath="$2" - local dir="$actualPath"; - if [[ "$actualPath" =~ /index\.(ts|tsx|js|jsx)$ ]]; then - dir="${actualPath%/index.*}" - else - dir="${actualPath%.*}" - fi - local rel - rel=$(python3 - "$dir" "$srcFile" <<'PY' -import os,sys -target=sys.argv[1] -src=sys.argv[2] -print(os.path.relpath(target, os.path.dirname(src))) -PY -) - if [[ "$rel" != .* ]]; then - rel="./$rel" - fi - echo "$rel" -} - -declare -A ts_paths - -# Load tsconfig paths via Node (robust JSON parsing) -if command -v node >/dev/null 2>&1 && [[ -f tsconfig.json ]]; then - while IFS= read -r line; do - key="${line%%|*}" - val="${line#*|}" - ts_paths["$key"]="$val" - done < <(node -e ' - const fs=require("fs"); - try { - const ts=JSON.parse(fs.readFileSync("tsconfig.json","utf8")); - const paths=(ts.compilerOptions&&ts.compilerOptions.paths)||{}; - for(const k of Object.keys(paths)){ - const arr=paths[k]; - if(Array.isArray(arr)&&arr.length){ - console.log(k+"|"+arr[0]); - } - } - } catch(e) {} - ') -fi - -resolve_ts_path() { - local spec="$1" - # Try exact key match - if [[ -n "${ts_paths[$spec]:-}" ]]; then - echo "${ts_paths[$spec]}" - return 0 - fi - # Try wildcard mappings like @alias/* - for key in "${!ts_paths[@]}"; do - if [[ "$key" == *"*"* ]]; then - local prefix="${key%%\*}" - if [[ "$spec" == ${prefix}* ]]; then - local rest="${spec#${prefix}}" - local target="${ts_paths[$key]}" - local base="${target%%\*}" - echo "${base}${rest}" - return 0 - fi - fi - done - return 1 -} - -# Iterate per-file to support --fix replacement -for src in "${files[@]}"; do - mapfile -t specs < <(grep -h -E "from ['\"]([^'\"]+)['\"]|import\(['\"]([^'\"]+)['\"]\)" "$src" \ - | sed -E "s/.*['\"]([^'\"]+)['\"].*/\1/" | sort -u) - - for imp in "${specs[@]:-}"; do - # 1) Relative imports - if [[ "$imp" =~ ^(\./|\../) ]]; then - handled=0 - for ext in .ts .tsx .js .jsx ""; do - lc=$(echo "${imp}${ext}" | tr '[:upper:]' '[:lower:]') - if [[ -n "${filemap[$lc]:-}" ]]; then - actual="${filemap[$lc]}" - want=$(rel_spec_from_actual "$src" "$actual") - if [[ "$imp" != "$want" ]]; then - echo "⚠️ Case mismatch in $src: '$imp' → '$want' (actual '$actual')" - mismatch=1 - if [[ $FIX -eq 1 ]]; then - perl -pi -e "s@from '\Q$imp\E'@from '$want'@g; s@from \"\Q$imp\E\"@from \"$want\"@g; s@import\('\Q$imp\E'\)@import('$want')@g; s@import\(\"\Q$imp\E\"\)@import(\"$want\")@g;" "$src" - fi - fi - handled=1; break - fi - # index fallback - lc=$(echo "${imp}/index${ext}" | tr '[:upper:]' '[:lower:]') - if [[ -n "${filemap[$lc]:-}" ]]; then - actual="${filemap[$lc]}" - want=$(rel_spec_from_actual "$src" "$actual") - if [[ "$imp" != "$want" ]]; then - echo "⚠️ Case mismatch in $src: '$imp' → '$want' (actual '$actual')" - mismatch=1 - if [[ $FIX -eq 1 ]]; then - perl -pi -e "s@from '\Q$imp\E'@from '$want'@g; s@from \"\Q$imp\E\"@from \"$want\"@g; s@import\('\Q$imp\E'\)@import('$want')@g; s@import\(\"\Q$imp\E\"\)@import(\"$want\")@g;" "$src" - fi - fi - handled=1; break - fi - done - continue - fi - - # 2) Resolve via tsconfig paths if available (detection only for now) - if baseResolved=$(resolve_ts_path "$imp"); then - # We could implement alias-preserving rewrite using tsconfig mapping specifics - continue - fi - - # 3) Alias-preserving auto-fix for @bitcode//... → compute canonical suffix from actual path - if [[ "$imp" =~ ^@bitcode/([^/]+)(/.*)?$ ]]; then - pkg="${BASH_REMATCH[1]}"; rest="${BASH_REMATCH[2]:-}" - base="packages/$pkg/src${rest}" - handled=0 - for ext in .ts .tsx .js .jsx ""; do - lc=$(echo "${base}${ext}" | tr '[:upper:]' '[:lower:]') - if [[ -n "${filemap[$lc]:-}" ]]; then - actual="${filemap[$lc]}" - root="packages/$pkg/src" - # Compute canonical suffix relative to root, strip extension and fold index - suffix=$(python3 - "$actual" "$root" <<'PY' -import os,sys -actual=sys.argv[1] -root=sys.argv[2] -rel=os.path.relpath(actual, root) -if rel.lower().endswith(('/index.ts','/index.tsx','/index.js','/index.jsx')): - rel=os.path.dirname(rel) -else: - rel=os.path.splitext(rel)[0] -print(rel) -PY -) - if [[ "$suffix" == "." || "$suffix" == "" ]]; then - want="@bitcode/$pkg" - else - want="@bitcode/$pkg/$suffix" - fi - if [[ "$imp" != "$want" ]]; then - echo "⚠️ Alias case mismatch in $src: '$imp' → '$want' (actual '$actual')" - mismatch=1 - if [[ $FIX -eq 1 ]]; then - perl -pi -e "s@from '\Q$imp\E'@from '$want'@g; s@from \"\Q$imp\E\"@from \"$want\"@g; s@import\('\Q$imp\E'\)@import('$want')@g; s@import\(\"\Q$imp\E\"\)@import(\"$want\")@g;" "$src" - fi - fi - handled=1; break - fi - # index fallback - lc=$(echo "${base}/index${ext}" | tr '[:upper:]' '[:lower:]') - if [[ -n "${filemap[$lc]:-}" ]]; then - actual="${filemap[$lc]}" - root="packages/$pkg/src" - suffix=$(python3 - "$actual" "$root" <<'PY' -import os,sys -actual=sys.argv[1] -root=sys.argv[2] -rel=os.path.relpath(actual, root) -if rel.lower().endswith(('/index.ts','/index.tsx','/index.js','/index.jsx')): - rel=os.path.dirname(rel) -else: - rel=os.path.splitext(rel)[0] -print(rel) -PY -) - if [[ "$suffix" == "." || "$suffix" == "" ]]; then - want="@bitcode/$pkg" - else - want="@bitcode/$pkg/$suffix" - fi - if [[ "$imp" != "$want" ]]; then - echo "⚠️ Alias case mismatch in $src: '$imp' → '$want' (actual '$actual')" - mismatch=1 - if [[ $FIX -eq 1 ]]; then - perl -pi -e "s@from '\Q$imp\E'@from '$want'@g; s@from \"\Q$imp\E\"@from \"$want\"@g; s@import\('\Q$imp\E'\)@import('$want')@g; s@import\(\"\Q$imp\E\"\)@import(\"$want\")@g;" "$src" - fi - fi - handled=1; break - fi - done - continue - fi - done -done - -if [[ $mismatch -eq 0 ]]; then - if [[ $FIX -eq 1 ]]; then - echo "✅ No mismatches found to fix." - else - echo "✅ No case-mismatched imports found." - fi -else - if [[ $FIX -eq 1 ]]; then - echo "✨ Applied fixes for mismatched relative imports. Review diffs and commit." - else - echo "❗ Review the above mismatches or rerun with --fix." - fi - exit 1 -fi +node "$(dirname "$0")/check-import-casing.mjs" "$@" diff --git a/scripts/find-uppercase-raw-promptparts.sh b/scripts/find-uppercase-raw-promptparts.sh index c8007a5aa..e27e95b94 100755 --- a/scripts/find-uppercase-raw-promptparts.sh +++ b/scripts/find-uppercase-raw-promptparts.sh @@ -10,19 +10,8 @@ found=0 for dir in "${TARGET_DIRS[@]}"; do if [[ -d "$dir" ]]; then while IFS= read -r path; do - # Python check for any uppercase character in the full relative path rel="${path#$ROOT_DIR/}" - python3 - < { expect(res.status).toBe(410); const body = await res.json(); expect(body.error).toContain('non-fungible asset-pack share/read-right'); - expect(body.acquisitionPaths.terminalNeedMinting).toContain('/terminal'); + expect(body.acquisitionPaths.terminalReadMinting).toContain('/terminal'); }); it('forbids non-admin user with 403', async () => { diff --git a/uapi/tests/mocks/observability.js b/uapi/tests/mocks/observability.js new file mode 100644 index 000000000..757d0be15 --- /dev/null +++ b/uapi/tests/mocks/observability.js @@ -0,0 +1,11 @@ +module.exports = { + trace: async (_name, fn) => fn(), + traceRoute: (_name, fn) => fn, + traceStep: async (_name, fn) => fn(), + generateTextTraced: async (...args) => { + if (args.length === 1 && typeof args[0] === 'function') { + return args[0](); + } + return undefined; + }, +}; diff --git a/uapi/tests/styleMock.js b/uapi/tests/styleMock.js new file mode 100644 index 000000000..af59327ed --- /dev/null +++ b/uapi/tests/styleMock.js @@ -0,0 +1,13 @@ +const styleProxy = new Proxy( + {}, + { + get: (_target, prop) => { + if (prop === '__esModule') return true; + if (prop === 'default') return styleProxy; + return String(prop); + }, + }, +); + +module.exports = styleProxy; +module.exports.default = styleProxy; diff --git a/uapi/tests/terminalSurfaceCopy.test.ts b/uapi/tests/terminalSurfaceCopy.test.ts index 8dc3e2106..7868a46ad 100644 --- a/uapi/tests/terminalSurfaceCopy.test.ts +++ b/uapi/tests/terminalSurfaceCopy.test.ts @@ -7,8 +7,8 @@ import { describe('TERMINAL_SURFACE_COPY', () => { it('keeps Bitcode Terminal detail copy centered on activity, asset packs, and proof reading', () => { expect(TERMINAL_SURFACE_COPY.frame.title).toContain('Overview'); - expect(TERMINAL_SURFACE_COPY.supply.title).toContain('Depositing'); - expect(TERMINAL_SURFACE_COPY.read.title).toContain('Reading'); + expect(TERMINAL_SURFACE_COPY.supply.title).toContain('Deposit'); + expect(TERMINAL_SURFACE_COPY.read.title).toContain('Read'); expect(TERMINAL_SURFACE_COPY.closure.title).toContain('Proofs'); expect(TERMINAL_SURFACE_COPY.detail.emptySelection).toContain('asset pack'); expect(TERMINAL_SURFACE_COPY.detail.transactionSummaryFallback).toContain('selected Terminal result'); diff --git a/uapi/tests/textMock.js b/uapi/tests/textMock.js new file mode 100644 index 000000000..86059f362 --- /dev/null +++ b/uapi/tests/textMock.js @@ -0,0 +1 @@ +module.exports = 'test-file-stub'; diff --git a/uapi/types/svg.d.ts b/uapi/types/svg.d.ts new file mode 100644 index 000000000..b49d15d65 --- /dev/null +++ b/uapi/types/svg.d.ts @@ -0,0 +1,6 @@ +declare module '*.svg' { + import type { StaticImageData } from 'next/image'; + + const src: StaticImageData; + export default src; +}