ondc-code-generator 0.9.0 → 1.0.1

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.
Files changed (56) hide show
  1. package/alpha/docs/rag-docs/confirm.md +301 -0
  2. package/alpha/docs/rag-docs/init.md +422 -0
  3. package/alpha/docs/rag-docs/on_confirm.md +921 -0
  4. package/alpha/docs/rag-docs/on_init.md +823 -0
  5. package/alpha/docs/rag-docs/on_search.md +897 -0
  6. package/alpha/docs/rag-docs/on_select.md +522 -0
  7. package/alpha/docs/rag-docs/on_status.md +854 -0
  8. package/alpha/docs/rag-docs/on_update.md +921 -0
  9. package/alpha/docs/rag-docs/search.md +678 -0
  10. package/alpha/docs/rag-docs/select.md +344 -0
  11. package/alpha/docs/rag-docs/status.md +178 -0
  12. package/alpha/docs/rag-docs/update.md +229 -0
  13. package/alpha/docs/rag-table-docs/confirm.md +63 -0
  14. package/alpha/docs/rag-table-docs/init.md +81 -0
  15. package/alpha/docs/rag-table-docs/on_confirm.md +164 -0
  16. package/alpha/docs/rag-table-docs/on_init.md +146 -0
  17. package/alpha/docs/rag-table-docs/on_search.md +163 -0
  18. package/alpha/docs/rag-table-docs/on_select.md +99 -0
  19. package/alpha/docs/rag-table-docs/on_status.md +153 -0
  20. package/alpha/docs/rag-table-docs/on_update.md +164 -0
  21. package/alpha/docs/rag-table-docs/raw_table.json +11198 -0
  22. package/alpha/docs/rag-table-docs/search.md +128 -0
  23. package/alpha/docs/rag-table-docs/select.md +70 -0
  24. package/alpha/docs/rag-table-docs/status.md +44 -0
  25. package/alpha/docs/rag-table-docs/update.md +51 -0
  26. package/alpha/docs/validPaths.json +34134 -0
  27. package/alpha/possible-json-paths.json +34134 -0
  28. package/alpha/table/rag-table-docs/confirm.md +3 -0
  29. package/alpha/table/rag-table-docs/init.md +3 -0
  30. package/alpha/table/rag-table-docs/on_confirm.md +3 -0
  31. package/alpha/table/rag-table-docs/on_init.md +3 -0
  32. package/alpha/table/rag-table-docs/on_search.md +3 -0
  33. package/alpha/table/rag-table-docs/on_select.md +3 -0
  34. package/alpha/table/rag-table-docs/on_status.md +3 -0
  35. package/alpha/table/rag-table-docs/on_update.md +3 -0
  36. package/alpha/table/rag-table-docs/search.md +3 -0
  37. package/alpha/table/rag-table-docs/select.md +3 -0
  38. package/alpha/table/rag-table-docs/status.md +3 -0
  39. package/alpha/table/rag-table-docs/update.md +3 -0
  40. package/dist/generator/config-compiler.d.ts +16 -2
  41. package/dist/generator/config-compiler.js +45 -19
  42. package/dist/generator/generators/classes/abstract-generator.d.ts +2 -0
  43. package/dist/generator/generators/documentation/markdown-message-generator.js +4 -1
  44. package/dist/generator/generators/documentation/md-generator.d.ts +2 -1
  45. package/dist/generator/generators/documentation/md-generator.js +3 -2
  46. package/dist/generator/generators/go/go-generator.js +1 -1
  47. package/dist/generator/generators/javascript/js-generator.js +1 -1
  48. package/dist/generator/generators/python/py-generator.js +1 -1
  49. package/dist/generator/generators/rag/rag-generator.d.ts +39 -28
  50. package/dist/generator/generators/rag/rag-generator.js +149 -103
  51. package/dist/generator/generators/rag/rag-table-generator.d.ts +7 -1
  52. package/dist/generator/generators/rag/rag-table-generator.js +24 -8
  53. package/dist/generator/generators/typescript/ts-generator.js +1 -1
  54. package/dist/index.test.js +12 -3
  55. package/dist/types/build.d.ts +4 -0
  56. package/package.json +1 -1
