Skip to content

feat: add create-chat-sdk CLI#603

Merged
dancer merged 24 commits into
mainfrom
create-chat-sdk
Jun 16, 2026
Merged

feat: add create-chat-sdk CLI#603
dancer merged 24 commits into
mainfrom
create-chat-sdk

Conversation

@bensabic

@bensabic bensabic commented Jun 10, 2026

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 with src/lib/bot.ts, .env.example, next.config.ts, package.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 such as Cursor or Claude Code runs the CLI, it uses non-interactive defaults and requires an explicit platform adapter. --interactive forces prompts.

also in this pr

  • google-chat is renamed to gchat everywhere, including docs pages, the OG image, and adapter catalog. Old URLs redirect permanently, including language-prefixed and /og paths
  • a new docs page is available at chat-sdk.dev/docs/create-chat-sdk, and the CLI is promoted on the homepage, package READMEs, and agent skill
  • create-chat-sdk releases independently with a minor changeset for its initial 0.1.0 release

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 16, 2026 7:43am
chat-sdk-nextjs-chat Ready Ready Preview, Comment, Open in v0 Jun 16, 2026 7:43am

@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.
bensabic added 2 commits June 16, 2026 01:25
- Remove the Photon iMessage adapter from the catalog, CLI scaffold spec, docs registry/meta/redirect, docs page, and integration tests
- Generate a Discord Gateway route and vercel.json cron (plus CRON_SECRET docs) when Discord is selected
- Add engines.node >=20.12 and downgrade commander to ^14
- Move chat to devDependencies (it is bundled via tsup noExternal)
- Drop the ConsoleLogger logger from the generated ioredis state and remove the now-unused chatImports mechanism
- Stop duplicating official adapters' provider SDKs in generated package.json (kept transitively); still install vendor-official peer deps
- Remove the unrelated global .prose inline-code style from the docs CSS
- Reject scoped project names since the name doubles as the output directory
- Exit non-zero when dependency install fails in non-interactive mode
- Use npm create chat-sdk@latest -- ... in copyable docs examples
- Export GET and POST from the template webhook route so WhatsApp/Messenger verification works
- Exclude Matrix and Lark from the CLI (long-running runtimes) while keeping them in the public catalog
- Remove stale conditional files (web routes, Discord gateway, vercel.json) on a --force re-run
- Require at least one platform adapter in both interactive and non-interactive flows
- Update the catalog display name, docs registry, and MDX page/prose
- Default interactive prompt lists only official adapters as a flat list with no group headings
- The --all flag lists every adapter grouped under Official and Vendor-official headings
- Document the --all flag and the default listing behavior
@dancer dancer merged commit 8f3af76 into main Jun 16, 2026
17 checks passed
@dancer dancer deleted the create-chat-sdk branch June 16, 2026 07:48
bensabic added a commit that referenced this pull request Jun 16, 2026
Stacked on top of #603 (`create-chat-sdk`).

Refreshes the chat-sdk.dev homepage styling:

- Adds Geist typography utilities (`text-heading-*`, `text-copy-*`) and
applies them to the hero, section headings, and copy.
- Adds a grid-based layout (`home-grid.css`) with consistent guide lines
for the stats, supported-platforms, code, and integrations sections.
- Adds a tabbed code showcase for the Chat SDK Core section, with window
chrome, a Geist syntax theme, and
`bot.ts`/handlers/cards/streaming/tools/state/multi-platform snippets.
- Scopes inline-code styling and sets the dark-mode
`--ds-background-100`/`--ds-background-200` tokens so `background-100`
is the elevated surface.

---------

Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com>
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.

2 participants