evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a command-line tool that analyzes JavaScript source files and outputs structured information about their documented APIs in multiple formats.
Your tool should accept a JavaScript file path as a command-line argument and provide three different analysis outputs:
When run with the --json flag, output the complete JSDoc data structure as JSON. This should include all parsed JSDoc information from the source file.
When run with the --template flag, output structured template data that could be used for documentation generation. This should be formatted as JSON and include organized information about all documented elements.
When run with the --namepaths flag, output a categorized list of all JSDoc namepaths found in the source, organized by their kind (e.g., functions, classes, properties). Format this as JSON with kinds as keys and arrays of namepaths as values.
When run without any flags, display a help message explaining the available options.
example.js containing a documented function, running the tool with --json outputs valid JSON containing JSDoc data @testexample.js containing a documented class, running the tool with --template outputs valid JSON containing structured template data @testexample.js containing multiple documented elements, running the tool with --namepaths outputs a JSON object with namepaths grouped by kind @test/**
* Main function that processes command-line arguments and generates the requested output
* @param {string[]} args - Command-line arguments
* @returns {Promise<void>}
*/
async function main(args) {
// Implementation
}
module.exports = { main };Provides JSDoc parsing and data extraction capabilities for analyzing JavaScript source files.