MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / generate

Method generate

src/services/MdbaseSpecService.ts:46–76  ·  view source on GitHub ↗

* Generate both mdbase.yaml and the task type definition.

()

Source from the content-addressed store, hash-verified

44 * Generate both mdbase.yaml and the task type definition.
45 */
46 async generate(): Promise<void> {
47 try {
48 const vault = this.plugin.app.vault;
49 const typesFolder = await this.getTypesFolder();
50 const taskTypePath = `${typesFolder}/task.md`;
51
52 await this.ensureFolderPath(typesFolder);
53
54 const taskTypeDef = this.buildTaskTypeDef();
55 await this.writeFile(taskTypePath, taskTypeDef);
56
57 // Only create mdbase.yaml if it doesn't already exist so that
58 // user customisations (extra excludes, description, etc.) are preserved.
59 const mdbaseExists = await vault.adapter.exists("mdbase.yaml");
60 if (!mdbaseExists) {
61 const mdbaseYaml = this.buildMdbaseYaml(typesFolder);
62 await this.writeFile("mdbase.yaml", mdbaseYaml);
63 }
64
65 tasknotesLogger.debug(
66 `[TaskNotes][mdbase-spec] Generated mdbase.yaml and ${taskTypePath}`,
67 { category: "configuration", operation: "generated-mdbase-yaml-and" }
68 );
69 } catch (error) {
70 tasknotesLogger.error("[TaskNotes][mdbase-spec] Failed to generate files:", {
71 category: "configuration",
72 operation: "generate-files",
73 error: error,
74 });
75 }
76 }
77
78 private async getTypesFolder(): Promise<string> {
79 const vault = this.plugin.app.vault;

Callers 2

onSettingsChangedMethod · 0.95

Calls 8

getTypesFolderMethod · 0.95
ensureFolderPathMethod · 0.95
buildTaskTypeDefMethod · 0.95
writeFileMethod · 0.95
buildMdbaseYamlMethod · 0.95
existsMethod · 0.80
debugMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected