feat(think): git init + Oxlint/Oxfmt for scaffolding, interactive template, drop unused helpers#1817
Merged
Merged
Conversation
…plate, drop unused helpers Scaffolding (create-think + `think init`) - Initialize a git repository for newly scaffolded and augmented apps, with a guard (`git rev-parse --is-inside-work-tree`) that skips cleanly when the target is already inside a repo — avoids reinit and accidental nested repos. Cross-platform spawn (`shell` on win32); a missing/broken git binary warns and continues. - create-think now prompts for a starter template when `--template` is omitted, with a TTY guard that falls back to `basic` non-interactively and robust numeric-choice handling (out-of-range falls back / re-prompts). - Starters ship with Oxlint + Oxfmt config (.oxlintrc.json / .oxfmtrc.json) and a `check` script (format check + lint + typecheck); `think init` augmentation writes the canonical 149-line .gitignore. - Consolidated shared CLI plumbing (git/npm spawning, repo guard, fs helpers) into create-think/src/cli-utils.ts so create-think and `think init` cannot drift; trimmed lib.ts re-exports to only what crosses the package boundary. Framework cleanup - Removed the unused declarative `agent()` helper (framework/agent.ts) in favor of class-based agents. - Removed identity helpers `defineMessengers`, `defineScheduledTasks`, and `defineChannels` in favor of plain typed object returns; updated all usages across examples, starters, tests, and docs. - Inlined `__isThinkAgentExport` into `__isAgentClass` and dropped the dead `reexportDefault` branch in inferAgentExport. Repo-wide config hygiene - Normalized Tailwind `@source` declarations in styles.css to a single node_modules path (npm install no longer needs the workspace-root fallback); added the missing `@cloudflare/kumo` direct dependency to forever-fibers, which was sourcing it without declaring it. - Normalized `$schema` paths in wrangler.jsonc to the nearest node_modules. Verified: pnpm run check (sherif + exports + oxfmt + oxlint + typecheck, 113/113) clean; create-think tests 16/16. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 0b6c939 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
…ch scaffolding The PR normalized every example's wrangler.jsonc $schema to `./node_modules/wrangler/config-schema.json` and each styles.css @source to `../node_modules/...`, but the convention guides still documented the old monorepo-root-relative paths. - examples/AGENTS.md: update the wrangler $schema bullet and the Kumo @source CSS block to the standalone-friendly paths, with a note on why they resolve both in the workspace and when copied out. - design/visuals.md: fix the @source code block and replace the now-incorrect "must point to the hoisted package at monorepo root" note. Co-authored-by: Cursor <cursoragent@cursor.com>
agents
@cloudflare/ai-chat
@cloudflare/codemode
create-think
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
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.
Summary
Improves the Think scaffolding experience (
npm create thinkandthink init), removes unused framework helpers in favor of class-based agents and plain typed returns, and does some repo-wide config hygiene.Scaffolding (
create-think+think init)git init, but only when not already inside a work tree (git rev-parse --is-inside-work-tree). This avoids the misleading "Reinitialized existing Git repository" and, more importantly, avoids creating a nested repo when scaffolding into a subfolder of an existing project. Cross-platform spawn (shellon win32); a missing/brokengitbinary warns and continues rather than failing.create-thinknow prompts for a starter when--templateis omitted. A TTY guard falls back tobasicin non-interactive environments (CI, piped stdin), and numeric input is validated — out-of-range choices fall back to the default instead of being treated as an unknown template name.check. Starters ship with.oxlintrc.json/.oxfmtrc.jsonand acheckscript (format check + lint + typecheck).think initaugmentation writes the canonical 149-line.gitignore.create-think/src/cli-utils.ts, imported by both entry points so they can't drift.lib.tsre-exports only what crosses the package boundary.Framework cleanup
agent()helper (framework/agent.ts).defineMessengers,defineScheduledTasks, anddefineChannelsin favor of plain typed object returns; updated all usages across examples, starters, tests, and docs.__isThinkAgentExportinto__isAgentClassand dropped the deadreexportDefaultbranch ininferAgentExport.Repo-wide config hygiene
@sourcedeclarations instyles.cssto a singlenode_modulespath — with npm install we no longer need the workspace-root fallback. Caught and fixedexperimental/forever-fibers, which sourced@cloudflare/kumowithout declaring it as a direct dependency.$schemapaths inwrangler.jsoncto the nearestnode_modules.Changeset
create-think: patch@cloudflare/think: minorTest plan
pnpm run check— sherif + export checks + oxfmt + oxlint + typecheck, 113/113 projects cleancreate-thinktests — 16/16 (incl. new git-skip-existing-repo and non-interactive template fallback cases)@cloudflare/thinkCLI tests updated for the repo guard + git messagingnpm create think(interactive prompt),--template,--yes, andthink initinto an existing repoMade with Cursor