feat: add create-chat-sdk CLI#603
Open
bensabic wants to merge 16 commits into
Open
Conversation
…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.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 -yThe 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 runsgit initand installs dependencies. There are no pages or client UI in the template.Adapter choices come straight from the
chat/adapterscatalog, 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;--interactiveforces prompts.Also in this PR
google-chatis renamed togchateverywhere (docs pages, OG image, adapter catalog). Old URLs redirect permanently, including language-prefixed and/ogpaths.chat-sdk.dev/docs/create-chat-sdk, and the CLI is promoted on the homepage, package READMEs, and the agent skill.chatand@chat-adapter/*.Testing
pnpm validatepasses (knip, lint, typecheck, tests, build).create-chat-sdkwith 100% coverage, including an e2e matrix that scaffolds every catalog adapter.npm pack --dry-run).