or run

npx @tessl/cli init
Log in

Version

Files

docs

cli.mdindex.mdprogrammatic-api.md
tile.json

task.mdevals/scenario-6/

JSDoc Data Analyzer

Build a command-line tool that analyzes JavaScript source files and outputs structured information about their documented APIs in multiple formats.

Requirements

Your tool should accept a JavaScript file path as a command-line argument and provide three different analysis outputs:

JSON Data Output

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.

Template Data Output

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.

Namepath Listing

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.

Default Behavior

When run without any flags, display a help message explaining the available options.

Test Cases

  • Given a file example.js containing a documented function, running the tool with --json outputs valid JSON containing JSDoc data @test
  • Given a file example.js containing a documented class, running the tool with --template outputs valid JSON containing structured template data @test
  • Given a file example.js containing multiple documented elements, running the tool with --namepaths outputs a JSON object with namepaths grouped by kind @test
  • Running the tool without arguments displays usage information @test

Implementation

@generates

API

/**
 * 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 };

Dependencies { .dependencies }

jsdoc-to-markdown { .dependency }

Provides JSDoc parsing and data extraction capabilities for analyzing JavaScript source files.