@cloudflare/think 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -17
- package/dist/{chat-sdk-Bb93yaZh.js → chat-sdk-D6cUghsQ.js} +33 -8
- package/dist/chat-sdk-D6cUghsQ.js.map +1 -0
- package/dist/cli/index.js +224 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/{codegen-CuPdJRpV.js → codegen-DlA2QQuU.js} +6 -38
- package/dist/codegen-DlA2QQuU.js.map +1 -0
- package/dist/{config-D512sQYg.d.ts → config-CD7hqncK.d.ts} +5 -5
- package/dist/extensions/index.js +1 -1
- package/dist/fetch-By3eIQ-a.d.ts +147 -0
- package/dist/framework/index.d.ts +17 -62
- package/dist/framework/index.js +3 -57
- package/dist/{think-i1Pkgb1R.d.ts → index-CR4-ffm_.d.ts} +1734 -736
- package/dist/{manager-BPndMP_6.js → manager-CSk5htym.js} +7 -7
- package/dist/{manager-BPndMP_6.js.map → manager-CSk5htym.js.map} +1 -1
- package/dist/{manifest-CpB-xngB.d.ts → manifest-DK5HuGga.d.ts} +16 -18
- package/dist/messengers/index.d.ts +59 -55
- package/dist/messengers/index.js +2 -2
- package/dist/messengers/telegram.d.ts +4 -4
- package/dist/messengers/telegram.js +1 -1
- package/dist/react.d.ts +79 -0
- package/dist/react.js +28 -0
- package/dist/react.js.map +1 -0
- package/dist/server-entry.d.ts +1 -1
- package/dist/server-entry.js +1 -1
- package/dist/server-entry.js.map +1 -1
- package/dist/studio/assets/{angular-html-z-TUogET.js → angular-html-D27LthTc.js} +1 -1
- package/dist/studio/assets/{angular-ts-DMGuEVeg.js → angular-ts-DtNL2gQ7.js} +1 -1
- package/dist/studio/assets/{apl-KvrEROqd.js → apl-BgEcDqM0.js} +1 -1
- package/dist/studio/assets/{astro-Bm_woEti.js → astro-CstbRF9e.js} +1 -1
- package/dist/studio/assets/{blade-BdCF3r89.js → blade-CLG-7epG.js} +1 -1
- package/dist/studio/assets/{c-CDqDtkvZ.js → c-CssQqwxO.js} +1 -1
- package/dist/studio/assets/{cobol-CeFM1vZz.js → cobol-CjmzHCjg.js} +1 -1
- package/dist/studio/assets/{coffee-2ed6LBym.js → coffee-B_rqYPkp.js} +1 -1
- package/dist/studio/assets/{cpp-Dj3nX0J4.js → cpp-5YyZJlb7.js} +1 -1
- package/dist/studio/assets/{crystal-BsIYZMQ3.js → crystal-D7uKze0i.js} +1 -1
- package/dist/studio/assets/{css-B48fnuoH.js → css-k9oPgg7G.js} +1 -1
- package/dist/studio/assets/{edge-C7qt1aza.js → edge-CGgsSt0x.js} +1 -1
- package/dist/studio/assets/{elixir-CiTmwoQ3.js → elixir-BX_d5Evo.js} +1 -1
- package/dist/studio/assets/{elm-exDZ-PRY.js → elm-DENxDm5e.js} +1 -1
- package/dist/studio/assets/{erb-3fmfgt-Q.js → erb-DvYOup03.js} +1 -1
- package/dist/studio/assets/{git-rebase-75I-C7zW.js → git-rebase-BsAdTS5A.js} +1 -1
- package/dist/studio/assets/{glimmer-js-JjRzYRv8.js → glimmer-js-e0h98Z67.js} +1 -1
- package/dist/studio/assets/{glimmer-ts-DcC_g6bi.js → glimmer-ts-C9s5Kv8m.js} +1 -1
- package/dist/studio/assets/{glsl-CHo__hpu.js → glsl-CCiyeTRs.js} +1 -1
- package/dist/studio/assets/{graphql-J3cHpSdo.js → graphql-BRtHwsqk.js} +1 -1
- package/dist/studio/assets/{hack-or1FCnPg.js → hack-Dnt0QXHh.js} +1 -1
- package/dist/studio/assets/{haml-uv3vtlo6.js → haml-EXGmzuB1.js} +1 -1
- package/dist/studio/assets/{handlebars--xrOP0sp.js → handlebars-CzyBIDJE.js} +1 -1
- package/dist/studio/assets/{highlighted-body-OFNGDK62-D5UBAw6b.js → highlighted-body-OFNGDK62-CQUFKLNu.js} +1 -1
- package/dist/studio/assets/{html-CWnTqWKh.js → html-BAT8b_VM.js} +1 -1
- package/dist/studio/assets/{html-derivative-DWyLco-z.js → html-derivative-7tkS-r6F.js} +1 -1
- package/dist/studio/assets/{http-BGB8mLqf.js → http-Cgka02Qq.js} +1 -1
- package/dist/studio/assets/{hurl-BWdvIVUG.js → hurl-Cbkh8WEw.js} +1 -1
- package/dist/studio/assets/index-D6n8vpkp.js +390 -0
- package/dist/studio/assets/index-DkGWw6ES.css +2 -0
- package/dist/studio/assets/{java-BqyrPpKF.js → java-DrRKiUno.js} +1 -1
- package/dist/studio/assets/{javascript-D8Aej0xg.js → javascript-9LAnHOxD.js} +1 -1
- package/dist/studio/assets/{jinja-SIORrXov.js → jinja-CqRt4prs.js} +1 -1
- package/dist/studio/assets/{jison-B2T4v51n.js → jison-BX-IOQpJ.js} +1 -1
- package/dist/studio/assets/{json-BFdVRj9r.js → json-dOrE-En8.js} +1 -1
- package/dist/studio/assets/{jsx-w4r1xieS.js → jsx-BSTPfqWX.js} +1 -1
- package/dist/studio/assets/{julia-BFBtDmmM.js → julia-Dvz-BPmf.js} +1 -1
- package/dist/studio/assets/{just-CjAPsU_y.js → just-BHQm0Atq.js} +1 -1
- package/dist/studio/assets/{latex-CghDKqKz.js → latex-CxdhxuXv.js} +1 -1
- package/dist/studio/assets/{liquid-Cp9loVkE.js → liquid-D-hM-Q_F.js} +1 -1
- package/dist/studio/assets/{lua-HNnIDxnY.js → lua-5qtqjLHq.js} +1 -1
- package/dist/studio/assets/{marko-BXT10Apm.js → marko-5FJaM2co.js} +1 -1
- package/dist/studio/assets/{mdc-CaiOz4_A.js → mdc-BhYW7lCG.js} +1 -1
- package/dist/studio/assets/mermaid-GHXKKRXX-CWM2EB-u.js +1 -0
- package/dist/studio/assets/{nginx-DgYZ5SY9.js → nginx-rtAXrRye.js} +1 -1
- package/dist/studio/assets/{nim-CAMVX-MV.js → nim-DQSmaN9U.js} +1 -1
- package/dist/studio/assets/{perl-Dc6Wp7SD.js → perl-B54AdcaE.js} +1 -1
- package/dist/studio/assets/{php-DgLi8LNU.js → php-DpvTxCny.js} +1 -1
- package/dist/studio/assets/{pug-ZHFv4Vgd.js → pug-Cyffw0Ho.js} +1 -1
- package/dist/studio/assets/{qml-DU62cSZp.js → qml-CxRetSkO.js} +1 -1
- package/dist/studio/assets/{r-BwU69RSh.js → r-CXWRxrXc.js} +1 -1
- package/dist/studio/assets/{razor-BUgi_XZM.js → razor-BJzI-zc9.js} +1 -1
- package/dist/studio/assets/{regexp-DuNhqfkW.js → regexp-dqxdfrnE.js} +1 -1
- package/dist/studio/assets/{rst-BB3BeaSy.js → rst-BW7eKYj4.js} +1 -1
- package/dist/studio/assets/{ruby-T0tkEfUZ.js → ruby-D5Npyj8-.js} +1 -1
- package/dist/studio/assets/{sas-CMhZa3S0.js → sas-DZLppjul.js} +1 -1
- package/dist/studio/assets/{scss-DtXjZ3vZ.js → scss-CbqoxyAe.js} +1 -1
- package/dist/studio/assets/{shellscript-BESt-FLs.js → shellscript-CFHqBeXu.js} +1 -1
- package/dist/studio/assets/{shellsession-8irtvYxL.js → shellsession-CbZDA4Bf.js} +1 -1
- package/dist/studio/assets/{soy-CIvhOgLR.js → soy-PImjtV58.js} +1 -1
- package/dist/studio/assets/{sql-obAOXh1G.js → sql-DhGo8urW.js} +1 -1
- package/dist/studio/assets/{stata-D3OCK8xW.js → stata-CjHWbU2v.js} +1 -1
- package/dist/studio/assets/{surrealql-Dk_bguB0.js → surrealql-o8Qr4t56.js} +1 -1
- package/dist/studio/assets/{svelte-C0-KQt-t.js → svelte-DlSIyEV1.js} +1 -1
- package/dist/studio/assets/{templ-lg4nvF9H.js → templ-qizfwU1w.js} +1 -1
- package/dist/studio/assets/{tex-BNcQSX7R.js → tex-Ca7T661H.js} +1 -1
- package/dist/studio/assets/{ts-tags-AgW9jVv0.js → ts-tags-DUmjLkgl.js} +1 -1
- package/dist/studio/assets/{tsx-CL8XyR3d.js → tsx-CfwgIqHW.js} +1 -1
- package/dist/studio/assets/{twig-VkSbsH0Y.js → twig-D7NAYUBY.js} +1 -1
- package/dist/studio/assets/{typescript-BfD1znAG.js → typescript-Bbz9oX-P.js} +1 -1
- package/dist/studio/assets/{vue-html-w3sbjuft.js → vue-html-CcxTb_Jn.js} +1 -1
- package/dist/studio/assets/{vue-gv_2i8Vk.js → vue-vYpz06zQ.js} +1 -1
- package/dist/studio/assets/{vue-vine-C9sgcRlL.js → vue-vine-DW4RqCKF.js} +1 -1
- package/dist/studio/assets/{xml-nNPxMKnG.js → xml-R4LZ_u4f.js} +1 -1
- package/dist/studio/assets/{xsl-C7iHP36x.js → xsl-CS-xzp3L.js} +1 -1
- package/dist/studio/assets/{yaml-Cq3YaG6o.js → yaml-CqDWbYXd.js} +1 -1
- package/dist/studio/index.html +2 -2
- package/dist/think.d.ts +3 -2
- package/dist/think.js +8406 -2
- package/dist/think.js.map +1 -0
- package/dist/tools/extensions.js +1 -1
- package/dist/tools/fetch.d.ts +22 -0
- package/dist/tools/fetch.js +646 -0
- package/dist/tools/fetch.js.map +1 -0
- package/dist/tools/workspace.js +2 -2
- package/dist/tools/workspace.js.map +1 -1
- package/dist/{types-codegen-B6c5KpYH.js → types-codegen-C-9yeFao.js} +9 -33
- package/dist/types-codegen-C-9yeFao.js.map +1 -0
- package/dist/vite.d.ts +5 -5
- package/dist/vite.js +1 -1
- package/dist/workflows.d.ts +1 -1
- package/docs/actions.md +297 -0
- package/docs/channels.md +185 -0
- package/docs/client-tools.md +233 -0
- package/docs/getting-started.md +314 -0
- package/docs/index.md +1324 -0
- package/docs/lifecycle-hooks.md +850 -0
- package/docs/messengers.md +197 -0
- package/docs/programmatic-submissions.md +206 -0
- package/docs/sub-agents.md +524 -0
- package/docs/tools.md +582 -0
- package/docs/workflows.md +217 -0
- package/package.json +50 -17
- package/dist/chat-sdk-Bb93yaZh.js.map +0 -1
- package/dist/codegen-CuPdJRpV.js.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/studio/assets/index-Cbb3GlZY.js +0 -496
- package/dist/studio/assets/index-DN9_cL01.css +0 -2
- package/dist/studio/assets/mermaid-GHXKKRXX-I2ZcYo7k.js +0 -1
- package/dist/think-BYZXQ-vm.js +0 -6513
- package/dist/think-BYZXQ-vm.js.map +0 -1
- package/dist/types-codegen-B6c5KpYH.js.map +0 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as readWranglerConfig, c as createThinkWorkerConfig, h as discoverThinkApp, i as readProjectFiles, m as summarizeThinkManifest, n as createThinkProject, o as resolveThinkManifest, t as applyUserBindingNames } from "../project-BHurFdu4.js";
|
|
3
|
-
import { n as isThinkGeneratedFile, t as generateThinkTypes } from "../types-codegen-
|
|
3
|
+
import { n as isThinkGeneratedFile, t as generateThinkTypes } from "../types-codegen-C-9yeFao.js";
|
|
4
4
|
import { CHAT_MESSAGE_TYPES } from "agents/chat";
|
|
5
5
|
import { access, mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import yargs from "yargs";
|
|
8
8
|
import { hideBin } from "yargs/helpers";
|
|
9
|
-
import {
|
|
10
|
-
import { initCommand, looksLikeThinkApp } from "create-think";
|
|
9
|
+
import { fileExists, gitOutcomeMessage, initCommand, initializeGit, looksLikeThinkApp, packageName, readTextIfExists, runNpmInstall } from "create-think";
|
|
11
10
|
import { AgentClient } from "agents/client";
|
|
11
|
+
import { spawn } from "node:child_process";
|
|
12
12
|
import { createReadStream } from "node:fs";
|
|
13
13
|
import { createServer } from "node:http";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
@@ -61,8 +61,12 @@ async function augmentExistingProject(root, options) {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
await writePlannedFiles(plan, skipped);
|
|
64
|
+
const gitOutcome = await initializeGit(root, {
|
|
65
|
+
gitRunner: options.gitRunner,
|
|
66
|
+
isInsideGitRepo: options.isInsideGitRepo
|
|
67
|
+
});
|
|
64
68
|
if (options.install ?? true) await (options.installRunner ?? runNpmInstall)(root);
|
|
65
|
-
printSuccess(plan, skipped, options.install ?? true);
|
|
69
|
+
printSuccess(plan, skipped, options.install ?? true, gitOutcome);
|
|
66
70
|
}
|
|
67
71
|
async function createInitPlan(options) {
|
|
68
72
|
const sourceFiles = {
|
|
@@ -106,6 +110,18 @@ async function createInitPlan(options) {
|
|
|
106
110
|
path: "tsconfig.json",
|
|
107
111
|
content: tsconfig()
|
|
108
112
|
},
|
|
113
|
+
{
|
|
114
|
+
path: ".gitignore",
|
|
115
|
+
content: gitignore()
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
path: ".oxlintrc.json",
|
|
119
|
+
content: oxlintConfig()
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
path: ".oxfmtrc.json",
|
|
123
|
+
content: oxfmtConfig()
|
|
124
|
+
},
|
|
109
125
|
{
|
|
110
126
|
path: "agents/assistant/agent.ts",
|
|
111
127
|
content: sourceFiles["agents/assistant/agent.ts"]
|
|
@@ -137,7 +153,7 @@ async function writePlannedFiles(plan, skip) {
|
|
|
137
153
|
}
|
|
138
154
|
async function mergePackageJson(absolutePath, generatedContent) {
|
|
139
155
|
const generated = JSON.parse(generatedContent);
|
|
140
|
-
const existingSource = await readTextIfExists
|
|
156
|
+
const existingSource = await readTextIfExists(absolutePath);
|
|
141
157
|
if (!existingSource) return generatedContent;
|
|
142
158
|
const existing = JSON.parse(existingSource);
|
|
143
159
|
return `${JSON.stringify(mergePackageJsonData(existing, generated), null, 2)}\n`;
|
|
@@ -173,46 +189,35 @@ async function unsafeMigrationReason(root) {
|
|
|
173
189
|
function printDryRun(plan, skipped, install) {
|
|
174
190
|
const lines = ["Think init would add to the current project:", ...plan.files.filter((file) => !skipped.has(file.path)).map((file) => `- ${file.path}`)];
|
|
175
191
|
if (skipped.size > 0) lines.push("", "Would keep your existing files (left unchanged):", ...[...skipped].map((file) => `- ${file}`));
|
|
176
|
-
lines.push(install ? "Would run: npm install" : "Would skip dependency install.");
|
|
192
|
+
lines.push("Would initialize a git repository (skipped if already inside one).", install ? "Would run: npm install" : "Would skip dependency install.");
|
|
177
193
|
console.log(lines.join("\n"));
|
|
178
194
|
}
|
|
179
|
-
function printSuccess(plan, skipped, install) {
|
|
180
|
-
const lines = [
|
|
195
|
+
function printSuccess(plan, skipped, install, gitOutcome) {
|
|
196
|
+
const lines = [
|
|
197
|
+
`Added Think to ${plan.root}.`,
|
|
198
|
+
gitOutcomeMessage(gitOutcome),
|
|
199
|
+
install ? "Installed npm dependencies." : "Skipped npm install."
|
|
200
|
+
];
|
|
181
201
|
if (skipped.size > 0) lines.push("", "Kept your existing files (not overwritten):", ...[...skipped].map((file) => `- ${file}`), "Reconcile them with Think's expected setup if the app does not build.");
|
|
182
202
|
lines.push("", "Next steps:", "- Edit agents/assistant/agent.ts to customize the model, prompt, skills, and schedules", "- npm run dev", "- npm run types", "- npm run deploy");
|
|
183
203
|
console.log(lines.join("\n"));
|
|
184
204
|
}
|
|
185
|
-
async function runNpmInstall(root) {
|
|
186
|
-
await new Promise((resolve, reject) => {
|
|
187
|
-
const child = spawn("npm", ["install"], {
|
|
188
|
-
cwd: root,
|
|
189
|
-
stdio: "inherit",
|
|
190
|
-
shell: process.platform === "win32"
|
|
191
|
-
});
|
|
192
|
-
child.on("error", reject);
|
|
193
|
-
child.on("exit", (code) => {
|
|
194
|
-
if (code === 0) {
|
|
195
|
-
resolve();
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
reject(/* @__PURE__ */ new Error(`npm install failed with exit code ${code ?? "unknown"}.`));
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
205
|
const FRAMEWORK_DEPENDENCIES = {
|
|
203
206
|
"@cloudflare/think": "latest",
|
|
204
207
|
agents: "latest"
|
|
205
208
|
};
|
|
206
209
|
const THIRD_PARTY_DEPENDENCIES = {
|
|
207
210
|
ai: "^6.0.202",
|
|
208
|
-
"workers-ai-provider": "^3.2.
|
|
211
|
+
"workers-ai-provider": "^3.2.1"
|
|
209
212
|
};
|
|
210
213
|
const THIRD_PARTY_DEV_DEPENDENCIES = {
|
|
211
|
-
"@cloudflare/vite-plugin": "^1.
|
|
212
|
-
"@cloudflare/workers-types": "^4.
|
|
214
|
+
"@cloudflare/vite-plugin": "^1.42.3",
|
|
215
|
+
"@cloudflare/workers-types": "^4.20260625.1",
|
|
216
|
+
oxfmt: "^0.56.0",
|
|
217
|
+
oxlint: "^1.71.0",
|
|
213
218
|
typescript: "^6.0.3",
|
|
214
|
-
vite: "^8.0
|
|
215
|
-
wrangler: "^4.
|
|
219
|
+
vite: "^8.1.0",
|
|
220
|
+
wrangler: "^4.105.0"
|
|
216
221
|
};
|
|
217
222
|
function packageJsonSource(projectName) {
|
|
218
223
|
return `${JSON.stringify({
|
|
@@ -223,7 +228,12 @@ function packageJsonSource(projectName) {
|
|
|
223
228
|
dev: "vite dev",
|
|
224
229
|
build: "vite build",
|
|
225
230
|
deploy: "vite build && wrangler deploy",
|
|
226
|
-
types: "think types --all"
|
|
231
|
+
types: "think types --all",
|
|
232
|
+
format: "oxfmt --write .",
|
|
233
|
+
"format:check": "oxfmt --check .",
|
|
234
|
+
lint: "oxlint .",
|
|
235
|
+
typecheck: "tsc --noEmit",
|
|
236
|
+
check: "npm run format:check && npm run lint && npm run typecheck"
|
|
227
237
|
},
|
|
228
238
|
dependencies: {
|
|
229
239
|
...FRAMEWORK_DEPENDENCIES,
|
|
@@ -318,28 +328,187 @@ function tsconfig() {
|
|
|
318
328
|
]
|
|
319
329
|
}, null, 2)}\n`;
|
|
320
330
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
function gitignore() {
|
|
332
|
+
return `# Logs
|
|
333
|
+
logs
|
|
334
|
+
*.log
|
|
335
|
+
npm-debug.log*
|
|
336
|
+
yarn-debug.log*
|
|
337
|
+
yarn-error.log*
|
|
338
|
+
lerna-debug.log*
|
|
339
|
+
|
|
340
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
341
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
342
|
+
|
|
343
|
+
# Runtime data
|
|
344
|
+
pids
|
|
345
|
+
*.pid
|
|
346
|
+
*.seed
|
|
347
|
+
*.pid.lock
|
|
348
|
+
|
|
349
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
350
|
+
lib-cov
|
|
351
|
+
|
|
352
|
+
# Coverage directory used by tools like istanbul
|
|
353
|
+
coverage
|
|
354
|
+
*.lcov
|
|
355
|
+
|
|
356
|
+
# nyc test coverage
|
|
357
|
+
.nyc_output
|
|
358
|
+
|
|
359
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
360
|
+
.grunt
|
|
361
|
+
|
|
362
|
+
# Bower dependency directory (https://bower.io/)
|
|
363
|
+
bower_components
|
|
364
|
+
|
|
365
|
+
# node-waf configuration
|
|
366
|
+
.lock-wscript
|
|
367
|
+
|
|
368
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
369
|
+
build/Release
|
|
370
|
+
|
|
371
|
+
# Dependency directories
|
|
372
|
+
node_modules/
|
|
373
|
+
jspm_packages/
|
|
374
|
+
|
|
375
|
+
# Snowpack dependency directory (https://snowpack.dev/)
|
|
376
|
+
web_modules/
|
|
377
|
+
|
|
378
|
+
# TypeScript cache
|
|
379
|
+
*.tsbuildinfo
|
|
380
|
+
|
|
381
|
+
# Optional npm cache directory
|
|
382
|
+
.npm
|
|
383
|
+
|
|
384
|
+
# Optional eslint cache
|
|
385
|
+
.eslintcache
|
|
386
|
+
|
|
387
|
+
# Optional stylelint cache
|
|
388
|
+
.stylelintcache
|
|
389
|
+
|
|
390
|
+
# Optional REPL history
|
|
391
|
+
.node_repl_history
|
|
392
|
+
|
|
393
|
+
# Output of 'npm pack'
|
|
394
|
+
*.tgz
|
|
395
|
+
|
|
396
|
+
# Yarn Integrity file
|
|
397
|
+
.yarn-integrity
|
|
398
|
+
|
|
399
|
+
# dotenv environment variable files
|
|
400
|
+
.env
|
|
401
|
+
.env.*
|
|
402
|
+
!.env.example
|
|
403
|
+
|
|
404
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
405
|
+
.cache
|
|
406
|
+
.parcel-cache
|
|
407
|
+
|
|
408
|
+
# Next.js build output
|
|
409
|
+
.next
|
|
410
|
+
out
|
|
411
|
+
|
|
412
|
+
# Nuxt.js build / generate output
|
|
413
|
+
.nuxt
|
|
414
|
+
dist
|
|
415
|
+
.output
|
|
416
|
+
|
|
417
|
+
# Gatsby files
|
|
418
|
+
.cache/
|
|
419
|
+
# Comment in the public line in if your project uses Gatsby and not Next.js
|
|
420
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
421
|
+
# public
|
|
422
|
+
|
|
423
|
+
# vuepress build output
|
|
424
|
+
.vuepress/dist
|
|
425
|
+
|
|
426
|
+
# vuepress v2.x temp directory
|
|
427
|
+
.temp
|
|
428
|
+
|
|
429
|
+
# Sveltekit cache directory
|
|
430
|
+
.svelte-kit/
|
|
431
|
+
|
|
432
|
+
# vitepress build output
|
|
433
|
+
**/.vitepress/dist
|
|
434
|
+
|
|
435
|
+
# vitepress cache directory
|
|
436
|
+
**/.vitepress/cache
|
|
437
|
+
|
|
438
|
+
# Docusaurus cache and generated files
|
|
439
|
+
.docusaurus
|
|
440
|
+
|
|
441
|
+
# Serverless directories
|
|
442
|
+
.serverless/
|
|
443
|
+
|
|
444
|
+
# FuseBox cache
|
|
445
|
+
.fusebox/
|
|
446
|
+
|
|
447
|
+
# DynamoDB Local files
|
|
448
|
+
.dynamodb/
|
|
449
|
+
|
|
450
|
+
# Firebase cache directory
|
|
451
|
+
.firebase/
|
|
452
|
+
|
|
453
|
+
# TernJS port file
|
|
454
|
+
.tern-port
|
|
455
|
+
|
|
456
|
+
# Stores VSCode versions used for testing VSCode extensions
|
|
457
|
+
.vscode-test
|
|
458
|
+
|
|
459
|
+
# pnpm
|
|
460
|
+
.pnpm-store
|
|
461
|
+
|
|
462
|
+
# yarn v3
|
|
463
|
+
.pnp.*
|
|
464
|
+
.yarn/*
|
|
465
|
+
!.yarn/patches
|
|
466
|
+
!.yarn/plugins
|
|
467
|
+
!.yarn/releases
|
|
468
|
+
!.yarn/sdks
|
|
469
|
+
!.yarn/versions
|
|
470
|
+
|
|
471
|
+
# Vite files
|
|
472
|
+
vite.config.js.timestamp-*
|
|
473
|
+
vite.config.ts.timestamp-*
|
|
474
|
+
.vite/
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
.wrangler
|
|
478
|
+
.dev.vars
|
|
479
|
+
.DS_Store
|
|
480
|
+
`;
|
|
331
481
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
482
|
+
function oxlintConfig() {
|
|
483
|
+
return `${JSON.stringify({
|
|
484
|
+
$schema: "./node_modules/oxlint/configuration_schema.json",
|
|
485
|
+
plugins: [
|
|
486
|
+
"react",
|
|
487
|
+
"jsx-a11y",
|
|
488
|
+
"typescript"
|
|
489
|
+
],
|
|
490
|
+
categories: { correctness: "error" },
|
|
491
|
+
rules: {
|
|
492
|
+
"no-explicit-any": "error",
|
|
493
|
+
"typescript/no-deprecated": "warn",
|
|
494
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
495
|
+
"no-unused-vars": ["error", {
|
|
496
|
+
argsIgnorePattern: "^_",
|
|
497
|
+
varsIgnorePattern: "^_",
|
|
498
|
+
caughtErrorsIgnorePattern: "^_"
|
|
499
|
+
}]
|
|
500
|
+
},
|
|
501
|
+
ignorePatterns: ["**/env.d.ts", "**/think.d.ts"]
|
|
502
|
+
}, null, 2)}\n`;
|
|
340
503
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
504
|
+
function oxfmtConfig() {
|
|
505
|
+
return `${JSON.stringify({
|
|
506
|
+
$schema: "./node_modules/oxfmt/configuration_schema.json",
|
|
507
|
+
trailingComma: "none",
|
|
508
|
+
printWidth: 80,
|
|
509
|
+
experimentalSortPackageJson: false,
|
|
510
|
+
ignorePatterns: ["**/think.d.ts"]
|
|
511
|
+
}, null, 2)}\n`;
|
|
343
512
|
}
|
|
344
513
|
//#endregion
|
|
345
514
|
//#region src/cli/inspect.ts
|
|
@@ -880,7 +1049,7 @@ async function findStaleFiles(root, files) {
|
|
|
880
1049
|
const stale = [];
|
|
881
1050
|
for (const file of files) {
|
|
882
1051
|
const expected = await expectedFileContent(root, file);
|
|
883
|
-
if (await readTextIfExists(path.join(root, file.path)) !== expected) stale.push(file.path);
|
|
1052
|
+
if (await readTextIfExists$1(path.join(root, file.path)) !== expected) stale.push(file.path);
|
|
884
1053
|
}
|
|
885
1054
|
return stale;
|
|
886
1055
|
}
|
|
@@ -891,11 +1060,11 @@ async function writeGeneratedFile(root, file) {
|
|
|
891
1060
|
await writeFile(absolute, expected, "utf8");
|
|
892
1061
|
}
|
|
893
1062
|
async function expectedFileContent(root, file) {
|
|
894
|
-
const current = await readTextIfExists(path.join(root, file.path));
|
|
1063
|
+
const current = await readTextIfExists$1(path.join(root, file.path));
|
|
895
1064
|
if (current && !isThinkGeneratedFile(current)) throw new Error(`${file.path} already exists and is not Think-generated; pass a different output path or replace it with a Think-generated file.`);
|
|
896
1065
|
return file.content;
|
|
897
1066
|
}
|
|
898
|
-
async function readTextIfExists(file) {
|
|
1067
|
+
async function readTextIfExists$1(file) {
|
|
899
1068
|
try {
|
|
900
1069
|
return await readFile(file, "utf8");
|
|
901
1070
|
} catch (error) {
|
|
@@ -996,7 +1165,7 @@ function createCli(argv = process.argv) {
|
|
|
996
1165
|
describe: "Package and Worker name for the generated app"
|
|
997
1166
|
}).option("template", {
|
|
998
1167
|
type: "string",
|
|
999
|
-
describe: "Starter template to scaffold (
|
|
1168
|
+
describe: "Starter template to scaffold (omit to choose)"
|
|
1000
1169
|
}).option("ref", {
|
|
1001
1170
|
type: "string",
|
|
1002
1171
|
describe: "Git ref to fetch remote templates from"
|