Skip to content

sdk: scaffold @pagespace/sdk package - #1780

Merged
2witstudios merged 2 commits into
pu/cli-loginfrom
pu/sdk-scaffold
Jul 3, 2026
Merged

2witstudios merged 2 commits into
pu/cli-loginfrom
pu/sdk-scaffold

Conversation

@2witstudios

Copy link
Copy Markdown
Owner

Summary

  • Scaffolds packages/sdk (@pagespace/sdk) per Phase 2 task 1 (task page i1nkmoax9kp7h1rwqg82eq4d): package.json ("type": "module", root exports entry, build/typecheck/test scripts wired for bun run --filter), tsconfig.json/tsconfig.build.json, vitest.config.ts — mirroring packages/lib conventions, no vitest aliases.
  • src/index.ts exports SDK_VERSION and reserves MIN_SERVER_API_VERSION per ADR 0001 D3; the repo-level MIN_SERVER_API_VERSION <= API_CONTRACT_VERSION assertion is deferred until packages/lib/src/api-contract-version.ts exists (noted in the package README).
  • RED test (src/__tests__/scaffold.test.ts) imports @pagespace/sdk by its published name (not a relative path) to prove real installability, and asserts the required scripts exist.
  • Only runtime dependency is zod, per epic non-negotiable Activate client telemetry for monitoring dashboards #4.

Notes for reviewers

  • The package's own tsconfig.json overrides moduleResolution/module to NodeNext and clears the inherited root "@pagespace/*" path-alias wildcard ("paths": {}). Without this, tsc would silently resolve the self-import via a source alias instead of genuinely validating the exports map — the empty override forces real package.json-exports resolution (matching how Vitest/Node already resolve it via Node's self-referencing-package feature).
  • pretypecheck/pretest hooks run bun run build first, since both tsc's own resolution of @pagespace/sdk and the entry test need dist/ to exist.

Test plan

  • bun install && bun run --filter '@pagespace/sdk' typecheck && bun run --filter '@pagespace/sdk' test green from a clean worktree (dist removed before each run)
  • RED test confirmed failing for the right reason before implementation existed (commit 1a74502)

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01EMFSFJChydanBadPdJADvF

2witstudios and others added 2 commits July 3, 2026 11:48
Failing test asserting SDK_VERSION/MIN_SERVER_API_VERSION exports and
build/typecheck/test scripts, plus the package.json/tsconfig/vitest
harness needed to run it. Fails because src/index.ts does not exist yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMFSFJChydanBadPdJADvF
- src/index.ts exports SDK_VERSION and a reserved MIN_SERVER_API_VERSION
  (ADR 0001 D3; cross-check against API_CONTRACT_VERSION deferred until
  packages/lib/src/api-contract-version.ts exists, noted in README)
- tsconfig.json/tsconfig.build.json use NodeNext module+moduleResolution
  (required for 'type: module' + package.json exports-field resolution,
  including Node's self-referencing-package feature the scaffold test
  exercises) with an empty 'paths' override so typecheck genuinely
  resolves '@pagespace/sdk' through the exports map rather than aliasing
  around it
- pretypecheck/pretest hooks build the package first, since both the
  entry test and tsc's own resolution of '@pagespace/sdk' need dist/
  to exist
- runtime deps: zod only, per epic non-negotiable

Gate green from a clean worktree: bun install && bun run --filter
'@pagespace/sdk' typecheck && bun run --filter '@pagespace/sdk' test

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EMFSFJChydanBadPdJADvF
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 05503be6-5370-43c3-93b0-352579e2c645

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pu/sdk-scaffold

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@2witstudios
2witstudios merged commit 9b7cab2 into pu/cli-login Jul 3, 2026
1 check passed
@2witstudios
2witstudios deleted the pu/sdk-scaffold branch July 3, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant