@thallylabs/mcp 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/create-project.d.ts +49 -0
- package/dist/create-project.js +67 -0
- package/dist/index.js +76 -316
- package/dist/tools.js +76 -316
- package/package.json +6 -4
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const createProjectSchema: z.ZodObject<{
|
|
4
|
+
projectDir: z.ZodString;
|
|
5
|
+
projectName: z.ZodOptional<z.ZodString>;
|
|
6
|
+
description: z.ZodOptional<z.ZodString>;
|
|
7
|
+
brandPreset: z.ZodDefault<z.ZodOptional<z.ZodEnum<["primary", "secondary"]>>>;
|
|
8
|
+
repoUrl: z.ZodOptional<z.ZodString>;
|
|
9
|
+
install: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
enableAiChat: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
11
|
+
i18nLocales: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
12
|
+
code: z.ZodString;
|
|
13
|
+
label: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
code: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}, {
|
|
18
|
+
code: string;
|
|
19
|
+
label: string;
|
|
20
|
+
}>, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
projectDir: string;
|
|
23
|
+
brandPreset: "primary" | "secondary";
|
|
24
|
+
install: boolean;
|
|
25
|
+
enableAiChat: boolean;
|
|
26
|
+
projectName?: string | undefined;
|
|
27
|
+
description?: string | undefined;
|
|
28
|
+
repoUrl?: string | undefined;
|
|
29
|
+
i18nLocales?: {
|
|
30
|
+
code: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}[] | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
projectDir: string;
|
|
35
|
+
projectName?: string | undefined;
|
|
36
|
+
description?: string | undefined;
|
|
37
|
+
brandPreset?: "primary" | "secondary" | undefined;
|
|
38
|
+
repoUrl?: string | undefined;
|
|
39
|
+
install?: boolean | undefined;
|
|
40
|
+
enableAiChat?: boolean | undefined;
|
|
41
|
+
i18nLocales?: {
|
|
42
|
+
code: string;
|
|
43
|
+
label: string;
|
|
44
|
+
}[] | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
type CreateProjectInput = z.infer<typeof createProjectSchema>;
|
|
47
|
+
declare function handleCreateProject(input: CreateProjectInput): Promise<string>;
|
|
48
|
+
|
|
49
|
+
export { type CreateProjectInput, createProjectSchema, handleCreateProject };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// src/tools/create-project.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
// src/lib/scaffold.ts
|
|
5
|
+
import {
|
|
6
|
+
EXCLUDE_PATHS,
|
|
7
|
+
STABLE_SCAFFOLD_RELEASE,
|
|
8
|
+
TEMPLATE_REPOSITORY,
|
|
9
|
+
scaffold as scaffoldProject,
|
|
10
|
+
shouldInclude
|
|
11
|
+
} from "create-thally-docs/scaffold";
|
|
12
|
+
import { buildStarterDocsJson } from "create-thally-docs/starter";
|
|
13
|
+
var MCP_TEMPLATE_COMMIT_SHA = STABLE_SCAFFOLD_RELEASE.source.commitSha;
|
|
14
|
+
var MCP_SCAFFOLD_RELEASE_ID = STABLE_SCAFFOLD_RELEASE.id;
|
|
15
|
+
async function scaffold(options) {
|
|
16
|
+
return scaffoldProject(options);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// src/tools/create-project.ts
|
|
20
|
+
var createProjectSchema = z.object({
|
|
21
|
+
projectDir: z.string().describe("Path where the new Thally project should be created"),
|
|
22
|
+
projectName: z.string().optional().describe("Display name of the project (defaults to directory name)"),
|
|
23
|
+
description: z.string().optional().describe("Short description of the project"),
|
|
24
|
+
brandPreset: z.enum(["primary", "secondary"]).optional().default("primary").describe("Brand color preset"),
|
|
25
|
+
repoUrl: z.string().optional().describe("GitHub repository URL (optional)"),
|
|
26
|
+
install: z.boolean().optional().default(true).describe("Whether to run npm install after scaffolding"),
|
|
27
|
+
enableAiChat: z.boolean().optional().default(true).describe("Enable AI chat in docs.json (default true)"),
|
|
28
|
+
i18nLocales: z.array(z.object({ code: z.string(), label: z.string() })).optional().describe('Additional locales beyond the included English and Spanish defaults (e.g. [{code:"fr",label:"Fran\xE7ais"}])')
|
|
29
|
+
});
|
|
30
|
+
async function handleCreateProject(input) {
|
|
31
|
+
const { projectDir, brandPreset = "primary", install = true } = input;
|
|
32
|
+
const dirBase = projectDir.split("/").filter(Boolean).pop() ?? "my-docs";
|
|
33
|
+
const projectName = input.projectName ?? dirBase.replace(/[-_]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
34
|
+
const description = input.description ?? `Documentation for ${projectName}.`;
|
|
35
|
+
const repoUrl = input.repoUrl ?? "";
|
|
36
|
+
const result = await scaffold({
|
|
37
|
+
projectDir,
|
|
38
|
+
projectName,
|
|
39
|
+
description,
|
|
40
|
+
brandPreset,
|
|
41
|
+
repoUrl,
|
|
42
|
+
doInstall: install,
|
|
43
|
+
enableAiChat: input.enableAiChat ?? true,
|
|
44
|
+
i18nLocales: input.i18nLocales
|
|
45
|
+
});
|
|
46
|
+
const dirName = result.projectDir.split("/").pop() ?? projectDir;
|
|
47
|
+
return [
|
|
48
|
+
`\u2705 Thally project "${projectName}" created at: ${result.projectDir}`,
|
|
49
|
+
"",
|
|
50
|
+
"Next steps:",
|
|
51
|
+
` cd ${dirName}`,
|
|
52
|
+
" npm run dev",
|
|
53
|
+
"",
|
|
54
|
+
"Then open http://localhost:3040 to see your docs.",
|
|
55
|
+
"",
|
|
56
|
+
"Key files to edit:",
|
|
57
|
+
" \u2022 src/data/site.ts \u2014 name, links, branding",
|
|
58
|
+
" \u2022 docs.json \u2014 navigation, AI chat config",
|
|
59
|
+
" \u2022 src/content/*.mdx \u2014 your documentation",
|
|
60
|
+
"",
|
|
61
|
+
...input.enableAiChat !== false ? ["\u{1F916} AI chat is enabled. Set ANTHROPIC_API_KEY in .env.local."] : []
|
|
62
|
+
].join("\n");
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
createProjectSchema,
|
|
66
|
+
handleCreateProject
|
|
67
|
+
};
|