create-thally-docs 0.7.2 → 0.7.4

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 CHANGED
@@ -9,10 +9,12 @@ AI agents as structured JSON, JSON-LD, and Markdown from the same URL.
9
9
  ```bash
10
10
  npx create-thally-docs my-docs
11
11
  cd my-docs
12
+ npm install
12
13
  npm run dev
13
14
  ```
14
15
 
15
- Then open [http://localhost:3040](http://localhost:3040). A freshly scaffolded
16
+ The dev server starts at [http://localhost:3040](http://localhost:3040) and
17
+ automatically uses the next available port when needed. A freshly scaffolded
16
18
  site is agent-ready out of the box and scores 100/A on the built-in
17
19
  [Agent Readiness Score](https://github.com/thallylabs/thally).
18
20
 
@@ -22,6 +24,10 @@ Run non-interactively with smart defaults:
22
24
  npx create-thally-docs my-docs --yes
23
25
  ```
24
26
 
27
+ Dependency installation is deliberately opt-in so the scaffold finishes in
28
+ seconds. Pass `--install` to run it immediately, or `--no-install` to skip the
29
+ interactive question explicitly.
30
+
25
31
  ## What you get
26
32
 
27
33
  - **MDX content** in `src/content/`, navigation in `docs.json`
@@ -3,7 +3,7 @@ import {
3
3
  initGit,
4
4
  installDeps,
5
5
  scaffold
6
- } from "./chunk-KN6QUPKR.js";
6
+ } from "./chunk-D6W2N7ZW.js";
7
7
 
8
8
  // src/migrate/index.ts
9
9
  import { mkdirSync as mkdirSync2, copyFileSync as copyFileSync2, readFileSync as readFileSync3, writeFileSync, existsSync as existsSync3, mkdtempSync, rmSync } from "fs";
@@ -494,7 +494,8 @@ npm install
494
494
  npm run dev
495
495
  \`\`\`
496
496
 
497
- Open [http://localhost:3040](http://localhost:3040).
497
+ The server starts at [http://localhost:3040](http://localhost:3040), or the next
498
+ available port when 3040 is already in use.
498
499
 
499
500
  ## Write your docs
500
501
 
@@ -519,6 +520,42 @@ anywhere Next.js is supported, or connect the repository to
519
520
  `;
520
521
  writeFileSync2(join2(targetDir, "README.md"), readme, "utf8");
521
522
  }
523
+ function writeCloudflareRuntimeConfig(targetDir, slug) {
524
+ writeFileSync2(
525
+ join2(targetDir, "open-next.config.ts"),
526
+ `/** OpenNext adapter configuration for the Cloudflare Workers runtime. */
527
+ import { defineCloudflareConfig } from '@opennextjs/cloudflare/config'
528
+
529
+ export default defineCloudflareConfig()
530
+ `,
531
+ "utf8"
532
+ );
533
+ writeFileSync2(
534
+ join2(targetDir, "wrangler.jsonc"),
535
+ `${JSON.stringify(
536
+ {
537
+ $schema: "node_modules/wrangler/config-schema.json",
538
+ name: slug,
539
+ main: ".open-next/worker.js",
540
+ compatibility_date: "2026-07-15",
541
+ compatibility_flags: ["nodejs_compat", "global_fetch_strictly_public"],
542
+ observability: {
543
+ enabled: true,
544
+ logs: { head_sampling_rate: 1 },
545
+ traces: { enabled: true, head_sampling_rate: 0.01 }
546
+ },
547
+ assets: {
548
+ directory: ".open-next/assets",
549
+ binding: "ASSETS"
550
+ }
551
+ },
552
+ null,
553
+ 2
554
+ )}
555
+ `,
556
+ "utf8"
557
+ );
558
+ }
522
559
  function updateSiteConfig(targetDir, projectName, description, brandPreset, repoUrl) {
523
560
  const siteFile = join2(targetDir, "src", "data", "site.ts");
524
561
  if (!existsSync(siteFile)) {
@@ -628,15 +665,34 @@ function patchPackageJson(targetDir, slug) {
628
665
  if (!existsSync(pkgPath)) return;
629
666
  const pkg = JSON.parse(readFileSync2(pkgPath, "utf8"));
630
667
  const hadWorkspaces = Array.isArray(pkg.workspaces) && pkg.workspaces.length > 0;
668
+ const hasRuntimeSourceCompiler = existsSync(
669
+ join2(targetDir, "scripts", "build-runtime-sources.mts")
670
+ );
631
671
  pkg.name = slug;
632
672
  delete pkg.workspaces;
633
673
  if (pkg.scripts) {
634
- if (pkg.scripts["prebuild"]) pkg.scripts["prebuild"] = "npm run embeddings:build";
674
+ if (hasRuntimeSourceCompiler) {
675
+ pkg.scripts["runtime-sources:build"] ??= "tsx scripts/build-runtime-sources.mts";
676
+ pkg.scripts["predev"] = "npm run runtime-sources:build";
677
+ pkg.scripts["postinstall"] = "npm run runtime-sources:build";
678
+ pkg.scripts["prebuild"] = "npm run runtime-sources:build && npm run embeddings:build";
679
+ } else {
680
+ pkg.scripts["prebuild"] = "npm run embeddings:build";
681
+ }
635
682
  delete pkg.scripts["pretest"];
636
683
  delete pkg.scripts["packages:build"];
684
+ pkg.scripts["build:cloudflare"] = "opennextjs-cloudflare build";
685
+ pkg.scripts["preview:cloudflare"] = "npm run build:cloudflare && opennextjs-cloudflare preview";
686
+ pkg.scripts["deploy:cloudflare"] = "npm run build:cloudflare && opennextjs-cloudflare deploy";
687
+ pkg.scripts["upload:cloudflare"] = "npm run build:cloudflare && opennextjs-cloudflare upload";
637
688
  }
689
+ pkg.devDependencies ??= {};
690
+ pkg.devDependencies["@thallylabs/cli"] = "0.5.1";
691
+ pkg.devDependencies["@opennextjs/cloudflare"] ??= "1.15.0";
692
+ pkg.devDependencies.vite ??= "7.2.6";
693
+ pkg.devDependencies.wrangler ??= "4.111.0";
638
694
  if (pkg.dependencies?.["@thallylabs/mcp"] === "*") {
639
- pkg.dependencies["@thallylabs/mcp"] = "0.7.0";
695
+ pkg.dependencies["@thallylabs/mcp"] = "0.7.1";
640
696
  }
641
697
  writeFileSync2(pkgPath, `${JSON.stringify(pkg, null, 2)}
642
698
  `, "utf8");
@@ -687,7 +743,7 @@ function installDeps(targetDir) {
687
743
  console.log("");
688
744
  console.log(" \u{1F4E6} Installing dependencies...");
689
745
  console.log("");
690
- run("npm install", targetDir);
746
+ run("npm install --prefer-offline --no-audit --no-fund --progress=false", targetDir);
691
747
  }
692
748
  function logo() {
693
749
  console.log("");
@@ -700,12 +756,12 @@ function logo() {
700
756
  console.log(" \u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551 \u2551");
701
757
  console.log(" \u2551 \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u2551");
702
758
  console.log(" \u2551 \u2551");
703
- console.log(" \u2551 Beautiful docs, zero lock-in. \u2551");
759
+ console.log(" \u2551Give your product and docs first-class agent visibility.\u2551");
704
760
  console.log(" \u2551 \u2551");
705
761
  console.log(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
706
762
  console.log("");
707
763
  }
708
- function success(projectDir, projectName) {
764
+ function success(projectDir, projectName, dependenciesInstalled) {
709
765
  console.log("");
710
766
  console.log(" \u2705 Your Thally project is ready!");
711
767
  console.log("");
@@ -714,9 +770,12 @@ function success(projectDir, projectName) {
714
770
  console.log(" Next steps:");
715
771
  console.log("");
716
772
  console.log(` cd ${basename(projectDir)}`);
773
+ if (!dependenciesInstalled) {
774
+ console.log(" npm install");
775
+ }
717
776
  console.log(" npm run dev");
718
777
  console.log("");
719
- console.log(` Then open http://localhost:3040 to see your ${projectName} docs.`);
778
+ console.log(` Your terminal will print the local URL for your ${projectName} docs.`);
720
779
  console.log("");
721
780
  console.log(" \u{1F4DD} Key files to edit:");
722
781
  console.log(" \u2022 src/data/site.ts \u2014 name, links, branding");
@@ -764,6 +823,7 @@ async function scaffold(options) {
764
823
  patchTopBarNavigation(targetDir);
765
824
  patchOpenApiFetch(targetDir);
766
825
  patchPackageJson(targetDir, slug);
826
+ writeCloudflareRuntimeConfig(targetDir, slug);
767
827
  patchGitignore(targetDir);
768
828
  updateEnvExample(targetDir);
769
829
  if (doInstall) {
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  migrateDocs,
4
4
  parseGitHubUrl
5
- } from "./chunk-QGRDDS5V.js";
5
+ } from "./chunk-AIG772AY.js";
6
6
  import {
7
7
  logo,
8
8
  readDocsJson,
@@ -10,7 +10,7 @@ import {
10
10
  slugify,
11
11
  success,
12
12
  writeDocsJson
13
- } from "./chunk-KN6QUPKR.js";
13
+ } from "./chunk-D6W2N7ZW.js";
14
14
 
15
15
  // src/index.ts
16
16
  import { existsSync as existsSync3, readdirSync as readdirSync2 } from "fs";
@@ -20,7 +20,7 @@ import { resolve as resolve2 } from "path";
20
20
  import { input, select } from "@inquirer/prompts";
21
21
  import { basename } from "path";
22
22
  import { resolve } from "path";
23
- async function gatherAnswers(dirArg, useDefaults) {
23
+ async function gatherAnswers(dirArg, useDefaults, installPreference) {
24
24
  let projectDir;
25
25
  if (dirArg) {
26
26
  projectDir = resolve(dirArg);
@@ -71,13 +71,13 @@ async function gatherAnswers(dirArg, useDefaults) {
71
71
  else console.log(" \u26A0 No valid owner/repo entries \u2014 skipping Track (add it later with `thally track add`).");
72
72
  }
73
73
  }
74
- let doInstall = true;
75
- if (!useDefaults) {
74
+ let doInstall = installPreference ?? false;
75
+ if (!useDefaults && installPreference === void 0) {
76
76
  const shouldInstall = await input({
77
- message: " Install dependencies? (Y/n):",
78
- default: "Y"
77
+ message: " Install dependencies now? (y/N):",
78
+ default: "N"
79
79
  });
80
- doInstall = shouldInstall.toLowerCase() !== "n";
80
+ doInstall = shouldInstall.trim().toLowerCase().startsWith("y");
81
81
  }
82
82
  let i18nLocales;
83
83
  if (!useDefaults) {
@@ -682,10 +682,19 @@ async function runTranslateCommand(locale, pages, force, apiKey, model, yes, pro
682
682
  // src/index.ts
683
683
  var args = process.argv.slice(2);
684
684
  var flags = args.filter((a) => a.startsWith("-"));
685
+ var valueFlags = /* @__PURE__ */ new Set([
686
+ "--api-key",
687
+ "--branch",
688
+ "--docs-dir",
689
+ "--into",
690
+ "--locale",
691
+ "--model",
692
+ "--pages"
693
+ ]);
685
694
  var positional = [];
686
695
  for (let i = 0; i < args.length; i++) {
687
696
  if (args[i].startsWith("-")) {
688
- if (i + 1 < args.length && !args[i + 1].startsWith("-")) {
697
+ if (valueFlags.has(args[i]) && i + 1 < args.length && !args[i + 1].startsWith("-")) {
689
698
  i++;
690
699
  }
691
700
  } else {
@@ -754,6 +763,7 @@ async function runMigrateCommand() {
754
763
  }
755
764
  async function runScaffoldCommand() {
756
765
  const useDefaults = flags.includes("--yes") || flags.includes("-y");
766
+ const installPreference = flags.includes("--install") ? true : flags.includes("--no-install") ? false : void 0;
757
767
  const dirArg = positional[0];
758
768
  if (dirArg) {
759
769
  const resolved = resolve2(dirArg);
@@ -763,7 +773,7 @@ async function runScaffoldCommand() {
763
773
  process.exit(1);
764
774
  }
765
775
  }
766
- const answers = await gatherAnswers(dirArg, useDefaults);
776
+ const answers = await gatherAnswers(dirArg, useDefaults, installPreference);
767
777
  const result = await scaffold({
768
778
  projectDir: answers.projectDir,
769
779
  projectName: answers.projectName,
@@ -774,7 +784,7 @@ async function runScaffoldCommand() {
774
784
  i18nLocales: answers.i18nLocales,
775
785
  trackRepos: answers.trackRepos
776
786
  });
777
- success(result.projectDir, answers.projectName);
787
+ success(result.projectDir, answers.projectName, answers.doInstall);
778
788
  }
779
789
  async function runCheckCommand() {
780
790
  const projectDir = resolve2(positional[1] ?? ".");
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  migrateDocs
4
- } from "../chunk-QGRDDS5V.js";
5
- import "../chunk-KN6QUPKR.js";
4
+ } from "../chunk-AIG772AY.js";
5
+ import "../chunk-D6W2N7ZW.js";
6
6
  export {
7
7
  migrateDocs
8
8
  };
package/dist/scaffold.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  scaffold
4
- } from "./chunk-KN6QUPKR.js";
4
+ } from "./chunk-D6W2N7ZW.js";
5
5
  export {
6
6
  scaffold
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-thally-docs",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Scaffold a new Thally documentation project",
5
5
  "type": "module",
6
6
  "engines": {