create-thally-docs 0.8.1 → 0.9.0
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/dist/chunk-BW7J7DJV.js +769 -0
- package/dist/chunk-JNDRCCJV.js +232 -0
- package/dist/chunk-PJW4JJIT.js +31 -0
- package/dist/{chunk-SDZZYPSN.js → chunk-YWNWLSZ2.js} +1 -1
- package/dist/customize.d.ts +93 -0
- package/dist/customize.js +37 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -5
- package/dist/migrate/index.d.ts +35 -0
- package/dist/migrate/index.js +4 -2
- package/dist/release.d.ts +58 -0
- package/dist/release.js +9 -0
- package/dist/scaffold.d.ts +38 -0
- package/dist/scaffold.js +16 -3
- package/package.json +10 -3
- package/dist/chunk-RS6U2GSX.js +0 -846
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
patchApiReferenceGuard,
|
|
4
|
+
patchGitignore,
|
|
5
|
+
patchOpenApiFetch,
|
|
6
|
+
patchPackageJson,
|
|
7
|
+
patchTopBarNavigation,
|
|
8
|
+
updateEnvExample,
|
|
9
|
+
updateSiteConfig,
|
|
10
|
+
writeCloudflareRuntimeConfig,
|
|
11
|
+
writeStarterAgentGuide,
|
|
12
|
+
writeStarterContent,
|
|
13
|
+
writeStarterReadme
|
|
14
|
+
} from "./chunk-BW7J7DJV.js";
|
|
15
|
+
import {
|
|
16
|
+
STABLE_SCAFFOLD_RELEASE
|
|
17
|
+
} from "./chunk-PJW4JJIT.js";
|
|
18
|
+
|
|
19
|
+
// src/scaffold.ts
|
|
20
|
+
import { existsSync, mkdirSync, readdirSync } from "fs";
|
|
21
|
+
import { resolve } from "path";
|
|
22
|
+
|
|
23
|
+
// src/download.ts
|
|
24
|
+
import { Readable, pipeline } from "stream";
|
|
25
|
+
import { promisify } from "util";
|
|
26
|
+
import { extract } from "tar";
|
|
27
|
+
var pipelineAsync = promisify(pipeline);
|
|
28
|
+
var TEMPLATE_REPOSITORY = STABLE_SCAFFOLD_RELEASE.source.repository;
|
|
29
|
+
var TEMPLATE_COMMIT_SHA = STABLE_SCAFFOLD_RELEASE.source.commitSha;
|
|
30
|
+
var TARBALL_URL = STABLE_SCAFFOLD_RELEASE.source.archiveUrl;
|
|
31
|
+
var EXCLUDE_PATHS = [
|
|
32
|
+
// Match both the directory entry itself and every nested file. Tar invokes
|
|
33
|
+
// the filter for `.../node_modules` before descendants, without a trailing `/`.
|
|
34
|
+
"/node_modules",
|
|
35
|
+
// The canonical docs repository may temporarily retain package sources while
|
|
36
|
+
// runtime work is being upstreamed. A scaffold consumes the published
|
|
37
|
+
// packages declared in package.json; it must never inherit those sources.
|
|
38
|
+
"/packages",
|
|
39
|
+
"/.git/",
|
|
40
|
+
"/.next/",
|
|
41
|
+
"/.data/",
|
|
42
|
+
"/.thally/",
|
|
43
|
+
// The first-party docs deployment pins its own canonical origin.
|
|
44
|
+
"/.env.production",
|
|
45
|
+
"/thally-track.yml",
|
|
46
|
+
"/CODEOWNERS",
|
|
47
|
+
"/CLAUDE.md",
|
|
48
|
+
"/notes/",
|
|
49
|
+
"/public/images/",
|
|
50
|
+
"/src/public/",
|
|
51
|
+
"/snippets/",
|
|
52
|
+
"/.github/ISSUE_TEMPLATE/",
|
|
53
|
+
"/.github/PULL_REQUEST_TEMPLATE.md",
|
|
54
|
+
"/README.md"
|
|
55
|
+
];
|
|
56
|
+
function shouldInclude(path) {
|
|
57
|
+
for (const excluded of EXCLUDE_PATHS) {
|
|
58
|
+
if (path.includes(excluded)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
async function downloadTemplate(targetDir, siteName) {
|
|
65
|
+
console.log("");
|
|
66
|
+
console.log(` \u23F3 Creating ${siteName?.trim() || "your docs site"}...`);
|
|
67
|
+
const response = await fetch(TARBALL_URL);
|
|
68
|
+
if (!response.ok) {
|
|
69
|
+
throw new Error(`Failed to download template: ${response.status} ${response.statusText}`);
|
|
70
|
+
}
|
|
71
|
+
if (!response.body) {
|
|
72
|
+
throw new Error("Response body is empty");
|
|
73
|
+
}
|
|
74
|
+
const nodeStream = Readable.fromWeb(response.body);
|
|
75
|
+
await pipelineAsync(
|
|
76
|
+
nodeStream,
|
|
77
|
+
extract({ cwd: targetDir, strip: 1, filter: shouldInclude })
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/docs-json.ts
|
|
82
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
83
|
+
import { join } from "path";
|
|
84
|
+
function readDocsJson(projectDir) {
|
|
85
|
+
const docsPath = join(projectDir, "docs.json");
|
|
86
|
+
const raw = readFileSync(docsPath, "utf8");
|
|
87
|
+
return JSON.parse(raw);
|
|
88
|
+
}
|
|
89
|
+
function writeDocsJson(projectDir, config) {
|
|
90
|
+
const docsPath = join(projectDir, "docs.json");
|
|
91
|
+
writeFileSync(docsPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
92
|
+
}
|
|
93
|
+
function resetTrackingConfig(projectDir) {
|
|
94
|
+
const config = readDocsJson(projectDir);
|
|
95
|
+
if (config.tracking) {
|
|
96
|
+
delete config.tracking;
|
|
97
|
+
writeDocsJson(projectDir, config);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function writeTrackingConfig(projectDir, repos) {
|
|
101
|
+
if (repos.length === 0) return;
|
|
102
|
+
const config = readDocsJson(projectDir);
|
|
103
|
+
config.tracking = { repos: repos.map((r) => ({ owner: r.owner, repo: r.repo, branch: "main" })) };
|
|
104
|
+
writeDocsJson(projectDir, config);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// src/utils.ts
|
|
108
|
+
import { execSync } from "child_process";
|
|
109
|
+
import { basename } from "path";
|
|
110
|
+
function slugify(name) {
|
|
111
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
112
|
+
}
|
|
113
|
+
function run(cmd, cwd) {
|
|
114
|
+
execSync(cmd, { cwd, stdio: "inherit" });
|
|
115
|
+
}
|
|
116
|
+
function initGit(targetDir) {
|
|
117
|
+
try {
|
|
118
|
+
run("git init", targetDir);
|
|
119
|
+
run("git add -A", targetDir);
|
|
120
|
+
run('git commit -m "Initial commit from create-thally-docs"', targetDir);
|
|
121
|
+
} catch {
|
|
122
|
+
console.log(" \u26A0\uFE0F Could not initialize git (you can do this manually).");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function installDeps(targetDir) {
|
|
126
|
+
console.log("");
|
|
127
|
+
console.log(" \u{1F4E6} Installing dependencies...");
|
|
128
|
+
console.log("");
|
|
129
|
+
run("npm install --prefer-offline --no-audit --no-fund --progress=false", targetDir);
|
|
130
|
+
}
|
|
131
|
+
function logo() {
|
|
132
|
+
console.log("");
|
|
133
|
+
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");
|
|
134
|
+
console.log(" \u2551 \u2551");
|
|
135
|
+
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");
|
|
136
|
+
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");
|
|
137
|
+
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");
|
|
138
|
+
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");
|
|
139
|
+
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");
|
|
140
|
+
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");
|
|
141
|
+
console.log(" \u2551 \u2551");
|
|
142
|
+
console.log(" \u2551Give your product and docs first-class agent visibility.\u2551");
|
|
143
|
+
console.log(" \u2551 \u2551");
|
|
144
|
+
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");
|
|
145
|
+
console.log("");
|
|
146
|
+
}
|
|
147
|
+
function success(projectDir, projectName, dependenciesInstalled) {
|
|
148
|
+
console.log("");
|
|
149
|
+
console.log(" \u2705 Your Thally project is ready!");
|
|
150
|
+
console.log("");
|
|
151
|
+
console.log(` \u{1F4C2} ${projectDir}`);
|
|
152
|
+
console.log("");
|
|
153
|
+
console.log(" Next steps:");
|
|
154
|
+
console.log("");
|
|
155
|
+
console.log(` cd ${basename(projectDir)}`);
|
|
156
|
+
if (!dependenciesInstalled) {
|
|
157
|
+
console.log(" npm install");
|
|
158
|
+
}
|
|
159
|
+
console.log(" npm run dev");
|
|
160
|
+
console.log("");
|
|
161
|
+
console.log(` Your terminal will print the local URL for your ${projectName} docs.`);
|
|
162
|
+
console.log("");
|
|
163
|
+
console.log(" \u{1F4DD} Key files to edit:");
|
|
164
|
+
console.log(" \u2022 src/data/site.ts \u2014 name, links, branding");
|
|
165
|
+
console.log(" \u2022 docs.json \u2014 navigation structure");
|
|
166
|
+
console.log(" \u2022 src/content/*.mdx \u2014 your documentation");
|
|
167
|
+
console.log(" \u2022 openapi.yaml \u2014 API spec (optional)");
|
|
168
|
+
console.log("");
|
|
169
|
+
console.log(" Happy documenting! \u{1F680}");
|
|
170
|
+
console.log("");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/scaffold.ts
|
|
174
|
+
async function scaffold(options) {
|
|
175
|
+
const {
|
|
176
|
+
projectDir,
|
|
177
|
+
projectName,
|
|
178
|
+
description,
|
|
179
|
+
brandPreset,
|
|
180
|
+
repoUrl,
|
|
181
|
+
doInstall,
|
|
182
|
+
enableAiChat = true,
|
|
183
|
+
i18nLocales,
|
|
184
|
+
trackRepos
|
|
185
|
+
} = options;
|
|
186
|
+
const targetDir = resolve(projectDir);
|
|
187
|
+
if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
|
|
188
|
+
throw new Error(`Directory "${targetDir}" already exists and is not empty.`);
|
|
189
|
+
}
|
|
190
|
+
mkdirSync(targetDir, { recursive: true });
|
|
191
|
+
const slug = slugify(projectName);
|
|
192
|
+
await downloadTemplate(targetDir, projectName);
|
|
193
|
+
resetTrackingConfig(targetDir);
|
|
194
|
+
if (trackRepos?.length) {
|
|
195
|
+
writeTrackingConfig(targetDir, trackRepos);
|
|
196
|
+
const list = trackRepos.map((r) => `${r.owner}/${r.repo}`).join(", ");
|
|
197
|
+
console.log(` \u2713 Thally Track enabled \u2014 watching ${list} (branch main, all files; refine in docs.json).`);
|
|
198
|
+
console.log(" To finish wiring it: `thally track setup` (pick a trigger) + `thally agent init`,");
|
|
199
|
+
console.log(" then add your ANTHROPIC_API_KEY. See /guides/thally-track.");
|
|
200
|
+
}
|
|
201
|
+
writeStarterContent(targetDir, projectName, enableAiChat, repoUrl, i18nLocales);
|
|
202
|
+
writeStarterReadme(targetDir, projectName);
|
|
203
|
+
writeStarterAgentGuide(targetDir, projectName);
|
|
204
|
+
updateSiteConfig(targetDir, projectName, description, brandPreset, repoUrl);
|
|
205
|
+
patchApiReferenceGuard(targetDir);
|
|
206
|
+
patchTopBarNavigation(targetDir);
|
|
207
|
+
patchOpenApiFetch(targetDir);
|
|
208
|
+
patchPackageJson(targetDir, slug);
|
|
209
|
+
writeCloudflareRuntimeConfig(targetDir, slug);
|
|
210
|
+
patchGitignore(targetDir);
|
|
211
|
+
updateEnvExample(targetDir);
|
|
212
|
+
if (doInstall) {
|
|
213
|
+
installDeps(targetDir);
|
|
214
|
+
}
|
|
215
|
+
initGit(targetDir);
|
|
216
|
+
return { projectDir: targetDir };
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export {
|
|
220
|
+
slugify,
|
|
221
|
+
initGit,
|
|
222
|
+
installDeps,
|
|
223
|
+
logo,
|
|
224
|
+
success,
|
|
225
|
+
TEMPLATE_REPOSITORY,
|
|
226
|
+
TEMPLATE_COMMIT_SHA,
|
|
227
|
+
EXCLUDE_PATHS,
|
|
228
|
+
shouldInclude,
|
|
229
|
+
readDocsJson,
|
|
230
|
+
writeDocsJson,
|
|
231
|
+
scaffold
|
|
232
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/release.ts
|
|
4
|
+
var STABLE_SCAFFOLD_RELEASE = {
|
|
5
|
+
schemaVersion: 1,
|
|
6
|
+
id: "2026-08-04.b0094de4.e36d2bcf",
|
|
7
|
+
source: {
|
|
8
|
+
repository: "thallylabs/docs",
|
|
9
|
+
commitSha: "b0094de4fea84567eb12c39c6783fdae6820bb98",
|
|
10
|
+
treeSha: "ffd0a6fda07341ddd1ba164cb40acef796f89e2d",
|
|
11
|
+
archiveUrl: "https://codeload.github.com/thallylabs/docs/tar.gz/b0094de4fea84567eb12c39c6783fdae6820bb98"
|
|
12
|
+
},
|
|
13
|
+
runtime: {
|
|
14
|
+
repository: "thallylabs/thally",
|
|
15
|
+
commitSha: "e36d2bcff38f7638a77369e12773a7cab4d5d9ce",
|
|
16
|
+
treeSha: "1c8b0358d78d8caa14ed039bff6ab47c98b685d8",
|
|
17
|
+
contentSource: "assets",
|
|
18
|
+
identityContractVersion: 1
|
|
19
|
+
},
|
|
20
|
+
starterVersion: 1
|
|
21
|
+
};
|
|
22
|
+
function isStableScaffoldRelease(value) {
|
|
23
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
24
|
+
const candidate = value;
|
|
25
|
+
return candidate.schemaVersion === STABLE_SCAFFOLD_RELEASE.schemaVersion && candidate.id === STABLE_SCAFFOLD_RELEASE.id && candidate.starterVersion === STABLE_SCAFFOLD_RELEASE.starterVersion && candidate.source?.repository === STABLE_SCAFFOLD_RELEASE.source.repository && candidate.source?.commitSha === STABLE_SCAFFOLD_RELEASE.source.commitSha && candidate.source?.treeSha === STABLE_SCAFFOLD_RELEASE.source.treeSha && candidate.source?.archiveUrl === STABLE_SCAFFOLD_RELEASE.source.archiveUrl && candidate.runtime?.repository === STABLE_SCAFFOLD_RELEASE.runtime.repository && candidate.runtime?.commitSha === STABLE_SCAFFOLD_RELEASE.runtime.commitSha && candidate.runtime?.treeSha === STABLE_SCAFFOLD_RELEASE.runtime.treeSha && candidate.runtime?.contentSource === STABLE_SCAFFOLD_RELEASE.runtime.contentSource && candidate.runtime?.identityContractVersion === STABLE_SCAFFOLD_RELEASE.runtime.identityContractVersion;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
STABLE_SCAFFOLD_RELEASE,
|
|
30
|
+
isStableScaffoldRelease
|
|
31
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lowest `@thallylabs/cli` release a scaffold may declare.
|
|
3
|
+
*
|
|
4
|
+
* The managed builder depends on the Cloudflare-aware CLI contract, so a site
|
|
5
|
+
* scaffolded from an older or locally-vendored template must not keep a
|
|
6
|
+
* pre-Workers pin. This is a FLOOR, never an override: the canonical template
|
|
7
|
+
* tracks the newest published CLI, and overwriting its pin with a constant that
|
|
8
|
+
* has since aged past it silently downgrades every generated site. Raise it
|
|
9
|
+
* only alongside a released CLI — `scaffold-hygiene.test.ts` fails if it ever
|
|
10
|
+
* climbs above the version this monorepo publishes.
|
|
11
|
+
*/
|
|
12
|
+
declare const MIN_CLI_VERSION = "0.7.0";
|
|
13
|
+
/**
|
|
14
|
+
* Lowest `@thallylabs/mcp` release a scaffold may declare. Same floor semantics
|
|
15
|
+
* as {@link MIN_CLI_VERSION}; it also stands in for the unresolvable `*` range
|
|
16
|
+
* that older workspace-based templates used.
|
|
17
|
+
*/
|
|
18
|
+
declare const MIN_MCP_VERSION = "0.9.0";
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a dependency pin to at least `floor`, preferring what the template
|
|
21
|
+
* already ships. An absent, unresolvable, or demonstrably older pin becomes the
|
|
22
|
+
* floor; anything newer — or anything the comparison cannot rank — survives.
|
|
23
|
+
*/
|
|
24
|
+
declare function raisePinToFloor(current: string | undefined, floor: string): string;
|
|
25
|
+
interface StarterLocale {
|
|
26
|
+
code: string;
|
|
27
|
+
label: string;
|
|
28
|
+
}
|
|
29
|
+
interface StarterFile {
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
}
|
|
33
|
+
interface BuildStarterFilesOptions {
|
|
34
|
+
projectName: string;
|
|
35
|
+
enableAiChat?: boolean;
|
|
36
|
+
repoUrl?: string;
|
|
37
|
+
i18nLocales?: Array<StarterLocale>;
|
|
38
|
+
}
|
|
39
|
+
declare function buildStarterDocsJson({ enableAiChat, repoUrl, i18nLocales, }: {
|
|
40
|
+
enableAiChat: boolean;
|
|
41
|
+
repoUrl?: string;
|
|
42
|
+
i18nLocales?: Array<{
|
|
43
|
+
code: string;
|
|
44
|
+
label: string;
|
|
45
|
+
}>;
|
|
46
|
+
}): string;
|
|
47
|
+
/**
|
|
48
|
+
* Render the complete site-owned starter layer without reading or writing the
|
|
49
|
+
* filesystem. CLI, MCP, and Thally Cloud consume these exact bytes so a new
|
|
50
|
+
* site cannot vary by which creation entry point the user chose.
|
|
51
|
+
*/
|
|
52
|
+
declare function buildStarterFiles({ projectName, enableAiChat, repoUrl, i18nLocales, }: BuildStarterFilesOptions): Array<StarterFile>;
|
|
53
|
+
declare function writeStarterContent(targetDir: string, projectName: string, enableAiChat?: boolean, repoUrl?: string, i18nLocales?: Array<{
|
|
54
|
+
code: string;
|
|
55
|
+
label: string;
|
|
56
|
+
}>): void;
|
|
57
|
+
declare function writeStarterAgentGuide(targetDir: string, projectName: string): void;
|
|
58
|
+
declare function writeStarterReadme(targetDir: string, projectName: string): void;
|
|
59
|
+
/**
|
|
60
|
+
* Write provider-portable Cloudflare Workers configuration into every scaffold.
|
|
61
|
+
*
|
|
62
|
+
* The files contain no account, route, bucket, or token identifiers. Thally
|
|
63
|
+
* Cloud supplies those operational values while self-hosters can deploy the
|
|
64
|
+
* same source tree to their own account without editing application internals.
|
|
65
|
+
*/
|
|
66
|
+
declare function writeCloudflareRuntimeConfig(targetDir: string, slug: string): void;
|
|
67
|
+
declare function updateSiteConfig(targetDir: string, projectName: string, description: string, brandPreset: string, repoUrl: string): void;
|
|
68
|
+
declare function patchApiReferenceGuard(targetDir: string): void;
|
|
69
|
+
declare function patchTopBarNavigation(targetDir: string): void;
|
|
70
|
+
declare function patchOpenApiFetch(targetDir: string): void;
|
|
71
|
+
declare function updateEnvExample(targetDir: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Normalize the canonical docs package for a newly named standalone site.
|
|
74
|
+
* `thallylabs/docs` is already standalone, while this defensive cleanup also
|
|
75
|
+
* keeps local or older monorepo-based sources safe to scaffold:
|
|
76
|
+
*
|
|
77
|
+
* - `workspaces` points at a directory that doesn't exist in scaffolds.
|
|
78
|
+
* - `prebuild`/`pretest` invoke `packages:build`, which builds those absent
|
|
79
|
+
* workspaces. Runtime sources and embeddings stay in `prebuild`: both run
|
|
80
|
+
* standalone and supply request-time data in filesystem-free Workers.
|
|
81
|
+
* - The copied `package-lock.json` still resolves the monorepo's workspace
|
|
82
|
+
* graph; deleting it lets the scaffold's own `npm install` write a clean
|
|
83
|
+
* lockfile. Workspace-linked deps (e.g. @thallylabs/core) resolve from the
|
|
84
|
+
* npm registry instead, which is why the template must depend on published
|
|
85
|
+
* versions, never `workspace:*` specs.
|
|
86
|
+
*
|
|
87
|
+
* Also names the package after the site so `npm ls`/lockfiles read correctly.
|
|
88
|
+
*/
|
|
89
|
+
declare function patchPackageJson(targetDir: string, slug: string): void;
|
|
90
|
+
/** Ensure dependency folders are ignored at any depth in generated sites. */
|
|
91
|
+
declare function patchGitignore(targetDir: string): void;
|
|
92
|
+
|
|
93
|
+
export { type BuildStarterFilesOptions, MIN_CLI_VERSION, MIN_MCP_VERSION, type StarterFile, type StarterLocale, buildStarterDocsJson, buildStarterFiles, patchApiReferenceGuard, patchGitignore, patchOpenApiFetch, patchPackageJson, patchTopBarNavigation, raisePinToFloor, updateEnvExample, updateSiteConfig, writeCloudflareRuntimeConfig, writeStarterAgentGuide, writeStarterContent, writeStarterReadme };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
MIN_CLI_VERSION,
|
|
4
|
+
MIN_MCP_VERSION,
|
|
5
|
+
buildStarterDocsJson,
|
|
6
|
+
buildStarterFiles,
|
|
7
|
+
patchApiReferenceGuard,
|
|
8
|
+
patchGitignore,
|
|
9
|
+
patchOpenApiFetch,
|
|
10
|
+
patchPackageJson,
|
|
11
|
+
patchTopBarNavigation,
|
|
12
|
+
raisePinToFloor,
|
|
13
|
+
updateEnvExample,
|
|
14
|
+
updateSiteConfig,
|
|
15
|
+
writeCloudflareRuntimeConfig,
|
|
16
|
+
writeStarterAgentGuide,
|
|
17
|
+
writeStarterContent,
|
|
18
|
+
writeStarterReadme
|
|
19
|
+
} from "./chunk-BW7J7DJV.js";
|
|
20
|
+
export {
|
|
21
|
+
MIN_CLI_VERSION,
|
|
22
|
+
MIN_MCP_VERSION,
|
|
23
|
+
buildStarterDocsJson,
|
|
24
|
+
buildStarterFiles,
|
|
25
|
+
patchApiReferenceGuard,
|
|
26
|
+
patchGitignore,
|
|
27
|
+
patchOpenApiFetch,
|
|
28
|
+
patchPackageJson,
|
|
29
|
+
patchTopBarNavigation,
|
|
30
|
+
raisePinToFloor,
|
|
31
|
+
updateEnvExample,
|
|
32
|
+
updateSiteConfig,
|
|
33
|
+
writeCloudflareRuntimeConfig,
|
|
34
|
+
writeStarterAgentGuide,
|
|
35
|
+
writeStarterContent,
|
|
36
|
+
writeStarterReadme
|
|
37
|
+
};
|
package/dist/index.d.ts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
migrateDocs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-YWNWLSZ2.js";
|
|
5
5
|
import {
|
|
6
6
|
logo,
|
|
7
7
|
readDocsJson,
|
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
slugify,
|
|
10
10
|
success,
|
|
11
11
|
writeDocsJson
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JNDRCCJV.js";
|
|
13
|
+
import "./chunk-BW7J7DJV.js";
|
|
14
|
+
import "./chunk-PJW4JJIT.js";
|
|
13
15
|
|
|
14
16
|
// src/index.ts
|
|
15
17
|
import { existsSync as existsSync3, readdirSync as readdirSync2 } from "fs";
|
|
@@ -149,13 +151,13 @@ async function gatherAnswers(dirArg, useDefaults, installPreference) {
|
|
|
149
151
|
let i18nLocales;
|
|
150
152
|
if (!useDefaults) {
|
|
151
153
|
const enableI18n = await input({
|
|
152
|
-
message: "
|
|
154
|
+
message: " Add languages beyond English and Spanish? (y/N):",
|
|
153
155
|
default: "N"
|
|
154
156
|
});
|
|
155
157
|
if (enableI18n.toLowerCase() === "y") {
|
|
156
158
|
const localesInput = await input({
|
|
157
|
-
message: " Which locales? (comma-separated codes, e.g.
|
|
158
|
-
default: "
|
|
159
|
+
message: " Which additional locales? (comma-separated codes, e.g. fr,de,ja):",
|
|
160
|
+
default: "fr"
|
|
159
161
|
});
|
|
160
162
|
const LOCALE_LABELS = {
|
|
161
163
|
en: "English",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MigrationPlatform, MigrationFetcher, MigrationBundle, MigrationWarning } from '@thallylabs/migrate';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CLI materializer for the shared Thally migration engine. Discovery completes
|
|
5
|
+
* before scaffolding or writing, and every generated path is proven to remain
|
|
6
|
+
* inside the selected project directory.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface MigrateOptions {
|
|
10
|
+
sourceUrl: string;
|
|
11
|
+
projectDir: string;
|
|
12
|
+
into: boolean;
|
|
13
|
+
/** Retained for CLI compatibility; Markdown/MDX imports do not require a key. */
|
|
14
|
+
apiKey?: string;
|
|
15
|
+
branch?: string;
|
|
16
|
+
docsDir?: string;
|
|
17
|
+
projectName?: string;
|
|
18
|
+
yes: boolean;
|
|
19
|
+
maxPages?: number;
|
|
20
|
+
/** Explicit source platform selected by an interactive or automated caller. */
|
|
21
|
+
platform?: MigrationPlatform;
|
|
22
|
+
/** Optional host fetch boundary; used by Thally Cloud adapters and tests. */
|
|
23
|
+
fetcher?: MigrationFetcher;
|
|
24
|
+
}
|
|
25
|
+
interface MigrateResult {
|
|
26
|
+
pagesWritten: number;
|
|
27
|
+
assetsWritten: number;
|
|
28
|
+
projectDir: string;
|
|
29
|
+
platform: MigrationBundle['platform'];
|
|
30
|
+
warnings: Array<MigrationWarning>;
|
|
31
|
+
}
|
|
32
|
+
/** Import a GitHub docs repository or public docs URL into a Thally project. */
|
|
33
|
+
declare function migrateDocs(options: MigrateOptions): Promise<MigrateResult>;
|
|
34
|
+
|
|
35
|
+
export { type MigrateOptions, type MigrateResult, migrateDocs };
|
package/dist/migrate/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
migrateDocs
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-YWNWLSZ2.js";
|
|
5
|
+
import "../chunk-JNDRCCJV.js";
|
|
6
|
+
import "../chunk-BW7J7DJV.js";
|
|
7
|
+
import "../chunk-PJW4JJIT.js";
|
|
6
8
|
export {
|
|
7
9
|
migrateDocs
|
|
8
10
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable source and runtime identity for every newly scaffolded Thally site.
|
|
3
|
+
*
|
|
4
|
+
* A release is promoted only after the source snapshot and its compiled runtime
|
|
5
|
+
* have passed the scaffold, build, and identity-safety gates. Consumers must
|
|
6
|
+
* use the whole record: independently resolving "latest template" and "latest
|
|
7
|
+
* runtime" recreates the drift this contract exists to prevent.
|
|
8
|
+
*/
|
|
9
|
+
interface ScaffoldSourceRelease {
|
|
10
|
+
repository: string;
|
|
11
|
+
commitSha: string;
|
|
12
|
+
treeSha: string;
|
|
13
|
+
archiveUrl: string;
|
|
14
|
+
}
|
|
15
|
+
interface ScaffoldRuntimeRelease {
|
|
16
|
+
repository: string;
|
|
17
|
+
commitSha: string;
|
|
18
|
+
treeSha: string;
|
|
19
|
+
contentSource: 'assets';
|
|
20
|
+
identityContractVersion: number;
|
|
21
|
+
}
|
|
22
|
+
interface ScaffoldRelease {
|
|
23
|
+
schemaVersion: 1;
|
|
24
|
+
id: string;
|
|
25
|
+
source: ScaffoldSourceRelease;
|
|
26
|
+
runtime: ScaffoldRuntimeRelease;
|
|
27
|
+
starterVersion: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Current stable scaffold release.
|
|
31
|
+
*
|
|
32
|
+
* The source commit is the refreshed public docs template and the runtime
|
|
33
|
+
* commit is the matching engine change. `create-thally-docs`, the CLI, MCP,
|
|
34
|
+
* and Thally Cloud all import this exact record rather than following a moving
|
|
35
|
+
* branch independently.
|
|
36
|
+
*/
|
|
37
|
+
declare const STABLE_SCAFFOLD_RELEASE: {
|
|
38
|
+
readonly schemaVersion: 1;
|
|
39
|
+
readonly id: "2026-08-04.b0094de4.e36d2bcf";
|
|
40
|
+
readonly source: {
|
|
41
|
+
readonly repository: "thallylabs/docs";
|
|
42
|
+
readonly commitSha: "b0094de4fea84567eb12c39c6783fdae6820bb98";
|
|
43
|
+
readonly treeSha: "ffd0a6fda07341ddd1ba164cb40acef796f89e2d";
|
|
44
|
+
readonly archiveUrl: "https://codeload.github.com/thallylabs/docs/tar.gz/b0094de4fea84567eb12c39c6783fdae6820bb98";
|
|
45
|
+
};
|
|
46
|
+
readonly runtime: {
|
|
47
|
+
readonly repository: "thallylabs/thally";
|
|
48
|
+
readonly commitSha: "e36d2bcff38f7638a77369e12773a7cab4d5d9ce";
|
|
49
|
+
readonly treeSha: "1c8b0358d78d8caa14ed039bff6ab47c98b685d8";
|
|
50
|
+
readonly contentSource: "assets";
|
|
51
|
+
readonly identityContractVersion: 1;
|
|
52
|
+
};
|
|
53
|
+
readonly starterVersion: 1;
|
|
54
|
+
};
|
|
55
|
+
/** True only when an unknown record is the currently supported release. */
|
|
56
|
+
declare function isStableScaffoldRelease(value: unknown): value is ScaffoldRelease;
|
|
57
|
+
|
|
58
|
+
export { STABLE_SCAFFOLD_RELEASE, type ScaffoldRelease, type ScaffoldRuntimeRelease, type ScaffoldSourceRelease, isStableScaffoldRelease };
|
package/dist/release.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export { STABLE_SCAFFOLD_RELEASE } from './release.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The live Thally documentation site is also the canonical standalone site
|
|
5
|
+
* source. Keeping one source means a runtime or UI improvement shipped to the
|
|
6
|
+
* docs is available to every subsequent scaffold without maintaining a second
|
|
7
|
+
* template repository.
|
|
8
|
+
*/
|
|
9
|
+
declare const TEMPLATE_REPOSITORY: "thallylabs/docs";
|
|
10
|
+
declare const TEMPLATE_COMMIT_SHA: "b0094de4fea84567eb12c39c6783fdae6820bb98";
|
|
11
|
+
declare const EXCLUDE_PATHS: string[];
|
|
12
|
+
/** True if a tarball entry should land in the scaffold (see EXCLUDE_PATHS). */
|
|
13
|
+
declare function shouldInclude(path: string): boolean;
|
|
14
|
+
|
|
15
|
+
interface ScaffoldOptions {
|
|
16
|
+
projectDir: string;
|
|
17
|
+
projectName: string;
|
|
18
|
+
description: string;
|
|
19
|
+
brandPreset: string;
|
|
20
|
+
repoUrl: string;
|
|
21
|
+
doInstall: boolean;
|
|
22
|
+
enableAiChat?: boolean;
|
|
23
|
+
i18nLocales?: Array<{
|
|
24
|
+
code: string;
|
|
25
|
+
label: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** Repos to pre-register for Thally Track (opt-in). Empty/undefined = Track off. */
|
|
28
|
+
trackRepos?: Array<{
|
|
29
|
+
owner: string;
|
|
30
|
+
repo: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
interface ScaffoldResult {
|
|
34
|
+
projectDir: string;
|
|
35
|
+
}
|
|
36
|
+
declare function scaffold(options: ScaffoldOptions): Promise<ScaffoldResult>;
|
|
37
|
+
|
|
38
|
+
export { EXCLUDE_PATHS, type ScaffoldOptions, type ScaffoldResult, TEMPLATE_COMMIT_SHA, TEMPLATE_REPOSITORY, scaffold, shouldInclude };
|
package/dist/scaffold.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
EXCLUDE_PATHS,
|
|
4
|
+
TEMPLATE_COMMIT_SHA,
|
|
5
|
+
TEMPLATE_REPOSITORY,
|
|
6
|
+
scaffold,
|
|
7
|
+
shouldInclude
|
|
8
|
+
} from "./chunk-JNDRCCJV.js";
|
|
9
|
+
import "./chunk-BW7J7DJV.js";
|
|
10
|
+
import {
|
|
11
|
+
STABLE_SCAFFOLD_RELEASE
|
|
12
|
+
} from "./chunk-PJW4JJIT.js";
|
|
5
13
|
export {
|
|
6
|
-
|
|
14
|
+
EXCLUDE_PATHS,
|
|
15
|
+
STABLE_SCAFFOLD_RELEASE,
|
|
16
|
+
TEMPLATE_COMMIT_SHA,
|
|
17
|
+
TEMPLATE_REPOSITORY,
|
|
18
|
+
scaffold,
|
|
19
|
+
shouldInclude
|
|
7
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-thally-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Scaffold the first documentation surface in a Thally product-knowledge pipeline.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": "./dist/index.js",
|
|
14
14
|
"./scaffold": "./dist/scaffold.js",
|
|
15
|
+
"./starter": {
|
|
16
|
+
"types": "./dist/customize.d.ts",
|
|
17
|
+
"import": "./dist/customize.js"
|
|
18
|
+
},
|
|
19
|
+
"./release": {
|
|
20
|
+
"types": "./dist/release.d.ts",
|
|
21
|
+
"import": "./dist/release.js"
|
|
22
|
+
},
|
|
15
23
|
"./migrate": "./dist/migrate/index.js",
|
|
16
24
|
"./package.json": "./package.json"
|
|
17
25
|
},
|
|
@@ -31,12 +39,11 @@
|
|
|
31
39
|
"@thallylabs/migrate": "0.2.0",
|
|
32
40
|
"gray-matter": "^4.0.3",
|
|
33
41
|
"p-limit": "^6.1.0",
|
|
34
|
-
"tar": "^
|
|
42
|
+
"tar": "^7.5.22",
|
|
35
43
|
"yaml": "^2.6.0"
|
|
36
44
|
},
|
|
37
45
|
"devDependencies": {
|
|
38
46
|
"@types/node": "^22.0.0",
|
|
39
|
-
"@types/tar": "^6.1.13",
|
|
40
47
|
"tsup": "^8.0.0",
|
|
41
48
|
"typescript": "^5.0.0"
|
|
42
49
|
},
|