@@ -3,11 +3,14 @@ action: confirm
3
3
  codeName: L1validations
4
4
  numTests: 45
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `confirm` Validations (Table View)
9
11
 
10
12
  **36** leaf validation rule(s) applied to `confirm` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: init
3
3
  codeName: L1validations
4
4
  numTests: 63
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `init` Validations (Table View)
9
11
 
10
12
  **49** leaf validation rule(s) applied to `init` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_confirm
3
3
  codeName: L1validations
4
4
  numTests: 146
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_confirm` Validations (Table View)
9
11
 
10
12
  **109** leaf validation rule(s) applied to `on_confirm` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_init
3
3
  codeName: L1validations
4
4
  numTests: 128
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_init` Validations (Table View)
9
11
 
10
12
  **95** leaf validation rule(s) applied to `on_init` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_search
3
3
  codeName: L1validations
4
4
  numTests: 145
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_search` Validations (Table View)
9
11
 
10
12
  **115** leaf validation rule(s) applied to `on_search` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_select
3
3
  codeName: L1validations
4
4
  numTests: 81
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_select` Validations (Table View)
9
11
 
10
12
  **61** leaf validation rule(s) applied to `on_select` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_status
3
3
  codeName: L1validations
4
4
  numTests: 135
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_status` Validations (Table View)
9
11
 
10
12
  **101** leaf validation rule(s) applied to `on_status` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: on_update
3
3
  codeName: L1validations
4
4
  numTests: 146
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `on_update` Validations (Table View)
9
11
 
10
12
  **109** leaf validation rule(s) applied to `on_update` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: search
3
3
  codeName: L1validations
4
4
  numTests: 110
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `search` Validations (Table View)
9
11
 
10
12
  **88** leaf validation rule(s) applied to `search` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: select
3
3
  codeName: L1validations
4
4
  numTests: 52
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `select` Validations (Table View)
9
11
 
10
12
  **40** leaf validation rule(s) applied to `select` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: status
3
3
  codeName: L1validations
4
4
  numTests: 26
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `status` Validations (Table View)
9
11
 
10
12
  **22** leaf validation rule(s) applied to `status` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -3,11 +3,14 @@ action: update
3
3
  codeName: L1validations
4
4
  numTests: 33
5
5
  generated: 2026-03-10
6
+ domain: -
7
+ version: -
6
8
  ---
7
9
 
8
10
  # L1validations — `update` Validations (Table View)
9
11
 
10
12
  **27** leaf validation rule(s) applied to `update` in the **L1validations** flow.
13
+ Domain: `-`, Version: `-`
11
14
  Group rows (GRP) list their immediate sub-tests. Leaf rows (LF) show the actual validation logic.
12
15
 
13
16
  ---
@@ -15,15 +15,29 @@ export declare class ConfigCompiler {
15
15
  errorDefinitions: ErrorDefinition[] | undefined;
16
16
  generatorConfig: CodeGeneratorConfig | undefined;
17
17
  language: SupportedLanguages;
18
+ domain?: string | string[];
19
+ version?: string;
18
20
  private SchemaExtractionService;
19
21
  constructor(language: SupportedLanguages);
20
22
  initialize: (buildYaml: string, generatorConfig?: Partial<CodeGeneratorConfig>) => Promise<void>;
21
23
  performValidations: (valConfig: ValidationConfig) => Promise<void>;
22
24
  withMinimalValidations: (valConfig: ValidationConfig) => Promise<void>;
23
- generateCode: (valConfig: ValidationConfig, codeName?: string, minimal?: boolean, outputPath?: string, absolutePath?: boolean, goPackageName?: string) => Promise<void>;
25
+ generateCode: (valConfig: ValidationConfig, codeGenConfig?: CodeGenConfig | string) => Promise<void>;
24
26
  generateL0Schema: (outputPath?: string, type?: "json" | "typescript", absolutePath?: boolean) => Promise<void>;
25
27
  generateValidPaths: () => Promise<Record<string, string[]>>;
26
- generateValidationFromBuild: (codeName: string, outputPath: string, absolutePath?: boolean, goPackageName?: string) => Promise<void>;
28
+ generateValidationFromBuild: (codeGenConfig: CodeGenConfig | string, outputPath?: string, absolutePath?: boolean, goPackageName?: string) => Promise<void>;
27
29
  extractPayloadsFromBuild: (outputPath: string) => Promise<void>;
28
30
  }
31
+ export type CodeGenConfig = {
32
+ codeName: string;
33
+ goPkgName?: string;
34
+ domain?: string | string[];
35
+ version?: string;
36
+ /** Skip full path/enum validations and run minimal checks only. Default: false */
37
+ minimal?: boolean;
38
+ /** Base output directory. Default: "./" */
39
+ outputPath?: string;
40
+ /** Treat outputPath as absolute (skip prepending "generated/<codeName>"). Default: false */
41
+ absolutePath?: boolean;
42
+ };
29
43
  export {};
@@ -34,9 +34,10 @@ export class ConfigCompiler {
34
34
  this.SchemaExtractionService.extractPossiblePaths(this.jsonSchemas);
35
35
  const errors = this.buildData["x-errorcodes"];
36
36
  this.errorDefinitions = errors.code;
37
+ this.domain = this.buildData.info?.domain;
38
+ this.version = this.buildData.info?.version;
37
39
  };
38
40
  this.performValidations = async (valConfig) => {
39
- // try {
40
41
  if (!this.buildData)
41
42
  throw new Error("Build data not initialized");
42
43
  if (!this.jsonSchemas)
@@ -46,22 +47,19 @@ export class ConfigCompiler {
46
47
  if (!this.errorDefinitions)
47
48
  throw new Error("Error definitions not initialized");
48
49
  await new ConfigValidator("", valConfig, this.possibleJsonPaths, this.errorDefinitions).validate();
49
- // } catch (e) {
50
- // logger.error(e);
51
- // throw new Error(e as any);
52
- // }
53
50
  };
54
51
  this.withMinimalValidations = async (valConfig) => {
55
- // try {
56
52
  await new ConfigValidator("", valConfig, {}, [], {
57
53
  minimal: true,
58
54
  }).validate();
59
- // } catch (e) {
60
- // logger.error(e);
61
- // throw new Error("validation failed");
62
55
  };
63
- // };
64
- this.generateCode = async (valConfig, codeName = "L1-Validations", minimal = false, outputPath = "./", absolutePath = false, goPackageName = "validationpkg") => {
56
+ this.generateCode = async (valConfig, codeGenConfig = "L1-Validations") => {
57
+ // Accept either the new CodeGenConfig object or the legacy positional
58
+ // string (codeName) so existing call-sites continue to work.
59
+ const config = typeof codeGenConfig === "string"
60
+ ? { codeName: codeGenConfig }
61
+ : codeGenConfig;
62
+ const { codeName = "L1-Validations", goPkgName = "validationpkg", minimal = false, outputPath = "./", absolutePath = false, domain = this.domain, version = this.version, } = config;
65
63
  try {
66
64
  console.log("[ CODE GENERATION ] Starting code generation...");
67
65
  valConfig = JSON.parse(JSON.stringify(valConfig));
@@ -82,35 +80,51 @@ export class ConfigCompiler {
82
80
  case SupportedLanguages.Typescript:
83
81
  await new TypescriptGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
84
82
  codeName: codeName,
83
+ domain: domain,
84
+ version: version,
85
85
  });
86
86
  break;
87
87
  case SupportedLanguages.Python:
88
88
  await new PythonGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
89
89
  codeName: codeName,
90
+ domain: domain,
91
+ version: version,
90
92
  });
91
93
  break;
92
94
  case SupportedLanguages.Javascript:
93
95
  await new JavascriptGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
94
96
  codeName: codeName,
97
+ domain: domain,
98
+ version: version,
95
99
  });
96
100
  break;
97
101
  case SupportedLanguages.Golang:
98
102
  await new GoGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
99
103
  codeName: codeName,
100
- goPkgName: goPackageName,
104
+ goPkgName: goPkgName,
105
+ domain: domain,
106
+ version: version,
101
107
  });
102
108
  break;
103
109
  case SupportedLanguages.Markdown:
104
- await new MarkdownDocGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode();
110
+ await new MarkdownDocGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
111
+ codeName: codeName,
112
+ domain: domain,
113
+ version: version,
114
+ });
105
115
  break;
106
116
  case SupportedLanguages.RAG:
107
117
  await new RagGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
108
118
  codeName: codeName,
119
+ domain: domain,
120
+ version: version,
109
121
  });
110
122
  break;
111
123
  case SupportedLanguages.RAG_TABLE:
112
124
  await new RagTableGenerator(valConfig, this.errorDefinitions ?? [], targetPath).generateCode({
113
125
  codeName: codeName,
126
+ domain: domain,
127
+ version: version,
114
128
  });
115
129
  break;
116
130
  default:
@@ -156,19 +170,31 @@ export class ConfigCompiler {
156
170
  this.generateValidPaths = async () => {
157
171
  if (!this.possibleJsonPaths)
158
172
  throw new Error("Possible paths not initialized");
159
- // writeFileSync(
160
- // "./validPaths.json",
161
- // JSON.stringify(this.possibleJsonPaths, null, 2)
162
- // );
163
173
  return this.possibleJsonPaths;
164
174
  };
165
- this.generateValidationFromBuild = async (codeName, outputPath, absolutePath = false, goPackageName = "validationpkg") => {
175
+ this.generateValidationFromBuild = async (codeGenConfig, outputPath, absolutePath, goPackageName) => {
166
176
  if (!this.buildData)
167
177
  throw new Error("Build data not initialized");
168
178
  const valConfig = this.buildData["x-validations"];
169
179
  if (!valConfig)
170
180
  throw new Error("No validation config found in build data");
171
- await this.generateCode(valConfig, codeName, false, outputPath, absolutePath, goPackageName);
181
+ // Support legacy positional call: (codeName, outputPath, absolutePath, goPkgName)
182
+ const config = typeof codeGenConfig === "string"
183
+ ? {
184
+ codeName: codeGenConfig,
185
+ outputPath: outputPath ?? "./",
186
+ absolutePath: absolutePath ?? false,
187
+ goPkgName: goPackageName ?? "validationpkg",
188
+ domain: this.buildData.info?.domain,
189
+ version: this.buildData.info?.version,
190
+ }
191
+ : {
192
+ ...codeGenConfig,
193
+ domain: codeGenConfig.domain ?? this.buildData?.info?.domain,
194
+ version: codeGenConfig.version ??
195
+ this.buildData?.info?.version,
196
+ };
197
+ await this.generateCode(valConfig, config);
172
198
  };
173
199
  this.extractPayloadsFromBuild = async (outputPath) => {
174
200
  if (!this.buildData)
@@ -3,6 +3,8 @@ import { ErrorDefinition } from "../../../types/error-codes";
3
3
  export type CodeGeneratorProps = {
4
4
  codeName: string;
5
5
  goPkgName?: string;
6
+ domain?: string | string[];
7
+ version?: string;
6
8
  };
7
9
  export declare abstract class CodeGenerator {
8
10
  validationConfig: ValidationConfig;
@@ -13,7 +13,10 @@ export function markdownMessageGenerator(returnInput, variableValues, startingPo
13
13
  const ast = buildAstFromInput(returnInput);
14
14
  const returnTemplate = variableValues[TestObjectSyntax.Description]
15
15
  ? variableValues[TestObjectSyntax.Description]
16
- : CompileToMarkdown(ast, /*topLevel*/ true, /*depth*/ 0, /*forNot*/ false);
16
+ : CompileToMarkdown(ast,
17
+ /*topLevel*/ true,
18
+ /*depth*/ 0,
19
+ /*forNot*/ false);
17
20
  let finalReturn = `#### **${startingPointer}**\n\n` +
