MCPcopy
hub / github.com/smapiot/piral / readValidators

Function readValidators

tools/generate-command-docs.js:90–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88}
89
90function readValidators() {
91 const baseDir = resolve(__dirname, validationFolder);
92
93 return readdirSync(baseDir)
94 .filter(
95 (file) =>
96 file.endsWith('.ts') && !file.endsWith('.test.ts') && (file.startsWith('pilet-') || file.startsWith('piral-')),
97 )
98 .map((file) => {
99 const path = resolve(baseDir, file);
100 const content = readFileSync(path, 'utf8');
101 return {
102 target: file.split('.')[0].split('-')[0],
103 name: file
104 .split('.')[0]
105 .split('-')
106 .filter((_, i) => i > 0)
107 .join('-'),
108 description: readValidatorDescription(content),
109 options: readValidatorOptions(content),
110 };
111 });
112}
113
114function getCommandData(retrieve) {
115 const data = {

Callers 1

generateCommandDocsFunction · 0.85

Calls 5

resolveFunction · 0.85
readValidatorDescriptionFunction · 0.85
readValidatorOptionsFunction · 0.85
mapMethod · 0.80
filterMethod · 0.65

Tested by

no test coverage detected