Skip to content

feat: add create-chat-sdk CLI#603

Open
bensabic wants to merge 16 commits into
mainfrom
create-chat-sdk
Open

feat: add create-chat-sdk CLI#603
bensabic wants to merge 16 commits into
mainfrom
create-chat-sdk

Conversation

@bensabic

Copy link
Copy Markdown
Contributor

Adds create-chat-sdk, a CLI that scaffolds a Next.js Chat SDK bot project:

npm create chat-sdk@latest my-bot

# non-interactive
npm create chat-sdk@latest -- my-bot --adapter slack redis -y

The user picks platform and state adapters (interactively or via --adapter), and the CLI generates a webhook-only project: src/lib/bot.ts, .env.example, next.config.ts, packae.json, and a README, then optionally runs git init and installs dependencies. There are no pages or client UI in the template.

Adapter choices come straight from the chat/adapters catalog, so the CLI has no adapter registry of its own. When a coding agent (Cursor, Claude Code, etc.) runs the CLI, it says so and uses non-interactive defaults; --interactive forces prompts.

Also in this PR

  • google-chat is renamed to gchat everywhere (docs pages, OG image, adapter catalog). Old URLs redirect permanently, including language-prefixed and /og paths.
  • New docs page at chat-sdk.dev/docs/create-chat-sdk, and the CLI is promoted on the homepage, package READMEs, and the agent skill.
  • Release wiring: the package joins the changesets fixed group, so it versions in lockstep with chat and @chat-adapter/*.

Testing

  • pnpm validate passes (knip, lint, typecheck, tests, build).
  • 146 tests in create-chat-sdk with 100% coverage, including an e2e matrix that scaffolds every catalog adapter.
  • Verified the published tarball contains the full template (npm pack --dry-run).

bensabic added 14 commits June 10, 2026 12:40
…e npm pack

npm-packlist always drops nested .gitignore files from published
tarballs (and applies their rules to siblings, which also excluded
next-env.d.ts). Ship the template file as `gitignore` and rename it
during copy, and un-ignore the template's next-env.d.ts at the repo
root so it gets committed and packed.
createIoRedisState has a required options argument with no REDIS_URL
auto-detection, so the zero-arg spec produced a project that failed
typecheck and crashed at runtime. Pass the url explicitly and teach
the .env.example generator to list env vars referenced only by the
generated bot.ts.
…alog

The bot.ts generator reads env names from the scaffold spec while
.env.example reads the catalog; a catalog rename would silently break
generated bots. Assert every spec env reference is documented for its
adapter, with an explicit allowlist for spec-only vars.
… drop --no-color

Agent env signals (CURSOR_TRACE_ID, CLAUDECODE, REPL_ID) are set in
interactive sessions too, so auto-detection forced yes-mode on humans
with no opt-out or notice. Add an --interactive escape hatch, skip
detection when a flag already decides the mode, and announce detection
when it applies. Always print fatal errors to stderr in --quiet mode,
and remove the --no-color flag, which was never wired up (picocolors
honors NO_COLOR on its own).
Assigning undefined to a process.env key stores the literal string
"undefined", leaving truthy agent detection for later same-process
tests.
Without --, npm consumes the flags itself (-y is npm's own --yes, -d
its --loglevel alias) and the initializer only receives positionals,
silently dropping the adapter selection. Also document --interactive
and replace the removed --no-color flag with the NO_COLOR standard.
The bare-path redirect missed /:lang/-prefixed pages and the /og image
route, which are linked from the GitHub-rendered gchat README and
indexed docs URLs.
Add the package to the fixed version group and a changeset so the
release workflow versions and publishes the CLI the docs advertise.
@bensabic bensabic requested review from a team and cramforce as code owners June 10, 2026 04:38
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
chat Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 5:01am
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 5:01am

@socket-security

socket-security Bot commented Jun 10, 2026

Copy link
Copy Markdown

Comment thread packages/create-chat-sdk/src/catalog/scaffold-spec.ts Outdated
IoRedisStateAdapterOptions declares logger as required, so the
generated url-only invocation failed tsc. Specs can now declare chat
package imports for generated invocation code, and ioredis uses that
to pass a ConsoleLogger.
Both options variants required a logger while the package's own JSDoc
examples and README omitted it, so the documented usage failed tsc.
Default to ConsoleLogger like state-redis, document the option in the
README, and correct AGENTS.md export names and the claimed REDIS_URL
auto-detection.
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