18
21
  Mustache.render(returnTemplate, ConvertArrayToStringsInTestObject(variableValues));
19
22
  if (skipInput && skipInput.length > 0) {
@@ -11,6 +11,7 @@ import { CodeGenerator, CodeGeneratorProps } from "../classes/abstract-generator
11
11
  export declare class MarkdownDocGenerator extends CodeGenerator {
12
12
  generateSessionDataCode(): Promise<void>;
13
13
  generateUnitTestingCode(): Promise<void>;
14
+ codeConfig: CodeGeneratorProps | undefined;
14
15
  generateValidationCode: () => Promise<void>;
15
- generateCode: (_codeConfig?: CodeGeneratorProps) => Promise<void>;
16
+ generateCode: (codeConfig: CodeGeneratorProps) => Promise<void>;
16
17
  }
@@ -29,7 +29,7 @@ export class MarkdownDocGenerator extends CodeGenerator {
29
29
  let finalMarkdown = "";
30
30
  for (const action of Object.keys(testConfig)) {
31
31
  const section = tableGen.buildActionMarkdown(action, action, // use action name as codeName heading inside the doc
32
- testConfig[action]);
32
+ testConfig[action], this.codeConfig);
33
33
  finalMarkdown += `\n\n${section}`;
34
34
  }
35
35
  finalMarkdown = finalMarkdown.trimStart();
@@ -41,7 +41,8 @@ export class MarkdownDocGenerator extends CodeGenerator {
41
41
  }));
