Skip to content

refactor: extract @withstanza/schema and @withstanza/utils packages#16

Merged
jakejarvis merged 2 commits into
mainfrom
refactor/schema-package
May 31, 2026
Merged

refactor: extract @withstanza/schema and @withstanza/utils packages#16
jakejarvis merged 2 commits into
mainfrom
refactor/schema-package

Conversation

@jakejarvis

@jakejarvis jakejarvis commented May 30, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Extracted the schema/contract layer to a new @withstanza/schema package and moved shared helpers to @withstanza/utils. @withstanza/registry now focuses on resolving and synthesis; the JSON Schema for stanza.json is served at /schema.json, and the static registry build moved to scripts/compile-registry.ts with a flatter output. No CLI behavior change.

  • Refactors

    • Added @withstanza/schema (npm-published): owns the stanza.json Zod schema (StanzaManifestSchema), module/registry schemas, contract types, CATEGORIES, package-manager and registry-config.
    • Added @withstanza/utils (private): safeRelativePath/assertSafeRelativePath, appendEnvVar.
    • Slimmed @withstanza/registry: keeps resolver, template rendering, package.json/env/README synthesis; depends on @withstanza/schema + @withstanza/utils.
    • New scripts/compile-registry.ts replaces package-embedded build; writes <out>/index.json and <out>/modules/*.json (no registry/ wrapper). Web prebuild and tests call this via jiti.
    • Web now serves the manifest JSON Schema at /schema.json (compiled from StanzaManifestSchema on request); removed public/schema.json and the unused manifestJsonSchema() helper.
    • Updated imports across CLI and web from @stanza/* to @withstanza/*; web package renamed to @withstanza/web. Docs updated.
  • Migration

    • Update imports:
      • Types/helpers from @stanza/registry@withstanza/schema.
      • Resolver and synthesis APIs → @withstanza/registry.
      • Path/env helpers → @withstanza/utils.
    • Build registries with jiti scripts/compile-registry.ts <outDir> and point STANZA_REGISTRY to <outDir>/index.json (was <outDir>/registry/index.json).
    • Use https://stanza.tools/schema.json for a manifest’s $schema.

Written for commit 9b44e45. Summary will update on new commits.

Review in cubic

@changeset-bot

changeset-bot Bot commented May 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9b44e45

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@withstanza/schema Minor
stanza-cli Patch
create-stanza Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stanza-web Ready Ready Preview, Comment May 31, 2026 1:44am

Request Review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 152 files, which is 2 over the limit of 150.

To get a review, narrow the scope:
• coderabbit review --type committed # exclude uncommitted changes
• coderabbit review --dir # limit to a subdirectory
• coderabbit review --base # compare against a closer base

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3efb0c43-c0c4-40c9-853e-6c4126763194

📥 Commits

Reviewing files that changed from the base of the PR and between 06bd248 and 9b44e45.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (152)
  • .changeset/extract-schema-package.md
  • .gitignore
  • AGENTS.md
  • README.md
  • apps/cli/package.json
  • apps/cli/src/commands/add.ts
  • apps/cli/src/commands/commands.test.ts
  • apps/cli/src/commands/doctor.ts
  • apps/cli/src/commands/init.ts
  • apps/cli/src/commands/list.ts
  • apps/cli/src/commands/remove.ts
  • apps/cli/src/commands/search.ts
  • apps/cli/src/lib/codemod-runner.test.ts
  • apps/cli/src/lib/codemod-runner.ts
  • apps/cli/src/lib/manifest.ts
  • apps/cli/src/lib/readme.ts
  • apps/cli/src/lib/region-tracker.ts
  • apps/cli/src/lib/registry-loader.ts
  • apps/cli/src/lib/wizard.ts
  • apps/web/.gitignore
  • apps/web/content/docs/authoring.mdx
  • apps/web/package.json
  • apps/web/src/components/builder/index.tsx
  • apps/web/src/components/builder/module-cards.tsx
  • apps/web/src/components/builder/project-setup.tsx
  • apps/web/src/components/command-preview.tsx
  • apps/web/src/components/detail/adapter-switcher.tsx
  • apps/web/src/components/detail/install.tsx
  • apps/web/src/components/detail/tables.tsx
  • apps/web/src/components/detail/templates-list.tsx
  • apps/web/src/components/module-logo.tsx
  • apps/web/src/components/package-manager-select.tsx
  • apps/web/src/components/search/site-search.tsx
  • apps/web/src/lib/analytics.ts
  • apps/web/src/lib/module-search.ts
  • apps/web/src/lib/package-manager.ts
  • apps/web/src/lib/prerender.ts
  • apps/web/src/lib/selection.ts
  • apps/web/src/routeTree.gen.ts
  • apps/web/src/routes/api.search.modules.ts
  • apps/web/src/routes/docs.$.tsx
  • apps/web/src/routes/og.registry.$category.{$id}[.]webp.ts
  • apps/web/src/routes/registry.$category.$id.tsx
  • apps/web/src/routes/registry.$category.index.tsx
  • apps/web/src/routes/registry.index.tsx
  • apps/web/src/routes/schema[.]json.ts
  • apps/web/src/routes/stats.tsx
  • apps/web/src/server/builder-state.functions.ts
  • apps/web/src/server/module-detail.functions.ts
  • apps/web/src/server/og-card.server.tsx
  • apps/web/src/server/registry-base.server.ts
  • apps/web/src/server/registry-index.functions.ts
  • apps/web/src/server/registry-modules.server.ts
  • apps/web/src/server/stats.functions.ts
  • apps/web/vite.config.ts
  • package.json
  • packages/codemods/package.json
  • packages/codemods/src/builtins/add-array-entry-in-call.test.ts
  • packages/codemods/src/builtins/add-array-entry-in-call.ts
  • packages/codemods/src/builtins/add-jsx-child.test.ts
  • packages/codemods/src/builtins/add-jsx-child.ts
  • packages/codemods/src/builtins/add-package-dep.test.ts
  • packages/codemods/src/builtins/add-plugin-to-call.test.ts
  • packages/codemods/src/builtins/add-plugin-to-call.ts
  • packages/codemods/src/builtins/append-to-file.test.ts
  • packages/codemods/src/builtins/append-to-file.ts
  • packages/codemods/src/builtins/index.ts
  • packages/codemods/src/builtins/re-export.test.ts
  • packages/codemods/src/builtins/re-export.ts
  • packages/codemods/src/builtins/replace-import.test.ts
  • packages/codemods/src/builtins/replace-import.ts
  • packages/codemods/src/builtins/set-html-attributes.test.ts
  • packages/codemods/src/builtins/set-html-attributes.ts
  • packages/codemods/src/builtins/set-tsconfig-paths.test.ts
  • packages/codemods/src/builtins/set-tsconfig-paths.ts
  • packages/codemods/src/builtins/wrap-root-layout.test.ts
  • packages/codemods/src/builtins/wrap-root-layout.ts
  • packages/codemods/src/env.ts
  • packages/codemods/src/types.ts
  • packages/registry/package.json
  • packages/registry/src/index.ts
  • packages/registry/src/package-json.test.ts
  • packages/registry/src/package-json.ts
  • packages/registry/src/resolver.test.ts
  • packages/registry/src/resolver.ts
  • packages/registry/src/synthesize.test.ts
  • packages/registry/src/synthesize.ts
  • packages/registry/src/template.test.ts
  • packages/registry/src/template.ts
  • packages/schema/README.md
  • packages/schema/package.json
  • packages/schema/src/category.ts
  • packages/schema/src/index.ts
  • packages/schema/src/manifest.test.ts
  • packages/schema/src/manifest.ts
  • packages/schema/src/module.ts
  • packages/schema/src/package-manager.ts
  • packages/schema/src/registry-config.test.ts
  • packages/schema/src/registry-config.ts
  • packages/schema/tsconfig.json
  • packages/utils/package.json
  • packages/utils/src/env.ts
  • packages/utils/src/index.ts
  • packages/utils/src/safe-path.test.ts
  • packages/utils/src/safe-path.ts
  • packages/utils/tsconfig.json
  • registry/modules/ai-tanstack-ai/module.ts
  • registry/modules/ai-tanstack-ai/package.json
  • registry/modules/ai-vercel-ai-sdk/module.ts
  • registry/modules/ai-vercel-ai-sdk/package.json
  • registry/modules/auth-better-auth/module.ts
  • registry/modules/auth-better-auth/package.json
  • registry/modules/auth-clerk/module.ts
  • registry/modules/auth-clerk/package.json
  • registry/modules/db-postgres/module.ts
  • registry/modules/db-postgres/package.json
  • registry/modules/db-sqlite/module.ts
  • registry/modules/db-sqlite/package.json
  • registry/modules/email-resend/module.ts
  • registry/modules/email-resend/package.json
  • registry/modules/framework-next/module.ts
  • registry/modules/framework-next/package.json
  • registry/modules/framework-tanstack-start/module.ts
  • registry/modules/framework-tanstack-start/package.json
  • registry/modules/monorepo-turbo/module.ts
  • registry/modules/monorepo-turbo/package.json
  • registry/modules/orm-drizzle/module.ts
  • registry/modules/orm-drizzle/package.json
  • registry/modules/orm-prisma/module.ts
  • registry/modules/orm-prisma/package.json
  • registry/modules/payments-polar/module.ts
  • registry/modules/payments-polar/package.json
  • registry/modules/payments-stripe/module.ts
  • registry/modules/payments-stripe/package.json
  • registry/modules/testing-playwright/module.ts
  • registry/modules/testing-playwright/package.json
  • registry/modules/testing-vitest/module.ts
  • registry/modules/testing-vitest/package.json
  • registry/modules/tooling-biome/module.ts
  • registry/modules/tooling-biome/package.json
  • registry/modules/tooling-eslint-prettier/module.ts
  • registry/modules/tooling-eslint-prettier/package.json
  • registry/modules/tooling-oxlint-oxfmt/module.ts
  • registry/modules/tooling-oxlint-oxfmt/package.json
  • registry/modules/ui-shadcn-base/module.ts
  • registry/modules/ui-shadcn-base/package.json
  • registry/modules/ui-shadcn-radix/module.ts
  • registry/modules/ui-shadcn-radix/package.json
  • registry/modules/ui-tailwind/module.ts
  • registry/modules/ui-tailwind/package.json
  • scripts/compile-registry.ts
  • vite.config.ts

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
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch refactor/schema-package

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 and usage tips.

…s to devDeps, and fix stale comment

- Remove `manifestJsonSchema()` from `packages/schema/src/manifest.ts` — no longer needed
- Move `@withstanza/utils` from `dependencies` to `devDependencies` in `@withstanza/schema` since it is only a build-time dep
- Correct a comment in `codemod-runner.ts` that cited `@withstanza/registry` instead of `@withstanza/schema`
@jakejarvis jakejarvis merged commit ea2d8c4 into main May 31, 2026
4 checks passed
@jakejarvis jakejarvis deleted the refactor/schema-package branch May 31, 2026 01:47
@github-actions github-actions Bot mentioned this pull request May 31, 2026
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