Skip to content

feat(think): git init + Oxlint/Oxfmt for scaffolding, interactive template, drop unused helpers#1817

Merged
threepointone merged 2 commits into
mainfrom
think-scaffold-git-oxlint-cleanup
Jun 26, 2026
Merged

feat(think): git init + Oxlint/Oxfmt for scaffolding, interactive template, drop unused helpers#1817
threepointone merged 2 commits into
mainfrom
think-scaffold-git-oxlint-cleanup

Conversation

@threepointone

@threepointone threepointone commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves the Think scaffolding experience (npm create think and think 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 with a guard. Newly scaffolded and augmented apps get 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 (shell on win32); a missing/broken git binary warns and continues rather than failing.
  • Interactive template selection. create-think now prompts for a starter when --template is omitted. A TTY guard falls back to basic in 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.
  • Oxlint/Oxfmt + check. Starters ship with .oxlintrc.json / .oxfmtrc.json and a check script (format check + lint + typecheck). think init augmentation writes the canonical 149-line .gitignore.
  • Shared CLI plumbing. Git/npm spawning, the existing-repo guard, and the small fs helpers now live in create-think/src/cli-utils.ts, imported by both entry points so they can't drift. lib.ts re-exports only what crosses the package boundary.

Framework cleanup

  • Removed the unused declarative agent() helper (framework/agent.ts).
  • Removed the 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 — with npm install we no longer need the workspace-root fallback. Caught and fixed experimental/forever-fibers, which sourced @cloudflare/kumo without declaring it as a direct dependency.
  • Normalized $schema paths in wrangler.jsonc to the nearest node_modules.

Changeset

  • create-think: patch
  • @cloudflare/think: minor

Test plan

  • pnpm run check — sherif + export checks + oxfmt + oxlint + typecheck, 113/113 projects clean
  • create-think tests — 16/16 (incl. new git-skip-existing-repo and non-interactive template fallback cases)
  • @cloudflare/think CLI tests updated for the repo guard + git messaging
  • Manual smoke: npm create think (interactive prompt), --template, --yes, and think init into an existing repo

Made with Cursor


Open in Devin Review

…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-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0b6c939

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

This PR includes changesets to release 2 packages
Name Type
create-think Patch
@cloudflare/think Minor

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread examples/a2a/wrangler.jsonc
Comment thread examples/assistant/src/styles.css
…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>
@pkg-pr-new

pkg-pr-new Bot commented Jun 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1817

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1817

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1817

create-think

npm i https://pkg.pr.new/create-think@1817

hono-agents

npm i https://pkg.pr.new/hono-agents@1817

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1817

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1817

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1817

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1817

commit: 0b6c939

@threepointone threepointone merged commit 7f367d8 into main Jun 26, 2026
4 checks passed
@threepointone threepointone deleted the think-scaffold-git-oxlint-cleanup branch June 26, 2026 00:00
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