42
42
  writeFileWithFsExtra(this.rootPath, "./page/style.css", cssData);
43
43
  };
44
- this.generateCode = async (_codeConfig) => {
44
+ this.generateCode = async (codeConfig) => {
45
+ this.codeConfig = codeConfig; // store for use in generateValidationCode
45
46
  await this.generateValidationCode();
46
47
  };
47
48
  }
@@ -42,7 +42,7 @@ export class GoGenerator extends CodeGenerator {
42
42
  await writeAndFormatCode(this.rootPath, `./${this.codeConfig.goPkgName}/go.mod`, goModCode, "text");
43
43
  await this.generateSessionDataCode();
44
44
  await this.generateUnitTestingCode();
45
- await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode();
45
+ await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode(codeConfig);
46
46
  };
47
47
  this.generateTestFunction = async (testObject) => {
48
48
  const template = readFileSync(path.resolve(__dirname, "./templates/test-object.mustache"), "utf-8");
@@ -45,7 +45,7 @@ export class JavascriptGenerator extends CodeGenerator {
45
45
  await this.generatePackageJson(codeConfig.codeName);
46
46
  // Step 6: Generate documentation
47
47
  logger.debug("Step 6: Generating documentation");
48
- await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode();
48
+ await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode(codeConfig);
49
49
  // Step 7: Clean up temporary files
50
50
  logger.debug("Step 7: Cleaning up temporary files");
51
51
  await this.cleanup();
@@ -107,7 +107,7 @@ export class PythonGenerator extends CodeGenerator {
107
107
  await writeAndFormatCode(this.rootPath, "requirements.txt", requirements, "text");
108
108
  await writeAndFormatCode(this.rootPath, "error.py", this.generateErrorFile(this.errorCodes), "python");
109
109
  await writeAndFormatCode(this.rootPath, "__init__.py", this.generateIndexFile(apiNames, codeConfig.codeName), "python");
110
- await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode();
110
+ await new MarkdownDocGenerator(this.validationConfig, this.errorCodes, this.rootPath).generateCode(codeConfig);
111
111
  await this.generateSessionDataCode();
112
112
  };
113
113
  this.generateTestFunction = async (testObject) => {
@@ -1,18 +1,23 @@
1
1
  import { CodeGenerator, CodeGeneratorProps } from "../classes/abstract-generator.js";
2
2
  /**
3
- * RagGenerator — produces one Markdown file per API action under ./rag-docs/.
3
+ * RagGenerator — produces one richly structured Markdown file per API action
4
+ * under `./rag-docs/`, designed for direct RAG pipeline ingestion.
4
5
  *
5
- * Each file is a self-contained, richly structured document intended to be
6
- * fed directly into a Retrieval-Augmented Generation (RAG) pipeline.
7
- *
8
- * Layout per file:
6
+ * Format:
7
+ * ---
8
+ * YAML frontmatter (action, codeName, numTests, generated, domain, version)
9
9
  * ---
10
- * YAML frontmatter (action, codeName, numTests, generated date)
10
+ * # Heading + context paragraph
11
+ *
12
+ * ## TOP_LEVEL_GROUP
13
+ * Prose intro listing child names, scope, skip condition.
11
14
  * ---
12
- * # <codeName> — <action> Validations
13
- * Short context paragraph
14
- * Numbered list of every test with its human-readable description,
15
- * error code, scope, and (indented) skip condition when present.
15
+ * ### CHILD_GROUP
16
+ * **LEAF_NAME**
17
+ * `group: PATH | type: leaf | error_code: X`
18
+ *
19
+ * - bullet description lines
20
+ * - Skipped if ...
16
21
  */
17
22
  export declare class RagGenerator extends CodeGenerator {
18
23
  generateSessionDataCode(): Promise<void>;
@@ -20,29 +25,35 @@ export declare class RagGenerator extends CodeGenerator {
20
25
  generateValidationCode: () => Promise<void>;
21
26
  generateCode: (codeConfig: CodeGeneratorProps) => Promise<void>;
22
27
  private buildActionMarkdown;
23
- /** Count only leaf (non-group) tests recursively. */
28
+ /** Counts leaf (non-group) tests recursively. */
24
29
  private countLeafTests;
30
+ /** Formats a list of names as English prose: "A, B, and C". */
31
+ private englishList;
25
32
  /**
26
- * Renders a numbered top-level section (##) for a test object.
27
- *
28
- * - Leaf test full human-readable description + metadata badges
29
- * - Group node → brief intro line + all children rendered as ### sub-sections
30
- * (recursing further for deeply nested groups)
31
- *
32
- * This preserves the parent→child relationship in the output so RAG
33
- * consumers can see exactly which sub-validations belong to which group.
33
+ * Top-level `##` section.
34
+ * - Leaf → `## NAME` + metadata line + body
35
+ * - Group`## NAME` + prose intro + `---` + children
36
+ */
37
+ private buildTopLevelSection;
38
+ /**
39
+ * Renders a group section recursively.
40
+ * @param headingLevel Markdown heading for this group node (e.g. "##")
41
+ * @param childLevel Markdown heading for its direct children (e.g. "###")
42
+ * @param ancestorPath Names of ancestor groups, used to build breadcrumbs
34
43
  */
35
- private buildTestSection;
44
+ private renderGroupSection;
36
45
  /**
37
- * Renders a child/nested section at the given heading level.
38
- * Recurses deeper (####, #####, …) for nested groups.
46
+ * Renders a leaf node's full content block:
47
+ * **NAME**
48
+ * `group: PATH | type: leaf | error_code: X`
49
+ *
50
+ * - bullet description lines
51
+ * - Skipped if ... (inline, from markdownMessageGenerator)
39
52
  */
40
- private renderChildSection;
53
+ private renderLeafBody;
41
54
  /**
42
- * Renders the skip block for a group node as a blockquote.
43
- * Returns an empty string when there is no _CONTINUE_ on this node.
55
+ * Renders a group's skip condition as a blockquote paragraph.
56
+ * Uses markdownMessageGenerator to compile the JVAL expression.
44
57
  */
45
- private renderSkipBlock;
46
- /** Renders a leaf test's heading, metadata badges, and compiled description. */
47
- private renderLeaf;
58
+ private renderSkipInlineBullet;
48
59
  }