create-thally-docs 0.10.78 → 0.10.80

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.
@@ -1,162 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- personalizeStarter,
4
- updateEnvExample
5
- } from "./chunk-4VKRBJV2.js";
6
- import {
7
- downloadStarter
8
- } from "./chunk-W5WQ2V7P.js";
9
-
10
- // src/scaffold.ts
11
- import { existsSync, mkdirSync, readdirSync } from "fs";
12
- import { resolve } from "path";
13
-
14
- // src/docs-json.ts
15
- import { readFileSync, writeFileSync } from "fs";
16
- import { join } from "path";
17
- function readDocsJson(projectDir) {
18
- const docsPath = join(projectDir, "docs.json");
19
- const raw = readFileSync(docsPath, "utf8");
20
- return JSON.parse(raw);
21
- }
22
- function writeDocsJson(projectDir, config) {
23
- const docsPath = join(projectDir, "docs.json");
24
- writeFileSync(docsPath, JSON.stringify(config, null, 2) + "\n", "utf8");
25
- }
26
- function resetTrackingConfig(projectDir) {
27
- const config = readDocsJson(projectDir);
28
- if (config.tracking) {
29
- delete config.tracking;
30
- writeDocsJson(projectDir, config);
31
- }
32
- }
33
- function writeTrackingConfig(projectDir, repos) {
34
- if (repos.length === 0) return;
35
- const config = readDocsJson(projectDir);
36
- config.tracking = { repos: repos.map((r) => ({ owner: r.owner, repo: r.repo, branch: "main" })) };
37
- writeDocsJson(projectDir, config);
38
- }
39
-
40
- // src/utils.ts
41
- import { execSync } from "child_process";
42
- import { basename } from "path";
43
- function slugify(name) {
44
- return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
45
- }
46
- function run(cmd, cwd) {
47
- execSync(cmd, { cwd, stdio: "inherit" });
48
- }
49
- function initGit(targetDir) {
50
- try {
51
- run("git init", targetDir);
52
- run("git add -A", targetDir);
53
- run('git commit -m "Initial commit from create-thally-docs"', targetDir);
54
- } catch {
55
- console.log(" \u26A0\uFE0F Could not initialize git (you can do this manually).");
56
- }
57
- }
58
- function installDeps(targetDir) {
59
- console.log("");
60
- console.log(" \u{1F4E6} Installing dependencies...");
61
- console.log("");
62
- run("npm install --prefer-offline --no-audit --no-fund --progress=false", targetDir);
63
- }
64
- function logo() {
65
- console.log("");
66
- console.log(" \u2554\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\u2557");
67
- console.log(" \u2551 \u2551");
68
- console.log(" \u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2557 \u2551");
69
- console.log(" \u2551 \u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D \u2551");
70
- console.log(" \u2551 \u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2551");
71
- console.log(" \u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D \u2551");
72
- 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");
73
- 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");
74
- console.log(" \u2551 \u2551");
75
- console.log(" \u2551Give your product and docs first-class agent visibility.\u2551");
76
- console.log(" \u2551 \u2551");
77
- 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");
78
- console.log("");
79
- }
80
- function success(projectDir, projectName, dependenciesInstalled) {
81
- console.log("");
82
- console.log(" \u2705 Your Thally project is ready!");
83
- console.log("");
84
- console.log(` \u{1F4C2} ${projectDir}`);
85
- console.log("");
86
- console.log(" Next steps:");
87
- console.log("");
88
- console.log(` cd ${basename(projectDir)}`);
89
- if (!dependenciesInstalled) {
90
- console.log(" npm install");
91
- }
92
- console.log(" npm run dev");
93
- console.log("");
94
- console.log(` Your terminal will print the local URL for your ${projectName} docs.`);
95
- console.log("");
96
- console.log(" \u{1F4DD} Key files to edit:");
97
- console.log(" \u2022 src/data/site.ts \u2014 name, links, branding");
98
- console.log(" \u2022 docs.json \u2014 navigation structure");
99
- console.log(" \u2022 src/content/*.mdx \u2014 your documentation");
100
- console.log(" \u2022 openapi.yaml \u2014 API spec (optional)");
101
- console.log("");
102
- console.log(" Happy documenting! \u{1F680}");
103
- console.log("");
104
- }
105
-
106
- // src/scaffold.ts
107
- async function scaffold(options) {
108
- const {
109
- projectDir,
110
- projectName,
111
- description,
112
- brandPreset,
113
- repoUrl,
114
- doInstall,
115
- enableAiChat = true,
116
- i18nLocales,
117
- trackRepos,
118
- colors
119
- } = options;
120
- const targetDir = resolve(projectDir);
121
- if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
122
- throw new Error(`Directory "${targetDir}" already exists and is not empty.`);
123
- }
124
- mkdirSync(targetDir, { recursive: true });
125
- const slug = slugify(projectName);
126
- await downloadStarter(targetDir, projectName);
127
- personalizeStarter(targetDir, {
128
- projectName,
129
- packageName: slug,
130
- description,
131
- brandPreset,
132
- repoUrl,
133
- enableAiChat,
134
- i18nLocales,
135
- colors
136
- });
137
- resetTrackingConfig(targetDir);
138
- if (trackRepos?.length) {
139
- writeTrackingConfig(targetDir, trackRepos);
140
- const list = trackRepos.map((r) => `${r.owner}/${r.repo}`).join(", ");
141
- console.log(` \u2713 Thally Track enabled \u2014 watching ${list} (branch main, all files; refine in docs.json).`);
142
- console.log(" To finish wiring it: `thally track setup` (pick a trigger) + `thally agent init`,");
143
- console.log(" then add your ANTHROPIC_API_KEY. See /guides/thally-track.");
144
- }
145
- updateEnvExample(targetDir);
146
- if (doInstall) {
147
- installDeps(targetDir);
148
- }
149
- initGit(targetDir);
150
- return { projectDir: targetDir };
151
- }
152
-
153
- export {
154
- slugify,
155
- initGit,
156
- installDeps,
157
- logo,
158
- success,
159
- readDocsJson,
160
- writeDocsJson,
161
- scaffold
162
- };